Skip to content

Commit 079bd29

Browse files
vmyklebustvaishnavachath
authored andcommitted
simplelink: update hal to LPF3 SDK 8.10.00.55
Update simplelink lpf3 hal to the simplelink LPF3 SDK version 8.10.00.55. Signed-off-by: Vebjorn Myklebust <[email protected]>
1 parent 2af164d commit 079bd29

Some content is hidden

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

61 files changed

+9519
-1471
lines changed

simplelink_lpf3/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if(CONFIG_HAS_CC23X0_SDK)
1919

2020
# Utils
2121
source/ti/drivers/utils/List.c
22+
source/ti/drivers/utils/Random.c
2223

2324
# Drivers
2425
source/ti/drivers/AESCCM.c
@@ -27,6 +28,7 @@ if(CONFIG_HAS_CC23X0_SDK)
2728
source/ti/drivers/AESCTRDRBG.c
2829
source/ti/drivers/AESECB.c
2930
source/ti/drivers/ECDH.c
31+
source/ti/drivers/RNG.c
3032
source/ti/drivers/aesccm/AESCCMLPF3.c
3133
source/ti/drivers/aescmac/AESCMACLPF3.c
3234
source/ti/drivers/aesctr/AESCTRLPF3.c
@@ -37,6 +39,7 @@ if(CONFIG_HAS_CC23X0_SDK)
3739
source/ti/drivers/cryptoutils/sharedresources/CryptoResourceLPF3.c
3840
source/ti/drivers/cryptoutils/utils/CryptoUtils.c
3941
source/ti/drivers/dma/UDMALPF3.c
42+
source/ti/drivers/rng/RNGLPF3RF.c
4043

4144
source/ti/drivers/Temperature.c
4245
source/ti/drivers/power/PowerCC23X0.c

