Changeset 550
- Timestamp:
- Sep 21, 2018, 10:24:15 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/boot/tsar_mips32/boot.c
r547 r550 463 463 (device->type != DEV_TYPE_ICU_XCU) && 464 464 (device->type != DEV_TYPE_MMC_TSR) && 465 (device->type != DEV_TYPE_DMA_SCL) ) 465 (device->type != DEV_TYPE_DMA_SCL) && 466 (device->type != DEV_TYPE_TXT_MTY) && 467 (device->type != DEV_TYPE_IOC_SPI) ) 466 468 { 467 469 boot_dev = &boot_info->ext_dev[device_id]; … … 558 560 (device->type == DEV_TYPE_MMC_TSR) || 559 561 (device->type == DEV_TYPE_DMA_SCL) || 560 (device->type == DEV_TYPE_TXT_MTY) ) 562 (device->type == DEV_TYPE_TXT_MTY) || 563 (device->type == DEV_TYPE_IOC_SPI) ) 561 564 { 562 565 if (device->type == DEV_TYPE_RAM_SCL) // RAM 563 566 { 564 // set number of physical memory pages 567 // set number of physical memory pages 565 568 boot_info->pages_nr = device->size >> CONFIG_PPM_PAGE_SHIFT; 566 569 -
trunk/hal/tsar_mips32/core/hal_drivers.c
r534 r550 31 31 #include <soclib_bdv.h> 32 32 #include <soclib_hba.h> 33 #include <soclib_sdc.h> 33 34 #include <soclib_mmc.h> 34 35 #include <soclib_nic.h> … … 125 126 soclib_hba_init( ioc ); 126 127 } 128 else if (impl == IMPL_IOC_SPI) 129 { 130 soclib_sdc_init( ioc ); 131 } 127 132 else 128 133 { -
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 /////////////////////////////////////////////////////////////////////////////// -
trunk/kernel/devices/dev_pic.h
r534 r550 142 142 uint32_t mmc; // MMC is single channel 143 143 uint32_t mtty; // Multi Tty (backup tty in cluster 0) 144 uint32_t sdcard; // SD card on cluster 00 144 145 } 145 146 lapic_input_t; -
trunk/kernel/kern/kernel_init.c
r539 r550 423 423 } 424 424 425 /////////////////////////////// 425 426 else if ( func == DEV_FUNC_TXT && info->use_mty0 == 1 ) 426 427 { … … 465 466 } 466 467 } 468 #if( DEBUG_KERNEL_INIT & 0x1 ) 469 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 470 printk("\n[DBG] %s : created MTY[%d] in cluster %x / chdev = %x\n", 471 __FUNCTION__ , channel , local_cxy , chdev_ptr ); 472 #endif 467 473 } 468 474 } 469 475 } 476 477 /////////////////////////////// 478 else if ( func == DEV_FUNC_IOC ) 479 { 480 assert(impl == IMPL_IOC_SPI, __FUNCTION__, 481 "Internal IOC should have SPI implementation\n"); 482 483 for ( channel = 0; channel < channels; channel++ ) 484 { 485 // create chdev in local cluster 486 chdev_ptr = chdev_create( func, 487 impl, 488 channel, 489 0, 490 base ); 491 492 assert( (chdev_ptr != NULL) , __FUNCTION__ , 493 "cannot allocate memory for IOC chdev" ); 494 495 // make IOC specific initialization 496 dev_ioc_init( chdev_ptr ); 497 498 // set the IOC fields in all clusters 499 xptr_t *chdev_entry = &chdev_dir.ioc[channel]; 500 for ( x = 0; x < info->x_max; x++ ) 501 { 502 for ( y = 0; y < info->y_max; y++ ) 503 { 504 cxy_t cxy = (x<<info->y_width) + y; 505 hal_remote_swd( XPTR( cxy, chdev_entry ), 506 XPTR( local_cxy, chdev_ptr ) ); 507 } 508 } 509 #if( DEBUG_KERNEL_INIT & 0x1 ) 510 if( hal_time_stamp() > DEBUG_KERNEL_INIT ) 511 printk("\n[DBG] %s : created IOC[%d] in cluster %x / chdev = %x\n", 512 __FUNCTION__ , channel , local_cxy , chdev_ptr ); 513 #endif 514 } 515 } 516 470 517 } 471 518 } // end internal_devices_init() … … 556 603 } 557 604 605 if ( func == DEV_FUNC_IOC && impl == IMPL_IOC_SPI ) 606 { 607 continue; 608 } 609 558 610 // compute target cluster for chdev[func,channel,direction] 559 611 uint32_t offset = ext_chdev_gid % ( info->x_size * (info->y_max) ); // [FIXME] … … 814 866 else if( func == DEV_FUNC_DMA ) lapic_input.dma[channel] = id; 815 867 else if( func == DEV_FUNC_TXT ) lapic_input.mtty = id; 868 else if( func == DEV_FUNC_IOC ) lapic_input.sdcard = id; 816 869 else assert( false , "illegal source device for LAPIC input" ); 817 870 }
Note: See TracChangeset
for help on using the changeset viewer.