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

VxWorks

开发平台:

C/C++

  1. /* sysLib.h - system dependent routines header */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 03s,24apr02,pai  Removed sysHwInit0() prototype.  A generic interface of this
  7.                  name is not yet defined.
  8. 03r,15apr02,pai  added sysHwInit0() prototype (SPR 74951).
  9. 03q,10oct01,dat  SPR 70855, adding sysNanoDelay as an optional BSP API
  10. 03p,09jun98,dat  rework of optional BSP routine declarations
  11. 03o,14nov97,db   added functions forward declarations for PPC family.
  12. 03n,05nov96,hdn  moved NETIF structure from bootConfig.c.
  13. 03m,18sep96,dat  added sysBspRev, sysPhysMemTop, sysScsiConfig,
  14.  sysSerialHwInit, sysSerialHwInit2, sysSerialReset
  15. 03l,06aug96,dat  using #include timerDev.h to declare timer functions
  16. 03k,13jun96,hdn  added sysInLong() sysInLongString() sysOutLong()
  17.  sysOutLongString().
  18. 03j,15jun95,ms  updated for new serial driver
  19. 03i,14jun95,hdn  added x86 specific prototypes.
  20. 03h,22may95,ms   added sysSerialDevGet() prototype.
  21. 03g,22sep92,rrr  added support for c++
  22. 03f,15sep92,jcf  cleaned up.
  23. 03e,31jul92,ccc  added tyCoDrv() and tyCoDevCreate() prototypes.
  24. 03d,27jul92,ccc  added prototypes to clean up os warnings.
  25. 03c,09rdc92,rdc  moved PHYS_MEM_DESC struct to vmLib.c.
  26. 03b,08rdc92,rdc  added PHYS_MEM_DESC struct.
  27. 03a,04jul92,jcf  cleaned up.
  28. 02b,26jun92,wmd  modified prototype for sysFaultTableInit().
  29. 02a,16jun92,ccc  removed function declarations for sysLib break-up.
  30. 01z,26may92,rrr  the tree shuffle
  31. 01y,23apr92,wmd  added sysFaultVecSet() prototype declaration for i960.
  32. 01x,21apr92,ccc  added SCSI declarations.
  33. 01w,16apr92,elh  added SYSFLG_PROXY.
  34. 01v,04apr92,elh  added SYSFLG_TFTP.
  35. 01u,18dec91,wmd  added mre ANSI prototypes for i960.
  36. 01t,04oct91,rrr  passed through the ansification filter
  37.   -fixed #else and #endif
  38.   -changed VOID to void
  39.   -changed ASMLANGUAGE to _ASMLANGUAGE
  40.   -changed copyright notice
  41. 01s,23oct90,shl  added a set of generic system dependent function prototypes.
  42. 01r,05oct90,dnw  added some ANSI prototypes.
  43. 01q,05oct90,shl  added copyright notice.
  44.                  made #endif ANSI style.
  45. 01p,10aug90,dnw  added SYSFLG_BOOTP
  46. 01o,28jul90,dnw  removed BOOT_FIELD_LEN to bootLib.h
  47.  added declaration of sysBootParams
  48.  added include of bootLib.h
  49. 01m,20jun90,gae  changed start types to be bit fields and renamed types.
  50.  added import of sysModel.
  51. 01l,24apr90,shl  added SYSFLG_NO_SECURITY.
  52. 01k,23may89,dnw  added SYSFLG_NO_STARTUP_SCRIPT.
  53. 01j,02may89,dnw  added SYSFLG_VENDOR_{0,1,2,3}.
  54. 01i,15oct88,dnw  added SYSFLG_NO_AUTOBOOT, SYSFLG_QUICK_AUTOBOOT,
  55.    and BOOT_WARM_QUICK_AUTOBOOT.
  56. 01h,24mar88,ecs  added declaration of sysExcMsg.
  57. 01g,13nov87,jcf  changed names of boot types.
  58. 01f,29oct87,dnw  added SYSFLG_DEBUG.
  59. 01e,14oct87,dnw  added SYSFLG_NO_SYS_CONTROLLER.
  60. 01d,14jul87,dnw  added more system global varaibles.
  61.  deleted sysLocalToBusAdrs().
  62.  added system restart types.
  63. 01c,14feb87,dnw  added sysBus, sysCpu, sysLocalToBusAdrs
  64. 01b,18dec86,llk  added BOOT_FIELD_LEN.
  65. 01a,04aug84,dnw  written
  66. */
  67. #ifndef __INCsysLibh
  68. #define __INCsysLibh
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72. #ifndef _ASMLANGUAGE
  73. #include "bootLib.h"
  74. #include "ttyLib.h"
  75. #include "sioLib.h"
  76. #include "drv/timer/timerDev.h"
  77. typedef struct  /* NETIF - network interface table */
  78.     {
  79.     char *ifName;         /* interface name */
  80.     FUNCPTR attachRtn;   /* attach routine */
  81.     char *arg1; /* address */
  82.     int arg2; /* vector */
  83.     int arg3; /* level */
  84.     int arg4;
  85.     int arg5;
  86.     int arg6;
  87.     int arg7;
  88.     int arg8;
  89.     } NETIF;
  90. #endif /* _ASMLANGUAGE */
  91. /* system restart types */
  92. #define BOOT_NORMAL 0x00 /* normal reboot with countdown */
  93. #define BOOT_NO_AUTOBOOT 0x01 /* no autoboot if set */
  94. #define BOOT_CLEAR 0x02 /* clear memory if set */
  95. #define BOOT_QUICK_AUTOBOOT 0x04 /* fast autoboot if set */
  96. /* for backward compatibility */
  97. #define BOOT_WARM_AUTOBOOT BOOT_NORMAL
  98. #define BOOT_WARM_NO_AUTOBOOT BOOT_NO_AUTOBOOT
  99. #define BOOT_WARM_QUICK_AUTOBOOT BOOT_QUICK_AUTOBOOT
  100. #define BOOT_COLD BOOT_CLEAR
  101. /* system configuration flags in sysFlags */
  102. /* Some targets have system controllers that can be enabled in software.
  103.  * By default, the system controller is enabled for processor 0.
  104.  * When set this flag inhibits enabling the system controller even
  105.  * for processor 0.
  106.  */
  107. #define SYSFLG_NO_SYS_CONTROLLER 0x01
  108. /* System debug option:
  109.  * load kernel symbol table with all symbols (not just globals)
  110.  */
  111. #define SYSFLG_DEBUG             0x02
  112. #define SYSFLG_NO_AUTOBOOT  0x04 /* Don't start autoboot sequence */
  113. #define SYSFLG_QUICK_AUTOBOOT  0x08 /* Immediate autoboot (no countdown) */
  114. #define SYSFLG_NO_STARTUP_SCRIPT 0x10 /* Don't read startup script */
  115. #define SYSFLG_NO_SECURITY  0x20   /* Don't ask passwd on network login */
  116. #define SYSFLG_AUTOCONFIG  0x40   /* Use bootp or DHCP to get boot */
  117.                                         /* parameters */
  118. #define SYSFLG_TFTP  0x80   /* Use tftp to get boot image */
  119. #define SYSFLG_PROXY  0x100 /* Use proxy arp */
  120. #define SYSFLG_WDB  0x200 /* Use WDB agent */
  121. #define SYSFLG_VENDOR_0  0x1000 /* vendor defined flag 0 */
  122. #define SYSFLG_VENDOR_1  0x2000 /* vendor defined flag 1 */
  123. #define SYSFLG_VENDOR_2  0x4000 /* vendor defined flag 2 */
  124. #define SYSFLG_VENDOR_3  0x8000 /* vendor defined flag 3 */
  125. /* system parameters */
  126. #ifndef _ASMLANGUAGE
  127. extern int  sysBus; /* system bus type (VME_BUS, MULTI_BUS, etc) */
  128. extern int  sysCpu; /* system cpu type (MC680x0, SPARC, etc.) */
  129. extern int  sysProcNum; /* processor number of this cpu */
  130. extern char * sysBootLine; /* address of boot line */
  131. extern char * sysExcMsg; /* address of exception message area */
  132. extern int sysFlags; /* configuration flags */
  133. extern BOOT_PARAMS sysBootParams; /* parameters from boot line */
  134. /* obsolete - but remain for backward compatiblity */
  135. extern char sysBootHost[]; /* name of host from which system was booted */
  136. extern char sysBootFile[]; /* name of file from which system was booted */
  137. /* function declarations */
  138. #if defined(__STDC__) || defined(__cplusplus)
  139. extern char * sysModel (void);
  140. extern char * sysBspRev (void);
  141. extern void  sysHwInit (void);
  142. extern void  sysHwInit2 (void);
  143. extern char * sysMemTop (void);
  144. extern char * sysPhysMemTop (void);
  145. extern STATUS  sysToMonitor (int startType);
  146. extern int  sysProcNumGet (void);
  147. extern void  sysProcNumSet (int procNum);
  148. extern BOOL  sysBusTas (char *adrs);
  149. extern STATUS  sysNvRamGet (char *string, int strLen, int offset);
  150. extern STATUS  sysNvRamSet (char *string, int strLen, int offset);
  151. extern STATUS  sysScsiInit (void);
  152. extern STATUS  sysScsiConfig (void);
  153. extern void sysSerialHwInit (void);
  154. extern void sysSerialHwInit2 (void);
  155. extern SIO_CHAN * sysSerialChanGet (int channel);
  156. extern void sysSerialReset (void);
  157. extern STATUS sysLocalToBusAdrs (int adrsSpace, char *localAdrs,
  158.    char **pBusAdrs);
  159. extern STATUS sysBusToLocalAdrs (int adrsSpace, char *busAdrs,
  160.    char **pLocalAdrs);
  161. extern STATUS sysIntDisable (int intLevel);
  162. extern STATUS sysIntEnable (int intLevel);
  163. extern int sysBusIntAck (int intLevel);
  164. extern STATUS sysBusIntGen (int level, int vector);
  165. extern STATUS sysMailboxConnect (FUNCPTR routine, int arg);
  166. extern STATUS sysMailboxEnable (char *mailboxAdrs);
  167. extern int tyCoDrv (void);
  168. extern int tyCoDevCreate (char *name, int channel, int rdBufSize,
  169.        int wrtBufSize);
  170. #if (CPU_FAMILY == I80X86)
  171. /*
  172.  * These prototypes are for the x86 family only.  They are incorrect,
  173.  * but we do not want to change the API for the entire ARCH_FAMILY.
  174.  * They should be unsigned arguments.
  175.  */
  176. extern UCHAR sysInByte (int port);
  177. extern USHORT sysInWord (int port);
  178. extern ULONG sysInLong (int port);
  179. extern void sysInWordString (int port, short *pData, int count);
  180. extern void sysInLongString (int port, long *pData, int count);
  181. extern void sysOutByte (int port, char data);
  182. extern void sysOutWord (int port, short data);
  183. extern void sysOutLong (int port, long data);
  184. extern void sysOutWordString (int port, short *pData, int count);
  185. extern void sysOutLongString (int port, long *pData, int count);
  186. #else
  187. /* For all architectures, except X86, the arguments are unsigned.  */
  188. extern UCHAR sysInByte (ULONG port);
  189. extern USHORT sysInWord (ULONG port);
  190. extern ULONG sysInLong (ULONG port);
  191. extern void sysInWordString (ULONG port, UINT16 *pData, int count);
  192. extern void sysInLongString (ULONG port, ULONG *pData, int count);
  193. extern void sysOutByte (ULONG port, UCHAR data);
  194. extern void sysOutWord (ULONG port, UINT16 data);
  195. extern void sysOutLong (ULONG port, ULONG data);
  196. extern void sysOutWordString (ULONG port, UINT16 *pData, int count);
  197. extern void sysOutLongString (ULONG port, ULONG *pData, int count);
  198. #endif /* (CPU_FAMILY == I80X86) */
  199. /* optional support routines used by several architectures */
  200. extern void sysNanoDelay (UINT32 nanoseconds);
  201. extern void sysReboot (void);
  202. extern void sysDelay (void);
  203. extern void sysWait (void);
  204. extern STATUS sysIntDisablePIC (int intLevel);
  205. extern STATUS sysIntEnablePIC (int intLevel);
  206. /* i960 special routines */
  207. extern void  sysFaultTableInit (void (*func)());
  208. extern UINT32  sysFaultVecSet (INSTR *vector, UINT32 faultNo, 
  209.  UINT32 type);
  210. extern void  sysExcInfoPrint (UINT32 type);
  211. /* X86 special routines */
  212. extern void sysLoadGdt (char *sysGdtr);
  213. #else /* __STDC__ */
  214. extern char * sysModel ();
  215. extern void  sysHwInit ();
  216. extern void  sysHwInit2 ();
  217. extern char * sysMemTop ();
  218. extern STATUS  sysToMonitor ();
  219. extern int  sysProcNumGet ();
  220. extern void  sysProcNumSet ();
  221. extern BOOL  sysBusTas ();
  222. extern STATUS  sysNvRamGet ();
  223. extern STATUS  sysNvRamSet ();
  224. extern STATUS  sysScsiInit ();
  225. extern SIO_CHAN *sysSerialChanGet ();
  226. extern STATUS   sysLocalToBusAdrs ();
  227. extern STATUS   sysBusToLocalAdrs ();
  228. extern STATUS   sysIntDisable ();
  229. extern STATUS   sysIntEnable ();
  230. extern int      sysBusIntAck ();
  231. extern STATUS   sysBusIntGen ();
  232. extern STATUS   sysMailboxConnect ();
  233. extern STATUS sysMailboxEnable ();
  234. extern int tyCoDrv ();
  235. extern int tyCoDevCreate ();
  236. #if CPU_FAMILY == I960
  237. extern void  sysFaultTableInit ();
  238. extern UINT32  sysFaultVecSet ();
  239. extern void  sysExcInfoPrint ();
  240. #endif /* CPU_FAMILY == I960 */
  241. #if (CPU_FAMILY == I80X86 || CPU_FAMILY == PPC)
  242. extern UCHAR sysInByte ();
  243. extern USHORT sysInWord ();
  244. extern ULONG sysInLong ();
  245. extern void sysInWordString ();
  246. extern void sysInLongString ();
  247. extern void sysOutByte ();
  248. extern void sysOutWord ();
  249. extern void sysOutLong ();
  250. extern void sysOutWordString ();
  251. extern void sysOutLongString ();
  252. extern void sysReboot ();
  253. extern void sysDelay ();
  254. extern void sysWait ();
  255. extern void sysLoadGdt ();
  256. extern STATUS sysIntDisablePIC ();
  257. extern STATUS sysIntEnablePIC ();
  258. #endif /* (CPU_FAMILY == I80X86 || CPU_FAMILY == PPC) */
  259. #endif /* __STDC__ */
  260. #endif /* _ASMLANGUAGE */
  261. #ifdef __cplusplus
  262. }
  263. #endif
  264. #endif /* __INCsysLibh */