?? app.ss
字號:
// ---------------------------------------------------------------------------
// Copyright (c) 2008 Semiconductor Components Industries, LLC
// (d/b/a ON Semiconductor). All Rights Reserved.
//
// This code is the property of ON Semiconductor and may not be redistributed
// in any form without prior written permission from ON Semiconductor. The
// terms of use and warranty for this code are covered by contractual
// agreements between ON Semiconductor and the licensee.
// ---------------------------------------------------------------------------
// app.ss
// - Main application-level source file
// ---------------------------------------------------------------------------
// $Revision: 1.16 $
// $Date: 2008/10/29 18:00:25 $
// ---------------------------------------------------------------------------
#include <sk25_hw.inc>
#include <boss.inc>
#include <bat.inc>
#include "app.inc"
#include "Tone.inc"
// ---------------------------------------------------------------------------
// Application Version
// ---------------------------------------------------------------------------
// Set the global assembler symbol App_Version equal to the
// pre-processor define APP_VERSION that was defined in app.inc
.global App_Version
.equ App_Version, APP_VERSION
// ---------------------------------------------------------------------------
// Main
// ---------------------------------------------------------------------------
Mem_Start_Absolute_Segment(app_main_segment, SYSTEM_MEMORY_TYPE_P, 0x1000)
.global main
main:
// Clear the status register
CLR ST
BRA start_app
// Put the application version in P memory at address 0x1003
.data App_Version
// Put the tone generation version in P memory
.data Tone_Version
start_app:
// Set up stack pointers
LDI R3, SYS_STACK_TOP
LDI R7, USR_STACK_TOP
// For development purposes, disable restricted mode to make it easier
// to download a new application.
// REMOVE THESE LINES IN YOUR FINAL APPLICATION IF YOU REQUIRE
// RESTRICTED MODE
LDI R4, D_ACCESS_CFG
RES (R4), ACCESS_CFG_ACCESS_MODE_POS
// Call the application's initialization routine
CALL App_Initialize
// Call any algorithm-specific initialization routines here
CALL Tone_Initialize
// Turn on overflow protection in Status Register
SET ST, ST_OP
// Configure and start the IOP
Set_IOP_Cfg(IOP_CFG)
// Clear any interrupt requests that may be pending
Interrupt_Ack(INT_ACK_ALL_INTS)
// Enable interrupts
Enable_Int
// ---------------------------------------------------------------------------
// Main loop
// ---------------------------------------------------------------------------
mainloop:
// Disable interrupts while checking flags
Disable_Int
// Check the interrupt flags
LD A, XL_INTERRUPT_FLAGS, X
// Check IOP interrupt done flag
TST AH, IOP_INTERRUPT_FLAG
BRA iop_done, NZ
// Check the WOLA interrupt flag
TST AH, WOLA_INTERRUPT_FLAG
BRA process_wola_interrupt, NZ
// Refresh the Watchdog
Watchdog_Refresh
// Re-enable interrupts and sleep until an interrupt is received.
SLEEP IE
// Loop back to see which interrupt has occurred
BRA mainloop
// ---------------------------------------------------------------------------
// IOP done
// ---------------------------------------------------------------------------
iop_done:
// Clear the IOP done flag
RES AH, IOP_INTERRUPT_FLAG
LD XL_INTERRUPT_FLAGS, A, X
// Re-enable interrupts
Enable_Int
// Do Pre-Analysis processing here
// Advance the WOLA state
LDSI A, WOLA_STATE_ANALYSIS
LD XL_WOLA_STATE, A, X
// Launch WOLA Analysis
WOLA_Start(UCODE_ANALYSIS_FUNCTION)
// Do While Analysis processing here
// Check if any more interrupts have occurred
BRA mainloop
// ---------------------------------------------------------------------------
// Process WOLA interrupt
// ---------------------------------------------------------------------------
process_wola_interrupt:
// Clear WOLA interrupt flag
RES AH, WOLA_INTERRUPT_FLAG
LD XL_INTERRUPT_FLAGS, A, X
// Re-enable interrupts
Enable_Int
// Determine which WOLA function just completed
LD A, XL_WOLA_STATE, X
// Check for Analysis done
CMSI A, WOLA_STATE_ANALYSIS
BRA wola_analysis_done, Z
// Check for Gain Application done
CMSI A, WOLA_STATE_GAIN
BRA wola_gain_application_done, Z
// Check for Synthesis done
CMSI A, WOLA_STATE_SYNTHESIS
BRA wola_synthesis_done, Z
// Shouldn抰 get here - break if debugging
BREAK
BRA mainloop
// ---------------------------------------------------------------------------
// WOLA Analysis done
// ---------------------------------------------------------------------------
wola_analysis_done:
// Do Post Analysis processing here
// Advance the WOLA state
LDSI A, WOLA_STATE_GAIN
LD XL_WOLA_STATE, A, X
// Launch WOLA Gain Application
WOLA_Start(UCODE_GAIN_FUNCTION)
// Do While Gain Application processing here
// Check if any more interrupts have occurred
BRA mainloop
// ---------------------------------------------------------------------------
// WOLA Gain Application done
// ---------------------------------------------------------------------------
wola_gain_application_done:
// Do Post Gain Application processing here
// Advance the WOLA state
LDSI A, WOLA_STATE_SYNTHESIS
LD XL_WOLA_STATE, A, X
// Launch WOLA Synthesis
WOLA_Start(UCODE_SYNTHESIS_FUNCTION)
// Do While Synthesis processing here
// Check if any more interrupts have occurred
BRA mainloop
// ---------------------------------------------------------------------------
// WOLA Synthesis done
// ---------------------------------------------------------------------------
wola_synthesis_done:
// Advance the WOLA state
LDSI A, WOLA_STATE_IDLE
LD XL_WOLA_STATE, A, X
// Do Post Synthesis processing here
CALL Tone_Generation
// Check if any more interrupts have occurred
BRA mainloop
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -