-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcr_packetizer.h
72 lines (59 loc) · 2.04 KB
/
lcr_packetizer.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
69
70
71
/*****************************************************************************
** TEXAS INSTRUMENTS PROPRIETARY INFORMATION
**
** (c) Copyright, Texas Instruments Incorporated, 2012-2013.
** All Rights Reserved.
**
** Property of Texas Instruments Incorporated. Restricted Rights -
** Use, duplication, or disclosure is subject to restrictions set
** forth in TI's program license agreement and associated documentation.
******************************************************************************/
/**
*
* @file lcr_packetizer.h
*
* @brief This file is responsible for packetizing the data the functions
* defined in this file are called by lcr_cmd file
**/
/*****************************************************************************/
#ifndef LCR_PACKETIZER_H_
#define LCR_PACKETIZER_H_
#include "common.h"
#include "error.h"
#ifdef __cplusplus
extern "C" {
#endif
#define HEADER_SIZE 6
#define MAX_PACKET_SIZE 0xFFFF
#define CHECKSUM_SIZE 1
#define LCR_CMD_IP "192.168.1.100"
#define LCR_CMD_PORT 0x5555
enum LCR_PacketType {
PKT_TYPE_BUSY,
PKT_TYPE_ERROR,
PKT_TYPE_WRITE,
PKT_TYPE_WRITE_RESP,
PKT_TYPE_READ,
PKT_TYPE_READ_RESP
};
typedef enum
{
LCR_CMD_PKT_TYPE_READ,
LCR_CMD_PKT_TYPE_WRITE,
} LCR_CommandType_t;
ErrorCode_t LCR_CMD_PKT_ConnectToLCR(void);
ErrorCode_t LCR_CMD_PKT_DisconnectLCR(void);
int LCR_CMD_PKT_CommandInit(LCR_CommandType_t cmdType, uint16 cmd);
int LCR_CMD_PKT_PutData(uint8 *data, unsigned long int size);
int LCR_CMD_PKT_PutInt(uint32 value, unsigned int size);
int LCR_CMD_PKT_GetData(uint8 *data, unsigned long int size);
uint32 LCR_CMD_PKT_GetInt(unsigned int size);
int LCR_CMD_PKT_PutFile(char const *fileName);
int LCR_CMD_PKT_GetFile(char const *fileName,uint32 size);
int LCR_CMD_PKT_SendCommand(void);
int LCR_CMD_PKT_ReceivePacket(BOOL firstPkt);
int LCR_CMD_PKT_SendPacket(BOOL more);
#ifdef __cplusplus
}
#endif
#endif /* LCR_PACKETIZER_H_ */