Ignore:
Timestamp:
Mar 27, 2015, 11:51:33 AM (9 years ago)
Author:
alain
Message:

1) Removing the IOC driver (integrated in the FAT library).
2) Simplifying the BDV, HBA, SDC, RDK drivers: they support
only two modes (synchronous => polling / descheduling => IRQ),
and only one access function (for both read/write).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/bdv_driver.h

    r496 r529  
    1010// a single channel, block oriented, external storage contrÃŽler.
    1111//
    12 // The _bdv_read() and _bdv_write() functions are always blocking.
    13 // They can be called in 3 modes:
     12// The _bdv_access() function supports both read and write access to block device,
     13// and implement two operating modes:
    1414//
    15 // - In BOOT mode, these functions use a polling policy on the BDV STATUS
     15// - in "synchronous" mode, it uses a polling policy on the BDV STATUS
    1616//   register to detect transfer completion, as interrupts are not activated.
    1717//   This mode is used by the boot code to load the map.bin file into memory
    1818//   (before MMU activation), or to load the .elf files (after MMU activation).
    19 //
    20 // - In KERNEL mode, these functions use a descheduling strategy:
    21 //   The ISR executed when transfer completes should restart the calling task.
    22 //   There is no checking of user access right to the memory buffer.
    23 //   This mode must be used, for an "open" system call.
    24 //
    25 // - In USER mode, these functions use a descheduling strategy:
    26 //   The ISR executed when transfer completes should restart the calling task,
    27 //   The user access right to the memory buffer must be checked.
    28 //   This mode must be used for a "read/write" system call.
    29 //
     19// - In "descheduling" mode, ir uses a descheduling + IRQ policy.
     20//   The ISR executed when transfer completes should restart the calling task,
     21//   as the calling task global index has been saved in the _bdv_gtid variable.
     22//   
    3023// As the BDV component can be used by several programs running in parallel,
    31 // the _bdv_lock variable guaranties exclusive access to the device.  The
    32 // _bdv_read() and _bdv_write() functions use atomic LL/SC to get the lock.
    33 //
    34 // Finally, the memory buffer must fulfill the following conditions:
    35 // - The buffer must be word aligned,
    36 // - The buffer must be mapped in user space for an user access,
    37 // - The buffer must be writable in case of (to_mem) access,
    38 // - The total number of physical pages occupied by the user buffer cannot
    39 //   be larger than 512 pages if the IOMMU is activated,
    40 // - All physical pages occupied by the user buffer must be contiguous
    41 //   if the IOMMU is not activated.
    42 // An error code is returned if these conditions are not verified.
     24// the _bdv_lock variable guaranties exclusive access to the device.
    4325//
    4426// The SEG_IOC_BASE address must be defined in the hard_config.h file.
     
    8668
    8769///////////////////////////////////////////////////////////////////////////////
    88 // BDV global variables
     70//           Global variables
    8971///////////////////////////////////////////////////////////////////////////////
    9072
    9173extern spin_lock_t  _bdv_lock;
     74
     75extern unsigned int _bdv_gtid;
     76
    9277extern unsigned int _bdv_status;
    93 extern unsigned int _bdv_gtid;
    9478
    9579///////////////////////////////////////////////////////////////////////////////////
     
    10488
    10589///////////////////////////////////////////////////////////////////////////////////
    106 // Transfer data from the block device to a memory buffer.
    107 // - mode     : BOOT / KERNEL / USER
     90// Transfer data to/from the block device from/to a memory buffer.
     91// - use_irq  : descheduling + IRQ if non zero / polling if zero
     92// - to_mem   : from external storage to memory when non 0.
    10893// - lba      : first block index on the block device
    109 // - buffer   : base address of the memory buffer (must be word aligned)
    110 // - count    : number of blocks to be transfered.
    111 // Returns 0 if success, > 0 if error.
    112 ////////////////////////////////////////////////////////////////////////////////////
    113 extern unsigned int _bdv_read(  unsigned int       mode,
    114                                 unsigned int       lba,
    115                                 unsigned long long buffer,
    116                                 unsigned int       count );
    117 
    118 ///////////////////////////////////////////////////////////////////////////////////
    119 // Transfer data from a memory buffer to the block device.
    120 // - mode     : BOOT / KERNEL / USER
    121 // - lba      : first block index on the block device
    122 // - buffer   : base address of the memory buffer (must be word aligned)
     94// - buffer   : pbase address of the memory buffer (must be word aligned)
    12395// - count    : number of blocks to be transfered.
    12496// Returns 0 if success, > 0 if error.
    12597///////////////////////////////////////////////////////////////////////////////////
    126 extern unsigned int _bdv_write( unsigned int       mode,
    127                                 unsigned int       lba,
    128                                 unsigned long long buffer,
    129                                 unsigned int       count );
    130 
    131 ///////////////////////////////////////////////////////////////////////////////////
    132 // Returns device status.
    133 ///////////////////////////////////////////////////////////////////////////////////
    134 extern unsigned int _bdv_get_status();
    135 
    136 ///////////////////////////////////////////////////////////////////////////////////
    137 // Returns block size.
    138 ///////////////////////////////////////////////////////////////////////////////////
    139 extern unsigned int _bdv_get_block_size();
     98extern unsigned int _bdv_access( unsigned int       use_irq,
     99                                 unsigned int       to_mem,
     100                                 unsigned int       lba,
     101                                 unsigned long long buffer,
     102                                 unsigned int       count );
    140103
    141104///////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.