module ti.sysbios.family.c7x.Exception

Exception Module

The Exception module is a basic C7x exception handler. It is generally considered to be a program endpoint, since an exception usually indicates something fatal to the system. [ more ... ]
C synopsis target-domain sourced in ti/sysbios/family/c7x/Exception.xdc
#include <ti/sysbios/family/c7x/Exception.h>
Functions
Void 
Void 
Functions common to all target modules
Defines
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
Typedefs
typedef Void 
typedef struct
Constants
extern const Bool 
extern const Exception_FuncPtr 
extern const Error_Id 
extern const Error_Id 
extern const Exception_FuncPtr 
extern const Exception_FuncPtr 
extern const Bool 
 
DETAILS
The Exception module is a basic C7x exception handler. It is generally considered to be a program endpoint, since an exception usually indicates something fatal to the system.
Function hooks are provided to the user for hooking in their own functions at different points of an exception. The hook functions are called in the following order: (1) exceptionHook - called whenever an exception occurs. (2) internalHook - called only when an internal exception or page fault occurs. (5) returnHook - called whenever an exception occurs.

Calling Context

Function Hwi Swi Task Main Startup
clearLastStatus Y Y Y Y Y
getLastStatus Y Y Y Y Y
setReturnPtr Y Y Y Y Y
Definitions:
  • Hwi: API is callable from a Hwi thread.
  • Swi: API is callable from a Swi thread.
  • Task: API is callable from a Task thread.
  • Main: API is callable during any of these phases:
    • In your module startup after this module is started (e.g. Mod_Module_startupDone() returns TRUE).
    • During xdc.runtime.Startup.lastFxns.
    • During main().
    • During BIOS.startupFxns.
  • Startup: API is callable during any of these phases:
    • During xdc.runtime.Startup.firstFxns.
    • In your module startup before this module is started (e.g. Mod_Module_startupDone() returns FALSE).
 
const Exception_IERRADX

Address exception

C synopsis target-domain
#define Exception_IERRADX (Bits32)0x00002000
 
 
const Exception_IERRDFX

Data fetch exception

C synopsis target-domain
#define Exception_IERRDFX (Bits32)0x00000400
 
 
const Exception_IERREPX

Execute packet exception

C synopsis target-domain
#define Exception_IERREPX (Bits32)0x00000008
 
 
const Exception_IERREXX

Execution exception

C synopsis target-domain
#define Exception_IERREXX (Bits32)0x00001000
 
 
const Exception_IERRFPX

Fetch packet exception

C synopsis target-domain
#define Exception_IERRFPX (Bits32)0x00000004
 
 
const Exception_IERRIFX

Instruction fetch exception

C synopsis target-domain
#define Exception_IERRIFX (Bits32)0x00000002
 
 
const Exception_IERRLBX

Loop buffer exception

C synopsis target-domain
#define Exception_IERRLBX (Bits32)0x00000100
 
 
const Exception_IERRMMX

MMA exception

C synopsis target-domain
#define Exception_IERRMMX (Bits32)0x00004000
 
 
const Exception_IERRMSX

Missed stall exception

C synopsis target-domain
#define Exception_IERRMSX (Bits32)0x00000200
 
 
const Exception_IERROPX

Illegal opcode exception

C synopsis target-domain
#define Exception_IERROPX (Bits32)0x00000010
 
 
const Exception_IERRPFX

Page fault exception

C synopsis target-domain
#define Exception_IERRPFX (Bits32)0x00000001
 
 
const Exception_IERRPRX

Priviledge exception

C synopsis target-domain
#define Exception_IERRPRX (Bits32)0x00000080
 
 
const Exception_IERRRAX

Resource access exeption

C synopsis target-domain
#define Exception_IERRRAX (Bits32)0x00000040
 
 
const Exception_IERRRCX

Resource conflict exception

C synopsis target-domain
#define Exception_IERRRCX (Bits32)0x00000020
 
 
const Exception_IERRSEX

Streaming engine exception

C synopsis target-domain
#define Exception_IERRSEX (Bits32)0x00000800
 
 
const Exception_sizeContextBuf
C synopsis target-domain
#define Exception_sizeContextBuf (UInt32)0x1000
 
 
typedef Exception_FuncPtr

FuncPtr - Hook function type definition

C synopsis target-domain
typedef Void (*Exception_FuncPtr)(Void);
 
 
struct Exception_Status

Status - structure filled by getLastStatus()

