module ti.sysbios.family.c64p.Exception

Exception Module

The Exception module is a basic C64+ 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/c64p/Exception.xdc
#include <ti/sysbios/family/c64p/Exception.h>
Functions
Void 
Void 
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
#define
#define
#define
#define
#define
#define
#define
#define
#define
Typedefs
typedef Void 
typedef struct
Constants
extern const Bool 
extern const Bool 
extern const Exception_FuncPtr 
extern const Exception_FuncPtr 
extern const Error_Id 
extern const Error_Id 
extern const Exception_FuncPtr 
extern const Exception_FuncPtr 
extern const Exception_FuncPtr 
extern const Bool 
 
DETAILS
The Exception module is a basic C64+ exception handler. It is generally considered to be a program endpoint, since an exception usually indicates something fatal to the system.
During initialization, the Exception module sets TSR.GEE and TSR.XEN to enable the CPU to recognize the EXECP input.
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 occurs. (3) externalHook - called only when an external exception occurs. (4) nmiHook - called only when a legacy NMI occurs. (5) returnHook - called whenever an exception occurs.

Calling Context

Function Hwi Swi Task Main Startup
clearLastStatus Y Y Y Y Y
evtEvtClear Y Y Y Y Y
evtExpMaskEnable 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_ECREXF

EXCEP flag

C synopsis target-domain
#define Exception_ECREXF (Bits32)Exception.EFREXF
 
 
const Exception_ECRIXF

Internal exception flag

C synopsis target-domain
#define Exception_ECRIXF (Bits32)Exception.EFRIXF
 
 
const Exception_ECRNXF

NMI exception flag

C synopsis target-domain
#define Exception_ECRNXF (Bits32)Exception.EFRNXF
 
 
const Exception_ECRSXF

Software exception flag

C synopsis target-domain
#define Exception_ECRSXF (Bits32)Exception.EFRSXF
 
 
const Exception_EFREXF

EXCEP flag

C synopsis target-domain
#define Exception_EFREXF (Bits32)0x40000000
 
 
const Exception_EFRIXF

Internal exception flag

C synopsis target-domain
#define Exception_EFRIXF (Bits32)0x00000002
 
 
const Exception_EFRNXF

NMI exception flag

C synopsis target-domain
#define Exception_EFRNXF (Bits32)0x80000000
 
 
const Exception_EFRSXF

Software exception flag

C synopsis target-domain
#define Exception_EFRSXF (Bits32)0x00000001
 
 
const Exception_IERREPX

Execute packet exception

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

Fetch packet exception

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

Instruction fetch exception

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

Loop buffer exception

C synopsis target-domain
#define Exception_IERRLBX (Bits32)0x00000080
 
 
const Exception_IERRMSX

Missed stall exception

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

Opcode exception

C synopsis target-domain
#define Exception_IERROPX (Bits32)0x00000008
 
 
const Exception_IERRPRX

Priviledge exception

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

Resource access exeption

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

Resource conflict exception

C synopsis target-domain
#define Exception_IERRRCX (Bits32)0x00000010
 
 
const Exception_TSRCXM

Current execution mode bits

C synopsis target-domain
#define Exception_TSRCXM (Bits32)0x000000C0
 
 
const Exception_TSRCXMSHIFT

TSR.CXM left shift value

C synopsis target-domain
#define Exception_TSRCXMSHIFT (Bits32)6
 
 
const Exception_TSRCXMSV

Supervisor mode

C synopsis target-domain
#define Exception_TSRCXMSV (Bits32)0x00000000
 
 
const Exception_TSRCXMUS

User mode

C synopsis target-domain
#define Exception_TSRCXMUS (Bits32)0x00000040
 
 
const Exception_TSREXC

Exception processing

C synopsis target-domain
#define Exception_TSREXC (Bits32)0x00000400
 
 
const Exception_TSRGEE

Global exception enable

C synopsis target-domain
#define Exception_TSRGEE (Bits32)0x00000004
 
 
const Exception_TSRXEN

External exception enable

