refactor: 精简R8裸机工程并补强调试链路
This commit is contained in:
@@ -87,6 +87,7 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
|
||||
{
|
||||
struct pbuf *q;
|
||||
uint32_t primask;
|
||||
uint32_t start_tick;
|
||||
|
||||
LWIP_UNUSED_ARG(netif);
|
||||
primask = ethernetif_lock();
|
||||
@@ -95,11 +96,20 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
|
||||
pbuf_remove_header(p, ETH_PAD_SIZE);
|
||||
#endif
|
||||
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
ch390_write_mem(q->payload, q->len);
|
||||
start_tick = HAL_GetTick();
|
||||
while (ch390_read_reg(CH390_TCR) & TCR_TXREQ) {
|
||||
if ((HAL_GetTick() - start_tick) > 10u) {
|
||||
ethernetif_unlock(primask);
|
||||
#if ETH_PAD_SIZE
|
||||
pbuf_add_header(p, ETH_PAD_SIZE);
|
||||
#endif
|
||||
LINK_STATS_INC(link.drop);
|
||||
return ERR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
while (ch390_read_reg(CH390_TCR) & TCR_TXREQ) {
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
ch390_write_mem(q->payload, q->len);
|
||||
}
|
||||
|
||||
ch390_write_reg(CH390_TXPLL, p->tot_len & 0xFFu);
|
||||
|
||||
Reference in New Issue
Block a user