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

📄 resext.c

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 C
📖 第 1 页 / 共 2 页
字号:
/* ============================================================================
*
*            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 2003, (C) Copyright 2003 Texas Instruments.  All rights reserved.
*
*   Component:     RES - Results via SPY for cosimulation of OMAP2420 proj
*    
*   Filename:      RESExt.c           
*    
*   Description:   Contains functions to dump cosimulation results
*
*                  The OMAP4 Library has an interface called RESExt.h
*                  that provides the declarations of functions that 
*                  MUST be implemented by any project that uses the 
*                  OMAP4 Library. This file implements the OMAP24x0
*                  version of these functions.
*
*   Domain:     All
*
*   Board:      Simulation only
*
*   Fucntional Specifcation Version: Not valid
*
*   Validating Test Cases: None
*    
* =============================================================================
*/
/* ============================================================================
* STANDARD INCLUDE FILES
* =============================================================================
*/

/* ============================================================================
* PROJECT SPECIFIC INCLUDE FILES
* =============================================================================
*/
#include "GlobalTypes.h"
#include "RESExt.h"
#include "MSG.h"
#include "BaseAddress.h"

/* ============================================================================
* LOCAL TYPES AND DEFINITIONS
* =============================================================================
*/

/* ----------------------------------------------------------------------------
* Definition: RES_BUF_SIZE
*
* DESCRIPTION: Number of UWORD16 Elements in Results buffer
*
* -----------------------------------------------------------------------------
*/
#define RES_BUF_SIZE    1024

/* ----------------------------------------------------------------------------
* Definition: RES_FIRST_DATA_LOCATION
*
* DESCRIPTION: Offset in table where first result is written too
*
* -----------------------------------------------------------------------------
*/
#define RES_FIRST_DATA_LOCATION         1

/* ----------------------------------------------------------------------------
* Definition: RES_BUF_SPACE
*
* DESCRIPTION: Number of UWORD16 Elements available space
*
* -----------------------------------------------------------------------------
*/
#define RES_BUF_SPACE         (RES_BUF_SIZE-RES_FIRST_DATA_LOCATION)

/* ----------------------------------------------------------------------------
* Definition: RES_RES_BUF_SPACE
*
* DESCRIPTION: Size of array header in UWORD16 elements
*
* -----------------------------------------------------------------------------
*/
#define RES_ARRAY_HEADER_SIZE         2

/* ----------------------------------------------------------------------------
* Definition: RES_THE_END
*
* DESCRIPTION: this is correct value to write to cause test to end
*
* -----------------------------------------------------------------------------
*/
#define RES_THE_END                     0xFFFF

/* ----------------------------------------------------------------------------
* Definition: RES_RANGE_MASK_VAL
*
* DESCRIPTION: result code mask for lower byte containing good and bad values
*
* -----------------------------------------------------------------------------
*/
#define RES_RANGE_MASK_VAL      0x00FF


/* ============================================================================
* GLOBAL VARIABLES DECLARATIONS
* =============================================================================
*/

/* internal table in memory of results values */
/* The first element in this array is used to indicate if a 
   a test passed or not. The other elements in array contain various
   result values which are written as the test progresses
    
   The #pragma is used here to place the array in a section that is NOT
   initialised by the start up code. 
*/

#ifndef __TITOOLCHAIN__

#pragma arm section zidata = "uninit"
UWORD16 RES_IntTable[RES_BUF_SIZE]; 
#pragma arm section zidata                  

#else

UWORD16 RES_IntTable[RES_BUF_SIZE]; 

#endif /* __TITOOLCHAIN__ */

/* ============================================================================
* LOCAL VARIABLES DECLARATIONS
* =============================================================================
*/

/* pointer to start of external table of results */
static UWORD16* res_pExtStart = NULL;

/* pointer to start of internal table of results */
static UWORD16* res_pIntStart = RES_IntTable;

