Skip to content

Commit f7447a8

Browse files
committed
[bsp][redv] formatting
1 parent df71ffd commit f7447a8

18 files changed

Lines changed: 139 additions & 139 deletions

File tree

bsp/sparkfun-redv/applications/led/led.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2020, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -56,4 +56,4 @@ void led_set(rt_uint8_t val)
5656
void led_toggle(void)
5757
{
5858
_led_toggle(USER_LED_OFFSET);
59-
}
59+
}

bsp/sparkfun-redv/applications/led/led.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2020, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*

bsp/sparkfun-redv/applications/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2020, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -14,7 +14,7 @@
1414
int main(void)
1515
{
1616
rt_kprintf("Hello, World!\n");
17-
17+
1818
led_init();
1919

2020
while (1)
@@ -60,4 +60,4 @@ static void give_me_five(void)
6060
}
6161
#ifdef FINSH_USING_MSH
6262
MSH_CMD_EXPORT(give_me_five, Show the SiFive logo)
63-
#endif
63+
#endif

bsp/sparkfun-redv/drivers/drv_usart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static rt_err_t usart_configure(struct rt_serial_device *serial,
3737
{
3838
RT_ASSERT(serial != RT_NULL);
3939
RT_ASSERT(cfg != RT_NULL);
40-
40+
4141
GPIO_REG(GPIO_IOF_SEL) &= ~IOF0_UART0_MASK;
4242
GPIO_REG(GPIO_IOF_EN) |= IOF0_UART0_MASK;
4343

bsp/sparkfun-redv/drivers/interrupt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ rt_isr_handler_t rt_hw_interrupt_handle(rt_uint32_t vector, void *param)
6262
void rt_hw_interrupt_init(void)
6363
{
6464
int idx;
65-
65+
6666
/* config interrupt vector*/
6767
asm volatile(
6868
"la t0, trap_entry\n"
6969
"csrw mtvec, t0"
7070
);
71-
71+
7272
/* enable global interrupt*/
7373
PLIC_init(&g_plic,
7474
PLIC_CTRL_ADDR,
@@ -86,8 +86,8 @@ void rt_hw_interrupt_init(void)
8686
irq_desc[idx].counter = 0;
8787
#endif
8888
}
89-
90-
// enable machine external interrupt
89+
90+
// enable machine external interrupt
9191
set_csr(mie, MIP_MEIP);
9292
}
9393

@@ -132,7 +132,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
132132
}
133133

134134
/**
135-
* This function will be call when external machine-level
135+
* This function will be call when external machine-level
136136
* interrupt from PLIC occurred.
137137
*/
138138
void handle_m_ext_interrupt(void)

bsp/sparkfun-redv/drivers/interrupt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq);
3333
void rt_hw_interrupt_ack(rt_uint32_t fiq_irq, rt_uint32_t id);
3434
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
3535
void *param, const char *name);
36-
36+
3737
#endif

bsp/sparkfun-redv/freedom-e-sdk/bsp/drivers/fe300prci/fe300prci_driver.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
#include "fe300prci/fe300prci_driver.h"
77
#include <unistd.h>
88

9-
#define rdmcycle(x) { \
10-
uint32_t lo, hi, hi2; \
11-
__asm__ __volatile__ ("1:\n\t" \
12-
"csrr %0, mcycleh\n\t" \
13-
"csrr %1, mcycle\n\t" \
14-
"csrr %2, mcycleh\n\t" \
15-
"bne %0, %2, 1b\n\t" \
16-
: "=r" (hi), "=r" (lo), "=r" (hi2)) ; \
17-
*(x) = lo | ((uint64_t) hi << 32); \
9+
#define rdmcycle(x) { \
10+
uint32_t lo, hi, hi2; \
11+
__asm__ __volatile__ ("1:\n\t" \
12+
"csrr %0, mcycleh\n\t" \
13+
"csrr %1, mcycle\n\t" \
14+
"csrr %2, mcycleh\n\t" \
15+
"bne %0, %2, 1b\n\t" \
16+
: "=r" (hi), "=r" (lo), "=r" (hi2)) ; \
17+
*(x) = lo | ((uint64_t) hi << 32); \
1818
}
1919

2020
uint32_t PRCI_measure_mcycle_freq(uint32_t mtime_ticks, uint32_t mtime_freq)
@@ -34,49 +34,49 @@ uint32_t PRCI_measure_mcycle_freq(uint32_t mtime_ticks, uint32_t mtime_freq)
3434
do {
3535
start_mtime = CLINT_REG(CLINT_MTIME);
3636
} while (start_mtime == tmp);
37-
37+
3838
uint64_t start_mcycle;
3939
rdmcycle(&start_mcycle);
40-
40+
4141
while (CLINT_REG(CLINT_MTIME) < end_mtime) ;
42-
42+
4343
uint64_t end_mcycle;
4444
rdmcycle(&end_mcycle);
4545
uint32_t difference = (uint32_t) (end_mcycle - start_mcycle);
4646

