mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
USB: add central file to define USB IDs, classes, and endpoints
Change-Id: Iba81f32a92c68a973e8e7adbc4c2a1064ba5290f
This commit is contained in:
@@ -28,7 +28,7 @@ static const USBDeviceDescriptor fsDevice = {
|
||||
.bDeviceClass = 0,
|
||||
.bDeviceSubClass = 0,
|
||||
.bDeviceProtocol = 0,
|
||||
.bMaxPacketSize0 = BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
|
||||
.bMaxPacketSize0 = USBEndpointDescriptor_MAXCTRLSIZE_FS,
|
||||
.idVendor = BOARD_USB_VENDOR_ID,
|
||||
.idProduct = BOARD_DFU_USB_PRODUCT_ID,
|
||||
.bcdDevice = BOARD_USB_RELEASE,
|
||||
|
||||
@@ -108,21 +108,6 @@
|
||||
// D+ has external pull-up
|
||||
#define BOARD_USB_PULLUP_EXTERNAL
|
||||
|
||||
#define BOARD_USB_NUMENDPOINTS 8
|
||||
|
||||
// FIXME: in all other cases return 0?
|
||||
#define BOARD_USB_ENDPOINTS_MAXPACKETSIZE(i) (((i == 4) || (i == 5))? 512 : 64)
|
||||
#define BOARD_USB_ENDPOINTS_BANKS(i) (((i == 0) || (i == 3)) ? 1 : 2)
|
||||
|
||||
#define USB_VENDOR_OPENMOKO 0x1d50
|
||||
#define USB_PRODUCT_OWHW_SAM3_DFU 0x4001 /* was 0x4000 */
|
||||
#define USB_PRODUCT_OWHW_SAM3 0x4001
|
||||
#define USB_PRODUCT_QMOD_HUB 0x4002
|
||||
#define USB_PRODUCT_QMOD_SAM3_DFU 0x4004 /* was 0x4003 */
|
||||
#define USB_PRODUCT_QMOD_SAM3 0x4004
|
||||
#define USB_PRODUCT_SIMTRACE2_DFU 0x60e3 /* was 0x60e2 */
|
||||
#define USB_PRODUCT_SIMTRACE2 0x60e3
|
||||
|
||||
#define BOARD_USB_DFU
|
||||
#define BOARD_DFU_BOOT_SIZE (16 * 1024)
|
||||
#define BOARD_DFU_RAM_SIZE (2 * 1024)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
#include "simtrace_usb.h"
|
||||
|
||||
/** Name of the board */
|
||||
#define BOARD_NAME "OWHW"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
#include "simtrace_usb.h"
|
||||
|
||||
#define LED_USIM1 LED_GREEN
|
||||
#define LED_USIM2 LED_RED
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
#include "simtrace_usb.h"
|
||||
|
||||
/* Name of the board */
|
||||
#define BOARD_NAME "SAM3S-SIMTRACE"
|
||||
|
||||
@@ -5,21 +5,8 @@
|
||||
#include "board.h"
|
||||
#include <usb/device/dfu/dfu.h>
|
||||
|
||||
/* Endpoint numbers */
|
||||
#define DATAOUT 1
|
||||
#define DATAIN 2
|
||||
#define INT 3
|
||||
|
||||
#define BUFLEN 512
|
||||
|
||||
#define PHONE_DATAOUT 4
|
||||
#define PHONE_DATAIN 5
|
||||
#define PHONE_INT 6
|
||||
|
||||
#define CARDEM_USIM2_DATAOUT DATAOUT
|
||||
#define CARDEM_USIM2_DATAIN DATAIN
|
||||
#define CARDEM_USIM2_INT INT
|
||||
|
||||
#define CLK_MASTER true
|
||||
#define CLK_SLAVE false
|
||||
|
||||
|
||||
66
firmware/libcommon/include/simtrace_usb.h
Normal file
66
firmware/libcommon/include/simtrace_usb.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* (C) 2018 by Kevin Redon <kredon@sysmocom.de>
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
/* SIMtrace USB IDs */
|
||||
#define USB_VENDOR_OPENMOKO 0x1d50
|
||||
#define USB_PRODUCT_OWHW_SAM3_DFU 0x4001 /* was 0x4000 */
|
||||
#define USB_PRODUCT_OWHW_SAM3 0x4001
|
||||
#define USB_PRODUCT_QMOD_HUB 0x4002
|
||||
#define USB_PRODUCT_QMOD_SAM3_DFU 0x4004 /* was 0x4003 */
|
||||
#define USB_PRODUCT_QMOD_SAM3 0x4004
|
||||
#define USB_PRODUCT_SIMTRACE2_DFU 0x60e3 /* was 0x60e2 */
|
||||
#define USB_PRODUCT_SIMTRACE2 0x60e3
|
||||
|
||||
/* USB proprietary class */
|
||||
#define USB_CLASS_PROPRIETARY 0xff
|
||||
|
||||
/* SIMtrace USB sub-classes */
|
||||
/*! Sniffer USB sub-class */
|
||||
#define SIMTRACE_SNIFFER_USB_SUBCLASS 1
|
||||
/*! Card-emulation USB sub-class */
|
||||
#define SIMTRACE_CARDEM_USB_SUBCLASS 2
|
||||
|
||||
/* Generic USB endpoint numbers */
|
||||
/*! Card-side USB data out (host to device) endpoint number */
|
||||
#define SIMTRACE_USB_EP_CARD_DATAOUT 1
|
||||
/*! Card-side USB data in (device to host) endpoint number */
|
||||
#define SIMTRACE_USB_EP_CARD_DATAIN 2
|
||||
/*! Card-side USB interrupt endpoint number */
|
||||
#define SIMTRACE_USB_EP_CARD_INT 3
|
||||
/*! Phone-side USB data out (host to device) endpoint number */
|
||||
#define SIMTRACE_USB_EP_PHONE_DATAOUT 4
|
||||
/*! Phone-side USB data in (device to host) endpoint number */
|
||||
#define SIMTRACE_USB_EP_PHONE_DATAIN 5
|
||||
/*! Phone-side USB interrupt endpoint number */
|
||||
#define SIMTRACE_USB_EP_PHONE_INT 6
|
||||
|
||||
/* Card-emulation USB endpoint numbers */
|
||||
/*! USIM1 USB data out (host to device) endpoint number */
|
||||
#define SIMTRACE_CARDEM_USB_EP_USIM1_DATAOUT 4
|
||||
/*! USIM1 USB data in (device to host) endpoint number */
|
||||
#define SIMTRACE_CARDEM_USB_EP_USIM1_DATAIN 5
|
||||
/*! USIM1 USB interrupt endpoint number */
|
||||
#define SIMTRACE_CARDEM_USB_EP_USIM1_INT 6
|
||||
/*! USIM2 USB data out (host to device) endpoint number */
|
||||
#define SIMTRACE_CARDEM_USB_EP_USIM2_DATAOUT 1
|
||||
/*! USIM2 USB data in (device to host) endpoint number */
|
||||
#define SIMTRACE_CARDEM_USB_EP_USIM2_DATAIN 2
|
||||
/*! USIM2 USB interrupt endpoint number */
|
||||
#define SIMTRACE_CARDEM_USB_EP_USIM2_INT 3
|
||||
|
||||
/*! Maximum number of endpoints */
|
||||
#define BOARD_USB_NUMENDPOINTS 6
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <osmocom/core/msgb.h>
|
||||
#include "llist_irqsafe.h"
|
||||
#include "usb_buf.h"
|
||||
#include "simtrace_usb.h"
|
||||
#include "simtrace_prot.h"
|
||||
#include "sim_switch.h"
|
||||
|
||||
@@ -54,9 +55,9 @@ struct cardem_inst cardem_inst[] = {
|
||||
.id = ID_USART1,
|
||||
.state = USART_RCV
|
||||
},
|
||||
.ep_out = PHONE_DATAOUT,
|
||||
.ep_in = PHONE_DATAIN,
|
||||
.ep_int = PHONE_INT,
|
||||
.ep_out = SIMTRACE_CARDEM_USB_EP_USIM1_DATAOUT,
|
||||
.ep_in = SIMTRACE_CARDEM_USB_EP_USIM1_DATAIN,
|
||||
.ep_int = SIMTRACE_CARDEM_USB_EP_USIM1_INT,
|
||||
#ifdef PIN_SET_USIM1_PRES
|
||||
.pin_insert = PIN_SET_USIM1_PRES,
|
||||
#endif
|
||||
@@ -69,9 +70,9 @@ struct cardem_inst cardem_inst[] = {
|
||||
.id = ID_USART0,
|
||||
.state = USART_RCV
|
||||
},
|
||||
.ep_out = CARDEM_USIM2_DATAOUT,
|
||||
.ep_in = CARDEM_USIM2_DATAIN,
|
||||
.ep_int = CARDEM_USIM2_INT,
|
||||
.ep_out = SIMTRACE_CARDEM_USB_EP_USIM2_DATAOUT,
|
||||
.ep_in = SIMTRACE_CARDEM_USB_EP_USIM2_DATAIN,
|
||||
.ep_int = SIMTRACE_CARDEM_USB_EP_USIM2_INT,
|
||||
#ifdef PIN_SET_USIM2_PRES
|
||||
.pin_insert = PIN_SET_USIM2_PRES,
|
||||
#endif
|
||||
@@ -391,7 +392,7 @@ void mode_cardemu_init(void)
|
||||
PIO_ConfigureIt(&pin_usim1_vcc, usim1_vcc_irqhandler);
|
||||
PIO_EnableIt(&pin_usim1_vcc);
|
||||
#endif /* DETECT_VCC_BY_ADC */
|
||||
cardem_inst[0].ch = card_emu_init(0, 2, 0, PHONE_DATAIN, PHONE_INT);
|
||||
cardem_inst[0].ch = card_emu_init(0, 2, 0, SIMTRACE_CARDEM_USB_EP_USIM1_DATAIN, SIMTRACE_CARDEM_USB_EP_USIM1_INT);
|
||||
sim_switch_use_physical(0, 1);
|
||||
|
||||
#ifdef CARDEMU_SECOND_UART
|
||||
@@ -406,7 +407,7 @@ void mode_cardemu_init(void)
|
||||
PIO_ConfigureIt(&pin_usim2_vcc, usim2_vcc_irqhandler);
|
||||
PIO_EnableIt(&pin_usim2_vcc);
|
||||
#endif /* DETECT_VCC_BY_ADC */
|
||||
cardem_inst[1].ch = card_emu_init(1, 0, 1, CARDEM_USIM2_DATAIN, CARDEM_USIM2_INT);
|
||||
cardem_inst[1].ch = card_emu_init(1, 0, 1, SIMTRACE_CARDEM_USB_EP_USIM2_DATAIN, SIMTRACE_CARDEM_USB_EP_USIM2_INT);
|
||||
sim_switch_use_physical(1, 1);
|
||||
#endif /* CARDEMU_SECOND_UART */
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "board.h"
|
||||
#include "simtrace.h"
|
||||
#include "simtrace_usb.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "iso7816_fidi.h"
|
||||
|
||||
@@ -67,7 +68,7 @@ void ISR_PhoneRST(const Pin * pPin)
|
||||
}
|
||||
|
||||
if ((ret =
|
||||
USBD_Write(PHONE_INT, "R", 1,
|
||||
USBD_Write(SIMTRACE_USB_EP_PHONE_INT, "R", 1,
|
||||
(TransferCallback) & Callback_PhoneRST_ISR,
|
||||
0)) != USBD_STATUS_SUCCESS) {
|
||||
TRACE_ERROR("USB err status: %d (%s)\n", ret, __FUNCTION__);
|
||||
|
||||
@@ -33,15 +33,13 @@
|
||||
|
||||
#include "board.h"
|
||||
#include "simtrace.h"
|
||||
#include "simtrace_usb.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <cciddriverdescriptors.h>
|
||||
#include <usb/common/dfu/usb_dfu.h>
|
||||
#include <usb/device/dfu/dfu.h>
|
||||
|
||||
#define SIMTRACE_SUBCLASS_SNIFFER 1
|
||||
#define SIMTRACE_SUBCLASS_CARDEM 2
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* USB String descriptors
|
||||
*------------------------------------------------------------------------------*/
|
||||
@@ -94,8 +92,8 @@ static const SIMTraceDriverConfigurationDescriptorSniffer
|
||||
.bInterfaceNumber = 0,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 3,
|
||||
.bInterfaceClass = 0xff,
|
||||
.bInterfaceSubClass = SIMTRACE_SUBCLASS_SNIFFER,
|
||||
.bInterfaceClass = USB_CLASS_PROPRIETARY,
|
||||
.bInterfaceSubClass = SIMTRACE_SNIFFER_USB_SUBCLASS,
|
||||
.bInterfaceProtocol = 0,
|
||||
.iInterface = SNIFFER_CONF_STR,
|
||||
},
|
||||
@@ -105,11 +103,9 @@ static const SIMTraceDriverConfigurationDescriptorSniffer
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_OUT,
|
||||
PHONE_DATAOUT),
|
||||
SIMTRACE_USB_EP_CARD_DATAOUT),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
PHONE_DATAOUT),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0,
|
||||
},
|
||||
/* Bulk-IN endpoint descriptor */
|
||||
@@ -118,11 +114,9 @@ static const SIMTraceDriverConfigurationDescriptorSniffer
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
PHONE_DATAIN),
|
||||
SIMTRACE_USB_EP_CARD_DATAIN),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
PHONE_DATAIN),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0,
|
||||
},
|
||||
// Notification endpoint descriptor
|
||||
@@ -131,11 +125,9 @@ static const SIMTraceDriverConfigurationDescriptorSniffer
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
PHONE_INT),
|
||||
SIMTRACE_USB_EP_CARD_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
PHONE_INT),
|
||||
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(1, 0),
|
||||
@@ -205,9 +197,7 @@ static const CCIDDriverConfigurationDescriptors configurationDescriptorCCID = {
|
||||
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
|
||||
CCID_EPT_DATA_OUT),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
CCID_EPT_DATA_OUT),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0x00,
|
||||
},
|
||||
// Bulk-IN endpoint descriptor
|
||||
@@ -218,9 +208,7 @@ static const CCIDDriverConfigurationDescriptors configurationDescriptorCCID = {
|
||||
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
|
||||
CCID_EPT_DATA_IN),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
CCID_EPT_DATA_IN),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.bInterval = 0x00,
|
||||
},
|
||||
// Notification endpoint descriptor
|
||||
@@ -231,9 +219,7 @@ static const CCIDDriverConfigurationDescriptors configurationDescriptorCCID = {
|
||||
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
|
||||
CCID_EPT_NOTIFICATION),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
CCID_EPT_NOTIFICATION),
|
||||
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(1, 0),
|
||||
@@ -282,8 +268,8 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bInterfaceNumber = 0,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 3,
|
||||
.bInterfaceClass = 0xff,
|
||||
.bInterfaceSubClass = SIMTRACE_SUBCLASS_CARDEM,
|
||||
.bInterfaceClass = USB_CLASS_PROPRIETARY,
|
||||
.bInterfaceSubClass = SIMTRACE_CARDEM_USB_SUBCLASS,
|
||||
.bInterfaceProtocol = 0,
|
||||
.iInterface = CARDEM_USIM1_INTF_STR,
|
||||
},
|
||||
@@ -293,10 +279,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_OUT,
|
||||
PHONE_DATAOUT),
|
||||
SIMTRACE_CARDEM_USB_EP_USIM1_DATAOUT),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(PHONE_DATAOUT),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0 /* Must be 0 for full-speed bulk endpoints */
|
||||
},
|
||||
/* Bulk-IN endpoint descriptor */
|
||||
@@ -305,10 +290,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
PHONE_DATAIN),
|
||||
SIMTRACE_CARDEM_USB_EP_USIM1_DATAIN),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(PHONE_DATAIN),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0 /* Must be 0 for full-speed bulk endpoints */
|
||||
},
|
||||
/* Notification endpoint descriptor */
|
||||
@@ -317,10 +301,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
PHONE_INT),
|
||||
SIMTRACE_CARDEM_USB_EP_USIM1_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(PHONE_INT),
|
||||
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10
|
||||
},
|
||||
#ifdef CARDEMU_SECOND_UART
|
||||
@@ -331,8 +314,8 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bInterfaceNumber = 1,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 3,
|
||||
.bInterfaceClass = 0xff,
|
||||
.bInterfaceSubClass = SIMTRACE_SUBCLASS_CARDEM,
|
||||
.bInterfaceClass = USB_CLASS_PROPRIETARY,
|
||||
.bInterfaceSubClass = SIMTRACE_CARDEM_USB_SUBCLASS,
|
||||
.bInterfaceProtocol = 0,
|
||||
.iInterface = CARDEM_USIM2_INTF_STR,
|
||||
},
|
||||
@@ -342,10 +325,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_OUT,
|
||||
CARDEM_USIM2_DATAOUT),
|
||||
SIMTRACE_CARDEM_USB_EP_USIM2_DATAOUT),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CARDEM_USIM2_DATAOUT),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0 /* Must be 0 for full-speed bulk endpoints */
|
||||
}
|
||||
,
|
||||
@@ -355,10 +337,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
CARDEM_USIM2_DATAIN),
|
||||
SIMTRACE_CARDEM_USB_EP_USIM2_DATAIN),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CARDEM_USIM2_DATAIN),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0 /* Must be 0 for full-speed bulk endpoints */
|
||||
},
|
||||
/* Notification endpoint descriptor */
|
||||
@@ -367,10 +348,9 @@ static const SIMTraceDriverConfigurationDescriptorPhone
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
CARDEM_USIM2_INT),
|
||||
SIMTRACE_CARDEM_USB_EP_USIM2_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CARDEM_USIM2_INT),
|
||||
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(2, 0),
|
||||
@@ -466,9 +446,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
|
||||
CCID_EPT_DATA_OUT),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
CCID_EPT_DATA_OUT),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0x00,
|
||||
},
|
||||
// Bulk-IN endpoint descriptor
|
||||
@@ -479,9 +457,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
|
||||
CCID_EPT_DATA_IN),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
CCID_EPT_DATA_IN),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0x00,
|
||||
},
|
||||
// Notification endpoint descriptor
|
||||
@@ -492,9 +468,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
|
||||
CCID_EPT_NOTIFICATION),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(
|
||||
CCID_EPT_NOTIFICATION),
|
||||
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10,
|
||||
},
|
||||
|
||||
@@ -516,10 +490,9 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_OUT,
|
||||
PHONE_DATAOUT),
|
||||
SIMTRACE_USB_EP_PHONE_DATAOUT),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(PHONE_DATAOUT),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0, /* Must be 0 for full-speed bulk endpoints */
|
||||
},
|
||||
/* Bulk-IN endpoint descriptor */
|
||||
@@ -528,10 +501,9 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
PHONE_DATAIN),
|
||||
SIMTRACE_USB_EP_PHONE_DATAIN),
|
||||
.bmAttributes = USBEndpointDescriptor_BULK,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(PHONE_DATAIN),
|
||||
USBEndpointDescriptor_MAXBULKSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXBULKSIZE_FS,
|
||||
.bInterval = 0, /* Must be 0 for full-speed bulk endpoints */
|
||||
},
|
||||
/* Notification endpoint descriptor */
|
||||
@@ -540,10 +512,9 @@ static const SIMTraceDriverConfigurationDescriptorMITM
|
||||
.bDescriptorType = USBGenericDescriptor_ENDPOINT,
|
||||
.bEndpointAddress = USBEndpointDescriptor_ADDRESS(
|
||||
USBEndpointDescriptor_IN,
|
||||
PHONE_INT),
|
||||
SIMTRACE_USB_EP_PHONE_INT),
|
||||
.bmAttributes = USBEndpointDescriptor_INTERRUPT,
|
||||
.wMaxPacketSize = MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(PHONE_INT),
|
||||
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
|
||||
.wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS,
|
||||
.bInterval = 0x10
|
||||
},
|
||||
DFURT_IF_DESCRIPTOR(2, 0),
|
||||
@@ -573,7 +544,7 @@ const USBDeviceDescriptor deviceDescriptor = {
|
||||
.bDeviceClass = 0,
|
||||
.bDeviceSubClass = 0,
|
||||
.bDeviceProtocol = 0,
|
||||
.bMaxPacketSize0 = BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
|
||||
.bMaxPacketSize0 = 64,
|
||||
.idVendor = BOARD_USB_VENDOR_ID,
|
||||
.idProduct = BOARD_USB_PRODUCT_ID,
|
||||
.bcdDevice = 2, /* Release number */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
#include "usb_buf.h"
|
||||
#include "simtrace_usb.h"
|
||||
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/msgb.h>
|
||||
|
||||
Reference in New Issue
Block a user