Use common USB standard requests handling.
authorppisa <pisa@cmp.felk.cvut.cz>
Sun, 23 Nov 2008 19:05:41 +0000 (20:05 +0100)
committerppisa <pisa@cmp.felk.cvut.cz>
Sun, 23 Nov 2008 19:05:41 +0000 (20:05 +0100)
The required adaptations in "usbcan" application
and specification of meaningful device identification
are included as well.

Signed-off-by: ppisa <pisa@cmp.felk.cvut.cz>
embedded/app/usbcan/Makefile.omk
embedded/app/usbcan/main.c
embedded/app/usbcan/usb/usb_defs.h
embedded/app/usbcan/usb_srq.c [deleted file]
embedded/board/arm/ul_usb1/config/config.usbcan

index 4f302d7..edb4a98 100644 (file)
@@ -19,14 +19,14 @@ INCLUDES += -I.
 #include_HEADERS  = ul_idstr.h
 
 bin_PROGRAMS = usbcan
-usbcan_SOURCES = main.c usb_srq.c can.c can_queue.c sja1000p.c can_quesysless.c devcommon.c setup.c ul_usb1.c finish.c usb_vend.c
+usbcan_SOURCES = main.c can.c can_queue.c sja1000p.c can_quesysless.c devcommon.c setup.c ul_usb1.c finish.c usb_vend.c
 
 #usbtest_SOURCES +=  ul_idstr.c
 #lib_LOADLIBES =  bspbase ul_drv lpciap keyval lpciap_kvpb mach_hal uldy
-lib_LOADLIBES =  bspbase usbbase lpcusb mach_hal
+lib_LOADLIBES =  bspbase usbbase usbmore lpcusb mach_hal
 usbcan_MOREOBJS = $(USER_LIB_DIR)/system_stub.o $(USER_LIB_DIR)/ivt.o
 nobase_include_HEADERS = usb/usb_defs.h
 
-link_VARIANTS = boot
+link_VARIANTS = boot app
 
 endif #CONFIG_ULBOOT
index fd12f59..657b9e3 100644 (file)
@@ -31,6 +31,7 @@
 #include "./can/ul_usb1.h"
 //#include "./can/setup.h"
 
+#include "./usb/usb_defs.h"
 #include "./usb/usb_vend.h"
 
 #define MASK_EP1RX  0x01
@@ -56,7 +57,7 @@
 /***********************************************************************
  * Note:
  * Code is wittingly complex in order to ease future changes in hardware
- * configuration and to make it as much similar as the code of LinCAN
+ * configuration and to make it as much similar as the code of LinCAN
  ***********************************************************************/
 
 LT_TIMER_DEC(lt_10msec)
@@ -69,13 +70,13 @@ LT_TIMER_IMP(lt_2sec)
 typedef void (*FNC)(); //function ptr
 
 /***********************************************************************
      * global variables
      ***********************************************************************/
+ * global variables
+ ***********************************************************************/
 
 
 usb_device_t usb_device;
 
-usb_ep_t eps[2];
+usb_ep_t eps[NUM_ENDPOINTS];
 unsigned char ep1_rx_buff[USB_MAX_PACKET];
 unsigned char ep1_tx_buff[USB_MAX_PACKET];
 uint8_t timer_str,timer_rx_off,timer_tx_off,timer_configured;
@@ -317,9 +318,10 @@ int main(void)
 
        memset( &usb_device, 0, sizeof( usb_device));
        usb_device.id = 1;
+       usb_device.devdes_table = &usb_devdes_table;
        usb_device.init = usb_lpc_init;
        usb_debug_set_level(DEBUG_LEVEL_NONE);
-       usb_device.cntep = 3;
+       usb_device.cntep = NUM_ENDPOINTS;
        usb_device.ep = eps;
 
        eps[0].max_packet_size = USB_MAX_PACKET;
@@ -331,7 +333,7 @@ int main(void)
        eps[0].udev = &usb_device;
        eps[1].udev = &usb_device;
 
-  usb_device.vendor_fnc=usbcan_vendor;
+       usb_device.vendor_fnc=usbcan_vendor;
 
        usb_init(&usb_device);
        usb_connect(&usb_device);
