Skip to content

Commit 5cbe5a3

Browse files
committed
version 2.13.0.4
1 parent f73c4df commit 5cbe5a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2353
-660
lines changed

Firmware/pmemdata_wlan_bt_9117

8 KB
Binary file not shown.

LICENSE

100644100755
File mode changed.

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ COMMAND_84_ERROR_WAR=y
6868
mac80211 will do scan
6969
OFFLOAD_SCAN_TO_DEVICE=y
7070

71-
EXTRA_CFLAGS += -DLINUX -Wimplicit -Wstrict-prototypes -Wall -Wno-implicit-fallthrough
71+
#Uncomment below line to skip loading firmware
72+
#EXTRA_CFLAGS += -DNO_FIRMWARE_LOAD_SUPPORT
73+
74+
EXTRA_CFLAGS += -DLINUX -Wimplicit -Wstrict-prototypes -Wall -Wno-implicit-fallthrough -Wno-address
7275
EXTRA_CFLAGS += -I$(PWD)/include
7376
EXTRA_CFLAGS += -DCONFIG_RSI_DEBUGFS
7477

@@ -204,3 +207,4 @@ clean:
204207
@find . -name 'onebox_util' | xargs rm -rf
205208
@find . -name 'transmit' | xargs rm -rf
206209
@find . -name 'transmit_packet' | xargs rm -rf
210+
@find . -name 'mfg' | xargs rm -rf

README.md

