Skip to content

Commit

Permalink
fixup! cpu/sam0_common: implement SERCOM time-sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed Nov 27, 2024
1 parent 30e5120 commit 25a530c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpu/samd21/include/periph_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ static inline int _sercom_id(SercomUsart *sercom)
return ((((uint32_t)sercom) >> 10) & 0x7) - 2;
}

/* these functions are documented in periph_cpu_common.h, but Doxygen
* is unable to connect the dots */
#if !DOXYGEN
static inline void sercom_apb_enable(sercom_t sercom)
{
PM->APBCMASK.reg |= (PM_APBCMASK_SERCOM0 << sercom);
Expand All @@ -111,6 +114,7 @@ static inline void sercom_gclk_enable(sercom_t sercom, uint8_t gclk)
(SERCOM0_GCLK_ID_CORE + sercom));
while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY) {}
}
#endif

/**
* @brief Pins that can be used for ADC input
Expand Down
4 changes: 4 additions & 0 deletions cpu/samd5x/include/periph_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ struct sam0_aux_cfg_mapping {
#define SAM0_SDHC1_PIN_SDCK GPIO_PIN(PA, 21) /**< Clock */
/** @} */

/* these functions are documented in periph_cpu_common.h, but Doxygen
* is unable to connect the dots */
#if !DOXYGEN
static inline void sercom_apb_enable(sercom_t sercom)
{
if (sercom < 2) {
Expand Down Expand Up @@ -326,6 +329,7 @@ static inline void sercom_gclk_enable(sercom_t sercom, uint8_t gclk)
{
GCLK->PCHCTRL[_sercom_gclk_id_core(sercom)].reg = (GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN(gclk));
}
#endif

#ifdef __cplusplus
}
Expand Down
4 changes: 4 additions & 0 deletions cpu/saml1x/include/periph_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ struct sam0_aux_cfg_mapping {
uint32_t user_crc; /**< CRC of NVM User Row bits 223:64 (words 2…6) */
};

/* these functions are documented in periph_cpu_common.h, but Doxygen
* is unable to connect the dots */
#if !DOXYGEN
static inline void sercom_apb_enable(sercom_t sercom)
{
MCLK->APBCMASK.reg |= (MCLK_APBCMASK_SERCOM0 << sercom);
Expand All @@ -169,6 +172,7 @@ static inline void sercom_gclk_enable(sercom_t sercom, uint8_t gclk)
{
GCLK->PCHCTRL[SERCOM0_GCLK_ID_CORE + sercom].reg = (GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN(gclk));
}
#endif

#ifdef __cplusplus
}
Expand Down
4 changes: 4 additions & 0 deletions cpu/saml21/include/periph_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ struct sam0_aux_cfg_mapping {
};
/** @} */

/* these functions are documented in periph_cpu_common.h, but Doxygen
* is unable to connect the dots */
#if !DOXYGEN
static inline void sercom_apb_enable(sercom_t sercom)
{
if (sercom < 5) {
Expand Down Expand Up @@ -198,6 +201,7 @@ static inline void sercom_gclk_enable(sercom_t sercom, uint8_t gclk)
GCLK->PCHCTRL[SERCOM5_GCLK_ID_CORE].reg = (GCLK_PCHCTRL_CHEN | GCLK_PCHCTRL_GEN(gclk));
}
}
#endif

#ifdef __cplusplus
}
Expand Down

0 comments on commit 25a530c

Please sign in to comment.