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

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

?? crc.c

?? NiosII DMA_用戶指令_自定義邏輯應用實例 nios_DMA_CI_UL
?? C
?? 第 1 頁 / 共 2 頁
字號:
/******************************************************************************
*                                                                             *
* License Agreement                                                           *
*                                                                             *
* Copyright (c) 2003 Altera Corporation, San Jose, California, USA.           *
* All rights reserved.                                                        *
*                                                                             *
* Permission is hereby granted, free of charge, to any person obtaining a     *
* copy of this software and associated documentation files (the "Software"),  *
* to deal in the Software without restriction, including without limitation   *
* the rights to use, copy, modify, merge, publish, distribute, sublicense,    *
* and/or sell copies of the Software, and to permit persons to whom the       *
* Software is furnished to do so, subject to the following conditions:        *
*                                                                             *
* The above copyright notice and this permission notice shall be included in  *
* all copies or substantial portions of the Software.                         *
*                                                                             *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     *
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         *
* DEALINGS IN THE SOFTWARE.                                                   *
*                                                                             *
* This agreement shall be governed in all respects by the laws of the State   *
* of California and by the laws of the United States of America.              *
*                                                                             *
******************************************************************************/

/*
 * The software implementation of CRC calulation contained within
 * this file is based upon an example written by Michael Barr
 * The original copyright notice is shown below
 */

/**********************************************************************
 *
 * Filename:    crc.c
 *
 * Description: A table-driven implementation of CRC-CCITT checksums.
 *
 * Notes:       Some of the constants in this file are specific to
 *              Arcom's Target188EB hardware.
 *
 *              This code can be easily modified to implement any
 *              "non-reflective" CRC algorithm.  Simply change the
 *              constants POLYNOMIAL, INITIAL_REMAINDER, FINAL_XOR,
 *              and--if an 8 or 32-bit CRC is required--the definition
 *              of type 'width'.
 *
 *
 * Copyright (c) 1998 by Michael Barr.  This software is placed into
 * the public domain and may be used for any purpose.  However, this
 * notice must not be changed or removed and no warranty is either
 * expressed or implied by its publication or distribution.
 **********************************************************************/


// #defines for test purposes
#ifdef ALT_SIM_OPTIMIZE  // this is set if the syslib project compiles for modelsim
#define SIM  // reduces repititions and printfs for simulation purpose
#define TEST  // reduces data block size and fills with known data
#endif

#ifndef TEST
// #defines that determine the CRC operation
// These can be changed by the user for experimentation
#define DATA_BLOCK_BEGIN EXT_FLASH_BASE
#define DATA_BLOCK_END   (EXT_FLASH_BASE + 0xffff)
#define DATA_SRAM_COPY   (EXT_RAM_BASE + 0xa0000)
#else
// limit the data block size for test purposes
#define DATA_BLOCK_BEGIN EXT_FLASH_BASE
#define DATA_BLOCK_END   (EXT_FLASH_BASE + 0xff)
#define DATA_SRAM_COPY   (EXT_RAM_BASE + 0xa0000)
#endif

// complete only one run if simulating
#ifdef SIM
#define CRC_RUNS 1
#else
#define CRC_RUNS 0x80
#endif


// These #defines represent the values read by the PIO
// connected to push buttons on the Altera development board
// They should not be changed by the user
#define SW0 0xE
#define SW1 0xD
#define SW2 0xB
#define NONE 0xF


// include libraries
#include <stdio.h>
#include <stdlib.h>
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
#include <unistd.h>
#include <sys/alt_timestamp.h>
#include "altera_avalon_dma.h"
#include "sys/alt_dma.h"


// Global variables:
alt_dma_txchan tx;				// channel descriptor for DMA transfer
volatile int dma_complete = 0;  // used by call back routine to denote completion of DMA
unsigned int timer_overhead;	// timer overhead of using the timestamp functions



/********************************************
 * Michael Barr's orignial code starts here *
 ********************************************/

// Any changes to #defines will impact the software routines only

/*
 * The CRC parameters.  Currently configured for CCITT.
 * Simply modify these to switch to another CRC standard.
 * NB: THIS ONLY EFFECTS THE SOFTWARE ROUTINE
 *     THE OTHER ROUTINES ARE HARD CODED IN THE HARDWARE
 */
#define POLYNOMIAL          0x1021
#define INITIAL_REMAINDER   0xFFFF
#define FINAL_XOR_VALUE     0x0000

/*
 * The width of the CRC calculation and result.
 * Modify the typedef for an 8 or 32-bit CRC standard.
 */
typedef unsigned short width;

#define WIDTH   (8 * sizeof(width))
#define TOPBIT  (1 << (WIDTH - 1))

/*
 * An array containing the pre-computed intermediate result for each
 * possible byte of input.  This is used to speed up the computation.
 */
width  crcTable[256];



/**********************************************************************
 *
 * Function:    crcInit()
 *
 * Description: Initialize the CRC lookup table.  This table is used
 *              by crcCompute() to make CRC computation faster.
 *
 * Notes:       The mod-2 binary long division is implemented here.
 *
 * Returns:     None defined.
 *
 **********************************************************************/

