/* * uart interrupt service routine */ static void dw_apb_uart_int_isr(SIOPCB *p_siopcb) { uint32_t status = 0; uint32_t lsr = 0; DW_APB_UART_STRUCT_PTR regs = p_siopcb->p_siopinib->regs; status = regs->IIR & IIR_INT_ID_MASK; switch (status) { case IIR_MDM_STATUS: break; case IIR_LINE_STATUS: /* overrun, parity error, framing error */ lsr = regs->LSR; lsr = lsr; break; case IIR_XMIT_EMPTY: sio_irdy_snd(p_siopcb->exinf); break; case IIR_RX_TIMEOUT: case IIR_DATA_AVAIL: /* read all received data */ do { sio_irdy_rcv(p_siopcb->exinf); } while (uart_getready(regs)); break; default: break; } }
void uart_sio_isr(/*ID siopid*/intptr_t unused) { if(uart_rcv_cbflg) while(uart_getready(&UART1)) { //uart_rx = buf[i]; /* * 受信通知コールバックルーチンを呼び出す. */ sio_irdy_rcv(uart_siopcb->exinf); } uint32_t lsr = UART1.LSR; if(uart_snd_cbflg && (lsr & UART_LSR_THRE) /*uart_putready(p_uart)*/) { // uart_tx_fifo_sem = 16; // /* // * 送信可能コールバックルーチンを呼び出す. // */ // sio_irdy_snd(p_siopcb->exinf); SIL_PRE_LOC; SIL_LOC_INT(); uart_tx_fifo_sem = 16; SIL_UNL_INT(); //for(int i = 0; i < 16 && uart_snd_cbflg; ++i) sio_irdy_snd(uart_siopcb->exinf); } }
void bluetooth_uart_isr() { //#ifdef DEBUG // printf("[bluetooth] Enter ISR."); //#endif // RX if(rx_size > 0) { while (rx_size > 0 && uart_getready(p_uart)) { *rx_ptr++ = p_uart->RBR_THR; rx_size--; } if (rx_size == 0) { #if defined(DEBUG) syslog(LOG_DEBUG, "[bluetooth] Finished receiving a block."); #endif assert(rx_cb != NULL); rx_cb(); } } else { p_uart->IER &= ~0x1; } // TX while(tx_size > 0 && uart_putready(p_uart)) { p_uart->RBR_THR = *tx_ptr++; if(--tx_size == 0) { #if defined(DEBUG) syslog(LOG_DEBUG, "[bluetooth] Finished sending a block."); #endif p_uart->IER &= ~0x2; assert(tx_cb != NULL); tx_cb(); } } }
/* * シリアルI/Oポートからの文字受信 */ INT uart_rcv_chr(SIOPCB *siopcb) { if (uart_getready(siopcb)) { return((INT)(UB) uart_getchar(siopcb)); } return(-1); }
/* * シリアルI/Oポートからの文字受信 */ int_t sio_rcv_chr(SIOPCB *siopcb) { if (uart_getready(siopcb)) { return((int_t)(uint8_t) uart_getchar(siopcb)); } return(-1); }
/* * シリアルI/Oポートからの文字受信 */ int_t uart_recv(uart_t *p_uart) { if (uart_getready(p_uart)) { //while(!uart_getready(p_uart));{ return((int_t)p_uart->RBR_THR); } return(-1); }
/* * シリアルI/Oポートに対する割込み処理 */ static void uart_rx_isr_siop(SIOPCB *siopcb) { if (uart_getready(siopcb)) { /* * 受信通知コールバックルーチンを呼び出す. */ uart_ierdy_rcv(siopcb->exinf); } }
/* * SIOの割込みサービスルーチン */ void int_timer2() { SIOPCB *siopcb = &(siopcb_table[0]); sil_rew_mem((VP)(TADR_TC_BASE+TC_WINDOW*2+TOFF_TC_SR)); if (uart_getready(siopcb)) { /* * 受信通知コールバックルーチンを呼び出す. */ uart_ierdy_rcv(siopcb->exinf); } }
/* * SIOの割込みハンドラ */ void sio_handler(void) { SIOPCB *p_siopcb = get_siopcb((x_prc_index() + 1)); if (uart_getready(p_siopcb)) { /* * 受信通知コールバックルーチンを呼び出す. */ sio_irdy_rcv(p_siopcb->exinf); } if (uart_putready(p_siopcb)) { /* * 送信可能コールバックルーチンを呼び出す. */ sio_irdy_snd(p_siopcb->exinf); } }
void sio_handler1(void) { SIOPCB *p_siopcb = &(siopcb_table[0]); if (uart_getready(p_siopcb)) { /* * 受信通知コールバックルーチンを呼び出す. */ sio_irdy_rcv(p_siopcb->exinf); } if (uart_putready(p_siopcb)) { /* * 送信可能コールバックルーチンを呼び出す. */ sio_irdy_snd(p_siopcb->exinf); } }
/* * シリアルI/Oポートからの文字受信 */ INT uart_rcv_chr(SIOPCB *siopcb) { #ifndef USE_JTAG_UART if (uart_getready(siopcb)) { return((INT)(UB) uart_getchar(siopcb)); } return(-1); #else UB tmp; if (jtag_uart_buf != -1) { tmp = jtag_uart_buf; jtag_uart_buf = -1; return tmp; } return(-1); #endif /* USE_JTAG_UART */ }
/* * シリアルI/Oポートに対する割込み処理 */ static void uart_isr_siop(SIOPCB *siopcb) { /* * エッジ割込みのため割込み処理前にACK */ intc_ack_interrupt(1 << (UARTINTLVL - 1)); if (uart_getready(siopcb)) { /* * 受信通知コールバックルーチンを呼び出す. */ uart_ierdy_rcv(siopcb->exinf); } if (uart_putready(siopcb)) { /* * 送信可能コールバックルーチンを呼び出す. */ uart_ierdy_snd(siopcb->exinf); } }