home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / lxapilib / lxapilib.c < prev    next >
C/C++ Source or Header  |  2002-04-26  |  17KB  |  444 lines

  1. /* $Id: lxapilib.c,v 1.2 2002/04/26 23:09:44 smilcke Exp $ */
  2.  
  3. /*
  4.  * lxapilib.c
  5.  * Autor:               Stefan Milcke
  6.  * Erstellt am:         08.01.2002
  7.  * Letzte Aenderung am: 14.04.2002
  8.  *
  9. */
  10.  
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15. #define INCL_NOPMAPI
  16. #define INCL_DOSINFOSEG
  17. #include <os2.h>
  18.  
  19. #include <linux/kernel.h>
  20. #include <linux/slab.h>
  21. #include <linux/vmalloc.h>
  22. #include <linux/mm.h>
  23. #include <asm/uaccess.h>
  24. #include <ioremap.h>
  25. #include <asm/page.h>
  26. #include <linux/types.h>
  27. #include <linux/i2c.h>
  28. #include <linux/i2c-algo-bit.h>
  29. #include <linux/vmalloc.h>
  30.  
  31. #include <lxapiidc.h>
  32.  
  33. #ifndef DebugInt3
  34. #define DebugInt3() _asm int 3;
  35. #endif
  36.  
  37. /******************************************************************************/
  38. /* function pointers                                                          */
  39. /******************************************************************************/
  40. //-------------------------------- OS2 specific --------------------------------
  41. unsigned long (*OS2_lxioctl)(void __far *requestPacketPtr)=NULL;
  42. int (*OS2_add_module)(struct os2lx_module *pModule)=NULL;
  43. int (*OS2_apply_mod_parm)(char *parm,struct os2lx_parm *parmList,int num)=NULL;
  44. int (*OS2_set_module_parm)(char *parm)=NULL;
  45. int (*OS2_get_num_modules)(void)=NULL;
  46. int (*OS2_get_total_num_modules)(void)=NULL;
  47. char *(*OS2_get_module_name)(int nr)=NULL;
  48. int (*OS2_enum_modules)(void *buffer,unsigned long buffer_len)=NULL;
  49.  
  50. //------------------------------ resource manager ------------------------------
  51. unsigned long __cdecl (*RM32CreateDriver)(DRIVERSTRUCT*,HDRIVER*)=NULL;
  52. unsigned long __cdecl (*RM32DestroyDriver)(HDRIVER)=NULL;
  53. unsigned long __cdecl (*RM32CreateAdapter)(HDRIVER,HADAPTER*,ADAPTERSTRUCT*,HDEVICE,AHRESOURCE*)=NULL;
  54. unsigned long __cdecl (*RM32DestroyAdapter)(HDRIVER,HADAPTER)=NULL;
  55. unsigned long __cdecl (*RM32CreateDevice)(HDRIVER,HDEVICE*,DEVICESTRUCT*,HADAPTER,AHRESOURCE*)=NULL;
  56. unsigned long __cdecl (*RM32DestroyDevice)(HDRIVER,HDEVICE)=NULL;
  57. unsigned long __cdecl (*RM32AllocResource)(HDRIVER,HRESOURCE*,RESOURCESTRUCT*)=NULL;
  58. unsigned long __cdecl (*RM32DeallocResource)(HDRIVER,HRESOURCE)=NULL;
  59. unsigned long __cdecl (*RM32ModifyResources)(HDRIVER,HADAPTER,USHORT,HRESOURCE)=NULL;
  60.  
  61. //--------------------------- video for linux (V4L) ----------------------------
  62. int (*OS2_v4lx_enum_devices)(void *buffer,unsigned long buffer_len)=NULL;
  63. unsigned long (*OS2_v4lx_get_num_devices)(void)=NULL;
  64. int (*OS2_v4lx_open_device)(char *devname)=NULL;
  65. int (*OS2_v4lx_close_device)(int handle)=NULL;
  66. void (*OS2_v4lx_close_all_opened_devices)(void)=NULL;
  67. struct video_device *(*OS2_v4lx_get_opened_device)(int handle)=NULL;
  68. int (*OS2_v4lx_ioctl)(int handle,int ioctlfn,void *userData)=NULL;
  69.  
  70. //----------------------------- memory management ------------------------------
  71. void *(*__malloc)(unsigned long size)=NULL;
  72. void *malloc(unsigned long size){ return __malloc(size); }
  73. void (*__free)(void *ptr)=NULL;
  74. void free(void *ptr){ __free(ptr); }
  75. void *(*kmalloc)(int size,int flags)=NULL;
  76. void (*kfree)(const void *ptr)=NULL;
  77. void *(*vmalloc)(unsigned long size)=NULL;
  78. void *(*__vmalloc)(unsigned long size,int gfp_mask,pgprot_t prot)=NULL;
  79. void (*vfree)(void *ptr)=NULL;
  80. void (*kfree_s)(const void *ptr,int size)=NULL;
  81. unsigned long (*virt_to_phys)(void *address)=NULL;
  82. void *(*phys_to_virt)(unsigned long adress)=NULL;
  83. int (*free_pages)(unsigned long addr,unsigned long order)=NULL;
  84. struct page *(*alloc_pages)(int gfp_mask,unsigned long order)=NULL;
  85. int (*remap_page_range)(unsigned long from,unsigned long to,unsigned long size,pgprot_t prot)=NULL;
  86. int (*is_access_ok)(int type,void *addr,unsigned long size)=NULL;
  87. void (*__copy_user)(void *to,const void *from,unsigned long n)=NULL;
  88. unsigned long (*copy_to_user)(void *to,const void *from,unsigned long n)=NULL;
  89. void (*__copy_user_zeroing)(void *to,const void *from,unsigned long n)=NULL;
  90. unsigned long (*copy_from_user)(void *to,const void *from,unsigned long n)=NULL;
  91. int (*get_user)(int size,void *dest,void *src)=NULL;
  92. int (*put_user)(int x,void *ptr)=NULL;
  93. unsigned long (*ioremap)(unsigned long addr,unsigned short usSize)=NULL;
  94. void (*iounmap)(void *addr)=NULL;
  95.  
  96. //---------------------------- semaphore management ----------------------------
  97. void (*init_MUTEX)(struct semaphore *sem)=NULL;
  98. void (*init_MUTEX_LOCKED)(struct semaphore *sem)=NULL;
  99. void (*down)(struct semaphore *sem)=NULL;
  100. void (*up)(struct semaphore *sem)=NULL;
  101.  
  102. //---------------------------- spinlock management -----------------------------
  103. void (*spin_lock_init)(spinlock_t *lock)=NULL;
  104. void (*spin_lock)(spinlock_t *lock)=NULL;
  105. void (*spin_lock_flag)(spinlock_t *lock,unsigned long *flag)=NULL;
  106. int (*spin_trylock)(spinlock_t *lock)=NULL;
  107. void (*spin_unlock_wait)(spinlock_t *lock)=NULL;
  108. void (*spin_unlock)(spinlock_t *lock)=NULL;
  109.  
  110. //----------------------------- module management ------------------------------
  111. int (*request_module)(const char *name)=NULL;
  112. int (*release_module)(const char *name)=NULL;
  113.  
  114. //---------------------------- schedule management -----------------------------
  115. unsigned long volatile *__jiffies=NULL;
  116. struct task_struct **__current=NULL;
  117. void (*add_wait_queue)(wait_queue_head_t *q,wait_queue_t *wait)=NULL;
  118. void (*add_wait_queue_exclusive)(wait_queue_head_t *q)=NULL;
  119. void (*remove_wait_queue)(wait_queue_head_t *q,wait_queue_t *wait)=NULL;
  120. void (*__wake_up)(wait_queue_head_t *q,unsigned int mode)=NULL;
  121. void (*sleep_on)(wait_queue_head_t *q)=NULL;
  122. long (*sleep_on_timeout)(wait_queue_head_t *q,signed long timeout)=NULL;
  123. void (*interruptible_sleep_on)(wait_queue_head_t *q)=NULL;
  124. long (*interruptible_sleep_on_timeout)(wait_queue_head_t *q,signed long timeout)=NULL;
  125. void (*wake_up_process)(struct task_struct *tsk)=NULL;
  126. signed long (*schedule_timeout)(signed long timeout)=NULL;
  127. void (*schedule)(void)=NULL;
  128. int (*kernel_thread)(int (*initFn)(void*),int (*fn)(void *),int (*exitFn)(void *),void *arg,unsigned long flags)=NULL;
  129. void (*tasklet_hi_schedule)(struct tq_struct *t)=NULL;
  130. void init_waitqueue_head(wait_queue_head_t *q){}
  131.  
  132. //------------------------------ timer management ------------------------------
  133. void (*add_timer)(struct timer_list * timer)=NULL;
  134. int (*mod_timer)(struct timer_list *timer,unsigned long expires)=NULL;
  135. int (*del_timer)(struct timer_list *timer)=NULL;
  136.  
  137. //---------------------------- resource management -----------------------------
  138. struct resource *__ioport_resource=NULL;
  139. struct resource *__iomem_resource=NULL;
  140. int (*request_resource)(struct resource *root,struct resource *newr)=NULL;
  141. int (*release_resource)(struct resource *old)=NULL;
  142. int (*allocate_resource)(struct resource *root,struct resource *newr,unsigned long size,unsigned long min,unsigned long max,unsigned long align,void (*alignf)(void *,struct resource*,unsigned long),void *alignf_data)=NULL;
  143. int (*request_irq)(unsigned int irq,void(*handler)(int,void*,struct pt_regs*regs),unsigned long flags,const char *name,void *data,struct lxrm_resource* rm_resource)=NULL;
  144. void (*free_irq)(unsigned int irq,void *data,struct lxrm_resource* rm_resource)=NULL;
  145. void (*eoi_irq)(unsigned int irq)=NULL;
  146. int (*__check_region)(struct resource *a,unsigned long b,unsigned long c)=NULL;
  147. struct resource* (*__request_region)(struct resource *a, unsigned long start, unsigned long n, const char *name,struct lxrm_resource *rm_resource);
  148. void (*__release_region)(struct resource *a,unsigned long b,unsigned long c,struct lxrm_resource *rm_resource)=NULL;
  149.  
  150. //------------------------------- pci management -------------------------------
  151. int *__pci_pci_problems=NULL;
  152. void (*pcibios_init)(void)=NULL;
  153. void (*pcibios_fixup_bus)(struct pci_bus *bus)=NULL;
  154. int (*pcibios_enable_device)(struct pci_dev *dev)=NULL;
  155. void (*pcibios_align_resource)(void *,struct resource *,unsigned long)=NULL;
  156.  
  157. struct pci_dev *(*pci_find_device)(unsigned int vendor,unsigned int device,const struct pci_dev *from)=NULL;
  158. struct pci_dev *(*pci_find_subsys)(unsigned int vendor,unsigned int device,unsigned int ss_vendor,unsigned int ss_device,const struct pci_dev *from)=NULL;
  159. struct pci_dev *(*pci_find_class)(unsigned int pciclass,const struct pci_dev *from)=NULL;
  160. struct pci_dev *(*pci_find_slot)(unsigned int bus,unsigned int devfn)=NULL;
  161. int (*pci_find_capability)(struct pci_dev *dev,int cap)=NULL;
  162.  
  163. int (*pci_read_config_byte)(struct pci_dev *dev, int where, u8 *val)=NULL;
  164. int (*pci_read_config_word)(struct pci_dev *dev, int where, u16 *val)=NULL;
  165. int (*pci_read_config_dword)(struct pci_dev *dev, int where, u32 *val)=NULL;
  166. int (*pci_write_config_byte)(struct pci_dev *dev, int where, u8 val)=NULL;
  167. int (*pci_write_config_word)(struct pci_dev *dev, int where, u16 val)=NULL;
  168. int (*pci_write_config_dword)(struct pci_dev *dev, int where, u32 val)=NULL;
  169.  
  170. int (*pci_enable_device)(struct pci_dev *dev)=NULL;
  171. void (*pci_disable_device)(struct pci_dev *dev)=NULL;
  172. void (*pci_set_master)(struct pci_dev *dev)=NULL;
  173. int (*pci_assign_resource)(struct pci_dev *dev, int i)=NULL;
  174.  
  175. int (*pci_register_driver)(struct pci_driver *)=NULL;
  176. void (*pci_unregister_driver)(struct pci_driver *)=NULL;
  177. void (*pci_insert_device)(struct pci_dev *, struct pci_bus *)=NULL;
  178. void (*pci_remove_device)(struct pci_dev *)=NULL;
  179. struct pci_driver *(*pci_dev_driver)(const struct pci_dev *)=NULL;
  180. const struct pci_device_id *(*pci_match_device)(const struct pci_device_id *ids, const struct pci_dev *dev)=NULL;
  181.  
  182. //------------------------------- i2c management -------------------------------
  183. int (*i2c_probe)(struct i2c_adapter *adapter,struct i2c_client_address_data *adress_data,i2c_client_found_addr_proc *found_proc)=NULL;
  184. int (*i2c_add_driver)(struct i2c_driver *)=NULL;
  185. int (*i2c_del_driver)(struct i2c_driver *)=NULL;
  186. int (*i2c_attach_client)(struct i2c_client *)=NULL;
  187. int (*i2c_detach_client)(struct i2c_client *)=NULL;
  188. int (*i2c_master_send)(struct i2c_client *,const char *,int)=NULL;
  189. int (*i2c_master_recv)(struct i2c_client *,char *,int)=NULL;
  190. int (*i2c_transfer)(struct i2c_adapter *adap,struct i2c_msg *msg,int num)=NULL;
  191.  
  192. int (*i2c_bit_add_bus)(struct i2c_adapter *)=NULL;
  193. int (*i2c_bit_del_bus)(struct i2c_adapter *)=NULL;
  194.  
  195. //---------------------------------- videodev ----------------------------------
  196. int (*video_register_device)(struct video_device *,int type,int nr)=NULL;
  197. void (*video_unregister_device)(struct video_device *)=NULL;
  198.  
  199. /******************************************************************************/
  200. /* Initialisation                                                             */
  201. /******************************************************************************/
  202. struct _IDCTABLE
  203. {
  204.  USHORT Reserved[3];
  205.  VOID (FAR *ProtIDCEntry)(VOID);
  206.  USHORT ProtIDC_DS;
  207. };
  208. typedef struct _IDCTABLE IDCTABLE;
  209. typedef struct _IDCTABLE *PIDCTABLE;
  210.  
  211. static IDCTABLE IDCTable={0};
  212.  
  213. extern ULONG __cdecl AttachToDD(char *ddname,IDCTABLE *table);
  214. extern ULONG __cdecl CallIDC(IDCTABLE *table,ULONG cmd,ULONG value);
  215.  
  216. #define DECLARE_LXAPI_STRUCT(type) \
  217. type api={LXAPI_VERSION};
  218.  
  219. #define DECLARE_LXAPI_STRUCT_AND_GET(type,cmd) \
  220. type api={LXAPI_VERSION}; \
  221. rc=CallIDC(&IDCTable,(ULONG)cmd,(ULONG)&api); \
  222. if(!rc)
  223.  
  224.  
  225. #define GETFROMLXAPI(name)name=api.name;
  226.  
  227. //------------------------------- OS2_initlxapi --------------------------------
  228. int OS2_initlxapi(void)
  229. {
  230.  int rc=0;
  231.  rc=AttachToDD("LXAPI32$",&IDCTable);
  232.  if(!rc)
  233.  { // get OS2 specific
  234.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETOS2API,LXIDCCMD_GETOS2API)
  235.   {
  236.    GETFROMLXAPI(OS2_lxioctl);
  237.    GETFROMLXAPI(OS2_add_module);
  238.    GETFROMLXAPI(OS2_apply_mod_parm);
  239.    GETFROMLXAPI(OS2_set_module_parm);
  240.    GETFROMLXAPI(OS2_get_num_modules);
  241.    GETFROMLXAPI(OS2_get_total_num_modules);
  242.    GETFROMLXAPI(OS2_get_module_name);
  243.    GETFROMLXAPI(OS2_enum_modules);
  244.   }
  245.  }
  246.  if(!rc)
  247.  {
  248.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETRMAPI,LXIDCCMD_GETRMAPI)
  249.   {
  250.    GETFROMLXAPI(RM32CreateDriver);
  251.    GETFROMLXAPI(RM32DestroyDriver);
  252.    GETFROMLXAPI(RM32CreateAdapter);
  253.    GETFROMLXAPI(RM32DestroyAdapter);
  254.    GETFROMLXAPI(RM32CreateDevice);
  255.    GETFROMLXAPI(RM32DestroyDevice);
  256.    GETFROMLXAPI(RM32AllocResource);
  257.    GETFROMLXAPI(RM32DeallocResource);
  258.    GETFROMLXAPI(RM32ModifyResources);
  259.   }
  260.  }
  261.  if(!rc)
  262.  {
  263.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETV4LAPI,LXIDCCMD_GETV4LAPI)
  264.   {
  265.    GETFROMLXAPI(OS2_v4lx_enum_devices);
  266.    GETFROMLXAPI(OS2_v4lx_get_num_devices);
  267.    GETFROMLXAPI(OS2_v4lx_open_device);
  268.    GETFROMLXAPI(OS2_v4lx_close_device);
  269.    GETFROMLXAPI(OS2_v4lx_close_all_opened_devices);
  270.    GETFROMLXAPI(OS2_v4lx_get_opened_device);
  271.    GETFROMLXAPI(OS2_v4lx_ioctl);
  272.   }
  273.  }
  274.  if(!rc)
  275.  { // get memory management
  276.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETMEMAPI,LXIDCCMD_GETMEMAPI)
  277.   {
  278.    __malloc=api.malloc;
  279.    __free=api.free;
  280.    GETFROMLXAPI(kmalloc);
  281.    GETFROMLXAPI(kfree);
  282.    GETFROMLXAPI(vmalloc);
  283.    GETFROMLXAPI(__vmalloc);
  284.    GETFROMLXAPI(vfree);
  285.    GETFROMLXAPI(kfree_s);
  286.    GETFROMLXAPI(virt_to_phys);
  287.    GETFROMLXAPI(phys_to_virt);
  288.    GETFROMLXAPI(free_pages);
  289.    GETFROMLXAPI(alloc_pages);
  290.    GETFROMLXAPI(remap_page_range);
  291.    GETFROMLXAPI(is_access_ok);
  292.    GETFROMLXAPI(__copy_user);
  293.    GETFROMLXAPI(copy_to_user);
  294.    GETFROMLXAPI(__copy_user_zeroing);
  295.    GETFROMLXAPI(copy_from_user);
  296.    GETFROMLXAPI(get_user);
  297.    GETFROMLXAPI(put_user);
  298.    GETFROMLXAPI(ioremap);
  299.    GETFROMLXAPI(iounmap);
  300.   }
  301.  }
  302.  if(!rc)
  303.  {
  304.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETSEMAPI,LXIDCCMD_GETSEMAPI)
  305.   {
  306.    GETFROMLXAPI(init_MUTEX);
  307.    GETFROMLXAPI(init_MUTEX_LOCKED);
  308.    GETFROMLXAPI(down);
  309.    GETFROMLXAPI(up);
  310.   }
  311.  }
  312.  if(!rc)
  313.  {
  314.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETSLCAPI,LXIDCCMD_GETSLCAPI)
  315.   {
  316.    GETFROMLXAPI(spin_lock_init);
  317.    GETFROMLXAPI(spin_lock);
  318.    GETFROMLXAPI(spin_lock_flag);
  319.    GETFROMLXAPI(spin_trylock);
  320.    GETFROMLXAPI(spin_unlock_wait);
  321.    GETFROMLXAPI(spin_unlock);
  322.   }
  323.  }
  324.  if(!rc)
  325.  {
  326.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETMODAPI,LXIDCCMD_GETMODAPI)
  327.   {
  328.    GETFROMLXAPI(request_module);
  329.    GETFROMLXAPI(release_module);
  330.   }
  331.  }
  332.  if(!rc)
  333.  {
  334.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETSCHAPI,LXIDCCMD_GETSCHAPI)
  335.   {
  336.    GETFROMLXAPI(__jiffies);
  337.    GETFROMLXAPI(__current);
  338.    GETFROMLXAPI(add_wait_queue);
  339.    GETFROMLXAPI(add_wait_queue_exclusive);
  340.    GETFROMLXAPI(remove_wait_queue);
  341.    GETFROMLXAPI(__wake_up);
  342.    GETFROMLXAPI(sleep_on);
  343.    GETFROMLXAPI(sleep_on_timeout);
  344.    GETFROMLXAPI(interruptible_sleep_on);
  345.    GETFROMLXAPI(interruptible_sleep_on_timeout);
  346.    GETFROMLXAPI(wake_up_process);
  347.    GETFROMLXAPI(schedule_timeout);
  348.    GETFROMLXAPI(schedule);
  349.    GETFROMLXAPI(kernel_thread);
  350.    GETFROMLXAPI(tasklet_hi_schedule);
  351.   }
  352.  }
  353.  if(!rc)
  354.  {
  355.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETTIMAPI,LXIDCCMD_GETTIMAPI)
  356.   {
  357.    GETFROMLXAPI(add_timer);
  358.    GETFROMLXAPI(mod_timer);
  359.    GETFROMLXAPI(del_timer);
  360.   }
  361.  }
  362.  if(!rc)
  363.  {
  364.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETRESAPI,LXIDCCMD_GETRESAPI)
  365.   {
  366.    GETFROMLXAPI(__ioport_resource);
  367.    GETFROMLXAPI(__iomem_resource);
  368.    GETFROMLXAPI(request_resource);
  369.    GETFROMLXAPI(release_resource);
  370.    GETFROMLXAPI(allocate_resource);
  371.    GETFROMLXAPI(request_irq);
  372.    GETFROMLXAPI(free_irq);
  373.    GETFROMLXAPI(eoi_irq);
  374.    GETFROMLXAPI(__check_region);
  375.    GETFROMLXAPI(__request_region);
  376.    GETFROMLXAPI(__release_region);
  377.   }
  378.  }
  379.  if(!rc)
  380.  {
  381.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETPCIAPI,LXIDCCMD_GETPCIAPI)
  382.   {
  383.    GETFROMLXAPI(__pci_pci_problems);
  384.    GETFROMLXAPI(pcibios_init);
  385.    GETFROMLXAPI(pcibios_fixup_bus);
  386.    GETFROMLXAPI(pcibios_enable_device);
  387.    GETFROMLXAPI(pcibios_align_resource);
  388.  
  389.    GETFROMLXAPI(pci_find_device);
  390.    GETFROMLXAPI(pci_find_subsys);
  391.    GETFROMLXAPI(pci_find_class);
  392.    GETFROMLXAPI(pci_find_slot);
  393.    GETFROMLXAPI(pci_find_capability);
  394.  
  395.    GETFROMLXAPI(pci_read_config_byte);
  396.    GETFROMLXAPI(pci_read_config_word);
  397.    GETFROMLXAPI(pci_read_config_dword);
  398.    GETFROMLXAPI(pci_write_config_byte);
  399.    GETFROMLXAPI(pci_write_config_word);
  400.    GETFROMLXAPI(pci_write_config_dword);
  401.  
  402.    GETFROMLXAPI(pci_enable_device);
  403.    GETFROMLXAPI(pci_disable_device);
  404.    GETFROMLXAPI(pci_set_master);
  405.    GETFROMLXAPI(pci_assign_resource);
  406.  
  407.    GETFROMLXAPI(pci_register_driver);
  408.    GETFROMLXAPI(pci_unregister_driver);
  409.    GETFROMLXAPI(pci_insert_device);
  410.    GETFROMLXAPI(pci_remove_device);
  411.    GETFROMLXAPI(pci_dev_driver);
  412.    GETFROMLXAPI(pci_match_device);
  413.   }
  414.  }
  415.  if(!rc)
  416.  {
  417.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETI2CAPI,LXIDCCMD_GETI2CAPI)
  418.   {
  419.    GETFROMLXAPI(i2c_probe);
  420.    GETFROMLXAPI(i2c_add_driver);
  421.    GETFROMLXAPI(i2c_del_driver);
  422.    GETFROMLXAPI(i2c_attach_client);
  423.    GETFROMLXAPI(i2c_detach_client);
  424.    GETFROMLXAPI(i2c_master_send);
  425.    GETFROMLXAPI(i2c_master_recv);
  426.    GETFROMLXAPI(i2c_transfer);
  427.    GETFROMLXAPI(i2c_bit_add_bus);
  428.    GETFROMLXAPI(i2c_bit_del_bus);
  429.   }
  430.  }
  431.  if(!rc)
  432.  {
  433.   DECLARE_LXAPI_STRUCT_AND_GET(LXIDC_GETVIDAPI,LXIDCCMD_GETVIDAPI)
  434.   {
  435.    GETFROMLXAPI(video_register_device);
  436.    GETFROMLXAPI(video_unregister_device);
  437.   }
  438.  }
  439.  return rc;
  440. }
  441.  
  442. #ifdef __cplusplus
  443. };
  444. #endif