7 #ifndef OPENOCD_JTAG_DRIVERS_VERSALOON_USBTOXXX_USBTOXXX_INTERNAL_H 
    8 #define OPENOCD_JTAG_DRIVERS_VERSALOON_USBTOXXX_USBTOXXX_INTERNAL_H 
   12 #define USB_TO_USART                            (VERSALOON_USB_TO_XXX_CMD_START + 0x00) 
   13 #define USB_TO_SPI                              (VERSALOON_USB_TO_XXX_CMD_START + 0x01) 
   14 #define USB_TO_I2C                              (VERSALOON_USB_TO_XXX_CMD_START + 0x02) 
   15 #define USB_TO_GPIO                             (VERSALOON_USB_TO_XXX_CMD_START + 0x03) 
   16 #define USB_TO_CAN                              (VERSALOON_USB_TO_XXX_CMD_START + 0x04) 
   17 #define USB_TO_PWM                              (VERSALOON_USB_TO_XXX_CMD_START + 0x05) 
   18 #define USB_TO_ADC                              (VERSALOON_USB_TO_XXX_CMD_START + 0x06) 
   19 #define USB_TO_DAC                              (VERSALOON_USB_TO_XXX_CMD_START + 0x07) 
   20 #define USB_TO_MICROWIRE                        (VERSALOON_USB_TO_XXX_CMD_START + 0x08) 
   21 #define USB_TO_SWIM                             (VERSALOON_USB_TO_XXX_CMD_START + 0x09) 
   22 #define USB_TO_DUSI                             (VERSALOON_USB_TO_XXX_CMD_START + 0x0A) 
   24 #define USB_TO_JTAG_LL                          (VERSALOON_USB_TO_XXX_CMD_START + 0x20) 
   25 #define USB_TO_JTAG_HL                          (VERSALOON_USB_TO_XXX_CMD_START + 0x21) 
   26 #define USB_TO_ISSP                             (VERSALOON_USB_TO_XXX_CMD_START + 0x22) 
   27 #define USB_TO_C2                               (VERSALOON_USB_TO_XXX_CMD_START + 0x23) 
   28 #define USB_TO_SBW                              (VERSALOON_USB_TO_XXX_CMD_START + 0x24) 
   29 #define USB_TO_LPCICP                           (VERSALOON_USB_TO_XXX_CMD_START + 0x25) 
   30 #define USB_TO_SWD                              (VERSALOON_USB_TO_XXX_CMD_START + 0x26) 
   31 #define USB_TO_JTAG_RAW                         (VERSALOON_USB_TO_XXX_CMD_START + 0x27) 
   32 #define USB_TO_BDM                              (VERSALOON_USB_TO_XXX_CMD_START + 0x28) 
   33 #define USB_TO_MSP430_JTAG                      (VERSALOON_USB_TO_XXX_CMD_START + 0x38) 
   35 #define USB_TO_POWER                            (VERSALOON_USB_TO_XXX_CMD_START + 0x40) 
   36 #define USB_TO_DELAY                            (VERSALOON_USB_TO_XXX_CMD_START + 0x41) 
   37 #define USB_TO_POLL                             (VERSALOON_USB_TO_XXX_CMD_START + 0x42) 
   38 #define USB_TO_INFO                             (VERSALOON_USB_TO_XXX_CMD_START + 0x5E) 
   39 #define USB_TO_ALL                              (VERSALOON_USB_TO_XXX_CMD_START + 0x5F) 
   42 #define USB_TO_XXX_CMDMASK                      0xF8 
   43 #define USB_TO_XXX_CMDSHIFT                     3 
   44 #define USB_TO_XXX_IDXMASK                      0x07 
   47 #define USB_TO_XXX_INIT                         (0x00 << USB_TO_XXX_CMDSHIFT) 
   48 #define USB_TO_XXX_FINI                         (0x01 << USB_TO_XXX_CMDSHIFT) 
   49 #define USB_TO_XXX_CONFIG                       (0x02 << USB_TO_XXX_CMDSHIFT) 
   50 #define USB_TO_XXX_GETHWINFO                    (0x03 << USB_TO_XXX_CMDSHIFT) 
   51 #define USB_TO_XXX_STATUS                       (0X04 << USB_TO_XXX_CMDSHIFT) 
   52 #define USB_TO_XXX_IN_OUT                       (0x05 << USB_TO_XXX_CMDSHIFT) 
   53 #define USB_TO_XXX_IN                           (0x06 << USB_TO_XXX_CMDSHIFT) 
   54 #define USB_TO_XXX_OUT                          (0x07 << USB_TO_XXX_CMDSHIFT) 
   55 #define USB_TO_XXX_POLL                         (0x08 << USB_TO_XXX_CMDSHIFT) 
   56 #define USB_TO_XXX_SPECIAL                      (0x09 << USB_TO_XXX_CMDSHIFT) 
   57 #define USB_TO_XXX_RESET                        (0x0A << USB_TO_XXX_CMDSHIFT) 
   58 #define USB_TO_XXX_SYNC                         (0x0B << USB_TO_XXX_CMDSHIFT) 
   59 #define USB_TO_XXX_ENABLE                       (0x0C << USB_TO_XXX_CMDSHIFT) 
   60 #define USB_TO_XXX_DISABLE                      (0x0D << USB_TO_XXX_CMDSHIFT) 
   62 #define USB_TO_POLL_START                       0x00 
   63 #define USB_TO_POLL_END                         0x01 
   64 #define USB_TO_POLL_CHECKOK                     0x02 
   65 #define USB_TO_POLL_CHECKFAIL                   0x03 
   66 #define USB_TO_POLL_VERIFYBUFF                  0x04 
   69 #define USB_TO_XXX_OK                           0x00 
   70 #define USB_TO_XXX_FAILED                       0x01 
   71 #define USB_TO_XXX_TIME_OUT                     0x02 
   72 #define USB_TO_XXX_INVALID_INDEX                0x03 
   73 #define USB_TO_XXX_INVALID_PARA                 0x04 
   74 #define USB_TO_XXX_INVALID_CMD                  0x05 
   75 #define USB_TO_XXX_CMD_NOT_SUPPORT              0x06 
   79         actual_szie, uint16_t want_pos,
 
   80         uint16_t want_size, uint8_t *
