Driverlib GSC API

Module: Driverlib (AM13E230X) APIs

More…

Types

Name

enum

DL_GSC_MainFlashBank { DL_GSC_MAIN_FLASH_BANK_0 = 0U, DL_GSC_MAIN_FLASH_BANK_1 = 1U}
Flash Bank identifiers for write protection.

enum

DL_GSC_PRIV_ACCESS { DL_GSC_PRIV_ACCESS_ADC0 = 0x11040000U, DL_GSC_PRIV_ACCESS_ADC1 = 0x11040001U, DL_GSC_PRIV_ACCESS_ADC2 = 0x11040002U, DL_GSC_PRIV_ACCESS_PWM0 = 0x110C0000U, DL_GSC_PRIV_ACCESS_PWM1 = 0x110C0001U, DL_GSC_PRIV_ACCESS_PWM2 = 0x110C0002U, DL_GSC_PRIV_ACCESS_PWM3 = 0x110C0003U, DL_GSC_PRIV_ACCESS_PWM4 = 0x110C0004U, DL_GSC_PRIV_ACCESS_ECAP0 = 0x110C0008U, DL_GSC_PRIV_ACCESS_ECAP1 = 0x110C0009U, DL_GSC_PRIV_ACCESS_EQEP0 = 0x110C0010U, DL_GSC_PRIV_ACCESS_EQEP1 = 0x110C0011U, DL_GSC_PRIV_ACCESS_EQEP2 = 0x110C0012U, DL_GSC_PRIV_ACCESS_TIMG4_0 = 0x110C0018U, DL_GSC_PRIV_ACCESS_TIMG12_0 = 0x110C0019U, DL_GSC_PRIV_ACCESS_S0U0 = 0x11140000U, DL_GSC_PRIV_ACCESS_S0U1 = 0x11140001U, DL_GSC_PRIV_ACCESS_S0U2 = 0x11140002U, DL_GSC_PRIV_ACCESS_S1U3 = 0x11140003U, DL_GSC_PRIV_ACCESS_S1U4 = 0x11140004U, DL_GSC_PRIV_ACCESS_S1U5 = 0x11140005U, DL_GSC_PRIV_ACCESS_S0_COMMON = 0x11140018U, DL_GSC_PRIV_ACCESS_S1_COMMON = 0x11140019U, DL_GSC_PRIV_ACCESS_GPIO0 = 0x111C0000U, DL_GSC_PRIV_ACCESS_GPIO1 = 0x111C0001U, DL_GSC_PRIV_ACCESS_GPIO2 = 0x111C0002U, DL_GSC_PRIV_ACCESS_GPIO3 = 0x111C0003U, DL_GSC_PRIV_ACCESS_MCAN = 0x11240000U, DL_GSC_PRIV_ACCESS_CMPSS0 = 0x11340000U, DL_GSC_PRIV_ACCESS_CMPSS1 = 0x11340001U, DL_GSC_PRIV_ACCESS_CMPSS2 = 0x11340002U, DL_GSC_PRIV_ACCESS_CMPSS3 = 0x11340003U, DL_GSC_PRIV_ACCESS_WWDT = 0x113C0000U, DL_GSC_PRIV_ACCESS_CRC = 0x114C0000U, DL_GSC_PRIV_ACCESS_AES = 0x11540000U, DL_GSC_PRIV_ACCESS_IOMUX = 0x116C0000U, DL_GSC_PRIV_ACCESS_DEBUGSS = 0x11840000U, DL_GSC_PRIV_ACCESS_KEYSTORECTL = 0x11940000U, DL_GSC_PRIV_ACCESS_EAM = 0x119C0000U, DL_GSC_PRIV_ACCESS_WUC = 0x11A40000U, DL_GSC_PRIV_ACCESS_FRIREGS = 0x11AC0000U, DL_GSC_PRIV_ACCESS_MEMCFG = 0x11B40000U, DL_GSC_PRIV_ACCESS_SYSCTL = 0x120C0000U, DL_GSC_PRIV_ACCESS_DMA = 0x12140000U, DL_GSC_PRIV_ACCESS_GSC = 0x121C0000U, DL_GSC_PRIV_ACCESS_TINIE = 0x12240000U, DL_GSC_PRIV_ACCESS_EPI = 0x122C0000U, DL_GSC_PRIV_ACCESS_PGA0 = 0x12340000U, DL_GSC_PRIV_ACCESS_PGA1 = 0x12340001U, DL_GSC_PRIV_ACCESS_PGA2 = 0x12340002U, DL_GSC_PRIV_ACCESS_ALL_XBAR_CONFIG = 0x123C0000U, DL_GSC_PRIV_ACCESS_XBAR_INPUT_FLAGS = 0x123C0001U, DL_GSC_PRIV_ACCESS_OUTPUT_XBAR_FLAGS = 0x123C0002U}
Peripheral identifiers for unified GSC PPC privilege access control.

Functions

Name

void

DL_GSC_configureMainFlashWriteProtect(GSC_Regs * gsc, DL_GSC_MainFlashBank bank, uint32_t sector0, uint32_t sector1)
Configure main flash write protection for specified bank.

void

DL_GSC_getMainFlashWriteProtectStatus(GSC_Regs * gsc, DL_GSC_MainFlashBank bank, uint32_t * sector0, uint32_t * sector1)
Get main flash write protection status for specified bank.

void

DL_GSC_configureMainFlashPrivilege(GSC_Regs * gsc, DL_GSC_MainFlashBank bank, uint32_t sector0, uint32_t sector1)
Configure privilege attributes for main flash regions.

void

DL_GSC_getMainFlashPrivilegeStatus(GSC_Regs * gsc, DL_GSC_MainFlashBank bank, uint32_t * sector0, uint32_t * sector1)
Get privilege attributes status for main flash regions.

bool

DL_GSC_configureHideProtectionRegion(GSC_Regs * gsc, uint8_t startSec, uint8_t endSec, uint8_t bank)
Configure hide protection region for flash.

void

DL_GSC_setHideProtectionAccess(GSC_Regs * gsc, bool enable, uint8_t bank)
Enable/Disable HDP access for flash.

__STATIC_INLINE void

DL_GSC_enableHideProtectionMode(GSC_Regs * gsc)
Enable Flash Hide Protection (HDP) mode.

__STATIC_INLINE void

DL_GSC_setVTOR_NS(GSC_Regs * gsc, uint32_t addr_ns)
Set the Vector Table Offset Register (VTOR_NS)

__STATIC_INLINE void

DL_GSC_allowPrivilegeAccessToNonPrivilegedSRAM(GSC_Regs * gsc)
Allow privileged access to non-privileged SRAM regions.

__STATIC_INLINE void

DL_GSC_blockPrivilegeAccessToNonPrivilegeSRAM(GSC_Regs * gsc)
Block privileged access to non-privileged SRAM regions.

__STATIC_INLINE void

DL_GSC_allowPrivilegeAccessToNonPrivilegeFlash(GSC_Regs * gsc)
Allow privileged access to non-privileged flash regions.

__STATIC_INLINE void

DL_GSC_blockPrivilegeAccessToNonPrivilegeFlash(GSC_Regs * gsc)
Block privileged access to non-privileged flash regions.

__STATIC_INLINE void

DL_GSC_allowPrivilegeAccessToNonPrivilegePeripheral(GSC_Regs * gsc)
Allow privileged access to non-privileged peripherals.

__STATIC_INLINE void

DL_GSC_blockPrivilegeAccessToNonPrivilegePeripheral(GSC_Regs * gsc)
Block privileged access to non-privileged peripherals.

__STATIC_INLINE void

DL_GSC_allowPrivilegeAccess(GSC_Regs * gsc, DL_GSC_PRIV_ACCESS peripheral)
Configure a peripheral as privileged-only via GSC PPC.

__STATIC_INLINE void

DL_GSC_blockPrivilegeAccess(GSC_Regs * gsc, DL_GSC_PRIV_ACCESS peripheral)
Configure a peripheral as non-privileged (accessible from any mode)

__STATIC_INLINE void

DL_GSC_setSRAMPrivilegeAttrib0(GSC_Regs * gsc, uint32_t val)
Set SRAM privilege attributes for pages 0-3 (SPC_PRIVATTRIB0)

__STATIC_INLINE void

DL_GSC_setSRAMPrivilegeAttrib1(GSC_Regs * gsc, uint32_t val)
Set SRAM privilege attributes for pages 4-7 (SPC_PRIVATTRIB1)

__STATIC_INLINE void

DL_GSC_setHideProtectionBank0Config(GSC_Regs * gsc, uint8_t startSec, uint8_t endSec)
Configure the Hide Data Protection (HDP) region for Flash Bank 0.

__STATIC_INLINE void

DL_GSC_setHideProtectionBank1Config(GSC_Regs * gsc, uint8_t startSec, uint8_t endSec)
Configure the Hide Data Protection (HDP) region for Flash Bank 1.

__STATIC_INLINE void

DL_GSC_lockRegisters(GSC_Regs * gsc, uint32_t lockMask)
Lock GSC registers by writing the GSC_LOCK register.

__STATIC_INLINE uint32_t

DL_GSC_getLockConfiguration(GSC_Regs * gsc)
Get current lock configuration as a bitmask.

__STATIC_INLINE void

DL_GSC_commitRegisters(GSC_Regs * gsc, uint32_t commitMask)
Commit GSC registers permanently by writing the GSC_COMMIT register.

__STATIC_INLINE uint32_t

DL_GSC_getCommitConfiguration(GSC_Regs * gsc)
Get current commit configuration as a bitmask.

Defines

Name

DL_GSC_LOCK_KEY

DL_GSC_COMMIT_KEY

DL_GSC_MAIN_FLASH_SECTOR_0

DL_GSC_MAIN_FLASH_SECTOR_1

DL_GSC_MAIN_FLASH_SECTOR_2

DL_GSC_MAIN_FLASH_SECTOR_3

DL_GSC_MAIN_FLASH_SECTOR_4

DL_GSC_MAIN_FLASH_SECTOR_5

DL_GSC_MAIN_FLASH_SECTOR_6

DL_GSC_MAIN_FLASH_SECTOR_7

DL_GSC_MAIN_FLASH_SECTOR_8

DL_GSC_MAIN_FLASH_SECTOR_9

DL_GSC_MAIN_FLASH_SECTOR_10

DL_GSC_MAIN_FLASH_SECTOR_11

DL_GSC_MAIN_FLASH_SECTOR_12

DL_GSC_MAIN_FLASH_SECTOR_13

DL_GSC_MAIN_FLASH_SECTOR_14

DL_GSC_MAIN_FLASH_SECTOR_15

DL_GSC_MAIN_FLASH_SECTOR_16

DL_GSC_MAIN_FLASH_SECTOR_17

DL_GSC_MAIN_FLASH_SECTOR_18

DL_GSC_MAIN_FLASH_SECTOR_19

DL_GSC_MAIN_FLASH_SECTOR_20

DL_GSC_MAIN_FLASH_SECTOR_21

DL_GSC_MAIN_FLASH_SECTOR_22

DL_GSC_MAIN_FLASH_SECTOR_23

DL_GSC_MAIN_FLASH_SECTOR_24

DL_GSC_MAIN_FLASH_SECTOR_25

DL_GSC_MAIN_FLASH_SECTOR_26

DL_GSC_MAIN_FLASH_SECTOR_27

DL_GSC_MAIN_FLASH_SECTOR_28

DL_GSC_MAIN_FLASH_SECTOR_29

DL_GSC_MAIN_FLASH_SECTOR_30

DL_GSC_MAIN_FLASH_SECTOR_31

DL_GSC_MAIN_FLASH_A_ALL_SECTORS

DL_GSC_MAIN_FLASH_SECTOR_32_39

DL_GSC_MAIN_FLASH_SECTOR_40_47

DL_GSC_MAIN_FLASH_SECTOR_48_55

DL_GSC_MAIN_FLASH_SECTOR_56_63

DL_GSC_MAIN_FLASH_SECTOR_64_71

DL_GSC_MAIN_FLASH_SECTOR_72_79

DL_GSC_MAIN_FLASH_SECTOR_80_87

DL_GSC_MAIN_FLASH_SECTOR_88_95

DL_GSC_MAIN_FLASH_SECTOR_96_103

DL_GSC_MAIN_FLASH_SECTOR_104_111

DL_GSC_MAIN_FLASH_SECTOR_112_119

DL_GSC_MAIN_FLASH_SECTOR_120_127

DL_GSC_MAIN_FLASH_B_ALL_SECTORS

DL_GSC_LOCK_ATTRIBVIOL_CONFIG

DL_GSC_LOCK_PPC_ATTRIB

DL_GSC_LOCK_SPC_ATTRIB

DL_GSC_LOCK_FPPC_ATTRIB

