📄 psocconfig.lis
字号:
0005 OSC_CR0_CPU_750kHz: equ 05h ; set CPU Freq bits for 750kHz Operation
0006 OSC_CR0_CPU_187d5kHz: equ 06h ; set CPU Freq bits for 187.5kHz Operation
0007 OSC_CR0_CPU_93d7kHz: equ 07h ; set CPU Freq bits for 93.7kHz Operation
0000
00E1 OSC_CR1: equ E1h ; System V1/V2 Divider Control Register (RW)
00F0 OSC_CR1_V1: equ F0h ; MASK System V1 24MHz divider
000F OSC_CR1_V2: equ 0Fh ; MASK System V2 24MHz divider
0000
0000 ;Reserved equ E2h
00E3 VLT_CR: equ E3h ; Voltage Monitor Control Register (RW)
0000
00E8 IMO_TR: equ E8h ; Internal Main Oscillator Trim Register (WO)
00E9 ILO_TR: equ E9h ; Internal Low-speed Oscillator Trim (WO)
00EA BDG_TR: equ EAh ; Band Gap Trim Register (WO)
00EB ECO_TR: equ EBh ; External Oscillator Trim Register (WO)
0000
0000
0000
0000 ;;===================================
0000 ;; M8C System Macros
0000 ;;===================================
0000
0000
0000 ;-------------------------------
0000 ; Swapping Register Banks
0000 ;-------------------------------
0000
0000 macro M8C_SetBank0
0000 and F, ~FlagXIOMask
0000 macro M8C_SetBank1
0000 or F, FlagXIOMask
0000 macro M8C_EnableGInt
0000 or F, FlagGlobalIE
0000 macro M8C_DisableGInt
0000 and F, ~FlagGlobalIE
0001 DISABLE_INT_FIX: equ 1
0000 ;---------------------------------------------------
0000 ; Use the following macros to enable/disable
0000 ; either of the two global interrupt mask registers,
0000 ; INT_MSK0 or INT_MSK1.
0000 ;
0000 ; This is a fix to a noted problem in which an
0000 ; inadvertant reset can occur if an interrupt occurs
0000 ; while clearing an interrupt mask bit.
0000 ;
0000 ; Usage: M8C_DisableIntMask INT_MSKN, MASK
0000 ; M8C_EnableIntMask INT_MSKN, MASK
0000 ;
0000 ; where INT_MSKN is INT_MSK0 or INT_MSK1 and
0000 ; MASK is the bit set to enable or disable
0000 ;-------------------------------------------------
0000 ; Disable Interrupt Bit Mask(s)
0000 macro M8C_DisableIntMask
0000 if DISABLE_INT_FIX
0000 mov A, reg[CPU_SCR] ; save the current Global interrupt state
0000 M8C_DisableGInt ; disable global interrupts
0000 endif
0000 and reg[@0], ~@1 ; disable specified interrupt enable bit
0000 if DISABLE_INT_FIX
0000 and A, CPUSCR_GIEMask ; determine if global interrupt was set
0000 jz . + 4 ; jump if global interrupt disabled
0000 M8C_EnableGInt ; set global interrupt
0000 endif
0000 macro M8C_EnableIntMask
0000 or reg[@0], @1
0000 macro M8C_EnableWatchDog
0000 ; Clearing the Power-On Reset bit starts up the Watchdog timer
0000 ; See the 25xxx/26xxx Family Datasheet, Section 9.3.4.
0000 and reg[CPU_SCR], ~CPUSCR_PORSMask & ~CPUSCR_WDRSMask
0000 macro M8C_ClearWDT
0000 mov reg[RES_WDT], 00h
0000 macro M8C_ClearWDTAndSleep
0000 mov reg[RES_WDT], 38h
0000 macro M8C_Stall
0000 or reg[ASY_CR], ASY_CR_SYNCEN
0000 macro M8C_Unstall
0000 and reg[ASY_CR], ~ASY_CR_SYNCEN
0000 macro M8C_Sleep
0000 or reg[CPU_SCR], CPUSCR_SleepMask
0000 ; The next instruction to be executed depends on the state of the
0000 ; various interrupt enable bits. If some interrupts are enabled
0000 ; and the global interrupts are disabled, the next instruction will
0000 ; be the one that follows the invocation of this macro. If global
0000 ; interrupts are also enabled then the next instruction will be
0000 ; from the interrupt vector table. If no interrupts are enabled
0000 ; then RIP.
0000 macro M8C_Stop
0000 ; In general, you probably don't want to do this, but here's how:
0000 or reg[CPU_SCR], CPUSCR_StopMask
0000 ; Next instruction to be executed is located in the interrupt
0000 ; vector table entry for Power-On Reset.
0000 macro M8C_Reset
0000 ; Restore everything to the power-on reset state.
0000 mov A, 0
0000 SSC
0000 ; Next non-supervisor instruction will be at interrupt vector 0.
0000 macro SSC
0000 db 0
0000 macro Suspend_CodeCompressor
0000 or f, 0
0000 macro Resume_CodeCompressor
0000 add sp, 0
export LoadConfigInit
export _LoadConfigInit
export LoadConfig_adcinc12_c_example
export _LoadConfig_adcinc12_c_example
export NO_SHADOW
export _NO_SHADOW
0010 FLAG_CFG_MASK: equ 10h ;M8C flag register REG address bit mask
00FF END_CONFIG_TABLE: equ ffh ;end of config table indicator
0000
AREA psoc_config(rom, rel)
0000 _LoadConfigInit:
0000 LoadConfigInit:
0000
0000 7C0004 lcall LoadConfig_adcinc12_c_example
0003
0003 7F ret
0004
0004 ;
0004 ; Load Configuration adcinc12_c_example
0004 ;
0004 _LoadConfig_adcinc12_c_example:
0004 LoadConfig_adcinc12_c_example:
0004 08 push a
0005 10 push x
0006 7110 or F, FlagXIOMask
0008 5001 mov a, 1
000A 67 asr a
000B 5000 mov A, >LoadConfigTBL_adcinc12_c_example_Bank1 ;load bank 1 table
000D 5700 mov X, <LoadConfigTBL_adcinc12_c_example_Bank1
000F 7C0021 lcall LoadConfig ;load the bank 1 values
0012 70EF and F, ~FlagXIOMask
0014 5000 mov a, 0
0016 67 asr a
0017 5000 mov A, >LoadConfigTBL_adcinc12_c_example_Bank0 ;load bank 0 table
0019 5700 mov X, <LoadConfigTBL_adcinc12_c_example_Bank0
001B 7C0021 lcall LoadConfig ;load the bank 0 values
001E 20 pop x
001F 18 pop a
0020 7F ret
0021
0021
0021 ;
0021 ; LoadConfig
0021 ;
0021 ; This function is not exported. It assumes that the address of the table
0021 ; to be loaded is contained in the X and A registers as if a romx instruction
0021 ; is the next instruction to be executed, i.e. lower address in X and uppper
0021 ; address in A. There is no return value.
0021 ;
0021 LoadConfig:
0021 3802 add SP, 2 ;set up temp vars
0023 10 push X
0024 08 push A
0025 4F mov X, SP
0026 56FC00 mov [X-4], 0
0029 D004 jnc LoadBank0Setup
002B 56FC01 mov [X-4], 1
002E LoadBank0Setup:
002E 18 pop A
002F 20 pop X
0030 LoadConfigLp:
0030 10 push X ;save config table address on stack
0031 08 push A
0032 70EF and F, ~FlagXIOMask
0034 62E300 mov reg[RES_WDT], 00h
0037 4F mov X, SP ;check for bank 1 load
0038 48FC01 tst [X-4], 1
003B A003 jz LoadingBank0
003D 7110 or F, FlagXIOMask
003F LoadingBank0:
003F 18 pop A
0040 20 pop X
0041 10 push X
0042 08 push A
0043 28 romx ;load config address
0044 39FF cmp A, END_CONFIG_TABLE ;check for end of table
0046 A01A jz EndLoadConfig ;if so, end of load
0048 4F mov X, SP ;save the address away
0049 54FD mov [X-3], A
004B 18 pop A ;retrieve the table address
004C 20 pop X
004D 75 inc X ;advance to the data byte
004E D002 jnc NoOverFlow1 ;check for overflow
0050 74 inc A ;if so, increment MSB
0051 NoOverFlow1:
0051 10 push X ;save the config table address again
0052 08 push A
0053 28 romx ;load the config data
0054 4F mov X, SP ;retrieve the config address
0055 59FD mov X, [X-3]
0057 6100 mov reg[X], A ;write the config data
0059 18 pop A ;retrieve the table address
005A 20 pop X
005B 75 inc X ;advance to the next address
005C D002 jnc NoOverFlow2 ;check for overflow
005E 74 inc A ;if so, increment MSB
005F NoOverFlow2:
005F 8FD0 jmp LoadConfigLp ;loop back
0061 EndLoadConfig:
0061 18 pop A ;clean up the stack
0062 20 pop X
0063 38FE add SP, -2
0065 7F ret
0066
0066 NO_SHADOW:
0066 _NO_SHADOW:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -