diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-11-26 04:46:31 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-11-26 04:46:31 +0000 |
commit | 5aa2b26261389cfbdfae8e793be4b8150ddc7a0a (patch) | |
tree | 98cd416fe1b9407956892a22e5b01b3018ccbb09 /Demos/Host/LowLevel/RNDISEthernetHost | |
parent | f37d21bbe961a72e4d6527767aacf843e3af412c (diff) | |
download | lufa-5aa2b26261389cfbdfae8e793be4b8150ddc7a0a.tar.gz lufa-5aa2b26261389cfbdfae8e793be4b8150ddc7a0a.tar.bz2 lufa-5aa2b26261389cfbdfae8e793be4b8150ddc7a0a.zip |
Added new RNDIS Host class driver and the beginnings of a RNDISEthernetHost Class Driver demo.
Fixed all Class drivers to ensure they have appropriate guards on each function to ensure the device is enumerated before running, fixed error codes on all guards to return "DeviceDisconnected" where possble.
Renamed HOST_SENDCONTROL_DeviceDisconnect enum value to HOST_SENDCONTROL_DeviceDisconnected to be in line with the rest of the library enum error codes.
Diffstat (limited to 'Demos/Host/LowLevel/RNDISEthernetHost')
3 files changed, 25 insertions, 21 deletions
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c index 9916baca8..ca9ee5f28 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c +++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c @@ -91,7 +91,8 @@ uint8_t RNDIS_GetEncapsulatedResponse(void* Buffer, uint16_t Length) /** Sends a RNDIS KEEPALIVE command to the device, to ensure that it does not enter standby mode after periods
* of long inactivity.
*
- * \return A value from the USB_Host_SendControlErrorCodes_t enum
+ * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
+ * logical command failure
*/
uint8_t RNDIS_SendKeepAlive(void)
{
@@ -124,7 +125,8 @@ uint8_t RNDIS_SendKeepAlive(void) * \param[in] HostMaxPacketSize Size of the packet buffer on the host
* \param[out] DeviceMaxPacketSize Pointer to where the packet buffer size of the device is to be stored
*
- * \return A value from the USB_Host_SendControlErrorCodes_t enum
+ * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
+ * logical command failure
*/
uint8_t RNDIS_InitializeDevice(uint16_t HostMaxPacketSize, uint16_t* DeviceMaxPacketSize)
{
@@ -167,7 +169,8 @@ uint8_t RNDIS_InitializeDevice(uint16_t HostMaxPacketSize, uint16_t* DeviceMaxPa * \param[in] Buffer Pointer to where the property data is to be sourced from
* \param[in] Length Length in bytes of the property data to sent to the device
*
- * \return A value from the USB_Host_SendControlErrorCodes_t enum
+ * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
+ * logical command failure
*/
uint8_t RNDIS_SetRNDISProperty(uint32_t Oid, void* Buffer, uint16_t Length)
{
@@ -216,7 +219,8 @@ uint8_t RNDIS_SetRNDISProperty(uint32_t Oid, void* Buffer, uint16_t Length) * \param[in] Buffer Pointer to where the property data is to be written to
* \param[in] MaxLength Length in bytes of the destination buffer size
*
- * \return A value from the USB_Host_SendControlErrorCodes_t enum
+ * \return A value from the USB_Host_SendControlErrorCodes_t enum or RNDIS_COMMAND_FAILED if the device returned a
+ * logical command failure
*/
uint8_t RNDIS_QueryRNDISProperty(uint32_t Oid, void* Buffer, uint16_t MaxLength)
{
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h index f65a66cbf..1d16dedc1 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h +++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h @@ -34,8 +34,8 @@ * constants, please refer to the Microsoft RNDIS specification.
*/
-#ifndef _RNDIS_CONSTANTS_H_
-#define _RNDIS_CONSTANTS_H_
+#ifndef _RNDIS_CONSTANTS_DEVICE_H_
+#define _RNDIS_CONSTANTS_DEVICE_H_
/* Macros: */
#define REMOTE_NDIS_PACKET_MSG 0x00000001UL
@@ -67,6 +67,19 @@ #define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
+
+ #define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL
+ #define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL
+ #define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL
+ #define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL
+ #define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL
+ #define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL
+ #define REMOTE_NDIS_PACKET_SMT 0x00000040UL
+ #define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL
+ #define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
+ #define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
+ #define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
+ #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
@@ -95,18 +108,5 @@ #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
-
- #define RNDIS_PACKET_TYPE_DIRECTED 0x00000001UL
- #define RNDIS_PACKET_TYPE_MULTICAST 0x00000002UL
- #define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004UL
- #define RNDIS_PACKET_TYPE_BROADCAST 0x00000008UL
- #define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010UL
- #define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020UL
- #define RNDIS_PACKET_TYPE_SMT 0x00000040UL
- #define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080UL
- #define RNDIS_PACKET_TYPE_GROUP 0x00001000UL
- #define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000UL
- #define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000UL
- #define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000UL
#endif
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c index 3e8ec57ac..24e87e9f7 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c +++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c @@ -226,7 +226,7 @@ void RNDIS_Host_Task(void) printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), DeviceMaxPacketSize);
/* We set the default filter to only receive packets we would be interested in */
- uint32_t PacketFilter = (RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST | RNDIS_PACKET_TYPE_ALL_MULTICAST);
+ uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST | REMOTE_NDIS_PACKET_ALL_MULTICAST);
if ((ErrorCode = RNDIS_SetRNDISProperty(OID_GEN_CURRENT_PACKET_FILTER,
&PacketFilter, sizeof(PacketFilter))) != HOST_SENDCONTROL_Successful)
{
@@ -256,7 +256,7 @@ void RNDIS_Host_Task(void) break;
}
- printf_P(PSTR("Device Vendor ID: 0x%08X\r\n"), VendorID);
+ printf_P(PSTR("Device Vendor ID: 0x%08lX\r\n"), VendorID);
puts_P(PSTR("RNDIS Device Enumerated.\r\n"));
|