DL_GSC_LOCK_VTOR

DL_GSC_LOCK_DTB_MUXSEL

DL_GSC_LOCK_ALL

DL_GSC_COMMIT_ATTRIBVIOL_CONFIG

DL_GSC_COMMIT_PPC_ATTRIB

DL_GSC_COMMIT_SPC_ATTRIB

DL_GSC_COMMIT_FPPC_ATTRIB

DL_GSC_COMMIT_VTOR

DL_GSC_COMMIT_DTB_MUXSEL

DL_GSC_COMMIT_ALL

DL_GSC_SPC_PRIVATTRIB_ALL_PRIVILEGED

DL_GSC_SPC_PRIVATTRIB_ALL_NONPRIVILEGED

DL_GSC_SPC_PAGE_CHUNK_512B_0

DL_GSC_SPC_PAGE_CHUNK_512B_1

DL_GSC_SPC_PAGE_CHUNK_1KB

DL_GSC_SPC_PAGE_CHUNK_2KB

DL_GSC_SPC_PAGE_CHUNK_4KB_0

DL_GSC_SPC_PAGE_CHUNK_4KB_1

DL_GSC_SPC_PAGE_CHUNK_4KB_2

DL_GSC_SPC_PAGE_ALL_CHUNKS

DL_GSC_SPC_PAGE_MASK(pageNum, chunkMask)
Build a PRIVATTRIB register value for a specific page.

DL_GSC_MAIN_FLASH_SECTOR_RANGE(start, end)
Helper macro to create sector ranges (sectors 0-31)

Detailed Description

The GSC DriverLib allows full configuration of the Global Security Controller (GSC) module. The GSC provides standard interfaces to configure:

  • Flash Protection (privilege access and write/erase protection)

  • SRAM Protection (privilege access)

  • Peripheral Protection (privilege access)

  • Hide Protection (HDP)

  • GSC Lock and Commit

Types Documentation

enum DL_GSC_MainFlashBank

Enumerator

Value

Description

DL_GSC_MAIN_FLASH_BANK_0

0U

Main Flash Bank 0 (256 KB)

DL_GSC_MAIN_FLASH_BANK_1

1U

Main Flash Bank 1 (256 KB)

Flash Bank identifiers for write protection.

enum DL_GSC_PRIV_ACCESS

Enumerator

Value

Description

DL_GSC_PRIV_ACCESS_ADC0

0x11040000U

Privilege access for ADC0.

DL_GSC_PRIV_ACCESS_ADC1

0x11040001U

Privilege access for ADC1.

DL_GSC_PRIV_ACCESS_ADC2

0x11040002U

Privilege access for ADC2.

DL_GSC_PRIV_ACCESS_PWM0

0x110C0000U

Privilege access for PWM0.

DL_GSC_PRIV_ACCESS_PWM1

0x110C0001U

Privilege access for PWM1.

DL_GSC_PRIV_ACCESS_PWM2

0x110C0002U

Privilege access for PWM2.

DL_GSC_PRIV_ACCESS_PWM3

0x110C0003U

Privilege access for PWM3.

DL_GSC_PRIV_ACCESS_PWM4

0x110C0004U

Privilege access for PWM4.

DL_GSC_PRIV_ACCESS_ECAP0

0x110C0008U

Privilege access for ECAP0.

DL_GSC_PRIV_ACCESS_ECAP1

0x110C0009U

Privilege access for ECAP1.

DL_GSC_PRIV_ACCESS_EQEP0

0x110C0010U

Privilege access for EQEP0.

DL_GSC_PRIV_ACCESS_EQEP1

0x110C0011U

Privilege access for EQEP1.

DL_GSC_PRIV_ACCESS_EQEP2

0x110C0012U

Privilege access for EQEP2.

DL_GSC_PRIV_ACCESS_TIMG4_0

0x110C0018U

Privilege access for TIMG4_0.

DL_GSC_PRIV_ACCESS_TIMG12_0

0x110C0019U

Privilege access for TIMG12_0.

DL_GSC_PRIV_ACCESS_S0U0

0x11140000U

Privilege access for UniComm S0U0.

DL_GSC_PRIV_ACCESS_S0U1

0x11140001U

Privilege access for UniComm S0U1.

DL_GSC_PRIV_ACCESS_S0U2

0x11140002U

Privilege access for UniComm S0U2.

DL_GSC_PRIV_ACCESS_S1U3

0x11140003U

Privilege access for UniComm S1U3.

DL_GSC_PRIV_ACCESS_S1U4

0x11140004U

Privilege access for UniComm S1U4.

DL_GSC_PRIV_ACCESS_S1U5

0x11140005U

Privilege access for UniComm S1U5.

DL_GSC_PRIV_ACCESS_S0_COMMON

0x11140018U

Privilege access for UniComm S0 common region.

DL_GSC_PRIV_ACCESS_S1_COMMON

0x11140019U

Privilege access for UniComm S1 common region.

DL_GSC_PRIV_ACCESS_GPIO0

0x111C0000U

Privilege access for GPIO0.

DL_GSC_PRIV_ACCESS_GPIO1

0x111C0001U

Privilege access for GPIO1.

DL_GSC_PRIV_ACCESS_GPIO2

0x111C0002U

Privilege access for GPIO2.

DL_GSC_PRIV_ACCESS_GPIO3

0x111C0003U

Privilege access for GPIO3.

DL_GSC_PRIV_ACCESS_MCAN

0x11240000U

Privilege access for MCAN.

DL_GSC_PRIV_ACCESS_CMPSS0

0x11340000U

Privilege access for CMPSS0.

DL_GSC_PRIV_ACCESS_CMPSS1

0x11340001U

Privilege access for CMPSS1.

DL_GSC_PRIV_ACCESS_CMPSS2

0x11340002U

Privilege access for CMPSS2.

DL_GSC_PRIV_ACCESS_CMPSS3

0x11340003U

Privilege access for CMPSS3.

DL_GSC_PRIV_ACCESS_WWDT

0x113C0000U

Privilege access for Windowed Watchdog.

DL_GSC_PRIV_ACCESS_CRC

0x114C0000U

Privilege access for CRC.

DL_GSC_PRIV_ACCESS_AES

0x11540000U

Privilege access for AES.

DL_GSC_PRIV_ACCESS_IOMUX

0x116C0000U

Privilege access for IOMUX.

DL_GSC_PRIV_ACCESS_DEBUGSS

0x11840000U

Privilege access for DEBUGSS.