simplelink_lpf3/kernel/zephyr/dpl/EventP_zephyr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ uint32_t EventP_pend(EventP_Handle event, uint32_t eventMask, bool waitForAll, u
101101
{
102102
uint32_t eventBits, tickPeriod;
103103
k_timeout_t eventTimeout;
104-
uint64_t timeUS;
105104

106105

107106
if (timeout == EventP_WAIT_FOREVER)

simplelink_lpf3/source/ti/devices/cc23x0r5/driverlib/ckmd.h

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -560,65 +560,77 @@ __STATIC_INLINE uint32_t CKMDGetTargetAmplitudeThresholdTrim(void)
560560

561561
//*****************************************************************************
562562
//
563-
//! \brief Gets the worst case LFOSC frequency jump due to RTN.
563+
//! \brief Gets the worst-case LFOSC frequency jump due to RTN.
564564
//!
565-
//! \return The absolute value of the worst case jump due to RTN in ppm.
565+
//! \return The absolute value of the worst-case jump due to RTN in ppm.
566566
//
567567
//*****************************************************************************
568568
__STATIC_INLINE uint_least16_t CKMDGetLfoscRtnPpm(void)
569569
{
570-
uint8_t ppmRtn = 0x14;
570+
// Only App trims revision 5 and newer has a ppmRtn field. For older
571+
// revisions use a default value of 20 (equivalent to 600ppm)
572+
uint8_t ppmRtn = 20;
571573
if (fcfg->appTrims.revision >= 0x5)
572574
{
573575
ppmRtn = fcfg->appTrims.cc23x0r5.lfOscParams.ppmRtn;
574576
}
577+
578+
// The ppmTempMid field uses units of 30ppm, convert to ppm
575579
return ppmRtn * 30;
576580
}
577581

578582
//*****************************************************************************
579583
//
580-
//! \brief Gets the the worst case LFOSC temperature coefficient in the "middle"
584+
//! \brief Gets the the worst-case LFOSC temperature coefficient in the "middle"
581585
//! temperature range.
582586
//!
583-
//! This function can be used to determine the the worst case LFOSC temperature
587+
//! This function can be used to determine the the worst-case LFOSC temperature
584588
//! coefficient in units of ppm/C in the temperature range [
585589
//! \ref CKMD_LFOSC_MID_TEMP_COEFFICIENT_RANGE_MIN,
586590
//! \ref CKMD_LFOSC_MID_TEMP_COEFFICIENT_RANGE_MAX ].
587591
//!
588-
//! \return The absolute value of worst case temperature coefficient in ppm/C.
592+
//! \return The absolute value of worst-case temperature coefficient in ppm/C.
589593
//
590594
//*****************************************************************************
591595
__STATIC_INLINE uint_least16_t CKMDGetLfoscMidTempCoefficientPpmPerC(void)
592596
{
593-
uint8_t ppmTempMid = 0x14;
597+
// Only App trims revision 5 and newer has a ppmTempMid field. For older
598+
// revisions use a default value of 20 (equivalent to 260ppm/C)
599+
uint8_t ppmTempMid = 20;
594600
if (fcfg->appTrims.revision >= 0x5)
595601
{
596602
ppmTempMid = fcfg->appTrims.cc23x0r5.lfOscParams.ppmTempMid;
597603
}
604+
605+
// The ppmTempMid field uses units of 13ppm/C, convert to ppm/C
598606
return ppmTempMid * 13;
599607
}
600608

601609
//*****************************************************************************
602610
//
603-
//! \brief Gets the the worst case LFOSC temperature coefficient in the
611+
//! \brief Gets the the worst-case LFOSC temperature coefficient in the
604612
//! "extended" temperature range.
605613
//!
606-
//! This function can be used to determine the the worst case LFOSC temperature
614+
//! This function can be used to determine the the worst-case LFOSC temperature
607615
//! coefficient in units of ppm/C when the temperature is outside of the
608616
//! temperature range [
609617
//! \ref CKMD_LFOSC_MID_TEMP_COEFFICIENT_RANGE_MIN,
610618
//! \ref CKMD_LFOSC_MID_TEMP_COEFFICIENT_RANGE_MAX ].
611619
//!
612-
//! \return The absolute value of worst case temperature coefficient in ppm/C.
620+
//! \return The absolute value of worst-case temperature coefficient in ppm/C.
613621
//
614622
//*****************************************************************************
615623
__STATIC_INLINE uint_least16_t CKMDGetLfoscExtTempCoefficientPpmPerC(void)
616624
{
617-
uint8_t ppmTempExt = 0x14;
625+
// Only App trims revision 5 and newer has a ppmTempExt field. For older
626+
// revisions use a default value of 20 (equivalent to 700ppm/C)
627+
uint8_t ppmTempExt = 20;
618628
if (fcfg->appTrims.revision >= 0x5)
619629
{
620630
ppmTempExt = fcfg->appTrims.cc23x0r5.lfOscParams.ppmTempExt;
621631
}
632+
633+
// The ppmTempExt field uses units of 35ppm/C, convert to ppm/C
622634
return ppmTempExt * 35;
623635
}
624636

simplelink_lpf3/source/ti/devices/cc23x0r5/driverlib/cpu.c

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Description: Instruction wrappers for special CPU instructions needed by
55
* the drivers.
66
*
7-
* Copyright (c) 2022 Texas Instruments Incorporated
7+
* Copyright (c) 2022-2023 Texas Instruments Incorporated
88
*
99
* Redistribution and use in source and binary forms, with or without
1010
* modification, are permitted provided that the following conditions are met:
@@ -57,41 +57,36 @@ void CPUDelay(uint32_t count)
5757
#pragma diag_suppress = Pe940
5858
}
5959
#pragma diag_default = Pe940
60-
61-
#elif defined(__TI_COMPILER_VERSION__)
62-
// For CCS implement this function in pure assembly. This prevents the TI
63-
// compiler from doing funny things with the optimizer.
64-
65-
// Loop the specified number of times
66-
__asm(" .sect \".text:CPUDelay\"\n"
67-
" .clink\n"
68-
" .thumbfunc CPUDelay\n"
69-
" .thumb\n"
70-
" .global CPUDelay\n"
71-
"CPUDelay:\n"
72-
" subs r0, #1\n"
73-
" bne.n CPUDelay\n"
74-
" bx lr\n");
75-
7660
#elif defined(__clang__)
77-
void CPUDelay(uint32_t count)
61+
void __attribute__((naked)) CPUDelay(uint32_t count)
7862
{
79-
(void)count; // Linter does not see the use of r0 in asm.
80-
// Loop the specified number of times
81-
__asm(" subs r0, #1\n"
82-
" bne.n CPUDelay\n"
83-
" bx lr");
63+
// Loop the specified number of times.
64+
// The naked attribute tells the compiler that the function is effectively
65+
// hand-coded assembly implemented using inlined assembly without operands.
66+
// As such, it assumes that the C calling conventions are obeyed, and we can
67+
// assume count is in R0.
68+
__asm volatile("CPUdel%=:\n"
69+
" subs r0, #1\n"
70+
" bne CPUdel%=\n"
71+
" bx lr\n"
72+
: /* No output */
73+
: /* No input */
74+
: "r0", "cc" /* Clobbers. "cc" is the flags */
75+
);
8476
}
85-
#else
86-
// GCC
77+
#elif defined(__GNUC__)
8778
void __attribute__((naked)) CPUDelay(uint32_t count)
8879
{
8980
// Loop the specified number of times
9081
__asm volatile(".syntax unified\n"
91-
"%=: subs %0, #1\n"
92-
" bne %=b\n"
93-
" bx lr\n"
94-
: /* No output */
95-
: "r"(count));
82+
"CPUdel%=:\n"
83+
" subs %0, #1\n"
84+
" bne CPUdel%=\n"
85+
" bx lr\n"
86+
: /* No output */
87+
: "r"(count) /* Input */
88+
);
9689
}
90+
#else
91+
#error "Unsupported toolchain!"
9792
#endif

