Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
119:ee6a53069455
Parent:
117:e9facba9db27
Child:
124:c1b6c893e1c3
--- a/parallelcpld.cpp	Fri Apr 24 13:54:24 2015 +0000
+++ b/parallelcpld.cpp	Thu Apr 30 15:42:41 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;
 
@@ -47,7 +47,7 @@
     
     delay_to_send_to_cbx.reset();
     
-    if ( drop_entendi_pkg && ( buffer[ 6 ] == __INVITE__ ) )
+    if ( drop_entendi_pkg && ( buffer[ 6 ] == INVITE ) )
     {
         debug_msg( "Droped entendi pkg" );
         return;    
@@ -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 ];
@@ -72,12 +72,14 @@
         }
         
         if( debug_cb_tx == true ){            
-            if( type != __AUDIO__ ) send_msg("Pkg to CBx :: ( %d, %d ) -- Type :: %d", ext, port, type );            
+            if( type != AUDIO ) send_msg("Pkg to CBx :: ( %d, %d ) -- Type :: %d", ext, port, type );            
         } 
     }else{
         // 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 );        
     }