README 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. CONTENT:
  2. epic.h
  3. epic1.c
  4. epic2.s
  5. WHAT ARE THESE FILES:
  6. These files contain MPC8240 (Kahlua) EPIC
  7. driver routines. The driver routines are not
  8. written for any specific operating system.
  9. They serves the purpose of code sample, and
  10. jump-start for using the MPC8240 EPIC unit.
  11. For the reason of correctness of C language
  12. syntax, these files are compiled by Metaware
  13. C compiler and assembler.
  14. ENDIAN NOTATION:
  15. The algorithm is designed for big-endian mode,
  16. software is responsible for byte swapping.
  17. USAGE:
  18. 1. The host system that is running on MPC8240
  19. shall link the files listed here. The memory
  20. location of driver routines shall take into
  21. account of that driver routines need to run
  22. in supervisor mode and they process external
  23. interrupts.
  24. The routine epic_exception shall be called by
  25. exception vector at location 0x500, i.e.,
  26. 603e core external exception vector.
  27. 2. The host system is responsible for configuring
  28. the MPC8240 including Embedded Utilities Memory
  29. Block. All EPIC driver functions require the
  30. content of Embedded Utilities Memory Block
  31. Base Address Register, EUMBBAR, as the first
  32. parameter.
  33. 3. Before EPIC unit of MPC8240 can be used,
  34. initialize EPIC unit by calling epicInit
  35. with the corresponding parameters.
  36. The initialization shall disable the 603e
  37. core External Exception by calling CoreExtIntDisable( ).
  38. Next, call epicInit( ). Last, enable the 603e core
  39. External Exception by calling CoreExtIntEnable( ).
  40. 4. After EPIC unit has been successfully initialized,
  41. epicIntSourceSet( ) shall be used to register each
  42. external interrupt source. Anytime, an external
  43. interrupt source can be disabled or enabled by
  44. calling corresponding function, epicIntDisable( ),
  45. or epicIntEnable( ).
  46. Global Timers' resource, base count and frequency,
  47. can be changed by calling epicTmFrequencySet( )
  48. and epicTmBaseSet( ).
  49. To stop counting a specific global timer, use
  50. the function, epicTmInhibit while epicTmEnable
  51. can be used to start counting a timer.
  52. 5. To mask a set of external interrupts that are
  53. are certain level below, epicIntPrioritySet( )
  54. can be used. For example, if the processor's
  55. current task priority register is set to 0x7,
  56. only interrupts of priority 0x8 or higher will
  57. be passed to the processor.
  58. Be careful when using this function. It may
  59. corrupt the current interrupt pending, selector,
  60. and request registers, resulting an invalid vetor.
  61. After enabling an interrupt, disable it may also
  62. cause an invalid vector. User may consider using
  63. the spurious vector interrupt service routine to
  64. handle this case.
  65. 6. The EPIC driver routines contains a set
  66. of utilities, Set and Get, for host system
  67. to query and modify the desired EPIC source
  68. registers.
  69. 7. Each external interrupt source shall register
  70. its interrupt service routine. The routine
  71. shall contain all interrupt source specific
  72. processes and keep as short as possible.
  73. Special customized end of interrupt routine
  74. is optional. If it is needed, it shall contain
  75. the external interrupt source specific end of
  76. interrupt process.
  77. External interrupt exception vector at 0x500
  78. shall always call the epicEOI just before
  79. rfi instruction. Refer to the routine,
  80. epic_exception, for a code sample.