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

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

?? jp-io.c

?? 嵌入式開發板連接程序源碼
?? C
字號:
/* jp-io.c -- Low level JTAG communications   Copyright (C) 2001 Marko Mlinar, markom@opencores.org   Copyright (C) 2004 Gy鰎gy Jeney, nog@sdf.lonestar.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. *//* This handles all the low-level io with the selected cable */#include <stdio.h>#include <stdint.h>#include <string.h>#include <sys/io.h>#include <sys/types.h>#include <unistd.h>#include <errno.h>#include <stdlib.h>#include <sys/socket.h>#include <sys/un.h>#include "jp.h"static int jp_parallel_init();static void jp_parallel_out(uint8_t value);static uint8_t jp_parallel_in();static int jp_parallel_opt(int c, char *str);static void jp_phys_wait();static int jp_rtl_sim_init();static void jp_rtl_sim_out(uint8_t value);static uint8_t jp_rtl_sim_in();static void jp_rtl_sim_wait();static int jp_rtl_sim_opt(int c, char *str);static int jp_vpi_init();static void jp_vpi_out(uint8_t value);static uint8_t jp_vpi_in();static void jp_vpi_wait();static int jp_vpi_opt(int c, char *str);static uint8_t jp_xpc3_in();static void jp_xpc3_out(uint8_t value);static uint8_t jp_xess_in();static void jp_xess_out(uint8_t value);static struct jtag_cable {  const char *name;  uint8_t (*in_func)();  void (*out_func)(uint8_t);  int (*init_func)();  void (*wait_func)();  int (*opt_func)(int c, char *str);  const char *opts;  const char *help;} jtag_cables[] = {  { "rtl_sim", jp_rtl_sim_in, jp_rtl_sim_out, jp_rtl_sim_init, jp_rtl_sim_wait,    jp_rtl_sim_opt, "d:",    "-d [directory] Directory in which gdb_in.dat/gdb_out.dat may be found\n" },  { "vpi", jp_vpi_in, jp_vpi_out, jp_vpi_init, jp_vpi_wait, jp_vpi_opt, "s:",    "-s [socket] Location of socket that the vpi module created\n" },  { "xpc3", jp_xpc3_in, jp_xpc3_out, jp_parallel_init, jp_phys_wait,    jp_parallel_opt, "p:",    "-p [port] Which port to use when communicateing with the parport hardware (eg. 0x378)\n" },  { "xess", jp_xess_in, jp_xess_out, jp_parallel_init, jp_phys_wait,    jp_parallel_opt, "p:",    "-p [port] Which port to use when communicateing with the parport hardware (eg. 0x378)\n" },  { NULL, NULL, NULL, NULL } };static struct jtag_cable *jtag_cable_in_use = NULL; /* The current selected cable *//* Only used for the parport */static int base = 0x378;/* Only used in the vpi */static int vpi_comm;static char *sock_loc = "/tmp/jp-vpi";/* Only used for the rtl_sim */static char *gdb_in = "gdb_in.dat";static char *gdb_out = "gdb_out.dat";void jp_out (uint8_t value){  /* finally call the cable-specific out-function */  jtag_cable_in_use->out_func(value);  if(!(value & 1))    debug("[%x%c]", (value & TDI_BIT) != 0, (value & TMS_BIT) ? '^' : '_');  flush_debug();}/* Receive a byte from the board.  */uint8_t jp_in(){  int data;  /* Get the data from the board */  data = jtag_cable_in_use->in_func();  debug(" R%01X ", data);  flush_debug();  return data;}/* waits */void jp_wait(){  jtag_cable_in_use->wait_func();}/* Selects a cable for use, returns non-null on success */int jp_select_cable(const char *cable){  int i;  for(i = 0; jtag_cables[i].name; i++) {    if(!strcmp(cable, jtag_cables[i].name)) {      jtag_cable_in_use = &jtag_cables[i];      return 1;    }  }  return 0;}/* Calls the init-fucntion of the cable */int jp_init_cable(){  return jtag_cable_in_use->init_func();}/* Parses command-line options specific to the selected cable */int jp_cable_opt(int c, char *str){  return jtag_cable_in_use->opt_func(c, str);}const char *jp_get_cable_args(){  return jtag_cable_in_use->opts;}/* Prints a (short) useage message for each availible cable */void jp_print_cable_help(){  int i;  printf("Availible cables: ");  for(i = 0; jtag_cables[i].name; i++) {    if(i)      printf(", ");    printf(jtag_cables[i].name);  }  printf("\n\nOptions availible for the cables:\n");  for(i = 0; jtag_cables[i].name; i++) {    if(!jtag_cables[i].help)      continue;    printf("  %s:\n    %s", jtag_cables[i].name, jtag_cables[i].help);  }}/*-------------------------------------[ Parallel port specific functions ]---*/static int jp_parallel_init(){  if (ioperm(base, 3, 1)) {    fprintf(stderr, "Couldn't get the port at %x\n", base);    perror("Root privileges are required.\n");    return 0;  }  printf("Connected to parallel port at %x\n", base);  printf("Dropping root privileges.\n");  setreuid(getuid(), getuid());  return 1;}static void jp_parallel_out(uint8_t value){  outb(value, LPT_WRITE);}static uint8_t jp_parallel_in(){  return inb(LPT_READ);}static int jp_parallel_opt(int c, char *str){  switch(c) {  case 'p':    if(!sscanf(str, "%x", &base)) {      fprintf(stderr, "p parameter must have a hex number as parameter\n");      return 0;    }    break;  default:    fprintf(stderr, "Unknown parameter '%c'\n", c);    return 0;  }  return 1;}/*-----------------------------------------[ Physical board wait function ]---*/static void jp_phys_wait(){  /* FIXME: this needs some real TLC */  int i;  volatile int j;  for(i = 0; i < 1000; i++)    j = i;}/*----------------------------------------------[ xpc3 specific functions ]---*/static void jp_xpc3_out(uint8_t value){  uint8_t out = 0;  /* First convert the bits in value byte to the ones that the cable wants */  if(value & TCLK_BIT)    out |= 0x02; /* D1 pin 3 */  if(value & TRST_BIT)    out |= 0x10; /* Not used */  if(value & TDI_BIT)    out |= 0x01; /* D0 pin 2 */  if(value & TMS_BIT)    out |= 0x04; /* D2 pin 4 */  jp_parallel_out(out);}static uint8_t jp_xpc3_in(){  uint8_t in;  in = jp_parallel_in();  if(in & 0x10) /* S6 pin 13 */    return 1;  return 0;}/*----------------------------------------------[ xess specific functions ]---*/static void jp_xess_out(uint8_t value){  uint8_t out = 0;  /* First convert the bits in value byte to the ones that the cable wants */  if(value & TCLK_BIT)    out |= 0x04; /* D2 pin 4 */  if(value & TRST_BIT)    out |= 0x08; /* D3 pin 5 */  if(value & TDI_BIT)    out |= 0x10; /* D4 pin 6 */  if(value & TMS_BIT)    out |= 0x20; /* D3 pin 5 */  jp_parallel_out(out);}static uint8_t jp_xess_in(){  uint8_t in;  in = jp_parallel_in();  if(in & 0x20) /* S5 pin 12*/    return 1;  return 0;}/*-------------------------------------------[ rtl_sim specific functions ]---*/static int jp_rtl_sim_init(){  FILE *fin = fopen (gdb_in, "wt+");  if(!fin) {    fprintf(stderr, "Can not open %s\n", gdb_in);    return 0;  }  fclose(fin);  return 1;}static void jp_rtl_sim_out(uint8_t value){  FILE *fout;  int num_read;  int r;  fout = fopen(gdb_in, "wt+");  fprintf(fout, "F\n");  fclose(fout);  fout = fopen(gdb_out, "wt+");  fprintf(fout, "%02X\n", value);  fclose(fout);  do {    fout = fopen(gdb_out, "rt");    r = fscanf(fout,"%x", &num_read);    fclose(fout);  } while(!r || (num_read != (0x10 | value)));}static uint8_t jp_rtl_sim_in(){  FILE *fin = 0;  char ch;  uint8_t data;  while(1) {    fin = fopen(gdb_in, "rt");    if(!fin)      continue;    ch = fgetc(fin);    fclose(fin);    if((ch != '0') && (ch != '1'))      continue;    else      break;  }  data = ch == '1' ? 1 : 0;  return data;}static void jp_rtl_sim_wait(){  usleep(1000);}static int jp_rtl_sim_opt(int c, char *str){  switch(c) {  case 'd':    if(!(gdb_in = malloc(strlen(str) + 12))) { /* 12 == strlen("gdb_in.dat") + 2 */      fprintf(stderr, "Unable to allocate enough memory\n");      return 0;    }    if(!(gdb_out = malloc(strlen(str) + 13))) { /* 13 == strlen("gdb_out.dat") + 2 */      fprintf(stderr, "Unable to allocate enough memory\n");      free(gdb_in);      return 0;    }    sprintf(gdb_in, "%s/gdb_in.dat", str);    sprintf(gdb_out, "%s/gdb_out.dat", str);    break;  default:    fprintf(stderr, "Unknown parameter '%c'\n", c);    return 0;  }  return 1;}/*-----------------------------------------------[ VPI specific functions ]---*/static int jp_vpi_init(){  struct sockaddr_un addr;  if((vpi_comm = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {    fprintf(stderr, "Unable to create socket (%s)\n", strerror(errno));    return 0;  }  addr.sun_family = AF_UNIX;  strcpy(addr.sun_path, sock_loc);  if(connect(vpi_comm, (struct sockaddr *)&addr, sizeof(addr)) == -1) {    fprintf(stderr, "Unable to connect to %s (%s)\n", addr.sun_path,            strerror(errno));    return 0;  }  return 1;}static void jp_vpi_out(uint8_t value){  uint8_t ack;  /* Send the data to the socket */  write(vpi_comm, &value, 1);  do {    /* Ok, read the data */    read(vpi_comm, &ack, 1);  } while(ack != (value | 0x10));}static uint8_t jp_vpi_in(){  uint8_t dat;  /* ask vpi to send us the out-bit */  dat = 0x80;  write(vpi_comm, &dat, 1);  /* Wait and read the data */  read(vpi_comm, &dat, 1);  if(dat > 1)    fprintf(stderr, "Unexpected value: %i\n", dat);  return dat;}static void jp_vpi_wait(){  uint8_t dat = 0x81;  /* Get the sim to reply when the timeout has been reached */  write(vpi_comm, &dat, 1);  /* block, waiting for the data */  read(vpi_comm, &dat, 1);}static int jp_vpi_opt(int c, char *str){  switch(c) {  case 's':    if(!(sock_loc = strdup(str))) {      fprintf(stderr, "Unable to allocate memory\n");      return 0;    }    break;  default:    fprintf(stderr, "Unknown parameter '%c'\n", c);    return 0;  }  return 1;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美日韩黄色大片| 午夜精品久久久久久久99水蜜桃| 91.com在线观看| 欧美色网站导航| 91久久精品国产91性色tv| av中文一区二区三区| 丰满放荡岳乱妇91ww| 盗摄精品av一区二区三区| 国产成人免费9x9x人网站视频| 国模少妇一区二区三区| 九九视频精品免费| 狠狠网亚洲精品| 国产精品正在播放| 国产99久久久国产精品潘金网站| 国产高清在线精品| 成人av在线网| 日本精品视频一区二区| 欧美无砖砖区免费| 欧美一区二区三区男人的天堂| 这里只有精品99re| 精品久久久久久久久久久久包黑料| 日韩欧美一级精品久久| 日韩精品中文字幕一区| 久久亚洲一区二区三区四区| 国产嫩草影院久久久久| 国产精品久久久久久久久免费丝袜 | 亚洲444eee在线观看| 亚洲va欧美va人人爽| 日韩—二三区免费观看av| 乱一区二区av| 高潮精品一区videoshd| www.亚洲国产| 欧美四级电影网| 日韩欧美高清dvd碟片| 久久久亚洲欧洲日产国码αv| 欧美国产日本视频| 亚洲精品日韩专区silk| 日本不卡一二三| 粉嫩久久99精品久久久久久夜| 色偷偷久久一区二区三区| 欧美精品精品一区| 久久久噜噜噜久久人人看| 亚洲视频一二区| 日韩激情av在线| 国产福利一区在线| 欧洲一区在线电影| 精品伦理精品一区| 亚洲女同女同女同女同女同69| 视频一区二区欧美| 国产成人精品亚洲777人妖| 色菇凉天天综合网| 精品播放一区二区| 一区二区三区丝袜| 寂寞少妇一区二区三区| 91麻豆视频网站| 精品国产一区二区三区四区四 | 蜜臀av性久久久久蜜臀aⅴ| 国产sm精品调教视频网站| 欧美日韩国产综合视频在线观看| 26uuu亚洲综合色| 艳妇臀荡乳欲伦亚洲一区| 久草这里只有精品视频| 色香蕉成人二区免费| 精品国产乱码久久久久久老虎| 亚洲免费视频中文字幕| 国产一区美女在线| 欧美日韩黄视频| 亚洲三级在线看| 精品一二线国产| 欧美日韩精品是欧美日韩精品| 国产精品欧美久久久久一区二区| 日韩二区三区四区| 日本韩国欧美国产| 国产精品色婷婷| 美女看a上一区| 欧美性受xxxx黑人xyx性爽| 欧美激情一区二区| 美女免费视频一区二区| 欧美日韩精品二区第二页| 亚洲欧美一区二区不卡| 国产剧情一区在线| 日韩视频在线一区二区| 一区二区三区av电影| 成人午夜视频免费看| 2021国产精品久久精品| 日韩av高清在线观看| 欧美性猛片xxxx免费看久爱| 国产精品家庭影院| 国产成人免费高清| 久久久国产精品麻豆| 精品在线亚洲视频| 欧美一级免费观看| 亚洲不卡在线观看| 欧美在线播放高清精品| 亚洲女人的天堂| 99久久综合99久久综合网站| 国产调教视频一区| 国产精品资源在线看| 2020国产精品久久精品美国| 久久99蜜桃精品| 欧美一区二区三区四区久久| 亚洲一区二区视频在线| 欧美综合在线视频| 洋洋成人永久网站入口| 欧美视频中文一区二区三区在线观看| 亚洲你懂的在线视频| 色综合久久六月婷婷中文字幕| 国产精品久久久一本精品 | 国产精品中文有码| 久久久99精品免费观看| 国产乱码精品一区二区三区五月婷| 日韩精品一区二区三区视频播放| 日韩福利电影在线| 欧美成人一区二区三区片免费| 欧美一区二区三级| 亚洲二区在线观看| 蜜臀精品久久久久久蜜臀| 成人精品一区二区三区四区| 国产偷国产偷亚洲高清人白洁 | 国产99久久久国产精品潘金网站| 国产三级一区二区| 99精品热视频| 亚洲免费观看在线视频| 欧美专区在线观看一区| 午夜精品国产更新| 精品乱码亚洲一区二区不卡| 国产精品一区二区91| 国产精品传媒视频| 欧美视频中文字幕| 麻豆极品一区二区三区| 国产视频一区二区在线| 91色综合久久久久婷婷| 亚洲成人精品一区二区| 欧美第一区第二区| 波多野结衣中文字幕一区| 一区二区三区四区激情| 91麻豆精品久久久久蜜臀| 精品影视av免费| 国产精品国产三级国产| 欧美日韩在线一区二区| 卡一卡二国产精品| 国产精品久久久久久久久晋中| 欧洲生活片亚洲生活在线观看| 欧美一区二区福利在线| 欧美mv日韩mv亚洲| 日韩亚洲欧美高清| 亚洲三级电影全部在线观看高清| 久久99精品久久只有精品| 国产三级三级三级精品8ⅰ区| 99国产一区二区三精品乱码| 图片区日韩欧美亚洲| 久久综合色8888| 在线观看av不卡| 精品一区二区三区的国产在线播放| 国产精品久久久一区麻豆最新章节| 欧美人伦禁忌dvd放荡欲情| 丰满岳乱妇一区二区三区| 亚洲成人av一区| 中文字幕欧美激情一区| 欧美久久免费观看| 国产不卡视频在线观看| 午夜成人免费电影| 国产视频911| 欧美久久久久中文字幕| av不卡免费电影| 久久99深爱久久99精品| 亚洲欧美电影院| 久久这里只有精品6| 欧美日韩一区二区三区在线看| 国产在线视频不卡二| 亚洲国产精品久久人人爱蜜臀| 国产欧美一区二区精品性色超碰| 欧美日韩国产一区| 91亚洲精品久久久蜜桃| 国产一区二区三区久久悠悠色av| 亚洲高清免费观看高清完整版在线观看 | 亚洲精品国产第一综合99久久| 欧美一区二区三区免费大片| 99精品欧美一区二区三区小说| 精品一区二区在线看| 亚洲一区二区三区三| 国产精品久久网站| 精品国产一区二区精华| 欧美伊人久久大香线蕉综合69| 成人自拍视频在线观看| 激情文学综合丁香| 日韩精品一级中文字幕精品视频免费观看| 国产精品久久久久三级| 久久影院视频免费| 欧美一二三在线| 欧美日韩日日骚| 色欧美88888久久久久久影院| 成人午夜av在线| 久草精品在线观看| 青青草国产精品97视觉盛宴| 亚洲综合偷拍欧美一区色| 亚洲人午夜精品天堂一二香蕉| 亚洲国产精品成人综合| 久久日韩粉嫩一区二区三区| 欧美www视频|