Changeset 295 for soft/giet_vm/giet_drivers/sdc_driver.c
- Timestamp:
- Mar 26, 2014, 6:44:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/sdc_driver.c
r289 r295 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 7 8 #include <sdc_driver.h> 9 #include <tty_driver.h> 8 10 #include <utils.h> 9 11 … … 179 181 if ( sdcard_rsp != 0x01 ) 180 182 { 181 182 _puts("card CMD0 failed "); 183 _printf("[SDC ERROR] card CMD0 failed\n"); 183 184 return sdcard_rsp; 184 185 } … … 196 197 if (!SDCARD_CHECK_R1_VALID(sdcard_rsp)) 197 198 { 198 _p uts("card CMD8 failed");199 _printf("[SDC ERROR] card CMD8 failed\n"); 199 200 return sdcard_rsp; 200 201 } … … 206 207 ersp = (ersp << 8) | _sdc_receive_char(); 207 208 ersp = (ersp << 8) | _sdc_receive_char(); 208 if ((ersp & 0xffff) != 0x0101) { 209 if ((ersp & 0xffff) != 0x0101) 210 { 209 211 // voltage mismatch 210 _puts("card CMD8 mismatch: "); 211 _putx(ersp); 212 _printf("[SDC ERROR] card CMD8 mismatch : ersp = %x\n"); 212 213 return sdcard_rsp; 213 214 } 214 _p uts("v2 or later ");215 _printf("[SDC WARNING] v2 or later "); 215 216 sdcard.sdhc = 1; 216 217 } … … 218 219 { 219 220 // other error 220 _p uts("card CMD8 error");221 _printf("[SDC ERROR] card CMD8 error\n"); 221 222 return sdcard_rsp; 222 223 } … … 249 250 if (sdcard_rsp) 250 251 { 251 _p uts("SD ACMD41 failed");252 _printf("[SDC ERROR] ACMD41 failed\n"); 252 253 return sdcard_rsp; 253 254 } … … 263 264 if (sdcard_rsp) 264 265 { 265 _p uts("SD CMD58 failed");266 _printf("[SDC ERROR] CMD58 failed\n"); 266 267 return sdcard_rsp; 267 268 } … … 272 273 if (ersp & 0x40000000) 273 274 { 274 _puts("SDHC "); 275 } else 275 _printf(" SDHC "); 276 } 277 else 276 278 { 277 279 sdcard.sdhc = 0; … … 279 281 _sdc_disable(); 280 282 } 281 _p uts("card detected");283 _printf("card detected\n"); 282 284 return 0; 283 285 } … … 334 336 // Returns 0 if success, other value if failure 335 337 /////////////////////////////////////////////////////////////////////////////// 336 unsigned int _sdc_init( unsigned int channel)338 unsigned int _sdc_init() 337 339 { 338 340 spi = (struct spi_dev*) &seg_ioc_base; … … 355 357 while(1) 356 358 { 357 _p uts("Trying to initialize SD card...");358 359 sdcard_rsp = _sdc_open( channel );359 _printf("[SDC WARNING] Trying to initialize SD card...\n"); 360 361 sdcard_rsp = _sdc_open( 0 ); // only channel 0 360 362 if (sdcard_rsp == 0) 361 363 { 362 _p uts("OK\n");364 _printf("OK\n"); 363 365 break; 364 366 } 365 367 366 _p uts("KO\n");368 _printf("KO\n"); 367 369 368 370 for (i = 0; i < 1000; i++); … … 370 372 if (++iter >= SDCARD_RESET_ITER_MAX) 371 373 { 372 _puts("\nERROR: During SD card reset to IDLE state\n" 373 "/ card response = "); 374 _putx(sdcard_rsp); 375 _puts("\n"); 374 _printf("\n[SDC ERROR] During SD card reset to IDLE state " 375 "/ card response = %x\n", sdcard_rsp ); 376 376 _exit(); 377 377 } … … 382 382 if (sdcard_rsp) 383 383 { 384 _p uts("ERROR:During SD card blocklen initialization\n");384 _printf("[SDC ERROR] During SD card blocklen initialization\n"); 385 385 _exit(); 386 386 } … … 396 396 ); 397 397 398 _p uts("Finish block deviceinitialization\n\r");398 _printf("[SDC WARNING] Finish SD card initialization\n\r"); 399 399 400 400 return 0; … … 478 478 479 479 /////////////////////////////////////////////////////////////////////////////// 480 // _sdc_get_status()481 480 // Transfer data from memory buffer to SD card device. 482 481 // - channel: channel index … … 484 483 // Returns 0 if success, > 0 if error. 485 484 /////////////////////////////////////////////////////////////////////////////// 486 unsigned int _sdc_get_status( unsigned int channel , 487 unsigned int* status ) 488 { 489 *status = BLOCK_DEVICE_IDLE; 490 491 return 0; 492 } 493 494 /////////////////////////////////////////////////////////////////////////////// 495 // _sdc_get_block_size() 485 unsigned int _sdc_get_status() 486 { 487 _printf("[SDC ERROR] function _sdc_get_status() should not be called\n"); 488 _exit(); 489 490 return 0; // to avoid a warning 491 } 492 493 /////////////////////////////////////////////////////////////////////////////// 496 494 // Returns the block size in bytes of the SD card 497 495 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.