aboutsummaryrefslogtreecommitdiffstats
path: root/usbdrv/usbdrv.h
diff options
context:
space:
mode:
authorChristian Starkjohann <cs+github@obdev.at>2012-12-05 22:57:13 +0100
committerChristian Starkjohann <cs+github@obdev.at>2012-12-05 22:57:13 +0100
commit5e355a4f0588438632d56e2f9fef5a75b949bd24 (patch)
treed363cf4807bdd2f2b96bdfd8ee40e5cae9ff80cb /usbdrv/usbdrv.h
parent5a50b438cac678c178dad625e04db4c6eeddd5fe (diff)
downloadv-usb-5e355a4f0588438632d56e2f9fef5a75b949bd24.tar.gz
v-usb-5e355a4f0588438632d56e2f9fef5a75b949bd24.tar.bz2
v-usb-5e355a4f0588438632d56e2f9fef5a75b949bd24.zip
usbMsgPtr now has a separate type so that it can be defined to an 8 bit type for tiny memory model
Diffstat (limited to 'usbdrv/usbdrv.h')
-rw-r--r--usbdrv/usbdrv.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/usbdrv/usbdrv.h b/usbdrv/usbdrv.h
index 6d1ad50..b377c43 100644
--- a/usbdrv/usbdrv.h
+++ b/usbdrv/usbdrv.h
@@ -163,6 +163,17 @@ USB messages, even if they address another (low-speed) device on the same bus.
*/
#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */
+#ifndef usbMsgPtr_t
+#define usbMsgPtr_t uchar *
+#endif
+/* Making usbMsgPtr_t a define allows the user of this library to define it to
+ * an 8 bit type on tiny devices. This reduces code size, especially if the
+ * compiler supports a tiny memory model.
+ * The type can be a pointer or scalar type, casts are made where necessary.
+ * Although it's paradoxical, Gcc 4 generates slightly better code for scalar
+ * types than for pointers.
+ */
+
struct usbRequest; /* forward declaration */
USB_PUBLIC void usbInit(void);
@@ -178,7 +189,7 @@ USB_PUBLIC void usbPoll(void);
* Please note that debug outputs through the UART take ~ 0.5ms per byte
* at 19200 bps.
*/
-extern uchar *usbMsgPtr;
+extern usbMsgPtr_t usbMsgPtr;
/* This variable may be used to pass transmit data to the driver from the
* implementation of usbFunctionWrite(). It is also used internally by the
* driver for standard control requests.