| Index: emcore/trunk/export/syscallwrappers.h |
| — | — | @@ -222,6 +222,7 @@ |
| 223 | 223 | #define read_battery_state __emcore_syscall->read_battery_state |
| 224 | 224 | #define tlsf_realign __emcore_syscall->tlsf_realign |
| 225 | 225 | #define realign __emcore_syscall->realign |
| | 226 | +#define fat_size_mv __emcore_syscall->fat_size_mv |
| 226 | 227 | |
| 227 | 228 | |
| 228 | 229 | #endif |
| Index: emcore/trunk/export/syscallapi.h |
| — | — | @@ -280,6 +280,7 @@ |
| 281 | 281 | typeof(read_battery_state) *read_battery_state; |
| 282 | 282 | typeof(tlsf_realign) *tlsf_realign; |
| 283 | 283 | typeof(realign) *realign; |
| | 284 | + typeof(fat_size_mv) *fat_size_mv; |
| 284 | 285 | }; |
| 285 | 286 | |
| 286 | 287 | |
| Index: emcore/trunk/syscallapi.c |
| — | — | @@ -244,5 +244,8 @@ |
| 245 | 245 | .read_input_mw = read_input_mw, |
| 246 | 246 | .read_battery_state = read_battery_state, |
| 247 | 247 | .tlsf_realign = tlsf_realign, |
| 248 | | - .realign = realign |
| | 248 | + .realign = realign, |
| | 249 | +#ifdef HAVE_STORAGE |
| | 250 | + .fat_size_mv = fat_size_mv |
| | 251 | +#endif |
| 249 | 252 | }; |
| Index: emcore/trunk/usb/usb.c |
| — | — | @@ -629,6 +629,7 @@ |
| 630 | 630 | case 51: // DISK_UNMOUNT
|
| 631 | 631 | #endif
|
| 632 | 632 | case 58: // FAT_ENABLE_FLUSHING
|
| | 633 | + case 59: // FAT_SIZE
|
| 633 | 634 | if (!set_dbgaction(DBGACTION_STORAGE, 0))
|
| 634 | 635 | memcpy(dbgasyncsendbuf, dbgrecvbuf, sizeof(dbgasyncsendbuf));
|
| 635 | 636 | break;
|
| — | — | @@ -951,6 +952,11 @@ |
| 952 | 953 | fat_enable_flushing((bool)(dbgasyncsendbuf[1]));
|
| 953 | 954 | usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
|
| 954 | 955 | break;
|
| | 956 | + case 59: // FAT_SIZE
|
| | 957 | + dbgasyncsendbuf[0] = 1;
|
| | 958 | + fat_size_mv(dbgasyncsendbuf[1], &dbgasyncsendbuf[1], &dbgasyncsendbuf[2]);
|
| | 959 | + usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
|
| | 960 | + break;
|
| 955 | 961 | }
|
| 956 | 962 | break;
|
| 957 | 963 | #endif
|
| Index: emcore/trunk/fat.c |
| — | — | @@ -250,11 +250,8 @@ |
| 251 | 251 | + fat_bpb->firstdatasector;
|
| 252 | 252 | }
|
| 253 | 253 |
|
| 254 | | -void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free)
|
| | 254 | +void fat_size_mv(int volume, unsigned long* size, unsigned long* free)
|
| 255 | 255 | {
|
| 256 | | -#ifndef HAVE_MULTIVOLUME
|
| 257 | | - const int volume = 0;
|
| 258 | | -#endif
|
| 259 | 256 | struct bpb* fat_bpb = &fat_bpbs[volume];
|
| 260 | 257 | if (size)
|
| 261 | 258 | *size = fat_bpb->dataclusters * (fat_bpb->bpb_secperclus * SECTOR_SIZE / 1024);
|
| — | — | @@ -262,6 +259,14 @@ |
| 263 | 260 | *free = fat_bpb->fsinfo.freecount * (fat_bpb->bpb_secperclus * SECTOR_SIZE / 1024);
|
| 264 | 261 | }
|
| 265 | 262 |
|
| | 263 | +void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free)
|
| | 264 | +{
|
| | 265 | +#ifndef HAVE_MULTIVOLUME
|
| | 266 | + const int volume = 0;
|
| | 267 | +#endif
|
| | 268 | + fat_size_mv(volume, size, free);
|
| | 269 | +}
|
| | 270 | +
|
| 266 | 271 | void fat_init(void)
|
| 267 | 272 | {
|
| 268 | 273 | unsigned int i;
|
| Index: emcore/trunk/fat.h |
| — | — | @@ -19,13 +19,22 @@ |
| 20 | 20 | *
|
| 21 | 21 | ****************************************************************************/
|
| 22 | 22 |
|
| | 23 | +
|
| 23 | 24 | #ifndef FAT_H
|
| 24 | 25 | #define FAT_H
|
| 25 | 26 |
|
| 26 | | -#ifndef IN_APPLICATION_CODE
|
| 27 | 27 |
|
| 28 | 28 | #include "global.h"
|
| 29 | 29 | #include "util.h"
|
| | 30 | +
|
| | 31 | +
|
| | 32 | +extern void fat_size_mv(int volume, unsigned long* size, unsigned long* free);
|
| | 33 | +extern void fat_enable_flushing(bool state);
|
| | 34 | +
|
| | 35 | +
|
| | 36 | +#ifndef IN_APPLICATION_CODE
|
| | 37 | +
|
| | 38 | +
|
| 30 | 39 | #include "mv.h" /* for volume definitions */
|
| 31 | 40 |
|
| 32 | 41 | #ifndef SECTOR_SIZE
|
| — | — | @@ -134,8 +143,8 @@ |
| 135 | 144 | extern void* fat_get_sector_buffer(void);
|
| 136 | 145 | extern void fat_release_sector_buffer(void);
|
| 137 | 146 |
|
| | 147 | +
|
| 138 | 148 | #endif
|
| 139 | 149 |
|
| 140 | | -extern void fat_enable_flushing(bool state);
|
| 141 | 150 |
|
| 142 | 151 | #endif
|