Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
cascoda_aerial_adapter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 /*
29  * Aerial Adapter (printf over Air), interfaces to testref app.
30 */
31 
32 #ifndef CASCODA_AERIAL_ADAPTER_H
33 #define CASCODA_AERIAL_ADAPTER_H
34 
35 #include "ca821x_api.h"
36 
37 /* Note that this configuration has to match up with configuration of production test */
38 /* reference device testref (baremetal/app/testref/include/testref.h) */
39 
40 /****** MAC PIB Setup for Test */
41 #define AERIAL_ADAPTER_DUT_SHORTADD 0xCAFE /* Short Address for DUT */
42 #define AERIAL_ADAPTER_REF_SHORTADD 0xCAFF /* Short Address for Reference Device */
43 #define AERIAL_ADAPTER_PANID 0xCA5C /* PanID */
44 #define AERIAL_ADAPTER_MSDU_HANDLE 0x05 /* Fixed Msdu handle for reference device (only one data request) */
45 
46 #define AERIAL_ADAPTER_EDTHRESHOLD 128 /* Increase ED treshold to get rid of interference (default 60) */
47 #define AERIAL_ADAPTER_CSTHRESHOLD 128 /* Increase CS treshold to get rid of interference (default 80) */
48 
49 /* Positions in MAC Payload */
50 #define AERIAL_ADAPTER_MSDU_POS_ID 0 /* Byte 0 - Test Packet Identifier */
51 #define AERIAL_ADAPTER_MSDU_POS_TYPE 1 /* Byte 1 - Test Packet Type */
52 #define AERIAL_ADAPTER_MSDU_POS_ED 2 /* Byte 2 - ED of last received Packet */
53 #define AERIAL_ADAPTER_MSDU_POS_CS 3 /* Byte 3 - CS of last received Packet */
54 #define AERIAL_ADAPTER_MSDU_POS_STATUS 4 /* Byte 4 - Test Status */
55 #define AERIAL_ADAPTER_MSDU_POS_MESSAGE 5 /* from Byte 5: Message if attached */
56 
57 /* Test Packet Identifier */
58 #define AERIAL_ADAPTER_PKT_ID 0xA5
59 
60 /* Test Packet Types */
61 #define AERIAL_ADAPTER_TYPE_REQUEST 0x01 /* DUT -> REF: Test Initialisation Request */
62 #define AERIAL_ADAPTER_TYPE_CONFIRM 0x02 /* REF -> DUT: Test Initialisation Confirm */
63 #define AERIAL_ADAPTER_TYPE_MESSAGE 0x03 /* DUT -> REF: Test Message for Terminal */
64 #define AERIAL_ADAPTER_TYPE_COMPLETE 0x04 /* DUT -> REF: Test Complete */
65 
66 /* maxium message size */
67 /* has to fit in 1 802.15.4 packet as no fragmentation supported */
68 #define AERIAL_ADAPTER_MAX_MESSAGE 100
69 
70 /* Functions */
71 
78 ca_error aainitialise(uint8_t channel, struct ca821x_dev *pDeviceRef);
79 
85 int aaprintf(const char *format, ...);
86 
87 #endif // CASCODA_AERIAL_ADAPTER_H
The main ca821x-api include file.
ca_error aainitialise(uint8_t channel, struct ca821x_dev *pDeviceRef)
Initialise and start aerial adapter.
Definition: cascoda_aerial_adapter.c:310
int aaprintf(const char *format,...)
Print message over air (max.
Definition: cascoda_aerial_adapter.c:361
ca_error
Cascoda error type.
Definition: ca821x_error.h:51
uint8_t channel
Channel we are sniffing on.
Definition: sniffer.c:200
CA-821x Device reference struct.
Definition: ca821x_api.h:123