ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
3 мая
747850 Топик полностью
SciFi (06.04.2017 17:22, просмотров: 154) ответил vllv на Где голова, из регистров DMA вычитывать?
Естественно. int uart_rxcount(void) { int ndtr[2], isr[2]; ndtr[0] = ~0; isr[0] = ~0; do { ndtr[1] = ndtr[0]; isr[1] = isr[0]; ndtr[0] = DMA1_Channel5->CNDTR; isr[0] = DMA1->ISR & DMA_ISR_TCIF5; } while (ndtr[0] != ndtr[1] || isr[0] != isr[1]); unsigned int rxhead = RX_BUFSIZE - ndtr[0]; if (isr[0]) { rxhead += RX_BUFSIZE; DMA1->IFCR = DMA_IFCR_CTCIF5; } return rxhead - rxtail; }
ส็็็็็็็็็็็็็็็็็็็็็็็็็༼ ຈل͜ຈ༽ส้้้้้้้้้้้้้้้้้้้้้้้