wiki:kernel_fat32

Version 1 (modified by alain, 9 years ago) (diff)

--

GIET-VM / FAT32 Handler

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).

  • The fat_sync.c and fat_sync.h files define the functions to access the block device with a polling policy on the peripheral status.
  • The fat_irq.c and fat_irq.h files define the functions to access the block device with a a descheduling / completion IRQ policy.
  • The fat_common.c and fat_common.h files define the functions that are independant on the

blockdevice access mode.

All these functions are prefixed by _ to remind that they can only be executed by a processor in kernel mode.

The _syscall_vector array contains the 64 kernel functions (syscal handlers) defined by the GIET-VM to handle system calls.

Common FAT32 access functions

Polling based FAT32 access functions

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.

1) int _fat_sync_open( )

2) int _fat_sync_read( unsigned int fd_id , unsigned int buffer , unsigned int count , unsigned int offset )

This function transfer an integer number of blocks from an open file on the block device to a memory buffer, after checking the arguments. If the number of requested sectors exceeds the file size, this number of sectors is reduced.

  • fd_id : file descriptor index
  • buffer : memory buffer virtual base address
  • count : number of blocks to transfer
  • offset : number of blocks to skip in file

Returns number of sectors transfered if success, returns -1 if error.

3) int _fat_sync_ioc_access( unsigned int to_memory , unsigned int lba , unsigned int buf_vaddr , unsigned int count )

This function computes the buffer physical address, and call the proper block device driver, as specified in the mapping.

  • to_memory : to memory transfer if non zero.
  • lba : first block index on the block device.
  • buf_vaddr : memory buffer virtual base address
  • count : number of blocks to transfer

Returns 0 if success, returns -1 if error.

Interrupt based FAT32 access functions