VZTECH / Mbed 2 deprecated header_main

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vz_protocol.h Source File

vz_protocol.h

00001 #ifndef _VZ_PROTOCOL_H__
00002 #define _VZ_PROTOCOL_H__
00003 
00004 #include <stdlib.h>
00005 #include <stdint.h>
00006 #include <string.h>
00007 #include "rtp.h"
00008 #include "NTPClient.h"
00009 #include "bits.h"
00010 // 7 + 14 + 1 == ts
00011 
00012 #define __VZ_HEADER_OFFSET__ 7
00013 #define __CB_BUFFER_SIZE__ 300
00014 #define __ETH_BUFFER_SIZE__ __CB_BUFFER_SIZE__ + __RTP_HEADER_SIZE__ + 1 // 313  
00015 #define __CB_AUDIO_DATA_SIZE__ 240
00016 #define __CHECKSUM_OFFSET__ 7
00017 #define __SEQ_NUM_SIZE__ 1
00018 #define __CLOCK_SYNC_SIZE__ 14
00019 #define __TIMESLICE_PLACE__ 22
00020 #define __UDP_PORT__ 7890 /* numeros arbitrarios ... */
00021 #define __TCP_PORT__ 8709
00022 
00023 #define __MAX_CB_IN_A_BRANCH__ 40
00024 #define __READ__ 0x01
00025 #define __WAITING__ 0x00
00026 
00027 // types
00028 #define __BOOT__ 0x00
00029 #define __REGISTRY__ 0x02
00030 #define __INVITE__ 0x04
00031 #define __AUDIO__ 0x08
00032 #define __TELEMETRY__ 0x10
00033 #define __CB_BYE__ 0x20
00034 #define __SOMETHING_2__ 0x40
00035 #define __SOMETHING_3__ 0x80
00036 
00037 #define __DO_NOTHING__ 0x99
00038 
00039 #define __MY_IP__ "192.168.120.169"
00040 
00041 uint16_t __checksum__( uint8_t * buffer, size_t length );
00042 
00043 /* incorporar a parte de cc */
00044 uint8_t * __parse_cb_buffer__( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer );
00045 uint8_t * __build_cb_package__( int ext, int port, uint8_t type, char * cb_buffer, uint8_t seq_num, int length,  uint8_t * pkg );
00046 char * __build_eth__package__( void );
00047 void __print_clock__( uint8_t * buffer );
00048 
00049 extern void uart3_puts(uint8_t *src, uint16_t size);
00050 
00051 /* mais pra frente isso vira os cpld_send and cpld_receive */
00052 uint8_t * __read_cb_buffer__( uint8_t * dest, uint8_t * src );
00053 uint8_t * __read_eth_buffer__( uint8_t * dest, uint8_t * src );
00054 uint8_t * __write_cb_buffer__( uint8_t * dest, uint8_t * src );
00055 void __send_to_cb__( uint8_t * buffer );
00056 uint8_t * __write_eth_buffer__( uint8_t * dest, uint8_t * src );
00057 
00058 
00059 #endif