Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/****************************************************************************
* drivers/wireless/generic/si4463.h
*
* Copyright (C) 2017 Sebastien Lorquet. All rights reserved.
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __DRIVERS_WIRELESS_GENERIC_SI4463_H
#define __DRIVERS_WIRELESS_GENERIC_SI4463_H
#include <nuttx/wqueue.h>
#include <nuttx/wireless/generic/genradio.h>
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#define SI4463_CMD_POWER_UP 0x02
#define SI4463_CMD_NOP 0x00
#define SI4463_CMD_PART_INFO 0x01
#define SI4463_CMD_FUNC_INFO 0x10
#define SI4463_CMD_SET_PROPERTY 0x11
#define SI4463_CMD_GET_PROPERTY 0x12
#define SI4463_CMD_GPIO_PIN_CFG 0x13
#define SI4463_CMD_FIFO_INFO 0x15
#define SI4463_CMD_GET_INT_STATUS 0x20
#define SI4463_CMD_REQUEST_DEVICE_STATE 0x33
#define SI4463_CMD_CHANGE_STATE 0x34
#define SI4463_CMD_READ_CMD_BUFF 0x44
#define SI4463_CMD_FRR_A_READ 0x50
#define SI4463_CMD_FRR_B_READ 0x51
#define SI4463_CMD_FRR_C_READ 0x53
#define SI4463_CMD_FRR_D_READ 0x57
#define SI4463_CMD_IRCAL 0x17
#define SI4463_CMD_IRCAL_MANUAL 0x1A
#define SI4463_CMD_START_TX 0x31
#define SI4463_CMD_TX_HOP 0x37
#define SI4463_CMD_WRITE_TX_FIFO 0x66
#define SI4463_CMD_PACKET_INFO 0x16
#define SI4463_CMD_GET_MODEM_STATUS 0x22
#define SI4463_CMD_START_RX 0x32
#define SI4463_CMD_RX_HOP 0x36
#define SI4463_CMD_READ_RX_FIFO 0x77
#define SI4463_CMD_GET_ADC_READING 0x14
#define SI4463_CMD_GET_PH_STATUS 0x21
#define SI4463_CMD_GET_CHIP_STATUS 0x23
/* Command and response data structures */
/* POWER ON command */
begin_packed_struct
{
uint8_t boot_options;
uint8_t xtal_options;
uint32_t xo_freq;
}
end_packed_struct;
#define PWRUP_BOOTOPT_NO_PATCH 0
#define PWRUP_BOOTOPT_PATCH (1<<7)
#define PWRUP_BOOTOPT_FUNC_SHIFT 0
#define PWRUP_BOOTOPT_FUNC_PRO (0x01<<PWRUP_BOOTOPT_FUNC_SHIFT)
#define PWRUP_XTALOPT_XTAL 0
#define PWRUP_XTALOPT_TCXO (1<<0)
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* PART INFO response */
begin_packed_struct
struct si4463_rsp_partinfo_s
{
uint8_t chiprev;
uint16_t part;
uint8_t pbuild;
uint16_t id;
uint8_t customer;
uint8_t romid;
}
end_packed_struct;
/* FUNC INFO response */
begin_packed_struct
struct si4463_rsp_funcinfo_s
{
uint8_t revext;
uint8_t revbranch;
uint8_t revint;
uint16_t patch;
uint8_t func;
}
end_packed_struct;
/* SET PROPERTY command */
begin_packed_struct
struct si4463_cmd_setproperty_s
{
uint8_t group;
uint8_t start_prop;
uint8_t data[12];
}
end_packed_struct;
/* GET PROPERTY command */
begin_packed_struct
struct si4463_cmd_getproperty_s
{
uint8_t group;
uint8_t start_prop;
}
end_packed_struct;
/* GET PROPERTY response */
begin_packed_struct
struct si4463_rsp_getproperty_s
{
uint8_t data[16];
}
end_packed_struct;
/* GPIO_PIN_CFG command or response */
begin_packed_struct
struct si4463_cmdrsp_gpiopincfg_s
{
uint8_t gpio[4];
uint8_t nirq;
uint8_t sdo;
uint8_t genconfig;
}
end_packed_struct;
#define PINCFG_PULL_DIS 0
#define PINCFG_PULL_EN (1<<6)
#define PINCFG_DONOTHING 0
#define PINCFG_TRISTATE 1
#define PINCFG_DRIVE0 2
#define PINCFG_DRIVE1 3
#define PINCFG_INPUT 4
#define PINCFG_32K_CLK 5
#define PINCFG_BOOT_CLK 6
#define PINCFG_DIV_CLK 7
#define PINCFG_CTS 8
#define PINCFG_INV_CTS 9
#define PINCFG_CMD_OVERLAP 10
#define PINCFG_SDO 11
#define PINCFG_POR 12
#define PINCFG_CAL_WUT 13
#define PINCFG_WUT 14
#define PINCFG_EN_PA 15
#define PINCFG_TX_DATA_CLK 16
#define PINCFG_RX_DATA_CLK 17
#define PINCFG_EN_LNA 18
#define PINCFG_TX_DATA 19
#define PINCFG_RX_DATA 20
#define PINCFG_RX_RAW_DATA 21
#define PINCFG_ANTENNA_1_SW 22
Loading full blame...