2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
2016-08-06 21:33:41 +02:00
|
|
|
* arch/renesas/include/m16c/irq.h
|
2009-02-07 16:16:55 +01:00
|
|
|
*
|
2021-03-28 17:04:28 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2009-02-07 16:16:55 +01:00
|
|
|
*
|
2021-03-28 17:04:28 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2009-02-07 16:16:55 +01:00
|
|
|
*
|
2021-03-28 17:04:28 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2009-02-07 16:16:55 +01:00
|
|
|
*
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2020-04-05 23:00:04 +02:00
|
|
|
/* This file should never be included directly but, rather,
|
2009-02-07 16:16:55 +01:00
|
|
|
* only indirectly through nuttx/irq.h
|
|
|
|
*/
|
|
|
|
|
2016-08-06 21:33:41 +02:00
|
|
|
#ifndef __ARCH_RENESAS_INCLUDE_M16C_IRQ_H
|
|
|
|
#define __ARCH_RENESAS_INCLUDE_M16C_IRQ_H
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
2009-02-07 16:16:55 +01:00
|
|
|
* Included Files
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2009-12-17 23:39:59 +01:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
2015-04-08 16:04:12 +02:00
|
|
|
* Pre-processor Definitions
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/* IRQ numbers **************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2009-02-08 21:30:10 +01:00
|
|
|
/* Fixed vector table */
|
|
|
|
|
|
|
|
#define M16C_UNDEFINST_IRQ 0 /* fffdc: Undefined instruction */
|
|
|
|
#define M16C_OVERFLOW_IRQ 1 /* fffe0: Overflow */
|
|
|
|
#define M16C_BRK_IRQ 2 /* fffe4: BRK instruction */
|
|
|
|
#define M16C_ADDRMATCH_IRQ 3 /* fffe8: Address match */
|
|
|
|
#ifdef CONFIG_M16C_DEBUGGER
|
|
|
|
# define M16C_SSTEP_IRQ 4 /* fffec: Single step */
|
|
|
|
# define M16C_WDOG_IRQ 5 /* ffff0: Watchdog timer */
|
|
|
|
# define M16C_DBC_IRQ 6 /* ffff4: DBC */
|
|
|
|
# define M16C_NMI_IRQ 7 /* ffff8: NMI */
|
2009-02-14 23:10:30 +01:00
|
|
|
# define _LAST_FIXED 7
|
2009-02-08 21:30:10 +01:00
|
|
|
#else
|
|
|
|
# define M16C_WDOG_IRQ 4 /* ffff0: Watchdog timer */
|
|
|
|
# define M16C_NMI_IRQ 5 /* ffff8: NMI */
|
2009-02-14 23:10:30 +01:00
|
|
|
# define _LAST_FIXED 5
|
2009-02-08 21:30:10 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Variable vector table (fixed at address 0xffd00) */
|
|
|
|
|
|
|
|
#ifdef CONFIG_M16C_SWINTS
|
|
|
|
# define M16C_BRK_IRQ (_LAST_FIXED+1) /* ffd00: BRK instruction */
|
|
|
|
# define M16C_SWINT0_IRQ M16C_BRK_IRQ /* S/W interrupt 0 */
|
|
|
|
# define M16C_INT3_IRQ (_LAST_FIXED+2) /* ffd10: INT3 */
|
|
|
|
# define M16C_SWINT4_IRQ M16C_INT3_IRQ /* S/W interrupt 4 */
|
2009-02-14 23:10:30 +01:00
|
|
|
# define M16C_CTXSV_SWINT (_LAST_FIXED+3) /* ffd14: Reserved -- used by NuttX */
|
|
|
|
# define M16C_SWINT5_IRQ M16C_CTXSV_SWINT /* S/W interrupt 5 */
|
2009-02-08 21:30:10 +01:00
|
|
|
# define M16C_SWINT6_IRQ (_LAST_FIXED+4) /* ffd18: Reserved / S/W interrupt 6 */
|
|
|
|
# define M16C_SWINT7_IRQ (_LAST_FIXED+5) /* ffd1c: Reserved / S/W interrupt 7 */
|
|
|
|
# define M16C_INT5_IRQ (_LAST_FIXED+6) /* ffd20: INT5 */
|
|
|
|
# define M16C_SWINT8_IRQ M16C_INT5_IRQ /* S/W interrupt 8 */
|
|
|
|
# define M16C_INT4_IRQ (_LAST_FIXED+7) /* ffd24: INT4 */
|
|
|
|
# define M16C_SWINT9_IRQ M16C_INT4_IRQ /* S/W interrupt 9 */
|
|
|
|
# define M16C_UART2BCD_IRQ (_LAST_FIXED+8) /* ffd28: UART2 bus collision detection */
|
|
|
|
# define M16C_SWINT10_IRQ M16C_UART2BCD_IRQ /* S/W interrupt 10 */
|
|
|
|
# define M16C_DMA0_IRQ (_LAST_FIXED+9) /* ffd2c: DMA0 */
|
|
|
|
# define M16C_SWINT11_IRQ M16C_DMA0_IRQ /* S/W interrupt 11 */
|
|
|
|
# define M16C_DMA1_IRQ (_LAST_FIXED+10) /* ffd30: DMA1 */
|
|
|
|
# define M16C_SWINT12_IRQ M16C_DMA1_IRQ /* S/W interrupt 12 */
|
|
|
|
# define M16C_KEYINP_IRQ (_LAST_FIXED+11) /* ffd34: Key input interrupt */
|
|
|
|
# define M16C_SWINT13_IRQ M16C_KEYINP_IRQ /* S/W interrupt 13 */
|
|
|
|
# define M16C_ADC_IRQ (_LAST_FIXED+12) /* ffd38: A-D */
|
|
|
|
# define M16C_SWINT14_IRQ M16C_ADC_IRQ /* S/W interrupt 14 */
|
|
|
|
# define M16C_UARTXNAK_IRQ (_LAST_FIXED+13) /* ffd3c UART2 transmit/NACK2 */
|
|
|
|
# define M16C_SWINT15_IRQ M16C_UARTNAK_IRQ /* S/W interrupt 15 */
|
|
|
|
# define M16C_UARTRACK_IRQ (_LAST_FIXED+14) /* ffd40: UART2 receive/ACK2 */
|
|
|
|
# define M16C_SWINT16_IRQ M16C_UARTRACK_IRQ /* S/W interrupt 16 */
|
|
|
|
# define M16C_UART0XMT_IRQ (_LAST_FIXED+15) /* ffd44: UART0 transmit */
|
|
|
|
# define M16C_SWINT17_IRQ M16C_UART0XMT_IRQ /* S/W interrupt 17 */
|
|
|
|
# define M16C_UART0RCV_IRQ (_LAST_FIXED+16) /* ffd48: UART0 receive */
|
|
|
|
# define M16C_SWINT18_IRQ M16C_UART0RCV_IRQ /* S/W interrupt 18 */
|
|
|
|
# define M16C_UART1XMT_IRQ (_LAST_FIXED+17) /* ffd4c: UART1 transmit */
|
|
|
|
# define M16C_SWINT19_IRQ M16C_UART1XMT_IRQ /* S/W interrupt 19 */
|
|
|
|
# define M16C_UART1RCV_IRQ (_LAST_FIXED+18) /* ffd50: UART1 receive */
|
|
|
|
# define M16C_SWINT20_IRQ M16C_UART1RCV_IRQ /* S/W interrupt 20 */
|
|
|
|
# define M16C_TMRA0_IRQ (_LAST_FIXED+19) /* ffd54: Timer A0 */
|
|
|
|
# define M16C_SWINT21_IRQ M16C_TMRA0_IRQ /* S/W interrupt 21 */
|
|
|
|
# define M16C_TMRA1_IRQ (_LAST_FIXED+20) /* ffd58: Timer A1 */
|
|
|
|
# define M16C_SWINT22_IRQ M16C_TMRA1_IRQ /* S/W interrupt 22 */
|
|
|
|
# define M16C_TMRA2_IRQ (_LAST_FIXED+21) /* ffd5c: Timer A2 */
|
|
|
|
# define M16C_SWINT23_IRQ M16C_TMRA2_IRQ /* S/W interrupt 23 */
|
|
|
|
# define M16C_TMRA3_IRQ (_LAST_FIXED+22) /* ffd60: Timer A3 */
|
|
|
|
# define M16C_SWINT24_IRQ M16C_TMRA3_IRQ /* S/W interrupt 24 */
|
|
|
|
# define M16C_TMRA4_IRQ (_LAST_FIXED+23) /* ffd64: Timer A4 */
|
|
|
|
# define M16C_SWINT25_IRQ M16C_TMRA4_IRQ /* S/W interrupt 25 */
|
|
|
|
# define M16C_TMRB0_IRQ (_LAST_FIXED+24) /* ffd68: Timer B0 */
|
|
|
|
# define M16C_SWINT26_IRQ M16C_TMRB0_IRQ /* S/W interrupt 26 */
|
|
|
|
# define M16C_TMRB1_IRQ (_LAST_FIXED+25) /* ffd6c: Timer B1 */
|
|
|
|
# define M16C_SWINT27_IRQ M16C_TMRB1_IRQ /* S/W interrupt 27 */
|
|
|
|
# define M16C_TMRB2_IRQ (_LAST_FIXED+26) /* ffd70: Timer B2 */
|
|
|
|
# define M16C_SWINT28_IRQ M16C_TMRB2_IRQ /* S/W interrupt 28 */
|
|
|
|
# define M16C_INT0_IRQ (_LAST_FIXED+27) /* ffd74: INT0 */
|
|
|
|
# define M16C_SWINT29_IRQ M16C_INT0_IRQ /* S/W interrupt 29 */
|
|
|
|
# define M16C_INT1_IRQ (_LAST_FIXED+28) /* ffd78: INT1 */
|
|
|
|
# define M16C_SWINT30_IRQ M16C_INT1_IRQ /* S/W interrupt 30 */
|
|
|
|
# define M16C_SWINT31_IRQ (_LAST_FIXED+29) /* ffd7c: Reserved / S/W interrupt 31 */
|
2009-02-14 23:10:30 +01:00
|
|
|
# define M16C_CTXRSTR_SWINT (_LAST_FIXED+30) /* ffd80: Used by NuttX */
|
|
|
|
# define M16C_SWINT32IRQ M16C_CTXRSTR_SWINT /* S/W interrupt 32 */
|
2009-02-08 21:30:10 +01:00
|
|
|
# define M16C_SWINT33_IRQ (_LAST_FIXED+31) /* ffd84: S/W interrupt 33 */
|
|
|
|
# define M16C_SWINT34_IRQ (_LAST_FIXED+32) /* ffd88: S/W interrupt 34 */
|
|
|
|
# define M16C_SWINT35_IRQ (_LAST_FIXED+33) /* ffd8c: S/W interrupt 35 */
|
|
|
|
# define M16C_SWINT36_IRQ (_LAST_FIXED+34) /* ffd90: S/W interrupt 36 */
|
|
|
|
# define M16C_SWINT37_IRQ (_LAST_FIXED+35) /* ffd94: S/W interrupt 37 */
|
|
|
|
# define M16C_SWINT38_IRQ (_LAST_FIXED+36) /* ffd98: S/W interrupt 38 */
|
|
|
|
# define M16C_SWINT39_IRQ (_LAST_FIXED+37) /* ffd9c: S/W interrupt 39 */
|
|
|
|
# define M16C_SWINT40_IRQ (_LAST_FIXED+38) /* ffda0: S/W interrupt 40 */
|
|
|
|
# define M16C_SWINT41_IRQ (_LAST_FIXED+39) /* ffda4: S/W interrupt 41 */
|
|
|
|
# define M16C_SWINT42_IRQ (_LAST_FIXED+40) /* ffda8: S/W interrupt 42 */
|
|
|
|
# define M16C_SWINT43_IRQ (_LAST_FIXED+41) /* ffdac: S/W interrupt 43 */
|
|
|
|
# define M16C_SWINT44_IRQ (_LAST_FIXED+42) /* ffdb0: S/W interrupt 44 */
|
|
|
|
# define M16C_SWINT45_IRQ (_LAST_FIXED+43) /* ffdb4: S/W interrupt 45 */
|
|
|
|
# define M16C_SWINT46_IRQ (_LAST_FIXED+44) /* ffdb8: S/W interrupt 46 */
|
|
|
|
# define M16C_SWINT47_IRQ (_LAST_FIXED+45) /* ffdbc: S/W interrupt 47 */
|
|
|
|
# define M16C_SWINT48_IRQ (_LAST_FIXED+46) /* ffdc0: S/W interrupt 48 */
|
|
|
|
# define M16C_SWINT49_IRQ (_LAST_FIXED+47) /* ffdc4: S/W interrupt 49 */
|
|
|
|
# define M16C_SWINT50_IRQ (_LAST_FIXED+48) /* ffdc8: S/W interrupt 50 */
|
|
|
|
# define M16C_SWINT51_IRQ (_LAST_FIXED+49) /* ffdcc: S/W interrupt 51 */
|
|
|
|
# define M16C_SWINT52_IRQ (_LAST_FIXED+50) /* ffdd0: S/W interrupt 52 */
|
|
|
|
# define M16C_SWINT53_IRQ (_LAST_FIXED+51) /* ffdd4: S/W interrupt 53 */
|
|
|
|
# define M16C_SWINT54_IRQ (_LAST_FIXED+52) /* ffdd8: S/W interrupt 54 */
|
|
|
|
# define M16C_SWINT55_IRQ (_LAST_FIXED+53) /* ffddc: S/W interrupt 55 */
|
|
|
|
# define M16C_SWINT56_IRQ (_LAST_FIXED+54) /* ffde0: S/W interrupt 56 */
|
|
|
|
# define M16C_SWINT57_IRQ (_LAST_FIXED+55) /* ffde4: S/W interrupt 57 */
|
|
|
|
# define M16C_SWINT58_IRQ (_LAST_FIXED+56) /* ffde8: S/W interrupt 58 */
|
|
|
|
# define M16C_SWINT59_IRQ (_LAST_FIXED+57) /* ffdec: S/W interrupt 59 */
|
|
|
|
# define M16C_SWINT60_IRQ (_LAST_FIXED+58) /* ffdf0: S/W interrupt 60 */
|
|
|
|
# define M16C_SWINT61_IRQ (_LAST_FIXED+59) /* ffdf4: S/W interrupt 61 */
|
|
|
|
# define M16C_SWINT62_IRQ (_LAST_FIXED+60) /* ffdf8: S/W interrupt 62 */
|
|
|
|
# define M16C_SWINT63_IRQ (_LAST_FIXED+61) /* ffdfc: S/W interrupt 63 */
|
|
|
|
|
|
|
|
# define NR_IRQS (_LAST_FIXED+62) /* Total number of supported IRQs */
|
|
|
|
#else
|
|
|
|
# define M16C_BRK_IRQ (_LAST_FIXED+1) /* ffd00: BRK instruction */
|
|
|
|
# define M16C_INT3_IRQ (_LAST_FIXED+2) /* ffd10: INT3 */
|
2009-02-14 23:10:30 +01:00
|
|
|
# define M16C_CTXSV_SWINT (_LAST_FIXED+3) /* ffd14: Reserved -- SWINT5 used by NuttX */
|
|
|
|
# define M16C_INT5_IRQ (_LAST_FIXED+5) /* ffd20: INT5 */
|
|
|
|
# define M16C_INT4_IRQ (_LAST_FIXED+6) /* ffd24: INT4 */
|
|
|
|
# define M16C_UART2BCD_IRQ (_LAST_FIXED+7) /* ffd28: UART2 bus collision detection */
|
|
|
|
# define M16C_DMA0_IRQ (_LAST_FIXED+8) /* ffd2c: DMA0 */
|
|
|
|
# define M16C_DMA1_IRQ (_LAST_FIXED+9) /* ffd30: DMA1 */
|
|
|
|
# define M16C_KEYINP_IRQ (_LAST_FIXED+10) /* ffd34: Key input interrupt */
|
|
|
|
# define M16C_ADC_IRQ (_LAST_FIXED+11) /* ffd38: A-D */
|
|
|
|
# define M16C_UARTXNAK_IRQ (_LAST_FIXED+12) /* ffd3c UART2 transmit/NACK2 */
|
|
|
|
# define M16C_UARTRACK_IRQ (_LAST_FIXED+13) /* ffd40: UART2 receive/ACK2 */
|
|
|
|
# define M16C_UART0XMT_IRQ (_LAST_FIXED+14) /* ffd44: UART0 transmit */
|
|
|
|
# define M16C_UART0RCV_IRQ (_LAST_FIXED+15) /* ffd48: UART0 receive */
|
|
|
|
# define M16C_UART1XMT_IRQ (_LAST_FIXED+16) /* ffd4c: UART1 transmit */
|
|
|
|
# define M16C_UART1RCV_IRQ (_LAST_FIXED+17) /* ffd50: UART1 receive */
|
|
|
|
# define M16C_TMRA0_IRQ (_LAST_FIXED+18) /* ffd54: Timer A0 */
|
|
|
|
# define M16C_TMRA1_IRQ (_LAST_FIXED+19) /* ffd58: Timer A1 */
|
|
|
|
# define M16C_TMRA2_IRQ (_LAST_FIXED+20) /* ffd5c: Timer A2 */
|
|
|
|
# define M16C_TMRA3_IRQ (_LAST_FIXED+21) /* ffd60: Timer A3 */
|
|
|
|
# define M16C_TMRA4_IRQ (_LAST_FIXED+22) /* ffd64: Timer A4 */
|
|
|
|
# define M16C_TMRB0_IRQ (_LAST_FIXED+23) /* ffd68: Timer B0 */
|
|
|
|
# define M16C_TMRB1_IRQ (_LAST_FIXED+24) /* ffd6c: Timer B1 */
|
|
|
|
# define M16C_TMRB2_IRQ (_LAST_FIXED+25) /* ffd70: Timer B2 */
|
|
|
|
# define M16C_INT0_IRQ (_LAST_FIXED+26) /* ffd74: INT0 */
|
|
|
|
# define M16C_INT1_IRQ (_LAST_FIXED+27) /* ffd78: INT1 */
|
|
|
|
# define M16C_CTXRSTR_SWINT (_LAST_FIXED+4) /* ffd80: S/W interrupt 32, used by NuttX */
|
2009-02-08 21:30:10 +01:00
|
|
|
|
2009-02-14 23:10:30 +01:00
|
|
|
# define NR_IRQS (_LAST_FIXED+28) /* Total number of supported IRQs */
|
2009-02-08 21:30:10 +01:00
|
|
|
#endif
|
|
|
|
|
2009-02-15 19:29:40 +01:00
|
|
|
/* Timer A0 is the system timer used by NuttX */
|
|
|
|
|
2009-02-08 21:30:10 +01:00
|
|
|
#define M16C_SYSTIMER_IRQ M16C_TMRA0_IRQ
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2009-02-14 02:08:39 +01:00
|
|
|
/* IRQ Stack Frame Format. The M16C has a push down stack. The CPU performs
|
|
|
|
* the following actions when an interrupt is taken:
|
|
|
|
*
|
2009-02-14 23:10:30 +01:00
|
|
|
* - Save FLG register
|
2009-02-14 02:08:39 +01:00
|
|
|
* - Clear I, D, and U flags in FLG register
|
|
|
|
* - Builds stack frame like:
|
2014-04-14 00:22:22 +02:00
|
|
|
*
|
2009-02-14 02:08:39 +01:00
|
|
|
* sp -> PC bits 0-7
|
|
|
|
* sp+1 -> PC bits 8-15
|
|
|
|
* sp+2 -> FLG bits 0-7
|
|
|
|
* sp+3 -> FLG (Bits 12-14) + PC (bits 16-19)
|
|
|
|
*
|
|
|
|
* - Sets IPL
|
|
|
|
* - Vectors to interrupt handler
|
2009-02-07 16:16:55 +01:00
|
|
|
*/
|
|
|
|
|
2009-02-14 23:10:30 +01:00
|
|
|
#define REG_FLGPCHI 0 /* 8-bit FLG (bits 12-14) + PC (bits 16-19) as would be
|
2009-02-14 02:08:39 +01:00
|
|
|
* presented by an interrupt */
|
2009-02-14 23:10:30 +01:00
|
|
|
#define REG_FLG 1 /* 8-bit FLG register (bits 0-7) */
|
2009-02-15 02:43:01 +01:00
|
|
|
#define REG_PC 2 /* 16-bit PC [0]:bits8-15 [1]:bits 0-7 */
|
2009-02-14 23:10:30 +01:00
|
|
|
#define REG_FB 4 /* 16-bit FB register */
|
|
|
|
#define REG_SB 6 /* 16-bit SB register */
|
|
|
|
#define REG_A1 8 /* 16-bit A1 register */
|
2009-02-15 02:43:01 +01:00
|
|
|
#define REG_A0 10 /* 16-bit A0 register */
|
|
|
|
#define REG_R3 12 /* 16-bit R3 register */
|
|
|
|
#define REG_R2 14 /* 16-bit R2 register */
|
|
|
|
#define REG_R1 16 /* 16-bit R1 register */
|
|
|
|
#define REG_R0 18 /* 16-bit R0 register */
|
|
|
|
#define REG_SP 20 /* 16-bit user stack pointer */
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2009-02-15 02:43:01 +01:00
|
|
|
#define XCPTCONTEXT_SIZE 22
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
2009-02-07 16:16:55 +01:00
|
|
|
* Public Types
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2021-03-30 13:10:19 +02:00
|
|
|
|
2009-02-14 02:08:39 +01:00
|
|
|
/* This struct defines the way the registers are stored. We need to save: */
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
struct xcptcontext
|
|
|
|
{
|
|
|
|
/* The following function pointer is non-zero if there are pending signals
|
|
|
|
* to be processed.
|
|
|
|
*/
|
|
|
|
|
2009-02-14 23:10:30 +01:00
|
|
|
void *sigdeliver; /* Actual type is sig_deliver_t */
|
2009-02-14 02:08:39 +01:00
|
|
|
|
2019-02-04 15:35:03 +01:00
|
|
|
/* These are saved copies of LR and SR used during signal processing.
|
|
|
|
*
|
|
|
|
* REVISIT: Because there is only one copy of these save areas,
|
|
|
|
* only a single signal handler can be active. This precludes
|
|
|
|
* queuing of signal actions. As a result, signals received while
|
|
|
|
* another signal handler is executing will be ignored!
|
|
|
|
*/
|
2009-02-14 02:08:39 +01:00
|
|
|
|
2009-12-16 17:05:08 +01:00
|
|
|
uint8_t saved_pc[2];
|
|
|
|
uint8_t saved_flg;
|
2009-02-14 02:08:39 +01:00
|
|
|
|
|
|
|
/* Register save area */
|
|
|
|
|
2009-12-16 17:05:08 +01:00
|
|
|
uint8_t regs[XCPTCONTEXT_SIZE];
|
2009-02-14 02:08:39 +01:00
|
|
|
};
|
|
|
|
#endif
|
2009-02-07 16:16:55 +01:00
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Inline functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Return the current value of the stack pointer */
|
|
|
|
|
|
|
|
static inline uint16_t up_getsp(void)
|
|
|
|
{
|
|
|
|
uint16_t sp;
|
|
|
|
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"\tstc sp, %0\n\t"
|
|
|
|
: "=r" (sp)
|
|
|
|
:
|
|
|
|
: "memory"
|
|
|
|
);
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2009-02-07 16:16:55 +01:00
|
|
|
* Public Data
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2015-06-13 03:26:01 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2009-02-07 16:16:55 +01:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
2009-02-07 16:16:55 +01:00
|
|
|
* Inline Functions
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
2009-02-09 01:11:22 +01:00
|
|
|
|
2016-02-14 23:11:25 +01:00
|
|
|
/* Name: up_irq_save, up_irq_restore, and friends.
|
|
|
|
*
|
|
|
|
* NOTE: This function should never be called from application code and,
|
|
|
|
* as a general rule unless you really know what you are doing, this
|
|
|
|
* function should not be called directly from operation system code either:
|
|
|
|
* Typically, the wrapper functions, enter_critical_section() and
|
|
|
|
* leave_critical section(), are probably what you really want.
|
|
|
|
*/
|
|
|
|
|
2018-06-06 17:25:40 +02:00
|
|
|
/* Return the current interrupt enable state and disable IRQs */
|
2009-02-09 01:11:22 +01:00
|
|
|
|
2016-02-14 23:11:25 +01:00
|
|
|
static inline irqstate_t up_irq_save(void)
|
2009-02-09 01:11:22 +01:00
|
|
|
{
|
|
|
|
irqstate_t flags;
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2018-06-06 17:25:40 +02:00
|
|
|
"\tstc flg, %0\n"
|
|
|
|
"\tfclr I\n"
|
2009-02-09 01:11:22 +01:00
|
|
|
: "=r" (flags)
|
|
|
|
:
|
|
|
|
: "memory");
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
2018-06-06 17:25:40 +02:00
|
|
|
/* Restore saved IRQ state */
|
2009-02-09 01:11:22 +01:00
|
|
|
|
2016-02-14 23:11:25 +01:00
|
|
|
static inline void up_irq_restore(irqstate_t flags)
|
2009-02-09 01:11:22 +01:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
2018-06-06 17:25:40 +02:00
|
|
|
"ldc %0, flg"
|
2009-02-09 01:11:22 +01:00
|
|
|
:
|
|
|
|
: "r" (flags)
|
|
|
|
: "memory");
|
|
|
|
}
|
|
|
|
|
2018-06-06 17:25:40 +02:00
|
|
|
/* Return the current interrupt enable state and enable IRQs */
|
|
|
|
|
|
|
|
static inline irqstate_t up_irq_enable(void)
|
|
|
|
{
|
|
|
|
irqstate_t flags;
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"\tstc flg, %0\n"
|
|
|
|
"\tfset I\n"
|
|
|
|
: "=r" (flags)
|
|
|
|
:
|
|
|
|
: "memory");
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
2009-02-07 16:16:55 +01:00
|
|
|
#endif
|
|
|
|
|
2022-06-29 21:47:43 +02:00
|
|
|
/****************************************************************************
|
2021-03-30 13:10:19 +02:00
|
|
|
* Public Functions Prototypes
|
2022-06-29 21:47:43 +02:00
|
|
|
****************************************************************************/
|
2009-02-07 16:16:55 +01:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2016-08-06 21:33:41 +02:00
|
|
|
#endif /* __ARCH_RENESAS_INCLUDE_M16C_IRQ_H */
|