1 /* 2 * Copyright (c) 2010 Broadcom Corporation 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef _hndrte_armtrap_h 18 #define _hndrte_armtrap_h 19 20 /* ARM trap handling */ 21 22 /* Trap types defined by ARM (see arminc.h) */ 23 24 /* Trap locations in lo memory */ 25 #define TRAP_STRIDE 4 26 #define FIRST_TRAP TR_RST 27 #define LAST_TRAP (TR_FIQ * TRAP_STRIDE) 28 29 #if defined(__ARM_ARCH_4T__) 30 #define MAX_TRAP_TYPE (TR_FIQ + 1) 31 #elif defined(__ARM_ARCH_7M__) 32 #define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS) 33 #endif /* __ARM_ARCH_7M__ */ 34 35 /* The trap structure is defined here as offsets for assembly */ 36 #define TR_TYPE 0x00 37 #define TR_EPC 0x04 38 #define TR_CPSR 0x08 39 #define TR_SPSR 0x0c 40 #define TR_REGS 0x10 41 #define TR_REG(n) (TR_REGS + (n) * 4) 42 #define TR_SP TR_REG(13) 43 #define TR_LR TR_REG(14) 44 #define TR_PC TR_REG(15) 45 46 #define TRAP_T_SIZE 80 47 48 #ifndef _LANGUAGE_ASSEMBLY 49 50 typedef struct _trap_struct { 51 u32 type; 52 u32 epc; 53 u32 cpsr; 54 u32 spsr; 55 u32 r0; 56 u32 r1; 57 u32 r2; 58 u32 r3; 59 u32 r4; 60 u32 r5; 61 u32 r6; 62 u32 r7; 63 u32 r8; 64 u32 r9; 65 u32 r10; 66 u32 r11; 67 u32 r12; 68 u32 r13; 69 u32 r14; 70 u32 pc; 71 } trap_t; 72 73 #endif /* !_LANGUAGE_ASSEMBLY */ 74 75 #endif /* _hndrte_armtrap_h */ 76