jtag-driver.h (1551B)
1 // Copyright 2014 Brian Swetland <swetland@frotz.net> 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef _JTAG_DRIVER_ 16 #define _JTAG_DRIVER_ 17 18 #include "jtag.h" 19 20 typedef struct JDRV JDRV; 21 22 typedef struct { 23 int (*init)(JDRV *d); 24 25 // returns actual speed 26 // if khz is negative, only query speed, do not set 27 int (*setspeed)(JDRV *drv, int khz); 28 29 // Declare the end of a transaction, block until success or failure. 30 // Once this returns, pointers passed via scan_*() may become invalid. 31 int (*commit)(JDRV *d); 32 33 // Shift count TMS=tbits TDI=obit out. 34 // If ibits is nonnull, capture the first TDO at offset ioffset in ibits. 35 int (*scan_tms)(JDRV *d, u32 obit, u32 count, u8 *tbits, 36 u32 ioffset, u8 *ibits); 37 38 // Shift count bits. 39 // If obits nonnull, shift out those bits to TDI. 40 // If ibits nonnull, capture to those bits from TDO. 41 // TMS does not change. 42 int (*scan_io)(JDRV *d, u32 count, u8 *obits, u8 *ibits); 43 44 // Close and release driver. 45 int (*close)(JDRV *d); 46 } JDVT; 47 48 int jtag_init(JTAG **jtag, JDRV *drv, JDVT *vt); 49 50 #endif 51 52