亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? crc.c

?? NiosII DMA_用戶指令_自定義邏輯應用實例 nios_DMA_CI_UL
?? C
?? 第 1 頁 / 共 2 頁
字號:
 *
 **********************************************************************/


unsigned short faster_crcCompute(unsigned long *data_block, unsigned int nBytes)
{

	// Intitialise CRC to 0xFFFF;
	// Write the value 0xFFFF to the base address of the peripheral
	IOWR(CRC_ACCELERATOR_BASE,0,0xFFFF);


	// #### COMPLETE CODE SEGMENT BELOW ####
	// set-up write address for DMA transfer (crc peripheral)
	// call alt_dma_txchan_ioctl function to set RX stream on and
	// set the write address to the CRC peripheral location + 0x4
	//
	alt_dma_txchan_ioct(/*Insert code*/);


	// #### COMPLETE CODE SEGMENT BELOW ####
	// set mode of DMA to move 32 bits at a time
	// call alt_dma_txchan_ioctl and set DMA mode to 32 bits
	//
	alt_dma_txchan_ioct(/*Insert code*/);


	// #### COMPLETE CODE SEGMENT BELOW ####
	// Queue the DMA transfer
	// call the alt_dms_txchan_send function with the following parameters
	//   channel descriptor (set as a global variable at the top of this file)
	//   The start address of the data (passed to this function as data_block)
	//   The number of bytes to be transferred (passed to this function as nBytes)
	//   The name of the call back function (defined above as dma_done)
	//   NULL
	//
	alt_dma_txchan_send (/*Insert code*/);


	//wait for DMA transaction to complete
	while(!dma_complete);

	dma_complete = 0;  // reset flag

	return (IORD(CRC_ACCELERATOR_BASE,0));

}   /* faster_crcCompute() */



/**********************************************************************
 *
 * Function:    sevenseg_set_hex()
 *
 * Description: Decode hex number to format for 7-seg display.
 *              Also: sends data to the 7-seg display PIO
 *
 * Notes:
 *
 * Returns:     No return value
 *
 **********************************************************************/

static void sevenseg_set_hex(int hex)
{
	static alt_u8 segments[16] = {
    0x81, 0xCF, 0x92, 0x86, 0xCC, 0xA4, 0xA0, 0x8F, 0x80, 0x84, /* 0-9 */
    0x88, 0xE0, 0xF2, 0xC2, 0xB0, 0xB8 };                       /* a-f */

	unsigned int data = segments[hex & 15] | (segments[(hex >> 4) & 15] << 8);

	IOWR_ALTERA_AVALON_PIO_DATA(SEVEN_SEG_PIO_BASE, data);

}  /* sevenseg_set_hex */



/**********************************************************************
 *
 * Function:    crc_demo()
 *
 * Description: CRC demo that calls calculation and checks performance
 *
 * Notes:
 *
 * Returns:     No return value
 *
 **********************************************************************/

void crc_demo (void)
{
	unsigned short int crc_result;
	unsigned int data_block_length;
	unsigned int hex_digits;
	unsigned int time1, time2, num_ticks;

	data_block_length = DATA_BLOCK_END - (DATA_BLOCK_BEGIN) + 1;

	time1 = alt_timestamp_start();
	printf ("---------------------------------------------\n");
	printf ("Running CRC with table based software routine\n");

	for (hex_digits = 0; hex_digits <= CRC_RUNS; hex_digits++)
	{
		crc_result = crcCompute((char*)DATA_SRAM_COPY, DATA_BLOCK_END - (DATA_BLOCK_BEGIN) + 1);
   	sevenseg_set_hex(hex_digits);
	}

	time2 = alt_timestamp();
	num_ticks = time2 - time1 - timer_overhead;
	printf ("CRC for Data Block = 0x%x.\n", crc_result);
	printf ("CPU time(ms): %.*f\n", 2, ((float)num_ticks/(float)alt_timestamp_freq()) * (float)1000);

}  /* crc_demo */



