- Timestamp:
- Sep 21, 2018, 10:20:35 PM (6 years ago)
- Location:
- trunk/hal/tsar_mips32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/Makefile
r457 r534 17 17 18 18 DRIVERS_OBJS = $(HAL_ARCH)/build/drivers/soclib_tty.o \ 19 $(HAL_ARCH)/build/drivers/soclib_mtty.o \ 19 20 $(HAL_ARCH)/build/drivers/soclib_bdv.o \ 20 21 $(HAL_ARCH)/build/drivers/soclib_hba.o \ -
trunk/hal/tsar_mips32/core/hal_drivers.c
r492 r534 26 26 27 27 #include <soclib_tty.h> 28 #include <soclib_mtty.h> 28 29 #include <soclib_pic.h> 29 30 #include <soclib_iob.h> … … 49 50 uint32_t impl ) 50 51 { 51 assert( (impl == IMPL_TXT_TTY), "bad implementation" ); 52 53 soclib_tty_init( txt ); 52 switch (impl) { 53 case IMPL_TXT_TTY : { 54 soclib_tty_init( txt ); 55 break; 56 } 57 case IMPL_TXT_MTY : { 58 soclib_mtty_init( txt ); 59 break; 60 } 61 default : { 62 assert( false, "bad implementation" ); 63 } 64 } 54 65 } 55 66 -
trunk/hal/tsar_mips32/drivers/soclib_mtty.c
r533 r534 53 53 54 54 __attribute__((section(".kdata"))) 55 tty_fifo_ttty_rx_fifo[CONFIG_MAX_TXT_CHANNELS];55 mtty_fifo_t mtty_rx_fifo[CONFIG_MAX_TXT_CHANNELS]; 56 56 57 57 __attribute__((section(".kdata"))) 58 tty_fifo_ttty_tx_fifo[CONFIG_MAX_TXT_CHANNELS];58 mtty_fifo_t mtty_tx_fifo[CONFIG_MAX_TXT_CHANNELS]; 59 59 60 60 /////////////////////////////////////// … … 84 84 if( is_rx ) 85 85 { 86 tty_rx_fifo[channel].sts = 0;87 tty_rx_fifo[channel].ptr = 0;88 tty_rx_fifo[channel].ptw = 0;86 mtty_rx_fifo[channel].sts = 0; 87 mtty_rx_fifo[channel].ptr = 0; 88 mtty_rx_fifo[channel].ptw = 0; 89 89 } 90 90 else 91 91 { 92 tty_tx_fifo[channel].sts = 0;93 tty_tx_fifo[channel].ptr = 0;94 tty_tx_fifo[channel].ptw = 0;92 mtty_tx_fifo[channel].sts = 0; 93 mtty_tx_fifo[channel].ptr = 0; 94 mtty_tx_fifo[channel].ptw = 0; 95 95 } 96 96 } // end soclib_mtty_init() … … 99 99 void __attribute__ ((noinline)) soclib_mtty_cmd( xptr_t th_xp ) 100 100 { 101 tty_fifo_t * fifo; // MTTY_RX or MTTY_TX FIFO101 mtty_fifo_t * fifo; // MTTY_RX or MTTY_TX FIFO 102 102 char byte; // byte value 103 103 uint32_t done; // number of bytes moved … … 138 138 if( type == TXT_WRITE ) // write bytes to MTTY_TX FIFO 139 139 { 140 fifo = & tty_tx_fifo[channel];140 fifo = &mtty_tx_fifo[channel]; 141 141 142 142 done = 0; … … 190 190 else if( type == TXT_READ ) // read bytes from MTTY_RX FIFO 191 191 { 192 fifo = & tty_rx_fifo[channel];192 fifo = &mtty_rx_fifo[channel]; 193 193 194 194 done = 0; … … 257 257 process_t * owner_ptr; // local pointer on TXT owner process 258 258 pid_t owner_pid; // TXT owner process identifier 259 tty_fifo_t * fifo; // pointer on MTTY_TX or MTTY_RX FIFO259 mtty_fifo_t * fifo; // pointer on MTTY_TX or MTTY_RX FIFO 260 260 cxy_t tty_cxy; // soclib_mtty cluster 261 261 uint32_t * tty_ptr; // soclib_mtty segment base address … … 308 308 if( is_rx ) 309 309 { 310 fifo = & tty_rx_fifo[channel];310 fifo = &mtty_rx_fifo[channel]; 311 311 312 312 // try to move bytes until MTTY_READ register empty … … 469 469 else 470 470 { 471 fifo = & tty_tx_fifo[channel];471 fifo = &mtty_tx_fifo[channel]; 472 472 473 473 // try to move bytes until TX_FIFO empty -
trunk/hal/tsar_mips32/drivers/soclib_mtty.h
r533 r534 65 65 #define MTTY_FIFO_DEPTH 128 66 66 67 typedef struct tty_fifo_s // 32 bytes67 typedef struct mtty_fifo_s // 32 bytes 68 68 { 69 69 char data[MTTY_FIFO_DEPTH]; // one char per slot … … 71 71 unsigned int ptw; // next full slot index 72 72 unsigned int sts; // number of full slots 73 } tty_fifo_t;73 } mtty_fifo_t; 74 74 75 75 -
trunk/hal/tsar_mips32/drivers/soclib_pic.c
r492 r534 367 367 // get the source chdev functionnal type, channel, and direction 368 368 uint32_t func = src_chdev->func; 369 uint32_t impl = src_chdev->impl; 369 370 uint32_t channel = src_chdev->channel; 370 371 bool_t is_rx = src_chdev->is_rx; 371 372 372 373 if( (func == DEV_FUNC_IOC) || (func == DEV_FUNC_NIC) || 373 (func == DEV_FUNC_TXT ) || (func == DEV_FUNC_IOB) ) // external IRQ => WTI374 (func == DEV_FUNC_TXT && impl == IMPL_TXT_TTY) || (func == DEV_FUNC_IOB) ) // external IRQ => WTI 374 375 { 375 376 // get external IRQ index … … 415 416 416 417 } 417 else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) ) // internal IRQ => HWI 418 else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) || 419 (func == DEV_FUNC_TXT && impl == IMPL_TXT_MTY) ) // internal IRQ => HWI 418 420 { 419 421 // get internal IRQ index 420 422 uint32_t hwi_id; 421 423 if( func == DEV_FUNC_DMA ) hwi_id = lapic_input.dma[channel]; 424 else if (func == DEV_FUNC_TXT ) hwi_id = lapic_input.mtty; 422 425 else hwi_id = lapic_input.mmc; 423 426
Note: See TracChangeset
for help on using the changeset viewer.