Skip to content

Commit f230d26

Browse files
axelnxpmmahadevan108
authored andcommitted
mcux: middleware: ieee_802_15_4: Adapt PHY to zephyr
Remove/disable unwanted code in Zephyr environment. Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
1 parent 651838b commit f230d26

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

mcux/middleware/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/interface/Phy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ typedef struct Phy_PhyLocalStruct_tag
256256

257257
PHY_ext_cmd_handler_t ext_cmd_handler;
258258

259+
#ifndef __ZEPHYR__
259260
messaging_t macPhyInputQueue;
261+
#endif
260262

261263
phyTxParams_t txParams;
262264
phyRxParams_t rxParams;

mcux/middleware/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/interface/PhyInterface.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@
2929
************************************************************************************/
3030
#include "PhyTypes.h"
3131
#include "PhyMessages.h"
32+
#ifndef __ZEPHYR__
3233
#include "fsl_component_messaging.h"
3334
#include "fsl_component_mem_manager.h"
35+
#else
36+
#include <stdbool.h>
37+
#endif
3438

3539
#include <assert.h>
3640
#include <limits.h>
@@ -39,11 +43,13 @@
3943
* Public type definitions
4044
*************************************************************************************
4145
********************************************************************************** */
46+
#ifndef __ZEPHYR__
4247
#ifndef CONCAT
4348
#define CONCAT(a, b) a ## b // Concatenate
4449
#endif
4550
#define CONCAT_EXPAND(a,b) CONCAT(a, b) // expand then paste
4651
#define _Static_assert(cond, STR) typedef char CONCAT_EXPAND(static_assert_line_, __LINE__)[(cond) ? 1 : -1] // Define _Static_assert for Backward Compatibility to support lower C11 C-Standard versions.
52+
#endif
4753

4854

4955
_Static_assert(sizeof(phyMessageId_t) == sizeof(uint8_t), "phyMessageId_t bigger than 1 byte");

mcux/middleware/mcux-sdk-middleware-ieee_802.15.4/ieee_802_15_4/phy/source/SerialDevice/Phy.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
#include "dtest.h"
1818
#endif
1919

20+
#ifdef __ZEPHYR__
21+
#include <zephyr/kernel.h>
22+
23+
#define MSG_Alloc(x) k_malloc(x)
24+
#define MSG_Free(x) k_free(x)
25+
26+
#else
27+
28+
#include "fsl_component_messaging.h"
29+
30+
#endif /* __ZEPHYR__ */
2031

2132
#undef CTX_NO
2233
#define CTX_NO 2
@@ -219,12 +230,14 @@ void Phy_Init(void)
219230

220231
OSA_InterruptEnable();
221232

233+
#ifndef __ZEPHYR__
222234
/* prepare to send RNG seed to NBU */
223235
int PLATFORM_FwkSrvInit();
224236
PLATFORM_FwkSrvInit();
225237

226238
int RNG_Init();
227239
RNG_Init();
240+
#endif
228241

229242
if (HAL_RpmsgInit((hal_rpmsg_handle_t)phyRpmsgHandle, &phyRpmsgConfig) != kStatus_HAL_RpmsgSuccess)
230243
{
@@ -414,9 +427,11 @@ uint8_t PHY_get_ctx()
414427

415428
assert(ret == gPhySuccess_c);
416429

430+
#ifndef __ZEPHYR__
417431
/* send RNG seed to NBU */
418432
int RNG_SetSeed(void);
419433
RNG_SetSeed();
434+
#endif
420435

421436
return (uint8_t)msg.msgData.getReq.PibAttributeValue;
422437
}

0 commit comments

Comments
 (0)