SemiDrive SSDK Appication Program Interface PTG3.0
Data Structures | Functions
sdrv_firewall.h File Reference
#include <firewall_hw.h>
#include <sdrv_common.h>
#include <spinlock.h>

Go to the source code of this file.

Data Structures

struct  mpc_region_cfg
 
struct  mpc_memport_cfg
 
struct  ppc_addrconfig
 
struct  ppc_ipconfig
 
struct  gpio_channel_cfg
 
struct  gpio_core_cfg
 
struct  sdrv_mpc_irqsta_t
 
struct  sdrv_ppc_irqsta_t
 
struct  sdrv_firewall_err_t
 
struct  sdrv_firewall_cfg_t
 
struct  sdrv_firewall
 

Functions

status_t sdrv_firewall_init (sdrv_firewall_t *ctrl, const sdrv_firewall_cfg_t *cfg)
 
status_t sdrv_firewall_assign_domain (sdrv_firewall_t *ctrl, uint8_t master_id, uint8_t domain_id)
 
status_t sdrv_firewall_lock_domain_assignment (sdrv_firewall_t *ctrl)
 
status_t sdrv_firewall_set_callback (sdrv_firewall_t *ctrl, sdrv_firewall_callback_t callback, void *userdata)
 
int sdrv_firewall_irq_handler (uint32_t irq, void *ctrl)
 
status_t sdrv_firewall_get_error_info (sdrv_firewall_t *ctrl, sdrv_firewall_err_t *firewall_err_info)
 

Detailed Description


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.


Date Version
2023/11/29 1.0.0

Macro Definition Documentation

◆ FIREWALL_APB_MAC_BASE

#define FIREWALL_APB_MAC_BASE   APB_MAC_BASE

Firewall module base address.

◆ FIREWALL_INIT

#define FIREWALL_INIT   (0x01U)

Firewall module initialized state.

◆ FIREWALL_PERMISSION_NONE

#define FIREWALL_PERMISSION_NONE   (0x03U)

No permission.

◆ FIREWALL_PERMISSION_RO

#define FIREWALL_PERMISSION_RO   (0x01U)

Enable read permission.

◆ FIREWALL_PERMISSION_RW

#define FIREWALL_PERMISSION_RW   (0x00U)

Enable read and write permissions.

◆ FIREWALL_PERMISSION_WO

#define FIREWALL_PERMISSION_WO   (0x02U)

Enable write permission.

◆ FIREWALL_REG_VALUE_MAX

#define FIREWALL_REG_VALUE_MAX   (0xFFFFFFFFU)

The maximum value of register.

◆ FIREWALL_REG_VALUE_MIN

#define FIREWALL_REG_VALUE_MIN   (0x00U)

The minimum value of register.

◆ FIREWALL_UNINIT

#define FIREWALL_UNINIT   (0x00U)

Firewall module uninitialized state.

Typedef Documentation

◆ sdrv_firewall_callback_t

typedef void(* sdrv_firewall_callback_t) (sdrv_firewall_t *ctrl, void *userdata)

Firewall callback function type.

◆ sdrv_firewall_err_status_e

Firewall status return code.

◆ sdrv_firewall_t

◆ sdrv_gpio_channel_cfg_t

Pin configuration.

◆ sdrv_gpio_core_cfg_t

Pin permission for the core.

◆ sdrv_mac_config_t

typedef const uint8_t* sdrv_mac_config_t

The type of configuarion for the MAC module.

◆ sdrv_mpc_memport_cfg_t

MPC memory port configure.

◆ sdrv_mpc_region_cfg_t

MPC region configure.

◆ sdrv_ppc_ip_config_t

PPC ip configure.

◆ sdrv_ppc_region_config_t

PPC address configure.

Enumeration Type Documentation

◆ sdrv_firewall_err_status

Firewall status return code.

Enumerator
FIREWALL_E_OK 

status for success.

FIREWALL_E_INIT 

Error due to API duplicated invoked FIREWALL_Init().

FIREWALL_E_UNINIT 

Error due to API invoked without performing FIREWALL_Init().

FIREWALL_E_NULL_POINTER 

Error due to NULL_PTR passed as parameter.

FIREWALL_E_MAC_MASTER_ID 

Error due to invalid master id.

FIREWALL_E_MAC_DOMAIN_ID 

Error due to invalid domain id.

FIREWALL_E_MAC_LOCKED 

Error due to the MAC module has been locked.

FIREWALL_E_MPC_PORT_NUM 

Error due to the unvalid number of memory ports.

