flsysfun.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:13k
源码类别:

VxWorks

开发平台:

C/C++

  1. /*
  2.  * $Log:   P:/user/amir/lite/vcs/flsysfun.h_v  $
  3.    
  4.       Rev 1.9   03 Nov 1997 16:19:00   danig
  5.    flAddLongToFarPointer
  6.    
  7.       Rev 1.8   19 Oct 1997 16:08:28   danig
  8.    Documentation
  9.    
  10.       Rev 1.7   05 Oct 1997 15:31:30   ANDRY
  11.    flSwapBytes() added
  12.       Rev 1.6   10 Sep 1997 15:46:46   danig
  13.    FLBoolean
  14.       Rev 1.5   19 Aug 1997 20:06:06   danig
  15.    Andray's changes
  16.       Rev 1.4   24 Jul 1997 17:49:16   amirban
  17.    Changed name to flsysfun.h
  18.       Rev 1.3   07 Jul 1997 15:23:50   amirban
  19.    Ver 2.0
  20.       Rev 1.2   09 Jun 1996 18:17:04   amirban
  21.    Added removeTimer
  22.       Rev 1.1   12 May 1996 20:05:48   amirban
  23.    include "custom.h"
  24.       Rev 1.0   20 Mar 1996 13:33:20   amirban
  25.    Initial revision.
  26.  */
  27. /************************************************************************/
  28. /*                                                                      */
  29. /* FAT-FTL Lite Software Development Kit */
  30. /* Copyright (C) M-Systems Ltd. 1995-1996 */
  31. /* */
  32. /************************************************************************/
  33. #ifndef FLSYSFUN_H
  34. #define FLSYSFUN_H
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. #include "flbase.h"
  39. /*----------------------------------------------------------------------*/
  40. /*                f l S y s f u n I n i t */
  41. /* */
  42. /* Do any necessary initialization for routines in this module. */
  43. /* */
  44. /* Called from fatlite.c (flInit) */
  45. /* */
  46. /* Parameters:                                                          */
  47. /*      None */
  48. /*                                                                      */
  49. /*----------------------------------------------------------------------*/
  50. extern void flSysfunInit(void);
  51. /*----------------------------------------------------------------------*/
  52. /*                        f l D e l a y L o o p                         */
  53. /*                                                                      */
  54. /* Short delay. It is BSp specific routine                              */
  55. /*                                                                      */
  56. /* Parameters:                                                          */
  57. /*      cycles          : wait loop cycles to perform                   */
  58. /*----------------------------------------------------------------------*/
  59. extern void flDelayLoop (int  cycles);
  60. /*----------------------------------------------------------------------*/
  61. /*                  f l R a n d B y t e */
  62. /* */
  63. /* Returns a random number between 0 and 255 */
  64. /* */
  65. /* Called from FTLLITE.C */
  66. /* */
  67. /* Parameters:                                                          */
  68. /*      None */
  69. /*                                                                      */
  70. /* Returns:                                                             */
  71. /* A random number between 0 and 255 */
  72. /*----------------------------------------------------------------------*/
  73. extern unsigned flRandByte(void);
  74. /*----------------------------------------------------------------------*/
  75. /*                 f l D e l a y M s e c s */
  76. /* */
  77. /* Delays execution for a number of milliseconds. */
  78. /* If there is no msec-accuracy to the clock, this routine should wait */
  79. /* at least the time specified. */
  80. /* */
  81. /* This routine may be called from the socket interface or MTD's, and */
  82. /* is not necessary for all implementations. */
  83. /* */
  84. /* Parameters:                                                          */
  85. /*      milliseconds : Milliseconds to wait */
  86. /*                                                                      */
  87. /*----------------------------------------------------------------------*/
  88. extern void flDelayMsecs(unsigned milliseconds);
  89. /*----------------------------------------------------------------------*/
  90. /*               f l I n s t a l l T i m e r */
  91. /* */
  92. /* Installs an interval timer. */
  93. /* The implementation of this routine usually means hooking a clock */
  94. /* interrupt. The polling interval is specified as a parameter. If the  */
  95. /* clock frequency is faster, the interval timer should count several */
  96. /* clock ticks before calling the interval routine. */
  97. /* */
  98. /* This routine is necessary if POLLING_INTERVAL (custom.h) is greater */
  99. /* than 0. In this case this routine will be called from socket.c  */
  100. /* (init). It will be called to install 'socketIntervalRoutine' with a */
  101. /* period specified by POLLING_INTERVAL. */
  102. /* */
  103. /* Parameters:                                                          */
  104. /*      routine : Routine to call at each interval */
  105. /* interval : Milliseconds per polling interval */
  106. /* */
  107. /* Returns: */
  108. /*  FLStatus : 0 on success, otherwise failure */
  109. /*----------------------------------------------------------------------*/
  110. extern FLStatus flInstallTimer(void (*routine)(void), unsigned interval);
  111. #ifdef EXIT
  112. /*----------------------------------------------------------------------*/
  113. /*               f l R e m o v e T i m e r  */
  114. /* */
  115. /* Removes the active interval timer. */
  116. /* This routine removes the active interval timer set by 'removeTimer'. */
  117. /* */
  118. /* Parameters:                                                          */
  119. /*      None */
  120. /*                                                                      */
  121. /*----------------------------------------------------------------------*/
  122. extern void flRemoveTimer(void);
  123. #endif
  124. /*----------------------------------------------------------------------*/
  125. /*                f l C u r r e n t D a t e */
  126. /* */
  127. /* Returns the current DOS-format date */
  128. /* */
  129. /* The DOS date format is documented in dosformt.h. */
  130. /*                                                                      */
  131. /* If a TOD clock is not available, return the value of 1/1/80. */
  132. /* */
  133. /* Parameters:                                                          */
  134. /*      None */
  135. /*                                                                      */
  136. /* Returns:                                                             */
  137. /* Current date */
  138. /*----------------------------------------------------------------------*/
  139. extern unsigned flCurrentDate(void);
  140. /*----------------------------------------------------------------------*/
  141. /*               f l C u r r e n t T i m e */
  142. /* */
  143. /* Returns the current DOS-format time */
  144. /* */
  145. /* The DOS time format is documented in dosformt.h. */
  146. /*                                                                      */
  147. /* If a TOD clock is not available, return the value of 0:00 AM. */
  148. /* */
  149. /* Parameters:                                                          */
  150. /*      None */
  151. /*                                                                      */
  152. /* Returns:                                                             */
  153. /* Current time */
  154. /*----------------------------------------------------------------------*/
  155. extern unsigned flCurrentTime(void);
  156. /*----------------------------------------------------------------------*/
  157. /*               f l C r e a t e M u t e x */
  158. /* */
  159. /* Creates and initializes a mutex object */
  160. /* */
  161. /* The mutex is initializes as not owned by anyone. */
  162. /* */
  163. /* Parameters:                                                          */
  164. /*      mutex : Pointer to mutex object */
  165. /*                                                                      */
  166. /* Returns:                                                             */
  167. /*  FLStatus : 0 on success, otherwise failure */
  168. /*----------------------------------------------------------------------*/
  169. extern FLStatus flCreateMutex(FLMutex *mutex);
  170. /*----------------------------------------------------------------------*/
  171. /*               f l D e l e t e M u t e x */
  172. /* */
  173. /* Destroys a mutex object */
  174. /* */
  175. /* This function frees any resources taken by flCreateMutex. */
  176. /* */
  177. /* Parameters:                                                          */
  178. /*      mutex : Pointer to mutex object */
  179. /*                                                                      */
  180. /* Returns:                                                             */
  181. /*  None */
  182. /*----------------------------------------------------------------------*/
  183. extern void flDeleteMutex(FLMutex *mutex);
  184. /*----------------------------------------------------------------------*/
  185. /*                 f l T a k e M u t e x */
  186. /* */
  187. /* Attempts to take ownership of a mutex. If the mutex is currently not */
  188. /* owned, TRUE is returned and the mutex becomes owned. If the mutex is */
  189. /* currently owned, FALSE is returned and ownership is not taken. */
  190. /* */
  191. /* Parameters:                                                          */
  192. /*      mutex : Pointer to mutex object */
  193. /*                                                                      */
  194. /* Returns:                                                             */
  195. /*  FLBoolean : TRUE if ownership taken, FALSE otherwise */
  196. /*----------------------------------------------------------------------*/
  197. extern FLBoolean flTakeMutex(FLMutex *mutex, int mode);
  198. /*----------------------------------------------------------------------*/
  199. /*                 f l F r e e M u t e x */
  200. /* */
  201. /* Frees ownership of a mutex */
  202. /* */
  203. /* Parameters:                                                          */
  204. /*      mutex : Pointer to mutex object */
  205. /*                                                                      */
  206. /* Returns:                                                             */
  207. /*  None */
  208. /*----------------------------------------------------------------------*/
  209. extern void flFreeMutex(FLMutex *mutex);
  210. #if FALSE
  211. /*----------------------------------------------------------------------*/
  212. /*                 f l I n p o r t b */
  213. /* */
  214. /* Reads a byte from an I/O port. */
  215. /* */
  216. /* Parameters:                                                          */
  217. /*      portId : Id or address of port */
  218. /*                                                                      */
  219. /* Returns:                                                             */
  220. /*  unsigned char : Value of I/O port */
  221. /*----------------------------------------------------------------------*/
  222. extern unsigned char flInportb(unsigned portId);
  223. /*----------------------------------------------------------------------*/
  224. /*                 f l O u t p o r t b */
  225. /* */
  226. /* Writes a byte to an I/O port. */
  227. /* */
  228. /* Parameters:                                                          */
  229. /*      portId : Id or address of port */
  230. /*      value : Value to write */
  231. /*                                                                      */
  232. /* Returns:                                                             */
  233. /*  None */
  234. /*----------------------------------------------------------------------*/
  235. extern void flOutportb(unsigned portId, unsigned char value);
  236. #endif /* FALSE */
  237. /*----------------------------------------------------------------------*/
  238. /*                 f l S w a p B y t e s */
  239. /* */
  240. /* Swap bytes in a given buffer. */
  241. /* */
  242. /* Parameters:                                                          */
  243. /*      buf : buffer that holds bytes to swap */
  244. /*      len : number of bytes to swap */
  245. /*                                                                      */
  246. /* Returns:                                                             */
  247. /*  None */
  248. /*----------------------------------------------------------------------*/
  249. extern void flSwapBytes(char FAR1 *buf, int len);
  250. /*----------------------------------------------------------------------*/
  251. /*                 f l A d d L o n g T o F a r P o i n t e r            */
  252. /* */
  253. /* Add unsigned long offset to the far pointer                          */
  254. /* */
  255. /* Parameters:                                                          */
  256. /*      ptr             : far pointer                                   */
  257. /*      offset          : offset in bytes                               */
  258. /*                                                                      */
  259. /*----------------------------------------------------------------------*/
  260. extern void FAR0* flAddLongToFarPointer(void FAR0 *ptr, unsigned long offset);
  261. /*----------------------------------------------------------------------*/
  262. /*                 f l F i t I n S o c k e t W i n d o w                */
  263. /* */
  264. /* Check if flash array fits in socket window */
  265. /* */
  266. /* Parameters: */
  267. /* chipSize : long int */
  268. /* interleaving : int */
  269. /* windowSize : long int */
  270. /* */
  271. /*----------------------------------------------------------------------*/
  272. extern long int flFitInSocketWindow (long int chipSize, int interleaving, 
  273.       long int windowSize);
  274. #ifdef __cplusplus
  275. }
  276. #endif
  277. #endif