kosmos/source/firmware/arch/stm32f4xx/driver/include/stm32_sys_tick.h

48 lines
1.7 KiB
C
Raw Normal View History

2016-08-16 11:08:49 +00:00
//! \file stm32_sys_tick.h
//! \author tkl
//! \date Feb 15, 2012
//! \brief Header file of the stm32f10x architecture dependent sys tick timer implementation.
#ifndef STM32_SYS_TICK_H_
#define STM32_SYS_TICK_H_
typedef void* (*stm32_sys_tick_cb_t)(void*); //!< callback for the external interrupt
//! \brief Type of sys tick base time.
enum stm32_sys_tick_time_base {
STM32_SYS_TICK_TIME_BASE_NONE = 0, //!< Not init
STM32_SYS_TICK_TIME_BASE_US, //!< Tick time = 1 us.
STM32_SYS_TICK_TIME_BASE_MS //!< Tick time = 1 ms.
};
//! \brief The sys tick device.
struct stm32_sys_tick {
const enum stm32_sys_tick_time_base *tick_time_base; //!< time base for the system tick
stm32_sys_tick_cb_t sys_tick_cb; //!< callback for the sys tick interrupt
void *sys_tick_cb_param; //!< parameter for the callback
};
//! \brief Open a sys tick timer.
//! \param sys_tick The sys tick to open. Must be of type const stm32_sys_tick_t*.
//! \return -1 in error case.
int stm32_sys_tick_open(const void *sys_tick);
//! \brief Close a sys tick timer.
//! \param sys_tick The sys tick to close. Must be of type const stm32_sys_tick_t*.
//! \return -1 in error case.
int stm32_sys_tick_close(const void *sys_tick);
//! \brief Set the call back for a sys tick timer.
//! \param sys_tick The sys tick to open. Mus be of type const stm32_sys_tick_t*.
//! \param callback The function pointer of the call back function.
//! \param param The parameter for the call back function.
//! \return -1 in error case.
int stm32_sys_tick_set_cb(const void *sys_tick, const void *callback, const void *param);
static const struct timer_fp timer_fp = {
stm32_sys_tick_open,
stm32_sys_tick_close,
stm32_sys_tick_set_cb
};
#endif /* STM32_SYS_TICK_H_ */