標題: DSP28335移植usos2的工程代碼 [打印本頁] 作者: 清池 時間: 2017-9-26 17:09 標題: DSP28335移植usos2的工程代碼 #include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
#include "..\OS\28335cpu\includes.h"
#include "F28335_example.h" // Main include file
// Determine when the shift to right justify the data takes place
// Only one of these should be defined as 1.
// The other two should be defined as 0.
#define POST_SHIFT 0 // Shift results after the entire sample table is full
#define INLINE_SHIFT 1 // Shift results as the data is taken from the results regsiter
#define NO_SHIFT 0 // Do not shift the results
//--- Global Variables
Uint16 AdcBuf[ADC_BUF_LEN]; // ADC data buffer allocation
Uint32 PwmDuty; // Measured PWM duty cycle
Uint32 PwmPeriod; // Measured PWM period
Uint16 p, x,y;
Uint16 LoopCount;
Uint16 ErrorCount;
Uint16 ReceivedChar;
char *msg;
void main(void)
{
//--- CPU Initialization
InitSysCtrl(); // Initialize the CPU
InitPieCtrl(); // Initialize and enable the PIE
//InitPieVectTable();
InitWatchdog(); // Initialize the Watchdog Timer
// InitGpio(); // Initialize the shared GPIO pins
// InitXintf();
InitXintf16Gpio();
InitScibGpio();
configtestled(); // Initialize the external memory interface
#ifdef EXAMPLE_FLASH // EXAMPLE_FLASH, if defined, is in CCS project options
//--- Copy all Flash sections that need to run from RAM (use memcpy() from RTS library)
// Section secureRamFuncs contains user defined code that runs from CSM secured RAM
/* memcpy( &secureRamFuncs_runstart,
&secureRamFuncs_loadstart,
&secureRamFuncs_loadend - &secureRamFuncs_loadstart);
*/
//--- Initialize the Flash and OTP
// InitFlash(); // Initialize the Flash
#endif
DINT;
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &OSTickISR;//ISRTimer0;//
PieVectTable.USER11 = &OSCtxSw;//èÎÎñÇD»»Ä£ÄaÖD¶Ï óÃÖ¸áîasm(" TRAP #30")à′μ÷óÃêμÏÖ
EDIS; // This is needed to disable write to EALLOW protected registers
// Step 4. Initialize the Device Peripheral. This function can be
// found in DSP2833x_CpuTimers.c
InitCpuTimers(); // For this example, only initialize the Cpu Timers
// Configure CPU-Timer 0, 1, and 2 to interrupt every second:
// 150MHz CPU Freq, 1 second Period (in uSeconds)
ConfigCpuTimer(&CpuTimer0, 150, 1000);//3õê¼»ˉÎa1MSÖD¶Ïò»′Î ×÷ÎaOSê±Öó
StartCpuTimer0();
// Enable CPU int1 which is connected to CPU-Timer 0, CPU int13
// which is connected to CPU-Timer 1, and CPU int 14, which is connected
// to CPU-Timer 2:
IER |= M_INT1;
// Enable TINT0 in the PIE: Group 1 interrupt 7
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
// Timer 1 connected to int13 by yang
XIntruptRegs.XNMICR.bit.SELECT= 0;
LoopCount = 0;
ErrorCount = 0;
//===========================================================================
// No more.
//===========================================================================