📄 result_led.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 1999, (C) Copyright 1999 Texas Instruments. All rights reserved.
//
// Filename : Result_led.c
//
// Description : Main file for the Result Area,
// which contains all the test status
// into a table of 128 values in 16 bits size
// 1) Global i.e. Final result Item 0
// 2) Intermediary tests Items 1..99
// 3) Debug tests Items 100 .. 126
// 4) Stop Marker Set to 0xFFFF Item 127
// to make VHDL bench test stopping
// Project : TI925MM
// Author : Francois Reygagne freygagn@tif.ti.com
//===============================================================================
#include "global_types.h"
#include "led_inth.h"
#include "intvecs.h"
#include "result_led.h"
#include "led_bootled.h"
#include "led_testaccess.h"
#include "led_testbench.h"
#include "clkm1.h"
#define FB_RAM_BASE_ADDR 0x20000000
#define FB_RAM(ADDR) REG32(FB_RAM_BASE_ADDR+(ADDR<<2) )
#pragma DATA_SECTION (result_led, ".spy" )
UWORD16 result_led [RESULT_SIZE]; // To accomodate with LED we reserve 2 more values
//static UWORD16* start_location ;
static UWORD16* start_result = (UWORD16*)&result_led;
static UWORD16* global_value= (UWORD16*)((&result_led) +1);
/* Points the first elementary result */
/* Allows to reserve a number of result items */
/* in the range 1 .. (IndexFirstValue - 1) */
//static UWORD16* ptcurrent_value ;
static UWORD16* ptresult_current = (UWORD16*)&result_led;
extern void DumpSPY_Results(UWORD32, UWORD16);
extern void DisableCache_prefetch(void);
extern void resetregs (void);
UWORD32 resumecode[16] = { 0xE3A00000 ,
0xE3A01000,
0xE3A02000,
0xE3A03000,
0xE3A04000,
0xE3A05000,
0xE3A06000,
0xE3A07000,
0xE3A08000,
0xE3A09000,
0xE3A0A000,
0xE3A0B000,
0xE3A0C000,
0xE1A0D000,
0xE1A0E000,
0xE1A0F000 };
/*
//
// LED Functions
//
----------------------------------------------
- RES_Set Status -
----------------------------------------------
*/
extern void RES_SetLog(UWORD16 status);
void LED_ResSet(const UWORD16 status)
{
RES_SetLog(status);
// ptcurrent_value++;
// *(ptcurrent_value) = status;
ptresult_current++;
*(ptresult_current)= status;
}
/*
void RES_Set(const UWORD16 status)
{
LED_ResSet(status);
}
*/
//----------------------------------------------------------
// NAME : LED_ResGetFinal
// DESCRIPTION : LED signatures function
// PARAMETERS : None
// RETURN VALUE: global status of the test
//
// LIMITATIONS : Must be used at the end of test
// ----------------------------------------------------------
UWORD16 LED_ResGetFinal(void)
{
UWORD16* value;
UWORD16 ErrorCount=0;
// We begin to scan at index 3
// because index 1 == 0x5555
// index 2 == 0xAAAA
// for tdl led format
//-----------------------------
for (value = start_result + 1; value <= ptresult_current; value++)
{
if ( (*value) == START_ARRAY_DATA )
{
while(((*value) != END_ARRAY_DATA) AND (value <= ptresult_current))
value++;
}
else
if ( (*value) != RESULT_SEPARATOR &&
(*value) != TEST_OK &&
(*value) != TEST_RESET_VALUE_SEPARATOR &&
(*value) != TEST_MODULE_SEPARATOR &&
(*value) != GLOBAL_TEST_SEPARATOR &&
((*value)<MIN_ARRAY_OK ||
(*value)>MAX_ARRAY_OK))
{
ErrorCount++;
}//endif
}// end for
// (*start_location) = ErrorCount;
(*start_result) = ErrorCount;
if (ErrorCount == 0)
{
ptresult_current++;
*(ptresult_current)= 0xACED;
}
else
{
ptresult_current++;
*(ptresult_current)= 0xDEAD;
}
return RES_OK;
} // End RES_GetFinalLed
/*
----------------------------------------------------------
- LED_ResSetLocation -
----------------------------------------------------------
*/
void LED_ResSetLocation(const UWORD32 start_address)
{
UWORD16* headerPtr;
// start_location = (UWORD16*)(&result_led);
// ptcurrent_value = (UWORD16*)(&result_led);
// for tdl led format
headerPtr=(UWORD16*)(&result_led);
*(headerPtr)= 0x5555;
headerPtr++;
*(headerPtr)= 0xAAAA;
//
// Change address space to avoid smashing first 2 signatures (5555 / AAAA)
//
start_result = (UWORD16*)(((UWORD16*)&result_led)+2);
ptresult_current = (((UWORD16*)&result_led)+2);
// global_value = start_result;
}
/*
----------------------------------------------------------
- LED_ResInitResult -
----------------------------------------------------------
*/
void arm9_idle(void)
{
ledINT_SetSupervisor();
wait_for_interrupt();
ledINT_SetUser();
}
void LED_ResInitResult(void) {
#define RES_INIT_VAL 0xBABE
UWORD16* value;
for(value=start_result;value<(start_result+RESULT_SIZE);value++)
(*value) = RES_INIT_VAL;
ptresult_current = start_result;
} // LED_ResInitResult
//------------------------------------------------------------------------------
// NAME : LED_ResEndSimulation()
// DESCRIPTION :
// PARAMETERS : Input : None
// Output: None
// RETURN VALUE: None
// LIMITATIONS : None
// -----------------------------------------------------------------------------
void (*rf) ();
void LED_ResEndSimulation(void) {
int i;
//switch off the dpll
// CLKRST_DPLLCTL1 = 0x2000;
// wait until DPLL is unlocked
// while (CLKRST_DPLLCTL1_REG != 0x2002);
// all divider set to 1
ARM_CKCTL_REG &= 0x3000;
// Now program to full synchronous mode instead of Bypass mode
ARM_SYSST_REG &= 0xC7FF;
// Disable I-Cache and D-cache
//INT_SetSupervisor();
//DisableCache_prefetch();
//INT_SetUser();
// Address of the array containing the spy_results
// Address corresponding to the 0x2000_0040 physical address
// REG32(SPY_SRAM_ADDR)=(UWORD32)&result_led;
//save the value indicating the end of the spy array
// LED_ResSet(0xF1F1);
BOOT_ConfigureGpioLed(0xFFFBE400);
// Tester signaling
LED_ResetExec();
//for (i=0;i<15;i++) FB_RAM(4096+i) = resumecode[i];
//LED_PollSync();
arm9_idle();
resetregs ();
// Loop forever
while (1);
}
/* -----------------------------------------------------------------------------
NAME : LED_ResStopVhdl, LED_ResStopDpllVhdl
DESCRIPTION : Set THE_END into the last item of result area to stop VHDL
simulator
PARAMETERS : None
RETURN VALUE: None
LIMITATIONS : None
----------------------------------------------------------------------------- */
void LED_ResStopVhdl(void) {
LED_ResEndSimulation(); // Function call
}
void LED_ResStopDpllVhdl(void) {
LED_ResGetFinal();
LED_ResStopVhdl();
}
//------------------------------------------------------------------------------
// NAME : LED_ResException(void)
// DESCRIPTION : CPU Exception occured, combined test exception handler
// PARAMETERS : Input : None
// Output: None
// RETURN VALUE: None
// LIMITATIONS : None
//------------------------------------------------------------------------------
void LED_ResException(void) {
LED_ResSet(0xAB0F);
LED_ResStopDpllVhdl();
}
// END OF FILE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -