Mark build test makefiles as being incompatible with parallel make builds, as they...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / MIDIClassDevice.c
index 7e0f6d4..c9553a4 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 /*
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -41,38 +41,14 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
 {
        memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
 
 {
        memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
 
-       for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
-       {
-               uint16_t Size;
-               uint8_t  Type;
-               uint8_t  Direction;
-               bool     DoubleBanked;
-
-               if (EndpointNum == MIDIInterfaceInfo->Config.DataINEndpointNumber)
-               {
-                       Size         = MIDIInterfaceInfo->Config.DataINEndpointSize;
-                       Direction    = ENDPOINT_DIR_IN;
-                       Type         = EP_TYPE_BULK;
-                       DoubleBanked = MIDIInterfaceInfo->Config.DataINEndpointDoubleBank;
-               }
-               else if (EndpointNum == MIDIInterfaceInfo->Config.DataOUTEndpointNumber)
-               {
-                       Size         = MIDIInterfaceInfo->Config.DataOUTEndpointSize;
-                       Direction    = ENDPOINT_DIR_OUT;
-                       Type         = EP_TYPE_BULK;
-                       DoubleBanked = MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank;
-               }
-               else
-               {
-                       continue;
-               }
-
-               if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
-                                                DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
-               {
-                       return false;
-               }
-       }
+       MIDIInterfaceInfo->Config.DataINEndpoint.Type  = EP_TYPE_BULK;
+       MIDIInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK;
+
+       if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataINEndpoint, 1)))
+         return false;
+
+       if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataOUTEndpoint, 1)))
+         return false;
 
        return true;
 }
 
        return true;
 }
@@ -95,7 +71,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
 
        uint8_t ErrorCode;
 
 
        uint8_t ErrorCode;
 
-       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
+       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address);
 
        if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError)
          return ErrorCode;
 
        if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError)
          return ErrorCode;
@@ -113,7 +89,7 @@ uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
 
        uint8_t ErrorCode;
 
 
        uint8_t ErrorCode;
 
-       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
+       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address);
 
        if (Endpoint_BytesInEndpoint())
        {
 
        if (Endpoint_BytesInEndpoint())
        {
@@ -132,7 +108,7 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
        if (USB_DeviceState != DEVICE_STATE_Configured)
          return false;
 
        if (USB_DeviceState != DEVICE_STATE_Configured)
          return false;
 
-       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber);
+       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpoint.Address);
 
        if (!(Endpoint_IsReadWriteAllowed()))
          return false;
 
        if (!(Endpoint_IsReadWriteAllowed()))
          return false;