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

📄 show_cfg.c

📁 详细介绍了一篇关于pci开发的接口芯片
💻 C
字号:
/*
	show_cfg.c
	CHAR *show_passthru_configuration( void )

	add text describing the test configuration to a string

	by region: size, width, SRAM/FIFO, PTCR value and
		what it means (Endian, waits, prefetch size, write FIFO en/dis)
*/
#include <stdtypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/* non-standard includes... */
#include <amcclib.h>
#include <lib.h>
#include <main.h>

extern int sync_clock, clock_rate_pci, clock_rate_addon, version_uut;
extern struct _chip chip_uut;
extern CHAR text[];
extern UINT32 control;

#define CAT	strcat( str, text );
static CHAR str[80 * 6];


CHAR *show_passthru_configuration( void )
/*
	Entry:	
	Return:	pointer to string showing configuration
*/
{
	UINT32 data32;
	UINT16 data16;
	int region;

	sprintf( str, "Chip version %1d.\n", version_uut );

	// print header...
	sprintf( text, \
		"Region  Size   Width  PTCR  Endian  WFIFO  Prefetch  Waits  Type\n");
	CAT
	for ( region = 0; region <= MAX_PT_REGION; region++ )
	{
		sprintf( text, "%1d       ", region );
		CAT
		if ( !region_is_valid( &chip_uut, region ) )
		{
			strcat( str, "Invalid\n" );
			continue;
		}

		sprintf( text, "$%4.4x  ", region_size(region) );
		CAT
		sprintf( text, "%2.2d     ", region_width(region) );
		CAT

		if ( region == 0 )
		{
			strcat( str, "\n" );
			continue;
		}

		// we use data16 because Borland converts 8->16 w/o barking
		// and it is easier to use ints in xprintf
		data32 = region_read32( &chip_uut, 0L, PTCR );
		data32 = data32 >> (8 * (region-1));
		data32 &= 0xFFL;
		data16 = (UINT16)data32;
		sprintf( text, "%2.2x    ", data16 );
		CAT
		if ( data16 & 0x40 ) strcat( str, "Big     " );
		else strcat( str, "Little  " );
		// write fifo...
		if ( data16 & 0x20 ) strcat( str, "disable " );
		else strcat( str, "enable  " );
		// prefetch..
		sprintf( text, "  %d", region_get_prefetch_size(region) );
		CAT
		// waits
		sprintf( text, "        %d", data16 & 7 );
		CAT
		if ( region_is_sram(region) )
			strcat( str, "    SRAM\n" );
		else
			strcat( str, "    FIFO\n" );
	}

	if ( control & CTRL_DQMODE )
		strcat( str, "DQMODE 16, " );
	else
		strcat( str, "DQMODE 32, " );

	if ( sync_clock )
		strcat( str, "Sync Clock, " );
	else
		strcat( str, "Async Clock, " );

	sprintf( text, "PCI/Addon %x/%x mhz.\n", clock_rate_pci, clock_rate_addon );
	CAT

	return str;
}

⌨️ 快捷键说明

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