1 /* 2 * Copyright (C) 2010-2014 NXP Semiconductors 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 functions. 19 */ 20 21 #ifndef PHNFCCOMMON_H 22 #define PHNFCCOMMON_H 23 24 /* 25 ************************* Include Files **************************************** 26 */ 27 28 #include <phNfcStatus.h> 29 #include <semaphore.h> 30 #include <phOsalNfc_Timer.h> 31 #include <pthread.h> 32 #include <phDal4Nfc_messageQueueLib.h> 33 #include <phNfcCompId.h> 34 35 36 # define FW_DLL_ROOT_DIR "/system/vendor/firmware/" 37 # define FW_DLL_EXTENSION ".so" 38 39 #if(NFC_NXP_CHIP_TYPE != PN547C2) 40 41 /* Actual FW library name*/ 42 #define FW_LIB_PATH FW_DLL_ROOT_DIR "libpn548ad_fw" FW_DLL_EXTENSION 43 /* Restore Currupted PLL Setttings/etc */ 44 #define PLATFORM_LIB_PATH FW_DLL_ROOT_DIR "libpn548ad_fw_platform" FW_DLL_EXTENSION 45 /* Upgrade the public Key */ 46 #define PKU_LIB_PATH FW_DLL_ROOT_DIR "libpn548ad_fw_pku" FW_DLL_EXTENSION 47 #else 48 /* Actual FW library name*/ 49 #define FW_LIB_PATH FW_DLL_ROOT_DIR "libpn547_fw" FW_DLL_EXTENSION 50 /* Restore Currupted PLL Setttings/etc */ 51 #define PLATFORM_LIB_PATH FW_DLL_ROOT_DIR "libpn547_fw_platform" FW_DLL_EXTENSION 52 /* Upgrade the public Key */ 53 #define PKU_LIB_PATH FW_DLL_ROOT_DIR "libpn547_fw_pku" FW_DLL_EXTENSION 54 #endif 55 56 /* HAL Version number (Updated as per release) */ 57 #define NXP_MW_VERSION_MAJ (1U) 58 #define NXP_MW_VERSION_MIN (0U) 59 60 /* 61 ***************************************************************** 62 *********** System clock source selection configuration ******** 63 ***************************************************************** 64 */ 65 66 #define CLK_SRC_UNDEF 0 67 #define CLK_SRC_XTAL 1 68 #define CLK_SRC_PLL 2 69 #define CLK_SRC_PADDIRECT 3 70 71 /*Extern crystal clock source*/ 72 #define NXP_SYS_CLK_SRC_SEL CLK_SRC_PLL /* Use one of CLK_SRC_<value> */ 73 /*Direct clock*/ 74 75 /* 76 ***************************************************************** 77 *********** System clock frequency selection configuration **************** 78 * If Clk_Src is set to PLL, make sure to set the Clk_Freq also* 79 ***************************************************************** 80 */ 81 #define CLK_FREQ_UNDEF 0 82 #define CLK_FREQ_13MHZ 1 83 #define CLK_FREQ_19_2MHZ 2 84 #define CLK_FREQ_24MHZ 3 85 #define CLK_FREQ_26MHZ 4 86 #define CLK_FREQ_38_4MHZ 5 87 #define CLK_FREQ_52MHZ 6 88 89 #define NXP_SYS_CLK_FREQ_SEL CLK_FREQ_19_2MHZ /* Set to one of CLK_FREQ_<value> */ 90 91 #define CLK_TO_CFG_DEF 1 92 #define CLK_TO_CFG_MAX 26 93 /* 94 * information to configure OSAL 95 */ 96 typedef struct phOsalNfc_Config 97 { 98 uint8_t *pLogFile; /* Log File Name*/ 99 uintptr_t dwCallbackThreadId; /* Client ID to which message is posted */ 100 }phOsalNfc_Config_t, *pphOsalNfc_Config_t /* Pointer to #phOsalNfc_Config_t */; 101 102 103 /* 104 * Deferred call declaration. 105 * This type of API is called from ClientApplication (main thread) to notify 106 * specific callback. 107 */ 108 typedef void (*pphOsalNfc_DeferFuncPointer_t) (void*); 109 110 111 /* 112 * Deferred message specific info declaration. 113 */ 114 typedef struct phOsalNfc_DeferedCallInfo 115 { 116 pphOsalNfc_DeferFuncPointer_t pDeferedCall;/* pointer to Deferred callback */ 117 void *pParam; /* contains timer message specific details*/ 118 }phOsalNfc_DeferedCallInfo_t; 119 120 121 /* 122 * States in which a OSAL timer exist. 123 */ 124 typedef enum 125 { 126 eTimerIdle = 0, /* Indicates Initial state of timer */ 127 eTimerRunning = 1, /* Indicate timer state when started */ 128 eTimerStopped = 2 /* Indicates timer state when stopped */ 129 }phOsalNfc_TimerStates_t; /* Variable representing State of timer */ 130 131 /* 132 **Timer Handle structure containing details of a timer. 133 */ 134 typedef struct phOsalNfc_TimerHandle 135 { 136 uint32_t TimerId; /* ID of the timer */ 137 timer_t hTimerHandle; /* Handle of the timer */ 138 pphOsalNfc_TimerCallbck_t Application_callback; /* Timer callback function to be invoked */ 139 void *pContext; /* Parameter to be passed to the callback function */ 140 phOsalNfc_TimerStates_t eState; /* Timer states */ 141 phLibNfc_Message_t tOsalMessage; /* Osal Timer message posted on User Thread */ 142 phOsalNfc_DeferedCallInfo_t tDeferedCallInfo; /* Deferred Call structure to Invoke Callback function */ 143 }phOsalNfc_TimerHandle_t,*pphOsalNfc_TimerHandle_t; /* Variables for Structure Instance and Structure Ptr */ 144 145 #endif /* PHOSALNFC_H */ 146