voltando a versao de n aberturas e fechamentos de sockets
Dependencies: EthernetInterface NTPClient mbed-rtos_old mbed
Fork of header_main_public by
vz_protocol.h@8:e3bfe62a477e, 2014-09-15 (annotated)
- Committer:
- klauss
- Date:
- Mon Sep 15 15:13:52 2014 +0000
- Revision:
- 8:e3bfe62a477e
- Parent:
- 7:019b08223b87
- Child:
- 15:9c7456c1b6f4
versao que precisa ser alinhada
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 | 0:4d17cd9c8f9d | 33 | #define __CB_BYE__ 0x20 |
klauss | 0:4d17cd9c8f9d | 34 | #define __SOMETHING_2__ 0x40 |
klauss | 0:4d17cd9c8f9d | 35 | #define __SOMETHING_3__ 0x80 |
klauss | 0:4d17cd9c8f9d | 36 | |
klauss | 0:4d17cd9c8f9d | 37 | #define __DO_NOTHING__ 0x99 |
klauss | 0:4d17cd9c8f9d | 38 | |
klauss | 0:4d17cd9c8f9d | 39 | #define __MY_IP__ "192.168.120.169" |
klauss | 0:4d17cd9c8f9d | 40 | |
klauss | 0:4d17cd9c8f9d | 41 | uint16_t __checksum__( uint8_t * buffer, size_t length ); |
klauss | 0:4d17cd9c8f9d | 42 | |
klauss | 0:4d17cd9c8f9d | 43 | /* incorporar a parte de cc */ |
klauss | 0:4d17cd9c8f9d | 44 | uint8_t * __parse_cb_buffer__( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ); |
klauss | 0:4d17cd9c8f9d | 45 | 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 | 46 | char * __build_eth__package__( void ); |
klauss | 0:4d17cd9c8f9d | 47 | void __print_clock__( uint8_t * buffer ); |
klauss | 0:4d17cd9c8f9d | 48 | |
klauss | 0:4d17cd9c8f9d | 49 | extern void uart3_puts(uint8_t *src, uint16_t size); |
klauss | 0:4d17cd9c8f9d | 50 | |
klauss | 0:4d17cd9c8f9d | 51 | /* mais pra frente isso vira os cpld_send and cpld_receive */ |
klauss | 0:4d17cd9c8f9d | 52 | uint8_t * __read_cb_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 53 | uint8_t * __read_eth_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 54 | uint8_t * __write_cb_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 55 | void __send_to_cb__( uint8_t * buffer ); |
klauss | 0:4d17cd9c8f9d | 56 | uint8_t * __write_eth_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 57 | |
klauss | 0:4d17cd9c8f9d | 58 | |
klauss | 0:4d17cd9c8f9d | 59 | #endif |