4.8. PORT

4.8.1. About This Document

Document Title

User Guide of MCAL PORT Driver

Document Version

Version 1.0

Company

Texas Instruments

Document Name

PORT User Guide

4.8.2. Document Revision History

Version

Date

Revision History

Status

Version 1.0

13 Oct 2023

Initial Version

Approved

4.8.3. Table of contents

  1. Acronyms and Definitions

  2. Functional Overview

  3. Deviations to requirements (Requirement Traceability)

  4. Integration Details

  5. API Description

  6. Configuration Description

  7. Memory Mapping

  8. Memory footprint

  9. Performance

  10. Example Usage

  11. FAQ’s

  12. Test Report (Link to test report)

  13. References

  14. Disclaimer

4.8.4. Acronyms and Definitions

Acronyms and Definitions used are presented in below table.

Acronyms

Descriptions

BSW

Basic Software

DET

Default Error Tracer

ADC

Analogue Digital Converter

MCU

Micro Controller Unit

OS

Operating System

API

Application Programming Interface

HW

Hardware

SW

Software

4.8.5. Functional Overview

4.8.5.1. Brief Overview

This document describes MCAL PORT Driver functionality, its application interfaces and configuration details as per AUTOSAR version 4.3.1 .

Supported AUTOSAR Release

4.3.1

Supported Configuration Variants

Pre-Compile, Post-build

Vendor ID

PORT_VENDOR_ID (44)

Module ID

PORT_MODULE_ID (124)

Supported Platform

AM263px

PORT module shall provide the service for initializing the whole PORT structure of the microcontroller. This driver specification is applicable for on-chip ports and port pins.

4.8.5.1.1. PORT Driver Architecture

The following figure shows where the PORT is located in the AUTOSAR architecture

../_images/port_image1.jpg

Figure 1: PORT in AUTOSAR architecture.

4.8.5.1.2. Initialization

Port_Init API initializes the PORT driver and does pin configuration of specified PORT PIN Id’s. Port_Init also enables all pins for specified module selected in the config structure passed to Port_Init.

4.8.5.1.3. States

No state is maintained in the PORT driver.

4.8.5.2. Features Supported and Not Supported

AUTOSAR features:

IP Supported Features

AUTOSAR Supported Features

Not Supported

Configuring the pins for rising and/or falling edge, specified for each GPIO pin.

The PORT Driver module shall initialize the whole port structure of the microcontroller.

None

Configuring the GPIO signal conditioning chain

  1. Invert/Non-invert

  2. Signal Qualification:

    • Asynchronous input

    • Synchronise to SYSCLK

    • Qualification using sampling window

The PORT Driver module shall allow the configuration of different functionality for each port and port pin. e.g. ADC, SPI, DIO etc.

None

Enabling all pins of specified peripheral for given mode of operation. This option provides a way configuring all pins for a peripheral for required mode of operation.

The PORT Driver module shall provide additional configurations for the MCU port/port pins:

  1. Pin direction (input/output)

  2. Pin level initial value

  3. Pin direction changeable during runtime (yes/no)

  4. Port mode changeable during runtime

None

The PORT Driver module shall provide a number of optional configurations for the MCU ports and port pins (if supported by hardware):

  1. Slew rate control

  2. Activation of internal pull-ups

  3. Type of Readback support (pin level, output register value).

None

4.8.5.3. Assumptions

None

4.8.5.4. Limitations

The Pins which are configured as GPIO, the parameter “PortInputOverrideCtrl” and “PortOutputOverrideCtrl” should be as disabled.

../_images/port_image2.jpg

Figure 2:Configuration settings.

4.8.5.6. File Structure

Description of static files is provided below:

Static source and header files

Description

Port.h

Contains the API’s of the PORT driver to be used by upper layers.

Port.c

Contains the implementation of the API’s for PORT driver.

Port_Priv.c

Contains Internal functions definition of PORT driver.

Port_Priv.h

Contains Internal functions declaration of PORT driver.

Description of generated files is provided below:

Plugin Files

Descriptions

Port_Cfg.h

Contains the Precompile switches, Symbolic names of PortPin.

Port_PBcfg.c

Contains all pins Post-Build Configured parameters

Port_Cfg.c

Contains all pins Pre-Compile Configured parameters

../_images/port_image3.jpg

Figure 4: PORT header file include structure

4.8.6. Deviations to requirements (Requirement Traceability)

4.8.6.1. Module Requirements

Will be updated in future release

4.8.6.2. Deviation of requirements against AUTOSAR specification requirements

Will be updated in future release

4.8.7. Integration Details

4.8.7.1. Dependency on Other Software Modules

PORT driver doesn’t depend on other peripheral drivers

4.8.7.1.1. Error Handling module

4.8.7.1.1.1. DET

The module PORT depends on the DET (by default) in order to report development errors. Detection and reporting of development errors can be enabled or disabled by the switch PORT_DEV_ERROR_DETECT = STD_ON in the Port_Cfg.h

