Skip to content

Commit 2a79f4a

Browse files
committed
Add simplelink_lpf2
- Since simplelink SDK for cc13x2_cc26x2 is seperate from other simplelink devices, make the folder seperate similar to lpf3 has. - Only cc13x2x7_cc26x2x7 supported right now since I can only test with BeagleConnect Freedom. - Version 8.31.00.11 Signed-off-by: Ayush Singh <[email protected]>
1 parent cc04902 commit 2a79f4a

File tree

900 files changed

+371505
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

900 files changed

+371505
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
add_subdirectory(simplelink)
2+
add_subdirectory(simplelink_lpf2)
23
add_subdirectory(simplelink_lpf3)
34
add_subdirectory(mspm0)

simplelink/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
add_subdirectory(source/ti/devices)
2-
31
if(CONFIG_SIMPLELINK_HOST_DRIVER)
42
zephyr_include_directories(
53
.
@@ -14,6 +12,8 @@ if(CONFIG_SIMPLELINK_HOST_DRIVER)
1412
endif()
1513

1614
if(CONFIG_HAS_CC3220SDK)
15+
add_subdirectory(source/ti/devices)
16+
1717
if(CONFIG_SIMPLELINK_HOST_DRIVER)
1818
zephyr_library()
1919
zephyr_library_compile_definitions(${COMPILER})
@@ -58,16 +58,13 @@ if(CONFIG_HAS_CC3220SDK)
5858
PROPERTIES COMPILE_FLAGS -Wno-incompatible-pointer-types) # driver.c warns on incompatible-pointer-types
5959
endif()
6060

61-
elseif(CONFIG_HAS_CC13X2_CC26X2_SDK OR CONFIG_HAS_CC13X2X7_CC26X2X7_SDK)
61+
elseif(CONFIG_HAS_CC13X2_CC26X2_SDK)
62+
add_subdirectory(source/ti/devices)
6263

6364
if(CONFIG_SOC_CC1352R OR CONFIG_SOC_CC1352P)
6465
zephyr_compile_definitions(DeviceFamily_CC13X2 ${COMPILER})
65-
elseif(CONFIG_SOC_CC1352R7 OR CONFIG_SOC_CC1352P7)
66-
zephyr_compile_definitions(DeviceFamily_CC13X2X7 ${COMPILER})
6766
elseif(CONFIG_SOC_CC2652R OR CONFIG_SOC_CC2652P)
6867
zephyr_compile_definitions(DeviceFamily_CC26X2 ${COMPILER})
69-
elseif(CONFIG_SOC_CC2652R7 OR CONFIG_SOC_CC2652P7)
70-
zephyr_compile_definitions(DeviceFamily_CC26X2X7 ${COMPILER})
7168
endif()
7269

7370
zephyr_include_directories(
@@ -93,6 +90,8 @@ elseif(CONFIG_HAS_CC13X2_CC26X2_SDK OR CONFIG_HAS_CC13X2X7_CC26X2X7_SDK)
9390
)
9491

9592
elseif(CONFIG_HAS_MSP432P4XXSDK)
93+
add_subdirectory(source/ti/devices)
94+
9695
zephyr_include_directories(
9796
source
9897
)

