Changeset 529 for soft/giet_vm/giet_drivers/bdv_driver.h
- Timestamp:
- Mar 27, 2015, 11:51:33 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/bdv_driver.h
r496 r529 10 10 // a single channel, block oriented, external storage contrÃŽler. 11 11 // 12 // The _bdv_ read() and _bdv_write() functions are always blocking.13 // They can be called in 3modes:12 // The _bdv_access() function supports both read and write access to block device, 13 // and implement two operating modes: 14 14 // 15 // - In BOOT mode, these functions usea polling policy on the BDV STATUS15 // - in "synchronous" mode, it uses a polling policy on the BDV STATUS 16 16 // register to detect transfer completion, as interrupts are not activated. 17 17 // This mode is used by the boot code to load the map.bin file into memory 18 18 // (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 // 30 23 // 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. 43 25 // 44 26 // The SEG_IOC_BASE address must be defined in the hard_config.h file. … … 86 68 87 69 /////////////////////////////////////////////////////////////////////////////// 88 // BDV global variables70 // Global variables 89 71 /////////////////////////////////////////////////////////////////////////////// 90 72 91 73 extern spin_lock_t _bdv_lock; 74 75 extern unsigned int _bdv_gtid; 76 92 77 extern unsigned int _bdv_status; 93 extern unsigned int _bdv_gtid;94 78 95 79 /////////////////////////////////////////////////////////////////////////////////// … … 104 88 105 89 /////////////////////////////////////////////////////////////////////////////////// 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. 108 93 // - 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) 123 95 // - count : number of blocks to be transfered. 124 96 // Returns 0 if success, > 0 if error. 125 97 /////////////////////////////////////////////////////////////////////////////////// 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(); 98 extern 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 ); 140 103 141 104 ///////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.