AUTOSAR requires that API functions shall check the validity of their respective parameters. These checks are for development error reporting and can be enabled or disabled.

The errors reported to DET module are described in the following table:

Error Code

Error Macro

Description

[0x0A]

PORT_E_PARAM_PIN

Invalid Port Pin ID requested

[0x0B]

PORT_E_DIRECTION_UNCHANGEABLE

Port Pin not configured as changeable

[0x0C]

PORT_E_INIT_FAILED

API Port_Init service called with wrong parameter.

[0x0D]

PORT_E_PARAM_INVALID_MODE

API Port_SetPinMode service called when mode is unchangeable.

[0x0E]

PORT_E_MODE_UNCHANGEABLE

API Port_SetPinMode service called when mode is unchangeable.

[0x0F]

PORT_E_UNINIT

API service called without module initialization

[0x10]

PORT_E_PARAM_POINTER

APIs called with a Null Pointer

The run time errors reported to DET module are described in the following table:

4.8.7.1.1.2. DEM

There are no DEM errors.

4.8.7.1.1.3. Callback Notification

There are no Callback Notifications.

4.8.7.2. Hardware - Software - ISR API name mapping

The PORT module doesn’t have interrupt service routines.

4.8.7.3. Scheduling Strategy

4.8.7.3.1. SchM

Beside the OS the BSW Scheduler provides functions that module PORT calls at begin and end of critical sections.

4.8.7.3.2. Critical Sections

There is only one kind of critical sections in this driver. Within these sections all read /modify / write accesses to internal MCU status variables must be protected. This is handled internally in the driver by invoking SchM_Enter_Port_PORT_EXCLUSIVE_AREA_0()/SchM_Exit_Port_PORT_EXCLUSIVE_AREA_0().

4.8.8. API Description

4.8.8.1. Description of the API’s (Can be referred to Api Guide spec)

Refer the AUTOSAR SWS for API documentation and Type definition.

4.8.8.2. List of API’s

The following table presents the list of API’s:

Service ID

Autosar API’s Supported Service

Autosar API’s not Supported Service

0x00

Port_Init

0x01

Port_SetPinDirection

0x02

Port_RefreshPortDirection

0x03

Port_GetVersionInfo

0x04

Port_SetPinMode

Refer Autosar SWS for API description mentioned in above table.

4.8.8.3. Description on Non Standard API’s

Port_DeInit API

This function is Non- Autosar based and is used to de-initialize port module.

4.8.9. Configuration Description

4.8.9.1. Configuration Variants

The PORT can be configured as Post-Build or Pre-Compile variant, using EB tresos tool.

Variants

Generated Files

PostBuild

Port_PBcfg.c , Port_Cfg.h

Pre-Compile

Port_Cfg.c , Port_Cfg.h

4.8.9.2. Parameter Description

Will be updated in future release

4.8.9.3. Symbolic Names deviations

None.

4.8.9.4. Configuration rules and constraints to enable possibility checks

Will be updated in future release

4.8.10. Memory Mapping

Memory Mapping Sections

PORT_CODE

PORT_VAR_ZERO_INIT

PORT_PBCFG

PORT_START_SEC_VAR_INIT_UNSPECIFIED (.data)

x

PORT_STOP_SEC_VAR_INIT_UNSPECIFIED

x

PORT_START_SEC_CODE (.bss)

x

PORT_STOP_SEC_CODE

x

PORT_START_SEC_CONFIG_DATA

x

PORT_STOP_SEC_CONFIG_DATA

x

4.8.11. Memory footprint

Please refer Memory Footprint for more details.

4.8.12. Performance

Not Applicable

4.8.13. Example Usage

4.8.13.1. Steps to build and run example

PORT example application demonstrating the MCAL PORT driver features is in folder <MCAL_ROOT>/examples/Port.

This application can be built from the root folder by giving gmake –s port_app PLATFORM=am263.

Once the build is completed we get a binary file, which is loaded in our controller and executed.

4.8.13.2. External set up Information

PORT module is tested using CC board (PROC111E2).

4.8.13.3. Configuration used to test this example

Pin configurations : Following pins are configured as a GPIO and used in example application to test.

Pin Ball Number

Pin Signal Name

C15

GPIOGH_120

4.8.13.4. Example Logs

CLANG compiled : portApp: Sample Application - STARTS !!!
Port Driver version info:8.6.2
Port Driver Module/Driver:124.44

Pin Value for channel 0 : 1

Dio_FlipChannel(channel_0)
Pin Value for channel 0 : 0

Dio_FlipChannel(channel_0)
Pin Value for channel 0 : 1

Pin Value for channel 0 : 0
Dio_FlipChannel(channel_0)
Pin Value for channel 0 : 0

PORT Test Passed!!!

4.8.14. FAQ’s

None

4.8.16. References

Autosar SWS 4.3.1 will be updated in future release.

Technical Reference Manual

4.8.17. Disclaimer

Will be updated in future release.