Use static inline intermediatary functions in Endpoint.h to handle the masking for...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / CDC.c
index 3d158fb..cf344be 100644 (file)
@@ -36,7 +36,8 @@
 #define  __INCLUDE_FROM_CDC_DRIVER
 #include "CDC.h"
 
-uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,
+uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
+                                uint16_t ConfigDescriptorSize,
                                 void* ConfigDescriptorData)
 {
        uint8_t FoundEndpoints = 0;
@@ -47,7 +48,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
          return CDC_ENUMERROR_InvalidConfigDescriptor;
        
        if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
-                                     DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+                                     DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
        {
                return CDC_ENUMERROR_NoCDCInterfaceFound;
        }
@@ -57,12 +58,12 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
        while (FoundEndpoints != (CDC_FOUND_NOTIFICATION_IN | CDC_FOUND_DATAPIPE_IN | CDC_FOUND_DATAPIPE_OUT))
        {
                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
-                                             DComp_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+                                             DCOMP_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
                {
                        if (FoundEndpoints & CDC_FOUND_NOTIFICATION_IN)
                        {
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, 
-                                                             DComp_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+                                                             DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
                                {
                                        return CDC_ENUMERROR_NoCDCInterfaceFound;
                                }
@@ -79,14 +80,14 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
                                Pipe_DisablePipe();
                        
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
-                                                             DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
+                                                             DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
                                {
                                        return CDC_ENUMERROR_NoCDCInterfaceFound;
                                }
                        }
 
                        if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
-                                                     DComp_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
+                                                     DCOMP_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
                        {
                                return CDC_ENUMERROR_EndpointsNotFound;
                        }
@@ -139,7 +140,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
        return CDC_ENUMERROR_NoError;
 }
 
-static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor)
+static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor)
 {
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
        {
@@ -157,7 +158,7 @@ static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
        return DESCRIPTOR_SEARCH_NotFound;
 }
 
-static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor)
+static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor)
 {
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
        {
@@ -175,7 +176,7 @@ static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
        return DESCRIPTOR_SEARCH_NotFound;
 }
 
-static uint8_t DComp_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor)
+static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor)
 {
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
        {
@@ -261,7 +262,8 @@ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCI
        return USB_Host_SendControlRequest(NULL);
 }
 
-uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Duration)
+uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
+                           const uint8_t Duration)
 {
        USB_ControlRequest = (USB_Request_Header_t)
        {
@@ -277,7 +279,9 @@ uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, con
        return USB_Host_SendControlRequest(NULL);
 }
 
-uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, char* Data, const uint16_t Length)
+uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
+                            char* const Data,
+                            const uint16_t Length)
 {
        if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
          return PIPE_READYWAIT_DeviceDisconnected;
@@ -293,7 +297,8 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, ch
        return ErrorCode;
 }
 
-uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Data)
+uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
+                          const uint8_t Data)
 {
        if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
          return PIPE_READYWAIT_DeviceDisconnected;
@@ -399,19 +404,22 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
        return PIPE_READYWAIT_NoError;
 }
 
-void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Stream)
+void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
+                           FILE* const Stream)
 {
        *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Host_putchar, CDC_Host_getchar, _FDEV_SETUP_RW);
        fdev_set_udata(Stream, CDCInterfaceInfo);
 }
 
-void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Stream)
+void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
+                                   FILE* const Stream)
 {
        *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Host_putchar, CDC_Host_getchar_Blocking, _FDEV_SETUP_RW);
        fdev_set_udata(Stream, CDCInterfaceInfo);
 }
 
-static int CDC_Host_putchar(char c, FILE* Stream)
+static int CDC_Host_putchar(char c,
+                            FILE* Stream)
 {
        return CDC_Host_SendByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0;
 }