⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datapage.lst

📁 motorola dp256 的中断向量映射表
💻 LST
📖 第 1 页 / 共 5 页
字号:
ANSI-C/cC++ Compiler for HC12 V-5.0.30 Build 6037, Feb  7 2006

    1:  /******************************************************************************
    2:    FILE        : datapage.c
    3:    PURPOSE     : paged data access runtime routines
    4:    MACHINE     : Freescale 68HC12 (Target)
    5:    LANGUAGE    : ANSI-C
    6:    HISTORY     : 21.7.96 first version created
    7:  ******************************************************************************/
    8:  
    9:  #include "hidef.h"
   10:  
   11:  #include "non_bank.sgm"
   12:  #include "runtime.sgm"
   13:  
   14:  #ifndef __HCS12X__ /* it's different for the HCS12X. See the text below at the #else // __HCS12X__ */
   15:  
   16:  /*
   17:     According to the -Cp option of the compiler the
   18:     __DPAGE__, __PPAGE__ and __EPAGE__ macros are defined.
   19:     If none of them is given as argument, then no page accesses should occur and
   20:     this runtime routine should not be used !
   21:     To be on the save side, the runtime routines are created anyway.
   22:     If some of the -Cp options are given an adapted versions which only covers the
   23:     needed cases is produced.
   24:  */
   25:  
   26:  /* if no compiler option -Cp is given, it is assumed that all possible are given : */
   27:  
   28:  /* Compile with option -DHCS12 to activate this code */
   29:  #if defined(HCS12) || defined(_HCS12) || defined(__HCS12__) /* HCS12 family has PPAGE register only at 0x30 */
   30:  #define PPAGE_ADDR (0x30+REGISTER_BASE)
   31:  #ifndef __PPAGE__ /* may be set already by option -CPPPAGE */
   32:  #define __PPAGE__
   33:  #endif
   34:  /* Compile with option -DDG128 to activate this code */
   35:  #elif defined DG128 /* HC912DG128 derivative has PPAGE register only at 0xFF */
   36:  #define PPAGE_ADDR (0xFF+REGISTER_BASE)
   37:  #ifndef __PPAGE__ /* may be set already by option -CPPPAGE */
   38:  #define __PPAGE__
   39:  #endif
   40:  #elif defined(HC812A4)
   41:  /* all setting default to A4 already */
   42:  #endif
   43:  
   44:  
   45:  #if !defined(__EPAGE__) && !defined(__PPAGE__) && !defined(__DPAGE__)
   46:  /* as default use all page registers */
   47:  #define __DPAGE__
   48:  #define __EPAGE__
   49:  #define __PPAGE__
   50:  #endif
   51:  
   52:  /* modify the following defines to your memory configuration */
   53:  
   54:  #define EPAGE_LOW_BOUND   0x400u
   55:  #define EPAGE_HIGH_BOUND  0x7ffu
   56:  
   57:  #define DPAGE_LOW_BOUND   0x7000u
   58:  #define DPAGE_HIGH_BOUND  0x7fffu
   59:  
   60:  #define PPAGE_LOW_BOUND   (DPAGE_HIGH_BOUND+1)
   61:  #define PPAGE_HIGH_BOUND  0xBFFFu
   62:  
   63:  #define REGISTER_BASE      0x0u
   64:  #ifndef DPAGE_ADDR
   65:  #define DPAGE_ADDR        (0x34u+REGISTER_BASE)
   66:  #endif
   67:  #ifndef EPAGE_ADDR
   68:  #define EPAGE_ADDR        (0x36u+REGISTER_BASE)
   69:  #endif
   70:  #ifndef PPAGE_ADDR
   71:  #define PPAGE_ADDR        (0x35u+REGISTER_BASE)
   72:  #endif
   73:  
   74:  /*
   75:    The following parts about the defines are assumed in the code of _GET_PAGE_REG :
   76:    - the memory region controlled by DPAGE is above the area controlled by the EPAGE and
   77:      below the area controlled by the PPAGE.
   78:    - the lower bound of the PPAGE area is equal to be the higher bound of the DPAGE area + 1
   79:  */
   80:  #if EPAGE_LOW_BOUND >= EPAGE_HIGH_BOUND || EPAGE_HIGH_BOUND >= DPAGE_LOW_BOUND || DPAGE_LOW_BOUND >= DPAGE_HIGH_BOUND || DPAGE_HIGH_BOUND >= PPAGE_LOW_BOUND || PPAGE_LOW_BOUND >= PPAGE_HIGH_BOUND
   81:  #error /* please adapt _GET_PAGE_REG for this non default page configuration */
   82:  #endif
   83:  
   84:  #if DPAGE_HIGH_BOUND+1 != PPAGE_LOW_BOUND
   85:  #error /* please adapt _GET_PAGE_REG for this non default page configuration */
   86:  #endif
   87:  
   88:  
   89:  /* this module does either control if any access is in the bounds of the specified page or */
   90:  /* ,if only one page is specified, just use this page. */
   91:  /* This behavior is controlled by the define USE_SEVERAL_PAGES. */
   92:  /* If !USE_SEVERAL_PAGES does increase the performance significantly */
   93:  /* NOTE : When !USE_SEVERAL_PAGES, the page is also set for accesses outside of the area controlled */
   94:  /*        by this single page. But this is should not cause problems because the page is restored to the old value before any other access could occur */
   95:  
   96:  #if !defined(__DPAGE__) && !defined(__EPAGE__) && !defined(__PPAGE__)
   97:  /* no page at all is specified */
   98:  /* only specifying the right pages will speed up these functions a lot */
   99:  #define USE_SEVERAL_PAGES 1
  100:  #elif defined(__DPAGE__) && defined(__EPAGE__) || defined(__DPAGE__) && defined(__PPAGE__) || defined(__EPAGE__) && defined(__PPAGE__)
  101:  /* more than one page register is used */
  102:  #define USE_SEVERAL_PAGES 1
  103:  #else
  104:  
  105:  #define USE_SEVERAL_PAGES 0
  106:  
  107:  #if defined(__DPAGE__) /* check which pages are used  */
  108:  #define PAGE_ADDR PPAGE_ADDR
  109:  #elif defined(__EPAGE__)
  110:  #define PAGE_ADDR EPAGE_ADDR
  111:  #elif defined(__PPAGE__)
  112:  #define PAGE_ADDR PPAGE_ADDR
  113:  #else /* we do not know which page, decide it at runtime */
  114:  #error /* must not happen */
  115:  #endif
  116:  
  117:  #endif
  118:  
  119:  
  120:  #if USE_SEVERAL_PAGES /* only needed for several pages support */
  121:  /*--------------------------- _GET_PAGE_REG --------------------------------
  122:    Runtime routine to detect the right register depending on the 16 bit offset part
  123:    of an address.
  124:    This function is only used by the functions below.
  125:  
  126:    Depending on the compiler options -Cp different versions of _GET_PAGE_REG are produced.
  127:  
  128:    Arguments :
  129:    - Y : offset part of an address
  130:  
  131:    Result :
  132:    if address Y is controlled by a page register :
  133:    - X : address of page register if Y is controlled by an page register
  134:    - Zero flag cleared
  135:    - all other registers remain unchanged
  136:  
  137:    if address Y is not controlled by a page register :
  138:    - Zero flag is set
  139:    - all registers remain unchanged
  140:  
  141:    --------------------------- _GET_PAGE_REG ----------------------------------*/
  142:  
  143:  #if defined(__DPAGE__)
  144:  
  145:  #ifdef __cplusplus
  146:  extern "C"
  147:  #endif
  148:  #pragma NO_ENTRY
  149:  #pragma NO_EXIT
  150:  #pragma NO_FRAME
  151:  
  152:  static void NEAR _GET_PAGE_REG(void) { /*lint -esym(528, _GET_PAGE_REG) used in asm code */
  153:    __asm {
  154:  L_DPAGE:
  155:          CPY     #DPAGE_LOW_BOUND  ;// test of lower bound of DPAGE
  156:  #if defined(__EPAGE__)
  157:          BLO     L_EPAGE           ;// EPAGE accesses are possible
  158:  #else
  159:          BLO     L_NOPAGE          ;// no paged memory below accesses
  160:  #endif
  161:          CPY     #DPAGE_HIGH_BOUND ;// test of higher bound DPAGE/lower bound PPAGE
  162:  #if defined(__PPAGE__)
  163:          BHI     L_PPAGE           ;// EPAGE accesses are possible
  164:  #else
  165:          BHI     L_NOPAGE          ;// no paged memory above accesses
  166:  #endif
  167:  FOUND_DPAGE:
  168:          LDX     #DPAGE_ADDR       ;// load page register address and clear zero flag
  169:          RTS
  170:  
  171:  #if defined(__PPAGE__)
  172:  L_PPAGE:
  173:          CPY     #PPAGE_HIGH_BOUND ;// test of higher bound of PPAGE
  174:          BHI     L_NOPAGE
  175:  FOUND_PPAGE:
  176:          LDX     #PPAGE_ADDR       ;// load page register address and clear zero flag
  177:          RTS
  178:  #endif
  179:  
  180:  #if defined(__EPAGE__)
  181:  L_EPAGE:
  182:          CPY     #EPAGE_LOW_BOUND  ;// test of lower bound of EPAGE
  183:          BLO     L_NOPAGE
  184:          CPY     #EPAGE_HIGH_BOUND ;// test of higher bound of EPAGE
  185:          BHI     L_NOPAGE
  186:  
  187:  FOUND_EPAGE:
  188:          LDX     #EPAGE_ADDR       ;// load page register address and clear zero flag
  189:          RTS
  190:  #endif
  191:  
  192:  L_NOPAGE:
  193:          ORCC    #0x04             ;// sets zero flag
  194:          RTS
  195:    }
  196:  }
  197:  
  198:  #else /* !defined(__DPAGE__) */
  199:  
  200:  #if defined( __PPAGE__ )
  201:  
  202:  #ifdef __cplusplus
  203:  extern "C"
  204:  #endif
  205:  #pragma NO_ENTRY
  206:  #pragma NO_EXIT
  207:  #pragma NO_FRAME
  208:  
  209:  static void NEAR _GET_PAGE_REG(void) {	/*lint -esym(528, _GET_PAGE_REG) used in asm code */
  210:    __asm {
  211:  L_PPAGE:
  212:          CPY     #PPAGE_LOW_BOUND  ;// test of lower bound of PPAGE
  213:  #if defined( __EPAGE__ )
  214:          BLO     L_EPAGE
  215:  #else
  216:          BLO     L_NOPAGE          ;// no paged memory below
  217:  #endif
  218:          CPY     #PPAGE_HIGH_BOUND ;// test of higher bound PPAGE
  219:          BHI     L_NOPAGE
  220:  FOUND_PPAGE:
  221:          LDX     #PPAGE_ADDR       ;// load page register address and clear zero flag
  222:          RTS
  223:  #if defined( __EPAGE__ )
  224:  L_EPAGE:
  225:          CPY     #EPAGE_LOW_BOUND  ;// test of lower bound of EPAGE
  226:          BLO     L_NOPAGE
  227:          CPY     #EPAGE_HIGH_BOUND ;// test of higher bound of EPAGE
  228:          BHI     L_NOPAGE
  229:  FOUND_EPAGE:
  230:          LDX     #EPAGE_ADDR       ;// load page register address and clear zero flag
  231:          RTS
  232:  #endif
  233:  
  234:  L_NOPAGE:                         ;// not in any allowed page area
  235:                                    ;// its a far access to a non paged variable
  236:          ORCC #0x04                ;// sets zero flag
  237:          RTS
  238:    }
  239:  }
  240:  
  241:  #else /* !defined(__DPAGE__ ) && !defined( __PPAGE__) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -