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

📄 main_bios.c

📁 关于DSP2812FLASH烧写,有兴趣的同学可以看一下,或交流一下
💻 C
字号:
/**********************************************************************
* File: main_BIOS.c
* Devices: TMS320F2812, TMS320F2811, TMS320F2810
* Author: David M. Alter, Texas Instruments Inc.
* History:
*   09/08/03 - original (based on DSP281x header files v1.00, D. Alter)
**********************************************************************/

#include "DSP281x_Device.h"

// EXAMPLE_BIOS or EXAMPLE_NONBIOS are defined in the CCS project build options
#ifdef EXAMPLE_BIOS
    #include "example_BIOS.h"
#endif

#ifdef EXAMPLE_NONBIOS
    #include "example_nonBIOS.h"
#endif


/*** Global variables used by AdcSwi() ***/
#define ADC_buf_len	50					// ADC buffer length
Uint16 ADC_buf[ADC_buf_len];			// ADC buffer allocation


/**********************************************************************
* Function: main()
*
* Description: Main function for F281x example.
**********************************************************************/
void main(void)
{
/*** CPU Initialization ***/
	InitSysCtrl();						// Initialize the CPU (FILE: SysCtrl.c)
	InitXintf();						// Initialize the external memory interface (FILE: Xintf.c)
	InitGpio();							// Initialize the shared GPIO pins (FILE: Gpio.c)
	InitPieCtrl();						// Initialize and enable the PIE (FILE: PieCtrl.c)

/*** 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 ***/
	InitFlash();						// Initialize the FLASH (FILE: SysCtrl.c)

/*** Peripheral Initialization ***/
	InitAdc();							// Initialize the ADC (FILE: Adc.c)
	InitEv();							// Initialize the Event Manager (FILE: Ev.c)

/*** Enable interrupts ***/
	SetDBGIER(IER | 0x6000);							// enable everything in IER, plus TINT2 and DLOGINT
	*(volatile unsigned int *)0x00000C14 |= 0x0C00;		// set TIMER2 free=soft=1

    // DSP/BIOS will enable global interrupts (INTM and DBGM)

} //end of main()



/**********************************************************************
* Function: UserInit()
*
* Description: This is the user initialization file to be specified in
* the DSP/BIOS configuration file, System - Global Settings.
**********************************************************************/
void UserInit(void)
{
// Section .trcdata is generated by DSP/BIOS.
// It must be copied from its load to its run address BEFORE main().
	memcpy(&trcdata_runstart, &trcdata_loadstart, &trcdata_loadend - &trcdata_loadstart);

} //end of UserInit()



/**********************************************************************
* Function: LedBlink()
*
* Description: Blinks LED on eZdsp F2812 board.
**********************************************************************/
void LedBlink(void)
{

	GpioDataRegs.GPFTOGGLE.bit.GPIOF14 = 1;	// Toggle the pin
	
} //end of LedBlink()



/**********************************************************************
* Function: AdcSwi()
*
* Description: ADC interrupt SWI
**********************************************************************/
void AdcSwi(void)
{
static Uint16 *ADC_buf_ptr = ADC_buf;			// Pointer to buffer
static Uint32 AdcSwi_count=0;					// used for LOG_printf example

/*** Show an example of using LOG_printf() to write to a log buffer ***/
	LOG_printf(&trace, "AdcSwi_count = %u", AdcSwi_count++);

/*** Manage the ADC registers ***/
	AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;			// Reset SEQ1 to CONV00 state
	AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;			// Clear ADC SEQ1 interrupt flag

/*** Read the ADC result ***/
	*ADC_buf_ptr++ = AdcRegs.ADCRESULT0 >> 4;	// Read the result

/*** Brute-force the circular buffer ***/
	if( ADC_buf_ptr == (ADC_buf + ADC_buf_len) )
		ADC_buf_ptr = ADC_buf;					// Rewind the pointer to beginning

} //end of AdcSwi()


/*** end of file *****************************************************/

⌨️ 快捷键说明

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