FatFs

Started by tha, May 05, 2022, 10:00:40 AM

Previous topic - Next topic

tha

http://elm-chan.org/fsw/ff/doc/error.html



Parameters
   fp
       ตัวชี้ไปยัง the open file object structure.

Return Values
ส่งคืนกลับ a non-zero value ถ้า a hard error ได้เกิดขึ้นแล้ว; ถ้าเป็นอย่างอื่นมันจะส่งคืนกลับ a zero.

Description
ในขบวนการปรับปรุงนี้, function นี้ถูกนำไปใช้เป็น a macro. มันไม่มีการตรวจสอบความถูกต้องใดๆและ mutual exclusion.


QuickInfo
มีให้ใช้งานเสมอ.

See Also
f_open, FIL

tha


tha

http://elm-chan.org/fsw/ff/doc/opendir.html



Parameters
   dp
       ตัวชี้ไปยัง the blank directory object เพื่อสร้าง a new one.
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ the directory name ที่จะถูกเปิด.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_PATH, FR_INVALID_NAME, FR_INVALID_OBJECT, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE, FR_TOO_MANY_OPEN_FILES

Description
The f_opendir function เปิด an exsisting directory และสร้าง a directory object สำหรับ f_readdir function ที่จะตามมา.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_MINIMIZE <= 1.

See Also
f_readdir, f_closedir, DIR


tha

http://elm-chan.org/fsw/ff/doc/closedir.html



Parameter
   dp
       ตัวชี้ไปยัง the open directory object structure ที่จะถูกปิด.

Return Values
FR_OK, FR_INT_ERR, FR_INVALID_OBJECT, FR_TIMEOUT

Description
The f_closedir function ปิด an open directory object. หลังจาก the function สำเร็จ, the directory object ใช้ไม่ได้อีกต่อไปและมันสามารถถูกละทิ้ง.
โปรดทราบว่า the directory object สามารถถูกละทิ้งโดยไม่มีขั้นตอนนี้ได้อีกด้วยเมื่อตัวเลือก FF_FS_LOCK ไม่ถูกเปิดใช้งาน. อย่างไรก็ตาม ไม่ขอแนะนำสำหรับ future compatibility.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_MINIMIZE <= 1.

See Also
f_opendir, f_readdir, DIR

tha

http://elm-chan.org/fsw/ff/doc/readdir.html



Parameters
   dp
       ตัวชี้ไปยัง the open directory object.
   fno
       ตัวชี้ไปยัง the file information structure เพื่อเก็บข้อมูลเกี่ยวกับรายการที่อ่าน. A null pointer กรอกลับ the read index ของ
       the directory.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_INVALID_OBJECT, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
The f_readdir function อ่าน a directory item, informations เกี่ยวกับ the object, จาก the open directory. Items ใน the directory สามารถถูกอ่านเป็นลำดับโดย f_readdir function calls. เมื่อทุก items ใน the directory ถูกอ่านแล้วและไม่มี item ให้อ่าน, a null string จะถูกเก็บลงใน the fno->fname[] โดยไม่มี any error. เมื่อ a null pointer ถูกให้ไปยัง the fno, the read index of the directory object จะถูกกรอกลับ. The f_rewinddir function ถูกจัดให้มีใช้เป็น a macro.

เมื่อ LFN ถูกเปิดใช้งาน, a member altname[] ถูกกำหนดใน the file information structure เพื่อเก็บ the short file name ของ the object. ถ้า the long file name ไม่สามารถเข้าถึงได้เนื่องจากเหตุผลที่แสดงรายการข้างล่าง, short file name จะถูกเก็บไปยัง the fname[] และ the altname[] มี a null string.
  •  The item ไม่มี LFN. (ไม่ใช่กรณีใน exFAT volume)
  •  FF_MAX_LFN ไม่เพียงพอเพื่อจัดการ the LFN. (ไม่ใช่กรณีใน FF_MAX_LFN == 255)
  •  FF_LFN_BUF ไม่เพียงพอเพื่อเก็บ the LFN.
  •  The LFN บรรจุบาง character ที่ไม่กำหนดใน current CP. (ไม่ใช่กรณีใน FF_LFN_UNICODE != 0)
มีปัญหาเกี่ยวกับ read directories ใน exFAT volume. The exFAT ไม่รองรับ short file name. นี้หมายความว่าไม่มี name สามารถถูกส่งคืนกลับตามเงื่อนไขข้างบนได้. หากเป็นกรณี, "?" ถูกส่งคืนกลับเป็น the file name เพื่อแสดงให้เห็นว่า the object ไม่สามารถเข้าถึงได้. เพื่อหลีกเลี่ยงปัญหานี้, กำหนดค่า FatFs FF_LFN_UNICODE != 0 and FF_MAX_LFN == 255 เพื่อรองรับคุณลักษณะทั้งหมดของ LFN specification.
Dot entries ("." and "..") ใน the sub-directory of FAT volume จะถูกกรองออกและพวกมันจะไม่เคยปรากฎใน the read items เนื่องจาก exFAT ไม่มี dot entries ใน the sub-directory.

