duff, thanks for creating this library.
question on buffered write
which in turn calls this
if TX_BUFFER_SIZE is 64 and count is >64, it looks like only 64 bytes are sent? what happens to the rest?
ok, I see memcpy_fast( tx_buffer+head, buffer, count );
but isn't tx_buffer only 64 bytes?
question on buffered write
Code:
virtual size_t write( const uint8_t *buffer, size_t size ) {
serial_dma_write( buffer, size );
return size;
}
which in turn calls this
Code:
void Uart1Event::serial_dma_write( const void *buf, unsigned int count ) {
uint8_t * buffer = ( uint8_t * )buf;
uint32_t head = tx_buffer_head;
uint32_t cnt = count;
uint32_t free = serial_dma_write_buffer_free( );
if ( cnt > free ) cnt = free;
uint32_t next = head + cnt;
bool wrap = next >= TX_BUFFER_SIZE ? true : false;
if ( wrap ) {
uint32_t over = next - TX_BUFFER_SIZE;
uint32_t under = TX_BUFFER_SIZE - head;
memcpy_fast( tx_buffer+head, buffer, under );
memcpy_fast( tx_buffer, buffer+under, over );
head = over;
}
else {
memcpy_fast( tx_buffer+head, buffer, count );
head += cnt;
}
tx_buffer_head = head;
if ( !transmitting ) {
transmitting = true;
__disable_irq( );
tx.TCD->CITER = cnt;
tx.TCD->BITER = cnt;
tx.enable( );
__enable_irq( );
}
}
if TX_BUFFER_SIZE is 64 and count is >64, it looks like only 64 bytes are sent? what happens to the rest?
ok, I see memcpy_fast( tx_buffer+head, buffer, count );
but isn't tx_buffer only 64 bytes?
Last edited: