1 #ifndef __SERVICE_MODE_PROTO_H__ 2 #define __SERVICE_MODE_PROTO_H__ 16 #define PROTO_BUFFER_SIZE (256)//FIXME: (65536 is too big for RAM consumption!) 17 #define PROTO_START_DELIMITER 0x7E 18 #define PROTO_UPPER_LAYER_NUM_MAX 256 20 #define PROTO_PKT_TIMEOUT (3000) 22 #define PROTO_USE_POPCOUNT_CHKSUM 40 #ifdef PROTO_USE_POPCOUNT_CHKSUM 43 PROTO_STATE_RECV_CRC_1 = 8,
44 PROTO_STATE_RECV_CRC_2 = 9,
45 PROTO_STATE_RECV_CRC_3 = 10,
46 PROTO_STATE_RECV_CRC_4 = 11,
60 #define PROTO_FLAG_RESPONSE 0x01 70 #ifdef PROTO_USE_POPCOUNT_CHKSUM uint16_t length
Definition: service_mode_proto.h:60
Definition: service_mode_proto.h:26
Definition: service_mode_proto.h:69
SERVICE_MODE_PROTOCOL_HANDLER request_handler
Definition: service_mode_proto.h:28
Definition: service_mode_proto.h:35
Definition: service_mode_proto.h:38
Definition: service_mode_proto.h:39
Definition: service_mode_proto.h:33
SERVICE_MODE_PROTOCOL_HANDLER response_handler
Definition: service_mode_proto.h:29
void service_mode_proto_deinit(SERIAL_PORT port)
enum _PROTO_EVENT PROTO_EVENT
void service_mode_proto_init(SERIAL_PORT port)
uint8_t chksum
Definition: service_mode_proto.h:71
Definition: service_mode_proto.h:41
int32_t service_mode_proto_register(uint8_t frame_type, SERVICE_MODE_PROTOCOL_HANDLER request_handler)
struct _proto_upper_layer_info proto_upper_layer_info
int32_t service_mode_proto_deregister(uint8_t frame_type)
_PROTO_STATE
Definition: service_mode_proto.h:32
Definition: service_mode_proto.h:48
Provide a hardware independent serial driver layer for API layer to use.
PROTO_STATE(* proto_event_handler)(SERIAL_PORT port, PROTO_STATE state, uint8_t ch)
Definition: service_mode_proto.h:58
Definition: service_mode_proto.h:37
Definition: service_mode_proto.h:53
Definition: service_mode_proto.h:36
void service_mode_proto_recv(SERIAL_PORT port, uint8_t ch)
Definition: service_mode_proto.h:54
void service_mode_proto_send(SERIAL_PORT port, uint8_t flag, uint8_t frame_type, uint8_t *payload, uint16_t length, SERVICE_MODE_PROTOCOL_HANDLER response_handler)
Definition: service_mode_proto.h:55
void(* SERVICE_MODE_PROTOCOL_HANDLER)(int, uint8_t *, uint16_t)
Definition: service_mode_proto.h:24
Definition: service_mode_proto.h:49
uint8_t frame_type
Definition: service_mode_proto.h:61
uint8_t flag
Definition: service_mode_proto.h:62
Definition: service_mode_proto.h:34
struct proto_packet_header_ __attribute__((packed)) proto_packet_header
enum _SERIAL_PORT SERIAL_PORT
enum _PROTO_STATE PROTO_STATE
_PROTO_EVENT
Definition: service_mode_proto.h:52