📄 common.h
字号:
/*
* Copyright:
* ----------------------------------------------------------------
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2003,2004 ARM Limited
* ALL RIGHTS RESERVED
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
* ----------------------------------------------------------------
* File: common.h
* Release: Version 1.1
* ----------------------------------------------------------------
*
* ----------------------------------------
* Version and Release Control Information:
*
* File Name : $RCSfile$
* File Revision : $Revision: 107 $
*
* ----------------------------------------
*
* Common Interface
* ================
*/
#define FALSE 0
#define TRUE 1
// System Control registers
#define SYS_BASE 0x10000000
#define SYS_ID ((volatile unsigned int *)(SYS_BASE + 0x00))
#define SYS_SW ((volatile unsigned int *)(SYS_BASE + 0x04))
#define SYS_LED ((volatile unsigned int *)(SYS_BASE + 0x08))
#define SYS_OSC0 ((volatile unsigned int *)(SYS_BASE + 0x0C))
#define SYS_OSC1 ((volatile unsigned int *)(SYS_BASE + 0x10))
#define SYS_OSC2 ((volatile unsigned int *)(SYS_BASE + 0x14))
#define SYS_OSC3 ((volatile unsigned int *)(SYS_BASE + 0x18))
#define SYS_OSC4 ((volatile unsigned int *)(SYS_BASE + 0x1C))
#define SYS_LOCK ((volatile unsigned int *)(SYS_BASE + 0x20))
#define SYS_MCI ((volatile unsigned int *)(SYS_BASE + 0x48))
#define SYS_MISC ((volatile unsigned int *)(SYS_BASE + 0x60))
#define SYS_CLCD ((volatile unsigned int *)(SYS_BASE + 0x50))
#define SYS_TEST_OSC0 ((volatile unsigned int *)(SYS_BASE + 0x80))
#define SYS_TEST_OSC1 ((volatile unsigned int *)(SYS_BASE + 0x84))
#define SYS_TEST_OSC2 ((volatile unsigned int *)(SYS_BASE + 0x88))
#define SYS_TEST_OSC3 ((volatile unsigned int *)(SYS_BASE + 0x8C))
#define SYS_TEST_OSC4 ((volatile unsigned int *)(SYS_BASE + 0x90))
// Timers 0/1
#define TIMER01_BASE 0x101E2000
#define TIMER0_LOAD ((volatile unsigned int *)(TIMER01_BASE + 0x00))
#define TIMER0_VALUE ((volatile unsigned int *)(TIMER01_BASE + 0x04))
#define TIMER0_CTRL ((volatile unsigned int *)(TIMER01_BASE + 0x08))
#define TIMER0_CLR ((volatile unsigned int *)(TIMER01_BASE + 0x0C))
// SYS_MCI register
#define SYS_MCI_CARDIN0 0x01 // MMCI card detect 0
#define SYS_MCI_CARDIN1 0x02 // MMCI card detect 1
#define SYS_MCI_WPROT0 0x04 // MMCI write protect 0
#define SYS_MCI_WPROT1 0x08 // MMCI write protect 1
// SYS_CLCD register
#define SYS_CLCD_MODE 0x03 // Mode mask
#define SYS_CLCD_555 0x01 // Mode is 5-5-5 mux
#define SYS_CLCD_24 0x00 // Mode is 24bit
#define SYS_CLCD_EN 0x14 // Enable CLCD and VGA
// Misc defines
#define SLEEP_TIMEOUT 1000 // Maximum time for timer to be loaded
#define EXTN_CMID_REV 0x01 // Exstensor SYS_ID should be rev 1
/*
* Description:
* Error codes - each module is assigned space for error codes from apERR_XXXX_START to apERR_XXXX_START+255.
*
* Implementation:
* Define an enumerated type apError. By using this it is posible to avoid the
* need to specify individual values for the error constants, but can simply append
* new constants to the list below.
*
* Code numbers with the top bit clear are generic errors.
* Those with the top bit set (negative) are module-specific errors
*/
#ifndef _EXTN_ERROR_H
#define _EXTN_ERROR_H
typedef enum
{
/*---------------Generic errors---------------*/
apERR_NONE =0,
apERR_BAD_PARAMETER =1, // Call failed due to a parameter out of range.
apERR_UNSUPPORTED =2, // Call failed due to a parameter which was in range,
// but unsupported for this variant of the hardware.
apERR_BUSY =3, // Resource is already in use
/*--------------Specific errors---------------*/
/* Returns errors of the form 0xFFFFxxxx */
apERR_BUZZER_START = apERR_NONE - 0x100, /*Module apBUZZER*/
apERR_MMC_START = apERR_BUZZER_START - 0x100, /*Module apMMC*/
apERR_SCI_START = apERR_MMC_START - 0x100, /*Module apSCI*/
apERR_UART0_START = apERR_SCI_START - 0x100, /*Module apUART0*/
apERR_UART1_START = apERR_UART0_START - 0x100, /*Module apUART1*/
apERR_IRDA_START = apERR_UART1_START - 0x100, /*Module apIRDA*/
apERR_LCD_START = apERR_IRDA_START - 0x100, /*Module apLCD*/
apERR_TSCI_START = apERR_LCD_START - 0x100, /*Module apTSCI*/
apERR_LCDBIAS_START = apERR_TSCI_START - 0x100, /*Module apLCDBIAS*/
apERR_AACI_START = apERR_LCDBIAS_START- 0x100, /*Module apAACI*/
apERR_LEDS_START = apERR_AACI_START - 0x100, /*Module apLEDS*/
apERR_GPIO_START = apERR_LEDS_START - 0x100, /*Module apGPIO*/
apERR_KYBD_START = apERR_GPIO_START - 0x100, /*Module apKYBD*/
apERR_MOUSE_START = apERR_KYBD_START - 0x100, /*Module apMOUSE*/
apERR_LANI_START = apERR_MOUSE_START - 0x100, /*Module apLANI*/
apERR_CLOCK_START = apERR_LANI_START - 0x100, /*Module apCLOCK*/
apERR_USB_START = apERR_CLOCK_START - 0x100, /*Module apUSB*/
apERR_MEM_START = apERR_USB_START - 0x100, /*Module apMEM*/
/*============================================*/
apERR_END // Dummy terminator
} apError;
#endif
#ifndef _EXTN_STATUS_H
#define _EXTN_STATUS_H
// Return status
typedef enum sts
{
TEST_S_UNKNOWN,
TEST_S_NOTRUN,
TEST_S_SUCCESS,
TEST_S_FAILURE,
MAX_STATUS
}
Status_t;
#endif
// Declaration of the global variables
extern unsigned int RunAllTests; //Used to indicate Run All Tests mode
// Function prototypes
unsigned int register_test(volatile unsigned int *addr, int firstbit,int lastbit);
void apSleep(unsigned int msec);
void apSleepus(unsigned int usec);
void Wait_For_Enter (int always);
int Get_OK(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -