BLE-Stack APIs  3.00.01
util.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, LPC, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: BSD3 2014 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
21 #ifndef UTIL_H
22 #define UTIL_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*********************************************************************
29  * INCLUDES
30  */
31 #include <ti/sysbios/knl/Clock.h>
32 #include <ti/sysbios/knl/Queue.h>
33 #ifdef ICALL_EVENTS
34 #include <ti/sysbios/knl/Event.h>
35 #else
36 #include <ti/sysbios/knl/Semaphore.h>
37 #endif //ICALL_EVENTS
38 
39 /*********************************************************************
40 * EXTERNAL VARIABLES
41 */
42 
43 /*********************************************************************
44  * CONSTANTS
45  */
46 
47 #ifdef ICALL_EVENTS
48 
55 #define UTIL_QUEUE_EVENT_ID Event_Id_30
56 #endif //ICALL_EVENTS
57 /*********************************************************************
58  * TYPEDEFS
59  */
60 
61 typedef struct
62 {
63  uint16_t event; // Event type.
64  uint8_t state; // Event state;
65 }appEvtHdr_t;
66 
67 /*********************************************************************
68  * MACROS
69  */
70 
71 /*********************************************************************
72  * API FUNCTIONS
73  */
74 
88 extern Clock_Handle Util_constructClock(Clock_Struct *pClock,
89  Clock_FuncPtr clockCB,
90  uint32_t clockDuration,
91  uint32_t clockPeriod,
92  uint8_t startFlag,
93  UArg arg);
94 
100 extern void Util_startClock(Clock_Struct *pClock);
101 
108 extern void Util_restartClock(Clock_Struct *pClock, uint32_t clockTimeout);
109 
118 extern bool Util_isActive(Clock_Struct *pClock);
119 
125 extern void Util_stopClock(Clock_Struct *pClock);
126 
133 extern void Util_rescheduleClock(Clock_Struct *pClock, uint32_t clockPeriod);
134 
143 extern Queue_Handle Util_constructQueue(Queue_Struct *pQueue);
144 
158 extern uint8_t Util_enqueueMsg(Queue_Handle msgQueue,
159  Event_Handle event,
160  uint8_t *pMsg);
161 
170 extern uint8_t *Util_dequeueMsg(Queue_Handle msgQueue);
171 
172 /*********************************************************************
173 *********************************************************************/
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif /* UTIL_H */
180 
uint8_t * Util_dequeueMsg(Queue_Handle msgQueue)
Dequeue the message from the RTOS queue.
uint8_t Util_enqueueMsg(Queue_Handle msgQueue, Event_Handle event, uint8_t *pMsg)
Creates a queue node and puts the node in RTOS queue.
void Util_rescheduleClock(Clock_Struct *pClock, uint32_t clockPeriod)
Reschedule a clock by changing the timeout and period values.
void Util_startClock(Clock_Struct *pClock)
Start a clock.
void Util_stopClock(Clock_Struct *pClock)
Stop a clock.
void Util_restartClock(Clock_Struct *pClock, uint32_t clockTimeout)
Restart a clock by changing the timeout.
Clock_Handle Util_constructClock(Clock_Struct *pClock, Clock_FuncPtr clockCB, uint32_t clockDuration, uint32_t clockPeriod, uint8_t startFlag, UArg arg)
Initialize a TIRTOS Clock instance.
Queue_Handle Util_constructQueue(Queue_Struct *pQueue)
Initialize an RTOS queue to hold messages from profile to be processed.
bool Util_isActive(Clock_Struct *pClock)
Determine if a clock is currently active.
Copyright 2017, Texas Instruments Incorporated