cardmi.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  **********************************************************************
  3.  *     sblive_mi.h
  4.  *     Copyright 1999, 2000 Creative Labs, Inc.
  5.  *
  6.  **********************************************************************
  7.  *
  8.  *     Date                 Author          Summary of changes
  9.  *     ----                 ------          ------------------
  10.  *     October 20, 1999     Bertrand Lee    base code release
  11.  *     November 2, 1999     Alan Cox        cleaned up
  12.  *
  13.  **********************************************************************
  14.  *
  15.  *     This program is free software; you can redistribute it and/or
  16.  *     modify it under the terms of the GNU General Public License as
  17.  *     published by the Free Software Foundation; either version 2 of
  18.  *     the License, or (at your option) any later version.
  19.  *
  20.  *     This program is distributed in the hope that it will be useful,
  21.  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  22.  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23.  *     GNU General Public License for more details.
  24.  *
  25.  *     You should have received a copy of the GNU General Public
  26.  *     License along with this program; if not, write to the Free
  27.  *     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  28.  *     USA.
  29.  *
  30.  **********************************************************************
  31.  */
  32. #ifndef _CARDMI_H
  33. #define _CARDMI_H
  34. #include "icardmid.h"
  35. #include <linux/interrupt.h>
  36. typedef enum
  37. {
  38. STIN_PARSE = 0,
  39. STIN_3BYTE,                     /* 0x80, 0x90, 0xA0, 0xB0, 0xE0 */
  40. STIN_3BYTE_KEY,                 /* Byte 1 */
  41. STIN_3BYTE_VEL,                 /* Byte 1 */
  42. STIN_2BYTE,                     /* 0xC0, 0xD0 */
  43. STIN_2BYTE_KEY,                 /* Byte 1 */
  44. STIN_SYS_COMMON_2,              /* 0xF1, 0xF3  */
  45. STIN_SYS_COMMON_2_KEY,
  46. STIN_SYS_COMMON_3,              /* 0xF2 */
  47. STIN_SYS_COMMON_3_KEY,
  48. STIN_SYS_COMMON_3_VEL,
  49. STIN_SYS_EX_NORM,               /* 0xF0, Normal mode */
  50. STIN_SYS_REAL
  51. } midi_in_state;
  52. /* flags for card MIDI in object */
  53. #define FLAGS_MIDM_STARTED          0x00001000      // Data has started to come in after Midm Start
  54. #define MIDIIN_MAX_BUFFER_SIZE      200             // Definition for struct emu10k1_mpuin
  55. struct midi_data
  56. {
  57. u8 data;
  58. u32 timein;
  59. };
  60. struct emu10k1_mpuin
  61. {
  62. spinlock_t        lock;
  63. struct midi_queue *firstmidiq;
  64. struct midi_queue *lastmidiq;
  65. unsigned          qhead, qtail;
  66. struct midi_data  midiq[MIDIIN_MAX_BUFFER_SIZE];
  67. struct tasklet_struct tasklet;
  68. struct midi_openinfo    openinfo;
  69. /* For MIDI state machine */
  70. u8              status;        /* For MIDI running status */
  71. u8              fstatus;       /* For 0xFn status only */
  72. midi_in_state   curstate;
  73. midi_in_state   laststate;
  74. u32             timestart;
  75. u32             timein;
  76. u8              data;
  77. };
  78. int emu10k1_mpuin_open(struct emu10k1_card *, struct midi_openinfo *);
  79. int emu10k1_mpuin_close(struct emu10k1_card *);
  80. int emu10k1_mpuin_add_buffer(struct emu10k1_mpuin *, struct midi_hdr *);
  81. int emu10k1_mpuin_start(struct emu10k1_card *);
  82. int emu10k1_mpuin_stop(struct emu10k1_card *);
  83. int emu10k1_mpuin_reset(struct emu10k1_card *);
  84. int sblive_miStateInit(struct emu10k1_mpuin *);
  85. int sblive_miStateEntry(struct emu10k1_mpuin *, u8);
  86. int sblive_miStateParse(struct emu10k1_mpuin *, u8);
  87. int sblive_miState3Byte(struct emu10k1_mpuin *, u8);
  88. int sblive_miState3ByteKey(struct emu10k1_mpuin *, u8);
  89. int sblive_miState3ByteVel(struct emu10k1_mpuin *, u8);
  90. int sblive_miState2Byte(struct emu10k1_mpuin *, u8);
  91. int sblive_miState2ByteKey(struct emu10k1_mpuin *, u8);
  92. int sblive_miStateSysCommon2(struct emu10k1_mpuin *, u8);
  93. int sblive_miStateSysCommon2Key(struct emu10k1_mpuin *, u8);
  94. int sblive_miStateSysCommon3(struct emu10k1_mpuin *, u8);
  95. int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *, u8);
  96. int sblive_miStateSysCommon3Vel(struct emu10k1_mpuin *, u8);
  97. int sblive_miStateSysExNorm(struct emu10k1_mpuin *, u8);
  98. int sblive_miStateSysReal(struct emu10k1_mpuin *, u8);
  99. int emu10k1_mpuin_irqhandler(struct emu10k1_card *);
  100. void emu10k1_mpuin_bh(unsigned long);
  101. int emu10k1_mpuin_callback(struct emu10k1_mpuin *card_mpuin, u32 msg, unsigned long data, u32 bytesvalid);
  102. #endif  /* _CARDMI_H */