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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jp1.c

?? 嵌入式開發(fā)板連接程序源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* jp1-linux.c -- JTAG protocol via parallel port for linux   Copyright (C) 2001 Marko Mlinar, markom@opencores.org   Code for TCP/IP copied from gdb, by Chris ZiomkowskiThis file is part of OpenRISC 1000 Architectural Simulator.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//* Establishes jtag proxy server and communicates with parallel port directly.  Requires root access. */#include <stdio.h>#include <ctype.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include <stdarg.h>#include <stdint.h>#include "jp.h"#include "mc.h"#define Boolean int#define false 0#define true 1/* Libraries for JTAG proxy server.  */#include <sys/stat.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <sys/select.h>#include <sys/poll.h>#include <fcntl.h>#include <netdb.h>#include <netinet/tcp.h>#include <inttypes.h>#include <errno.h>#include "gdb.h" /* partially copied from gdb/config/or1k *//* Selects crc trailer size in bits. Currently supported: 8 */#define CRC_SIZE (8)/* Scan chain size in bits.  */#define SC_SIZE (4)#ifndef ULONGEST#define ULONGEST unsigned long#endifint err = 0;int set_pc = 0;int set_step = 0;int waiting = 0;unsigned int serverIP = 0;unsigned int serverPort = 0;unsigned int server_fd = 0;unsigned int gdb_fd = 0;void HandleServerSocket(Boolean block);void JTAGRequest(void);void GDBRequest(void);void ProtocolClean(int,int32_t);static int gdb_read(void*,int);static int gdb_write(void*,int);static void jtag_set_chain (int);/* Scan chain info. *//* *INDENT-OFF* */static int chain_addr_size[] = { 0,  32, 0,  0,  5,  32, 32};static int chain_data_size[] = { 0,  32, 0,  32, 32, 32, 32};static int chain_is_valid[]  = { 0,  1,  0,  1,  1,  1,   1};static int chain_has_crc[]   = { 0,  1,  0,  1,  1,  1,   1};static int chain_has_rw[]    = { 0,  1,  0,  0,  1,  1,   1};/* *INDENT-OFF* *//* Currently selected scan chain - just to prevent unnecessary   transfers. */static int current_chain;/* Designates whether we are in SELECT_DR state, otherwise in   RUN TEST/IDLE */static int select_dr = 0;/* Crc of current read or written data.  */static int crc_r, crc_w = 0;/* Address of previous read */static unsigned long prev_regno = 0;/* Generates new crc, sending in new bit input_bit */static intcrc_calc (int crc, uint8_t input_bit){  int c;  int new_crc;  int d;#if (CRC_SIZE == 8)  d = input_bit&1;  c = crc;  /* Move queue left.  */  new_crc = crc << 1;  /* Mask upper five bits.  */  new_crc &= 0xF8;  /* Set lower three bits */  new_crc |= (d ^ ((c >> 7)&1));  new_crc |= (d ^ ((c >> 0)&1) ^ ((c >> 7)&1)) << 1;  new_crc |= (d ^ ((c >> 1)&1) ^ ((c >> 7)&1)) << 2;  return new_crc;#else  return 0;#endif}/* Writes TCLK=0, TRST=1, TMS=bit1, TDI=bit0   and    TCLK=1, TRST=1, TMS=bit1, TDI=bit0 */static voidjp1_write_JTAG (packet)  uint8_t packet;{  uint8_t data = TRST_BIT;  if (packet & 1)    data |= TDI_BIT;  if (packet & 2)    data |= TMS_BIT;      jp_out (data);  jp_wait();  crc_w = crc_calc (crc_w, packet&1);  /* rise clock */  jp_out (data | TCLK_BIT);  jp_wait();}/* Reads TDI.  */static uint8_tjp1_read_JTAG (){  uint8_t data;  data = jp_in ();  crc_r = crc_calc (crc_r, data);  return data;}/* Writes bitstream.  LS bit first.  */static voidjp1_write_stream (stream, len, set_last_bit)  ULONGEST stream;  int len;  int set_last_bit;{  int i;  if (len <= 0) return;  debug("\nwrite(");  for (i = 0; i < len - 1; i++)    jp1_write_JTAG ((stream >> i) & 1);  if (set_last_bit)    jp1_write_JTAG ((stream >> (len - 1))& 1 | TMS);  else    jp1_write_JTAG ((stream >> (len - 1))& 1);  debug(")\n");}/* Gets bitstream.  LS bit first.  */static ULONGESTjp1_read_stream (stream, len, set_last_bit)       unsigned long stream;  int len;  int set_last_bit;{  int i;  ULONGEST data;  debug("\nread(");  if (len <= 0) return;   data = 0;  for (i = 0; i < len - 1; i++)    {            jp1_write_JTAG (stream & 1);   /* LSB first */      stream >>= 1;      data |= jp1_read_JTAG () << i; /* LSB first */    }    if (set_last_bit)    jp1_write_JTAG (stream & 1 | TMS);  else    jp1_write_JTAG (stream & 1);  data |= jp1_read_JTAG () << (len - 1);  debug(")\n");  return data;}/* Goes into SELECT_IR state. Should be called before every control write.  */static voidjp1_prepare_control (){  if (!select_dr)    jp1_write_JTAG (TMS); /* SELECT_DR SCAN */  jp1_write_JTAG (TMS);   /* SELECT_IR SCAN */  select_dr = 0;}/* Resets JTAG.   Writes TRST=0   and    TRST=1 */static voidjp1_reset_JTAG (){  int i;  debug2 ("\nreset(");  jp_out (0);  JTAG_RETRY_WAIT();  /* In case we don't have TRST reset it manually */  for (i = 0; i < 8; i++)    jp1_write_JTAG (TMS);  jp_out (TRST_BIT);  JTAG_RETRY_WAIT();  jp1_write_JTAG (0);  debug2(")\n");  select_dr = 0;}/* Sets register/memory regno to data.  *//* CZ 08/06/01: I am not sure how error checking is intended to   be implemented here. It appears that no indication is returned   to the caller as you have in standard unix system calls. Therefore,   I guess the only way to use these functions when you want to know   the exact position of the error is to manually clear err, call the   function, and then manually check err. I have also made some changes   where necessary because no value was returned at all int jtag_read_reg.*/static voidjtag_write_reg_support (regno, data)  int regno;  ULONGEST data;{  int crc_read, crc_write, crc_ok, retry;  int result;  int tmp;  debug("\n");  debug2("write_reg %i(%08x) <- %08x \n", regno, regno, data);  if (!select_dr)    jp1_write_JTAG (TMS); /* SELECT_DR SCAN */  select_dr = 1;      /* If we don't have rw bit, we assume chain   is read only. */  if (!chain_has_rw[current_chain])    error ("Internal: Chain not writable.");  for (retry = 0; retry < NUM_RETRIES; retry++) {    jp1_write_JTAG (0); /* CAPTURE_DR */    jp1_write_JTAG (0); /* SHIFT_DR */    crc_w = 0;    /* write addr */    jp1_write_stream (regno, chain_addr_size[current_chain], 0);    /* write (R/W=1) - we tested that previously. */    jp1_write_JTAG (TDI);        if (chain_has_crc[current_chain])      {        /* write data */        jp1_write_stream (data, chain_data_size[current_chain], 0);         crc_write = crc_w;        /* write CRC, EXIT1_DR */        crc_read = jp1_read_stream (crc_write, CRC_SIZE + 1, 1) >> 1;      }    else      {        /* write data */        jp1_write_stream (data, chain_data_size[current_chain], 1);      }    jp1_write_JTAG (TMS); /* UPDATE_DR */    jp1_write_JTAG (TMS); /* SELECT_DR */        /* Did JTAG receive packet correctly? */    if (chain_has_crc[current_chain])      crc_ok = crc_read == crc_write;    if (chain_has_crc[current_chain])      {        if (crc_ok)          return;        debug2(", crc failed. read %08x, generated %08x\n", crc_read, crc_write);        jp1_reset_JTAG();        jp1_write_JTAG (TMS); /* SELECT_DR SCAN */        select_dr = 1;        tmp = current_chain;        current_chain = -1;        jtag_set_chain(tmp);      }    else      return;  }  printf ("Invalid CRC\n");  err = ERR_CRC;}/* Reads register/memory from regno.     Reading is a bit strange. Data is not available   at the time we pass an address, but in successive   read instead. Call jtag_read_reg twice to get correct   data. */static ULONGESTjtag_read_reg (regno)  unsigned int regno;{  ULONGEST data;  int crc_read, crc_write, crc_actual_read,  retry, crc_ok;  int result;  int tmp;  debug("\n");  debug2("read_reg %i(%08x)", regno, regno);  debug (" \n ");  if (!select_dr)    jp1_write_JTAG (TMS); /* SELECT_DR SCAN */  select_dr = 1;  for (retry = 0; retry < NUM_RETRIES; retry++) {          jp1_write_JTAG (0); /* CAPTURE_DR */    jp1_write_JTAG (0); /* SHIFT_DR */    crc_w = 0;    /* write addr */    jp1_write_stream (regno, chain_addr_size[current_chain], 0);      /* read (R/W=0) */    if (chain_has_rw[current_chain])      jp1_write_JTAG (0);    if (chain_has_crc[current_chain])      {        crc_r = 0;        /* data = 0 */        data = jp1_read_stream (0, chain_data_size[current_chain], 0);        crc_write = crc_w;        crc_actual_read = crc_r;        /* Send my crc, EXIT1_DR */        crc_read = jp1_read_stream (crc_write, CRC_SIZE + 1, 1) >> 1;      } else {        /* data = 0 */        data = jp1_read_stream (0, chain_data_size[current_chain], 1);      }    jp1_write_JTAG (TMS); /* UPDATE_DR */    jp1_write_JTAG (TMS); /* SELECT_DR */    /* Did JTAG receive packet correctly? */    if (chain_has_crc[current_chain])      crc_ok = jp1_read_JTAG ();              if (chain_has_crc[current_chain])      {        if ((crc_read == crc_actual_read) && (crc_ok)) {          debug2(" , read_reg %i(%08x) = %08x\n", regno, regno, data);          prev_regno = regno;          return data;        }        debug2(", crc failed. read %08x, generated %08x\n", crc_read, crc_actual_read);        jp1_reset_JTAG();        jp1_write_JTAG (TMS); /* SELECT_DR SCAN */        select_dr = 1;        tmp = current_chain;        current_chain = -1;        jtag_set_chain(tmp);        jtag_read_reg (prev_regno);        if (err) return -1;      }    else {      debug2(" , read_reg %i(%08x) = %08x\n", regno, regno, data);      prev_regno = regno;      return data;    }  }  printf ("Invalid CRC\n");  err = ERR_CRC;  return -1;}/* Sets scan chain.  */static voidjtag_set_chain (chain)  int chain;{  int crc_read, crc_write, crc_ok, retry;  int result;  debug("\n");  debug2("set_chain %i\n", chain);  if (current_chain != chain) {    if (!chain_is_valid[chain])      error ("Chain not valid.");    current_chain = chain;    jp1_prepare_control ();         while (1) {      jp1_write_JTAG (0); /* CAPTURE_IR */      jp1_write_JTAG (0); /* SHIFT_IR */                  /* write data, EXIT1_IR */      jp1_write_stream (JI_CHAIN_SELECT, JI_SIZE, 1);      jp1_write_JTAG (TMS); /* UPDATE_IR */      jp1_write_JTAG (TMS); /* SELECT_DR */                jp1_write_JTAG (0); /* CAPTURE_DR */      jp1_write_JTAG (0); /* SHIFT_DR */      if (chain_has_crc[current_chain])        {                   crc_w = 0;          /* write data */          jp1_write_stream (chain, SC_SIZE, 0);                    crc_write = crc_w;          /* write CRC, EXIT1_DR */                 crc_read = jp1_read_stream (crc_write, CRC_SIZE + 1, 1) >> 1;        } else {          /* write data, EXIT1_DR */          jp1_write_stream (chain, SC_SIZE, 1);        }      jp1_write_JTAG (TMS); /* UPDATE_DR */      jp1_write_JTAG (TMS); /* SELECT_DR */            /* Did JTAG receive packet correctly? */      if (chain_has_crc[current_chain])        crc_ok = crc_read == crc_write;            if (chain_has_crc[current_chain])        {          if (!crc_ok)            {              debug2(", crc failed.\n");              jp1_reset_JTAG();              jp1_prepare_control ();              continue;            }        }         jp1_write_JTAG (TMS); /* SELECT_IR */      jp1_write_JTAG (0); /* CAPTURE_IR */      jp1_write_JTAG (0); /* SHIFT_IR */      crc_w = 0;          /* write data, EXIT1_IR */      jp1_write_stream (JI_DEBUG, JI_SIZE, 1);      jp1_write_JTAG (TMS); /* UPDATE_IR */      jp1_write_JTAG (TMS); /* SELECT_DR */      select_dr = 1;          return;    }    printf ("Invalid CRC\n");    err = ERR_CRC;  } else    debug2 ("Already set.\n");}/* Sets register/memory regno to data.  */static voidjtag_write_reg (regno, data)  int regno;  ULONGEST data;{  /* Set PC *///  if (current_chain == SC_RISC_DEBUG && regno == 0x10)//    data = data - 4;  jtag_write_reg_support (regno, data);}/* Stalls the CPU.  */static voidor1k_stall (){  int val;  jtag_set_chain (SC_REGISTER);    val = jtag_read_reg (JTAG_RISCOP);  jtag_write_reg (JTAG_RISCOP, val | 1);}/* Unstalls the CPU.  */static voidor1k_unstall (){  unsigned int val;  jtag_set_chain (SC_REGISTER);  val = jtag_read_reg (JTAG_RISCOP);  jtag_write_reg (JTAG_RISCOP, val & ~1);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日日摸夜夜添夜夜添精品视频| 麻豆精品在线播放| 亚洲欧洲日韩在线| 国产精品污网站| 国产性色一区二区| 欧美激情一区二区三区在线| 国产丝袜美腿一区二区三区| 欧美国产精品一区二区三区| 国产精品国产三级国产a| 欧美国产激情一区二区三区蜜月| 91色porny在线视频| 成人免费高清在线观看| 国产性做久久久久久| 欧美日韩日日夜夜| 成人动漫一区二区三区| 顶级嫩模精品视频在线看| 风间由美一区二区av101| 成人国产精品免费观看动漫| 成人国产免费视频| 91成人在线精品| 欧美日韩高清影院| 亚洲精品一区二区三区四区高清 | 欧美xxxxx牲另类人与| 精品福利在线导航| 国产色综合一区| ...xxx性欧美| 亚洲3atv精品一区二区三区| 麻豆一区二区99久久久久| 国产精品亚洲午夜一区二区三区| 成人黄色大片在线观看| 色哟哟日韩精品| 欧美一区二区三区视频免费播放 | 亚洲一二三专区| 日本v片在线高清不卡在线观看| 久久国产日韩欧美精品| 成人午夜视频在线观看| 在线亚洲+欧美+日本专区| 日韩欧美亚洲国产精品字幕久久久 | 一本在线高清不卡dvd| 欧美日韩久久一区二区| 久久只精品国产| 中文字幕一区日韩精品欧美| 亚洲图片欧美色图| 国产成人自拍在线| 欧美丝袜丝交足nylons| 精品av久久707| 一区二区三区精品视频| 精品一区二区三区在线观看国产| 99久久精品免费看| 欧美岛国在线观看| 亚洲男帅同性gay1069| 毛片av一区二区| 99久久99精品久久久久久| 3d动漫精品啪啪| 亚洲女子a中天字幕| 精品亚洲aⅴ乱码一区二区三区| 91小视频免费看| 日韩精品一区在线观看| 亚洲国产美女搞黄色| 国产成人8x视频一区二区| 91精品欧美综合在线观看最新| 中文字幕的久久| 久久国产精品无码网站| 欧美自拍偷拍一区| 国产精品久久久久精k8| 国产一区二区三区最好精华液| 欧美日韩一区二区三区四区| 中文字幕一区二区日韩精品绯色| 经典三级视频一区| 欧美精品久久久久久久久老牛影院| 中文字幕一区不卡| 国产凹凸在线观看一区二区| 日韩欧美一二三四区| 亚洲午夜精品在线| 91麻豆精品视频| 国产精品午夜春色av| 国产精品自拍一区| 欧美一卡2卡3卡4卡| 五月天激情综合| 欧美亚洲一区二区三区四区| 日韩伦理av电影| 粉嫩欧美一区二区三区高清影视| 日韩免费电影一区| 免费高清不卡av| 欧美一级二级三级蜜桃| 午夜久久久影院| 欧美日韩国产天堂| 亚洲综合色婷婷| 91福利视频在线| 一区二区不卡在线视频 午夜欧美不卡在 | 亚洲国产欧美日韩另类综合| 色综合色综合色综合| 中文字幕一区二区三区四区| 国产大陆精品国产| 国产亚洲成av人在线观看导航| 国产一区在线不卡| 久久蜜桃一区二区| 国产精品91xxx| 国产色婷婷亚洲99精品小说| 欧美日韩久久久久久| 国产一区不卡精品| 色999日韩国产欧美一区二区| 国产精品天干天干在线综合| 国产99久久久久| 国产精品萝li| 一本一道久久a久久精品| 亚洲女同女同女同女同女同69| 91网址在线看| 一区二区成人在线| 7777精品伊人久久久大香线蕉完整版 | 久久精品99国产精品| 日韩一区二区精品| 久久精品99久久久| 国产农村妇女毛片精品久久麻豆| 国产精品系列在线观看| 国产精品毛片无遮挡高清| 成人白浆超碰人人人人| 日韩美女精品在线| 欧美亚洲高清一区| 男人操女人的视频在线观看欧美| 日韩精品综合一本久道在线视频| 麻豆精品视频在线观看| 国产亚洲欧洲997久久综合| 一本到一区二区三区| 日韩一区二区在线免费观看| 亚洲美女精品一区| 欧美日韩不卡视频| 精品综合久久久久久8888| 久久久综合视频| 成人精品视频一区二区三区 | 亚洲午夜精品久久久久久久久| 欧美日韩国产综合久久| 久久国产精品露脸对白| 国产精品乱码妇女bbbb| 欧美色老头old∨ideo| 久久国产精品99精品国产| 欧美国产欧美综合| 欧美日韩免费一区二区三区视频 | 7777女厕盗摄久久久| 国模少妇一区二区三区| 亚洲婷婷国产精品电影人久久| 欧美午夜片在线观看| 国产一区久久久| 亚洲麻豆国产自偷在线| 日韩欧美www| 91网站在线播放| 美腿丝袜亚洲综合| 亚洲欧美日韩国产综合| 欧美一区二区三区免费大片| 成人激情文学综合网| 日韩高清在线电影| 国产精品你懂的| 91精品国模一区二区三区| 成人美女在线视频| 蜜臀a∨国产成人精品| 亚洲欧美在线视频| 日韩视频永久免费| 日本福利一区二区| 激情六月婷婷综合| 亚洲高清在线精品| 中文字幕一区二区不卡| 精品国产乱码久久久久久蜜臀 | 亚洲欧洲国产日韩| 欧美mv日韩mv亚洲| 欧美专区日韩专区| 成人白浆超碰人人人人| 美女视频一区在线观看| 亚洲欧美日韩一区| 国产午夜精品在线观看| 欧美一级在线免费| 欧洲另类一二三四区| 成人动漫av在线| 久久99精品久久久久| 午夜伦理一区二区| 亚洲精品久久久蜜桃| 国产精品午夜在线观看| 精品播放一区二区| 日韩一区二区在线观看视频| 在线一区二区三区四区五区| 成人一级视频在线观看| 捆绑调教美女网站视频一区| 午夜一区二区三区在线观看| 中文字幕一区二区三区视频| 国产清纯美女被跳蛋高潮一区二区久久w | 国产精品99久久久久久久女警| 偷窥少妇高潮呻吟av久久免费| 亚洲日本韩国一区| 国产精品每日更新| 国产肉丝袜一区二区| 精品国产91久久久久久久妲己 | 中文字幕一区二区三中文字幕| 国产日韩欧美一区二区三区乱码| 欧美videos中文字幕| 欧美成va人片在线观看| 4438x亚洲最大成人网| 欧美日韩精品一区二区三区 | 在线精品视频小说1| 91视频精品在这里| 91美女在线看| 色视频欧美一区二区三区|