RTEMS 6.1-rc6
|
Data Structures | |
struct | _qtmr_config |
Quad Timer config structure. More... | |
Macros | |
#define | TMR_CSCTRL_OFLAG_MASK (0x100UL) |
#define | TMR_CSCTRL_OFLAG_SHIFT (8UL) |
Functions | |
status_t | QTMR_SetupPwm (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t pwmFreqHz, uint8_t dutyCyclePercent, bool outputPolarity, uint32_t srcClock_Hz) |
Sets up Quad timer module for PWM signal output. | |
void | QTMR_SetupInputCapture (TMR_Type *base, qtmr_channel_selection_t channel, qtmr_input_source_t capturePin, bool inputPolarity, bool reloadOnCapture, qtmr_input_capture_edge_t captureMode) |
Allows the user to count the source clock cycles until a capture event arrives. | |
Initialization and deinitialization | |
void | QTMR_Init (TMR_Type *base, qtmr_channel_selection_t channel, const qtmr_config_t *config) |
Ungates the Quad Timer clock and configures the peripheral for basic operation. | |
void | QTMR_Deinit (TMR_Type *base, qtmr_channel_selection_t channel) |
Stops the counter and gates the Quad Timer clock. | |
void | QTMR_GetDefaultConfig (qtmr_config_t *config) |
Fill in the Quad Timer config struct with the default settings. | |
Interrupt Interface | |
void | QTMR_EnableInterrupts (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Enables the selected Quad Timer interrupts. | |
void | QTMR_DisableInterrupts (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Disables the selected Quad Timer interrupts. | |
uint32_t | QTMR_GetEnabledInterrupts (TMR_Type *base, qtmr_channel_selection_t channel) |
Gets the enabled Quad Timer interrupts. | |
Status Interface | |
uint32_t | QTMR_GetStatus (TMR_Type *base, qtmr_channel_selection_t channel) |
Gets the Quad Timer status flags. | |
void | QTMR_ClearStatusFlags (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Clears the Quad Timer status flags. | |
Read and Write the timer period | |
void | QTMR_SetTimerPeriod (TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks) |
Sets the timer period in ticks. | |
void | QTMR_SetCompareValue (TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks) |
Set compare value. | |
Enable and Disable the Quad Timer DMA | |
void | QTMR_EnableDma (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Enable the Quad Timer DMA. | |
void | QTMR_DisableDma (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Disable the Quad Timer DMA. | |
void | QTMR_SetPwmOutputToIdle (TMR_Type *base, qtmr_channel_selection_t channel, bool idleStatus) |
Set PWM output in idle status (high or low). | |
uint8_t | QTMR_GetPwmChannelStatus (TMR_Type *base, qtmr_channel_selection_t channel) |
Get the PWM channel dutycycle value. | |
void | QTMR_SetPwmClockMode (TMR_Type *base, qtmr_channel_selection_t channel, qtmr_primary_count_source_t prescaler) |
This function set the value of the prescaler on QTimer channels. | |
#define FSL_QTMR_DRIVER_VERSION (MAKE_VERSION(2, 2, 1)) |
Version
typedef struct _qtmr_config qtmr_config_t |
Quad Timer config structure.
This structure holds the configuration settings for the Quad Timer peripheral. To initialize this structure to reasonable defaults, call the QTMR_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
enum _qtmr_counting_mode |
Quad Timer counting mode selection.
enum _qtmr_debug_action |
enum _qtmr_dma_enable |
Quad Timer input capture edge mode, rising edge, or falling edge.
enum _qtmr_input_source |
enum _qtmr_output_mode |
Quad Timer output mode selection.
Quad Timer primary clock source selection.
enum _qtmr_pwm_out_state |
enum _qtmr_status_flags |
void QTMR_ClearStatusFlags | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
Clears the Quad Timer status flags.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
mask | The status flags to clear. This is a logical OR of members of the enumeration qtmr_status_flags_t |
brief Clears the Quad Timer status flags.
param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The status flags to clear. This is a logical OR of members of the enumeration qtmr_status_flags_t
void QTMR_Deinit | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
Stops the counter and gates the Quad Timer clock.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
brief Stops the counter and gates the Quad Timer clock
param base Quad Timer peripheral base address param channel Quad Timer channel number
void QTMR_DisableDma | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
Disable the Quad Timer DMA.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
mask | The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t |
brief Disable the Quad Timer DMA.
param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t
void QTMR_DisableInterrupts | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
Disables the selected Quad Timer interrupts.
base | Quad Timer peripheral base addres |
channel | Quad Timer channel number |
mask | The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t |
brief Disables the selected Quad Timer interrupts
param base Quad Timer peripheral base addres param channel Quad Timer channel number param mask The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t
void QTMR_EnableDma | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
Enable the Quad Timer DMA.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
mask | The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t |
brief Enable the Quad Timer DMA.
param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t
void QTMR_EnableInterrupts | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
Enables the selected Quad Timer interrupts.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
mask | The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t |
brief Enables the selected Quad Timer interrupts
param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t
void QTMR_GetDefaultConfig | ( | qtmr_config_t * | config | ) |
Fill in the Quad Timer config struct with the default settings.
The default values are:
config | Pointer to user's Quad Timer config structure. |
brief Fill in the Quad Timer config struct with the default settings
The default values are: code config->debugMode = kQTMR_RunNormalInDebug; config->enableExternalForce = false; config->enableMasterMode = false; config->faultFilterCount = 0; config->faultFilterPeriod = 0; config->primarySource = kQTMR_ClockDivide_2; config->secondarySource = kQTMR_Counter0InputPin; endcode param config Pointer to user's Quad Timer config structure.
uint32_t QTMR_GetEnabledInterrupts | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
Gets the enabled Quad Timer interrupts.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
brief Gets the enabled Quad Timer interrupts
param base Quad Timer peripheral base address param channel Quad Timer channel number
return The enabled interrupts. This is the logical OR of members of the enumeration qtmr_interrupt_enable_t
uint8_t QTMR_GetPwmChannelStatus | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
Get the PWM channel dutycycle value.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
brief Get the PWM channel dutycycle value.
param base Quad Timer peripheral base address param channel Quad Timer channel number
return Current channel dutycycle value.
uint32_t QTMR_GetStatus | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
Gets the Quad Timer status flags.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
brief Gets the Quad Timer status flags
param base Quad Timer peripheral base address param channel Quad Timer channel number
return The status flags. This is the logical OR of members of the enumeration qtmr_status_flags_t
void QTMR_Init | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
const qtmr_config_t * | config | ||
) |
Ungates the Quad Timer clock and configures the peripheral for basic operation.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
config | Pointer to user's Quad Timer config structure |
brief Ungates the Quad Timer clock and configures the peripheral for basic operation.
note This API should be called at the beginning of the application using the Quad Timer driver.
param base Quad Timer peripheral base address param channel Quad Timer channel number param config Pointer to user's Quad Timer config structure
void QTMR_SetCompareValue | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint16_t | ticks | ||
) |
Set compare value.
This function sets the value used for comparison with the counter value.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
ticks | Timer period in units of ticks. |
brief Set compare value.
This function sets the value used for comparison with the counter value.
param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks.
void QTMR_SetPwmClockMode | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
qtmr_primary_count_source_t | prescaler | ||
) |
This function set the value of the prescaler on QTimer channels.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
prescaler | Set prescaler value |
brief This function set the value of the prescaler on QTimer channels.
param base Quad Timer peripheral base address param channel Quad Timer channel number param prescaler Set prescaler value
void QTMR_SetPwmOutputToIdle | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
bool | idleStatus | ||
) |
Set PWM output in idle status (high or low).
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
idleStatus | True: PWM output is high in idle status; false: PWM output is low in idle status. |
brief Set PWM output in idle status (high or low).
Note: When the PWM is set again, the counting needs to be restarted.
param base Quad Timer peripheral base address param channel Quad Timer channel number param idleStatus True: PWM output is high in idle status; false: PWM output is low in idle status.
void QTMR_SetTimerPeriod | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint16_t | ticks | ||
) |
Sets the timer period in ticks.
Timers counts from initial value till it equals the count value set here. The counter will then reinitialize to the value specified in the Load register.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
ticks | Timer period in units of ticks |
brief Sets the timer period in ticks.
Timers counts from initial value till it equals the count value set here. The counter will then reinitialize to the value specified in the Load register.
note
param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks
void QTMR_SetupInputCapture | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
qtmr_input_source_t | capturePin, | ||
bool | inputPolarity, | ||
bool | reloadOnCapture, | ||
qtmr_input_capture_edge_t | captureMode | ||
) |
Allows the user to count the source clock cycles until a capture event arrives.
The count is stored in the capture register.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
capturePin | Pin through which we receive the input signal to trigger the capture |
inputPolarity | true: invert polarity of the input signal, false: no inversion |
reloadOnCapture | true: reload the counter when an input capture occurs, false: no reload |
captureMode | Specifies which edge of the input signal triggers a capture |
brief Allows the user to count the source clock cycles until a capture event arrives.
The count is stored in the capture register.
param base Quad Timer peripheral base address param channel Quad Timer channel number param capturePin Pin through which we receive the input signal to trigger the capture param inputPolarity true: invert polarity of the input signal, false: no inversion param reloadOnCapture true: reload the counter when an input capture occurs, false: no reload param captureMode Specifies which edge of the input signal triggers a capture
status_t QTMR_SetupPwm | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | pwmFreqHz, | ||
uint8_t | dutyCyclePercent, | ||
bool | outputPolarity, | ||
uint32_t | srcClock_Hz | ||
) |
Sets up Quad timer module for PWM signal output.
The function initializes the timer module according to the parameters passed in by the user. The function also sets up the value compare registers to match the PWM signal requirements.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
pwmFreqHz | PWM signal frequency in Hz |
dutyCyclePercent | PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle) |
outputPolarity | true: invert polarity of the output signal, false: no inversion |
srcClock_Hz | Main counter clock in Hz. |
brief Sets up Quad timer module for PWM signal output.
The function initializes the timer module according to the parameters passed in by the user. The function also sets up the value compare registers to match the PWM signal requirements.
param base Quad Timer peripheral base address param channel Quad Timer channel number param pwmFreqHz PWM signal frequency in Hz param dutyCyclePercent PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle) param outputPolarity true: invert polarity of the output signal, false: no inversion param srcClock_Hz Main counter clock in Hz.
return Returns an error if there was error setting up the signal.