Root/m1/patches/rtems/milkymist-map-sysfreq.patch

Source at commit f6fd776f528905e346c7f1caec97945535c7ca43 created 8 years 4 months ago.
By Werner Almesberger, m1/patches/rtems/: Milkymist-specific patches are in upstream (update by Xiangfu)
1From: S?bastien Bourdeauducq <sebastien@milkymist.org>
2Subject: [Milkymist-devel] RTEMS support patch for new address map +
3        readable system frequency
4
5Index: rtems/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h
6===================================================================
7--- rtems.orig/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h 2011-11-25 05:05:51.000000000 -0300
8+++ rtems/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h 2011-11-25 05:18:11.000000000 -0300
9@@ -15,9 +15,11 @@
10 #ifndef __SYSTEM_CONFIG_H_
11 #define __SYSTEM_CONFIG_H_
12 
13-#define CPU_FREQUENCY (80000000)
14 #define UART_BAUD_RATE (115200)
15 
16+/* Clock frequency */
17+#define MM_FREQUENCY (0xe0001074)
18+
19 /* FML bridge */
20 #define FMLBRG_FLUSH_BASE (0xc8000000)
21 #define FMLBRG_LINE_LENGTH (32)
22@@ -65,10 +67,10 @@
23 #define GPIO_LED2 (0x00000002)
24 
25 /* System ID and reset */
26-#define MM_SYSTEM_ID (0xe000103c)
27+#define MM_SYSTEM_ID (0xe000107c)
28 
29 /* ICAP */
30-#define MM_ICAP (0xe0001034)
31+#define MM_ICAP (0xe0001040)
32 
33 #define ICAP_READY (0x01)
34 #define ICAP_CE (0x10000)
35Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c
36===================================================================
37--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c 2011-08-01 10:48:39.000000000 -0300
38+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c 2011-11-25 05:18:11.000000000 -0300
39@@ -35,7 +35,7 @@
40 void Clock_driver_support_initialize_hardware(void)
41 {
42   MM_WRITE(MM_TIMER0_COMPARE,
43- (CPU_FREQUENCY/(1000000/rtems_configuration_get_microseconds_per_tick())));
44+ (MM_READ(MM_FREQUENCY)/(1000000/rtems_configuration_get_microseconds_per_tick())));
45   MM_WRITE(MM_TIMER0_COUNTER, 0);
46   MM_WRITE(MM_TIMER0_CONTROL, TIMER_ENABLE | TIMER_AUTORESTART);
47   bsp_interrupt_vector_enable(MM_IRQ_TIMER0);
48Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c
49===================================================================
50--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c 2011-11-25 05:05:51.000000000 -0300
51+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c 2011-11-25 05:18:11.000000000 -0300
52@@ -109,7 +109,7 @@
53   }
54 
55   if (baud > 0)
56- MM_WRITE(MM_UART_DIV, CPU_FREQUENCY/baud/16);
57+ MM_WRITE(MM_UART_DIV, MM_READ(MM_FREQUENCY)/baud/16);
58 
59   return 0;
60 }
61Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c
62===================================================================
63--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c 2011-11-25 05:05:51.000000000 -0300
64+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c 2011-11-25 05:18:11.000000000 -0300
65@@ -19,7 +19,7 @@
66 
67 void BSP_uart_init(int baud)
68 {
69- MM_WRITE(MM_UART_DIV, CPU_FREQUENCY/baud/16);
70+ MM_WRITE(MM_UART_DIV, MM_READ(MM_FREQUENCY)/baud/16);
71 }
72 
73 void BSP_uart_polled_write(char ch)
74Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c
75===================================================================
76--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c 2011-08-01 10:48:40.000000000 -0300
77+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c 2011-11-25 05:18:11.000000000 -0300
78@@ -58,7 +58,7 @@
79   if (ticks == 0xffffffff)
80     printk("Timer overflow!\n");
81 
82- total = ticks / (CPU_FREQUENCY / 1000000);
83+ total = ticks / (MM_READ(MM_FREQUENCY) / 1000000);
84 
85   if (benchmark_timer_find_average_overhead)
86     return total;
87

Archive Download this file

Branches:
master



interactive