summaryrefslogtreecommitdiff
path: root/arch/powerpc/cpu/mpc824x/drivers/epic/README
blob: 57989969b90b6f566d4f760820a0d8647c550b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
CONTENT:

   epic.h
   epic1.c
   epic2.s

WHAT ARE THESE FILES:

These files contain MPC8240 (Kahlua) EPIC
driver routines. The driver routines are not
written for any specific operating system.
They serves the purpose of code sample, and
jump-start for using the MPC8240 EPIC unit.

For the reason of correctness of C language
syntax, these files are compiled by Metaware
C compiler and assembler.

ENDIAN NOTATION:

The algorithm is designed for big-endian mode,
software is responsible for byte swapping.

USAGE:

1. The host system that is running on MPC8240
   shall link the files listed here. The memory
   location of driver routines shall take into
   account of that driver routines need to run
   in supervisor mode and they process external
   interrupts.

   The routine epic_exception shall be called by
   exception vector at location 0x500, i.e.,
   603e core external exception vector.

2. The host system is responsible for configuring
   the MPC8240 including Embedded Utilities Memory
   Block. All EPIC driver functions require the
   content of Embedded Utilities Memory Block
   Base Address Register, EUMBBAR, as the first
   parameter.

3. Before EPIC unit of MPC8240 can be used,
   initialize EPIC unit by calling epicInit
   with the corresponding parameters.

   The initialization shall disable the 603e
   core External Exception by calling CoreExtIntDisable( ).
   Next, call epicInit( ). Last, enable the 603e core
   External Exception by calling CoreExtIntEnable( ).

4. After EPIC unit has been successfully initialized,
   epicIntSourceSet( ) shall be used to register each
   external interrupt source. Anytime, an external
   interrupt source can be disabled or enabled by
   calling corresponding function, epicIntDisable( ),
   or epicIntEnable( ).

   Global Timers' resource, base count and frequency,
   can be changed by calling epicTmFrequencySet( )
   and epicTmBaseSet( ).

   To stop counting a specific global timer, use
   the function, epicTmInhibit while epicTmEnable
   can be used to start counting a timer.

5. To mask a set of external interrupts that are
   are certain level below, epicIntPrioritySet( )
   can be used. For example, if the processor's
   current task priority register is set to 0x7,
   only interrupts of priority 0x8 or higher will
   be passed to the processor.

   Be careful when using this function. It may
   corrupt the current interrupt pending, selector,
   and request registers, resulting an invalid vetor.

   After enabling an interrupt, disable it may also
   cause an invalid vector. User may consider using
   the spurious vector interrupt service routine to
   handle this case.

6. The EPIC driver routines contains a set
   of utilities, Set and Get, for host system
   to query and modify the desired EPIC source
   registers.

7. Each external interrupt source shall register
   its interrupt service routine. The routine
   shall contain all interrupt source specific
   processes and keep as short as possible.

   Special customized end of interrupt routine
   is optional. If it is needed, it shall contain
   the external interrupt source specific end of
   interrupt process.

   External interrupt exception vector at 0x500
   shall always call the epicEOI just before
   rfi instruction. Refer to the routine,
   epic_exception, for a code sample.