main.c
来自「dsp28335例程」· C语言 代码 · 共 81 行
C
81 行
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
Uint16 *ExRamStart = (Uint16 *)0x100000;
Uint16 FrameLenth;
Uint16 RxSuccessFlag;
//-------------------
Uint16 TxEthnetFrameBuffer[1518/2];
Uint16 RxEthnetFrameBuffer[1518/2];
void SendData(Uint16 data);
void main(void)
{
Uint16 Temp;
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); // Skipped for this example
InitXintf16Gpio(); //zq
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
SendData(0xFF);
LedReg = 0xFF;
Init8019();
while(1)
{
do{
Temp=RecFrame();
}while(Temp);
if(RxSuccessFlag)
{
RxSuccessFlag=0;
DoNetworkStuff();
}
}
}
void SendData(Uint16 data)
{
Uint16 i,Temp;
Temp = 0x80;
for (i=0;i<8;i++)
{
if ((data & Temp)==0) ClrData;
else SetData;
Temp >>= 1;
DELAY_US(100);
ClrClk;
DELAY_US(200);
SetClk;
}
SysReg = 0xEF;
DELAY_US(200);
SysReg = 0xFF ;
SetData;
}
//===========================================================================
// No more.
//===========================================================================
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?