Fixes for New USB stack

This commit is contained in:
NIIBE Yutaka
2012-05-11 09:28:04 +09:00
parent ab8a3eed29
commit a0a1b8177b
7 changed files with 42 additions and 23 deletions

View File

@@ -1,5 +1,15 @@
2012-05-11 Niibe Yutaka <gniibe@fsij.org> 2012-05-11 Niibe Yutaka <gniibe@fsij.org>
* src/usb_prop.c (vcom_port_setup_with_nodata) Rename.
(vcom_port_data_setup): Rename and fix return value.
* src/usb-cdc.h (VIRTUAL_COM_PORT_DATA_SIZE)
(VIRTUAL_COM_PORT_INT_SIZE): New.
* src/main.c (#include): Add usb-cdc.h.
* src/usb_desc.c (#include): Add usb-cdc.h.
* src/usb_endp.c (#include): Add usb_lld.h.
* src/configure ($help): Add FST_01. * src/configure ($help): Add FST_01.
2012-05-10 Niibe Yutaka <gniibe@fsij.org> 2012-05-10 Niibe Yutaka <gniibe@fsij.org>

2
GNUK_USB_DEVICE_ID Normal file
View File

@@ -0,0 +1,2 @@
# VID:PID bcdDev Product_STRING Vender_STRING
234b:0000 0200 FSIJ USB Token Free Software Initiative of Japan

View File

@@ -25,6 +25,7 @@
#include "ch.h" #include "ch.h"
#include "gnuk.h" #include "gnuk.h"
#include "usb_lld.h" #include "usb_lld.h"
#include "usb-cdc.h"
#ifdef DEBUG #ifdef DEBUG
struct stdout { struct stdout {

View File

@@ -5,3 +5,6 @@
#define USB_CDC_REQ_GET_LINE_CODING 0x21 #define USB_CDC_REQ_GET_LINE_CODING 0x21
#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
#define USB_CDC_REQ_SEND_BREAK 0x23 #define USB_CDC_REQ_SEND_BREAK 0x23
#define VIRTUAL_COM_PORT_DATA_SIZE 16
#define VIRTUAL_COM_PORT_INT_SIZE 8

View File

@@ -6,6 +6,7 @@
#include "ch.h" #include "ch.h"
#include "usb_lld.h" #include "usb_lld.h"
#include "usb_conf.h" #include "usb_conf.h"
#include "usb-cdc.h"
#define USB_ICC_INTERFACE_CLASS 0x0B #define USB_ICC_INTERFACE_CLASS 0x0B
#define USB_ICC_INTERFACE_SUBCLASS 0x00 #define USB_ICC_INTERFACE_SUBCLASS 0x00

View File

@@ -5,6 +5,7 @@
#include "config.h" #include "config.h"
#include "ch.h" #include "ch.h"
#include "gnuk.h" #include "gnuk.h"
#include "usb_lld.h"
void void
EP3_IN_Callback (void) EP3_IN_Callback (void)

View File

@@ -48,19 +48,18 @@ static const struct line_coding line_coding = {
}; };
static void static void
Virtual_Com_Port_Data_Setup (uint8_t RequestNo) vcom_port_data_setup (uint8_t RequestNo)
{ {
if (RequestNo != USB_CDC_REQ_GET_LINE_CODING) if (RequestNo != USB_CDC_REQ_GET_LINE_CODING)
return USB_UNSUPPORT; return;
/* RequestNo == USB_CDC_REQ_SET_LINE_CODING is not supported */ /* RequestNo == USB_CDC_REQ_SET_LINE_CODING is not supported */
usb_lld_set_data_to_send (&line_coding, sizeof(line_coding)); usb_lld_set_data_to_send (&line_coding, sizeof(line_coding));
return USB_SUCCESS;
} }
static int static int
Virtual_Com_Port_NoData_Setup (uint8_t RequestNo) vcom_port_setup_with_nodata (uint8_t RequestNo)
{ {
if (RequestNo == USB_CDC_REQ_SET_CONTROL_LINE_STATE) if (RequestNo == USB_CDC_REQ_SET_CONTROL_LINE_STATE)
/* Do nothing and success */ /* Do nothing and success */
@@ -184,29 +183,31 @@ static void
gnuk_setup_with_data (uint8_t recipient, uint8_t RequestNo, uint16_t index) gnuk_setup_with_data (uint8_t recipient, uint8_t RequestNo, uint16_t index)
{ {
if (recipient == (CLASS_REQUEST | INTERFACE_RECIPIENT)) /* Interface */ if (recipient == (CLASS_REQUEST | INTERFACE_RECIPIENT)) /* Interface */
if (index == 0) {
{ if (index == 0)
if (RequestNo == USB_CCID_REQ_GET_CLOCK_FREQUENCIES) {
usb_lld_set_data_to_send (freq_table, sizeof (freq_table)); if (RequestNo == USB_CCID_REQ_GET_CLOCK_FREQUENCIES)
else if (RequestNo == USB_CCID_REQ_GET_DATA_RATES) usb_lld_set_data_to_send (freq_table, sizeof (freq_table));
usb_lld_set_data_to_send (data_rate_table, sizeof (data_rate_table)); else if (RequestNo == USB_CCID_REQ_GET_DATA_RATES)
} usb_lld_set_data_to_send (data_rate_table, sizeof (data_rate_table));
}
#if defined(PINPAD_DND_SUPPORT) #if defined(PINPAD_DND_SUPPORT)
# if defined(ENABLE_VIRTUAL_COM_PORT) # if defined(ENABLE_VIRTUAL_COM_PORT)
else if (index == 1) else if (index == 1)
Virtual_Com_Port_Data_Setup (RequestNo); vcom_port_data_setup (RequestNo);
else if (index == 3) else if (index == 3)
# else # else
else if (index == 1) else if (index == 1)
# endif # endif
{ {
if (RequestNo == MSC_GET_MAX_LUN_COMMAND) if (RequestNo == MSC_GET_MAX_LUN_COMMAND)
usb_lld_set_data_to_send (lun_table, sizeof (lun_table)); usb_lld_set_data_to_send (lun_table, sizeof (lun_table));
} }
#elif defined(ENABLE_VIRTUAL_COM_PORT) #elif defined(ENABLE_VIRTUAL_COM_PORT)
else if (index == 1) else if (index == 1)
Virtual_Com_Port_Data_Setup (RequestNo); vcom_port_data_setup (RequestNo);
#endif #endif
}
} }
@@ -226,7 +227,7 @@ gnuk_setup_with_nodata (uint8_t recipient, uint8_t RequestNo, uint16_t index)
#if defined(PINPAD_DND_SUPPORT) #if defined(PINPAD_DND_SUPPORT)
# if defined(ENABLE_VIRTUAL_COM_PORT) # if defined(ENABLE_VIRTUAL_COM_PORT)
else if (index == 1) else if (index == 1)
return Virtual_Com_Port_NoData_Setup (RequestNo); return vcom_port_setup_with_nodata (RequestNo);
else if (index == 3) else if (index == 3)
# else # else
else if (index == 1) else if (index == 1)
@@ -242,7 +243,7 @@ gnuk_setup_with_nodata (uint8_t recipient, uint8_t RequestNo, uint16_t index)
} }
#elif defined(ENABLE_VIRTUAL_COM_PORT) #elif defined(ENABLE_VIRTUAL_COM_PORT)
else if (index == 1) else if (index == 1)
return Virtual_Com_Port_NoData_Setup (RequestNo); return vcom_port_setup_with_nodata (RequestNo);
#endif #endif
else else
return USB_UNSUPPORT; return USB_UNSUPPORT;