sys_api.h
来自「MIPS YAMON, a famous monitor inc. source」· C头文件 代码 · 共 1,385 行 · 第 1/3 页
H
1,385 行
/************************************************************************ * * sys_api.h * * Header file for system functions * * ###################################################################### * * mips_start_of_legal_notice * * Copyright (c) 2004 MIPS Technologies, Inc. All rights reserved. * * * Unpublished rights (if any) reserved under the copyright laws of the * United States of America and other countries. * * This code is proprietary to MIPS Technologies, Inc. ("MIPS * Technologies"). Any copying, reproducing, modifying or use of this code * (in whole or in part) that is not expressly permitted in writing by MIPS * Technologies or an authorized third party is strictly prohibited. At a * minimum, this code is protected under unfair competition and copyright * laws. Violations thereof may result in criminal penalties and fines. * * MIPS Technologies reserves the right to change this code to improve * function, design or otherwise. MIPS Technologies does not assume any * liability arising out of the application or use of this code, or of any * error or omission in such code. Any warranties, whether express, * statutory, implied or otherwise, including but not limited to the implied * warranties of merchantability or fitness for a particular purpose, are * excluded. Except as expressly provided in any written license agreement * from MIPS Technologies or an authorized third party, the furnishing of * this code does not give recipient any license to any intellectual * property rights, including any patent rights, that cover this code. * * This code shall not be exported, reexported, transferred, or released, * directly or indirectly, in violation of the law of any country or * international law, regulation, treaty, Executive Order, statute, * amendments or supplements thereto. Should a conflict arise regarding the * export, reexport, transfer, or release of this code, the laws of the * United States of America shall be the governing law. * * This code constitutes one or more of the following: commercial computer * software, commercial computer software documentation or other commercial * items. If the user of this code, 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 code, 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 code 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 code from MIPS Technologies or an authorized * third party. * * * * * mips_end_of_legal_notice * * ************************************************************************/#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."#define YAMON_REV_STRING _REVMAJ_"."_REVMIN_#define DEFAULT_PROMPT "YAMON\0\0\0"/* 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_38400_BPS#define DEFAULT_DATABITS SERIAL_DATABITS_8#define DEFAULT_PARITY SERIAL_PARITY_NONE#define DEFAULT_STOPBITS SERIAL_STOPBITS_10#define DEFAULT_FLOWCTRL SERIAL_FLOWCTRL_HARDWARE/* Default env. variable for serial port settings */#define DEFAULT_SERIAL_ENV "38400,n,8,1,hw"/* 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 6typedef 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;/* Function pointer passed to sys_func_noram() */typedef UINT32 (*t_sys_func_noram)(UINT32, UINT32, UINT32);/************************************************************************ * 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_manid;extern UINT32 sys_manpd;extern UINT32 sys_nb_base;extern UINT32 sys_ramsize;extern UINT32 sys_freemem;extern bool sys_64bit;extern bool sys_mips32_64;extern bool sys_mips16e;extern bool sys_smallpage_support;extern bool sys_ejtag;extern UINT8 sys_arch_rev; /* Reflects the C0_Config.AR field */extern UINT32 sys_fpu; /* if set, contains cp1_fir value */extern bool sys_cpu_cache_coherency;extern bool sys_l2cache;extern bool sys_l2cache_enabled;extern UINT32 sys_l2cache_lines;extern UINT32 sys_l2cache_linesize;extern UINT32 sys_l2cache_assoc;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;extern char *sys_default_prompt;extern char sys_default_display[];/************************************************************************ * Public functions ************************************************************************/UINT32 sys_determine_icache_linesize_flash( UINT32 procid );UINT32 sys_determine_icache_lines_flash( UINT32 procid );UINT32 sys_determine_icache_assoc_flash( UINT32 procid ); UINT32 sys_determine_dcache_linesize_flash( UINT32 procid );UINT32 sys_determine_dcache_lines_flash( UINT32 procid );UINT32 sys_determine_dcache_assoc_flash( UINT32 procid );void sys_putchar( UINT32 port, char ch );voidsys_puts( UINT32 port, char *s );boolsys_getchar( UINT32 port, char *ch );boolsys_getchar_ctrlc( UINT32 port );/************************************************************************ * * sys_sync * Description : * ------------- * * Issue "sync" instruction * * Return values : * --------------- * * None * ************************************************************************/voidsys_sync( void );/************************************************************************ * * sys_dma_enable * Description : * ------------- * * Platform specific handling of DMA (enable/disable) * * Return values : * --------------- * * None * ************************************************************************/voidsys_dma_enable( bool enable ); /* TRUE -> Enable DMA devices, FALSE -> Disable *//************************************************************************ * * sys_access_func * Description : * ------------- * * Call requested function without linker restrictions on address. * * The 3 specified parameters are passed in CPU registers a0, a1, a2. * * Return values : * --------------- * * UINT32 returned by requested function * ************************************************************************/UINT32sys_access_func( UINT32 (*func)(UINT32, UINT32, UINT32), UINT32 parm1, UINT32 parm2, UINT32 parm3 );/************************************************************************ * * sys_func_noram * Description : * ------------- * * Access function while executing from flash. * All RAM access will be disabled while accessing function. * * Return values : * --------------- * * UINT32 returned by requested function * ************************************************************************/UINT32sys_func_noram( t_sys_func_noram func, UINT32 parm1, UINT32 parm2, UINT32 parm3 );/************************************************************************ * * sys_legal_align * Description : * ------------- * * Determine if alignment of address is legal * * Return values : * --------------- * * TRUE -> Legal alignment, FALSE -> Illegal alignment * ************************************************************************/boolsys_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 * ************************************************************************/voidsys_poll( void );/************************************************************************ * * sys_poll_enable * Description : * ------------- * * Enable/disable non-critical polling done by function sys_poll * * Return values : * --------------- * * None * ************************************************************************/voidsys_poll_enable( bool enable );/************************************************************************ * * sys_cp0_read32 * Description : * ------------- * * Read 32 bit CP0 register * * Return values : * --------------- * * Value read * ************************************************************************/UINT32sys_cp0_read32( UINT32 number, /* Register number (0..31) */ UINT32 sel ); /* sel field (0..7) *//************************************************************************ * * sys_cp0_read64 * Description : * ------------- * * Read 64 bit CP0 register * * Return values : * --------------- * * Value read * ************************************************************************/UINT64sys_cp0_read64( UINT32 number, /* Register number (0..31) */ UINT32 sel ); /* sel field (0..7) *//************************************************************************
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?