DL_GSC_PRIV_ACCESS_KEYSTORECTL

0x11940000U

Privilege access for KEYSTORECTL.

DL_GSC_PRIV_ACCESS_EAM

0x119C0000U

Privilege access for EAM.

DL_GSC_PRIV_ACCESS_WUC

0x11A40000U

Privilege access for WUC.

DL_GSC_PRIV_ACCESS_FRIREGS

0x11AC0000U

Privilege access for FRIREGS.

DL_GSC_PRIV_ACCESS_MEMCFG

0x11B40000U

Privilege access for MEMCFG.

DL_GSC_PRIV_ACCESS_SYSCTL

0x120C0000U

Privilege access for SYSCTL.

DL_GSC_PRIV_ACCESS_DMA

0x12140000U

Privilege access for DMA.

DL_GSC_PRIV_ACCESS_GSC

0x121C0000U

Privilege access for GSC.

DL_GSC_PRIV_ACCESS_TINIE

0x12240000U

Privilege access for TINIE.

DL_GSC_PRIV_ACCESS_EPI

0x122C0000U

Privilege access for EPI.

DL_GSC_PRIV_ACCESS_PGA0

0x12340000U

Privilege access for PGA0.

DL_GSC_PRIV_ACCESS_PGA1

0x12340001U

Privilege access for PGA1.

DL_GSC_PRIV_ACCESS_PGA2

0x12340002U

Privilege access for PGA2.

DL_GSC_PRIV_ACCESS_ALL_XBAR_CONFIG

0x123C0000U

Privilege access for ALL_XBAR_CONFIG.

DL_GSC_PRIV_ACCESS_XBAR_INPUT_FLAGS

0x123C0001U

Privilege access for XBAR_INPUT_FLAGS.

DL_GSC_PRIV_ACCESS_OUTPUT_XBAR_FLAGS

0x123C0002U

Privilege access for OUTPUT_XBAR_FLAGS.

Peripheral identifiers for unified GSC PPC privilege access control.

Each value encodes the register offset (upper 16 bits) and bit position (lower 16 bits) for the corresponding register.

Functions Documentation

function DL_GSC_configureMainFlashWriteProtect

void DL_GSC_configureMainFlashWriteProtect(
    GSC_Regs * gsc,
    DL_GSC_MainFlashBank bank,
    uint32_t sector0,
    uint32_t sector1
)

Configure main flash write protection for specified bank.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • bank Main flash bank to configure (DL_GSC_MAIN_FLASH_BANK_0 or BANK_1)

  • sector0 Write protection mask for sectors 0-31 (FPC_WEPROTA, R/W1S)

  • sector1 Write protection mask for sectors 32-127 (FPC_WEPROTB, bits 4-15, R/W1S)

Note: FPC_WEPROTA/B are R/W1S registers: once set, bits cannot be cleared without reset.

Configures write protection for main flash memory sectors. Each sector is 2KB. sector0 : write-protect mask for sectors 0-31 (1 bit = 1 sector) sector1 : write-protect mask for sectors 32-127 (1 bit = 8 sectors, bits 4-15)

Each bit in sector0 corresponds to one 2KB sector (bit 0 = sector 0, bit 31 = sector 31). Each bit in sector1 corresponds to 8 sectors (bit 4 = sectors 32-39, bit 15 = sectors 120-127).

  • 0: Sector is not write protected

  • 1: Sector is write protected

Example usage:

// Protect sectors 0 and 1 of Bank 0
uint32_t lower = DL_GSC_MAIN_FLASH_SECTOR_0 | DL_GSC_MAIN_FLASH_SECTOR_1;
DL_GSC_configureMainFlashWriteProtect(gsc, DL_GSC_MAIN_FLASH_BANK_0, lower, 0);

function DL_GSC_getMainFlashWriteProtectStatus

void DL_GSC_getMainFlashWriteProtectStatus(
    GSC_Regs * gsc,
    DL_GSC_MainFlashBank bank,
    uint32_t * sector0,
    uint32_t * sector1
)

Get main flash write protection status for specified bank.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • bank Main flash bank to check (DL_GSC_MAIN_FLASH_BANK_0 or BANK_1)

  • sector0 Current FPC_WEPROTA value (sectors 0-31, 1 bit = 1 sector)

  • sector1 Current FPC_WEPROTB value (sectors 32-127, 1 bit = 8 sectors)

For returned sector masks:

  • 0: Sector is not write protected

  • 1: Sector is write protected

function DL_GSC_configureMainFlashPrivilege

void DL_GSC_configureMainFlashPrivilege(
    GSC_Regs * gsc,
    DL_GSC_MainFlashBank bank,
    uint32_t sector0,
    uint32_t sector1
)

Configure privilege attributes for main flash regions.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • bank Main flash bank to configure (DL_GSC_MAIN_FLASH_BANK_0 or BANK_1)

  • sector0 Privilege mask for sectors 0-31 (FPC_PRIVATTRIBA)

  • sector1 Privilege mask for sectors 32-127 (FPC_PRIVATTRIBB, bits 4-15)

Configures FPC_PRIVATTRIBA (sectors 0-31) and FPC_PRIVATTRIBB (sectors 32-127) for the specified bank.

  • 0: Non-privileged access allowed

  • 1: Privileged access only

function DL_GSC_getMainFlashPrivilegeStatus

void DL_GSC_getMainFlashPrivilegeStatus(
    GSC_Regs * gsc,
    DL_GSC_MainFlashBank bank,
    uint32_t * sector0,
    uint32_t * sector1
)

Get privilege attributes status for main flash regions.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • bank Main flash bank to check (DL_GSC_MAIN_FLASH_BANK_0 or BANK_1)

  • sector0 Current FPC_PRIVATTRIBA value (sectors 0-31)

  • sector1 Current FPC_PRIVATTRIBB value (sectors 32-127, bits 4-15)

function DL_GSC_configureHideProtectionRegion

bool DL_GSC_configureHideProtectionRegion(
    GSC_Regs * gsc,
    uint8_t startSec,
    uint8_t endSec,
    uint8_t bank
)

Configure hide protection region for flash.

Parameters:

  • gsc Pointer to the GSC peripheral

  • startSec Starting sector number (0-127) for hide protection

  • endSec Ending sector number (0-127) for hide protection

  • bank 0: Configure Bank 0 (FPC_HDPPROT0_CONFIG) 1: Configure Bank 1 (FPC_HDPPROT1_CONFIG)

Return: bool Returns true if configuration is valid (startSec <= endSec), false otherwise