4747
uint64_t freq = ((uint64_t) difference * mtime_freq) / mtime_ticks;
4848
return (uint32_t) freq & 0xFFFFFFFF;
49-
49+
5050
}
51-
51+
5252

5353
void PRCI_use_hfrosc(int div, int trim)
5454
{
5555
// Make sure the HFROSC is running at its default setting
5656
// It is OK to change this even if we are running off of it.
57-
57+
5858
PRCI_REG(PRCI_HFROSCCFG) = (ROSC_DIV(div) | ROSC_TRIM(trim) | ROSC_EN(1));
5959

6060
while ((PRCI_REG(PRCI_HFROSCCFG) & ROSC_RDY(1)) == 0);
61-
61+
6262
PRCI_REG(PRCI_PLLCFG) &= ~PLL_SEL(1);
6363
}
6464

6565
void PRCI_use_pll(int refsel, int bypass,
66-
int r, int f, int q, int finaldiv,
67-
int hfroscdiv, int hfrosctrim)
66+
int r, int f, int q, int finaldiv,
67+
int hfroscdiv, int hfrosctrim)
6868
{
6969
// Ensure that we aren't running off the PLL before we mess with it.
7070
if (PRCI_REG(PRCI_PLLCFG) & PLL_SEL(1)) {
7171
// Make sure the HFROSC is running at its default setting
7272
PRCI_use_hfrosc(4, 16);
7373
}
74-
74+
7575
// Set PLL Source to be HFXOSC if desired.
7676
uint32_t config_value = 0;
7777

7878
config_value |= PLL_REFSEL(refsel);
79-
79+
8080
if (bypass) {
8181
// Bypass
8282
config_value |= PLL_BYPASS(1);
@@ -87,14 +87,14 @@ void PRCI_use_pll(int refsel, int bypass,
8787
// Set our Final output divide to divide-by-1:
8888
PRCI_REG(PRCI_PLLDIV) = (PLL_FINAL_DIV_BY_1(1) | PLL_FINAL_DIV(0));
8989
} else {
90-
90+
9191
// To overclock, use the hfrosc
9292
if (hfrosctrim >= 0 && hfroscdiv >= 0) {
9393
PRCI_use_hfrosc(hfroscdiv, hfrosctrim);
9494
}
95-
95+
9696
// Set DIV Settings for PLL
97-
97+
9898
// (Legal values of f_REF are 6-48MHz)
9999

100100
// Set DIVR to divide-by-2 to get 8MHz frequency
@@ -132,7 +132,7 @@ void PRCI_use_pll(int refsel, int bypass,
132132
// So wait 4 ticks of RTC.
133133
uint32_t now = CLINT_REG(CLINT_MTIME);
134134
while (CLINT_REG(CLINT_MTIME) - now < 4) ;
135-
135+
136136
// Now it is safe to check for PLL Lock
137137
while ((PRCI_REG(PRCI_PLLCFG) & PLL_LOCK(1)) == 0);
138138

@@ -146,7 +146,7 @@ void PRCI_use_pll(int refsel, int bypass,
146146
if (refsel) {
147147
PRCI_REG(PRCI_HFROSCCFG) &= ~ROSC_EN(1);
148148
}
149-
149+
150150
}
151151

152152
void PRCI_use_default_clocks()
@@ -160,15 +160,15 @@ void PRCI_use_default_clocks()
160160

161161
void PRCI_use_hfxosc(uint32_t finaldiv)
162162
{
163-
163+
164164
PRCI_use_pll(1, // Use HFXTAL
165-
1, // Bypass = 1
166-
0, // PLL settings don't matter
167-
0, // PLL settings don't matter
168-
0, // PLL settings don't matter
169-
finaldiv,
170-
-1,
171-
-1);
165+
1, // Bypass = 1
166+
0, // PLL settings don't matter
167+
0, // PLL settings don't matter
168+
0, // PLL settings don't matter
169+
finaldiv,
170+
-1,
171+
-1);
172172
}
173173

174174
// This is a generic function, which
@@ -199,28 +199,28 @@ uint32_t PRCI_set_hfrosctrim_for_f_cpu(uint32_t f_cpu, PRCI_freq_target target )
199199
uint32_t desired_hfrosc_freq = (f_cpu/ 16);
200200

201201
PRCI_use_hfrosc(hfroscdiv, hfrosctrim);
202-
202+
203203
// Ignore the first run (for icache reasons)
204204
uint32_t cpu_freq = PRCI_measure_mcycle_freq(3000, RTC_FREQ);
205205

206206
cpu_freq = PRCI_measure_mcycle_freq(3000, RTC_FREQ);
207207
uint32_t prev_freq = cpu_freq;
208-
208+
209209
while ((cpu_freq < desired_hfrosc_freq) && (hfrosctrim < 0x1F)){
210210
prev_trim = hfrosctrim;
211211
prev_freq = cpu_freq;
212212
hfrosctrim ++;
213213
PRCI_use_hfrosc(hfroscdiv, hfrosctrim);
214214
cpu_freq = PRCI_measure_mcycle_freq(3000, RTC_FREQ);
215-
}
215+
}
216216

217217
// We couldn't go low enough
218218
if (prev_freq > desired_hfrosc_freq){
219219
PRCI_use_pll(0, 0, 1, 31, 1, 1, hfroscdiv, prev_trim);
220220
cpu_freq = PRCI_measure_mcycle_freq(1000, RTC_FREQ);
221221
return cpu_freq;
222222
}
223-
223+
224224
// We couldn't go high enough
225225
if (cpu_freq < desired_hfrosc_freq){
226226
PRCI_use_pll(0, 0, 1, 31, 1, 1, hfroscdiv, prev_trim);

bsp/sparkfun-redv/freedom-e-sdk/bsp/drivers/fe300prci/fe300prci_driver.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
#include <unistd.h>
99

1010
typedef enum prci_freq_target {
11-
11+
1212
PRCI_FREQ_OVERSHOOT,
1313
PRCI_FREQ_CLOSEST,
1414
PRCI_FREQ_UNDERSHOOT
1515

1616
} PRCI_freq_target;
1717

18-
/* Measure and return the approximate frequency of the
19-
* CPU, as given by measuring the mcycle counter against
18+
/* Measure and return the approximate frequency of the
19+
* CPU, as given by measuring the mcycle counter against
2020
* the mtime ticks.
2121
*/
2222
uint32_t PRCI_measure_mcycle_freq(uint32_t mtime_ticks, uint32_t mtime_freq);
@@ -34,7 +34,7 @@ void PRCI_use_hfxosc(uint32_t finaldiv);
3434

3535
/* Safely switch over to the PLL using the given
3636
* settings.
37-
*
37+
*
3838
* Note that not all combinations of the inputs are actually
3939
* legal, and this function does not check for their
4040
* legality ("safely" means that this function won't turn off
@@ -43,30 +43,30 @@ void PRCI_use_hfxosc(uint32_t finaldiv);
4343
*/
4444

4545
void PRCI_use_pll(int refsel, int bypass,
46-
int r, int f, int q, int finaldiv,
47-
int hfroscdiv, int hfrosctrim);
46+
int r, int f, int q, int finaldiv,
47+
int hfroscdiv, int hfrosctrim);
4848

4949
/* Use the default clocks configured at reset.
5050
* This is ~16Mhz HFROSC and turns off the LFROSC
51-
* (on the current FE310 Dev Platforms, an external LFROSC is
51+
* (on the current FE310 Dev Platforms, an external LFROSC is
5252
* used as it is more power efficient).
5353
*/
5454
void PRCI_use_default_clocks();
5555

5656
/* This routine will adjust the HFROSC trim
57-
* while using HFROSC as the clock source,
57+
* while using HFROSC as the clock source,
5858
* measure the resulting frequency, then
59-
* use it as the PLL clock source,
60-
* in an attempt to get over, under, or close to the
61-
* requested frequency. It returns the actual measured
62-
* frequency.
59+
* use it as the PLL clock source,
60+
* in an attempt to get over, under, or close to the
61+
* requested frequency. It returns the actual measured
62+
* frequency.
6363
*
64-
* Note that the requested frequency must be within the
65-
* range supported by the PLL so not all values are
66-
* achievable with this function, and not all
64+
* Note that the requested frequency must be within the
65+
* range supported by the PLL so not all values are
66+
* achievable with this function, and not all
6767
* are guaranteed to actually work. The PLL
6868
* is rated higher than the hardware.
69-
*
69+
*
7070
* There is no check on the desired f_cpu frequency, it
7171
* is up to the user to specify something reasonable.
7272
*/
@@ -76,4 +76,4 @@ uint32_t PRCI_set_hfrosctrim_for_f_cpu(uint32_t f_cpu, PRCI_freq_target target);
7676
//__END_DECLS
7777

7878
#endif
79-
79+

0 commit comments

Comments
 (0)