123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 |
- /*==================================================================================================
- * Project : RTD AUTOSAR 4.4
- * Platform : CORTEXM
- * Peripheral : PORT_CI
- * Dependencies : none
- *
- * Autosar Version : 4.4.0
- * Autosar Revision : ASR_REL_4_4_REV_0000
- * Autosar Conf.Variant :
- * SW Version : 1.0.0
- * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
- *
- * (c) Copyright 2020-2021 NXP Semiconductors
- * All Rights Reserved.
- *
- * NXP Confidential. This software is owned or controlled by NXP and may only be
- * used strictly in accordance with the applicable license terms. By expressly
- * accepting such terms or by downloading, installing, activating and/or otherwise
- * using the software, you are agreeing that you have read, and that you agree to
- * comply with and are bound by, such license terms. If you do not agree to be
- * bound by the applicable license terms, then you may not retain, install,
- * activate or otherwise use the software.
- ==================================================================================================*/
- /**
- * @file Port.c
- *
- * @implements Port.c_Artifact
- * @brief Autosar Port driver main source file
- * @details Port driver file that contains the implementation of the interface functions
- *
- * @addtogroup Port_HLD
- * @{
- */
- #ifdef __cplusplus
- extern "C"{
- #endif
- /*=================================================================================================
- * INCLUDE FILES
- * 1) system and project includes
- * 2) needed interfaces from external units
- * 3) internal and external interfaces from this unit
- =================================================================================================*/
- #include "Port.h"
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- #include "Det.h"
- #endif
- /*=================================================================================================
- * SOURCE FILE VERSION INFORMATION
- =================================================================================================*/
- /**
- * @brief Parameters that shall be published within the Port driver header file and also in the
- * module's description file
- */
- #define PORT_VENDOR_ID_C 43
- #define PORT_AR_RELEASE_MAJOR_VERSION_C 4
- #define PORT_AR_RELEASE_MINOR_VERSION_C 4
- #define PORT_AR_RELEASE_REVISION_VERSION_C 0
- #define PORT_SW_MAJOR_VERSION_C 1
- #define PORT_SW_MINOR_VERSION_C 0
- #define PORT_SW_PATCH_VERSION_C 0
- /*=================================================================================================
- * FILE VERSION CHECKS
- =================================================================================================*/
- /* Check if source file and Port header file are of the same vendor */
- #if (PORT_VENDOR_ID_C != PORT_VENDOR_ID_H)
- #error "Port.c and Port.h have different vendor ids"
- #endif
- /* Check if source file and Port header file are of the same Autosar version */
- #if ((PORT_AR_RELEASE_MAJOR_VERSION_C != PORT_AR_RELEASE_MAJOR_VERSION_H) || \
- (PORT_AR_RELEASE_MINOR_VERSION_C != PORT_AR_RELEASE_MINOR_VERSION_H) || \
- (PORT_AR_RELEASE_REVISION_VERSION_C != PORT_AR_RELEASE_REVISION_VERSION_H) \
- )
- #error "AutoSar Version Numbers of Port.c and Port.h are different"
- #endif
- /* Check if source file and Port header file are of the same Software version */
- #if ((PORT_SW_MAJOR_VERSION_C != PORT_SW_MAJOR_VERSION_H) || \
- (PORT_SW_MINOR_VERSION_C != PORT_SW_MINOR_VERSION_H) || \
- (PORT_SW_PATCH_VERSION_C != PORT_SW_PATCH_VERSION_H) \
- )
- #error "Software Version Numbers of Port.c and Port.h are different"
- #endif
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
- /* Check if the source file and Det.h file are of the same Autosar version */
- #if ((PORT_AR_RELEASE_MAJOR_VERSION_C != DET_AR_RELEASE_MAJOR_VERSION) || \
- (PORT_AR_RELEASE_MINOR_VERSION_C != DET_AR_RELEASE_MINOR_VERSION) \
- )
- #error "AutoSar Version Numbers of Port.c and Det.h are different"
- #endif
- #endif
- #endif
- /*=================================================================================================
- * LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
- =================================================================================================*/
- /*=================================================================================================
- * LOCAL MACROS
- =================================================================================================*/
- /*=================================================================================================
- * LOCAL CONSTANTS
- =================================================================================================*/
- #if (STD_ON == PORT_MULTICORE_ENABLED)
- #define Port_GetCoreID() OsIf_GetCoreID()
- #else
- #define Port_GetCoreID() ((uint32)0UL)
- #endif
- /*=================================================================================================
- * LOCAL VARIABLES
- =================================================================================================*/
- /*=================================================================================================
- * GLOBAL CONSTANTS
- =================================================================================================*/
- /*=================================================================================================
- * GLOBAL VARIABLES
- =================================================================================================*/
- #define PORT_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
- #include "Port_MemMap.h"
- static const Port_ConfigType * Port_pConfig;
- #define PORT_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
- #include "Port_MemMap.h"
- #define PORT_START_SEC_CONFIG_DATA_UNSPECIFIED
- #include "Port_MemMap.h"
- #if (STD_ON == PORT_PRECOMPILE_SUPPORT)
- extern Port_ConfigType Port_Config;
- #endif
- #define PORT_STOP_SEC_CONFIG_DATA_UNSPECIFIED
- #include "Port_MemMap.h"
- /*=================================================================================================
- * LOCAL FUNCTION PROTOTYPES
- =================================================================================================*/
- /*=================================================================================================
- * LOCAL FUNCTIONS
- =================================================================================================*/
- #define PORT_START_SEC_CODE
- #include "Port_MemMap.h"
- /*=================================================================================================
- * GLOBAL FUNCTIONS
- =================================================================================================*/
- /**
- * @brief Initializes the Port Driver module.
- * @details The function @p Port_Init() will initialize ALL ports and port pins
- * with the configuration set pointed to by the parameter @p pConfigPtr.
- * @post Port_Init() must be called before all other Port Driver module's functions
- * otherwise no operation can occur on the MCU ports and port pins.
- *
- * @param[in] ConfigPtr A pointer to the structure which contains
- * initialization parameters.
- *
- * @implements Port_Init_Activity
- */
- void Port_Init
- (
- const Port_ConfigType * ConfigPtr
- )
- {
- const Port_ConfigType * pLocalConfigPtr = ConfigPtr;
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- #if (STD_OFF == PORT_PRECOMPILE_SUPPORT)
- if (NULL_PTR == ConfigPtr)
- #else /*(STD_OFF == PORT_PRECOMPILE_SUPPORT) */
- if (NULL_PTR != ConfigPtr)
- #endif /* (STD_OFF == PORT_PRECOMPILE_SUPPORT) */
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, PORT_INSTANCE_ID, (uint8)PORT_INIT_ID, (uint8)PORT_E_INIT_FAILED);
- }
- else
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- {
- #if (STD_ON == PORT_PRECOMPILE_SUPPORT)
- pLocalConfigPtr = &Port_Config;
- #endif /* (STD_ON == PORT_PRECOMPILE_SUPPORT) */
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- if ((uint32)1 != pLocalConfigPtr->pau8Port_PartitionList[CoreId])
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, PORT_INSTANCE_ID, (uint8)PORT_INIT_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- else
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- {
- Port_Ipw_Init(pLocalConfigPtr);
- /* Save configuration pointer in global variable */
- Port_pConfig = pLocalConfigPtr;
- }
- }
- }
- #if (STD_ON == PORT_SET_PIN_DIRECTION_API)
- /**
- * @brief Sets the port pin direction.
- * @details The function @p Port_SetPinDirection() will set the port pin direction
- * during runtime.
- * @pre @p Port_Init() must have been called first. In order to change the
- * pin direction the PortPinDirectionChangeable flag must have been set
- * to @p TRUE.
- *
- * @param[in] Pin Pin ID number.
- * @param[in] Direction Port Pin direction.
- *
- * @implements Port_SetPinDirection_Activity
- */
- void Port_SetPinDirection
- (
- Port_PinType Pin,
- Port_PinDirectionType Direction
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- /* Variable used to store current error status */
- Std_ReturnType ErrStatus;
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- /* Check if Port module is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINDIRECTION_ID, (uint8)PORT_E_UNINIT);
- }
- /* Check port pin validity */
- else if (Pin >= (Port_PinType)Port_pConfig->u16NumPins)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINDIRECTION_ID, (uint8)PORT_E_PARAM_PIN);
- }
- else if ((uint32)1 != (((Port_pConfig->pau32Port_PinToPartitionMap[Pin])&((uint32)1 << CoreId)) >> CoreId))
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINDIRECTION_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- else
- #endif /* PORT_DEV_ERROR_DETECT */
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- ErrStatus = Port_Ipw_SetPinDirection(Pin, Direction, Port_pConfig);
- #else
- (void)Port_Ipw_SetPinDirection(Pin, Direction, Port_pConfig);
- #endif
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- if ((Std_ReturnType)E_NOT_OK == ErrStatus)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINDIRECTION_ID, (uint8)PORT_E_DIRECTION_UNCHANGEABLE);
- }
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- }
- }
- #endif /* (STD_ON == PORT_SET_PIN_DIRECTION_API) */
- #ifdef PORT_SET_2_PINS_DIRECTION_API
- #if (STD_ON == PORT_SET_2_PINS_DIRECTION_API)
- /**
- * @brief Sets the direction of 2 pins.
- * @details The function @p Port_Set2PinsDirection() will set the port pins direction
- * during runtime.
- * @pre @p Port_Init() must have been called first. In order to change the
- * pin direction the PortPinDirectionChangeable flag must have been set
- * to @p TRUE for both pins.
- *
- * @param[in] Pin1 Pin 1 ID number.
- * @param[in] Pin2 Pin 2 ID number.
- * @param[in] Direction Port Pin direction.
- *
- * Port_Set2PinsDirection_Activity
- * @api
- */
- void Port_Set2PinsDirection
- (
- Port_PinType Pin1,
- Port_PinType Pin2,
- Port_PinDirectionType Direction
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- /* Variable used to store current error status */
- Std_ReturnType ErrStatus = (Std_ReturnType)E_OK;
- /* Check if Port module is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SET2PINSDIRECTION_ID, (uint8)PORT_E_UNINIT);
- }
- /* Check port pin validity */
- else if ((Pin1 >= (Port_PinType)Port_pConfig->u16NumPins) || (Pin2 >= (Port_PinType)Port_pConfig->u16NumPins))
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SET2PINSDIRECTION_ID, (uint8)PORT_E_PARAM_PIN);
- }
- else
- #endif /* PORT_DEV_ERROR_DETECT */
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- ErrStatus = Port_Ipw_Set2PinsDirection(Pin1, Pin2, (Port_PinDirectionType)Direction, Port_pConfig);
- #else
- (void)Port_Ipw_Set2PinsDirection(Pin1, Pin2, (Port_PinDirectionType)Direction, Port_pConfig);
- #endif
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- if ((Std_ReturnType)E_NOT_OK == ErrStatus)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SET2PINSDIRECTION_ID, (uint8)PORT_E_DIRECTION_UNCHANGEABLE);
- }
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- }
- }
- #endif /*(STD_ON == PORT_SET_2_PINS_DIRECTION_API) */
- #endif
- #if (STD_ON == PORT_SET_PIN_MODE_API)
- /**
- * @brief Sets the port pin mode.
- * @details The function @p Port_SetPinMode() will set the port pin mode of the
- * referenced pin during runtime.
- * @pre @p Port_Init() must have been called first.
- *
- * @param[in] Pin Pin ID number.
- * @param[in] Mode New Port Pin mode to be set on port pin.
- *
- * @implements Port_SetPinMode_Activity
- */
- void Port_SetPinMode
- (
- Port_PinType Pin,
- Port_PinModeType Mode
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- uint8 u8PinModeError = (uint8)0U;
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- /* Check if port is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINMODE_ID, (uint8)PORT_E_UNINIT);
- }
- /* Check port pin validity */
- else if (Pin >= (Port_PinType)Port_pConfig->u16NumPins)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINMODE_ID, (uint8)PORT_E_PARAM_PIN);
- }
- else if ((uint32)1 != (((Port_pConfig->pau32Port_PinToPartitionMap[Pin])&((uint32)1 << CoreId)) >> CoreId))
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINMODE_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- /* Check port pin mode Unchangeable */
- else if(FALSE == Port_pConfig->pUsedPadConfig[Pin].bMC)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINMODE_ID, (uint8)PORT_E_MODE_UNCHANGEABLE);
- }
- else
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- {
- /* Sets the port pin direction */
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- u8PinModeError = (uint8)Port_Ipw_SetPinMode(Pin, Mode, Port_pConfig);
- #else
- (void)Port_Ipw_SetPinMode(Pin, Mode, Port_pConfig);
- #endif
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- if (PORT_E_PARAM_INVALID_MODE == u8PinModeError)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETPINMODE_ID, (uint8)PORT_E_PARAM_INVALID_MODE);
- }
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- }
- }
- #endif /* (STD_ON == PORT_SET_PIN_MODE_API) */
- /**
- * @brief Refreshes port direction.
- * @details This function will refresh the direction of all configured ports to
- * the configured direction.
- * The PORT driver will exclude from refreshing those port pins that
- * are configured as "pin direction changeable during runtime".
- * @pre @p Port_Init() must have been called first.
- *
- * @implements Port_RefreshPortDirection_Activity
- */
- void Port_RefreshPortDirection( void )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- /* Check if Port module is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_REFRESHPINDIRECTION_ID, (uint8)PORT_E_UNINIT);
- }
- else if ((uint32)1 != Port_pConfig->pau8Port_PartitionList[CoreId])
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, PORT_INSTANCE_ID, (uint8)PORT_REFRESHPINDIRECTION_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- else
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- {
- Port_Ipw_RefreshPortDirection(Port_pConfig);
- }
- }
- #if (STD_ON == PORT_VERSION_INFO_API)
- /**
- * @brief Returns the version information of this module.
- * @details The function Port_GetVersionInfo() will return the version
- * information of this module. The version information includes:
- * - Module Id,
- * - Vendor Id,
- * - Vendor specific version numbers.
- *
- * @param[in,out] versioninfo Pointer to where to store the version
- * information of this module.
- *
- *
- * @implements Port_GetVersionInfo_Activity
- */
- void Port_GetVersionInfo
- (
- Std_VersionInfoType * versioninfo
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- if (NULL_PTR == versioninfo)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_GETVERSIONINFO_ID, (uint8)PORT_E_PARAM_POINTER);
- }
- else
- #endif /* (STD_ON == PORT_DEV_ERROR_DETECT) */
- {
- (versioninfo)->vendorID = (uint16)PORT_VENDOR_ID_H;
- (versioninfo)->moduleID = (uint16)PORT_MODULE_ID;
- (versioninfo)->sw_major_version = (uint8)PORT_SW_MAJOR_VERSION_H;
- (versioninfo)->sw_minor_version = (uint8)PORT_SW_MINOR_VERSION_H;
- (versioninfo)->sw_patch_version = (uint8)PORT_SW_PATCH_VERSION_H;
- }
- }
- #endif /* (STD_ON == PORT_VERSION_INFO_API) */
- #ifdef PORT_SET_AS_UNUSED_PIN_API
- #if (STD_ON == PORT_SET_AS_UNUSED_PIN_API)
- /**
- * @brief Set as unused pin.
- * @details This function shall configure the referenced pin with all
- * the properties specified in the NotUsedPortPin container.
- * @pre @p Port_Init() must have been called first.
- *
- * @implements Port_SetAsUnusedPin_Activity
- */
- void Port_SetAsUnusedPin
- (
- Port_PinType Pin
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- /* Check if port is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUNUSEDPIN_ID, (uint8)PORT_E_UNINIT);
- }
- else if (Pin >= (Port_PinType)Port_pConfig->u16NumPins)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUNUSEDPIN_ID, (uint8)PORT_E_PARAM_PIN);
- }
- /* Check if this function was called with wrong core */
- else if ((uint32)1 != (((Port_pConfig->pau32Port_PinToPartitionMap[Pin])&((uint32)1 << CoreId)) >> CoreId))
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUNUSEDPIN_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- /* Check port pin mode Unchangeable */
- else if(FALSE == Port_pConfig->pUsedPadConfig[Pin].bMC)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUNUSEDPIN_ID, (uint8)PORT_E_MODE_UNCHANGEABLE);
- }
- else
- #endif
- {
- Port_Ipw_SetAsUnusedPin(Pin, Port_pConfig);
- }
- }
- /**
- * @brief Set as used pin.
- * @details This function shall configure the referenced pin with
- * all the properties that where set during the Port_Init operation.
- * @pre @p Port_Init() must have been called first.
- *
- * @implements Port_SetAsUsedPin_Activity
- */
- void Port_SetAsUsedPin
- (
- Port_PinType Pin
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- /* Check if port is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUSEDPIN_ID, (uint8)PORT_E_UNINIT);
- }
- /* Check port pin validity */
- else if (Pin >= (Port_PinType)Port_pConfig->u16NumPins)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUSEDPIN_ID, (uint8)PORT_E_PARAM_PIN);
- }
- else if ((uint32)1 != (((Port_pConfig->pau32Port_PinToPartitionMap[Pin])&((uint32)1 << CoreId)) >> CoreId))
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUSEDPIN_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- /* Check port pin mode Unchangeable */
- else if(FALSE == Port_pConfig->pUsedPadConfig[Pin].bMC)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_SETASUSEDPIN_ID, (uint8)PORT_E_MODE_UNCHANGEABLE);
- }
- else
- #endif
- {
- Port_Ipw_SetAsUsedPin(Pin, Port_pConfig);
- }
- }
- #endif /* (STD_ON == PORT_SET_AS_UNUSED_PIN_API) */
- #endif
- #ifdef PORT_RESET_PIN_MODE_API
- #if (STD_ON == PORT_RESET_PIN_MODE_API)
- /**
- * @brief Reset Pin Mode.
- * @details This function shall revert the port pin mode of the referenced pin
- * to the value that was set by Port_Init operation.
- * @pre @p Port_Init() must have been called first.
- *
- * @implements Port_ResetPinMode_Activity
- */
- void Port_ResetPinMode
- (
- Port_PinType Pin
- )
- {
- #if (STD_ON == PORT_DEV_ERROR_DETECT)
- uint8 CoreId;
- CoreId = (uint8)Port_GetCoreID();
- /* Check if port is initialized */
- if (NULL_PTR == Port_pConfig)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_RESETPINMODE_ID, (uint8)PORT_E_UNINIT);
- }
- /* Check port pin validity */
- else if (Pin >= (Port_PinType)Port_pConfig->u16NumPins)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_RESETPINMODE_ID, (uint8)PORT_E_PARAM_PIN);
- }
- /* Check port pin validity */
- else if ((uint32)1 != (((Port_pConfig->pau32Port_PinToPartitionMap[Pin])&((uint32)1 << CoreId)) >> CoreId))
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_RESETPINMODE_ID, (uint8)PORT_E_PARAM_CONFIG);
- }
- /* Check port pin mode Unchangeable */
- else if(FALSE == Port_pConfig->pUsedPadConfig[Pin].bMC)
- {
- (void)Det_ReportError((uint16)PORT_MODULE_ID, (uint8)PORT_INSTANCE_ID, (uint8)PORT_RESETPINMODE_ID, (uint8)PORT_E_MODE_UNCHANGEABLE);
- }
- else
- #endif
- {
- Port_Ipw_ResetPinMode(Pin, Port_pConfig);
- }
- }
- #endif /* (STD_ON == PORT_RESET_PIN_MODE_API) */
- #endif
- #define PORT_STOP_SEC_CODE
- #include "Port_MemMap.h"
- #ifdef __cplusplus
- }
- #endif
- /** @} */
- /* End of File */
|