Skip to content

Commit 028c9f6

Browse files
author
Sebastien Bourdeauducq
committedNov 22, 2011
software: remove redundant clk_frequency
1 parent 0f65527 commit 028c9f6

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed
 

Diff for: ‎software/bios/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static int test_user_abort()
476476

477477
puts("I: Press Q or ESC to abort boot");
478478
CSR_TIMER0_COUNTER = 0;
479-
CSR_TIMER0_COMPARE = 2*brd_desc->clk_frequency;
479+
CSR_TIMER0_COMPARE = 2*CSR_FREQUENCY;
480480
CSR_TIMER0_CONTROL = TIMER_ENABLE;
481481
while(CSR_TIMER0_CONTROL & TIMER_ENABLE) {
482482
if(readchar_nonblock()) {
@@ -596,7 +596,7 @@ static void readstr(char *s, int size)
596596
static void ethreset_delay()
597597
{
598598
CSR_TIMER0_COUNTER = 0;
599-
CSR_TIMER0_COMPARE = brd_desc->clk_frequency >> 2;
599+
CSR_TIMER0_COMPARE = CSR_FREQUENCY >> 2;
600600
CSR_TIMER0_CONTROL = TIMER_ENABLE;
601601
while(CSR_TIMER0_CONTROL & TIMER_ENABLE);
602602
}

Diff for: ‎software/demo/memstats.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Milkymist SoC (Software)
3-
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
3+
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -17,9 +17,8 @@
1717

1818
#include <board.h>
1919

20-
#include <hal/brd.h>
21-
2220
#include <hw/fmlmeter.h>
21+
#include <hw/sysctl.h>
2322

2423
static unsigned int last_stb_count;
2524
static unsigned int last_ack_count;
@@ -41,7 +40,7 @@ void memstats_tick()
4140

4241
unsigned int memstat_occupancy()
4342
{
44-
return last_stb_count/(brd_desc->clk_frequency/100);
43+
return last_stb_count/(CSR_FREQUENCY/100);
4544
}
4645

4746
unsigned int memstat_net_bandwidth()

Diff for: ‎software/include/base/board.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Milkymist SoC (Software)
3-
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
3+
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@
2323
struct board_desc {
2424
unsigned short int id;
2525
char name[BOARD_NAME_LEN];
26-
unsigned int clk_frequency;
2726
unsigned int ethernet_phyadr;
2827
};
2928

Diff for: ‎software/libbase/board.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Milkymist SoC (Software)
3-
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
3+
* Copyright (C) 2007, 2008, 2009, 2011 Sebastien Bourdeauducq
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@ static const struct board_desc boards[1] = {
2525
{
2626
.id = 0x4D31, /* M1 */
2727
.name = "Milkymist One",
28-
.clk_frequency = 80000000,
2928
.ethernet_phyadr = 1
3029
},
3130
};

Diff for: ‎software/libhal/time.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <hw/sysctl.h>
2424
#include <hw/interrupts.h>
2525

26-
#include <hal/brd.h>
2726
#include <hal/time.h>
2827

2928
static int sec;
@@ -33,7 +32,7 @@ void time_init()
3332
unsigned int mask;
3433

3534
CSR_TIMER0_COUNTER = 0;
36-
CSR_TIMER0_COMPARE = brd_desc->clk_frequency;
35+
CSR_TIMER0_COMPARE = CSR_FREQUENCY;
3736
CSR_TIMER0_CONTROL = TIMER_AUTORESTART|TIMER_ENABLE;
3837
irq_ack(IRQ_TIMER0);
3938

@@ -64,15 +63,15 @@ void time_get(struct timestamp *ts)
6463
irq_setmask(oldmask);
6564

6665
ts->sec = sec2;
67-
ts->usec = counter/(brd_desc->clk_frequency/1000000);
66+
ts->usec = counter/(CSR_FREQUENCY/1000000);
6867

6968
/*
7069
* If the counter is less than half a second, we consider that
7170
* the overflow was already present when we read the counter
7271
* value.
7372
*/
7473
if(pending) {
75-
if(counter < (brd_desc->clk_frequency/2))
74+
if(counter < (CSR_FREQUENCY/2))
7675
ts->sec++;
7776
}
7877
}

0 commit comments

Comments
 (0)
Please sign in to comment.