Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
chili_test.h
Go to the documentation of this file.
1 
5 /*
6  * Copyright (c) 2019, Cascoda Ltd.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the copyright holder nor the
17  * names of its contributors may be used to endorse or promote products
18  * derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef CHILI_TEST_H
34 #define CHILI_TEST_H
35 
37 
38 /******************************************************************************/
39 /****** EVBME TEMPSENSE Command ID Codes ******/
40 /******************************************************************************/
41 #define EVBME_TEST_START_TEST (0x9F) /* start test (automatic by GUI) */
42 #define EVBME_TEST_START_TEST_2 (0x9E) /* start test (manual command) */
43 #define EVBME_TEST_SETUP_REF (0x9D) /* configure reference device */
44 
45 /******************************************************************************/
46 /****** EVBME Command ID Code for Starting Test (DUT) ******/
47 /******************************************************************************/
48 /* Test Command Packet Payload for extra Safety */
49 #define EVBME_TEST_LEN (3)
50 #define EVBME_TEST_DATA0 (0x5A)
51 #define EVBME_TEST_DATA1 (0xA5)
52 #define EVBME_TEST_DATA2 (0x81)
53 
54 /******************************************************************************/
55 /****** Test Limits ******/
56 /******************************************************************************/
57 #define CHILI_TEST_CS_LIMIT 200
58 #define CHILI_TEST_ED_LIMIT 100
59 #define CHILI_TEST_DUT_TIMEOUT 400
60 
61 /******************************************************************************/
62 /****** Test Mode Definitions ******/
63 /******************************************************************************/
64 #define CHILI_TEST_OFF 0
65 #define CHILI_TEST_DUT 1
66 #define CHILI_TEST_REF 2
67 
68 /******************************************************************************/
69 /****** MAC PIB Values for Test ******/
70 /******************************************************************************/
71 #define CHILI_TEST_DUT_SHORTADD 0xCAFE
72 #define CHILI_TEST_REF_SHORTADD 0xCAFF
73 #define CHILI_TEST_CHANNEL 11
74 #define CHILI_TEST_PANID 0xCA5C
75 
76 /******************************************************************************/
77 /****** Test Communication State Definitions ******/
78 /******************************************************************************/
79 #define CHILI_TEST_CST_DONE 0x00
80 #define CHILI_TEST_CST_DUT_D_REQUESTED 0x01
81 #define CHILI_TEST_CST_DUT_D_CONFIRMED 0x02
82 #define CHILI_TEST_CST_DUT_DISPLAY 0x03
83 #define CHILI_TEST_CST_DUT_FINISHED 0x04
84 
85 /******************************************************************************/
86 /****** Test Packet Types, defined by MSDU[0] ******/
87 /******************************************************************************/
88 #define PT_MSDU_TEST_DUT 0xAA
89 #define PT_MSDU_TEST_REF 0xBB
90 
91 /******************************************************************************/
92 /****** Test Result/Status Definitions ******/
93 /******************************************************************************/
94 #define CHILI_TEST_ST_SUCCESS 0x00
95 #define CHILI_TEST_ST_NOCOMMS 0x01
96 #define CHILI_TEST_ST_DATA_CNF_UNEXP 0x02
97 #define CHILI_TEST_ST_DATA_CNF_TIMEOUT 0x03
98 #define CHILI_TEST_ST_DATA_CNF_NO_ACK 0x04
99 #define CHILI_TEST_ST_DATA_CNF_CHACCF 0x05
100 #define CHILI_TEST_ST_DATA_CNF_TROVFL 0x06
101 #define CHILI_TEST_ST_DATA_CNF_OTHERS 0x07
102 #define CHILI_TEST_ST_DATA_IND_UNEXP 0x08
103 #define CHILI_TEST_ST_DATA_IND_TIMEOUT 0x09
104 #define CHILI_TEST_ST_DATA_IND_ID 0x0A
105 #define CHILI_TEST_ST_TIMEOUT 0x0B
106 #define CHILI_TEST_ST_CS_REF_LOW 0x0C
107 #define CHILI_TEST_ST_CS_DUT_LOW 0x0D
108 #define CHILI_TEST_ST_ED_REF_LOW 0x0E
109 #define CHILI_TEST_ST_ED_DUT_LOW 0x0F
110 
111 /******************************************************************************/
112 /****** TEST Functions ******/
113 /******************************************************************************/
114 
115 /******************************************************************************/
116 /***************************************************************************/
120 void CHILI_TEST_Initialise(u8_t status, struct ca821x_dev *pDeviceRef);
121 
122 /******************************************************************************/
123 /***************************************************************************/
127 void CHILI_TEST_Handler(struct ca821x_dev *pDeviceRef);
128 
129 /******************************************************************************/
130 /***************************************************************************/
134 int CHILI_TEST_UpStreamDispatch(struct SerialBuffer *SerialRxBuffer, struct ca821x_dev *pDeviceRef);
135 
136 /******************************************************************************/
137 /***************************************************************************/
142 
143 #endif // CHILI_TEST_H
struct SerialBuffer SerialRxBuffer
Type definitions used by Cascoda baremetal drivers.
unsigned char u8_t
Definition: cascoda_types.h:46
u8_t CHILI_TEST_IsInTestMode(void)
Checks if Device is in Production Test Mode (yes if non-zero)
Definition: chili_test.c:153
void CHILI_TEST_Initialise(u8_t status, struct ca821x_dev *pDeviceRef)
Chili Production Test Initialisation.
Definition: chili_test.c:92
void CHILI_TEST_Handler(struct ca821x_dev *pDeviceRef)
Chili Production Test Handler.
Definition: chili_test.c:104
int CHILI_TEST_UpStreamDispatch(struct SerialBuffer *SerialRxBuffer, struct ca821x_dev *pDeviceRef)
Chili Test Dispatch Branch (UpStream, Serial)
Definition: chili_test.c:122
Structure of serial transfers.
Definition: cascoda_serial.h:50
CA-821x Device reference struct.
Definition: ca821x_api.h:123