1:     2:     3:     4:     5:     6:     7:     8:     9:    10:    11:    12: 
   13: 
   14:    15:    16:    17:    18:    19: 
   20: 
   21: #ifndef __TK_SYSDEF_DEPEND_CPU_H__
   22: #define __TK_SYSDEF_DEPEND_CPU_H__
   23: 
   24: 
   25: 
   26: #include "../core/armv7a/sysdef.h"
   27: 
   28: 
   29:    30:    31:    32:    33:    34:    35: 
   36: 
   37: #define IRAM_START_ADDR                 0x80000000
   38: #define IRAM_SIZE                       0x00400000
   39: #define IRAM_UNCACHED_SIZE              0x00200000
   40: 
   41: #define IRAM_CACHED_START_ADDR          IRAM_START_ADDR
   42: #define IRAM_CACHED_SIZE                (IRAM_SIZE - IRAM_UNCACHED_SIZE)
   43: #define IRAM_CACHED_END_ADDR            (IRAM_CACHED_START_ADDR + IRAM_CACHED_SIZE)
   44: #define IRAM_UNCACHED_START_ADDR        IRAM_CACHED_END_ADDR
   45: 
   46:    47:    48: 
   49: #define INTERNAL_RAM_SIZE       0x002E0000
   50: #define INTERNAL_RAM_START      0x80020000
   51: #define INTERNAL_RAM_END        (INTERNAL_RAM_START+INTERNAL_RAM_SIZE)
   52: 
   53: 
   54:    55:    56: 
   57: #define INITIAL_SP              INTERNAL_RAM_END
   58: 
   59: 
   60:    61:    62: 
   63: #define TTB_ATR_STRGLY                          0x00DF2       
   64: #define TTB_ATR_STRGLY_NS                       0x80DF2     
   65: #define TTB_ATR_DEVICE                          0x00DF6       
   66: #define TTB_ATR_DEVICE_NS                       0x80DF6     
   67: #define TTB_ATR_NORMAL_NOT_CACHE                0x04DE2       
   68: #define TTB_ATR_NORMAL_NOT_CACHE_NS             0x84DE2    
   69: #define TTB_ATR_NORMAL_CACHE                    0x01DEE  
   70: #define TTB_ATR_NORMAL_CACHE_NS                 0x81DEE       
   71: #define TTB_ATR_NORMAL_L1_CACHE_L2_NOT_CACHE    0x04DE6    
   72: #define TTB_ATR_NORMAL_L1_CACHE_L2_NOT_CACHE_NS 0x84DE6 
   73: 
   74: 
   75: 
   76:    77:    78: 
   79: 
   80:    81:    82: 
   83: #define CPG_FRQCR               0xFCFE0010
   84: 
   85: 
   86:    87:    88:    89:    90: 
   91: #define CPG_FRQCR_INIVAL        0x1012
   92: #define CLOCK_in        24     
   93: #define CLOCK_I         528    
   94: #define CLOCK_G         264    
   95: #define CLOCK_B         132    
   96: #define CLOCK_P1        66     
   97: #define CLOCK_P0        33     
   98: 
   99: #define CPG_CKIOSEL             0xFCFE0100
  100: #define CPG_SCLKSEL             0xFCFE0104
  101: 
  102:   103:   104: 
  105: #define CPG_SYSCR1              0xFCFE0400
  106: #define CPG_SYSCR2              0xFCFE0404
  107: #define CPG_SYSCR3              0xFCFE0408
  108: 
  109:   110:   111: 
  112: #define CPG_STBCR1              0xFCFE0020
  113: #define CPG_STBCR2              0xFCFE0024
  114: #define CPG_STBCR3              0xFCFE0420
  115: #define CPG_STBCR4              0xFCFE0424
  116: #define CPG_STBCR5              0xFCFE0428
  117: #define CPG_STBCR6              0xFCFE042C
  118: #define CPG_STBCR7              0xFCFE0430
  119: #define CPG_STBCR8              0xFCFE0434
  120: #define CPG_STBCR9              0xFCFE0438
  121: #define CPG_STBCR10             0xFCFE043C
  122: #define CPG_STBCR11             0xFCFE0440
  123: 
  124: 
  125: 
  126:   127:   128: 
  129: #define PL310_BASE              0x1F003000
  130: #define PL310_POWER_CTL         (PL310_BASE + 0x0F80)          
  131: 
  132: 
  133:   134:   135: 
  136: 
  137: 
  138: #define OSTM0_BASE      0xE803B000
  139: #define OSTM0_CMP       (OSTM0_BASE + 0x0000)
  140: #define OSTM0_CNT       (OSTM0_BASE + 0x0004)
  141: #define OSTM0_TE        (OSTM0_BASE + 0x0010)
  142: #define OSTM0_TS        (OSTM0_BASE + 0x0014)
  143: #define OSTM0_TT        (OSTM0_BASE + 0x0018)
  144: #define OSTM0_CTL       (OSTM0_BASE + 0x0020)
  145: 
  146: 
  147: 
  148: #define TMCLK                   66              
  149: #define TMCLK_KHz               66666                
  150: #define COUNT_PER_SEC           66666666LL       
  151: #define NSEC_PER_COUNT          15              
  152: 
  153: 
  154: 
  155: #define MIN_TIMER_PERIOD        1
  156: #define MAX_TIMER_PERIOD        50
  157: 
  158: 
  159:   160:   161: 
  162: #define GICD_BASE       0xE8221000UL          
  163: #define GICC_BASE       0xE8222000UL          
  164: 
  165: 
  166: 
  167:   168:   169: 
  170: #define N_INTVEC                (512)         
  171: 
  172:   173:   174: 
  175: #define INTPRI_BITWIDTH         5      
  176: 
  177:   178:   179: 
  180: #define INTPRI_SHIFT            (8 - INTPRI_BITWIDTH)
  181: #define INTPRI_HIGHEST          0       
  182: #define INTPRI_LOWEST           31       
  183: #define INTPRI_SYSTICK          1       
  184: 
  185:   186:   187: 
  188: #define INTNO_SW0               0    
  189: #define INTNO_SW15              15  
  190: 
  191: #define INTNO_SYSTICK           88       
  192: 
  193:   194:   195: 
  196: #define TIMER_INTLEVEL          0
  197: 
  198: 
  199: 
  200:   201:   202: 
  203: #define PORT_BASE       0xFCFFE000
  204: 
  205: 
  206: #define PORT0_PDR       (PORT_BASE + 0x0000)
  207: #define PORT1_PDR       (PORT_BASE + 0x0002)
  208: #define PORT2_PDR       (PORT_BASE + 0x0004)
  209: #define PORT3_PDR       (PORT_BASE + 0x0006)
  210: #define PORT4_PDR       (PORT_BASE + 0x0008)
  211: #define PORT5_PDR       (PORT_BASE + 0x000A)
  212: #define PORT6_PDR       (PORT_BASE + 0x000C)
  213: #define PORT7_PDR       (PORT_BASE + 0x000E)
  214: #define PORT8_PDR       (PORT_BASE + 0x0010)
  215: #define PORT9_PDR       (PORT_BASE + 0x0012)
  216: #define PORTA_PDR       (PORT_BASE + 0x0014)
  217: #define PORTB_PDR       (PORT_BASE + 0x0016)
  218: #define PORTC_PDR       (PORT_BASE + 0x0018)
  219: #define PORTD_PDR       (PORT_BASE + 0x001A)
  220: #define PORTE_PDR       (PORT_BASE + 0x001C)
  221: #define PORTF_PDR       (PORT_BASE + 0x001E)
  222: #define PORTG_PDR       (PORT_BASE + 0x0020)
  223: #define PORTH_PDR       (PORT_BASE + 0x0022)
  224: #define PORTJ_PDR       (PORT_BASE + 0x0024)
  225: #define PORTK_PDR       (PORT_BASE + 0x0026)
  226: #define PORTL_PDR       (PORT_BASE + 0x0028)
  227: #define PORTM_PDR       (PORT_BASE + 0x002A)
  228: 
  229: 
  230: #define PORT0_PODR      (PORT_BASE + 0x0040)
  231: #define PORT1_PODR      (PORT_BASE + 0x0041)
  232: #define PORT2_PODR      (PORT_BASE + 0x0042)
  233: #define PORT3_PODR      (PORT_BASE + 0x0043)
  234: #define PORT4_PODR      (PORT_BASE + 0x0044)
  235: #define PORT5_PODR      (PORT_BASE + 0x0045)
  236: #define PORT6_PODR      (PORT_BASE + 0x0046)
  237: #define PORT7_PODR      (PORT_BASE + 0x0047)
  238: #define PORT8_PODR      (PORT_BASE + 0x0048)
  239: #define PORT9_PODR      (PORT_BASE + 0x0049)
  240: #define PORTA_PODR      (PORT_BASE + 0x004A)
  241: #define PORTB_PODR      (PORT_BASE + 0x004B)
  242: #define PORTC_PODR      (PORT_BASE + 0x004C)
  243: #define PORTD_PODR      (PORT_BASE + 0x004D)
  244: #define PORTE_PODR      (PORT_BASE + 0x004E)
  245: #define PORTF_PODR      (PORT_BASE + 0x004F)
  246: #define PORTG_PODR      (PORT_BASE + 0x0050)
  247: #define PORTH_PODR      (PORT_BASE + 0x0051)
  248: #define PORTJ_PODR      (PORT_BASE + 0x0052)
  249: #define PORTK_PODR      (PORT_BASE + 0x0053)
  250: #define PORTL_PODR      (PORT_BASE + 0x0054)
  251: #define PORTM_PODR      (PORT_BASE + 0x0055)
  252: 
  253: 
  254: #define PORT0_PIDR      (PORT_BASE + 0x0060)
  255: #define PORT1_PIDR      (PORT_BASE + 0x0061)
  256: #define PORT2_PIDR      (PORT_BASE + 0x0062)
  257: #define PORT3_PIDR      (PORT_BASE + 0x0063)
  258: #define PORT4_PIDR      (PORT_BASE + 0x0064)
  259: #define PORT5_PIDR      (PORT_BASE + 0x0065)
  260: #define PORT6_PIDR      (PORT_BASE + 0x0066)
  261: #define PORT7_PIDR      (PORT_BASE + 0x0067)
  262: #define PORT8_PIDR      (PORT_BASE + 0x0068)
  263: #define PORT9_PIDR      (PORT_BASE + 0x0069)
  264: #define PORTA_PIDR      (PORT_BASE + 0x006A)
  265: #define PORTB_PIDR      (PORT_BASE + 0x006B)
  266: #define PORTC_PIDR      (PORT_BASE + 0x006C)
  267: #define PORTD_PIDR      (PORT_BASE + 0x006D)
  268: #define PORTE_PIDR      (PORT_BASE + 0x006E)
  269: #define PORTF_PIDR      (PORT_BASE + 0x006F)
  270: #define PORTG_PIDR      (PORT_BASE + 0x0070)
  271: #define PORTH_PIDR      (PORT_BASE + 0x0071)
  272: #define PORTJ_PIDR      (PORT_BASE + 0x0072)
  273: #define PORTK_PIDR      (PORT_BASE + 0x0073)
  274: #define PORTL_PIDR      (PORT_BASE + 0x0074)
  275: #define PORTM_PIDR      (PORT_BASE + 0x0075)
  276: 
  277: 
  278: #define PORT0_PMR       (PORT_BASE + 0x0080)
  279: #define PORT1_PMR       (PORT_BASE + 0x0081)
  280: #define PORT2_PMR       (PORT_BASE + 0x0082)
  281: #define PORT3_PMR       (PORT_BASE + 0x0083)
  282: #define PORT4_PMR       (PORT_BASE + 0x0084)
  283: #define PORT5_PMR       (PORT_BASE + 0x0085)
  284: #define PORT6_PMR       (PORT_BASE + 0x0086)
  285: #define PORT7_PMR       (PORT_BASE + 0x0087)
  286: #define PORT8_PMR       (PORT_BASE + 0x0088)
  287: #define PORT9_PMR       (PORT_BASE + 0x0089)
  288: #define PORTA_PMR       (PORT_BASE + 0x008A)
  289: #define PORTB_PMR       (PORT_BASE + 0x008B)
  290: #define PORTC_PMR       (PORT_BASE + 0x008C)
  291: #define PORTD_PMR       (PORT_BASE + 0x008D)
  292: #define PORTE_PMR       (PORT_BASE + 0x008E)
  293: #define PORTF_PMR       (PORT_BASE + 0x008F)
  294: #define PORTG_PMR       (PORT_BASE + 0x0090)
  295: #define PORTH_PMR       (PORT_BASE + 0x0091)
  296: #define PORTJ_PMR       (PORT_BASE + 0x0092)
  297: #define PORTK_PMR       (PORT_BASE + 0x0093)
  298: #define PORTL_PMR       (PORT_BASE + 0x0094)
  299: #define PORTM_PMR       (PORT_BASE + 0x0095)
  300: 
  301: 
  302: #define PORT0_DSCR      (PORT_BASE + 0x0140)
  303: #define PORT1_DSCR      (PORT_BASE + 0x0142)
  304: #define PORT2_DSCR      (PORT_BASE + 0x0144)
  305: #define PORT3_DSCR      (PORT_BASE + 0x0146)
  306: #define PORT4_DSCR      (PORT_BASE + 0x0148)
  307: #define PORT5_DSCR      (PORT_BASE + 0x014A)
  308: #define PORT6_DSCR      (PORT_BASE + 0x014C)
  309: #define PORT7_DSCR      (PORT_BASE + 0x014E)
  310: #define PORT8_DSCR      (PORT_BASE + 0x0150)
  311: #define PORT9_DSCR      (PORT_BASE + 0x0152)
  312: #define PORTA_DSCR      (PORT_BASE + 0x0154)
  313: #define PORTB_DSCR      (PORT_BASE + 0x0156)
  314: #define PORTC_DSCR      (PORT_BASE + 0x0158)
  315: #define PORTD_DSCR      (PORT_BASE + 0x015A)
  316: #define PORTE_DSCR      (PORT_BASE + 0x015C)
  317: #define PORTF_DSCR      (PORT_BASE + 0x015E)
  318: #define PORTG_DSCR      (PORT_BASE + 0x0160)
  319: #define PORTH_DSCR      (PORT_BASE + 0x0162)
  320: #define PORTJ_DSCR      (PORT_BASE + 0x0164)
  321: #define PORTK_DSCR      (PORT_BASE + 0x0166)
  322: #define PORTL_DSCR      (PORT_BASE + 0x0168)
  323: #define PORTM_DSCR      (PORT_BASE + 0x016A)
  324: 
  325: 
  326: #define PORT0n_PFS(n)   (PORT_BASE + 0x0200 + (n))
  327: #define PORT1n_PFS(n)   (PORT_BASE + 0x0208 + (n))
  328: #define PORT2n_PFS(n)   (PORT_BASE + 0x0210 + (n))
  329: #define PORT3n_PFS(n)   (PORT_BASE + 0x0218 + (n))
  330: #define PORT4n_PFS(n)   (PORT_BASE + 0x0220 + (n))
  331: #define PORT5n_PFS(n)   (PORT_BASE + 0x0228 + (n))
  332: #define PORT6n_PFS(n)   (PORT_BASE + 0x0230 + (n))
  333: #define PORT7n_PFS(n)   (PORT_BASE + 0x0238 + (n))
  334: #define PORT8n_PFS(n)   (PORT_BASE + 0x0240 + (n))
  335: #define PORT9n_PFS(n)   (PORT_BASE + 0x0248 + (n))
  336: #define PORTAn_PFS(n)   (PORT_BASE + 0x0250 + (n))
  337: #define PORTBn_PFS(n)   (PORT_BASE + 0x0258 + (n))
  338: #define PORTCn_PFS(n)   (PORT_BASE + 0x0260 + (n))
  339: #define PORTDn_PFS(n)   (PORT_BASE + 0x0268 + (n))
  340: #define PORTEn_PFS(n)   (PORT_BASE + 0x0270 + (n))
  341: #define PORTFn_PFS(n)   (PORT_BASE + 0x0278 + (n))
  342: #define PORTGn_PFS(n)   (PORT_BASE + 0x0280 + (n))
  343: #define PORTHn_PFS(n)   (PORT_BASE + 0x0288 + (n))
  344: #define PORTJn_PFS(n)   (PORT_BASE + 0x0290 + (n))
  345: #define PORTKn_PFS(n)   (PORT_BASE + 0x0298 + (n))
  346: #define PORTLn_PFS(n)   (PORT_BASE + 0x02A0 + (n))
  347: #define PORTMn_PFS(n)   (PORT_BASE + 0x02A8 + (n))
  348: 
  349: #define PORT_PFS_ISEL           (0x40)
  350: #define PORT_PFS_PSEL(n)        (0x07 & n)
  351: 
  352: #define PORT_PWPR       (PORT_BASE + 0x02FF)          
  353: #define PORT_PWPR_B0WI  0b10000000                       
  354: #define PORT_PWPR_PFSWE 0b01000000                      
  355: 
  356: 
  357:   358:   359: 
  360: #define CPU_HAS_PTMR    (1)
  361: 
  362: 
  363: #define OSTM1_BASE      0xE803C000
  364: #define OSTM2_BASE      0xE803D000
  365: 
  366: #define OSTMnCMP        0x00
  367: #define OSTMnCNT        0x04
  368: #define OSTMnTE         0x10
  369: #define OSTMnTS         0x14
  370: #define OSTMnTT         0x18
  371: #define OSTMnCTL        0x20
  372: 
  373: #define OSTMnCTL_MD1    0x02
  374: #define OSTMnCTL_MD0    0x01
  375: 
  376: 
  377: #define INTNO_OSTM1     89
  378: #define INTNO_OSTM2     90
  379: 
  380: 
  381: #define INTPRI_OSTM1    5
  382: #define INTPRI_OSTM2    5
  383: 
  384: 
  385: #define PTMCLK          33
  386: 
  387: 
  388: #define PTMR_MAX_CNT    (0xFFFFFFFF)
  389: 
  390: 
  391: 
  392:   393:   394: 
  395: #define CPU_HAS_FPU                     1
  396: #define CPU_HAS_DPS                     0
  397: 
  398:   399:   400:   401: 
  402: #if USE_FPU
  403: #define NUM_COPROCESSOR         1
  404: #else
  405: #define NUM_COPROCESSOR         0
  406: #endif
  407: 
  408: #endif