Changeset 412 for trunk/softs/tsar_boot/src/boot_ioc.c
- Timestamp:
- Jun 17, 2013, 7:10:20 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/src/boot_ioc.c
r388 r412 21 21 } 22 22 23 #if INSTRUMENTATION23 #if (BOOT_DEBUG == 1 && BOOT_DEBUG_IOC == 1) 24 24 inline unsigned int boot_proctime() 25 25 { … … 28 28 return ret; 29 29 } 30 #endif // end if INSTRUMENTATION30 #endif 31 31 32 32 #ifndef SOCLIB_IOC … … 47 47 SPI_TX_NEGEDGE, 48 48 SPI_RX_POSEDGE 49 ); 49 ); 50 50 51 51 /** … … 53 53 */ 54 54 unsigned int iter = 0; 55 while(1) 55 while(1) 56 56 { 57 57 boot_puts("Trying to initialize SD card... "); … … 118 118 119 119 120 unsigned int * ioc_address = ( unsigned int * ) VCIBD_BASE;121 120 unsigned int * ioc_address = ( unsigned int * )IOC_BASE; 121 122 122 while ( 1 ) 123 { 123 { 124 124 status = ioread32(&ioc_address[BLOCK_DEVICE_STATUS]); 125 125 … … 128 128 break; 129 129 } 130 130 131 131 return status; 132 132 } … … 135 135 /** 136 136 * boot_ioc_read() 137 * 137 * 138 138 * Transfer data from a file on the block device to a memory buffer. 139 139 * … … 153 153 { 154 154 155 unsigned int * ioc_address = (unsigned int*)VCIBD_BASE; 156 157 // block_device configuration 158 iowrite32( &ioc_address[BLOCK_DEVICE_BUFFER], 159 ( unsigned int ) buffer ); 160 161 iowrite32( &ioc_address[BLOCK_DEVICE_COUNT], 162 ( unsigned int ) count ); 163 164 iowrite32( &ioc_address[BLOCK_DEVICE_LBA], 165 ( unsigned int ) lba ); 166 167 iowrite32( &ioc_address[BLOCK_DEVICE_IRQ_ENABLE], 168 ( unsigned int ) 0 ); 169 170 iowrite32( &ioc_address[BLOCK_DEVICE_OP], 171 ( unsigned int ) BLOCK_DEVICE_READ ); 172 173 _boot_ioc_completed(); 174 175 #if (CACHE_COHERENCE == 0) 176 boot_dbuf_invalidate(buffer, CACHE_LINE_SIZE, count * 512); 177 #endif 178 return 0; 179 } 180 181 #else 182 183 /////////////////////////////////////////////////////////////////////////////// 184 // FPGA version of the boot_ioc_read function 185 186 int boot_ioc_read(unsigned int lba, void* buffer, unsigned int count) 187 { 188 unsigned int sdcard_rsp; 189 unsigned int i; 190 191 sdcard_dev_lseek(&_sdcard_device, lba); 192 193 #if INSTRUMENTATION 155 unsigned int * ioc_address = (unsigned int*)IOC_BASE; 156 157 #if (BOOT_DEBUG == 1 && BOOT_DEBUG_IOC == 1) 194 158 unsigned int start_time; 195 159 unsigned int end_time; … … 202 166 #endif 203 167 168 // block_device configuration 169 iowrite32( &ioc_address[BLOCK_DEVICE_BUFFER], 170 ( unsigned int ) buffer ); 171 172 iowrite32( &ioc_address[BLOCK_DEVICE_COUNT], 173 ( unsigned int ) count ); 174 175 iowrite32( &ioc_address[BLOCK_DEVICE_LBA], 176 ( unsigned int ) lba ); 177 178 iowrite32( &ioc_address[BLOCK_DEVICE_IRQ_ENABLE], 179 ( unsigned int ) 0 ); 180 181 iowrite32( &ioc_address[BLOCK_DEVICE_OP], 182 ( unsigned int ) BLOCK_DEVICE_READ ); 183 184 _boot_ioc_completed(); 185 186 #if (CACHE_COHERENCE == 0) 187 boot_dbuf_invalidate(buffer, CACHE_LINE_SIZE, count * 512); 188 #endif 189 190 #if (BOOT_DEBUG == 1 && BOOT_DEBUG_IOC == 1) 191 end_time = boot_proctime(); 192 193 boot_puts(" / cycles for transfert: "); 194 boot_putd(end_time - start_time); 195 boot_puts("\n"); 196 #endif 197 198 return 0; 199 } 200 201 #else 202 203 /////////////////////////////////////////////////////////////////////////////// 204 // FPGA version of the boot_ioc_read function 205 206 int boot_ioc_read(unsigned int lba, void* buffer, unsigned int count) 207 { 208 unsigned int sdcard_rsp; 209 unsigned int i; 210 211 sdcard_dev_lseek(&_sdcard_device, lba); 212 213 #if (BOOT_DEBUG ==1 && BOOT_DEBUG_IOC == 1) 214 unsigned int start_time; 215 unsigned int end_time; 216 boot_puts("[ DEBUG ] Reading blocks "); 217 boot_putd(lba); 218 boot_puts(" to "); 219 boot_putd(lba + count - 1); 220 221 start_time = boot_proctime(); 222 #endif 223 204 224 for(i = 0; i < count; i++) 205 225 { … … 208 228 (unsigned char *) buffer + (512 * i), 209 229 512 210 ) 230 ) 211 231 )) 212 232 { 213 boot_puts("ERROR during read on the SDCARD device. Code: "); 233 boot_puts("ERROR during read on the SDCARD device. Code: "); 214 234 boot_putx(sdcard_rsp); 215 235 boot_puts("\n\r"); … … 219 239 } 220 240 221 #if INSTRUMENTATION241 #if (BOOT_DEBUG == 1 && BOOT_DEBUG_IOC == 1) 222 242 end_time = boot_proctime(); 223 243 … … 234 254 * _dcache_buf_invalidate() 235 255 * 236 * Invalidate all data cache lines corresponding to a memory 256 * Invalidate all data cache lines corresponding to a memory 237 257 * buffer (identified by an address and a size). 238 258 */ … … 245 265 unsigned int i; 246 266 247 // iterate on cache lines 267 // iterate on cache lines 248 268 for (i = 0; i < size; i += line_size) { 249 269 asm volatile(
Note: See TracChangeset
for help on using the changeset viewer.