FIREWALL_E_MPC_REGION_NUM 

Error due to the unvalid number of memory regions.

FIREWALL_E_PPC_IP_NUM 

Error due to the unvalid number of peripherals.

FIREWALL_E_PPC_REGION_NUM 

Error due to the unvalid number of apb regions.

FIREWALL_E_GPIO_CORE_ID 

Error due to invalid core id.

FIREWALL_E_GPIO_CHANNEL_ID 

Error due to invalid gpio pin channel id.

FIREWALL_E_GPIO_CORE_NUM 

Error due to invalid number of cores.

FIREWALL_E_GPIO_CHANNEL_NUM 

Error due to invalid number of gpio pin channels.

Function Documentation

◆ sdrv_firewall_assign_domain()

status_t sdrv_firewall_assign_domain ( sdrv_firewall_t ctrl,
uint8_t  master_id,
uint8_t  domain_id 
)

Assigns the master to the specified domain.

Assigns the specified master to a domain. This function should be executed after the initialization function sdrv_firewall_init().

Parameters
[in]ctrlthe firewall instance.
[in]master_idthe id of the master.
[in]domain_idthe id of the domain.
Returns
The result of this function.
  • return FIREWALL_E_OK, Assigned the master to the domain success.

return FIREWALL_E_UNINIT: The firewall is uninitialized.

  • return FIREWALL_E_MAC_MASTER_ID: The master id is unvalid.
  • return FIREWALL_E_MAC_DOMAIN_ID: The domain id is unvalid.
  • return FIREWALL_E_MAC_LOCKED: The domain assignment of the master is locked.

◆ sdrv_firewall_get_error_info()

status_t sdrv_firewall_get_error_info ( sdrv_firewall_t ctrl,
sdrv_firewall_err_t firewall_err_info 
)

Get firewall illegal access infomation.

Should enable the macro FIREWALL_INTERRUPT_EN.

Parameters
[in]ctrlthe firewall instance.
[in]firewall_err_infoPointer to the buffer used by system to get the information.
Returns
The result of this function.
  • return FIREWALL_E_OK : Set callback function success.

return FIREWALL_E_NULL_POINTER : The pointer to the MAC configuration is NULL.

  • return FIREWALL_E_UNINIT : The firewall is uninitialized.

◆ sdrv_firewall_init()

status_t sdrv_firewall_init ( sdrv_firewall_t ctrl,
const sdrv_firewall_cfg_t cfg 
)

Configure firewall.

Parameters
[in]ctrlthe firewall instance.
[in]cfgthe configuration of the MAC/MPC/PPC/GPIO module.
Returns
The result of the firewall initialization function
  • return SDRV_STATUS_OK, initializa firewall success.

return SDRV_STATUS_INVALID_PARAM, invalid configuration parameter.

◆ sdrv_firewall_irq_handler()

int sdrv_firewall_irq_handler ( uint32_t  irq,
void *  ctrl 
)

Handle firewall interrupt.

This function clear MAC/PPC/MPC Interruption, return interrupt state.

Parameters
[in]irqthe irq number of the firewall.
[in]ctrlsdrv firewall controller.
Returns
The result of this function.
  • return 0 : Handle firewall interrupt success.

return 1 : The pointer to the MAC configuration is NULL.

  • return 2 : The firewall is uninitialized.

◆ sdrv_firewall_lock_domain_assignment()

status_t sdrv_firewall_lock_domain_assignment ( sdrv_firewall_t ctrl)

Lock the domain assignment of the master.

This function lock the domain assignment of the master, should be called after the initialization function sdrv_firewall_init() or domain assignment function sdrv_firewall_assign_domain().

Parameters
[in]ctrlthe firewall instance.
Returns
The result of this function.
  • return FIREWALL_E_OK : Lock domain assignment success.

return FIREWALL_E_INIT : The firewall is uninitialized.

  • return FIREWALL_E_NULL_POINTER : The pointer to the MAC configuration is NULL.

◆ sdrv_firewall_set_callback()

status_t sdrv_firewall_set_callback ( sdrv_firewall_t ctrl,
sdrv_firewall_callback_t  callback,
void *  userdata 
)

Set callback function for firewall.

Parameters
[in]ctrlthe firewall instance.
[in]callbackthe callback function.
[in]userdatathe param of callback function.
Returns
The result of this function.
  • return FIREWALL_E_OK : Set callback function success.

return FIREWALL_E_NULL_POINTER : The pointer to the MAC configuration is NULL.

  • return FIREWALL_E_UNINIT : The firewall is uninitialized.