526a48c6f5d66f12cc518874c8e9c30daa57b562
[rtems-devel.git] / rtems-patches / rtems-csb336-20051008-other.patch
1 Index: rtems/c/src/lib/libbsp/arm/csb336/times
2 ===================================================================
3 --- rtems/c/src/lib/libbsp/arm/csb336/times     (revision 42)
4 +++ rtems/c/src/lib/libbsp/arm/csb336/times     (working copy)
5 @@ -18,155 +18,155 @@
6  
7                                               
8  == ====================================================================  ===
9 - 1 rtems_semaphore_create                                                16
10 - 1 rtems_semaphore_delete                                                17
11 - 1 rtems_semaphore_obtain: available                                     2
12 - 1 rtems_semaphore_obtain: not available -- NO_WAIT                      2
13 - 1 rtems_semaphore_release: no waiting tasks                             5
14 + 1 rtems_semaphore_create                                                15
15 + 1 rtems_semaphore_delete                                                15
16 + 1 rtems_semaphore_obtain: available                                     0
17 + 1 rtems_semaphore_obtain: not available -- NO_WAIT                      0
18 + 1 rtems_semaphore_release: no waiting tasks                             0
19  
20 - 2 rtems_semaphore_obtain: not available -- caller blocks                20
21 + 2 rtems_semaphore_obtain: not available -- caller blocks                12
22  
23 - 3 rtems_semaphore_release: task readied -- preempts caller              16
24 + 3 rtems_semaphore_release: task readied -- preempts caller              11
25  
26 - 4 rtems_task_restart: blocked task -- preempts caller                   48
27 - 4 rtems_task_restart: ready task -- preempts caller                     36
28 - 4 rtems_semaphore_release: task readied -- returns to caller            9
29 - 4 rtems_task_create                                                     33
30 - 4 rtems_task_start                                                      12
31 - 4 rtems_task_restart: suspended task -- returns to caller               14
32 - 4 rtems_task_delete: suspended task                                     31
33 - 4 rtems_task_restart: ready task -- returns to caller                   14
34 - 4 rtems_task_restart: blocked task -- returns to caller                 19
35 - 4 rtems_task_delete: blocked task                                       32
36 + 4 rtems_task_restart: blocked task -- preempts caller                   38
37 + 4 rtems_task_restart: ready task -- preempts caller                     29
38 + 4 rtems_semaphore_release: task readied -- returns to caller            5
39 + 4 rtems_task_create                                                     24
40 + 4 rtems_task_start                                                      8
41 + 4 rtems_task_restart: suspended task -- returns to caller               9
42 + 4 rtems_task_delete: suspended task                                     20
43 + 4 rtems_task_restart: ready task -- returns to caller                   10
44 + 4 rtems_task_restart: blocked task -- returns to caller                 11
45 + 4 rtems_task_delete: blocked task                                       21
46  
47 - 5 rtems_task_suspend: calling task                                      14
48 - 5 rtems_task_resume: task readied -- preempts caller                    12
49 + 5 rtems_task_suspend: calling task                                      9
50 + 5 rtems_task_resume: task readied -- preempts caller                    8
51  
52 - 6 rtems_task_restart: calling task                                      14
53 - 6 rtems_task_suspend: returns to caller                                 6
54 - 6 rtems_task_resume: task readied -- returns to caller                  6
55 - 6 rtems_task_delete: ready task                                         32
56 + 6 rtems_task_restart: calling task                                      8
57 + 6 rtems_task_suspend: returns to caller                                 3
58 + 6 rtems_task_resume: task readied -- returns to caller                  3
59 + 6 rtems_task_delete: ready task                                         22
60  
61 - 7 rtems_task_restart: suspended task -- preempts caller                 24
62 + 7 rtems_task_restart: suspended task -- preempts caller                 14
63  
64 - 8 rtems_task_set_priority: obtain current priority                      4
65 - 8 rtems_task_set_priority: returns to caller                            8
66 - 8 rtems_task_mode: obtain current mode                                  2
67 - 8 rtems_task_mode: no reschedule                                        2
68 - 8 rtems_task_mode: reschedule -- returns to caller                      4
69 - 8 rtems_task_mode: reschedule -- preempts caller                        19
70 - 8 rtems_task_set_note                                                   4
71 - 8 rtems_task_get_note                                                   4
72 - 8 rtems_clock_set                                                       9
73 + 8 rtems_task_set_priority: obtain current priority                      1
74 + 8 rtems_task_set_priority: returns to caller                            3
75 + 8 rtems_task_mode: obtain current mode                                  0
76 + 8 rtems_task_mode: no reschedule                                        0
77 + 8 rtems_task_mode: reschedule -- returns to caller                      3
78 + 8 rtems_task_mode: reschedule -- preempts caller                        13
79 + 8 rtems_task_set_note                                                   1
80 + 8 rtems_task_get_note                                                   1
81 + 8 rtems_clock_set                                                       4
82   8 rtems_clock_get                                                       0
83  
84 - 9 rtems_message_queue_create                                            54
85 - 9 rtems_message_queue_send: no waiting tasks                            8
86 - 9 rtems_message_queue_urgent: no waiting tasks                          8
87 - 9 rtems_message_queue_receive: available                                7
88 - 9 rtems_message_queue_flush: no messages flushed                        4
89 - 9 rtems_message_queue_flush: messages flushed                           5
90 - 9 rtems_message_queue_delete                                            21
91 + 9 rtems_message_queue_create                                            38
92 + 9 rtems_message_queue_send: no waiting tasks                            4
93 + 9 rtems_message_queue_urgent: no waiting tasks                          4
94 + 9 rtems_message_queue_receive: available                                4
95 + 9 rtems_message_queue_flush: no messages flushed                        2
96 + 9 rtems_message_queue_flush: messages flushed                           3
97 + 9 rtems_message_queue_delete                                            19
98  
99 -10 rtems_message_queue_receive: not available -- NO_WAIT                 4
100 -10 rtems_message_queue_receive: not available -- caller blocks           20
101 +10 rtems_message_queue_receive: not available -- NO_WAIT                 2
102 +10 rtems_message_queue_receive: not available -- caller blocks           12
103  
104 -11 rtems_message_queue_send: task readied -- preempts caller             18
105 +11 rtems_message_queue_send: task readied -- preempts caller             13
106  
107 -12 rtems_message_queue_send: task readied -- returns to caller           11
108 +12 rtems_message_queue_send: task readied -- returns to caller           7
109  
110 -13 rtems_message_queue_urgent: task readied -- preempts caller           19
111 +13 rtems_message_queue_urgent: task readied -- preempts caller           13
112  
113 -14 rtems_message_queue_urgent: task readied -- returns to caller 11
114 +14 rtems_message_queue_urgent: task readied -- returns to caller         7
115  
116  15 rtems_event_receive: obtain current events                            0
117 -15 rtems_event_receive: not available -- NO_WAIT                         3
118 -15 rtems_event_receive: not available -- caller blocks                   17
119 -15 rtems_event_send: no task readied                                     3
120 -15 rtems_event_receive: available                                        5
121 -15 rtems_event_send: task readied -- returns to caller                   10
122 +15 rtems_event_receive: not available -- NO_WAIT                         1
123 +15 rtems_event_receive: not available -- caller blocks                   11
124 +15 rtems_event_send: no task readied                                     1
125 +15 rtems_event_receive: available                                        3
126 +15 rtems_event_send: task readied -- returns to caller                   7
127  
128 -16 rtems_event_send: task readied -- preempts caller                     16
129 +16 rtems_event_send: task readied -- preempts caller                     12
130  
131 -17 rtems_task_set_priority: preempts caller                              19
132 +17 rtems_task_set_priority: preempts caller                              13
133  
134 -18 rtems_task_delete: calling task                                       41
135 +18 rtems_task_delete: calling task                                       26
136  
137 -19 rtems_signal_catch                                                    6
138 -19 rtems_signal_send: returns to caller                                  15
139 -19 rtems_signal_send: signal to self                                     25
140 -19 exit ASR overhead: returns to calling task                            11
141 -19 exit ASR overhead: returns to preempting task                         12
142 +19 rtems_signal_catch                                                    5
143 +19 rtems_signal_send: returns to caller                                  12
144 +19 rtems_signal_send: signal to self                                     19
145 +19 exit ASR overhead: returns to calling task                            7
146 +19 exit ASR overhead: returns to preempting task                         10
147  
148 -20 rtems_partition_create                                                22
149 -20 rtems_region_create                                                   30
150 -20 rtems_partition_get_buffer: available                                 10
151 -20 rtems_partition_get_buffer: not available                             4
152 -20 rtems_partition_return_buffer                                         9
153 -20 rtems_partition_delete                                                10
154 -20 rtems_region_get_segment: available                                   15
155 -20 rtems_region_get_segment: not available -- NO_WAIT                    16
156 -20 rtems_region_return_segment: no waiting tasks                         13
157 -20 rtems_region_get_segment: not available -- caller blocks              47
158 -20 rtems_region_return_segment: task readied -- preempts caller 45                                                          
159 -20 rtems_region_return_segment: task readied -- returns to caller 25
160 -20 rtems_region_delete                                                   23
161 -20 rtems_io_initialize                                                   1
162 +20 rtems_partition_create                                                21
163 +20 rtems_region_create                                                   33
164 +20 rtems_partition_get_buffer: available                                 9
165 +20 rtems_partition_get_buffer: not available                             3
166 +20 rtems_partition_return_buffer                                         8
167 +20 rtems_partition_delete                                                8
168 +20 rtems_region_get_segment: available                                   7
169 +20 rtems_region_get_segment: not available -- NO_WAIT                    7
170 +20 rtems_region_return_segment: no waiting tasks                         6
171 +20 rtems_region_get_segment: not available -- caller blocks              36
172 +20 rtems_region_return_segment: task readied -- preempts caller          33                                                 
173 +20 rtems_region_return_segment: task readied -- returns to caller        13
174 +20 rtems_region_delete                                                   18
175 +20 rtems_io_initialize                                                   0
176  20 rtems_io_open                                                         0
177  20 rtems_io_close                                                        0
178  20 rtems_io_read                                                         0
179  20 rtems_io_write                                                        0
180  20 rtems_io_control                                                      0
181  
182 -21 rtems_task_ident                                                      39
183 -21 rtems_message_queue_ident                                             38
184 -21 rtems_semaphore_ident                                                 43
185 -21 rtems_partition_ident                                                 38
186 -21 rtems_region_ident                                                    38
187 -21 rtems_port_ident                                                      37
188 -21 rtems_timer_ident                                                     38
189 -21 rtems_rate_monotonic_ident                                            38
190 +21 rtems_task_ident                                                      8
191 +21 rtems_message_queue_ident                                             8
192 +21 rtems_semaphore_ident                                                 9
193 +21 rtems_partition_ident                                                 8
194 +21 rtems_region_ident                                                    8
195 +21 rtems_port_ident                                                      8
196 +21 rtems_timer_ident                                                     8
197 +21 rtems_rate_monotonic_ident                                            8
198  
199  22 rtems_message_queue_broadcast: task readied -- returns to caller      27
200 -22 rtems_message_queue_broadcast: no waiting tasks                       6
201 -22 rtems_message_queue_broadcast: task readied -- preempts caller        22
202 +22 rtems_message_queue_broadcast: no waiting tasks                       2
203 +22 rtems_message_queue_broadcast: task readied -- preempts caller        16
204  
205 -23 rtems_timer_create                                                    4
206 -23 rtems_timer_fire_after: inactive                                      7
207 -23 rtems_timer_fire_after: active                                        7
208 -23 rtems_timer_cancel: active                                            4
209 -23 rtems_timer_cancel: inactive                                          3
210 -23 rtems_timer_reset: inactive                                           6
211 -23 rtems_timer_reset: active                                             7
212 -23 rtems_timer_fire_when: inactive                                       9
213 -23 rtems_timer_fire_when: active                                         9
214 -23 rtems_timer_delete: active                                            5
215 -23 rtems_timer_delete: inactive                                          4
216 -23 rtems_task_wake_when                                                  21
217 +23 rtems_timer_create                                                    3
218 +23 rtems_timer_fire_after: inactive                                      4
219 +23 rtems_timer_fire_after: active                                        4
220 +23 rtems_timer_cancel: active                                            2
221 +23 rtems_timer_cancel: inactive                                          1
222 +23 rtems_timer_reset: inactive                                           3
223 +23 rtems_timer_reset: active                                             3
224 +23 rtems_timer_fire_when: inactive                                       4
225 +23 rtems_timer_fire_when: active                                         4
226 +23 rtems_timer_delete: active                                            3
227 +23 rtems_timer_delete: inactive                                          3
228 +23 rtems_task_wake_when                                                  12
229  
230 -24 rtems_task_wake_after: yield -- returns to caller                     2
231 -24 rtems_task_wake_after: yields -- preempts caller                      12
232 +24 rtems_task_wake_after: yield -- returns to caller                     1
233 +24 rtems_task_wake_after: yields -- preempts caller                      9
234  
235 -25 rtems_clock_tick                                                      13
236 +25 rtems_clock_tick                                                      10
237  
238 -26 _ISR_Disable                                                           3
239 +26 _ISR_Disable                                                          3
240  26 _ISR_Flash                                                            1
241  26 _ISR_Enable                                                           0
242  26 _Thread_Disable_dispatch                                              1
243  26 _Thread_Enable_dispatch                                               3
244  26 _Thread_Set_state                                                     6
245 -26 _Thread_Disptach (NO FP)                                              13
246 -26 context switch: no floating point contexts                            10
247 +26 _Thread_Disptach (NO FP)                                              9
248 +26 context switch: no floating point contexts                            7
249  26 context switch: self                                                  1
250  26 context switch: to another task                                       2
251  26 fp context switch: restore 1st FP task -                              NA
252  26 fp context switch: save idle, restore initialized -                   NA
253  26 fp context switch: save idle, restore idle -                          NA
254  26 fp context switch: save initialized, restore initialized -            NA
255 -26 _Thread_Resume                                                        9
256 -26 _Thread_Unblock                                                       8
257 -26 _Thread_Ready                                                         5
258 -26 _Thread_Get                                                           1
259 +26 _Thread_Resume                                                        8
260 +26 _Thread_Unblock                                                       7
261 +26 _Thread_Ready                                                         4
262 +26 _Thread_Get                                                           0
263  26 _Semaphore_Get                                                        0
264  26 _Thread_Get: invalid id                                               0
265  
266 @@ -175,15 +175,15 @@
267  27 interrupt entry overhead: returns to nested interrupt                 0
268  27 interrupt exit overhead: returns to nested interrupt                  0
269  
270 -28 rtems_port_create                                                     13
271 -28 rtems_port_external_to_internal                                       3
272 -28 rtems_port_internal_to_external                                       3
273 -28 rtems_port_delete                                                     11
274 +28 rtems_port_create                                                     10
275 +28 rtems_port_external_to_internal                                       1
276 +28 rtems_port_internal_to_external                                       1
277 +28 rtems_port_delete                                                     8
278  
279 -29 rtems_rate_monotonic_create                                           13
280 -29 rtems_rate_monotonic_period: initiate period -- returns to caller     24
281 -29 rtems_rate_monotonic_period: obtain status                            5
282 -29 rtems_rate_monotonic_cancel                                           15
283 +29 rtems_rate_monotonic_create                                           12
284 +29 rtems_rate_monotonic_period: initiate period -- returns to caller     17
285 +29 rtems_rate_monotonic_period: obtain status                            3
286 +29 rtems_rate_monotonic_cancel                                           12
287  29 rtems_rate_monotonic_delete: inactive                                 12
288 -29 rtems_rate_monotonic_delete: active                                   7
289 -29 rtems_rate_monotonic_period: conclude periods -- caller blocks        13
290 +29 rtems_rate_monotonic_delete: active                                   4
291 +29 rtems_rate_monotonic_period: conclude periods -- caller blocks        9
292 Index: rtems/c/src/lib/libbsp/arm/csb336/startup/bspstart.c
293 ===================================================================
294 --- rtems/c/src/lib/libbsp/arm/csb336/startup/bspstart.c        (revision 42)
295 +++ rtems/c/src/lib/libbsp/arm/csb336/startup/bspstart.c        (working copy)
296 @@ -153,12 +169,12 @@
297  /* Calcuate the frequency for perclk1 */
298  int get_perclk1_freq(void)
299  {
300 -    int fin;
301 -    int fpll;
302 -    int pd;
303 -    int mfd;
304 -    int mfi;
305 -    int mfn;
306 +    unsigned int fin;
307 +    unsigned int fpll;
308 +    unsigned int pd;
309 +    unsigned int mfd;
310 +    unsigned int mfi;
311 +    unsigned int mfn;
312      uint32_t reg;
313      int perclk1;
314  
315 @@ -187,13 +203,14 @@
316      printk("mfd = %d\n", mfd);
317      printk("mfi = %d\n", mfi);
318      printk("mfn = %d\n", mfn);
319 -    printk("(fin * mfi) / (pd + 1) = %d\n", (fin * mfi) / (pd + 1));
320 -    printk("(fin * mfn) / ((pd + 1) * (mfd + 1)) = %d\n",
321 -           (fin * mfn) / ((pd + 1) * (mfd + 1)));
322 +    printk("rounded (fin * mfi) / (pd + 1) = %d\n", (fin * mfi) / (pd + 1));
323 +    printk("rounded (fin * mfn) / ((pd + 1) * (mfd + 1)) = %d\n",
324 +           ((long long)fin * mfn) / ((pd + 1) * (mfd + 1)));
325  #endif
326  
327 -    fpll = 2 * ( ((fin * mfi) / (pd + 1)) +
328 -                 ((fin * mfn) / ((pd + 1) * (mfd + 1))) );
329 +    fpll = 2 * ( ((fin * mfi  + (pd + 1) / 2) / (pd + 1)) +
330 +                 (((long long)fin * mfn + ((pd + 1) * (mfd + 1)) / 2) / 
331 +                ((pd + 1) * (mfd + 1))) );
332  
333      /* calculate the output of the PERCLK1 divider */
334      reg = MC9328MXL_PLL_PCDR;
335 Index: rtems/c/src/lib/libbsp/arm/csb336/startup/linkcmds
336 ===================================================================
337 --- rtems/c/src/lib/libbsp/arm/csb336/startup/linkcmds  (revision 42)
338 +++ rtems/c/src/lib/libbsp/arm/csb336/startup/linkcmds  (working copy)
339 @@ -75,9 +75,6 @@
340      rtems_vector_table = .;
341      . += (8 * 4);                     /* 8 ARM interrupts */
342         
343 -    bsp_vector_table = .;
344 -    . += (64 * 4);                    /* 64 MC9328MXL interrupts */
345 -
346      . = ALIGN (0x100);
347  
348  
349 Index: rtems/c/src/lib/libbsp/arm/csb336/startup/exit.c
350 ===================================================================
351 --- rtems/c/src/lib/libbsp/arm/csb336/startup/exit.c    (revision 42)
352 +++ rtems/c/src/lib/libbsp/arm/csb336/startup/exit.c    (working copy)
353 @@ -29,7 +29,7 @@
354     */
355    printk("\n");
356    printk(line);
357 -  while (uart_poll_read(0) < 0) continue;
358 +  while (BSP_poll_char() < 0) continue;
359  
360    bsp_reset();
361  
362 Index: rtems/c/src/lib/libbsp/arm/csb336/network/network.c
363 ===================================================================
364 --- rtems/c/src/lib/libbsp/arm/csb336/network/network.c (revision 42)
365 +++ rtems/c/src/lib/libbsp/arm/csb336/network/network.c (working copy)
366 @@ -41,20 +41,20 @@
367  /* RTEMS event used to start transmit daemon. */
368  #define START_TRANSMIT_EVENT    RTEMS_EVENT_2
369  
370 -static rtems_isr enet_isr(rtems_vector_number vector);
371 +static void enet_isr(rtems_irq_hdl_param);
372  static void enet_isr_on(const rtems_irq_connect_data *unused);
373  static void enet_isr_off(const rtems_irq_connect_data *unused);
374  static int enet_isr_is_on(const rtems_irq_connect_data *irq);
375  
376  /* Replace the first value with the clock's interrupt name. */
377 -rtems_irq_connect_data mc9328mxl_enet_isr_data = {BSP_INT_GPIO_PORTA,
378 -                                                  (rtems_irq_hdl)enet_isr,
379 -                                                  enet_isr_on,
380 -                                                  enet_isr_off,
381 -                                                  enet_isr_is_on,
382 -                                                  3,    /* unused for ARM */
383 -                                                  0 };  /* unused for ARM */
384 -
385 +rtems_irq_connect_data mc9328mxl_enet_isr_data = {
386 +    .name    = BSP_INT_GPIO_PORTA,
387 +    .hdl     = (rtems_irq_hdl)enet_isr,
388 +    .handle  = (void *)BSP_INT_GPIO_PORTA,
389 +    .on      = enet_isr_on,
390 +    .off     = enet_isr_off,
391 +    .isOn    = enet_isr_is_on,
392 +};
393  typedef struct {
394    unsigned long rx_packets;        /* total packets received         */
395    unsigned long tx_packets;        /* total packets transmitted      */
396 @@ -102,7 +102,8 @@
397  void mc9328mxl_enet_sendpacket (struct ifnet *ifp, struct mbuf *m);
398  void mc9328mxl_enet_rx_task(void *arg);
399  void mc9328mxl_enet_stats(mc9328mxl_enet_softc_t *sc);
400 -static int mc9328mxl_enet_ioctl(struct ifnet *ifp, int command, caddr_t data);
401 +static int mc9328mxl_enet_ioctl(struct ifnet *ifp, 
402 +                                unsigned long command, caddr_t data);
403  
404  
405  int rtems_mc9328mxl_enet_attach (
406 @@ -631,7 +632,7 @@
407  
408  /*  Driver ioctl handler */
409  static int
410 -mc9328mxl_enet_ioctl (struct ifnet *ifp, int command, caddr_t data)
411 +mc9328mxl_enet_ioctl (struct ifnet *ifp, unsigned long command, caddr_t data)
412  {
413      mc9328mxl_enet_softc_t *sc = ifp->if_softc;
414      int error = 0;
415 @@ -678,7 +679,7 @@
416  }
417  
418  /* interrupt handler */
419 -rtems_isr enet_isr (rtems_vector_number v)
420 +static void enet_isr(rtems_irq_hdl_param unused)
421  {
422      uint16_t int_reg;
423  
424 Index: rtems/c/src/lib/libbsp/arm/shared/irq/irq_init.c
425 ===================================================================
426 --- rtems/c/src/lib/libbsp/arm/shared/irq/irq_init.c    (revision 42)
427 +++ rtems/c/src/lib/libbsp/arm/shared/irq/irq_init.c    (working copy)
428 @@ -30,21 +30,14 @@
429  void  rtems_irq_mngt_init()
430  {
431      int                        i;
432 -    long                       *vectorTable;
433      rtems_interrupt_level       level;
434  
435 -    vectorTable = (long *) VECTOR_TABLE;
436 -
437      _CPU_ISR_Disable(level);
438  
439      /* First, connect the ISR_Handler for IRQ and FIQ interrupts */
440      _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, _ISR_Handler, NULL);
441      _CPU_ISR_install_vector(ARM_EXCEPTION_FIQ, _ISR_Handler, NULL);
442  
443 -     /* Initialize the vector table contents with default handler */
444 -    for (i=0; i<BSP_MAX_INT; i++)
445 -      *(vectorTable + i) = (long)(default_int_handler);
446 -
447      /* Initialize the INT at the BSP level */
448      BSP_rtems_irq_mngt_init();
449  }
450 Index: rtems/c/src/lib/libbsp/arm/edb7312/irq/bsp_irq_init.c
451 ===================================================================
452 --- rtems/c/src/lib/libbsp/arm/edb7312/irq/bsp_irq_init.c       (revision 42)
453 +++ rtems/c/src/lib/libbsp/arm/edb7312/irq/bsp_irq_init.c       (working copy)
454 @@ -22,7 +22,16 @@
455  void BSP_rtems_irq_mngt_init()
456  {
457         long int_stat;
458 +        long *vectorTable;
459 +        int i;
460  
461 +        vectorTable = (long *) VECTOR_TABLE;
462 +
463 +        /* Initialize the vector table contents with default handler */
464 +        for (i=0; i<BSP_MAX_INT; i++) {
465 +            *(vectorTable + i) = (long)(default_int_handler);
466 +        }
467 +
468         /* mask all interrupts */
469         *EP7312_INTMR1 = 0x0;
470         *EP7312_INTMR2 = 0x0;
471 Index: rtems/c/src/lib/libbsp/arm/gba/irq/bsp_irq_init.c
472 ===================================================================
473 --- rtems/c/src/lib/libbsp/arm/gba/irq/bsp_irq_init.c   (revision 42)
474 +++ rtems/c/src/lib/libbsp/arm/gba/irq/bsp_irq_init.c   (working copy)
475 @@ -29,6 +29,16 @@
476   */
477  void BSP_rtems_irq_mngt_init(void)
478  {
479 +  long *vectorTable;
480 +  int i;
481 +
482 +  vectorTable = (long *) VECTOR_TABLE;
483 +    
484 +  /* Initialize the vector table contents with default handler */
485 +  for (i=0; i<BSP_MAX_INT; i++) {
486 +      *(vectorTable + i) = (long)(default_int_handler);
487 +  }
488 +
489    /* clear all interrupt status flags */
490    GBA_REG_IF = 0xffff;
491    /* disable all interrupts */
492 Index: rtems/c/src/lib/libcpu/arm/mc9328mxl/include/mc9328mxl.h
493 ===================================================================
494 --- rtems/c/src/lib/libcpu/arm/mc9328mxl/include/mc9328mxl.h    (revision 42)
495 +++ rtems/c/src/lib/libcpu/arm/mc9328mxl/include/mc9328mxl.h    (working copy)
496 @@ -131,6 +131,33 @@
497  #define MC9328MXL_UART2_MPR4  (*((volatile uint32_t *)((MC9328MXL_UART2_BASE) + 0xcc)))
498  #define MC9328MXL_UART2_TS    (*((volatile uint32_t *)((MC9328MXL_UART2_BASE) + 0xd0)))
499  
500 +typedef struct {
501 +    volatile uint32_t rxd;
502 +    volatile uint32_t _res0[15];
503 +    volatile uint32_t txd;
504 +    volatile uint32_t _res1[15];
505 +    volatile uint32_t cr1;
506 +    volatile uint32_t cr2;
507 +    volatile uint32_t cr3;
508 +    volatile uint32_t cr4;
509 +    volatile uint32_t fcr;
510 +    volatile uint32_t sr1;
511 +    volatile uint32_t sr2;
512 +    volatile uint32_t esc;
513 +    volatile uint32_t tim;
514 +    volatile uint32_t bir;
515 +    volatile uint32_t bmr;
516 +    volatile uint32_t brc;
517 +    volatile uint32_t ipr1;
518 +    volatile uint32_t ipr2;
519 +    volatile uint32_t ipr3;
520 +    volatile uint32_t ipr4;
521 +    volatile uint32_t mpr1;
522 +    volatile uint32_t mpr2;
523 +    volatile uint32_t mpr3;
524 +    volatile uint32_t mpr4;
525 +    volatile uint32_t ts;
526 +} mc9328mxl_uart_regs_t;
527  
528  #define MC9328MXL_UART_RXD_CHARRDY    (bit(15))
529  #define MC9328MXL_UART_RXD_ERR        (bit(14))
530 @@ -205,6 +232,17 @@
531  #define MC9328MXL_UART_CR4_OREN       (bit(1))
532  #define MC9328MXL_UART_CR4_DREN       (bit(0))
533  
534 +#define MC9328MXL_UART_FCR_TXTL(x)    (((x) & 0x3f) << 10)
535 +#define MC9328MXL_UART_FCR_RFDIV_1    (5 << 7)
536 +#define MC9328MXL_UART_FCR_RFDIV_2    (4 << 7)
537 +#define MC9328MXL_UART_FCR_RFDIV_3    (3 << 7)
538 +#define MC9328MXL_UART_FCR_RFDIV_4    (2 << 7)
539 +#define MC9328MXL_UART_FCR_RFDIV_5    (1 << 7)
540 +#define MC9328MXL_UART_FCR_RFDIV_6    (0 << 7)
541 +#define MC9328MXL_UART_FCR_RFDIV_7    (6 << 7)
542 +#define MC9328MXL_UART_FCR_RFDIV_MASK (7 << 7)
543 +#define MC9328MXL_UART_FCR_RXTL(x)    (((x) & 0x3f) << 0)
544 +
545  #define MC9328MXL_UART_SR1_PARERR     (bit(15))
546  #define MC9328MXL_UART_SR1_RTSS       (bit(14))
547  #define MC9328MXL_UART_SR1_TRDY       (bit(13))
548 Index: rtems/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c
549 ===================================================================
550 --- rtems/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c       (revision 42)
551 +++ rtems/c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c       (working copy)
552 @@ -28,13 +28,14 @@
553  static int clock_isr_is_on(const rtems_irq_connect_data *irq);
554  
555  /* Replace the first value with the clock's interrupt name. */
556 -rtems_irq_connect_data clock_isr_data = {BSP_INT_TIMER1,
557 -                                         (rtems_irq_hdl)Clock_isr,
558 -                                         clock_isr_on,
559 -                                         clock_isr_off,
560 -                                         clock_isr_is_on,
561 -                                         3,     /* unused for ARM cpus */
562 -                                         0 };   /* unused for ARM cpus */
563 +rtems_irq_connect_data clock_isr_data = {
564 +    .name   = BSP_INT_TIMER1,
565 +    .hdl    = (rtems_irq_hdl)Clock_isr,
566 +    .handle = (void *)BSP_INT_TIMER1,
567 +    .on     = clock_isr_on,
568 +    .off    = clock_isr_off,
569 +    .isOn   = clock_isr_is_on,
570 +};
571  
572  /* If you follow the code, this is never used, so any value 
573   * should work
574 @@ -82,7 +83,7 @@
575          int cnt; \
576          freq = get_perclk1_freq(); \
577          printk("perclk1 freq is %d\n", freq); \
578 -        cnt = ((freq / 1000) * BSP_Configuration.microseconds_per_tick) / 1000;\
579 +        cnt = ((long long)freq * BSP_Configuration.microseconds_per_tick + 500000) / 1000000;\
580          printk("cnt freq is %d\n", cnt); \
581          MC9328MXL_TMR1_TCMP = cnt; \
582          /* use PERCLK1 as input, enable timer */ \
583 Index: rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S
584 ===================================================================
585 --- rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S      (revision 42)
586 +++ rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_asm.S      (working copy)
587 @@ -31,13 +31,15 @@
588  
589    /* find the ISR's address based on the vector */     
590    ldr   r0, =bsp_vector_table
591 -  ldr  r0, [r0, r1, LSL #2]    /* Read the address */
592 +  mov   r1, r1, LSL #3          /* Shift vector to get offset into table */
593 +  add   r1, r0, r1              /* r1 has address of vector entry */
594 +  ldr   r0, [r1, #4]            /* Get the data pointer */
595 +  ldr  r1, [r1]                /* Get the vector */
596  
597 -
598    stmdb          sp!,{lr}
599    ldr     lr, =IRQ_return         /* prepare the return from handler  */
600  
601 -  mov     pc, r0               /* EXECUTE INT HANDLER */
602 +  mov     pc, r1               /* EXECUTE INT HANDLER */
603  
604  IRQ_return:
605    ldmia sp!,{lr}
606 Index: rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h
607 ===================================================================
608 --- rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h      (revision 42)
609 +++ rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h      (working copy)
610 @@ -15,6 +15,8 @@
611  #ifndef __IRQ_H__
612  #define __IRQ_H__
613  
614 +#include <rtems/irq.h>
615 +
616  #ifdef __cplusplus
617  extern "C" {
618  #endif
619 @@ -34,7 +36,7 @@
620   * Constants
621   **********************************************************************/
622  
623 -/* possible interrupt sources on the AT91RM9200 */
624 +/* possible interrupt sources on the MC9328MXL */
625  #define BSP_INT_UART3_PFERR       0 
626  #define BSP_INT_UART3_RTS         1     
627  #define BSP_INT_UART3_DTR         2     
628 @@ -101,64 +103,21 @@
629  #define BSP_INT_WDT              63
630  #define BSP_MAX_INT              64
631                
632 -typedef unsigned char  rtems_irq_level;
633 -typedef unsigned char  rtems_irq_trigger;
634 +typedef struct {
635 +    rtems_irq_hdl       vector;
636 +    rtems_irq_hdl_param data;
637 +} mc9328mxl_irq_info_t;
638  
639 -typedef unsigned int rtems_irq_number;
640 -struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
641  
642 -typedef void (*rtems_irq_hdl)       (void);
643 -typedef void (*rtems_irq_enable)    (const struct __rtems_irq_connect_data__*);
644 -typedef void (*rtems_irq_disable)   (const struct __rtems_irq_connect_data__*);
645 -typedef int  (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*);
646  
647 -extern rtems_irq_hdl bsp_vector_table[BSP_MAX_INT];
648 -#define VECTOR_TABLE bsp_vector_table
649 -                                                                                          
650 -typedef struct __rtems_irq_connect_data__ {
651 -    /* IRQ line */
652 -    rtems_irq_number              name;
653 +extern mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
654  
655 -    /* Handler */
656 -    rtems_irq_hdl                 hdl;
657 -
658 -    /* function for enabling interrupts at device level. */
659 -    rtems_irq_enable              on;
660 -
661 -    /* function for disabling interrupts at device level. */
662 -    rtems_irq_disable             off;
663 -
664 -    /* Function to test if interrupt is enabled */
665 -    rtems_irq_is_enabled        isOn;
666 -
667 -    /* priority level of interrupt */
668 -    rtems_irq_level               irqLevel;
669 -
670 -    /* Trigger method (rising/falling edge or high/low level) */
671 -    rtems_irq_trigger             irqTrigger;
672 -} rtems_irq_connect_data;
673 -
674  /*
675   * function to initialize the interrupt for a specific BSP
676   */
677  void BSP_rtems_irq_mngt_init();
678  
679  
680 -/*
681 - * function to connect a particular irq handler.
682 - */
683 -int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
684 -
685 -/*
686 - * function to get the current RTEMS irq handler for ptr->name. 
687 - */
688 -int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
689 -
690 -/*
691 - * function to disconnect the RTEMS irq handler for ptr->name.
692 - */
693 -int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
694 -
695  #endif /* __asm__ */
696  
697  #ifdef __cplusplus
698 Index: rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c
699 ===================================================================
700 --- rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c     (revision 42)
701 +++ rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/bsp_irq_init.c     (working copy)
702 @@ -23,10 +23,11 @@
703   */
704  void BSP_rtems_irq_mngt_init()
705  {
706 -#if 0
707 -    /* disable all interrupts */
708 -    AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
709 -#endif
710 +    int i;
711  
712 +    for (i = 0; i < BSP_MAX_INT; i++) {
713 +        bsp_vector_table[i].vector = default_int_handler;
714 +        bsp_vector_table[i].data   = NULL;
715 +    }
716  }
717  
718 Index: rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
719 ===================================================================
720 --- rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c      (revision 42)
721 +++ rtems/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c      (working copy)
722 @@ -16,6 +16,8 @@
723  #include <rtems/score/apiext.h>
724  #include <mc9328mxl.h>
725  
726 +mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
727 +
728  /*
729   * This function check that the value given for the irq line
730   * is valid.
731 @@ -36,9 +38,6 @@
732  int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
733  {
734      rtems_interrupt_level level;
735 -    rtems_irq_hdl *bsp_tbl;
736 -
737 -    bsp_tbl = (rtems_irq_hdl *)&bsp_vector_table;
738      
739      if (!isValidInterrupt(irq->name)) {
740        return 0;
741 @@ -47,8 +46,8 @@
742      /*
743       * Check if default handler is actually connected. If not issue an error.
744       */
745 -    if (bsp_tbl[irq->name] != default_int_handler) {
746 -      return 0;
747 +    if (bsp_vector_table[irq->name].vector != default_int_handler) {
748 +        return 0;
749      }
750  
751      _CPU_ISR_Disable(level);
752 @@ -56,7 +55,8 @@
753      /*
754       * store the new handler
755       */
756 -    bsp_tbl[irq->name] = irq->hdl;
757 +    bsp_vector_table[irq->name].vector = irq->hdl;
758 +    bsp_vector_table[irq->name].data = irq->handle;
759  
760      /*
761       * Enable interrupt on device
762 @@ -80,18 +80,15 @@
763  int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
764  {
765      rtems_interrupt_level level;
766 -    rtems_irq_hdl *bsp_tbl;
767  
768 -    bsp_tbl = (rtems_irq_hdl *)&bsp_vector_table;
769 -  
770      if (!isValidInterrupt(irq->name)) {
771        return 0;
772      }
773      /*
774       * Check if the handler is actually connected. If not issue an error.
775       */
776 -    if (bsp_tbl[irq->name] != irq->hdl) {
777 -      return 0;
778 +    if (bsp_vector_table[irq->name].vector != irq->hdl) {
779 +        return 0;
780      }
781  
782      _CPU_ISR_Disable(level);
783 @@ -106,8 +103,8 @@
784      /*
785       * restore the default irq value
786       */
787 -    bsp_tbl[irq->name] = default_int_handler;
788 -    
789 +    bsp_vector_table[irq->name].vector = default_int_handler;
790 +    bsp_vector_table[irq->name].data = NULL;
791  
792      _CPU_ISR_Enable(level);
793  
794 Index: rtems/c/src/lib/libcpu/arm/shared/arm920/mmu.c
795 ===================================================================
796 --- rtems/c/src/lib/libcpu/arm/shared/arm920/mmu.c      (revision 42)
797 +++ rtems/c/src/lib/libcpu/arm/shared/arm920/mmu.c      (working copy)
798 @@ -151,7 +151,7 @@
799  static inline uint32_t mmu_get_ctrl(void)
800  {
801      uint32_t val;
802 -    asm volatile ("msr 15, 0, %0, cr1, cr0\n" : "=r" (val));
803 +    asm volatile ("mrc 15, 0, %0, cr1, cr0\n" : "=r" (val));
804      return val;
805  }
806  
807 @@ -240,3 +240,13 @@
808          base[i] = MMU_SET_LVL1_INVAL;
809      }
810  }
811 +
812 +
813 +void mmu_set_cpu_async_mode(void)
814 +{
815 +    uint32_t reg;
816 +    reg = mmu_get_ctrl();
817 +    reg |= 0xc0000000;
818 +    mmu_set_ctrl(reg);
819 +}
820 +    
821 Index: rtems/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c
822 ===================================================================
823 --- rtems/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c    (revision 42)
824 +++ rtems/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_init.c    (working copy)
825 @@ -23,6 +23,16 @@
826   */
827  void BSP_rtems_irq_mngt_init()
828  {
829 +    long *vectorTable;
830 +    int i;
831 +
832 +    vectorTable = (long *) VECTOR_TABLE;
833 +
834 +    /* Initialize the vector table contents with default handler */
835 +    for (i=0; i<BSP_MAX_INT; i++) {
836 +        *(vectorTable + i) = (long)(default_int_handler);
837 +    }
838 +
839      /* disable all interrupts */
840      AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
841  }
842 Index: rtems/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_init.c
843 ===================================================================
844 --- rtems/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_init.c       (revision 42)
845 +++ rtems/c/src/lib/libcpu/arm/s3c2400/irq/bsp_irq_init.c       (working copy)
846 @@ -20,6 +20,16 @@
847  
848  void BSP_rtems_irq_mngt_init() 
849  {
850 +    long *vectorTable;
851 +    int i;
852 +
853 +    vectorTable = (long *) VECTOR_TABLE;
854 +
855 +    /* Initialize the vector table contents with default handler */
856 +    for (i=0; i<BSP_MAX_INT; i++) {
857 +        *(vectorTable + i) = (long)(default_int_handler);
858 +    }
859 +
860      /*
861       * Here is the code to initialize the INT for
862       * the specified BSP
863 Index: rtems/make/custom/csb336.cfg
864 ===================================================================
865 --- rtems/make/custom/csb336.cfg        (revision 42)
866 +++ rtems/make/custom/csb336.cfg        (working copy)
867 @@ -22,12 +22,12 @@
868  # -O4 is ok for RTEMS
869  # NOTE2: some level of -O may be actually required by inline assembler (at least
870  # -O2 so far.
871 -CFLAGS_OPTIMIZE_V=-O3
872 +CFLAGS_OPTIMIZE_V=-O3 -g
873  #CFLAGS_OPTIMIZE_V=-O4 -mmultiple -mstring -mstrict-align
874  
875  # debug flags: typically none, but at least -O1 is required due to this
876  # BSP using inlined code
877 -CFLAGS_DEBUG_V = -O1
878 +CFLAGS_DEBUG_V = -O1 -g
879  #CFLAGS_DEBUG_V = -O1 -mmultiple -mstring -mstrict-align
880  
881