1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - FATFS - include
3   File:     api.h
4 
5   Copyright 2007-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-11-27#$
14   $Rev: 9432 $
15   $Author: yosizaki $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_FATFS_API_H_
19 #define NITRO_FATFS_API_H_
20 
21 
22 #include <twl/fatfs/common/types.h>
23 
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
30 /*---------------------------------------------------------------------------*/
31 /* Functions */
32 
33 /*---------------------------------------------------------------------------*
34   Name:         FATFS_Init
35 
36   Description:  Initializes the FATFS library.
37 
38   Arguments:    None.
39 
40   Returns:      None.
41  *---------------------------------------------------------------------------*/
42 #ifdef  SDK_ARM9
43 void FATFS_Init(void);
44 #else
45 BOOL FATFS_Init(u32 dma1, u32 dma2, u32 priority);
46 #endif
47 
48 /*---------------------------------------------------------------------------*
49   Name:         FATFSi_IsInitialized
50 
51   Description:  Returns a value indicating whether the FATFS library has been initialized.
52 
53   Arguments:    None.
54 
55   Returns:      TRUE if it has been initialized.
56  *---------------------------------------------------------------------------*/
57 BOOL FATFSi_IsInitialized(void);
58 
59 /*---------------------------------------------------------------------------*
60   Name:         FATFSi_GetArcnameList
61 
62   Description:  Gets a list of accessible archive names.
63 
64   Arguments:    None.
65 
66   Returns:      A list of archive names delimited by the null character ('\0'), with two null characters ("\0\0") at the end.
67  *---------------------------------------------------------------------------*/
68 const char* FATFSi_GetArcnameList(void);
69 
70 /*---------------------------------------------------------------------------*
71   Name:         FATFS_GetLastError
72 
73   Description:  Gets the result of the last issued request.
74 
75   Arguments:    None.
76 
77   Returns:      None.
78  *---------------------------------------------------------------------------*/
79 u32 FATFS_GetLastError(void);
80 
81 /*---------------------------------------------------------------------------*
82   Name:         FATFS_RegisterResultBuffer
83 
84   Description:  Registers a command result buffer to associate with the calling thread.
85 
86   Arguments:    buffer: A FATFSResultBuffer structure.
87                 enable: TRUE to register and FALSE to unregister it
88 
89   Returns:      None.
90  *---------------------------------------------------------------------------*/
91 void FATFS_RegisterResultBuffer(FATFSResultBuffer *buffer, BOOL enable);
92 
93 /*---------------------------------------------------------------------------*
94   Name:         FATFS_MountDrive
95 
96   Description:  Mounts the specified NAND partition on a drive.
97 
98   Arguments:    name: The drive name (characters from 'A' to 'Z')
99                 partition: NAND partition number
100 
101   Returns:      TRUE if processing is successful.
102  *---------------------------------------------------------------------------*/
103 BOOL FATFS_MountDrive(const char *name, FATFSMediaType media, u32 partition);
104 
105 /*---------------------------------------------------------------------------*
106   Name:         FATFS_MountNAND
107 
108   Description:  Mounts the specified NAND partition on a drive.
109 
110   Arguments:    name: The drive name (characters from 'A' to 'Z')
111                 partition: NAND partition number
112 
113   Returns:      TRUE if processing is successful.
114  *---------------------------------------------------------------------------*/
FATFS_MountNAND(const char * name,u32 partition)115 SDK_INLINE BOOL FATFS_MountNAND(const char *name, u32 partition)
116 {
117     return FATFS_MountDrive(name, FATFS_MEDIA_TYPE_NAND, partition);
118 }
119 
120 /*---------------------------------------------------------------------------*
121   Name:         FATFS_UnmountDrive
122 
123   Description:  Unmounts the specified drive.
124 
125   Arguments:    name: The drive name (characters from 'A' to 'Z')
126 
127   Returns:      TRUE if processing is successful.
128  *---------------------------------------------------------------------------*/
129 BOOL FATFS_UnmountDrive(const char *name);
130 
131 /*---------------------------------------------------------------------------*
132   Name:         FATFS_SetDefaultDrive
133 
134   Description:  Selects the default drive.
135 
136   Arguments:    path: The path including the drive name
137 
138   Returns:      TRUE if processing is successful.
139  *---------------------------------------------------------------------------*/
140 BOOL FATFS_SetDefaultDrive(const char *path);
141 
142 /*---------------------------------------------------------------------------*
143   Name:         FATFS_FormatDrive
144 
145   Description:  Initializes the drive indicated by the specified path.
146 
147   Arguments:    path: The path including the drive name
148 
149   Returns:      TRUE if processing is successful.
150  *---------------------------------------------------------------------------*/
151 BOOL FATFS_FormatDrive(const char *path);
152 
153 /*---------------------------------------------------------------------------*
154   Name:         FATFSi_FormatDriveEx
155 
156   Description:  Initializes the entire media or the entire drive indicated by the specified path.
157 
158   Arguments:    path: The path including the drive name
159                 formatMedia: TRUE to erase the entire media
160 
161   Returns:      TRUE if processing is successful.
162  *---------------------------------------------------------------------------*/
163 BOOL FATFSi_FormatDriveEx(const char *path, BOOL formatMedia);
164 
165 /*---------------------------------------------------------------------------*
166   Name:         FATFSi_FormatMedia
167 
168   Description:  Initializes the entire media indicated by the specified path.
169 
170   Arguments:    path: The path including the drive name
171 
172   Returns:      TRUE if processing is successful.
173  *---------------------------------------------------------------------------*/
FATFSi_FormatMedia(const char * path)174 SDK_INLINE BOOL FATFSi_FormatMedia(const char *path)
175 {
176     return FATFSi_FormatDriveEx(path, TRUE);
177 }
178 
179 /*---------------------------------------------------------------------------*
180   Name:         FATFS_CheckDisk
181 
182   Description:  Checks disk content and fixes it if necessary.
183 
184   Arguments:    name: The drive name (characters from 'A' to 'Z')
185                 info: The FATFSDiskInfo structure to store the result
186                 verbose: TRUE to send checked content to debug output
187                 fixProblems: TRUE to fix FAT errors once they are detected
188                 writeChains: TRUE to recover files from isolated chains
189                               (this is only valid when fixProblems is enabled)
190 
191   Returns:      TRUE if processing is successful.
192  *---------------------------------------------------------------------------*/
193 BOOL FATFS_CheckDisk(const char *name, FATFSDiskInfo *info, BOOL verbose, BOOL fixProblems, BOOL writeChains);
194 
195 /*---------------------------------------------------------------------------*
196   Name:         FATFS_GetDriveResource
197 
198   Description:  Gets the amount of free disk space.
199 
200   Arguments:    path: The path including the drive name
201                 resource: The FATFSDriveResource structure to store the result
202 
203   Returns:      TRUE if processing is successful.
204  *---------------------------------------------------------------------------*/
205 BOOL FATFS_GetDriveResource(const char *path, FATFSDriveResource *resource);
206 
207 /*---------------------------------------------------------------------------*
208   Name:         FATFS_GetDiskSpace
209 
210   Description:  Gets the amount of free disk space.
211 
212   Arguments:    name: The drive name (characters from 'A' to 'Z')
213                 totalBlocks: A pointer to get the total block count or NULL
214                 freeBlocks: A pointer to get the free block count or NULL
215 
216   Returns:      The number of bytes of free space on success and -1 on failure.
217  *---------------------------------------------------------------------------*/
218 int FATFS_GetDiskSpace(const char *name, u32 *totalBlocks, u32 *freeBlocks);
219 
220 /*---------------------------------------------------------------------------*
221   Name:         FATFS_GetFileInfo
222 
223   Description:  Gets information for a file or directory.
224 
225   Arguments:    path: The path name
226                 info: The FATFSFileInfo structure to store the result
227 
228   Returns:      Gets information and returns TRUE if the specified path exists; otherwise, returns FALSE.
229  *---------------------------------------------------------------------------*/
230 BOOL FATFS_GetFileInfo(const char *path, FATFSFileInfo *info);
231 
232 /*---------------------------------------------------------------------------*
233   Name:         FATFS_SetFileInfo
234 
235   Description:  Changes file or directory information.
236 
237   Arguments:    path: The path name
238                 info: The FATFSFileInfo structure storing the information that should be changed
239 
240   Returns:      Changes information and returns TRUE if the specified path exists; otherwise, returns FALSE.
241  *---------------------------------------------------------------------------*/
242 BOOL FATFS_SetFileInfo(const char *path, const FATFSFileInfo *info);
243 
244 /*---------------------------------------------------------------------------*
245   Name:         FATFS_CreateFile
246 
247   Description:  Creates a file at the specified path.
248 
249   Arguments:    path: The path name
250                 trunc: TRUE to delete the file if it already exists
251                 permit: File access permissions (rwx){1,3}
252 
253   Returns:      TRUE if processing is successful.
254  *---------------------------------------------------------------------------*/
255 BOOL FATFS_CreateFile(const char *path, BOOL trunc, const char *permit);
256 
257 /*---------------------------------------------------------------------------*
258   Name:         FATFS_DeleteFile
259 
260   Description:  Deletes the specified file.
261 
262   Arguments:    path: The path name
263 
264   Returns:      TRUE if it was deleted successfully.
265  *---------------------------------------------------------------------------*/
266 BOOL FATFS_DeleteFile(const char *path);
267 
268 /*---------------------------------------------------------------------------*
269   Name:         FATFS_RenameFile
270 
271   Description:  Renames the specified file.
272 
273   Arguments:    path: The path name
274                 newpath: The new path name
275 
276   Returns:      TRUE if it was renamed successfully.
277  *---------------------------------------------------------------------------*/
278 BOOL FATFS_RenameFile(const char *path, const char *newpath);
279 
280 /*---------------------------------------------------------------------------*
281   Name:         FATFS_CreateDirectory
282 
283   Description:  Creates a directory at the specified path.
284 
285   Arguments:    path: The path name
286                 permit: Directory access permissions (rwx){1,3}
287 
288   Returns:      TRUE if processing is successful.
289  *---------------------------------------------------------------------------*/
290 BOOL FATFS_CreateDirectory(const char *path, const char *permit);
291 
292 /*---------------------------------------------------------------------------*
293   Name:         FATFS_DeleteDirectory
294 
295   Description:  Deletes the specified directory.
296 
297   Arguments:    path: The path name
298 
299   Returns:      TRUE if it was deleted successfully.
300  *---------------------------------------------------------------------------*/
301 BOOL FATFS_DeleteDirectory(const char *path);
302 
303 /*---------------------------------------------------------------------------*
304   Name:         FATFS_RenameDirectory
305 
306   Description:  Renames the specified directory.
307 
308   Arguments:    path: The path name
309                 newpath: The new path name
310 
311   Returns:      TRUE if it was renamed successfully.
312  *---------------------------------------------------------------------------*/
313 BOOL FATFS_RenameDirectory(const char *path, const char *newpath);
314 
315 /*---------------------------------------------------------------------------*
316   Name:         FATFS_OpenFile
317 
318   Description:  Opens the file at the specified path.
319 
320   Arguments:    path: The path name
321                 mode: File access mode ("r/w/r+/w+" and "b/t")
322 
323   Returns:      The opened file handle or NULL.
324  *---------------------------------------------------------------------------*/
325 FATFSFileHandle FATFS_OpenFile(const char *path, const char *mode);
326 
327 /*---------------------------------------------------------------------------*
328   Name:         FATFS_CloseFile
329 
330   Description:  Close the file
331 
332   Arguments:    file: File handle
333 
334   Returns:      TRUE on success.
335  *---------------------------------------------------------------------------*/
336 BOOL FATFS_CloseFile(FATFSFileHandle file);
337 
338 /*---------------------------------------------------------------------------*
339   Name:         FATFS_ReadFile
340 
341   Description:  Reads data from a file.
342 
343   Arguments:    file: File handle
344                 buffer: Location to store the data that is read
345                 length: The data size to read
346 
347   Returns:      The data size that was actually read or -1.
348  *---------------------------------------------------------------------------*/
349 int FATFS_ReadFile(FATFSFileHandle file, void *buffer, int length);
350 
351 /*---------------------------------------------------------------------------*
352   Name:         FATFS_WriteFile
353 
354   Description:  Writes data to a file.
355 
356   Arguments:    file: File handle
357                 buffer: Location storing the data to write
358                 length: Size to be written.
359 
360   Returns:      The data size that was actually written or -1.
361  *---------------------------------------------------------------------------*/
362 int FATFS_WriteFile(FATFSFileHandle file, const void *buffer, int length);
363 
364 /*---------------------------------------------------------------------------*
365   Name:         FATFS_SetSeekCache
366 
367   Description:  Assigns the cache buffer for a fast reverse seek.
368 
369   Arguments:    file: File handle
370                 buf: Cache buffer
371                 buf_size: The cache buffer size
372 
373   Returns:      TRUE on success.
374  *---------------------------------------------------------------------------*/
375 BOOL FATFS_SetSeekCache(FATFSFileHandle file, void* buf, u32 buf_size);
376 
377 /*---------------------------------------------------------------------------*
378   Name:         FATFS_SeekFile
379 
380   Description:  Moves a file pointer.
381 
382   Arguments:    file: File handle
383                 offset: The distance to move
384                 origin: The starting point to move from
385 
386   Returns:      The shifted offset or -1.
387  *---------------------------------------------------------------------------*/
388 int FATFS_SeekFile(FATFSFileHandle file, int offset, FATFSSeekMode origin);
389 
390 /*---------------------------------------------------------------------------*
391   Name:         FATFS_FlushFile
392 
393   Description:  Flushes file content to the drive.
394 
395   Arguments:    file: File handle
396 
397   Returns:      TRUE if it was flushed normally.
398  *---------------------------------------------------------------------------*/
399 BOOL FATFS_FlushFile(FATFSFileHandle file);
400 
401 /*---------------------------------------------------------------------------*
402   Name:         FATFS_GetFileLength
403 
404   Description:  Gets the file size.
405 
406   Arguments:    file: File handle
407 
408   Returns:      The file size or -1.
409  *---------------------------------------------------------------------------*/
410 int FATFS_GetFileLength(FATFSFileHandle file);
411 
412 /*---------------------------------------------------------------------------*
413   Name:         FATFS_SetFileLength
414 
415   Description:  Sets the file size.
416 
417   Arguments:    file: File handle
418 
419   Returns:      TRUE if it was set successfully.
420  *---------------------------------------------------------------------------*/
421 BOOL FATFS_SetFileLength(FATFSFileHandle file, int length);
422 
423 /*---------------------------------------------------------------------------*
424   Name:         FATFS_OpenDirectory
425 
426   Description:  Opens the directory at the specified path.
427 
428   Arguments:    path: The path name
429                 mode: Directory access mode (this is currently ignored)
430 
431   Returns:      The opened directory handle or NULL.
432  *---------------------------------------------------------------------------*/
433 FATFSDirectoryHandle FATFS_OpenDirectory(const char *path, const char *mode);
434 
435 /*---------------------------------------------------------------------------*
436   Name:         FATFS_CloseDirectory
437 
438   Description:  Closes a directory.
439 
440   Arguments:    dir: Directory handle
441 
442   Returns:      TRUE on success.
443  *---------------------------------------------------------------------------*/
444 BOOL FATFS_CloseDirectory(FATFSDirectoryHandle dir);
445 
446 /*---------------------------------------------------------------------------*
447   Name:         FATFS_ReadDirectory
448 
449   Description:  Reads the next entry information from a directory.
450 
451   Arguments:    dir: Directory handle
452                 info: Location to store the entry information
453 
454   Returns:      TRUE if the entry information was read normally.
455  *---------------------------------------------------------------------------*/
456 BOOL FATFS_ReadDirectory(FATFSDirectoryHandle dir, FATFSFileInfo *info);
457 
458 /*---------------------------------------------------------------------------*
459   Name:         FATFS_FlushAll
460 
461   Description:  Flushes all drive content to the device.
462 
463   Arguments:    None.
464 
465   Returns:      TRUE if processing is successful.
466  *---------------------------------------------------------------------------*/
467 BOOL FATFS_FlushAll(void);
468 
469 /*---------------------------------------------------------------------------*
470   Name:         FATFS_UnmountAll
471 
472   Description:  Unmounts all drives.
473 
474   Arguments:    None.
475 
476   Returns:      TRUE if processing is successful.
477  *---------------------------------------------------------------------------*/
478 BOOL FATFS_UnmountAll(void);
479 
480 /*---------------------------------------------------------------------------*
481   Name:         FATFS_MountSpecial
482 
483   Description:  Mounts a special drive.
484 
485   Arguments:    param: Parameter that indicates what to mount
486                 arcname: Archive name to mount
487                           You can specify "otherPub", "otherPrv", and "share".
488                           If NULL is specified, previously mounted drives will be unmounted
489                 slot: A buffer to store the assigned index.
490                           This will be set when mounting and accessed when unmounting.
491 
492   Returns:      TRUE if processing is successful.
493  *---------------------------------------------------------------------------*/
494 BOOL FATFS_MountSpecial(u64 param, const char *arcname, int *slot);
495 
496 /*---------------------------------------------------------------------------*
497   Name:         FATFS_FormatSpecial
498 
499   Description:  Re-initializes a special drive owned by the caller of this function.
500 
501   Arguments:    path: The path including the drive name
502 
503   Returns:      TRUE if processing is successful.
504  *---------------------------------------------------------------------------*/
505 BOOL FATFS_FormatSpecial(const char *path);
506 
507 /*---------------------------------------------------------------------------*
508   Name:         FATFS_SetLatencyEmulation
509 
510   Description:  Indicates that the drive layer should emulate the wait times that occur when accessing a deteriorated device.
511 
512 
513   Arguments:    enable: TRUE to enable this.
514 
515   Returns:      TRUE if processing is successful.
516  *---------------------------------------------------------------------------*/
517 BOOL FATFS_SetLatencyEmulation(BOOL enable);
518 
519 /*---------------------------------------------------------------------------*
520  * Versions with Unicode support
521  *---------------------------------------------------------------------------*/
522 
523 /*---------------------------------------------------------------------------*
524   Name:         FATFS_GetDriveResourceW
525 
526   Description:  Gets the amount of free disk space.
527 
528   Arguments:    path: The path including the drive name
529                 resource: The FATFSDriveResource structure to store the result
530 
531   Returns:      TRUE if processing is successful.
532  *---------------------------------------------------------------------------*/
533 BOOL FATFS_GetDriveResourceW(const u16 *path, FATFSDriveResource *resource);
534 
535 /*---------------------------------------------------------------------------*
536   Name:         FATFS_GetFileInfoW
537 
538   Description:  Gets information for a file or directory.
539 
540   Arguments:    path: The path name
541                 info: The FATFSFileInfoW structure to store the result
542 
543   Returns:      Gets information and returns TRUE if the specified path exists; otherwise, returns FALSE.
544  *---------------------------------------------------------------------------*/
545 BOOL FATFS_GetFileInfoW(const u16 *path, FATFSFileInfoW *info);
546 
547 /*---------------------------------------------------------------------------*
548   Name:         FATFS_SetFileInfoW
549 
550   Description:  Changes file or directory information.
551 
552   Arguments:    path: The path name
553                 info: The FATFSFileInfoW structure storing the information that should be changed
554 
555   Returns:      Changes information and returns TRUE if the specified path exists; otherwise, returns FALSE.
556  *---------------------------------------------------------------------------*/
557 BOOL FATFS_SetFileInfoW(const u16 *path, const FATFSFileInfoW *info);
558 
559 /*---------------------------------------------------------------------------*
560   Name:         FATFS_CreateFileW
561 
562   Description:  Creates a file at the specified path.
563 
564   Arguments:    path: The path name
565                 trunc: TRUE to delete the file if it already exists
566                 permit: File access permissions (rwx){1,3}
567 
568   Returns:      TRUE if processing is successful.
569  *---------------------------------------------------------------------------*/
570 BOOL FATFS_CreateFileW(const u16 *path, BOOL trunc, const char *permit);
571 
572 /*---------------------------------------------------------------------------*
573   Name:         FATFS_DeleteFileW
574 
575   Description:  Deletes the specified file.
576 
577   Arguments:    path: The path name
578 
579   Returns:      TRUE if it was deleted successfully.
580  *---------------------------------------------------------------------------*/
581 BOOL FATFS_DeleteFileW(const u16 *path);
582 
583 /*---------------------------------------------------------------------------*
584   Name:         FATFS_RenameFileW
585 
586   Description:  Renames the specified file.
587 
588   Arguments:    path: The path name
589                 newpath: The new path name
590 
591   Returns:      TRUE if it was renamed successfully.
592  *---------------------------------------------------------------------------*/
593 BOOL FATFS_RenameFileW(const u16 *path, const u16 *newpath);
594 
595 /*---------------------------------------------------------------------------*
596   Name:         FATFS_CreateDirectoryW
597 
598   Description:  Creates a directory at the specified path.
599 
600   Arguments:    path: The path name
601                 permit: File access permissions (rwx){1,3}
602 
603   Returns:      TRUE if processing is successful.
604  *---------------------------------------------------------------------------*/
605 BOOL FATFS_CreateDirectoryW(const u16 *path, const char *permit);
606 
607 /*---------------------------------------------------------------------------*
608   Name:         FATFS_DeleteDirectoryW
609 
610   Description:  Deletes the specified directory.
611 
612   Arguments:    path: The path name
613 
614   Returns:      TRUE if it was deleted successfully.
615  *---------------------------------------------------------------------------*/
616 BOOL FATFS_DeleteDirectoryW(const u16 *path);
617 
618 /*---------------------------------------------------------------------------*
619   Name:         FATFS_RenameDirectoryW
620 
621   Description:  Renames the specified directory.
622 
623   Arguments:    path: The path name
624                 newpath: The new path name
625 
626   Returns:      TRUE if it was renamed successfully.
627  *---------------------------------------------------------------------------*/
628 BOOL FATFS_RenameDirectoryW(const u16 *path, const u16 *newpath);
629 
630 /*---------------------------------------------------------------------------*
631   Name:         FATFS_OpenFileW
632 
633   Description:  Opens the file at the specified path.
634 
635   Arguments:    path: The path name
636                 mode: File access mode ("r/w/r+/w+" and "b/t")
637 
638   Returns:      The opened file handle or NULL.
639  *---------------------------------------------------------------------------*/
640 FATFSFileHandle FATFS_OpenFileW(const u16 *path, const char *mode);
641 
642 /*---------------------------------------------------------------------------*
643   Name:         FATFS_OpenDirectoryW
644 
645   Description:  Opens the directory at the specified path.
646 
647   Arguments:    path: The path name
648                 mode: Directory access mode (this is currently ignored)
649 
650   Returns:      The opened directory handle or NULL.
651  *---------------------------------------------------------------------------*/
652 FATFSDirectoryHandle FATFS_OpenDirectoryW(const u16 *path, const char *mode);
653 
654 /*---------------------------------------------------------------------------*
655   Name:         FATFS_ReadDirectoryW
656 
657   Description:  Reads the next entry information from a directory.
658 
659   Arguments:    dir: Directory handle
660                 info: Location to store the entry information
661 
662   Returns:      TRUE if the entry information was read normally.
663  *---------------------------------------------------------------------------*/
664 BOOL FATFS_ReadDirectoryW(FATFSDirectoryHandle dir, FATFSFileInfoW *info);
665 
666 
667 /*---------------------------------------------------------------------------*
668  * Internal Functions
669  *---------------------------------------------------------------------------*
670 
671  /*---------------------------------------------------------------------------*
672   Name:         FATFSiArcnameList
673 
674   Description:  This static buffer maintains a list of archive names that are accessible from the ARM9.
675                 The memory must be accessible by both the ARM9 and ARM7. By default, static variables in the LTDMAIN segment are used.
676                 For applications constructed using a special memory layout, you can change these variables to set the appropriate buffer before calling the FATFS_Init function.
677 
678 
679 
680 
681   Arguments:    None.
682 
683   Returns:      A static buffer that maintains a list of archive names that are accessible from the ARM9.
684  *---------------------------------------------------------------------------*/
685 extern char *FATFSiArcnameList/* [MATH_ROUNDUP(OS_MOUNT_ARCHIVE_NAME_LEN * OS_MOUNT_INFO_MAX + 1, 32)] ATTRIBUTE_ALIGN(32) */;
686 
687 /*---------------------------------------------------------------------------*
688   Name:         FATFSiCommandBuffer
689 
690   Description:  This is a pointer to a static command buffer for issuing requests.
691                 The memory must be accessible by both the ARM9 and ARM7. By default, static variables in the LTDMAIN segment are used.
692                 For applications constructed using a special memory layout, you can change these variables to set the appropriate buffer before calling the FATFS_Init function.
693 
694 
695 
696 
697   Arguments:    None.
698 
699   Returns:      Static command buffer of FATFS_COMMAND_BUFFER_MAX bytes.
700  *---------------------------------------------------------------------------*/
701 extern u8 *FATFSiCommandBuffer/* [FATFS_COMMAND_BUFFER_MAX] ATTRIBUTE_ALIGN(32)*/;
702 
703 /*---------------------------------------------------------------------------*
704   Name:         FATFSi_GetUnicodeConversionTable
705 
706   Description:  Gets the Unicode conversion table for sharing with the ARM7.
707                 You can override and disable this function to delete the (slightly less than) 80KB Unicode conversion table for applications that will clearly handle only ASCII path names.
708 
709 
710 
711   Arguments:    u2s: A conversion table from Unicode to Shift JIS
712                 s2u: A conversion table from Shift JIS to Unicode
713 
714   Returns:      None.
715  *---------------------------------------------------------------------------*/
716 void FATFSi_GetUnicodeConversionTable(const u8 **u2s, const u16 **s2u);
717 
718 /*---------------------------------------------------------------------------*
719   Name:         FATFSi_SetNdmaParameters
720 
721   Description:  Directly changes the NDMA settings used by the ARM7's FAT drives.
722 
723   Arguments:    ndmaNo: The NDMA channel (0-3) for which to change the settings
724                 blockWord: The block transfer word count (MI_NDMA_BWORD_1-MI_NDMA_BWORD_32768)
725                 intervalTimer: The interval (0x0000-0xFFFF)
726                 prescaler: The prescaler (MI_NDMA_INTERVAL_PS_1-MI_NDMA_INTERVAL_PS_64)
727 
728   Returns:      None.
729  *---------------------------------------------------------------------------*/
730 void FATFSi_SetNdmaParameters(u32 ndmaNo, u32 blockWord, u32 intervalTimer, u32 prescaler);
731 
732 /*---------------------------------------------------------------------------*
733   Name:         FATFSi_SetRequestBuffer
734 
735   Description:  Configures a request buffer for changing the next command to be issued into an asynchronous process.
736 
737 
738   Arguments:    buffer: A FATFSRequestBuffer structure to use for request management.
739                          It must be aligned to boundaries at integer multiples of 32 bytes.
740 
741                 callback: The callback to invoke when the command has completed.
742 
743                 userdata: An arbitrary user-defined value to associate with the request buffer.
744 
745   Returns:      None.
746  *---------------------------------------------------------------------------*/
747 void FATFSi_SetRequestBuffer(FATFSRequestBuffer *buffer, void (*callback)(FATFSRequestBuffer *), void *userdata);
748 
749 
750 #ifdef __cplusplus
751 } /* extern "C" */
752 #endif
753 
754 /* NITRO_FATFS_API_H_ */
755 #endif
756