buffer);
 
   83         uint16_t cmdlen, uint16_t retlen,
 
   84         uint8_t *wantbuf, uint16_t wantpos,
 
   85         uint16_t wantlen, uint8_t collect);
 
   87 #define usbtoxxx_init_command(type, port)                           \ 
   88     usbtoxxx_add_command((type), (USB_TO_XXX_INIT | (port)), \ 
   89     NULL, 0, 0, NULL, 0, 0, 0) 
   90 #define usbtoxxx_fini_command(type, port)                                   \ 
   91     usbtoxxx_add_command((type), (USB_TO_XXX_FINI | (port)), \ 
   92     NULL, 0, 0, NULL, 0, 0, 0) 
   93 #define usbtoxxx_conf_command(type, port, cmdbuf, cmdlen)                   \ 
   94     usbtoxxx_add_command((type), (USB_TO_XXX_CONFIG | (port)), \ 
   95     (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0) 
   96 #define usbtoxxx_inout_command(type, port, cmdbuf, cmdlen, retlen, wantbuf, \ 
   97     wantpos, wantlen, c)                            \ 
   98     usbtoxxx_add_command((type), (USB_TO_XXX_IN_OUT | (port)), \ 
   99     (cmdbuf), (cmdlen), (retlen), (wantbuf), \ 
  100     (wantpos), (wantlen), (c)) 
  101 #define usbtoxxx_in_command(type, port, cmdbuf, cmdlen, retlen, wantbuf, \ 
  102         wantpos, wantlen, c)                            \ 
  103     usbtoxxx_add_command((type), (USB_TO_XXX_IN | (port)), (cmdbuf), \ 
  104     (cmdlen), (retlen), (wantbuf), (wantpos), \ 
  106 #define usbtoxxx_out_command(type, port, cmdbuf, cmdlen, c)                 \ 
  107     usbtoxxx_add_command((type), (USB_TO_XXX_OUT | (port)), (cmdbuf), \ 
  108     (cmdlen), 0, NULL, 0, 0, (c)) 
  109 #define usbtoxxx_poll_command(type, port, cmdbuf, cmdlen, retbuf, retlen)   \ 
  110     usbtoxxx_add_command((type), (USB_TO_XXX_POLL | (port)), (cmdbuf), \ 
  111     (cmdlen), (retlen), (retbuf), 0, (retlen), 0) 
  112 #define usbtoxxx_status_command(type, port, retlen, wantbuf, wantpos, wantlen, c) \ 
  113     usbtoxxx_add_command((type), (USB_TO_XXX_STATUS | (port)), \ 
  114     NULL, 0, (retlen), (wantbuf), (wantpos), \ 
  116 #define usbtoxxx_special_command(type, port, cmdbuf, cmdlen, retlen, wantbuf, \ 
  117     wantpos, wantlen, c)                        \ 
  118     usbtoxxx_add_command((type), (USB_TO_XXX_SPECIAL | (port)), \ 
  119     (cmdbuf), (cmdlen), retlen, wantbuf, \ 
  120     wantpos, wantlen, (c)) 
  121 #define usbtoxxx_reset_command(type, port, cmdbuf, cmdlen)                  \ 
  122     usbtoxxx_add_command((type), (USB_TO_XXX_RESET | (port)), \ 
  123     (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0) 
  124 #define usbtoxxx_sync_command(type, port, cmdbuf, cmdlen, retlen, wantbuf)  \ 
  125     usbtoxxx_add_command((type), (USB_TO_XXX_SYNC | (port)), \ 
  126     (cmdbuf), (cmdlen), (retlen), (wantbuf), 0, \ 
  128 #define usbtoxxx_enable_command(type, port, cmdbuf, cmdlen)                 \ 
  129     usbtoxxx_add_command((type), (USB_TO_XXX_ENABLE | (port)), \ 
  130     (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0) 
  131 #define usbtoxxx_disable_command(type, port, cmdbuf, cmdlen)                \ 
  132     usbtoxxx_add_command((type), (USB_TO_XXX_DISABLE | (port)), \ 
  133     (cmdbuf), (cmdlen), 0, NULL, 0, 0, 0) 
  136 #define USB_TO_SPI_BAUDRATE_MSK     0x1F 
  137 #define USB_TO_SPI_CPOL_MSK         0x20 
  138 #define USB_TO_SPI_CPHA_MSK         0x40 
  139 #define USB_TO_SPI_MSB_FIRST        0x80 
  142 #define USB_TO_DUSI_BAUDRATE_MSK    0x1F 
  143 #define USB_TO_DUSI_CPOL_MSK        0x20 
  144 #define USB_TO_DUSI_CPHA_MSK        0x40 
  145 #define USB_TO_DUSI_MSB_FIRST       0x80 
  148 #define USB_TO_GPIO_DIR_MSK         0x01 
uint64_t buffer
Pointer to data buffer to send over SPI.
 
RESULT usbtoxxx_add_command(uint8_t type, uint8_t cmd, uint8_t *cmdbuf, uint16_t cmdlen, uint16_t retlen, uint8_t *wantbuf, uint16_t wantpos, uint16_t wantlen, uint8_t collect)
 
RESULT usbtoxxx_add_pending(uint8_t type, uint8_t cmd, uint16_t actual_szie, uint16_t want_pos, uint16_t want_size, uint8_t *buffer)