driver-cpu.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 __DEVICE_CPU_H__
  13. #define __DEVICE_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. #if defined(__i386__) && defined(HAVE_SSE2)
  21. #define WANT_SSE2_4WAY 1
  22. #endif
  23. #ifdef __ALTIVEC__
  24. #define WANT_ALTIVEC_4WAY 1
  25. #endif
  26. #if defined(__i386__) && defined(HAVE_YASM) && defined(HAVE_SSE2)
  27. #define WANT_X8632_SSE2 1
  28. #endif
  29. #ifdef __i386__
  30. #define WANT_VIA_PADLOCK 1
  31. #endif
  32. #if defined(__x86_64__) && defined(HAVE_YASM)
  33. #define WANT_X8664_SSE2 1
  34. #endif
  35. #if defined(__x86_64__) && defined(HAVE_YASM)
  36. #define WANT_X8664_SSE4 1
  37. #endif
  38. #ifdef USE_SCRYPT
  39. #define WANT_SCRYPT
  40. #endif
  41. enum sha256_algos {
  42. ALGO_C, /* plain C */
  43. ALGO_4WAY, /* parallel SSE2 */
  44. ALGO_VIA, /* VIA padlock */
  45. ALGO_CRYPTOPP, /* Crypto++ (C) */
  46. ALGO_CRYPTOPP_ASM32, /* Crypto++ 32-bit assembly */
  47. ALGO_SSE2_32, /* SSE2 for x86_32 */
  48. ALGO_SSE2_64, /* SSE2 for x86_64 */
  49. ALGO_SSE4_64, /* SSE4 for x86_64 */
  50. ALGO_ALTIVEC_4WAY, /* parallel Altivec */
  51. ALGO_PRIME,
  52. ALGO_SCRYPT, /* scrypt */
  53. ALGO_FASTAUTO, /* fast autodetect */
  54. ALGO_AUTO /* autodetect */
  55. };
  56. extern const char *algo_names[];
  57. extern bool opt_usecpu;
  58. extern struct device_drv cpu_drv;
  59. extern char *set_algo(const char *arg, enum sha256_algos *algo);
  60. extern void show_algo(char buf[OPT_SHOW_LEN], const enum sha256_algos *algo);
  61. extern char *force_nthreads_int(const char *arg, int *i);
  62. extern void init_max_name_len();
  63. extern double bench_algo_stage3(enum sha256_algos algo);
  64. extern void set_scrypt_algo(enum sha256_algos *algo);
  65. #endif /* __DEVICE_CPU_H__ */