Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

259 lines
6.4 KiB

  1. // $Header: G:/SwDev/WDM/Video/bt848/rcs/Bt848api.cpp 1.2 1998/04/29 22:43:26 tomz Exp $
  2. #include "device.h"
  3. #include "audio.h"
  4. void PsDevice::EnableAudio( State s )
  5. {
  6. SetGPOE( 0x0000000FL );
  7. if ( s == On )
  8. SetGPDATABits( 0, 1, AUDIO_SOURCE_TVTUNER, 0 );
  9. else
  10. SetGPDATABits( 0, 1, AUDIO_SOURCE_EXTAUDIO, 0 );
  11. }
  12. /////////////////////////////////////////////////////////////////////////////
  13. // I2C DATA/CONTROL REGISTER API
  14. /////////////////////////////////////////////////////////////////////////////
  15. bool PsDevice::I2CIsInitOK( void )
  16. {
  17. return i2c.IsInitOK();
  18. }
  19. #ifdef HARDWAREI2C
  20. //---------------------------------------------------------------------------
  21. ErrorCode PsDevice::I2CInitHWMode( long freq )
  22. {
  23. return i2c.I2CInitHWMode( freq );
  24. }
  25. //---------------------------------------------------------------------------
  26. void PsDevice::I2CSetFreq( long freq )
  27. {
  28. i2c.I2CSetFreq( freq );
  29. }
  30. //---------------------------------------------------------------------------
  31. int PsDevice::I2CReadDiv( void )
  32. {
  33. return i2c.I2CReadDiv();
  34. }
  35. //---------------------------------------------------------------------------
  36. ErrorCode PsDevice::I2CHWRead( BYTE address, BYTE *value )
  37. {
  38. return i2c.I2CHWRead( address, value );
  39. }
  40. //---------------------------------------------------------------------------
  41. ErrorCode PsDevice::I2CHWWrite2( BYTE address, BYTE value1 )
  42. {
  43. return i2c.I2CHWWrite2( address, value1 );
  44. }
  45. //---------------------------------------------------------------------------
  46. ErrorCode PsDevice::I2CHWWrite3( BYTE address, BYTE value1, BYTE value2 )
  47. {
  48. return i2c.I2CHWWrite3( address, value1, value2 );
  49. }
  50. //---------------------------------------------------------------------------
  51. int PsDevice::I2CReadSync( void )
  52. {
  53. return i2c.I2CReadSync();
  54. }
  55. #endif
  56. //---------------------------------------------------------------------------
  57. int PsDevice::I2CGetLastError( void )
  58. {
  59. return i2c.I2CGetLastError();
  60. }
  61. #ifdef HAUPPAUGEI2CPROVIDER
  62. ErrorCode PsDevice::I2CInitSWMode( long freq )
  63. {
  64. return i2c.I2CInitSWMode( freq );
  65. }
  66. ErrorCode PsDevice::I2CSWStart( void )
  67. {
  68. return i2c.I2CSWStart();
  69. }
  70. ErrorCode PsDevice::I2CSWStop( void )
  71. {
  72. return i2c.I2CSWStop();
  73. }
  74. ErrorCode PsDevice::I2CSWRead( BYTE * value )
  75. {
  76. return i2c.I2CSWRead( value );
  77. }
  78. ErrorCode PsDevice::I2CSWWrite( BYTE value )
  79. {
  80. return i2c.I2CSWWrite( value );
  81. }
  82. ErrorCode PsDevice::I2CSWSendACK( void )
  83. {
  84. return i2c.I2CSWSendACK();
  85. }
  86. ErrorCode PsDevice::I2CSWSendNACK( void )
  87. {
  88. return i2c.I2CSWSendNACK();
  89. }
  90. // ErrorCode PsDevice::I2CSWSetSCL( Level );
  91. // int PsDevice::I2CSWReadSCL( void );
  92. // ErrorCode PsDevice::I2CSWSetSDA( Level );
  93. // int PsDevice::I2CSWReadSDA( void );
  94. #endif
  95. /////////////////////////////////////////////////////////////////////////////
  96. // GPIO, GPOE, GPIE, and GPDATA REGISTER API
  97. /////////////////////////////////////////////////////////////////////////////
  98. bool PsDevice::GPIOIsInitOK( void )
  99. {
  100. return gpio.IsInitOK();
  101. }
  102. //---------------------------------------------------------------------------
  103. void PsDevice::SetGPCLKMODE( State s )
  104. {
  105. gpio.SetGPCLKMODE( s );
  106. }
  107. //---------------------------------------------------------------------------
  108. int PsDevice::GetGPCLKMODE( void )
  109. {
  110. return gpio.GetGPCLKMODE();
  111. }
  112. //---------------------------------------------------------------------------
  113. void PsDevice::SetGPIOMODE( GPIOMode mode )
  114. {
  115. gpio.SetGPIOMODE( mode );
  116. }
  117. //---------------------------------------------------------------------------
  118. int PsDevice::GetGPIOMODE( void )
  119. {
  120. return gpio.GetGPIOMODE();
  121. }
  122. //---------------------------------------------------------------------------
  123. void PsDevice::SetGPWEC( State s )
  124. {
  125. gpio.SetGPWEC( s );
  126. }
  127. //---------------------------------------------------------------------------
  128. int PsDevice::GetGPWEC( void )
  129. {
  130. return gpio.GetGPWEC();
  131. }
  132. //---------------------------------------------------------------------------
  133. void PsDevice::SetGPINTI( State s )
  134. {
  135. gpio.SetGPINTI( s );
  136. }
  137. //---------------------------------------------------------------------------
  138. int PsDevice::GetGPINTI( void )
  139. {
  140. return gpio.GetGPINTI();
  141. }
  142. //---------------------------------------------------------------------------
  143. void PsDevice::SetGPINTC( State s )
  144. {
  145. gpio.SetGPINTC( s );
  146. }
  147. //---------------------------------------------------------------------------
  148. int PsDevice::GetGPINTC( void )
  149. {
  150. return gpio.GetGPINTC();
  151. }
  152. //---------------------------------------------------------------------------
  153. ErrorCode PsDevice::SetGPOEBit( int bit, State s )
  154. {
  155. return gpio.SetGPOE( bit, s );
  156. }
  157. //---------------------------------------------------------------------------
  158. void PsDevice::SetGPOE( DWORD value )
  159. {
  160. gpio.SetGPOE( value );
  161. }
  162. //---------------------------------------------------------------------------
  163. int PsDevice::GetGPOEBit( int bit )
  164. {
  165. return gpio.GetGPOE( bit );
  166. }
  167. //---------------------------------------------------------------------------
  168. DWORD PsDevice::GetGPOE( void )
  169. {
  170. return gpio.GetGPOE();
  171. }
  172. //---------------------------------------------------------------------------
  173. ErrorCode PsDevice::SetGPIEBit( int bit , State s )
  174. {
  175. return gpio.SetGPIE( bit, s );
  176. }
  177. //---------------------------------------------------------------------------
  178. void PsDevice::SetGPIE( DWORD value )
  179. {
  180. gpio.SetGPIE( value );
  181. }
  182. //---------------------------------------------------------------------------
  183. int PsDevice::GetGPIEBit( int bit )
  184. {
  185. return gpio.GetGPIE( bit );
  186. }
  187. //---------------------------------------------------------------------------
  188. DWORD PsDevice::GetGPIE( void )
  189. {
  190. return gpio.GetGPIE();
  191. }
  192. //---------------------------------------------------------------------------
  193. ErrorCode PsDevice::SetGPDATA( GPIOReg *data, int size, int offset )
  194. {
  195. return gpio.SetGPDATA( data, size, offset );
  196. }
  197. //---------------------------------------------------------------------------
  198. ErrorCode PsDevice::GetGPDATA( GPIOReg *data, int size, int offset )
  199. {
  200. return gpio.GetGPDATA( data, size, offset );
  201. }
  202. //---------------------------------------------------------------------------
  203. ErrorCode PsDevice::SetGPDATABits( int fromBit, int toBit, DWORD value, int offset )
  204. {
  205. return gpio.SetGPDATA( fromBit, toBit, value, offset );
  206. }
  207. //---------------------------------------------------------------------------
  208. ErrorCode PsDevice::GetGPDATABits( int fromBit, int toBit, DWORD *value, int offset )
  209. {
  210. return gpio.GetGPDATA( fromBit, toBit, value, offset );
  211. }