|
Functions | |
| __PFAT_VOLUME | __fatGetVolumeFromFatFS (__PFAT_FATFS fs) |
| __STATIC __PDEVICE | __fatGetDevice (u8 drv) |
Retrieves a device pointer from the drv index. | |
| __STATIC __PFAT_VOLUME | __fatCreateVolume (u8 num, __PFAT_FATFS fat, __PDEVICE dv) |
| Creates a new volume. | |
| __STATIC __VOID | __fatFreeVolume (__PFAT_VOLUME vol) |
| Deallocates a volume structure. | |
Fat functions.
Definition at line 81 of file fat.c.
{
__PFAT_VOLUME vol = __fatVolumes;
while (vol)
{
if (vol->fat == fs) return vol;
vol = vol->next;
}
return __NULL;
}
| __STATIC __PDEVICE __fatGetDevice | ( | u8 | drv | ) |
Retrieves a device pointer from the drv index.
Internal function.
| drv | Index of the device. |
Definition at line 102 of file fat.c.
{
__PFAT_VOLUME vol = __fatVolumes;
while (vol)
{
if (vol->num == drv) return vol->dv;
vol = vol->next;
}
return __NULL;
}
| __STATIC __PFAT_VOLUME __fatCreateVolume | ( | u8 | num, |
| __PFAT_FATFS | fat, | ||
| __PDEVICE | dv | ||
| ) |
Creates a new volume.
The allocated volume structure must be freed with the __fatFreeVolume() function. Internal function.
| num | Volume number. |
| fat | Pointer to a __FAT_FATFS structure. The function will only copy the pointer, so destroy it (if it was dynamically created) after calling __fatFreeVolume(). |
| dv | Pointer to the device that manages the volume. |
Definition at line 129 of file fat.c.
{
__PFAT_VOLUME ptr = __fatVolumes;
__PFAT_VOLUME last = ptr;
__systemStop();
/* Find a position */
while (ptr)
{
last = ptr;
ptr = ptr->next;
}
ptr = (__PFAT_VOLUME) __heapAllocZero(sizeof(__FAT_VOLUME));
if (!ptr) return __NULL;
ptr->num = num;
ptr->fat = fat;
ptr->dv = dv;
ptr->next = __NULL;
if (!last)
{
__fatVolumes = ptr;
} else
{
last->next = ptr;
}
__systemStart();
return ptr;
}

Deallocates a volume structure.
Deallocates a volume structure previously created with the __fatAllocVolume() function.
| vol | Pointer to a __FAT_VOLUME structure previously created with __fatCreateVolume(). |
Definition at line 176 of file fat.c.
{
__PFAT_VOLUME ptr = __fatVolumes;
__PFAT_VOLUME last = ptr;
__systemStop();
/* Find the position */
while (ptr) {
if (ptr == vol)
{
if (vol == __fatVolumes)
{
__fatVolumes = __fatVolumes->next;
} else
{
last->next = ptr->next;
}
__heapFree(vol);
}
last = ptr;
ptr = ptr->next;
}
}
