gonzui


Format: Advanced Search

mtkernel_3/kernel/sysdepend/cpu/core/armv7m/interrupt.cbare sourcepermlink (0.01 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    micro T-Kernel 3.00.03
    4:  *
    5:  *    Copyright (C) 2006-2021 by Ken Sakamura.
    6:  *    This software is distributed under the T-License 2.2.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by TRON Forum(http://www.tron.org) at 2021/03/31
   10:  *
   11:  *----------------------------------------------------------------------
   12:  */
   13: 
   14: #include <sys/machine.h>
   15: #ifdef CPU_CORE_ARMV7M
   16: /*
   17:  *      interrupt.c (ARMv7-M)
   18:  *      Interrupt control
   19:  */
   20: 
   21: #include "kernel.h"
   22: #include "../../../sysdepend.h"
   23: 
   24: #if !USE_STATIC_IVT
   25: /* ------------------------------------------------------------------------ */
   26: /*
   27:  * Exception handler table (RAM)
   28:  */
   29: EXPORT UW exchdr_tbl[N_SYSVEC + N_INTVEC] __attribute__ ((section (".data_vector")));
   30: 
   31: #endif
   32: 
   33: /* ------------------------------------------------------------------------ */
   34: /*
   35:  * HLL(High level programming language) Interrupt Handler
   36:  */
   37: 
   38: Noinit(LOCAL FP knl_inthdr_tbl[N_INTVEC]);      /* HLL Interrupt Handler Table */
   39: 
   40: EXPORT void knl_hll_inthdr(void)
   41: {
   42:         FP     inthdr;
   43:         UW     intno;
   44: 
   45:         ENTER_TASK_INDEPENDENT;
   46: 
   47:         intno  = knl_get_ipsr() - 16;
   48:         inthdr = knl_inthdr_tbl[intno];
   49: 
   50:         (*inthdr)(intno);
   51: 
   52:         LEAVE_TASK_INDEPENDENT;
   53: }
   54: 
   55: 
   56: /* ------------------------------------------------------------------------ */
   57: /*
   58:  * System-timer Interrupt handler
   59:  */
   60: EXPORT void knl_systim_inthdr(void)
   61: {
   62:         ENTER_TASK_INDEPENDENT;
   63: 
   64:         knl_timer_handler();
   65: 
   66:         LEAVE_TASK_INDEPENDENT;
   67: }
   68: 
   69: /* ----------------------------------------------------------------------- */
   70: /*
   71:  * Set interrupt handler (Used in tk_def_int())
   72:  */
   73: EXPORT ER knl_define_inthdr( INT intno, ATR intatr, FP inthdr )
   74: {
   75:         volatile FP    *intvet;
   76: 
   77:         if(inthdr != NULL) {
   78:                 if ( (intatr & TA_HLNG) != 0 ) {
   79:                         knl_inthdr_tbl[intno] = inthdr;
   80:                         inthdr = knl_hll_inthdr;
   81:                 }             
   82:         } else         {      /* Clear interrupt handler */
   83:                 inthdr = Default_Handler;
   84:         }
   85:         intvet = (FP*)&exchdr_tbl[N_SYSVEC];
   86:         intvet[intno] = inthdr;
   87: 
   88:         return E_OK;
   89: }
   90: 
   91: /* ----------------------------------------------------------------------- */
   92: /*
   93:  * Return interrupt handler (Used in tk_ret_int())
   94:  */
   95: EXPORT void knl_return_inthdr(void)
   96: {
   97:         /* No processing in ARM. */
   98:         return;
   99: }
  100: 
  101: /* ------------------------------------------------------------------------ */
  102: /*
  103:  * Interrupt initialize
  104:  */
  105: EXPORT ER knl_init_interrupt( void )
  106: {
  107:         /* Register exception handler used on OS */
  108: 
  109:         return E_OK;
  110: }
  111: 
  112: 
  113: 
  114: #endif  /* CPU_CORE_ARMV7M */