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

📄 yamon_api.h

📁 MIPS下的boottloader yamon 的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
 *
 *  Function performs "writeback and invalidate" operations on D-cache
 *  lines and "invalidate" operations on I-cache lines.
 *
 *  Parameters :
 *  ------------
 *
 *  'type' (IN) : Cache to be flushed.
 *
 *  Return values :
 *  ---------------
 *
 *  None
 *
 ************************************************************************/
typedef void
(*t_yamon_flush_cache)(
#define YAMON_FLUSH_ICACHE	0
#define YAMON_FLUSH_DCACHE 	1
    t_yamon_uint32 type );	/* I- or D-cache indication		*/

#define YAMON_FUNC_FLUSH_CACHE( type )\
    ((t_yamon_flush_cache)( YAMON_FUNC(YAMON_FUNC_FLUSH_CACHE_OFS) ))\
        ( type )


/************************************************************************
 *
 *                          t_yamon_register_esr
 *  Description :
 *  -------------
 *
 *  Registers an exception handler, also known as an "Exception Service
 *  Routine" (ESR) for the specified exception.
 *  
 *  Two special exception IDs are defined :
 *      YAMON_DEFAULT_HANDLER used for a default ESR.
 *      YAMON_DEFAULT_EJTAG_ESR used for EJTAG exceptions.
 *	
 *  The default ESR is called if no other ESR is registered
 *  for an exception. If no default ESR is registered, a static
 *  (i.e. not registered) "super default" function is invoked.
 *  This function prints out the registers and halts.
 *
 *  Deregistration of an ESR may be be done by calling this function 
 *  with 'esr' set to NULL.
 *  An ESR can also be deregistered using the 'yamon_deregister_esr'
 *  function.
 *
 *  An ESR may be registered even if a previously registered 
 *  ESR has not been deregistered. In this case the previously
 *  registered ESR is lost.
 *
 *  The ESR will get called with registers in the state they were 
 *  when the exception occurred. This includes all CP0 registers and 
 *  CPU registers $0..$31, except for k0,k1 ($26,$27).
 *
 *  In case an ESR does not want to handle the exception, it may
 *  call the return function passed in the 'retfunc' parameter.
 *
 *  Case 1 : 'retfunc' called by ESR registered for the 
 *           INTERRUPT exception.
 *
 *  We assume an application has registered this ESR and wants
 *  YAMON to process the (remaining) interrupts.
 *
 *  Case 2 :  'retfunc' called by an ESR registered for a specific
 *	      exception (not INTERRUPT).
 *
 *  Default handling will be done.
 *
 *  Case 3 : 'retfunc' is called by the ESR registered as default ESR.
 *
 *  The exception will be handled as though no ESR is registered 
 *  (i.e. the "super default" function is called).
 *
 *  Parameters :
 *  ------------
 *
 *  'exception' (IN)  : Exception code
 *		        or YAMON_DEFAULT_HANDLER for a default ESR
 *		        or YAMON_DEFAULT_EJTAG_ESR for ejtag exceptions.
 *  'esr'       (IN)  : Function pointer for ESR.
 *  'ref'	(OUT) : Handle used for deregistration of ESR.
 *  'retfunc'	(OUT) : Pointer to function pointer for the return
 *			function described above.
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Registration went well.
 *  Other values indicate error.
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_register_esr)(
    t_yamon_uint32  exception,	     /* Exception identification	*/
    t_yamon_esr     esr,	     /* ESR to be registered		*/
    t_yamon_ref     *ref,	     /* Handle for deregistration	*/
    t_yamon_retfunc *retfunc );      /* Return function			*/

#define YAMON_FUNC_REGISTER_ESR( exc, esr, ref, retfunc )\
    ((t_yamon_register_esr)( YAMON_FUNC(YAMON_FUNC_REGISTER_ESR_OFS) ))\
        ( exc, esr, ref, retfunc )


/************************************************************************
 *
 *                          t_yamon_deregister_esr
 *  Description :
 *  -------------
 *
 *  Deregisters ESR..
 *  
 *  Parameters :
 *  ------------
 *
 *  'ref' (IN) : Handle obtained when calling 'yamon_register_esr'.
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Deregistration went well.
 *  Other values indicate error.
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_deregister_esr)(
    t_yamon_ref ref );             /* Handle for deregistration		*/

#define YAMON_FUNC_DEREGISTER_ESR( ref )\
    ((t_yamon_deregister_esr)( YAMON_FUNC(YAMON_FUNC_DEREGISTER_ESR_OFS) ))\
        ( ref )


/************************************************************************
 *
 *                          t_yamon_register_cpu_isr
 *  Description :
 *  -------------
 *
 *  Registers an Interrupt Service Routine (ISR) for the specified 
 *  CPU interrupt.
 *  The highest service priority is attached to HW-INT5, which is
 *  connected to the CPU-built-in CP0-timer. SW_INT0 gets the lowest
 *  service priority. During registration, the interrupt mask field
 *  in the CPU CP0-status register is updated to enable interrupts
 *  from the specified interrupt source.
 *
 *  A special ID is defined :
 *      YAMON_DEFAULT_HANDLER used for a default ISR.
 *	
 *  The default ISR is called if no other ISR is registered
 *  for a CPU interrupt.
 *
 *  Deregistration of the default ISR may be done by calling
 *  this function with 'isr' set to NULL.
 *  Also, a new default ISR may be registered even if a 
 *  previously registered ISR has not been deregistered.
 *  ISRs for specific CPU interrupts must be deregistered using 
 *  'yamon_deregister_cpu_isr'.
 *
 *  Parameters :
 *  ------------
 *
 *  'cpu_int' (IN)  : CPU interrupt (0..7)
 *		      or YAMON_DEFAULT_HANDLER for a default ISR.
 *  'isr'     (IN)  : Function pointer for ISR.
 *  'data'    (IN)  : Data pointer (may be NULL). Will be passed to
 *		      ISR when called.
 *  'ref'     (OUT) : Handle used for deregistration of ISR.
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Registration went well.
 *  Other values indicate error.
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_register_cpu_isr)(
    t_yamon_uint32 cpu_int,	/* CPU interrupt (0..7)			*/
    t_yamon_isr	   isr,		/* ISR to be registered			*/
    void	   *data,   	/* Data reference to be registered	*/
    t_yamon_ref	   *ref );      /* Handle for deregistration		*/

#define YAMON_FUNC_REGISTER_CPU_ISR( cpu_int, isr, data, ref )\
    ((t_yamon_register_cpu_isr)( YAMON_FUNC(YAMON_FUNC_REGISTER_CPU_ISR_OFS) ))\
        ( cpu_int, isr, data, ref )


/************************************************************************
 *
 *                          t_yamon_deregister_cpu_isr
 *  Description :
 *  -------------
 *
 *  Deregisters ISR for CPU interrupt.
 *  
 *  Parameters :
 *  ------------
 *
 *  'ref' (IN) : Handle obtained when calling 'yamon_register_cpu_isr'.
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Deregistration went well.
 *  Other values indicate error
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_deregister_cpu_isr)(
    t_yamon_ref ref );	             /* Handle for deregistration	*/

#define YAMON_FUNC_DEREGISTER_CPU_ISR( ref )\
    ((t_yamon_deregister_cpu_isr)( YAMON_FUNC(YAMON_FUNC_DEREGISTER_CPU_ISR_OFS) ))\
        ( ref )


/************************************************************************
 *
 *                          t_yamon_register_ic_isr
 *  Description :
 *  -------------
 *
 *  Registers an Interrupt Service Routine (ISR) for the specified 
 *  source in the interrupt controller. 
 *
 *  A special ID is defined :
 *      YAMON_DEFAULT_HANDLER used for a default ISR.
 *	
 *  The default ISR is called if no other ISR is registered
 *  for an interrupt.
 *
 *  Deregistration of the default ISR may be done by calling
 *  this function with 'isr' set to NULL.
 *  Also, a new default ISR may be registered even if a 
 *  previously registered ISR has not been deregistered.
 *  ISRs for specific interrupts must be deregistered using 
 *  'yamon_deregister_ic_isr'.
 *
 *  Parameters :
 *  ------------
 *
 *  'ic_line' (IN)  : Interrupt source line in Int. Controller
 *		      or YAMON_DEFAULT_HANDLER for a default ISR.
 *  'isr',    (IN)  : Function pointer for user defined ISR.
 *  'data'    (IN)  : Data pointer (may be NULL). Will be passed to
 *		      ISR when called.
 *  'ref',    (OUT) : Handle used for deregistration of ISR.
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Registration went well.
 *  Other values indicate error.
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_register_ic_isr)(
    t_yamon_uint32 ic_line,	    /* Interrupt controller line	*/
    t_yamon_isr	   isr,		    /* ISR to be registered		*/
    void	   *data,	    /* Data reference to be registered  */
    t_yamon_ref	   *ref );	    /* Handle for deregistration	*/

#define YAMON_FUNC_REGISTER_IC_ISR( ic_line, isr, data, ref )\
    ((t_yamon_register_ic_isr)( YAMON_FUNC(YAMON_FUNC_REGISTER_IC_ISR_OFS) ))\
        ( ic_line, isr, data, ref )


/************************************************************************
 *
 *                          t_yamon_deregister_ic_isr
 *  Description :
 *  -------------
 *
 *  Deregisters ISR for source in interrupt controller.
 *  
 *  Parameters :
 *  ------------
 *
 *  'ref' (IN) : Handle obtained when calling 'yamon_register_ic_isr'.
 *
 *  Return values :
 *  ---------------
 *
 *  0 : Deregistration went well.
 *  Other values indicate error
 *
 ************************************************************************/
typedef t_yamon_int32
(*t_yamon_deregister_ic_isr)(
    t_yamon_ref ref );	             /* Handle for deregistration	*/

#define YAMON_FUNC_DEREGISTER_IC_ISR( ref )\
    ((t_yamon_deregister_ic_isr)( YAMON_FUNC(YAMON_FUNC_DEREGISTER_IC_ISR_OFS) ))\
        ( ref )


#endif /* #ifndef YAMON_API_H */






⌨️ 快捷键说明

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