divider.h File Reference
#include "pico.h"
#include "hardware/structs/sio.h"
Include dependency graph for divider.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hw_divider_state_t
 

Typedefs

typedef uint64_t divmod_result_t
 

Functions

static void hw_divider_divmod_s32_start (int32_t a, int32_t b)
 Start a signed asynchronous divideStart a divide of the specified signed parameters. You should wait for 8 cycles (__div_pause()) or wait for the ready bit to be set (hw_divider_wait_ready()) prior to reading the results. More...
 
static void hw_divider_divmod_u32_start (uint32_t a, uint32_t b)
 Start an unsigned asynchronous divideStart a divide of the specified unsigned parameters. You should wait for 8 cycles (__div_pause()) or wait for the ready bit to be set (hw_divider_wait_ready()) prior to reading the results. More...
 
static void hw_divider_wait_ready (void)
 Wait for a divide to completeWait for a divide to complete.
 
static divmod_result_t hw_divider_result_nowait (void)
 Return result of HW divide, nowait. More...
 
static divmod_result_t hw_divider_result_wait (void)
 Return result of last asynchronous HW divideThis function waits for the result to be ready by calling hw_divider_wait_ready(). More...
 
static uint32_t hw_divider_u32_quotient_wait (void)
 Return result of last asynchronous HW divide, unsigned quotient onlyThis function waits for the result to be ready by calling hw_divider_wait_ready(). More...
 
static int32_t hw_divider_s32_quotient_wait (void)
 Return result of last asynchronous HW divide, signed quotient onlyThis function waits for the result to be ready by calling hw_divider_wait_ready(). More...
 
static uint32_t hw_divider_u32_remainder_wait (void)
 Return result of last asynchronous HW divide, unsigned remainder onlyThis function waits for the result to be ready by calling hw_divider_wait_ready(). More...
 
static int32_t hw_divider_s32_remainder_wait (void)
 Return result of last asynchronous HW divide, signed remainder onlyThis function waits for the result to be ready by calling hw_divider_wait_ready(). More...
 
divmod_result_t hw_divider_divmod_s32 (int32_t a, int32_t b)
 Do a signed HW divide and wait for resultDivide a by b, wait for calculation to complete, return result as a fixed point 32p32 value. More...
 
divmod_result_t hw_divider_divmod_u32 (uint32_t a, uint32_t b)
 Do an unsigned HW divide and wait for resultDivide a by b, wait for calculation to complete, return result as a fixed point 32p32 value. More...
 
static uint32_t to_quotient_u32 (divmod_result_t r)
 Efficient extraction of unsigned quotient from 32p32 fixed point. More...
 
static int32_t to_quotient_s32 (divmod_result_t r)
 Efficient extraction of signed quotient from 32p32 fixed point. More...
 
static uint32_t to_remainder_u32 (divmod_result_t r)
 Efficient extraction of unsigned remainder from 32p32 fixed point. More...
 
static int32_t to_remainder_s32 (divmod_result_t r)
 Efficient extraction of signed remainder from 32p32 fixed point. More...
 
static uint32_t hw_divider_u32_quotient (uint32_t a, uint32_t b)
 Do an unsigned HW divide, wait for result, return quotientDivide a by b, wait for calculation to complete, return quotient. More...
 
static uint32_t hw_divider_u32_remainder (uint32_t a, uint32_t b)
 Do an unsigned HW divide, wait for result, return remainderDivide a by b, wait for calculation to complete, return remainder. More...
 
static int32_t hw_divider_quotient_s32 (int32_t a, int32_t b)
 Do a signed HW divide, wait for result, return quotientDivide a by b, wait for calculation to complete, return quotient. More...
 
static int32_t hw_divider_remainder_s32 (int32_t a, int32_t b)
 Do a signed HW divide, wait for result, return remainderDivide a by b, wait for calculation to complete, return remainder. More...
 
static void hw_divider_pause (void)
 Pause for exact amount of time needed for a asynchronous divide to complete.
 
static uint32_t hw_divider_u32_quotient_inlined (uint32_t a, uint32_t b)
 Do a hardware unsigned HW divide, wait for result, return quotientDivide a by b, wait for calculation to complete, return quotient. More...
 
static uint32_t hw_divider_u32_remainder_inlined (uint32_t a, uint32_t b)
 Do a hardware unsigned HW divide, wait for result, return remainderDivide a by b, wait for calculation to complete, return remainder. More...
 
static int32_t hw_divider_s32_quotient_inlined (int32_t a, int32_t b)
 Do a hardware signed HW divide, wait for result, return quotientDivide a by b, wait for calculation to complete, return quotient. More...
 
static int32_t hw_divider_s32_remainder_inlined (int32_t a, int32_t b)
 Do a hardware signed HW divide, wait for result, return remainderDivide a by b, wait for calculation to complete, return remainder. More...
 
void hw_divider_save_state (hw_divider_state_t *dest)
 Save the calling cores hardware divider stateCopy the current core's hardware divider state into the provided structure. This method waits for the divider results to be stable, then copies them to memory. They can be restored via hw_divider_restore_state() More...
 
void hw_divider_restore_state (hw_divider_state_t *src)
 Load a saved hardware divider state into the current core's hardware dividerCopy the passed hardware divider state into the hardware divider. More...