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

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

?? jp1.c

?? 嵌入式開發板連接程序源碼
?? 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);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩久久久| 风间由美一区二区av101 | 日韩精品一区二区三区四区| 五月天丁香久久| 日韩免费高清av| 国产老妇另类xxxxx| 日本一区二区不卡视频| 成人白浆超碰人人人人| 亚洲自拍都市欧美小说| 日韩一区二区三区电影在线观看| 国产综合色精品一区二区三区| 国产精品久久久久久久久免费樱桃| 91一区一区三区| 日韩成人av影视| 欧美国产一区二区在线观看| 欧美中文字幕久久| 激情深爱一区二区| 日韩美女啊v在线免费观看| 欧美日韩国产综合一区二区| 极品美女销魂一区二区三区免费| 亚洲国产成人一区二区三区| 欧美亚洲一区二区在线| 国产一区二区三区免费观看| 亚洲男人的天堂av| 精品捆绑美女sm三区| eeuss鲁一区二区三区| 午夜欧美视频在线观看| 欧美极品少妇xxxxⅹ高跟鞋 | 欧美性大战xxxxx久久久| 久久69国产一区二区蜜臀| 国产精品伦一区二区三级视频| 欧美久久久久久蜜桃| 成人v精品蜜桃久久一区| 日韩精品一二三四| 一色屋精品亚洲香蕉网站| 日韩一区二区三区四区五区六区| 91丨porny丨首页| 国产九色精品成人porny| 亚洲午夜一区二区| 国产视频一区不卡| 日韩视频在线你懂得| 日本高清成人免费播放| 国产成人精品aa毛片| 美腿丝袜亚洲色图| 亚洲国产sm捆绑调教视频| 国产区在线观看成人精品| 欧美高清精品3d| 欧美性淫爽ww久久久久无| 成人中文字幕合集| 精久久久久久久久久久| 亚洲午夜激情网站| 亚洲欧美偷拍卡通变态| 国产性色一区二区| 精品国精品自拍自在线| 欧美日本国产视频| 在线观看亚洲一区| 色8久久精品久久久久久蜜| 成人免费黄色大片| 国产一区高清在线| 久99久精品视频免费观看| 午夜久久久久久| 亚洲电影一级黄| 亚洲精品免费在线播放| 亚洲日本青草视频在线怡红院| 国产婷婷精品av在线| 国产日韩v精品一区二区| 26uuu欧美| 久久天天做天天爱综合色| 日韩免费性生活视频播放| 欧美一区二区日韩| 91精品国产欧美日韩| 91精品国产色综合久久| 欧美一区二区三区的| 欧美变态tickling挠脚心| 日韩一二三区不卡| 精品国产乱码久久久久久牛牛| 精品日韩成人av| 久久久久久97三级| 国产精品女主播av| 最新欧美精品一区二区三区| 中文字幕在线播放不卡一区| 亚洲色图视频免费播放| 亚洲综合色视频| 午夜成人免费电影| 免费人成在线不卡| 久久99九九99精品| 懂色av中文字幕一区二区三区| 成人高清av在线| 在线这里只有精品| 欧美一区二区高清| 久久九九久久九九| 最新高清无码专区| 亚洲v精品v日韩v欧美v专区| 蜜桃视频一区二区三区在线观看| 精品中文字幕一区二区| 成人天堂资源www在线| 波多野结衣一区二区三区| 日本精品视频一区二区| 欧美一区二区在线看| 久久这里只有精品首页| 亚洲人成影院在线观看| 天天操天天干天天综合网| 日本va欧美va精品发布| 美日韩一区二区三区| 国产麻豆精品久久一二三| 99综合电影在线视频| 欧美精选在线播放| 国产欧美精品区一区二区三区| 亚洲欧美成aⅴ人在线观看| 日韩国产在线观看一区| 国产精品一级片| 欧美在线综合视频| 久久精品这里都是精品| 亚洲一区二区三区四区在线观看 | 美女脱光内衣内裤视频久久网站 | 日本在线不卡视频| 成人丝袜高跟foot| 88在线观看91蜜桃国自产| 久久一区二区三区国产精品| 亚洲免费观看在线观看| 美脚の诱脚舐め脚责91| 91网站在线播放| 欧美一二三区在线观看| 亚洲免费高清视频在线| 国产九九视频一区二区三区| 欧美性猛交xxxxxxxx| 久久久www免费人成精品| 亚洲国产成人va在线观看天堂| 粉嫩高潮美女一区二区三区 | 日韩欧美在线影院| 亚洲欧美日韩国产成人精品影院| 久久99国产乱子伦精品免费| 欧美综合天天夜夜久久| 日本一区二区三区dvd视频在线| 日韩中文字幕亚洲一区二区va在线| 成人性生交大片免费看中文网站| 欧美一区二区三区免费在线看 | 欧美一级免费大片| 最新不卡av在线| 岛国av在线一区| 欧美不卡一区二区| 日本特黄久久久高潮| 色哟哟精品一区| 国产精品久久久久久久久快鸭 | 一区二区三区在线视频免费观看| 精品一区精品二区高清| 欧美精品色综合| 一区二区三区日韩精品| 国产成人在线网站| 欧美zozo另类异族| 日韩av在线发布| 欧美群妇大交群中文字幕| 亚洲伦在线观看| 99精品热视频| 国产精品久久久久久久久搜平片| 国产精品资源在线观看| 精品国产亚洲在线| 日韩avvvv在线播放| 欧美日韩激情一区二区三区| 亚洲一级不卡视频| 色噜噜偷拍精品综合在线| 国产精品免费丝袜| av不卡一区二区三区| 中文字幕国产一区二区| 国产精品一区2区| 久久精品一区二区三区不卡牛牛| 国内一区二区在线| 精品日韩av一区二区| 国产一区视频在线看| 2022国产精品视频| 国产精品资源在线观看| 国产蜜臀av在线一区二区三区| 高清不卡一二三区| 国产精品国模大尺度视频| 成人国产在线观看| 国产精品乱人伦| 91麻豆精品在线观看| 一区二区三区四区在线播放| 欧美日韩一区国产| 免费国产亚洲视频| 精品国产髙清在线看国产毛片| 激情小说亚洲一区| 最新久久zyz资源站| 欧美亚洲动漫另类| 日韩av电影天堂| 久久综合色一综合色88| 成人精品小蝌蚪| 一区二区三区.www| 69堂国产成人免费视频| 激情欧美日韩一区二区| 国产日韩欧美一区二区三区综合| av在线一区二区| 秋霞电影网一区二区| 久久久久久久久久久久电影| 99国产精品久久久久| 香蕉久久夜色精品国产使用方法| ww久久中文字幕| 欧美中文字幕一区| 久久国产精品99久久久久久老狼| 欧美国产日本视频|