#include "usb_jtag.h"#include "mips32.h"
Go to the source code of this file.
Defines | |
| #define | EP_IN 0x6 |
| #define | EP_OUT 0x2 |
| #define | MY_DEBUG |
| #define | PACK_BUFF_SIZE 1024*1024*10 |
Functions | |
| unsigned int | lw_feed_data (unsigned int data) |
| void | usb_hardware_rcv (unsigned char *ptr, unsigned int len) |
| void | usb_hardware_send (unsigned char *ptr, unsigned int len) |
| unsigned char * | usb_wr_cache (unsigned char *ptr, unsigned int len, int rd_len) |
| unsigned int | usb_wr_dr_nwb (unsigned int new_dr_data) |
| unsigned int | usb_wr_ir_nwb (unsigned char new_ir_data) |
Variables | |
| int | init_my_1 = 0 |
| static unsigned char | last_ir |
| int | pack_buff_cntr = 0 |
| unsigned char | pack_buffer [PACK_BUFF_SIZE] |
| static unsigned char | updated |
| #define EP_IN 0x6 |
| #define EP_OUT 0x2 |
| #define MY_DEBUG |
| #define PACK_BUFF_SIZE 1024*1024*10 |
| unsigned int lw_feed_data | ( | unsigned int | data | ) |
Definition at line 101 of file aaa.c.
References dJTAG_REGISTER_CONTROL, dJTAG_REGISTER_DATA, dMIPS32_ECR_CPU_RESET_OCCURED, dMIPS32_ECR_PROBE_ENABLE, dMIPS32_ECR_PROBE_VECTOR, usb_wr_dr_nwb(), and usb_wr_ir_nwb().
Referenced by fast_write_3().
00102 { 00103 unsigned int ui_result ; 00104 // printf("Info : feed 0x%08x with 0x%08x\n",lw_get_ejtag_addr(),data); 00105 usb_wr_ir_nwb(dJTAG_REGISTER_DATA); 00106 usb_wr_dr_nwb(data); 00107 00108 ui_result=dMIPS32_ECR_CPU_RESET_OCCURED|dMIPS32_ECR_PROBE_ENABLE| 00109 dMIPS32_ECR_PROBE_VECTOR ; 00110 usb_wr_ir_nwb(dJTAG_REGISTER_CONTROL); 00111 usb_wr_dr_nwb(ui_result); 00112 // usb_wr_cache(NULL,0,0); 00113 }
| void usb_hardware_rcv | ( | unsigned char * | ptr, | |
| unsigned int | len | |||
| ) |
Definition at line 23 of file aaa.c.
References current_handle, and EP_IN.
Referenced by usb_wr_cache().
00024 { 00025 int a=usb_bulk_read(current_handle,EP_IN,ptr,len,5000); 00026 if(a!=len) 00027 { 00028 printf("Request for bulk write failed: %s\n"); 00029 return ; 00030 } 00031 }
| void usb_hardware_send | ( | unsigned char * | ptr, | |
| unsigned int | len | |||
| ) |
Definition at line 11 of file aaa.c.
References current_handle, and EP_OUT.
Referenced by usb_wr_cache().
00012 { 00013 int a ; 00014 a=usb_bulk_write(current_handle,EP_OUT,ptr,len,5000); 00015 if(a!=len) 00016 { 00017 printf("Request for bulk write failed: %s\n"); 00018 return ; 00019 } 00020 }
| unsigned char* usb_wr_cache | ( | unsigned char * | ptr, | |
| unsigned int | len, | |||
| int | rd_len | |||
| ) |
Definition at line 41 of file aaa.c.
References MY_DEBUG, pack_buff_cntr, PACK_BUFF_SIZE, pack_buffer, usb_hardware_rcv(), and usb_hardware_send().
Referenced by fast_write_3(), and usb_wr_dr_nwb().
00042 { 00043 int i,j,k,a ; 00044 00045 // if(ptr != NULL) 00046 // usb_hardware_send(ptr,len); 00047 #if 1 00048 int do_send_now=a=0; // (0==rd_len)?0:1 ; 00049 /* 00050 if(!init_my_1) 00051 { 00052 init_my_1 = 1; 00053 pack_buffer = malloc(PACK_BUFF_SIZE); 00054 } 00055 */ 00056 if(ptr==NULL) 00057 do_send_now=1 ; 00058 if(len==0) 00059 do_send_now=1 ; 00060 00061 if(PACK_BUFF_SIZE<(pack_buff_cntr+len+64)) 00062 { 00063 do_send_now=1 ; 00064 a=1; 00065 } 00066 else 00067 for(i=0;i<len;++i) 00068 // pack_buff_cntr++; 00069 pack_buffer[pack_buff_cntr++]=ptr[i]; 00070 MY_DEBUG 00071 // if(do_send_now&&(pack_buff_cntr!=0)) 00072 if(do_send_now) 00073 { 00074 MY_DEBUG 00075 //printf("sending a packdge ,which size is %d\n",pack_buff_cntr); 00076 usb_hardware_send(pack_buffer,pack_buff_cntr); 00077 pack_buff_cntr=0 ; 00078 if(a) 00079 { 00080 for(i=0;i<len;++i) 00081 // pack_buff_cntr++; 00082 pack_buffer[pack_buff_cntr++]=ptr[i]; 00083 } 00084 } 00085 MY_DEBUG 00086 #endif 00087 00088 #if 0 00089 if(rd_len!=0) 00090 { 00091 MY_DEBUG 00092 usb_hardware_rcv(ptr,rd_len); 00093 MY_DEBUG 00094 } 00095 MY_DEBUG 00096 #endif 00097 return ptr ; 00098 }
| unsigned int usb_wr_dr_nwb | ( | unsigned int | new_dr_data | ) |
Definition at line 127 of file aaa.c.
References last_ir, OP_EJTAG_SHIFT, OP_WR_DR, updated, usb_wr_cache(), and usb_wr_dr_data.
Referenced by lw_feed_data().
00128 { 00129 unsigned short usb_wr_dr_data[20]; 00130 static unsigned char buf[32]; 00131 static unsigned char tmp[4]; 00132 int i,a,count=6 ; 00133 unsigned int usb_wr_dr_result=0 ; 00134 // int i_data=(wb==0)?0:1 ; 00135 // wb=i_data ; 00136 if(updated) 00137 { 00138 tmp[0]=last_ir ; 00139 //usb_wr_ir_data&0xff; 00140 tmp[1]=0x10 ; 00141 //no need to write back. 00142 usb_wr_cache(tmp,2,0); 00143 updated=0 ; 00144 } 00145 usb_wr_dr_data[0]=OP_WR_DR<<OP_EJTAG_SHIFT ; 00146 // if (wb) usb_wr_dr_data[0]|= 1 << OP_EJTAG_W_SHIFT ; 00147 // if (wb) usb_wr_dr_data[0]|= 1 << OP_EJTAG_I_SHIFT ; 00148 usb_wr_dr_data[1]=new_dr_data&0xFFFF ; 00149 usb_wr_dr_data[2]=(new_dr_data&0xFFFF0000)>>16 ; 00150 for(i=0;i<count;i=i+2) 00151 { 00152 buf[i]=usb_wr_dr_data[i/2]&0xFF ; 00153 buf[i+1]=(usb_wr_dr_data[i/2]&0xFF00)>>8 ; 00154 } 00155 00156 usb_wr_cache(buf,6,0); 00157 00158 return 0 ; 00159 }
| unsigned int usb_wr_ir_nwb | ( | unsigned char | new_ir_data | ) |
Definition at line 115 of file aaa.c.
References last_ir, and updated.
Referenced by lw_feed_data().
00116 { 00117 int a ; 00118 unsigned short usb_wr_ir_data ; 00119 //=0xff&(new_ir_data <<8 )+0x10; 00120 new_ir_data&=0x1f ; 00121 usb_wr_ir_data=new_ir_data+1<<4 ; 00122 if(last_ir==new_ir_data)return ; 00123 last_ir=new_ir_data ; 00124 updated=1 ; 00125 }
unsigned char last_ir [static] |
| int pack_buff_cntr = 0 |
| unsigned char pack_buffer[PACK_BUFF_SIZE] |
unsigned char updated [static] |
1.5.6