-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol.h
68 lines (63 loc) · 1.69 KB
/
protocol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* =====================================================================================
*
* Filename: protocol.h
*
* Description:
*
* Version: 1.0
* Created: 05.09.2012 18:40:35
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
* =====================================================================================
*/
#include "stm32f10x.h"
/*packet description:
Address of slave device(server) 1
Command to server 1
command for any address transaction provides server for information about address and data width for transaction
Count of transmit data
*/
typedef struct {
// uint8_t command_len;
int8_t command;
uint8_t data_len;
uint8_t data[256];
uint8_t CS;
int16_t index;
uint16_t beg;
uint16_t end;
uint8_t progress;
uint16_t len; //index of end of packet
} packet_t;
typedef struct {
int16_t command;
uint8_t data[256];
uint8_t data_count;
} execute_t;
typedef struct {
uint8_t arch; // Bus width (in bytes) for microcontroller or embedded microprocessor
uint8_t pipe_address;
uint32_t uart_speed;
uint8_t uart_overclock; //Количество выборок для одного бита UART
uint16_t buf_size;
uint8_t *buf_rx;
uint16_t buf_rx_index; //индекс принятого байта.
packet_t packet;
execute_t exec;
USART_TypeDef *USART;
DMA_Channel_TypeDef *DMA_Channel_Recieve;
DMA_Channel_TypeDef *DMA_Channel_Transmit;
DMA_Channel_TypeDef *DMA_Channel_Data_Copy;
} pipe_t;
execute_t exec;
int packet_parser(pipe_t *pipe);
int llmdb_parser();
int string_parser();
void hardware_init(pipe_t *pipe);
void exec_command(pipe_t *pipe);
//void packet_parser_1();