C synopsis target-domain
typedef struct Exception_Status {
    Bits64 nrp;
    // NMI return pointer register
    Bits64 ntsr;
    // NMI/Exception task state register
    Bits64 ierr;
    // Internal Exception report register
    Bits64 iear;
    // Internal Exception report register
    Bits64 iesr;
    // Internal Exception report register
    Exception_Context *excContext;
    // Context structure filled by last exception
} Exception_Status;
 
 
config Exception_E_exceptionMax  // module-wide

Error raised when Exception.enablePrint is true

C synopsis target-domain
extern const Error_Id Exception_E_exceptionMax;
 
 
config Exception_E_exceptionMin  // module-wide

Error raised when Exception.enablePrint is false

C synopsis target-domain
extern const Error_Id Exception_E_exceptionMin;
 
 
config Exception_enablePrint  // module-wide

enablePrint - Enable print of exception details and Register values

C synopsis target-domain
extern const Bool Exception_enablePrint;
 
 
config Exception_exceptionHook  // module-wide

exceptionHook - Function hook called by handler This is called anytime an exception occurs

C synopsis target-domain
extern const Exception_FuncPtr Exception_exceptionHook;
 
 
config Exception_internalHook  // module-wide

internalHook - Function hook called by internalHandler Function is only called when an internal exception has occurred

C synopsis target-domain
extern const Exception_FuncPtr Exception_internalHook;
 
 
config Exception_returnHook  // module-wide

returnHook - Function hook called at the end of Exception_dispatch

C synopsis target-domain
extern const Exception_FuncPtr Exception_returnHook;
 
 
config Exception_useInternalBuffer  // module-wide

If true, the exception context is saved to an internal buffer. If false, the exception context is saved to the bottom of the isr stack and no memory for the internal buffer is allocated

C synopsis target-domain
extern const Bool Exception_useInternalBuffer;
 
 
Exception_clearLastStatus()  // module-wide

clearLastStatus - Clears internal Status structure

C synopsis target-domain
Void Exception_clearLastStatus();
 
 
Exception_getLastStatus()  // module-wide

getLastStatus - Fills passed status structure with the Status fields that were recorded by the last invocation of dispatch(), handler() and internalHandler(). The 'excContext' is valid only in the scope of sub-handler "Hook" functions

C synopsis target-domain
Void Exception_getLastStatus(Exception_Status *status);
 
 
Exception_setReturnPtr()  // module-wide

setReturnPtr - Configures dispatch() to "return" (branch) to the passed ptr

C synopsis target-domain
Exception_FuncPtr Exception_setReturnPtr(Exception_FuncPtr ptr);
 
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Exception_Module_id();
// Get this module's unique id
 
Bool Exception_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Exception_Module_heap();
// The heap from which this module allocates memory
 
Bool Exception_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Exception_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Exception_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
 
Configuration settings sourced in ti/sysbios/family/c7x/Exception.xdc
var Exception = xdc.useModule('ti.sysbios.family.c7x.Exception');
module-wide constants & types
    const Exception.IERRADX// Address exception = 0x00002000;
    const Exception.IERRDFX// Data fetch exception = 0x00000400;
    const Exception.IERREPX// Execute packet exception = 0x00000008;
    const Exception.IERREXX// Execution exception = 0x00001000;
    const Exception.IERRFPX// Fetch packet exception = 0x00000004;
    const Exception.IERRLBX// Loop buffer exception = 0x00000100;
    const Exception.IERRMMX// MMA exception = 0x00004000;
    const Exception.IERRMSX// Missed stall exception = 0x00000200;
    const Exception.IERROPX// Illegal opcode exception = 0x00000010;
    const Exception.IERRPFX// Page fault exception = 0x00000001;
    const Exception.IERRPRX// Priviledge exception = 0x00000080;
    const Exception.IERRRAX// Resource access exeption = 0x00000040;
    const Exception.sizeContextBuf//  = 0x1000;
 
        obj.nrp// NMI return pointer register = Bits64  ...
        obj.ntsr// NMI/Exception task state register = Bits64  ...
        obj.ierr// Internal Exception report register = Bits64  ...
        obj.iear// Internal Exception report register = Bits64  ...
        obj.iesr// Internal Exception report register = Bits64  ...
module-wide config parameters
        msg: "E_exceptionMax: pc = 0x%08x, sp = 0x%08x."
    };
        msg: "E_exceptionMin: pc = 0x%08x, sp = 0x%08x.\nTo see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'"
    };
 
 
 
const Exception.IERRADX

Address exception

Configuration settings
const Exception.IERRADX = 0x00002000;
 
C SYNOPSIS
 
const Exception.IERRDFX

Data fetch exception

Configuration settings
const Exception.IERRDFX = 0x00000400;
 
C SYNOPSIS
 
