Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_subdirectory(simplelink)
add_subdirectory(simplelink_lpf2)
add_subdirectory(simplelink_lpf3)
add_subdirectory(mspm0)
13 changes: 6 additions & 7 deletions simplelink/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
add_subdirectory(source/ti/devices)

if(CONFIG_SIMPLELINK_HOST_DRIVER)
zephyr_include_directories(
.
Expand All @@ -14,6 +12,8 @@ if(CONFIG_SIMPLELINK_HOST_DRIVER)
endif()

if(CONFIG_HAS_CC3220SDK)
add_subdirectory(source/ti/devices)

if(CONFIG_SIMPLELINK_HOST_DRIVER)
zephyr_library()
zephyr_library_compile_definitions(${COMPILER})
Expand Down Expand Up @@ -58,16 +58,13 @@ if(CONFIG_HAS_CC3220SDK)
PROPERTIES COMPILE_FLAGS -Wno-incompatible-pointer-types) # driver.c warns on incompatible-pointer-types
endif()

elseif(CONFIG_HAS_CC13X2_CC26X2_SDK OR CONFIG_HAS_CC13X2X7_CC26X2X7_SDK)
elseif(CONFIG_HAS_CC13X2_CC26X2_SDK)
add_subdirectory(source/ti/devices)

if(CONFIG_SOC_CC1352R OR CONFIG_SOC_CC1352P)
zephyr_compile_definitions(DeviceFamily_CC13X2 ${COMPILER})
elseif(CONFIG_SOC_CC1352R7 OR CONFIG_SOC_CC1352P7)
zephyr_compile_definitions(DeviceFamily_CC13X2X7 ${COMPILER})
elseif(CONFIG_SOC_CC2652R OR CONFIG_SOC_CC2652P)
zephyr_compile_definitions(DeviceFamily_CC26X2 ${COMPILER})
elseif(CONFIG_SOC_CC2652R7 OR CONFIG_SOC_CC2652P7)
zephyr_compile_definitions(DeviceFamily_CC26X2X7 ${COMPILER})
endif()

zephyr_include_directories(
Expand All @@ -93,6 +90,8 @@ elseif(CONFIG_HAS_CC13X2_CC26X2_SDK OR CONFIG_HAS_CC13X2X7_CC26X2X7_SDK)
)

elseif(CONFIG_HAS_MSP432P4XXSDK)
add_subdirectory(source/ti/devices)

zephyr_include_directories(
source
)
Expand Down
58 changes: 58 additions & 0 deletions simplelink_lpf2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
if(CONFIG_HAS_CC13X2X7_CC26X2X7_SDK)
if(CONFIG_SOC_CC1352R7 OR CONFIG_SOC_CC1352P7)
zephyr_compile_definitions(DeviceFamily_CC13X2X7 ${COMPILER})
elseif(CONFIG_SOC_CC2652R7 OR CONFIG_SOC_CC2652P7)
zephyr_compile_definitions(DeviceFamily_CC26X2X7 ${COMPILER})
endif()

zephyr_include_directories(
.
source
source/ti/devices/cc13x2x7_cc26x2x7
)

zephyr_library()
zephyr_library_sources(
# device driverlib files
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/setup.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/chipinfo.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/aux_sysif.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/prcm.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/osc.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/cpu.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/sys_ctrl.c

# PM
source/ti/drivers/power/PowerCC26X2.c
source/ti/drivers/power/PowerCC26X2_helpers.c
source/ti/drivers/power/PowerCC26X2_calibrateRCOSC.c
source/ti/drivers/power/PowerCC26X2_calibrateRCOSC_helpers.c
source/ti/drivers/utils/List.c
source/ti/drivers/rf/RFCC26X2_multiMode.c

# DPL
kernel/zephyr/dpl/ClockP_zephyr.c
kernel/zephyr/dpl/HwiP_zephyr.c
kernel/zephyr/dpl/SemaphoreP_zephyr.c
kernel/zephyr/dpl/SwiP_zephyr.c
kernel/zephyr/dpl/QueueP_zephyr.c
)

# Required for on-chip flash support
zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_CC13XX_CC26XX source/ti/devices/cc13x2x7_cc26x2x7/driverlib/flash.c)

# Required for IEEE 802.15.4 support
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX
source/ti/devices/cc13x2x7_cc26x2x7/rf_patches/rf_patch_cpe_multi_protocol.c
source/ti/devices/cc13x2x7_cc26x2x7/rf_patches/rf_patch_cpe_ieee_802_15_4.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/rfc.c
)

# Required for IEEE 802.15.4g support
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ
source/ti/devices/cc13x2x7_cc26x2x7/rf_patches/rf_patch_cpe_multi_protocol.c
source/ti/devices/cc13x2x7_cc26x2x7/driverlib/rfc.c
)

zephyr_library_sources_ifdef(CONFIG_ADC_CC13XX_CC26XX source/ti/devices/cc13x2x7_cc26x2x7/driverlib/aux_adc.c)
endif()
21 changes: 21 additions & 0 deletions simplelink_lpf2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Simplelink LPF2

This folder contains the low-level support required from the
Simplelink LPF2 SDK.

### Version

