TI BLE-Stack for Bluetooth 4.2 API Documentation  3.01.00.07
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 <stdbool.h>
37 #include <ti/sysbios/knl/Clock.h>
38 #include <ti/sysbios/knl/Queue.h>
39 #include <ti/sysbios/knl/Event.h>
40 
41 /*********************************************************************
42 * EXTERNAL VARIABLES
43 */
44 
45 /*********************************************************************
46  * CONSTANTS
47  */
48 
56 #define UTIL_QUEUE_EVENT_ID Event_Id_30
57 
58 /*********************************************************************
59  * TYPEDEFS
60  */
61 
62 typedef struct
63 {
64  uint16_t event; // Event type.
65  uint8_t state; // Event state;
66 }appEvtHdr_t;
67 
68 /*********************************************************************
69  * MACROS
70  */
71 
72 /*********************************************************************
73  * API FUNCTIONS
74  */
75 
89 extern Clock_Handle Util_constructClock(Clock_Struct *pClock,
90  Clock_FuncPtr clockCB,
91  uint32_t clockDuration,
92  uint32_t clockPeriod,
93  uint8_t startFlag,
94  UArg arg);
95 
101 extern void Util_startClock(Clock_Struct *pClock);
102 
109 extern void Util_restartClock(Clock_Struct *pClock, uint32_t clockTimeout);
110 
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 
157 extern uint8_t Util_enqueueMsg(Queue_Handle msgQueue,
158  Event_Handle event,
159  uint8_t *pMsg);
160 
168 extern uint8_t *Util_dequeueMsg(Queue_Handle msgQueue);
169 
178 extern char *Util_convertBdAddr2Str(uint8_t *pAddr);
179 
189 extern uint8_t Util_isBufSet(uint8_t *pBuf, uint8_t pattern, uint16_t len);
190 
191 
192 /*********************************************************************
193 *********************************************************************/
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif /* UTIL_H */
200 
uint8_t * Util_dequeueMsg(Queue_Handle msgQueue)
Dequeue the message from the RTOS queue.
uint8_t Util_isBufSet(uint8_t *pBuf, uint8_t pattern, uint16_t len)
Check if contents of buffer matches byte pattern.
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.
char * Util_convertBdAddr2Str(uint8_t *pAddr)
Convert Bluetooth address to string. Only needed when LCD display is used.
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