REG=
{
GCR_PDID=1342177280,
GCR_RSTSRC=1342177284,
GCR_IPRSTC1=1342177288,
GCR_IPRSTC2=1342177292,
GCR_BODCR=1342177304,
GCR_TEMPCR=1342177308,
GCR_PORCR=1342177316,
GCR_P0_MFP=1342177328,
GCR_P1_MFP=1342177332,
GCR_P2_MFP=1342177336,
GCR_P3_MFP=1342177340,
GCR_P4_MFP=1342177344,
GCR_P5_MFP=1342177348,
GCR_P6_MFP=1342177352,
GCR_P7_MFP=1342177356,
GCR_P8_MFP=1342177360,
GCR_P9_MFP=1342177364,
GCR_PA_MFP=1342177368,
GCR_REGWRPROT=1342177536,
GCR_IRCCR=1342177560,
GCR_IRCSR=1342177564,
SYST_SYST_CSR=3758153744,
SYST_SYST_RVR=3758153748,
SYST_SYST_CVR=3758153752,
NVIC_NVIC_ISER=3758153984,
NVIC_NVIC_ICER=3758154112,
NVIC_NVIC_ISPR=3758154240,
NVIC_NVIC_ICPR=3758154368,
NVIC_NVIC_IPR0=3758154752,
NVIC_NVIC_IPR1=3758154756,
NVIC_NVIC_IPR2=3758154760,
NVIC_NVIC_IPR3=3758154764,
NVIC_NVIC_IPR4=3758154768,
NVIC_NVIC_IPR5=3758154772,
NVIC_NVIC_IPR6=3758154776,
NVIC_NVIC_IPR7=3758154780,
INT_IRQ0_SRC=1342178048,
INT_IRQ1_SRC=1342178052,
INT_IRQ2_SRC=1342178056,
INT_IRQ3_SRC=1342178060,
INT_IRQ4_SRC=1342178064,
INT_IRQ5_SRC=1342178068,
INT_IRQ6_SRC=1342178072,
INT_IRQ7_SRC=1342178076,
INT_IRQ8_SRC=1342178080,
INT_IRQ9_SRC=1342178084,
INT_IRQ10_SRC=1342178088,
INT_IRQ11_SRC=1342178092,
INT_IRQ12_SRC=1342178096,
INT_IRQ13_SRC=1342178100,
INT_IRQ14_SRC=1342178104,
INT_IRQ15_SRC=1342178108,
INT_IRQ16_SRC=1342178112,
INT_IRQ17_SRC=1342178116,
INT_IRQ18_SRC=1342178120,
INT_IRQ19_SRC=1342178124,
INT_IRQ20_SRC=1342178128,
INT_IRQ21_SRC=1342178132,
INT_IRQ22_SRC=1342178136,
INT_IRQ23_SRC=1342178140,
INT_IRQ24_SRC=1342178144,
INT_IRQ25_SRC=1342178148,
INT_IRQ26_SRC=1342178152,
INT_IRQ27_SRC=1342178156,
INT_IRQ28_SRC=1342178160,
INT_IRQ29_SRC=1342178164,
INT_IRQ30_SRC=1342178168,
INT_IRQ31_SRC=1342178172,
INT_NMI_CON=1342178176,
INT_MCU_IRQ=1342178180,
SCB_CPUID=3758157056,
SCB_ICSR=3758157060,
SCB_AIRCR=3758157068,
SCB_SCR=3758157072,
SCB_SHPR2=3758157084,
SCB_SHPR3=3758157088,
CLK_PWRCON=1342177792,
CLK_AHBCLK=1342177796,
CLK_APBCLK=1342177800,
CLK_CLKSTATUS=1342177804,
CLK_CLKSEL0=1342177808,
CLK_CLKSEL1=1342177812,
CLK_CLKDIV=1342177816,
CLK_CLKSEL2=1342177820,
CLK_PLLCON=1342177824,
CLK_FRQDIV=1342177828,
GP0_Px_PMD=1342193664,
GP0_Px_OFFD=1342193668,
GP0_Px_DOUT=1342193672,
GP0_Px_DMASK=1342193676,
GP0_Px_PIN=1342193680,
GP0_Px_DBEN=1342193684,
GP0_Px_IMD=1342193688,
GP0_Px_IEN=1342193692,
GP0_Px_ISF=1342193696,
GP0_DBNCECON=1342194400,
GP0_PWMPOEN=1342194404,
GP10_Px_PMD=1342194304,
GP10_Px_OFFD=1342194308,
GP10_Px_DOUT=1342194312,
GP10_Px_DMASK=1342194316,
GP10_Px_PIN=1342194320,
GP10_Px_DBEN=1342194324,
GP10_Px_IMD=1342194328,
GP10_Px_IEN=1342194332,
GP10_Px_ISF=1342194336,
GP10_DBNCECON=1342195040,
GP10_PWMPOEN=1342195044,
GP1_Px_PMD=1342193728,
GP1_Px_OFFD=1342193732,
GP1_Px_DOUT=1342193736,
GP1_Px_DMASK=1342193740,
GP1_Px_PIN=1342193744,
GP1_Px_DBEN=1342193748,
GP1_Px_IMD=1342193752,
GP1_Px_IEN=1342193756,
GP1_Px_ISF=1342193760,
GP1_DBNCECON=1342194464,
GP1_PWMPOEN=1342194468,
GP2_Px_PMD=1342193792,
GP2_Px_OFFD=1342193796,
GP2_Px_DOUT=1342193800,
GP2_Px_DMASK=1342193804,
GP2_Px_PIN=1342193808,
GP2_Px_DBEN=1342193812,
GP2_Px_IMD=1342193816,
GP2_Px_IEN=1342193820,
GP2_Px_ISF=1342193824,
GP2_DBNCECON=1342194528,
GP2_PWMPOEN=1342194532,
GP3_Px_PMD=1342193856,
GP3_Px_OFFD=1342193860,
GP3_Px_DOUT=1342193864,
GP3_Px_DMASK=1342193868,
GP3_Px_PIN=1342193872,
GP3_Px_DBEN=1342193876,
GP3_Px_IMD=1342193880,
GP3_Px_IEN=1342193884,
GP3_Px_ISF=1342193888,
GP3_DBNCECON=1342194592,
GP3_PWMPOEN=1342194596,
GP4_Px_PMD=1342193920,
GP4_Px_OFFD=1342193924,
GP4_Px_DOUT=1342193928,
GP4_Px_DMASK=1342193932,
GP4_Px_PIN=1342193936,
GP4_Px_DBEN=1342193940,
GP4_Px_IMD=1342193944,
GP4_Px_IEN=1342193948,
GP4_Px_ISF=1342193952,
GP4_DBNCECON=1342194656,
GP4_PWMPOEN=1342194660,
GP5_Px_PMD=1342193984,
GP5_Px_OFFD=1342193988,
GP5_Px_DOUT=1342193992,
GP5_Px_DMASK=1342193996,
GP5_Px_PIN=1342194000,
GP5_Px_DBEN=1342194004,
GP5_Px_IMD=1342194008,
GP5_Px_IEN=1342194012,
GP5_Px_ISF=1342194016,
GP5_DBNCECON=1342194720,
GP5_PWMPOEN=1342194724,
GP6_Px_PMD=1342194048,
GP6_Px_OFFD=1342194052,
GP6_Px_DOUT=1342194056,
GP6_Px_DMASK=1342194060,
GP6_Px_PIN=1342194064,
GP6_Px_DBEN=1342194068,
GP6_Px_IMD=1342194072,
GP6_Px_IEN=1342194076,
GP6_Px_ISF=1342194080,
GP6_DBNCECON=1342194784,
GP6_PWMPOEN=1342194788,
GP7_Px_PMD=1342194112,
GP7_Px_OFFD=1342194116,
GP7_Px_DOUT=1342194120,
GP7_Px_DMASK=1342194124,
GP7_Px_PIN=1342194128,
GP7_Px_DBEN=1342194132,
GP7_Px_IMD=1342194136,
GP7_Px_IEN=1342194140,
GP7_Px_ISF=1342194144,
GP7_DBNCECON=1342194848,
GP7_PWMPOEN=1342194852,
GP8_Px_PMD=1342194176,
GP8_Px_OFFD=1342194180,
GP8_Px_DOUT=1342194184,
GP8_Px_DMASK=1342194188,
GP8_Px_PIN=1342194192,
GP8_Px_DBEN=1342194196,
GP8_Px_IMD=1342194200,
GP8_Px_IEN=1342194204,
GP8_Px_ISF=1342194208,
GP8_DBNCECON=1342194912,
GP8_PWMPOEN=1342194916,
GP9_Px_PMD=1342194240,
GP9_Px_OFFD=1342194244,
GP9_Px_DOUT=1342194248,
GP9_Px_DMASK=1342194252,
GP9_Px_PIN=1342194256,
GP9_Px_DBEN=1342194260,
GP9_Px_IMD=1342194264,
GP9_Px_IEN=1342194268,
GP9_Px_ISF=1342194272,
GP9_DBNCECON=1342194976,
GP9_PWMPOEN=1342194980,
GPIOB_P0_0=1342194432,
GPIOB_P0_1=1342194436,
GPIOB_P0_2=1342194440,
GPIOB_P0_3=1342194444,
GPIOB_P0_4=1342194448,
GPIOB_P0_5=1342194452,
GPIOB_P0_6=1342194456,
GPIOB_P0_7=1342194460,
GPIOB_P1_0=1342194464,
GPIOB_P1_1=1342194468,
GPIOB_P1_2=1342194472,
GPIOB_P1_3=1342194476,
GPIOB_P1_4=1342194480,
GPIOB_P1_5=1342194484,
GPIOB_P1_6=1342194488,
GPIOB_P1_7=1342194492,
GPIOB_P2_0=1342194496,
GPIOB_P2_1=1342194500,
GPIOB_P2_2=1342194504,
GPIOB_P2_3=1342194508,
GPIOB_P2_4=1342194512,
GPIOB_P2_5=1342194516,
GPIOB_P2_6=1342194520,
GPIOB_P2_7=1342194524,
GPIOB_P3_0=1342194528,
GPIOB_P3_1=1342194532,
GPIOB_P3_2=1342194536,
GPIOB_P3_3=1342194540,
GPIOB_P3_4=1342194544,
GPIOB_P3_5=1342194548,
GPIOB_P3_6=1342194552,
GPIOB_P3_7=1342194556,
GPIOB_P4_0=1342194560,
GPIOB_P4_1=1342194564,
GPIOB_P4_2=1342194568,
GPIOB_P4_3=1342194572,
GPIOB_P4_4=1342194576,
GPIOB_P4_5=1342194580,
GPIOB_P4_6=1342194584,
GPIOB_P4_7=1342194588,
GPIOB_P5_0=1342194592,
GPIOB_P5_1=1342194596,
GPIOB_P5_2=1342194600,
GPIOB_P5_3=1342194604,
GPIOB_P5_4=1342194608,
GPIOB_P5_5=1342194612,
GPIOB_P5_6=1342194616,
GPIOB_P5_7=1342194620,
GPIOB_P6_0=1342194624,
GPIOB_P6_1=1342194628,
GPIOB_P6_2=1342194632,
GPIOB_P6_3=1342194636,
GPIOB_P6_4=1342194640,
GPIOB_P6_5=1342194644,
GPIOB_P6_6=1342194648,
GPIOB_P6_7=1342194652,
GPIOB_P7_0=1342194656,
GPIOB_P7_1=1342194660,
GPIOB_P7_2=1342194664,
GPIOB_P7_3=1342194668,
GPIOB_P7_4=1342194672,
GPIOB_P7_5=1342194676,
GPIOB_P7_6=1342194680,
GPIOB_P7_7=1342194684,
GPIOB_P8_0=1342194688,
GPIOB_P8_1=1342194692,
GPIOB_P8_2=1342194696,
GPIOB_P8_3=1342194700,
GPIOB_P8_4=1342194704,
GPIOB_P8_5=1342194708,
GPIOB_P8_6=1342194712,
GPIOB_P8_7=1342194716,
GPIOB_P9_0=1342194720,
GPIOB_P9_1=1342194724,
GPIOB_P9_2=1342194728,
GPIOB_P9_3=1342194732,
GPIOB_P9_4=1342194736,
GPIOB_P9_5=1342194740,
GPIOB_P9_6=1342194744,
GPIOB_P9_7=1342194748,
GPIOB_P10_0=1342194752,
GPIOB_P10_1=1342194756,
GPIOB_P10_2=1342194760,
GPIOB_P10_3=1342194764,
GPIOB_P10_4=1342194768,
GPIOB_P10_5=1342194772,
GPIOB_P10_6=1342194776,
GPIOB_P10_7=1342194780,
TMR01_TCSR0=1073807360,
TMR01_TCMPR0=1073807364,
TMR01_TISR0=1073807368,
TMR01_TDR0=1073807372,
TMR01_TCAP0=1073807376,
TMR01_TEXCON0=1073807380,
TMR01_TEXISR0=1073807384,
TMR01_TCSR1=1073807392,
TMR01_TCMPR1=1073807396,
TMR01_TISR1=1073807400,
TMR01_TDR1=1073807404,
TMR01_TCAP1=1073807408,
TMR01_TEXCON1=1073807412,
TMR01_TEXISR1=1073807416,
TMR23_TCSR2=1074855936,
TMR23_TCMPR2=1074855940,
TMR23_TISR2=1074855944,
TMR23_TDR2=1074855948,
TMR23_TCAP2=1074855952,
TMR23_TEXCON2=1074855956,
TMR23_TEXISR2=1074855960,
TMR23_TCSR3=1074855968,
TMR23_TCMPR3=1074855972,
TMR23_TISR3=1074855976,
TMR23_TDR3=1074855980,
TMR23_TCAP3=1074855984,
TMR23_TEXCON3=1074855988,
TMR23_TEXISR3=1074855992,
WDT_WTCR=1073758208,
WDT_WTCRALT=1073758212,
WWDT_WWDTRLD=1073758464,
WWDT_WWDTCR=1073758468,
WWDT_WWDTSR=1073758472,
WWDT_WWDTCVR=1073758476,
BPWM_PPR=1074003968,
BPWM_CSR=1074003972,
BPWM_PCR=1074003976,
BPWM_CNR0=1074003980,
BPWM_CMR0=1074003984,
BPWM_PDR0=1074003988,
BPWM_CNR1=1074003992,
BPWM_CMR1=1074003996,
BPWM_PDR1=1074004000,
BPWM_PIER=1074004032,
BPWM_PIIR=1074004036,
BPWM_CCR=1074004048,
BPWM_CRLR0=1074004056,
BPWM_CFLR0=1074004060,
BPWM_CRLR1=1074004064,
BPWM_CFLR1=1074004068,
BPWM_CAPENR=1074004088,
BPWM_POE=1074004092,
EPWM0_PWMCON=1075380224,
EPWM0_PWMSTS=1075380228,
EPWM0_PWMP=1075380232,
EPWM0_PWM0=1075380236,
EPWM0_PWM2=1075380240,
EPWM0_PWM4=1075380244,
EPWM0_PMSKE=1075380248,
EPWM0_PMSKD=1075380252,
EPWM0_PDTC=1075380268,
EPWM0_PWMB=1075380272,
EPWM0_PNPC=1075380276,
EPWM0_PWMFCNT=1075380284,
EPWM0_PWMEIC=1075380288,
EPWM1_PWMCON=1075396608,
EPWM1_PWMSTS=1075396612,
EPWM1_PWMP=1075396616,
EPWM1_PWM0=1075396620,
EPWM1_PWM2=1075396624,
EPWM1_PWM4=1075396628,
EPWM1_PMSKE=1075396632,
EPWM1_PMSKD=1075396636,
EPWM1_PDTC=1075396652,
EPWM1_PWMB=1075396656,
EPWM1_PNPC=1075396660,
EPWM1_PWMFCNT=1075396668,
EPWM1_PWMEIC=1075396672,
MDU0_Ia=1075642368,
MDU0_Ib=1075642372,
MDU0_Ic=1075642376,
MDU0_Ialfa=1075642380,
MDU0_Ibeta=1075642384,
MDU0_SIN=1075642388,
MDU0_COS=1075642392,
MDU0_Id=1075642396,
MDU0_Iq=1075642400,
MDU0_Id_CMD=1075642404,
MDU0_Iq_CMD=1075642408,
MDU0_KP_d=1075642412,
MDU0_KI_d=1075642416,
MDU0_KP_q=1075642420,
MDU0_KI_q=1075642424,
MDU0_PI_dFW=1075642428,
MDU0_PI_qFW=1075642432,
MDU0_UI_d=1075642436,
MDU0_UI_q=1075642440,
MDU0_Vd=1075642444,
MDU0_Vq=1075642448,
MDU0_Valfa=1075642452,
MDU0_Vbeta=1075642456,
MDU0_Vref1=1075642460,
MDU0_Vref2=1075642464,
MDU0_Vref3=1075642468,
MDU0_SVPDATA0=1075642472,
MDU0_SVPDATA2=1075642476,
MDU0_SVPDATA4=1075642480,
MDU0_SVPDATA0N=1075642484,
MDU0_SVPDATA2N=1075642488,
MDU0_SVPDATA4N=1075642492,
MDU0_MDUCON=1075642496,
MDU0_MDUSTS=1075642500,
MDU0_PI_dMAX=1075642624,
MDU0_PI_dMIN=1075642628,
MDU0_PI_qMAX=1075642632,
MDU0_PI_qMIN=1075642636,
MDU0_I_dMAX=1075642640,
MDU0_I_dMIN=1075642644,
MDU0_I_qMAX=1075642648,
MDU0_I_qMIN=1075642652,
MDU0_Vd_In=1075642656,
MDU0_Vq_In=1075642660,
MDU0_PWMNORM=1075642664,
MDU0_PWMMAX=1075642668,
MDU0_PWMMIN=1075642672,
MDU0_Id_Err=1075642676,
MDU0_Iq_Err=1075642680,
MDU1_Ia=1075658752,
MDU1_Ib=1075658756,
MDU1_Ic=1075658760,
MDU1_Ialfa=1075658764,
MDU1_Ibeta=1075658768,
MDU1_SIN=1075658772,
MDU1_COS=1075658776,
MDU1_Id=1075658780,
MDU1_Iq=1075658784,
MDU1_Id_CMD=1075658788,
MDU1_Iq_CMD=1075658792,
MDU1_KP_d=1075658796,
MDU1_KI_d=1075658800,
MDU1_KP_q=1075658804,
MDU1_KI_q=1075658808,
MDU1_PI_dFW=1075658812,
MDU1_PI_qFW=1075658816,
MDU1_UI_d=1075658820,
MDU1_UI_q=1075658824,
MDU1_Vd=1075658828,
MDU1_Vq=1075658832,
MDU1_Valfa=1075658836,
MDU1_Vbeta=1075658840,
MDU1_Vref1=1075658844,
MDU1_Vref2=1075658848,
MDU1_Vref3=1075658852,
MDU1_SVPDATA0=1075658856,
MDU1_SVPDATA2=1075658860,
MDU1_SVPDATA4=1075658864,
MDU1_SVPDATA0N=1075658868,
MDU1_SVPDATA2N=1075658872,
MDU1_SVPDATA4N=1075658876,
MDU1_MDUCON=1075658880,
MDU1_MDUSTS=1075658884,
MDU1_PI_dMAX=1075659008,
MDU1_PI_dMIN=1075659012,
MDU1_PI_qMAX=1075659016,
MDU1_PI_qMIN=1075659020,
MDU1_I_dMAX=1075659024,
MDU1_I_dMIN=1075659028,
MDU1_I_qMAX=1075659032,
MDU1_I_qMIN=1075659036,
MDU1_Vd_In=1075659040,
MDU1_Vq_In=1075659044,
MDU1_PWMNORM=1075659048,
MDU1_PWMMAX=1075659052,
MDU1_PWMMIN=1075659056,
MDU1_Id_Err=1075659060,
MDU1_Iq_Err=1075659064,
MDUG_MDUSCON=1075644416,
MDUG_MDUSSTS=1075644420,
DIV_DIVCON=1342259200,
DIV_DIVIDEND=1342259204,
DIV_DIVISOR=1342259208,
DIV_DIVQUO=1342259212,
DIV_DIVREM=1342259216,
DIV_DIVSTS=1342259220,
CAP0_CAP_CNT=1075511296,
CAP0_CAP_HLD0=1075511300,
CAP0_CAP_HLD1=1075511304,
CAP0_CAP_HLD2=1075511308,
CAP0_CAP_CNTCMP=1075511312,
CAP0_CAP_CTR0=1075511316,
CAP0_CAP_CTR1=1075511320,
CAP0_CAP_STS=1075511324,
CAP1_CAP_CNT=1075527680,
CAP1_CAP_HLD0=1075527684,
CAP1_CAP_HLD1=1075527688,
CAP1_CAP_HLD2=1075527692,
CAP1_CAP_CNTCMP=1075527696,
CAP1_CAP_CTR0=1075527700,
CAP1_CAP_CTR1=1075527704,
CAP1_CAP_STS=1075527708,
QEI0_QEI_CNT=1075576832,
QEI0_QEI_CNTHLD=1075576836,
QEI0_QEI_CNTILAT=1075576840,
QEI0_QEI_CNTCMP=1075576844,
QEI0_QEI_MAXCNT=1075576852,
QEI0_QEI_CTR=1075576856,
QEI0_QEI_STS=1075576876,
QEI1_QEI_CNT=1075593216,
QEI1_QEI_CNTHLD=1075593220,
QEI1_QEI_CNTILAT=1075593224,
QEI1_QEI_CNTCMP=1075593228,
QEI1_QEI_MAXCNT=1075593236,
QEI1_QEI_CTR=1075593240,
QEI1_QEI_STS=1075593260,
UART0_UA_RBR=1074069504,
UART0_UA_THR=1074069504,
UART0_UA_IER=1074069508,
UART0_UA_FCR=1074069512,
UART0_UA_LCR=1074069516,
UART0_UA_MCR=1074069520,
UART0_UA_MSR=1074069524,
UART0_UA_FSR=1074069528,
UART0_UA_ISR=1074069532,
UART0_UA_TOR=1074069536,
UART0_UA_BAUD=1074069540,
UART0_UA_IRCR=1074069544,
UART0_UA_ALT_CSR=1074069548,
UART0_UA_FUN_SEL=1074069552,
UART0_UA_LIN_CTL=1074069556,
UART0_UA_LIN_SR=1074069560,
UART1_UA_RBR=1075118080,
UART1_UA_THR=1075118080,
UART1_UA_IER=1075118084,
UART1_UA_FCR=1075118088,
UART1_UA_LCR=1075118092,
UART1_UA_MCR=1075118096,
UART1_UA_MSR=1075118100,
UART1_UA_FSR=1075118104,
UART1_UA_ISR=1075118108,
UART1_UA_TOR=1075118112,
UART1_UA_BAUD=1075118116,
UART1_UA_IRCR=1075118120,
UART1_UA_ALT_CSR=1075118124,
UART1_UA_FUN_SEL=1075118128,
UART1_UA_LIN_CTL=1075118132,
UART1_UA_LIN_SR=1075118136,
SPI0_SPI_CNTRL=1073938432,
SPI0_SPI_DIVIDER=1073938436,
SPI0_SPI_SSR=1073938440,
SPI0_SPI_RX=1073938448,
SPI0_SPI_TX=1073938464,
SPI0_SPI_CNTRL2=1073938492,
SPI0_SPI_FIFO_CTL=1073938496,
SPI0_SPI_STATUS=1073938500,
SPI1_SPI_CNTRL=1073954816,
SPI1_SPI_DIVIDER=1073954820,
SPI1_SPI_SSR=1073954824,
SPI1_SPI_RX=1073954832,
SPI1_SPI_TX=1073954848,
SPI1_SPI_CNTRL2=1073954876,
SPI1_SPI_FIFO_CTL=1073954880,
SPI1_SPI_STATUS=1073954884,
SPI2_SPI_CNTRL=1074987008,
SPI2_SPI_DIVIDER=1074987012,
SPI2_SPI_SSR=1074987016,
SPI2_SPI_RX=1074987024,
SPI2_SPI_TX=1074987040,
SPI2_SPI_CNTRL2=1074987068,
SPI2_SPI_FIFO_CTL=1074987072,
SPI2_SPI_STATUS=1074987076,
I2C0_I2CON=1073872896,
I2C0_I2CADDR0=1073872900,
I2C0_I2CDAT=1073872904,
I2C0_I2CSTATUS=1073872908,
I2C0_I2CLK=1073872912,
I2C0_I2CTOC=1073872916,
I2C0_I2CADDR1=1073872920,
I2C0_I2CADDR2=1073872924,
I2C0_I2CADDR3=1073872928,
I2C0_I2CADM0=1073872932,
I2C0_I2CADM1=1073872936,
I2C0_I2CADM2=1073872940,
I2C0_I2CADM3=1073872944,
I2C0_I2CWKUPCON=1073872956,
I2C0_I2CWKUPSTS=1073872960,
CAN0_CAN_CON=1075314688,
CAN0_CAN_STATUS=1075314692,
CAN0_CAN_ERR=1075314696,
CAN0_CAN_BTIME=1075314700,
CAN0_CAN_IIDR=1075314704,
CAN0_CAN_TEST=1075314708,
CAN0_CAN_BRPE=1075314712,
CAN0_CAN_IF1_CREQ=1075314720,
CAN0_CAN_IF1_CMASK=1075314724,
CAN0_CAN_IF1_MASK1=1075314728,
CAN0_CAN_IF1_MASK2=1075314732,
CAN0_CAN_IF1_ARB1=1075314736,
CAN0_CAN_IF1_ARB2=1075314740,
CAN0_CAN_IF1_MCON=1075314744,
CAN0_CAN_IF1_DAT_A1=1075314748,
CAN0_CAN_IF1_DAT_A2=1075314752,
CAN0_CAN_IF1_DAT_B1=1075314756,
CAN0_CAN_IF1_DAT_B2=1075314760,
CAN0_CAN_IF2_CREQ=1075314816,
CAN0_CAN_IF2_CMASK=1075314820,
CAN0_CAN_IF2_MASK1=1075314824,
CAN0_CAN_IF2_MASK2=1075314828,
CAN0_CAN_IF2_ARB1=1075314832,
CAN0_CAN_IF2_ARB2=1075314836,
CAN0_CAN_IF2_MCON=1075314840,
CAN0_CAN_IF2_DAT_A1=1075314844,
CAN0_CAN_IF2_DAT_A2=1075314848,
CAN0_CAN_IF2_DAT_B1=1075314852,
CAN0_CAN_IF2_DAT_B2=1075314856,
CAN0_CAN_TXREQ1=1075314944,
CAN0_CAN_TXREQ2=1075314948,
CAN0_CAN_NDAT1=1075314976,
CAN0_CAN_NDAT2=1075314980,
CAN0_CAN_IPND1=1075315008,
CAN0_CAN_IPND2=1075315012,
CAN0_CAN_MVLD1=1075315040,
CAN0_CAN_MVLD2=1075315044,
CAN0_CAN_WU_EN=1075315048,
CAN0_CAN_WU_STATUS=1075315052,
ADC_ADDRA0=1074659328,
ADC_ADDRA1=1074659332,
ADC_ADDRA2=1074659336,
ADC_ADDRA3=1074659340,
ADC_ADDRA4=1074659344,
ADC_ADDRA5=1074659348,
ADC_ADDRA6=1074659352,
ADC_ADDRA7=1074659356,
ADC_ADDRB0=1074659360,
ADC_ADDRB1=1074659364,
ADC_ADDRB2=1074659368,
ADC_ADDRB3=1074659372,
ADC_ADDRB4=1074659376,
ADC_ADDRB5=1074659380,
ADC_ADDRB6=1074659384,
ADC_ADDRB7=1074659388,
ADC_ADCR=1074659392,
ADC_ADCHISELR=1074659396,
ADC_ADSSTR=1074659400,
ADC_ADSTPFR=1074659404,
ADC_ADIFOVR=1074659408,
ADC_ADSPOVFR=1074659412,
ADC_ADSPCRA0=1074659416,
ADC_ADSPCRA1=1074659420,
ADC_ADSPCRA2=1074659424,
ADC_ADSPCRA3=1074659428,
ADC_ADSPCRA4=1074659432,
ADC_ADSPCRA5=1074659436,
ADC_ADSPCRA6=1074659440,
ADC_ADSPCRA7=1074659444,
ADC_ADSPCRB0=1074659448,
ADC_ADSPCRB1=1074659452,
ADC_ADSPCRB2=1074659456,
ADC_ADSPCRB3=1074659460,
ADC_ADSPCRB4=1074659464,
ADC_ADSPCRB5=1074659468,
ADC_ADSPCRB6=1074659472,
ADC_ADSPCRB7=1074659476,
ADC_ADITSSELR=1074659480,
ADC_ADSMSELR=1074659492,
ADC_ADCMPR0=1074659496,
ADC_ADCMPR1=1074659500,
ADC_ADSR0=1074659504,
ADC_ADSR1=1074659508,
ADC_ADTCR=1074659512,
ACMP_ACMP0CR=1074593792,
ACMP_ACMP1CR=1074593796,
ACMP_ACMP2CR=1074593800,
ACMP_ACMPSR=1074593804,
OPA_OPACR=1074724864,
OPA_OPASR=1074724868,
FMC_ISPCON=1342226432,
FMC_ISPADR=1342226436,
FMC_ISPDAT=1342226440,
FMC_ISPCMD=1342226444,
FMC_ISPTRG=1342226448,
FMC_DFBADR=1342226452,
FMC_FATCON=1342226456,
FMC_ISPSTA=1342226496,
}
g_NM15xx_regs=REG
function read_NM1500_Registers(e,e,e,e)
local e={}
e["GCR_P0_MFP"],
e["GCR_P1_MFP"],
e["GCR_P2_MFP"],
e["GCR_P3_MFP"],
e["GCR_P4_MFP"],
e["GCR_P5_MFP"],
e["GCR_P6_MFP"],
e["GCR_P7_MFP"],
e["GCR_P8_MFP"],
e["GCR_P9_MFP"],
e["GCR_PA_MFP"]=ice:ReadMem32(g_NM15xx_regs.GCR_P0_MFP,11)
e["GP0_Px_PMD"],
e["GP0_Px_OFFD"],
e["GP0_Px_DOUT"],
e["GP0_Px_DMASK"],
e["GP0_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP0_Px_PMD,5)
e["GP1_Px_PMD"],
e["GP1_Px_OFFD"],
e["GP1_Px_DOUT"],
e["GP1_Px_DMASK"],
e["GP1_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP1_Px_PMD,5)
e["GP2_Px_PMD"],
e["GP2_Px_OFFD"],
e["GP2_Px_DOUT"],
e["GP2_Px_DMASK"],
e["GP2_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP2_Px_PMD,5)
e["GP3_Px_PMD"],
e["GP3_Px_OFFD"],
e["GP3_Px_DOUT"],
e["GP3_Px_DMASK"],
e["GP3_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP3_Px_PMD,5)
e["GP4_Px_PMD"],
e["GP4_Px_OFFD"],
e["GP4_Px_DOUT"],
e["GP4_Px_DMASK"],
e["GP4_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP4_Px_PMD,5)
e["GP5_Px_PMD"],
e["GP5_Px_OFFD"],
e["GP5_Px_DOUT"],
e["GP5_Px_DMASK"],
e["GP5_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP5_Px_PMD,5)
e["GP6_Px_PMD"],
e["GP6_Px_OFFD"],
e["GP6_Px_DOUT"],
e["GP6_Px_DMASK"],
e["GP6_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP6_Px_PMD,5)
e["GP7_Px_PMD"],
e["GP7_Px_OFFD"],
e["GP7_Px_DOUT"],
e["GP7_Px_DMASK"],
e["GP7_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP7_Px_PMD,5)
e["GP8_Px_PMD"],
e["GP8_Px_OFFD"],
e["GP8_Px_DOUT"],
e["GP8_Px_DMASK"],
e["GP8_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP8_Px_PMD,5)
e["GP9_Px_PMD"],
e["GP9_Px_OFFD"],
e["GP9_Px_DOUT"],
e["GP9_Px_DMASK"],
e["GP9_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP9_Px_PMD,5)
e["GP10_Px_PMD"],
e["GP10_Px_OFFD"],
e["GP10_Px_DOUT"],
e["GP10_Px_DMASK"],
e["GP10_Px_PIN"]=ice:ReadMem32(g_NM15xx_regs.GP10_Px_PMD,5)
e["CLK_PWRCON"],
e["CLK_AHBCLK"],
e["CLK_APBCLK"],
e["CLK_CLKSTATUS"],
e["CLK_CLKSEL0"],
e["CLK_CLKSEL1"],
e["CLK_CLKDIV"],
e["CLK_CLKSEL2"],
e["CLK_PLLCON"],
e["CLK_FRQDIV"]=ice:ReadMem32(g_NM15xx_regs.CLK_PWRCON,10)
e["UART0_UA_BAUD"],
e["UART1_UA_BAUD"]=ice:ReadMemMulti(g_NM15xx_regs.UART0_UA_BAUD,
g_NM15xx_regs.UART1_UA_BAUD)
e["SPI0_SPI_CNTRL"],
e["SPI0_SPI_DIVIDER"],
e["SPI0_SPI_CNTRL2"]=ice:ReadMemMulti(g_NM15xx_regs.SPI0_SPI_CNTRL,
g_NM15xx_regs.SPI0_SPI_DIVIDER,
g_NM15xx_regs.SPI0_SPI_CNTRL2)
e["SPI1_SPI_CNTRL"],
e["SPI1_SPI_DIVIDER"],
e["SPI1_SPI_CNTRL2"]=ice:ReadMemMulti(g_NM15xx_regs.SPI1_SPI_CNTRL,
g_NM15xx_regs.SPI1_SPI_DIVIDER,
g_NM15xx_regs.SPI1_SPI_CNTRL2)
e["SPI2_SPI_CNTRL"],
e["SPI2_SPI_DIVIDER"],
e["SPI2_SPI_CNTRL2"]=ice:ReadMemMulti(g_NM15xx_regs.SPI2_SPI_CNTRL,
g_NM15xx_regs.SPI2_SPI_DIVIDER,
g_NM15xx_regs.SPI2_SPI_CNTRL2)
e["TMR01_TCSR0"],
e["TMR01_TCSR1"],
e["TMR23_TCSR2"],
e["TMR23_TCSR3"]=ice:ReadMemMulti(g_NM15xx_regs.TMR01_TCSR0,
g_NM15xx_regs.TMR01_TCSR1,
g_NM15xx_regs.TMR23_TCSR2,
g_NM15xx_regs.TMR23_TCSR3)
e["I2C0_I2CON"],
e["I2C0_I2CLK"]=ice:ReadMemMulti(g_NM15xx_regs.I2C0_I2CON,
g_NM15xx_regs.I2C0_I2CLK)
e["OPA_OPACR"],
e["CAP0_CAP_CTR0"],
e["CAP1_CAP_CTR0"]=ice:ReadMemMulti(g_NM15xx_regs.OPA_OPACR,
g_NM15xx_regs.CAP0_CAP_CTR0,
g_NM15xx_regs.CAP1_CAP_CTR0)
e["QEI0_QEI_CTR"],
e["QEI1_QEI_CTR"],
e["CAN0_CAN_BTIME"],
e["CAN0_CAN_BRPE"]=ice:ReadMemMulti(g_NM15xx_regs.QEI0_QEI_CTR,
g_NM15xx_regs.QEI1_QEI_CTR,
g_NM15xx_regs.CAN0_CAN_BTIME,
g_NM15xx_regs.CAN0_CAN_BRPE)
e["BPWM_CSR"],
e["BPWM_PPR"],
e["EPWM0_PWMCON"],
e["EPWM1_PWMCON"]=ice:ReadMemMulti(g_NM15xx_regs.BPWM_CSR,
g_NM15xx_regs.BPWM_PPR,
g_NM15xx_regs.EPWM0_PWMCON,
g_NM15xx_regs.EPWM1_PWMCON)
return e
end
local n={
[0]=kPinDirection_In,
[1]=kPinDirection_PushPullOut,
[2]=kPinDirection_OpenDrainOut,
[3]=kPinDirection_Bi,
}
local a={
[0]="INPUT",
[1]="OUTPUT",
[2]="Open-Drain",
[3]="Quasi-bidirection",
}
function get_mfp_regs(t,e)
local e={string.format("GCR_P%X_MFP",e)}
if#e>1 then
return reg2str("Multi-Function registers",g_NM15xx_regs,t,e)
else
return reg2str("Multi-Function register",g_NM15xx_regs,t,e)
end
end
function fill_NM1500_GPIO(o,s,t,e,l)
if l==nil then l=string.format("P%X.%d",t,e)end
local i=s[string.format("GCR_P%X_MFP",t)]
local i=s[string.format("GP%d_Px_PMD",t)]
local u=s[string.format("GP%d_Px_OFFD",t)]
local r=s[string.format("GP%d_Px_DOUT",t)]
local h=s[string.format("GP%d_Px_DMASK",t)]
local d=s[string.format("GP%d_Px_PIN",t)]
o["highlight_text"]=string.format("P%X.%d",t,e)
o["normal_color"]=kColor_Invalid
o["highlight_color"]=kColor_GPIO
o["pin_bg_color"]=kBgColor_GPIO
local i=ext.band(ext.rshift(i,e*2),3)
o["direction"]=n[i]
if n[i]==kPinDirection_In
or n[i]==kPinDirection_Bi then
if ext.band(d,ext.lshift(1,e))==0 then
o["status"]=kPinStatus_Low
else
o["status"]=kPinStatus_High
end
else
if ext.band(h,ext.lshift(1,e))~=0 then
o["status"]=kPinStatus_Unknown
elseif ext.band(r,ext.lshift(1,e))==0 then
o["status"]=kPinStatus_Low
else
o["status"]=kPinStatus_High
end
end
local a=string.format("P%X.%d is in %s mode
",
t,e,a[i])
if n[i]==kPinDirection_In
or n[i]==kPinDirection_Bi then
if ext.band(d,ext.lshift(1,e))==0 then
a=a.."Pin input low
"
else
a=a.."Pin input high
"
end
end
if n[i]==kPinDirection_PushPullOut
or n[i]==kPinDirection_OpenDrainOut
or n[i]==kPinDirection_Bi then
if ext.band(h,ext.lshift(1,e))~=0 then
a=a.."Pin output masked
"
elseif ext.band(r,ext.lshift(1,e))==0 then
a=a.."Pin output low
"
else
a=a.."Pin output high
"
end
end
if ext.band(u,ext.lshift(1,e+16))==0 then
a=a.."IO digital input path enabled
"
else
a=a.."IO digital input path disabled(digital input tied to low)
"
end
local h=""
if n[i]==kPinDirection_PushPullOut
or n[i]==kPinDirection_Bi then
if ext.band(r,ext.lshift(1,e))==0 and ext.band(d,ext.lshift(1,e))~=0 then
h=string.format("Leakage warning: P%d_DOUT[%d] = 0, P%d_PIN[%d] = 1
",t,e,t,e)
elseif ext.band(r,ext.lshift(1,e))~=0 and ext.band(d,ext.lshift(1,e))==0 then
h=string.format("Leakage warning: P%d_DOUT[%d] = 1, P%d_PIN[%d] = 0
",t,e,t,e)
end
end
if h~=""then
o["pin_no_color"]=kBgColor_Error
h=""..h..""
end
local e={
string.format("GP%d_Px_PMD",t),
string.format("GP%d_Px_OFFD",t),
string.format("GP%d_Px_DOUT",t),
string.format("GP%d_Px_DMASK",t),
string.format("GP%d_Px_PIN",t)}
local e=reg2str("GPIO setting registers",g_NM15xx_regs,s,e)
o["information"]=string.format("%s
%s
"..
"%s%s"..
"Information
"..
"%s",
l,
h,
get_mfp_regs(s,t),
e,
a)
end
function fill_invalid_GPIO(e,o,t,a)
e["highlight_text"]=string.format("P%X.%d",t,a)
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_Invalid
e["pin_bg_color"]=kBgColor_Invalid
e["direction"]=kPinDirection_Unknown
e["status"]=kPinStatus_Unknown
e["pin_no_color"]=kBgColor_Error
local i="Undefined setting in Multi-Function register for this pin
"
e["information"]=string.format("P%X.%d
%s
"..
"%s",
t,a,
i,
get_mfp_regs(o,t))
end
function get_XTL12M_clock(a,o)
local t
local e
table.insert(o,"CLK_PWRCON")
local a=ext.band(a["CLK_PWRCON"],1)
if a==1 then
t=12000000
e="external input, when external input clock is 12M"
else
t=0
e="invalid external clock (see PWRCON[0].XTL12M_EN)"
end
return t,e
end
function get_OSC22M_clock(o,a)
local e
local t
table.insert(a,"CLK_PWRCON")
local a=ext.band(o["CLK_PWRCON"],4)
if a==0 then
e=0
t="invalid internal 22.1184MHz oscillator clock (see PWRCON[2].OSC22M_EN)"
else
e=22118400
t="internal 22.1184MHz oscillator clock"
end
return e,t
end
function get_OSC10K_clock(o,a)
local e
local t
table.insert(a,"CLK_PWRCON")
local a=ext.band(o["CLK_PWRCON"],8)
if a==0 then
e=0
t="invalid internal 10kHz oscillator clock (see PWRCON[3].OSC10K_EN)"
else
e=10000
t="internal 10kHz oscillator clock"
end
return e,t
end
function get_PLL_clock(a,o)
local t
local e
table.insert(o,"CLK_PLLCON")
if ext.band(a["CLK_PLLCON"],65536)~=0 then
t=0
e="invalid PLL clock, PLL is in power down mode (see PLLCON[16].PD)"
else
if ext.band(a["CLK_PLLCON"],524288)~=0 then
t,e=get_OSC22M_clock(a,o)
else
t,e=get_XTL12M_clock(a,o)
end
if t~=0 then
if ext.band(a["CLK_PLLCON"],131072)~=0 then
e=string.format("PLL clock (%sHz), bypassed from %s",val2str(t),e)
else
local o={1,2,2,4}
local i=ext.band(a["CLK_PLLCON"],511)+2
local n=ext.rshift(ext.band(a["CLK_PLLCON"],15872),9)+2
local a=o[ext.rshift(ext.band(a["CLK_PLLCON"],49152),14)+1]
t=t*i/n/a
e=string.format("PLL clock (%sHz), from %s",val2str(t),e)
end
else
e="PLL clock from "..e
end
end
return t,e
end
function get_sys_clock(o,a,n)
table.insert(a,"CLK_CLKSEL0")
local i=ext.band(o["CLK_CLKSEL0"],7)
local e
local t
if i==0 then
e,t=get_XTL12M_clock(o,a)
elseif i==2 then
e,t=get_PLL_clock(o,a)
elseif i==3 then
e,t=get_OSC10K_clock(o,a)
elseif i==7 then
e,t=get_OSC22M_clock(o,a)
else
e=0
t="invalid "..n.." clock (see CLKSEL0[2:0].HCLK_S)"
return e,t
end
if e==0 then
t=""..n.." clock from "..t
else
table.insert(a,"CLK_CLKDIV")
local a=ext.band(o["CLK_CLKDIV"],15)
e=e/(a+1)
t=string.format("%s clock (%sHz), from %s",n,val2str(e),t)
end
return e,t
end
function get_HCLK_clock(t,e)
return get_sys_clock(t,e,"HCLK")
end
function get_PCLK_clock(e,t)
return get_sys_clock(e,t,"PCLK")
end
function get_clk_informnation(t,e)
return reg2str("Clock setting registers",g_NM15xx_regs,t,e)
end
function fill_NM1500_UART(a,e,d,t,r,n)
local i=""
local t=""
local o={}
local s=0
a["highlight_text"]=r
a["normal_color"]=kColor_Invalid
a["highlight_color"]=kColor_UART
a["pin_bg_color"]=kBgColor_UART
a["direction"]=kPinDirection_Unknown
a["status"]=kPinStatus_Unknown
function get_uart_baudate(s)
local i=string.format("UART%d",n)
local t=string.format("UART%d_UA_BAUD",n)
table.insert(o,t)
local o=ext.band(e[t],536870912)
local n=ext.band(e[t],268435456)
local h=ext.rshift(ext.band(e[t],251658240),24)
local e=ext.band(e[t],65535)
local a=0
local t=""
if o==0 and n==0 then
a=s/(16*(e+2))
elseif o~=0 and n==0 then
if h>=8 then
a=s/((h+1)*(e+2))
else
t="invalid "..i.."'s UA_BAUD value, DIVIDER_X must >= 8"
end
elseif o~=0 and n~=0 then
if e>=3 then
a=s/(e+2)
else
t="invalid "..i.."'s UA_BAUD value, BRD must >= 3"
end
else
t="invalid "..i.."'s UA_BAUD value"
end
return a,t
end
table.insert(o,"CLK_APBCLK")
if ext.band(e["CLK_APBCLK"],ext.lshift(65536,n))~=0 then
table.insert(o,"CLK_CLKSEL1")
local h=ext.band(ext.rshift(e["CLK_CLKSEL1"],24),3)
local r=ext.band(ext.rshift(e["CLK_CLKDIV"],8),15)
local n
local a
if h==0 then
n,a=get_XTL12M_clock(e,o)
elseif h==1 then
n,a=get_PLL_clock(e,o)
elseif h==3 then
n,a=get_OSC22M_clock(e,o)
else
t="UART clock is not available (see CLKSEL1[25:24].UART_S).
"
end
if t==""then
s=n/(r+1)
if s~=0 then
table.insert(o,"CLK_CLKDIV")
i=string.format("UART clock frequency: %sHz, from %s.
",val2str(s),a)
else
t=string.format("UART clock is not available, %s.
",a)
end
end
else
t=string.format("UART%d clock is not available (see APBCLK[%d].UART%d_EN).
",
n,n+16,n)
end
if t==""then
local e,a=get_uart_baudate(s)
if e~=0 then
i=i..string.format("UART baudrate: %d
",e)
else
t=a..".
"
end
end
if t~=""then
t=""..t..""
a["pin_no_color"]=kBgColor_Error
end
if i~=""then
i="Information
"..i
end
a["information"]=string.format(
"%s
%s
%s%s%s",
r,
t,
get_mfp_regs(e,d),
get_clk_informnation(e,o),
i)
end
function fill_NM1500_Normal(e,o,a,i,t)
local n=""
e["highlight_text"]=t
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_Normal
e["pin_bg_color"]=kBgColor_Normal
e["direction"]=kPinDirection_Unknown
e["status"]=kPinStatus_Unknown
n=t.."
"
if a==nil or i==nil then
e["information"]=string.format(
"%s
",
t)
else
e["information"]=string.format(
"%s
"..
"%s",
t,
get_mfp_regs(o,a))
end
end
function fill_NM1500_SPI(a,o,d,t,h,e)
local t=""
local i=""
local n={}
a["highlight_text"]=h
a["normal_color"]=kColor_Invalid
a["highlight_color"]=kColor_SPI
a["pin_bg_color"]=kBgColor_SPI
a["direction"]=kPinDirection_Unknown
a["status"]=kPinStatus_Unknown
table.insert(n,"CLK_APBCLK")
if ext.band(o["CLK_APBCLK"],ext.lshift(4096,e))~=0 then
local s,h=get_PCLK_clock(o,n)
if s~=0 then
local r=string.format("SPI%d_SPI_CNTRL",e)
local i=string.format("SPI%d_SPI_CNTRL2",e)
local a=string.format("SPI%d_SPI_DIVIDER",e)
table.insert(n,r)
local r=ext.band(o[r],262144)
if r~=0 then
t="SPI is in slave mode.
"
else
t="SPI is in master mode.
"
table.insert(n,i)
table.insert(n,a)
local i=ext.band(o[i],2147483648)
local o=ext.band(o[a],255)
local a=0
if i~=0 then
a=s/(o+1)
else
a=s/((o+1)*2)
end
t=t..string.format("SPI%d clock frequency: %sHz, from %s.
",
e,val2str(a),h)
end
else
i=string.format("SPI%d clock is not available, %s.
",e,h)
end
else
i=string.format("SPI%d clock is not available (see APBCLK[%d].SPI%d_EN).
",e,e+12,e)
end
if i~=""then
i=""..i..""
a["pin_no_color"]=kBgColor_Error
end
if t~=""then
t="Information
"..t
end
a["information"]=string.format(
"%s
%s
%s%s%s",
h,
i,
get_mfp_regs(o,d),
get_clk_informnation(o,n),
t)
end
function fill_NM1500_SPI_IO(e,a,o,t)
local o=string.format("SPI%d_SPI_CNTRL",o)
local a=ext.band(a[o],262144)
if a==0 then
if t then
e["direction"]=kPinDirection_In
else
e["direction"]=kPinDirection_PushPullOut
end
else
if t then
e["direction"]=kPinDirection_PushPullOut
else
e["direction"]=kPinDirection_In
end
end
end
function fill_NM1500_TM(t,i,r,a,h,e)
local a=""
local o=""
local n={}
t["highlight_text"]=h
t["normal_color"]=kColor_Invalid
t["highlight_color"]=kColor_TM
t["pin_bg_color"]=kBgColor_TM
t["direction"]=kPinDirection_Unknown
t["status"]=kPinStatus_Unknown
table.insert(n,"CLK_APBCLK")
local s=ext.band(i["CLK_APBCLK"],ext.lshift(4,e))
if s~=0 then
local t=string.format("TMR%d%d_TCSR%d",ext.rshift(e,1)*2,ext.rshift(e,1)*2+1,e)
local s=ext.band(i[t],16777216)
table.insert(n,t)
if s~=0 then
a=string.format("Timer%d external counter mode enabled.
",e)
else
local t
local s
t,s=get_HCLK_clock(i,n)
if t~=0 then
a=string.format("Timer%d clock frequency: %sHz, from %s
",
e,val2str(t),s)
else
o=string.format("Timer%d clock is not available, %s.
",e,s)
end
end
else
o=string.format("Timer%d clock is disabled (see APBCLK[%d].TMR%d_EN).
",e,e+2,e)
end
if o~=""then
o=""..o..""
t["pin_no_color"]=kBgColor_Error
end
if a~=""then
a="Information
"..a
end
t["information"]=string.format(
"%s
%s
%s%s%s",
h,
o,
get_mfp_regs(i,r),
get_clk_informnation(i,n),
a)
end
function fill_NM1500_CLKO(a,e,r,t,h)
local i=""
local t=""
local o={}
a["highlight_text"]=h
a["normal_color"]=kColor_Invalid
a["highlight_color"]=kColor_CLK
a["pin_bg_color"]=kBgColor_CLK
a["direction"]=kPinDirection_PushPullOut
a["status"]=kPinStatus_Unknown
table.insert(o,"CLK_APBCLK")
if ext.band(e["CLK_APBCLK"],64)~=0 then
table.insert(o,"CLK_FRQDIV")
if ext.band(e["CLK_FRQDIV"],16)~=0 then
table.insert(o,"CLK_CLKSEL2")
local s=ext.rshift(ext.band(e["CLK_CLKSEL2"],12),2)
local h=ext.band(e["CLK_FRQDIV"],15)
local n
local a
if s==0 then
n,a=get_XTL12M_clock(e,o)
elseif s==2 then
n,a=get_HCLK_clock(e,o)
elseif s==3 then
n,a=get_OSC22M_clock(e,o)
else
t="Frequency divider is not available (see CLKSEL2[3:2].FRQDIV_S).
"
end
if t==""then
local e=n/ext.lshift(1,(h+1))
if e~=0 then
i=string.format("FRQDIV clock frequency: %sHz, from %s.
",val2str(e),a)
else
t="FRQDIV clock is not available, "..a..".
"
end
end
else
t="Frequency divider disabled (see FRQDIV[4].DIVIDER_EN).
"
end
else
t="FRQDIV clock is not available (see APBCLK[6].FDIV_EN).
"
end
if t~=""then
t=""..t..""
a["pin_no_color"]=kBgColor_Error
end
if i~=""then
i="Information
"..i
end
a["information"]=string.format(
"%s
%s
%s%s%s",
h,
t,
get_mfp_regs(e,r),
get_clk_informnation(e,o),
i)
end
function fill_NM1500_I2C(e,a,s,t,n)
local o=""
local t=""
local i={}
e["highlight_text"]=n
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_I2C
e["pin_bg_color"]=kBgColor_I2C
e["direction"]=kPinDirection_Unknown
e["status"]=kPinStatus_Unknown
table.insert(i,"CLK_APBCLK")
if ext.band(a["CLK_APBCLK"],256)~=0 then
table.insert(i,"I2C0_I2CON")
local e=ext.band(a["I2C0_I2CON"],64)
if e~=0 then
local n,e=get_PCLK_clock(a,i)
if n~=0 then
table.insert(i,"I2C0_I2CLK")
local t=ext.band(a["I2C0_I2CLK"],255)
local t=n/(4*(t+1))
o=string.format("I2C clock frequency: %sHz, from %s.
",val2str(t),e)
else
t=string.format("I2C clock is not available, %s.
",e)
end
else
t="I2C controller disabled (see I2CON[6].ENS1).
"
end
else
t="I2C clock is not available (see APBCLK[8].I2C_EN).
"
end
if t~=""then
t=""..t..""
e["pin_no_color"]=kBgColor_Error
end
if o~=""then
o="Information
"..o
end
e["information"]=string.format(
"%s
%s
%s%s%s",
n,
t,
get_mfp_regs(a,s),
get_clk_informnation(a,i),
o)
end
function fill_NM1500_ADC(e,o,h,t,n)
local a=""
local t=""
local i={}
e["highlight_text"]=n
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_ADC
e["pin_bg_color"]=kBgColor_ADC
e["direction"]=kPinDirection_In
e["status"]=kPinStatus_Unknown
table.insert(i,"CLK_APBCLK")
local s=ext.rshift(ext.band(o["CLK_APBCLK"],268435456),28)
if s~=0 then
local n
local e
n,e=get_HCLK_clock(o,i)
local o=ext.rshift(ext.band(o["CLK_CLKDIV"],16711680),16)
local o=n/(o+1)
if o~=0 then
table.insert(i,"CLK_CLKDIV")
a=string.format("ADC clock frequency: %sHz, from %s.
",val2str(o),e)
else
t="ADC clock is not available, "..e..".
"
end
else
t="ADC clock is not available (see APBCLK[28].ADC_EN).
"
end
if t~=""then
t=""..t..""
e["pin_no_color"]=kBgColor_Error
end
if a~=""then
a="Information
"..a
end
e["information"]=string.format(
"%s
%s
%s%s%s",
n,
t,
get_mfp_regs(o,h),
get_clk_informnation(o,i),
a)
return{name=n,warn=t,clk_regs=i,info=a,clk_en=s}
end
function fill_NM1500_ACMP(e,a,s,t,o,t)
local t=""
local i={}
e["highlight_text"]=o
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_CMP
e["pin_bg_color"]=kBgColor_CMP
e["direction"]=kPinDirection_In
e["status"]=kPinStatus_Unknown
table.insert(i,"CLK_APBCLK")
local n=ext.band(a["CLK_APBCLK"],4194304)
if n==0 then
t="ACMP clock is not available (see APBCLK[22].ACMP_EN).
"
t=""..t..""
e["pin_no_color"]=kBgColor_Error
end
e["information"]=string.format(
"%s
%s
"..
"%s%s",
o,
t,
get_mfp_regs(a,s),
get_clk_informnation(a,i))
return{name=o,warn=t,clk_regs=i,info="",clk_en=n}
end
function fill_NM1500_OPA(e,o,s,t,n,a)
local t=""
local i={}
e["highlight_text"]=n
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_OPA
e["pin_bg_color"]=kBgColor_OPA
e["direction"]=kPinDirection_In
e["status"]=kPinStatus_Unknown
table.insert(i,"CLK_APBCLK")
local h=ext.band(o["CLK_APBCLK"],536870912)
if h==0 then
t="OPA clock is not available (see APBCLK[29].OPA_EN).
"
else
table.insert(i,"OPA_OPACR")
local e=ext.band(o["OPA_OPACR"],ext.lshift(1,a))
if e==0 then
t=string.format("OP Amplifier %d disabled (see OPACR[%d].OP%d_EN).
",a,a,a)
end
end
if t~=""then
t=""..t..""
e["pin_no_color"]=kBgColor_Error
end
e["information"]=string.format(
"%s
%s
"..
"%s%s",
n,
t,
get_mfp_regs(o,s),
get_clk_informnation(o,i))
end
function fill_NM1500_CAP(e,i,d,a,r,t,a)
local o=""
local a=""
local n={}
e["highlight_text"]=r
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_CAP
e["pin_bg_color"]=kBgColor_CAP
e["direction"]=kPinDirection_In
e["status"]=kPinStatus_Unknown
table.insert(n,"CLK_APBCLK")
if ext.band(i["CLK_APBCLK"],ext.lshift(67108864,t))~=0 then
local s
local e
s,e=get_HCLK_clock(i,n)
if s~=0 then
local h=string.format("CAP%d_CAP_CTR0",t)
table.insert(n,h)
local i=ext.band(i[h],536870912)
if i~=0 then
o=string.format("CAP%d clock frequency: %sHz, from %s.
",t,val2str(s),e)
else
a=string.format("Input capture function disabled (see CAP%d.CAP_CTR0[29].CAP_EN).
",t)
end
else
a=string.format("CAP%d clock is not available, %s.
",t,e)
end
else
a=string.format("CAP%d clock is not available (see APBCLK1[%d].CAP%d_EN).
",t,t+26,t)
end
if a~=""then
a=""..a..""
e["pin_no_color"]=kBgColor_Error
end
if o~=""then
o="Information
"..o
end
e["information"]=string.format(
"%s
%s
%s%s%s",
r,
a,
get_mfp_regs(i,d),
get_clk_informnation(i,n),
o)
end
function fill_NM1500_QEI(t,i,d,a,r,e)
local o=""
local a=""
local n={}
t["highlight_text"]=r
t["normal_color"]=kColor_Invalid
t["highlight_color"]=kColor_QEI
t["pin_bg_color"]=kBgColor_QEI
t["direction"]=kPinDirection_In
t["status"]=kPinStatus_Unknown
table.insert(n,"CLK_APBCLK")
if ext.band(i["CLK_APBCLK"],ext.lshift(1073741824,e))~=0 then
local s
local t
s,t=get_HCLK_clock(i,n)
if s~=0 then
local h=string.format("QEI%d_QEI_CTR",e)
table.insert(n,h)
local i=ext.band(i[h],536870912)
if i~=0 then
o=o..string.format("QEI%d clock frequency: %sHz, from %s.
",e,val2str(s),t)
else
a=string.format("QEI%d controller function disabled (see QEI%d.QEI_CTR[29].QEI_EN).
",e,e)
end
else
a=string.format("QEI%d clock is not available, %s.
",e,t)
end
else
a=string.format("QEI%d clock is not available (see APBCLK1[%d].QEI%d_EN).
",e,e+30,e)
end
if a~=""then
a=""..a..""
t["pin_no_color"]=kBgColor_Error
end
if o~=""then
o="Information
"..o
end
t["information"]=string.format(
"%s
%s
%s%s%s",
r,
a,
get_mfp_regs(i,d),
get_clk_informnation(i,n),
o)
end
function fill_NM1500_BPWM(e,a,r,t,h,t,n)
local o=""
local t=""
local i={}
e["highlight_text"]=h
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_PWM
e["pin_bg_color"]=kBgColor_PWM
e["direction"]=kPinDirection_Unknown
e["status"]=kPinStatus_Unknown
table.insert(i,"CLK_APBCLK")
local s=ext.band(a["CLK_APBCLK"],524288)
if s~=0 then
local s
local e
s,e=get_HCLK_clock(a,i)
if s==0 then
t=string.format("BPWM clock is not available, %s.
",e)
else
table.insert(i,"BPWM_CSR")
table.insert(i,"BPWM_PPR")
local i=ext.band(ext.rshift(a["BPWM_CSR"],4*n),7)
local i=({2,4,8,16,1,0,0,0})[i+1]
local a=ext.band(a["BPWM_PPR"],255)
if a==0 then
t="BPWM counter will be stopped since BPWM_PPR[7:0].CP01 = 0
"
elseif i==0 then
t=string.format("BPWM counter clock is not available (see BPWM_CSR[%d:%d].CSR%d).
",
n*4+2,n*4,n)
else
local t=s/(a+1)
local a=t/i
o=string.format("BPWM clock frequency: %sHz (Pre-Scaled), from %s.
"..
"BPWM counter frequency: %sHz
",
val2str(t),e,val2str(a))
end
end
else
t="BPWM clock is not available (see APBCLK[19].BPWM_EN).
"
end
if t~=""then
t=""..t..""
e["pin_no_color"]=kBgColor_Error
end
if o~=""then
o="Information
"..o
end
e["information"]=string.format(
"%s
%s
%s%s%s",
h,
t,
get_mfp_regs(a,r),
get_clk_informnation(a,i),
o)
end
function fill_NM1500_EPWM(e,o,d,a,r,t)
local i=""
local a=""
local n={}
e["highlight_text"]=r
e["normal_color"]=kColor_Invalid
e["highlight_color"]=kColor_PWM
e["pin_bg_color"]=kBgColor_PWM
e["direction"]=kPinDirection_Unknown
e["status"]=kPinStatus_Unknown
table.insert(n,"CLK_APBCLK")
local s=ext.band(o["CLK_APBCLK"],ext.lshift(1048576,t))
if s~=0 then
local h
local s
h,s=get_HCLK_clock(o,n)
if h==0 then
a=string.format("EPWM%s clock is not available, %s.
",t,s)
else
local e=string.format("EPWM%d_PWMCON",t)
table.insert(n,e)
local n=ext.band(o[e],128)
if n~=0 then
local e=ext.rshift(ext.band(o[e],12),2)
local e=h/({1,2,4,16})[e+1]
i=string.format("EPWM%s clock frequency: %sHz, from %s
",
t,val2str(e),s)
else
a=string.format("EPWM%s stops running (see PWMCON[7].PWMRUN).
",t)
end
end
else
a=string.format("EPWM%s clock is not available (see APBCLK[%d].EPWM%s_EN).
",
t,t+20,t)
end
if a~=""then
a=""..a..""
e["pin_no_color"]=kBgColor_Error
end
if i~=""then
i="Information
"..i
end
e["information"]=string.format(
"%s
%s
"..
"%s%s%s",
r,
a,
get_mfp_regs(o,d),
get_clk_informnation(o,n),
i)
end
function fill_NM1500_CAN(t,e,h,a,s)
local i=""
local a=""
local o={}
t["highlight_text"]=s
t["normal_color"]=kColor_Invalid
t["highlight_color"]=kColor_CAN
t["pin_bg_color"]=kBgColor_CAN
t["status"]=kPinStatus_Unknown
function get_can_bitrate(i)
table.insert(o,"CAN0_CAN_BTIME")
table.insert(o,"CAN0_CAN_BRPE")
local a=ext.band(ext.rshift(e["CAN0_CAN_BTIME"],8),15)
local t=ext.band(ext.rshift(e["CAN0_CAN_BTIME"],12),7)
local e=
ext.bor(ext.band(e["CAN0_CAN_BTIME"],63),
ext.lshift(ext.band(e["CAN0_CAN_BRPE"],15),6))
local e=i/(e+1)/(a+t+3)/1000
return e
end
table.insert(o,"CLK_APBCLK")
if ext.band(e["CLK_APBCLK"],16777216)~=0 then
local n
local t
n,t=get_PCLK_clock(e,o)
if n~=0 then
local e=get_can_bitrate(n)
i=string.format("CAN bitrate: %sHz, from %s.
",val2str(e),t)
else
a="CAN clock is not available, "..t..".
"
end
else
a="CAN clock is not available (see APBCLK[24].CAN_EN).
"
end
if a~=""then
a=""..a..""
t["pin_no_color"]=kBgColor_Error
end
if i~=""then
i="Information
"..i
end
t["information"]=string.format(
"%s
%s
"..
"%s%s%s",
s,
a,
get_mfp_regs(e,h),
get_clk_informnation(e,o),
i)
end
function fill_NM1500_Analog(e,h,d,l,n,c,i)
local t=""
local a=""
local u={}
local s={}
local o={}
if i~=nil then
o=fill_NM1500_ACMP(s,h,d,l,n)
for t,e in ipairs(o.clk_regs)do
table.insert(u,e)
end
if o.info~=""then
if t~=""then t=t.."
"end
t=t.."ACMP "..o.info
end
a=a..(o.warn)
end
local r={}
local i={}
if c~=nil then
i=fill_NM1500_ADC(r,h,d,l,n,unpack(c))
for t,e in ipairs(i.clk_regs)do
table.insert(u,e)
end
if i.info~=""then
if t~=""then t=t.."
"end
t=t.."ADC "..i.info
end
a=a..(i.warn)
end
if o.clk_en~=0 then
e["highlight_color"]=s["highlight_color"]
e["pin_bg_color"]=s["pin_bg_color"]
e["pin_no_color"]=s["pin_no_color"]
elseif i.clk_en~=0 then
e["highlight_color"]=r["highlight_color"]
e["pin_bg_color"]=r["pin_bg_color"]
e["pin_no_color"]=r["pin_no_color"]
else
e["highlight_color"]=kColor_Normal
e["pin_bg_color"]=kBgColor_Normal
if a~=""then
e["pin_no_color"]=kBgColor_Error
end
end
e["highlight_text"]=n
e["normal_color"]=kColor_Invalid
e["direction"]=kPinDirection_Unknown
e["status"]=kPinStatus_Unknown
e["information"]=string.format(
"%s
%s
"..
"%s%s%s",
n,
a,
get_mfp_regs(h,d,l),
get_clk_informnation(h,u),
t)
end