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

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

?? xilinx-load.c

?? eCos操作系統源碼
?? C
字號:
//==========================================================================////      xilinx-load.c////      FPGA support for NMI uEngine uE250 PCI////==========================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 2003 Gary Thomas <gary@mind.be>//// eCos is free software; you can redistribute it and/or modify it under// the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 or (at your option) any later version.//// eCos is distributed in the hope that it will be useful, but WITHOUT ANY// WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License// for more details.//// You should have received a copy of the GNU General Public License along// with eCos; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.//// As a special exception, if other files instantiate templates or use macros// or inline functions from this file, or you compile this file and link it// with other works to produce a work based on this file, this file does not// by itself cause the resulting work to be covered by the GNU General Public// License. However the source code for this file must still be made available// in accordance with section (3) of the GNU General Public License.//// This exception does not invalidate any other reasons why a work based on// this file might be covered by the GNU General Public License.//// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.// at http://sources.redhat.com/ecos/ecos-license/// -------------------------------------------//####ECOSGPLCOPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):    David Mazur <david@mind.be>// Contributors: gthomas// Date:         2003-02-20// Purpose:      FPGA support// Description:  ////####DESCRIPTIONEND####////========================================================================*/#include <pkgconf/hal.h>#include <pkgconf/system.h>#include CYGBLD_HAL_PLATFORM_H#include CYGHWR_MEMORY_LAYOUT_H#include <cyg/infra/cyg_type.h>         // base types#include <cyg/infra/cyg_trac.h>         // tracing macros#include <cyg/infra/cyg_ass.h>          // assertion macros#include <cyg/infra/diag.h>             // diagnostic printing#include <cyg/hal/hal_io.h>             // IO macros#include <cyg/hal/hal_if.h>             // calling interface API#include <cyg/hal/hal_arch.h>           // Register state info#include <cyg/hal/hal_diag.h>#include <cyg/hal/hal_intr.h>           // Interrupt names#include <cyg/hal/hal_cache.h>#include <cyg/io/pci_hw.h>#include <cyg/io/pci.h>#include <cyg/hal/plx.h>#define FPGA_PROG 0x00020000#define FPGA_INIT 0x00000002#define FPGA_DONE 0x00080000#define _FPGA_PROG_BASE 0x0c000000#define FPGA_PROG_BASE (*((volatile cyg_uint32 *)(_FPGA_PROG_BASE)))#define FPGA_DONE_DRV   0x8#define FPGA_INIT_DRV   0x10#define FPGA_WRITE      0x20#define VGA_PROG_CTRL  0x4008#define VGA_PROG_DATA  0x400C#define VGA_DONE       0x1#define VGA_INIT       0x2#define VGA_PROG       0x4#define VGA_DONE_DRV   0x8#define VGA_INIT_DRV   0x10#define VGA_WRITE      0x20#include <cyg/compress/zlib.h>extern char _end;static z_stream stream;#define FEEDBACK_COUNT 16#define ZCHAR_BUF_SIZE 256struct _zchar_info {    char  buf[ZCHAR_BUF_SIZE];    char *ptr;    int   avail;    int   feedback;    int   total;};// Internal allocator for decompression - just use bottom of heap// which will be reclaimed by eCos once the system is initializedstatic void *_zcalloc(void *opaque, unsigned int items, unsigned int size){    static char *ptr = (char *)&_end;    char *res = ptr;//    diag_printf("%s(%p,%d,%d) = %p\n", __FUNCTION__, opaque, items, size, res);    ptr += (size*items);    return res;}static void _zcfree(void *opaque, void *ptr){//    diag_printf("%s(%p,%p)\n", __FUNCTION__, opaque, ptr);    }static int_zchar(void){    int err;    struct _zchar_info *info = (struct _zchar_info *)stream.opaque;    static char spin[] = "|/-\\|-";    static int tick = 0;    if (info->avail == 0) {        stream.next_out = info->buf;        stream.avail_out = sizeof(info->buf);        info->ptr = info->buf;        err = inflate(&stream, Z_SYNC_FLUSH);        info->avail = (char *)stream.next_out - info->buf;        if (--info->feedback == 0) {            diag_printf("%c\b", spin[tick++]);            if (tick >= (sizeof(spin)-1)) {                tick = 0;            }            info->feedback = FEEDBACK_COUNT;        }    }    if (info->avail) {        info->avail--;        info->total++;        return *(info->ptr)++;    } else {        // End of data stream        return -1;    }}/** * A little bit swapping function, necessary due to the xilinx bit file format. */static const cyg_uint8 _swapped[] = {    0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,    0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F};static cyg_uint8 bitswap(cyg_uint8 byte){    cyg_uint8 _new = (_swapped[byte & 0x0F] << 4) | (_swapped[(byte >> 4) & 0x0F]);    return _new;}typedef int _bitfile_fun(void);typedef void _download_fun(_bitfile_fun *_bitfile);/** * Gets the tag at given location in the bitfile. */static cyg_uint8 bitfile_get_tag(_bitfile_fun *_bitfile){    return (*_bitfile)();}static cyg_uint16 bitfile_get_len16(_bitfile_fun *_bitfile){    cyg_uint16 length;    length = (*_bitfile)() << 8;    length |= (*_bitfile)();    return length;}static int bitfile_get_len32(_bitfile_fun *_bitfile){    cyg_uint32 length;    length = (*_bitfile)() << 24;    length |= (*_bitfile)() << 16;    length |= (*_bitfile)() << 8;    length |= (*_bitfile)();    return length;}/** * Process a string tag. */static void bitfile_process_string_tag(char *description, _bitfile_fun *_bitfile){    int len,i;    len = bitfile_get_len16(_bitfile);    diag_printf(description);    for (i = 0; i < len; i++) {        diag_printf("%c", (*_bitfile)());    }}/** * Process the 'e' tag in the bit file, which is the actual code that is to * be programmed on the fpga. */static void bitfile_process_tag_e(_bitfile_fun *_bitfile){    int len,count,i;    cyg_uint8 byte;    cyg_uint32 word;    len = bitfile_get_len32(_bitfile);    *PXA2X0_GPCR0 = FPGA_PROG;    for (count=0; count<10000; count++)        if ((*PXA2X0_GPLR0 & FPGA_INIT) == 0)            break;    if ((*PXA2X0_GPLR0 & FPGA_INIT) != 0)        diag_printf("INIT did not go low. FPGA programming failed\n");    *PXA2X0_GPSR0 = FPGA_PROG;    for (count=0; count<10000; count++)        if ((*PXA2X0_GPLR0 & FPGA_INIT) != 0)            break;    if ((*PXA2X0_GPLR0 & FPGA_INIT) == 0)        diag_printf("INIT did not go high. FPGA programming failed\n");    for( i=0; i<len; i++) {        if ((*PXA2X0_GPLR0 & FPGA_INIT) == 0) {            diag_printf("CRC Error. FPGA programming failed\n");        }        byte = (*_bitfile)();        word = 0;        if (byte & (0x01 << 7)) word|=(0x01);        if (byte & (0x01 << 6)) word|=(0x01 << 18);        if (byte & (0x01 << 5)) word|=(0x01 << 14);        if (byte & (0x01 << 4)) word|=(0x01 << 1);        if (byte & (0x01 << 3)) word|=(0x01 << 4);        if (byte & (0x01 << 2)) word|=(0x01 << 6);        if (byte & (0x01 << 1)) word|=(0x01 << 9);        if (byte & (0x01)) word|=(0x01 << 30);        FPGA_PROG_BASE = word;    }    for (count=0; count<10000; count++)        if ((*PXA2X0_GPLR0 & FPGA_DONE) != 0)            break;    if ((*PXA2X0_GPLR0 & FPGA_DONE) == 0)        diag_printf("DONE did not go high. FPGA programming failed\n");}/** * Process the 'e' tag in the bit file, which is the actual code that is to * be programmed on the fpga. */static void vga_bitfile_process_tag_e(_bitfile_fun *_bitfile){    int len,count,i;    cyg_uint8 byte;    len = bitfile_get_len32(_bitfile);    localbus_writeb(VGA_WRITE,  VGA_PROG_CTRL);    localbus_writeb(VGA_WRITE | VGA_PROG,  VGA_PROG_CTRL);    for (count=0; count<10000; count++)        if (localbus_readb(VGA_PROG_CTRL) & VGA_INIT)            break;    if (!(localbus_readb(VGA_PROG_CTRL) & VGA_INIT))        diag_printf("INIT did not go high. VGA FPGA programming failed\n");    localbus_writeb(VGA_PROG, VGA_PROG_CTRL);    for (i=0; i<len; i++) {        byte = (*_bitfile)();        localbus_writeb(bitswap(byte),VGA_PROG_DATA);    }     for (count=0; count<10000; count++)        if (localbus_readb(VGA_PROG_CTRL) & VGA_DONE)            break;    if (!(localbus_readb(VGA_PROG_CTRL) & VGA_DONE))        diag_printf("DONE did not go high. VGA FPGA programming failed\n");    localbus_writeb(VGA_PROG | VGA_WRITE,  VGA_PROG_CTRL);}//// Download a bitstream//static voiddownload_bitstream(char *title, _bitfile_fun *_bitfile, _download_fun *_download){    int len, tag;    diag_printf("Load %s(", title);    len = bitfile_get_len16(_bitfile);    while (len-- > 0) {        (*_bitfile)();  // Skip    }    len = bitfile_get_len16(_bitfile);    tag = 0;    while (tag != 'e') {        tag = bitfile_get_tag(_bitfile);        switch (tag) {        case 'a':            bitfile_process_string_tag("Design:", _bitfile);            break;        case 'b':            bitfile_process_string_tag(", Part:", _bitfile);            break;        case 'c':            bitfile_process_string_tag(", Date:", _bitfile);            break;        case 'd':            bitfile_process_string_tag(" ", _bitfile);            break;        case 'e':            (*_download)(_bitfile);            break;        default:            diag_printf("Unknown tag. aborting...\n");            return;        }    }}/** * Process a bitfile located at the given address. */void load_fpga(cyg_uint8 *compressed_bitfile, int len) {    int err;    struct _zchar_info zchar_data;    stream.zalloc = _zcalloc;    stream.zfree = _zcfree;    stream.next_in = compressed_bitfile;    stream.avail_in = len;    stream.next_out = 0;    stream.avail_out = 0;    stream.opaque = (void *)&zchar_data;    zchar_data.avail = 0;    zchar_data.feedback = FEEDBACK_COUNT;    zchar_data.total = 0;    err = inflateInit(&stream);    if (err) {        diag_printf("%s: Can't init stream\n", __FUNCTION__);        return;    }    // Set up to download FPGA bitstreap    *PXA2X0_GPSR0 = FPGA_PROG;    download_bitstream("PCI ctlr", _zchar, bitfile_process_tag_e);    inflateEnd(&stream);    diag_printf(") %x bytes\n", zchar_data.total);}/** * Process a bitfile located at the given address. */void load_vga(cyg_uint8 *compressed_bitfile, int len){    int err;    struct _zchar_info zchar_data;    stream.zalloc = _zcalloc;    stream.zfree = _zcfree;    stream.next_in = compressed_bitfile;    stream.avail_in = len;    stream.next_out = 0;    stream.avail_out = 0;    stream.opaque = (void *)&zchar_data;    zchar_data.avail = 0;    zchar_data.feedback = FEEDBACK_COUNT;    zchar_data.total = 0;    err = inflateInit(&stream);    if (err) {        diag_printf("%s: Can't init stream\n", __FUNCTION__);        return;    }    download_bitstream("VGA ctlr", _zchar, vga_bitfile_process_tag_e);    inflateEnd(&stream);    diag_printf(") %x bytes\n", zchar_data.total);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩欧美一区二区三区综合| 黑人巨大精品欧美一区| 亚洲电影视频在线| 蜜桃av噜噜一区| av在线播放一区二区三区| 欧美日韩性生活| 亚洲国产经典视频| 日韩精品欧美精品| 不卡视频在线看| 91精品综合久久久久久| 一区免费观看视频| 精品一区二区影视| 欧美日韩三级视频| 岛国av在线一区| 91影院在线免费观看| 日韩免费高清视频| 亚洲最色的网站| 国产精品一级在线| 日韩精品一区二区三区在线 | 最近中文字幕一区二区三区| 日本aⅴ免费视频一区二区三区| 欧美日韩一区 二区 三区 久久精品| 亚洲精品一线二线三线| 亚洲高清免费观看高清完整版在线观看| 韩日欧美一区二区三区| 正在播放亚洲一区| 亚洲大尺度视频在线观看| 成人av网站在线观看免费| 久久精品一区四区| 国产乱国产乱300精品| 欧美一区二区成人6969| 午夜视频一区二区| 欧美亚洲国产一区在线观看网站| 国产iv一区二区三区| 亚洲午夜久久久久久久久久久| 国产老肥熟一区二区三区| 欧美日韩国产123区| 亚洲精品国产a久久久久久| 成人精品国产福利| 国产视频一区二区三区在线观看| 美女诱惑一区二区| 制服.丝袜.亚洲.另类.中文| 日韩国产欧美三级| 欧美一区日韩一区| 首页综合国产亚洲丝袜| 欧美高清性hdvideosex| 丝袜亚洲精品中文字幕一区| 欧美性一二三区| 性欧美大战久久久久久久久| 欧美精品v国产精品v日韩精品| 午夜av电影一区| 一本色道a无线码一区v| 国产精品视频在线看| 成人一区二区三区视频在线观看| 国产欧美精品一区aⅴ影院| 粉嫩av亚洲一区二区图片| 国产精品久久久久影视| 99re这里都是精品| 亚洲一区二区av在线| 欧美日韩国产综合视频在线观看| 天堂影院一区二区| 精品捆绑美女sm三区| 国产传媒久久文化传媒| 国产精品久久久久久久裸模| 色婷婷综合在线| 日韩国产欧美视频| 欧美激情一区二区三区不卡| 成人爱爱电影网址| 亚洲成人av资源| www激情久久| 99精品国产99久久久久久白柏| 亚洲裸体在线观看| 欧美一区二区精品| 成人一级片网址| 亚洲国产欧美日韩另类综合| 精品入口麻豆88视频| 99精品视频中文字幕| 天堂av在线一区| 中文字幕精品综合| 欧美美女黄视频| 成人综合日日夜夜| 天堂av在线一区| 欧美国产欧美综合| 欧美久久婷婷综合色| 国产**成人网毛片九色| 午夜精品视频一区| 国产精品美女久久久久久2018| 欧美日精品一区视频| 国产乱对白刺激视频不卡| 亚洲最大成人综合| 亚洲私人影院在线观看| 欧美亚洲一区三区| 国产乱码精品一区二区三| 一区二区三区四区蜜桃| 337p日本欧洲亚洲大胆精品| 91久久精品国产91性色tv| 激情综合网天天干| 性做久久久久久久久| 成人免费在线视频| 亚洲精品一线二线三线无人区| 欧美午夜精品一区| 91亚洲精品乱码久久久久久蜜桃| 久久爱www久久做| 亚洲超丰满肉感bbw| 国产精品乱码人人做人人爱| 日韩精品资源二区在线| 欧美视频完全免费看| 91色婷婷久久久久合中文| 国产精品一区在线观看乱码| 日韩成人av影视| 亚洲午夜精品在线| 亚洲欧美日韩国产一区二区三区| 国产女人18毛片水真多成人如厕| 欧美一区二区三区在线电影| 欧美伊人久久久久久久久影院| av电影天堂一区二区在线观看| 国产美女一区二区三区| 奇米影视7777精品一区二区| 亚洲1区2区3区视频| 亚洲一区二区欧美日韩| 一区二区三区日韩欧美精品| 国产精品入口麻豆原神| 亚洲国产高清在线观看视频| 国产欧美日韩一区二区三区在线观看| 2021中文字幕一区亚洲| 精品少妇一区二区三区| 精品美女被调教视频大全网站| 91精品国产入口| 在线播放日韩导航| 日韩一区二区三区av| 日韩欧美国产精品| 精品处破学生在线二十三| 欧美tk丨vk视频| 久久精品在线免费观看| 中文字幕精品一区| 亚洲婷婷综合色高清在线| 亚洲伦在线观看| 亚洲.国产.中文慕字在线| 天堂在线亚洲视频| 久久精品久久久精品美女| 国精品**一区二区三区在线蜜桃| 国产精品一区二区三区网站| 粉嫩久久99精品久久久久久夜| 99在线视频精品| 欧美视频中文字幕| 欧美mv和日韩mv的网站| 国产精品妹子av| 亚洲国产精品一区二区久久恐怖片| 五月天视频一区| 国内国产精品久久| 9l国产精品久久久久麻豆| 欧美在线观看一二区| 欧美刺激脚交jootjob| 久久久99免费| 亚洲欧美偷拍卡通变态| 日韩精品免费专区| 国产成人免费9x9x人网站视频| 99re这里只有精品视频首页| 91精品国产综合久久久久久久| 久久久午夜精品理论片中文字幕| 亚洲欧美综合网| 天堂久久一区二区三区| 成人天堂资源www在线| 在线播放一区二区三区| 国产精品美女久久久久久久网站| 亚洲国产成人av好男人在线观看| 韩国v欧美v亚洲v日本v| 欧洲亚洲精品在线| 国产亚洲短视频| 亚洲va韩国va欧美va精品| 国产福利一区二区三区视频| 色88888久久久久久影院按摩| 精品国产91九色蝌蚪| 亚洲综合成人在线视频| 国产精品一区三区| 欧美一区二区三区在线电影| 亚洲色图一区二区| 久久av资源站| 欧美裸体bbwbbwbbw| 亚洲人成网站色在线观看| 久久国产精品露脸对白| 欧美亚日韩国产aⅴ精品中极品| 久久久国产精品不卡| 水野朝阳av一区二区三区| 99久精品国产| 日本一区二区三区dvd视频在线| 日韩中文字幕一区二区三区| 91女厕偷拍女厕偷拍高清| 2021久久国产精品不只是精品| 日韩影院在线观看| 色综合久久久久综合体| 中文一区一区三区高中清不卡| 麻豆精品一二三| 欧美日韩高清在线播放| 亚洲美女屁股眼交3| 成人午夜av在线| 26uuu精品一区二区三区四区在线| 午夜欧美2019年伦理| 欧洲一区二区三区免费视频| 亚洲欧美偷拍三级|