Fixes to the ST tick mode.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14120 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
f09e1976b2
commit
dbb6d05322
|
@ -105,6 +105,8 @@
|
|||
#define port_timer_get_time() stGetCounter()
|
||||
|
||||
#else
|
||||
#define port_timer_enable(oip) stBind()
|
||||
#define port_timer_disable(oip)
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -114,12 +116,15 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void stBind(void);
|
||||
#if CH_CFG_ST_TIMEDELTA > 0
|
||||
void stBindAlarmN(unsigned alarm);
|
||||
void stStartAlarmN(unsigned alarm, systime_t time);
|
||||
void stStopAlarmN(unsigned alarm);
|
||||
void stSetAlarmN(unsigned alarm, systime_t time);
|
||||
systime_t stGetAlarmN(unsigned alarm);
|
||||
systime_t stGetCounter(void);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -68,11 +68,11 @@ extern st_callback_t st_callbacks[ST_LLD_NUM_ALARMS];
|
|||
extern "C" {
|
||||
#endif
|
||||
void stInit(void);
|
||||
#if defined(ST_LLD_MULTICORE_SUPPORT)
|
||||
void stBind(void);
|
||||
#endif
|
||||
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
|
||||
systime_t stGetCounter(void);
|
||||
#if defined(ST_LLD_MULTICORE_SUPPORT)
|
||||
void stBindAlarm(void);
|
||||
#endif
|
||||
void stStartAlarm(systime_t abstime);
|
||||
void stStopAlarm(void);
|
||||
void stSetAlarm(systime_t abstime);
|
||||
|
@ -94,7 +94,6 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* HAL_ST_H */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -55,12 +55,16 @@ typedef struct {
|
|||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if (OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING) || defined(__DOXYGEN__)
|
||||
#if (ST_LLD_NUM_ALARMS > 1) || defined(__DOXYGEN__)
|
||||
static const alarm_irq_t alarm_irqs[ST_LLD_NUM_ALARMS] = {
|
||||
{RP_TIMER_IRQ0_NUMBER, RP_IRQ_TIMER_ALARM0_PRIORITY},
|
||||
{RP_TIMER_IRQ1_NUMBER, RP_IRQ_TIMER_ALARM1_PRIORITY},
|
||||
{RP_TIMER_IRQ2_NUMBER, RP_IRQ_TIMER_ALARM2_PRIORITY},
|
||||
{RP_TIMER_IRQ3_NUMBER, RP_IRQ_TIMER_ALARM3_PRIORITY}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
|
@ -223,24 +227,20 @@ void st_lld_init(void) {
|
|||
TIMER->INTR = TIMER_INTR_ALARM3 | TIMER_INTR_ALARM2 |
|
||||
TIMER_INTR_ALARM1 | TIMER_INTR_ALARM0;
|
||||
|
||||
#if 0
|
||||
/* IRQs enabled.*/
|
||||
#if !defined(ST_TIMER_ALARM0_SUPPRESS_ISR)
|
||||
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables an alarm interrupt on the invoking core.
|
||||
* @note Must be called before any other alarm-related function.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void st_lld_bind(void) {
|
||||
|
||||
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
|
||||
nvicEnableVector(RP_TIMER_IRQ0_NUMBER, RP_IRQ_TIMER_ALARM0_PRIORITY);
|
||||
#endif
|
||||
#if !defined(ST_TIMER_ALARM1_SUPPRESS_ISR)
|
||||
nvicEnableVector(RP_TIMER_IRQ1_NUMBER, RP_IRQ_TIMER_ALARM1_PRIORITY);
|
||||
#endif
|
||||
#if !defined(ST_TIMER_ALARM2_SUPPRESS_ISR)
|
||||
nvicEnableVector(RP_TIMER_IRQ2_NUMBER, RP_IRQ_TIMER_ALARM2_PRIORITY);
|
||||
#endif
|
||||
#if !defined(ST_TIMER_ALARM3_SUPPRESS_ISR)
|
||||
nvicEnableVector(RP_TIMER_IRQ3_NUMBER, RP_IRQ_TIMER_ALARM3_PRIORITY);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */
|
||||
|
||||
#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC
|
||||
uint32_t timer_clk = RP_CORE_CLK;
|
||||
|
||||
|
@ -263,20 +263,6 @@ void st_lld_init(void) {
|
|||
}
|
||||
|
||||
#if (OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING) || defined(__DOXYGEN__)
|
||||
#if defined(ST_LLD_MULTICORE_SUPPORT) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Enables an alarm interrupt on the invoking core.
|
||||
* @note Must be called before any other alarm-related function.
|
||||
*
|
||||
* @param[in] alarm alarm channel number (0..ST_LLD_NUM_ALARMS-1)
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void st_lld_bind_alarm(void) {
|
||||
|
||||
nvicEnableVector(alarm_irqs[0].n, alarm_irqs[0].prio);
|
||||
}
|
||||
|
||||
#if (ST_LLD_NUM_ALARMS > 1) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Enables an alarm interrupt on the invoking core.
|
||||
|
@ -291,7 +277,6 @@ void st_lld_bind_alarm_n(unsigned alarm) {
|
|||
nvicEnableVector(alarm_irqs[alarm].n, alarm_irqs[alarm].prio);
|
||||
}
|
||||
#endif /* ST_LLD_NUM_ALARMS > 1 */
|
||||
#endif /* defined(ST_LLD_MULTICORE_SUPPORT) */
|
||||
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */
|
||||
|
||||
#endif /* OSAL_ST_MODE != OSAL_ST_MODE_NONE */
|
||||
|
|
|
@ -148,12 +148,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
void st_lld_init(void);
|
||||
void st_lld_bind(void);
|
||||
#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
|
||||
#if defined(ST_LLD_MULTICORE_SUPPORT)
|
||||
void st_lld_bind_alarm(void);
|
||||
void st_lld_bind_alarm_n(unsigned alarm);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -77,6 +77,19 @@ void stInit(void) {
|
|||
st_lld_init();
|
||||
}
|
||||
|
||||
#if defined(ST_LLD_MULTICORE_SUPPORT) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Enables an alarm interrupt on the invoking core.
|
||||
* @note Must be called before any other alarm-related function.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
void stBind(void) {
|
||||
|
||||
st_lld_bind();
|
||||
}
|
||||
#endif /* defined(ST_LLD_MULTICORE_SUPPORT) */
|
||||
|
||||
#if (OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Returns the time counter value.
|
||||
|
@ -92,21 +105,6 @@ systime_t stGetCounter(void) {
|
|||
return st_lld_get_counter();
|
||||
}
|
||||
|
||||
#if defined(ST_LLD_MULTICORE_SUPPORT) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Enables an alarm interrupt on the invoking core.
|
||||
* @note Must be called before any other alarm-related function.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
void stBindAlarm(void) {
|
||||
|
||||
osalDbgAssert(stIsAlarmActive() == false, "already active");
|
||||
|
||||
st_lld_bind_alarm();
|
||||
}
|
||||
#endif /* defined(ST_LLD_MULTICORE_SUPPORT) */
|
||||
|
||||
/**
|
||||
* @brief Starts the alarm zero.
|
||||
* @note Makes sure that no spurious alarms are triggered after
|
||||
|
|
Loading…
Reference in New Issue