mpui.c

来自「OMAP5912双核通信机制中MPUI机制,ARM侧程序.在CCStudio上运」· C语言 代码 · 共 59 行

C
59
字号
#include "5912_reg.h"
#include "boot_data.h"
#include <stdio.h>

void main( )
{
	volatile unsigned short *section_addr;
	int code_offset,section_length;
	int i,j;
	unsigned int data;
	
	
//	ARM_RSTCT1=0x00000004;
//	DSP_API_CONFIG=0;
//	ARM_IDLECT2|=0x00000040;
	CTRL_REG=0x0000FF1F;
	DSP_BOOT_CONFIG=0x00000005;

//	printf("%x\n",boot_data[11]);
//	printf("%x\n",((boot_data[11])<<8));

	printf("Start\n");

	code_offset=0;
	section_addr=((volatile unsigned short *)0xE0010000);
	section_length=boot_data[code_offset];
	j=1;
	while(section_length!=0)
	{
		code_offset=code_offset+2;
		for(i=0;i<section_length;i++)
		{
			//printf("%d,%d  ",j,code_offset);
			(*(volatile unsigned short *)section_addr++)=(boot_data[code_offset]);
			code_offset++;
		}
		//printf("\n%d\n",code_offset);
		section_length=boot_data[code_offset];
		j++;
	}	
	
	
	/*	take the DSP subsysytem out of reset	*/
	ARM_RSTCT1 |= 0x00000002;
	
	
	/* 与DSP通信 */
	while(1)
	{
		data=*( VUint32* )0xE0002000;
		if((data&0x0000FFFF)==0x1235)
		{
			printf("Communication is Successful!!!\n");
			break;
		}
	}
	
}

⌨️ 快捷键说明

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