Note:

  • HDPSTART must be <= HDPEND for a valid configuration.

  • HDP registers are write-once. A BOOTRST is required to reconfigure.

Configures hide protection for a region of flash sectors.

Each sector is 2KB. AM13E2x has 128 sectors per bank (sectors 0-127). HDP registers are write-once (WOnce); a BOOTRST is required to reconfigure.

function DL_GSC_setHideProtectionAccess

void DL_GSC_setHideProtectionAccess(
    GSC_Regs * gsc,
    bool enable,
    uint8_t bank
)

Enable/Disable HDP access for flash.

Parameters:

  • gsc Pointer to the GSC peripheral

  • enable true: Enable HDP region access, false: Disable HDP region access

  • bank 0: Configure Bank 0 (HDPPROT0ACCDIS), 1: Configure Bank 1 (HDPPROT1ACCDIS)

Controls access to hide protected regions

function DL_GSC_enableHideProtectionMode

__STATIC_INLINE void DL_GSC_enableHideProtectionMode(
    GSC_Regs * gsc
)

Enable Flash Hide Protection (HDP) mode.

Parameters:

  • gsc Pointer to the GSC peripheral

function DL_GSC_setVTOR_NS

__STATIC_INLINE void DL_GSC_setVTOR_NS(
    GSC_Regs * gsc,
    uint32_t addr_ns
)

Set the Vector Table Offset Register (VTOR_NS)

Parameters:

  • gsc Pointer to the register overlay for the peripheral

  • addr_ns Address where the application Vector Table resides

Configures the VTOR_NS register which holds the address of the application vector table. This register can be locked via GSC_LOCK.VTOR.

function DL_GSC_allowPrivilegeAccessToNonPrivilegedSRAM

__STATIC_INLINE void DL_GSC_allowPrivilegeAccessToNonPrivilegedSRAM(
    GSC_Regs * gsc
)

Allow privileged access to non-privileged SRAM regions.

Parameters:

  • gsc Pointer to the GSC peripheral

Configures SRAM protection control to allow privileged code to access non-privileged SRAM regions by disabling bus fault generation on violations.

function DL_GSC_blockPrivilegeAccessToNonPrivilegeSRAM

__STATIC_INLINE void DL_GSC_blockPrivilegeAccessToNonPrivilegeSRAM(
    GSC_Regs * gsc
)

Block privileged access to non-privileged SRAM regions.

Parameters:

  • gsc Pointer to the GSC peripheral

Configures SRAM protection control to block privileged code from accessing non-privileged SRAM regions by enabling bus fault generation on violations.

function DL_GSC_allowPrivilegeAccessToNonPrivilegeFlash

__STATIC_INLINE void DL_GSC_allowPrivilegeAccessToNonPrivilegeFlash(
    GSC_Regs * gsc
)

Allow privileged access to non-privileged flash regions.

Parameters:

  • gsc Pointer to the GSC peripheral

Configures flash protection control to allow privileged code to access non-privileged flash regions by disabling bus fault generation on violations.

function DL_GSC_blockPrivilegeAccessToNonPrivilegeFlash

__STATIC_INLINE void DL_GSC_blockPrivilegeAccessToNonPrivilegeFlash(
    GSC_Regs * gsc
)

Block privileged access to non-privileged flash regions.

Parameters:

  • gsc Pointer to the GSC peripheral

Configures flash protection control to block privileged code from accessing non-privileged flash regions by enabling bus fault generation on violations.

function DL_GSC_allowPrivilegeAccessToNonPrivilegePeripheral

__STATIC_INLINE void DL_GSC_allowPrivilegeAccessToNonPrivilegePeripheral(
    GSC_Regs * gsc
)

Allow privileged access to non-privileged peripherals.

Parameters:

  • gsc Pointer to the GSC peripheral

Configures peripheral protection control to allow privileged code to access non-privileged peripherals by disabling bus fault generation on violations.

function DL_GSC_blockPrivilegeAccessToNonPrivilegePeripheral

__STATIC_INLINE void DL_GSC_blockPrivilegeAccessToNonPrivilegePeripheral(
    GSC_Regs * gsc
)

Block privileged access to non-privileged peripherals.

Parameters:

  • gsc Pointer to the GSC peripheral

Configures peripheral protection control to block privileged code from accessing non-privileged peripherals by enabling bus fault generation on violations.

function DL_GSC_allowPrivilegeAccess

__STATIC_INLINE void DL_GSC_allowPrivilegeAccess(
    GSC_Regs * gsc,
    DL_GSC_PRIV_ACCESS peripheral
)

Configure a peripheral as privileged-only via GSC PPC.

Parameters:

  • gsc Pointer to GSC register base

  • peripheral Peripheral to configure, one of [DL_GSC_PRIV_ACCESS]

function DL_GSC_blockPrivilegeAccess

__STATIC_INLINE void DL_GSC_blockPrivilegeAccess(
    GSC_Regs * gsc,
    DL_GSC_PRIV_ACCESS peripheral
)

Configure a peripheral as non-privileged (accessible from any mode)

Parameters:

  • gsc Pointer to GSC register base

  • peripheral Peripheral to configure, one of [DL_GSC_PRIV_ACCESS]

function DL_GSC_setSRAMPrivilegeAttrib0

__STATIC_INLINE void DL_GSC_setSRAMPrivilegeAttrib0(
    GSC_Regs * gsc,
    uint32_t val
)

Set SRAM privilege attributes for pages 0-3 (SPC_PRIVATTRIB0)

Parameters:

function DL_GSC_setSRAMPrivilegeAttrib1

__STATIC_INLINE void DL_GSC_setSRAMPrivilegeAttrib1(
    GSC_Regs * gsc,
    uint32_t val
)

Set SRAM privilege attributes for pages 4-7 (SPC_PRIVATTRIB1)

Parameters:

function DL_GSC_setHideProtectionBank0Config

__STATIC_INLINE void DL_GSC_setHideProtectionBank0Config(
    GSC_Regs * gsc,
    uint8_t startSec,
    uint8_t endSec
)

Configure the Hide Data Protection (HDP) region for Flash Bank 0.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • startSec First sector of the HDP region (0-127)

  • endSec Last sector of the HDP region (0-127, must be >= startSec)

Sets the start and end sector of the HDP region in Bank 0. This register is write-once — once set it cannot be changed without reset.

function DL_GSC_setHideProtectionBank1Config

__STATIC_INLINE void DL_GSC_setHideProtectionBank1Config(
    GSC_Regs * gsc,
    uint8_t startSec,
    uint8_t endSec
)

