miner.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __MINER_H__
  2. #define __MINER_H__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <sys/time.h>
  6. #include <jansson.h>
  7. #ifdef __SSE2__
  8. #define WANT_SSE2_4WAY 1
  9. #endif
  10. #if defined(__i386__) || defined(__x86_64__)
  11. #define WANT_VIA_PADLOCK 1
  12. #endif
  13. #ifndef ARRAY_SIZE
  14. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  15. #endif
  16. extern bool opt_debug;
  17. extern bool opt_protocol;
  18. extern const uint32_t sha256_init_state[];
  19. extern json_t *json_rpc_call(const char *url, const char *userpass,
  20. const char *rpc_req);
  21. extern char *bin2hex(unsigned char *p, size_t len);
  22. extern bool hex2bin(unsigned char *p, const char *hexstr, size_t len);
  23. extern unsigned int ScanHash_4WaySSE2(const unsigned char *pmidstate,
  24. unsigned char *pdata, unsigned char *phash1, unsigned char *phash,
  25. unsigned long *nHashesDone);
  26. extern bool scanhash_via(const unsigned char *midstate, const unsigned char *data_in,
  27. unsigned char *hash1, unsigned char *hash,
  28. unsigned long *hashes_done);
  29. extern bool scanhash_c(const unsigned char *midstate, unsigned char *data,
  30. unsigned char *hash1, unsigned char *hash,
  31. unsigned long *hashes_done);
  32. extern int
  33. timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y);
  34. #endif /* __MINER_H__ */