Skip to content

Commit 5fa3ef0

Browse files
authored
feat(PeriphDrivers): Add MXC_TMR_SetClockSourceFreq API for timers (#1589)
Add a new MXC_TMR_SetClockSourceFreq API so that the timer frequency can be manually set when using external clock as timer clock source. Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
1 parent b381a47 commit 5fa3ef0

29 files changed

Lines changed: 204 additions & 2 deletions

File tree

Libraries/PeriphDrivers/Include/MAX32650/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
149149
*/
150150
void MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg);
151151

152+
/**
153+
* @brief Set the timer input clock frequency.
154+
* @param tmr Pointer to timer instance.
155+
* @param clksrc_freq Timer input clock frequency in Hz.
156+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no
157+
* effect on timer revisions without selectable clock sources.
158+
*/
159+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
160+
152161
/**
153162
* @brief Shutdown timer module clock.
154163
* @param tmr Pointer to timer module to shutdown.

Libraries/PeriphDrivers/Include/MAX32655/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
191191
*/
192192
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins);
193193

194+
/**
195+
* @brief Set the timer input clock frequency.
196+
* @param tmr Pointer to timer instance.
197+
* @param clksrc_freq Timer input clock frequency in Hz.
198+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
199+
* on timer revisions without selectable clock sources.
200+
*/
201+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
202+
194203
/**
195204
* @brief Shutdown timer module clock.
196205
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32657/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
189189
*/
190190
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins);
191191

192+
/**
193+
* @brief Set the timer input clock frequency.
194+
* @param tmr Pointer to timer instance.
195+
* @param clksrc_freq Timer input clock frequency in Hz.
196+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
197+
* on timer revisions without selectable clock sources.
198+
*/
199+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
200+
192201
/**
193202
* @brief Shutdown timer module clock.
194203
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32660/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
169169
*/
170170
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg);
171171

172+
/**
173+
* @brief Set the timer input clock frequency.
174+
* @param tmr Pointer to timer instance.
175+
* @param clksrc_freq Timer input clock frequency in Hz.
176+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
177+
* on timer revisions without selectable clock sources.
178+
*/
179+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
180+
172181
/**
173182
* @brief Shutdown timer module clock.
174183
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32662/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
194194
*/
195195
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins, sys_map_t pin_sel);
196196

197+
/**
198+
* @brief Set the timer input clock frequency.
199+
* @param tmr Pointer to timer instance.
200+
* @param clksrc_freq Timer input clock frequency in Hz.
201+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
202+
* on timer revisions without selectable clock sources.
203+
*/
204+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
205+
197206
/**
198207
* @brief Shutdown timer module clock.
199208
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32665/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
147147
*/
148148
void MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg);
149149

150+
/**
151+
* @brief Set the timer input clock frequency.
152+
* @param tmr Pointer to timer instance.
153+
* @param clksrc_freq Timer input clock frequency in Hz.
154+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no
155+
* effect on timer revisions without selectable clock sources.
156+
*/
157+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
158+
150159
/**
151160
* @brief Shutdown timer module clock.
152161
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32670/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
190190
*/
191191
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins);
192192

193+
/**
194+
* @brief Set the timer input clock frequency.
195+
* @param tmr Pointer to timer instance.
196+
* @param clksrc_freq Timer input clock frequency in Hz.
197+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
198+
* on timer revisions without selectable clock sources.
199+
*/
200+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
201+
193202
/**
194203
* @brief Shutdown timer module clock.
195204
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32672/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
190190
*/
191191
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins);
192192

193+
/**
194+
* @brief Set the timer input clock frequency.
195+
* @param tmr Pointer to timer instance.
196+
* @param clksrc_freq Timer input clock frequency in Hz.
197+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
198+
* on timer revisions without selectable clock sources.
199+
*/
200+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
201+
193202
/**
194203
* @brief Shutdown timer module clock.
195204
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32675/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
189189
*/
190190
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins);
191191

192+
/**
193+
* @brief Set the timer input clock frequency.
194+
* @param tmr Pointer to timer instance.
195+
* @param clksrc_freq Timer input clock frequency in Hz.
196+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
197+
* on timer revisions without selectable clock sources.
198+
*/
199+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
200+
192201
/**
193202
* @brief Shutdown timer module clock.
194203
* @param tmr Pointer to timer module to initialize.

Libraries/PeriphDrivers/Include/MAX32680/tmr.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ typedef void (*mxc_tmr_complete_t)(int error);
191191
*/
192192
int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins);
193193

194+
/**
195+
* @brief Set the timer input clock frequency.
196+
* @param tmr Pointer to timer instance.
197+
* @param clksrc_freq Timer input clock frequency in Hz.
198+
* @note Call this after selecting MXC_TMR_EXT_CLK on RevB timers. This API has no effect
199+
* on timer revisions without selectable clock sources.
200+
*/
201+
void MXC_TMR_SetClockSourceFreq(mxc_tmr_regs_t *tmr, int clksrc_freq);
202+
194203
/**
195204
* @brief Shutdown timer module clock.
196205
* @param tmr Pointer to timer module to initialize.

0 commit comments

Comments
 (0)