Added events handling in PAL high level driver. No implementations yet.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9583 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
ca6ceacb90
commit
9ddae2895c
|
@ -98,6 +98,17 @@
|
|||
#define PAL_HIGH 1U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name PAL event modes
|
||||
* @{
|
||||
*/
|
||||
#define PAL_EVENT_MODE_EDGES_MASK 3U /**< @brief Mask of edges field. */
|
||||
#define PAL_EVENT_MODE_DISABLED 0U /**< @brief Channel disabled. */
|
||||
#define PAL_EVENT_MODE_RISING_EDGE 1U /**< @brief Rising edge callback. */
|
||||
#define PAL_EVENT_MODE_FALLING_EDGE 2U /**< @brief Falling edge callback. */
|
||||
#define PAL_EVENT_MODE_BOTH_EDGES 3U /**< @brief Both edges callback. */
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
@ -110,6 +121,11 @@
|
|||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of a PAL event callback.
|
||||
*/
|
||||
typedef void (*palcallback_t)(void);
|
||||
|
||||
#include "hal_pal_lld.h"
|
||||
|
||||
/**
|
||||
|
@ -205,8 +221,6 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Reads the physical I/O port states.
|
||||
* @note The default implementation always return zero and computes the
|
||||
* parameter eventual side effects.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -224,8 +238,6 @@ typedef struct {
|
|||
* @brief Reads the output latch.
|
||||
* @details The purpose of this function is to read back the latched output
|
||||
* value.
|
||||
* @note The default implementation always return zero and computes the
|
||||
* parameter eventual side effects.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -241,8 +253,6 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Writes a bits mask on a I/O port.
|
||||
* @note The default implementation does nothing except computing the
|
||||
* parameters eventual side effects.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -262,9 +272,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -285,9 +292,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -308,9 +312,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -346,6 +347,10 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Writes a group of bits.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -366,11 +371,14 @@ typedef struct {
|
|||
pal_lld_writegroup(port, mask, offset, bits)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pads group mode setup.
|
||||
* @details This function programs a pads group belonging to the same port
|
||||
* with the specified mode.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note Programming an unknown or unsupported mode is silently ignored.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
|
@ -390,10 +398,6 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Reads an input pad logic state.
|
||||
* @note The default implementation not necessarily optimal. Low level
|
||||
* drivers may optimize the function by using specific hardware
|
||||
* or coding.
|
||||
* @note The default implementation internally uses the @p palReadPort().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -416,11 +420,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The default implementation internally uses the @p palReadLatch()
|
||||
* and @p palWritePort().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -444,10 +443,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The default implementation internally uses the @p palSetPort().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -467,10 +462,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The default implementation internally uses the @p palClearPort().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -490,10 +481,6 @@ typedef struct {
|
|||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The default implementation is non atomic and not necessarily
|
||||
* optimal. Low level drivers may optimize the function by using
|
||||
* specific hardware or coding.
|
||||
* @note The default implementation internally uses the @p palTogglePort().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
|
@ -510,9 +497,10 @@ typedef struct {
|
|||
/**
|
||||
* @brief Pad mode setup.
|
||||
* @details This function programs a pad with the specified mode.
|
||||
* @note The default implementation not necessarily optimal. Low level
|
||||
* drivers may optimize the function by using specific hardware
|
||||
* or coding.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note Programming an unknown or unsupported mode is silently ignored.
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
|
@ -529,6 +517,41 @@ typedef struct {
|
|||
#define palSetPadMode(port, pad, mode) pal_lld_setpadmode(port, pad, mode)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Pad event enable.
|
||||
* @details This function programs an event callback in the specified mode.
|
||||
* @note Programming an unknown or unsupported mode is silently ignored.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
* @param[in] pad pad number within the port
|
||||
* @param[in] mode pad event mode
|
||||
* @param[in] callback event callback function
|
||||
*
|
||||
* @iclass
|
||||
*/
|
||||
#if !defined(pal_lld_enablepadevent) || defined(__DOXYGEN__)
|
||||
#define palPadEnableEventI(port, pad, mode, callback)
|
||||
#else
|
||||
#define palPadEnableEventI(port, pad, mode, callback) \
|
||||
pal_lld_enablepadevent(port, pad, mode, callback)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Pad event disable.
|
||||
* @details This function disables previously programmed event callbacks.
|
||||
*
|
||||
* @param[in] port port identifier
|
||||
* @param[in] pad pad number within the port
|
||||
*
|
||||
* @iclass
|
||||
*/
|
||||
#if !defined(pal_lld_disablepadevent) || defined(__DOXYGEN__)
|
||||
#define palPadDisableEventI(port, pad)
|
||||
#else
|
||||
#define palPadDisableEventI(port, pad) \
|
||||
pal_lld_disablepadevent(port, pad)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Reads an input line logic state.
|
||||
* @note The function can be called from any context.
|
||||
|
@ -548,6 +571,10 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Writes a logic state on an output line.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
|
@ -564,6 +591,10 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Sets a line logic state to @p PAL_HIGH.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
|
@ -578,6 +609,10 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Clears a line logic state to @p PAL_LOW.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
|
@ -592,6 +627,10 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Toggles a line logic state.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
|
@ -606,6 +645,10 @@ typedef struct {
|
|||
|
||||
/**
|
||||
* @brief Line mode setup.
|
||||
* @note The operation is not guaranteed to be atomic on all the
|
||||
* architectures, for atomicity and/or portability reasons you may
|
||||
* need to enclose port I/O operations between @p osalSysLock() and
|
||||
* @p osalSysUnlock().
|
||||
* @note The function can be called from any context.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
|
@ -619,6 +662,38 @@ typedef struct {
|
|||
#else
|
||||
#define palSetLineMode(line, mode) pal_lld_setlinemode(line, mode)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Line event enable.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
* @param[in] mode line event mode
|
||||
* @param[in] callback event callback function
|
||||
*
|
||||
* @iclass
|
||||
*/
|
||||
#if !defined(pal_lld_lineenableevent) || defined(__DOXYGEN__)
|
||||
#define palLineEnableEventI(line, mode, callback) \
|
||||
palPadEnableEventI(PAL_PORT(line), PAL_PAD(line), mode, callback)
|
||||
#else
|
||||
#define palLineEnableEventI(line, mode, callback) \
|
||||
pal_lld_lineenableevent(line, mode, callback)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Line event disable.
|
||||
*
|
||||
* @param[in] line line identifier
|
||||
*
|
||||
* @iclass
|
||||
*/
|
||||
#if !defined(pal_lld_linedisableevent) || defined(__DOXYGEN__)
|
||||
#define palLineDisableEventI(line) \
|
||||
palPadDisableEventI(PAL_PORT(line), PAL_PAD(line))
|
||||
#else
|
||||
#define palLineDisableEventI(line) pal_lld_linedisableevent(line)
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
Loading…
Reference in New Issue