Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: parallelcpld.cpp
- Revision:
- 116:39a41ebb675c
- Parent:
- 114:472502b31a12
- Child:
- 117:e9facba9db27
--- a/parallelcpld.cpp Thu Apr 23 13:57:54 2015 +0000 +++ b/parallelcpld.cpp Thu Apr 23 20:24:09 2015 +0000 @@ -14,9 +14,9 @@ DigitalOut hw_extern_wdt( p23 ); -uint8_t cb_tx_buffer[ __CB_BUFFER_SIZE__ ]; +uint8_t cb_tx_buffer[ CB_BUFFER_SIZE ]; -uint8_t TXBuffer[ __CB_BUFFER_SIZE__ ]; +uint8_t TXBuffer[ CB_BUFFER_SIZE ]; uint8_t tx_clear = 1; @@ -55,11 +55,11 @@ if( tx_clear == 1 ){ tx_clear = 0; - xmemcpy( TXBuffer, buffer, __CB_BUFFER_SIZE__ ); + xmemcpy( TXBuffer, buffer, CB_BUFFER_SIZE ); // Send the first position of TXBuffer first parallel_write( TXBuffer[ 0 ] ); DataReady = 1; - xmemcpy( cb_tx_buffer, buffer, __CB_BUFFER_SIZE__ ); + xmemcpy( cb_tx_buffer, buffer, CB_BUFFER_SIZE ); cpld_pkg_tx_counter++; uint16_t ext = ( ( uint16_t )buffer[ 0 ] ) << 8 | buffer[ 1 ]; @@ -78,6 +78,8 @@ // Error if the transmission is still in use uint8_t ret = ring_buffer_add( rb, buffer ); + delayed_pkg_to_cb++; + if( ret == 0x01 ) if( dparallel ) debug_msg("Error: Ring buffer fully charged"); if( ret == 0x00 ) if( dparallel ) debug_msg("Success : package queued -- on queue %u", rb->size ); @@ -110,9 +112,9 @@ void tx_buffer_ring_buffer_handler( void ){ //if( ( rb->size != 0x00 ) && ( tx_clear == 1 ) && ( delay_to_send_to_cbx.read_ms() > 7 ) ){ if( ( rb->size != 0x00 ) && ( tx_clear == 1 ) ){ - //uint8_t buffer[ __CB_BUFFER_SIZE__ ]; + //uint8_t buffer[ CB_BUFFER_SIZE ]; uint8_t * _rb_next = ring_buffer_get_next( rb ); - //xmemcpy( buffer, _rb_next, __CB_BUFFER_SIZE__ ); + //xmemcpy( buffer, _rb_next, CB_BUFFER_SIZE ); if( dparallel ) send_msg( "Ring Buffer less one -- remain %u", rb->size ); send2callboxes( _rb_next ); }