⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yamon_api.h

📁 MIPS下的boottloader yamon 的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:

/************************************************************************
 *
 *  yamon_api.h
 *
 *  YAMON interface definitions
 *
 *
 * ######################################################################
 *
 * 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 YAMON_API_H
#define YAMON_API_H

/************************************************************************
 *  Include files
 ************************************************************************/


/************************************************************************
 *  Definitions
*************************************************************************/

/* Basic types */

typedef unsigned int        t_yamon_uint32;
typedef signed int	    t_yamon_int32;
typedef unsigned char       t_yamon_bool;

#define YAMON_FALSE	    0
#define YAMON_TRUE	    (!YAMON_FALSE)

/* YAMON Environment variable */
typedef struct
{
    char *name;
    char *val;
}
t_yamon_env_var;

/* Format of application function */
typedef t_yamon_uint32
(*t_yamon_appl_main)(
    t_yamon_uint32  argc,      /* Number of tokens in argv array	*/
    char	    **argv,    /* Array of tokens (first is "go")	*/
    t_yamon_env_var *env,      /* Array of env. variables		*/
    t_yamon_uint32  memsize ); /* Size of memory (byte count)		*/


/* ID of YAMON configuration object */
typedef t_yamon_uint32 t_yamon_syscon_id;


/*  Number used by the exception registration functions in order to register
 *  a default ISR/ESR.
 */
#define YAMON_DEFAULT_HANDLER		    0xfffffff0

/*  Number used by the exception registration functions in order to register
 *  an EJTAG debug exception ESR.
 */
#define YAMON_DEFAULT_EJTAG_ESR		    0xfffffff1

/* Registered Interrupt Service Routine (ISR) */
typedef void (*t_yamon_isr)(void *data);

/* Registered Exception Service Routine (ESR) */
typedef void (*t_yamon_esr)(void);

/* Entry point called by ESRs wishing to pass control back to YAMON */
typedef void (*t_yamon_retfunc)(void);

/* Handle used for deregistration of ISR/ESR */
typedef void *t_yamon_ref;


/* YAMONE Vector table address */
#define YAMON_FUNCTION_BASE		    0x9fc00500

/* YAMON Vector table offsets */
#define YAMON_FUNC_PRINT_COUNT_OFS	    0x04
#define YAMON_FUNC_EXIT_OFS		    0x20
#define YAMON_FUNC_FLUSH_CACHE_OFS	    0x2C
#define YAMON_FUNC_PRINT_OFS		    0x34
#define YAMON_FUNC_REGISTER_CPU_ISR_OFS	    0x38
#define YAMON_FUNC_DEREGISTER_CPU_ISR_OFS   0x3c
#define YAMON_FUNC_REGISTER_IC_ISR_OFS	    0x40
#define YAMON_FUNC_DEREGISTER_IC_ISR_OFS    0x44
#define YAMON_FUNC_REGISTER_ESR_OFS	    0x48
#define YAMON_FUNC_DEREGISTER_ESR_OFS       0x4c
#define YAMON_FUNC_GETCHAR_OFS		    0x50
#define YAMON_FUNC_SYSCON_READ_OFS	    0x54

/* Macro for accessing YAMON function */
#define YAMON_FUNC(ofs)\
    (*(t_yamon_uint32 *)(YAMON_FUNCTION_BASE + (ofs)))


/************************************************************************
 *  Public variables
 ************************************************************************/

/************************************************************************
 *  Public functions
 ************************************************************************/


/************************************************************************
 *
 *                          t_yamon_exit
 *  Description :
 *  -------------
 *
 *  Exit application and return to YAMON.
 *
 *  Parameters :
 *  ------------
 *
 *  'rc' (OUT) : Return code 
 *
 *  Return values :
 *  ---------------
 *
 *  None (never returns)
 *
 ************************************************************************/
typedef void 
(*t_yamon_exit)(
    t_yamon_uint32 rc );	/* Return code				*/

#define YAMON_FUNC_EXIT( rc )\
    ((t_yamon_exit)( YAMON_FUNC(YAMON_FUNC_EXIT_OFS) ))\
        ( rc )


/************************************************************************
 *
 *                          t_yamon_print
 *  Description :
 *  -------------
 *
 *  Print null-terminated string to tty0.
 *
 *  Parameters :
 *  ------------
 *
 *  'port' (OUT) : Ignored, always prints to tty0. Not included in macro.
 *  's'    (OUT) : String to print.
 *
 *  Return values :
 *  ---------------
 *
 *  None
 *
 ************************************************************************/
typedef void 
(*t_yamon_print)(
    t_yamon_uint32 port, /* Output port (not used, always tty0)		*/
    char           *s ); /* String to output				*/

#define YAMON_FUNC_PRINT( s )\
    ((t_yamon_print)( YAMON_FUNC(YAMON_FUNC_PRINT_OFS) ))\
        ( 0, s )


/************************************************************************
 *
 *                          t_yamon_print_count
 *  Description :
 *  -------------
 *
 *  Print specified number of characters to tty0.
 *
 *  Parameters :
 *  ------------
 *
 *  'port'  (OUT) : Ignored, always prints to tty0. Not included in macro.
 *  's'     (OUT) : Array of characters to print.
 *  'count' (OUT) : Number of characters to print.
 *
 *  Return values :
 *  ---------------
 *
 *  None
 *
 ************************************************************************/
typedef void 
(*t_yamon_print_count)(
    t_yamon_uint32 port,	/* Output port (not used, always tty0	*/
    char	   *s,		/* String to output			*/
    t_yamon_uint32 count );	/* Number of characters to output	*/

#define YAMON_FUNC_PRINT_COUNT( s, count )\
    ((t_yamon_print_count)( YAMON_FUNC(YAMON_FUNC_PRINT_COUNT_OFS) ))\
        ( 0, s, count )


/************************************************************************
 *
 *                          t_yamon_getchar
 *  Description :
 *  -------------
 *
 *  Get character from tty0 if character is available. Function
 *  returns immediately if no character is available.
 *
 *  Parameters :
 *  ------------
 *
 *  'port'  (OUT) : Ignored, always uses tty0. Not included in macro.
 *  'ch'    (OUT) : Character read (if available).
 *
 *  Return values :
 *  ---------------
 *
 *  YAMON_TRUE if character was available, else YAMON_FALSE.
 *
 ************************************************************************/
typedef t_yamon_bool
(*t_yamon_getchar)(
    t_yamon_uint32 port,	/* Output port (not used, always tty0	*/
    char	   *ch );	/* Character to output			*/

#define YAMON_FUNC_GETCHAR( ch )\
    ((t_yamon_getchar)( YAMON_FUNC(YAMON_FUNC_GETCHAR_OFS) ))\
        ( 0, ch )


/************************************************************************
 *
 *                          t_yamon_syscon_read
 *  Description :
 *  -------------
 *
 *  Read the value of system configuration object given by 'id'.
 *
 *  See syscon_api.h in YAMON source distribution for further details
 *  on object IDs and error codes.
 *
 *  Parameters :
 *  ------------
 *
 *  'id'    (IN)    : Object id.
 *  'param' (INOUT) : Buffer for object value.
 *  'size'  (IN)    : Size of buffer (must match size of object).
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Returned parameter is valid.
 *  Other values indicate error.
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_syscon_read)(
    t_yamon_syscon_id   id,	      /* Object ID			*/
    void                *param,       /* Buffer for object value	*/
    t_yamon_uint32      size);        /* Buffer size (bytes)		*/

#define YAMON_FUNC_SYSCON_READ( id, param, size )\
    ((t_yamon_syscon_read)( YAMON_FUNC(YAMON_FUNC_SYSCON_READ_OFS) ))\
        ( id, param, size )


/************************************************************************
 *
 *                          t_yamon_flush_cache
 *  Description :
 *  -------------
 *
 *  Flush I-or D-cache

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -