⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 the_dsp28_header_files.txt

📁 这是DSP F2812芯片的头文件
💻 TXT
📖 第 1 页 / 共 2 页
字号:
Intended for product evaluation purposes
Introduction: _______________________________________________________________________________________2
Packet Contents: ____________________________________________________________________________________2
· Directory structure ____________________________________________________________________________2
· .h definition files ______________________________________________________________________________2
· Global variable definition file ___________________________________________________________________3
· Peripheral Interrupt Expansion (PIE) block support ________________________________________________3
· Example main program ________________________________________________________________________4
· Peripheral specific routines _____________________________________________________________________4
· Example Linker .cmd files ______________________________________________________________________4
· Other source files _____________________________________________________________________________4
· Code Composer .gel Files _______________________________________________________________________5
· Examples ____________________________________________________________________________________5
Steps for Using These Files ____________________________________________________________________________6
Accessing Peripheral Registers _________________________________________________________________________9
Troubleshooting Tips ________________________________________________________________________________11
Variable Names and Data Sections _____________________________________________________________________13
DSP28_Device.h - Main Include File ___________________________________________________________________15
Introduction:
This packet is meant to facilitate writing in C for the F2810/F2812. In the future it will be replaced with a fullfeatured
Chip Support Library (CSL). Note: Programs written with the DSP28 header files are not
guaranteed to be compatible with a future release of CSL.
This packet can be used as-is to provide a platform for writing code examples or the user can pick and choose
which files to use in their own projects and discard the rest.
This packet is currently Alpha quality and is being released for product evaluation purposes.
Packet Contents:
·  Directory structure
o <base directory> ‘28x CCS project file and readme.doc
o <base directory>\doc\ Example documentation
o <base directory>\examples\ Example programs
o <base directory>\gel\ .gel files that are specific to the DSP28 headerfiles
o <base directory>\include\ .h files
o <base directory>\src\ .c source files
o <base directory>\cmd\ linker command files
o <base directory>\debug\ output from the compiler
The DSP28 example files include the following:
·  .h definition files
These files are found in the include\ directory and define structures and bit fields that correspond to each
peripheral and system register on the F2810 and F2812 devices. The following support files fall into this
category:
o DSP28_Device.h DSP28_Device.h is the main include file. By including this one file in any
of your .c source files, you will automatically include all the required
peripheral specific .h files. If you do not want to include a particular file,
simply comment it out. In addition the file includes typedef statements
for data types on any ‘28x device.
o DSP28_DevEmu.h Emulation register definitions – Device ID
o DSP28_SysCtrl.h System register definitions. (Watchdog, PLL, CSM, etc..)
o DSP28_PieCtrl.h PIE control register definitions
o DSP28_Adc.h ADC register definitions
o DSP28_CpuTimers.h CPU timer register definitions
o DSP28_ECan.h Enhanced CAN register definitions
o DSP28_Ev.h Event Manager register definitions
o DSP28_Gpio.h General Purpose I/O register definitions
o DSP28_Mcbsp.h McBSP register definitions
o DSP28_Sci.h SCI register definitions
o DSP28_Spi.h SPI register definitions
o DSP28_Xintf.h External interface register definitions
o DSP28_XIntrupt.h External interrupt register definitions
·  Global variable definition file
The DSP28_GlobalVariableDefs.c file defines all of the variables required to use the above .h files. In
addition, a CODE_SECTION pragma statement is included to define a code section for each variable.
The linker will then use these code sections to link the structure over the peripheral in memory. In this
manner the variable can be used to directly access the register.
o DSP28_GlobalVariableDefs.c
·  Peripheral Interrupt Expansion (PIE) block support
In addition to the register definitions defined in DSP28_PieCtrl.h, this packet provides the basic ISR
structure for the PIE block. These files are:
o DSP28_PieVect.h Example PIE vector table definition. A structure definition of pointers to
functions for the entire 96 vectors in the PIE vector table. This vector
table is populated with pointers to functions as defined in the
corresponding DSP28_PieVect.c file. The initialization routine found in
the corresponding DSP28_PieVect.c file demonstrates how this table is
populated.
o DSP28_PieVect.c Defines the PIE Vector table structure and populates it with pointers to
the ISR routines found in DSP28_DefaultIsr.c
o DSP28_DefaultIsr.c Default ISR routines. These are shell routines for all of the PIE
interrupts. You can populate one of these shell routines with the ISR or
remap your own function into the PIE vector table instead.
o DSP28_DefaultIsr.h Function prototypes for the included ISR shell routines.
In addition, the following files are included for software prioritization of interrupts. These files are used in
place of those above. Refer to the sw_prioritized_interrupts example and documentation information on
their use.
o DSP28_SWPrioritizedPieVect.c PIE Vector table structure
o DSP28_SWPrioritizedDefaultIsr.c Default ISR routines with software prioritization.
o DSP28_SWPrioritizedIsrLevels.h User assigns priority levels in this file.
.
·  Example main program
Example_28xDevice.c file contains a sample main() program for the F2810/F2812. This program shows
the steps for initializing the device. DSP28_InitPeripherals.c contains the peripheral initialization function
used by the example program. All of the examples provided follow the basic flow found in this file.
The example program has a corresponding Example_28xDevice.h file. This file contains the external
function prototypes used by the example program. These external functions can be found in the
peripheral specific .c files found in the src\ directory.
o Example_28xDevice.c
o Example.h
o DSP28_InitPeripherals.c
·  Peripheral specific routines
This support package contains peripheral specific initialization routines and other support functions.
These functions can be found in the peripheral .c files in the src\ directory. These files include:
o DSP28_SysCtrl.c
o DSP28_PieCtrl.c
o DSP28_Adc.c
o DSP28_CpuTimers.c
o DSP28_ECan.c
o DSP28_Ev.c
o DSP28_Gpio.c
o DSP28_Mcbsp.c
o DSP28_Sci.c
o DSP28_Spi.c
o DSP28_Xintf.c
o DSP28_XIntrupt.c
Note: The example routines are under development and may not all be available as of this release.
They will be added and distributed as more examples are developed.
·  Example Linker .cmd files
The cmd\ directory contains example linker command files. These files contain the memory allocation for
all of the peripheral structure definitions that are included in this support package.
The following .cmd files are provided as examples. For getting started the basic EzDSP_RAM_lnk.cmd
file is suggested:
o EzDSP_RAM_lnk.cmd Simple memory map that only uses RAM locations. This memory map is
used for all of the examples for use with the F2812 EzDSP. No Flash or
OTP locations are used.
o F2810.cmd, F2812.cmd Example memory maps for advanced/later development with Flash
included.
·  Other source files
o DSP28_CodeStartBranch.asm Branch statement used to redirect code execution when booting
to Flash. Refer to the flash example for usage.
o DSP28_DBGIER.asm Assembly function to manipulate the DEBIER register from C
o DSP28_usDelay.asm Macro to specify a delay in microseconds. Refer to
/examples/adc for an example of its use.
·  Code Composer .gel Files
o DSP28_Peripheral.gel This .gel file provides GEL pull-down menus to load the DSP28
data structures into the watch window. You may want to have
CCS load this file automatically by adding a
GEL_LoadGel(“<base_path>/gel/DSP28peripheral.gel”)
function to the standard F2812.gel that was included with CCS.
o DSP28_GpioQuickRef.gel This .gel file provides a quick reference for the GPIO ports on the
F2810/12. It simply prints out the mux information into a
debugger window.
·  Examples
In the DSP28/examples directory there are example projects that use the DSP28 headerfiles as a
framework. More examples will be added in future revisions.
In general, each example is documented in the code comments at the top of the main source file. This
includes information on any special hardware settings or conditions that must be met for the test to run
properly. These tests are self-validating and can be used to check the health of the hardware or
demonstrate how to setup a peripheral.
Each example includes a Code Composer Studio project (.pjt) that should be used to build the .out file.
Most examples also include a .gel file to help facilitate building and loading the example.
The examples use the header files found in the top level DSP28/include directory and some source files
in the top level DSP28/src directory. Only files specific to that particular example are in the appropriate
example directory - the shared files remain in the top level. This is done by providing the proper include
path in the project file.
If you wish to modify the examples it is suggested that you make a copy of the entire DSP28 packet to
modify. New examples provided will assume that the base files are as supplied.
Note: Most of the example code included uses the .bit field structures to access registers. This is done to
help the user learn how to use the device. Using the bit fields has the advantage of yielding code that is
easier to read and modify. This method will result in a slight code overhead when compared to using the
.all method. In addition, for these examples the compiler optimizer has not been turned on.
Steps for Using These Files
The following steps provide a high-level overview for using these support files to create your own projects.
1. Include the DSP28_Device.h file in any source file in which you want to use the register definitions:
#include “DSP28_Device.h”
This file will in-turn include all of the device peripheral .h files and required definitions.
2. In DSP28_Device.h, select the target you are building for:
//---------------------------------------------------------------------------
// User To Select Target Device:
#define F2812 TARGET
#define F2810 0
3. Include DSP28_GlobalVariableDefs.c in your project. This file will define all of the variables and data
sections required to access the peripheral registers directly as variables.
This includes:
‰ Variables that are used to access the peripheral registers. You can use this same variable name in other
.c source files to access the same peripheral registers.
‰ Data sections that are used by the linker to place the variables in the proper locations in memory. These
locations correspond to the memory address of the peripheral registers and will be defined in the linker
.cmd file (see step 4).
For example, for the CPU Timers:
// Define data sections for each of the variables
#pragma DATA_SECTION(CpuTimer0Regs,"CpuTimer0RegsFile");
#pragma DATA_SECTION(CpuTimer1Regs,"CpuTimer1RegsFile");
#pragma DATA_SECTION(CpuTimer2Regs,"CpuTimer2RegsFile");
// Define a variable to access each of the CPU Timer register sets
volatile struct CPUTIMER_REGS CpuTimer0Regs;
volatile struct CPUTIMER_REGS CpuTimer1Regs;
volatile struct CPUTIMER_REGS CpuTimer2Regs;
The volatile keyword tells the compiler that those registers may change due to some event outside of the
code. This keeps the compiler from optimizing out parts of the code that do not appear necessary. For
example, if you wanted to poll a bit, the compiler may only check the bit once unless the location is defined as
volatile.
In this case CpuTimer0Regs, CpuTimer1Regs and CpuTimer2Regs are all defined as variables of type
CPUTIMER_REGS.
CPUTIMER_REGS is a structure defined within the DSP28_CpuTimer.h file. This structure contains all the
registers that belong to a CPU-Timer peripheral. Since each of the three CPU Timers has the same registers,
we can use the same definition for each of the three CPU Timers.
4. Update your the linker cmd file or use one of the example .cmd files provided. The following .cmd files are
provided as examples. For getting started the basic EzDSP_RAM_lnk.cmd file is suggested:
EzDSP_RAM_lnk.cmd Simple memory map that only uses RAM locations. This memory map is
used for all of the examples shipped with the F2812 EzDSP.
No Flash or OTP locations are used.
F2810.cmd
F2812.cmd
Example memory maps for advanced/later development.
Your linker .cmd file should include:
‰ Reserve memory blocks on page 1 for all of the peripheral register file locations. These memory
allocations enable the ‘28x linker to place variables at that exact location in memory. The
memory allocation for the three CPU Timers is shown below. Refer to the example .cmd file for
the other required memory allocations.
Memory
{
……
PAGE 1 :
……
CPU_TIMER0 : origin = 0x000C00, length = 0x000008
CPU_TIMER1 : origin = 0x000C08, length = 0x000008
CPU_TIMER2 : origin = 0x000C10, length = 0x000008
…… etc
……
}
‰ A corresponding section assignment to the proper memory region defined for each of the
peripheral register structures. Recall that in step 3 we showed how the variables are assigned a
particular data section using a #pragma statement such as:
#pragma DATA_SECTION(CpuTimer0Regs,"CpuTimer0RegsFile");
The section assignment will place the defined data section “CpuTimer0RegsFile” in memory
where the peripheral registers are located. Now the variable CPUTimer0Regs, which is the only
variable within that data section, will be located over-laid on top of the memory-mapped registers.
Thus the variable CpuTimer0Regs can be used to access the registers directly from C-code.
SECTIONS
{
……

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -