FreeCalypso > hg > fc-selenite
comparison src/cs/drivers/drv_app/ffs/board/drv.c @ 72:4484ab3f6ab3
FFS interrupt voodoo: made original TMS470 approach work with gcc
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 20 Jul 2018 03:35:25 +0000 |
parents | 8019491a67a9 |
children | 7d50d8d13711 |
comparison
equal
deleted
inserted
replaced
71:8019491a67a9 | 72:4484ab3f6ab3 |
---|---|
1424 | 1424 |
1425 #if (TARGET == 1) | 1425 #if (TARGET == 1) |
1426 // Note that we use our own interrupt disable/enable function because | 1426 // Note that we use our own interrupt disable/enable function because |
1427 // Nucleus allegedly should have a bug in its implementation for this. | 1427 // Nucleus allegedly should have a bug in its implementation for this. |
1428 | 1428 |
1429 uint32 int_disable(void) | |
1430 { | |
1431 #ifdef __GNUC__ | 1429 #ifdef __GNUC__ |
1432 return NU_Control_Interrupts(0xC0); | 1430 #define NOINLINE __attribute__ ((noinline)) |
1431 #else | |
1432 #define NOINLINE | |
1433 #endif | |
1434 | |
1435 uint32 NOINLINE int_disable(void) | |
1436 { | |
1437 #ifdef __GNUC__ | |
1438 asm(" .code 16"); | |
1433 #else | 1439 #else |
1434 asm(" .state16"); | 1440 asm(" .state16"); |
1441 #endif | |
1435 asm(" mov A1, #0xC0"); | 1442 asm(" mov A1, #0xC0"); |
1436 asm(" ldr A2, tct_disable"); | 1443 asm(" ldr A2, tct_disable"); |
1437 asm(" bx A2 "); | 1444 asm(" bx A2 "); |
1438 | 1445 |
1446 #ifdef __GNUC__ | |
1447 asm(".balign 4"); | |
1448 asm("tct_disable:"); | |
1449 asm(" .word TCT_Control_Interrupts"); | |
1450 #else | |
1439 asm("tct_disable .field _TCT_Control_Interrupts+0,32"); | 1451 asm("tct_disable .field _TCT_Control_Interrupts+0,32"); |
1440 asm(" .global _TCT_Control_Interrupts"); | 1452 asm(" .global _TCT_Control_Interrupts"); |
1441 #endif | 1453 #endif |
1442 } | 1454 } |
1443 | 1455 |
1444 void int_enable(uint32 cpsr) | 1456 void NOINLINE int_enable(uint32 cpsr) |
1445 { | 1457 { |
1446 #ifdef __GNUC__ | 1458 #ifdef __GNUC__ |
1447 return NU_Control_Interrupts(cpsr); | 1459 asm(" .code 16"); |
1448 #else | 1460 #else |
1449 asm(" .state16"); | 1461 asm(" .state16"); |
1462 #endif | |
1450 asm(" ldr A2, tct_enable"); | 1463 asm(" ldr A2, tct_enable"); |
1451 asm(" bx A2 "); | 1464 asm(" bx A2 "); |
1452 | 1465 |
1466 #ifdef __GNUC__ | |
1467 asm(".balign 4"); | |
1468 asm("tct_enable:"); | |
1469 asm(" .word TCT_Control_Interrupts"); | |
1470 #else | |
1453 asm("tct_enable .field _TCT_Control_Interrupts+0,32"); | 1471 asm("tct_enable .field _TCT_Control_Interrupts+0,32"); |
1454 asm(" .global _TCT_Control_Interrupts"); | 1472 asm(" .global _TCT_Control_Interrupts"); |
1455 #endif | 1473 #endif |
1456 } | 1474 } |
1457 | 1475 |