@@ -341,7 +343,7 @@ int main(void)
         * Start
         ***********************************************************************/
 
-  timer_rx_off=timer_tx_off=timer_str=timer_configured=0;
+       timer_rx_off=timer_tx_off=timer_str=timer_configured=0;
        while (1) {
 
                usb_check_events(&usb_device);
index 48dde4e..adb531c 100644 (file)
     #define CODE
   #endif
 
-       #ifdef USB_MAX_PACKET
-               #undef USB_MAX_PACKET
-               #define USB_MAX_PACKET 16
-       #endif
+  #ifdef USB_MAX_PACKET
+    #undef USB_MAX_PACKET
+  #endif
+  #define USB_MAX_PACKET 16
+
 /*****************************************************/
 /*** Static data structures for device descriptors ***/
 /*****************************************************/
 #ifndef USB_VENDOR_ID
-  #define USB_VENDOR_ID      0x1669  /* vymyslene cislo ( snad ho nikdo nema ... ;-) */
+  #define USB_VENDOR_ID      0x1669  /* PiKRON.com registered number */
 #endif
 #ifndef USB_PRODUCT_ID
   #define USB_PRODUCT_ID     0x1011  /* test code for ULAD21 */
   };
 
   CODE const char Str1Desc[] = {  /* 1 = manufacturer */
-    48,0x03,
-    'S',0,
-    'm',0,
-    'o',0,
-    'l',0,
+    44,0x03,
+    'K',0,
+    'r',0,
     'i',0,
-    'k',0,
+    'z',0,
     ',',0,
     'B',0,
     'a',0,
   };
 
   CODE const char Str2Desc[] = {  /* 2 = product */
-    38, 0x03,
-    'u',0,
-    'L',0,
-    'a',0,
-    'n',0,
-    '2',0,
-    'u',0,
-    's',0,
-    'b',0,
+    42, 0x03,
+    'C',0,
+    'A',0,
+    'N',0,
+    ' ',0,
+    't',0,
+    'o',0,
+    ' ',0,
+    'U',0,
+    'S',0,
+    'B',0,
     ' ',0,
     'c',0,
     'o',0,
 
   CODE const char Str3Desc[] = {  /* 3 = version */
     26, 0x03,
-    '2',0,
-    '3',0,
-    '.',0,
-    '0',0,
-    '7',0,
+    '1',0,
     '.',0,
+    '1',0,
+    ' ',0,
     '0',0,
-    '4',0,
+    '8',0,
     '-',0,
     '1',0,
-    '.',0,
-    '1',0
+    '1',0,
+    '-',0,
+    '2',0,
+    '3',0
   };
   CODE const char Str4Desc[] = {  /* 4 = configuration */
     34, 0x03,
     '1',0
   };
   CODE const char Str5Desc[] = {  /* 5 = interface */
-    26,0x03,
+    38,0x03,
     'I',0,
     'n',0,
     't',0,
     'e',0,
     ' ',0,
     '#',0,
-    '0',0
+    '0',0,
+    ' ',0,
+    '-',0,
+    ' ',0,
+    'C',0,
+    'A',0,
+    'N',0
   };
 
   CODE const char Str6Desc[] = {  /* EP1 OUT descriptor */
-    136,0x03,
+    48,0x03,
     'E',0,
     'P',0,
     '1',0,
     'n',0,
     'd',0,
     ' ',0,
+    'C',0,
+    'A',0,
+    'N',0,
+    ' ',0,
     'm',0,
     'e',0,
     's',0,
     's',0,
     'a',0,
     'g',0,
-    'e',0,
-    '-',0,
-    'd',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    's',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    'c',0,
-    'm',0,
-    'd',0,
-    ',',0,
-    'f',0,
-    'l',0,
-    'g',0,
-    ',',0,
-    's',0,
-    't',0,
-    'a',0,
-    'm',0,
-    'p',0,
-    ',',0,
-    'f',0,
-    'r',0,
-    'e',0,
-    'e',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'l',0,
-    'o',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'h',0,
-    'i',0,
-    ',',0,
-    'd',0,
-    'a',0,
-    't',0,
-    'a',0
+    'e',0
   };
 
-  CODE const char Str7Desc[] = {  /* EP2 IN descriptor */
-    140,0x03,
+  CODE const char Str7Desc[] = {  /* EP1 IN descriptor */
+    52,0x03,
     'E',0,
     'P',0,
     '1',0,
     'v',0,
     'e',0,
     ' ',0,
-    'm',0,
-    'e',0,
-    's',0,
-    's',0,
-    'a',0,
-    'g',0,
-    'e',0,
-    '-',0,
-    'd',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    's',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    'c',0,
-    'm',0,
-    'd',0,
-    ',',0,
-    'f',0,
-    'l',0,
-    'g',0,
-    ',',0,
-    's',0,
-    't',0,
-    'a',0,
-    'm',0,
-    'p',0,
-    ',',0,
-    'f',0,
-    'r',0,
-    'e',0,
-    'e',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'l',0,
-    'o',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'h',0,
-    'i',0,
-    ',',0,
-    'd',0,
-    'a',0,
-    't',0,
-    'a',0
-  };
-
-  CODE const char Str8Desc[] = {  /* EP1 OUT descriptor */
-    136,0x03,
-    'E',0,
-    'P',0,
-    '2',0,
-    'O',0,
-    'U',0,
-    'T',0,
-    '-',0,
-    's',0,
-    'e',0,
-    'n',0,
-    'd',0,
+    'C',0,
+    'A',0,
+    'N',0,
     ' ',0,
     'm',0,
     'e',0,
     's',0,
     'a',0,
     'g',0,
-    'e',0,
-    '-',0,
-    'd',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    's',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    'c',0,
-    'm',0,
-    'd',0,
-    ',',0,
-    'f',0,
-    'l',0,
-    'g',0,
-    ',',0,
-    's',0,
-    't',0,
-    'a',0,
-    'm',0,
-    'p',0,
-    ',',0,
-    'f',0,
-    'r',0,
-    'e',0,
-    'e',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'l',0,
-    'o',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'h',0,
-    'i',0,
-    ',',0,
-    'd',0,
-    'a',0,
-    't',0,
-    'a',0
+    'e',0
   };
 
-  #define CNT_STRINGS 0x09
-
   /* all strings in pointers array */
   CODE const PUSB_STRING_DESCRIPTOR StringDescriptors[] = {
     (PUSB_STRING_DESCRIPTOR) Str0Desc,
     (PUSB_STRING_DESCRIPTOR) Str5Desc,
     (PUSB_STRING_DESCRIPTOR) Str6Desc,
     (PUSB_STRING_DESCRIPTOR) Str7Desc,
-    (PUSB_STRING_DESCRIPTOR) Str8Desc
+  };
+
+  #define CNT_STRINGS (sizeof(StringDescriptors)/sizeof(StringDescriptors[0]))
+
+  CODE const USB_DEVICE_CONFIGURATION_ENTRY usb_devdes_configurations[] = {
+    {
+      .pConfigDescription = &ConfigDescription.configuration,
+      .iConfigTotalLength = CONFIG_DESCRIPTOR_LENGTH
+    }
+  };
+
+  CODE const USB_INTERFACE_DESCRIPTOR *usb_devdes_interfaces[] = {
+    &ConfigDescription.interface
+  };
+
+  CODE const USB_DEVICE_DESCRIPTORS_TABLE usb_devdes_table = {
+    .pDeviceDescription = &DeviceDescription,
+    .pConfigurations = usb_devdes_configurations,
+    .pInterfaceDescriptors = usb_devdes_interfaces,
+    .pStrings = StringDescriptors,
+    .iNumStrings = CNT_STRINGS,
+    .bNumEndpoints = NUM_ENDPOINTS,
+    .bNumConfigurations = 1,
+    .bNumInterfaces = 1
   };
 
 #endif /* USB_DEFS_MODULE */
diff --git a/embedded/app/usbcan/usb_srq.c b/embedded/app/usbcan/usb_srq.c
deleted file mode 100644 (file)
index 4299a83..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*****************************************************/
-/***   Module : USB module                         ***/
-/***   Author : Roman Bartosinski (C) 28.04.2002   ***/
-/***   Modify : 08.08.2002, 16.04.2003             ***/
-/*****************************************************/
-
-#include <string.h>
-#include <cpu_def.h>
-#include <system_def.h>
-#include <usb/usb.h>
-#include <usb/usb_spec.h>
-#include <usb/usbdebug.h>
-#include <usb/usb_srq.h>
-#include <usb/usb_defs.h>
-#include <usb/lpcusb.h>
-
-//extern ul_dcnv_state_t ep1_dcnv_state;
-
-  // ****************************
-  int usb_stdreq_get_status( usb_device_t *udev)
-  {
-    unsigned char c,buf[2] = { 0, 0};
-    unsigned char epid = (unsigned char) udev->request.wIndex;
-    usb_ep_t *ep0 = &(udev->ep0);
-
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("GetStatus\n"));
-    switch( udev->request.bmRequestType & USB_RECIPIENT) {
-      case USB_RECIPIENT_DEVICE:
-        if ( udev->flags & USB_FLAG_REMOTE_WAKE) //.remote_wake_up == 1)
-          buf[0] = USB_GETSTATUS_REMOTE_WAKEUP_ENABLED | USB_GETSTATUS_SELF_POWERED;
-        else
-          buf[0] = USB_GETSTATUS_SELF_POWERED;
-        break;
-      case USB_RECIPIENT_INTERFACE:
-        break;
-      case USB_RECIPIENT_ENDPOINT:
-/*        if ( epid & USB_ENDPOINT_DIRECTION_MASK)
-          c = pdiSelectEp(pdiEp2Idx(epid)); // endpoint in
-        else
-          c = pdiSelectEp(pdiEp2Idx(epid));     // endpoint Out
-          #ifdef PDIUSBD12
-          buf[0] = (( c & PDI_SELEP_STALL) == PDI_SELEP_STALL);
-          #else
-          buf[0] = 0;
-          #endif*/
-        break;
-      default:
-        return USB_COMPLETE_FAIL;
-    }
-    usb_udev_write_endpoint( ep0, buf, 2);
-    return USB_COMPLETE_OK;
-  }
-
-  int usb_stdreq_clear_feature( usb_device_t *udev)
-  {
-    USB_DEVICE_REQUEST *dreq = &(udev->request);
-    unsigned char epid = (unsigned char) dreq->wIndex;
-
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("ClearFeature\n"));
-    switch( dreq->bmRequestType & USB_RECIPIENT) {
-      case USB_RECIPIENT_DEVICE:
-        if ( dreq->wValue == USB_FEATURE_REMOTE_WAKEUP) {
-          udev->flags &= ~USB_FLAG_REMOTE_WAKE; //.remote_wake_up = 0;
-          usb_udev_ack_setup( udev);
-          return USB_COMPLETE_OK;
-        }
-        break;
-      case USB_RECIPIENT_ENDPOINT:
-        if ( dreq->wValue == USB_FEATURE_ENDPOINT_STALL) {
-          lpc_usb_clrstallEP(epid);
-          usb_udev_ack_setup( udev);
-         //initialize state of ulan convertor
-         switch (epid&(USB_ENDPOINT_DIRECTION_MASK|0x03)) {
-           case 0x01:                          //rx USB -> tx ulan
-//           ul_freemsg(ep1_dcnv_state.tx_fd);
-//              ep1_dcnv_state.tx_2send=-1;
-             break;
-           case 0x81:                          //tx USB -> rx ulan
-//           ul_freemsg(ep1_dcnv_state.rx_fd);
-//              ep1_dcnv_state.rx_2rec=-1;
-//              ep1_dcnv_state.rx_wait4host=0;
-             break;
-         }
-          return USB_COMPLETE_OK;
-        }
-        break;
-    }
-    return USB_COMPLETE_FAIL;
-  }
-
-  int usb_stdreq_set_feature( usb_device_t *udev)
-  {
-    USB_DEVICE_REQUEST *dreq = &(udev->request);
-    unsigned char epid = (unsigned char) dreq->wIndex;
-
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("SetFeature\n"));
-    switch( dreq->bmRequestType & USB_RECIPIENT) {
-      case USB_RECIPIENT_DEVICE:
-        if ( dreq->wValue == USB_FEATURE_REMOTE_WAKEUP) {
-          udev->flags |= USB_FLAG_REMOTE_WAKE; //.remote_wake_up = 1;
-          lpc_usb_setstallEP (epid);
-          usb_udev_ack_setup( udev);
-          return USB_COMPLETE_OK;
-        }
-        break;
-      case USB_RECIPIENT_ENDPOINT:
-        if ( dreq->wValue == USB_FEATURE_ENDPOINT_STALL) {
-          usb_udev_ack_setup( udev);
-          return USB_COMPLETE_OK;
-        }
-        break;
-    }
-    return USB_COMPLETE_FAIL;
-  }
-
-  int usb_stdreq_set_address( usb_device_t *udev)
-  {
-    int adr;
-    USB_DEVICE_REQUEST *dreq = &(udev->request);
-    adr=dreq->wValue & DEVICE_ADDRESS_MASK;
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("SetAddr-%d\n",adr));
-    usb_udev_ack_setup( udev);
-    lpc_usb_set_addr(adr);
-    return USB_COMPLETE_OK;
-  }
-
-  int usb_stdreq_get_configuration( usb_device_t *udev)
-  {
-    unsigned char buf = udev->configuration; //usb_flags.configured;
-    usb_ep_t *ep0 = &(udev->ep0);
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("GetConfig\n"));
-    usb_udev_write_endpoint( ep0, &buf, 1);
-    return USB_COMPLETE_OK;
-  }
-
-  int usb_stdreq_set_configuration( usb_device_t *udev)
-  {
-    USB_DEVICE_REQUEST *dreq = &(udev->request);
-    unsigned char iCfg = dreq->wValue & 0xff;
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("SetConfig\n"));
-    if ( iCfg < 2) {       // put device in unconfigured state or set configuration 1 ( no else)
-      usb_udev_ack_setup( udev);
-      lpc_usb_config_device(iCfg);
-      if ( iCfg) {
-        udev->flags |= USB_FLAG_CONFIGURED;
-        lpc_usb_configEP(0x01,USB_MAX_PACKET0);
-        lpc_usb_configEP(0x81,USB_MAX_PACKET0);
-      } else {
-        udev->flags &= ~USB_FLAG_CONFIGURED;
-      }
-      udev->configuration = iCfg;  //usb_flags.configured = iCfg;
-      return USB_COMPLETE_OK;
-    } else
-      return USB_COMPLETE_FAIL;
-  }
-
-  int usb_stdreq_get_interface( usb_device_t *udev)
-  {
-    unsigned char buf = 0; /// udev->interface
-    usb_ep_t *ep0 = &(udev->ep0);
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("GetIface\n"));
-    usb_udev_write_endpoint( ep0, &buf, 1);
-    return USB_COMPLETE_OK;
-  }
-
-  int usb_stdreq_set_interface( usb_device_t *udev)
-  {
-    USB_DEVICE_REQUEST *dreq = &(udev->request);
-
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("SetIface\n"));
-    if (( dreq->wValue == 0) && ( dreq->wIndex == 0)) {
-      usb_udev_ack_setup( udev);
-      return USB_COMPLETE_OK;
-    } else {
-      return USB_COMPLETE_FAIL;
-    }
-  }
-
-  int usb_stdreq_get_descriptor( usb_device_t *udev)
-  {
-    unsigned char *pDesc;
-    unsigned short Len = 0;
-    USB_DEVICE_REQUEST *dreq = &(udev->request);
-    int i;
-
-    i = (dreq->wValue >> 8) & 0xff; /* MSB part of wValue */
-    usb_debug_print( DEBUG_LEVEL_HIGH, ("GetDesc\n"));
-    usb_debug_print( DEBUG_LEVEL_VERBOSE, ( " - %s desc.\n", /*(unsigned int)*/ usb_debug_get_std_descriptor(i)));
-
-    switch (i) {
-      case USB_DESCRIPTOR_TYPE_DEVICE:
-        pDesc = (unsigned char *)&DeviceDescription;
-        Len = sizeof( USB_DEVICE_DESCRIPTOR);
-        break;
-      case USB_DESCRIPTOR_TYPE_CONFIGURATION:
-        pDesc = (unsigned char *)&ConfigDescription;
-        Len = CONFIG_DESCRIPTOR_LENGTH;
-        break;
-      case USB_DESCRIPTOR_TYPE_INTERFACE:
-        pDesc = (unsigned char *)&ConfigDescription.interface;
-        Len = sizeof( USB_INTERFACE_DESCRIPTOR);
-        break;
-      case USB_DESCRIPTOR_TYPE_STRING:
-        i = dreq->wValue & 0xff; /* LSB part of wValue */
-        /*printf("Get descriptor indx=0x%02x\n", i);*/
-        if ( i < CNT_STRINGS) {
-          pDesc = (unsigned char *) StringDescriptors[ i];
-          Len = *pDesc;
-          /*usb_debug_print(0,("indx=0x%02x ptr=%p len=%d : '%c'\n", i, pDesc, Len, pDesc[2]));*/
-        } else {
-          return USB_COMPLETE_FAIL;
-        }
-        break;
-      default:
-        return USB_COMPLETE_FAIL;
-    }
-    if ( dreq->wLength < Len) Len = dreq->wLength;
-    usb_send_control_data( udev, pDesc, Len);
-    return USB_COMPLETE_OK;
-  }
-
-
-/*
-  void usb_init_stdreq_fnc( usb_device_t *udev)
-  {
-    // memset( udev->stdreq, 0, sizeof(udev->stdreq));
-
-    udev->stdreq[USB_REQUEST_GET_STATUS] = usb_stdreq_get_status;
-    udev->stdreq[USB_REQUEST_CLEAR_FEATURE] = usb_stdreq_clear_feature;
-    udev->stdreq[USB_REQUEST_SET_FEATURE] = usb_stdreq_set_feature;
-    udev->stdreq[USB_REQUEST_SET_ADDRESS] = usb_stdreq_set_address;
-    udev->stdreq[USB_REQUEST_GET_DESCRIPTOR] = usb_stdreq_get_descriptor;
-    udev->stdreq[USB_REQUEST_GET_CONFIGURATION] = usb_stdreq_get_configuration;
-    udev->stdreq[USB_REQUEST_SET_CONFIGURATION] = usb_stdreq_set_configuration;
-    udev->stdreq[USB_REQUEST_GET_INTERFACE] = usb_stdreq_get_interface;
-    udev->stdreq[USB_REQUEST_SET_INTERFACE] = usb_stdreq_set_interface;
-  }
-*/
index cc5d422..b3ee364 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_KEYVAL=y
 #CONFIG_APP_U2U=y
 #CONFIG_APP_U2U_V2=y
 CONFIG_USB_BASE=y
