VZTECH / Mbed 2 deprecated main_src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vz_stdio.h Source File

vz_stdio.h

00001 %: ifndef __VZ_STDIO_H__
00002 %: define __VZ_STDIO_H__
00003 
00004 %: include "mbed.h"
00005 %: include <stdarg.h>
00006 %: include <stdio.h>
00007 %: include "shared_variables.h"
00008 %: include "EthernetInterface.h"
00009 
00010 extern Serial serial_pc;
00011 
00012 extern UDPSocket udp_client;
00013 
00014 extern Endpoint udp_server;
00015 
00016 extern TCPSocketServer tcp_server;
00017 ///< Socket responsavel por ouvir determinado porta TCP.
00018 
00019 extern TCPSocketConnection tcp_client;
00020 ///< Representa a presença de algum cliente logado em uma sessão TCP.
00021 
00022 extern bool udp_request;
00023 
00024 extern bool udp_query;
00025 
00026 extern bool tcp_session;
00027 
00028 extern bool from_eth;
00029 
00030 extern bool debug_io_eth;
00031 ///< Variável de controle que ativa o debug do prompt eth.
00032 
00033 int vz_io_eth_init ( void );
00034 
00035 int vz_printf ( const char * format, ... );
00036 
00037 void udp_query_send_msg ( char * msg );
00038 
00039 const uint8_t PROMPT_UDP_COMMAND_SIZE = 64;
00040 
00041 const uint16_t TCP_IDLE_MAX_TIME = 360;
00042 ///< Define o tempo maximo de espera por um novo comando via eth, dado que já estamos em uma sessão TCP.
00043 
00044 const uint16_t PROMPT_ETH_BUFFER_SIZE = 1024;
00045 ///< Representa o tamanho máximo do pacote recebido pelo prompt da Header.
00046 
00047 const uint16_t IO_MSG_SIZE = 1024;
00048 
00049 const uint8_t IO_AUX_MSG_SIZE = 64;
00050 
00051 extern char io_msg1 [ IO_MSG_SIZE + IO_AUX_MSG_SIZE ];
00052 ///< Buffer usado na composisão da mensagem enviada pela macro debug_msg
00053 
00054 extern char io_debug_msg1 [ IO_MSG_SIZE + IO_AUX_MSG_SIZE ];
00055 
00056 extern char io_msg2 [ IO_MSG_SIZE ];
00057 ///< Buffer usado na composisão da mensagem enviada pela macro debug_msg
00058 
00059 extern char io_debug_msg2 [ IO_MSG_SIZE ];
00060 
00061 extern char io_msg_ [ IO_MSG_SIZE ];
00062 ///< Buffer utilizado pela macro send_msg
00063 
00064 const uint16_t DEBUGBUFSIZE = PROMPT_ETH_BUFFER_SIZE;
00065 ///< Define o tamanho do buffer de entrada de dados.
00066 
00067 extern bool debug_reconnect;
00068 
00069 inline void reconnect_prompt_udp_socket ( void )
00070 {
00071   udp_client.close ();
00072   udp_client.bind ( ( int ) cm -> get_udp_port_listener () );
00073   udp_client.set_blocking ( false, 0 );
00074 }
00075 
00076 extern bool debug_uart3;
00077 
00078 
00079 #define vz_debug(...) _vz_debug(__VA_ARGS__)
00080 #define _vz_debug(...) { \
00081   snprintf ( io_debug_msg1, ( IO_MSG_SIZE + IO_AUX_MSG_SIZE ) -1, "%s:%d ", __FILE__, __LINE__); \
00082   snprintf ( io_debug_msg2, IO_MSG_SIZE - 1 , __VA_ARGS__); \
00083   strncat ( io_debug_msg1, io_debug_msg2, IO_MSG_SIZE - 1 ); \
00084   vz_printf ( "%s", io_debug_msg1 ); \
00085 }
00086 
00087 %: endif