1 /* 2 * Copyright (C) 2017-2018 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 #ifndef PHOSAL_ADAPTATION_H_ 18 #define PHOSAL_ADAPTATION_H_ 19 20 #include "phOsal_Posix.h" 21 #include "phOsal_Queue.h" 22 23 #ifdef __cplusplus 24 extern "C" { /* Assume C declarations for C++ */ 25 #endif /* __cplusplus */ 26 27 #define ADAPTSTATUS_OK 0 28 #define ADAPTSTATUS_SUCCESS 0 29 #define ADAPTSTATUS_INVALID_PARAMS 1 30 #define ADAPTSTATUS_FAILED 2 31 #define ADAPTSTATUS_SEM_TIMEOUT 3 32 #define ADAPTSTATUS_Q_OVERFLOW 4 33 #define ADAPTSTATUS_Q_UNDERFLOW 5 34 #define ADAPTSTATUS_NOT_SUPPORTED 6 35 #define ADAPTSTATUS_NOT_INITIALISED 7 36 #define ADAPTSTATUS_INSUFFICIENT_RESOURCES 8 37 #define ADAPTSTATUS_ALREADY_INITIALISED 9 38 39 typedef unsigned int ADAPTSTATUS; /* Return values */ 40 41 #define MAX_BUFFER_DATA 260 42 43 typedef struct { 44 phOsal_Config_t sOsalConfig; 45 phOsal_QueueCreateParams_t sQueueCreatePrms; 46 void* pvUpLayerContext; 47 void* pvOsalTaskHandle; 48 void* pvOsalQueueHandle; 49 bool bOsalInitialized; 50 } sphOsalAdapt_Context_t, *psphOsalAdapt_Context_t; 51 52 typedef struct { 53 unsigned char buffer[MAX_BUFFER_DATA]; 54 unsigned short len; 55 } sQueueData_t, *psQueueData_t; 56 57 ADAPTSTATUS phOsalAdapt_InitOsal(void* pvAppContext); 58 ADAPTSTATUS phOsalAdapt_DeinitOsal(); 59 ADAPTSTATUS phOsalAdapt_StartTask(void* pvTaskFuncPtr, void* pParams); 60 ADAPTSTATUS phOsalAdapt_StopTask(void* pvTaskHandle); 61 ADAPTSTATUS phOsalAdapt_GetQueHandle(void** ppvQueHandle); 62 ADAPTSTATUS phOsalAdapt_GetTaskHandle(void** ppvTaskHandle); 63 ADAPTSTATUS phOsalAdapt_SendData(psQueueData_t psSendData); 64 psQueueData_t phOsalAdapt_GetData(); 65 66 #ifdef __cplusplus 67 } /* Assume C declarations for C++ */ 68 #endif /* __cplusplus */ 69 70 #endif /* PHOSAL_INTERFACE_H_ */ 71