Execute a timed square root that takes less than one millisecond
| 1480 | |
| 1481 | // Execute a timed square root that takes less than one millisecond |
| 1482 | static uint32_t TimedSqrt(uint64_t arg, uint32_t& timeAcc) noexcept |
| 1483 | { |
| 1484 | IrqDisable(); |
| 1485 | asm volatile("":::"memory"); |
| 1486 | uint32_t now1 = SysTick->VAL; |
| 1487 | const uint32_t ret = isqrt64(arg); |
| 1488 | uint32_t now2 = SysTick->VAL; |
| 1489 | asm volatile("":::"memory"); |
| 1490 | IrqEnable(); |
| 1491 | now1 &= 0x00FFFFFF; |
| 1492 | now2 &= 0x00FFFFFF; |
| 1493 | timeAcc += ((now1 > now2) ? now1 : now1 + (SysTick->LOAD & 0x00FFFFFF) + 1) - now2; |
| 1494 | return ret; |
| 1495 | } |
| 1496 | |
| 1497 | GCodeResult Platform::PrintTestReport(GCodeBuffer& gb, const StringRef& reply, OutputBuffer *_ecv_null & buf) const THROWS(GCodeException) |
| 1498 | { |