Azure Sphere MT3620 M4 API Reference Manual
|
M-HAL PWM API list information, including PWM controller allocating and releasing, PWM hardware initializing and de-initializing, setting PWM frequency and duty cycle, enabling and disabling PWM hardware output, getting PWM frequency and duty cycle, getting the current status of PWM, enabling and disabling clock. More...
M-HAL PWM API list information, including PWM controller allocating and releasing, PWM hardware initializing and de-initializing, setting PWM frequency and duty cycle, enabling and disabling PWM hardware output, getting PWM frequency and duty cycle, getting the current status of PWM, enabling and disabling clock.
Functions | |
int | mtk_mhal_pwm_clock_select (struct mtk_pwm_controller *ctlr) |
This function is used to select PWM clock source of the PWM controller. More... | |
int | mtk_mhal_pwm_enable_clk (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to enable PWM clock before operating hardware. More... | |
int | mtk_mhal_pwm_disable_clk (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to disable PWM clock. More... | |
int | mtk_mhal_pwm_init (struct mtk_pwm_controller *ctlr, u32 channel_bit_map) |
This function is used to initialize the PWM hardware. More... | |
int | mtk_mhal_pwm_deinit (struct mtk_pwm_controller *ctlr, u32 channel_bit_map) |
This function is used to de-initialize PWM hardware. More... | |
int | mtk_mhal_pwm_set_frequency (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to set PWM frequency. More... | |
int | mtk_mhal_pwm_set_duty_cycle (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to set PWM duty cycle. More... | |
int | mtk_mhal_pwm_start (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to start the PWM hardware. More... | |
int | mtk_mhal_pwm_stop (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to stop the PWM hardware. More... | |
int | mtk_mhal_pwm_get_frequency (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to get current frequency of the PWM with the unit of frequency being Hz. More... | |
int | mtk_mhal_pwm_get_duty_cycle (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to get the current duty cycle of the PWM. More... | |
int | mtk_mhal_pwm_get_running_status (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to get the current status of PWM. More... | |
int | mtk_mhal_pwm_feature_enable (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to select PWM global kick, IO ctrl, polarity setting. More... | |
int | mtk_mhal_pwm_config_s0_s1_freq_duty (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to set PWM frequency and duty cycle in 2-state mode. More... | |
int | mtk_mhal_pwm_s0_s1_stay_cycle_config (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to set PWM stay cycles of S0 and S1 in 2-state mode. More... | |
int | mtk_mhal_pwm_kick (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to kick PWM hardware output waveform in 2-state mode. More... | |
int | mtk_mhal_pwm_global_kick (struct mtk_pwm_controller *ctlr) |
This function is used to reset PWM hardware by group. More... | |
int | mtk_mhal_pwm_dpsel (struct mtk_pwm_controller *ctlr, pwm_channels channel_num) |
This function is used to set PWM channel's differential mode. More... | |
int mtk_mhal_pwm_clock_select | ( | struct mtk_pwm_controller * | ctlr | ) |
This function is used to select PWM clock source of the PWM controller.
Usage: It must be called before operating hardware; Otherwise, it will use dPWM_EFAULT clock source.
[in] | ctlr | : Abstract a PWM controller. |
int mtk_mhal_pwm_enable_clk | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to enable PWM clock before operating hardware.
Usage: It must be called to enable clock before operating hardware; otherwise, the access to PWM register will fail, so this function should be called in the sequence: alloc_controller-> enable_clk-> pwm_init.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_disable_clk | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to disable PWM clock.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_init | ( | struct mtk_pwm_controller * | ctlr, |
u32 | channel_bit_map | ||
) |
This function is used to initialize the PWM hardware.
Usage: OS-HAL calls this API to initialize PWM hardware, and the main sequence is as bellow:
1.This function should be called after allocating the PWM controller.
2.Before operating PWM hardware, this API should be called first.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_bit_map | : PWM channel bit map(0x0~0xF). |
int mtk_mhal_pwm_deinit | ( | struct mtk_pwm_controller * | ctlr, |
u32 | channel_bit_map | ||
) |
This function is used to de-initialize PWM hardware.
Usage: OS-HAL calls this API to de-initialize PWM hardware, and this function should be called before releasing the PWM controller.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_bit_map | : PWM channel bit map(0x0~0xF). |
int mtk_mhal_pwm_set_frequency | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to set PWM frequency.
Usage: OS-HAL calls this API to set PWM hardware at the specified frequency, and this function should be called before starting PWM hardware.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_set_duty_cycle | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to set PWM duty cycle.
Usage: OS-HAL calls this API to set PWM hardware at the specified duty cycle, and this function should be called before PWM starting.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_start | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to start the PWM hardware.
Usage: OS-HAL calls this API to start PWM hardware output waveform at the specified frequency and duty cycle, and the main sequence is as bellow:
1.This function should be called after setting the frequency.
2.This function should be called after setting the duty cycle.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_stop | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to stop the PWM hardware.
Usage: The main sequence is as bellow:
1.This function should be called after setting the frequency.
2.This function should be called after setting the duty cycle.
3.This function should be called before de-initializing.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_get_frequency | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to get current frequency of the PWM with the unit of frequency being Hz.
Usage: The duty cycle is restored in ctlr->data.current_frequency.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_get_duty_cycle | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to get the current duty cycle of the PWM.
Usage: The duty cycle is restored in ctlr->data.current_duty_cycle.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_get_running_status | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to get the current status of PWM.
Usage: The running status is restored in ctlr->data.running_status.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_feature_enable | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to select PWM global kick, IO ctrl, polarity setting.
Usage: It must be called to set global kick, IO ctrl, polarity in 2-state mode and this function should be called before
kicking PWM hardware output waveform.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_config_s0_s1_freq_duty | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to set PWM frequency and duty cycle in 2-state mode.
Usage: OS-HAL calls this API to set PWM hardware frequency and duty cycle and the main sequence is as bellow:
1.This function should be called before kicking PWM hardware output waveform.
2.This function can configure frequency and duty cycle of stage S0 and S1.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_s0_s1_stay_cycle_config | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to set PWM stay cycles of S0 and S1 in 2-state mode.
Usage: OS-HAL calls this API to set PWM stay cycles of S0 and S1.
1.This function should be called before kicking PWM hardware output waveform.
2.This function can configure stay cycles of stage S0 and S1.
3.This function can configure enable replay mode or not.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_kick | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to kick PWM hardware output waveform in 2-state mode.
Usage: OS-HAL calls this API to kick PWM hardware output waveform by channel.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |
int mtk_mhal_pwm_global_kick | ( | struct mtk_pwm_controller * | ctlr | ) |
This function is used to reset PWM hardware by group.
Usage: OS-HAL calls this API to reset PWM hardware by group.
[in] | ctlr | : Abstract a PWM controller. |
int mtk_mhal_pwm_dpsel | ( | struct mtk_pwm_controller * | ctlr, |
pwm_channels | channel_num | ||
) |
This function is used to set PWM channel's differential mode.
Usage: After setting PWM configuration, It should be called to set PWM channel's differential mode.
[in] | ctlr | : Abstract a PWM controller. |
[in] | channel_num | : PWM channel number(0~3). For more details about the parameter, please refer to pwm_channels. |