Changeset 529 for soft/giet_vm/giet_drivers/rdk_driver.c
- Timestamp:
- Mar 27, 2015, 11:51:33 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/rdk_driver.c
r456 r529 1 /////////////////////////////////////////////////////////////////////////////// ////1 /////////////////////////////////////////////////////////////////////////////// 2 2 // File : rdk_driver.c 3 3 // Date : 13/02/2014 … … 5 5 // Maintainer: cesar fuguet 6 6 // Copyright (c) UPMC-LIP6 7 /////////////////////////////////////////////////////////////////////////////// ////7 /////////////////////////////////////////////////////////////////////////////// 8 8 9 9 #include <giet_config.h> … … 17 17 #endif 18 18 19 ////////////////////////////////////////////// 20 unsigned int _rdk_init( unsigned int channel ) 21 { 22 return 0; 23 } 24 25 ////////////////////////////////////////// 26 unsigned int _rdk_read( unsigned int lba, 27 unsigned int buffer, 28 unsigned int count) 19 ///////////////////////////////////////////////////// 20 unsigned int _rdk_access( unsigned int use_irq, // not used 21 unsigned int to_mem, 22 unsigned int lba, 23 unsigned long long buf_vaddr, // actually vaddr 24 unsigned int count) 29 25 { 30 26 #if USE_IOC_RDK 31 27 32 28 #if GIET_DEBUG_IOC_DRIVER 33 _puts("\n[IOC DEBUG] Enter _rdk_read() at cycle "); 34 _putd( _get_proctime() ); 35 _puts("\n - vaddr = "); 36 _putx( buffer ); 37 -puts("\n - sectors = "); 38 _putd( count ); 39 -puts("\n - lba = "); 40 _putx( lba ); 41 _puts("\n"); 29 unsigned int procid = _get_procid(); 30 unsigned int x = procid >> (Y_WIDTH + P_WIDTH); 31 unsigned int y = (procid >> P_WIDTH) & ((1<<Y_WIDTH) - 1); 32 unsigned int p = procid & ((1<<P_WIDTH)-1); 33 _printf("\n[RDK DEBUG] P[%d,%d,%d] enters _rdk_access at cycle %d\n" 34 " use_irq = %d / to_mem = %d / lba = %x / paddr = %x / count = %d\n", 35 x , y , p , _get_proctime() , use_irq , to_mem , lba , buf_vaddr, count ); 42 36 #endif 43 37 44 char* src = (char*)SEG_RDK_BASE + (512*lba); 45 char* dst = (char*)buffer; 46 memcpy( dst, src, count*512 ); 38 char* rdk = (char*)SEG_RDK_BASE + (512*lba); 39 char* buf = (char*)buf_paddr; 40 41 if ( to_mem ) memcpy( buf, rdk, count*512 ); 42 else memcpy( rdk, buf, count*512 ); 43 47 44 return 0; 48 45 49 46 #else 50 47 51 _p uts("[GIET ERROR] _rdk_read() should not be used ifUSE_IOC_RDK not set\n");48 _printf("[RDK ERROR] _rdk_access() but USE_IOC_RDK not set\n"); 52 49 return 1; 53 50 54 51 #endif 55 52 } 56 57 //////////////////////////////////////////58 unsigned int _rdk_write( unsigned int lba,59 unsigned int buffer,60 unsigned int count )61 {62 #if USE_IOC_RDK63 64 #if GIET_DEBUG_IOC_DRIVER65 _puts("\n[IOC DEBUG] Enter _rdk_write() at cycle ");66 _putd( _get_proctime() );67 _puts("\n - vaddr = ");68 _putx( buffer );69 -puts("\n - sectors = ");70 _putd( count );71 -puts("\n - lba = ");72 _putx( lba );73 _puts("\n");74 #endif75 76 char* dst = (char*)SEG_RDK_BASE + (512*lba);77 char* src = (char*)buffer;78 memcpy( dst, src, count*512 );79 return 0;80 81 #else82 83 _puts("[GIET ERROR] _rdk_write() should not be used if USE_IOC_RDK not set\n");84 return 1;85 86 #endif87 }88 89 //////////////////////////////////90 unsigned int _rdk_get_block_size()91 {92 return 512;93 }94 95 //////////////////////////////96 unsigned int _rdk_get_status()97 {98 return 0;99 }100 101 53 102 54 // Local Variables:
Note: See TracChangeset
for help on using the changeset viewer.