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

📄 syscon_platform.c

📁 yamon2.27.tar.gz bootloader 在au1200上完全通过
💻 C
📖 第 1 页 / 共 5 页
字号:
*  board_ledbar_sead_read
************************************************************************/
static UINT32
board_ledbar_sead_read(
					   void *param,
					   void *data )
{
    *(UINT32 *)param = REGP(KSEG1BASE, SEAD_PLED);
    return OK;
}


/************************************************************************
*  board_ledbar_sead_write
************************************************************************/
static UINT32
board_ledbar_sead_write(
						void *param,
						void *data )
{
    REGP(KSEG1BASE, SEAD_PLED) = *(UINT32 *)param;
    return OK;
}


/************************************************************************
*  board_asciiword_atlas_malta_write
************************************************************************/
static UINT32
board_asciiword_atlas_malta_write(
								  void *param,
								  void *data )
{
    REGP(KSEG1BASE, ATLAS_ASCIIWORD) = *(UINT32 *)param;
    return OK;
}


/************************************************************************
*  board_asciiword_sead_write
************************************************************************/
static UINT32
board_asciiword_sead_write(
						   void *param,
						   void *data )
{
    UINT32 tl, sl, i;
	
    sl = 8 ;
	
    if( alpha_display_size < 8 )
    {
        sl = alpha_display_size;
    }
	
    for(i=0; i<sl; i++)
    {
        tl = ( (*(UINT32 *)param) >> (28-(i*4)) ) & 0xf;
        tl = bin2char[ tl ];
        *alpha_io[ i ] = tl;
    }
	
    return OK;
}

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



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


/************************************************************************
*  board_asciistring_write
************************************************************************/
static UINT32
board_asciistring_write(
						void *param,
						void *data )
{
    UINT32 tl, i;
    UINT8  *ptb, temp;
	
    tl  = ((t_sys_alphanumeric *)param)->posid;
    ptb = ((t_sys_alphanumeric *)param)->string;
    
	{
	// sys_disp_string_c is in ROM and board_asciistring_write is in RAM
	// so these two functions are out of the 256MB reach, thus the need
	// to load the address into a pointer, and then call thru the pointer
	// the asm volatile ("NOP") is necessary since, without it, the compiler
	// optimizes the call to use a direct jal, which then suffers from the
	// 256MB issue...the intervening asm volatile nop prevents the optimization

	// This function is called by YAMON after copying and running from RAM,
	// but before the IO subsystem is up and running....it is equivalent to
	// the sys_disp_string function utilized by the low-level assembly startup
	// code in YAMON.

	// If you run into any trouble at all with YAMON booting and a new/diff
	// compiler version, then by all means, just comment out the call to
	// func(ptb).....
	extern void sys_disp_string_c (char *string);
	void (*func)(char *string) = &sys_disp_string_c;
	//asm volatile ("sdbbp");
	asm volatile (" nop ");
//	func(ptb);
	}

	return OK;
}


/************************************************************************
*  board_get_millisec_atlas_read
************************************************************************/
static UINT32
board_get_millisec_atlas_read(
							  void *param,
							  void *data )
{
    *(UINT32 *)param = REG(KSEG1(ATLAS_TMRA_BASE), TMRA_TM0CNT)/1000;
    return OK;
}


/************************************************************************
*  board_get_millisec_sead_read
************************************************************************/
static UINT32
board_get_millisec_sead_read(
							 void *param,
							 void *data )
{
    UINT32 cycle_per_count;
	
    SYSCON_read( SYSCON_CPU_CYCLE_PER_COUNT_ID,
		(void *)&cycle_per_count,
		sizeof(UINT32) );
	
    if (sys_cpufreq_hz != 0)
    {
        *(UINT32 *)param = ( sys_cpufreq_hz * 1000 / cycle_per_count );
        *(UINT32 *)param = ( CP0_count_read() / (*(UINT32*)param) );
    }
    else
    {
        *(UINT32 *)param = ( SEAD_MAX_FREQ_MHZ * 1000000 / (cycle_per_count*1000) );
        *(UINT32 *)param = ( CP0_count_read() / (*(UINT32*)param) );
    }
    
    return OK;
}


/************************************************************************
*  board_get_millisec_malta_read
************************************************************************/
static UINT32
board_get_millisec_malta_read(
							  void *param,
							  void *data )
{
    UINT16 count;
	
    /* Request PIIX4 counter 0 to be latched */
	
    MALTA_PIIX4_IO8( PIIX4_TCW_OFS ) = 
        (PIIX4_TCW_CS_0  << PIIX4_TCW_CS_SHF)  |
		(PIIX4_TCW_RW_CL << PIIX4_TCW_RW_SHF);
	
    /* Read LSB then MSB */
    count =  MALTA_PIIX4_IO8( PIIX4_TMRCNT0_OFS );
    count += MALTA_PIIX4_IO8( PIIX4_TMRCNT0_OFS ) << 8;
	
    /* Convert to ms (note that the counter counts down */
    count            = 0xFFFF - count;
    *(UINT32 *)param = (UINT32)count * PIIX4_TIMER_PERIOD_NS / 1000000;
	
    return OK;
}

/************************************************************************
*  board_get_millisec_pb1000_read
************************************************************************/
static UINT32
board_get_millisec_pb1000_read(
							   void *param,
							   void *data )
{
/* Revise - this could be updated to use onboard counter - this routine
				uses the CORE COUNTER */
	
	
	
    *(UINT32 *)param = ( CP0_count_read() / (sys_cpufreq_hz / 1000));
	
	
}



/************************************************************************
*    board_piix4_smb_base_malta_read  
************************************************************************/
static UINT32
board_piix4_smb_base_malta_read(
								void *param,
								void *data )
{
/*  PIIX4 SMB registers
*  are memory mapped into SMB Bar
	*/
#if 0
    if( pci_lookup_bar( PCI_VENDID_INTEL,
		PCI_DEVID_PIIX4_POWER,
		PIIX4_PCI_FUNCTION_POWER,
		PIIX4_PCI_BAR_SMB_POS,
		(void **)param ) )
    {
        return OK;
    }
    else
#endif
        return ERROR_SYSCON_UNKNOWN_PARAM;
}


/************************************************************************
*    board_piix4_power_base_malta_read  
************************************************************************/
static UINT32
board_piix4_power_base_malta_read(
								  void *param,
								  void *data )
{
/*  PIIX4 Power Management registers
*  are memory mapped into POWER Bar
	*/
#if 0
    if( pci_lookup_bar( PCI_VENDID_INTEL,
		PCI_DEVID_PIIX4_POWER,
		PIIX4_PCI_FUNCTION_POWER,
		PIIX4_PCI_BAR_POWER_POS,
		(void **)param ) )
    {
        return OK;
    }
    else
#endif
        return ERROR_SYSCON_UNKNOWN_PARAM;
}


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



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



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


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



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

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


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


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

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


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


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

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



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


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


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

/************************************************************************
*  board_systemflash_write_enable_atlas_write
************************************************************************/
static UINT32

⌨️ 快捷键说明

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