]> hackdaworld.org Git - my-code/pnx.git/commitdiff
basically working set_ir stuff (untested!)
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 27 Mar 2011 12:31:03 +0000 (14:31 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 27 Mar 2011 12:31:03 +0000 (14:31 +0200)
jtag.c

diff --git a/jtag.c b/jtag.c
index 2e8298cf44767d578e14db9746ee07be7db1622f..2497cf78dbd935c1a632cdc53f3a0307b82c4af6 100644 (file)
--- a/jtag.c
+++ b/jtag.c
@@ -230,27 +230,29 @@ int jtag_chain_init(t_jtag *jtag) {
 
 int jtag_set_ir(char *s,int bitlen) {
 
-       u8 ir[MAXDEV*MAX_IR_LEN/8];
+       u8 ir[MAXDEV*MAXIRLEN/8];
        int count;
 
-       if(biten>=MAXDEV*MAX_IR_LEN) {
+       if(bitlen>=MAXDEV*MAXIRLEN) {
                printf("instruction register too big!\n");
                return -1;
        }
 
-       memset(ir,0,MAXDEV*MAX_IR_LEN/8*sizeof(u8));
+       memset(ir,0,MAXDEV*MAXIRLEN/8*sizeof(u8));
 
+       printf("ir to set: ");
        while(bitlen) {
-               ir[count/8]|=p[count] ... HIER WEITER ..;
+               ir[count/8]|=(s[count]<<(count%8));
+               printf("%d",ir[count/8]&(1<<count%8)?1:0);
                count+=1;
                bitlen-=1;
        }
+       printf("\n");
 
        jtag_enter_shift_ir();
-
-       while(len--)
-
+       jtag_write_data(ir,bitlen);
        jtag_leave_shift_ir();
+
        return 0;
 
 }
@@ -258,6 +260,8 @@ int jtag_set_ir(char *s,int bitlen) {
 int main(int argc,char **argv) {
 
        t_jtag jtag;
+       u8 io[256];
+       int i;
 
        memset(&jtag,0,sizeof(t_jtag));
 
@@ -273,6 +277,16 @@ int main(int argc,char **argv) {
        jtag_chain_init(&jtag);
        printf("done\n\n");
 
+       printf("testing some instructions ...\n\n");
+       jtag_set_ir("000001000001",12);
+       jtag_enter_shift_dr();
+       jtag_read_data(io,64);
+       for(i=0;i<64;i++) {
+               printf("%d",io[i/8]&(1<<(i%8))?1:0);
+       }
+       printf("\n");
+       jtag_leave_shift_dr();
+
        return 0;
 
 }