Synergy Software Package User's Manual

Driver for the I/O Ports. More...

Functions

ssp_err_t R_IOPORT_Init (const ioport_cfg_t *p_cfg)
 Initializes internal driver data, then calls R_IOPORT_PinsCfg to configure pins. More...
 
ssp_err_t R_IOPORT_PinsCfg (const ioport_cfg_t *p_cfg)
 Configures the functions of multiple pins by loading configuration data into pin PFS registers. Implements ioport_api_t::pinsCfg. More...
 
ssp_err_t R_IOPORT_PinCfg (ioport_port_pin_t pin, uint32_t cfg)
 Configures the settings of a pin. Implements ioport_api_t::pinCfg. More...
 
ssp_err_t R_IOPORT_PinRead (ioport_port_pin_t pin, ioport_level_t *p_pin_value)
 Reads the level on a pin. Implements ioport_api_t::pinRead. More...
 
ssp_err_t R_IOPORT_PortRead (ioport_port_t port, ioport_size_t *p_port_value)
 Reads the value on an IO port. Implements ioport_api_t::portRead. More...
 
ssp_err_t R_IOPORT_PortWrite (ioport_port_t port, ioport_size_t value, ioport_size_t mask)
 Writes to multiple pins on a port. Implements ioport_api_t::portWrite. More...
 
ssp_err_t R_IOPORT_PinWrite (ioport_port_pin_t pin, ioport_level_t level)
 Sets a pin's output either high or low. Implements ioport_api_t::pinWrite. More...
 
ssp_err_t R_IOPORT_PortDirectionSet (ioport_port_t port, ioport_size_t direction_values, ioport_size_t mask)
 Sets the direction of individual pins on a port. Implements ioport_api_t::portDirectionSet(). More...
 
ssp_err_t R_IOPORT_PinDirectionSet (ioport_port_pin_t pin, ioport_direction_t direction)
 Sets the direction of an individual pin on a port. Implements ioport_api_t::pinDirectionSet. More...
 
ssp_err_t R_IOPORT_PortEventInputRead (ioport_port_t port, ioport_size_t *p_event_data)
 Reads the value of the event input data. Implements ioport_api_t::portEventInputRead(). More...
 
ssp_err_t R_IOPORT_PinEventInputRead (ioport_port_pin_t pin, ioport_level_t *p_pin_event)
 Reads the value of the event input data of a specific pin. Implements ioport_api_t::pinEventInputRead. More...
 
ssp_err_t R_IOPORT_PortEventOutputWrite (ioport_port_t port, ioport_size_t event_data, ioport_size_t mask_value)
 This function writes the set and reset event output data for a port. Implements ioport_api_t::portEventOutputWrite. More...
 
ssp_err_t R_IOPORT_PinEventOutputWrite (ioport_port_pin_t pin, ioport_level_t pin_value)
 This function writes the event output data value to a pin. Implements ioport_api_t::pinEventOutputWrite. More...
 
ssp_err_t R_IOPORT_VersionGet (ssp_version_t *p_data)
 Returns IOPort HAL driver version. Implements ioport_api_t::versionGet. More...
 
ssp_err_t R_IOPORT_EthernetModeCfg (ioport_ethernet_channel_t channel, ioport_ethernet_mode_t mode)
 Configures Ethernet channel PHY mode. Implements ioport_api_t::ethModeCfg. More...
 

Detailed Description

Driver for the I/O Ports.

The IOPort HAL drivers provide the ability to access the I/O Ports of a device at both bit and port level. Port and pin direction can be changed. In addition a number of configuration APIs are provided to change the functionality of individual pins.

Function Documentation

◆ R_IOPORT_EthernetModeCfg()

ssp_err_t R_IOPORT_EthernetModeCfg ( ioport_ethernet_channel_t  channel,
ioport_ethernet_mode_t  mode 
)

Configures Ethernet channel PHY mode. Implements ioport_api_t::ethModeCfg.

