MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / TimedSqrt

Function TimedSqrt

src/Platform/Platform.cpp:1482–1495  ·  view source on GitHub ↗

Execute a timed square root that takes less than one millisecond

Source from the content-addressed store, hash-verified

1480
1481// Execute a timed square root that takes less than one millisecond
1482static 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
1497GCodeResult Platform::PrintTestReport(GCodeBuffer& gb, const StringRef& reply, OutputBuffer *_ecv_null & buf) const THROWS(GCodeException)
1498{

Callers 1

Platform.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected