Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

306 lines
13 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/FLSYSFUN.H_V $
  3. *
  4. * Rev 1.2 Jul 13 2001 01:06:40 oris
  5. * Changed copywrite date.
  6. *
  7. * Rev 1.1 Apr 18 2001 09:31:14 oris
  8. * added new line at the end of the file.
  9. *
  10. * Rev 1.0 Feb 04 2001 11:59:26 oris
  11. * Initial revision.
  12. *
  13. */
  14. /***********************************************************************************/
  15. /* M-Systems Confidential */
  16. /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */
  17. /* All Rights Reserved */
  18. /***********************************************************************************/
  19. /* NOTICE OF M-SYSTEMS OEM */
  20. /* SOFTWARE LICENSE AGREEMENT */
  21. /* */
  22. /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
  23. /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
  24. /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
  25. /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
  26. /* E-MAIL = [email protected] */
  27. /***********************************************************************************/
  28. #ifndef FLSYSFUN_H
  29. #define FLSYSFUN_H
  30. /*#include "flbase.h" */
  31. /*----------------------------------------------------------------------*/
  32. /* f l S y s f u n I n i t */
  33. /* */
  34. /* Do any necessary initialization for routines in this module. */
  35. /* */
  36. /* Called from fatlite.c (flInit) */
  37. /* */
  38. /* Parameters: */
  39. /* None */
  40. /* */
  41. /*----------------------------------------------------------------------*/
  42. extern void flSysfunInit(void);
  43. /*----------------------------------------------------------------------*/
  44. /* f l R a n d B y t e */
  45. /* */
  46. /* Returns a random number between 0 and 255 */
  47. /* */
  48. /* Called from FTLLITE.C */
  49. /* */
  50. /* Parameters: */
  51. /* None */
  52. /* */
  53. /* Returns: */
  54. /* A random number between 0 and 255 */
  55. /*----------------------------------------------------------------------*/
  56. extern unsigned flRandByte(void);
  57. /*----------------------------------------------------------------------*/
  58. /* f l D e l a y M s e c s */
  59. /* */
  60. /* Delays execution for a number of milliseconds. */
  61. /* If there is no msec-accuracy to the clock, this routine should wait */
  62. /* at least the time specified. */
  63. /* */
  64. /* This routine may be called from the socket interface or MTD's, and */
  65. /* is not necessary for all implementations. */
  66. /* */
  67. /* Parameters: */
  68. /* milliseconds : Milliseconds to wait */
  69. /* */
  70. /*----------------------------------------------------------------------*/
  71. extern void flDelayMsecs(unsigned milliseconds);
  72. /*----------------------------------------------------------------------*/
  73. /* f l s l e e p */
  74. /* */
  75. /* wait number of milliseconds with yield CPU. */
  76. /* */
  77. /* Parameters: */
  78. /* msec : minimum number of milliseconds to wait */
  79. /* */
  80. /*----------------------------------------------------------------------*/
  81. extern void flsleep(unsigned long msec);
  82. /*----------------------------------------------------------------------*/
  83. /* f l I n s t a l l T i m e r */
  84. /* */
  85. /* Installs an interval timer. */
  86. /* The implementation of this routine usually means hooking a clock */
  87. /* interrupt. The polling interval is specified as a parameter. If the */
  88. /* clock frequency is faster, the interval timer should count several */
  89. /* clock ticks before calling the interval routine. */
  90. /* */
  91. /* This routine is necessary if POLLING_INTERVAL (custom.h) is greater */
  92. /* than 0. In this case this routine will be called from socket.c */
  93. /* (init). It will be called to install 'socketIntervalRoutine' with a */
  94. /* period specified by POLLING_INTERVAL. */
  95. /* */
  96. /* Parameters: */
  97. /* routine : Routine to call at each interval */
  98. /* interval : Milliseconds per polling interval */
  99. /* */
  100. /* Returns: */
  101. /* FLStatus : 0 on success, otherwise failure */
  102. /*----------------------------------------------------------------------*/
  103. extern FLStatus flInstallTimer(void (*routine)(void), unsigned interval);
  104. #ifdef EXIT
  105. /*----------------------------------------------------------------------*/
  106. /* f l R e m o v e T i m e r */
  107. /* */
  108. /* Removes the active interval timer. */
  109. /* This routine removes the active interval timer set by 'removeTimer'. */
  110. /* */
  111. /* Parameters: */
  112. /* None */
  113. /* */
  114. /*----------------------------------------------------------------------*/
  115. extern void flRemoveTimer(void);
  116. #endif
  117. /*----------------------------------------------------------------------*/
  118. /* f l C u r r e n t D a t e */
  119. /* */
  120. /* Returns the current DOS-format date */
  121. /* */
  122. /* The DOS date format is documented in dosformt.h. */
  123. /* */
  124. /* If a TOD clock is not available, return the value of 1/1/80. */
  125. /* */
  126. /* Parameters: */
  127. /* None */
  128. /* */
  129. /* Returns: */
  130. /* Current date */
  131. /*----------------------------------------------------------------------*/
  132. extern unsigned flCurrentDate(void);
  133. /*----------------------------------------------------------------------*/
  134. /* f l C u r r e n t T i m e */
  135. /* */
  136. /* Returns the current DOS-format time */
  137. /* */
  138. /* The DOS time format is documented in dosformt.h. */
  139. /* */
  140. /* If a TOD clock is not available, return the value of 0:00 AM. */
  141. /* */
  142. /* Parameters: */
  143. /* None */
  144. /* */
  145. /* Returns: */
  146. /* Current time */
  147. /*----------------------------------------------------------------------*/
  148. extern unsigned flCurrentTime(void);
  149. /*----------------------------------------------------------------------*/
  150. /* f l C r e a t e M u t e x */
  151. /* */
  152. /* Creates and initializes a mutex object */
  153. /* */
  154. /* The mutex is initializes as not owned by anyone. */
  155. /* */
  156. /* Parameters: */
  157. /* mutex : Pointer to mutex object */
  158. /* */
  159. /* Returns: */
  160. /* FLStatus : 0 on success, otherwise failure */
  161. /*----------------------------------------------------------------------*/
  162. extern FLStatus flCreateMutex(FLMutex *mutex);
  163. /*----------------------------------------------------------------------*/
  164. /* f l D e l e t e M u t e x */
  165. /* */
  166. /* Destroys a mutex object */
  167. /* */
  168. /* This function frees any resources taken by flCreateMutex. */
  169. /* */
  170. /* Parameters: */
  171. /* mutex : Pointer to mutex object */
  172. /* */
  173. /* Returns: */
  174. /* None */
  175. /*----------------------------------------------------------------------*/
  176. extern void flDeleteMutex(FLMutex *mutex);
  177. /*----------------------------------------------------------------------*/
  178. /* f l T a k e M u t e x */
  179. /* */
  180. /* Attempts to take ownership of a mutex. If the mutex is currently not */
  181. /* owned, TRUE is returned and the mutex becomes owned. If the mutex is */
  182. /* currently owned, FALSE is returned and ownership is not taken. */
  183. /* */
  184. /* Parameters: */
  185. /* mutex : Pointer to mutex object */
  186. /* */
  187. /* Returns: */
  188. /* FLBoolean : TRUE if ownership taken, FALSE otherwise */
  189. /*----------------------------------------------------------------------*/
  190. extern FLBoolean flTakeMutex(FLMutex *mutex);
  191. /*----------------------------------------------------------------------*/
  192. /* f l F r e e M u t e x */
  193. /* */
  194. /* Frees ownership of a mutex */
  195. /* */
  196. /* Parameters: */
  197. /* mutex : Pointer to mutex object */
  198. /* */
  199. /* Returns: */
  200. /* None */
  201. /*----------------------------------------------------------------------*/
  202. extern void flFreeMutex(FLMutex *mutex);
  203. /*----------------------------------------------------------------------*/
  204. /* f l I n p o r t b */
  205. /* */
  206. /* Reads a byte from an I/O port. */
  207. /* */
  208. /* Parameters: */
  209. /* portId : Id or address of port */
  210. /* */
  211. /* Returns: */
  212. /* unsigned char : Value of I/O port */
  213. /*----------------------------------------------------------------------*/
  214. extern unsigned char flInportb(unsigned portId);
  215. /*----------------------------------------------------------------------*/
  216. /* f l O u t p o r t b */
  217. /* */
  218. /* Writes a byte to an I/O port. */
  219. /* */
  220. /* Parameters: */
  221. /* portId : Id or address of port */
  222. /* value : Value to write */
  223. /* */
  224. /* Returns: */
  225. /* None */
  226. /*----------------------------------------------------------------------*/
  227. extern void flOutportb(unsigned portId, unsigned char value);
  228. /*----------------------------------------------------------------------*/
  229. /* f l S w a p B y t e s */
  230. /* */
  231. /* Swap bytes in a given buffer. */
  232. /* */
  233. /* Parameters: */
  234. /* buf : buffer that holds bytes to swap */
  235. /* len : number of bytes to swap */
  236. /* */
  237. /* Returns: */
  238. /* None */
  239. /*----------------------------------------------------------------------*/
  240. extern void flSwapBytes(char FAR1 *buf, int len);
  241. /*----------------------------------------------------------------------*/
  242. /* f l A d d L o n g T o F a r P o i n t e r */
  243. /* */
  244. /* Add unsigned long offset to the far pointer */
  245. /* */
  246. /* Parameters: */
  247. /* ptr : far pointer */
  248. /* offset : offset in bytes */
  249. /* */
  250. /*----------------------------------------------------------------------*/
  251. extern void FAR0* flAddLongToFarPointer(void FAR0 *ptr, unsigned long offset);
  252. #endif