📄 sys_api.h
字号:
/************************************************************************
*
* sys_api.h
*
* Header file for system functions
*
*
* ######################################################################
*
* Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved.
*
* Unpublished rights reserved under the Copyright Laws of the United States of
* America.
*
* This document contains information that is proprietary to MIPS Technologies,
* Inc. ("MIPS Technologies"). Any copying, modifying or use of this information
* (in whole or in part) which is not expressly permitted in writing by MIPS
* Technologies or a contractually-authorized third party is strictly
* prohibited. At a minimum, this information is protected under unfair
* competition laws and the expression of the information contained herein is
* protected under federal copyright laws. Violations thereof may result in
* criminal penalties and fines.
* MIPS Technologies or any contractually-authorized third party reserves the
* right to change the information contained in this document to improve
* function, design or otherwise. MIPS Technologies does not assume any
* liability arising out of the application or use of this information. Any
* license under patent rights or any other intellectual property rights owned
* by MIPS Technologies or third parties shall be conveyed by MIPS Technologies
* or any contractually-authorized third party in a separate license agreement
* between the parties.
* The information contained in this document constitutes one or more of the
* following: commercial computer software, commercial computer software
* documentation or other commercial items. If the user of this information, or
* any related documentation of any kind, including related technical data or
* manuals, is an agency, department, or other entity of the United States
* government ("Government"), the use, duplication, reproduction, release,
* modification, disclosure, or transfer of this information, or any related
* documentation of any kind, is restricted in accordance with Federal
* Acquisition Regulation 12.212 for civilian agencies and Defense Federal
* Acquisition Regulation Supplement 227.7202 for military agencies. The use of
* this information by the Government is further restricted in accordance with
* the terms of the license agreement(s) and/or applicable contract terms and
* conditions covering this information from MIPS Technologies or any
* contractually-authorized third party.
*
************************************************************************/
#ifndef SYS_API_H
#define SYS_API_H
#ifndef _ASSEMBLER_
/************************************************************************
* Include files
************************************************************************/
#include <serial_api.h>
#include <gdb_stub.h>
/************************************************************************
* Definitions
*************************************************************************/
#define MIPS_NAME "MIPS Technologies, Inc."
/* Display macros (ASCII display) */
#define DISP( val ) sys_disp( val )
#define DISP_CH( pos, ch ) sys_disp_ch( pos, ch )
#define DISP_STR( s ) sys_disp_str( s )
#define PUTCHAR(port, ch) sys_putchar(port, ch)
#define GETCHAR(port, ch) sys_getchar(port, ch)
#define GETCHAR_CTRLC(port) sys_getchar_ctrlc(port)
#define PUTS(port, s) sys_puts(port, s)
#ifdef _DEBUG_
#define DEBUG(s) PUTS(DEBUG_PORT, s)
#else
#define DEBUG(s)
#endif
/* Default baudrates for serial ports */
#define DEFAULT_BAUDRATE SERIAL_BAUDRATE_115200_BPS
#define DEFAULT_DATABITS SERIAL_DATABITS_8
#define DEFAULT_PARITY SERIAL_PARITY_NONE
#define DEFAULT_STOPBITS SERIAL_STOPBITS_10
#define DEFAULT_FLOWCTRL SERIAL_FLOWCTRL_NONE
/* Default env. variable for serial port settings */
#define DEFAULT_SERIAL_ENV "115200,n,8,1,none"
/* Board Serial number type */
#define SYS_SN_BCD_SIZE 5 /* BCD coded (eeprom format) */
#define SYS_SN_ASCII_SIZE 11 /* ascii coded (syscon format ),
including '\0' termination */
typedef UINT8 t_sn_bcd[SYS_SN_BCD_SIZE];
typedef char t_sn_ascii[SYS_SN_ASCII_SIZE];
/* MAC address type (Ethernet address). */
#define SYS_MAC_ADDR_SIZE 6
typedef UINT8 t_mac_addr[SYS_MAC_ADDR_SIZE];
/* Array with count type */
typedef struct
{
UINT32 count;
UINT32 *array;
}
t_sys_array;
/* Structure for holding data for cpu configuration */
typedef struct
{
UINT32 i_bpw;
UINT32 i_assoc;
UINT32 d_bpw;
UINT32 d_assoc;
bool mmu_tlb; /* TRUE -> TLB, FALSE -> Fixed */
}
t_sys_cpu_decoded;
/************************************************************************
* Public variables
************************************************************************/
extern UINT32 sys_cpufreq_hz;
extern UINT32 sys_busfreq_hz;
extern UINT32 sys_platform;
extern UINT32 sys_processor;
extern UINT32 sys_corecard;
extern UINT32 sys_nb_base;
extern UINT32 sys_ramsize;
extern UINT32 sys_freemem;
extern bool sys_64bit;
extern UINT32 sys_icache_linesize;
extern UINT32 sys_icache_lines;
extern UINT32 sys_icache_assoc;
extern UINT32 sys_dcache_linesize;
extern UINT32 sys_dcache_lines;
extern UINT32 sys_dcache_assoc;
/************************************************************************
* Public functions
************************************************************************/
UINT32 sys_determine_icache_linesize( UINT32 procid );
UINT32 sys_determine_icache_lines( UINT32 procid );
UINT32 sys_determine_icache_assoc( UINT32 procid );
UINT32 sys_determine_dcache_linesize( UINT32 procid );
UINT32 sys_determine_dcache_lines( UINT32 procid );
UINT32 sys_determine_dcache_assoc( UINT32 procid );
void
sys_putchar(
UINT32 port,
char ch );
void
sys_puts(
UINT32 port,
char *s );
bool
sys_getchar(
UINT32 port,
char *ch );
bool
sys_getchar_ctrlc(
UINT32 port );
/************************************************************************
*
* sys_legal_align
* Description :
* -------------
*
* Determine if alignment of address is legal
*
* Return values :
* ---------------
*
* TRUE -> Legal alignment, FALSE -> Illegal alignment
*
************************************************************************/
bool
sys_legal_align(
UINT32 address,
UINT32 align );
/************************************************************************
*
* sys_disp
* Description :
* -------------
*
* Display value in ASCII display
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_disp(
UINT32 val );
/************************************************************************
*
* sys_disp_ch
* Description :
* -------------
*
* Display character in ASCII display
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_disp_ch(
UINT8 pos, /* Position */
char ch ); /* Character */
/************************************************************************
*
* sys_disp_str
* Description :
* -------------
*
* Display string in ASCII display
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_disp_str(
char *ch ); /* String */
/************************************************************************
*
* sys_poll
* Description :
* -------------
*
* Poll drivers that need to be polled.
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_poll( void );
/************************************************************************
*
* sys_poll_enable
* Description :
* -------------
*
* Enable/disable non-critical polling done by function sys_poll
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_poll_enable(
bool enable );
/************************************************************************
*
* sys_memory_test
* Description :
* -------------
*
* Perform memory test
*
* Return values :
* ---------------
*
* 0 -> OK
* Non zero -> Error
*
************************************************************************/
UINT32
sys_memory_test(
UINT32 start, /* Start address */
UINT32 size, /* Size (in bytes) */
UINT32 big ); /* 1-> Run big test, 0-> don't */
/************************************************************************
* sys_cpu_cache_bpw
************************************************************************/
void
sys_cpu_cache_bpw(
bool icache, /* TRUE -> icache, FALSE -> dcache */
t_sys_array *sys_array );
/************************************************************************
* sys_cpu_cache_assoc
************************************************************************/
void
sys_cpu_cache_assoc(
bool icache, /* TRUE -> icache, FALSE -> dcache */
t_sys_array *sys_array );
/************************************************************************
*
* sys_icache_invalidate_index
* Description :
* -------------
*
* Fill I cache line containing specified index
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_icache_invalidate_index(
UINT32 index );
/************************************************************************
*
* sys_icache_invalidate_addr
* Description :
* -------------
*
* Invalidate I cache line containing specified address
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_icache_invalidate_addr(
UINT32 address );
/************************************************************************
*
* sys_dcache_flush_index
* Description :
* -------------
*
* Flush D cache line containing specified index
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_dcache_flush_index(
UINT32 index );
/************************************************************************
*
* sys_dcache_flush_addr
* Description :
* -------------
*
* Flush D cache line containing specified address
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_dcache_flush_addr(
UINT32 addr );
/************************************************************************
*
* sys_dcache_flush_all
* Description :
* -------------
*
* Flush entire DCACHE
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_dcache_flush_all( void );
/************************************************************************
*
* sys_icache_invalidate_all
* Description :
* -------------
*
* Invalidate entire ICACHE
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_icache_invalidate_all( void );
/************************************************************************
*
* sys_flush_caches
* Description :
* -------------
*
* First flush entire DCACHE, then invalidate entire ICACHE
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_flush_caches( void );
/************************************************************************
*
* sys_flush_cache_line
* Description :
* -------------
*
* First flush DCACHE line, then invalidate ICACHE line
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_flush_cache_line(
void *addr );
/************************************************************************
*
* sys_cpu_icache_config
* Description :
* -------------
*
* Configure icache
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
sys_cpu_icache_config(
UINT32 is,
UINT32 il,
UINT32 ia,
UINT32 config1_reset );
/************************************************************************
*
* sys_cpu_dcache_config
* Description :
* -------------
*
* Configure dcache
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -