Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
vz_stdio.h@137:32dd35a6dbc9, 2015-11-24 (annotated)
- Committer:
- klauss
- Date:
- Tue Nov 24 14:06:22 2015 +0000
- Revision:
- 137:32dd35a6dbc9
- Parent:
- 132:05cd37f7e007
core source of the .bin (09/21/2015) in the field
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 132:05cd37f7e007 | 1 | %: ifndef __VZ_STDIO_H__ |
klauss | 132:05cd37f7e007 | 2 | %: define __VZ_STDIO_H__ |
klauss | 132:05cd37f7e007 | 3 | |
klauss | 132:05cd37f7e007 | 4 | %: include "mbed.h" |
klauss | 132:05cd37f7e007 | 5 | %: include <stdarg.h> |
klauss | 132:05cd37f7e007 | 6 | %: include <stdio.h> |
klauss | 132:05cd37f7e007 | 7 | %: include "shared_variables.h" |
klauss | 132:05cd37f7e007 | 8 | %: include "EthernetInterface.h" |
klauss | 132:05cd37f7e007 | 9 | |
klauss | 132:05cd37f7e007 | 10 | extern Serial serial_pc; |
klauss | 132:05cd37f7e007 | 11 | |
klauss | 132:05cd37f7e007 | 12 | extern UDPSocket udp_client; |
klauss | 132:05cd37f7e007 | 13 | |
klauss | 132:05cd37f7e007 | 14 | extern Endpoint udp_server; |
klauss | 132:05cd37f7e007 | 15 | |
klauss | 132:05cd37f7e007 | 16 | extern TCPSocketServer tcp_server; |
klauss | 132:05cd37f7e007 | 17 | ///< Socket responsavel por ouvir determinado porta TCP. |
klauss | 132:05cd37f7e007 | 18 | |
klauss | 132:05cd37f7e007 | 19 | extern TCPSocketConnection tcp_client; |
klauss | 132:05cd37f7e007 | 20 | ///< Representa a presença de algum cliente logado em uma sessão TCP. |
klauss | 132:05cd37f7e007 | 21 | |
klauss | 132:05cd37f7e007 | 22 | extern bool udp_request; |
klauss | 132:05cd37f7e007 | 23 | |
klauss | 132:05cd37f7e007 | 24 | extern bool udp_query; |
klauss | 132:05cd37f7e007 | 25 | |
klauss | 132:05cd37f7e007 | 26 | extern bool tcp_session; |
klauss | 132:05cd37f7e007 | 27 | |
klauss | 132:05cd37f7e007 | 28 | extern bool from_eth; |
klauss | 132:05cd37f7e007 | 29 | |
klauss | 132:05cd37f7e007 | 30 | extern bool debug_io_eth; |
klauss | 132:05cd37f7e007 | 31 | ///< Variável de controle que ativa o debug do prompt eth. |
klauss | 132:05cd37f7e007 | 32 | |
klauss | 132:05cd37f7e007 | 33 | int vz_io_eth_init ( void ); |
klauss | 132:05cd37f7e007 | 34 | |
klauss | 132:05cd37f7e007 | 35 | int vz_printf ( const char * format, ... ); |
klauss | 132:05cd37f7e007 | 36 | |
klauss | 132:05cd37f7e007 | 37 | void udp_query_send_msg ( char * msg ); |
klauss | 132:05cd37f7e007 | 38 | |
klauss | 132:05cd37f7e007 | 39 | const uint8_t PROMPT_UDP_COMMAND_SIZE = 64; |
klauss | 132:05cd37f7e007 | 40 | |
klauss | 132:05cd37f7e007 | 41 | const uint16_t TCP_IDLE_MAX_TIME = 360; |
klauss | 132:05cd37f7e007 | 42 | ///< Define o tempo maximo de espera por um novo comando via eth, dado que já estamos em uma sessão TCP. |
klauss | 132:05cd37f7e007 | 43 | |
klauss | 132:05cd37f7e007 | 44 | const uint16_t PROMPT_ETH_BUFFER_SIZE = 1024; |
klauss | 132:05cd37f7e007 | 45 | ///< Representa o tamanho máximo do pacote recebido pelo prompt da Header. |
klauss | 132:05cd37f7e007 | 46 | |
klauss | 132:05cd37f7e007 | 47 | const uint16_t IO_MSG_SIZE = 1024; |
klauss | 132:05cd37f7e007 | 48 | |
klauss | 132:05cd37f7e007 | 49 | const uint8_t IO_AUX_MSG_SIZE = 64; |
klauss | 132:05cd37f7e007 | 50 | |
klauss | 132:05cd37f7e007 | 51 | extern char io_msg1 [ IO_MSG_SIZE + IO_AUX_MSG_SIZE ]; |
klauss | 132:05cd37f7e007 | 52 | ///< Buffer usado na composisão da mensagem enviada pela macro debug_msg |
klauss | 132:05cd37f7e007 | 53 | |
klauss | 132:05cd37f7e007 | 54 | extern char io_debug_msg1 [ IO_MSG_SIZE + IO_AUX_MSG_SIZE ]; |
klauss | 132:05cd37f7e007 | 55 | |
klauss | 132:05cd37f7e007 | 56 | extern char io_msg2 [ IO_MSG_SIZE ]; |
klauss | 132:05cd37f7e007 | 57 | ///< Buffer usado na composisão da mensagem enviada pela macro debug_msg |
klauss | 132:05cd37f7e007 | 58 | |
klauss | 132:05cd37f7e007 | 59 | extern char io_debug_msg2 [ IO_MSG_SIZE ]; |
klauss | 132:05cd37f7e007 | 60 | |
klauss | 132:05cd37f7e007 | 61 | extern char io_msg_ [ IO_MSG_SIZE ]; |
klauss | 132:05cd37f7e007 | 62 | ///< Buffer utilizado pela macro send_msg |
klauss | 132:05cd37f7e007 | 63 | |
klauss | 132:05cd37f7e007 | 64 | const uint16_t DEBUGBUFSIZE = PROMPT_ETH_BUFFER_SIZE; |
klauss | 132:05cd37f7e007 | 65 | ///< Define o tamanho do buffer de entrada de dados. |
klauss | 132:05cd37f7e007 | 66 | |
klauss | 132:05cd37f7e007 | 67 | extern bool debug_reconnect; |
klauss | 132:05cd37f7e007 | 68 | |
klauss | 132:05cd37f7e007 | 69 | inline void reconnect_prompt_udp_socket ( void ) |
klauss | 132:05cd37f7e007 | 70 | { |
klauss | 132:05cd37f7e007 | 71 | udp_client.close (); |
klauss | 132:05cd37f7e007 | 72 | udp_client.bind ( ( int ) cm -> get_udp_port_listener () ); |
klauss | 132:05cd37f7e007 | 73 | udp_client.set_blocking ( false, 0 ); |
klauss | 132:05cd37f7e007 | 74 | } |
klauss | 132:05cd37f7e007 | 75 | |
klauss | 132:05cd37f7e007 | 76 | extern bool debug_uart3; |
klauss | 132:05cd37f7e007 | 77 | |
klauss | 132:05cd37f7e007 | 78 | |
klauss | 132:05cd37f7e007 | 79 | #define vz_debug(...) _vz_debug(__VA_ARGS__) |
klauss | 132:05cd37f7e007 | 80 | #define _vz_debug(...) { \ |
klauss | 132:05cd37f7e007 | 81 | snprintf ( io_debug_msg1, ( IO_MSG_SIZE + IO_AUX_MSG_SIZE ) -1, "%s:%d ", __FILE__, __LINE__); \ |
klauss | 132:05cd37f7e007 | 82 | snprintf ( io_debug_msg2, IO_MSG_SIZE - 1 , __VA_ARGS__); \ |
klauss | 132:05cd37f7e007 | 83 | strncat ( io_debug_msg1, io_debug_msg2, IO_MSG_SIZE - 1 ); \ |
klauss | 132:05cd37f7e007 | 84 | vz_printf ( "%s", io_debug_msg1 ); \ |
klauss | 132:05cd37f7e007 | 85 | } |
klauss | 132:05cd37f7e007 | 86 | |
klauss | 132:05cd37f7e007 | 87 | %: endif |