RA Flexible Software Package Documentation  Release v5.2.0

 
Three-Phase Interface

Detailed Description

Interface for three-phase timer functions.

Summary

The Three-Phase interface provides functionality for synchronous start/stop/reset control of three timer channels for use in 3-phase motor control applications.

Data Structures

struct  three_phase_duty_cycle_t
 
struct  three_phase_cfg_t
 
struct  three_phase_api_t
 
struct  three_phase_instance_t
 

Typedefs

typedef void three_phase_ctrl_t
 

Enumerations

enum  three_phase_channel_t
 
enum  three_phase_buffer_mode_t
 

Data Structure Documentation

◆ three_phase_duty_cycle_t

struct three_phase_duty_cycle_t

Struct for passing duty cycle values to three_phase_api_t::dutyCycleSet

Data Fields
uint32_t duty[3]

Duty cycle. Note: When the GPT instances are configured in TIMER_MODE_TRIANGLE_WAVE_ASYMMETRIC_PWM_MODE3, this value sets the duty cycle count that is transfered to GTCCRA/B at the trough.

uint32_t duty_buffer[3]

Double-buffer for duty cycle values. Note: When the GPT instances are configured in TIMER_MODE_TRIANGLE_WAVE_ASYMMETRIC_PWM_MODE3, this value sets the duty cycle count that is transfered to GTCCRA/B at the crest.

◆ three_phase_cfg_t

struct three_phase_cfg_t

User configuration structure, used in open function

Data Fields
three_phase_buffer_mode_t buffer_mode Single or double-buffer mode.
timer_instance_t const * p_timer_instance[3] Pointer to the timer instance structs.
three_phase_channel_t callback_ch Channel to enable callback when using three_phase_api_t::callbackSet.
uint32_t channel_mask Bitmask of timer channels used by this module.
void const * p_context

Placeholder for user data. Passed to the user callback in timer_callback_args_t.

void const * p_extend Extension parameter for hardware specific settings.

◆ three_phase_api_t

struct three_phase_api_t

Three-Phase API structure.

Data Fields

fsp_err_t(* open )(three_phase_ctrl_t *const p_ctrl, three_phase_cfg_t const *const p_cfg)
 
fsp_err_t(* start )(three_phase_ctrl_t *const p_ctrl)
 
fsp_err_t(* stop )(three_phase_ctrl_t *const p_ctrl)
 
fsp_err_t(* reset )(three_phase_ctrl_t *const p_ctrl)
 
fsp_err_t(* dutyCycleSet )(three_phase_ctrl_t *const p_ctrl, three_phase_duty_cycle_t *const p_duty_cycle)
 
fsp_err_t(* callbackSet )(three_phase_ctrl_t *const p_ctrl, void(*p_callback)(timer_callback_args_t *), void const *const p_context, timer_callback_args_t *const p_callback_memory)
 
fsp_err_t(* close )(three_phase_ctrl_t *const p_ctrl)
 

Field Documentation

◆ open

fsp_err_t(* three_phase_api_t::open) (three_phase_ctrl_t *const p_ctrl, three_phase_cfg_t const *const p_cfg)

Initial configuration.

Parameters
[in]p_ctrlPointer to control block. Must be declared by user. Elements set here.
[in]p_cfgPointer to configuration structure. All elements of this structure must be set by user.

◆ start

fsp_err_t(* three_phase_api_t::start) (three_phase_ctrl_t *const p_ctrl)

Start all three timers synchronously.

Parameters
[in]p_ctrlControl block set in three_phase_api_t::open call for this timer.

◆ stop

fsp_err_t(* three_phase_api_t::stop) (three_phase_ctrl_t *const p_ctrl)

Stop all three timers synchronously.

Parameters
[in]p_ctrlControl block set in three_phase_api_t::open call for this timer.

◆ reset

fsp_err_t(* three_phase_api_t::reset) (three_phase_ctrl_t *const p_ctrl)

Reset all three timers synchronously.

Parameters
[in]p_ctrlControl block set in three_phase_api_t::open call for this timer.

◆ dutyCycleSet

fsp_err_t(* three_phase_api_t::dutyCycleSet) (three_phase_ctrl_t *const p_ctrl, three_phase_duty_cycle_t *const p_duty_cycle)

Sets the duty cycle match values. If the timer is counting, the updated duty cycle is reflected after the next timer expiration.

Parameters
[in]p_ctrlControl block set in three_phase_api_t::open call for this timer.
[in]p_duty_cycleDuty cycle values for all three timer channels.

◆ callbackSet

fsp_err_t(* three_phase_api_t::callbackSet) (three_phase_ctrl_t *const p_ctrl, void(*p_callback)(timer_callback_args_t *), void const *const p_context, timer_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Parameters
[in]p_ctrlControl block set in three_phase_api_t::open call.
[in]p_callbackCallback function to register with GPT U-channel
[in]p_contextPointer to send to callback function
[in]p_working_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ close

fsp_err_t(* three_phase_api_t::close) (three_phase_ctrl_t *const p_ctrl)

Allows driver to be reconfigured and may reduce power consumption.

Parameters
[in]p_ctrlControl block set in three_phase_api_t::open call for this timer.

◆ three_phase_instance_t

struct three_phase_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
three_phase_ctrl_t * p_ctrl Pointer to the control structure for this instance.
three_phase_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
three_phase_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ three_phase_ctrl_t

typedef void three_phase_ctrl_t

Three-Phase control block. Allocate an instance specific control block to pass into the timer API calls.

Enumeration Type Documentation

◆ three_phase_channel_t

Timer channel indices

Enumerator
THREE_PHASE_CHANNEL_U 

U-channel index.

THREE_PHASE_CHANNEL_V 

V-channel index.

THREE_PHASE_CHANNEL_W 

W-channel index.

◆ three_phase_buffer_mode_t

Buffering mode

Enumerator
THREE_PHASE_BUFFER_MODE_SINGLE 

Single-buffer mode.

THREE_PHASE_BUFFER_MODE_DOUBLE 

Double-buffer mode.