![](/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
debug.h@119:ee6a53069455, 2015-04-30 (annotated)
- Committer:
- klauss
- Date:
- Thu Apr 30 15:42:41 2015 +0000
- Revision:
- 119:ee6a53069455
- Parent:
- 117:e9facba9db27
- Child:
- 120:770f00554b1e
funcionalidade - clock "ogro" - implementada
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 69:65665afbad5d | 1 | /** |
klauss | 69:65665afbad5d | 2 | * @file debug.h |
klauss | 69:65665afbad5d | 3 | * @Synopsis Instrumenta o uso de debug no código da header. |
klauss | 69:65665afbad5d | 4 | * @author Jhonatan Casale / PedroZN |
klauss | 69:65665afbad5d | 5 | * @version 1 |
klauss | 69:65665afbad5d | 6 | * @date 2014-11-05 |
klauss | 69:65665afbad5d | 7 | */ |
klauss | 0:4d17cd9c8f9d | 8 | #ifndef __DEBUG_H__ |
klauss | 0:4d17cd9c8f9d | 9 | #define __DEBUG_H__ |
klauss | 0:4d17cd9c8f9d | 10 | |
klauss | 0:4d17cd9c8f9d | 11 | #include <stdint.h> |
klauss | 0:4d17cd9c8f9d | 12 | #include <stdio.h> |
klauss | 0:4d17cd9c8f9d | 13 | #include "mbed.h" |
klauss | 0:4d17cd9c8f9d | 14 | #include "EthernetInterface.h" |
klauss | 74:81c47fff88a5 | 15 | #include "string.h" |
klauss | 74:81c47fff88a5 | 16 | #include "shared_variables.h" |
klauss | 0:4d17cd9c8f9d | 17 | |
klauss | 109:a5b8264ffbbc | 18 | extern UDPSocket eth_fw_debug; |
klauss | 109:a5b8264ffbbc | 19 | extern Endpoint eth_fw_debug_server; |
klauss | 109:a5b8264ffbbc | 20 | |
klauss | 119:ee6a53069455 | 21 | const uint16_t DEBUG_MSG_SIZE = 1024; |
klauss | 119:ee6a53069455 | 22 | const uint8_t DEBUG_AUX_MSG_SIZE = 64; |
klauss | 119:ee6a53069455 | 23 | |
klauss | 119:ee6a53069455 | 24 | extern char debug_msg1[ DEBUG_MSG_SIZE + DEBUG_AUX_MSG_SIZE ]; |
klauss | 69:65665afbad5d | 25 | ///< Buffer usado na composisão da mensagem enviada pela macro debug_msg |
klauss | 119:ee6a53069455 | 26 | extern char debug_msg2[ DEBUG_MSG_SIZE ]; |
klauss | 69:65665afbad5d | 27 | ///< Buffer usado na composisão da mensagem enviada pela macro debug_msg |
klauss | 119:ee6a53069455 | 28 | extern char msg_[ DEBUG_MSG_SIZE ]; |
klauss | 69:65665afbad5d | 29 | ///< Buffer utilizado pela macro send_msg |
klauss | 14:22a35f575502 | 30 | |
klauss | 74:81c47fff88a5 | 31 | extern bool cb_session; |
klauss | 74:81c47fff88a5 | 32 | ///< Não utilizada atualmente. |
klauss | 74:81c47fff88a5 | 33 | extern bool cb_status; |
klauss | 74:81c47fff88a5 | 34 | ///< Não utilizada atualmente. |
klauss | 74:81c47fff88a5 | 35 | extern bool debug_telemetry; |
klauss | 74:81c47fff88a5 | 36 | ///< Variável de controle que aciona o debug de telemetria. |
klauss | 74:81c47fff88a5 | 37 | extern bool main_test; |
klauss | 74:81c47fff88a5 | 38 | ///< Variável de controle para acionamento de algum comando de interesse. |
klauss | 74:81c47fff88a5 | 39 | |
klauss | 119:ee6a53069455 | 40 | extern bool sizes; |
klauss | 119:ee6a53069455 | 41 | |
klauss | 119:ee6a53069455 | 42 | extern bool debug_reconnect; |
klauss | 119:ee6a53069455 | 43 | extern uint16_t miss_debug_fw_send_pkg; |
klauss | 119:ee6a53069455 | 44 | extern uint16_t miss_sip_registry_send_pkg; |
klauss | 119:ee6a53069455 | 45 | extern uint16_t miss_sip_invite_send_pkg; |
klauss | 119:ee6a53069455 | 46 | extern uint16_t miss_sip_bye_send_pkg; |
klauss | 119:ee6a53069455 | 47 | extern uint16_t miss_sip_unregistry_send_pkg; |
klauss | 119:ee6a53069455 | 48 | extern uint16_t miss_sip_ok_send_pkg; |
klauss | 119:ee6a53069455 | 49 | extern uint16_t miss_sip_rcv_bye_send_pkg; |
klauss | 119:ee6a53069455 | 50 | extern uint16_t miss_wdt_send_pkg; |
klauss | 119:ee6a53069455 | 51 | extern uint16_t miss_sip_inc_pkg; |
klauss | 119:ee6a53069455 | 52 | extern uint16_t miss_udp_prompt_send_pkg; |
klauss | 119:ee6a53069455 | 53 | extern uint16_t miss_closk_send_pkg; |
klauss | 119:ee6a53069455 | 54 | |
klauss | 119:ee6a53069455 | 55 | extern bool show_uptime; |
klauss | 119:ee6a53069455 | 56 | |
klauss | 75:bd3c647b860b | 57 | extern bool debug_sip; |
klauss | 74:81c47fff88a5 | 58 | ///< Variável de controle que ativa o debug sip. |
klauss | 75:bd3c647b860b | 59 | extern bool debug_prompt; |
klauss | 74:81c47fff88a5 | 60 | ///< Variável de controle que ativa o debug do prompt. |
klauss | 75:bd3c647b860b | 61 | extern bool debug_vector; |
klauss | 74:81c47fff88a5 | 62 | ///< Variável de controle que ativa o debug do vector. |
klauss | 75:bd3c647b860b | 63 | extern bool debug_cb; |
klauss | 74:81c47fff88a5 | 64 | ///< Variável de controle que ativa o debug da classe Call_box. |
klauss | 75:bd3c647b860b | 65 | extern bool debug_main; |
klauss | 74:81c47fff88a5 | 66 | ///< Variável de controle que ativa o debug da main. |
klauss | 75:bd3c647b860b | 67 | extern bool debug_cks; |
klauss | 74:81c47fff88a5 | 68 | ///< Variável de controle que ativa o debug do ckechsum dos pacotes recebidos. |
klauss | 75:bd3c647b860b | 69 | extern bool debug_cb_rx; |
klauss | 74:81c47fff88a5 | 70 | ///< Variável de controle que ativa o debug dos pacotes recebidos do CBx. |
klauss | 75:bd3c647b860b | 71 | extern bool debug_cb_tx; |
klauss | 74:81c47fff88a5 | 72 | ///< Variável de controle que ativa o debug dos pacotes enviados para o CBx. |
klauss | 75:bd3c647b860b | 73 | extern bool debug_eth_rx; |
klauss | 74:81c47fff88a5 | 74 | ///< Variável de controle que ativa o debug dos pacotes recebidos da eth \note não implementado. |
klauss | 75:bd3c647b860b | 75 | extern bool debug_eth_tx; |
klauss | 74:81c47fff88a5 | 76 | ///< Variável de controle que ativa o debug dos pacotes enviados para a eth \note não implementado. |
klauss | 75:bd3c647b860b | 77 | extern bool debug_prompt_eth; |
klauss | 74:81c47fff88a5 | 78 | ///< Variável de controle que ativa o debug do prompt eth. |
klauss | 75:bd3c647b860b | 79 | extern bool debug_file; |
klauss | 74:81c47fff88a5 | 80 | ///< Variável de controle que ativa o debug do sistema de arquivos. |
klauss | 74:81c47fff88a5 | 81 | extern bool dbl; |
klauss | 74:81c47fff88a5 | 82 | ///< Variável de controle que ativa o debug do protocolo de bootloader dos CBx |
klauss | 74:81c47fff88a5 | 83 | extern bool dparallel; |
klauss | 74:81c47fff88a5 | 84 | ///< Variável de controle que aciona o debug de envio de pacotes pro cb, quando se |
klauss | 74:81c47fff88a5 | 85 | ///< quer transmitir um pacote enquanto outro pacote, já esta em transmissao. |
klauss | 75:bd3c647b860b | 86 | extern bool test_debug; |
klauss | 74:81c47fff88a5 | 87 | ///< Variável de controle que ativa o debug de test. |
klauss | 78:1353744f01e1 | 88 | extern bool debug_aging; |
klauss | 78:1353744f01e1 | 89 | ///< Variável de controle que ativa o debug da funçao de aging do registro. |
klauss | 78:1353744f01e1 | 90 | |
klauss | 119:ee6a53069455 | 91 | extern bool debug_clock; |
klauss | 78:1353744f01e1 | 92 | extern bool debug_invite; |
klauss | 78:1353744f01e1 | 93 | extern bool debug_wake; |
klauss | 81:3656f00ab3db | 94 | extern bool debug_muted; |
klauss | 78:1353744f01e1 | 95 | extern bool debug_cpld; |
klauss | 119:ee6a53069455 | 96 | extern bool debug_show_cpld; |
klauss | 78:1353744f01e1 | 97 | extern bool debug_cks_err; |
klauss | 78:1353744f01e1 | 98 | extern bool debug_ping; |
klauss | 81:3656f00ab3db | 99 | extern bool debug_refresh; |
klauss | 81:3656f00ab3db | 100 | extern bool long_list; |
klauss | 81:3656f00ab3db | 101 | extern bool debug_out_of_range; |
klauss | 81:3656f00ab3db | 102 | extern bool debug_wdt; |
klauss | 81:3656f00ab3db | 103 | extern bool debug_eth; |
klauss | 81:3656f00ab3db | 104 | extern bool wdt_show; |
klauss | 87:679ee0d594a9 | 105 | extern bool debug_rtp; |
klauss | 89:0fe315117b00 | 106 | extern bool debug_memory; |
klauss | 98:43b45f26b430 | 107 | extern bool debug_port_match; |
klauss | 99:e80850c51106 | 108 | extern bool debug_fw; |
klauss | 119:ee6a53069455 | 109 | extern bool debug_gp; |
klauss | 119:ee6a53069455 | 110 | extern bool missed_send_udp_pkg; |
klauss | 74:81c47fff88a5 | 111 | |
klauss | 99:e80850c51106 | 112 | extern bool debug_boot; |
klauss | 99:e80850c51106 | 113 | extern bool debug_fw_print; |
klauss | 100:09a23fcd3bdf | 114 | extern bool debug_uart3; |
klauss | 100:09a23fcd3bdf | 115 | extern bool big_bug_pkg; |
klauss | 100:09a23fcd3bdf | 116 | extern bool flood_bug_pkg; |
klauss | 119:ee6a53069455 | 117 | extern uint16_t miss_ftp_udp_send_pkg; |
klauss | 119:ee6a53069455 | 118 | extern bool reset_missed_send_udp_pkg; |
klauss | 119:ee6a53069455 | 119 | extern bool debug_missed; |
klauss | 119:ee6a53069455 | 120 | extern uint16_t deleted_sip; |
klauss | 108:18a3702650f3 | 121 | extern bool dshow_rtp; |
klauss | 108:18a3702650f3 | 122 | extern bool dcallshow_rtp; |
klauss | 119:ee6a53069455 | 123 | extern bool debug_reset_rtp; |
klauss | 114:472502b31a12 | 124 | extern bool debug_rtp; |
klauss | 114:472502b31a12 | 125 | extern uint16_t deleted_sip; |
klauss | 109:a5b8264ffbbc | 126 | extern bool print_values; |
klauss | 109:a5b8264ffbbc | 127 | extern bool print_v_cb; |
klauss | 109:a5b8264ffbbc | 128 | extern bool print_v_call; |
klauss | 109:a5b8264ffbbc | 129 | extern bool print_cb_var; |
klauss | 109:a5b8264ffbbc | 130 | extern bool print_cb_all; |
klauss | 109:a5b8264ffbbc | 131 | extern bool print_hex_cb_var; |
klauss | 109:a5b8264ffbbc | 132 | extern bool print_hex_cb_all; |
klauss | 109:a5b8264ffbbc | 133 | extern bool print_sip_var; |
klauss | 109:a5b8264ffbbc | 134 | extern bool print_sip_all; |
klauss | 109:a5b8264ffbbc | 135 | extern bool print_hex_sip_var; |
klauss | 109:a5b8264ffbbc | 136 | extern bool print_hex_sip_all; |
klauss | 109:a5b8264ffbbc | 137 | |
klauss | 109:a5b8264ffbbc | 138 | extern bool print_call_var; |
klauss | 109:a5b8264ffbbc | 139 | extern bool print_call_all; |
klauss | 109:a5b8264ffbbc | 140 | extern bool print_hex_call_var; |
klauss | 109:a5b8264ffbbc | 141 | extern bool print_hex_call_all; |
klauss | 109:a5b8264ffbbc | 142 | |
klauss | 109:a5b8264ffbbc | 143 | extern bool print_rtp_var; |
klauss | 109:a5b8264ffbbc | 144 | extern bool print_rtp_all; |
klauss | 109:a5b8264ffbbc | 145 | extern bool print_hex_rtp_var; |
klauss | 109:a5b8264ffbbc | 146 | extern bool print_hex_rtp_all; |
klauss | 109:a5b8264ffbbc | 147 | extern bool tango; |
klauss | 109:a5b8264ffbbc | 148 | extern bool york; |
klauss | 109:a5b8264ffbbc | 149 | extern bool chicago; |
klauss | 109:a5b8264ffbbc | 150 | extern bool malasia; |
klauss | 109:a5b8264ffbbc | 151 | extern bool canada; |
klauss | 109:a5b8264ffbbc | 152 | extern bool america; |
klauss | 109:a5b8264ffbbc | 153 | extern bool frtp; |
klauss | 109:a5b8264ffbbc | 154 | extern bool rescue_rtp; |
klauss | 109:a5b8264ffbbc | 155 | extern bool drop_invite_pkg; |
klauss | 109:a5b8264ffbbc | 156 | extern bool drop_entendi_pkg; |
klauss | 109:a5b8264ffbbc | 157 | extern bool drop_invite_to_ast_pkg; |
klauss | 109:a5b8264ffbbc | 158 | extern bool drop_ok_pkg; |
klauss | 109:a5b8264ffbbc | 159 | extern bool drop_ack_pkg; |
klauss | 109:a5b8264ffbbc | 160 | extern bool drop_rtp_from_ast_pkg; |
klauss | 109:a5b8264ffbbc | 161 | extern bool drop_rtp_from_cbx_pkg; |
klauss | 119:ee6a53069455 | 162 | extern bool drop_registry_pkg; |
klauss | 112:6ae726539ab9 | 163 | extern bool cogumelo; |
klauss | 112:6ae726539ab9 | 164 | extern bool gnomo; |
klauss | 112:6ae726539ab9 | 165 | extern bool registra; |
klauss | 119:ee6a53069455 | 166 | extern bool received_audio_from_cb; |
klauss | 119:ee6a53069455 | 167 | extern bool debug_reconnect; |
klauss | 119:ee6a53069455 | 168 | extern uint16_t miss_ftp_udp_send_pkg; |
klauss | 117:e9facba9db27 | 169 | extern bool debug_bootloader; |
klauss | 119:ee6a53069455 | 170 | extern bool debug_bind; |
klauss | 119:ee6a53069455 | 171 | extern bool debug_app_init; |
klauss | 119:ee6a53069455 | 172 | extern bool debug_string_length; |
klauss | 119:ee6a53069455 | 173 | extern bool show_current_time; |
klauss | 69:65665afbad5d | 174 | /** |
klauss | 69:65665afbad5d | 175 | * @Synopsis Função usada anteriormente para formatação da string que debug, não esta mais em uso. |
klauss | 69:65665afbad5d | 176 | * |
klauss | 99:e80850c51106 | 177 | * * @param pkg Ponteiro para inicio dos dados a serem transmitidos. |
klauss | 69:65665afbad5d | 178 | * @param size Tamanho do pacote que deve ser enviado. |
klauss | 99:e80850c51106 | 179 | * |
klauss | 69:65665afbad5d | 180 | */ |
klauss | 99:e80850c51106 | 181 | int eth_fw_debug_pkgdebug_pkg( uint8_t * pkg, int size ); |
klauss | 0:4d17cd9c8f9d | 182 | |
klauss | 119:ee6a53069455 | 183 | /* |
klauss | 0:4d17cd9c8f9d | 184 | #define debug_msg(...) _debug_msg(__VA_ARGS__) |
klauss | 0:4d17cd9c8f9d | 185 | #define _debug_msg(...) { \ |
klauss | 0:4d17cd9c8f9d | 186 | sprintf(debug_msg1, "%s:%d ", __FILE__, __LINE__); \ |
klauss | 0:4d17cd9c8f9d | 187 | sprintf(debug_msg2, __VA_ARGS__); \ |
klauss | 0:4d17cd9c8f9d | 188 | strcat(debug_msg1, debug_msg2); \ |
klauss | 114:472502b31a12 | 189 | if( debug_uart3 ) pc.printf( "%s\n\r> ", debug_msg1 ); \ |
klauss | 114:472502b31a12 | 190 | if( tcp_session ){ \ |
klauss | 48:195c97f12e8e | 191 | strcat( debug_msg1, "\n\r" ); \ |
klauss | 78:1353744f01e1 | 192 | while( !( tcp_client.send_all( debug_msg1, strlen( debug_msg1 ) ) ) ); \ |
klauss | 114:472502b31a12 | 193 | }else if( udp_request ){ \ |
klauss | 114:472502b31a12 | 194 | udp_server.sendTo( udp_client, debug_msg1, strlen( debug_msg1 ) ); \ |
klauss | 44:cc4996469404 | 195 | } \ |
klauss | 0:4d17cd9c8f9d | 196 | } |
klauss | 119:ee6a53069455 | 197 | */ |
klauss | 119:ee6a53069455 | 198 | #define debug_msg(...) _debug_msg(__VA_ARGS__) |
klauss | 119:ee6a53069455 | 199 | #define _debug_msg(...) { \ |
klauss | 119:ee6a53069455 | 200 | snprintf( debug_msg1, DEBUG_AUX_MSG_SIZE, "%s:%d ", __FILE__, __LINE__); \ |
klauss | 119:ee6a53069455 | 201 | snprintf( debug_msg2, DEBUG_MSG_SIZE, __VA_ARGS__); \ |
klauss | 119:ee6a53069455 | 202 | strncat( debug_msg1, debug_msg2, DEBUG_MSG_SIZE ); \ |
klauss | 119:ee6a53069455 | 203 | if( debug_uart3 && !udp_query && !from_eth ) pc.printf( "%s\n\r> ", debug_msg1 ); \ |
klauss | 119:ee6a53069455 | 204 | if( tcp_session && !udp_query ){ \ |
klauss | 119:ee6a53069455 | 205 | strcat( debug_msg1, "\n\r" ); \ |
klauss | 119:ee6a53069455 | 206 | while( !( tcp_client.send_all( debug_msg1, strlen( debug_msg1 ) ) ) ); \ |
klauss | 119:ee6a53069455 | 207 | } \ |
klauss | 119:ee6a53069455 | 208 | if( udp_query ){ \ |
klauss | 119:ee6a53069455 | 209 | strcat( debug_msg1, "\n\r" ); \ |
klauss | 119:ee6a53069455 | 210 | int send = udp_client.sendTo( udp_server, debug_msg1, strlen( debug_msg1 ) ); \ |
klauss | 119:ee6a53069455 | 211 | if( send != strlen( debug_msg1 ) ) \ |
klauss | 119:ee6a53069455 | 212 | { \ |
klauss | 119:ee6a53069455 | 213 | if( debug_reconnect && debug_uart3 && !from_eth ) pc.printf("\r\nReconnect udp_query client"); \ |
klauss | 119:ee6a53069455 | 214 | reconnect_prompt_udp_socket(); \ |
klauss | 119:ee6a53069455 | 215 | miss_prompt_udp_send_pkg++; \ |
klauss | 119:ee6a53069455 | 216 | } \ |
klauss | 119:ee6a53069455 | 217 | } \ |
klauss | 119:ee6a53069455 | 218 | } |
klauss | 48:195c97f12e8e | 219 | #define send_msg(...) _send_msg(__VA_ARGS__) |
klauss | 48:195c97f12e8e | 220 | #define _send_msg(...) { \ |
klauss | 119:ee6a53069455 | 221 | int snprintf_ret = snprintf( msg_, DEBUG_MSG_SIZE, __VA_ARGS__ ); \ |
klauss | 119:ee6a53069455 | 222 | if( snprintf_ret >= DEBUG_MSG_SIZE ) string_msg_overflow++; \ |
klauss | 119:ee6a53069455 | 223 | if( debug_uart3 && !udp_query && !from_eth ) pc.printf( "%s\n\r> ", msg_ ); \ |
klauss | 119:ee6a53069455 | 224 | if( tcp_session && !udp_query ){ \ |
klauss | 48:195c97f12e8e | 225 | strcat( msg_, "\n\r> " ); \ |
klauss | 78:1353744f01e1 | 226 | while( !( tcp_client.send_all( msg_, strlen( msg_ ) ) ) ); \ |
klauss | 119:ee6a53069455 | 227 | } \ |
klauss | 119:ee6a53069455 | 228 | if( udp_query ){ \ |
klauss | 119:ee6a53069455 | 229 | strcat( msg_, "\n\r> " ); \ |
klauss | 119:ee6a53069455 | 230 | int send = udp_client.sendTo( udp_server, msg_, strlen( msg_ ) ); \ |
klauss | 119:ee6a53069455 | 231 | if( send != strlen( msg_ ) ) \ |
klauss | 119:ee6a53069455 | 232 | { \ |
klauss | 119:ee6a53069455 | 233 | if( debug_reconnect && debug_uart3 ) pc.printf ("\n\rReconnect udp_query client\n\r"); \ |
klauss | 119:ee6a53069455 | 234 | reconnect_prompt_udp_socket(); \ |
klauss | 119:ee6a53069455 | 235 | miss_prompt_udp_send_pkg++; \ |
klauss | 119:ee6a53069455 | 236 | } \ |
klauss | 105:a930035b6556 | 237 | } \ |
klauss | 48:195c97f12e8e | 238 | } |
klauss | 48:195c97f12e8e | 239 | |
klauss | 32:43041f5e27c4 | 240 | #endif |