first commit
This commit is contained in:
74
Lib/asm/DSP2833x_ADC_cal.asm
Normal file
74
Lib/asm/DSP2833x_ADC_cal.asm
Normal file
@@ -0,0 +1,74 @@
|
||||
;; TI File $Revision: /main/1 $
|
||||
;; Checkin $Date: July 30, 2007 10:29:23 $
|
||||
;;###########################################################################
|
||||
;;
|
||||
;; FILE: ADC_cal.asm
|
||||
;;
|
||||
;; TITLE: 2833x Boot Rom ADC Cal routine.
|
||||
;;
|
||||
;; Functions:
|
||||
;;
|
||||
;; _ADC_cal - Copies device specific calibration data into ADCREFSEL and
|
||||
;; ADCOFFTRIM registers
|
||||
;; Notes:
|
||||
;;
|
||||
;;###########################################################################
|
||||
;; $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
;; $Release Date: June 28, 2010 $
|
||||
;; $Copyright:
|
||||
;// Copyright (C) 2009-2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
;//
|
||||
;// Redistribution and use in source and binary forms, with or without
|
||||
;// modification, are permitted provided that the following conditions
|
||||
;// are met:
|
||||
;//
|
||||
;// Redistributions of source code must retain the above copyright
|
||||
;// notice, this list of conditions and the following disclaimer.
|
||||
;//
|
||||
;// Redistributions in binary form must reproduce the above copyright
|
||||
;// notice, this list of conditions and the following disclaimer in the
|
||||
;// documentation and/or other materials provided with the
|
||||
;// distribution.
|
||||
;//
|
||||
;// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
;// its contributors may be used to endorse or promote products derived
|
||||
;// from this software without specific prior written permission.
|
||||
;//
|
||||
;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
;// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
;// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
;// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
;// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
;// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
;// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
;// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
;// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
;// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;// $
|
||||
;;###########################################################################
|
||||
|
||||
.def _ADC_cal
|
||||
.asg "0x711C", ADCREFSEL_LOC
|
||||
|
||||
;-----------------------------------------------
|
||||
; _ADC_cal
|
||||
;-----------------------------------------------
|
||||
;-----------------------------------------------
|
||||
; This is the ADC cal routine.This routine is programmed into
|
||||
; reserved memory by the factory. 0xAAAA and 0xBBBB are place-
|
||||
; holders for calibration data.
|
||||
;The actual values programmed by TI are device specific.
|
||||
;
|
||||
; This function assumes that the clocks have been
|
||||
; enabled to the ADC module.
|
||||
;-----------------------------------------------
|
||||
|
||||
.sect ".adc_cal"
|
||||
|
||||
_ADC_cal
|
||||
MOVW DP, #ADCREFSEL_LOC >> 6
|
||||
MOV @28, #0xAAAA ; actual value may not be 0xAAAA
|
||||
MOV @29, #0xBBBB ; actual value may not be 0xBBBB
|
||||
LRETR
|
||||
;eof ----------
|
||||
76
Lib/asm/DSP2833x_usDelay.asm
Normal file
76
Lib/asm/DSP2833x_usDelay.asm
Normal file
@@ -0,0 +1,76 @@
|
||||
;// TI File $Revision: /main/4 $
|
||||
;// Checkin $Date: July 30, 2007 10:28:57 $
|
||||
;//###########################################################################
|
||||
;//
|
||||
;// FILE: DSP2833x_usDelay.asm
|
||||
;//
|
||||
;// TITLE: Simple delay function
|
||||
;//
|
||||
;// DESCRIPTION:
|
||||
;//
|
||||
;// This is a simple delay function that can be used to insert a specified
|
||||
;// delay into code.
|
||||
;//
|
||||
;// This function is only accurate if executed from internal zero-waitstate
|
||||
;// SARAM. If it is executed from waitstate memory then the delay will be
|
||||
;// longer then specified.
|
||||
;//
|
||||
;// To use this function:
|
||||
;//
|
||||
;// 1 - update the CPU clock speed in the DSP2833x_Examples.h
|
||||
;// file. For example:
|
||||
;// #define CPU_RATE 6.667L // for a 150MHz CPU clock speed
|
||||
;// or #define CPU_RATE 10.000L // for a 100MHz CPU clock speed
|
||||
;//
|
||||
;// 2 - Call this function by using the DELAY_US(A) macro
|
||||
;// that is defined in the DSP2833x_Examples.h file. This macro
|
||||
;// will convert the number of microseconds specified
|
||||
;// into a loop count for use with this function.
|
||||
;// This count will be based on the CPU frequency you specify.
|
||||
;//
|
||||
;// 3 - For the most accurate delay
|
||||
;// - Execute this function in 0 waitstate RAM.
|
||||
;// - Disable interrupts before calling the function
|
||||
;// If you do not disable interrupts, then think of
|
||||
;// this as an "at least" delay function as the actual
|
||||
;// delay may be longer.
|
||||
;//
|
||||
;// The C assembly call from the DELAY_US(time) macro will
|
||||
;// look as follows:
|
||||
;//
|
||||
;// extern void Delay(long LoopCount);
|
||||
;//
|
||||
;// MOV AL,#LowLoopCount
|
||||
;// MOV AH,#HighLoopCount
|
||||
;// LCR _Delay
|
||||
;//
|
||||
;// Or as follows (if count is less then 16-bits):
|
||||
;//
|
||||
;// MOV ACC,#LoopCount
|
||||
;// LCR _Delay
|
||||
;//
|
||||
;//
|
||||
;//###########################################################################
|
||||
;// $TI Release: DSP2833x Header Files V1.00 $
|
||||
;// $Release Date: September 7, 2007 $
|
||||
;//###########################################################################
|
||||
|
||||
.def _DSP28x_usDelay
|
||||
.text
|
||||
|
||||
.global __DSP28x_usDelay
|
||||
_DSP28x_usDelay:
|
||||
SUB ACC,#1
|
||||
BF _DSP28x_usDelay,GEQ ;; Loop if ACC >= 0
|
||||
LRETR
|
||||
|
||||
;There is a 9/10 cycle overhead and each loop
|
||||
;takes five cycles. The LoopCount is given by
|
||||
;the following formula:
|
||||
; DELAY_CPU_CYCLES = 9 + 5*LoopCount
|
||||
; LoopCount = (DELAY_CPU_CYCLES - 9) / 5
|
||||
; The macro DELAY_US(A) performs this calculation for you
|
||||
;
|
||||
;//===========================================================================
|
||||
;// End of file.
|
||||
;//===========================================================================
|
||||
88
Lib/asm/DSP28xxx_CodeStartBranch.asm
Normal file
88
Lib/asm/DSP28xxx_CodeStartBranch.asm
Normal file
@@ -0,0 +1,88 @@
|
||||
;// TI File $Revision: /main/1 $
|
||||
;// Checkin $Date: December 1, 2004 11:11:32 $
|
||||
;//###########################################################################
|
||||
;//
|
||||
;// FILE: DSP28xxx_CodeStartBranch.asm
|
||||
;//
|
||||
;// TITLE: Branch for redirecting code execution after boot.
|
||||
;//
|
||||
;// For these examples, code_start is the first code that is executed after
|
||||
;// exiting the boot ROM code.
|
||||
;//
|
||||
;// The codestart section in the linker cmd file is used to physically place
|
||||
;// this code at the correct memory location. This section should be placed
|
||||
;// at the location the BOOT ROM will re-direct the code to. For example,
|
||||
;// for boot to FLASH this code will be located at 0x3f7ff6.
|
||||
;//
|
||||
;// From this code the watchdog will be disabled followed by calling the
|
||||
;// copy_section function to copy sections from flash to ram.
|
||||
;//
|
||||
;// In addition, the example DSP28xxx projects are setup such that the codegen
|
||||
;// entry point is also set to the code_start label. This is done by linker
|
||||
;// option -e in the project build options. When the debugger loads the code,
|
||||
;// it will automatically set the PC to the "entry point" address indicated by
|
||||
;// the -e linker option. In this case the debugger is simply assigning the PC,
|
||||
;// it is not the same as a full reset of the device.
|
||||
;//
|
||||
;// The compiler may warn that the entry point for the project is other then
|
||||
;// _c_init00. _c_init00 is the C environment setup and is run before
|
||||
;// main() is entered. The copy_sections code will re-direct the execution
|
||||
;// to _c_init00 and thus there is no worry and this warning can be ignored.
|
||||
;//
|
||||
;//###########################################################################
|
||||
;// $TI Release: DSP280x, DSP2801x Header Files V1.41 $
|
||||
;// $Release Date: August 7th, 2006 $
|
||||
;// Modified by: Tim Love
|
||||
;// Modified Date: March 2008
|
||||
;//###########################################################################
|
||||
|
||||
|
||||
***********************************************************************
|
||||
|
||||
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
|
||||
|
||||
.ref copy_sections
|
||||
.global code_start
|
||||
|
||||
***********************************************************************
|
||||
* Function: codestart section
|
||||
*
|
||||
* Description: Branch to code starting point
|
||||
***********************************************************************
|
||||
|
||||
.sect "codestart"
|
||||
|
||||
code_start:
|
||||
.if WD_DISABLE == 1
|
||||
LB wd_disable ;Branch to watchdog disable code
|
||||
.else
|
||||
LB copy_sections ;Branch to copy_sections
|
||||
.endif
|
||||
|
||||
;end codestart section
|
||||
|
||||
***********************************************************************
|
||||
* Function: wd_disable
|
||||
*
|
||||
* Description: Disables the watchdog timer
|
||||
***********************************************************************
|
||||
.if WD_DISABLE == 1
|
||||
|
||||
.sect "wddisable"
|
||||
wd_disable:
|
||||
SETC OBJMODE ;Set OBJMODE for 28x object code
|
||||
EALLOW ;Enable EALLOW protected register access
|
||||
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
|
||||
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
|
||||
EDIS ;Disable EALLOW protected register access
|
||||
LB copy_sections ;Branch to copy_sections
|
||||
|
||||
.endif
|
||||
|
||||
;end wd_disable
|
||||
|
||||
.end
|
||||
|
||||
;//===========================================================================
|
||||
;// End of file.
|
||||
;//===========================================================================
|
||||
88
Lib/asm/DSP28xxx_SectionCopy_nonBIOS.asm
Normal file
88
Lib/asm/DSP28xxx_SectionCopy_nonBIOS.asm
Normal file
@@ -0,0 +1,88 @@
|
||||
;############################################################################
|
||||
;
|
||||
; FILE: DSP28xxx_SectionCopy_nonBIOS.asm
|
||||
;
|
||||
; DESCRIPTION: Provides functionality for copying intialized sections from
|
||||
; flash to ram at runtime before entering the _c_int00 startup
|
||||
; routine
|
||||
;############################################################################
|
||||
; Author: Tim Love
|
||||
; Release Date: March 2008
|
||||
;############################################################################
|
||||
|
||||
|
||||
.ref _c_int00
|
||||
.global copy_sections
|
||||
.global _cinit_loadstart, _cinit_runstart, _cinit_size
|
||||
.global _const_loadstart, _const_runstart, _const_size
|
||||
.global _econst_loadstart, _econst_runstart, _econst_size
|
||||
.global _pinit_loadstart, _pinit_runstart, _pinit_size
|
||||
.global _switch_loadstart, _switch_runstart, _switch_size
|
||||
.global _text_loadstart, _text_runstart, _text_size
|
||||
|
||||
***********************************************************************
|
||||
* Function: copy_sections
|
||||
*
|
||||
* Description: Copies initialized sections from flash to ram
|
||||
***********************************************************************
|
||||
|
||||
.sect "copysections"
|
||||
|
||||
copy_sections:
|
||||
|
||||
|
||||
MOVL XAR5,#_cinit_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_cinit_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_cinit_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_const_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_const_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_const_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_econst_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_econst_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_econst_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_pinit_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_pinit_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_pinit_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_switch_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_switch_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_switch_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_text_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_text_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_text_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
|
||||
LB _c_int00 ; Branch to start of boot.asm in RTS library
|
||||
|
||||
copy:
|
||||
B return,EQ ; Return if ACC is Zero (No section to copy)
|
||||
|
||||
SUBB ACC,#1
|
||||
|
||||
RPT AL ; Copy Section From Load Address to
|
||||
|| PWRITE *XAR7, *XAR6++ ; Run Address
|
||||
|
||||
return:
|
||||
LRETR ; Return
|
||||
|
||||
.end
|
||||
|
||||
;//===========================================================================
|
||||
;// End of file.
|
||||
;//===========================================================================
|
||||
Reference in New Issue
Block a user