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 #ifndef PHOSALUWB_TIMER_H 18 #define PHOSALUWB_TIMER_H 19 20 /* 21 ************************* Include Files **************************************** 22 */ 23 #include <cstdint> 24 25 #include "phUwbTypes.h" 26 27 /* 28 * Timer callback interface which will be called once registered timer 29 * time out expires. 30 * TimerId - Timer Id for which callback is called. 31 * pContext - Parameter to be passed to the callback function 32 */ 33 typedef void (*pphOsalUwb_TimerCallbck_t)(uint32_t TimerId, void* pContext); 34 35 /* 36 * The Timer could not be created due to a 37 * system error */ 38 #define PH_OSALUWB_TIMER_CREATE_ERROR (0X00E0) 39 40 /* 41 * The Timer could not be started due to a 42 * system error or invalid handle */ 43 #define PH_OSALUWB_TIMER_START_ERROR (0X00E1) 44 45 /* 46 * The Timer could not be stopped due to a 47 * system error or invalid handle */ 48 #define PH_OSALUWB_TIMER_STOP_ERROR (0X00E2) 49 50 /* 51 * The Timer could not be deleted due to a 52 * system error or invalid handle */ 53 #define PH_OSALUWB_TIMER_DELETE_ERROR (0X00E3) 54 55 /* 56 * Invalid timer ID type.This ID used indicate timer creation is failed */ 57 #define PH_OSALUWB_TIMER_ID_INVALID (0xFFFF) 58 59 /* 60 * OSAL timer message .This message type will be posted to 61 * calling application thread.*/ 62 #define PH_OSALUWB_TIMER_MSG (0x315) 63 64 /* 65 ***************************Globals,Structure and Enumeration ****************** 66 */ 67 68 uint32_t phOsalUwb_Timer_Create(void); 69 tHAL_UWB_STATUS phOsalUwb_Timer_Start(uint32_t dwTimerId, uint32_t dwRegTimeCnt, 70 pphOsalUwb_TimerCallbck_t pApplication_callback, 71 void* pContext); 72 tHAL_UWB_STATUS phOsalUwb_Timer_Stop(uint32_t dwTimerId); 73 tHAL_UWB_STATUS phOsalUwb_Timer_Delete(uint32_t dwTimerId); 74 void phOsalUwb_Timer_Cleanup(void); 75 uint32_t phUtilUwb_CheckForAvailableTimer(void); 76 tHAL_UWB_STATUS phOsalUwb_CheckTimerPresence(void* pObjectHandle); 77 78 #endif /* PHOSALUWB_TIMER_H */ 79