The current version of simplelink_lpf2 is based on
[Simplelink LPF2 8.31.00.11](https://github.com/TexasInstruments/simplelink-lowpower-f2-sdk).

## Contents

The folder-structure herein reflects the folder-structure in the
Simplelink SDK. All files required to support Zephyr have been copied
manually from the Simplelink SDK, with the exception of DPL files under
`kernel/zephyr/dpl`, which are original and maintained in this repository.

When updating to a new SDK, a comparison of the files in the 'devices'
and 'drivers' directories should be performed to pick up any new changes.

There is a simple helper script present to copy the relevant directories.
175 changes: 175 additions & 0 deletions simplelink_lpf2/kernel/zephyr/dpl/ClockP_zephyr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*
* Copyright (c) 2017, Texas Instruments Incorporated
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/kernel.h>
#include <ti/drivers/dpl/ClockP.h>

#define CLOCKP_TICK_PERIOD (USEC_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC);

/*
* ClockP_STRUCT_SIZE in ClockP.h must be updated to match the size of this
* struct
*/
typedef struct _ClockP_Obj {
struct k_timer timer;
ClockP_Fxn clock_fxn;
uintptr_t arg;
uint32_t timeout; /* in sys clock uptime ticks */
uint32_t period; /* in sys clock uptime ticks */
bool active;
} ClockP_Obj;

static ClockP_Params ClockP_defaultParams = {
.startFlag = false,
.period = 0,
.arg = 0,
};

static void expiry_fxn(struct k_timer *timer_id)
{
ClockP_Obj *obj = (ClockP_Obj *)k_timer_user_data_get(timer_id);

obj->clock_fxn(obj->arg);
}

/*
* ======== ClockP_construct ========
* @param timeout in sys clock uptime ticks
*/
ClockP_Handle ClockP_construct(ClockP_Struct *handle, ClockP_Fxn clockFxn,
uint32_t timeout, ClockP_Params *params)
{
ClockP_Obj *obj = (ClockP_Obj *)handle;

if (handle == NULL) {
return NULL;
}

if (params == NULL) {
params = &ClockP_defaultParams;
}

obj->clock_fxn = clockFxn;
obj->arg = params->arg;
obj->period = params->period;
obj->timeout = timeout;
obj->active = false;

k_timer_init(&obj->timer, expiry_fxn, NULL);
k_timer_user_data_set(&obj->timer, obj);

if (params->startFlag) {
ClockP_start(obj);
}

return ((ClockP_Handle)handle);
}

/*
* ======== ClockP_getSystemTickFreq ========
*/
inline uint32_t ClockP_getSystemTickFreq()
{
return CONFIG_SYS_CLOCK_TICKS_PER_SEC;
}

/*
* ======== ClockP_getSystemTickPeriod ========
*
* This implementation rounds the system tick period down by ~17250ppm
* which makes it useless for any precision timing. Use
* (timeUs * ClockP_getSystemTickFreq() for these purposes instead.
*/
inline uint32_t ClockP_getSystemTickPeriod()
{
return CLOCKP_TICK_PERIOD;
}

uint32_t ClockP_getSystemTicks()
{
/* may wrap */
return k_uptime_ticks();
}

/*
* ======== ClockP_Params_init ========
*/
void ClockP_Params_init(ClockP_Params *params)
{
params->arg = 0;
params->startFlag = false;
params->period = 0;
}

/*
* ======== ClockP_setTimeout ========
* @param timeout in sys clock uptime ticks
*/
void ClockP_setTimeout(ClockP_Handle handle, uint32_t timeout)
{
ClockP_Obj *obj = (ClockP_Obj *)handle;

obj->timeout = timeout;
}

/*
* ======== ClockP_start ========
*/
void ClockP_start(ClockP_Handle handle)
{
ClockP_Obj *obj = (ClockP_Obj *)handle;

k_timer_start(&obj->timer, K_TICKS(obj->timeout), K_TICKS(obj->period));
obj->active = true;
}

/*
* ======== ClockP_stop ========
*/
void ClockP_stop(ClockP_Handle handle)
{
ClockP_Obj *obj = (ClockP_Obj *)handle;

k_timer_stop(&obj->timer);
obj->active = false;
}

/*
* ======== ClockP_usleep ========
*/
void ClockP_usleep(uint32_t usec)
{
k_sleep(K_USEC(usec));
}

/*
* ======== ClockP_getTimeout ========
*/
uint32_t ClockP_getTimeout(ClockP_Handle handle) {
ClockP_Obj *obj = (ClockP_Obj *)handle;
return obj->active ? k_timer_remaining_ticks(&obj->timer) : obj->timeout;
}

/*
* ======== ClockP_isActive ========
*/
bool ClockP_isActive(ClockP_Handle handle) {
ClockP_Obj *obj = (ClockP_Obj *)handle;
return obj->active;
}

void ClockP_destruct(ClockP_Struct *clockP)
{
ClockP_Obj *obj = (ClockP_Obj *)clockP->data;

obj->clock_fxn = NULL;
obj->arg = 0;
obj->period = 0;
obj->timeout = 0;
obj->active = false;

k_timer_stop(&obj->timer);
}
Loading