/**********************************************************************
 *
 * Function:    fast_crc_demo()
 *
 * Description: CRC demo that calls calculation and checks performance
 *
 * Notes:
 *
 * Returns:     No return value
 *
 **********************************************************************/

void fast_crc_demo (void)
{
	unsigned short int crc_result;
	unsigned int data_block_length;
	unsigned int hex_digits;
	unsigned int time1, time2, num_ticks;

	data_block_length = (long*)DATA_BLOCK_END - (long*)DATA_BLOCK_BEGIN + 1;

	time1 = alt_timestamp_start();
	printf ("---------------------------------------------\n");
	printf ("Running CRC with custom instruction routine\n");

	for (hex_digits = 0; hex_digits <= CRC_RUNS; hex_digits++)
	{
		crc_result = fast_crcCompute((long*)DATA_SRAM_COPY, data_block_length);
		sevenseg_set_hex(hex_digits);
	}

	time2 = alt_timestamp();
	num_ticks = time2 - time1 - timer_overhead;
	printf ("CRC for Data Block = 0x%x.\n", crc_result);
	printf("CPU time(ms): %.*f\n", 2, ((float)num_ticks/(float)alt_timestamp_freq()) * (float)1000);

}  /* fast_crc_demo */



/**********************************************************************
 *
 * Function:    faster_crc_demo()
 *
 * Description: CRC demo that calls calculation and checks performance
 *
 * Notes:
 *
 * Returns:     No return value
 *
 **********************************************************************/

void faster_crc_demo (void)
{
	unsigned short int crc_result;
	unsigned int data_block_length;
	unsigned int hex_digits;
 	unsigned int time1, time2, num_ticks;

	data_block_length = (char*)DATA_BLOCK_END - (char*)DATA_BLOCK_BEGIN + 1;
	time1 = alt_timestamp_start();
	printf ("---------------------------------------------\n");
	printf ("Running CRC with DMA based routine\n");


	for (hex_digits = 0; hex_digits <= CRC_RUNS; hex_digits++)
	{
		crc_result = faster_crcCompute((long*)DATA_SRAM_COPY, data_block_length);
		sevenseg_set_hex(hex_digits);
	}

	time2 = alt_timestamp();
	num_ticks = time2 - time1 - timer_overhead;
	printf ("CRC for Data Block = 0x%x.\n", crc_result);
	printf("CPU time(ms): %.*f\n", 2, ((float)num_ticks/(float)alt_timestamp_freq()) * (float)1000);

}  /* faster_crc_demo */



/**********************************************************************
 *
 * Function:    main()
 *
 * Description: computes CRC for data block after copying from flash to SRAM
 *
 * Notes:       This function expects that crcInit() has been called
 *              first to initialize the CRC lookup table.
 *              This Fuction has been modified from the original file
 *              for the purposes of a Nios custom instruction lab/demo
 *
 * Returns:     n/a
 *
 **********************************************************************/

