1 /******************************************************************************
2 @file csf_linux.h
4 @brief TIMAC 2.0 API Collector specific (linux) function definitions
6 Group: WCS LPC
7 $Target Devices: Linux: AM335x, Embedded Devices: CC1310, CC1350, CC1352$
9 ******************************************************************************
10 $License: BSD3 2016 $
12 Copyright (c) 2015, Texas Instruments Incorporated
13 All rights reserved.
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions
17 are met:
19 * Redistributions of source code must retain the above copyright
20 notice, this list of conditions and the following disclaimer.
22 * Redistributions in binary form must reproduce the above copyright
23 notice, this list of conditions and the following disclaimer in the
24 documentation and/or other materials provided with the distribution.
26 * Neither the name of Texas Instruments Incorporated nor the names of
27 its contributors may be used to endorse or promote products derived
28 from this software without specific prior written permission.
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
34 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 ******************************************************************************
42 $Release Name: TI-15.4Stack Linux x64 SDK$
43 $Release Date: Sept 27, 2017 (2.04.00.13)$
44 *****************************************************************************/
46 #if !defined(CSF_LINUX_H)
47 #define CSF_LINUX_H
49 typedef uint8_t UArg;
51 /*!
52 * Network parameters for a non-frequency hopping coordinator.
53 */
55 /*! Network Information */
56 typedef struct
57 {
58 /*! Device Information */
59 ApiMac_deviceDescriptor_t deviceInfo;
60 /*! Channel */
61 uint8_t channel;
62 } Llc_networkInfo_t;
64 /*!
65 * Frequency Hopping Interface Settings
66 */
67 typedef struct _Llc_fhintervalsettings_t
68 {
69 /*! Channel dwell time (in milliseconds) */
70 uint16_t dwell;
71 /*! Channel interval time (in milliseconds) */
72 uint16_t interval;
73 } Llc_fhIntervalSettings_t;
75 /*!
76 * Device frequency hopping information
77 */
78 typedef struct _Llc_deviceinfofh_t
79 {
80 /*! Broadcast Interval settings */
81 Llc_fhIntervalSettings_t bcIntervals;
82 /*! Broadcast number of channels used */
83 uint8_t bcNumChans;
84 /*!
85 Broadcast channels used. Pointer to an array of bytes, Each byte
86 is a channel number and the order is the sequence to hop.
87 */
88 uint8_t *pBcChans;
89 /*! Unicast Rx Interval settings */
90 Llc_fhIntervalSettings_t unicastIntervals;
91 /*! Unicast Rx number of channels used */
92 uint8_t unicastNumChans;
93 /*!
94 * Unicast channels used. Pointer to an array of bytes, Each byte
95 * is a channel number and the order is the sequence to hop.
96 */
97 uint8_t *pUnicastChans;
98 } Llc_deviceInfoFh_t;
100 /*!
101 * Network parameters for a frequency hopping coordinator.
102 */
103 typedef struct _Llc_networkinfofh_t
104 {
105 /*! Device Information */
106 /* Address information */
107 ApiMac_deviceDescriptor_t devInfo;
108 /*! Device Frequency Hopping Information */
109 Llc_deviceInfoFh_t fhInfo;
110 } Llc_networkInfoFh_t;
112 /*! Stored network information */
113 typedef struct
114 {
115 /*! true if network is frequency hopping */
116 bool fh;
118 /*! union to hold network information */
119 union
120 {
121 Llc_netInfo_t netInfo;
122 Llc_networkInfoFh_t fhNetInfo;
123 } info;
124 } Csf_networkInformation_t;
126 /*! for use by web interface */
127 typedef struct
128 {
129 /*! Address information */
130 ApiMac_deviceDescriptor_t devInfo;
131 /*! Device capability */
132 ApiMac_capabilityInfo_t capInfo;
133 } Csf_deviceInformation_t;
135 /*
136 * @brief Get the device list
137 *
138 * Note: Memory must be released via Csf_freeDeviceList()
139 */
140 int Csf_getDeviceInformationList(Csf_deviceInformation_t **ppDeviceInfo);
142 /*
143 * @brief Release memory from the getDeviceList call
144 */
145 void Csf_freeDeviceInformationList(size_t n, Csf_deviceInformation_t *p);
147 /*
148 * @brief given a state, return the ascii text name of this state (for dbg)
149 * @param s - the state.
150 */
151 const char *CSF_cllc_statename(Cllc_states_t s);
153 /*
154 * @brief return the last known state of the CLLC.
155 */
156 Cllc_states_t Csf_getCllcState(void);
158 /*!
159 * @brief Send the configuration message to a collector module to be
160 * sent OTA.
161 *
162 * @param pDstAddr - destination address of the device to send the message
163 * @param frameControl - configure what to the device is to report back.
164 * Ref. Smsgs_dataFields_t.
165 * @param reportingInterval - in millseconds- how often to report, 0
166 * means to turn off automated reporting, but will
167 * force the sensor device to send the Sensor Data
168 * message once.
169 * @param pollingInterval - in millseconds- how often to the device is to
170 * poll its parent for data (for sleeping devices
171 * only.
172 *
173 * @return status(uint8_t) - Success (0), Failure (1)
174 */
175 extern uint8_t Csf_sendConfigRequest( ApiMac_sAddr_t *pDstAddr,
176 uint16_t frameControl,
177 uint32_t reportingInterval,
178 uint32_t pollingInterval);
179 /*!
180 * @brief Build and send the toggle led message to a device.
181 *
182 * @param pDstAddr - destination address of the device to send the message
183 *
184 * @return Collector_status_success, Collector_status_invalid_state
185 * or Collector_status_deviceNotFound
186 */
187 extern uint8_t Csf_sendToggleLedRequest(
188 ApiMac_sAddr_t *pDstAddr);
190 /*!
191 * @brief Build and send the toggle led message to a device.
192 *
193 * @param pDstAddr - destination address of the device to send the message
194 *
195 * @return Collector_status_success, Collector_status_invalid_state
196 * or Collector_status_deviceNotFound
197 */
198 extern uint8_t Csf_sendBuzzerCtrlRequest(
199 ApiMac_sAddr_t *pDstAddr);
201 #endif
203 /*
204 * ========================================
205 * Texas Instruments Micro Controller Style
206 * ========================================
207 * Local Variables:
208 * mode: c
209 * c-file-style: "bsd"
210 * tab-width: 4
211 * c-basic-offset: 4
212 * indent-tabs-mode: nil
213 * End:
214 * vim:set filetype=c tabstop=4 shiftwidth=4 expandtab=true
215 */