mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-11-19 18:37:20 +01:00
* Accept and store float frequency values * Unify PLL resolver for 1366/1368/1370 Pick the closest frequency to the requested target. If there are multiple PLL settings, pick the one with first the lowest VDO frequency, and finally the lowest posdividers. Merged frequency ramp start and loop. This solves overshooting when requesting a target frequency within the current step size. It also eliminates the duplicate setting of the target frequency is that's on a step boundary. Cleaned up several unused defines. * Restore postdiv2 < postdiv1 condition for BM1368 and BM1370 * Whitespace * Clean up intermediate functions Simplify frequency_transition further, finally fix overshoot * Code cleanup * Add debug logging for BM1397 * Fix log * Flip postdiv condition for readability * Add test * Fix BM1370 fb_range * EOF line in test_pll.c
31 lines
996 B
C
31 lines
996 B
C
#ifndef FREQUENCY_TRANSITION_H
|
|
#define FREQUENCY_TRANSITION_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
extern const char *FREQUENCY_TRANSITION_TAG;
|
|
|
|
/**
|
|
* @brief Function pointer type for ASIC hash frequency setting functions
|
|
*
|
|
* This type defines the signature for functions that set the hash frequency
|
|
* for different ASIC types.
|
|
*
|
|
* @param frequency The frequency to set in MHz
|
|
*/
|
|
typedef void (*set_hash_frequency_fn)(float frequency);
|
|
|
|
/**
|
|
* @brief Transition the ASIC frequency to a target value
|
|
*
|
|
* This function gradually adjusts the ASIC frequency to reach the target value,
|
|
* stepping up or down in increments to ensure stability.
|
|
*
|
|
* @param target_frequency The target frequency in MHz
|
|
* @param set_frequency_fn Function pointer to the appropriate ASIC's set_hash_frequency function
|
|
* @param asic_type The type of ASIC chip (for logging purposes only)
|
|
*/
|
|
void do_frequency_transition(float target_frequency, set_hash_frequency_fn set_frequency_fn);
|
|
|
|
#endif // FREQUENCY_TRANSITION_H
|