Skip to content

Commit 5d32b5d

Browse files
- fix indentations.
1 parent 0fc2b13 commit 5d32b5d

File tree

13 files changed

+1054
-997
lines changed

13 files changed

+1054
-997
lines changed

bsp/ls2kdev/applications/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#include <rtthread.h>
1212

13-
int main(int argc, char** argv)
14-
{
13+
int main(int argc, char **argv)
14+
{
1515
rt_kprintf("Hi, this is RT-Thread!!\n");
1616
return 0;
1717
}

bsp/ls2kdev/drivers/board.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void rt_hw_timer_handler(void)
6767
*/
6868
void rt_hw_timer_init(void)
6969
{
70-
write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
70+
write_c0_compare(CPU_HZ / 2 / RT_TICK_PER_SECOND);
7171
write_c0_count(0);
7272
mips_unmask_cpu_irq(7);
7373
}
@@ -94,12 +94,12 @@ void rt_hw_board_init(void)
9494
#endif
9595

9696
#ifdef RT_USING_HEAP
97-
rt_system_heap_init((void*)RT_HW_HEAP_BEGIN, (void*)RT_HW_HEAP_END);
97+
rt_system_heap_init((void *)RT_HW_HEAP_BEGIN, (void *)RT_HW_HEAP_END);
9898
#endif
9999

100100
/* init operating system timer */
101101
rt_hw_timer_init();
102-
102+
103103
#ifdef RT_USING_COMPONENTS_INIT
104104
rt_components_board_init();
105105
#endif

bsp/ls2kdev/drivers/clk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#include <rtthread.h>
1515
#include "ls2k1000.h"
1616

17-
struct loongson_pll {
17+
struct loongson_pll
18+
{
1819
rt_uint64_t PLL_SYS_0;
1920
rt_uint64_t PLL_SYS_1;
2021
rt_uint64_t PLL_DDR_0;

bsp/ls2kdev/drivers/drv_gpio.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ static void loongson_pin_mode(struct rt_device *device, rt_base_t pin, rt_base_t
2525
gpio = (void *)device->user_data;
2626
m = (rt_uint64_t)1 << pin;
2727

28-
switch (mode) {
28+
switch (mode)
29+
{
2930
case PIN_MODE_OUTPUT:
3031
gpio->GPIO0_OEN &= ~m;
3132
break;
@@ -52,7 +53,8 @@ static void loongson_pin_write(struct rt_device *device, rt_base_t pin, rt_base_
5253
struct loongson_gpio *gpio;
5354
rt_uint64_t m;
5455

55-
if (pin < 0 || pin >= 60) {
56+
if (pin < 0 || pin >= 60)
57+
{
5658
rt_kprintf("error\n");
5759
return;
5860
}
@@ -90,19 +92,19 @@ static rt_err_t loongson_pin_attach_irq(struct rt_device *device, rt_int32_t pin
9092

9193
gpio = (void *)device->user_data;
9294

93-
if(pin < 4)
95+
if (pin < 4)
9496
{
9597
index = pin;
9698
}
97-
else if(pin < 32)
99+
else if (pin < 32)
98100
{
99101
index = 5;
100102
}
101103
else
102104
{
103105
index = 6;
104106
}
105-
107+
106108
_g_gpio_irq_tbl[index].irq_cb[pin] = hdr;
107109
_g_gpio_irq_tbl[index].irq_arg[pin] = args;
108110
_g_gpio_irq_tbl[index].irq_type[pin] = mode;
@@ -120,11 +122,11 @@ static rt_err_t loongson_pin_detach_irq(struct rt_device *device, rt_int32_t pin
120122
gpio = (void *)device->user_data;
121123

122124
rt_uint8_t index;
123-
if(pin < 4)
125+
if (pin < 4)
124126
{
125127
index = pin;
126128
}
127-
else if(pin < 32)
129+
else if (pin < 32)
128130
{
129131
index = 5;
130132
}
@@ -146,11 +148,11 @@ static rt_err_t loongson_pin_irq_enable(struct rt_device *device, rt_base_t pin,
146148
gpio = (void *)device->user_data;
147149

148150
rt_uint8_t index;
149-
if(pin < 4)
151+
if (pin < 4)
150152
{
151153
index = pin;
152154
}
153-
else if(pin < 32)
155+
else if (pin < 32)
154156
{
155157
index = 5;
156158
}
@@ -173,36 +175,36 @@ static void gpio_irq_handler(int irq, void *param)
173175
rt_uint32_t value;
174176
rt_uint32_t tmpvalue;
175177

176-
if(irq == LS2K_GPIO0_INT_IRQ)
178+
if (irq == LS2K_GPIO0_INT_IRQ)
177179
{
178180
pin = 0;
179181
}
180-
else if(irq == LS2K_GPIO1_INT_IRQ)
182+
else if (irq == LS2K_GPIO1_INT_IRQ)
181183
{
182184
pin = 1;
183185
}
184-
else if(irq == LS2K_GPIO2_INT_IRQ)
186+
else if (irq == LS2K_GPIO2_INT_IRQ)
185187
{
186188
pin = 2;
187189
}
188-
else if(irq == LS2K_GPIO3_INT_IRQ)
190+
else if (irq == LS2K_GPIO3_INT_IRQ)
189191
{
190192
pin = 3;
191193
}
192-
else if(irq == LS2K_GPIO_INTLO_IRQ)
194+
else if (irq == LS2K_GPIO_INTLO_IRQ)
193195
{
194196
pin = 4;
195197
}
196198
else
197199
{
198200
pin = 32;
199201
}
200-
202+
201203
while (value)
202204
{
203205
if ((value & 0x1) && (irq_def->irq_cb[pin] != RT_NULL))
204206
{
205-
if(irq_def->state[pin])
207+
if (irq_def->state[pin])
206208
{
207209
irq_def->irq_cb[pin](irq_def->irq_arg[pin]);
208210
}
@@ -212,7 +214,8 @@ static void gpio_irq_handler(int irq, void *param)
212214
}
213215
}
214216

215-
static struct rt_pin_ops loongson_pin_ops = {
217+
static struct rt_pin_ops loongson_pin_ops =
218+
{
216219
.pin_mode = loongson_pin_mode,
217220
.pin_write = loongson_pin_write,
218221
.pin_read = loongson_pin_read,

bsp/ls2kdev/drivers/drv_pwm.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
#define CTRL_INVERT (1UL<<9)
2929
#define CTRL_DZONE (1UL<<10)
3030

31-
struct loongson_pwm {
31+
struct loongson_pwm
32+
{
3233
rt_uint32_t __PAD0;
3334
rt_uint32_t low_buffer;
3435
rt_uint32_t full_buffer;
@@ -91,7 +92,8 @@ static rt_err_t loongson_pwm_ioctl(struct rt_device_pwm *device, int cmd, void *
9192

9293
cfg = (void *)arg;
9394

94-
switch (cmd) {
95+
switch (cmd)
96+
{
9597
case PWM_CMD_ENABLE:
9698
rc = loongson_pwm_enable(device, cfg->channel);
9799
break;
@@ -111,18 +113,21 @@ static rt_err_t loongson_pwm_ioctl(struct rt_device_pwm *device, int cmd, void *
111113
return rc;
112114
}
113115

114-
struct rt_pwm_ops loongson_pwm_ops = {
116+
struct rt_pwm_ops loongson_pwm_ops =
117+
{
115118
.control = loongson_pwm_ioctl,
116119
};
117120

118-
struct rt_device_pwm loongson_pwm = {
121+
struct rt_device_pwm loongson_pwm =
122+
{
119123
.ops = &loongson_pwm_ops,
120124
};
121125

122126
int loongson_pwm_init(void)
123127
{
124128
int rc = RT_EOK;
125-
static rt_uint32_t *priv[] = {
129+
static rt_uint32_t *priv[] =
130+
{
126131
(void *)PWM0_BASE,
127132
(void *)PWM1_BASE,
128133
(void *)PWM2_BASE,

bsp/ls2kdev/drivers/drv_rtc.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
#ifdef RT_USING_RTC
2121

22-
struct loongson_rtc {
22+
struct loongson_rtc
23+
{
2324
rt_uint32_t sys_toytrim;
2425
rt_uint32_t sys_toywrite0;
2526
rt_uint32_t sys_toywrite1;
@@ -45,7 +46,8 @@ struct loongson_rtc {
4546
#define __BF(number, n, m) __RBF((number>>m), (n-m+1))
4647
#define BF(number, n, m) (m<n ? __BF(number, n, m) : __BF(number, m, n))
4748

48-
struct rtctime {
49+
struct rtctime
50+
{
4951
rt_uint32_t sys_toyread0;
5052
rt_uint32_t sys_toyread1;
5153
rt_uint32_t sys_rtcread0;
@@ -106,7 +108,7 @@ static rt_err_t rt_rtc_open(rt_device_t dev, rt_uint16_t oflag)
106108
return RT_EOK;
107109
}
108110

109-
static rt_size_t rt_rtc_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
111+
static rt_size_t rt_rtc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
110112
{
111113
return 0;
112114
}
@@ -133,7 +135,8 @@ static rt_err_t rt_rtc_ioctl(rt_device_t dev, int cmd, void *args)
133135
rtctm.sys_rtcread0 = hw_rtc->sys_rtcread0;
134136
tmptime = *localrtctime(&rtctm);
135137

136-
switch (cmd) {
138+
switch (cmd)
139+
{
137140
case RT_DEVICE_CTRL_RTC_GET_TIME:
138141
*t = mktime(&tmptime);
139142
break;
@@ -164,7 +167,8 @@ static rt_err_t rt_rtc_ioctl(rt_device_t dev, int cmd, void *args)
164167

165168
int rt_hw_rtc_init(void)
166169
{
167-
static struct rt_device rtc = {
170+
static struct rt_device rtc =
171+
{
168172
.type = RT_Device_Class_RTC,
169173
.init = RT_NULL,
170174
.open = rt_rtc_open,

0 commit comments

Comments
 (0)