Configure the Hide Data Protection (HDP) region for Flash Bank 1.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • startSec First sector of the HDP region (0-127)

  • endSec Last sector of the HDP region (0-127, must be >= startSec)

Sets the start and end sector of the HDP region in Bank 1. This register is write-once — once set it cannot be changed without reset.

function DL_GSC_lockRegisters

__STATIC_INLINE void DL_GSC_lockRegisters(
    GSC_Regs * gsc,
    uint32_t lockMask
)

Lock GSC registers by writing the GSC_LOCK register.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • lockMask Bitmask of registers to lock. Use [DL_GSC_LOCK_BITS] macros ORed together.

Note: Writing lock requires valid key (0xA551)

Writes GSC_LOCK with KEY=0xA551 and the specified lock bits ORed together. Once locked, the corresponding registers cannot be modified. To unlock, call this function again with the bit cleared (lockMask = 0). If committed (via DL_GSC_commitRegisters), only BOOTRST can undo.

Example usage:

DL_GSC_lockRegisters(gsc, DL_GSC_LOCK_VTOR | DL_GSC_LOCK_PPC_ATTRIB);

function DL_GSC_getLockConfiguration

__STATIC_INLINE uint32_t DL_GSC_getLockConfiguration(
    GSC_Regs * gsc
)

Get current lock configuration as a bitmask.

Parameters:

  • gsc Pointer to the GSC peripheral register block

Return: uint32_t Current lock bitmask (use DL_GSC_LOCK_xxx macros to check)

Returns the current GSC_LOCK register value (key bits masked out). Compare against [DL_GSC_LOCK_BITS] macros to check individual bits.

Example usage:

uint32_t lockMask = DL_GSC_getLockConfiguration(gsc);
if (lockMask & DL_GSC_LOCK_VTOR) { }

function DL_GSC_commitRegisters

__STATIC_INLINE void DL_GSC_commitRegisters(
    GSC_Regs * gsc,
    uint32_t commitMask
)

Commit GSC registers permanently by writing the GSC_COMMIT register.

Parameters:

  • gsc Pointer to the GSC peripheral register block

  • commitMask Bitmask of registers to commit. Use [DL_GSC_COMMIT_BITS] macros ORed together.

Note:

  • Writing commit requires valid key (0xA442)

  • Committed bits can only be cleared by BOOTRST

Writes GSC_COMMIT with KEY=0xA442 and the specified commit bits ORed together. Once committed, the corresponding registers cannot be modified until BOOTRST.

Example usage:

DL_GSC_commitRegisters(gsc, DL_GSC_COMMIT_VTOR | DL_GSC_COMMIT_PPC_ATTRIB);

function DL_GSC_getCommitConfiguration

__STATIC_INLINE uint32_t DL_GSC_getCommitConfiguration(
    GSC_Regs * gsc
)

Get current commit configuration as a bitmask.

Parameters:

  • gsc Pointer to the GSC peripheral register block

Return: uint32_t Current commit bitmask (use DL_GSC_COMMIT_xxx macros to check)

Example usage:

uint32_t commitMask = DL_GSC_getCommitConfiguration(gsc);
if (commitMask & DL_GSC_COMMIT_VTOR) { }

Macros Documentation

define DL_GSC_LOCK_KEY

#define DL_GSC_LOCK_KEY ((uint32_t)0xA551U)

Key required to write GSC_LOCK register

define DL_GSC_COMMIT_KEY

#define DL_GSC_COMMIT_KEY ((uint32_t)0xA442U)

Key required to write GSC_COMMIT register

define DL_GSC_MAIN_FLASH_SECTOR_0

#define DL_GSC_MAIN_FLASH_SECTOR_0 (0x00000001U)

