Changes between Version 2 and Version 3 of ioc_driver


Ignore:
Timestamp:
Oct 8, 2014, 2:18:38 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ioc_driver

    v2 v3  
    33[[PageOutline]]
    44
    5 The [source:soft/giet_vm/giet_drivers/ioc_driver.c ioc_driver.c] and [source:soft/giet_vm/giet_drivers/ioc_driver.h ioc_driver.h] files define an abstract, block oriented, mass storage driver.
     5The [source:soft/giet_vm/giet_drivers/ioc_driver.c ioc_driver.c] and [source:soft/giet_vm/giet_drivers/ioc_driver.h ioc_driver.h] files define an abstract, block oriented, mass storage peripheral driver.
    66
    77This abstact driver define a generic API, supporting various physical disks or virtual disks controlers:
     
    2424
    2525These functions can be called in 3 modes:
    26  * In BOOT mode, these functions use the buffer virtual address as a physical address if the MMU is not activated. They make a V2P translation if the MMU is activated. This mode is used to load the map.bin file (before memory activation), or to load the various .elf files (after MMU activation).
    27  *  In KERNEL mode, these functions make a V2P translation to compute the buffer physical address. There is no checking of user access right to the memory buffer.  This mode must be used for an ''open'' system call.
    28  * In USER mode, these functions make a V2P translation to compute the buffer physical address. The user access right to the memory buffer are checked.  This mode must be used for a ''read'' or ''write'' system call.
     26 * In '''BOOT''' mode, these functions use the buffer virtual address as a physical address if the MMU is not activated. They make a V2P translation if the MMU is activated. This mode is used to load the map.bin file (before memory activation), or to load the various .elf files (after MMU activation).
     27 *  In '''KERNEL''' mode, these functions make a V2P translation to compute the buffer physical address. There is no checking of user access right to the memory buffer.  This mode must be used for an ''open'' system call.
     28 * In '''USER''' mode, these functions make a V2P translation to compute the buffer physical address. The user access right to the memory buffer are checked.  This mode must be used for a ''read'' or ''write'' system call.
    2929
    3030The memory buffer must fulfill the following conditions:
     
    3939
    4040The IOMMU is not supported yet, but the method is the following: A fixed size 2 Mbytes vseg is allocated to the IOC peripheral, in the I/O virtual space, and the user buffer is dynamically remapped to one single big page in the IOMMU page table. The user buffer is unmapped by the _ioc_completed() function when the transfer is completed.
     41
     42
     43 === unsigned int '''_ioc_init'''( unsigned int channel ) ===
     44This function cheks block size, and desactivates interrupts.
     45Return 0 for success, non zero if error.
     46
     47 === unsigned int '''_ioc_write'''( unsigned int channel,  unsigned int mode,  unsigned int lba,  const void*  buffer,  unsigned int count ) ===
     48Transfer data from a memory buffer to the disk.
     49 * channel : channel index (for multi-channels peripherals)
     50 * mode : BOOT / KERNEL / USER
     51 * lba : first block index on the block device
     52 * buffer : base address of the memory buffer (must be word aligned)
     53 * count : number of blocks to be transfered.
     54Returns 0 if success, > 0 if error.
     55
     56 === unsigned int '''_ioc_read'''(  unsigned int channel,  unsigned int mode,  unsigned int lba,  void* buffer,  unsigned int count ) ===
     57Transfer data from the disk to a memory buffer.
     58 * channel : channel index (for multi-channels peripherals)
     59 * mode : BOOT / KERNEL / USER
     60 * lba : first block index on the block device
     61 * buffer : base address of the memory buffer (must be word aligned)
     62 * count : number of blocks to be transfered.
     63Returns 0 if success, > 0 if error.
     64
     65 === unsigned int '''_ioc_get_status'''( unsigned int channel ) ===
     66This function returns in the status variable, the transfert status, and acknowledge the IRQ if required.
     67Returns 0 if success, > 0 if error
     68
     69 === unsigned int '''_ioc_get_block_size'''() ===
     70This function returns the block_size for the block device.
     71