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

📄 rbwmain.c.bak

📁 在ccs中调试DSP外部存储sdram的反色代码
💻 BAK
字号:
/*
 *  Copyright 2008 by Boss.H Lab.
 *  All rights reserved. Property of Boss.H Lab.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  	
 */
/* copy_in_out 2008.07.07 ver 1.0 */
/*
 *输入一副24位深的BMP黑白图像,反转颜色输出
 */

/*
 *  ======== rBWmain.c ========
 */
 
/*引用头文件*/
#include <std.h>
#include <csl_stdinc.h>
#include <hst.h>
#include <pip.h>
#include <swi.h>
#include <log.h>
#include "rBWcfg.h"	/*DSP_BIOS头文件,由CCS根据CDB配置自动生成*/

/*SDRAM映射地址0x80000000,长度0x08000000,共128MB*/
#define MT48_SDRAM_BASE		0x80000000

/*定义一个全局变量,根据文件大小控制执行次数*/
static Uns count;

/*子函数列表,功能见下*/
Void intomem(HST_Obj *input);
Void outofmem(HST_Obj *output);
Void reversalBW(Void);
Void inputReady(Void);
Void outputReady(Void);

/*
 *  ======== main ========
 *主函数,初始化相关变量
 */
Void main(Int argc, String argv[])
{
	CSL_init();
	EMIFA_config(&MT48);
	
	count = 0x0;
	
    LOG_printf(&trace, "reversal Black&White started.");
	
    /* fall into BIOS idle loop */
    return;                 
}

/*
 *  ======== intomem ========
 *HST_input通道数据拷贝进SDRAM 0x80000000开始的区域
 */
Void intomem(HST_Obj *input);
{
    PIP_Obj     *in;
    Uns         *src;
    Uns         size;
    
    LOG_printf(&trace, "intomem started.");
    /*创建PIP对象in,设定相关参数*/
    in = HST_getpipe(input);/*绑定in到HST对象input上*/
    
    /*PIP_get(in); get input data */    
    LOG_printf(&trace, "PIP_getReaderNumFrames = %x\n", PIP_getReaderNumFrames(in));
    
    src = PIP_getReaderAddr(in);/*得到in的地址*/
    size = PIP_getReaderSize(in);/*得到in的size长度*/
    LOG_printf(&trace, "PIP_getReaderSize = %x\n", size);
    
    /* copy input data to SDRAM 0x80000000 */
    for (; size > 0; size--) {
    	*((Uint32 *)(MT48_SDRAM_BASE + (count<<2))) = *src++;
    	count++;
    }
	//LOG_printf(&trace, "count = %x\n", count);
	
    /* free input buffer 
    
    PIP_free(in);*/
    
    /*测试各种函数的返回值*/
    
    
    LOG_printf(&trace, "PIP_free = %x\n", PIP_free(in));
	/*PIP_getReaderNumFrames(in)这个是否可以触发新软件中断*/
}

/*
 *  ======== outofmem ========
 *HST_input通道数据拷贝进SDRAM 0x80000000开始的区域
 */
Void outofmem(HST_Obj *output);
{
	LOG_printf(&trace, "outofmem started.");
}

/*
 *  ======== reversalBW ========
 *1、读取传输文件大小
 *2、读取图像行列
 *3、每行按位取反
 *4、跳过行尾添加的0x00
 *5、判断操作结束,激活outofmem
 */
Void reversalBW(Void);
{
	LOG_printf(&trace, "reversalBW started.");
}

/*
 * ======== inputReady ========
 */
Void inputReady(Void)
{	
	LOG_printf(&trace, "inputReady started.");
	SWI_andn(&intomemSwi, 1);/* clear swi mbx bit position 0 */
}

/*
 * ======== outputReady ========
 */
Void outputReady(Void)
{
	LOG_printf(&trace, "outputReady started.");
    SWI_andn(&outofmemSwi, 2); /* clear swi mbx bit position 1 */

}

⌨️ 快捷键说明

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