Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXP S32 introduce support PSI5_S #469

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions s32/drivers/s32ze/BaseNXP/header/S32Z2_PSI5.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#define PSI5_CHANNEL_CH_PMR_COUNT 32u
#define PSI5_CHANNEL_CH_SFR_COUNT 6u
#define PSI5_CHANNEL_CH_SFCR_COUNT 6u
#define PSI5_CHANNEL_COUNT 4u
#define PSI5_CHANNEL_COUNT 4

/** PSI5 - Register Layout Typedef */
typedef struct {
Expand Down Expand Up @@ -132,7 +132,7 @@ typedef struct {
} PSI5_Type, *PSI5_MemMapPtr;

/** Number of instances of the PSI5 module. */
#define PSI5_INSTANCE_COUNT (2u)
#define PSI5_INSTANCE_COUNT 2

/* PSI5 - Peripheral instance base addresses */
/** Peripheral PSI5_0 base address */
Expand Down
2 changes: 1 addition & 1 deletion s32/drivers/s32ze/BaseNXP/header/S32Z2_PSI5_S.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ typedef struct {
} PSI5_S_Type, *PSI5_S_MemMapPtr;

/** Number of instances of the PSI5_S module. */
#define PSI5_S_INSTANCE_COUNT (2u)
#define PSI5_S_INSTANCE_COUNT 2

/* PSI5_S - Peripheral instance base addresses */
/** Peripheral PSI5_S_0 base address */
Expand Down
5 changes: 5 additions & 0 deletions s32/drivers/s32ze/BaseNXP/include/Psi5_MemMap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
*/
2 changes: 2 additions & 0 deletions s32/drivers/s32ze/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ if (CONFIG_ETH_NXP_S32_NETC)
add_subdirectory(EthSwt_NETC)
endif()
add_subdirectory_ifdef(CONFIG_CAN_NXP_S32_CANXL Can_CANEXCEL)
add_subdirectory_ifdef(CONFIG_PSI5_NXP_S32 Psi5)
add_subdirectory_ifdef(CONFIG_PSI5_S_NXP_S32 Psi5_S)
6 changes: 6 additions & 0 deletions s32/drivers/s32ze/Psi5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: BSD-3-Clause

zephyr_include_directories(include)
zephyr_library_sources(src/Psi5_Ip.c)
zephyr_library_sources(src/Psi5_Ip_Irq.c)
247 changes: 247 additions & 0 deletions s32/drivers/s32ze/Psi5/include/Psi5_Ip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/*
* Copyright 2021-2024 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef PSI5_IP_H
#define PSI5_IP_H

#if defined(__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 "Psi5_Ip_Types.h"
#include "Psi5_Ip_Cfg.h"

/*==================================================================================================
* SOURCE FILE VERSION INFOPSI5ATION
==================================================================================================*/
#define PSI5_IP_VENDOR_ID 43
#define PSI5_IP_AR_RELEASE_MAJOR_VERSION 4
#define PSI5_IP_AR_RELEASE_MINOR_VERSION 7
#define PSI5_IP_AR_RELEASE_REVISION_VERSION 0
#define PSI5_IP_SW_MAJOR_VERSION 2
#define PSI5_IP_SW_MINOR_VERSION 0
#define PSI5_IP_SW_PATCH_VERSION 0


/*==================================================================================================
* FILE VERSION CHECKS
==================================================================================================*/
/* Checks against Psi5_Ip_Types.h */
#if (PSI5_IP_VENDOR_ID != PSI5_IP_TYPES_VENDOR_ID)
#error "Psi5_Ip.h and Psi5_Ip_Types.h have different vendor ids"
#endif
#if ((PSI5_IP_AR_RELEASE_MAJOR_VERSION != PSI5_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
(PSI5_IP_AR_RELEASE_MINOR_VERSION != PSI5_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
(PSI5_IP_AR_RELEASE_REVISION_VERSION != PSI5_IP_TYPES_AR_RELEASE_REVISION_VERSION) \
)
#error "AUTOSAR Version Numbers of Psi5_Ip.h and Psi5_Ip_Types.h are different"
#endif
#if ((PSI5_IP_SW_MAJOR_VERSION != PSI5_IP_TYPES_SW_MAJOR_VERSION) || \
(PSI5_IP_SW_MINOR_VERSION != PSI5_IP_TYPES_SW_MINOR_VERSION) || \
(PSI5_IP_SW_PATCH_VERSION != PSI5_IP_TYPES_SW_PATCH_VERSION) \
)
#error "Software Version Numbers of Psi5_Ip.h and Psi5_Ip_Types.h are different"
#endif

/* Checks against Psi5_Ip_Cfg.h */
#if (PSI5_IP_VENDOR_ID != PSI5_IP_CFG_VENDOR_ID)
#error "Psi5_Ip.h and Psi5_Ip_Cfg.h have different vendor ids"
#endif
#if ((PSI5_IP_AR_RELEASE_MAJOR_VERSION != PSI5_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
(PSI5_IP_AR_RELEASE_MINOR_VERSION != PSI5_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
(PSI5_IP_AR_RELEASE_REVISION_VERSION != PSI5_IP_CFG_AR_RELEASE_REVISION_VERSION) \
)
#error "AUTOSAR Version Numbers of Psi5_Ip.h and Psi5_Ip_Cfg.h are different"
#endif
#if ((PSI5_IP_SW_MAJOR_VERSION != PSI5_IP_CFG_SW_MAJOR_VERSION) || \
(PSI5_IP_SW_MINOR_VERSION != PSI5_IP_CFG_SW_MINOR_VERSION) || \
(PSI5_IP_SW_PATCH_VERSION != PSI5_IP_CFG_SW_PATCH_VERSION) \
)
#error "Software Version Numbers of Psi5_Ip.h and Psi5_Ip_Cfg.h are different"
#endif

