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

  1. /* $Id: lxmisc.c,v 1.2 2002/04/26 23:09:24 smilcke Exp $ */
  2.  
  3. /*
  4.  * misc.c
  5.  * Autor:               Stefan Milcke
  6.  * Erstellt am:         08.11.2001
  7.  * Letzte Aenderung am: 20.03.2002
  8.  *
  9. */
  10. #include "hwaccess.h"
  11. #include <linux/init.h>
  12. #include <linux/poll.h>
  13. #include <asm/uaccess.h>
  14. #include <asm/hardirq.h>
  15. #include <linux/ioport.h>
  16. #include <linux/utsname.h>
  17. #include <linux/time.h>
  18.  
  19. struct new_utsname system_utsname = {0};
  20. struct resource ioport_resource={"PCI IO",0x0000,IO_SPACE_LIMIT,IORESOURCE_IO};
  21. struct resource iomem_resource= {"PCI mem",0x00000000,0xffffffff,IORESOURCE_MEM};
  22. mem_map_t *mem_map = 0;
  23.  
  24. #ifdef TARGET_OS2
  25. struct lxrm_resource;
  26. #endif
  27. //---------------------------------- set_bit -----------------------------------
  28. void set_bit(int nr, volatile void * addr)
  29. {
  30.  volatile unsigned long *pAddr = (volatile unsigned long *)addr;
  31.  
  32.    *pAddr = (*pAddr) | (1 << nr);
  33. }
  34.  
  35. //--------------------------------- clear_bit ----------------------------------
  36. void clear_bit(int nr, volatile void * addr)
  37. {
  38.  volatile unsigned long *pAddr = (volatile unsigned long *)addr;
  39.  
  40.    *pAddr = (*pAddr) & ~(1 << nr);
  41. }
  42.  
  43. //----------------------------------- printk -----------------------------------
  44. int printk(const char * fmt, ...)
  45. {
  46.   return 0;
  47. }
  48.  
  49. //--------------------------------- poll_wait ----------------------------------
  50. void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
  51. {
  52.  
  53. }
  54.  
  55.  
  56. //------------------------------- __check_region -------------------------------
  57. int __check_region(struct resource *a, unsigned long b, unsigned long c)
  58. {
  59.   return 0;
  60. }
  61.  
  62. extern unsigned long OS2_request_region(struct lxrm_resource *rm_resource
  63.                                         ,struct resource *a
  64.                                         ,unsigned long start,unsigned long n);
  65. extern unsigned long OS2_release_region(struct lxrm_resource *rm_resource
  66.                                         ,struct resource *a
  67.                                         ,unsigned long start,unsigned long n);
  68. //------------------------------ __release_region ------------------------------
  69. void __release_region(struct resource *a, unsigned long b, unsigned long c,struct lxrm_resource *rm_resource)
  70. {
  71.  OS2_release_region(rm_resource,a,b,c);
  72. }
  73.  
  74. //------------------------------ __request_region ------------------------------
  75. struct resource * __request_region(struct resource *a, unsigned long start, unsigned long n, const char *name,struct lxrm_resource *rm_resource)
  76. {
  77.  if(0==OS2_request_region(rm_resource,a,start,n))
  78.   return a;
  79.  return NULL;
  80. }
  81.  
  82. //------------------------------ do_gettimeofday -------------------------------
  83. void do_gettimeofday(struct timeval *tv)
  84. {
  85.  tv->tv_sec=0;    // seconds
  86.  tv->tv_usec=0;   // microseconds
  87. }
  88.  
  89. void iodelay32(unsigned long);
  90. // Wrong parameter register [eax] ??? (SM)
  91. //#pragma aux iodelay32 parm nomemory [eax] modify nomemory exact [eax ecx];
  92. #pragma aux iodelay32 parm nomemory [ecx] modify nomemory exact [eax ecx];
  93.  
  94. //---------------------------------- __udelay ----------------------------------
  95. void __udelay(unsigned long usecs)
  96. {
  97.   iodelay32(usecs*2);
  98. }
  99.