mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-26 17:51:45 +01:00
stratum: move prettyHex and flip32 into utils
This commit is contained in:
parent
d23a106a65
commit
b9858777b0
@ -32,4 +32,6 @@ double le256todouble(const void *target);
|
||||
|
||||
void prettyHex(unsigned char * buf, int len);
|
||||
|
||||
uint32_t flip32(uint32_t val);
|
||||
|
||||
#endif // STRATUM_UTILS_H
|
@ -3,7 +3,6 @@
|
||||
#include <limits.h>
|
||||
#include "mining.h"
|
||||
#include "utils.h"
|
||||
#include "../../main/pretty.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
|
||||
void free_bm_job(bm_job * job)
|
||||
|
@ -265,4 +265,13 @@ void prettyHex(unsigned char * buf, int len) {
|
||||
printf("%02X ", buf[i]);
|
||||
}
|
||||
printf("%02X]\n", buf[len-1]);
|
||||
}
|
||||
|
||||
uint32_t flip32(uint32_t val) {
|
||||
uint32_t ret = 0;
|
||||
ret |= (val & 0xFF) << 24;
|
||||
ret |= (val & 0xFF00) << 8;
|
||||
ret |= (val & 0xFF0000) >> 8;
|
||||
ret |= (val & 0xFF000000) >> 24;
|
||||
return ret;
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
idf_component_register(SRCS
|
||||
"pretty.c"
|
||||
"crc.c"
|
||||
"serial.c"
|
||||
"system.c"
|
||||
@ -18,7 +17,6 @@ idf_component_register(SRCS
|
||||
"serial"
|
||||
"bm1397.c"
|
||||
"crc.c"
|
||||
"pretty.c"
|
||||
"miner.c"
|
||||
"work_queue.c"
|
||||
INCLUDE_DIRS ".")
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "serial.h"
|
||||
#include "pretty.h"
|
||||
#include "bm1397.h"
|
||||
#include "utils.h"
|
||||
#include "crc.h"
|
||||
|
||||
#define SLEEP_TIME 20
|
||||
|
@ -1,27 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "pretty.h"
|
||||
|
||||
void prettyHex(unsigned char * buf, int len) {
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
if ((i > 0) && (buf[i] == 0xAA) && (buf[i+1] == 0x55))
|
||||
printf("\n");
|
||||
printf("%02X ", buf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//flip byte order of a 32 bit integer
|
||||
uint32_t flip32(uint32_t val) {
|
||||
uint32_t ret = 0;
|
||||
ret |= (val & 0xFF) << 24;
|
||||
ret |= (val & 0xFF00) << 8;
|
||||
ret |= (val & 0xFF0000) >> 8;
|
||||
ret |= (val & 0xFF000000) >> 24;
|
||||
return ret;
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
#ifndef PRETTY_H_
|
||||
#define PRETTY_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void prettyHex(unsigned char * buf, int len);
|
||||
uint32_t flip32(uint32_t val);
|
||||
|
||||
#endif // PRETTY_H_
|
@ -9,9 +9,9 @@
|
||||
#include "esp_log.h"
|
||||
#include "soc/uart_struct.h"
|
||||
|
||||
#include "pretty.h"
|
||||
#include "bm1397.h"
|
||||
#include "serial.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define ECHO_TEST_TXD (17)
|
||||
#define ECHO_TEST_RXD (18)
|
||||
|
Loading…
x
Reference in New Issue
Block a user