![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
voltando a versao de n aberturas e fechamentos de sockets data 19/09
Dependencies: EthernetInterface NTPClient mbed-rtos mbed EALib
Fork of header_main_publish by
vz_protocol.h@7:019b08223b87, 2014-09-13 (annotated)
- Committer:
- klauss
- Date:
- Sat Sep 13 19:21:48 2014 +0000
- Revision:
- 7:019b08223b87
- Parent:
- 6:a10de9926fbe
- Child:
- 8:e3bfe62a477e
testando estabilidade do embarcado
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 0:4d17cd9c8f9d | 1 | #ifndef _VZ_PROTOCOL_H__ |
klauss | 0:4d17cd9c8f9d | 2 | #define _VZ_PROTOCOL_H__ |
klauss | 0:4d17cd9c8f9d | 3 | |
klauss | 0:4d17cd9c8f9d | 4 | #include <stdlib.h> |
klauss | 0:4d17cd9c8f9d | 5 | #include <stdint.h> |
klauss | 0:4d17cd9c8f9d | 6 | #include <string.h> |
klauss | 0:4d17cd9c8f9d | 7 | #include "rtp.h" |
klauss | 0:4d17cd9c8f9d | 8 | #include "NTPClient.h" |
klauss | 0:4d17cd9c8f9d | 9 | #include "bits.h" |
klauss | 0:4d17cd9c8f9d | 10 | // 7 + 14 + 1 == ts |
klauss | 0:4d17cd9c8f9d | 11 | |
klauss | 0:4d17cd9c8f9d | 12 | #define __VZ_HEADER_OFFSET__ 7 |
klauss | 0:4d17cd9c8f9d | 13 | #define __CB_BUFFER_SIZE__ 300 |
klauss | 0:4d17cd9c8f9d | 14 | #define __ETH_BUFFER_SIZE__ __CB_BUFFER_SIZE__ + __RTP_HEADER_SIZE__ + 1 // 313 |
klauss | 0:4d17cd9c8f9d | 15 | #define __CB_AUDIO_DATA_SIZE__ 240 |
klauss | 0:4d17cd9c8f9d | 16 | #define __CHECKSUM_OFFSET__ 7 |
klauss | 0:4d17cd9c8f9d | 17 | #define __SEQ_NUM_SIZE__ 1 |
klauss | 0:4d17cd9c8f9d | 18 | #define __CLOCK_SYNC_SIZE__ 14 |
klauss | 0:4d17cd9c8f9d | 19 | #define __TIMESLICE_PLACE__ 22 |
klauss | 0:4d17cd9c8f9d | 20 | #define __UDP_PORT__ 7890 /* numeros arbitrarios ... */ |
klauss | 0:4d17cd9c8f9d | 21 | #define __TCP_PORT__ 8709 |
klauss | 0:4d17cd9c8f9d | 22 | |
klauss | 0:4d17cd9c8f9d | 23 | #define __MAX_CB_IN_A_BRANCH__ 40 |
klauss | 0:4d17cd9c8f9d | 24 | #define __READ__ 0x01 |
klauss | 0:4d17cd9c8f9d | 25 | #define __WAITING__ 0x00 |
klauss | 0:4d17cd9c8f9d | 26 | |
klauss | 0:4d17cd9c8f9d | 27 | // types |
klauss | 0:4d17cd9c8f9d | 28 | #define __BOOT__ 0x00 |
klauss | 0:4d17cd9c8f9d | 29 | #define __REGISTRY__ 0x02 |
klauss | 0:4d17cd9c8f9d | 30 | #define __INVITE__ 0x04 |
klauss | 0:4d17cd9c8f9d | 31 | #define __AUDIO__ 0x08 |
klauss | 0:4d17cd9c8f9d | 32 | #define __TELEMETRY__ 0x10 |
klauss | 7:019b08223b87 | 33 | #define __FUCA__ 0x16 |
klauss | 0:4d17cd9c8f9d | 34 | #define __CB_BYE__ 0x20 |
klauss | 7:019b08223b87 | 35 | |
klauss | 0:4d17cd9c8f9d | 36 | #define __SOMETHING_2__ 0x40 |
klauss | 0:4d17cd9c8f9d | 37 | #define __SOMETHING_3__ 0x80 |
klauss | 0:4d17cd9c8f9d | 38 | |
klauss | 0:4d17cd9c8f9d | 39 | #define __DO_NOTHING__ 0x99 |
klauss | 0:4d17cd9c8f9d | 40 | |
klauss | 7:019b08223b87 | 41 | |
klauss | 7:019b08223b87 | 42 | //#define config_colinas |
klauss | 7:019b08223b87 | 43 | #ifdef config_colinas |
klauss | 6:a10de9926fbe | 44 | #define __MY_IP__ "192.168.2.200" |
klauss | 7:019b08223b87 | 45 | #define __MY_GW__ "192.168.2.254" |
klauss | 6:a10de9926fbe | 46 | #endif |
klauss | 7:019b08223b87 | 47 | #ifndef config_colinas |
klauss | 0:4d17cd9c8f9d | 48 | #define __MY_IP__ "192.168.120.169" |
klauss | 7:019b08223b87 | 49 | #define __MY_GW__ "192.168.120.1" |
klauss | 6:a10de9926fbe | 50 | #endif |
klauss | 6:a10de9926fbe | 51 | |
klauss | 6:a10de9926fbe | 52 | #define __MY_MK__ "255.255.255.0" |
klauss | 0:4d17cd9c8f9d | 53 | |
klauss | 0:4d17cd9c8f9d | 54 | uint16_t __checksum__( uint8_t * buffer, size_t length ); |
klauss | 0:4d17cd9c8f9d | 55 | |
klauss | 0:4d17cd9c8f9d | 56 | /* incorporar a parte de cc */ |
klauss | 0:4d17cd9c8f9d | 57 | uint8_t * __parse_cb_buffer__( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ); |
klauss | 0:4d17cd9c8f9d | 58 | uint8_t * __build_cb_package__( int ext, int port, uint8_t type, char * cb_buffer, uint8_t seq_num, int length, uint8_t * pkg ); |
klauss | 0:4d17cd9c8f9d | 59 | char * __build_eth__package__( void ); |
klauss | 0:4d17cd9c8f9d | 60 | void __print_clock__( uint8_t * buffer ); |
klauss | 0:4d17cd9c8f9d | 61 | |
klauss | 0:4d17cd9c8f9d | 62 | extern void uart3_puts(uint8_t *src, uint16_t size); |
klauss | 0:4d17cd9c8f9d | 63 | |
klauss | 0:4d17cd9c8f9d | 64 | /* mais pra frente isso vira os cpld_send and cpld_receive */ |
klauss | 0:4d17cd9c8f9d | 65 | uint8_t * __read_cb_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 66 | uint8_t * __read_eth_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 67 | uint8_t * __write_cb_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 68 | void __send_to_cb__( uint8_t * buffer ); |
klauss | 0:4d17cd9c8f9d | 69 | uint8_t * __write_eth_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 70 | |
klauss | 0:4d17cd9c8f9d | 71 | |
klauss | 0:4d17cd9c8f9d | 72 | #endif |