-
Notifications
You must be signed in to change notification settings - Fork 17.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP_HAL_ChibiOS: raise internal error on FPE
- Loading branch information
1 parent
417d37f
commit 0ebef0b
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
FPE detection support | ||
*/ | ||
|
||
#include "hal.h" | ||
#include "fpe.h" | ||
|
||
uint32_t stm32_fpe_flags(void) | ||
{ | ||
// Flush to zero (IDC) | ||
// Inexact result (IXC) | ||
// Underflow (UFC) | ||
// Overflow (OFC) | ||
// Division by zero (DZC) | ||
// Invalid operation (IOC) | ||
|
||
// see page 14/31: | ||
const uint32_t IOC = 1U << 0; | ||
const uint32_t DZC = 1U << 1; | ||
const uint32_t OFC = 1U << 2; | ||
// const uint32_t UFC = 1U << 3; | ||
// const uint32_t IXC = 1U << 4; | ||
const uint32_t IDC = 1U << 7; | ||
|
||
return __get_FPSCR() & (IOC|DZC|OFC|IDC); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
uint32_t stm32_fpe_flags(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |