module.c
上传用户:aoeyumen
上传日期:2007-01-06
资源大小:3329k
文件大小:6k
源码类别:

DVD

开发平台:

Unix_Linux

  1. /*
  2.   **********************************************************************
  3.   *
  4.   *     Copyright 1999, 2000 Creative Labs, Inc.
  5.   *
  6.   **********************************************************************
  7.   *
  8.   *     Date                 Author               Summary of changes
  9.   *     ----                 ------               ------------------
  10.   *     October 20, 1999     Andrew de Quincey    Rewrote and extended
  11.   *                          Lucien Murray-Pitts  original incomplete 
  12.   *                                               driver.
  13.   *
  14.   *     April 18, 1999       Andrew Veliath       Original Driver
  15.   *                                               implementation
  16.   *
  17.   **********************************************************************
  18.   *
  19.   *     This program is free software; you can redistribute it and/or
  20.   *     modify it under the terms of the GNU General Public License as
  21.   *     published by the Free Software Foundation; either version 2 of
  22.   *     the License, or (at your option) any later version.
  23.   *
  24.   *     This program is distributed in the hope that it will be useful,
  25.   *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  26.   *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  27.   *     GNU General Public License for more details.
  28.   *
  29.   *     You should have received a copy of the GNU General Public
  30.   *     License along with this program; if not, write to the Free
  31.   *     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  32.   *     USA.
  33.   *
  34.   **********************************************************************
  35.   */
  36. /**
  37.  *
  38.  * Driver for the C-Cube Ziva-DS MPEG decoder chip
  39.  * Driver Maintenance functions
  40.  *
  41.  */
  42. #define EXPORT_SYMTAB
  43. #include <linux/config.h>
  44. #undef MODVERSION
  45. #undef CONFIG_MODVERSIONS
  46. #include <linux/version.h>
  47. #include <linux/module.h>
  48. #include <linux/kernel.h>
  49. #include <linux/sched.h>
  50. #include <linux/string.h>
  51. #include <linux/ptrace.h>
  52. #include <linux/errno.h>
  53. #include <linux/ioport.h>
  54. #include <linux/malloc.h>
  55. #include <linux/interrupt.h>
  56. #include <linux/pci.h>
  57. #include <linux/delay.h>
  58. #include <linux/init.h>
  59. #include <linux/pci.h>
  60. #include <linux/cdrom.h>
  61. #include <linux/videodev.h>
  62. #include <asm/byteorder.h>
  63. #include <asm/bitops.h>
  64. #include <asm/io.h>
  65. #include <asm/irq.h>
  66. #include <asm/uaccess.h>
  67. #include <asm/spinlock.h>
  68. #include <zivaDS.h>
  69. // internal driver functions that are in different files
  70. extern int zivaDS_validate(zivaDS_t* instance);
  71. /**
  72.  *
  73.  * Create new zivaDS driver instance
  74.  *
  75.  * @param ops Lowlevel operations to talk to chip
  76.  * @param data Any extra data for said functions
  77.  *
  78.  */
  79. extern zivaDS_t* zivaDS_new(zivaDS_ops_t* ops, void *data)
  80. {
  81.   zivaDS_t* instance;
  82.   
  83.   // validate ops
  84.   if (ops == NULL)
  85.     return NULL;
  86.   
  87.   // create new structure
  88.   instance = (zivaDS_t*) vmalloc (sizeof(zivaDS_t));
  89.   if (!instance)
  90.     return NULL;
  91.   
  92.   // copy necessary data
  93.   instance->ops = ops;
  94.   instance->data = data;
  95.   // validate the ziva... check it is there
  96.   if (zivaDS_validate(instance) < 0) {
  97.     
  98.     vfree(instance);
  99.     return(NULL);
  100.   }
  101.   
  102.   // unknown ziva chip type
  103.   instance->zivaDSType = ZIVADS_TYPE_3;
  104.   // ints are not enabled
  105.   instance->intEnabledFlag = 0;
  106.   // report OK
  107.   printk (KERN_INFO ZIVADS_LOGNAME "(%s): instance created.n",
  108.   instance->ops->name);
  109.   // OK, another module usage
  110.   MOD_INC_USE_COUNT;
  111.   // return new structure
  112.   return instance;
  113. }
  114. /**
  115.  *
  116.  * Destroy a zivaDS driver instance
  117.  *
  118.  * @param instance The instance to destroy
  119.  *
  120.  */
  121. void zivaDS_free (zivaDS_t* instance)
  122. {
  123.   char* tmpName = instance->ops->name;
  124.   
  125.   // free instance
  126.   vfree(instance);
  127.   
  128.   // one less module usage
  129.   MOD_DEC_USE_COUNT;
  130.   // log it
  131.   printk (KERN_INFO ZIVADS_LOGNAME "(%s): instance destroyed.n", 
  132.   tmpName);
  133. }
  134. #ifdef MODULE
  135. int init_module (void)
  136. {
  137.   return 0;
  138. }
  139. void cleanup_module (void)
  140. {
  141. }
  142. #endif
  143. EXPORT_SYMBOL(zivaDS_get_reg);
  144. EXPORT_SYMBOL(zivaDS_set_reg);
  145. EXPORT_SYMBOL(zivaDS_get_bits);
  146. EXPORT_SYMBOL(zivaDS_set_bits);
  147. EXPORT_SYMBOL(zivaDS_get_mem);
  148. EXPORT_SYMBOL(zivaDS_set_mem);
  149. EXPORT_SYMBOL(zivaDS_set_decryption_mode);
  150. EXPORT_SYMBOL(zivaDS_send_challenge_key);
  151. EXPORT_SYMBOL(zivaDS_get_challenge_key);
  152. EXPORT_SYMBOL(zivaDS_send_response_key);
  153. EXPORT_SYMBOL(zivaDS_get_response_key);
  154. EXPORT_SYMBOL(zivaDS_send_disc_key_part1);
  155. EXPORT_SYMBOL(zivaDS_send_disc_key_part2);
  156. EXPORT_SYMBOL(zivaDS_send_title_key);
  157. EXPORT_SYMBOL(zivaDS_free);
  158. EXPORT_SYMBOL(zivaDS_new);
  159. EXPORT_SYMBOL(zivaDS_get_css_flags);
  160. EXPORT_SYMBOL(zivaDS_restore_css_flags);
  161. EXPORT_SYMBOL(zivaDS_set_css_mode);
  162. EXPORT_SYMBOL(zivaDS_detect);
  163. EXPORT_SYMBOL(zivaDS_enable_subpicture);
  164. EXPORT_SYMBOL(zivaDS_abort);
  165. EXPORT_SYMBOL(zivaDS_set_output_aspect_ratio);
  166. EXPORT_SYMBOL(zivaDS_set_source_aspect_ratio);
  167. EXPORT_SYMBOL(zivaDS_set_audio_volume);
  168. EXPORT_SYMBOL(zivaDS_pause);
  169. EXPORT_SYMBOL(zivaDS_clear_video);
  170. EXPORT_SYMBOL(zivaDS_slow_forwards);
  171. EXPORT_SYMBOL(zivaDS_slow_backwards);
  172. EXPORT_SYMBOL(zivaDS_set_aspect_ratio_mode);
  173. EXPORT_SYMBOL(zivaDS_scan_mode);
  174. EXPORT_SYMBOL(zivaDS_single_step);
  175. EXPORT_SYMBOL(zivaDS_reverse_play);
  176. EXPORT_SYMBOL(zivaDS_set_subpicture_palettes);
  177. EXPORT_SYMBOL(zivaDS_init);
  178. EXPORT_SYMBOL(zivaDS_select_stream);
  179. EXPORT_SYMBOL(zivaDS_play);
  180. EXPORT_SYMBOL(zivaDS_resume);
  181. EXPORT_SYMBOL(zivaDS_reset);
  182. EXPORT_SYMBOL(zivaDS_new_play_mode);
  183. EXPORT_SYMBOL(zivaDS_set_bitstream_type);
  184. EXPORT_SYMBOL(zivaDS_set_source_video_frequency);
  185. EXPORT_SYMBOL(zivaDS_get_mrc_pic_stc);
  186. EXPORT_SYMBOL(zivaDS_get_mrc_pic_pts);
  187. EXPORT_SYMBOL(zivaDS_set_iec958_output_mode);
  188. EXPORT_SYMBOL(zivaDS_set_AC3_mode);
  189. EXPORT_SYMBOL(zivaDS_select_AC3_voice);
  190. EXPORT_SYMBOL(zivaDS_set_audio_attenuation);
  191. EXPORT_SYMBOL(zivaDS_setup_audio_dac);
  192. EXPORT_SYMBOL(zivaDS_command);
  193. EXPORT_SYMBOL(zivaDS_is_int_enabled);
  194. EXPORT_SYMBOL(zivaDS_enable_int);
  195. EXPORT_SYMBOL(zivaDS_get_int_status);
  196. EXPORT_SYMBOL(zivaDS_highlight);
  197. EXPORT_SYMBOL(zivaDS_wait_for_HLI_int);
  198. EXPORT_SYMBOL(zivaDS_check_type_1);
  199. EXPORT_SYMBOL(zivaDS_set_audio_clock_frequency);