-
Notifications
You must be signed in to change notification settings - Fork 3
/
mcb_intf.h
160 lines (146 loc) · 3.52 KB
/
mcb_intf.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/**
* @file mcb_intf.h
* @brief This file contains API for accessing to low level interface
* of the motion control bus (MCB)
*
* @author Firmware department
* @copyright Ingenia Motion Control (c) 2018. All rights reserved.
*/
/**
* \addtogroup InternalAPI MCB library
* @{
*
* Internal headers of the motion control bus library
*/
#ifndef MCB_INTF_H
#define MCB_INTF_H
#include "mcb_usr.h"
/**
* Initialize a Motion Control Bus interface
*
* @param[in] ptInst
* Instace to be initialized
*/
void
Mcb_IntfInit(Mcb_TIntf* ptInst);
/**
* Deinitialize Motion Control Bus interface
*
* @param[in] ptInst
* Instance to be deinitialized
*/
void
Mcb_IntfDeinit(Mcb_TIntf* ptInst);
/**
* Resets the Motion Control Bus interface
*
* @param[in] ptInst
* Instace to be reinitialized
*/
void
Mcb_IntfReset(Mcb_TIntf* ptInst);
/**
* Execute a complete config write sequence through MCB
*
* @param[in] ptInst
* Target instance
* @param[in] u16Node
* Target slave
* @param[in] u16Addr
* Register address to be written
* @param[in] pu16Data
* Data to be written
* @param[in] pu16Sz
* Size to be written
*
* @retval Mcb_EStatus
*/
Mcb_EStatus
Mcb_IntfWrite(Mcb_TIntf* ptInst, uint16_t u16Node, uint16_t u16Addr, uint16_t* pu16Data, uint16_t* pu16Sz);
/**
* Execute a complete config read sequence through MCB
*
* @param[in] ptInst
* Target instance
* @param[in] u16Node
* Target slave
* @param[in] u16Addr
* Register address to be read
* @param[out] pu16Data
* Data to be read
* @param[out] pu16Sz
* Size of read words
*
* @retval Mcb_EStatus
*/
Mcb_EStatus
Mcb_IntfRead(Mcb_TIntf* ptInst, uint16_t u16Node, uint16_t u16Addr, uint16_t* pu16Data, uint16_t* pu16Sz);
/**
* Execute a complete config getinfo sequence through MCB
*
* @param[in] ptInst
* Target instance
* @param[in] u16Node
* Target slave
* @param[in] u16Addr
* Register address to be read
* @param[out] pu16Data
* Data to be read
* @param[out] pu16Sz
* Size of read words
*
* @retval Mcb_EStatus
*/
Mcb_EStatus
Mcb_IntfGetInfo(Mcb_TIntf* ptInst, uint16_t u16Node, uint16_t u16Addr, uint16_t* pu16Data, uint16_t* pu16Sz);
/**
* Process config data inside cyclic frames
*
* @param[in] ptInst
* Target instance
* @param[in] u16Node
* Target slave
* @param[in] u16Addr
* Register address to be read / write through config
* @param[in, out] pu16Cmd
* Command to be sent
* @param[in, out] pu16Data
* Data to be read / write through config
* @param[in, out] pu16CfgSz
* Size of the configuration transmission
* @param[in] pisNewData
* Indicates if a new config data must be added into cyclic frame
*
* @retval Mcb_EStatus
*/
Mcb_EStatus
Mcb_IntfCfgOverCyclic(Mcb_TIntf* ptInst, uint16_t u16Node, uint16_t u16Addr, uint16_t* pu16Cmd, uint16_t* pu16Data,
uint16_t* pu16CfgSz, bool* pisNewData);
/**
* Latch a cyclic transfer through MCB
*
* @param[in] ptInst
* Target instance
* @param[in] ptInBuf
* Cyclic data to be sent
* @param[in] u16CyclicSz
* Cyclic transmission size
* @param[in] isNewCfgData
* Indicates if a new config data must be added into cyclic frame
*/
void
Mcb_IntfCyclicLatch(Mcb_TIntf* ptInst, uint16_t *ptInBuf, uint16_t u16CyclicSz, bool isNewCfgData);
/**
* Process the received cyclic frame
*
* @param[in] ptInst
* Target instance
* @param[out] ptOutBuf
* Received Cyclic data
* @param[in] u16CyclicSz
* Cyclic transmission size
*/
void
Mcb_IntfProcessCyclic(Mcb_TIntf* ptInst, uint16_t *ptOutBuf, uint16_t u16CyclicSz);
#endif /* MCB_INTF_H */
/** @} */