+CONFIG_USB_MORE=y
 CONFIG_USB_LPCUSB=y
 CONFIG_APP_USBCAN=y
 #CONFIG_APP_USBBOOT=y
@@ -54,10 +55,21 @@ PROG_SIZE=0x20000
 UL_SENDHEX ?= ul_sendhex
 MOD ?= 3
 
-LOAD_CMD-app = \
+LOAD_CMD-app-ulan = \
     $(UL_SENDHEX) -m $(MOD) -r -o 0 ; \
     $(UL_SENDHEX) -m $(MOD) -o 0 -t 0x101 -s $(PROG_BASE) -l $(PROG_SIZE) -e; \
     $(UL_SENDHEX) -m $(MOD) -o 0 -t 0x101 -b 256 -s $(PROG_BASE) -f binary
 
-RUN_CMD-app = \
+RUN_CMD-app-ulan = \
     $(UL_SENDHEX) -m $(MOD) -g $(PROG_BASE)
+
+USB_SENDHEX ?= usb_sendhex
+USB_VID ?= dead
+USB_PID ?= 2263
+
+LOAD_CMD-app = \
+    $(USB_SENDHEX) -d $(USB_VID):$(USB_PID) -s $(PROG_BASE) -l $(PROG_SIZE) -e; sleep 2 ; \
+    $(USB_SENDHEX) -d $(USB_VID):$(USB_PID) -s $(PROG_BASE) -f binary
+
+RUN_CMD-app = \
+    $(USB_SENDHEX) -r