• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012-2020 NXP
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  *  OSAL header files related to memory, debug, random, semaphore and mutex
19  * functions.
20  */
21 
22 #ifndef PHUWBCOMMON_H
23 #define PHUWBCOMMON_H
24 
25 /*
26 ************************* Include Files ****************************************
27 */
28 
29 #include <phDal4Uwb_messageQueueLib.h>
30 #include <phUwbCompId.h>
31 #include <phUwbStatus.h>
32 #include <phOsalUwb_Timer.h>
33 #include <pthread.h>
34 #include <semaphore.h>
35 
36 /*
37  *  information to configure OSAL
38  */
39 typedef struct phOsalUwb_Config {
40   uint8_t* pLogFile;            /* Log File Name*/
41   uintptr_t dwCallbackThreadId; /* Client ID to which message is posted */
42 } phOsalUwb_Config_t, *pphOsalUwb_Config_t /* Pointer to #phOsalUwb_Config_t */;
43 
44 /*
45  * Deferred call declaration.
46  * This type of API is called from ClientApplication (main thread) to notify
47  * specific callback.
48  */
49 typedef void (*pphOsalUwb_DeferFuncPointer_t)(void*);
50 
51 /*
52  * Deferred message specific info declaration.
53  */
54 typedef struct phOsalUwb_DeferedCallInfo {
55   pphOsalUwb_DeferFuncPointer_t pDeferedCall; /* pointer to Deferred callback */
56   void* pParam; /* contains timer message specific details*/
57 } phOsalUwb_DeferedCallInfo_t;
58 
59 /*
60  * States in which a OSAL timer exist.
61  */
62 typedef enum {
63   eTimerIdle = 0,          /* Indicates Initial state of timer */
64   eTimerRunning = 1,       /* Indicate timer state when started */
65   eTimerStopped = 2        /* Indicates timer state when stopped */
66 } phOsalUwb_TimerStates_t; /* Variable representing State of timer */
67 
68 /*
69  **Timer Handle structure containing details of a timer.
70  */
71 typedef struct phOsalUwb_TimerHandle {
72   uint32_t TimerId;     /* ID of the timer */
73   timer_t hTimerHandle; /* Handle of the timer */
74   /* Timer callback function to be invoked */
75   pphOsalUwb_TimerCallbck_t Application_callback;
76   void* pContext; /* Parameter to be passed to the callback function */
77   phOsalUwb_TimerStates_t eState; /* Timer states */
78   /* Osal Timer message posted on User Thread */
79   phLibUwb_Message_t tOsalMessage;
80   /* Deferred Call structure to Invoke Callback function */
81   phOsalUwb_DeferedCallInfo_t tDeferedCallInfo;
82   /* Variables for Structure Instance and Structure Ptr */
83 } phOsalUwb_TimerHandle_t, *pphOsalUwb_TimerHandle_t;
84 
85 #endif /*  PHOSALUWB_H  */
86