RZA Flexible Software Package Documentation  Release v1.1.0

 
General Timer (r_gtm)

Functions

fsp_err_t R_GTM_Close (timer_ctrl_t *const p_ctrl)
 
fsp_err_t R_GTM_PeriodSet (timer_ctrl_t *const p_ctrl, uint32_t const period_counts)
 
fsp_err_t R_GTM_DutyCycleSet (timer_ctrl_t *const p_ctrl, uint32_t const duty_cycle_counts, uint32_t const pin)
 
fsp_err_t R_GTM_Reset (timer_ctrl_t *const p_ctrl)
 
fsp_err_t R_GTM_Start (timer_ctrl_t *const p_ctrl)
 
fsp_err_t R_GTM_Enable (timer_ctrl_t *const p_ctrl)
 
fsp_err_t R_GTM_Disable (timer_ctrl_t *const p_ctrl)
 
fsp_err_t R_GTM_InfoGet (timer_ctrl_t *const p_ctrl, timer_info_t *const p_info)
 
fsp_err_t R_GTM_StatusGet (timer_ctrl_t *const p_ctrl, timer_status_t *const p_status)
 
fsp_err_t R_GTM_Stop (timer_ctrl_t *const p_ctrl)
 
fsp_err_t R_GTM_Open (timer_ctrl_t *const p_ctrl, timer_cfg_t const *const p_cfg)
 
fsp_err_t R_GTM_CallbackSet (timer_ctrl_t *const p_api_ctrl, void(*p_callback)(timer_callback_args_t *), void const *const p_context, timer_callback_args_t *const p_callback_memory)
 

Detailed Description

Driver for the GTM peripherals on RZ MPUs. This module implements the Timer Interface.

Overview

The GTM module can be used to count events, generate a periodic interrupt.

Features

The General timer has the following features:

Data Structures

struct  gtm_instance_ctrl_t
 
struct  gtm_extended_cfg_t
 

Enumerations

enum  gtm_giws_type_t
 
enum  gtm_timer_mode_t
 

Data Structure Documentation

◆ gtm_instance_ctrl_t

struct gtm_instance_ctrl_t

Channel control block. DO NOT INITIALIZE. Initialization occurs when timer_api_t::open is called.

◆ gtm_extended_cfg_t

struct gtm_extended_cfg_t

Optional GTM extension data structure.

Enumeration Type Documentation

◆ gtm_giws_type_t

Optional GTM interrupt setting

Enumerator
GTM_GIWS_TYPE_DISABLED 

Do not generate interrupt when timer started.

GTM_GIWS_TYPE_ENABLED 

Generates interrupt when timer started.

◆ gtm_timer_mode_t

Optional GTM timer mode setting

Enumerator
GTM_TIMER_MODE_INTERVAL 

Use interval timer mode.

GTM_TIMER_MODE_FREERUN 

Use free-running comparison mode.

Function Documentation

◆ R_GTM_Close()

fsp_err_t R_GTM_Close ( timer_ctrl_t *const  p_ctrl)

Stops counter, disables interrupts, disables output pins, and clears internal driver data. Implements timer_api_t::close.

Return values
FSP_SUCCESSTimer closed.
FSP_ERR_ASSERTIONp_ctrl is NULL.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_GTM_PeriodSet()

fsp_err_t R_GTM_PeriodSet ( timer_ctrl_t *const  p_ctrl,
uint32_t const  period_counts 
)

Updates period. The new period is updated immediately and the counter is reset to the maximum value. Implements timer_api_t::periodSet.

Warning
If periodic output is used, the duty cycle buffer registers are updated after the period buffer register. If this function is called while the timer is running and an GTM underflow occurs during processing, the duty cycle will not be the desired 50% duty cycle until the counter underflow after processing completes.
Stop the timer before calling this function if one-shot output is used.
Return values
FSP_SUCCESSPeriod value updated.
FSP_ERR_ASSERTIONA required pointer was NULL, or the period was not in the valid range of 1 to 0xFFFF.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_GTM_DutyCycleSet()

fsp_err_t R_GTM_DutyCycleSet ( timer_ctrl_t *const  p_ctrl,
uint32_t const  duty_cycle_counts,
uint32_t const  pin 
)

