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

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

isf_ci_stream.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2015, Freescale Semiconductor, Inc.
4 *
5 */
6
7 /*!
8 * @file isf_ci_stream.h
9 * @brief ISF Command Interpreter (CI) stream protocol header file.
10 *
11 */
12
13 #ifndef ISF_CI_STREAM_H_
14 #define ISF_CI_STREAM_H_
15
16
17 #include "isf.h"
18
19
20
21 /*!
22 * @brief CI host stream command.
23 *
24 * @details The host indicates which command the stream protocol runs.
25 * ::ci_commands_stream_enum is used to identify this command. The maximum
26 * number of possible commands is 128 represented by 7 bits.
27 *
28 */
29 typedef enum
30 {
31 /*! The host resets the stream protocol which deletes all instances. */
32 CI_CMD_STREAM_RESET = 0,
33
34 /*! The host enables stream data updates. */
35 CI_CMD_STREAM_ENABLE_DATA_UPDATE = 1,
36
37 /*! The host enables stream data updates. */
38 CI_CMD_STREAM_DISABLE_DATA_UPDATE = 2,
39
40 /*! The host creates a stream. */
41 CI_CMD_STREAM_CREATE_STREAM = 3,
42
43 /*! The host deletes a stream. */
44 CI_CMD_STREAM_DELETE_STREAM = 4,
45
46 /*! The host resets a stream trigger. */
47 CI_CMD_STREAM_RESET_TRIGGER = 5,
48
49 /*! The host enables CRC generation in the stream packet. */
50 CI_CMD_STREAM_ENABLE_CRC = 6,
51
52 /*! The host disables CRC generation in the stream packet. */
53 CI_CMD_STREAM_DISABLE_CRC = 7,
54
55 /*! The host requests to get the current number of streams. */
56 CI_CMD_STREAM_GETINFO_NUMBER_STREAMS = 8,
57
58 /*! The host requests the trigger state of a given stream ID. */
59 CI_CMD_STREAM_GETINFO_TRIGGER_STATE = 9,
60
61 /*! The host requests to get the stream configuration of a given stream ID. */
62 CI_CMD_STREAM_GETINFO_STREAM_CONFIG = 10,
63
64 /*! The host requests to get the first stream ID. */
65 CI_CMD_STREAM_GETINFO_GET_FIRST_STREAMID = 11,
66
67 /*! The host requests to get the next stream ID. */
68 CI_CMD_STREAM_GETINFO_GET_NEXT_STREAMID = 12,
69
70 /*! Maximum currently defined CI stream commands. */
71 CI_CMD_STREAM_MAX = 12
72
73 /*! Maximum number of possible CI stream commands is 128 (7-bits). */
74
75 } ci_commands_stream_enum;
76
77
78
79 /*! @brief These are the CI stream protocol errors provided to the host.
80 *
81 * @details Any errors identified by the stream protocol are returned
82 * to the host. These errors may be passed back to the host from the
83 * application. There are 7 bits allocated to contain error status
84 * resulting in 128 possible different status values.
85 *
86 * Bit6 of the status byte is used to indicate error condition. If
87 * bit6 = 1, then the value in bit0-5 contains the specific error
88 * condition. If bit6 = 0, then the value in bit0-5 contains the
89 * specific status.
90 */
91
92 #define CI_STATUS_STREAM_SPECIFIC_STATUS (0xBF) // Bit6 cleared
93 #define CI_STATUS_STREAM_SPECIFIC_ERROR (0x40) // Bit6 set
94
95 typedef enum
96 {
97
98
99 // --------------------------------------
100 // General protocol status.
101
102 /*! This status indicates a success. */
103 CI_STATUS_STREAM_SUCCESS = ISF_SUCCESS,
104
105 /*! This error indicates a general error. */
106 CI_STATUS_STREAM_ERR = 1,
107
108
109
110 // --------------------------------------
111 // Stream specific status
112
113 /*! This status indicates data was sent to the host. */
114 CI_STATUS_STREAM_DATA_UPDATE = (2 & CI_STATUS_STREAM_SPECIFIC_STATUS),
115
116 /*! This indicates the dataset ID does not exists. */
117 CI_STATUS_STREAM_DATASETID_NOTUSED = (3 & CI_STATUS_STREAM_SPECIFIC_STATUS),
118
119 /*! This indicates end of the stream list has been reached. */
120 CI_STATUS_STREAM_STREAM_END_OF_LIST = (4 & CI_STATUS_STREAM_SPECIFIC_STATUS),
121
122
123 // --------------------------------------
124 // Stream specific error status
125
126 /*! This error indicates an invalid host command. */
127 CI_STATUS_STREAM_ERR_INVALID_CMD = (0 | CI_STATUS_STREAM_SPECIFIC_ERROR),
128
129 /*! This error indicates one or more invalid parameters. */
130 CI_STATUS_STREAM_ERR_INVALID_PARM = (1 | CI_STATUS_STREAM_SPECIFIC_ERROR),
131
132 /*! This error indicates invalid number of parameters. */
133 CI_STATUS_STREAM_ERR_INVALID_NUM_PARM = (2 | CI_STATUS_STREAM_SPECIFIC_ERROR),
134
135 /*! This error indicates no streams exists. */
136 CI_STATUS_STREAM_ERR_STREAM_NOEXISTS = (3 | CI_STATUS_STREAM_SPECIFIC_ERROR),
137
138 /*! This error indicates a given pointer is NULL. */
139 CI_STATUS_STREAM_ERR_NULL_POINTER = (4 | CI_STATUS_STREAM_SPECIFIC_ERROR),
140
141 /*! This error indicates the stream ID does not exists. */
142 CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS = (5 | CI_STATUS_STREAM_SPECIFIC_ERROR),
143
144 /*! This error indicates the stream ID already exists. */
145 CI_STATUS_STREAM_ERR_STREAMID_EXISTS = (6 | CI_STATUS_STREAM_SPECIFIC_ERROR),
146
147 /*! This error indicates the dataset ID does not exists. */
148 CI_STATUS_STREAM_ERR_DATASETID_NOEXISTS = (7 | CI_STATUS_STREAM_SPECIFIC_ERROR),
149
150 /*! This error indicates the dataset ID already exists. */
151 CI_STATUS_STREAM_ERR_DATASETID_EXISTS = (8 | CI_STATUS_STREAM_SPECIFIC_ERROR),
152
153 /*! This error indicates the dataset length is invalid (zero). */
154 CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALID = (9 | CI_STATUS_STREAM_SPECIFIC_ERROR),
155
156 /*! This error indicates the number of elements is invalid (zero). */
157 CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALID = (10 | CI_STATUS_STREAM_SPECIFIC_ERROR),
158
159 /*! This error indicates out of memory condition. */
160 CI_STATUS_STREAM_ERR_OUT_OF_MEMORY = (11 | CI_STATUS_STREAM_SPECIFIC_ERROR),
161
162 /*! This error indicates an error in sending data to the host. */
163 CI_STATUS_STREAM_ERR_SENDDATA_TO_HOST = (12 | CI_STATUS_STREAM_SPECIFIC_ERROR),
164
165 /*! This error indicates the CRC check failed. */
166 CI_STATUS_STREAM_ERR_CRC = (13 | CI_STATUS_STREAM_SPECIFIC_ERROR),
167
168
169 /*! The maximum possible status value. */
170 CI_STATUS_STREAM_MAX = 0x7F
171
172 } ci_response_stream_enum;
173
174
175
176 /*! @brief Stream control: enable/disable CRC generation/checking. */
177 #define STREAM_CRC_ENABLED (1)
178 #define STREAM_CRC_DISABLED (0)
179
180
181
182
183 /*! @brief This structure contains the stream element information.
184 *
185 * @details The stream element structure contains information of a
186 * dataset that includes an ID, the byte length, and the byte offset.
187 * Stream elements are part of the stream configuration structure.
188 *
189 */
190 typedef struct __attribute__((__packed__)) _ci_stream_element
191 {
192 /*! Dataset ID */
193 uint8 datasetID;
194
195 /*! Length in bytes of the dataset */
196 uint16 length;
197
198 /*! Offset n bytes of the dataset */
199 uint16 offset;
200
201 } ci_stream_element_t;
202
203
204
205
206 /*! @brief This structure contains the stream configuration
207 * information.
208 *
209 * @details The stream configuration structure contains information
210 * about the stream that includes the stream ID, number of elements,
211 * trigger masks, and element list.
212 *
213 */
214 typedef struct __attribute__((__packed__)) _ci_stream_config
215 {
216
217 /*! Stream ID */
218 uint8 streamID;
219
220 /*! Number of elements */
221 uint8 numElements;
222
223 /*! Buffer containing the trigger mask bytes */
224 uint8 *pTriggerMask;
225
226 /*! Buffer containing the element list */
227 ci_stream_element_t *pElementList;
228
229 } ci_stream_config_t;
230
231
232
233
234 /*!
235 *
236 * @brief This API creates a stream.
237 *
238 * @details This API creates a stream with the given parameters. It dynamically
239 * allocates memory to create a buffer to store all the information required
240 * to operation the stream.
241 *
242 *
243 * @param [in] aStreamID Stream ID value.
244 *
245 * @param [in] aNumElements The number of elements or datasets in the stream.
246 *
247 * @param [in] apTriggerMask Pointer to the trigger mask buffer. This buffer
248 * consists if an array of byte(s) with each bit corresponding
249 * a dataset in the element list. Bit 0 of the first trigger byte
250 * corresponds to the first dataset in apElementList. Bit 1 of
251 * the first trigger byte corresponds to the second dataset in
252 * apElementList and so on. Each trigger byte can respresent up
253 * to 8 datasets in apElementList.
254 *
255 * During the creation process, the data from this buffer
256 * is copied over to the stream being created.
257 *
258 * @param [in] apElementList Pointer to a buffer containing a list of datasets.
259 * Each dataset is defined in the list as follows:
260 *
261 * Offset Size Description
262 * 0 1 byte Dataset ID
263 * 1 2 bytes Length, msb first
264 * 3 2 bytes Offset, msb first
265 *
266 * During the creation process, the data from this buffer is
267 * copied over to the stream being created.
268 *
269 * @return isf_ci_stream_create() returns a value of type
270 * ::isf_status_t providing the status of the stream creation
271 * operation.
272 *
273 * @retval ::ISF_SUCCESS The stream was created successfully.
274 *
275 * @retval ::CI_STATUS_STREAM_ERR_NULL_POINTER The apTriggerMask and/or
276 * the apElementList pointers are NULL.
277 *
278 * @retval ::CI_STATUS_STREAM_ERR_INVALID_NUM_PARM The number of parameter
279 * bytes provided to create the stream is not sufficient.
280 *
281 * @retval ::CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALID The aNumElements
282 * value is zero.
283 *
284 * @retval ::CI_STATUS_STREAM_ERR_STREAMID_EXISTS The aStreamID
285 * value specifies a stream ID that already exists.
286 *
287 * @retval ::CI_STATUS_STREAM_ERR_OUT_OF_MEMORY The system is out
288 * of memory and the stream cannot be created.
289 *
290 *
291 * @constraints The following constraints must be observed when using
292 * this function. If these constraints are not met, this
293 * API returns an error.
294 * @li aStreamID must refer to a stream that does NOT exists.
295 * @li apTriggerMask and apElementList must not be NULL.
296 * @li aNumElements must not be zero.
297 *
298 * @reentrant Yes.
299 *
300 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
301 *
302 */
303 isf_status_t isf_ci_stream_create(uint8 aStreamID, uint8 aNumElements, uint8 *apTriggerMask, ci_stream_element_t *apElementList);
304
305
306
307
308
309 /*!
310 *
311 * @brief This API updates the data of a dataset.
312 *
313 * @details This API updates the data of the given dataset ID. The data is
314 * updated under two conditions that must exist:
315 *
316 * - The dataset ID exists in a stream. Streams can contain multiple
317 * datasets with the same ID and these datasets may have lengths
318 * and offsets that are the same or different.
319 *
320 * - The dataset region as defined in the stream overlaps with the given
321 * region provided in the parameters.
322 *
323 * If a dataset in any streams meet these conditions, the overlapped region
324 * of the dataset data is updated and the trigger state bit associated with
325 * the dataset ID is cleared. If all trigger state bits of the stream is
326 * cleared, the data is sent to the host if stream update is enabled.
327 *
328 *
329 * @param [in] aDataSetID ID of the dataset to update
330 *
331 * @param [in] aLength The byte length of data to update.
332 *
333 * @param [in] aOffset The offset of the data to update. It references the
334 * offset of the data buffer that the application makes
335 * available to the host.
336 *
337 * @param [in] apSrc Pointer to the source of the data to perform the
338 * update. If the dataset ID matches and the data region
339 * overlaps, the source data is copied to the stream buffer.
340 *
341 * @return isf_ci_stream_update_data() returns a value of type
342 * ::isf_status_t providing the status of the data update
343 * operation.
344 *
345 * @retval ::ISF_SUCCESS Dataset(s) data were updated. No data was
346 * sent to the host because not all trigger state bits are
347 * cleared.
348 *
349 * @retval ::CI_STATUS_STREAM_ERR_NULL_POINTER The apSrc is NULL.
350 *
351 * @retval ::CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALID The aLength
352 * value is zero.
353 *
354 * @retval ::CI_STATUS_STREAM_ERR_SENDDATA_TO_HOST An error was
355 * encountered in sending data to the host.
356 *
357 * @retval ::CI_STATUS_STREAM_DATASETID_NOTUSED The dataset ID
358 * was not found in any streams. No data was updated.
359 *
360 * @retval ::CI_STATUS_STREAM_DATA_UPDATE An update data packet was
361 * sent to the host.
362 *
363 *
364 * @constraints The following constraints must be observed when using
365 * this function. If these constraints are not met, this
366 * API returns an error.
367 * @li aDataSetID must refer to a dataset that exists.
368 * @li aLength must not be zero.
369 * @li apSrc must not be NULL.
370 *
371 * @reentrant Yes.
372 *
373 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
374 *
375 */
376 isf_status_t isf_ci_stream_update_data(uint8 aDataSetID, uint16 aLength, uint16 aOffset, uint8 *apSrc);
377
378
379
380
381 /*!
382 *
383 * @brief This API deletes the given stream ID.
384 *
385 * @details This API deletes the given stream ID. Its memory is
386 * deallocated and the stream linked list is reordered.
387 *
388 * @param [in] aStreamID Stream ID value of the stream to delete.
389 *
390 * @return isf_ci_stream_delete() returns a value of type
391 * ::isf_status_t providing the status of the stream
392 * creation operation.
393 *
394 * @retval ::ISF_SUCCESS The stream ID was found and the stream
395 * deleted.
396 *
397 * @retval ::CI_STATUS_STREAM_ERR_STREAM_NOEXISTS The aStreamID
398 * value specifies a stream ID that does not exists.
399 *
400 *
401 * @constraints The following constraints must be observed when using
402 * this function. If these constraints are not met, this
403 * API returns an error.
404 * @li aStreamID must refer to a stream that exists.
405 *
406 * @reentrant Yes.
407 *
408 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
409 *
410 */
411 isf_status_t isf_ci_stream_delete(uint8 aStreamID);
412
413
414 /*!
415 *
416 * @brief This API resets the trigger bits of the the given stream ID.
417 *
418 * @details This API resets the trigger state of the given stream ID.
419 * The trigger state is set to the trigger mask that was provided
420 * during stream creation.
421 *
422 * @param aStreamID Stream ID value of the stream to reset
423 * the trigger state.
424 *
425 * @return isf_ci_stream_reset_trigger() returns a value of type
426 * ::isf_status_t providing the status of the stream
427 * creation operation.
428 *
429 * @retval ::ISF_SUCCESS The stream ID was found and its
430 * trigger state reset to the trigger mask.
431 *
432 * @retval ::CI_STATUS_STREAM_ERR_STREAM_NOEXISTS The aStreamID
433 * value specifies a stream ID that does not exists.
434 *
435 *
436 * @constraints The following constraints must be observed when using
437 * this function. If these constraints are not met, this
438 * API returns an error.
439 * @li aStreamID must refer to a stream that exists.
440 *
441 * @reentrant Yes.
442 *
443 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
444 *
445 */
446 isf_status_t isf_ci_stream_reset_trigger(uint8 aStreamID);
447
448
449
450 /*!
451 *
452 * @brief This API gets the stream configuration of the specified stream ID.
453 *
454 * @param [in] aStreamID Stream ID value of the configuration to retrieve.
455 *
456 * @return isf_ci_stream_get_config() returns a pointer of the type
457 * ::ci_stream_config_t of the configuration associated with
458 * the given stream ID. The pointer value is NULL if the
459 * configuration does not exists.
460 *
461 * @constraints The following constraints must be observed when using
462 * this function. If these constraints are not met, this
463 * API returns an error.
464 * @li aStreamID must refer to a stream that exists. If
465 * the stream does not exists, a NULL value is returned.
466 *
467 * @reentrant Yes.
468 *
469 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
470 *
471 */
472 ci_stream_config_t *isf_ci_stream_get_config(uint8 aStreamID);
473
474
475
476 /*!
477 *
478 * @brief This API returns the trigger state of the given stream ID.
479 *
480 * @details This API returns the trigger state bytes of the given
481 * stream ID. The trigger state is copied to the trigger buffer
482 * provided by the caller.
483 *
484 *
485 * @param [in] aStreamID Stream ID value of the stream to get
486 * the trigger state.
487 *
488 * @param [in,out] apTrigger Pointer to the trigger byte array. The
489 * trigger state of the stream is copied to this byte
490 * array. This value is NULL if the stream ID does not
491 * exists. The caller must provide an array large enough
492 * to hold all of the trigger bytes.
493 *
494 * Each bit in the trigger byte corresponds to a dataset.
495 *
496 * @return isf_ci_stream_get_trigger() returns a value of type
497 * ::isf_status_t providing the status of the stream
498 * creation operation.
499 *
500 * @retval ::ISF_SUCCESS The stream ID was found and its
501 * trigger state reset to the trigger mask.
502 *
503 * @retval ::CI_STATUS_STREAM_ERR apTrigger is NULL.
504 *
505 * @retval ::CI_STATUS_STREAM_ERR_STREAM_NOEXISTS The aStreamID
506 * value specifies a stream ID that does not exists.
507 *
508 *
509 * @constraints The following constraints must be observed when using
510 * this function. If these constraints are not met, this
511 * API returns an error.
512 * @li aStreamID must refer to a stream that exists.
513 * @li apTrigger must not be NULL.
514 *
515 * @reentrant Yes.
516 *
517 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
518 *
519 */
520 isf_status_t isf_ci_stream_get_trigger(uint8 aStreamID, uint8 *apTrigger);
521
522
523
524 /*!
525 *
526 * @brief This API returns the number of streams.
527 *
528 * @details This API returns the number of streams that currently exists.
529 *
530 * @return isf_ci_stream_get_num_streams() returns the number
531 * of streams that currently exists.
532 *
533 * @constraints None
534 *
535 * @reentrant Yes.
536 *
537 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
538 *
539 */
540 uint8 isf_ci_stream_get_num_streams(void);
541
542
543
544
545 /*!
546 *
547 * @brief This API returns the configuration of the first stream in the
548 * linked list.
549 *
550 * @details This API returns a pointer to the configuration of the
551 * first stream in the linked list. If no stream exists, NULL is returned.
552 *
553 * @return isf_ci_stream_get_first() returns a pointer to
554 * the configuration of the first stream.
555 *
556 * @constraints None
557 *
558 * @reentrant Yes.
559 *
560 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
561 *
562 * @see isf_ci_stream_get_next()
563 */
564 ci_stream_config_t *isf_ci_stream_get_first(void);
565
566
567 /*!
568 *
569 * @brief This API returns the configuration of the next stream in the
570 * linked list.
571 *
572 * @details This API returns a pointer to the configuration of the
573 * next stream in the linked list. The stream returned is the next stream
574 * in the list from the previous isf_ci_stream_get_first() or
575 * isf_ci_stream_get_next() call. If no stream exists, NULL is returned.
576 *
577 *
578 * @return isf_ci_stream_get_next() returns a pointer to
579 * the configuration of the next stream in the linked list.
580 *
581 * @constraints None
582 *
583 * @reentrant Yes.
584 *
585 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
586 *
587 * @see isf_ci_stream_get_next()
588 */
589 ci_stream_config_t *isf_ci_stream_get_next(void);
590
591
592
593 /*!
594 *
595 * @brief This API sets the cyclic redundancy check (CRC) code generation
596 * to the requested state.
597 *
598 * @details This API is used to enable or disable the CRC state. If enabled,
599 * CRC code is generated and sent as part of any data packets going to the
600 * host for the stream protocol. Also, any packet received from the host
601 * is expected to have a CRC bytes that are checked against the received data.
602 * If disabled, no CRC data is generated for packets going to the host and no
603 * CRC check is performed for packets received from the host.
604 *
605 * The CRC used by the stream protocol is the CCITT CRC16. This method uses
606 * two bytes (16-bit). If CRC bytes are generated for a data packet destined
607 * for the host, the bytes are placed at the end of the packet but before the
608 * end marker byte (0x7E). The same CRC byte placement is expected of data
609 * packets from the host to the stream protocol.
610 *
611 * If CRC is enabled by the host using the CI_CMD_STREAM_ENABLE_CRC command,
612 * the response packet to the host for this command will have the CRC bytes
613 * as part of the packet.
614 *
615 * If CRC is disabled by the host using the CI_CMD_STREAM_DISABLE_CRC command,
616 * the response packet to the host for this command will NOT have the CRC bytes
617 * as part of the packet.
618 *
619 * @param [in] acrcEnable Requested state of CRC.
620 * ::STREAM_CRC_ENABLED to enable CRC generation and checking.
621 * ::STREAM_CRC_DISABLED to disabke CRC generation and checking.
622 *
623 * @return None
624 *
625 * @constraints None
626 *
627 * @reentrant Yes.
628 *
629 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
630 *
631 * @see isf_ci_stream_get_next()
632 */
633 void isf_ci_stream_set_CRC(boolean acrcEnable);
634
635
636
637 /*! @brief This is a CI stream protocol intialization callback function pointer.
638 *
639 * @details A callback that implements the initialization for the CI stream
640 * protocol.
641 *
642 * @param [in] aprotocolID The protocol ID assigned to the protocol.
643 * The protocol initialization function is required to
644 * save the ID and include the ID in data packets sent
645 * back to the host.
646 *
647 * @param [in] apInitData Pointer to the user defined data.
648 *
649 * @retval ::ISF_SUCCESS The initialization callback completed
650 * successfully.
651 *
652 * @retval ::ISF_ERR_LIB_INIT The initialization callback
653 * failed to initialize.
654 *
655 * @Constraints None
656 *
657 * @Reentrant No
658 *
659 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
660 *
661 * @see isf_status_t
662 *
663 */
664 isf_status_t ci_stream_init(uint8 aprotocolID, void *apInitData);
665
666
667
668 /*! @brief This is a CI stream protocol callback function pointer.
669 *
670 * @details A callback that implements the CI stream protocol.
671 * This callback is invoked if a packet is received with a protocol
672 * ID matching the ID that was assigned to this protocol during
673 * initialization.
674 *
675 *
676 * @param [in] anumBytes The number of bytes that the host has
677 * sent to the protocol. The data resides in the
678 * apSrc buffer.
679 *
680 * @param [in] apSrc Pointer to the received data from the host.
681 *
682 * @param [in,out] apnumDestBytes As an input, this parameter specifies
683 * maxinum size of the destination buffer apDest. As an
684 * output this parameter specifies the actual size of
685 * the number of bytes used in the buffer apDest.
686 *
687 * @param [out] apDest Pointer to the processed data.
688 *
689 * @retval The callback function returns the protocol ID value of
690 * the next protocol to be invoked. If no more protocols
691 * are to be called, the callback function returns a zero
692 * to notify the CI to sends the destination buffer to the
693 * host.
694 *
695 * @Constraints The following constraints must be observed when using
696 * this function. If these constraints are not met, this
697 * API returns an error.
698 * @li anumSrcBytes must be equal to or greater than the
699 * minimum number of bytes the specific protocol may
700 * require. This requirement is protocol dependent.
701 *
702 * @Reentrant No
703 *
704 * @libs libisf_core_m0p.a, libisf_core_m4f.a, libisf_core_m4.a
705 *
706 * @see isf_status_t
707 *
708 */
709 isf_status_t ci_protocol_CB_stream(uint32 anumBytes, uint8 *apSrc, uint32 *apnumDestBytes, uint8 *apDest);
710
711
712
713 /*!
714 *
715 * @brief This API enables data stream.
716 *
717 * @details This API is used to enable data stream state.
718 * Data streaming is enabled by setting
719 * gStreamReg.StreamCtrlReg1.Bits.enable_stream_data = STREAM_PROTOCOL_DATA_ENABLED.
720 *
721 * @param [in] None
722 *
723 *
724 * @return None
725 *
726 * @constraints None
727 *
728 * @reentrant Yes.
729 *
730 * @see ci_protocol_CB_stream()
731 */
732 void isf_ci_stream_set_stream_enable();
733
734
735 /*!
736 *
737 * @brief This API disables data stream.
738 *
739 * @details This API is used to enable data stream state.
740 * Data streaming is enabled by setting
741 * gStreamReg.StreamCtrlReg1.Bits.enable_stream_data = STREAM_PROTOCOL_DATA_DISABLED.
742 *
743 * @param [in] None
744 *
745 *
746 * @return None
747 *
748 * @constraints None
749 *
750 * @reentrant Yes.
751 *
752 * @see ci_protocol_CB_stream()
753 */
754 void isf_ci_stream_set_stream_disable();
755
756 #endif // ISF_CI_STREAM_H_
CI_STATUS_STREAM_ERR_CRC
Definition: isf_ci_stream.h:166
CI_CMD_STREAM_GETINFO_NUMBER_STREAMS
Definition: isf_ci_stream.h:56
uint8
unsigned char uint8
Definition: isf_types.h:76
CI_STATUS_STREAM_ERR_DATASETID_EXISTS
Definition: isf_ci_stream.h:151
CI_CMD_STREAM_DISABLE_CRC
Definition: isf_ci_stream.h:53
CI_CMD_STREAM_DELETE_STREAM
Definition: isf_ci_stream.h:44
CI_CMD_STREAM_GETINFO_GET_FIRST_STREAMID
Definition: isf_ci_stream.h:65
CI_CMD_STREAM_GETINFO_GET_NEXT_STREAMID
Definition: isf_ci_stream.h:68
ISF_SUCCESS
Definition: isf.h:31
CI_CMD_STREAM_ENABLE_CRC
Definition: isf_ci_stream.h:50
CI_CMD_STREAM_RESET
Definition: isf_ci_stream.h:32
CI_STATUS_STREAM_ERR_DATASET_LENGTH_INVALID
Definition: isf_ci_stream.h:154
isf_ci_stream_set_stream_disable
void isf_ci_stream_set_stream_disable()
This API disables data stream.
Definition: ci_protocol_stream.c:1833
ci_response_stream_enum
ci_response_stream_enum
Definition: isf_ci_stream.h:95
isf_ci_stream_reset_trigger
isf_status_t isf_ci_stream_reset_trigger(uint8 aStreamID)
This API resets the trigger bits of the the given stream ID.
Definition: ci_protocol_stream.c:693
CI_STATUS_STREAM_ERR_STREAM_NOEXISTS
Definition: isf_ci_stream.h:136
CI_STATUS_STREAM_STREAM_END_OF_LIST
Definition: isf_ci_stream.h:120
isf_ci_stream_get_first
ci_stream_config_t * isf_ci_stream_get_first(void)
This API returns the configuration of the first stream in the linked list.
Definition: ci_protocol_stream.c:118
isf_ci_stream_get_config
ci_stream_config_t * isf_ci_stream_get_config(uint8 aStreamID)
This API gets the stream configuration of the specified stream ID.
CI_STATUS_STREAM_DATASETID_NOTUSED
Definition: isf_ci_stream.h:117
isf_ci_stream_get_next
ci_stream_config_t * isf_ci_stream_get_next(void)
This API returns the configuration of the next stream in the linked list.
Definition: ci_protocol_stream.c:133
CI_CMD_STREAM_DISABLE_DATA_UPDATE
Definition: isf_ci_stream.h:38
CI_STATUS_STREAM_ERR_INVALID_CMD
Definition: isf_ci_stream.h:127
CI_CMD_STREAM_GETINFO_TRIGGER_STATE
Definition: isf_ci_stream.h:59
CI_STATUS_STREAM_SUCCESS
Definition: isf_ci_stream.h:103
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
isf_ci_stream_get_num_streams
uint8 isf_ci_stream_get_num_streams(void)
This API returns the number of streams.
Definition: ci_protocol_stream.c:639
CI_STATUS_STREAM_ERR_OUT_OF_MEMORY
Definition: isf_ci_stream.h:160
isf_ci_stream_set_CRC
void isf_ci_stream_set_CRC(boolean acrcEnable)
This API sets the cyclic redundancy check (CRC) code generation to the requested state.
Definition: ci_protocol_stream.c:725
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
ci_stream_config_t
ci_stream_config_t
Definition: isf_ci_stream.h:229
CI_STATUS_STREAM_ERR_STREAMID_EXISTS
Definition: isf_ci_stream.h:145
CI_STATUS_STREAM_ERR
Definition: isf_ci_stream.h:106
CI_STATUS_STREAM_DATA_UPDATE
Definition: isf_ci_stream.h:114
CI_STATUS_STREAM_SPECIFIC_ERROR
#define CI_STATUS_STREAM_SPECIFIC_ERROR
Definition: isf_ci_stream.h:93
isf.h
Main ISF header file. Contains code common to all ISF components.
CI_CMD_STREAM_ENABLE_DATA_UPDATE
Definition: isf_ci_stream.h:35
uint16
unsigned short int uint16
Definition: isf_types.h:77
CI_STATUS_STREAM_ERR_SENDDATA_TO_HOST
Definition: isf_ci_stream.h:163
CI_STATUS_STREAM_SPECIFIC_STATUS
#define CI_STATUS_STREAM_SPECIFIC_STATUS
These are the CI stream protocol errors provided to the host.
Definition: isf_ci_stream.h:92
ci_stream_element_t
ci_stream_element_t
Definition: isf_ci_stream.h:201
ci_commands_stream_enum
ci_commands_stream_enum
CI host stream command.
Definition: isf_ci_stream.h:29
CI_CMD_STREAM_MAX
Definition: isf_ci_stream.h:71
CI_STATUS_STREAM_ERR_DATASETID_NOEXISTS
Definition: isf_ci_stream.h:148
CI_STATUS_STREAM_ERR_NUMELEMENTS_INVALID
Definition: isf_ci_stream.h:157
isf_ci_stream_get_trigger
isf_status_t isf_ci_stream_get_trigger(uint8 aStreamID, uint8 *apTrigger)
This API returns the trigger state of the given stream ID.
Definition: ci_protocol_stream.c:656
isf_status_t
int32 isf_status_t
ISF return status type.
Definition: isf.h:76
isf_ci_stream_set_stream_enable
void isf_ci_stream_set_stream_enable()
This API enables data stream.
Definition: ci_protocol_stream.c:1821
CI_STATUS_STREAM_ERR_STREAMID_NOEXISTS
Definition: isf_ci_stream.h:142
CI_CMD_STREAM_GETINFO_STREAM_CONFIG
Definition: isf_ci_stream.h:62
CI_CMD_STREAM_RESET_TRIGGER
Definition: isf_ci_stream.h:47
CI_STATUS_STREAM_MAX
Definition: isf_ci_stream.h:170
__attribute__
struct __attribute__((__packed__)) _ci_stream_element
This structure contains the stream element information.
Definition: isf_ci_stream.h:190
ci_protocol_CB_stream
isf_status_t ci_protocol_CB_stream(uint32 anumBytes, uint8 *apSrc, uint32 *apnumDestBytes, uint8 *apDest)
This is a CI stream protocol callback function pointer.
Definition: ci_protocol_stream.c:1010
CI_STATUS_STREAM_ERR_INVALID_NUM_PARM
Definition: isf_ci_stream.h:133
uint32
unsigned long int uint32
Definition: isf_types.h:78
CI_STATUS_STREAM_ERR_INVALID_PARM
Definition: isf_ci_stream.h:130
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_stream_init
isf_status_t ci_stream_init(uint8 aprotocolID, void *apInitData)
This is a CI stream protocol intialization callback function pointer.
Definition: ci_protocol_stream.c:85
CI_STATUS_STREAM_ERR_NULL_POINTER
Definition: isf_ci_stream.h:139
CI_CMD_STREAM_CREATE_STREAM
Definition: isf_ci_stream.h:41
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.