void crcInit(void)
{
	width  remainder;
	width  dividend;
	int    bit;

	// Perform binary long division, a bit at a time.
	for (dividend = 0; dividend < 256; dividend++)
	{
		// Initialize the remainder.
		remainder = dividend << (WIDTH - 8);

		// Shift and XOR with the polynomial.
		for (bit = 0; bit < 8; bit++)
		{
         // Try to divide the current data bit.
			if (remainder & TOPBIT)
			{
				remainder = (remainder << 1) ^ POLYNOMIAL;
			}
			else
			{
				remainder = remainder << 1;
			}
		}

		// Save the result in the table.
		crcTable[dividend] = remainder;
	}
}   /* crcInit() */



/**********************************************************************
 *
 * Function:    crcCompute()
 *
 * Description: Compute the CRC checksum of a binary message block.
 *
 * Notes:       This function expects that crcInit() has been called
 *              first to initialize the CRC lookup table.
 *
 * Returns:     The CRC of the data.
 *
 **********************************************************************/

unsigned short crcCompute(unsigned char * message, unsigned int nBytes)
{
	unsigned int   offset;
	unsigned char  byte;
	width          remainder = INITIAL_REMAINDER;

	// Divide the message by the polynomial, a byte at time.
	for (offset = 0; offset < nBytes; offset++)
	{
		byte = (remainder >> (WIDTH - 8)) ^ message[offset];
		remainder = crcTable[byte] ^ (remainder << 8);
	}

	// The final remainder is the CRC result.
	return (remainder ^ FINAL_XOR_VALUE);

}   /* crcCompute() */



/******************************************
 * Michael Barr's orignial code ends here *
 ******************************************/



/**********************************************************************
 *
 * Function:    fast_crcCompute()
 *
 * Description: Computes the CRC checksum of a binary message block
 *
 * Notes:		Uses a custom instruction to perform the calculation
 *				The data block must be a factor 0f 4 bytes in length
 *
 * Returns:     The CRC of the data
 *
 **********************************************************************/

unsigned short fast_crcCompute(unsigned long *data_block, unsigned int nWords)
{
	unsigned long*  pointer;
	unsigned short   word;


	// #### COMPLETE CODE SEGMENT BELOW ####
	// initialise crc reg to 0xFFFF
	// call CRC Custom Instruction with DataA = 0xFFF & DataB = 0x1
	//
	word = /*Insert code*/;

	for (pointer = data_block; pointer < (data_block + nWords); pointer ++)
	{
		// #### COMPLETE CODE SEGMENT BELOW ####
		// pass next word to CRC custom instruction
		// call CRC Custom Instruction with DataA = *pointer & DataB = 0x0
		//
		word = /*Insert code*/;
	}

	return (word);

}   /* fast_crcCompute() */



/**********************************************************************
 *
 * Function:    dma_done()
 *
 * Description: Sets the global variable dma_complete to 1
 *
 * Notes:       Callback function called by DMA routine upon
 *              completion
 *
 * Returns:     The Global variable dma_done is set to 1.
 *
 **********************************************************************/

void dma_done (void* handle, void* data){
	dma_complete = 1;

}  /* dma_done */



