Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mcux: add files and cmake changes for mcxw71 IEEE802.15.4 driver #491

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions mcux/hal_nxp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,32 @@ if(${MCUX_DEVICE} MATCHES "MCXW")
include(driver_ccm32k)
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/ccm32k)
endif()

if(CONFIG_SOC_SERIES_MCXW AND (CONFIG_NET_L2_IEEE802154 OR CONFIG_NET_L2_OPENTHREAD))

list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lptmr
)

include(driver_lptmr)
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lptmr)

zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/lists)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/lists/fsl_component_generic_list.c)

zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/osa)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/osa/fsl_os_abstraction_zephyr.c)
zephyr_compile_definitions(OSA_USED=1)

zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/timer_manager)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/timer_manager/fsl_component_timer_manager.c)

zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/timer)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/timer/fsl_adapter_lptmr.c)

zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/messaging)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/messaging/fsl_component_messaging.c)

zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/mem_manager)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/mem_manager/fsl_component_mem_manager_light.c)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
#define ENABLE_GLOBAL_IRQ(reg) \
D_BARRIER; \
EnableGlobalIRQ(reg)
#define KB(x) ((x) << 10u)

/************************************************************************************
*************************************************************************************
Expand Down Expand Up @@ -532,7 +531,7 @@ mem_status_t MEM_RegisterExtendedArea(memAreaCfg_t *area_desc, uint8_t *p_area_i
break;
}
area_sz = new_area_desc->end_address.raw_address - new_area_desc->start_address.raw_address;
if (area_sz <= (uint32_t)KB((uint32_t)1U))
if (area_sz <= (uint32_t)(1U << 10U))
{
/* doesn't make sense to register an area smaller than 1024 bytes */
st = kStatus_MemInitError;
Expand Down
16 changes: 15 additions & 1 deletion mcux/middleware/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(CONFIG_BT OR CONFIG_NET_L2_OPENTHREAD)
if(CONFIG_BT OR CONFIG_NET_L2_IEEE802154 OR CONFIG_NET_L2_OPENTHREAD)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk-middleware-connectivity-framework)
include(connectivity_framework)
if(CONFIG_SOC_SERIES_MCXW)
Expand All @@ -25,5 +25,19 @@ if(CONFIG_BT OR CONFIG_NET_L2_OPENTHREAD)
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-multicore/rpmsg_lite/lib/rpmsg_lite/porting/platform/kw45b41/rpmsg_platform.c
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-multicore/rpmsg_lite/lib/rpmsg_lite/rpmsg_lite.c
)

if(CONFIG_NET_L2_IEEE802154 OR CONFIG_NET_L2_OPENTHREAD)
zephyr_include_directories(
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/interface
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-ieee_802.15.4/utils
)

zephyr_library_sources(
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/source/PhyTime.c
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/source/SerialDevice/ASP.c
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/source/SerialDevice/Phy.c
)
zephyr_compile_definitions(USE_NBU=1)
endif()
endif()
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*!
* Copyright 20021-2023 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _PLATFORM_OT_H_
#define _PLATFORM_OT_H_

#include "EmbeddedTypes.h"
#include "clock_config.h"
#include "fsl_component_serial_manager.h"

#if KW45_A0_SUPPORT
#if !defined(OT_APP_UART_INSTANCE)
#define OT_APP_UART_INSTANCE 0
#define OT_APP_UART_CLK kCLOCK_Lpuart0
#endif
#else
#if !defined(OT_APP_UART_INSTANCE)
#define OT_APP_UART_INSTANCE 1
#define OT_APP_UART_CLK kCLOCK_Lpuart1
#endif
#endif

#if 1
#define OT_APP_UART_CLKSRC kCLOCK_IpSrcFro192M
#else
#define OT_APP_UART_CLKSRC kCLOCK_IpSrcFro6M
#endif

#ifndef OT_APP_UART_BAUDRATE
#define OT_APP_UART_BAUDRATE 115200
#endif

#ifndef OT_APP_UART_TYPE
#define OT_APP_UART_TYPE (kSerialPort_Uart)
#endif

#ifndef SERIAL_MANAGER_RING_BUFFER_SIZE
#define SERIAL_MANAGER_RING_BUFFER_SIZE (128U)
#define kReceiveBufferSize (128)
#else
#define kReceiveBufferSize (SERIAL_MANAGER_RING_BUFFER_SIZE + 1)
#endif

#if !defined(gPlatformUseUniqueDeviceIdFor15_4Addr_d)
/*!
* \brief use the device unique Id for IEEE802.15.4 MAC address
*/
#define gPlatformUseUniqueDeviceIdFor15_4Addr_d 0
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*!
* \brief platform initialization for OpenThread
*
* this function prepares:
* platform multicore and intercore service channel
* configure RFMC module, NBU domain and start CM3 core
* handshaking for chip revision (A0 or A1)
* loads some HW parameters from Flash to RAM
*
* \return int 0 if success, 1 if already initialized, negative value if error.
*/
int PLATFORM_InitOT(void);

/*!
* \brief Return OpenThread / iEEE 802.15.4 MAC address
*
* If MAC address already programmed return its value.
* If not yet programmed generate one using the OUI defined by the IEEE_15_4_ADDR_OUI
* macro. The remaining 5 bytes are picked either from the Radio UID or generated
* randomly.
* \param eui64_address pointer on buffer storage supplied by caller to receive the 8
* bytes of EUI-64 MAC address.
*
*/
void PLATFORM_GetIeee802_15_4Addr(uint8_t *eui64_address);

#ifdef __cplusplus
}
#endif

#endif /* _PLATFORM_OT_H_ */
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NXP Software Content Register

Package: mcux-sdk-middleware-ieee_802.15.4.git
Version: 5.3.11
Outgoing License: LA_OPT_NXP_SOFTWARE_License v44 - Additional distribution license granted, license in Section 2.3 applies
License File: LICENSE.htm
Description and comments: Wireless 802.15.4 middleware
Release Location: https://github.com/nxp-mcuxpresso/mcux-sdk-middleware-ieee_802.15.4.git
Origin: NXP (proprietary)
Loading