5.7. PORT

5.7.1. Types

Base type

Type Name

Brief

enum

Port_PinDirectionType

Enum of Port Direction.

enum

Port_PinLevelValueType

Enum of Port Pin Level.

enum

Port_PinPadConfigType

Enum of Port Pin Pad, Up/Down Type selection.

enum

Port_PinQualificationMode

Values that can be passed to set qualification parameter to initialize MCU module.

enum

Port_PinCoreSelect

Values that can be passed to select master core for MCU module.

enum

Port_AnalogModeType

Values that can be passed to set the mode in which Pin should operate.

typedef uint32

Port_PinType

Type for symbolic name of Port pins.

typedef uint32

Port_PinModeType

Pin Mode type structure.

typedef uint8

Port_PinConfigFlagType

Type for Pin Config Flag. Pin config flags Bit 0 - Is Pin configurable? Bit 1 - Does Pin support Analog Mode? Bit 2 - Does Pin operate in AGPIO mode? Bit 3 - Does Pin operate in AIO mode? Bit 4 - Does Pin operate in GPIO mode?

5.7.1.1. enum Port_PinDirectionType

Enumerator

Value

Description

PORT_PIN_IN

Direction IN.

PORT_PIN_OUT

Direction OUT.

PORT_PIN_NA

NA Direction.

Brief: Enum of Port Direction.

5.7.1.2. enum Port_PinLevelValueType

Enumerator

Value

Description

PORT_PIN_LEVEL_HIGH

Pin Level HIGH.

PORT_PIN_LEVEL_LOW

Pin Level LOW.

PORT_PIN_LEVEL_NA

Pin Level NA.

Brief: Enum of Port Pin Level.

5.7.1.3. enum Port_PinPadConfigType

Enumerator

Value

Description

PORT_PIN_TYPE_STD

1U

Standard pad configuration with pull up disable.

PORT_PIN_TYPE_PULLUP

2U

Enable pull up for the pin.

PORT_PIN_TYPE_STD_PULLUP

3U

Standard pad configuration with pull up enable.

PORT_PIN_TYPE_OPEN_DRAIN

4U

Open Drain pad configuration with pull up disable.

PORT_PIN_TYPE_OPEN_DRAIN_PULLUP

6U

Open Drain pad configuration with pull up enable.

PORT_PIN_TYPE_NA

255U

No pad configuration.

Brief: Enum of Port Pin Pad, Up/Down Type selection.

5.7.1.4. enum Port_PinQualificationMode

Enumerator

Value

Description

PORT_QUAL_SYNC

Synchronization to SYSCLKOUT.

PORT_QUAL_3SAMPLE

Qualified with 3 samples.

PORT_QUAL_6SAMPLE

Qualified with 6 samples.

PORT_QUAL_ASYNC

No synchronization.

PORT_QUAL_NA

Invalid synchronization.

Brief: Values that can be passed to set qualification parameter to initialize MCU module.

5.7.1.5. enum Port_PinCoreSelect

Enumerator

Value

Description

PORT_CORE_CPU1

CPU1 selected as master core.

PORT_CORE_CPU2

CPU2 selected as master core.

PORT_CORE_CPU3

CPU3 selected as master core.

Brief: Values that can be passed to select master core for MCU module.

5.7.1.6. enum Port_AnalogModeType

Enumerator

Value

Description

PORT_ANALOG_DISABLED

Pin is in digital mode.

PORT_ANALOG_ENABLED

Pin is in analog mode.

Brief: Values that can be passed to set the mode in which Pin should operate.

5.7.1.7. typedef Port_PinType

typedef uint32 Port_PinType;

Brief: Type for symbolic name of Port pins.

5.7.1.8. typedef Port_PinModeType

typedef uint32 Port_PinModeType;

Brief: Pin Mode type structure.

5.7.1.9. typedef Port_PinConfigFlagType

typedef uint8 Port_PinConfigFlagType;

Brief: Type for Pin Config Flag. Pin config flags Bit 0 - Is Pin configurable? Bit 1 - Does Pin support Analog Mode? Bit 2 - Does Pin operate in AGPIO mode? Bit 3 - Does Pin operate in AIO mode? Bit 4 - Does Pin operate in GPIO mode?

5.7.2. Structures

Name

Brief

Port_PinModeConfigType

Pin Mux Mode Config type structure.

Port_PinConfigType

Pin Configuration structure.

Port_ConfigType

PORT Module ROOT configuration.

Port_ControllerSpecificType

Controller Specific structure.

5.7.3. Defines

Name

Brief

PORT_SW_MAJOR_VERSION

Driver Implementation Major Version.

PORT_SW_MINOR_VERSION

Driver Implementation Minor Version.

PORT_SW_PATCH_VERSION

Driver Implementation Patch Version.

PORT_AR_RELEASE_MAJOR_VERSION

