Milos RTOS v0.3.4a
Real Time Operating System
Private functions
Collaboration diagram for Private functions:

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.

Detailed Description

Fat functions.


Function Documentation

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;
}

Retrieves a device pointer from the drv index.

Internal function.

Parameters:
drvIndex of the device.
Returns:
A pointer to the device on success, otherwise __NULL.

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;
}

Creates a new volume.

The allocated volume structure must be freed with the __fatFreeVolume() function. Internal function.

Parameters:
numVolume number.
fatPointer to a __FAT_FATFS structure. The function will only copy the pointer, so destroy it (if it was dynamically created) after calling __fatFreeVolume().
dvPointer to the device that manages the volume.
Returns:
A pointer to the newly created 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;
}

Here is the call graph for this function:

Deallocates a volume structure.

Deallocates a volume structure previously created with the __fatAllocVolume() function.

Parameters:
volPointer to a __FAT_VOLUME structure previously created with __fatCreateVolume().
Returns:
Nothing.

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;
    }
}

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Defines