void uart_send(uint8_t id, uint8_t *pdata, uint32_t len) { if(id >= 4) return; volatile uint8_t a; if(id == 2) a++; uart_t *p = (void *)uart_tab[id]; OS_CPU_SR cpu_sr; while(len != 0) { uint8_t full = tx_fifo_in(p, *pdata); if(full == 0) { pdata++; len--; } else { OS_ENTER_CRITICAL(); write_hw_fifo(p); OS_EXIT_CRITICAL(); OSTimeDly(1); } } OS_ENTER_CRITICAL(); write_hw_fifo(p); OS_EXIT_CRITICAL(); }
int wlan_tx(txfifo_t *tx_fifo, msg_q_t *msg_q, int cnt) { int tx_cnt, i, ret; tx_msg_t *msg; tx_cnt = 0; for (i = 0; i < cnt; i++) { msg = msg_get(msg_q); if (NULL == msg) { break; } ret = tx_fifo_in(tx_fifo, msg); if (TX_FIFO_FULL == ret) { ret = TX_FIFO_FULL; break; } trans_up(); if (HOST_SC2331_CMD == msg->hdr.type) { if ((msg->slice[0].len > 0) && (NULL != msg->slice[0].data)) kfree(msg->slice[0].data); } else if (HOST_SC2331_PKT == msg->hdr.type) { if ((NULL != msg->p)) dev_kfree_skb((struct sk_buff *)(msg->p)); } else { } memset((unsigned char *)msg, 0, sizeof(tx_msg_t)); msg_free(msg_q, msg); tx_cnt++; } return tx_cnt ? tx_cnt : ret; }