/*==================================================================================================
* CONSTANTS
==================================================================================================*/

/*==================================================================================================
* DEFINES AND MACROS
==================================================================================================*/

/*==================================================================================================
* ENUMS
==================================================================================================*/

/*==================================================================================================
* STRUCTURES AND OTHER TYPEDEFS
==================================================================================================*/

/*==================================================================================================
* GLOBAL VARIABLE DECLARATIONS
==================================================================================================*/

/*==================================================================================================
* FUNCTION PROTOTYPES
==================================================================================================*/

#define PSI5_START_SEC_CONFIG_DATA_UNSPECIFIED
#include "Psi5_MemMap.h"
/**
* @brief Export PSI5 configurations.
*/
PSI5_IP_CONFIG_EXT

#define PSI5_STOP_SEC_CONFIG_DATA_UNSPECIFIED
#include "Psi5_MemMap.h"

#define PSI5_START_SEC_CODE
#include "Psi5_MemMap.h"


/**
* @brief Interrupt handler signature for PSI5 module.
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5ChannelId Instance channel number
* @return void
*
*/
void Psi5_Ip_IRQ_Handler(const Psi5_Ip_InstanceIdType Psi5InstanceId,
const Psi5_Ip_HwChannelIdType Psi5ChannelId
);
/*!
* @brief Main initializer for the driver
*
* Initializes the driver for a given peripheral
* according to the given configuration structure.
*
* @param[in] configPtr Pointer to the configuration structure
*/
void Psi5_Ip_Init(const Psi5_Ip_ConfigType *configPtr);

/*!
* @brief Reset the peripheral.
*
* De-Initializes the peripheral and brings it's registers into a reset state.
*
*/
void Psi5_Ip_DeInit(void);

#if (STD_ON == PSI5_IP_TRANSMIT_API)
/*!
* @brief Transmit a data frame
*
* Transmits a data frame according to configuration.
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5ChannelId Channel number
* @param[in] Psi5Data Data to send
* @return STATUS_SUCCESS If transmit succeeded
* @return STATUS_ERROR If not configured or not enabled or not ready
*/
Std_ReturnType Psi5_Ip_Transmit(const Psi5_Ip_InstanceIdType Psi5InstanceId,
const Psi5_Ip_HwChannelIdType Psi5ChannelId,
const uint64 Psi5Data
);
#endif

#if (STD_ON == PSI5_IP_GET_TRANSMISSION_STATUS_API)
/*!
* @brief Transmission status
*
* Returns the status of the transmission.
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5ChannelId Channel number
* @return true If transmission ready
* @return false If transmission pending
*/
boolean Psi5_Ip_GetTransmissionStatus(const Psi5_Ip_InstanceIdType Psi5InstanceId,
const Psi5_Ip_HwChannelIdType Psi5ChannelId
);
#endif

#if (STD_ON == PSI5_IP_GET_PSI5_FRAME_API)
/*!
* @brief Gets a PSI5 frame
*
* Returns the last received PSI5 frame.
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5ChannelId Channel number
* @param[out] Psi5FramePtr Target variable
*/
Std_ReturnType Psi5_Ip_GetPsi5Frame(const Psi5_Ip_InstanceIdType Psi5InstanceId,
const Psi5_Ip_HwChannelIdType Psi5ChannelId,
Psi5_Ip_Psi5FrameType *PsiFramePtr
);
#endif

#if (STD_ON == PSI5_IP_GET_SMC_FRAME_API)
/*!
* @brief Gets a SMC frame
*
* Returns the last received SMC frame.
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5ChannelId Channel number
* @param[out] Psi5FramePtr Target variable
*/
Std_ReturnType Psi5_Ip_GetSmcFrame(const Psi5_Ip_InstanceIdType Psi5InstanceId,
const Psi5_Ip_HwChannelIdType Psi5ChannelId,
Psi5_Ip_SmcFrameType *Psi5SmcFramePtr
);
#endif

#if (STD_ON == PSI5_IP_SET_GLOBAL_SYNC_API)
/*!
* @brief Global sync state
*
* Changes the global sync pulse generator state
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5State Desired state
*/
Std_ReturnType Psi5_Ip_SetGlobalSync(const uint8 Psi5InstanceId,
const boolean PsiState
);
#endif

#if (STD_ON == PSI5_IP_SET_CHANNEL_SYNC_API)
/*!
* @brief Channel sync state
*
* Changes the channel sync pulse generator state
*
* @param[in] Psi5InstanceId Instance number
* @param[in] Psi5ChannelId Instance channel number
* @param[in] Psi5State Desired state
*/
Std_ReturnType Psi5_Ip_SetChannelSync(const Psi5_Ip_InstanceIdType Psi5InstanceId,
const Psi5_Ip_HwChannelIdType Psi5ChannelId,
const boolean PsiState
);
#endif

#define PSI5_STOP_SEC_CODE
#include "Psi5_MemMap.h"

#if defined(__cplusplus)
}
#endif

/*! @}*/

/*! @}*/ /* End of addtogroup psi5 */

#endif /* PSI5_IP_H */
Loading