simplelink_lpf3/source/ti/devices/cc23x0r5/driverlib/cpu.h

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Description: Defines and prototypes for the CPU instruction wrapper
55
* functions.
66
*
7-
* Copyright (c) 2022 Texas Instruments Incorporated
7+
* Copyright (c) 2022-2023 Texas Instruments Incorporated
88
*
99
* Redistribution and use in source and binary forms, with or without
1010
* modification, are permitted provided that the following conditions are met:
@@ -69,31 +69,25 @@ extern "C" {
6969
//
7070
//! \brief Provide a small non-zero delay using a simple loop counter.
7171
//!
72-
//! This function provides means for generating a constant length delay. It
73-
//! is written in assembly to keep the delay consistent across tool chains,
72+
//! This function provides means for generating a constant length delay. It is
73+
//! written in assembly to keep the delay consistent across tool chains,
7474
//! avoiding the need to tune the delay based on the tool chain in use.
7575
//!
76-
//! \note It is not recommended using this function for long delays.
77-
//!
78-
//! Notice that interrupts can affect the delay if not manually disabled in advance.
79-
//!
80-
//! The delay depends on where code resides and the path for code fetching:
81-
//! - Code in flash, cache enabled, prefetch enabled : 4 cycles per loop (Default)
82-
//! - Code in flash, cache enabled, prefetch disabled : 5 cycles per loop
83-
//! - Code in flash, cache disabled : 7 cycles per loop
84-
//! - Code in SRAM : 6 cycles per loop
85-
//! - Code in GPRAM : 3 cycles per loop
76+
//! \note It is not recommended using this function for long delays. For longer
77+
//! delays, consider using ROM function \ref HapiWaitUs().
8678
//!
8779
//! \note If using an RTOS, consider using RTOS provided delay functions because
8880
//! these will not block task scheduling and will potentially save power.
8981
//!
90-
//! Calculate delay count based on the wanted delay in microseconds (us):
91-
//! - count = [delay in us] * [CPU clock in MHz] / [cycles per loop]
82+
//! \note Interrupts can affect the delay if not manually disabled in advance.
83+
//!
84+
//! \note The delay depends on where code resides and the path for code
85+
//! fetching, consider using ROM function \ref HapiWaitUs().
9286
//!
93-
//! Example: 250 us delay with code in flash and with cache and prefetch enabled:
94-
//! - count = 250 * 48 / 4 = 3000
87+
//! \param count is the number of delay loop iterations to perform. Number must
88+
//! be greater than zero.
9589
//!
96-
//! \param count is the number of delay loop iterations to perform. Number must be greater than zero.
90+
//! \sa HapiWaitUs()
9791
//!
9892
//! \return None
9993
//

simplelink_lpf3/source/ti/devices/cc23x0r5/driverlib/hapi.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ typedef struct
8686
// 16: SHA256: Round constants
8787
const uint32_t (*sha256SW_K256)[64];
8888
// 17: SHA256: Initial constants
89-
const uint32_t (*sha256SW_initialDigest256)[8];
89+
const uint32_t (*sha256Sw_initialDigest256)[8];
9090
// 18: Busy loop that waits for nUs microseconds
9191
void (*waitUs)(uint32_t nUs);
9292
// 19: Count leading zeros
@@ -456,13 +456,13 @@ typedef struct
456456
#define HapiResetDevice() HAPI_TABLE_POINTER->resetDevice()
457457

458458
// HAPI entry used for internal purposes
459-
#define HapiSha256SWProcessBlock(d, w) HAPI_TABLE_POINTER->pSHA256SWProcessBlock((d), (w))
459+
#define HapiSha256SwProcessBlock(d, w) HAPI_TABLE_POINTER->sha256SwProcessBlock((d), (w))
460460

461461
// HAPI entry used for internal purposes
462-
#define HapiSha256SW_K256 (*HAPI_TABLE_POINTER->sha256SW_K256)
462+
#define HapiSha256Sw_K256 (*HAPI_TABLE_POINTER->sha256SW_K256)
463463

464464
// HAPI entry used for internal purposes
465-
#define HapiSha256SW_initialDigest256 (*HAPI_TABLE_POINTER->sha256SW_initialDigest256)
465+
#define HapiSha256Sw_initialDigest256 (*HAPI_TABLE_POINTER->sha256Sw_initialDigest256)
466466

467467
// void HapiWaitUs(uint32_t nUs)
468468
/*****************************************************************************

simplelink_lpf3/source/ti/devices/cc23x0r5/driverlib/lrfd.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Description: Driver for LRFD
55
*
6-
* Copyright (c) 2023 Texas Instruments Incorporated
6+
* Copyright (c) 2023-2024 Texas Instruments Incorporated
77
*
88
* Redistribution and use in source and binary forms, with or without
99
* modification, are permitted provided that the following conditions are met:
@@ -44,7 +44,6 @@
4444
#include "../driverlib/interrupt.h"
4545

4646
static uint16_t lrfdClockDependencySets[LRFD_NUM_CLK_DEP];
47-
static bool lrfdClocked = false;
4847

4948
//*****************************************************************************
5049
//
@@ -81,21 +80,23 @@ void LRFDReleaseClockDependency(uint16_t mask, uint8_t dependencySetId)
8180
//*****************************************************************************
8281
void LRFDApplyClockDependencies(void)
8382
{
84-
uint16_t clkctl = 0;
83+
uint16_t clkctl = 0;
84+
bool lrfdClocked = (HWREG(CLKCTL_BASE + CLKCTL_O_CLKCFG0) & CLKCTL_CLKCFG0_LRFD_M) == CLKCTL_CLKCFG0_LRFD_CLK_EN;
8585
for (int i = 0; i < LRFD_NUM_CLK_DEP; i++)
8686
{
8787
clkctl |= lrfdClockDependencySets[i];
8888
}
8989

9090
if (lrfdClocked)
9191
{
92-
/* BRIDGE bit should not be needed, as hardware will automatically enable the clock when
93-
needed. The bit should be always be 0 in the HW, and is thus cleared. */
92+
// BRIDGE bit should not be needed, as hardware will automatically
93+
// enable the clock when needed. The bit should be always be 0 in the
94+
// HW, and is thus cleared.
9495
HWREG(LRFDDBELL_BASE + LRFDDBELL_O_CLKCTL) = clkctl & ~LRFDDBELL_CLKCTL_BRIDGE_M;
9596

9697
if (clkctl == 0)
9798
{
98-
/* Disable LRFD module clock */
99+
// Disable LRFD module clock
99100
HWREG( CLKCTL_BASE + CLKCTL_O_CLKENCLR0 ) = CLKCTL_CLKENCLR0_LRFD;
100101
lrfdClocked = false;
101102
}
@@ -104,14 +105,19 @@ void LRFDApplyClockDependencies(void)
104105
{
105106
if (clkctl != 0)
106107
{
107-
/* Enable LRFD module clock */
108+
// Enable LRFD module clock
108109
HWREG( CLKCTL_BASE + CLKCTL_O_CLKENSET0 ) = CLKCTL_CLKENSET0_LRFD;
109-
lrfdClocked = true;
110110

111-
/* BRIDGE bit should not be needed, as hardware will automatically enable the clock when
112-
needed. The bit should be always be 0 in the HW, and is thus cleared. The bit can be
113-
used in the input to indicate the need for the LRFD module clock to be enabled, but no
114-
internal LRFD clocks. */
111+
// Wait for LRFD clock to be enabled. It is not expected that the
112+
// LRFD clock will ever not be enabled, but this will add sufficient
113+
// delay before enabling the internal LRFD clocks below.
114+
while ((HWREG(CLKCTL_BASE + CLKCTL_O_CLKCFG0) & CLKCTL_CLKCFG0_LRFD_M) != CLKCTL_CLKCFG0_LRFD_CLK_EN) {}
115+
116+
// BRIDGE bit should not be needed, as hardware will automatically
117+
// enable the clock when needed. The bit should be always be 0 in
118+
// the HW, and is thus cleared. The bit can be used in the input to
119+
// indicate the need for the LRFD module clock to be enabled, but no
120+
// internal LRFD clocks.
115121
HWREG(LRFDDBELL_BASE + LRFDDBELL_O_CLKCTL) = clkctl & ~LRFDDBELL_CLKCTL_BRIDGE_M;
116122
}
117123
}

0 commit comments

Comments
 (0)