/**********************************************************************
 *
 * Function:    faster_crcCompute()
 *
 * Description: Computes the CRC checksum of a binary message block
 *
 * Notes:		Uses a custom peripheral to perform the calculation
 *				The data block must be a factor 0f 4 bytes in length
 *
 * Returns:     The CRC of the data

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91福利国产精品| av亚洲精华国产精华精| 7777精品伊人久久久大香线蕉完整版| 亚洲一区二区三区四区的| 欧美日韩精品欧美日韩精品一 | 欧美一级日韩不卡播放免费| 天堂一区二区在线| 久久影院电视剧免费观看| 成人免费av在线| 亚洲一区二区三区四区不卡| 日韩一级黄色片| 成人国产免费视频| 悠悠色在线精品| 91精品国产色综合久久ai换脸| 久久69国产一区二区蜜臀| 国产精品成人在线观看| 欧美日韩精品电影| 国产麻豆成人精品| 一区二区三区.www| 欧美一区二区人人喊爽| 成人做爰69片免费看网站| 亚洲影院免费观看| 精品久久免费看| 在线观看日产精品| 国产一区欧美二区| 一区二区在线免费观看| 26uuu欧美| 欧美日韩专区在线| 国产高清视频一区| 午夜电影一区二区三区| 中文字幕欧美激情| 欧美一区二区三区四区五区| 不卡视频一二三| 美国一区二区三区在线播放| 国产精品午夜电影| 欧美一区二区视频在线观看| 成人高清免费观看| 捆绑调教一区二区三区| 免费成人在线视频观看| 国产精品久久久久久久久图文区| 在线播放日韩导航| 不卡av电影在线播放| 久久99精品久久久久久久久久久久| 成人免费小视频| 精品欧美一区二区在线观看| 色婷婷综合久久久久中文一区二区 | 国产精品一线二线三线精华| 亚洲国产乱码最新视频| 国产精品水嫩水嫩| 国产亚洲一本大道中文在线| 51精品秘密在线观看| 欧美亚洲国产一区二区三区va| 国产91精品一区二区麻豆亚洲| 日韩**一区毛片| 夜夜嗨av一区二区三区| 亚洲欧美日韩国产综合在线| 欧美激情中文不卡| 国产日韩欧美一区二区三区乱码| 69堂精品视频| 欧美日韩的一区二区| 在线日韩一区二区| 在线视频你懂得一区| 91麻豆精品在线观看| 成人av午夜电影| 成人av资源站| 成人福利视频在线| 成人激情免费视频| 成人免费视频一区二区| 高清成人免费视频| 国产剧情一区二区| 国产二区国产一区在线观看 | 成人激情免费网站| 成人sese在线| www.久久精品| 色综合天天做天天爱| 日本福利一区二区| 在线观看日韩高清av| 在线视频欧美区| 91.xcao| 日韩欧美黄色影院| 欧美mv日韩mv国产网站| 久久亚洲综合色一区二区三区| 久久婷婷久久一区二区三区| 国产婷婷色一区二区三区| 久久综合久久综合久久| 国产区在线观看成人精品| 国产欧美精品在线观看| 日韩精品一区第一页| 捆绑调教美女网站视频一区| 国内精品在线播放| 成人av综合在线| 欧美在线小视频| 精品久久人人做人人爱| 中文字幕国产精品一区二区| 亚洲欧美乱综合| 视频在线在亚洲| 国产99久久久国产精品潘金 | 在线观看区一区二| 56国语精品自产拍在线观看| 欧美成人video| 国产精品国产自产拍在线| 亚洲资源在线观看| 久久er精品视频| 91在线视频播放地址| 欧美日韩大陆一区二区| 久久女同精品一区二区| 日韩一区在线看| 蜜桃av一区二区三区电影| 风间由美一区二区av101| 日本黄色一区二区| 欧美一级国产精品| 中文字幕一区二区三| 丝袜美腿高跟呻吟高潮一区| 国产成人精品综合在线观看 | 欧美中文字幕一区二区三区| 日韩免费看网站| 亚洲人成小说网站色在线| 日韩av在线播放中文字幕| av一区二区三区四区| 8v天堂国产在线一区二区| 国产精品入口麻豆九色| 亚洲成人激情av| 99综合电影在线视频| 欧美一区永久视频免费观看| 中文字幕字幕中文在线中不卡视频| 日韩精品一二三| 99精品在线免费| 国产亚洲欧美日韩日本| 亚洲v中文字幕| 99久久婷婷国产综合精品电影| 日韩午夜在线影院| 艳妇臀荡乳欲伦亚洲一区| 激情六月婷婷久久| 欧美日本在线观看| ●精品国产综合乱码久久久久 | 粉嫩欧美一区二区三区高清影视| 欧美视频日韩视频在线观看| 午夜精品视频一区| 91污在线观看| 欧美国产1区2区| 久久99久久99| 欧美一区二区三区在线电影| 亚洲已满18点击进入久久| 久久机这里只有精品| 91精品综合久久久久久| 亚洲影视在线播放| 91性感美女视频| 中文字幕一区三区| 不卡大黄网站免费看| 欧美国产成人在线| 国产精品456| 久久免费电影网| 麻豆精品视频在线观看视频| 欧美精品vⅰdeose4hd| 亚洲欧洲中文日韩久久av乱码| 成人av在线一区二区三区| 久久久久亚洲蜜桃| 国产米奇在线777精品观看| 日韩欧美第一区| 精品一区二区在线免费观看| 日韩精品一区二区三区中文精品 | 日本欧美一区二区| 欧美一级黄色大片| 另类调教123区| 欧美不卡视频一区| 韩国午夜理伦三级不卡影院| 欧美r级电影在线观看| 国产在线麻豆精品观看| 久久精品在线免费观看| 国产成人精品在线看| 国产欧美日韩激情| av激情综合网| 亚洲一区免费视频| 欧美精品一二三区| 裸体健美xxxx欧美裸体表演| 日韩欧美在线观看一区二区三区| 麻豆精品一区二区综合av| 久久综合给合久久狠狠狠97色69| 国产精品99久久久久久有的能看 | 欧美色视频在线观看| 日韩福利电影在线| 精品国产一区二区三区四区四| 激情深爱一区二区| 国产精品乱码一区二三区小蝌蚪| 99精品视频中文字幕| 亚洲亚洲精品在线观看| 91精品国产综合久久精品麻豆| 久99久精品视频免费观看| 中文子幕无线码一区tr| 91色九色蝌蚪| 日韩国产在线观看| 国产日产精品一区| 91女厕偷拍女厕偷拍高清| 午夜视黄欧洲亚洲| 国产精品久久久久久久岛一牛影视 | 亚洲黄色免费电影| 欧美伦理电影网| 国产乱一区二区| 亚洲综合在线视频| 日韩一级完整毛片|