Skip to content
Closed
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
2 changes: 2 additions & 0 deletions mcux/mcux-sdk-ng/devices/MCX/MCXA/MCXA266/MCXA266_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@
#define FSL_FEATURE_RTC_HAS_NO_CR_SUP (1)
/* @brief Has no oscillator enable bit (CR). */
#define FSL_FEATURE_RTC_HAS_NO_CR_OSCE (1)
/* @brief Has clock output (bitfield CR[CLKO]). */
#define FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT (0)

/* SPC module features */

Expand Down
2 changes: 2 additions & 0 deletions mcux/mcux-sdk-ng/devices/MCX/MCXA/MCXA345/MCXA345_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@
#define FSL_FEATURE_RTC_HAS_NO_CR_SUP (1)
/* @brief Has no oscillator enable bit (CR). */
#define FSL_FEATURE_RTC_HAS_NO_CR_OSCE (1)
/* @brief Has clock output (bitfield CR[CLKO]). */
#define FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT (0)

/* SPC module features */

Expand Down
2 changes: 2 additions & 0 deletions mcux/mcux-sdk-ng/devices/MCX/MCXA/MCXA346/MCXA346_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@
#define FSL_FEATURE_RTC_HAS_NO_CR_SUP (1)
/* @brief Has no oscillator enable bit (CR). */
#define FSL_FEATURE_RTC_HAS_NO_CR_OSCE (1)
/* @brief Has clock output (bitfield CR[CLKO]). */
#define FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT (0)

/* SPC module features */

Expand Down
2 changes: 2 additions & 0 deletions mcux/mcux-sdk-ng/devices/MCX/MCXA/MCXA366/MCXA366_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,8 @@
#define FSL_FEATURE_RTC_HAS_NO_CR_SUP (1)
/* @brief Has no oscillator enable bit (CR). */
#define FSL_FEATURE_RTC_HAS_NO_CR_OSCE (1)
/* @brief Has clock output (bitfield CR[CLKO]). */
#define FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT (0)

/* SPC module features */

Expand Down
6 changes: 3 additions & 3 deletions mcux/mcux-sdk-ng/drivers/caam/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2024 NXP
# Copyright 2024-2025 NXP
#
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_MCUX_COMPONENT_driver.caam)
mcux_component_version(2.3.2)
mcux_component_version(2.4.0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Holt-Sun, I remember that updating the caam driver to the latest SDK version (2.4.0) will cause the RT1170/1160 network samples run fail. Did you copy it directly from the SDK or did you add a patch for caam?


mcux_add_source(SOURCES fsl_caam.c fsl_caam.h)

mcux_add_include(INCLUDES .)

mcux_add_configuration(CC "-DCRYPTO_USE_DRIVER_CAAM -DCACHE_MODE_WRITE_THROUGH=1")
mcux_add_macro("-DCRYPTO_USE_DRIVER_CAAM -DCACHE_MODE_WRITE_THROUGH=1")

endif()
2,177 changes: 1,953 additions & 224 deletions mcux/mcux-sdk-ng/drivers/caam/fsl_caam.c

Large diffs are not rendered by default.

1,123 changes: 1,105 additions & 18 deletions mcux/mcux-sdk-ng/drivers/caam/fsl_caam.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mcux/mcux-sdk-ng/drivers/rtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_MCUX_COMPONENT_driver.rtc)
mcux_component_version(2.3.3)
mcux_component_version(2.4.0)

mcux_add_source(SOURCES fsl_rtc.c fsl_rtc.h)

