![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
vz_protocol.h@43:455522f98de5, 2014-10-06 (annotated)
- Committer:
- klauss
- Date:
- Mon Oct 06 14:31:54 2014 +0000
- Revision:
- 43:455522f98de5
- Parent:
- 42:480335bdde12
- Child:
- 46:a670f187a704
prompt tcp ainda em validacao, conseguindo fazer ligacoes
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 | 27:98f824719d1c | 10 | //#include "prompt.h" |
klauss | 0:4d17cd9c8f9d | 11 | // 7 + 14 + 1 == ts |
klauss | 0:4d17cd9c8f9d | 12 | |
klauss | 36:728498a78e1e | 13 | #define __START_PKG_COUNT__ 100 |
klauss | 36:728498a78e1e | 14 | #define UDP_PORT_LISTENER 11406 |
klauss | 40:990683572031 | 15 | #define TCP_PORT_LISTENER 7879 |
klauss | 36:728498a78e1e | 16 | |
klauss | 36:728498a78e1e | 17 | |
klauss | 0:4d17cd9c8f9d | 18 | #define __VZ_HEADER_OFFSET__ 7 |
klauss | 0:4d17cd9c8f9d | 19 | #define __CB_BUFFER_SIZE__ 300 |
klauss | 42:480335bdde12 | 20 | #define __PROMPT_ETH_BUFFER_SIZE__ 1024 |
klauss | 28:94aec56c6329 | 21 | #define __TELEMETRY_SIZE__ __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__ |
klauss | 0:4d17cd9c8f9d | 22 | #define __ETH_BUFFER_SIZE__ __CB_BUFFER_SIZE__ + __RTP_HEADER_SIZE__ + 1 // 313 |
klauss | 0:4d17cd9c8f9d | 23 | #define __CB_AUDIO_DATA_SIZE__ 240 |
klauss | 0:4d17cd9c8f9d | 24 | #define __CHECKSUM_OFFSET__ 7 |
klauss | 0:4d17cd9c8f9d | 25 | #define __SEQ_NUM_SIZE__ 1 |
klauss | 0:4d17cd9c8f9d | 26 | #define __CLOCK_SYNC_SIZE__ 14 |
klauss | 0:4d17cd9c8f9d | 27 | #define __TIMESLICE_PLACE__ 22 |
klauss | 0:4d17cd9c8f9d | 28 | #define __UDP_PORT__ 7890 /* numeros arbitrarios ... */ |
klauss | 0:4d17cd9c8f9d | 29 | #define __TCP_PORT__ 8709 |
klauss | 0:4d17cd9c8f9d | 30 | |
klauss | 0:4d17cd9c8f9d | 31 | #define __MAX_CB_IN_A_BRANCH__ 40 |
klauss | 0:4d17cd9c8f9d | 32 | #define __READ__ 0x01 |
klauss | 0:4d17cd9c8f9d | 33 | #define __WAITING__ 0x00 |
klauss | 0:4d17cd9c8f9d | 34 | |
klauss | 0:4d17cd9c8f9d | 35 | // types |
klauss | 0:4d17cd9c8f9d | 36 | #define __BOOT__ 0x00 |
klauss | 0:4d17cd9c8f9d | 37 | #define __REGISTRY__ 0x02 |
klauss | 0:4d17cd9c8f9d | 38 | #define __INVITE__ 0x04 |
klauss | 0:4d17cd9c8f9d | 39 | #define __AUDIO__ 0x08 |
klauss | 0:4d17cd9c8f9d | 40 | #define __TELEMETRY__ 0x10 |
klauss | 0:4d17cd9c8f9d | 41 | #define __CB_BYE__ 0x20 |
Cola | 21:0bd688722e81 | 42 | #define __PROMPT__ 0x01 |
klauss | 0:4d17cd9c8f9d | 43 | #define __SOMETHING_3__ 0x80 |
klauss | 0:4d17cd9c8f9d | 44 | |
klauss | 0:4d17cd9c8f9d | 45 | #define __DO_NOTHING__ 0x99 |
klauss | 0:4d17cd9c8f9d | 46 | |
klauss | 29:7246460b73f8 | 47 | //#define __MY_IP__ "192.168.2.200" |
klauss | 43:455522f98de5 | 48 | #define __MY_IP__ "192.168.120.171" |
klauss | 28:94aec56c6329 | 49 | #define __MY_EXT__ 820 |
klauss | 28:94aec56c6329 | 50 | #define __MY_PORT__ 5062 |
klauss | 28:94aec56c6329 | 51 | |
klauss | 28:94aec56c6329 | 52 | #define __SERVER_IP__ "192.168.120.120" |
klauss | 29:7246460b73f8 | 53 | |
klauss | 28:94aec56c6329 | 54 | #define __PEER_EXT__ 913 |
klauss | 28:94aec56c6329 | 55 | #define __SERVER_PORT__ 5075 |
klauss | 28:94aec56c6329 | 56 | |
klauss | 43:455522f98de5 | 57 | #define __MY_MSK__ "255.255.255.0" |
klauss | 28:94aec56c6329 | 58 | #define __MY_GTW__ "192.168.2.254" |
Cola | 20:2d6ab23956e5 | 59 | |
Cola | 20:2d6ab23956e5 | 60 | extern uint16_t pkg_ckserr; |
Cola | 20:2d6ab23956e5 | 61 | extern uint16_t pkg_cksok; |
klauss | 0:4d17cd9c8f9d | 62 | |
klauss | 0:4d17cd9c8f9d | 63 | uint16_t __checksum__( uint8_t * buffer, size_t length ); |
klauss | 0:4d17cd9c8f9d | 64 | |
klauss | 0:4d17cd9c8f9d | 65 | /* incorporar a parte de cc */ |
klauss | 34:f19d9735428e | 66 | uint8_t * __parse_vz_pkg__( int * ext, int * port, volatile uint8_t * type, uint8_t * cb_buffer ); |
klauss | 0:4d17cd9c8f9d | 67 | 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 | 68 | char * __build_eth__package__( void ); |
klauss | 0:4d17cd9c8f9d | 69 | void __print_clock__( uint8_t * buffer ); |
klauss | 0:4d17cd9c8f9d | 70 | |
klauss | 0:4d17cd9c8f9d | 71 | extern void uart3_puts(uint8_t *src, uint16_t size); |
klauss | 0:4d17cd9c8f9d | 72 | |
klauss | 0:4d17cd9c8f9d | 73 | /* mais pra frente isso vira os cpld_send and cpld_receive */ |
klauss | 0:4d17cd9c8f9d | 74 | uint8_t * __read_cb_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 75 | uint8_t * __read_eth_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 76 | uint8_t * __write_cb_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 77 | void __send_to_cb__( uint8_t * buffer ); |
klauss | 0:4d17cd9c8f9d | 78 | uint8_t * __write_eth_buffer__( uint8_t * dest, uint8_t * src ); |
klauss | 0:4d17cd9c8f9d | 79 | |
klauss | 0:4d17cd9c8f9d | 80 | |
klauss | 0:4d17cd9c8f9d | 81 | #endif |