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); } }
/* * SIOの割込みサービスルーチン */ void sio_isr(intptr_t exinf) { SIOPCB *p_siopcb; p_siopcb = get_siopcb(exinf); /* * 割込みのクリア */ UARTIntClear(p_siopcb->p_siopinib->base, UARTIntStatus(p_siopcb->p_siopinib->base, true)); if (UARTCharsAvail(p_siopcb->p_siopinib->base)) { /* * 受信通知コールバックルーチンを呼び出す. */ sio_irdy_rcv(p_siopcb->exinf); } if (UARTSpaceAvail(p_siopcb->p_siopinib->base)) { /* * 送信可能コールバックルーチンを呼び出す. */ sio_irdy_snd(p_siopcb->exinf); } }
/* * 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; } }
/** * \ingroup SIOAPI * \brief 割込みサービスルーチン * \param exinf 拡張 * \details * porting.txtの8.3節で養成されている割り込みサービスルーチン。 * このルーチンはextinfの情報を元にどの割り込みが発生したか自動判別 * している。 * * extinfにどのような情報を与えるかは、明言されていないように思える。 * CORTEX-M3版ではポート番号(1から始まってTNUM_PORTまでの識別 * 番号)がtarget_erial.cfgの中でATTISRのextinf引数として与えられている。 */ void sio_isr(intptr_t exinf) { SIOPCB* siopcb = GET_SIOPCB(exinf); int32_t reg = siopcb->reg_base; /* 送信コールバック可能でかつ送信可能なら、送信コールバックを呼ぶ */ if (sio_putready(siopcb) && ( uart_read(reg, UART_IER) & IER_TX)) { sio_irdy_snd(siopcb->exinf); } /* 受信コールバック可能でかつ受信可能なら、受信コールバックを呼ぶ */ if (sio_getready(siopcb) && ( uart_read(reg, UART_IER) & IER_RX)) { sio_irdy_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); } }
/* * SIOの割込みサービスルーチン */ void sio_isr(intptr_t exinf) { SIOPCB *p_siopcb = &(siopcb_table[0]); int_t n; if (p_siopcb->snd_flag) { if ((n = write(p_siopcb->write_fd, &(p_siopcb->snd_buf), 1)) > 0) { p_siopcb->snd_flag = false; if (p_siopcb->snd_rdy) { sio_irdy_snd(p_siopcb->exinf); } } } if (!p_siopcb->rcv_flag) { if ((n = read(p_siopcb->read_fd, &(p_siopcb->rcv_buf), 1)) > 0) { p_siopcb->rcv_flag = true; if (p_siopcb->rcv_rdy) { sio_irdy_rcv(p_siopcb->exinf); } } } }
/* * シリアルI/Oポートからの送信可能コールバック */ void upd72001_irdy_snd(intptr_t exinf) { sio_irdy_snd(exinf); }
void bt_sio_cyc(/*ID siopid*/intptr_t unused) { // Fill the send buffer while(bt_snd_cbr_ena && bt_send_buffer_bytes[bt_send_buffer_idx] < BT_SND_BUF_SIZE) sio_irdy_snd(bt_siopcb->exinf); }
void bt_snd_alm(intptr_t unused) { sio_irdy_snd(bt_siopcb->exinf); }
/* * シリアルI/Oポートからの送信可能コールバック */ void scif_irdy_snd(intptr_t exinf) { sio_irdy_snd(exinf); }