- refactored interrupt en/dis
- enable mips-debugger in App git-svn-id: http://moon:8086/svn/mips@132 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
+3
-1
@@ -2,10 +2,12 @@
|
|||||||
# BOARD = {ml402, denano}
|
# BOARD = {ml402, denano}
|
||||||
# TLB = {no, yes}
|
# TLB = {no, yes}
|
||||||
# ENDIANESS = {eb, el}
|
# ENDIANESS = {eb, el}
|
||||||
|
# DEBUGGER = {gdb, mips, rom}
|
||||||
|
|
||||||
BOARD ?= ml402
|
BOARD ?= ml402
|
||||||
TLB ?= no
|
TLB ?= no
|
||||||
ENDIANESS ?= eb
|
ENDIANESS ?= eb
|
||||||
DEBUGGER ?= rom
|
DEBUGGER ?= mips
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(ENDIANESS),el)
|
ifeq ($(ENDIANESS),el)
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void board_init(void)
|
|||||||
|
|
||||||
// Setup interrupt support
|
// Setup interrupt support
|
||||||
interrupt_init();
|
interrupt_init();
|
||||||
interrupt_enable_all();
|
interrupt_global_enable();
|
||||||
|
|
||||||
// Do some initializations here
|
// Do some initializations here
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void board_init(void)
|
|||||||
|
|
||||||
// Setup interrupt support
|
// Setup interrupt support
|
||||||
interrupt_init();
|
interrupt_init();
|
||||||
interrupt_enable_all();
|
interrupt_global_enable();
|
||||||
|
|
||||||
// Do some initializations here
|
// Do some initializations here
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -59,13 +59,13 @@ void interrupt_disable(int irq_num)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void interrupt_enable_all()
|
void interrupt_global_enable()
|
||||||
{
|
{
|
||||||
uint32_t reg = CP0_SR_read() | SR_MASK_IEC;
|
uint32_t reg = CP0_SR_read() | SR_MASK_IEC;
|
||||||
CP0_SR_write(reg);
|
CP0_SR_write(reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void interrupt_disable_all()
|
void interrupt_global_disable()
|
||||||
{
|
{
|
||||||
uint32_t reg = CP0_SR_read() & ~SR_MASK_IEC;
|
uint32_t reg = CP0_SR_read() & ~SR_MASK_IEC;
|
||||||
CP0_SR_write(reg);
|
CP0_SR_write(reg);
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ int _irq_dispatch(struct xcptcontext * xcp);
|
|||||||
void interrupt_register(int irq_num, fp_irq_t fp);
|
void interrupt_register(int irq_num, fp_irq_t fp);
|
||||||
void interrupt_enable(int irq_num);
|
void interrupt_enable(int irq_num);
|
||||||
void interrupt_disable(int irq_num);
|
void interrupt_disable(int irq_num);
|
||||||
void interrupt_enable_all();
|
void interrupt_global_enable();
|
||||||
void interrupt_disable_all();
|
void interrupt_global_disable();
|
||||||
|
|
||||||
#endif // IRQ_H
|
#endif // IRQ_H
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ void enter_critical()
|
|||||||
{
|
{
|
||||||
if (critical_nesting_counter == 0)
|
if (critical_nesting_counter == 0)
|
||||||
{
|
{
|
||||||
interrupt_disable_all();
|
interrupt_global_disable();
|
||||||
}
|
}
|
||||||
critical_nesting_counter++;
|
critical_nesting_counter++;
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ void exit_critical()
|
|||||||
critical_nesting_counter--;
|
critical_nesting_counter--;
|
||||||
if (critical_nesting_counter == 0)
|
if (critical_nesting_counter == 0)
|
||||||
{
|
{
|
||||||
interrupt_enable_all();
|
interrupt_global_enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-6
@@ -245,6 +245,7 @@ int Test10_LoadStore()
|
|||||||
// sputs("buf = ");
|
// sputs("buf = ");
|
||||||
// print_word((int)buf);
|
// print_word((int)buf);
|
||||||
// sputs("\n");
|
// sputs("\n");
|
||||||
|
interrupt_global_disable();
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
@@ -357,6 +358,8 @@ int Test10_LoadStore()
|
|||||||
err = NO_ERROR;
|
err = NO_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
interrupt_global_enable();
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
if (IS_ERROR(err))
|
if (IS_ERROR(err))
|
||||||
@@ -838,20 +841,26 @@ uint32_t test_Icache()
|
|||||||
uint32_t *pInstr = malloc(sizeof(test_icache_instr));
|
uint32_t *pInstr = malloc(sizeof(test_icache_instr));
|
||||||
memcpy(pInstr, test_icache_instr, sizeof(test_icache_instr));
|
memcpy(pInstr, test_icache_instr, sizeof(test_icache_instr));
|
||||||
func_t pF = (func_t)pInstr;
|
func_t pF = (func_t)pInstr;
|
||||||
|
uint32_t v1;
|
||||||
|
uint32_t v2;
|
||||||
|
uint32_t v3;
|
||||||
|
|
||||||
uint32_t v = pF();
|
interrupt_global_disable();
|
||||||
printf("v = %u\n", (unsigned)v);
|
v1 = pF();
|
||||||
|
|
||||||
pInstr[4] = 0x24100002;
|
pInstr[4] = 0x24100002;
|
||||||
v = pF();
|
v2 = pF();
|
||||||
printf("v = %u\n", (unsigned)v);
|
|
||||||
|
|
||||||
ICACHE_invalidate_at(&pInstr[4]);
|
ICACHE_invalidate_at(&pInstr[4]);
|
||||||
v = pF();
|
v3 = pF();
|
||||||
printf("v = %u\n", (unsigned)v);
|
interrupt_global_enable();
|
||||||
|
|
||||||
free(pF);
|
free(pF);
|
||||||
|
|
||||||
|
printf("v1 = %u\n", (unsigned)v1);
|
||||||
|
printf("v2 = %u\n", (unsigned)v2);
|
||||||
|
printf("v3 = %u\n", (unsigned)v3);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user