Changeset 550 for trunk/hal/tsar_mips32/drivers
- Timestamp:
- Sep 21, 2018, 10:24:15 PM (6 years ago)
- Location:
- trunk/hal/tsar_mips32/drivers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_pic.c
r534 r550 371 371 bool_t is_rx = src_chdev->is_rx; 372 372 373 if( (func == DEV_FUNC_IOC ) || (func == DEV_FUNC_NIC) ||373 if( (func == DEV_FUNC_IOC && impl == IMPL_IOC_BDV) || (func == DEV_FUNC_NIC) || 374 374 (func == DEV_FUNC_TXT && impl == IMPL_TXT_TTY) || (func == DEV_FUNC_IOB) ) // external IRQ => WTI 375 375 { … … 417 417 } 418 418 else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) || 419 (func == DEV_FUNC_TXT && impl == IMPL_TXT_MTY) ) // internal IRQ => HWI 419 (func == DEV_FUNC_TXT && impl == IMPL_TXT_MTY) || 420 (func == DEV_FUNC_IOC && impl == IMPL_IOC_SPI) ) // internal IRQ => HWI 420 421 { 421 422 // get internal IRQ index … … 423 424 if( func == DEV_FUNC_DMA ) hwi_id = lapic_input.dma[channel]; 424 425 else if (func == DEV_FUNC_TXT ) hwi_id = lapic_input.mtty; 426 else if (func == DEV_FUNC_IOC ) hwi_id = lapic_input.sdcard; 425 427 else hwi_id = lapic_input.mmc; 426 428 -
trunk/hal/tsar_mips32/drivers/soclib_sdc.c
r543 r550 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 7 8 // #include <hard_config.h>8 // #include <hard_config.h> 9 9 #include <soclib_sdc.h> 10 10 //#include <tty0.h> 11 11 //#include <utils.h> 12 #include <hal_kernel_types.h> 13 #include <chdev.h> 14 #include <dev_ioc.h> 15 #include <thread.h> 12 16 #include <printk.h> 13 17 … … 334 338 335 339 //////////////////////// 336 unsigned int _sdc_init()340 void soclib_sdc_init( chdev_t* chdev ) 337 341 { 338 342 spi = (struct spi_dev*)SEG_IOC_BASE; … … 393 397 printk("[SDC WARNING] Finish SD card initialization\n\r"); 394 398 395 return 0; 396 } // end _sdc_init() 397 399 /* Initialize the chdev */ 400 // get extended pointer on SOCLIB_BDV peripheral base address 401 xptr_t sdc_xp = chdev->base; 402 403 // set driver specific fields 404 chdev->cmd = &soclib_sdc_cmd; 405 chdev->isr = &soclib_sdc_isr; 406 407 } // end soclib_sdc_init() 398 408 399 409 ///////////////////////////////////////////////////// 400 unsigned int _sdc_access( unsigned int use_irq, // unused 401 unsigned int to_mem, 402 unsigned int lba, 403 unsigned long long buf_paddr, 404 unsigned int count ) 405 { 410 void __attribute__ ((noinline)) soclib_sdc_cmd( xptr_t th_xp ) 411 { 412 cxy_t th_cxy = GET_CXY( th_xp ); 413 thread_t * th_ptr = GET_PTR( th_xp ); 414 415 // get command arguments and extended pointer on IOC device 416 uint32_t cmd_type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) ); 417 unsigned int lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) ); 418 xptr_t buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) ); 419 unsigned int count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) ); 420 406 421 unsigned char args[4]; 407 422 unsigned char sdcard_rsp; … … 410 425 unsigned int last = lba + count; 411 426 412 if ( to_mem) // read access427 if ( cmd_type == IOC_SYNC_READ ) // read access 413 428 { 414 429 for ( ; curr < last ; curr++ ) … … 432 447 _sdc_wait_data_block(); 433 448 434 if (spi_get_data(sdcard.spi, buf_ paddr, 512 ))449 if (spi_get_data(sdcard.spi, buf_xp, 512 )) 435 450 { 436 451 _sdc_disable(); … … 444 459 _sdc_disable(); 445 460 446 buf_ paddr+= 512;461 buf_xp += 512; 447 462 } 448 463 } … … 451 466 assert( false, __FUNCTION__, "[SDC ERROR] function _sdc_write() not iplemented yet\n"); 452 467 } 453 454 return 0;455 468 } // _end sdc_access() 456 469 … … 458 471 // This ISR handles the IRQ generated by a SDC controler 459 472 /////////////////////////////////////////////////////////////////////////////// 460 void _sdc_isr( unsigned int irq_type, 461 unsigned int irq_id, 462 unsigned int channel ) 473 void __attribute__ ((noinline)) soclib_sdc_isr( chdev_t * chdev ) 463 474 { 464 475 assert( false, __FUNCTION__, "\n[GIET ERROR] _sdc_isr() not implemented\n"); -
trunk/hal/tsar_mips32/drivers/soclib_sdc.h
r543 r550 10 10 11 11 12 #include <chdev.h> 12 13 #include <soclib_spi.h> 13 14 #include <hard_config.h> … … 43 44 // Returns 0 if success, other value if failure 44 45 /////////////////////////////////////////////////////////////////////////////// 45 unsigned int _sdc_init(); 46 // unsigned int _sdc_init(); 47 extern void soclib_sdc_init( chdev_t* chdev ); 46 48 47 49 /////////////////////////////////////////////////////////////////////////////// … … 54 56 // Returns 0 if success, > 0 if error. 55 57 /////////////////////////////////////////////////////////////////////////////// 56 unsigned int _sdc_access( unsigned int use_irq, 57 unsigned int to_mem, 58 unsigned int lba, 59 unsigned long long buf_vaddr, 60 unsigned int count); 58 extern void soclib_sdc_cmd( xptr_t thread_xp ); 61 59 62 60 /////////////////////////////////////////////////////////////////////////////// 63 61 // This ISR handles the IRQ generated by a SDC controler 64 62 /////////////////////////////////////////////////////////////////////////////// 65 void _sdc_isr( unsigned int irq_type, 66 unsigned int irq_id, 67 unsigned int channel ); 63 extern void soclib_sdc_isr( chdev_t* chdev ); 68 64 69 65 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.