forked from EmbeddedRPC/erpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smac.erpc
172 lines (136 loc) · 3.02 KB
/
smac.erpc
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
161
162
163
164
165
166
167
168
169
170
171
/*!
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
*/
program smac
type channels_t = uint8
enum smacErrors_t
{
gErrorNoError_c = 0,
gErrorBusy_c,
gErrorChannelBusy_c,
gErrorNoAck_c,
gErrorOutOfRange_c,
gErrorNoResourcesAvailable_c,
gErrorNoValidCondition_c,
gErrorCorrupted_c,
gErrorMaxError_c
}
enum smacMessageDefs_t
{
gMcpsDataCnf_c,
gMcpsDataInd_c,
gMlmeCcaCnf_c,
gMlmeEdCnf_c,
gMlmeSetReq_c,
gMlmeSetCnf_c,
gMlmeTimeoutInd_c,
gMlme_UnexpectedRadioResetInd_c
}
enum rxStatus_t
{
rxInitStatus,
rxProcessingReceptionStatus_c,
rxSuccessStatus_c,
rxTimeOutStatus_c,
rxAbortedStatus_c,
rxMaxStatus_c
}
type smacTime_t = uint64
struct smacHeader_t
{
uint16 frameControl;
uint8 seqNo;
uint16 panId;
uint16 destAddr;
uint16 srcAddr;
}
struct txPacket_t
{
uint8 u8DataLength;
smacHeader_t smacHeader;
binary smacPdu @length(u8DataLength);
}
struct txContextConfig_t
{
bool ccaBeforeTx;
bool autoAck;
uint8 retryCountCCAFail;
uint8 retryCountAckFail;
}
struct rxPacket_t
{
uint8 u8MaxDataLength;
rxStatus_t rxStatus;
uint8 u8DataLength;
smacHeader_t smacHeader;
binary smacPdu @length(u8DataLength);
}
interface SMAC {
InitSmac() -> void
MCPSDataRequest(txPacket_t txPacket) -> smacErrors_t
MLMEConfigureTxContext(txContextConfig_t txConfig) -> smacErrors_t
MLMERXEnableRequest(rxPacket_t rxPacket, smacTime_t stTimeout) -> smacErrors_t
MLMERXDisableRequest() -> smacErrors_t
MLMESetChannelRequest(channels_t newChannel) -> smacErrors_t
MLMEGetChannelRequest() -> channels_t
MLMEPAOutputAdjust(uint8 u8PaValue) -> smacErrors_t
MLMELinkQuality() -> uint8
MLMEScanRequest(channels_t u8ChannelToScan) -> smacErrors_t
MLMECcaRequest() -> smacErrors_t
MLMETXDisableRequest() -> void
SMACSetShortSrcAddress(uint16 nwShortAddress) -> smacErrors_t
SMACSetPanID(uint16 nwShortPanID) -> smacErrors_t
SMAC_SetIVKey(uint8[16] KEY, uint8[16] IV) -> void
}
type instanceId_t = uint32
struct smacDataCnf_t
{
smacErrors_t status;
}
struct smacDataInd_t
{
uint8 u8LastRxRssi;
rxPacket_t pRxPacket;
}
struct smacCcaCnf_t
{
smacErrors_t status;
}
struct smacEdCnf_t
{
smacErrors_t status;
uint8 energyLevel;
uint8 energyLeveldB;
channels_t scannedChannel;
}
struct smacToAppMlmeMessage_t
{
smacMessageDefs_t msgType;
uint8 appInstanceId;
union (msgType) {
case gMlmeCcaCnf_c:
smacCcaCnf_t ccaCnf;
case gMlmeEdCnf_c:
smacEdCnf_t edCnf;
} msgData;
}
struct smacToAppDataMessage_t
{
smacMessageDefs_t msgType;
uint8 appInstanceId;
union (msgType) {
case gMcpsDataCnf_c:
smacDataCnf_t dataCnf;
case gMcpsDataInd_c:
smacDataInd_t dataInd;
} msgData;
}
interface SMACCallbacks {
SMAC_APP_MCPS_SapHandler(smacToAppDataMessage_t msg, instanceId_t instanceId) -> smacErrors_t
SMAC_APP_MLME_SapHandler(smacToAppMlmeMessage_t msg, instanceId_t instanceId) -> smacErrors_t
}