| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

rli_project.c
Go to the documentation of this file.
1 /*!
2 * @file rli_project.c
3 * @brief rli_Project.c is an embedded application written using
4 * ISF to demonstrate the functionality of the rli for
5 * over I2C/SPI interfaces.
6 *
7 * The rli_project.c is a working example of an ISF embedded application that
8 * enables host configuration of the rli I2C magnetometer sensor. This application
9 * uses the ISF Command Interpreter directly. It can be easily used as a starting
10 * point for modifications to allow anyone to write their own embedded application.
11 * The source code has been commented to explain the various parts of the application.
12 *
13 * @copyright Copyright (c) 2015, Freescale Semiconductor, Inc.
14 *
15 ******************************************************************************/
16 // ISF includes
17 #include "isf_target.h"
18 #include "isf_types.h" // For uint8, uint16, int32, TRUE, FALSE, etc.
19 #include "isf.h" // For isf_status_t
20 #include "isf_init.h" // For ISF_TASKS_ATTRIBUTES, ISF_APP_CALLBACKS, etc.
21 #include "isf_ci.h" // For ci_response_t, CI function prototypes, etc.
22 #include "isf_ci_stream.h"
23 #include "isf_pm.h" // For the power management function prototypes
24 #include "isf_bm.h"
25 #include "isf_devmsg.h"
26 #include "isf_sysconf_comms.h"
27 #include "isf_sysconf_types.h"
28 #include "isf_rli.h"
29 #include "fsl_i2c_master_driver.h"
30 #include "isf_i2c_master_types.h"
31 #include "isf_spi_master_types.h"
32
33 /******************************************************
34 * TYPE DEFINITIONS
35 *****************************************************/
36
37 /* The event flag used for sensor data notifications.
38 * This is passed to the Sensor Manager during subscription.
39 */
40 #define SENSOR_DATA_READY_EVENT ((uint32)(1 << 10))
41 #define RLI_COMM_BUFFER_SIZE (255)
42 #define RLI_CMD_BUFFER_SIZE (24)
43 typedef uint8_t rcvBuffer_t[RLI_COMM_BUFFER_SIZE];
44 typedef uint8_t cmdBuffer_t[RLI_CMD_BUFFER_SIZE];
45
46 enum {
47 RLI_APP_STATE_CLOSED = 0,
48 RLI_APP_STATE_OPEN = 1,
49 RLI_APP_STATE_ERROR = 0xFF
50 };
51
52 /*! @brief Macro that extracts one of the fields below. */
53 #define SET_FIELD(name,val) (((val)<<name##_SHIFT)&(name##_MASK))
54 #define GET_FIELD(name,val) ((val&name##_MASK)>>name##_SHIFT)
55
56
57 enum {
58 CONFIGURE_PERIODIC_READ = 11,
59 STOP_PERIODIC_READ = 12,
60 };
61
62 typedef struct {
63 uint16_t deviceAddress;
64 dm_ChannelId_t channelID;
65 } rliConfigRegister_t;
66
67 /*! @brief rli application configuration buffer format. */
68
69 typedef struct {
70 uint8 device;
71 uint8 channel;
72 uint8 error;
73 } rliAppStatus_t;
74
75 typedef struct {
76 rliConfigRegister_t CfgBuffer; //!< Application configuration information
77 rliAppStatus_t status;
78 bm_callback_token_t token;
79 cmdBuffer_t cmdBuffer;
80 rcvBuffer_t rcvBuffer;
81 rcvBuffer_t periodicRcvBuffer;
82 RLI_CHANNEL_HANDLE* pChannelDescriptor;
83 RLI_DEV_HANDLE* pHandle;
84 uint8_t periodicStartAddress;
85 uint8_t periodicNRead;
86 uint8_t streamId;
87 } rliAppState_t;
88 /*! @brief rli overall application state buffer format. */
89
90
91 typedef struct
92 {
93 /*! read period (usecs) */
94 isf_duration_t period;
95
96 /*! streamId to use */
97 uint8 streamId;
98
99 } device_periodic_read_cfg_packet_t;
100
101 /* OVerlays on the standard ci_cmd_packet_t */
102 typedef struct
103 {
104 /*! Application ID */
105 uint8 appId;
106
107 /*! Host command */
108 uint8 cmd;
109
110 /*! Register Offset */
111 uint16 nWrite;
112
113 /*! Number of bytes to read/write */
114 uint8 nRead;
115
116 } device_cmd_packet_t;
117
118 #define RLI_APP_DATA "RLI App"
119
120 /*!
121 * @struct rli_app_info_t
122 * @This structure holds the RLI Application version and build
123 * information.
124 *
125 */
126 typedef struct
127 {
128 //! ISF Embedded Application type
129 uint8 appType;
130 //! ISF Embedded Application version information
131 uint16 version_info;
132 //! ISF Embedded Application registered additional information/data size
133 uint8 numBytes;
134 //! ISF Embedded Application registered additional information/data
135 uint8 appData[sizeof(RLI_APP_DATA)];
136 } rli_app_info_t;
137
138 /******************************************************
139 * FUNCTION PROTOTYPES
140 *****************************************************/
141 ci_response_t rli_ci_app_callback(ci_host_cmd_packet_t *pHostPacket, ci_app_resp_packet_t *pAppPacket);
142 void rli_app_task(void);
143 int32 open_channel(rliAppState_t *appState);
144 int32 close_channel(rliAppState_t *appState);
145 int32 device_connect(rliAppState_t *appState);
146 int32 device_disconnect(rliAppState_t *appState);
147 extern spi_master_CommSpecificInfo_t rli_spi_get_config(uint16 spiAddress);
148
149 /******************************************************
150 * GLOBAL VARIABLES
151 *****************************************************/
152 /* App Info Structure returned by the CI_CMD_READ_APP_VERSION command */
153 static const rli_app_info_t gsRLI_AppInfo = {
154 .appType = ISF_RLI_APP,
155 .version_info = 0x0100,
156 .numBytes = sizeof(RLI_APP_DATA),
157 .appData = RLI_APP_DATA
158 };
159
160 static rliAppState_t rliAppState; //! @brief This data structure/variable holds the complete state of the rli magnetometer sensor embedded application.
161
162 extern const sys_channelDescriptor_t gSys_ConfiguredChannelList[]; // Channel configuration list.
163
164 static const uint8 i2cChannels[] =
165 {
166 COMM_CHANNEL_I2C1,
167 COMM_CHANNEL_I2C1,
168 };
169
170 static const uint8 spiChannels[] =
171 {
172 COMM_CHANNEL_SPI1,
173 };
174
175 void rli_PeriodicCallback(rliAppState_t *rliAppState)
176 {
177 isf_status_t callbackRet;
178
179 // Execute the command
180 callbackRet = isf_rli_read(rliAppState->pHandle, rliAppState->periodicStartAddress, rliAppState->periodicNRead, rliAppState->periodicRcvBuffer);
181 if ((ci_response_enum)ISF_SUCCESS != callbackRet){
182 rliAppState->status.error= 1;
183 }
184
185 isf_ci_stream_update_data(rliAppState->streamId, rliAppState->periodicNRead, 0, rliAppState->periodicRcvBuffer);
186 }
187
188 /* Main Task for RLI */
189 void rli_app_task( void )
190 {
191 #if 0 /* Disabled Auto slave selection to enable dynamic selection of COMM channel.
192 * Slave will be initialized when Slave select command is received from Host RLI. */
193 // Initialize the current application state.
194 rliAppState.CfgBuffer.channelID = COMM_CHANNEL_I2C1;
195 rliAppState.CfgBuffer.deviceAddress = 0x0E;
196
197 // Open the rli channel
198 rliAppState.pChannelDescriptor = isf_rli_init(rliAppState.CfgBuffer.channelID);
199
200 // Connect to the default device
201 device_connect(&rliAppState);
202 #endif
203 _task_block();
204
205 for (;;)
206 {
207
208
209 } // for (;;)
210 }
211
212 /* CI Callback for RLI */
213 ci_response_t rli_ci_app_callback(ci_host_cmd_packet_t *pHostPacket, ci_app_resp_packet_t *pAppPacket) {
214 // New application configuration.
215 ci_response_enum callbackRet = CI_ERROR_NONE;
216
217 switch(pHostPacket->cmd)
218 {
219 case CI_CMD_READ_APP_DATA:
220 {
221 uint8 *pDataBuffer = (uint8 *)(rliAppState.rcvBuffer);
222
223 pAppPacket->bytes_xfer = (uint8)isf_ci_app_write(pHostPacket->appId, (uint32)pHostPacket->byte_cnt, (uint8*)(pDataBuffer + pHostPacket->offset));
224 break;
225 }
226
227 // Read data from the status struct.
228 case CI_CMD_READ_APP_STATUS:
229 {
230 uint8 size = sizeof(rliAppState.status);
231 uint8 *pDataBuffer = (uint8 *) &rliAppState.status;
232
233 // Validate the offset and byte count to ensure the read operation is within the range of the host output buffer.
234 if (pHostPacket->byte_cnt > size) {
235 callbackRet = CI_INVALID_COUNT;
236 break;
237 }
238
239 if (pHostPacket->offset + pHostPacket->byte_cnt > size ) {
240 callbackRet = CI_ERROR_COMMAND;
241 break;
242 }
243
244 // Lock the output buffer, update the data to the CI, then unlock the buffer.
245 pAppPacket->bytes_xfer = (uint8)isf_ci_app_write(pHostPacket->appId, (uint32)pHostPacket->byte_cnt, (uint8*)(pDataBuffer + pHostPacket->offset));
246 break;
247 }
248 // Read or write the application configuration structure.
249 case CI_CMD_READ_CONFIG:
250 // Fall through.
251 case CI_CMD_WRITE_CONFIG:
252 {
253 uint8 size = sizeof(rliAppState.CfgBuffer);
254
255 // Validate the offset and byte count to ensure the read or write operation is within the range of the host configuration buffer.
256 if (pHostPacket->byte_cnt > size ) {
257 callbackRet = CI_INVALID_COUNT;
258 break;
259 }
260
261 if (pHostPacket->offset + pHostPacket->byte_cnt > size) {
262 callbackRet = CI_ERROR_COMMAND;
263 break;
264 }
265
266 // Read or write the data to/from the CI.
267 if (CI_CMD_READ_CONFIG == pHostPacket->cmd)
268 {
269 // The host is reading so we have to write what they've asked for
270 pAppPacket->rw = CI_RW_WRITE; // Write the data to host.
271 pAppPacket->bytes_xfer = (uint8)isf_ci_app_write(pHostPacket->appId, (uint32)pHostPacket->byte_cnt,
272 (uint8*)(&rliAppState.CfgBuffer) + pHostPacket->offset);
273 }
274 else {
275 // The host is writing so we have to read what they've written
276 // Read the new data from the host.
277 pAppPacket->rw = CI_RW_READ;
278 pAppPacket->bytes_xfer =
279 (uint8)isf_ci_app_read(
280 pHostPacket->appId, (uint32)pHostPacket->byte_cnt,
281 (uint8*)(&rliAppState.CfgBuffer) + pHostPacket->offset
282 );
283 /* Brute force transitions - always shutdown and restart on any config change TODO: Make this more elegant */
284 if (rliAppState.status.device == RLI_APP_STATE_OPEN)
285 {
286 device_disconnect(&rliAppState);
287 }
288 callbackRet = device_connect(&rliAppState);
289 if ((ci_response_enum)ISF_SUCCESS != callbackRet){
290 return CI_ERROR_PARAM;
291 }
292 }
293
294 }
295 break;
296
297 // Reset the application state.
298 case CI_CMD_RESET_APP:
299
300 break;
301 // Read or write the application configuration structure.
302
303 case CI_CMD_DEVICE_READ:
304 // Fall through.
305 case CI_CMD_DEVICE_WRITE:
306 {
307 /* Overlay a device packet structure on the host packet to reinterpret the provided data as a device command
308 * instead of a traditional host packet. This allows the host to skip sending a useless offset and length
309 * and instead immediately place the nWrite and nRead of the comm_Command_t sent to device messaging.
310 */
311 device_cmd_packet_t *pDeviceCmd = (device_cmd_packet_t *)pHostPacket;
312
313 // Validate the read and write byte counts to ensure they will fit in the configured buffers.
314 if ((pDeviceCmd->nRead > sizeof(rcvBuffer_t)) || (pDeviceCmd->nWrite > sizeof(cmdBuffer_t)) ) {
315 callbackRet = CI_INVALID_COUNT;
316 break;
317 }
318
319 if (pDeviceCmd->nWrite > 0) {
320 pAppPacket->rw = CI_RW_READ; // Write the data to host.
321 pAppPacket->bytes_xfer = (uint8)isf_ci_app_read (
322 pDeviceCmd->appId,
323 (uint32)pDeviceCmd->nWrite,
324 (uint8*)rliAppState.cmdBuffer
325 );
326 }
327
328 // Read or write the data to/from the CI.
329 if (CI_CMD_DEVICE_READ == pDeviceCmd->cmd)
330 {
331
332 // store the num bytes and start address to read from in the state structure
333 // to support a possible periodic read later on.
334 rliAppState.periodicStartAddress = rliAppState.cmdBuffer[0];
335 rliAppState.periodicNRead = pDeviceCmd->nRead;
336
337 // Execute the command
338 callbackRet = isf_rli_read(rliAppState.pHandle, rliAppState.cmdBuffer[0], pDeviceCmd->nRead, rliAppState.rcvBuffer);
339 if ((ci_response_enum)ISF_SUCCESS != callbackRet){
340 rliAppState.status.error= 1;
341 }
342
343 pAppPacket->rw = CI_RW_WRITE; // Write the data to host.
344 pAppPacket->bytes_xfer = (uint8)isf_ci_app_write(pHostPacket->appId, (uint32)pDeviceCmd->nRead,
345 (uint8*)rliAppState.rcvBuffer);
346 }
347 else {
348 callbackRet = isf_rli_write(rliAppState.pHandle, rliAppState.cmdBuffer[0], pDeviceCmd->nWrite - 1, &rliAppState.cmdBuffer[1] );
349
350 if ((ci_response_enum)ISF_SUCCESS != callbackRet){
351 rliAppState.status.error= 2;
352 }
353
354 pAppPacket->rw = CI_RW_WRITE; // Write the data to host.
355 pAppPacket->bytes_xfer = (uint8)isf_ci_app_write(pHostPacket->appId, (uint32)pDeviceCmd->nRead,
356 (uint8*)rliAppState.rcvBuffer);
357
358 }
359
360 }
361 break;
362
363 case CONFIGURE_PERIODIC_READ:
364
365 {
366 device_periodic_read_cfg_packet_t readCfg;
367 uint8_t cmdBuf[10];
368 uint8 triggerMask = 1;
369 ci_stream_element_t element1;
370 isf_status_t st;
371
372 pAppPacket->bytes_xfer =
373 (uint8)isf_ci_app_read(
374 pHostPacket->appId, (uint32)pHostPacket->byte_cnt, cmdBuf
375 );
376 readCfg.period = (cmdBuf[0]<<24)|(cmdBuf[1]<<16)|(cmdBuf[2]<<8)|(cmdBuf[3]);
377 readCfg.streamId = cmdBuf[4];
378
379 rliAppState.streamId = readCfg.streamId;
380
381 // Define the block of data to send. (DATA_TYPE_SUB0 is the sensor data from the first sensor subscription)
382 element1.datasetID = rliAppState.streamId; // Make datasetID match the streamId
383 element1.length = rliAppState.periodicNRead; // Send all the data read
384 element1.offset = 0; // No offset for the register read data
385
386 // Define a stream that sends the register data
387 st = isf_ci_stream_create(rliAppState.streamId, 1, &triggerMask, &element1);
388
389 // Register the periodic callback function with the Bus Manager.
390 rliAppState.token = bm_register_periodic_callback( readCfg.period, (bm_callback_t *)rli_PeriodicCallback , (void *)&rliAppState);
391 if(BM_ERROR & rliAppState.token){
392 callbackRet = rliAppState.token;
393 }
394 bm_start(false, rliAppState.token);
395 }
396 break;
397
398 case STOP_PERIODIC_READ:
399 {
400 isf_status_t st;
401
402 if (rliAppState.streamId)
403 {
404 bm_stop(rliAppState.token);
405 // Unregister the periodic callback function with the Bus Manager.
406 callbackRet = bm_unregister_callback(rliAppState.token);
407
408 // delete the stream
409 st = isf_ci_stream_delete(rliAppState.streamId);
410 rliAppState.streamId = 0;
411 }
412 }
413 break;
414
415 // Read ISF Embedded Application Version Info.
416 case CI_CMD_READ_VERSION:
417 // Write the ISF Application information to the host interface.
418 pAppPacket->bytes_xfer = isf_ci_app_write(pHostPacket->appId, sizeof(gsRLI_AppInfo), (uint8*)&gsRLI_AppInfo);
419 break;
420
421 default:
422 callbackRet = CI_ERROR_COMMAND;
423 break;
424 }
425
426 return callbackRet;
427 }
428
429 /* ---------------------------------
430 * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
431 * ---------------------------------
432 * |TYP| ChannelID |SPI_TP/Reserved|
433 * ---------------MSB---------------
434 * ---------------------------------
435 * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
436 * ---------------------------------
437 * | Slave Select Address (I2C) |
438 * ---------------LSB---------------
439 *
440 * TYP = I2C/SPI Type selector (0=I2C/1=SPI).
441 * Channel ID = The I2C/SPI sub-channel number (0=I2C0/SPI0 or defaults, 1=I2C1/SPI1).
442 * SPI_TP/Reserved = SPI Type or Reserved for I2C.
443 */
444 int32 device_connect(rliAppState_t *appState)
445 {
446 void *device;
447 uint8 channelType, channelID;
448
449 channelID = (appState->CfgBuffer.deviceAddress & 0x7000) >> 12;
450 channelType = (appState->CfgBuffer.deviceAddress & 0x8000) >> 15;
451 appState->status.channel = RLI_APP_STATE_ERROR;
452 rliAppState.pChannelDescriptor = NULL;
453
454 spi_master_CommSpecificInfo_t spiDevice;
455 if(channelType == 1) //SPI Selected
456 {
457 rliAppState.CfgBuffer.channelID = spiChannels[channelID];
458 rliAppState.pChannelDescriptor = isf_rli_init(rliAppState.CfgBuffer.channelID);
459 if(rliAppState.pChannelDescriptor == NULL)
460 {
461 return -1;
462 }
463 appState->status.channel = RLI_APP_STATE_OPEN;
464 spiDevice = rli_spi_get_config(appState->CfgBuffer.deviceAddress);
465 device = &spiDevice;
466 }
467
468 i2c_device_t i2cDevice = {0};
469 if(channelType == 0) //I2C Selected
470 {
471 rliAppState.CfgBuffer.channelID = i2cChannels[channelID];
472 rliAppState.pChannelDescriptor = isf_rli_init(rliAppState.CfgBuffer.channelID);
473 if(rliAppState.pChannelDescriptor == NULL)
474 {
475 return -1;
476 }
477 appState->status.channel = RLI_APP_STATE_OPEN;
478 i2cDevice.address = appState->CfgBuffer.deviceAddress & 0x00FF;
479 i2cDevice.baudRate_kbps = ((i2c_Master_BusConfig_t*)gSys_ConfiguredChannelList[i2cChannels[channelID]].pConfig)->defaultSpeed;
480 device = &i2cDevice;
481 appState->status.channel = RLI_APP_STATE_OPEN;
482 }
483
484 appState->status.device = RLI_APP_STATE_ERROR;
485 appState->pHandle = isf_rli_open(appState->pChannelDescriptor, device);
486 if (NULL == appState->pHandle)
487 {
488 return -1;
489 }
490 // Open the device and get the device handler
491 appState->status.device = RLI_APP_STATE_OPEN;
492 return 0;
493 }
494
495 int32 device_disconnect(rliAppState_t *appState)
496 {
497 appState->status.device = RLI_APP_STATE_ERROR;
498
499 // Close the device
500 if(isf_rli_close(appState->pHandle)){
501 return -1;
502 }
503 appState->status.device = RLI_APP_STATE_CLOSED;
504 appState->status.channel = RLI_APP_STATE_ERROR;
505
506 // Stop the channel
507 if(isf_rli_deint(appState->pChannelDescriptor)){
508 return -1;
509 }
510 appState->status.channel = RLI_APP_STATE_CLOSED;
511
512 return 0;
513 }
514
isf_i2c_master_types.h
isf_i2c_master_types.h defines the i2c master protocol adapter structure and types.
rliAppState_t::streamId
uint8_t streamId
Definition: rli_project.c:86
isf_target.h
ISF board support header files.
isf_sysconf_comms.h
This file defines the system configuration for the communication channel.
uint8
unsigned char uint8
Definition: isf_types.h:76
CI_RW_WRITE
Definition: isf_ci.h:55
RLI_COMM_BUFFER_SIZE
#define RLI_COMM_BUFFER_SIZE
Definition: rli_project.c:41
spi_master_CommSpecificInfo_t
Definition: isf_spi_master_types.h:60
isf_rli_close
isf_status_t isf_rli_close(RLI_DEV_HANDLE *apRLIDeviceHandle)
This function closes the RLI connection.
Definition: isf_rli.c:97
rliConfigRegister_t
Definition: rli_project.c:62
device_cmd_packet_t
Definition: rli_project.c:102
CI_CMD_READ_CONFIG
Definition: isf_ci.h:74
ci_host_cmd_packet_t::byte_cnt
uint8 byte_cnt
Definition: isf_ci.h:209
ci_host_cmd_packet_t::offset
uint16 offset
Definition: isf_ci.h:206
RLI_CHANNEL_HANDLE
void RLI_CHANNEL_HANDLE
Definition: isf_rli.h:18
ISF_SUCCESS
Definition: isf.h:31
rli_app_info_t::version_info
uint16 version_info
ISF Embedded Application version information.
Definition: rli_project.c:131
isf_ci_stream.h
ISF Command Interpreter (CI) stream protocol header file.
device_cmd_packet_t::nWrite
uint16 nWrite
Definition: rli_project.c:111
ISF_RLI_APP
ISF Application Type for RLI Application.
Definition: isf.h:51
rli_app_info_t::appType
uint8 appType
ISF Embedded Application type.
Definition: rli_project.c:129
device_periodic_read_cfg_packet_t::period
isf_duration_t period
Definition: rli_project.c:94
close_channel
int32 close_channel(rliAppState_t *appState)
isf_bm.h
API definitions, types, and macros for the Intelligent Sensing Framework (ISF) Bus Manager (BM)...
CI_ERROR_COMMAND
Definition: isf_ci.h:137
rliAppState_t::periodicStartAddress
uint8_t periodicStartAddress
Definition: rli_project.c:84
gSys_ConfiguredChannelList
const sys_channelDescriptor_t gSys_ConfiguredChannelList[]
This data structure/variable holds the complete state of the rli magnetometer sensor embedded applica...
Definition: isf_sysconf_comms.c:71
rli_PeriodicCallback
void rli_PeriodicCallback(rliAppState_t *rliAppState)
Definition: rli_project.c:175
isf_rli_init
RLI_CHANNEL_HANDLE * isf_rli_init(uint32 aChannelId)
This function initializes a register level interface.
Definition: isf_rli.c:24
rliAppState_t
Definition: rli_project.c:75
rcvBuffer_t
uint8_t rcvBuffer_t[RLI_COMM_BUFFER_SIZE]
Definition: rli_project.c:43
device_periodic_read_cfg_packet_t
rli overall application state buffer format.
Definition: rli_project.c:91
ci_host_cmd_packet_t::cmd
uint8 cmd
Definition: isf_ci.h:203
rliAppStatus_t::channel
uint8 channel
Definition: rli_project.c:71
ci_app_resp_packet_t::rw
ci_rw_enum rw
Definition: isf_ci.h:228
bm_callback_token_t
uint32 bm_callback_token_t
This type defines the Bus Manager token. Each callback registered with the Bus Manager receives a uni...
Definition: isf_bm.h:79
ci_app_resp_packet_t::bytes_xfer
uint8 bytes_xfer
Definition: isf_ci.h:233
bm_unregister_callback
isf_status_t bm_unregister_callback(bm_callback_token_t aToken)
This API unregisters one or more callbacks.
Definition: bus_management.c:178
rli_app_info_t::numBytes
uint8 numBytes
ISF Embedded Application registered additional information/data size.
Definition: rli_project.c:133
rliConfigRegister_t::channelID
dm_ChannelId_t channelID
Definition: rli_project.c:64
rliAppStatus_t::device
uint8 device
Definition: rli_project.c:70
CI_CMD_DEVICE_READ
Definition: isf_ci.h:95
isf_pm.h
isf_pm.h describes the API definitions, types, and macros for the Intelligent Sensing Framework (ISF)...
isf_types.h
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
device_disconnect
int32 device_disconnect(rliAppState_t *appState)
Definition: rli_project.c:495
cmdBuffer_t
uint8_t cmdBuffer_t[RLI_CMD_BUFFER_SIZE]
Definition: rli_project.c:44
RLI_APP_STATE_CLOSED
Definition: rli_project.c:47
rliAppState_t::cmdBuffer
cmdBuffer_t cmdBuffer
Definition: rli_project.c:79
CI_RW_READ
Definition: isf_ci.h:52
RLI_APP_DATA
#define RLI_APP_DATA
Definition: rli_project.c:118
rliAppState_t::pChannelDescriptor
RLI_CHANNEL_HANDLE * pChannelDescriptor
Definition: rli_project.c:82
isf_ci_stream_delete
isf_status_t isf_ci_stream_delete(uint8 aStreamID)
This API deletes the given stream ID.
Definition: ci_protocol_stream.c:168
rli_app_task
void rli_app_task(void)
Definition: rli_project.c:189
isf_ci_stream_create
isf_status_t isf_ci_stream_create(uint8 aStreamID, uint8 aNumElements, uint8 *apTriggerMask, ci_stream_element_t *apElementList)
This API creates a stream.
Definition: ci_protocol_stream.c:243
STOP_PERIODIC_READ
Definition: rli_project.c:59
rliAppStatus_t::error
uint8 error
Definition: rli_project.c:72
bm_register_periodic_callback
bm_callback_token_t bm_register_periodic_callback(isf_duration_t aPeriod, bm_callback_t *pCallback, void *pCbData)
This API schedules a callback at the specified period.
Definition: bus_management.c:94
CI_CMD_READ_APP_DATA
Definition: isf_ci.h:80
device_connect
int32 device_connect(rliAppState_t *appState)
Definition: rli_project.c:444
CI_CMD_READ_APP_STATUS
Definition: isf_ci.h:86
rliAppState_t::rcvBuffer
rcvBuffer_t rcvBuffer
Definition: rli_project.c:80
CI_INVALID_COUNT
Definition: isf_ci.h:134
isf_ci_app_read
uint32 isf_ci_app_read(uint8 aAppId, uint32 anumBytes, uint8 *apDst)
This API reads data from the host via the mailboxes.
Definition: ci_protocol_mbox.c:226
isf_ci_app_write
uint32 isf_ci_app_write(uint8 aAppId, uint32 anumBytes, uint8 *apSrc)
This API writes data to the host via the mailboxes.
Definition: ci_protocol_mbox.c:277
isf_rli_write
isf_status_t isf_rli_write(RLI_DEV_HANDLE *apRLIDeviceHandle, int32 startAddress, uint32 aNbyteWrite, uint8 *apWriteBuffer)
This function writes to the device registers.
Definition: isf_rli.c:68
COMM_CHANNEL_I2C1
Definition: isf_sysconf_comms.h:30
CONFIGURE_PERIODIC_READ
Definition: rli_project.c:58
CI_CMD_DEVICE_WRITE
Definition: isf_ci.h:92
isf_rli_deint
isf_status_t isf_rli_deint(RLI_CHANNEL_HANDLE *apRLIChannelHandle)
This function de-initialize the RLI channel.
Definition: isf_rli.c:113
bm_stop
isf_status_t bm_stop(bm_callback_token_t aTokens)
This API stops one or more callback(s) by setting them to the inactive state.
Definition: bus_management.c:349
bm_start
isf_status_t bm_start(boolean aSync, bm_callback_token_t aTokens)
This API sets one or more callback(s) to the active state.
Definition: bus_management.c:278
sys_channelDescriptor_t
This structure defines the channel descriptor.
Definition: isf_sysconf_types.h:33
rliAppState_t::token
bm_callback_token_t token
Definition: rli_project.c:78
rliAppState_t::periodicNRead
uint8_t periodicNRead
Definition: rli_project.c:85
isf_duration_t
uint32 isf_duration_t
ISF time duration in microseconds.
Definition: isf.h:84
rli_spi_get_config
spi_master_CommSpecificInfo_t rli_spi_get_config(uint16 spiAddress)
Definition: RLI1.c:176
isf.h
Main ISF header file. Contains code common to all ISF components.
CI_ERROR_PARAM
Definition: isf_ci.h:129
device_periodic_read_cfg_packet_t::streamId
uint8 streamId
Definition: rli_project.c:97
bm_callback_t
void( bm_callback_t)(void *)
Type for the prototype for a Bus Manager periodic callback function.
Definition: isf_bm.h:71
int32
signed long int int32
Definition: isf_types.h:74
uint16
unsigned short int uint16
Definition: isf_types.h:77
open_channel
int32 open_channel(rliAppState_t *appState)
rliAppStatus_t
rli application configuration buffer format.
Definition: rli_project.c:69
RLI_APP_STATE_ERROR
Definition: rli_project.c:49
isf_ci.h
API definitions, types, and macros for the Intelligent Sensing Framework (ISF) Command Interpreter (C...
rliAppState_t::CfgBuffer
rliConfigRegister_t CfgBuffer
Application configuration information.
Definition: rli_project.c:76
ci_stream_element_t
ci_stream_element_t
Definition: isf_ci_stream.h:201
isf_init.h
The isf_init.h file contains the task initialization attributes required for initialization of the fo...
CI_CMD_READ_VERSION
Definition: isf_ci.h:71
rliConfigRegister_t::deviceAddress
uint16_t deviceAddress
Definition: rli_project.c:63
device_cmd_packet_t::appId
uint8 appId
Definition: rli_project.c:105
BM_ERROR
#define BM_ERROR
This value specifies a general Bus Manager error. If an error occurs in registering a callback...
Definition: isf_bm.h:57
ci_app_resp_packet_t
This structure enables an application to read from or write to the host.
Definition: isf_ci.h:221
rliAppState_t::periodicRcvBuffer
rcvBuffer_t periodicRcvBuffer
Definition: rli_project.c:81
isf_status_t
int32 isf_status_t
ISF return status type.
Definition: isf.h:76
isf_rli.h
isf_spi_master_types.h
isf_spi_master_types.h defines the spi protocol adapter structure and types.
device_cmd_packet_t::nRead
uint8 nRead
Definition: rli_project.c:114
RLI_CMD_BUFFER_SIZE
#define RLI_CMD_BUFFER_SIZE
Definition: rli_project.c:42
i2c_Master_BusConfig_struct
Definition: isf_i2c_master_types.h:17
RLI_DEV_HANDLE
void RLI_DEV_HANDLE
Definition: isf_rli.h:19
ci_host_cmd_packet_t
This structure contains host command information.
Definition: isf_ci.h:197
uint32
unsigned long int uint32
Definition: isf_types.h:78
isf_rli_read
isf_status_t isf_rli_read(RLI_DEV_HANDLE *apRLIDeviceHandle, int32 startAddress, uint32 aNbyteRead, uint8 *apReadBuffer)
This function reads from the device registers.
Definition: isf_rli.c:83
device_cmd_packet_t::cmd
uint8 cmd
Definition: rli_project.c:108
CI_ERROR_NONE
Definition: isf_ci.h:123
isf_devmsg.h
isf_devmsg.h defines the API definitions and types for the Intelligent Sensing (ISF) Device Messaging...
ci_host_cmd_packet_t::appId
uint8 appId
Definition: isf_ci.h:200
ci_response_enum
ci_response_enum
These are the CI errors provided to the host.
Definition: isf_ci.h:119
rliAppState_t::status
rliAppStatus_t status
Definition: rli_project.c:77
isf_sysconf_types.h
This file defines the configuration types and structures for the system communication channel...
COMM_CHANNEL_SPI1
Definition: isf_sysconf_comms.h:31
RLI_APP_STATE_OPEN
Definition: rli_project.c:48
isf_ci_stream_update_data
isf_status_t isf_ci_stream_update_data(uint8 aDataSetID, uint16 aLength, uint16 aOffset, uint8 *apSrc)
This API updates the data of a dataset.
Definition: ci_protocol_stream.c:449
CI_CMD_RESET_APP
Definition: isf_ci.h:89
rli_app_info_t
Definition: rli_project.c:126
isf_rli_open
RLI_DEV_HANDLE * isf_rli_open(RLI_CHANNEL_HANDLE *apRLIChannelHandle, void *apSlaveInfo)
This function creates a RLI connection handle at a specified device address.
Definition: isf_rli.c:47
CI_CMD_WRITE_CONFIG
Definition: isf_ci.h:77
dm_ChannelId_t
comm_Id_t dm_ChannelId_t
This typedef is a numeric channel identifier index into an array of channels in the system...
Definition: isf_devmsg.h:33
rliAppState_t::pHandle
RLI_DEV_HANDLE * pHandle
Definition: rli_project.c:83
rli_ci_app_callback
ci_response_t rli_ci_app_callback(ci_host_cmd_packet_t *pHostPacket, ci_app_resp_packet_t *pAppPacket)
Definition: rli_project.c:213
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.