1 /*
2  * Copyright 2012-2020 NXP
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 /* Basic type definitions */
18 #include <phUwbTypes.h>
19 #include <phTmlUwb.h>
20 
21 #define SRXXX_MAGIC 0xEA
22 #define SRXXX_SET_PWR _IOW(SRXXX_MAGIC, 0x01, uint32_t)
23 #define SRXXX_SET_FWD _IOW(SRXXX_MAGIC, 0x02, uint32_t)
24 #define SRXXX_ESE_RESET _IOW(SRXXX_MAGIC, 0x03, uint32_t)
25 #define SRXXX_GET_THROUGHPUT _IOW(SRXXX_MAGIC, 0x04, uint32_t)
26 
27 #define PWR_DISABLE               0
28 #define PWR_ENABLE                1
29 #define ABORT_READ_PENDING        2
30 #define PWR_SUSPEND               3
31 #define PWR_RESUME                4
32 
33 #define NORMAL_MODE_HEADER_LEN    4
34 #define NORMAL_MODE_LEN_OFFSET    3
35 
36 #define EXTENDED_SIZE_LEN_OFFSET  1
37 #define UCI_EXTENDED_PKT_MASK     0xC0
38 #define UCI_EXTENDED_SIZE_SHIFT   6
39 #define UCI_NORMAL_PKT_SIZE       0
40 #define UCI_EXT_PKT_SIZE_512B     1
41 #define UCI_EXT_PKT_SIZE_1K       2
42 #define UCI_EXT_PKT_SIZE_2K       3
43 
44 #define UCI_PKT_SIZE_512B         512
45 #define UCI_PKT_SIZE_1K           1024
46 #define UCI_PKT_SIZE_2K           2048
47 
48 /* Function declarations */
49 void phTmlUwb_spi_close(void* pDevHandle);
50 tHAL_UWB_STATUS phTmlUwb_spi_open_and_configure(const char* pDevName, void** pLinkHandle);
51 int phTmlUwb_spi_read(void* pDevHandle, uint8_t* pBuffer, size_t nNbBytesToRead);
52 int phTmlUwb_spi_write(void* pDevHandle, uint8_t* pBuffer, size_t nNbBytesToWrite);
53 int phTmlUwb_Spi_Ioctl(void* pDevHandle, phTmlUwb_ControlCode_t cmd, long arg);
54