Files
adammwest f130b05511 ASIC version mask now based on pool stratum version mask msg (#349)
* make set version mask a function call

* update name

* update init fuc to support version mask setting

* update parameter spec for bm1397

* parametrize set version rolling and update init func for BM136X +

* add default stratum mask

* update all bmchips with a new set_version_mask ASIC function which can be called in main

* update init func prototype params

* update self test to remove extra vmask call in init

* fix compiler errors

* fix compiler errors in main

* add version_mask_given bool to tell the next job to set a new version mask to the chip when a smg comes in
2024-09-26 11:30:06 -04:00

39 lines
1.1 KiB
C

#ifndef STRATUM_UTILS_H
#define STRATUM_UTILS_H
#include <stddef.h>
#include <stdint.h>
int hex2char(uint8_t x, char *c);
size_t bin2hex(const uint8_t *buf, size_t buflen, char *hex, size_t hexlen);
uint8_t hex2val(char c);
void flip80bytes(void *dest_p, const void *src_p);
void flip32bytes(void *dest_p, const void *src_p);
size_t hex2bin(const char *hex, uint8_t *bin, size_t bin_len);
void print_hex(const uint8_t *b, size_t len,
const size_t in_line, const char *prefix);
char *double_sha256(const char *hex_string);
uint8_t *double_sha256_bin(const uint8_t *data, const size_t data_len);
void single_sha256_bin(const uint8_t *data, const size_t data_len, uint8_t *dest);
void midstate_sha256_bin(const uint8_t *data, const size_t data_len, uint8_t *dest);
void swap_endian_words(const char *hex, uint8_t *output);
void reverse_bytes(uint8_t *data, size_t len);
double le256todouble(const void *target);
void prettyHex(unsigned char *buf, int len);
uint32_t flip32(uint32_t val);
#define STRATUM_DEFAULT_VERSION_MASK 0x1fffe000
#endif // STRATUM_UTILS_H