LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MIDIClassHost.h
Go to the documentation of this file.
1 /*
2  * @brief Host mode driver for the library USB MIDI Class driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * Copyright(C) Dean Camera, 2011, 2012
7  * All rights reserved.
8  *
9  * @par
10  * Software that is described herein is for illustrative purposes only
11  * which provides customers with programming information regarding the
12  * LPC products. This software is supplied "AS IS" without any warranties of
13  * any kind, and NXP Semiconductors and its licensor disclaim any and
14  * all warranties, express or implied, including all implied warranties of
15  * merchantability, fitness for a particular purpose and non-infringement of
16  * intellectual property rights. NXP Semiconductors assumes no responsibility
17  * or liability for the use of the software, conveys no license or rights under any
18  * patent, copyright, mask work right, or any other intellectual property rights in
19  * or to any products. NXP Semiconductors reserves the right to make changes
20  * in the software without notification. NXP Semiconductors also makes no
21  * representation or warranty that such application will be suitable for the
22  * specified use without further testing or modification.
23  *
24  * @par
25  * Permission to use, copy, modify, and distribute this software and its
26  * documentation is hereby granted, under NXP Semiconductors' and its
27  * licensor's relevant copyrights in the software, without fee, provided that it
28  * is used in conjunction with NXP Semiconductors microcontrollers. This
29  * copyright, permission, and disclaimer notice must appear in all copies of
30  * this code.
31  */
32 
46 #ifndef __MIDI_CLASS_HOST_H__
47 #define __MIDI_CLASS_HOST_H__
48 
49  /* Includes: */
50  #include "../../USB.h"
51  #include "../Common/MIDIClassCommon.h"
52 
53  /* Enable C linkage for C++ Compilers: */
54  #if defined(__cplusplus)
55  extern "C" {
56  #endif
57 
58  /* Preprocessor Checks: */
59  #if !defined(__INCLUDE_FROM_MIDI_DRIVER)
60  #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
61  #endif
62 
63  /* Public Interface - May be used in end-application: */
64  /* Type Defines: */
71  typedef struct
72  {
73  const struct
74  {
75  uint8_t DataINPipeNumber;
80  uint8_t PortNumber;
82  } Config;
85  struct
86  {
87  bool IsActive;
91  uint8_t InterfaceNumber;
93  uint16_t DataINPipeSize;
94  uint16_t DataOUTPipeSize;
95  } State;
100 
101  /* Enums: */
104  {
109  };
110 
111  /* Function Prototypes: */
124  uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
125  uint16_t ConfigDescriptorSize,
126  void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
127 
134  void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
135 
146  uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
147  MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
148 
158  uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
159 
170  bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
171  MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
172 
173  /* Private Interface - For use in library only: */
174  #if !defined(__DOXYGEN__)
175  /* Function Prototypes: */
176  #if defined(__INCLUDE_FROM_MIDI_HOST_C)
177  static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor)
179  static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor)
181  #endif
182  #endif
183 
184  /* Disable C linkage for C++ Compilers: */
185  #if defined(__cplusplus)
186  }
187  #endif
188 
189 #endif
190