Expand Down
46 changes: 45 additions & 1 deletion mcux/mcux-sdk-ng/drivers/rtc/fsl_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ static uint32_t RTC_ConvertDatetimeToSeconds(const rtc_datetime_t *datetime)
* represented in the hours, minutes and seconds field*/
seconds += ((uint32_t)datetime->day - 1U);
/* For leap year if month less than or equal to Febraury, decrement day counter*/
/*
* $Branch Coverage Justification$
* ((0U == (datetime->year & 3U)) && (datetime->month <= 2U) && 0U == seconds) cannot be covered, when it is leap year(>1970), the seconds cannot be 0U
*/
if ((0U == (datetime->year & 3U)) && (datetime->month <= 2U) && 0U != seconds)
{
seconds--;
Expand Down Expand Up @@ -248,13 +252,19 @@ void RTC_Init(RTC_Type *base, const rtc_config_t *config)
reg &= ~(RTC_CR_WPS_MASK);
reg |= RTC_CR_WPS(config->wakeupSelect ? 1U : 0U);
#endif /* FSL_FEATURE_RTC_HAS_WAKEUP_PIN */

#if !(defined(FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT) && FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT == 0)
reg &= ~RTC_CR_CLKO_MASK;
reg |= RTC_CR_CLKO(config->clockOutput ? 1U : 0U);
#endif /* FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT */

base->CR = reg;

/* Configure the RTC time compensation register */
base->TCR = (RTC_TCR_CIR(config->compensationInterval) | RTC_TCR_TCR(config->compensationTime));

#if defined(FSL_FEATURE_RTC_HAS_TSIC) && FSL_FEATURE_RTC_HAS_TSIC
/* Configure RTC timer seconds interrupt to be generated once per second */
/* Configure RTC timer seconds interrupt to be generated once per second and disable the interrupt */
base->IER &= ~(RTC_IER_TSIC_MASK | RTC_IER_TSIE_MASK);
#endif
}
Expand All @@ -279,6 +289,10 @@ void RTC_GetDefaultConfig(rtc_config_t *config)
/* Initializes the configure structure to zero. */
(void)memset(config, 0, sizeof(*config));

#if !(defined(FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT) && FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT == 0)
/* Clock output is disabled by default */
config->clockOutput = false;
#endif /* FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT */
/* Wakeup pin will assert if the RTC interrupt asserts or if the wakeup pin is turned on */
config->wakeupSelect = false;
/* Registers cannot be written when locked */
Expand Down Expand Up @@ -902,3 +916,33 @@ status_t RTC_IncrementMonotonicCounter(RTC_Type *base)
}

#endif /* FSL_FEATURE_RTC_HAS_MONOTONIC */

#if defined(FSL_FEATURE_RTC_HAS_TSIC) && FSL_FEATURE_RTC_HAS_TSIC

/*!
* brief Sets the RTC timer seconds interrupt frequency.
*
* This function sets the RTC timer seconds interrupt frequency.
*
* param base RTC peripheral base address
* param freq The timer seconds interrupt frequency. This is a member of the
* enumeration ::rtc_timer_seconds_interrupt_frequency_t
*/
void RTC_SetTimerSecondsInterruptFrequency(RTC_Type *base, rtc_timer_seconds_interrupt_frequency_t freq)
{
assert(freq < kRTC_TimerSecondsFrequency128Hz);
uint32_t reg = base->IER;

reg &= ~(RTC_IER_TSIC_MASK);
reg |= RTC_IER_TSIC(freq);

/* Enable the timer seconds interrupt if not enabled */
if ((reg & RTC_IER_TSIE_MASK) != 0U)
{
reg |= RTC_IER_TSIE_MASK;
}

base->IER = reg;
}

#endif /* FSL_FEATURE_RTC_HAS_TSIC */
63 changes: 61 additions & 2 deletions mcux/mcux-sdk-ng/drivers/rtc/fsl_rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/*! @name Driver version */
/*! @{ */
#define FSL_RTC_DRIVER_VERSION (MAKE_VERSION(2, 3, 3)) /*!< Version 2.3.3 */
#define FSL_RTC_DRIVER_VERSION (MAKE_VERSION(2, 4, 0)) /*!< Version 2.4.0 */
/*! @} */

/*! @brief List of RTC interrupts */
Expand Down Expand Up @@ -86,9 +86,25 @@ typedef enum _rtc_osc_cap_load
kRTC_Capacitor_8p = RTC_CR_SC8P_MASK, /*!< 8 pF capacitor load */
kRTC_Capacitor_16p = RTC_CR_SC16P_MASK /*!< 16 pF capacitor load */
} rtc_osc_cap_load_t;