simplelink_lpf2/CMakeLists.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
if(CONFIG_HAS_CC13X2X7_CC26X2X7_SDK)
2+
if(CONFIG_SOC_CC1352R7 OR CONFIG_SOC_CC1352P7)
3+
zephyr_compile_definitions(DeviceFamily_CC13X2X7 ${COMPILER})
4+
elseif(CONFIG_SOC_CC2652R7 OR CONFIG_SOC_CC2652P7)
5+
zephyr_compile_definitions(DeviceFamily_CC26X2X7 ${COMPILER})
6+
endif()
7+
8+
zephyr_include_directories(
9+
.
10+
source
11+
source/ti/devices/cc13x2x7_cc26x2x7
12+
)
13+
14+
zephyr_library()
15+
zephyr_library_sources(
16+
# device driverlib files
17+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/setup.c
18+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/chipinfo.c
19+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/aux_sysif.c
20+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/prcm.c
21+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/osc.c
22+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/cpu.c
23+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/sys_ctrl.c
24+
25+
# PM
26+
source/ti/drivers/power/PowerCC26X2.c
27+
source/ti/drivers/power/PowerCC26X2_helpers.c
28+
source/ti/drivers/power/PowerCC26X2_calibrateRCOSC.c
29+
source/ti/drivers/power/PowerCC26X2_calibrateRCOSC_helpers.c
30+
source/ti/drivers/utils/List.c
31+
source/ti/drivers/rf/RFCC26X2_multiMode.c
32+
33+
# DPL
34+
kernel/zephyr/dpl/ClockP_zephyr.c
35+
kernel/zephyr/dpl/HwiP_zephyr.c
36+
kernel/zephyr/dpl/SemaphoreP_zephyr.c
37+
kernel/zephyr/dpl/SwiP_zephyr.c
38+
kernel/zephyr/dpl/QueueP_zephyr.c
39+
)
40+
41+
# Required for on-chip flash support
42+
zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_CC13XX_CC26XX source/ti/devices/cc13x2x7_cc26x2x7/driverlib/flash.c)
43+
44+
# Required for IEEE 802.15.4 support
45+
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX
46+
source/ti/devices/cc13x2x7_cc26x2x7/rf_patches/rf_patch_cpe_multi_protocol.c
47+
source/ti/devices/cc13x2x7_cc26x2x7/rf_patches/rf_patch_cpe_ieee_802_15_4.c
48+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/rfc.c
49+
)
50+
51+
# Required for IEEE 802.15.4g support
52+
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ
53+
source/ti/devices/cc13x2x7_cc26x2x7/rf_patches/rf_patch_cpe_multi_protocol.c
54+
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/rfc.c
55+
)
56+
57+
zephyr_library_sources_ifdef(CONFIG_ADC_CC13XX_CC26XX source/ti/devices/cc13x2x7_cc26x2x7/driverlib/aux_adc.c)
58+
endif()
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
* Copyright (c) 2017, Texas Instruments Incorporated
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/kernel.h>
8+
#include <ti/drivers/dpl/ClockP.h>
9+
10+
#define CLOCKP_TICK_PERIOD (USEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC);
11+
12+
/*
13+
* ClockP_STRUCT_SIZE in ClockP.h must be updated to match the size of this
14+
* struct
15+
*/
16+
typedef struct _ClockP_Obj {
17+
struct k_timer timer;
18+
ClockP_Fxn clock_fxn;
19+
uintptr_t arg;
20+
uint32_t timeout; /* in sys clock uptime ticks */
21+
uint32_t period; /* in sys clock uptime ticks */
22+
bool active;
23+
} ClockP_Obj;
24+
25+
static ClockP_Params ClockP_defaultParams = {
26+
.startFlag = false,
27+
.period = 0,
28+
.arg = 0,
29+
};
30+
31+
static void expiry_fxn(struct k_timer *timer_id)
32+
{
33+
ClockP_Obj *obj = (ClockP_Obj *)k_timer_user_data_get(timer_id);
34+
35+
obj->clock_fxn(obj->arg);
36+
}
37+
38+
/*
39+
* ======== ClockP_construct ========
40+
* @param timeout in sys clock uptime ticks
41+
*/
42+
ClockP_Handle ClockP_construct(ClockP_Struct *handle, ClockP_Fxn clockFxn,
43+
uint32_t timeout, ClockP_Params *params)
44+
{
45+
ClockP_Obj *obj = (ClockP_Obj *)handle;
46+
47+
if (handle == NULL) {
48+
return NULL;
49+
}
50+
51+
if (params == NULL) {
52+
params = &ClockP_defaultParams;
53+
}
54+
55+
obj->clock_fxn = clockFxn;
56+
obj->arg = params->arg;
57+
obj->period = params->period;
58+
obj->timeout = timeout;
59+
obj->active = false;
60+
61+
k_timer_init(&obj->timer, expiry_fxn, NULL);
62+
k_timer_user_data_set(&obj->timer, obj);
63+
64+
if (params->startFlag) {
65+
ClockP_start(obj);
66+
}
67+
68+
return ((ClockP_Handle)handle);
69+
}
70+
71+
/*
72+
* ======== ClockP_getSystemTickFreq ========
73+
*/
74+
inline uint32_t ClockP_getSystemTickFreq()
75+
{
76+
return CONFIG_SYS_CLOCK_TICKS_PER_SEC;
77+
}
78+
79+
/*
80+
* ======== ClockP_getSystemTickPeriod ========
81+
*
82+
* This implementation rounds the system tick period down by ~17250ppm
83+
* which makes it useless for any precision timing. Use
84+
* (timeUs * ClockP_getSystemTickFreq() for these purposes instead.
85+
*/
86+
inline uint32_t ClockP_getSystemTickPeriod()
87+
{
88+
return CLOCKP_TICK_PERIOD;
89+
}
90+
91+
uint32_t ClockP_getSystemTicks()
92+
{
93+
/* may wrap */
94+
return k_uptime_ticks();
95+
}
96+
97+
/*
98+
* ======== ClockP_Params_init ========
99+
*/
100+
void ClockP_Params_init(ClockP_Params *params)
101+
{
102+
params->arg = 0;
103+
params->startFlag = false;
104+
params->period = 0;
105+
}
106+
107+
/*
108+
* ======== ClockP_setTimeout ========
109+
* @param timeout in sys clock uptime ticks
110+
*/
111+
void ClockP_setTimeout(ClockP_Handle handle, uint32_t timeout)
112+
{
113+
ClockP_Obj *obj = (ClockP_Obj *)handle;
114+
115+
obj->timeout = timeout;
116+
}
117+
118+
/*
119+
* ======== ClockP_start ========
120+
*/
121+
void ClockP_start(ClockP_Handle handle)
122+
{
123+
ClockP_Obj *obj = (ClockP_Obj *)handle;
124+
125+
k_timer_start(&obj->timer, K_TICKS(obj->timeout), K_TICKS(obj->period));
126+
obj->active = true;
127+
}
128+
129+
/*
130+
* ======== ClockP_stop ========
131+
*/
132+
void ClockP_stop(ClockP_Handle handle)
133+
{
134+
ClockP_Obj *obj = (ClockP_Obj *)handle;
135+
136+
k_timer_stop(&obj->timer);
137+
obj->active = false;
138+
}
139+
140+
/*
141+
* ======== ClockP_usleep ========
142+
*/
143+
void ClockP_usleep(uint32_t usec)
144+
{
145+
k_sleep(K_USEC(usec));
146+
}
147+
148+
/*
149+
* ======== ClockP_getTimeout ========
150+
*/
151+
uint32_t ClockP_getTimeout(ClockP_Handle handle) {
152+
ClockP_Obj *obj = (ClockP_Obj *)handle;
153+
return obj->active ? k_timer_remaining_ticks(&obj->timer) : obj->timeout;
154+
}
155+
156+
/*
157+
* ======== ClockP_isActive ========
158+
*/
159+
bool ClockP_isActive(ClockP_Handle handle) {
160+
ClockP_Obj *obj = (ClockP_Obj *)handle;
161+
return obj->active;
162+
}
163+
164+
void ClockP_destruct(ClockP_Struct *clockP)
165+
{
166+
ClockP_Obj *obj = (ClockP_Obj *)clockP->data;
167+
168+
obj->clock_fxn = NULL;
169+
obj->arg = 0;
170+
obj->period = 0;
171+
obj->timeout = 0;
172+
obj->active = false;
173+
174+
k_timer_stop(&obj->timer);
175+
}

0 commit comments

Comments
 (0)