LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MIDIClassCommon.h
Go to the documentation of this file.
1 /*
2  * @brief Common definitions and declarations 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 
43 #ifndef _MIDI_CLASS_COMMON_H_
44 #define _MIDI_CLASS_COMMON_H_
45 
46  /* Macros: */
47  #define __INCLUDE_FROM_AUDIO_DRIVER
48 
49  /* Includes: */
50  #include "../../Core/StdDescriptors.h"
51  #include "AudioClassCommon.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  /* Macros: */
67  #define MIDI_COMMAND_NOTE_ON 0x90
68 
70  #define MIDI_COMMAND_NOTE_OFF 0x80
71 
72 
74  #define MIDI_STANDARD_VELOCITY 64
75 
81  #define MIDI_CHANNEL(channel) ((channel) - 1)
82 
83  /* Enums: */
86  {
89  };
90 
91  /* Type Defines: */
102  typedef ATTR_IAR_PACKED struct
103  {
105  uint8_t Subtype;
110  uint16_t TotalLength;
112 
124  typedef ATTR_IAR_PACKED struct
125  {
126  uint8_t bLength;
127  uint8_t bDescriptorType;
133  uint16_t bcdMSC;
134  uint16_t wTotalLength;
136 
146  typedef ATTR_IAR_PACKED struct
147  {
149  uint8_t Subtype;
151  uint8_t JackType;
152  uint8_t JackID;
154  uint8_t JackStrIndex;
156 
167  typedef ATTR_IAR_PACKED struct
168  {
169  uint8_t bLength;
170  uint8_t bDescriptorType;
174  uint8_t bDescriptorSubtype;
176  uint8_t bJackType;
177  uint8_t bJackID;
179  uint8_t iJack;
181 
191  typedef ATTR_IAR_PACKED struct
192  {
194  uint8_t Subtype;
196  uint8_t JackType;
197  uint8_t JackID;
199  uint8_t NumberOfPins;
200  uint8_t SourceJackID[1];
201  uint8_t SourcePinID[1];
203  uint8_t JackStrIndex;
205 
216  typedef ATTR_IAR_PACKED struct
217  {
218  uint8_t bLength;
219  uint8_t bDescriptorType;
223  uint8_t bDescriptorSubtype;
225  uint8_t bJackType;
226  uint8_t bJackID;
228  uint8_t bNrInputPins;
229  uint8_t baSourceID[1];
230  uint8_t baSourcePin[1];
232  uint8_t iJack;
234 
245  typedef ATTR_IAR_PACKED struct
246  {
248  uint8_t Subtype;
251  uint8_t AssociatedJackID[1];
253 
265  typedef ATTR_IAR_PACKED struct
266  {
267  uint8_t bLength;
268  uint8_t bDescriptorType;
272  uint8_t bDescriptorSubtype;
274  uint8_t bNumEmbMIDIJack;
275  uint8_t bAssocJackID[1];
277 
284  typedef ATTR_IAR_PACKED struct
285  {
286  unsigned Command : 4;
287  unsigned CableNumber : 4;
289  uint8_t Data1;
290  uint8_t Data2;
291  uint8_t Data3;
293 
294  /* Disable C linkage for C++ Compilers: */
295  #if defined(__cplusplus)
296  }
297  #endif
298 
299 #endif
300