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

📄 main.c

📁 Using ROM Contents on TMS320C672x
💻 C
字号:
// include the standard library
#include <stdio.h>
#include <stdlib.h>

// include the mathematical library
#include <math.h>

// DSP lib headers
#include "..\include\DSPF_sp_maxval.h"
#include "..\include\DSPF_sp_minval.h"
#include "..\include\DSPF_sp_vecmul.h"
#include "..\include\DSPF_sp_w_vec.h"
#include "..\include\DSPF_sp_blk_move.h"

// include the BIOS objects definition
#include "simple_bioscfg.h"

/////////////////////////////////////////////////////////
//  VARIABLES
/////////////////////////////////////////////////////////


#define align_data 8
#define N 10

// required by the DSP lib implementation 
#pragma DATA_ALIGN(buffer_1, align_data);
static float buffer_1[N];

#pragma DATA_ALIGN(buffer_2, align_data);
static float buffer_2[N];

#pragma DATA_ALIGN(buffer_3, align_data);
static float buffer_3[N];

float *a,*b,*c;
volatile int	count=0;

/* define trigonometric constant PI */
double pi_2 = 3.141576;



/////////////////////////////////////////////////////////
//      main()      									
/////////////////////////////////////////////////////////

void main()
{
	int i;
	float answer;
	double value;

	printf("C672x test without rom contents - start\n");

	// prime the buffers
	for( i=0; i< N ; i++)
	{
		buffer_1[i] = 1.0 + i;
		buffer_2[i] = 2.0 + i;
		buffer_3[i] = 0.0;
	}

	// calculate the maximum value
	a = &buffer_1[0];
	answer = DSPF_sp_maxval(a, N);		

	// calculate the minimum value
	a = &buffer_1[0];
	answer = DSPF_sp_minval(a, N);		

	// move a block of data from a to b
	a = &buffer_1[0];
	b = &buffer_2[0];
	DSPF_sp_blk_move(a, b, N);

	// do a weighted ((a*2)+b) sum of vectors
	a = &buffer_1[0];
	b = &buffer_2[0];
	c = &buffer_3[0];
	DSPF_sp_w_vec(a, b, 2, c, N);
	
	// multiply the two vectors
	a = &buffer_1[0];
	b = &buffer_2[0];
	c = &buffer_3[0];
	DSPF_sp_vecmul(a, b, c, N);

	// calculate the cosine
	value = cos(pi_2);

	// print a string
	printf("C672x test without rom contents - end\n");


}




void myPrdFunction()
{
	LOG_printf(&myTrace,"BIOS log");
}

⌨️ 快捷键说明

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