Skip to content

Commit

Permalink
fix wlan interfaces and minor
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed Aug 11, 2022
1 parent ce972d4 commit a61583f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 49 deletions.
4 changes: 2 additions & 2 deletions hal/src/rtl872x/gsm0710muxer/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const auto taskPriority = OS_THREAD_PRIORITY_NETWORK;
#define GSM0710_ASSERT(x) SPARK_ASSERT(x)

// #define GSM0710_MODEM_STATUS_SEND_EMPTY_BREAK
#define GSM0710_PUMP_INPUT_DATA 50
// #define GSM0710_PUMP_INPUT_DATA 50
// #define GSM0710_ENABLE_DEBUG_LOGGING

// #define GSM0710_SHARED_STREAM_EVENT_GROUP
#define GSM0710_SHARED_STREAM_EVENT_GROUP
#define GSM0710_SHARED_STREAM_EVENT_BASE (__builtin_ffs(HAL_USART_PVT_EVENT_MAX))

#if HAL_PLATFORM_WIFI
Expand Down
36 changes: 12 additions & 24 deletions hal/src/trackerm/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "realtek/rtlncpnetif.h"
#include "lwip_util.h"
#include "core_hal.h"
#include "deviceid_hal.h"

using namespace particle;
using namespace particle::net;
Expand Down Expand Up @@ -153,18 +154,10 @@ int if_init_platform(void*) {
reserve_netif_index();

/* en2 - Ethernet FeatherWing (optional) */
uint8_t mac[6] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
{
// const uint32_t lsb = __builtin_bswap32(NRF_FICR->DEVICEADDR[0]);
// const uint32_t msb = NRF_FICR->DEVICEADDR[1] & 0xffff;
// memcpy(mac + 2, &lsb, sizeof(lsb));
// mac[0] = msb >> 8;
// mac[1] = msb;
/* Drop 'multicast' bit */
mac[0] &= 0b11111110;
/* Set 'locally administered' bit */
mac[0] |= 0b10;
}
uint8_t deviceId[HAL_DEVICE_ID_SIZE] = {};
hal_get_device_id(deviceId, sizeof(deviceId));
uint8_t* mac = deviceId + HAL_DEVICE_ID_SIZE - 6;
mac[5] += 3;

if (HAL_Feature_Get(FEATURE_ETHERNET_DETECTION)) {
en2 = new WizNetif(HAL_SPI_INTERFACE1, D5, D3, D4, mac);
Expand All @@ -178,23 +171,20 @@ int if_init_platform(void*) {
reserve_netif_index();
}

#if !HAL_PLATFORM_WIFI_SCAN_ONLY
/* wl4 - Realtek NCP Station */
wl4 = new RealtekNcpNetif();
if (wl4) {
((RealtekNcpNetif*)wl4)->setWifiManager(wifiNetworkManager());
((RealtekNcpNetif*)wl4)->init();
}
#endif

/* pp3 - Cellular */
pp3 = new PppNcpNetif();
if (pp3) {
((PppNcpNetif*)pp3)->setCellularManager(cellularNetworkManager());
((PppNcpNetif*)pp3)->init();
}

reserve_netif_index(); // wl4
/* wl4 - Realtek NCP Station */
wl4 = new RealtekNcpNetif();
if (wl4) {
((RealtekNcpNetif*)wl4)->setWifiManager(wifiNetworkManager());
((RealtekNcpNetif*)wl4)->init();
}

reserve_netif_index(); // wl5
/* TODO: wl5 - Realtek NCP Access Point */
(void)wl5;
Expand Down Expand Up @@ -240,11 +230,9 @@ unsigned char* rltk_wlan_get_gwmask(int idx) {
void rltk_wlan_set_netif_info(int idx_wlan, void* dev, unsigned char* dev_addr) {
LOG(INFO, "rltk_wlan_set_netif_info: %d, %02x:%02x:%02x:%02x:%02x:%02x", idx_wlan,
dev_addr[0], dev_addr[1], dev_addr[2], dev_addr[3], dev_addr[4], dev_addr[5]);
#if !HAL_PLATFORM_WIFI_SCAN_ONLY
if (wl4) {
memcpy(wl4->interface()->hwaddr, dev_addr, sizeof(wl4->interface()->hwaddr));
}
#endif
}

void netif_rx(int idx, unsigned int len) {
Expand Down
11 changes: 1 addition & 10 deletions hal/src/trackerm/ota_flash_hal.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
/**
******************************************************************************
* @file ota_flash_hal.cpp
* @author Matthew McGowan, Satish Nair
* @version V1.0.0
* @date 27-Jul-2022
* @brief
******************************************************************************
*
/*
* Copyright (c) 2022 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
Expand All @@ -21,7 +13,6 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
******************************************************************************
*/

#include <cstring>
Expand Down
1 change: 0 additions & 1 deletion hal/src/trackerm/platform_ncp_quectel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const auto NCP_IDX_PRIMARY_QUECTEL = 0;

PlatformNCPIdentifier platform_primary_ncp_identifier() {
// Check the DCT
return PlatformNCPIdentifier::PLATFORM_NCP_QUECTEL_BG95_M1;
uint8_t ncpId = 0;
int r = dct_read_app_data_copy(DCT_NCP_ID_OFFSET, &ncpId, 1);
if (r < 0 || !isValidNcpId(ncpId)) {
Expand Down
16 changes: 4 additions & 12 deletions hal/src/tron/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,10 @@ int if_init_platform(void*) {
reserve_netif_index();

/* en2 - Ethernet FeatherWing (optional) */
uint8_t mac[6] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
{
// const uint32_t lsb = __builtin_bswap32(NRF_FICR->DEVICEADDR[0]);
// const uint32_t msb = NRF_FICR->DEVICEADDR[1] & 0xffff;
// memcpy(mac + 2, &lsb, sizeof(lsb));
// mac[0] = msb >> 8;
// mac[1] = msb;
/* Drop 'multicast' bit */
mac[0] &= 0b11111110;
/* Set 'locally administered' bit */
mac[0] |= 0b10;
}
uint8_t deviceId[HAL_DEVICE_ID_SIZE] = {};
hal_get_device_id(deviceId, sizeof(deviceId));
uint8_t* mac = deviceId + HAL_DEVICE_ID_SIZE - 6;
mac[5] += 3;

if (HAL_Feature_Get(FEATURE_ETHERNET_DETECTION)) {
en2 = new WizNetif(HAL_SPI_INTERFACE1, D5, D3, D4, mac);
Expand Down

0 comments on commit a61583f

Please sign in to comment.