TI BLE Stack API Documentation  2.03.09
util.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  @file util.h
4 
5  @brief This file contains function declarations common to CC26xx
6  TIRTOS Applications.
7 
8  Group: WCS, BTS
9  $Target Device: DEVICES $
10 
11  ******************************************************************************
12  $License: BSD3 2014 $
13  ******************************************************************************
14  $Release Name: PACKAGE NAME $
15  $Release Date: PACKAGE RELEASE DATE $
16  *****************************************************************************/
17 
26 #ifndef UTIL_H
27 #define UTIL_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*********************************************************************
34  * INCLUDES
35  */
36 #include <ti/sysbios/knl/Clock.h>
37 #include <ti/sysbios/knl/Queue.h>
38 #ifdef ICALL_EVENTS
39 #include <ti/sysbios/knl/Event.h>
40 #else
41 #include <ti/sysbios/knl/Semaphore.h>
42 #endif //ICALL_EVENTS
43 
44 /*********************************************************************
45 * EXTERNAL VARIABLES
46 */
47 
48 /*********************************************************************
49  * CONSTANTS
50  */
51 
52 #ifdef ICALL_EVENTS
53 
60 #define UTIL_QUEUE_EVENT_ID Event_Id_30
61 #endif //ICALL_EVENTS
62 /*********************************************************************
63  * TYPEDEFS
64  */
65 
66 typedef struct
67 {
68  uint16_t event; // Event type.
69  uint8_t state; // Event state;
71 
72 /*********************************************************************
73  * MACROS
74  */
75 
76 /*********************************************************************
77  * API FUNCTIONS
78  */
79 
93 extern Clock_Handle Util_constructClock(Clock_Struct *pClock,
94  Clock_FuncPtr clockCB,
95  uint32_t clockDuration,
96  uint32_t clockPeriod,
97  uint8_t startFlag,
98  UArg arg);
99 
105 extern void Util_startClock(Clock_Struct *pClock);
106 
113 extern void Util_restartClock(Clock_Struct *pClock, uint32_t clockTimeout);
114 
122 extern bool Util_isActive(Clock_Struct *pClock);
123 
129 extern void Util_stopClock(Clock_Struct *pClock);
130 
137 extern void Util_rescheduleClock(Clock_Struct *pClock, uint32_t clockPeriod);
138 
147 extern Queue_Handle Util_constructQueue(Queue_Struct *pQueue);
148 
159 extern uint8_t Util_enqueueMsg(Queue_Handle msgQueue,
160 #ifdef ICALL_EVENTS
161  Event_Handle event,
162 #else
163  Semaphore_Handle sem,
164 #endif //ICALL_EVENTS
165  uint8_t *pMsg);
166 
174 extern uint8_t *Util_dequeueMsg(Queue_Handle msgQueue);
175 
184 extern char *Util_convertBdAddr2Str(uint8_t *pAddr);
185 
186 /*********************************************************************
187 *********************************************************************/
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif /* UTIL_H */
ICALL_EVENTS.
Definition: util.h:66
char * Util_convertBdAddr2Str(uint8_t *pAddr)
Convert Bluetooth address to string. Only needed when LCD display is used.
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.
uint8_t Util_enqueueMsg(Queue_Handle msgQueue, Semaphore_Handle sem, uint8_t *pMsg)
Creates a queue node and puts the node in RTOS queue.
bool Util_isActive(Clock_Struct *pClock)
Determine if a clock is currently active.
void Util_startClock(Clock_Struct *pClock)
Start a clock.
uint8_t * Util_dequeueMsg(Queue_Handle msgQueue)
Dequeue the message from the RTOS queue.
void Util_rescheduleClock(Clock_Struct *pClock, uint32_t clockPeriod)
Reschedule a clock by changing the timeout and period values.
void Util_restartClock(Clock_Struct *pClock, uint32_t clockTimeout)
Restart a clock by changing the timeout.
Queue_Handle Util_constructQueue(Queue_Struct *pQueue)
Initialize an RTOS queue to hold messages from profile to be processed.
void Util_stopClock(Clock_Struct *pClock)
Stop a clock.