Updates duty cycle. If the timer is counting, the new duty cycle is reflected after the next counter underflow. Implements timer_api_t::dutyCycleSet.

Return values
FSP_ERR_UNSUPPORTED

◆ R_GTM_Reset()

fsp_err_t R_GTM_Reset ( timer_ctrl_t *const  p_ctrl)

Resets the counter value to the period minus one. Implements timer_api_t::reset.

Return values
FSP_ERR_UNSUPPORTEDSelected function not supported by this module.

◆ R_GTM_Start()

fsp_err_t R_GTM_Start ( timer_ctrl_t *const  p_ctrl)

Starts timer. Implements timer_api_t::start.

Return values
FSP_SUCCESSTimer started.
FSP_ERR_ASSERTIONp_ctrl is null.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_GTM_Enable()

fsp_err_t R_GTM_Enable ( timer_ctrl_t *const  p_ctrl)

Enables external event triggers that start, stop, clear, or capture the counter. Implements timer_api_t::enable.

Return values
FSP_ERR_UNSUPPORTEDSelected function not supported by this module.

◆ R_GTM_Disable()

fsp_err_t R_GTM_Disable ( timer_ctrl_t *const  p_ctrl)

Disables external event triggers that start, stop, clear, or capture the counter. Implements timer_api_t::disable.

Return values
FSP_ERR_UNSUPPORTEDSelected function not supported by this module.

◆ R_GTM_InfoGet()

fsp_err_t R_GTM_InfoGet ( timer_ctrl_t *const  p_ctrl,
timer_info_t *const  p_info 
)

Gets timer information and store it in provided pointer p_info. Implements timer_api_t::infoGet.

Return values
FSP_SUCCESSPeriod, count direction, and frequency stored in p_info.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_GTM_StatusGet()

fsp_err_t R_GTM_StatusGet ( timer_ctrl_t *const  p_ctrl,
timer_status_t *const  p_status 
)

Retrieves the current state and counter value stores them in p_status. Implements timer_api_t::statusGet.

Return values
FSP_SUCCESSCurrent status and counter value provided in p_status.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_GTM_Stop()

fsp_err_t R_GTM_Stop ( timer_ctrl_t *const  p_ctrl)

Stops the timer. Implements timer_api_t::stop.

Return values
FSP_SUCCESSTimer stopped.
FSP_ERR_ASSERTIONp_ctrl was NULL.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_GTM_Open()

fsp_err_t R_GTM_Open ( timer_ctrl_t *const  p_ctrl,
timer_cfg_t const *const  p_cfg 
)

Initializes the GTM module instance. Implements timer_api_t::open.

The GTM hardware does not support one-shot functionality natively. The one-shot feature is therefore implemented in the GTM HAL layer. For a timer configured as a one-shot timer, the timer is stopped upon the first timer expiration.

The GTM implementation of the general timer can accept an optional gtm_extended_cfg_t extension parameter. For GTM, the extension specifies the clock to be used as timer source and the output pin configurations. If the extension parameter is not specified (NULL), the default clock P0CLK is used and the output pins are disabled.

Return values
FSP_SUCCESSInitialization was successful and timer has started.
FSP_ERR_ASSERTIONA required input pointer is NULL or the period is not in the valid range of 1 to 0xFFFF.
FSP_ERR_ALREADY_OPENR_GTM_Open has already been called for this p_ctrl.
FSP_ERR_IRQ_BSP_DISABLEDA required interrupt has not been enabled in the vector table.
FSP_ERR_IP_CHANNEL_NOT_PRESENTRequested channel number is not available on GTM.

◆ R_GTM_CallbackSet()

fsp_err_t R_GTM_CallbackSet ( timer_ctrl_t *const  p_api_ctrl,
void(*)(timer_callback_args_t *)  p_callback,
void const *const  p_context,
timer_callback_args_t *const  p_callback_memory 
)

Updates the user callback with the option to provide memory for the callback argument structure. Implements timer_api_t::callbackSet.

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_NO_CALLBACK_MEMORYp_callback is non-secure and p_callback_memory is either secure or NULL.