Changeset 657 for trunk/kernel/devices/dev_ioc.h
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_ioc.h
r647 r657 2 2 * dev_ioc.h - IOC (Block Device Controler) generic device API definition. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 45 45 * - SYNC_WRITE : move blocks from memory to device, with a busy waiting policy. 46 46 * 47 * For the heREAD or WRITE operations, the client thread is descheduled, and the work47 * For the READ or WRITE operations, the client thread is descheduled, and the work 48 48 * is done by the server thread associated to the IOC device: 49 49 * The client thread calls the dev_ioc_move_data() kernel functions that (i) registers … … 93 93 94 94 /****************************************************************************************** 95 * This defines the (implementation independant) command passed to the driver.95 * This structure defines the IOC command for all drivers implementing the IOC device. 96 96 *****************************************************************************************/ 97 97 … … 103 103 IOC_SYNC_WRITE = 3, 104 104 } 105 cmd_type_t;105 ioc_cmd_type_t; 106 106 107 107 typedef struct ioc_command_s … … 111 111 uint32_t lba; /*! first block index */ 112 112 uint32_t count; /*! number of blocks */ 113 xptr_t buf_xp; /*! extended pointer on memory buffer*/113 xptr_t buf_xp; /*! extended pointer on kernel memory buffer */ 114 114 uint32_t error; /*! operation status (0 if success) */ 115 115 } … … 122 122 * @ return pointer on string. 123 123 *****************************************************************************************/ 124 char * dev_ioc_cmd_str( cmd_type_t cmd );124 char * dev_ioc_cmd_str( ioc_cmd_type_t cmd ); 125 125 126 126 /****************************************************************************************** … … 138 138 139 139 /****************************************************************************************** 140 * This blocking function moves <count> contiguous blocks of data between the block device 141 * starting from block defined by the <lba> argument and a kernel memory buffer, defined 142 * by the <buffer_xp> argument. The transfer direction and mode are defined by the 143 * <cmd_type> argument. The request is always registered in the calling thread descriptor. 144 * - In synchronous mode, the calling thread is not descheduled, and directly calls the 145 * IOC driver, polling the IOC status to detect transfer completion. 146 * - In asynchronous mode, the calling thread blocks and deschedules, and the IOC driver 147 * is called by the server thread associated to the IOC device. 148 ****************************************************************************************** 149 * @ cmd_type : IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYN_WRITE. 150 * @ buffer_xp : extended pointer on kernel buffer in memory (must be block aligned). 151 * @ lba : first block index on device. 152 * @ count : number of blocks to transfer. 153 * @ returns 0 if success / returns -1 if error. 154 *****************************************************************************************/ 155 error_t dev_ioc_move_data( uint32_t cmd_type, 156 xptr_t buffer_xp, 140 * This blocking function register an asynchronous READ request : move <count> contiguous 141 * blocks from the block device, starting from block defined by the <lba> argument, to a 142 * kernel buffer defined by the <buffer_xp> argument. 143 * It register the request in the client thread descriptor, it register the client thread 144 * in the IOC device queue, it blocks on the THREAD_BLOCKED_IO condition, and deschedules. 145 * It will be reactivated by the DEV server thread when the transfer is completed. 146 * It can be executed by a thread running in any cluster. 147 ****************************************************************************************** 148 * @ buffer_xp : extended pointer on kernel buffer in memory (must be block aligned). 149 * @ lba : first block index on device. 150 * @ count : number of blocks to transfer. 151 * @ returns 0 if success / returns -1 if error. 152 *****************************************************************************************/ 153 error_t dev_ioc_read( xptr_t buffer_xp, 154 uint32_t lba, 155 uint32_t count ); 156 157 /****************************************************************************************** 158 * This blocking function register an asynchronous WRITE request : move <count> contiguous 159 * blocks from a kernel buffer defined by the <buffer_xp> argument to the block device, 160 * starting from block defined by the <lba> argument. 161 * It register the request in the client thread descriptor, it register the client thread 162 * in the IOC device queue, it blocks on the THREAD_BLOCKED_IO condition, and deschedules. 163 * It will be reactivated by the DEV server thread when the transfer is completed. 164 * It can be executed by a thread running in any cluster. 165 ****************************************************************************************** 166 * @ buffer_xp : extended pointer on kernel buffer in memory (must be block aligned). 167 * @ lba : first block index on device. 168 * @ count : number of blocks to transfer. 169 * @ returns 0 if success / returns -1 if error. 170 *****************************************************************************************/ 171 error_t dev_ioc_write( xptr_t buffer_xp, 172 uint32_t lba, 173 uint32_t count ); 174 175 /****************************************************************************************** 176 * This blocking function executes a synchronous SYNC_READ request : it moves <count> 177 * contiguous blocks of data from the block device, starting from block defined by the 178 * <lba> argument to a kernel memory buffer, defined by the <buffer_xp> argument. 179 * The request is registered in the calling thread descriptor, but the client thread calls 180 * directly the driver cmd function, that is also a blocking function returning only 181 * when the transfer is completed. 182 * It can be executed by a thread running in any cluster. 183 ****************************************************************************************** 184 * @ buffer_xp : extended pointer on kernel buffer in memory (must be block aligned). 185 * @ lba : first block index on device. 186 * @ count : number of blocks to transfer. 187 * @ returns 0 if success / returns -1 if error. 188 *****************************************************************************************/ 189 error_t dev_ioc_sync_read( xptr_t buffer_xp, 157 190 uint32_t lba, 158 191 uint32_t count ); 159 192 193 /****************************************************************************************** 194 * This blocking function executes a synchronous SYNC_WRITE request : it moves <count> 195 * contiguous blocks of data from a kernel memory buffer, defined by the <buffer_xp> 196 * argument to the block device, starting from block defined by the <lba> argument. 197 * The request is registered in the calling thread descriptor, but the client thread calls 198 * directly the driver cmd() function, that is also a blocking function returning only 199 * when the transfer is completed. 200 * It can be executed by a thread running in any cluster. 201 ****************************************************************************************** 202 * @ buffer_xp : extended pointer on kernel buffer in memory (must be block aligned). 203 * @ lba : first block index on device. 204 * @ count : number of blocks to transfer. 205 * @ returns 0 if success / returns -1 if error. 206 *****************************************************************************************/ 207 error_t dev_ioc_sync_write( xptr_t buffer_xp, 208 uint32_t lba, 209 uint32_t count ); 210 160 211 #endif /* _DEV_IOC_H */
Note: See TracChangeset
for help on using the changeset viewer.