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

[TI] Update Number of LWIP Buffers, Fix ICD GPIO build error #33053

Merged
merged 4 commits into from
Apr 19, 2024
Merged
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
7 changes: 0 additions & 7 deletions examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
#define APP_TASK_STACK_SIZE (5000)
#define APP_TASK_PRIORITY 4
#define APP_EVENT_QUEUE_SIZE 10

#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
#define LED_ENABLE 0
#else
#define LED_ENABLE 1
#endif
#define BUTTON_ENABLE 1

using namespace ::chip;
Expand All @@ -68,7 +62,6 @@ using namespace ::chip::DeviceLayer;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/cc13x4_26x4/main/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@

#include "Globals.h"

#if (LED_ENABLE == 1)
LED_Handle sAppRedHandle;
LED_Handle sAppGreenHandle;
#endif
7 changes: 7 additions & 0 deletions examples/all-clusters-app/cc13x4_26x4/main/include/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ void cc13xx_26xxLog(const char * aFormat, ...);
#ifdef __cplusplus
}
#endif

#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
#define LED_ENABLE 0
#else
#define LED_ENABLE 1
#endif

extern LED_Handle sAppRedHandle;
extern LED_Handle sAppGreenHandle;
3 changes: 2 additions & 1 deletion examples/lighting-app/cc13x4_26x4/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ using namespace ::chip::DeviceLayer;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

#if (LED_ENABLE == 1)
static LED_Handle sAppRedHandle;
static LED_Handle sAppGreenHandle;
#endif
static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
Expand Down
3 changes: 2 additions & 1 deletion examples/lock-app/cc13x4_26x4/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ using namespace ::chip::app::Clusters::DoorLock;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

#if (LED_ENABLE == 1)
static LED_Handle sAppRedHandle;
static LED_Handle sAppGreenHandle;
#endif
static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0
#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0
#define OPENTHREAD_CONFIG_DIAG_ENABLE 0
Expand Down
3 changes: 2 additions & 1 deletion examples/pump-app/cc13x4_26x4/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ using namespace chip::app::Clusters;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

#if (LED_ENABLE == 1)
static LED_Handle sAppRedHandle;
static LED_Handle sAppGreenHandle;
#endif
static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;

Expand Down
3 changes: 2 additions & 1 deletion examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ using namespace ::chip::DeviceLayer;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

#if (LED_ENABLE == 1)
static LED_Handle sAppRedHandle;
static LED_Handle sAppGreenHandle;
#endif
static Button_Handle sAppLeftHandle;
static Button_Handle sAppRightHandle;

Expand Down
2 changes: 1 addition & 1 deletion src/lwip/cc13xx_26xx/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
#define MEMP_SEPARATE_POOLS (1)
#define LWIP_PBUF_FROM_CUSTOM_POOLS (0)
#define MEMP_USE_CUSTOM_POOLS (0)
#define PBUF_POOL_SIZE (6)
#define PBUF_POOL_SIZE (12)
#define PBUF_POOL_BUFSIZE (1280)
#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL)
#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE)
Expand Down
75 changes: 75 additions & 0 deletions src/platform/cc13xx_26xx/TI_heap_wrapper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "bget.h"
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SwiP.h>

typedef unsigned int dpl_CSState;

typedef union _dpl_cs_state_union_t
{
/** critical section variable as declared in the interface */
dpl_CSState state;
/** @internal field used to access internal data */
struct _dpl_cs_state_aggr_t
{
/** field to store Swi_disable() return value */
uint_least16_t swikey;
/** field to store Hwi_disable() return value */
uint_least16_t hwikey;
} each;
} dpl_CSStateUnion;

/* This is enter critical section for DPL supported devices */
dpl_CSState dpl_enterCSImpl(void)
{

dpl_CSStateUnion cu;
cu.each.swikey = (uint_least16_t) SwiP_disable();
cu.each.hwikey = (uint_least16_t) HwiP_disable();
return cu.state;
}

/* This is exit critical section for DPL supported devices */
void dpl_leaveCSImpl(dpl_CSState key)
{
dpl_CSStateUnion * cu = (dpl_CSStateUnion *) &key;
HwiP_restore((uint32_t) cu->each.hwikey);
SwiP_restore((uint32_t) cu->each.swikey);
}

/* Protected allocation */
void * pvPortMalloc(size_t xWantedSize)
{
void * retVal = NULL;

dpl_CSState state;
state = dpl_enterCSImpl();

retVal = bget(xWantedSize);

dpl_leaveCSImpl(state);
return retVal;
}

/* Protected Deallocation */
void vPortFree(void * pv)
{
dpl_CSState state;
state = dpl_enterCSImpl();

brel(pv);

dpl_leaveCSImpl(state);
}

void * pvPortRealloc(void * pv, size_t size)
{
void * retVal = NULL;

dpl_CSState state;
state = dpl_enterCSImpl();

retVal = bgetr(pv, size);

dpl_leaveCSImpl(state);
return retVal;
}
10 changes: 10 additions & 0 deletions src/platform/cc13xx_26xx/TI_heap_wrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Protected allocation
malloc/ICall_heapMalloc --> ti_heap_wrapper --> bget protected by critical section
*/
void * pvPortMalloc(size_t xWantedSize);

/* Protected Deallocation
Free/ICall_heapFree --> ti_heap_wrapper --> brel protected by critical section
*/
void vPortFree(void * pv);
void * pvPortRealloc(void * pv, size_t size);
Loading
Loading