1 /******************************************************************************
3 * Copyright (c) 2019 Intel.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *******************************************************************************/
22 typedef unsigned char U8; /* unsigned 8-bit integer */
23 typedef unsigned short U16; /* unsigned 16-bit integer */
24 typedef unsigned int U32; /* unsigned 32-bit integer */
26 typedef unsigned long U64; /* unsigned 64-bit integer */
28 typedef unsigned long long U64; /* unsigned 64-bit integer */
31 typedef volatile unsigned char V8;
32 typedef volatile unsigned short V16;
33 typedef volatile unsigned int V32;
34 typedef volatile unsigned long V4;
36 typedef signed char S8; /* 8-bit signed integer */
37 typedef signed short S16; /* 16-bit signed integer */
38 typedef signed int S32; /* 32-bit signed integer */
41 typedef signed long S64; /* unsigned 64-bit integer */
43 typedef signed long long S64; /* unsigned 64-bit integer */
51 typedef U64 (*wls_us_addr_conv)(void*, U64);
57 #define MHZ (KHZ * KHZ)
68 #define NULL ((PVOID)(0))
73 #define DSB() smp_mb()
74 #define DMB() smp_wmb()
76 #define DSB() __asm__ __volatile__("mfence": : :"memory")
77 #define DMB() __asm__ __volatile__("sfence": : :"memory")
80 typedef struct tagWLS_MSG_HANDLE
85 U16 TypeID; // used to identify destination
88 } WLS_MSG_HANDLE, *PWLS_MSG_HANDLE; /* 4 x QW */
90 typedef struct tagFASTQUEUE {
98 } FASTQUEUE, *PFASTQUEUE;
100 typedef struct tagWLS_MSG_QUEUE {
106 } WLS_MSG_QUEUE, *PWLS_MSG_QUEUE;
108 #define COUNT(some_array) ( sizeof(some_array)/sizeof((some_array)[0]) )
110 void SFL_DefQueue(PFASTQUEUE pq, void *pStorage, int StorageSize);
111 int SFL_WlsEnqueue(PFASTQUEUE pq, U64 pData, wls_us_addr_conv change_addr, void* hWls);
112 int SFL_Enqueue_NoSync(PFASTQUEUE pq, PVOID pData);
113 U64 SFL_WlsDequeue(PFASTQUEUE pq, wls_us_addr_conv change_addr, void *hWls);
115 PVOID SFL_Dequeue_NoSync(PFASTQUEUE pq);
116 U32 SFL_Queue_BatchRead( PFASTQUEUE pq, unsigned long *pDestArr, U32 Count);
117 U32 SFL_Queue_BatchWrite( PFASTQUEUE pq, unsigned long *pSrcArr, U32 Count);
119 void WLS_MsgDefineQueue(PWLS_MSG_QUEUE pq, PWLS_MSG_HANDLE pStorage, U32 size, U32 sema);
120 U32 WLS_MsgEnqueue(PWLS_MSG_QUEUE pq, U64 pIaPaMsg, U32 MsgSize, U16 TypeID, U16 flags, wls_us_addr_conv change_addr, void* h);
121 int WLS_MsgDequeue(PWLS_MSG_QUEUE pq, PWLS_MSG_HANDLE pDestItem, wls_us_addr_conv change_addr, void *hWls);
122 U32 WLS_GetNumItemsInTheQueue(PWLS_MSG_QUEUE fpq);
123 U32 SFL_GetNumItemsInTheQueue(FASTQUEUE *fpq);
129 #endif // __SYSLIB_H__