#endif /* FSL_FEATURE_SCG_HAS_OSC_SCXP */

#if defined(FSL_FEATURE_RTC_HAS_TSIC) && FSL_FEATURE_RTC_HAS_TSIC

/*! @brief List of RTC Timer Seconds Interrupt Frequencies */
typedef enum _rtc_timer_seconds_interrupt_frequency
{
kRTC_TimerSecondsFrequency1Hz = 0U, /*!< Timer seconds frequency is 1Hz */
kRTC_TimerSecondsFrequency2Hz = 1U, /*!< Timer seconds frequency is 2Hz */
kRTC_TimerSecondsFrequency4Hz = 2U, /*!< Timer seconds frequency is 4Hz */
kRTC_TimerSecondsFrequency8Hz = 3U, /*!< Timer seconds frequency is 8Hz */
kRTC_TimerSecondsFrequency16Hz = 4U, /*!< Timer seconds frequency is 16Hz */
kRTC_TimerSecondsFrequency32Hz = 5U, /*!< Timer seconds frequency is 32Hz */
kRTC_TimerSecondsFrequency64Hz = 6U, /*!< Timer seconds frequency is 64Hz */
kRTC_TimerSecondsFrequency128Hz = 7U /*!< Timer seconds frequency is 128Hz */
} rtc_timer_seconds_interrupt_frequency_t;

#endif /* FSL_FEATURE_RTC_HAS_TSIC */

/*! @brief Structure is used to hold the date and time */
typedef struct _rtc_datetime
{
Expand Down Expand Up @@ -132,6 +148,11 @@ typedef struct _rtc_pin_config
*/
typedef struct _rtc_config
{
#if !(defined(FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT) && FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT == 0)
bool clockOutput; /*!< true: The 32 kHz clock is not output to other
peripherals; false: The 32 kHz clock is output to other
peripherals */
#endif /* FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT */
bool wakeupSelect; /*!< true: Wakeup pin outputs the 32 KHz clock;
false:Wakeup pin used to wakeup the chip */
bool updateMode; /*!< true: Registers can be written even when locked under certain
Expand Down Expand Up @@ -190,6 +211,7 @@ static inline void RTC_Deinit(RTC_Type *base)
*
* The default values are as follows.
* @code
* config->clockOutput = false;
* config->wakeupSelect = false;
* config->updateMode = false;
* config->supervisorAccess = false;
Expand Down Expand Up @@ -541,6 +563,43 @@ static inline void RTC_EnableWakeUpPin(RTC_Type *base, bool enable)
}
#endif

#if !(defined(FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT) && FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT == 0)
/*!
* @brief Enables or disables the RTC 32 kHz clock output.
*
* This function enables or disables the RTC 32 kHz clock output.
*
* @param base RTC_Type base pointer.
* @param enable true to enable, false to disable.
*/
static inline void RTC_EnableClockOutput(RTC_Type *base, bool enable)
{
if (enable)
{
base->CR |= RTC_CR_CLKO_MASK;
}
else
{
base->CR &= ~RTC_CR_CLKO_MASK;
}
}
#endif /* FSL_FEATURE_RTC_HAS_CLOCK_OUTPUT */

#if defined(FSL_FEATURE_RTC_HAS_TSIC) && FSL_FEATURE_RTC_HAS_TSIC

/*!
* @brief Sets the RTC timer seconds interrupt frequency.
*
* This function sets the RTC timer seconds interrupt frequency.
*
* @param base RTC peripheral base address
* @param freq The timer seconds interrupt frequency. This is a member of the
* enumeration ::rtc_timer_seconds_interrupt_frequency_t
*/
void RTC_SetTimerSecondsInterruptFrequency(RTC_Type *base, rtc_timer_seconds_interrupt_frequency_t freq);

#endif /* FSL_FEATURE_RTC_HAS_TSIC */

#if defined(__cplusplus)
}
#endif
Expand Down