1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-21 12:26:26 +02:00
wernermisc/m1/patches/rtems/milkymist-map-sysfreq.patch

87 lines
3.5 KiB
Diff
Raw Normal View History

From: S?bastien Bourdeauducq <sebastien@milkymist.org>
Subject: [Milkymist-devel] RTEMS support patch for new address map +
readable system frequency
Index: rtems/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h 2011-11-25 05:05:51.000000000 -0300
+++ rtems/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h 2011-11-25 05:18:11.000000000 -0300
@@ -15,9 +15,11 @@
#ifndef __SYSTEM_CONFIG_H_
#define __SYSTEM_CONFIG_H_
-#define CPU_FREQUENCY (80000000)
#define UART_BAUD_RATE (115200)
+/* Clock frequency */
+#define MM_FREQUENCY (0xe0001074)
+
/* FML bridge */
#define FMLBRG_FLUSH_BASE (0xc8000000)
#define FMLBRG_LINE_LENGTH (32)
@@ -65,10 +67,10 @@
#define GPIO_LED2 (0x00000002)
/* System ID and reset */
-#define MM_SYSTEM_ID (0xe000103c)
+#define MM_SYSTEM_ID (0xe000107c)
/* ICAP */
-#define MM_ICAP (0xe0001034)
+#define MM_ICAP (0xe0001040)
#define ICAP_READY (0x01)
#define ICAP_CE (0x10000)
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c 2011-08-01 10:48:39.000000000 -0300
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c 2011-11-25 05:18:11.000000000 -0300
@@ -35,7 +35,7 @@
void Clock_driver_support_initialize_hardware(void)
{
MM_WRITE(MM_TIMER0_COMPARE,
- (CPU_FREQUENCY/(1000000/rtems_configuration_get_microseconds_per_tick())));
+ (MM_READ(MM_FREQUENCY)/(1000000/rtems_configuration_get_microseconds_per_tick())));
MM_WRITE(MM_TIMER0_COUNTER, 0);
MM_WRITE(MM_TIMER0_CONTROL, TIMER_ENABLE | TIMER_AUTORESTART);
bsp_interrupt_vector_enable(MM_IRQ_TIMER0);
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c 2011-11-25 05:05:51.000000000 -0300
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c 2011-11-25 05:18:11.000000000 -0300
@@ -109,7 +109,7 @@
}
if (baud > 0)
- MM_WRITE(MM_UART_DIV, CPU_FREQUENCY/baud/16);
+ MM_WRITE(MM_UART_DIV, MM_READ(MM_FREQUENCY)/baud/16);
return 0;
}
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c 2011-11-25 05:05:51.000000000 -0300
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c 2011-11-25 05:18:11.000000000 -0300
@@ -19,7 +19,7 @@
void BSP_uart_init(int baud)
{
- MM_WRITE(MM_UART_DIV, CPU_FREQUENCY/baud/16);
+ MM_WRITE(MM_UART_DIV, MM_READ(MM_FREQUENCY)/baud/16);
}
void BSP_uart_polled_write(char ch)
Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c
===================================================================
--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c 2011-08-01 10:48:40.000000000 -0300
+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c 2011-11-25 05:18:11.000000000 -0300
@@ -58,7 +58,7 @@
if (ticks == 0xffffffff)
printk("Timer overflow!\n");
- total = ticks / (CPU_FREQUENCY / 1000000);
+ total = ticks / (MM_READ(MM_FREQUENCY) / 1000000);
if (benchmark_timer_find_average_overhead)
return total;