1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
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
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  *****************************************************************************/
18 #ifndef PHY_TEST_H_
19 #define PHY_TEST_H_
20 
21 #include "tl_common.h"
22 
23 #ifndef			PHYTEST_MODE_DISABLE
24 #define			PHYTEST_MODE_DISABLE					0
25 #endif
26 
27 #ifndef			PHYTEST_MODE_THROUGH_2_WIRE_UART
28 #define 		PHYTEST_MODE_THROUGH_2_WIRE_UART		1   //Direct Test Mode through a 2-wire UART interface
29 #endif
30 
31 #ifndef			PHYTEST_MODE_OVER_HCI_WITH_USB
32 #define 		PHYTEST_MODE_OVER_HCI_WITH_USB			2   //Direct Test Mode over HCI(UART hardware interface)
33 #endif
34 
35 #ifndef			PHYTEST_MODE_OVER_HCI_WITH_UART
36 #define 		PHYTEST_MODE_OVER_HCI_WITH_UART			3   //Direct Test Mode over HCI(USB  hardware interface)
37 #endif
38 
39 
40 #define 		BLC_PHYTEST_DISABLE						0
41 #define 		BLC_PHYTEST_ENABLE						1
42 
43 
44 
45 
46 
47 
48 
49 
50 /**
51  * @brief      for user to initialize PHY test module
52  * @param      none
53  * @return     none
54  */
55 void 	  blc_phy_initPhyTest_module(void);
56 
57 
58 /**
59  * @brief      for user to set PHY test enable or disable
60  * @param[in]  en - 1: enable; 0:disable
61  * @return     status: 0x00 command OK, no other rvalue
62  */
63 ble_sts_t blc_phy_setPhyTestEnable (u8 en);
64 
65 
66 /**
67  * @brief      for user to get PHY test status: enable or disable
68  * @param      none
69  * @return     1: PHY test is enable; 0: PHY test is disable
70  */
71 bool 	  blc_phy_isPhyTestEnable(void);
72 
73 
74 /**
75  * @brief      uart RX data process for PHY test 2 wire UART mode
76  * @param      none
77  * @return     always 0
78  */
79 int 	 phy_test_2_wire_rx_from_uart (void);
80 
81 
82 /**
83  * @brief      uart TX data process for PHY test 2 wire UART mode
84  * @param      none
85  * @return     always 0
86  */
87 int 	 phy_test_2_wire_tx_to_uart (void);
88 
89 
90 
91 
92 #endif /* PHY_TEST_H_ */
93