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