/* offset in elements from start of table where next result will be stored  */
static UWORD32 res_pTabOffset = 0;



/* ============================================================================
* LOCAL FUNCTIONS PROTOTYPES
* =============================================================================
*/

/* ============================================================================
* FUNCTIONS
* =============================================================================
*/
ReturnCode_t RES_SetLocation(
                const UWORD32 startAddress
                )
{
    ReturnCode_t returnCode = TEST_OK;
#ifdef __BOARD__
    UWORD16 cnt;

    /* Clear memory area for internal SPY usage */
    for (cnt=0; cnt<RES_BUF_SIZE; cnt++)
    	RES_IntTable[cnt]=0x0000;
#endif 

    /* setup up external pointers */
    res_pExtStart   = (UWORD16*) startAddress;

    /* reset internal pointer */
    res_pIntStart = RES_IntTable;

    /* indicate that test not finished yet in first element */
    /* and that spy has initialised                         */
    *res_pIntStart = RES_SPY_INIT_OK;
    *res_pExtStart = RES_SPY_INIT_OK;

    /* Set offset to point tofirst data location */
    res_pTabOffset = RES_FIRST_DATA_LOCATION;

    return returnCode;
}		

/*==================== Function Separator =============================*/

ReturnCode_t RES_Set(
                const UWORD16 status
                )
{
    ReturnCode_t returnCode = TEST_OK;

    /* Check if array full */
    CHECK_INPUT_RANGE_NO_SPY_MIN0(
                    res_pTabOffset, 
                    RES_BUF_SPACE, 
                    RET_FULL); 

    /* write value to res_pTabOffset element of external result table */
    *(res_pExtStart + res_pTabOffset) = status;
    
    /* write value to an element of internal result table */
    *(res_pIntStart + res_pTabOffset) = status;

    /* Set offset to point to next element */
    res_pTabOffset++;

    return returnCode;
}		

/*==================== Function Separator =============================*/

ReturnCode_t RES_SetVar(
                const UWORD16 status
                )
{
    ReturnCode_t returnCode = TEST_OK;

    /* Check if array full */
    CHECK_INPUT_RANGE_NO_SPY_MIN0(
                    res_pTabOffset, 
                    RES_BUF_SPACE, 
                    RET_FULL); 

    /* check if value is illegal value  */
    if ((status & RES_THE_END) == RES_THE_END)
    {
        /* write value to res_pTabOffset element of external result table */
        *(res_pExtStart + res_pTabOffset) = RES_BADD_VALUE;
        
        /* write value to an element of internal result table */
        *(res_pIntStart + res_pTabOffset) = RES_BADD_VALUE;

        /* Set offset to point to next element */
        res_pTabOffset++;
    }
    /* else valid value  */
    else
    {

        /* write value to res_pTabOffset element of external result table */
        *(res_pExtStart + res_pTabOffset) = status;
    
        /* write value to an element of internal result table */
        *(res_pIntStart + res_pTabOffset) = status;

        /* Set offset to point to next element */
        res_pTabOffset++;
    }

    return returnCode;
}		

/*==================== Function Separator =============================*/
ReturnCode_t RES_SetArray(
                const UWORD16 numArray,
                const UWORD16 *const statusArray
                )
{
    ReturnCode_t returnCode = TEST_OK;
    UWORD16 counter = 0;

    /* check input pointer */
    CHECK_INPUT_PARAM(statusArray, NULL,  RET_BAD_NULL_PARAM, RES_RES_BASE + RES_INVALID_INPUT_PARAM);
    
    /* check num array greater than max space */
    CHECK_INPUT_RANGE_MIN0(numArray,RES_BUF_SPACE-RES_ARRAY_HEADER_SIZE, RET_PARAM_OUT_OF_RANGE, RES_RES_BASE + RES_INVALID_INPUT_PARAM);
    
    /* check if space for all array */

⌨️ 快捷键说明

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