AUTOSAR Major version specification implemented by PORT Driver.

PORT_AR_RELEASE_MINOR_VERSION

AUTOSAR Minor version specification implemented by PORT Driver.

PORT_AR_RELEASE_REVISION_VERSION

AUTOSAR Patch version specification implemented by PORT Driver.

PORT_VENDOR_ID

Texas Instruments Vendor ID.

PORT_MODULE_ID

PORT Driver Module ID.

PORT_INSTANCE_ID

PORT Driver Instance ID.

PORT_E_PARAM_PIN

Invalid Port Pin ID requested.

PORT_E_DIRECTION_UNCHANGEABLE

Port Pin not configured as changeable.

PORT_E_INIT_FAILED

API Port_Init service called with wrong parameter.

PORT_E_PARAM_INVALID_MODE

API Port_SetPinMode service called when mode is unchangeable.

PORT_E_MODE_UNCHANGEABLE

API Port_SetPinMode service called when mode is unchangeable.

PORT_E_UNINIT

API service called without module initialization.

PORT_E_PARAM_POINTER

APIs called with a Null pointer.

PORT_SID_INIT

Service ID - Port_Init().

PORT_SID_SET_PIN_DIR

Service ID - Port_SetPinDirection().

PORT_SID_REFRESH_PORT_DIR

Service ID - Port_RefreshPortDirection()

PORT_SID_GET_VERSION_INFO

Service ID - Port_GetVersionInfo().

PORT_SID_SET_PIN_MODE

Service ID - Port_SetPinMode().

PORT_SID_COMMIT_CONFIGURATION

Service ID - Port_CommitConfiguration().

5.7.4. Functions

Return type

Function Name

Brief

void

Port_Init(const Port_ConfigType * CfgPtr)

Initializes the Port Driver module.

void

Port_SetPinDirection(Port_PinType Pin, Port_PinDirectionType Direction)

Sets the port pin direction.

void

Port_RefreshPortDirection(void )

Refreshes port direction.

void

Port_GetVersionInfo(Std_VersionInfoType * versioninfo)

Service to get the version information of the module.

void

Port_SetPinMode(Port_PinType Pin, Port_PinModeType Mode)

Sets the port pin mode.

void

Port_CommitConfiguration(void )

Commits the locked Critical Configuration registers for the current Configuration.

5.7.4.1. function Port_Init

void Port_Init(
    const Port_ConfigType * CfgPtr
)

Brief: Initializes the Port Driver module.

This function is called by user to initialize the Port pins of the microcontroller

Parameters:

  • CfgPtr is the configuration pointer for Port module.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.7.4.2. function Port_SetPinDirection

void Port_SetPinDirection(
    Port_PinType Pin,
    Port_PinDirectionType Direction
)

Brief: Sets the port pin direction.

This function is used to change the direction of the pin during runtime.

Parameters:

  • Pin is the symbolic name of the pin.

  • Direction is the direction to which pin is to be set.

Returns:

  • None

Return: None

Precondition: Port_Init should be called before calling this function

Postcondition: None

5.7.4.3. function Port_RefreshPortDirection

void Port_RefreshPortDirection(
    void 
)

Brief: Refreshes port direction.

This function refreshes the Port pins to their initial direction. Pins whose direction can be changed during runtime are excluded from this action.

Returns:

  • None

Return: None

Precondition: Port_Init should be called before calling this function

Postcondition: None

5.7.4.4. function Port_GetVersionInfo

void Port_GetVersionInfo(
    Std_VersionInfoType * versioninfo
)

Brief: Service to get the version information of the module.

This service writes the version information of this module into the data structure referenced by the parameter. If this parameter references NULL_PTR, a development error is reported to Det. This service is only available if the pre-compile configuration parameter PORT_CFG_GET_VERSION_INFO_API is enabled.

Parameters:

  • versioninfo structure that contains the version information parameters.

Returns:

  • None

Return: None

Precondition: None

Postcondition: None

5.7.4.5. function Port_SetPinMode

void Port_SetPinMode(
    Port_PinType Pin,
    Port_PinModeType Mode
)

Brief: Sets the port pin mode.

This function is used to change the Mode of the pin during runtime.

Parameters:

  • Pin is the symbolic name of the pin.

  • Mode is desired functionality of the Pin e.g. PORT_PIN_MODE_ADC, PORT_PIN_MODE_DIO etc.

Returns:

  • None

Return: None

Precondition: Port_Init should be called before calling this function

Postcondition: None

5.7.4.6. function Port_CommitConfiguration

void Port_CommitConfiguration(
    void 
)

Brief: Commits the locked Critical Configuration registers for the current Configuration.

This function Commits the locked Critical Configuration registers for the current Configuration

Returns:

  • None

Return: None

Precondition: Port_Init should be called before calling this function

Postcondition: None