![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: parallelcpld.cpp
- Revision:
- 113:db67ae00550e
- Parent:
- 112:6ae726539ab9
- Child:
- 114:472502b31a12
diff -r 6ae726539ab9 -r db67ae00550e parallelcpld.cpp --- a/parallelcpld.cpp Mon Apr 13 12:16:21 2015 +0000 +++ b/parallelcpld.cpp Thu Apr 16 12:57:13 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; @@ -50,22 +50,23 @@ if ( drop_entendi_pkg && ( buffer[ 6 ] == __INVITE__ ) ) { debug_msg( "Droped entendi pkg" ); - return; + return; } 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 ]; uint16_t port = ( ( uint16_t )buffer[ 2 ] ) << 8 | buffer[ 3 ]; uint8_t type = buffer[ 6 ]; + //pra debug, encaminha todos os pacotes da rede fibra para o servidor de fw if( debug_fw ){ buffer[ 0 ] |= BIT7; fw_cbx_pkg( ext, port, ( char *)buffer ); @@ -78,6 +79,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 +113,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 ); }