const Exception.IERREPX

Execute packet exception

Configuration settings
const Exception.IERREPX = 0x00000008;
 
C SYNOPSIS
 
const Exception.IERREXX

Execution exception

Configuration settings
const Exception.IERREXX = 0x00001000;
 
C SYNOPSIS
 
const Exception.IERRFPX

Fetch packet exception

Configuration settings
const Exception.IERRFPX = 0x00000004;
 
C SYNOPSIS
 
const Exception.IERRIFX

Instruction fetch exception

Configuration settings
const Exception.IERRIFX = 0x00000002;
 
C SYNOPSIS
 
const Exception.IERRLBX

Loop buffer exception

Configuration settings
const Exception.IERRLBX = 0x00000100;
 
C SYNOPSIS
 
const Exception.IERRMMX

MMA exception

Configuration settings
const Exception.IERRMMX = 0x00004000;
 
C SYNOPSIS
 
const Exception.IERRMSX

Missed stall exception

Configuration settings
const Exception.IERRMSX = 0x00000200;
 
C SYNOPSIS
 
const Exception.IERROPX

Illegal opcode exception

Configuration settings
const Exception.IERROPX = 0x00000010;
 
C SYNOPSIS
 
const Exception.IERRPFX

Page fault exception

Configuration settings
const Exception.IERRPFX = 0x00000001;
 
C SYNOPSIS
 
const Exception.IERRPRX

Priviledge exception

Configuration settings
const Exception.IERRPRX = 0x00000080;
 
C SYNOPSIS
 
const Exception.IERRRAX

Resource access exeption

Configuration settings
const Exception.IERRRAX = 0x00000040;
 
C SYNOPSIS
 
const Exception.IERRRCX

Resource conflict exception

Configuration settings
const Exception.IERRRCX = 0x00000020;
 
C SYNOPSIS
 
const Exception.IERRSEX

Streaming engine exception

Configuration settings
const Exception.IERRSEX = 0x00000800;
 
C SYNOPSIS
 
const Exception.sizeContextBuf
Configuration settings
const Exception.sizeContextBuf = 0x1000;
 
C SYNOPSIS
 
struct Exception.Status

Status - structure filled by getLastStatus()

Configuration settings
var obj = new Exception.Status;
 
    obj.nrp = Bits64  ...
    // NMI return pointer register
    obj.ntsr = Bits64  ...
    // NMI/Exception task state register
    obj.ierr = Bits64  ...
    // Internal Exception report register
    obj.iear = Bits64  ...
    // Internal Exception report register
    obj.iesr = Bits64  ...
    // Internal Exception report register
    obj.excContext = Exception.Context*  ...
    // Context structure filled by last exception
 
C SYNOPSIS
 
config Exception.E_exceptionMax  // module-wide

Error raised when Exception.enablePrint is true

Configuration settings
Exception.E_exceptionMax = Error.Desc {
    msg: "E_exceptionMax: pc = 0x%08x, sp = 0x%08x."
};
 
C SYNOPSIS
 
config Exception.E_exceptionMin  // module-wide

Error raised when Exception.enablePrint is false

Configuration settings
Exception.E_exceptionMin = Error.Desc {
    msg: "E_exceptionMin: pc = 0x%08x, sp = 0x%08x.\nTo see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'"
};
 
C SYNOPSIS
 
config Exception.enablePrint  // module-wide

enablePrint - Enable print of exception details and Register values

Configuration settings
Exception.enablePrint = Bool true;
 
C SYNOPSIS
 
config Exception.exceptionHook  // module-wide

exceptionHook - Function hook called by handler This is called anytime an exception occurs

Configuration settings
Exception.exceptionHook = Void(*)(Void) null;
 
C SYNOPSIS
 
config Exception.internalHook  // module-wide

internalHook - Function hook called by internalHandler Function is only called when an internal exception has occurred

Configuration settings
Exception.internalHook = Void(*)(Void) null;
 
C SYNOPSIS
 
config Exception.returnHook  // module-wide

returnHook - Function hook called at the end of Exception_dispatch

Configuration settings
Exception.returnHook = Void(*)(Void) null;
 
C SYNOPSIS
 
config Exception.useInternalBuffer  // module-wide

If true, the exception context is saved to an internal buffer. If false, the exception context is saved to the bottom of the isr stack and no memory for the internal buffer is allocated

Configuration settings
Exception.useInternalBuffer = Bool false;
 
C SYNOPSIS
 
metaonly config Exception.common$  // module-wide

Common module configuration parameters

Configuration settings
Exception.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
generated on Sat, 19 Sep 2020 02:06:18 GMT