QuickInfo
มีให้ใช้งานเมื่อ FF_FS_MINIMIZE <= 1.

Sample Code
(ตัวอย่างโค้ดดูในลิ้งค์เอานะครับ)

See Also
f_opendir, f_closedir, f_stat, FILINFO, DIR

tha

http://elm-chan.org/fsw/ff/doc/findfirst.html



Parameters
   dp
       ตัวชี้ไปยัง the blank directory object.
   fno
       ตัวชี้ไปยัง the file information structure เพื่อเก็บ the information เกี่ยวกับรายการที่พบ.
   path
       ตัวชี้ไปยัง the null-terminated string ที่ระบุ the directory name ที่จะถูกเปิด.
   pattern
       ตัวชี้ไปยัง the nul-terminated string ที่ระบุ the name matching pattern ที่จะถูกค้นหา. มันถูกอ้างอิงโดย f_findnext
       function ที่ตามมาอีกด้วย, ดังนั้น the string ต้องใช้ได้ขณะที่ the successive function calls.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_PATH, FR_INVALID_NAME, FR_INVALID_OBJECT, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT, FR_NOT_ENOUGH_CORE, FR_TOO_MANY_OPEN_FILES

Description
หลังจาก the directory ที่ระบุโดย path สามารถถูกเปิด, มันเริ่มค้นหา the directory เพื่อ items ที่มี the matching pattern ที่ระบุโดย pattern. ถ้า the first item ถูกพบ, the information เกี่ยวกับ the item จะถูกเก็บลงใน the file information structure fno. ถ้าไม่พบ,   fno->fname[] จะมี a null string.
The matching pattern string สามารถมีคำศัพท์ที่เป็นสัญลักษณ์แทนได้ ตัวอย่างเช่น:
  •  ? - character ใดๆ.
  •  - string ใดๆในความยาวสาม characters.
  •  * - string ใดๆในความยาวศูนย์หรือยาวกว่า.
  •  - string ใดๆในความยาวสี่หรือยาวกว่า.
เนื่องจาก the matching algorithm ใช้ recursion, number of wildcard terms ใน the matching pattern ถูกจำกัดที่สี่เพื่อจำกัด the stack usage. Any pattern ที่มี too many wildcard terms จะไม่ตรงกับ any name. ใน LFN configuration, มีเพียง fname[] ถูกทดสอบเมื่อ FF_USE_FIND == 1 และ altname[] ถูกทดสอบเมื่อ FF_USE_FIND == 2 ด้วย. มีความแตกต่างบางประการตามรายการด้านล่างระหว่าง FatFs และ standard systems ในเงื่อนไขการจับคู่.
  •  "*.*" ไม่เคยเข้าคู่ชื่อใดๆที่ไม่มีนามสกุลขณะที่มันเข้าคุ๋ชื่อใดๆที่มีหรือไม่มีนามสกุลใน standard systems.
  •  pattern ใดๆที่ลงท้ายด้วยจุดไม่เคยเข้าคู่ชื่อใดๆขณะที่มันเข้าคู่ the name ที่ไม่มี extensiton ใน standard systems.
  •  DBCS extended characters จะถูกเปรียบเทียบโดยคำนึงถึงขนาดตัวพิมพ์เมื่อ LFN ถูกเปิดใช้งานด้วย ANSI/OEM code API.

QuickInfo
นี้คือ a wrapper function ของ f_opendir and f_readdir function. มีให้ใช้งานเมื่อ FF_USE_FIND >= 1 and FF_FS_MINIMIZE <= 1.

Examples


See Also
f_findnext, f_closedir, DIR, FILINFO

tha

http://elm-chan.org/fsw/ff/doc/findnext.html



Parameters
   dp
       ตัวชี้ไปยัง the valid directory object ที่สร้างขึ้นโดย f_findfirst function.
   fno
       ตัวชี้ไปยัง the file information structure เพื่อเก็บ the information เกี่ยวกับ the found directory item.

Return Values
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_INVALID_OBJECT, FR_TIMEOUT, FR_NOT_ENOUGH_CORE

Description
มันต่อเนื่องการค้นหาจากการเรียกก่อนหน้าถึง the f_findfirst or f_findnext function. ถ้าพบ, the information เกี่ยวกับ the object จะถูกเก็บลงใน the file information structure. ถ้าไม่มี item ที่ถูกอ่าน, a null string จะถูกส่งคืนกลับลงใน fno->fname[].

QuickInfo
นี้คือ a wrapper function ของ f_readdir function. มีให้ใช้งานเมื่อ FF_USE_FIND >= 1 and FF_FS_MINIMIZE <= 1.

See Also
f_findfirst, f_closedir, DIR, FILINFO

tha