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

📄 hpi_common.c

📁 dsp tms320c6486的csl例程
💻 C
字号:
/*****************************************************************************\
*           TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION           
*                                                                            
*  Property of Texas Instruments 
*  For  Unrestricted  Internal  Use  Only 
*  Unauthorized reproduction and/or distribution is strictly prohibited.  
*  This product is protected under copyright law and trade secret law 
*  as an unpublished work.  
*  Created 2004, (C) Copyright 2003 Texas Instruments.  All rights reserved.
*------------------------------------------------------------------------------
*  Filename       : hpi_common.c
*  Date Created   : Feb 10, 2005
*  Last Modified  : Feb 15, 2005
*  Description    : Common functions defined for the UHPI Test Cases.
*
*  History        :
*  Project        : Himalaya
*  Author         : Raja
\*****************************************************************************/

#include <csl.h>
#include "hpi_const.h"    /* Device specific file */
#include "hpi_common.h"
#include "tomahawk.h"
#include <csl_gpio.h>


    CSL_Status                  intStat;
    CSL_GpioPinConfig           config;
    CSL_GpioPinNum              pinNum;
    CSL_Status                  status;
    CSL_GpioContext             pContext;
    CSL_GpioObj                 gpioObj;
    CSL_GpioHwSetup             hwSetup;
CSL_GpioHandle hGpio;


/* Wait until Pre-loaded memory is properly initialized */
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;
}


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);
}


Uint32 Data_Compare_HPI_Hwob(Uint32 *dsp_ref_addr, 
                             Uint32 *dsp_dst_addr,
                             Uint32 length)
{
    Uint32 i;
    Uint32 ref_val1, ref_val2;
    Uint32 dst_val1, dst_val2;
 
    for (i=0; i<length; i++)
    {
       /* Since HWOB bit is set to "1", LSB's and MSB's should be swapped before comparison */

       ref_val1 = (dsp_ref_addr[i] >> 16) & (0x0000FFFF);
       dst_val1 = dsp_dst_addr[i] & (0x0000FFFF);

       if (ref_val1 != dst_val1)
       {
          return (FAIL);
       }

       ref_val2 = (dsp_ref_addr[i] & (0x0000FFFF));
       dst_val2 = ((dsp_dst_addr[i] >> 16) & (0x0000FFFF));

       if (ref_val2 != dst_val2)
       {
          return (FAIL);
       }
    }

    return (PASS);
}


void init_gpio()
{
    hGpio = CSL_gpioOpen(&gpioObj, CSL_GPIO, NULL, &status);
}



void setup_gpio()
{
    /* TB Synchronisation-> Setting GPIO 12 as O/p and 13 as I/P */
//    CSL_GPIO_REGS->DIR = 0x2000;GPIO_OUT_DATA_OUT12
    CSL_FINS (hGpio->regs->DIR, GPIO_DIR_DIR13, 1);
  
    /* TB Synchronisation-> Setting GPIO 12 */
//    CSL_GPIO_REGS->BANK[0].OUT_DATA = 0x1000;
    CSL_FINS (hGpio->regs->OUT_DATA, GPIO_OUT_DATA_OUT12, 1);

//	while(CSL_GPIO_REGS->BANK[0].IN_DATA != 0x3000)
    while (hGpio->regs->IN_DATA != 0x3000)
	{
	}

//	CSL_GPIO_REGS->BANK[0].OUT_DATA = 0x0000;
    CSL_FINS (hGpio->regs->OUT_DATA, GPIO_OUT_DATA_OUT12, 0);

//	while(CSL_GPIO_REGS->BANK[0].IN_DATA != 0x0000)
    while (hGpio->regs->IN_DATA != 0x0000)
	{
	}
}




/*****************************************************************************\
* End of hpi_common.c
\*****************************************************************************/

⌨️ 快捷键说明

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