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

📄 syscon.c

📁 MIPS下的boottloader yamon 的源代码
💻 C
📖 第 1 页 / 共 4 页
字号:
    void *param,
    void *data )
{
    CP0_count_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_entryhi_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_entryhi_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_entryhi_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_entryhi_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_entryhi_generic_write(
    void *param,
    void *data )
{
    CP0_entryhi_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_compare_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_compare_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_compare_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_compare_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_compare_generic_write(
    void *param,
    void *data )
{
    CP0_compare_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_status_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_status_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_status_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_status_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_status_generic_write(
    void *param,
    void *data )
{
    CP0_status_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_cause_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_cause_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_cause_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_cause_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_cause_generic_write(
    void *param,
    void *data )
{
    CP0_cause_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_epc_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_epc_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_epc_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_epc_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_epc_generic_write(
    void *param,
    void *data )
{
    CP0_epc_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_prid_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_prid_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_prid_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_config_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_config_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_config_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_config_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_config_generic_write(
    void *param,
    void *data )
{
    CP0_config_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_lladdr_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_lladdr_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_lladdr_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_watchlo_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_watchlo_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_watchlo_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_watchlo_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_watchlo_generic_write(
    void *param,
    void *data )
{
    CP0_watchlo_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_watchhi_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_watchhi_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_watchhi_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_watchhi_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_watchhi_generic_write(
    void *param,
    void *data )
{
    CP0_watchhi_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_cacheerr_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_cacheerr_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_cacheerr_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_taglo0_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_taglo0_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_taglo0_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_taglo0_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_taglo0_generic_write(
    void *param,
    void *data )
{
    CP0_taglo0_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_taghi0_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_taghi0_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_taghi0_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_taghi0_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_taghi0_generic_write(
    void *param,
    void *data )
{
    CP0_taghi0_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_datalo1_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_datalo1_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_datalo1_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_datahi1_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_datahi1_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_datahi1_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_errorepc_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_errorepc_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_errorepc_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_errorepc_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_errorepc_generic_write(
    void *param,
    void *data )
{
    CP0_errorepc_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *  cpu_cp0_desave_generic_read
 ************************************************************************/
static UINT32
cpu_cp0_desave_generic_read(
    void *param,
    void *data )
{
    *(UINT32*)param = CP0_desave_read();
    return OK;
}


/************************************************************************
 *  cpu_cp0_desave_generic_write
 ************************************************************************/
static UINT32
cpu_cp0_desave_generic_write(
    void *param,
    void *data )
{
    CP0_desave_write( *(UINT32 *)param );
    return OK;
}


/************************************************************************
 *
 *                          SYSCON_error_lookup
 *  Description :
 *  -------------
 *  Lookup error code to error string(s)
 *
 *  Parameters :
 *  ------------
 * 
 *  'param',   INOUT,    variable of type, t_sys_error_string.
 *
 *  Return values :
 *  ---------------
 *
 * 'OK' = 0x00:  
 *
 ************************************************************************/
static INT32 
SYSCON_error_lookup( 
    t_sys_error_string *param )
{
    UINT32 t;

    param->count = 0;

    t = SYSERROR_ID( param->syserror );

    if( t < sizeof(syscon_error_string)/sizeof(char*) )
    {
        param->strings[SYSCON_ERRORMSG_IDX] = syscon_error_string[t];
        param->count = 1;
    }

    return(OK);
}


/************************************************************************
 *  board_systemram_sras2scas_ns_read, 
 ************************************************************************/
static UINT32
board_systemram_sras2scas_ns_read(
    void *param,
    void *data )
{
    UINT8 data8;
    INT32 rc;
    
    rc = spd_read( EEPROM_MINOR_SPD000, SPD_RCDM, 1, (void *)&data8 );

    *(UINT32 *)param = data8;
     
    return rc;
}


/************************************************************************
 *  board_systemram_srasprchg_ns_read, 
 ************************************************************************/
static UINT32
board_systemram_srasprchg_ns_read(
    void *param,
    void *data )
{
    UINT8 data8;
    INT32 rc;
    
    rc = spd_read( EEPROM_MINOR_SPD000, SPD_MRPT, 1, (void *)&data8 );

    *(UINT32 *)param = data8;
     
    return rc;
}


/************************************************************************
 *  board_systemram_refresh_ns_read, 
 ************************************************************************/
static UINT32
board_systemram_refresh_ns_read(
    void *param,
    void *data )
{
    UINT8 data8;
    INT32 rc;
    
    rc = spd_read( EEPROM_MINOR_SPD000, SPD_RFSH_RT, 1, (void *)&data8 );

    if( rc != OK )
        return rc;

    switch( REGFIELD( data8, SPD_RFSH_RT_RATE ) )
    {
      case SPD_RFSH_RT_RATE_125 :
      	/* 125 us */
	*(UINT32 *)param = 125000;
	break;

      case SPD_RFSH_RT_RATE_62_5 :
      	/* 62.5 us */
	*(UINT32 *)param = 62500;
	break;

      case SPD_RFSH_RT_RATE_31_3 :
	/* 31.3 us */
	*(UINT32 *)param = 31300;
	break;

      case SPD_RFSH_RT_RATE_15_625 :
	/* 15.625 us */
	*(UINT32 *)param = 15625;
	break;

      case SPD_RFSH_RT_RATE_7_8 :
	/* 7.8 us */
	*(UINT32 *)param = 7800;
	break;

      default : 
        /* Assume 3.9us */
	*(UINT32 *)param = 3900;
	break;
    }

    return OK;
}


/************************************************************************
 *  Implementation : Public functions
 ************************************************************************/


/*  Functions of the format required for registered SYSCON functions.
 *  Local to SYSCON module.

⌨️ 快捷键说明

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