| 1 | = GIET-VM / FAT32 Handler = |
| 2 | |
| 3 | This section define the kernel data structure and functions that are used to access a FAT32 file system stored on a mass storage block device (such as BDV, HBA, SDC, or RDK peripherals). |
| 4 | |
| 5 | [[PageOutline]] |
| 6 | |
| 7 | * The [source:soft/giet_vm/giet_fat32/fat_sync.c fat_sync.c] and [source:soft/giet_vm/giet_fat32/fat_sync.h fat_sync.h] files define the functions to access the block device with a polling policy on the peripheral status. |
| 8 | * The [source:soft/giet_vm/giet_fat32/fat_irq.c fat_irq.c] and [source:soft/giet_vm/giet_fat32/fat_irq.h fat_irq.h] files define the functions to access the block device with a a descheduling / completion IRQ policy. |
| 9 | * The [source:soft/giet_vm/giet_fat32/fat_common.c fat_common.c] and [source:soft/giet_vm/fat_common.h fat_common.h] files define the functions that are independant on the |
| 10 | blockdevice access mode. |
| 11 | |
| 12 | All these functions are prefixed by ''_'' to remind that they can only be executed by a processor in kernel mode. |
| 13 | |
| 14 | The [source:soft/giet_vm/giet_kernel/sys_handler.c _syscall_vector] array contains the 64 kernel functions (syscal handlers) defined by the GIET-VM to handle system calls. |
| 15 | |
| 16 | == Common FAT32 access functions == |
| 17 | |
| 18 | == Polling based FAT32 access functions == |
| 19 | |
| 20 | The following functions are intended to be used by the GIET_VM boot-loader, when the interrupts are not yet enabled. They use a polling strategy on the block device status to detect completion. |
| 21 | |
| 22 | === 1) int '''_fat_sync_open'''( ) === |
| 23 | |
| 24 | === 2) int '''_fat_sync_read'''( unsigned int fd_id , unsigned int buffer , unsigned int count , unsigned int offset ) === |
| 25 | This function transfer an integer number of blocks from an open file on the block device to a memory buffer, after checking the arguments. |
| 26 | If the number of requested sectors exceeds the file size, this number of sectors is reduced. |
| 27 | * '''fd_id''' : file descriptor index |
| 28 | * '''buffer''' : memory buffer virtual base address |
| 29 | * '''count''' : number of blocks to transfer |
| 30 | * '''offset''' : number of blocks to skip in file |
| 31 | Returns number of sectors transfered if success, returns -1 if error. |
| 32 | |
| 33 | === 3) int '''_fat_sync_ioc_access( unsigned int to_memory , unsigned int lba , unsigned int buf_vaddr , unsigned int count ) === |
| 34 | This function computes the buffer physical address, and call the proper block device driver, as specified in the mapping. |
| 35 | * '''to_memory''' : to memory transfer if non zero. |
| 36 | * '''lba''' : first block index on the block device. |
| 37 | * '''buf_vaddr''' : memory buffer virtual base address |
| 38 | * '''count''' : number of blocks to transfer |
| 39 | Returns 0 if success, returns -1 if error. |
| 40 | |
| 41 | == Interrupt based FAT32 access functions == |
| 42 | |
| 43 | |