Sector 0 (bank offset 0x0000-0x07FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_1

#define DL_GSC_MAIN_FLASH_SECTOR_1 (0x00000002U)

Sector 1 (bank offset 0x0800-0x0FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_2

#define DL_GSC_MAIN_FLASH_SECTOR_2 (0x00000004U)

Sector 2 (bank offset 0x1000-0x17FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_3

#define DL_GSC_MAIN_FLASH_SECTOR_3 (0x00000008U)

Sector 3 (bank offset 0x1800-0x1FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_4

#define DL_GSC_MAIN_FLASH_SECTOR_4 (0x00000010U)

Sector 4 (bank offset 0x2000-0x27FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_5

#define DL_GSC_MAIN_FLASH_SECTOR_5 (0x00000020U)

Sector 5 (bank offset 0x2800-0x2FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_6

#define DL_GSC_MAIN_FLASH_SECTOR_6 (0x00000040U)

Sector 6 (bank offset 0x3000-0x37FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_7

#define DL_GSC_MAIN_FLASH_SECTOR_7 (0x00000080U)

Sector 7 (bank offset 0x3800-0x3FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_8

#define DL_GSC_MAIN_FLASH_SECTOR_8 (0x00000100U)

Sector 8 (bank offset 0x4000-0x47FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_9

#define DL_GSC_MAIN_FLASH_SECTOR_9 (0x00000200U)

Sector 9 (bank offset 0x4800-0x4FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_10

#define DL_GSC_MAIN_FLASH_SECTOR_10 (0x00000400U)

Sector 10 (bank offset 0x5000-0x57FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_11

#define DL_GSC_MAIN_FLASH_SECTOR_11 (0x00000800U)

Sector 11 (bank offset 0x5800-0x5FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_12

#define DL_GSC_MAIN_FLASH_SECTOR_12 (0x00001000U)

Sector 12 (bank offset 0x6000-0x67FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_13

#define DL_GSC_MAIN_FLASH_SECTOR_13 (0x00002000U)

Sector 13 (bank offset 0x6800-0x6FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_14

#define DL_GSC_MAIN_FLASH_SECTOR_14 (0x00004000U)

Sector 14 (bank offset 0x7000-0x77FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_15

#define DL_GSC_MAIN_FLASH_SECTOR_15 (0x00008000U)

Sector 15 (bank offset 0x7800-0x7FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_16

#define DL_GSC_MAIN_FLASH_SECTOR_16 (0x00010000U)

Sector 16 (bank offset 0x8000-0x87FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_17

#define DL_GSC_MAIN_FLASH_SECTOR_17 (0x00020000U)

Sector 17 (bank offset 0x8800-0x8FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_18

#define DL_GSC_MAIN_FLASH_SECTOR_18 (0x00040000U)

Sector 18 (bank offset 0x9000-0x97FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_19

#define DL_GSC_MAIN_FLASH_SECTOR_19 (0x00080000U)

Sector 19 (bank offset 0x9800-0x9FFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_20

#define DL_GSC_MAIN_FLASH_SECTOR_20 (0x00100000U)

Sector 20 (bank offset 0xA000-0xA7FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_21

#define DL_GSC_MAIN_FLASH_SECTOR_21 (0x00200000U)

Sector 21 (bank offset 0xA800-0xAFFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_22

#define DL_GSC_MAIN_FLASH_SECTOR_22 (0x00400000U)

Sector 22 (bank offset 0xB000-0xB7FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_23

#define DL_GSC_MAIN_FLASH_SECTOR_23 (0x00800000U)

Sector 23 (bank offset 0xB800-0xBFFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_24

#define DL_GSC_MAIN_FLASH_SECTOR_24 (0x01000000U)

Sector 24 (bank offset 0xC000-0xC7FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_25

#define DL_GSC_MAIN_FLASH_SECTOR_25 (0x02000000U)

Sector 25 (bank offset 0xC800-0xCFFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_26

#define DL_GSC_MAIN_FLASH_SECTOR_26 (0x04000000U)

Sector 26 (bank offset 0xD000-0xD7FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_27

#define DL_GSC_MAIN_FLASH_SECTOR_27 (0x08000000U)

Sector 27 (bank offset 0xD800-0xDFFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_28

#define DL_GSC_MAIN_FLASH_SECTOR_28 (0x10000000U)

Sector 28 (bank offset 0xE000-0xE7FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_29

#define DL_GSC_MAIN_FLASH_SECTOR_29 (0x20000000U)

Sector 29 (bank offset 0xE800-0xEFFF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_30

#define DL_GSC_MAIN_FLASH_SECTOR_30 (0x40000000U)

Sector 30 (bank offset 0xF000-0xF7FF, 2KB)

define DL_GSC_MAIN_FLASH_SECTOR_31

#define DL_GSC_MAIN_FLASH_SECTOR_31 (0x80000000U)

Sector 31 (bank offset 0xF800-0xFFFF, 2KB)

define DL_GSC_MAIN_FLASH_A_ALL_SECTORS

#define DL_GSC_MAIN_FLASH_A_ALL_SECTORS (0xFFFFFFFFU)

All 32 sectors (sectors 0-31)

define DL_GSC_MAIN_FLASH_SECTOR_32_39

#define DL_GSC_MAIN_FLASH_SECTOR_32_39 (1U << 4U)

Sectors 32-39 (bank offset 0x10000-0x13FFF)

define DL_GSC_MAIN_FLASH_SECTOR_40_47

#define DL_GSC_MAIN_FLASH_SECTOR_40_47 (1U << 5U)

Sectors 40-47 (bank offset 0x14000-0x17FFF)

define DL_GSC_MAIN_FLASH_SECTOR_48_55

#define DL_GSC_MAIN_FLASH_SECTOR_48_55 (1U << 6U)

Sectors 48-55 (bank offset 0x18000-0x1BFFF)

define DL_GSC_MAIN_FLASH_SECTOR_56_63

#define DL_GSC_MAIN_FLASH_SECTOR_56_63 (1U << 7U)

Sectors 56-63 (bank offset 0x1C000-0x1FFFF)

define DL_GSC_MAIN_FLASH_SECTOR_64_71

#define DL_GSC_MAIN_FLASH_SECTOR_64_71 (1U << 8U)

Sectors 64-71 (bank offset 0x20000-0x23FFF)

define DL_GSC_MAIN_FLASH_SECTOR_72_79

#define DL_GSC_MAIN_FLASH_SECTOR_72_79 (1U << 9U)

Sectors 72-79 (bank offset 0x24000-0x27FFF)

define DL_GSC_MAIN_FLASH_SECTOR_80_87

#define DL_GSC_MAIN_FLASH_SECTOR_80_87 (1U << 10U)

Sectors 80-87 (bank offset 0x28000-0x2BFFF)

define DL_GSC_MAIN_FLASH_SECTOR_88_95

#define DL_GSC_MAIN_FLASH_SECTOR_88_95 (1U << 11U)

Sectors 88-95 (bank offset 0x2C000-0x2FFFF)

define DL_GSC_MAIN_FLASH_SECTOR_96_103

#define DL_GSC_MAIN_FLASH_SECTOR_96_103 (1U << 12U)

Sectors 96-103 (bank offset 0x30000-0x33FFF)

define DL_GSC_MAIN_FLASH_SECTOR_104_111

#define DL_GSC_MAIN_FLASH_SECTOR_104_111 (1U << 13U)

Sectors 104-111 (bank offset 0x34000-0x37FFF)

define DL_GSC_MAIN_FLASH_SECTOR_112_119

#define DL_GSC_MAIN_FLASH_SECTOR_112_119 (1U << 14U)

Sectors 112-119 (bank offset 0x38000-0x3BFFF)

define DL_GSC_MAIN_FLASH_SECTOR_120_127

#define DL_GSC_MAIN_FLASH_SECTOR_120_127 (1U << 15U)

Sectors 120-127 (bank offset 0x3C000-0x3FFFF)

define DL_GSC_MAIN_FLASH_B_ALL_SECTORS

#define DL_GSC_MAIN_FLASH_B_ALL_SECTORS (0x0000FFF0U)

All B-register sectors (sectors 32-127)

define DL_GSC_LOCK_ATTRIBVIOL_CONFIG

#define DL_GSC_LOCK_ATTRIBVIOL_CONFIG     (GSC_GSC_LOCK_ATTRIBVIOL_CONFIG_MASK)

Lock attribute violation configuration

define DL_GSC_LOCK_PPC_ATTRIB

#define DL_GSC_LOCK_PPC_ATTRIB (GSC_GSC_LOCK_PPC_AATRIB_MASK)

Lock PPC attribute configuration

define DL_GSC_LOCK_SPC_ATTRIB

#define DL_GSC_LOCK_SPC_ATTRIB (GSC_GSC_LOCK_SPC_AATRIB_MASK)

Lock SPC attribute configuration

define DL_GSC_LOCK_FPPC_ATTRIB

#define DL_GSC_LOCK_FPPC_ATTRIB (GSC_GSC_LOCK_FPPC_AATRIB_MASK)

Lock FPPC attribute configuration

define DL_GSC_LOCK_VTOR

#define DL_GSC_LOCK_VTOR (GSC_GSC_LOCK_VTOR_MASK)

Lock Vector Table Offset Register

define DL_GSC_LOCK_DTB_MUXSEL

#define DL_GSC_LOCK_DTB_MUXSEL (GSC_GSC_LOCK_DTB_MUXSEL_MASK)

Lock DTB MUX selection

define DL_GSC_LOCK_ALL

#define DL_GSC_LOCK_ALL     (DL_GSC_LOCK_ATTRIBVIOL_CONFIG | DL_GSC_LOCK_PPC_ATTRIB | DL_GSC_LOCK_SPC_ATTRIB | DL_GSC_LOCK_FPPC_ATTRIB | \
     DL_GSC_LOCK_VTOR | DL_GSC_LOCK_DTB_MUXSEL)

All lock bits ORed together

define DL_GSC_COMMIT_ATTRIBVIOL_CONFIG

#define DL_GSC_COMMIT_ATTRIBVIOL_CONFIG     (GSC_GSC_COMMIT_ATTRIBVIOL_CONFIG_MASK)

Commit attribute violation configuration

define DL_GSC_COMMIT_PPC_ATTRIB

#define DL_GSC_COMMIT_PPC_ATTRIB (GSC_GSC_COMMIT_PPC_AATRIB_MASK)

Commit PPC attribute configuration

define DL_GSC_COMMIT_SPC_ATTRIB

#define DL_GSC_COMMIT_SPC_ATTRIB (GSC_GSC_COMMIT_SPC_AATRIB_MASK)

Commit SPC attribute configuration

define DL_GSC_COMMIT_FPPC_ATTRIB

#define DL_GSC_COMMIT_FPPC_ATTRIB (GSC_GSC_COMMIT_FPPC_AATRIB_MASK)

Commit FPPC attribute configuration

define DL_GSC_COMMIT_VTOR

#define DL_GSC_COMMIT_VTOR (GSC_GSC_COMMIT_VTOR_MASK)

Commit Vector Table Offset Register

define DL_GSC_COMMIT_DTB_MUXSEL

#define DL_GSC_COMMIT_DTB_MUXSEL (GSC_GSC_COMMIT_DTB_MUXSEL_MASK)

Commit DTB MUX selection

define DL_GSC_COMMIT_ALL

#define DL_GSC_COMMIT_ALL     (DL_GSC_COMMIT_ATTRIBVIOL_CONFIG | DL_GSC_COMMIT_PPC_ATTRIB | DL_GSC_COMMIT_SPC_ATTRIB | \
     DL_GSC_COMMIT_FPPC_ATTRIB | DL_GSC_COMMIT_VTOR | DL_GSC_COMMIT_DTB_MUXSEL)

All commit bits ORed together

define DL_GSC_SPC_PRIVATTRIB_ALL_PRIVILEGED

#define DL_GSC_SPC_PRIVATTRIB_ALL_PRIVILEGED (0x7F7F7F7FU)

All pages privileged

define DL_GSC_SPC_PRIVATTRIB_ALL_NONPRIVILEGED

#define DL_GSC_SPC_PRIVATTRIB_ALL_NONPRIVILEGED (0x00000000U)

All pages non-privileged

define DL_GSC_SPC_PAGE_CHUNK_512B_0

#define DL_GSC_SPC_PAGE_CHUNK_512B_0 (1U << 0U)

Per-page chunk bitmasks (bits 0-6 within each page byte) First 512B chunk (offset 0x000-0x1FF)

define DL_GSC_SPC_PAGE_CHUNK_512B_1

#define DL_GSC_SPC_PAGE_CHUNK_512B_1 (1U << 1U)

Second 512B chunk (offset 0x200-0x3FF)

define DL_GSC_SPC_PAGE_CHUNK_1KB

#define DL_GSC_SPC_PAGE_CHUNK_1KB (1U << 2U)

1KB chunk (offset 0x400-0x7FF)

define DL_GSC_SPC_PAGE_CHUNK_2KB

#define DL_GSC_SPC_PAGE_CHUNK_2KB (1U << 3U)

2KB chunk (offset 0x800-0xFFF)

define DL_GSC_SPC_PAGE_CHUNK_4KB_0

#define DL_GSC_SPC_PAGE_CHUNK_4KB_0 (1U << 4U)

First 4KB chunk (offset 0x1000-0x1FFF)

define DL_GSC_SPC_PAGE_CHUNK_4KB_1

#define DL_GSC_SPC_PAGE_CHUNK_4KB_1 (1U << 5U)

Second 4KB chunk (offset 0x2000-0x2FFF)

define DL_GSC_SPC_PAGE_CHUNK_4KB_2

#define DL_GSC_SPC_PAGE_CHUNK_4KB_2 (1U << 6U)

Third 4KB chunk (offset 0x3000-0x3FFF)

define DL_GSC_SPC_PAGE_ALL_CHUNKS

#define DL_GSC_SPC_PAGE_ALL_CHUNKS (0x7FU)

All 7 chunks of a page

define DL_GSC_SPC_PAGE_MASK

#define DL_GSC_SPC_PAGE_MASK(
    pageNum,
    chunkMask
)
((uint32_t)(chunkMask) << ((pageNum) * 8U))

Build a PRIVATTRIB register value for a specific page.

Parameters:

  • pageNum Page number within the register (0-3 for PRIVATTRIB0, 0-3 for PRIVATTRIB1)

  • chunkMask Bitmask of chunks to mark privileged (use DL_GSC_SPC_PAGE_CHUNK_xxx)

Example — mark all chunks of page 1 as privileged in PRIVATTRIB0:

DL_GSC_setSRAMPrivilegeAttrib0(GSC, DL_GSC_SPC_PAGE_MASK(1, DL_GSC_SPC_PAGE_ALL_CHUNKS));

define DL_GSC_MAIN_FLASH_SECTOR_RANGE

#define DL_GSC_MAIN_FLASH_SECTOR_RANGE(
    start,
    end
)
    ((uint32_t)(((uint64_t)0xFFFFFFFFULL << (start)) & ((uint64_t)0xFFFFFFFFULL >> (31U - (end)))))

Helper macro to create sector ranges (sectors 0-31)

Parameters:

  • start Starting sector number (0-31)

  • end Ending sector number (0-31)

Return: Mask representing the sector range (uint32_t)

Note: For sectors 32-127, use the [DL_GSC_MAIN_FLASH_SECTOR_B] macros directly with the sector1 parameter of the configure functions.