-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
85 lines (81 loc) · 2.41 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include"c6678.h"
#include <c6x.h>
#include <stdio.h>
#include <cslr_gpio.h>
#include <csl_bootcfgAux.h>
#include "KeyStone_common.h"
#include "gpio_z.h"
#include "hdlc_cmu.h"
#include "init.h"
/********************************************************************
* 可修改的全局变量
*******************************************************************/
//#define DEBUG
//记录速度
CSL_Uint64 average_write_speed=0;
CSL_Uint64 average_read_speed=0;
unsigned int frame=0;
unsigned int hdlc_rec_flag =0;
//DMA测试宏变量
#define DEVICE_HZ 1000000000//800MHZ:800000000//1GHZ:1000000000;1.25GHZ:1250000000
#define MB 0x100000
#define TEST_LOOP_COUNT 1000
#define KB 1024
/********************************************************************
* emif16_fpga部分
*******************************************************************/
#define EMIF16FPGA_SEND_BUF_ADDR 0x0C1D0000
#define EMIF16FPGA_RECV_BUF_ADDR 0x0C1E0000
//#define GPIO_LOOP_BACK_TEST 1
void main(void)
{
init();
int coreNum=0;
int * src_buf= (int *)EMIF16FPGA_SEND_BUF_ADDR;
int * dst_buf= (int *)EMIF16FPGA_RECV_BUF_ADDR;
unsigned int length,i;
coreNum = CSL_chipReadReg (CSL_CHIP_DNUM);
if(DEVICE==DEVICE1)
{
if (coreNum ==0)
{
while(1)
{
if(hdlc_rec_flag == 1)
{
hdlc_rec_flag = 0;
length = receive_hdlc(dst_buf);
int flag_send;
flag_send=zhuanfa(dst_buf,src_buf);
if(flag_send==1)
{
send_hdlc(202,src_buf);
}
/*if( (frame%3)==1 )
{
src_buf[0]=0x77;
src_buf[1]=0x22;
src_buf[2]=0x44;
src_buf[2]=frame%256;
for(i=1;i<200;i++)
{
src_buf[i+2] = i+1 ;
}
send_hdlc(202,src_buf);
}*/
}
//C6678_TimeCounter_Delaycycles(10000000);
}
}
}
}
//Interrupt service routine for timer
void interrupt GPIO_ISR(void)
{
Uint32 eventFlag;
/*read interrupt flag*/
eventFlag= gpCGEM_regs->MEVTFLAG[2];
/*clear interrupt flag*/
gpCGEM_regs->EVTCLR[2]= eventFlag;
hdlc_rec_flag = 1;
}