Files
6CAR/drivers/source/firewall/sdrv_firewall_mpc.h
2026-04-18 09:16:58 +08:00

106 lines
4.3 KiB
C

/** ************************************************************************************************
* SEMIDRIVE Copyright Statement
* Copyright (c) SEMIDRIVE. All rights reserved
*
* This software and all rights therein are owned by SEMIDRIVE, and are
* protected by copyright law and other relevant laws, regulations and
* protection. Without SEMIDRIVE's prior written consent and/or related rights,
* please do not use this software or any potion thereof in any form or by any
* means. You may not reproduce, modify or distribute this software except in
* compliance with the License. Unless required by applicable law or agreed to
* in writing, software distributed under the License is distributed on
* an 'AS IS' basis, WITHOUT WARRANTIES OF ANY KIND, either express or implied.
*
**************************************************************************************************/
/** ************************************************************************************************
* \file sdrv_firewall_mpc.h
* \brief This file contains interface header for SSDK Firewall MPC module.
*
* <table>
* <tr><th>Date <th>Version
* <tr><td>2023/11/29 <td>1.0.0
* </table>
**************************************************************************************************/
#ifndef FIREWALL_MPC_H
#define FIREWALL_MPC_H
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************************************
* Include header files
**************************************************************************************************/
#include <sdrv_firewall.h>
/***************************************************************************************************
* Global Function Declarations
**************************************************************************************************/
/**
* @brief Configure the permission of memory port regions in MPC module.
*
* This function configure memory ports in MPC module.
* The permissions of memory regions in MPC module should be locked after configuring.
*
* @param[in] base the address of the MAC module.
* @param[in] mpc_cfg The configuration of memory.
* @param[in] memport_num The number of memory port.
*
* @return The result of the MPC initialization function.
* @details - return FIREWALL_E_OK : initializa MPC success.
* - return FIREWALL_E_NULL_POINTER : The pointer is a NULL_PTR.
* - return FIREWALL_E_MPC_PORT_NUM : The number of memory port is unvalid.
*/
status_t sdrv_firewall_mpc_configure(uint32_t base,
const sdrv_mpc_memport_cfg_t *mpc_cfg,
uint32_t memport_num);
/**
* @brief Lock MPC configuration.
*
* @param[in] base the address of the MAC module.
*/
void sdrv_firewall_mpc_lock(uint32_t base);
/**
* @brief Handle the interrupt status of the MPC module.
*
* This function get the illegal access error information of the MPC module.
* The function exits as soon as it gets an illegal access message.
* This function should be called by the firewall interrupt handler
* sdrv_firewall_irq_handler().
*
* @param[in] base the address of the MAC module.
* @param[in] mpc_cfg The configuration of memory.
* @param[in] memport_num The number of memory port.
* @param[out] mpc_irqsta The status of mpc interrupt.
*
* @return The result of the MPC handler.
* @details - return FIREWALL_E_OK : Handle MPC interrupt success.
* - return FIREWALL_E_NULL_POINTER : The pointer is a NULL_PTR.
* - return FIREWALL_E_MPC_PORT_NUM : The number of memory port is unvalid.
*/
status_t sdrv_firewall_mpc_irq_handler(uint32_t base,
const sdrv_mpc_memport_cfg_t *mpc_cfg,
uint32_t memport_num,
sdrv_mpc_irqsta_t *mpc_irqsta);
/**
* @brief Clear the interrupt status of the MPC module.
*
* This function will clear the interrupt registers in the MPC module.
* This function should not be called after the firewall has been initialized.
*
* @param[in] base the address of the MAC module.
*/
void sdrv_firewall_mpc_clear_interrupt(uint32_t base);
#ifdef __cplusplus
}
#endif
#endif /* FIREWALL_MPC_H */
/* End of file */