Skip to content

Commit 4a2ce8b

Browse files
committed
修改格式
1 parent 341e52d commit 4a2ce8b

File tree

4 files changed

+45
-34
lines changed

4 files changed

+45
-34
lines changed

bsp/ti-tms320c6678/driver/drv_timer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void rt_hw_systick_isr(void)
3535
void rt_hw_system_timer_init(void)
3636
{
3737
// initial system timer interrupt, map local timer interrupt to INT14
38-
gpCGEM_regs->INTMUX3=(CSL_GEM_TINTLN<<CSL_CGEM_INTMUX3_INTSEL14_SHIFT);
38+
gpCGEM_regs->INTMUX3 = (CSL_GEM_TINTLN<<CSL_CGEM_INTMUX3_INTSEL14_SHIFT);
3939
// enable CPU INT14
4040
CPU_interrupt_enable(1<<14);
4141

@@ -55,10 +55,10 @@ void rt_hw_system_timer_start(void)
5555
gpBootCfgRegs->TOUTSEL = (DNUM*2)<<CSL_BOOTCFG_TOUTSEL_TOUTSEL0_SHIFT;
5656

5757
// configure the timer to generate clocks and interrupts
58-
tmrCfg.timer_num=DNUM;
59-
tmrCfg.timerMode=TIMER_PERIODIC_CLOCK;
58+
tmrCfg.timer_num = DNUM;
59+
tmrCfg.timerMode = TIMER_PERIODIC_CLOCK;
6060
tmrCfg.period = (unsigned long long) RT_TICK_PER_SECOND*gDSP_Core_Speed_Hz/6000;
61-
tmrCfg.reload_period=0;
61+
tmrCfg.reload_period = 0;
6262

6363
// initial timer
6464
Timer64_Init(&tmrCfg);

libcpu/ti-dsp/c6x/interrupt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* 2021-11-16 Dystopia the first version
99
*/
1010

11-
1211
#include "interrupt.h"
1312
#include "c66xx.h"
1413
#include "trap.h"
@@ -46,7 +45,9 @@ void rt_hw_interrupt_init(void)
4645
void rt_hw_interrupt_mask(int vector)
4746
{
4847
if (vector < 0 || vector >= MAX_HANDLERS)
48+
{
4949
return;
50+
}
5051
}
5152

5253
/**
@@ -56,7 +57,9 @@ void rt_hw_interrupt_mask(int vector)
5657
void rt_hw_interrupt_umask(int vector)
5758
{
5859
if (vector < 0 || vector >= MAX_HANDLERS)
60+
{
5961
return;
62+
}
6063
}
6164

6265
/**
@@ -90,5 +93,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
9093
void rt_hw_interrupt_clear(int vector)
9194
{
9295
if (vector < 0 || vector >= MAX_HANDLERS)
96+
{
9397
return;
98+
}
9499
}

libcpu/ti-dsp/c6x/trap.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
#include "c66xx.h"
1313

1414
#include <rthw.h>
15-
#include <rtthread.h>
16-
1715
#include <rtdef.h>
16+
#include <rtthread.h>
1817

1918
#define RT_SYS_STACK_SIZE 4096
2019

@@ -136,16 +135,18 @@ static struct rt_exception_info iexcept_table[10] = {
136135
static int process_iexcept(struct rt_hw_exp_stack_register *regs)
137136
{
138137
unsigned int iexcept_report = get_iexcept();
139-
unsigned int iexcept_num;
138+
unsigned int iexcept_num = 0;
140139

141140
ack_exception(EXCEPT_TYPE_IXF);
142141

143-
while(iexcept_report) {
142+
while(iexcept_report)
143+
{
144144
iexcept_num = __ffs(iexcept_report);
145145
iexcept_report &= ~(1 << iexcept_num);
146146
set_iexcept(iexcept_report);
147147

148-
if (*(unsigned int *)regs->pc == BKPT_OPCODE) {
148+
if (*(unsigned int *)regs->pc == BKPT_OPCODE)
149+
{
149150
/* This is a breakpoint */
150151
struct rt_exception_info bkpt_exception = { " - undefined instruction", ABORT_TYPE_UNDDEF, ABORT_BRKPT_ILL };
151152
do_trap(&bkpt_exception, regs);
@@ -300,10 +301,12 @@ static void process_except(struct rt_hw_exp_stack_register *regs)
300301
{
301302
int except_num;
302303
int bank = 0;
303-
int i;
304+
int i = 0;
304305

305-
for (i = 0; i <= 3; i++) {
306-
while (INTC_MEXPMASK[i]) {
306+
for (i = 0; i <= 3; i++)
307+
{
308+
while (INTC_MEXPMASK[i])
309+
{
307310
__dint();
308311
except_num = __ffs(INTC_MEXPMASK[i]);
309312
INTC_MEXPMASK[i] &= ~(1 << except_num); /* ack the external exception */
@@ -317,14 +320,13 @@ static void process_except(struct rt_hw_exp_stack_register *regs)
317320
}
318321

319322
extern void hw_nmi_handler(struct rt_hw_exp_stack_register *regs);
320-
321323
/*
322324
* Main exception processing
323325
*/
324326
int rt_hw_process_exception(struct rt_hw_exp_stack_register *regs)
325327
{
326-
int type;
327-
int type_num;
328+
int type = 0;
329+
int type_num = 0;
328330
int ie_num = 9; /* default is unknown exception */
329331

330332
while ((type = get_except_type()) != 0) {
@@ -334,12 +336,16 @@ int rt_hw_process_exception(struct rt_hw_exp_stack_register *regs)
334336
case EXCEPT_TYPE_NXF: /* NMI exception */
335337
ack_exception(EXCEPT_TYPE_NXF); /* clear exception */
336338
if (hw_nmi_handler != RT_NULL)
339+
{
337340
hw_nmi_handler(regs);
341+
}
338342
break;
339343

340344
case EXCEPT_TYPE_IXF: /* internal exception */
341345
if (process_iexcept(regs))
346+
{
342347
return 1;
348+
}
343349
break;
344350

345351
case EXCEPT_TYPE_EXC: /* external exception */

libcpu/ti-dsp/c6x/trap.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,34 @@
4141

4242
enum SYSTEM_TRAP_CODE
4343
{
44-
ABORT_BUS_ADDRERR = 0, // bus address error
45-
ABORT_BUS_ACCERR, // bus access permission error
46-
ABORT_OPCODE_ILL, // illegal opcode
47-
ABORT_PRVREG_ILL, // privilege register
48-
ABORT_PRVOPC_ILL, // privileged opcode
49-
ABORT_ILLTRP_ILL, // illegal trap
50-
ABORT_BRKPT_ILL, // handling breakpoints
44+
ABORT_BUS_ADDRERR = 0, // bus address error
45+
ABORT_BUS_ACCERR, // bus access permission error
46+
ABORT_OPCODE_ILL, // illegal opcode
47+
ABORT_PRVREG_ILL, // privilege register
48+
ABORT_PRVOPC_ILL, // privileged opcode
49+
ABORT_ILLTRP_ILL, // illegal trap
50+
ABORT_BRKPT_ILL, // handling breakpoints
5151
};
5252

5353
/*
5454
* abort types
5555
*/
56-
#define ABORT_TYPE_BUS 0 // bus access abnormal
57-
#define ABORT_TYPE_MAP 1 // page table mapping error
58-
#define ABORT_TYPE_UNDDEF 0xff // undefined exception
59-
#define ABORT_TYPE_FATAL 0xffffffff // fatal error
56+
#define ABORT_TYPE_BUS 0 // bus access abnormal
57+
#define ABORT_TYPE_MAP 1 // page table mapping error
58+
#define ABORT_TYPE_UNDDEF 0xff // undefined exception
59+
#define ABORT_TYPE_FATAL 0xffffffff // fatal error
6060

6161
struct rt_exception_info {
62-
char *kernel_str;
63-
int type;
64-
int code;
62+
char *kernel_str;
63+
int type;
64+
int code;
6565
};
6666

67-
#define BKPT_OPCODE 0x56454314 /* illegal opcode */
68-
#define INTC_MEXPMASK __SYSREGA(0x018000e0, unsigned int)
67+
#define BKPT_OPCODE 0x56454314 /* illegal opcode */
68+
#define INTC_MEXPMASK __SYSREGA(0x018000e0, unsigned int)
6969

70-
#define __ffs(a) (_lmbd(1, _bitr(a)))
71-
#define __fls(a) (!(a) ? 0 : (32 - _lmbd(1, (a))))
70+
#define __ffs(a) (_lmbd(1, _bitr(a)))
71+
#define __fls(a) (!(a) ? 0 : (32 - _lmbd(1, (a))))
7272

7373
extern void rt_trap_init(void);
7474

0 commit comments

Comments
 (0)