miner.h 1.1 KB

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