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

VxWorks

开发平台:

C/C++

  1. /* usrKernel.c - wind kernel initialization */
  2. /* Copyright 1992-1999 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01f,20jan99,jpd  added INITIAL_MEM_ALLOCATION.
  7. 01e,18sep95,ism  imported conditional include of wvLib.h from bootConfig.c
  8. 01d,28mar95,kkk  moved kernel defines to configAll.h
  9. 01c,07dec93,smb  configuration change for windview
  10. 01b,10nov92,jcf  configuration change for MicroWorks.
  11. 01a,18sep92,jcf  written.
  12. */
  13. /*
  14. DESCRIPTION
  15. This file is used to configure and initialize the Wind kernel.  This file is
  16. included by usrConfig.c.
  17. NOMANUAL
  18. */
  19. #ifdef INCLUDE_WDB
  20. #define FREE_MEM_START_ADRS (FREE_RAM_ADRS + WDB_POOL_SIZE)
  21. #else /* ! INCLUDE_WDB */
  22. #define FREE_MEM_START_ADRS FREE_RAM_ADRS
  23. #endif
  24. #ifdef  INCLUDE_INITIAL_MEM_ALLOCATION
  25. #define MEM_POOL_START (char *) 
  26.     (ROUND_UP(FREE_MEM_START_ADRS, (INITIAL_MEM_ALIGNMENT)) + 
  27.     (INITIAL_MEM_SIZE))
  28. #else   /* INCLUDE_INITIAL_MEM_ALLOCATION */
  29. #define MEM_POOL_START (char *) FREE_MEM_START_ADRS
  30. #endif  /* INCLUDE_INITIAL_MEM_ALLOCATION */
  31. /* global variables */
  32. #ifdef INCLUDE_CONSTANT_RDY_Q
  33. BMAP_LIST readyQBMap; /* bit mapped ready queue list array */
  34. #endif /* INCLUDE_CONSTANT_RDY_Q */
  35. /*******************************************************************************
  36. *
  37. * usrKernelInit - configure kernel data structures
  38. *
  39. * NOMANUAL
  40. */
  41. void usrKernelInit (void)
  42.     {
  43.     classLibInit (); /* initialize class (must be first) */
  44.     taskLibInit (); /* initialize task object */
  45.     /* configure the kernel queues */
  46. #ifdef INCLUDE_CONSTANT_RDY_Q
  47.     qInit (&readyQHead, Q_PRI_BMAP, (int)&readyQBMap, 256); /* fixed ready q */
  48. #else
  49.     qInit (&readyQHead, Q_PRI_LIST); /* simple priority ready q */
  50. #endif /* !INCLUDE_CONSTANT_RDY_Q */
  51.     qInit (&activeQHead, Q_FIFO);  /* FIFO queue for active q */
  52.     qInit (&tickQHead, Q_PRI_LIST);  /* simple priority semaphore q*/
  53.     workQInit (); /* queue for deferred work */
  54.     /* start the kernel specifying usrRoot as the root task */
  55.     kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE, MEM_POOL_START,
  56.                 sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);
  57.     }