Changeset 626 for trunk/kernel/devices/dev_ioc.c
- Timestamp:
- Apr 29, 2019, 7:25:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_ioc.c
r619 r626 2 2 * dev_ioc.c - IOC (Block Device Controler) generic device API implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 36 36 37 37 extern chdev_directory_t chdev_dir; // allocated in kernel_init.c 38 39 //////////////////////////////////////// 40 char * dev_ioc_cmd_str( cmd_type_t cmd ) 41 { 42 if ( cmd == IOC_READ ) return "READ"; 43 else if( cmd == IOC_WRITE ) return "WRITE"; 44 else if( cmd == IOC_SYNC_READ ) return "SYNC_READ"; 45 else if( cmd == IOC_SYNC_WRITE ) return "SYNC_WRITE"; 46 else return "undefined"; 47 } 38 48 39 49 ////////////////////////////////// … … 192 202 ////////////////////////////////////i///////////////////////////////////////////// 193 203 error_t dev_ioc_sync_access( uint32_t cmd_type, 194 uint8_t * buffer,204 xptr_t buffer_xp, 195 205 uint32_t lba, 196 206 uint32_t count ) … … 202 212 if( chdev_dir.iob ) 203 213 { 204 if (cmd_type == IOC_SYNC_READ) dev_mmc_inval( XPTR(local_cxy,buffer), count<<9 );205 else dev_mmc_sync ( XPTR(local_cxy,buffer), count<<9 );214 if (cmd_type == IOC_SYNC_READ) dev_mmc_inval( buffer_xp , count<<9 ); 215 else dev_mmc_sync ( buffer_xp , count<<9 ); 206 216 } 207 217 … … 215 225 this->ioc_cmd.dev_xp = ioc_xp; 216 226 this->ioc_cmd.type = cmd_type; 217 this->ioc_cmd.buf_xp = XPTR( local_cxy , buffer );227 this->ioc_cmd.buf_xp = buffer_xp; 218 228 this->ioc_cmd.lba = lba; 219 229 this->ioc_cmd.count = count; … … 241 251 return this->ioc_cmd.error; 242 252 243 } // end ioc_sync_access()244 245 ///////////////////////////////////////////// 246 error_t dev_ioc_sync_read( uint8_t * buffer,253 } // end dev_ioc_sync_access() 254 255 //////////////////////////////////////////////// 256 error_t dev_ioc_sync_read( xptr_t buffer_xp, 247 257 uint32_t lba, 248 258 uint32_t count ) … … 253 263 uint32_t cycle = (uint32_t)hal_get_cycles(); 254 264 if( DEBUG_DEV_IOC_RX < cycle ) 255 printk("\n[%s] thread[%x,%x] : lba %x / buffer %x / cycle %d\n", 256 __FUNCTION__ , this->process->pid, this->trdid, lba, buffer, cycle ); 257 #endif 258 259 return dev_ioc_sync_access( IOC_SYNC_READ , buffer , lba , count ); 265 printk("\n[%s] thread[%x,%x] : lba %x / buffer(%x,%x) / count %d / cycle %d\n", 266 __FUNCTION__ , this->process->pid, this->trdid, 267 lba, GET_CXY(buffer_xp), GET_PTR(buffer_xp), count, cycle ); 268 #endif 269 270 return dev_ioc_sync_access( IOC_SYNC_READ , buffer_xp , lba , count ); 260 271 } 261 272 262 ////////////////////////////////////////////// 263 error_t dev_ioc_sync_write( uint8_t * buffer,273 ///////////////////////////////////////////////// 274 error_t dev_ioc_sync_write( xptr_t buffer_xp, 264 275 uint32_t lba, 265 276 uint32_t count ) 266 277 { 267 278 268 #if DEBUG_DEV_IOC_RX 269 thread_t * this = CURRENT_THREAD; 270 uint32_t cycle = (uint32_t)hal_get_cycles(); 271 if( DEBUG_DEV_IOC_RX < cycle ) 272 printk("\n[%s] thread[%x,%x] enters / lba %x / buffer %x / cycle %d\n", 273 __FUNCTION__ , this->process->pid, this->trdid, lba, buffer, cycle ); 274 #endif 275 276 return dev_ioc_sync_access( IOC_SYNC_WRITE , buffer , lba , count ); 279 #if DEBUG_DEV_IOC_TX 280 thread_t * this = CURRENT_THREAD; 281 uint32_t cycle = (uint32_t)hal_get_cycles(); 282 if( DEBUG_DEV_IOC_TX < cycle ) 283 printk("\n[%s] thread[%x,%x] : lba %x / buffer(%x,%x) / count %d / cycle %d\n", 284 __FUNCTION__ , this->process->pid, this->trdid, 285 lba, GET_CXY(buffer_xp), GET_PTR(buffer_xp), count, cycle ); 286 #endif 287 288 return dev_ioc_sync_access( IOC_SYNC_WRITE , buffer_xp , lba , count ); 277 289 } 278 290
Note: See TracChangeset
for help on using the changeset viewer.