Actions

EmSys

Tm4clib-cortex

From EdWiki

Cortex Core Defines

Macros

#define MMIO8(addr) (*(volatile uint8_t *)(addr))

#define MMIO16(addr) (*(volatile uint16_t *)(addr))

#define MMIO32(addr) (*(volatile uint32_t *)(addr))

#define MMIO64(addr) (*(volatile uint64_t *)(addr))

Modules

Cortex Core Atomic support Defines
Atomic operation support. More..

Functions

Macros Documentation

MMIO8

#define MMIO8(addr) (*(volatile uint8_t *)(addr))

MMIO16

#define MMIO16(addr) (*(volatile uint16_t *)(addr))

MMIO32

#define MMIO32(addr) (*(volatile uint32_t *)(addr))

MMIO64

#define MMIO64(addr) (*(volatile uint64_t *)(addr))

Detailed Description

Defined Constants and Types for the Cortex Core

Function Documentation

cm_disable_faults()

Cortex M Disable faults.

Prototype: static void cm_disable_faults(void)
Description: Mask the HardFault interrupt globally

cm_disable_interrupts()

Cortex M Disable interrupts.

Prototype: static void cm_disable_interrupts(void)
Description: Mask all interrupts globally

cm_enable_faults()

Cortex M Enable faults.

Prototype: static void cm_enable_faults(void)
Description: Disable the HardFault mask and enable fault interrupt globally

cm_enable_interrupts()

Cortex M Enable interrupts.

Prototype: static void cm_enable_interrupts(void)
Description: Disable the interrupt mask and enable interrupts globally

cm_is_masked_faults()

Cortex M Check if Fault interrupt is masked.

Prototype: static bool cm_is_masked_faults(void)
Description:Checks, if HardFault interrupt is masked (disabled).
Returns: bool true, if HardFault interrupt is disabled.

cm_is_masked_interrupts()

Cortex M Check if interrupts are masked.

Prototype: static bool cm_is_masked_interrupts(void)
Description:Checks, if interrupts are masked (disabled).
Returns : true, if interrupts are disabled.

cm_mask_faults()

Cortex M Mask HardFault interrupt.

Prototype: static uint32_t cm_mask_faults(uint32_t mask)
Description:This function switches the mask of the HardFault interrupt. If mask is true, the HardFault interrupt will be disabled. The result of this function can be used for restoring previous state of the mask.
Parameters:
[in] mask uint32_t New state of the HardFault interrupt mask
Returns: uint32_t old state of the HardFault interrupt mask

cm_mask_interrupts()

Cortex M Mask interrupts.

Prototype: static uint32_t cm_mask_interrupts(uint32_t mask)
Description:This function switches the mask of the interrupts. If mask is true, the interrupts will be disabled. The result of this function can be used for restoring previous state of the mask.
Parameters:
[in] mask uint32_t New state of the interrupt mask
Returns: uint32_t old state of the interrupt mask

Cortex Core Atomic support

Macros

#define __CM_SAVER(state)

#define CM_ATOMIC_BLOCK() for(uint32_t __CM_SAVER(true), __my = true; __my; __my = false)

#define CM_ATOMIC_CONTEXT() uint32_t __CM_SAVER(true)

Functions

static uint32_t __cm_atomic_set(uint32_t *val)

Macro Definition Documentation

__CM_SAVER

#define __CM_SAVER(state)
Value:

__val = (state),                                        \
        __save __attribute__((__cleanup__(__cm_atomic_set))) =  \
        __cm_atomic_set(&__val)

CM_ATOMIC_BLOCK

#define CM_ATOMIC_BLOCK() for (uint32_t __CM_SAVER(true), __my = true; __my; __my = false)
Examples:
Use of return inside block:

uint64_t value;         // This value is used somewhere in interrupt
...
uint64_t allocval(void)
{
    CM_ATOMIC_BLOCK() {         // interrupts are masked in this block
        value = value * 1024 + 651;     // do long atomic operation
        return value;           // interrupts is restored automatically
    }
}

CM_ATOMIC_CONTEXT

#define CM_ATOMIC_CONTEXT() uint32_t __CM_SAVER(true)

__cm_atomic_set()

static uint32_t __cm_atomic_set(uint32_t *val)