+59-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,59 @@
1-
# SiWT917 Open Source Driver
2-
3-
This software package contains following folders/files :
4-
5-
## Package
6-
7-
SiWT917.X.X.X.X
8-
9-
├── Firmware
10-
├── apps
11-
├── release
12-
└── rsi
13-
14-
## Content Description
15-
16-
- Firmware : This folder contains firmware binary for SiWT917.
17-
18-
- apps : This folder contains driver tools source code.
19-
20-
- release : This folder contains kernel modules, configuration files of
21-
supplicant, hostapd and script files.
22-
23-
- rsi : This folder contains SiWT917 RCP driver source code.
24-
1+
# SiWT917 Open Source Driver
2+
The SiWT917 RCP Driver is a SoftMAC driver that interacts with the Linux wireless MAC layer, MAC80211. It consists of simple and efficient kernel modules that currently support SiWT917 RCP chipsets and can be ported to any embedded platform, in addition to the X-86 platform.
3+
4+
- [Release Notes](#release-notes)
5+
- [Licensing](#licensing)
6+
- [Documentation](#documentation)
7+
- [Software Reference](#software-reference)
8+
- [Hardware Reference](#hardware-reference)
9+
- [Package structure](#Package-structure)
10+
11+
12+
13+
## Release Notes
14+
15+
- See [here](https://github.com/SiliconLabs/si91x-rcp-driver/blob/master/docs/release-notes/index.md) for the latest RCP release notes.
16+
17+
## Licensing
18+
19+
The default license for SiWT917 RCP Driver is [GNU General Public License v2.0](https://github.com/SiliconLabs/si91x-rcp-driver/blob/master/LICENSE).
20+
21+
## Documentation
22+
23+
The online RCP documentation is available [here](https://docs.silabs.com/wifi91xrcp/latest/wifi91xrcp-developing-in-rcp-mode/).
24+
25+
### Software Reference
26+
27+
- See the [Getting Started Guide](https://docs.silabs.com/wifi91xrcp/latest/wifi91xrcp-getting-started/) section for instructions on how to set up the SiWT917 Linux driver in RCP mode.
28+
- [SiWT917 Software Reference Manual](https://docs.silabs.com/wifi91xrcp/latest/wifi91xrcp-developers-guide-overview/)
29+
30+
### Hardware Reference
31+
32+
- [SiWT917 RCP Datasheet](https://www.silabs.com/documents/public/data-sheets/siwt917-rcp-datasheet.pdf)
33+
34+
35+
## Package Structure
36+
37+
This software package contains following folders/files :
38+
39+
SiWT917.X.X.X.X
40+
41+
├── Firmware
42+
├── apps
43+
├── release
44+
├── rsi
45+
└── docs
46+
47+
### Content Description
48+
49+
- Firmware : This folder contains firmware binary for SiWT917.
50+
51+
- apps : This folder contains driver tools source code.
52+
53+
- release : This folder contains kernel modules, configuration files of
54+
supplicant, hostapd and script files.
55+
56+
- rsi : This folder contains SiWT917 RCP driver source code.
57+
58+
- docs : This folder contains release notes.
59+

apps/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ all:
1818
$(CC) -o ble_receive ble_receive.c per_sock.c $(CFLAGS)
1919
$(CC) -o transmit_packet transmit_packet.c per_sock.c $(CFLAGS)
2020
$(CC) -o bbp_util matlab_utils.c per_sock.c -lm -lpthread $(CFLAGS)
21+
#Uncomment the -D DEBUG flags in the below statement to increase log level for cmfg
22+
$(CC) -o mfg cmfg/*.c -Icmfg/ #-D DEBUG
2123

2224
@echo -e "Copying to release folder...."
2325
$(cpy) receive ../release/
@@ -29,3 +31,4 @@ all:
2931
$(cpy) transmit_packet ../release/
3032
$(cpy) bt_ble_gain_table_update ../release/
3133
$(cpy) bbp_util ../release/
34+
$(cpy) mfg ../release/

apps/ble_transmit.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,16 @@ int main(int argc, char *argv[])
198198
printf("Invalid rf chain \n");
199199
return ONEBOX_STATUS_FAILURE;
200200
}
201-
201+
//__9117_CODE_START
202+
#ifdef CONFIG_917
203+
if ((ble_per_params.ble_rate == BLE_2MBPS)) {
204+
if ((ble_per_params.bt_tx_rf_chnl == 39) || (ble_per_params.bt_rx_rf_chnl == 39)) {
205+
printf("invalid rf channel configuration");
206+
return ONEBOX_STATUS_FAILURE;
207+
}
208+
}
209+
#endif
210+
//__9117_CODE_END
202211
printf("the packet length is %d \n", ble_per_params.pkt_length);
203212

204213
bb_rf_params.value = PER_BLE_TRANSMIT;

apps/bt_util.c

+41-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ int main(int argc, char *argv[])
2828
int cmdNo = -1;
2929
struct bb_rf_param_bt_t bb_rf_params;
3030
int no_of_packets;
31-
unsigned int bb_addr = 0, bb_val = 0;
31+
unsigned int bb_addr = 0, bb_val = 0, len = 0;
32+
unsigned char ii = 0;
33+
struct nlmsghdr *nlh;
3234

3335
memset(&bb_rf_params, 0, sizeof(bb_rf_params));
3436

@@ -52,7 +54,7 @@ int main(int argc, char *argv[])
5254
return ONEBOX_STATUS_FAILURE;
5355
}
5456
} else {
55-
printf("Usage: ./bt_util bt_e2e_stats < filename >\n");
57+
usage();
5658
}
5759

5860
} break;
@@ -62,7 +64,7 @@ int main(int argc, char *argv[])
6264
return ONEBOX_STATUS_FAILURE;
6365
}
6466
} else {
65-
printf("Usage: ./bt_util bt_e2e_periodic_stats < filename > < duration >\n");
67+
usage();
6668
}
6769
} break;
6870
case RSI_GET_BT_STATS: {
@@ -72,7 +74,7 @@ int main(int argc, char *argv[])
7274
return ONEBOX_STATUS_FAILURE;
7375
}
7476
} else {
75-
printf("Usage: ./bt_util bt_stats < filename > <no_of_packets>\n");
77+
usage();
7678
}
7779
} break;
7880

@@ -87,14 +89,43 @@ int main(int argc, char *argv[])
8789
bb_rf_params.Data[0] = bb_addr;
8890
bb_rf_params.Data[1] = bb_val;
8991
} else {
90-
printf("Usage: bb_write addr \n");
92+
usage();
9193
return ONEBOX_STATUS_FAILURE;
9294
}
93-
if (send_bb_write_frame_to_drv(bb_rf_params, sfd) < 0) {
95+
if (send_bb_read_write_frame_to_drv(bb_rf_params, sfd) < 0) {
9496
printf("Unable to perform BB_WRITE\n");
9597
} else
9698
printf("SUCCESS Writing to BB: \n");
9799
break;
100+
case RSI_SET_BB_READ:
101+
len = sizeof(bb_rf_params);
102+
if (argc == 3) {
103+
bb_addr = strtol(argv[2], NULL, 16);
104+
ONEBOX_PRINT("BB addr: 0x%x \n", bb_addr);
105+
bb_rf_params.value = 0; //BB_READ_TYPE
106+
bb_rf_params.no_of_values = 1;
107+
bb_rf_params.soft_reset = 0;
108+
bb_rf_params.Data[0] = bb_addr;
109+
} else {
110+
usage();
111+
return ONEBOX_STATUS_FAILURE;
112+
}
113+
if (send_bb_read_write_frame_to_drv(bb_rf_params, sfd) < 0) {
114+
printf("Unable to perform BB_READ\n");
115+
} else
116+
printf("SUCCESS in Reading BB: \n");
117+
nlh = common_recv_mesg_wrapper(sfd, len);
118+
if (nlh == NULL) {
119+
printf("Error receving from bb\n");
120+
break;
121+
} else {
122+
memcpy(&bb_rf_params, NLMSG_DATA(nlh), len);
123+
for (ii = 0; ii < bb_rf_params.no_of_values; ii++) {
124+
printf("BB_read value is 0x%x\n", bb_rf_params.Data[ii]);
125+
}
126+
}
127+
free(nlh);
128+
break;
98129
default:
99130
break;
100131
}
@@ -180,7 +211,7 @@ int send_bt_stat_frame_to_drv(struct bb_rf_param_bt_t bb_rf_params, int sfd)
180211
return ret;
181212
}
182213

183-
int send_bb_write_frame_to_drv(struct bb_rf_param_bt_t bb_rf_params, int sfd)
214+
int send_bb_read_write_frame_to_drv(struct bb_rf_param_bt_t bb_rf_params, int sfd)
184215
{
185216
struct sockaddr_nl dest_addr;
186217
struct nlmsghdr *nlh = NULL;
@@ -586,6 +617,8 @@ int get_bt_cmdnumber(char *command)
586617
return RSI_GET_BT_STATS;
587618
else if (!strcmp(command, "bb_write"))
588619
return RSI_SET_BB_WRITE;
620+
else if (!strcmp(command, "bb_read"))
621+
return RSI_SET_BB_READ;
589622
else
590623
usage();
591624
return ONEBOX_STATUS_SUCCESS;
@@ -601,5 +634,6 @@ void usage()
601634
ONEBOX_PRINT("Usage: ./bt_util bt_e2e_periodic_stats < filename > < duration >\n");
602635
ONEBOX_PRINT("Usage: ./bt_util bt_stats < filename > <no_of_packets>\n");
603636
ONEBOX_PRINT("Usage: ./bt_util bb_write <addr> < value> \n");
637+
ONEBOX_PRINT("Usage: ./bt_util bb_read <addr>\n");
604638
return;
605639
}

apps/cmfg/cmfg.h

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright 2020-2023 Silicon Labs, Inc.
4+
*/
5+
6+
#include <stdio.h>
7+
#include <stdint.h>
8+
#include <stdlib.h>
9+
#include <stddef.h>
10+
#include <string.h>
11+
#include <signal.h>
12+
#include <unistd.h>
13+
14+
#include <arpa/inet.h>
15+
#include <sys/socket.h>
16+
#include <linux/netlink.h>
17+
18+
#define SOCKET_PROTOCOL 31
19+
20+
// Minimun TX packet length
21+
#define TX_CMD_DESC 14
22+
// Minimun RX packet length
23+
#define RX_CMD_DESC 10
24+
// Maximum TX packet buffer
25+
#define MAX_TX_BUFF_SUPPORTED (4096 + TX_CMD_DESC)
26+
// Maximum RX packet buffer
27+
#define MAX_RX_BUFF_SUPPORTED (4096 + RX_CMD_DESC)
28+
29+
// MCU commands
30+
#define RESET_INTERFACE_COMMAND 0x0000
31+
#define INIT_INTERFACE_COMMAND 0x0001
32+
#define RESET_TARGET_COMMAND 0x0002
33+
#define POWER_TARGET_COMMAND 0x0003
34+
#define READ_MEMORY_COMMAND 0x0004
35+
#define WRITE_MEMORY_COMMAND 0x0005
36+
37+
// Error Marcos
38+
#define MEMORY_ALLOCATION_FAILURE 0x0
39+
#define TX_PACKET_CRC_CHECK_ERROR 0xE0
40+
#define RX_PACKET_CRC_CHECK_ERROR 0xE1
41+
#define INVALID_COMMAND 0xE2
42+
#define UNSUPPORTED_COMMAND 0xE3
43+
#define SOFT_RESET_TARGET 0x4
44+
45+
#define CMFG_MAX_COMMAND_LENGTH MAX_TX_BUFF_SUPPORTED
46+
#define CMFG_MIN_COMMAND_LENGTH TX_CMD_DESC
47+
48+
// Transfer packet Structure
49+
typedef struct tx_packet_command_desc_s {
50+
uint8_t start_tag;
51+
uint8_t sequence_number;
52+
uint16_t packet_length;
53+
uint16_t MCU_command;
54+
uint16_t length;
55+
uint32_t address;
56+
uint8_t content[0];
57+
} tx_packet_command_desc_t;
58+
59+
// Receive Packet Structure
60+
typedef struct rx_packet_command_desc_s {
61+
uint8_t start_tag;
62+
uint8_t sequence_number;
63+
uint16_t packet_length;
64+
uint32_t status;
65+
uint8_t content[0];
66+
} rx_packet_command_desc_t;
67+
68+
// TCP socket related
69+
#define SOURCE_PORT 51917
70+
int tcp_server(void);
71+
int server_response(rx_packet_command_desc_t *, uint16_t, int);
72+
int process_request(tx_packet_command_desc_t *, uint16_t, int);
73+
int allocate_tx_buffer(tx_packet_command_desc_t **);
74+
void allocate_rx_buffer(rx_packet_command_desc_t **);
75+
void sig_handler(int);
76+
void interrupt_checker(void);
77+
78+
// Netlink socket related
79+
#define WLAN_PACKET 1
80+
#define MANUFACTURING 16
81+
#define MFG_READ 'R'
82+
#define MFG_WRITE 'W'
83+
#define MFG_RESET 'X'
84+
// Master structure for read and write
85+
typedef struct mfg_rw_s {
86+
uint32_t address;
87+
uint16_t length;
88+
uint8_t data[MAX_TX_BUFF_SUPPORTED];
89+
uint32_t reset_value;
90+
char read_write;
91+
} mfg_rw_t;
92+
//Command Type
93+
struct rsi_nl_desc {
94+
uint16_t desc_word[0];
95+
};
96+
97+
extern int netlink_sfd;
98+
int netlink_socket_creation(void);
99+
int send_tx_packet(mfg_rw_t *, int, int);
100+
int receive_rx_packet(mfg_rw_t *, int, int);
101+
102+
// Device R/W Routines
103+
void reset_routine(rx_packet_command_desc_t *, int);
104+
void read_routine(rx_packet_command_desc_t *, tx_packet_command_desc_t *, int);
105+
void write_routine(rx_packet_command_desc_t *, tx_packet_command_desc_t *, int);
106+
107+
// CRC related
108+
uint16_t crc16_computation(uint8_t *, uint16_t);
109+
void rx_crc_check(rx_packet_command_desc_t *, uint32_t content_len);

0 commit comments

Comments
 (0)