C synopsis target-domain
#define Exception_TSRXEN (Bits32)0x00000008
 
 
const Exception_sizeContextBuf
C synopsis target-domain
#define Exception_sizeContextBuf (UInt32)320
 
 
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 {
    Bits32 efr;
    // Exception flag register
    Bits32 nrp;
    // NMI return pointer register
    Bits32 ntsr;
    // NMI/Exception task state register
    Bits32 ierr;
    // 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_enableExternalMPC  // module-wide

enableExternalMPC - Enable handling of Memory Protection Controller (MPC) exceptions

C synopsis target-domain
extern const Bool Exception_enableExternalMPC;
 
 
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_externalHook  // module-wide

externalHook - Function hook called by externalHandler Function is only called when an external exception has occurred

C synopsis target-domain
extern const Exception_FuncPtr Exception_externalHook;
 
 
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_nmiHook  // module-wide

nmiHook - Function hook called by nmiHandler Function is called for legacy NMI exceptions only

C synopsis target-domain
extern const Exception_FuncPtr Exception_nmiHook;
 
 
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_evtEvtClear()  // module-wide

evtEvtClear - Clear a C64+ event from the EVTFLAG register

C synopsis target-domain
Void Exception_evtEvtClear(UInt event);
 
 
Exception_evtExpMaskEnable()  // module-wide

evtExpMaskEnable - Enable a C64+ event to generate an exception

C synopsis target-domain
Void Exception_evtExpMaskEnable(UInt event);
 
 
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/c64p/Exception.xdc
var Exception = xdc.useModule('ti.sysbios.family.c64p.Exception');
module-wide constants & types
    const Exception.EFREXF// EXCEP flag = 0x40000000;
    const Exception.EFRIXF// Internal exception flag = 0x00000002;
    const Exception.EFRNXF// NMI exception flag = 0x80000000;
    const Exception.EFRSXF// Software exception flag = 0x00000001;
    const Exception.IERREPX// Execute packet exception = 0x00000004;
    const Exception.IERRFPX// Fetch packet exception = 0x00000002;
    const Exception.IERRLBX// Loop buffer exception = 0x00000080;
    const Exception.IERRMSX// Missed stall exception = 0x00000100;
    const Exception.IERROPX// Opcode exception = 0x00000008;
    const Exception.IERRPRX// Priviledge exception = 0x00000040;
    const Exception.IERRRAX// Resource access exeption = 0x00000020;
    const Exception.TSRCXMSV// Supervisor mode = 0x00000000;
    const Exception.TSRCXMUS// User mode = 0x00000040;
    const Exception.TSREXC// Exception processing = 0x00000400;
    const Exception.TSRGEE// Global exception enable = 0x00000004;
    const Exception.TSRXEN// External exception enable = 0x00000008;
    const Exception.sizeContextBuf//  = 320;
 
        obj.efr// Exception flag register = Bits32  ...
        obj.nrp// NMI return pointer register = Bits32  ...
        obj.ntsr// NMI/Exception task state register = Bits32  ...
        obj.ierr// Internal Exception report register = Bits32  ...
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.ECREXF

EXCEP flag

Configuration settings
const Exception.ECREXF = Exception.EFREXF;
 
C SYNOPSIS
 
const Exception.ECRIXF

Internal exception flag

Configuration settings
const Exception.ECRIXF = Exception.EFRIXF;
 
C SYNOPSIS
 
const Exception.ECRNXF

NMI exception flag

Configuration settings
const Exception.ECRNXF = Exception.EFRNXF;
 
C SYNOPSIS
 
const Exception.ECRSXF

Software exception flag

Configuration settings
const Exception.ECRSXF = Exception.EFRSXF;
 
C SYNOPSIS
 
const Exception.EFREXF

EXCEP flag

Configuration settings
const Exception.EFREXF = 0x40000000;
 
C SYNOPSIS
 
const Exception.EFRIXF

Internal exception flag

Configuration settings
const Exception.EFRIXF = 0x00000002;
 
C SYNOPSIS
 
const Exception.EFRNXF

NMI exception flag

Configuration settings
const Exception.EFRNXF = 0x80000000;
 
C SYNOPSIS
 
const Exception.EFRSXF

Software exception flag

Configuration settings
const Exception.EFRSXF = 0x00000001;
 
C SYNOPSIS
 
const Exception.IERREPX

Execute packet exception

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

Fetch packet exception

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

Instruction fetch exception

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

Loop buffer exception

Configuration settings
const Exception.IERRLBX = 0x00000080;
 
C SYNOPSIS
 
const Exception.IERRMSX

Missed stall exception

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

Opcode exception

Configuration settings
const Exception.IERROPX = 0x00000008;
 
C SYNOPSIS
 
const Exception.IERRPRX

Priviledge exception

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

Resource access exeption

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

Resource conflict exception

Configuration settings
const Exception.IERRRCX = 0x00000010;
 
C SYNOPSIS
 
const Exception.TSRCXM

Current execution mode bits

Configuration settings
const Exception.TSRCXM = 0x000000C0;
 
C SYNOPSIS
 
const Exception.TSRCXMSHIFT

TSR.CXM left shift value

Configuration settings
const Exception.TSRCXMSHIFT = 6;
 
C SYNOPSIS
 
const Exception.TSRCXMSV

Supervisor mode

Configuration settings
const Exception.TSRCXMSV = 0x00000000;
 
C SYNOPSIS
 
const Exception.TSRCXMUS

User mode

Configuration settings
const Exception.TSRCXMUS = 0x00000040;
 
C SYNOPSIS
 
const Exception.TSREXC

Exception processing

Configuration settings
const Exception.TSREXC = 0x00000400;
 
C SYNOPSIS
 
const Exception.TSRGEE

Global exception enable

Configuration settings
const Exception.TSRGEE = 0x00000004;
 
C SYNOPSIS
 
const Exception.TSRXEN

External exception enable

Configuration settings
const Exception.TSRXEN = 0x00000008;
 
C SYNOPSIS
 
const Exception.sizeContextBuf
Configuration settings
const Exception.sizeContextBuf = 320;
 
C SYNOPSIS
 
struct Exception.Status

Status - structure filled by getLastStatus()

Configuration settings
var obj = new Exception.Status;
 
    obj.efr = Bits32  ...
    // Exception flag register
    obj.nrp = Bits32  ...
    // NMI return pointer register
    obj.ntsr = Bits32  ...
    // NMI/Exception task state register
    obj.ierr = Bits32  ...
    // 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.enableExternalMPC  // module-wide

enableExternalMPC - Enable handling of Memory Protection Controller (MPC) exceptions

Configuration settings
Exception.enableExternalMPC = Bool false;
 
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.externalHook  // module-wide

externalHook - Function hook called by externalHandler Function is only called when an external exception has occurred

Configuration settings
Exception.externalHook = 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.nmiHook  // module-wide

nmiHook - Function hook called by nmiHandler Function is called for legacy NMI exceptions only

Configuration settings
Exception.nmiHook = 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 Tue, 09 Oct 2018 20:57:43 GMT