int main(void)
{
	unsigned int buttons;
	unsigned int* read_data;
	unsigned int* write_data;
	unsigned int time1, time2, timer_overhead;

#ifdef TEST
	// Copy data known data into sram
	write_data = (int*)DATA_SRAM_COPY;
	for (read_data = (int*)DATA_BLOCK_BEGIN; (int*)read_data <= (int*)DATA_BLOCK_END; read_data++)
	{
   	*write_data = 0x01234567;
   	write_data++;
	}
#else
	// Copy data block to SRAM so that Flash access time does not effect results
	write_data = (int*)DATA_SRAM_COPY;
	for (read_data = (int*)DATA_BLOCK_BEGIN; (int*)read_data <= (int*)DATA_BLOCK_END; read_data++)
	{
   	IOWR_32DIRECT(write_data, 0, *read_data);
   	write_data++;
	}
#endif

// simulation is only intended for the accelerated routines so dont bother
// initialising the crc table for the software routine during simulation
#ifndef SIM
	crcInit();
#endif

	// Start Timer:
	if(alt_timestamp_start() < 0)
	{
		printf("Timer init failed \n");
		exit(0);
	}

	// Determine time measurement overhead
	time1 = alt_timestamp_start();
	time2 = alt_timestamp();
	timer_overhead = time2 - time1;

	// Open DMA channel
	tx = alt_dma_txchan_open ("/dev/avalon_dma");

	while (1)
	{

#ifdef SIM
		printf("CRC\n");
#else
		printf ("\n=============================================\n");
		printf ("Nios II CRC Acceleration Demo\n");
		printf ("Press SW0 for software calculation\n");
		printf ("press SW1 for custom instruction calculation\n");
		printf ("press SW2 for DMA calculation\n");
#endif

		buttons = IORD_ALTERA_AVALON_PIO_DATA(BUTTON_PIO_BASE);
		while (buttons == NONE)
			buttons = IORD_ALTERA_AVALON_PIO_DATA(BUTTON_PIO_BASE);

		switch (buttons) {
			case SW0:
				crc_demo();
				break;
			case SW1:
				fast_crc_demo();
				break;
			case SW2:
				faster_crc_demo();
				break;
		}

		while (buttons != NONE)
			buttons = IORD_ALTERA_AVALON_PIO_DATA(BUTTON_PIO_BASE);

		usleep (40000);  // debounce delay
  	}
}  /* main */

/**********************************************************************
 *
 * End of file.
 *
 **********************************************************************/


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆福利精品推荐| www.亚洲色图| 亚洲国产毛片aaaaa无费看| ●精品国产综合乱码久久久久| 久久久午夜精品理论片中文字幕| 精品福利在线导航| 精品处破学生在线二十三| 日韩欧美激情在线| 欧美一级黄色录像| 欧美激情一区二区| 亚洲美腿欧美偷拍| 偷拍日韩校园综合在线| 麻豆成人综合网| 国内精品久久久久影院色| 国产精品综合av一区二区国产馆| 国产夫妻精品视频| 97久久精品人人做人人爽| 91国内精品野花午夜精品| 国产精品亚洲一区二区三区在线| 日韩经典中文字幕一区| 亚洲电影第三页| 久久精品国产亚洲一区二区三区 | 欧美人与禽zozo性伦| 777奇米四色成人影色区| 26uuu国产日韩综合| 中文字幕一区二区三区在线观看| 亚洲精品高清在线| 蜜臀av性久久久久av蜜臀妖精 | 91美女在线观看| 欧美日韩在线播| 久久久不卡影院| 亚洲综合免费观看高清完整版在线| 日本女人一区二区三区| 成人av影视在线观看| 欧美精品一级二级| 欧美韩日一区二区三区四区| 午夜激情久久久| 99在线精品免费| 日韩欧美在线影院| 亚洲黄色免费电影| 国产米奇在线777精品观看| 欧洲av在线精品| 国产日韩欧美综合在线| 日韩影视精彩在线| 91麻豆swag| 国产欧美日本一区二区三区| 日本人妖一区二区| 色网站国产精品| 国产精品免费av| 国产一区二区三区精品欧美日韩一区二区三区 | 国产成人免费网站| 欧美日韩一区久久| 1000部国产精品成人观看| 国产一区二区三区免费在线观看| 日韩欧美www| 丝袜美腿成人在线| 91高清视频免费看| 亚洲视频免费观看| 不卡视频一二三四| 国产色爱av资源综合区| 黄色小说综合网站| 日韩一区二区在线看片| 亚洲va韩国va欧美va| 91福利小视频| 一区二区欧美在线观看| 99精品热视频| 亚洲欧洲www| 91在线观看视频| 国产精品久久福利| av中文一区二区三区| 国产精品伦理在线| 99免费精品在线观看| 中文字幕中文字幕一区| 成人av资源在线| 国产精品乱子久久久久| 91社区在线播放| 亚洲永久免费视频| 欧美日韩国产一二三| 日韩vs国产vs欧美| 欧美一区二区三区啪啪| 久久91精品久久久久久秒播| 精品欧美久久久| 国产mv日韩mv欧美| ...xxx性欧美| 欧美亚洲免费在线一区| 香蕉成人啪国产精品视频综合网| 精品视频免费在线| 久久精品国产亚洲a| 国产亚洲精品aa| 91在线免费播放| 亚洲gay无套男同| 精品久久一二三区| 99精品久久99久久久久| 亚洲在线免费播放| 精品第一国产综合精品aⅴ| 国产成人在线电影| 亚洲靠逼com| 日韩一区二区不卡| 成人黄色电影在线| 午夜不卡av免费| 国产欧美精品区一区二区三区| 91美女视频网站| 国产中文字幕精品| 一区二区在线免费观看| 日韩精品在线网站| 91影院在线免费观看| 极品瑜伽女神91| 一级中文字幕一区二区| 亚洲视频资源在线| 制服丝袜亚洲色图| 99精品偷自拍| 国产精品自拍在线| 亚洲人被黑人高潮完整版| 日韩精品一区二区三区四区| 91麻豆精品视频| 国产一区二区三区在线观看免费| 亚洲亚洲人成综合网络| 国产午夜一区二区三区| 欧美精品视频www在线观看| 成人国产一区二区三区精品| 五月天一区二区三区| 亚洲视频免费在线观看| 久久综合色婷婷| 欧美美女视频在线观看| gogogo免费视频观看亚洲一| 久草这里只有精品视频| 三级在线观看一区二区| 亚洲黄色性网站| 国产精品国产自产拍高清av王其| 欧美精品一区二区三区在线| 欧美精三区欧美精三区| 在线观看免费一区| 色婷婷综合在线| 99久久99久久精品免费看蜜桃| 国产专区欧美精品| 激情伊人五月天久久综合| 无码av免费一区二区三区试看 | 欧美电影免费观看高清完整版在线观看| 色综合久久九月婷婷色综合| 国产99久久久精品| 国产毛片精品一区| 国产在线精品视频| 久久国产精品一区二区| 美女视频一区在线观看| 亚洲一区二区视频| 久久精品国产在热久久| 蜜桃视频第一区免费观看| 人人精品人人爱| 蜜臀av性久久久久蜜臀aⅴ流畅| 日韩专区欧美专区| 免费精品视频在线| 久久精品99久久久| 国产尤物一区二区在线| 国产一区二区三区免费在线观看| 韩国欧美一区二区| 高清不卡一二三区| 成人小视频免费观看| 欧美中文字幕一区| 一本色道久久加勒比精品| 中文字幕亚洲区| 国产精品久久久久久久裸模 | av电影天堂一区二区在线| 成人av午夜电影| 97久久精品人人澡人人爽| 色综合久久久久综合体| 欧美日本乱大交xxxxx| 欧美一区二区三区免费| 亚洲精品在线一区二区| 国产精品久久久久久久久晋中 | 狠狠狠色丁香婷婷综合激情| 国产精一品亚洲二区在线视频| 国产ts人妖一区二区| 91麻豆产精品久久久久久| 欧美情侣在线播放| 精品美女在线观看| 国产精品每日更新| 日韩国产成人精品| 国产精品资源网站| 91极品视觉盛宴| www国产精品av| 亚洲精品成人在线| 久久精品免费观看| av中文字幕亚洲| 欧美一级片在线看| 国产精品国产成人国产三级| 亚洲一区二区美女| 国产伦精品一区二区三区免费迷| 不卡av免费在线观看| 欧美精品色一区二区三区| 亚洲国产精品激情在线观看| 午夜精品视频一区| 成人高清免费在线播放| 欧美一区2区视频在线观看| 中文字幕av一区二区三区高| 亚洲 欧美综合在线网络| 高清不卡一区二区| 日韩精品综合一本久道在线视频| 日韩码欧中文字| 国产伦精品一区二区三区免费迷 | 精品欧美一区二区在线观看|