Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

software: remove redundant clk_frequency

  • Loading branch information...
commit 028c9f6cda80a8834450c86286b55cea0077efc5 1 parent 0f65527
Sébastien Bourdeauducq authored November 22, 2011
4  software/bios/main.c
@@ -476,7 +476,7 @@ static int test_user_abort()
476 476
 
477 477
 	puts("I: Press Q or ESC to abort boot");
478 478
 	CSR_TIMER0_COUNTER = 0;
479  
-	CSR_TIMER0_COMPARE = 2*brd_desc->clk_frequency;
  479
+	CSR_TIMER0_COMPARE = 2*CSR_FREQUENCY;
480 480
 	CSR_TIMER0_CONTROL = TIMER_ENABLE;
481 481
 	while(CSR_TIMER0_CONTROL & TIMER_ENABLE) {
482 482
 		if(readchar_nonblock()) {
@@ -596,7 +596,7 @@ static void readstr(char *s, int size)
596 596
 static void ethreset_delay()
597 597
 {
598 598
 	CSR_TIMER0_COUNTER = 0;
599  
-	CSR_TIMER0_COMPARE = brd_desc->clk_frequency >> 2;
  599
+	CSR_TIMER0_COMPARE = CSR_FREQUENCY >> 2;
600 600
 	CSR_TIMER0_CONTROL = TIMER_ENABLE;
601 601
 	while(CSR_TIMER0_CONTROL & TIMER_ENABLE);
602 602
 }
7  software/demo/memstats.c
... ...
@@ -1,6 +1,6 @@
1 1
 /*
2 2
  * Milkymist SoC (Software)
3  
- * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
  3
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
4 4
  *
5 5
  * This program is free software: you can redistribute it and/or modify
6 6
  * it under the terms of the GNU General Public License as published by
@@ -17,9 +17,8 @@
17 17
 
18 18
 #include <board.h>
19 19
 
20  
-#include <hal/brd.h>
21  
-
22 20
 #include <hw/fmlmeter.h>
  21
+#include <hw/sysctl.h>
23 22
 
24 23
 static unsigned int last_stb_count;
25 24
 static unsigned int last_ack_count;
@@ -41,7 +40,7 @@ void memstats_tick()
41 40
 
42 41
 unsigned int memstat_occupancy()
43 42
 {
44  
-	return last_stb_count/(brd_desc->clk_frequency/100);
  43
+	return last_stb_count/(CSR_FREQUENCY/100);
45 44
 }
46 45
 
47 46
 unsigned int memstat_net_bandwidth()
3  software/include/base/board.h
... ...
@@ -1,6 +1,6 @@
1 1
 /*
2 2
  * Milkymist SoC (Software)
3  
- * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
  3
+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
4 4
  *
5 5
  * This program is free software: you can redistribute it and/or modify
6 6
  * it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@
23 23
 struct board_desc {
24 24
 	unsigned short int id;
25 25
 	char name[BOARD_NAME_LEN];
26  
-	unsigned int clk_frequency;
27 26
 	unsigned int ethernet_phyadr;
28 27
 };
29 28
 
3  software/libbase/board.c
... ...
@@ -1,6 +1,6 @@
1 1
 /*
2 2
  * Milkymist SoC (Software)
3  
- * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
  3
+ * Copyright (C) 2007, 2008, 2009, 2011 Sebastien Bourdeauducq
4 4
  *
5 5
  * This program is free software: you can redistribute it and/or modify
6 6
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@ static const struct board_desc boards[1] = {
25 25
 	{
26 26
 		.id = 0x4D31, /* M1 */
27 27
 		.name = "Milkymist One",
28  
-		.clk_frequency = 80000000,
29 28
 		.ethernet_phyadr = 1
30 29
 	},
31 30
 };
7  software/libhal/time.c
@@ -23,7 +23,6 @@
23 23
 #include <hw/sysctl.h>
24 24
 #include <hw/interrupts.h>
25 25
 
26  
-#include <hal/brd.h>
27 26
 #include <hal/time.h>
28 27
 
29 28
 static int sec;
@@ -33,7 +32,7 @@ void time_init()
33 32
 	unsigned int mask;
34 33
 	
35 34
 	CSR_TIMER0_COUNTER = 0;
36  
-	CSR_TIMER0_COMPARE = brd_desc->clk_frequency;
  35
+	CSR_TIMER0_COMPARE = CSR_FREQUENCY;
37 36
 	CSR_TIMER0_CONTROL = TIMER_AUTORESTART|TIMER_ENABLE;
38 37
 	irq_ack(IRQ_TIMER0);
39 38
 
@@ -64,7 +63,7 @@ void time_get(struct timestamp *ts)
64 63
 	irq_setmask(oldmask);
65 64
 
66 65
 	ts->sec = sec2;
67  
-	ts->usec = counter/(brd_desc->clk_frequency/1000000);
  66
+	ts->usec = counter/(CSR_FREQUENCY/1000000);
68 67
 	
69 68
 	/*
70 69
 	 * If the counter is less than half a second, we consider that
@@ -72,7 +71,7 @@ void time_get(struct timestamp *ts)
72 71
 	 * value.
73 72
 	 */
74 73
 	if(pending) {
75  
-		if(counter < (brd_desc->clk_frequency/2))
  74
+		if(counter < (CSR_FREQUENCY/2))
76 75
 			ts->sec++;
77 76
 	}
78 77
 }

0 notes on commit 028c9f6

Please sign in to comment.
Something went wrong with that request. Please try again.