Skip to content

Commit df24e02

Browse files
asmellbyjhedberg
authored andcommitted
simplicity_sdk: Import HAL version 2025.6.1
Origin: Simplicity SDK License: Zlib URL: https://github.com/SiliconLabs/simplicity_sdk Commit: 4c4c7151c8a5953a6afc1e926c0bbb9e4e1893de Version: 2025.6.1 Purpose: HAL for Silicon Labs Series 2 devices Signed-off-by: Aksel Skauge Mellbye <[email protected]>
1 parent 8d896a6 commit df24e02

Some content is hidden

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

51 files changed

+1845
-941
lines changed

simplicity_sdk/platform/common/inc/sl_event_system.h

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "sl_status.h"
3838
#include "sl_enum.h"
3939
#include "sl_core.h"
40+
#include "sl_component_catalog.h"
4041

4142
#ifdef __cplusplus
4243
extern "C" {
@@ -86,6 +87,14 @@ extern "C" {
8687
* After consuming the event, the @sl_event_process function must be called for each
8788
* event instance. This will ensure that the memory and resources used by the event
8889
* data structure is properly deallocated.
90+
*
91+
* ## Supervisor Mode
92+
*
93+
* Supervisor mode allows users to subscribe to all events from all classes. There is an internal
94+
* queue that will receive all events published by any publisher. When a publisher is registered,
95+
* the supervisor queue will subscribe to it automatically. To get an event from the supervisor
96+
* queue, the user must call the function @ref sl_event_supervisor_queue_get.
97+
*
8998
* @{
9099
******************************************************************************/
91100

@@ -119,6 +128,7 @@ typedef struct {
119128
} sl_event_publisher_t;
120129

121130
typedef struct {
131+
sl_event_class_t event_class;
122132
sl_event_free_data_cb_t free_data_callback;
123133
uint8_t reference_count;
124134
void* event_data;
@@ -379,15 +389,82 @@ sl_status_t sl_event_alloc(sl_event_t **event);
379389
*
380390
* @note
381391
* Freeing an event structure that has not yet been processed by all
382-
* subscribers will
392+
* subscribers will result in undefined behavior.
383393
*
384-
* @param[in] event address of a pointer to an event struct
394+
* @param[in] event address of a pointer to an event struct.
385395
*
386396
* @return
387397
* SL_STATUS_OK if successful, otherwise an error code is returned.
388398
******************************************************************************/
389399
sl_status_t sl_event_free(sl_event_t *event);
390400

401+
#if defined(SL_CATALOG_EVENT_SYSTEM_SUPERVISOR_MODE_PRESENT)
402+
/*******************************************************************************
403+
* @brief
404+
* Get an event from the supervisor event queue.
405+
*
406+
* @param[out] event address of a pointer to an event struct.
407+
*
408+
* @return
409+
* SL_STATUS_OK if successful, otherwise an error code is returned.
410+
******************************************************************************/
411+
sl_status_t sl_event_supervisor_queue_get(sl_event_t **event);
412+
#endif
413+
414+
/*******************************************************************************
415+
* @brief
416+
* Initialize the IRQ event system.
417+
*
418+
* @description
419+
* This function initializes the IRQ event publisher to allow publishing events
420+
* from interrupt service routines. This must be called after sl_event_system_init().
421+
*
422+
* @param[in] event_queue Event queue to use for IRQ events.
423+
*
424+
* @return
425+
* SL_STATUS_OK if successful, otherwise an error code is returned.
426+
******************************************************************************/
427+
sl_status_t sl_event_irq_publisher_init(void);
428+
429+
/*******************************************************************************
430+
* @brief
431+
* De-initialize the IRQ event system.
432+
*
433+
* @return
434+
* SL_STATUS_OK if successful, otherwise an error code is returned.
435+
******************************************************************************/
436+
sl_status_t sl_event_irq_publisher_deinit(void);
437+
438+
/*******************************************************************************
439+
* @brief
440+
* Publish an event from an interrupt service routine (ISR).
441+
*
442+
* @details
443+
* This function should only be called from IRQ contexts to publish IRQ events to
444+
* subscribers of the IRQ event class.
445+
*
446+
* @param[in] irq_number The IRQ number associated with the event.
447+
*
448+
* @return
449+
* SL_STATUS_OK if successful, otherwise an error code is returned.
450+
*
451+
* @note
452+
* This function must only be called from IRQ contexts. For non-IRQ contexts,
453+
* use the standard event publishing mechanisms.
454+
******************************************************************************/
455+
sl_status_t sl_event_irq_publish(uint32_t irq_number);
456+
457+
/*******************************************************************************
458+
* @brief
459+
* Decode the IRQ event from a given event structure.
460+
*
461+
* @param[in] event Pointer to the event structure.
462+
*
463+
* @return
464+
* The decoded IRQ event, or 0xFFFFFFFF if the event is invalid.
465+
******************************************************************************/
466+
uint32_t sl_event_irq_decode(sl_event_t *event);
467+
391468
/** @} (end addtogroup event-system) */
392469

393470
#ifdef __cplusplus

simplicity_sdk/platform/emlib/src/em_eusart.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ static void EUSART_AsyncInitCommon(EUSART_TypeDef *eusart,
10671067
#endif /* EUSART_DALICFG_DALIEN */
10681068

10691069
// Enable EUSART IP.
1070-
EUSART_Enable(eusart, eusartEnable);
1070+
eusart->EN_SET = EUSART_EN_EN;
10711071

10721072
// Configure the baudrate if auto baud detection is not used.
10731073
if (init->baudrate) {
@@ -1222,13 +1222,8 @@ static void EUSART_SyncInitCommon(EUSART_TypeDef *eusart,
12221222
// Set baudrate for synchronous operation mode.
12231223
EUSART_BaudrateSet(eusart, init->refFreq, init->bitRate);
12241224

1225-
// Enable EUSART IP.
1226-
EUSART_Enable(eusart, eusartEnable);
1227-
12281225
// Finally enable the Rx and/or Tx channel (as specified).
1229-
eusart_sync(eusart, _EUSART_SYNCBUSY_RXEN_MASK | _EUSART_SYNCBUSY_TXEN_MASK); // Wait for low frequency register synchronization.
1230-
eusart->CMD = (uint32_t)init->enable;
1231-
eusart_sync(eusart, _EUSART_SYNCBUSY_RXEN_MASK | _EUSART_SYNCBUSY_TXEN_MASK);
1226+
EUSART_Enable(eusart, init->enable);
12321227
while (~EUSART_StatusGet(eusart) & (_EUSART_STATUS_RXIDLE_MASK | _EUSART_STATUS_TXIDLE_MASK)) {
12331228
}
12341229
}

simplicity_sdk/platform/peripheral/inc/sl_hal_burtc.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ typedef struct {
6464
bool compare0_top; ///< Set if Compare Value 0 is also top value (counter restart)
6565
bool em4_comparator; ///< Enable EM4 wakeup on compare match.
6666
bool em4_overflow; ///< Enable EM4 wakeup on counter overflow.
67-
} sl_hal_burtc_init_config_t;
67+
} sl_hal_burtc_init_t;
68+
69+
/** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
70+
// Typedef for configuration structure used for backward compatibility purposes.
71+
typedef sl_hal_burtc_init_t sl_hal_burtc_init_config_t;
72+
/** @endcond */
6873

6974
/*******************************************************************************
7075
************************** STRUCT INITIALIZERS ****************************
@@ -91,10 +96,10 @@ typedef struct {
9196
* @brief
9297
* Initialize the Back-Up RTC.
9398
*
94-
* @param[in] burtc_init
99+
* @param[in] init
95100
* A pointer to the initialization structure used to configure the BURTC.
96101
******************************************************************************/
97-
void sl_hal_burtc_init(const sl_hal_burtc_init_config_t *burtc_init);
102+
void sl_hal_burtc_init(const sl_hal_burtc_init_t *init);
98103

99104
/***************************************************************************//**
100105
* @brief
@@ -347,7 +352,7 @@ __INLINE void sl_hal_burtc_unlock(void)
347352
* void burtc_example(void)
348353
* {
349354
* // Initialize configuration structure with default settings
350-
* sl_hal_burtc_init_config_t init = SL_HAL_BURTC_INIT_DEFAULT;
355+
* sl_hal_burtc_init_t init = SL_HAL_BURTC_INIT_DEFAULT;
351356
*
352357
* // Initialize BURTC with default settings
353358
* sl_hal_burtc_init(&init);

simplicity_sdk/platform/peripheral/inc/sl_hal_dcdc_coulomb_counter.h

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,42 @@ SL_ENUM(sl_hal_dcdc_coulomb_counter_calibration_load_level_t) {
8080
typedef struct {
8181
uint16_t counter_threshold_em0; ///< Coulomb Counter Threshold in EM0.
8282
uint16_t counter_threshold_em2; ///< Coulomb Counter Threshold in EM2.
83-
} sl_hal_dcdc_coulomb_counter_config_t;
84-
85-
/// DCDC_COULOMB_COUNTER calibration configuration structure.
83+
} sl_hal_dcdc_coulomb_counter_init_t;
8684
typedef struct {
8785
CMU_Select_TypeDef reference_clk; ///< Coulomb Counter Calibration Reference Clock.
8886
int8_t cal_count; ///< Coulomb Counter Calibration Reference Count.
8987
sl_hal_dcdc_coulomb_counter_emode_t cal_emode; ///< Coulomb Counter Calibration Energy Mode.
9088
sl_hal_dcdc_coulomb_counter_calibration_load_level_t cal_load_level; ///< Coulomb Counter Calibration Power Load.
91-
} sl_hal_dcdc_coulomb_counter_calibration_config_t;
89+
} sl_hal_dcdc_coulomb_counter_calibration_init_t;
90+
91+
/** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
92+
// Typedef for configuration structure used for backward compatibility purposes.
93+
typedef sl_hal_dcdc_coulomb_counter_init_t sl_hal_dcdc_coulomb_counter_config_t;
94+
typedef sl_hal_dcdc_coulomb_counter_calibration_init_t sl_hal_dcdc_coulomb_counter_calibration_config_t;
95+
/** @endcond */
9296

9397
/// Suggested default values for DCDC_COULOMB_COUNTER configuration structure.
94-
#define DCDC_COULOMB_COUNTER_CONFIG_DEFAULT \
98+
#define SL_HAL_DCDC_COULOMB_COUNTER_INIT_DEFAULT \
9599
{ \
96100
0x8000, /* Coulomb Counter EM0 Threshold. */ \
97101
0x8000, /* Coulomb Counter EM2 Threshold. */ \
98102
}
99103

100104
/// Suggested default values for DCDC_COULOMB_COUNTER calibration configuration structure.
101-
#define DCDC_COULOMB_COUNTER_CALIBRATION_CONFIG_DEFAULT \
105+
#define SL_HAL_DCDC_COULOMB_COUNTER_CALIBRATION_INIT_DEFAULT \
102106
{ \
103107
cmuSelect_HFXO, /* Coulomb Counter Calibration Reference Clock. */ \
104108
8, /* Coulomb Counter Calibration Reference Count. */ \
105109
SL_HAL_DCDC_COULOMB_COUNTER_EM0, /* Coulomb Counter Calibration DC-DC energy mode. */ \
106110
SL_HAL_DCDC_COULOMB_COUNTER_CAL_LOAD3, /* Coulomb Counter Calibration Load. */ \
107111
}
108112

113+
/** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
114+
// Alias for deprecated macro names used for backward compatibility purposes.
115+
#define DCDC_COULOMB_COUNTER_CONFIG_DEFAULT SL_HAL_DCDC_COULOMB_COUNTER_INIT_DEFAULT
116+
#define DCDC_COULOMB_COUNTER_CALIBRATION_CONFIG_DEFAULT SL_HAL_DCDC_COULOMB_COUNTER_CALIBRATION_INIT_DEFAULT
117+
/** @endcond */
118+
109119
/*******************************************************************************
110120
***************************** PROTOTYPES **********************************
111121
******************************************************************************/
@@ -114,11 +124,11 @@ typedef struct {
114124
* @brief
115125
* Initializes DCDC_COULOMB_COUNTER module.
116126
*
117-
* @param[in] p_config
127+
* @param[in] init
118128
* A pointer to the DCDC_COULOMB_COUNTER initialization
119129
* structure variable.
120130
******************************************************************************/
121-
void sl_hal_dcdc_coulomb_counter_init(const sl_hal_dcdc_coulomb_counter_config_t *p_config);
131+
void sl_hal_dcdc_coulomb_counter_init(const sl_hal_dcdc_coulomb_counter_init_t *init);
122132

123133
/***************************************************************************//**
124134
* @brief
@@ -354,14 +364,14 @@ __STATIC_INLINE void sl_hal_dcdc_coulomb_counter_set_interrupts(uint32_t flags)
354364
* @brief
355365
* Initializes the calibration of the DCDC Coulomb Counter.
356366
*
357-
* @param[in] config
367+
* @param[in] init
358368
* DCDC_COULOMB_COUNTER calibration configuration structure.
359369
*
360370
* @note
361371
* The charge per pulse is measured using known on-chip calibration
362372
* loads, a PRS channel, and the CMU RC oscillator calibration circuitry.
363373
******************************************************************************/
364-
void sl_hal_dcdc_coulomb_counter_cal_init(sl_hal_dcdc_coulomb_counter_calibration_config_t config);
374+
void sl_hal_dcdc_coulomb_counter_cal_init(sl_hal_dcdc_coulomb_counter_calibration_init_t init);
365375

366376
/***************************************************************************//**
367377
* @brief
@@ -472,10 +482,10 @@ __STATIC_INLINE bool sl_hal_dcdc_coulomb_counter_calhalt_is_set(void)
472482
* @code{.c}
473483
* {
474484
* // Initialize with default configuration
475-
* sl_hal_dcdc_coulomb_counter_config_t config = DCDC_COULOMB_COUNTER_CONFIG_DEFAULT;
485+
* sl_hal_dcdc_coulomb_counter_init_t init = SL_HAL_DCDC_COULOMB_COUNTER_INIT_DEFAULT;
476486
*
477487
* // Initialize the coulomb counter
478-
* sl_hal_dcdc_coulomb_counter_init(&config);
488+
* sl_hal_dcdc_coulomb_counter_init(&init);
479489
*
480490
* // Enable the counter
481491
* sl_hal_dcdc_coulomb_counter_enable();
@@ -502,10 +512,10 @@ __STATIC_INLINE bool sl_hal_dcdc_coulomb_counter_calhalt_is_set(void)
502512
* sl_hal_dcdc_coulomb_counter_disable();
503513
*
504514
* // To calibrate the counter before use:
505-
* sl_hal_dcdc_coulomb_counter_calibration_config_t cal_config =
506-
* DCDC_COULOMB_COUNTER_CALIBRATION_CONFIG_DEFAULT;
515+
* sl_hal_dcdc_coulomb_counter_calibration_init_t cal_init =
516+
* SL_HAL_DCDC_COULOMB_COUNTER_CALIBRATION_INIT_DEFAULT;
507517
*
508-
* sl_hal_dcdc_coulomb_counter_cal_init(cal_config);
518+
* sl_hal_dcdc_coulomb_counter_cal_init(cal_init);
509519
* sl_hal_dcdc_coulomb_counter_cal_start();
510520
*
511521
* // After calibration is complete

0 commit comments

Comments
 (0)