From 5e355a4f0588438632d56e2f9fef5a75b949bd24 Mon Sep 17 00:00:00 2001 From: Christian Starkjohann Date: Wed, 5 Dec 2012 22:57:13 +0100 Subject: usbMsgPtr now has a separate type so that it can be defined to an 8 bit type for tiny memory model --- usbdrv/usbdrv.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'usbdrv/usbdrv.h') 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. -- cgit v1.2.3