Skip to content

Commit 8e79e24

Browse files
[TI] Update Number of LWIP Buffers, Fix ICD GPIO build error (#33053)
* Update Number of LWIP Buffers, Fix ICD GPIO build error Update memory interface to support realloc, decrease num message buffers Fix ICD LED Build failures * Restyled by whitespace * Restyled by clang-format * Keep old implementation of realloc for CC3220 --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent e62bc1c commit 8e79e24

File tree

13 files changed

+504
-14
lines changed

13 files changed

+504
-14
lines changed

examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@
5454
#define APP_TASK_STACK_SIZE (5000)
5555
#define APP_TASK_PRIORITY 4
5656
#define APP_EVENT_QUEUE_SIZE 10
57-
58-
#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
59-
#define LED_ENABLE 0
60-
#else
61-
#define LED_ENABLE 1
62-
#endif
6357
#define BUTTON_ENABLE 1
6458

6559
using namespace ::chip;
@@ -68,7 +62,6 @@ using namespace ::chip::DeviceLayer;
6862

6963
static TaskHandle_t sAppTaskHandle;
7064
static QueueHandle_t sAppEventQueue;
71-
7265
static Button_Handle sAppLeftHandle;
7366
static Button_Handle sAppRightHandle;
7467
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;

examples/all-clusters-app/cc13x4_26x4/main/Globals.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818

1919
#include "Globals.h"
2020

21+
#if (LED_ENABLE == 1)
2122
LED_Handle sAppRedHandle;
2223
LED_Handle sAppGreenHandle;
24+
#endif

examples/all-clusters-app/cc13x4_26x4/main/include/Globals.h

+7
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,12 @@ void cc13xx_26xxLog(const char * aFormat, ...);
3131
#ifdef __cplusplus
3232
}
3333
#endif
34+
35+
#if (CHIP_CONFIG_ENABLE_ICD_SERVER == 1)
36+
#define LED_ENABLE 0
37+
#else
38+
#define LED_ENABLE 1
39+
#endif
40+
3441
extern LED_Handle sAppRedHandle;
3542
extern LED_Handle sAppGreenHandle;

examples/lighting-app/cc13x4_26x4/src/AppTask.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ using namespace ::chip::DeviceLayer;
8181

8282
static TaskHandle_t sAppTaskHandle;
8383
static QueueHandle_t sAppEventQueue;
84-
84+
#if (LED_ENABLE == 1)
8585
static LED_Handle sAppRedHandle;
8686
static LED_Handle sAppGreenHandle;
87+
#endif
8788
static Button_Handle sAppLeftHandle;
8889
static Button_Handle sAppRightHandle;
8990
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;

examples/lock-app/cc13x4_26x4/src/AppTask.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ using namespace ::chip::app::Clusters::DoorLock;
7272

7373
static TaskHandle_t sAppTaskHandle;
7474
static QueueHandle_t sAppEventQueue;
75-
75+
#if (LED_ENABLE == 1)
7676
static LED_Handle sAppRedHandle;
7777
static LED_Handle sAppGreenHandle;
78+
#endif
7879
static Button_Handle sAppLeftHandle;
7980
static Button_Handle sAppRightHandle;
8081

examples/platform/cc13x4_26x4/project_include/OpenThreadConfig.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#pragma once
2525

26+
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
2627
#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0
2728
#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0
2829
#define OPENTHREAD_CONFIG_DIAG_ENABLE 0

examples/pump-app/cc13x4_26x4/main/AppTask.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ using namespace chip::app::Clusters;
7979

8080
static TaskHandle_t sAppTaskHandle;
8181
static QueueHandle_t sAppEventQueue;
82-
82+
#if (LED_ENABLE == 1)
8383
static LED_Handle sAppRedHandle;
8484
static LED_Handle sAppGreenHandle;
85+
#endif
8586
static Button_Handle sAppLeftHandle;
8687
static Button_Handle sAppRightHandle;
8788

examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ using namespace ::chip::DeviceLayer;
6868

6969
static TaskHandle_t sAppTaskHandle;
7070
static QueueHandle_t sAppEventQueue;
71-
71+
#if (LED_ENABLE == 1)
7272
static LED_Handle sAppRedHandle;
7373
static LED_Handle sAppGreenHandle;
74+
#endif
7475
static Button_Handle sAppLeftHandle;
7576
static Button_Handle sAppRightHandle;
7677

src/lwip/cc13xx_26xx/lwipopts.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
#define MEMP_SEPARATE_POOLS (1)
9090
#define LWIP_PBUF_FROM_CUSTOM_POOLS (0)
9191
#define MEMP_USE_CUSTOM_POOLS (0)
92-
#define PBUF_POOL_SIZE (6)
92+
#define PBUF_POOL_SIZE (12)
9393
#define PBUF_POOL_BUFSIZE (1280)
9494
#define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL)
9595
#define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE)
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#include "bget.h"
2+
#include <ti/drivers/dpl/HwiP.h>
3+
#include <ti/drivers/dpl/SwiP.h>
4+
5+
typedef unsigned int dpl_CSState;
6+
7+
typedef union _dpl_cs_state_union_t
8+
{
9+
/** critical section variable as declared in the interface */
10+
dpl_CSState state;
11+
/** @internal field used to access internal data */
12+
struct _dpl_cs_state_aggr_t
13+
{
14+
/** field to store Swi_disable() return value */
15+
uint_least16_t swikey;
16+
/** field to store Hwi_disable() return value */
17+
uint_least16_t hwikey;
18+
} each;
19+
} dpl_CSStateUnion;
20+
21+
/* This is enter critical section for DPL supported devices */
22+
dpl_CSState dpl_enterCSImpl(void)
23+
{
24+
25+
dpl_CSStateUnion cu;
26+
cu.each.swikey = (uint_least16_t) SwiP_disable();
27+
cu.each.hwikey = (uint_least16_t) HwiP_disable();
28+
return cu.state;
29+
}
30+
31+
/* This is exit critical section for DPL supported devices */
32+
void dpl_leaveCSImpl(dpl_CSState key)
33+
{
34+
dpl_CSStateUnion * cu = (dpl_CSStateUnion *) &key;
35+
HwiP_restore((uint32_t) cu->each.hwikey);
36+
SwiP_restore((uint32_t) cu->each.swikey);
37+
}
38+
39+
/* Protected allocation */
40+
void * pvPortMalloc(size_t xWantedSize)
41+
{
42+
void * retVal = NULL;
43+
44+
dpl_CSState state;
45+
state = dpl_enterCSImpl();
46+
47+
retVal = bget(xWantedSize);
48+
49+
dpl_leaveCSImpl(state);
50+
return retVal;
51+
}
52+
53+
/* Protected Deallocation */
54+
void vPortFree(void * pv)
55+
{
56+
dpl_CSState state;
57+
state = dpl_enterCSImpl();
58+
59+
brel(pv);
60+
61+
dpl_leaveCSImpl(state);
62+
}
63+
64+
void * pvPortRealloc(void * pv, size_t size)
65+
{
66+
void * retVal = NULL;
67+
68+
dpl_CSState state;
69+
state = dpl_enterCSImpl();
70+
71+
retVal = bgetr(pv, size);
72+
73+
dpl_leaveCSImpl(state);
74+
return retVal;
75+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Protected allocation
2+
malloc/ICall_heapMalloc --> ti_heap_wrapper --> bget protected by critical section
3+
*/
4+
void * pvPortMalloc(size_t xWantedSize);
5+
6+
/* Protected Deallocation
7+
Free/ICall_heapFree --> ti_heap_wrapper --> brel protected by critical section
8+
*/
9+
void vPortFree(void * pv);
10+
void * pvPortRealloc(void * pv, size_t size);

0 commit comments

Comments
 (0)