RTEMS 6.1-rc4
|
Data Structures | |
struct | _enc_config |
Define user configuration structure for ENC module. More... | |
struct | _enc_self_test_config |
Define configuration structure for self test module. More... | |
Macros | |
#define | FSL_ENC_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
Typedefs | |
typedef enum _enc_home_trigger_mode | enc_home_trigger_mode_t |
Define HOME signal's trigger mode. | |
typedef enum _enc_index_trigger_mode | enc_index_trigger_mode_t |
Define INDEX signal's trigger mode. | |
typedef enum _enc_decoder_work_mode | enc_decoder_work_mode_t |
Define type for decoder work mode. | |
typedef enum _enc_position_match_mode | enc_position_match_mode_t |
Define type for the condition of POSMATCH pulses. | |
typedef enum _enc_revolution_count_condition | enc_revolution_count_condition_t |
Define type for determining how the revolution counter (REV) is incremented/decremented. | |
typedef enum _enc_self_test_direction | enc_self_test_direction_t |
Define type for direction of self test generated signal. | |
typedef struct _enc_config | enc_config_t |
Define user configuration structure for ENC module. | |
typedef struct _enc_self_test_config | enc_self_test_config_t |
Define configuration structure for self test module. | |
Initialization and De-initialization | |
void | ENC_Init (ENC_Type *base, const enc_config_t *config) |
Initialization for the ENC module. | |
void | ENC_Deinit (ENC_Type *base) |
De-initialization for the ENC module. | |
void | ENC_GetDefaultConfig (enc_config_t *config) |
Get an available pre-defined settings for ENC's configuration. | |
void | ENC_DoSoftwareLoadInitialPositionValue (ENC_Type *base) |
Load the initial position value to position counter. | |
void | ENC_SetSelfTestConfig (ENC_Type *base, const enc_self_test_config_t *config) |
Enable and configure the self test function. | |
void | ENC_EnableWatchdog (ENC_Type *base, bool enable) |
Enable watchdog for ENC module. | |
void | ENC_SetInitialPositionValue (ENC_Type *base, uint32_t value) |
Set initial position value for ENC module. | |
Status | |
uint32_t | ENC_GetStatusFlags (ENC_Type *base) |
Get the status flags. | |
void | ENC_ClearStatusFlags (ENC_Type *base, uint32_t mask) |
Clear the status flags. | |
Interrupts | |
void | ENC_EnableInterrupts (ENC_Type *base, uint32_t mask) |
Enable the interrupts. | |
void | ENC_DisableInterrupts (ENC_Type *base, uint32_t mask) |
Disable the interrupts. | |
uint32_t | ENC_GetEnabledInterrupts (ENC_Type *base) |
Get the enabled interrupts' flags. | |
Value Operation | |
uint32_t | ENC_GetPositionValue (ENC_Type *base) |
Get the current position counter's value. | |
uint32_t | ENC_GetHoldPositionValue (ENC_Type *base) |
Get the hold position counter's value. | |
typedef enum _enc_decoder_work_mode enc_decoder_work_mode_t |
Define type for decoder work mode.
The normal work mode uses the standard quadrature decoder with PHASEA and PHASEB. When in signal phase count mode, a positive transition of the PHASEA input generates a count signal while the PHASEB input and the reverse direction control the counter direction. If the reverse direction is not enabled, PHASEB = 0 means counting up and PHASEB = 1 means counting down. Otherwise, the direction is reversed.
typedef enum _enc_home_trigger_mode enc_home_trigger_mode_t |
Define HOME signal's trigger mode.
The ENC would count the trigger from HOME signal line.
typedef enum _enc_index_trigger_mode enc_index_trigger_mode_t |
Define INDEX signal's trigger mode.
The ENC would count the trigger from INDEX signal line.
typedef struct _enc_self_test_config enc_self_test_config_t |
Define configuration structure for self test module.
The self test module provides a quadrature test signal to the inputs of the quadrature decoder module. This is a factory test feature. It is also useful to customers' software development and testing.
Define type for decoder work mode.
The normal work mode uses the standard quadrature decoder with PHASEA and PHASEB. When in signal phase count mode, a positive transition of the PHASEA input generates a count signal while the PHASEB input and the reverse direction control the counter direction. If the reverse direction is not enabled, PHASEB = 0 means counting up and PHASEB = 1 means counting down. Otherwise, the direction is reversed.
Define HOME signal's trigger mode.
The ENC would count the trigger from HOME signal line.
Define INDEX signal's trigger mode.
The ENC would count the trigger from INDEX signal line.
Interrupt enable/disable mask.
Define type for the condition of POSMATCH pulses.
Define type for determining how the revolution counter (REV) is incremented/decremented.
Signal status flag mask.
These flags indicate the counter's signal.
enum _enc_status_flags |
Status flag mask.
These flags indicate the counter's events.
void ENC_ClearStatusFlags | ( | ENC_Type * | base, |
uint32_t | mask | ||
) |
Clear the status flags.
base | ENC peripheral base address. |
mask | Mask value of status flags to be cleared. For available mask, see to "_enc_status_flags". |
brief Clear the status flags.
param base ENC peripheral base address. param mask Mask value of status flags to be cleared. For available mask, see to "_enc_status_flags".
void ENC_Deinit | ( | ENC_Type * | base | ) |
De-initialization for the ENC module.
This function is to make the de-initialization for the ENC module. It could be called when ENC is no longer used with the operations like:
base | ENC peripheral base address. |
brief De-initialization for the ENC module.
This function is to make the de-initialization for the ENC module. It could be called when ENC is no longer used with the operations like:
param base ENC peripheral base address.
void ENC_DisableInterrupts | ( | ENC_Type * | base, |
uint32_t | mask | ||
) |
Disable the interrupts.
base | ENC peripheral base address. |
mask | Mask value of interrupts to be disabled. For available mask, see to "_enc_interrupt_enable". |
brief Disable the interrupts.
param base ENC peripheral base address. param mask Mask value of interrupts to be disabled. For available mask, see to "_enc_interrupt_enable".
void ENC_DoSoftwareLoadInitialPositionValue | ( | ENC_Type * | base | ) |
Load the initial position value to position counter.
This function is to transfer the initial position value (UINIT and LINIT) contents to position counter (UPOS and LPOS), so that to provide the consistent operation the position counter registers.
base | ENC peripheral base address. |
brief Load the initial position value to position counter.
This function is to transfer the initial position value (UINIT and LINIT) contents to position counter (UPOS and LPOS), so that to provide the consistent operation the position counter registers.
param base ENC peripheral base address.
void ENC_EnableInterrupts | ( | ENC_Type * | base, |
uint32_t | mask | ||
) |
Enable the interrupts.
base | ENC peripheral base address. |
mask | Mask value of interrupts to be enabled. For available mask, see to "_enc_interrupt_enable". |
brief Enable the interrupts.
param base ENC peripheral base address. param mask Mask value of interrupts to be enabled. For available mask, see to "_enc_interrupt_enable".
void ENC_EnableWatchdog | ( | ENC_Type * | base, |
bool | enable | ||
) |
Enable watchdog for ENC module.
base | ENC peripheral base address |
enable | Enables or disables the watchdog |
brief Enable watchdog for ENC module.
param base ENC peripheral base address param enable Enables or disables the watchdog
void ENC_GetDefaultConfig | ( | enc_config_t * | config | ) |
Get an available pre-defined settings for ENC's configuration.
This function initializes the ENC configuration structure with an available settings, the default value are:
config | Pointer to a variable of configuration structure. See to "enc_config_t". |
brief Get an available pre-defined settings for ENC's configuration.
This function initializes the ENC configuration structure with an available settings, the default value are: code config->enableReverseDirection = false; config->decoderWorkMode = kENC_DecoderWorkAsNormalMode; config->HOMETriggerMode = kENC_HOMETriggerDisabled; config->INDEXTriggerMode = kENC_INDEXTriggerDisabled; config->enableTRIGGERClearPositionCounter = false; config->enableTRIGGERClearHoldPositionCounter = false; config->enableWatchdog = false; config->watchdogTimeoutValue = 0U; config->filterCount = 0U; config->filterSamplePeriod = 0U; config->positionMatchMode = kENC_POSMATCHOnPositionCounterEqualToComapreValue; config->positionCompareValue = 0xFFFFFFFFU; config->revolutionCountCondition = kENC_RevolutionCountOnINDEXPulse; config->enableModuloCountMode = false; config->positionModulusValue = 0U; config->positionInitialValue = 0U; config->prescalerValue = kENC_ClockDiv1; config->enablePeriodMeasurementFunction = true; endcode param config Pointer to a variable of configuration structure. See to "enc_config_t".
uint32_t ENC_GetEnabledInterrupts | ( | ENC_Type * | base | ) |
Get the enabled interrupts' flags.
base | ENC peripheral base address. |
brief Get the enabled interrupts' flags.
param base ENC peripheral base address.
return Mask value of enabled interrupts.
uint32_t ENC_GetHoldPositionValue | ( | ENC_Type * | base | ) |
Get the hold position counter's value.
When any of the counter registers is read, the contents of each counter register is written to the corresponding hold register. Taking a snapshot of the counters' values provides a consistent view of a system position and a velocity to be attained.
base | ENC peripheral base address. |
brief Get the hold position counter's value.
When any of the counter registers is read, the contents of each counter register is written to the corresponding hold register. Taking a snapshot of the counters' values provides a consistent view of a system position and a velocity to be attained.
param base ENC peripheral base address.
return Hold position counter's value.
uint32_t ENC_GetPositionValue | ( | ENC_Type * | base | ) |
Get the current position counter's value.
base | ENC peripheral base address. |
brief Get the current position counter's value.
param base ENC peripheral base address.
return Current position counter's value.
uint32_t ENC_GetStatusFlags | ( | ENC_Type * | base | ) |
Get the status flags.
base | ENC peripheral base address. |
brief Get the status flags.
param base ENC peripheral base address.
return Mask value of status flags. For available mask, see to "_enc_status_flags".
void ENC_Init | ( | ENC_Type * | base, |
const enc_config_t * | config | ||
) |
Initialization for the ENC module.
This function is to make the initialization for the ENC module. It should be called firstly before any operation to the ENC with the operations like:
base | ENC peripheral base address. |
config | Pointer to configuration structure. See to "enc_config_t". |
brief Initialization for the ENC module.
This function is to make the initialization for the ENC module. It should be called firstly before any operation to the ENC with the operations like:
param base ENC peripheral base address. param config Pointer to configuration structure. See to "enc_config_t".
void ENC_SetInitialPositionValue | ( | ENC_Type * | base, |
uint32_t | value | ||
) |
Set initial position value for ENC module.
base | ENC peripheral base address |
value | Positive initial value |
brief Set initial position value for ENC module.
param base ENC peripheral base address param value Positive initial value
void ENC_SetSelfTestConfig | ( | ENC_Type * | base, |
const enc_self_test_config_t * | config | ||
) |
Enable and configure the self test function.
This function is to enable and configuration the self test function. It controls and sets the frequency of a quadrature signal generator. It provides a quadrature test signal to the inputs of the quadrature decoder module. It is a factory test feature; however, it may be useful to customers' software development and testing.
base | ENC peripheral base address. |
config | Pointer to configuration structure. See to "enc_self_test_config_t". Pass "NULL" to disable. |
brief Enable and configure the self test function.
This function is to enable and configuration the self test function. It controls and sets the frequency of a quadrature signal generator. It provides a quadrature test signal to the inputs of the quadrature decoder module. It is a factory test feature; however, it may be useful to customers' software development and testing.
param base ENC peripheral base address. param config Pointer to configuration structure. See to "enc_self_test_config_t". Pass "NULL" to disable.
enc_decoder_work_mode_t _enc_config::decoderWorkMode |
Enable signal phase count mode.
bool _enc_config::enableModuloCountMode |
Enable Modulo Counting.
bool _enc_config::enableReverseDirection |
Enable reverse direction counting.
bool _enc_config::enableTRIGGERClearHoldPositionCounter |
Enable update of hold registers on rising edge of TRIGGER, or not.
bool _enc_config::enableTRIGGERClearPositionCounter |
Clear POSD, REV, UPOS and LPOS on rising edge of TRIGGER, or not.
bool _enc_config::enableWatchdog |
Enable the watchdog to detect if the target is moving or not.
uint16_t _enc_config::filterCount |
Input Filter Sample Count. This value should be chosen to reduce the probability of noisy samples causing an incorrect transition to be recognized. The value represent the number of consecutive samples that must agree prior to the input filter accepting an input transition. A value of 0x0 represents 3 samples. A value of 0x7 represents 10 samples. The Available range is 0 - 7.
uint16_t _enc_config::filterSamplePeriod |
Input Filter Sample Period. This value should be set such that the sampling period is larger than the period of the expected noise. This value represents the sampling period (in IPBus clock cycles) of the decoder input signals. The available range is 0 - 255.
enc_home_trigger_mode_t _enc_config::HOMETriggerMode |
Enable HOME to initialize position counters.
enc_index_trigger_mode_t _enc_config::INDEXTriggerMode |
Enable INDEX to initialize position counters.
uint32_t _enc_config::positionCompareValue |
Position compare value. The available value is a 32-bit number.
uint32_t _enc_config::positionInitialValue |
Position initial value. The available value is a 32-bit number.
enc_position_match_mode_t _enc_config::positionMatchMode |
The condition of POSMATCH pulses.
uint32_t _enc_config::positionModulusValue |
Position modulus value. This value would be available only when "enableModuloCountMode" = true. The available value is a 32-bit number.
enc_revolution_count_condition_t _enc_config::revolutionCountCondition |
Revolution Counter Modulus Enable.
uint16_t _enc_self_test_config::signalCount |
Hold the number of quadrature advances to generate. The available range is 0 - 255.
enc_self_test_direction_t _enc_self_test_config::signalDirection |
Direction of self test generated signal.
uint16_t _enc_self_test_config::signalPeriod |
Hold the period of quadrature phase in IPBus clock cycles. The available range is 0 - 31.
uint16_t _enc_config::watchdogTimeoutValue |
Watchdog timeout count value. It stores the timeout count for the quadrature decoder module watchdog timer. This field is only available when "enableWatchdog" = true. The available value is a 16-bit unsigned number.