driver-cpu.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright 2011-2013 Luke Dashjr
  3. * Copyright 2011-2012 Con Kolivas
  4. * Copyright 2011 Mark Crichton
  5. * Copyright 2010 Jeff Garzik
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 3 of the License, or (at your option)
  10. * any later version. See COPYING for more details.
  11. */
  12. #ifndef BFG_DRIVER_CPU_H
  13. #define BFG_DRIVER_CPU_H
  14. #include "miner.h"
  15. #include "config.h"
  16. #include <stdbool.h>
  17. #ifndef OPT_SHOW_LEN
  18. #define OPT_SHOW_LEN 80
  19. #endif
  20. #ifdef USE_SHA256D
  21. #if defined(__i386__) && defined(HAVE_SSE2)
  22. #define WANT_SSE2_4WAY 1
  23. #endif
  24. #ifdef __ALTIVEC__
  25. #define WANT_ALTIVEC_4WAY 1
  26. #endif
  27. #if defined(__i386__) && defined(HAVE_YASM) && defined(HAVE_SSE2)
  28. #define WANT_X8632_SSE2 1
  29. #endif
  30. #ifdef __i386__
  31. #define WANT_VIA_PADLOCK 1
  32. #endif
  33. #if defined(__x86_64__) && defined(HAVE_YASM)
  34. #define WANT_X8664_SSE2 1
  35. #endif
  36. #if defined(__x86_64__) && defined(HAVE_YASM)
  37. #define WANT_X8664_SSE4 1
  38. #endif
  39. #endif /* USE_SHA256D */
  40. #ifdef USE_SCRYPT
  41. #define WANT_SCRYPT
  42. #endif
  43. enum sha256_algos {
  44. #ifdef USE_SHA256D
  45. ALGO_C, /* plain C */
  46. ALGO_4WAY, /* parallel SSE2 */
  47. ALGO_VIA, /* VIA padlock */
  48. ALGO_CRYPTOPP, /* Crypto++ (C) */
  49. ALGO_CRYPTOPP_ASM32, /* Crypto++ 32-bit assembly */
  50. ALGO_SSE2_32, /* SSE2 for x86_32 */
  51. ALGO_SSE2_64, /* SSE2 for x86_64 */
  52. ALGO_SSE4_64, /* SSE4 for x86_64 */
  53. ALGO_ALTIVEC_4WAY, /* parallel Altivec */
  54. #endif
  55. #ifdef USE_SCRYPT
  56. ALGO_SCRYPT, /* scrypt */
  57. #endif
  58. #ifdef USE_SHA256D
  59. ALGO_FASTAUTO, /* fast autodetect */
  60. ALGO_AUTO, /* autodetect */
  61. #endif
  62. CUSTOM_CPU_MINING_ALGOS_COUNT,
  63. };
  64. extern const char *algo_names[];
  65. extern struct device_drv cpu_drv;
  66. extern const uint32_t hash1_init[];
  67. extern char *set_algo(const char *arg, enum sha256_algos *algo);
  68. extern void show_algo(char buf[OPT_SHOW_LEN], const enum sha256_algos *algo);
  69. extern char *force_nthreads_int(const char *arg, int *i);
  70. extern void init_max_name_len();
  71. extern double bench_algo_stage3(enum sha256_algos algo);
  72. extern void set_scrypt_algo(enum sha256_algos *algo);
  73. #endif /* __DEVICE_CPU_H__ */