?? main.c
字號:
/*****************************************************************************
** **
** Name: post_main.c **
** **
******************************************************************************
(C) Copyright 2006 - Analog Devices, Inc. All rights reserved.
Pjoject Name: 21262 POST ATE
Date Modified: 11 May 2006
Software: VisualDSP++ 4.5
Hardware: ADSP-21262 EZ-KIT Lite
Connections:
Purpose: Purpose: Perform a POST ATE on the 21262 EZ-Kit Lite
21262 EZ-KIT board test indicators (version 1.00.0 11 May 2006)
Enter 21262 EZ-KIT POST test by pressing PB4. All other LEDs not shown below do
not matter and may be on or off.
LED1 LED2 LED3 LED4
VERSION 1 0 0 0
PBLED 0 1 0 0
SRAM 1 1 0 0
AM29LV081B 0 0 1 0
AT25F2048 1 0 1 0
ANALOG_AUDIO 0 1 1 0 SW11 All on
DIGITAL_AUDIO 1 1 1 0
The switch settings for the built in self test differ slightly from the default settings shipped.
See the users manual for default switch settings.
Switch settings:
- SW6 = OFF,OFF,OFF,OFF
- SW7 1 = OFF, 2 = ON, 3 = ON, 4 = ON
- SW9 1 = ON, 2 = ON, 3 = ON, 4 = ON, 5 = OFF, 6 = OFF
- SW10 1 = OFF, 2 = ON, 3 = OFF, 4 = ON
- SW11 All ON
- SW12= ALL ON
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Enter USB EZ-Extender POST test by pressing SW3 along with SW4
Test indicators are as follows:
LED1 LED2 LED3 LED4
USB 1 0 0 0
NOTE: This test disables the LED's, so the acutal LED pattern may vary. The
indication of a pass/fail should be the data returned by the usb hostapp.exe
The switch settings for the built in self test for the USB EZ-Extender differ slightly from the default
settings shipped. The "*" indicates the only setting that is different from the normal
POST settings above. See the users manual for default switch settings.
Switch settings:
SW6 = OFF,OFF,OFF,OFF
- SW7 1 = OFF, 2 = ON, 3 = ON, 4 = ON
- SW8 All ON
- *SW9 1 = OFF, 2 = OFF, 3 = ON, 4 = ON, 5 = OFF, 6 = OFF
- SW10 1 = OFF, 2 = ON, 3 = OFF, 4 = ON
- SW11 All ON
Settings for the USB EZ-Extender:
- JP1: not installed
*****************************************************************************/
#include <Cdef21262.h>
#include <def21262.h>
#include <sysreg.h>
#include <string.h>
#include "post_common.h"
//////////////////////////////////////////////////////////////////////////////
//
// variables
//
//////////////////////////////////////////////////////////////////////////////
int g_loops = 0;
char g_szVersion[64] = "1.30.0";
char g_szBuildDate[64];
char g_szBuildTime[64];
//////////////////////////////////////////////////////////////////////////////
//
// function prototypes
//
//////////////////////////////////////////////////////////////////////////////
int TEST_VERSION(void);
int TEST_PBLED(void);
int TEST_SRAM(void);
int TEST_AM29LV081B_FLASH(void);
int TEST_AT25F2048_FLASH(void);
int TEST_ANALOG_AUDIO(void);
int TEST_DIGITAL_AUDIO(void);
int TEST_USB(void);
int TEST_DUMMY(void) {return 1;} // place holder test
typedef enum TEST_INDEX_tag{
VERSION, //0001
PBLED, //0010
SRAM, //0011
AM29LV081B, //0100
AT25F2048, //0101
ANALOG_AUDIO, //0110
DIGITAL_AUDIO, //0111
USB, //1000
DUMMY, //1001
NUM_TESTS
}enTEST_INDEX;
typedef int (*pfnTests)(void);
typedef struct stTestParams_TAG
{
enTESTS m_nTest;
enTEST_STATES m_nTestState;
pfnTests m_pTestFunctions;
}stTestParamaters;
stTestParamaters g_Tests[NUM_TESTS] = {
{TEST_1, TEST_1_SET, TEST_VERSION},
{TEST_2, TEST_2_SET, TEST_PBLED},
{TEST_3, TEST_3_SET, TEST_SRAM},
{TEST_4, TEST_4_SET, TEST_AM29LV081B_FLASH},
{TEST_5, TEST_5_SET, TEST_AT25F2048_FLASH},
{TEST_6, TEST_6_SET, TEST_ANALOG_AUDIO},
{TEST_7, TEST_7_SET, TEST_DIGITAL_AUDIO},
{TEST_8, TEST_8_SET, TEST_USB},
{TEST_9, TEST_9_SET, TEST_DUMMY} };
//////////////////////////////////////////////////////////////////////////////
// void PerformTest( const stTestParamaters Test )
//
// Purpose: Wrap up the test paramaters and perform the test
//////////////////////////////////////////////////////////////////////////////
int PerformTest( const stTestParamaters Test, const int nIgnoreResult )
{
int nResult = 0;
Delay(BLINK_FAST * 25);
ClearSet_LED_Bank( (-1), 0x0000);
ClearSet_LED_Bank( Test.m_nTest, Test.m_nTestState); // change the state of the led
Delay(BLINK_SLOW * 10);
if( 0 == Test.m_pTestFunctions() )
{ // test failed
if( 0 == nIgnoreResult )
{
Blink_LED( Test.m_nTest, BLINK_FAST );
}
else if( 1 == nIgnoreResult )
{
int n;
for( n = 0; n < 30; n++ )
{
Delay(BLINK_SLOW);
ClearSet_LED_Bank( (-1), 0x0000);
ClearSet_LED_Bank( Test.m_nTest, 0); // change the state of the led
Delay(BLINK_SLOW);
ClearSet_LED_Bank( (-1), 0x0000);
ClearSet_LED_Bank( Test.m_nTest, 1); // change the state of the led
}
}
}
return nResult;
}
//////////////////////////////////////////////////////////////////////////////
//
// Main program
//
//////////////////////////////////////////////////////////////////////////////
int main(void)
{
int iReturn = 0;
int bPassed = 0;
enLED enLEDs;
int nDelay;
strcpy(g_szBuildDate, __DATE__);
strcpy(g_szBuildTime, __TIME__);
Setup_leds();
int nPB3_4 = 0;
nPB3_4 = ((*pDAI_PIN_STAT & 0x000C0000) >> 18);
if( (0x01 == (nPB3_4 & 0x01)) && (0x02 == (nPB3_4 & 0x02)) ) // PB3 + PB4 was pressed.
{
*pSYSCTL &= ~PPFLGS; // disable this bit for USB to work
asm("nop; nop; nop; nop;");
PerformTest( g_Tests[USB], 0 );
// this test should run forever, so this will never get run.
*pSYSCTL |= PPFLGS; // re-enable this bit
asm("nop; nop; nop; nop;");
}
// if the test mode button SW9 was depressed at boot time,
// then the test mode will be entered, otherwise the
// led bar will display continuously.
if( (0x01 == (nPB3_4 & 0x01)) && (0x02 != (nPB3_4 & 0x02)) ) // only PB3 was pressed.
{
while(1)
{
PerformTest( g_Tests[DIGITAL_AUDIO], 0 );
g_loops++;
// indicate everything passed
ClearSet_LED_Bank( (-1), 0x0000);
LED_BAR( BLINK_SLOW);
}
}
// if the test mode button SW4 was depressed at boot time,
// then the test mode will be entered, otherwise the
// led bar will display continuously.
if( (0x02 == (nPB3_4 & 0x02)) && (0x01 != (nPB3_4 & 0x01)) ) // only PB4 was pressed.
{
ClearSet_LED_Bank( (-1), 0x0000);
// do the push button & LED test first
// if this fails, there is not much point
// in going on as there is no way to get
// feedback to the user about which test
// failed.
TEST_PBLED();
// WAIT A BIT, THEN RESET THE LED's
Delay(BLINK_FAST * 100);
while(1)
{
int nTestIndex;
for( nTestIndex = 2; nTestIndex < DIGITAL_AUDIO; nTestIndex++ )
{
PerformTest( g_Tests[nTestIndex], 0 );
}
g_loops++;
// indicate everything passed
ClearSet_LED_Bank( (-1), 0x0000);
LED_BAR( BLINK_SLOW);
}
}
// this is just normal blink mode.
while(1)
{
LED_BAR(BLINK_SLOW);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -