📄 hpi_common.c
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2006
*
* Use of this software is controlled by the terms and conditions found
* in the license agreement under which this software has been supplied.
* ============================================================================
*/
/** ============================================================================
*
* @file hpi_common.c
*
* @path $(CSLPATH)\example\c6486\hpi\src
*
* @desc Common functions defined for HPI read and write example.
*
****************************************************************************
*/
/* =============================================================================
* Revision History
* ===============
* 03-Aug-2006 NG Created
* =============================================================================
*/
#include <csl.h>
/* Device specific file */
#include "hpi_common.h"
#include <csl_gpio.h>
#include <soc.h>
#define FAIL 1
#define PASS 0
CSL_GpioHandle hGpio;
CSL_GpioPinData gpioPinData;
CSL_GpioPinConfig gpioConfig;
/*
* =============================================================================
* @func Wait_For_Memory_Initialization
*
* @desc
* @n This function is to Wait until Pre-loaded memory is properly initialized
*
* @arg
* None
*
* @return
* None
* =============================================================================
*/
void Wait_For_Memory_Initialization (
Uint32 *dsp_src_buff,
Uint32 length
)
{
Uint32 tmp_val;
/* Wait for the pre-loaded data */
while (1) {
tmp_val = dsp_src_buff[length - 1];
if (tmp_val != 0) {
break;
}
}
/* Perform a Write and wait until Read is completed */
dsp_src_buff[length - 1] = 0xC0FE1111;
while ((dsp_src_buff[length - 1]) != 0xC0FE1111);
dsp_src_buff[length - 1] = tmp_val;
}
/*
* =============================================================================
* @func Data_Compare_HPI
*
* @desc
* @n This function is to Compare Source and Destination Buffer
*
* @arg
* None
*
* @return
* None
* =============================================================================
*/
Uint32 Data_Compare_HPI (
Uint32 *dsp_src_addr,
Uint32 *dsp_dst_addr,
Uint32 length
)
{
Uint32 i;
for (i = 0; i < length; i++) {
if(dsp_src_addr[i] != dsp_dst_addr[i]) {
return (FAIL);
}
}
return (PASS);
}
/*
* =============================================================================
* @func setup_gpio
*
* @desc
* @n This function is used for handshaking between testbench and dsp
*
* @arg
* None
*
* @return
* None
* =============================================================================
*/
void setup_gpio (
)
{
/* TB Synchronisation-> Setting GPIO 12 as O/p and 13 as I/P */
hGpio->regs->DIR = 0x2000;
/* TB Synchronisation-> Setting GPIO 12 */
hGpio->regs->OUT_DATA = 0x1000;
while(hGpio->regs->IN_DATA != 0x3000) {
;
}
hGpio->regs->OUT_DATA = 0x0000;
while(hGpio->regs->IN_DATA != 0x0000) {
;
}
}
/* End of hpi_common.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -