Currently Non-working JTAG programmer

Dependencies:   mbed

Committer:
monpjc
Date:
Thu Jun 28 13:36:55 2012 +0000
Revision:
0:a23e8a7c9275
new

Who changed what in which revision?

UserRevisionLine numberNew contents of line
monpjc 0:a23e8a7c9275 1 /*******************************************************/
monpjc 0:a23e8a7c9275 2 /* file: lenval.h */
monpjc 0:a23e8a7c9275 3 /* abstract: This file contains a description of the */
monpjc 0:a23e8a7c9275 4 /* data structure "lenval". */
monpjc 0:a23e8a7c9275 5 /*******************************************************/
monpjc 0:a23e8a7c9275 6
monpjc 0:a23e8a7c9275 7 #ifndef lenval_dot_h
monpjc 0:a23e8a7c9275 8 #define lenval_dot_h
monpjc 0:a23e8a7c9275 9
monpjc 0:a23e8a7c9275 10 /* the lenVal structure is a byte oriented type used to store an */
monpjc 0:a23e8a7c9275 11 /* arbitrary length binary value. As an example, the hex value */
monpjc 0:a23e8a7c9275 12 /* 0x0e3d is represented as a lenVal with len=2 (since 2 bytes */
monpjc 0:a23e8a7c9275 13 /* and val[0]=0e and val[1]=3d. val[2-MAX_LEN] are undefined */
monpjc 0:a23e8a7c9275 14
monpjc 0:a23e8a7c9275 15 /* maximum length (in bytes) of value to read in */
monpjc 0:a23e8a7c9275 16 /* this needs to be at least 4, and longer than the */
monpjc 0:a23e8a7c9275 17 /* length of the longest SDR instruction. If there is, */
monpjc 0:a23e8a7c9275 18 /* only 1 device in the chain, MAX_LEN must be at least */
monpjc 0:a23e8a7c9275 19 /* ceil(27/8) == 4. For 6 devices in a chain, MAX_LEN */
monpjc 0:a23e8a7c9275 20 /* must be 5, for 14 devices MAX_LEN must be 6, for 20 */
monpjc 0:a23e8a7c9275 21 /* devices MAX_LEN must be 7, etc.. */
monpjc 0:a23e8a7c9275 22 /* You can safely set MAX_LEN to a smaller number if you*/
monpjc 0:a23e8a7c9275 23 /* know how many devices will be in your chain. */
monpjc 0:a23e8a7c9275 24 /* #define MAX_LEN (Actual #define is below this comment block)
monpjc 0:a23e8a7c9275 25 This #define defines the maximum length (in bytes) of predefined
monpjc 0:a23e8a7c9275 26 buffers in which the XSVF player stores the current shift data.
monpjc 0:a23e8a7c9275 27 This length must be greater than the longest shift length (in bytes)
monpjc 0:a23e8a7c9275 28 in the XSVF files that will be processed. 7000 is a very conservative
monpjc 0:a23e8a7c9275 29 number. The buffers are stored on the stack and if you have limited
monpjc 0:a23e8a7c9275 30 stack space, you may decrease the MAX_LEN value.
monpjc 0:a23e8a7c9275 31
monpjc 0:a23e8a7c9275 32 How to find the "shift length" in bits?
monpjc 0:a23e8a7c9275 33 Look at the ASCII version of the XSVF (generated with the -a option
monpjc 0:a23e8a7c9275 34 for the SVF2XSVF translator) and search for the XSDRSIZE command
monpjc 0:a23e8a7c9275 35 with the biggest parameter. XSDRSIZE is equivalent to the SVF's
monpjc 0:a23e8a7c9275 36 SDR length plus the lengths of applicable HDR and TDR commands.
monpjc 0:a23e8a7c9275 37 Remember that the MAX_LEN is defined in bytes. Therefore, the
monpjc 0:a23e8a7c9275 38 minimum MAX_LEN = ceil( max( XSDRSIZE ) / 8 );
monpjc 0:a23e8a7c9275 39
monpjc 0:a23e8a7c9275 40 The following MAX_LEN values have been tested and provide relatively
monpjc 0:a23e8a7c9275 41 good margin for the corresponding devices:
monpjc 0:a23e8a7c9275 42
monpjc 0:a23e8a7c9275 43 DEVICE MAX_LEN Resulting Shift Length Max (in bits)
monpjc 0:a23e8a7c9275 44 --------- ------- ----------------------------------------------
monpjc 0:a23e8a7c9275 45 XC9500/XL/XV 32 256
monpjc 0:a23e8a7c9275 46
monpjc 0:a23e8a7c9275 47 CoolRunner/II 256 2048 - actual max 1 device = 1035 bits
monpjc 0:a23e8a7c9275 48
monpjc 0:a23e8a7c9275 49 FPGA 128 1024 - svf2xsvf -rlen 1024
monpjc 0:a23e8a7c9275 50
monpjc 0:a23e8a7c9275 51 XC18V00/XCF00
monpjc 0:a23e8a7c9275 52 1100 8800 - no blank check performed (default)
monpjc 0:a23e8a7c9275 53 - actual max 1 device = 8192 bits verify
monpjc 0:a23e8a7c9275 54 - max 1 device = 4096 bits program-only
monpjc 0:a23e8a7c9275 55
monpjc 0:a23e8a7c9275 56 XC18V00/XCF00 when using the optional Blank Check operation
monpjc 0:a23e8a7c9275 57 2500 20000 - required for blank check
monpjc 0:a23e8a7c9275 58 - blank check max 1 device = 16384 bits
monpjc 0:a23e8a7c9275 59 */
monpjc 0:a23e8a7c9275 60 #define MAX_LEN 7000
monpjc 0:a23e8a7c9275 61
monpjc 0:a23e8a7c9275 62
monpjc 0:a23e8a7c9275 63 typedef struct var_len_byte
monpjc 0:a23e8a7c9275 64 {
monpjc 0:a23e8a7c9275 65 short len; /* number of chars in this value */
monpjc 0:a23e8a7c9275 66 unsigned char val[MAX_LEN+1]; /* bytes of data */
monpjc 0:a23e8a7c9275 67 } lenVal;
monpjc 0:a23e8a7c9275 68
monpjc 0:a23e8a7c9275 69
monpjc 0:a23e8a7c9275 70 /* return the long representation of a lenVal */
monpjc 0:a23e8a7c9275 71 extern long value(lenVal *x);
monpjc 0:a23e8a7c9275 72
monpjc 0:a23e8a7c9275 73 /* set lenVal equal to value */
monpjc 0:a23e8a7c9275 74 extern void initLenVal(lenVal *x, long value);
monpjc 0:a23e8a7c9275 75
monpjc 0:a23e8a7c9275 76 /* check if expected equals actual (taking the mask into account) */
monpjc 0:a23e8a7c9275 77 extern short EqualLenVal(lenVal *expected, lenVal *actual, lenVal *mask);
monpjc 0:a23e8a7c9275 78
monpjc 0:a23e8a7c9275 79 /* add val1+val2 and put the result in resVal */
monpjc 0:a23e8a7c9275 80 extern void addVal(lenVal *resVal, lenVal *val1, lenVal *val2);
monpjc 0:a23e8a7c9275 81
monpjc 0:a23e8a7c9275 82 /* return the (byte, bit) of lv (reading from left to right) */
monpjc 0:a23e8a7c9275 83 extern short RetBit(lenVal *lv, int byte, int bit);
monpjc 0:a23e8a7c9275 84
monpjc 0:a23e8a7c9275 85 /* set the (byte, bit) of lv equal to val (e.g. SetBit("00000000",byte, 1)
monpjc 0:a23e8a7c9275 86 equals "01000000" */
monpjc 0:a23e8a7c9275 87 extern void SetBit(lenVal *lv, int byte, int bit, short val);
monpjc 0:a23e8a7c9275 88
monpjc 0:a23e8a7c9275 89 /* read from XSVF numBytes bytes of data into x */
monpjc 0:a23e8a7c9275 90 extern void readVal(lenVal *x, short numBytes);
monpjc 0:a23e8a7c9275 91
monpjc 0:a23e8a7c9275 92 #endif
monpjc 0:a23e8a7c9275 93