• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  ****************************************************************************************
18  *
19  * @file lwifi_task.h
20  *
21  * @brief define basic type
22  *
23  ****************************************************************************************
24  */
25 #ifndef _TYPES_H_
26 #define _TYPES_H_
27 
28 #include <stdint.h>
29 #include <stdbool.h>
30 
31 #if 0   // use standard defines
32 
33 #ifndef int8_t
34 typedef signed char int8_t;
35 #endif
36 
37 #ifndef uint8_t
38 typedef unsigned char uint8_t;
39 #endif
40 
41 #ifndef int16_t
42 typedef signed short int16_t;
43 #endif
44 
45 #ifndef uint16_t
46 typedef unsigned short uint16_t;
47 #endif
48 
49 #ifndef int32_t
50 typedef signed int int32_t;
51 #endif
52 
53 #ifndef uint32_t
54 typedef unsigned int uint32_t;
55 #endif
56 
57 #ifndef int64_t
58 typedef signed long long int64_t;
59 #endif
60 
61 #ifndef uint64_t
62 typedef unsigned long long uint64_t;
63 #endif
64 
65 #ifndef true
66 #define true 1
67 #endif
68 
69 #ifndef false
70 #define false 0
71 #endif
72 
73 #ifndef bool
74 typedef unsigned char bool;
75 #endif
76 
77 #endif
78 #ifndef NULL
79 #define NULL (void*)0
80 #endif
81 #define BIT(n)           (1<<(n))
82 #define CO_WF_BIT(pos)      (1U<<(pos))
83 
84 // structure of a list element header
85 struct co_wf_list_hdr {
86     // Pointer to the next element in the list
87     struct co_wf_list_hdr *next;
88 };
89 
___swap16(uint16_t x)90 inline static uint16_t  ___swap16(uint16_t x)
91 {
92     uint16_t __x = x;
93     return ((uint16_t)((((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) |
94                        (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8)));
95 }
96 
__arch__swap16(uint16_t x)97 inline static uint16_t __arch__swap16(uint16_t x)
98 {
99     return ___swap16(x);
100 }
101 
__fswap16(uint16_t x)102 inline static uint16_t __fswap16(uint16_t x)
103 {
104     return __arch__swap16(x);
105 }
106 
107 #define __swap16(x) __fswap16(x)
108 
109 #define __cpu_to_be16(x) __swap16(x)
110 #define __be16_to_cpu(x) __swap16(x)
111 
112 #define wlan_htons(x) __cpu_to_be16(x)
113 // #define ntohs(x) __be16_to_cpu(x)
114 
115 #endif // _TYPES_H_
116 
117