ac97.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:7k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ac97.h - AC97 header file */
  2. /* Copyright 2000 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01c,18apr01,dmh public api provided for manually adjusting codec registers
  7. 01b,31oct00,dmh  extended to support ac97mixer.c
  8. 01a,14mar00,jlb  written.
  9. */
  10. #ifndef __INCac97h
  11. #define __INCac97h
  12. #include <iosLib.h>
  13. #include <semLib.h>
  14. #if __cplusplus
  15. extern "C" {
  16. #endif
  17. /*
  18.   DESCRIPTION 
  19.  
  20.   This file provides definitions for the Intel Audio Codec 97 
  21.  
  22.   */
  23. #define  AC97_RESET              0x0000      /* Reset */
  24. #define  AC97_MASTER_VOL_STEREO  0x0002      /* Line Out */
  25. #define  AC97_HEADPHONE_VOL      0x0004       
  26. #define  AC97_MASTER_VOL_MONO    0x0006     
  27. #define  AC97_MASTER_TONE        0x0008      
  28. #define  AC97_PCBEEP_VOL         0x000a 
  29. #define  AC97_PHONE_VOL          0x000c 
  30. #define  AC97_MIC_VOL            0x000e  
  31. #define  AC97_LINEIN_VOL         0x0010 
  32. #define  AC97_CD_VOL             0x0012  
  33. #define  AC97_VIDEO_VOL          0x0014     
  34. #define  AC97_AUX_VOL            0x0016  
  35. #define  AC97_PCMOUT_VOL         0x0018   
  36. #define  AC97_RECORD_SELECT      0x001a     
  37. #define  AC97_RECORD_GAIN        0x001c
  38. #define  AC97_RECORD_GAIN_MIC    0x001e
  39. #define  AC97_GENERAL_PURPOSE    0x0020
  40. #define  AC97_3D_CONTROL         0x0022
  41. #define  AC97_MODEM_RATE         0x0024
  42. #define  AC97_POWER_CONTROL      0x0026
  43. /* registers 0x0028 - 0x0058 are reserved */
  44. /* AC'97 2.0 */
  45. #define AC97_EXTENDED_ID        0x0028  /* Extended Audio ID */
  46. #define AC97_EXTENDED_STATUS    0x002A  /* Extended Audio Status */
  47. #define AC97_PCM_FRONT_DAC_RATE 0x002C  /* PCM Front DAC Rate */
  48. #define AC97_PCM_SURR_DAC_RATE  0x002E  /* PCM Surround DAC Rate */
  49. #define AC97_PCM_LFE_DAC_RATE   0x0030  /* PCM LFE DAC Rate */
  50. #define AC97_PCM_LR_DAC_RATE    0x0032  /* PCM LR DAC Rate */
  51. #define AC97_PCM_MIC_ADC_RATE   0x0034  /* PCM MIC ADC Rate */
  52. #define AC97_CENTER_LFE_MASTER  0x0036  /* Center + LFE Master Volume */
  53. #define AC97_SURROUND_MASTER    0x0038  /* Surround (Rear) Master Volume */
  54. #define AC97_RESERVED_3A        0x003A  /* Reserved */
  55. /* range 0x3c-0x58 - MODEM */
  56. /* registers 0x005a - 0x007a are vendor reserved */
  57. #define AC97_VENDOR_ID1         0x007c
  58. #define AC97_VENDOR_ID2         0x007e
  59. /* volume control bit defines */
  60. #define AC97_MUTE               0x8000
  61. #define AC97_MICBOOST           0x0040
  62. #define AC97_LEFTVOL            0x3f00
  63. #define AC97_RIGHTVOL           0x003f
  64. /* record mux defines */
  65. #define AC97_RECMUX_MIC         0x0000
  66. #define AC97_RECMUX_CD          0x0101
  67. #define AC97_RECMUX_VIDEO       0x0202      /* not used */
  68. #define AC97_RECMUX_AUX         0x0303      
  69. #define AC97_RECMUX_LINE        0x0404      
  70. #define AC97_RECMUX_STEREO_MIX  0x0505
  71. #define AC97_RECMUX_MONO_MIX    0x0606
  72. #define AC97_RECMUX_PHONE       0x0707
  73. /* general purpose register bit defines */
  74. #define AC97_GP_LPBK            0x0080      /* Loopback mode */
  75. #define AC97_GP_MS              0x0100      /* Mic Select 0=Mic1, 1=Mic2 */
  76. #define AC97_GP_MIX             0x0200      /* Mono output select 0=Mix, 1=Mic */
  77. #define AC97_GP_RLBK            0x0400      /* Remote Loopback - Modem line codec */
  78. #define AC97_GP_LLBK            0x0800      /* Local Loopback - Modem Line codec */
  79. #define AC97_GP_LD              0x1000      /* Loudness 1=on */
  80. #define AC97_GP_3D              0x2000      /* 3D Enhancement 1=on */
  81. #define AC97_GP_ST              0x4000      /* Stereo Enhancement 1=on */
  82. #define AC97_GP_POP             0x8000      /* Pcm Out Path, 0=pre 3D, 1=post 3D */
  83. /* powerdown control and status bit defines */
  84. /* status */
  85. #define AC97_PWR_MDM            0x0010      /* Modem section ready */
  86. #define AC97_PWR_REF            0x0008      /* Vref nominal */
  87. #define AC97_PWR_ANL            0x0004      /* Analog section ready */
  88. #define AC97_PWR_DAC            0x0002      /* DAC section ready */
  89. #define AC97_PWR_ADC            0x0001      /* ADC section ready */
  90. /* control */
  91. #define AC97_PWR_PR0            0x0100      /* ADC and Mux powerdown */
  92. #define AC97_PWR_PR1            0x0200      /* DAC powerdown */
  93. #define AC97_PWR_PR2            0x0400      /* Output mixer powerdown (Vref on) */
  94. #define AC97_PWR_PR3            0x0800      /* Output mixer powerdown (Vref off) */
  95. #define AC97_PWR_PR4            0x1000      /* AC-link powerdown */
  96. #define AC97_PWR_PR5            0x2000      /* Internal Clk disable */
  97. #define AC97_PWR_PR6            0x4000      /* HP amp powerdown */
  98. #define AC97_PWR_PR7            0x8000      /* Modem off - if supported */
  99. /* useful power states */
  100. #define AC97_PWR_D0             0x0000      /* everything on */
  101. #define AC97_PWR_D1             AC97_PWR_PR0 | AC97_PWR_PR1 | AC97_PWR_PR4
  102. #define AC97_PWR_D2             AC97_PWR_PR0 | AC97_PWR_PR1 | 
  103.                                 AC97_PWR_PR2 | AC97_PWR_PR3 | AC97_PWR_PR4
  104. #define AC97_PWR_D3             AC97_PWR_PR0 | AC97_PWR_PR1 | 
  105.                                 AC97_PWR_PR2 | AC97_PWR_PR3 | AC97_PWR_PR4
  106. #define AC97_PWR_ANLOFF         AC97_PWR_PR2 | AC97_PWR_PR3 
  107. /* Total number of defined registers.  */
  108. #define AC97_REG_CNT    64
  109.                    struct ac97_dev;
  110. struct ac97mixtable_entry;
  111. struct ac97_fd;
  112. typedef struct ac97mixtable_entry
  113.     {
  114.     int reg:8;
  115.     unsigned bits:4;
  116.     unsigned ofs:4;
  117.     unsigned stereo:1;
  118.     unsigned mute:1;
  119.     unsigned recidx:4;
  120.     unsigned        mask:1;
  121.     } AC97MIXTABLE_ENTRY;
  122. typedef struct ac97_fd
  123.     {
  124.     struct ac97_dev  * pDev;
  125.     UINT32             devs;
  126.     UINT32           recSrc;
  127.     UINT32          recDevs;
  128.     SEM_ID            semId;
  129.     } AC97_FD;
  130. typedef struct ac97_dev
  131.     {
  132.     DEV_HDR             devHdr;
  133.     FUNCPTR               init;
  134.     FUNCPTR               read;
  135.     FUNCPTR              write;
  136.     UINT32                 key;
  137.     AC97MIXTABLE_ENTRY mix[32];
  138.     AC97_FD           mixer_fd;
  139.     } AC97_DEV;
  140.     
  141. #ifndef AC97MIXER_C
  142. /* public api for custom applications 
  143.    note: an AC97_DEV* may be obtained using iosDevFind, 
  144.    iosNextDevGet, or iosFdDevFind*/
  145. extern void ac97Write(AC97_DEV * pDev, UINT32 reg, UINT16 val);
  146. extern UINT16 ac97Read(AC97_DEV * pDev, UINT32 reg);
  147. /* api to be used only by sound controller drivers
  148.    since only sound controllers understand how to read
  149.    and write to AC97 registers */
  150. extern STATUS ac97MixerDrv();
  151. extern AC97_DEV* ac97MixerDevCreate(DEV_HDR* pDev, FUNCPTR  rd, FUNCPTR wr);
  152. #else 
  153. STATUS ac97MixerDrv();
  154. AC97_DEV* ac97MixerDevCreate(DEV_HDR* pDev, FUNCPTR rd, FUNCPTR wr);
  155. void ac97Write(AC97_DEV * pDev, UINT32 reg, UINT16 val);
  156. UINT16 ac97Read(AC97_DEV * pDev, UINT32 reg);
  157. #endif
  158. #if __cplusplus
  159. } /* extern "C" */
  160. #endif
  161. #endif  /* __INCac97h */