summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack/usb_serial.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2009-04-18 20:04:52 +0000
committerFrank Gevaerts <frank@gevaerts.be>2009-04-18 20:04:52 +0000
commitab09322b7acfa1667f3124612735ea83ce5342d5 (patch)
treec3b35f6bc62e95dfc7b1ac6840564f24e4bca557 /firmware/usbstack/usb_serial.c
parent8b6b46f3c47aa3772598b359b43e3efe1138e9e6 (diff)
downloadrockbox-ab09322b7acfa1667f3124612735ea83ce5342d5.tar.gz
rockbox-ab09322b7acfa1667f3124612735ea83ce5342d5.tar.bz2
rockbox-ab09322b7acfa1667f3124612735ea83ce5342d5.zip
Add a PACK_DESCRIPTOR macro to make the class drivers a bit more readable (FS#10145 by Tomer Shalev)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20733 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_serial.c')
-rw-r--r--firmware/usbstack/usb_serial.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/firmware/usbstack/usb_serial.c b/firmware/usbstack/usb_serial.c
index b7d5062237..514df0dc2b 100644
--- a/firmware/usbstack/usb_serial.c
+++ b/firmware/usbstack/usb_serial.c
@@ -24,7 +24,7 @@
#include "usb_drv.h"
#include "kernel.h"
#include "usb_serial.h"
-
+#include "usb_class_driver.h"
//#define LOGF_ENABLE
#include "logf.h"
@@ -102,19 +102,16 @@ int usb_serial_get_config_descriptor(unsigned char *dest,int max_packet_size)
{
unsigned char *orig_dest = dest;
- endpoint_descriptor.wMaxPacketSize=max_packet_size;
- interface_descriptor.bInterfaceNumber=usb_interface;
+ interface_descriptor.bInterfaceNumber = usb_interface;
+ PACK_DESCRIPTOR(dest, interface_descriptor);
- memcpy(dest,&interface_descriptor,sizeof(struct usb_interface_descriptor));
- dest+=sizeof(struct usb_interface_descriptor);
+ endpoint_descriptor.wMaxPacketSize = max_packet_size;
endpoint_descriptor.bEndpointAddress = ep_in;
- memcpy(dest,&endpoint_descriptor,sizeof(struct usb_endpoint_descriptor));
- dest+=sizeof(struct usb_endpoint_descriptor);
+ PACK_DESCRIPTOR(dest, endpoint_descriptor);
endpoint_descriptor.bEndpointAddress = ep_out;
- memcpy(dest,&endpoint_descriptor,sizeof(struct usb_endpoint_descriptor));
- dest+=sizeof(struct usb_endpoint_descriptor);
+ PACK_DESCRIPTOR(dest, endpoint_descriptor);
return (dest - orig_dest);
}