system_servo.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:5k
源码类别:

DVD

开发平台:

C/C++

  1. /*
  2. *  Terry,2004/1/28 09:51AM
  3. */
  4. #ifdef SPHE8202//define 8202 SERVO TRAY SENSOR,cmchang
  5. #ifdef EMU_BOARD_256_SHARE
  6.         #define TRAY_IS_IN_GPIO 84
  7.         #define TRAY_IS_OUT_GPIO 85
  8. #elif defined(EMU_BOARD_216_PIN)
  9. #define DISC_IS_IN_GPIO 8
  10. #define TRAY_IS_IN_GPIO 9
  11. #define TRAY_IS_OUT_GPIO 10
  12. #define SRV_TRIG_GPIO 70
  13. #elif defined(EMU_BOARD_256_NON_SHARE)
  14. #elif defined(MP_BOARD_256_PIN_NON_SHARE)
  15. #ifdef PORTABLE_DVD
  16. #define TRAY_IS_IN_GPIO  6  //99 //pin232
  17. #define TRAY_IS_OUT_GPIO 18 //98 //pin231
  18. #define SRV_TRIG_GPIO 97  //pin230
  19. #else
  20. #define TRAY_IS_IN_GPIO  5
  21. #define DISC_IS_IN_GPIO 8
  22. #define TRAY_IS_OUT_GPIO 18
  23. #define SRV_TRIG_GPIO 97  //pin230
  24. #endif
  25. #elif defined(MP_BOARD_216_PIN_NON_SHARE)//kenny 2004/7/14
  26. #define TRAY_IS_IN_GPIO 70
  27. #define TRAY_IS_OUT_GPIO 71
  28. #define SRV_TRIG_GPIO 15  //pin65
  29. #elif defined(MP_BOARD_216_PIN)
  30. #define TRAY_IS_IN_GPIO 70
  31. #define TRAY_IS_OUT_GPIO 71
  32. #elif defined(MP_BOARD_256_PIN_SHARE)
  33. #define TRAY_IS_IN_GPIO 5
  34. #define TRAY_IS_OUT_GPIO 18
  35. #endif
  36. #if defined(PORTABLE_DVD)
  37. //#define LOAD_IN_GPIO 56
  38. //#define LOAD_OUT_GPIO 55
  39. #define DISC_IS_IN_GPIO 55  //100
  40. #endif
  41. //#else //define 8200 SERVO TRIGER GPIO
  42. //#define SRV_TRIG_GPIO 14
  43. #endif
  44. static inline void system_init_servo_var(void)
  45. {
  46. #ifdef DVD_SERVO
  47. #ifdef PREAMP_GPIO_ENABLE
  48. gbSrvFuncSW = 0x01;
  49. #else
  50. gbSrvFuncSW = 0x00;
  51. #endif
  52. #ifdef TRAY_AVAILABLE
  53. gbSrvFuncSW |= 0x02;
  54. #endif
  55. #ifdef DISC_TYPE_RETRY
  56. gbSrvFuncSW |= 0x04;
  57. #endif
  58. #ifdef CHANGE_TRAY_DIRECTION_FUNC
  59. gbSrvFuncSW |= 0x08;
  60. #endif
  61. #ifdef POWER_ON_TOPDOOR_PRESTOP
  62. gbSrvFuncSW |= 0x10;
  63. #endif
  64. #ifdef POWER_ON_SERVO_STARTUP
  65. gbSrvFuncSW |= 0x20;
  66. #endif
  67. #ifdef PH0PH0_STD
  68. gbSrvFuncSW |= 0x40;
  69. #endif
  70. #ifdef NEW_DEBOUNCE_COUNTER
  71. gbDebounce = NEW_DEBOUNCE_COUNTER;
  72. #endif
  73. // SERVO Eject Speed
  74. #ifdef TRAY_SPEED
  75. gbEjectSpeed = TRAY_SPEED;
  76. #endif
  77. #ifdef TRAY_OUT_SPEED1
  78. gbEjectSpeed1 = TRAY_OUT_SPEED1;
  79. #endif
  80. #ifdef TRAY_OUT_SPEED2
  81. gbEjectSpeed2 = TRAY_OUT_SPEED2;
  82. #endif
  83. #ifdef TRAY_IN_SPEED1
  84. gbEjectSpeed3 = TRAY_IN_SPEED1;
  85. #endif
  86. #ifdef TRAY_IN_SPEED2
  87. gbEjectSpeed4 = TRAY_IN_SPEED2;
  88. #endif
  89. #ifdef TRAY_OUT_CNT
  90. gbTray_Out_Cnt = TRAY_OUT_CNT;
  91. #endif
  92. #ifdef TRAY_IN_CNT
  93. gbTray_In_Cnt = TRAY_IN_CNT;
  94. #endif
  95. #ifdef TRAY_OUT_BRAKE_TIMER
  96. gbTrayOutBrakeTimer=TRAY_OUT_BRAKE_TIMER;
  97. #endif
  98. // 8202 SERVO TRAY Sensor,cmchang
  99. #ifdef TRAY_IS_IN_GPIO
  100.     gbGPIO_TrayIsIn = TRAY_IS_IN_GPIO;
  101. #endif
  102. #ifdef TRAY_IS_OUT_GPIO
  103.     gbGPIO_TrayIsOut = TRAY_IS_OUT_GPIO;
  104. #endif
  105. #ifdef DISC_IS_IN_GPIO
  106.     gbGPIO_DiscIsIn = DISC_IS_IN_GPIO;
  107. #endif
  108. #ifdef DISC_IS_STANDBY_GPIO
  109.     gbGPIO_TrayIsMid = DISC_IS_STANDBY_GPIO;
  110. #endif
  111. #ifdef SLED_IS_OUT_GPIO
  112.     gbGPIO_SledIsOut = SLED_IS_OUT_GPIO;
  113. #endif
  114. // 8202 SERVO DeBUG LED2, longson
  115. #ifdef SRV_TRIG_GPIO
  116. gbGPIO_TrigLED1 = SRV_TRIG_GPIO;
  117. #endif
  118. #endif
  119. // 8202 SERVO LOAD IN/OUT GPIO  2004/07/20/hcchang
  120. #ifdef LOAD_IN_GPIO
  121.     gbGPIO_LoadIn = LOAD_IN_GPIO;
  122. #endif
  123. #ifdef LOAD_OUT_GPIO
  124.     gbGPIO_LoadOut = LOAD_OUT_GPIO;
  125. #endif
  126. // 8202 Servo Table
  127. #ifdef SPHE8202
  128. extern BYTE (*_gpbEQSetting)[4];
  129. #ifdef IC_8202D
  130. extern BYTE _gpbEQ_PS2P1[][4];
  131. _gpbEQSetting = _gpbEQ_PS2P1;
  132. #elif defined(IC_8202E)
  133. extern BYTE _gpbEQ_PJ8202A[][4];
  134. _gpbEQSetting = _gpbEQ_PJ8202A;
  135. #else
  136. if (regs0->stamp==0x82) // PS2.1
  137. {
  138. extern BYTE _gpbEQ_PS2P1[][4];
  139. _gpbEQSetting = _gpbEQ_PS2P1;
  140. }
  141. else // PA8202
  142. {
  143. extern BYTE _gpbEQ_PA8202[][4];
  144. _gpbEQSetting = _gpbEQ_PA8202;
  145. }
  146. #endif
  147. #endif
  148. //------------------Slot-in--------------//TEAC
  149. #ifdef TEAC_PORTABLE_DVD
  150. gbGPIO_TrayIsMid = GPIO_SW_A;
  151. gbGPIO_TrayIsIn  = GPIO_LDCMPLT;
  152. gbGPIO_TrayIsOut = GPIO_EJCMPLT;
  153. gbGPIO_DiscIsIn  = GPIO_PRELOAD;
  154. gbGPIO_SledIsOut = GPIO_OUT_SW;
  155. #endif
  156. //---------------------------------------
  157. }
  158. // SERVO_LIGHT hcchang
  159. UCHAR DecFunctionNull() {return 0;}
  160. #ifdef SERVO_LIGHT
  161. UCHAR (* DecOptionalFunc1)() = DecFunctionNull;
  162. void (* DecOptionalFunc2)() = DecFunctionNull;
  163. void (* DecOptionalFunc3)() = DecFunctionNull;
  164. void (* DecOptionalFunc4)() = DecFunctionNull;
  165. void (* DecOptionalFunc5)() = DecFunctionNull;
  166. void (* DecOptionalFunc6)() = DecFunctionNull;
  167. #else
  168. extern UCHAR DecOptionalFunc1a();
  169. extern void DecOptionalFunc2a();
  170. extern void DecOptionalFunc3a();
  171. extern void DecOptionalFunc4a();
  172. extern void DecOptionalFunc5a();
  173. extern void DecOptionalFunc6a();
  174. UCHAR (* DecOptionalFunc1)() = DecOptionalFunc1a;
  175. void (* DecOptionalFunc2)() = DecOptionalFunc2a;
  176. void (* DecOptionalFunc3)() = DecOptionalFunc3a;
  177. void (* DecOptionalFunc4)() = DecOptionalFunc4a;
  178. void (* DecOptionalFunc5)() = DecOptionalFunc5a;
  179. void (* DecOptionalFunc6)() = DecOptionalFunc6a;
  180. #endif
  181. //-----------------------------------------ending----------------------------------------------