home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / lxapiidc.h < prev    next >
C/C++ Source or Header  |  2002-04-22  |  13KB  |  261 lines

  1. /*
  2.  * lxapiidc.h
  3.  * Autor:               Stefan Milcke
  4.  * Erstellt am:         27.12.2001
  5.  * Letzte Aenderung am: 14.04.2002
  6.  *
  7. */
  8.  
  9. #ifndef LXAPIIDC_H_INCLUDED
  10. #define LXAPIIDC_H_INCLUDED
  11.  
  12. /* defines for OS/2 include */
  13.  
  14. /* Standard headers */
  15.  
  16. /* Application headers */
  17.  
  18. /* OS/2 Headers */
  19. #include <lxrmcall.h>
  20.  
  21. #define LXAPI_VERSION                           1
  22.  
  23. //-------------------------------- OS2 specific --------------------------------
  24. #define LXIDCCMD_GETOS2API                      1
  25. #pragma pack(1)
  26. typedef struct _LXIDC_GETOS2API
  27. {
  28.  unsigned long required_version;       // IN: Required version
  29.  unsigned long actual_version;         // OUT: Actual version
  30.  unsigned long (*OS2_lxioctl)(void __far* requestPacketPtr);
  31.  int (*OS2_add_module)(struct os2lx_module *pModule);
  32.  int (*OS2_apply_mod_parm)(char *parm,struct os2lx_parm *parmList,int num);
  33.  int (*OS2_set_module_parm)(char *parm);
  34.  int (*OS2_get_num_modules)(void);
  35.  int (*OS2_get_total_num_modules)(void);
  36.  char *(*OS2_get_module_name)(int nr);
  37.  int (*OS2_enum_modules)(void *buffer,unsigned long buffer_len);
  38. }LXIDC_GETOS2API,*PLXIDC_GETOS2API;
  39.  
  40. //------------------------------ resource manager ------------------------------
  41. #define LXIDCCMD_GETRMAPI                       2
  42. typedef struct _LXIDC_GETRMAPI
  43. {
  44.  unsigned long required_version;       // IN: Required version
  45.  unsigned long actual_version;         // OUT: Actual version
  46.  unsigned long __cdecl (*RM32CreateDriver)(DRIVERSTRUCT*,HDRIVER*);
  47.  unsigned long __cdecl (*RM32DestroyDriver)(HDRIVER);
  48.  unsigned long __cdecl (*RM32CreateAdapter)(HDRIVER,HADAPTER*,ADAPTERSTRUCT*,HDEVICE,AHRESOURCE*);
  49.  unsigned long __cdecl (*RM32DestroyAdapter)(HDRIVER,HADAPTER);
  50.  unsigned long __cdecl (*RM32CreateDevice)(HDRIVER,HDEVICE*,DEVICESTRUCT*,HADAPTER,AHRESOURCE*);
  51.  unsigned long __cdecl (*RM32DestroyDevice)(HDRIVER,HDEVICE);
  52.  unsigned long __cdecl (*RM32AllocResource)(HDRIVER,HRESOURCE*,RESOURCESTRUCT*);
  53.  unsigned long __cdecl (*RM32DeallocResource)(HDRIVER,HRESOURCE);
  54.  unsigned long __cdecl (*RM32ModifyResources)(HDRIVER,HADAPTER,USHORT,HRESOURCE);
  55. }LXIDC_GETRMAPI,*PLXIDC_GETRMAPI;
  56.  
  57. //--------------------------- video for linux (V4L) ----------------------------
  58. #define LXIDCCMD_GETV4LAPI                      3
  59. typedef struct _LXIDC_GETV4LAPI
  60. {
  61.  unsigned long required_version;       // IN: Required version
  62.  unsigned long actual_version;         // OUT: Actual version
  63.  int (*OS2_v4lx_enum_devices)(void *buffer,unsigned long buffer_len);
  64.  unsigned long (*OS2_v4lx_get_num_devices)(void);
  65.  int (*OS2_v4lx_open_device)(char *devname);
  66.  int (*OS2_v4lx_close_device)(int handle);
  67.  void (*OS2_v4lx_close_all_opened_devices)(void);
  68.  struct video_device *(*OS2_v4lx_get_opened_device)(int handle);
  69.  int (*OS2_v4lx_ioctl)(int handle,int ioctlfn,void *userData);
  70. }LXIDC_GETV4LAPI,*PLXIDC_GETV4LAPI;
  71.  
  72. //----------------------------- memory management ------------------------------
  73. #define LXIDCCMD_GETMEMAPI                      101
  74. typedef struct _LXIDC_GETMEMAPI
  75. {
  76.  unsigned long required_version;       // IN: Required version
  77.  unsigned long actual_version;         // OUT: Actual version
  78.  void *(*malloc)(unsigned long size);
  79.  void (*free)(void *ptr);
  80.  void *(*kmalloc)(int size,int flags);
  81.  void (*kfree)(const void *ptr);
  82.  void *(*vmalloc)(unsigned long size);
  83.  void *(*__vmalloc)(unsigned long size,int gfp_mask,pgprot_t prot);
  84.  void (*vfree)(void *ptr);
  85.  void (*kfree_s)(const void *ptr,int size);
  86.  unsigned long (*virt_to_phys)(void *address);
  87.  void *(*phys_to_virt)(unsigned long adress);
  88.  int (*free_pages)(unsigned long addr,unsigned long order);
  89.  struct page *(*alloc_pages)(int gfp_mask,unsigned long order);
  90.  int (*remap_page_range)(unsigned long from,unsigned long to,unsigned long size,pgprot_t prot);
  91.  int (*is_access_ok)(int type,void *addr,unsigned long size);
  92.  void (*__copy_user)(void *to,const void *from,unsigned long n);
  93.  unsigned long (*copy_to_user)(void *to,const void *from,unsigned long n);
  94.  void (*__copy_user_zeroing)(void *to,const void *from,unsigned long n);
  95.  unsigned long (*copy_from_user)(void *to,const void *from,unsigned long n);
  96.  int (*get_user)(int size,void *dest,void *src);
  97.  int (*put_user)(int x,void *ptr);
  98.  unsigned long (*ioremap)(unsigned long addr,unsigned short usSize);
  99.  void (*iounmap)(void *addr);
  100. }LXIDC_GETMEMAPI,*PLXIDC_GETMEMAPI;
  101.  
  102.  
  103. //---------------------------- semaphore management ----------------------------
  104. #define LXIDCCMD_GETSEMAPI                      102
  105. typedef struct _LXIDC_GETSEMAPI
  106. {
  107.  unsigned long required_version;       // IN: Required version
  108.  unsigned long actual_version;         // OUT: Actual version
  109.  void (*init_MUTEX)(struct semaphore *sem);
  110.  void (*init_MUTEX_LOCKED)(struct semaphore *sem);
  111.  void (*down)(struct semaphore *sem);
  112.  void (*up)(struct semaphore *sem);
  113. }LXIDC_GETSEMAPI,*PLXIDC_GETSEMAPI;
  114.  
  115. //---------------------------- spinlock management -----------------------------
  116. #define LXIDCCMD_GETSLCAPI                      103
  117. typedef struct _LXIDC_GETSLCAPI
  118. {
  119.  unsigned long required_version;       // IN: Required version
  120.  unsigned long actual_version;         // OUT: Actual version
  121.  void (*spin_lock_init)(spinlock_t *lock);
  122.  void (*spin_lock)(spinlock_t *lock);
  123.  void (*spin_lock_flag)(spinlock_t *lock,unsigned long *flag);
  124.  int (*spin_trylock)(spinlock_t *lock);
  125.  void (*spin_unlock_wait)(spinlock_t *lock);
  126.  void (*spin_unlock)(spinlock_t *lock);
  127. }LXIDC_GETSLCAPI,*PLXIDC_GETSLCAPI;
  128.  
  129. //----------------------------- module management ------------------------------
  130. #define LXIDCCMD_GETMODAPI                      104
  131. typedef struct _LXIDC_GETMODAPI
  132. {
  133.  unsigned long required_version;       // IN: Required version
  134.  unsigned long actual_version;         // OUT: Actual version
  135.  int (*request_module)(const char *name);
  136.  int (*release_module)(const char *name);
  137. }LXIDC_GETMODAPI,*PLXIDC_GETMODAPI;
  138.  
  139. //---------------------------- schedule management -----------------------------
  140. #define LXIDCCMD_GETSCHAPI                      105
  141. typedef struct _LXIDC_GETSCHAPI
  142. {
  143.  unsigned long required_version;       // IN: Required version
  144.  unsigned long actual_version;         // OUT: Actual version
  145.  unsigned long volatile *__jiffies;
  146.  struct task_struct **__current;
  147.  void (*add_wait_queue)(wait_queue_head_t *q,wait_queue_t *wait);
  148.  void (*add_wait_queue_exclusive)(wait_queue_head_t *q);
  149.  void (*remove_wait_queue)(wait_queue_head_t *q,wait_queue_t *wait);
  150.  void (*__wake_up)(wait_queue_head_t *q,unsigned int mode);
  151.  void (*sleep_on)(wait_queue_head_t *q);
  152.  long (*sleep_on_timeout)(wait_queue_head_t *q,signed long timeout);
  153.  void (*interruptible_sleep_on)(wait_queue_head_t *q);
  154.  long (*interruptible_sleep_on_timeout)(wait_queue_head_t *q,signed long timeout);
  155.  void (*wake_up_process)(struct task_struct *tsk);
  156.  signed long (*schedule_timeout)(signed long timeout);
  157.  void (*schedule)(void);
  158.  int (*kernel_thread)(int (*initFn)(void*),int (*fn)(void *),int (*exitFn)(void *),void *arg,unsigned long flags);
  159.  void (*tasklet_hi_schedule)(struct tq_struct *t);
  160. }LXIDC_GETSCHAPI,*PLXIDC_GETSCHAPI;
  161.  
  162. //------------------------------ timer management ------------------------------
  163. #define LXIDCCMD_GETTIMAPI                      106
  164. typedef struct _LXIDC_GETTIMAPI
  165. {
  166.  unsigned long required_version;       // IN: Required version
  167.  unsigned long actual_version;         // OUT: Actual version
  168.  void (*add_timer)(struct timer_list * timer);
  169.  int (*mod_timer)(struct timer_list *timer,unsigned long expires);
  170.  int (*del_timer)(struct timer_list *timer);
  171. }LXIDC_GETTIMAPI,*PLXIDC_GETTIMAPI;
  172.  
  173. //---------------------------- resource management -----------------------------
  174. #define LXIDCCMD_GETRESAPI                      107
  175. typedef struct _LXIDC_GETRESAPI
  176. {
  177.  unsigned long required_version;       // IN: Required version
  178.  unsigned long actual_version;         // OUT: Actual version
  179.  struct resource *__ioport_resource;
  180.  struct resource *__iomem_resource;
  181.  int (*request_resource)(struct resource *root,struct resource *newr);
  182.  int (*release_resource)(struct resource *old);
  183.  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);
  184.  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);
  185.  void (*free_irq)(unsigned int irq,void *data,struct lxrm_resource* rm_resource);
  186.  void (*eoi_irq)(unsigned int irq);
  187.  int (*__check_region)(struct resource *a,unsigned long b,unsigned long c);
  188.  struct resource* (*__request_region)(struct resource *a,unsigned long start,unsigned long n,const char *name,struct lxrm_resource *rm_resource);
  189.  void (*__release_region)(struct resource *a,unsigned long b,unsigned long c,struct lxrm_resource *rm_resource);
  190. }LXIDC_GETRESAPI,*PLXIDC_GETRESAPI;
  191.  
  192. //------------------------------- pci management -------------------------------
  193. #define LXIDCCMD_GETPCIAPI                      200
  194. typedef struct _LXIDC_GETPCIAPI
  195. {
  196.  unsigned long required_version;       // IN: Required version
  197.  unsigned long actual_version;         // OUT: Actual version
  198.  int *__pci_pci_problems;
  199.  void (*pcibios_init)(void);
  200.  void (*pcibios_fixup_bus)(struct pci_bus *bus);
  201.  int (*pcibios_enable_device)(struct pci_dev *dev);
  202.  void (*pcibios_align_resource)(void *,struct resource *,unsigned long);
  203.  
  204.  struct pci_dev *(*pci_find_device)(unsigned int vendor,unsigned int device,const struct pci_dev *from);
  205.  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);
  206.  struct pci_dev *(*pci_find_class)(unsigned int pciclass,const struct pci_dev *from);
  207.  struct pci_dev *(*pci_find_slot)(unsigned int bus,unsigned int devfn);
  208.  int (*pci_find_capability)(struct pci_dev *dev,int cap);
  209.  
  210.  int (*pci_read_config_byte)(struct pci_dev *dev, int where, u8 *val);
  211.  int (*pci_read_config_word)(struct pci_dev *dev, int where, u16 *val);
  212.  int (*pci_read_config_dword)(struct pci_dev *dev, int where, u32 *val);
  213.  int (*pci_write_config_byte)(struct pci_dev *dev, int where, u8 val);
  214.  int (*pci_write_config_word)(struct pci_dev *dev, int where, u16 val);
  215.  int (*pci_write_config_dword)(struct pci_dev *dev, int where, u32 val);
  216.  
  217.  int (*pci_enable_device)(struct pci_dev *dev);
  218.  void (*pci_disable_device)(struct pci_dev *dev);
  219.  void (*pci_set_master)(struct pci_dev *dev);
  220.  int (*pci_assign_resource)(struct pci_dev *dev, int i);
  221.  
  222.  int (*pci_register_driver)(struct pci_driver *);
  223.  void (*pci_unregister_driver)(struct pci_driver *);
  224.  void (*pci_insert_device)(struct pci_dev *, struct pci_bus *);
  225.  void (*pci_remove_device)(struct pci_dev *);
  226.  struct pci_driver *(*pci_dev_driver)(const struct pci_dev *);
  227.  const struct pci_device_id *(*pci_match_device)(const struct pci_device_id *ids, const struct pci_dev *dev);
  228. }LXIDC_GETPCIAPI,*PLXIDC_GETPCIAPI;
  229.  
  230. //------------------------------- i2c management -------------------------------
  231. #define LXIDCCMD_GETI2CAPI                      201
  232. typedef struct _LXIDC_GETI2CAPI
  233. {
  234.  unsigned long required_version;       // IN: Required version
  235.  unsigned long actual_version;         // OUT: Actual version
  236.  int (*i2c_probe)(struct i2c_adapter *adapter,struct i2c_client_address_data *adress_data,i2c_client_found_addr_proc *found_proc);
  237.  int (*i2c_add_driver)(struct i2c_driver *);
  238.  int (*i2c_del_driver)(struct i2c_driver *);
  239.  int (*i2c_attach_client)(struct i2c_client *);
  240.  int (*i2c_detach_client)(struct i2c_client *);
  241.  int (*i2c_master_send)(struct i2c_client *,const char *,int);
  242.  int (*i2c_master_recv)(struct i2c_client *,char *,int);
  243.  int (*i2c_transfer)(struct i2c_adapter *adap,struct i2c_msg *msg,int num);
  244.  
  245.  int (*i2c_bit_add_bus)(struct i2c_adapter *);
  246.  int (*i2c_bit_del_bus)(struct i2c_adapter *);
  247. }LXIDC_GETI2CAPI,*PLXIDC_GETI2CAPI;
  248.  
  249. //---------------------------------- videodev ----------------------------------
  250. #define LXIDCCMD_GETVIDAPI                      300
  251. typedef struct _LXIDC_GETVIDAPI
  252. {
  253.  unsigned long required_version;       // IN: Required version
  254.  unsigned long actual_version;         // OUT: Actual version
  255.  int (*video_register_device)(struct video_device *,int type,int nr);
  256.  void (*video_unregister_device)(struct video_device *);
  257. }LXIDC_GETVIDAPI,*PLXIDC_GETVIDAPI;
  258. #pragma pack()
  259.  
  260. #endif //LXAPIIDC_H_INCLUDED
  261.