Return values
SSP_SUCCESSEthernet PHY mode set.
SSP_ERR_INVALID_ARGUMENTChannel or mode not valid.
SSP_ERR_UNSUPPORTEDEthernet configuration not supported on this device.
Note
This function is not re-entrant.

◆ R_IOPORT_Init()

ssp_err_t R_IOPORT_Init ( const ioport_cfg_t p_cfg)

Initializes internal driver data, then calls R_IOPORT_PinsCfg to configure pins.

Return values
SSP_SUCCESSPin configuration data written to PFS register(s)
SSP_ERR_ASSERTIONNULL pointer
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

◆ R_IOPORT_PinCfg()

ssp_err_t R_IOPORT_PinCfg ( ioport_port_pin_t  pin,
uint32_t  cfg 
)

Configures the settings of a pin. Implements ioport_api_t::pinCfg.

Return values
SSP_SUCCESSPin configured.
SSP_ERR_INVALID_ARGUMENTInvalid pin
Note
This function is re-entrant for different pins. This function will change the configuration of the pin with the new configuration. For example it is not possible with this function to change the drive strength of a pin while leaving all the other pin settings unchanged. To achieve this the original settings with the required change will need to be written using this function.

◆ R_IOPORT_PinDirectionSet()

ssp_err_t R_IOPORT_PinDirectionSet ( ioport_port_pin_t  pin,
ioport_direction_t  direction 
)

Sets the direction of an individual pin on a port. Implements ioport_api_t::pinDirectionSet.

Return values
SSP_SUCCESSPin direction updated.
SSP_ERR_INVALID_ARGUMENTThe pin and/or direction not valid.
Note
This function is re-entrant for different pins.

◆ R_IOPORT_PinEventInputRead()

ssp_err_t R_IOPORT_PinEventInputRead ( ioport_port_pin_t  pin,
ioport_level_t p_pin_event 
)

Reads the value of the event input data of a specific pin. Implements ioport_api_t::pinEventInputRead.

The pin event data is captured in response to a trigger from the ELC. This function enables this data to be read. Using the event system allows the captured data to be stored when it occurs and then read back at a later time.

Return values
SSP_SUCCESSPin read.
SSP_ERR_INVALID_ARGUMENTPin not valid.
SSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant.

◆ R_IOPORT_PinEventOutputWrite()

ssp_err_t R_IOPORT_PinEventOutputWrite ( ioport_port_pin_t  pin,
ioport_level_t  pin_value 
)

This function writes the event output data value to a pin. Implements ioport_api_t::pinEventOutputWrite.

Using the event system enables a pin state to be stored by this function in advance of being output on the pin. The output to the pin will occur when the ELC event occurs.

Return values
SSP_SUCCESSPin event data written.
SSP_ERR_INVALID_ARGUMENTPin or value not valid.
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PinRead()

ssp_err_t R_IOPORT_PinRead ( ioport_port_pin_t  pin,
ioport_level_t p_pin_value 
)

Reads the level on a pin. Implements ioport_api_t::pinRead.

Return values
SSP_SUCCESSPin read.
SSP_ERR_INVALID_ARGUMENTInvalid argument
SSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different pins.

◆ R_IOPORT_PinsCfg()

ssp_err_t R_IOPORT_PinsCfg ( const ioport_cfg_t p_cfg)

Configures the functions of multiple pins by loading configuration data into pin PFS registers. Implements ioport_api_t::pinsCfg.

This function initializes the supplied list of PmnPFS registers with the supplied values. This data can be generated by the ISDE pin configurator or manually by the developer. Different pin configurations can be loaded for different situations such as low power modes and test.*

Return values
SSP_SUCCESSPin configuration data written to PFS register(s)
SSP_ERR_ASSERTIONNULL pointer

◆ R_IOPORT_PinWrite()

ssp_err_t R_IOPORT_PinWrite ( ioport_port_pin_t  pin,
ioport_level_t  level 
)

Sets a pin's output either high or low. Implements ioport_api_t::pinWrite.

Return values
SSP_SUCCESSPin written to.
SSP_ERR_INVALID_ARGUMENTThe pin and/or level not valid.
Note
This function is re-entrant for different pins. This function makes use of the PCNTR3 register to atomically modify the level on the specified pin on a port.

◆ R_IOPORT_PortDirectionSet()

ssp_err_t R_IOPORT_PortDirectionSet ( ioport_port_t  port,
ioport_size_t  direction_values,
ioport_size_t  mask 
)

Sets the direction of individual pins on a port. Implements ioport_api_t::portDirectionSet().

Multiple pins on a port can be set to inputs or outputs at once. Each bit in the mask parameter corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. If a bit is set to 1 then the corresponding pin will be changed to an input or an output as specified by the direction values. If a mask bit is set to 0 then the direction of the pin will not be changed.

Return values
SSP_SUCCESSPort direction updated.
SSP_ERR_INVALID_ARGUMENTThe port and/or mask not valid.
Note
This function is re-entrant for different ports.

High bits

Low bits

New value to write to port direction register

◆ R_IOPORT_PortEventInputRead()

ssp_err_t R_IOPORT_PortEventInputRead ( ioport_port_t  port,
ioport_size_t p_event_data 
)

Reads the value of the event input data. Implements ioport_api_t::portEventInputRead().

The event input data for the port will be read. Each bit in the returned value corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on.

The port event data is captured in response to a trigger from the ELC. This function enables this data to be read. Using the event system allows the captured data to be stored when it occurs and then read back at a later time.

Return values
SSP_SUCCESSPort read.
SSP_ERR_INVALID_ARGUMENTPort not valid.
SSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortEventOutputWrite()

ssp_err_t R_IOPORT_PortEventOutputWrite ( ioport_port_t  port,
ioport_size_t  event_data,
ioport_size_t  mask_value 
)

This function writes the set and reset event output data for a port. Implements ioport_api_t::portEventOutputWrite.

Using the event system enables a port state to be stored by this function in advance of being output on the port. The output to the port will occur when the ELC event occurs.

The input value will be written to the specified port when an ELC event configured for that port occurs. Each bit in the value parameter corresponds to a bit on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. Each bit in the mask parameter corresponds to a pin on the port.

Return values
SSP_SUCCESSPort event data written.
SSP_ERR_INVALID_ARGUMENTPort and/or mask not valid.
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortRead()

ssp_err_t R_IOPORT_PortRead ( ioport_port_t  port,
ioport_size_t p_port_value 
)

Reads the value on an IO port. Implements ioport_api_t::portRead.

The specified port will be read, and the levels for all the pins will be returned. Each bit in the returned value corresponds to a pin on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. *

Return values
SSP_SUCCESSPort read.
SSP_ERR_INVALID_ARGUMENTPort not valid.
SSP_ERR_ASSERTIONNULL pointer
Note
This function is re-entrant for different ports.

◆ R_IOPORT_PortWrite()

ssp_err_t R_IOPORT_PortWrite ( ioport_port_t  port,
ioport_size_t  value,
ioport_size_t  mask 
)

Writes to multiple pins on a port. Implements ioport_api_t::portWrite.

The input value will be written to the specified port. Each bit in the value parameter corresponds to a bit on the port. For example, bit 7 corresponds to pin 7, bit 6 to pin 6, and so on. Each bit in the mask parameter corresponds to a pin on the port.

Only the bits with the corresponding bit in the mask value set will be updated. e.g. value = 0xFFFF, mask = 0x0003 results in only bits 0 and 1 being updated.

Return values
SSP_SUCCESSPort written to.
SSP_ERR_INVALID_ARGUMENTThe port and/or mask not valid.
Note
This function is re-entrant for different ports. This function makes use of the PCNTR3 register to atomically modify the levels on the specified pins on a port.

High bits

Low bits

◆ R_IOPORT_VersionGet()

ssp_err_t R_IOPORT_VersionGet ( ssp_version_t p_data)

Returns IOPort HAL driver version. Implements ioport_api_t::versionGet.

Return values
SSP_SUCCESSVersion information read.
SSP_ERR_ASSERTIONThe parameter p_data is NULL.
Note
This function is reentrant.