pcibx_device.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. Catalyst PCIBX32 PCI Extender control utility
  3. Copyright (c) 2006-2009 Michael Buesch <mb@bu3sch.de>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #ifndef PCIBX_DEVICE_H_
  18. #define PCIBX_DEVICE_H_
  19. #include <stdint.h>
  20. #define PCIBX_REG_FIRMREV 0x50
  21. #define PCIBX_REG_BOARDID 0x53
  22. #define PCIBX_REG_GLOBALPWR 0x63
  23. #define PCIBX_REG_UUTVOLT 0x64
  24. #define PCIBX_REG_AUX5V 0x65
  25. #define PCIBX_REG_AUX33V 0x66
  26. #define PCIBX_REG_MEASURE_CTL 0x67
  27. #define PCIBX_REG_MEASURE_CONV 0x68
  28. #define PCIBX_REG_MEASURE_STROBE 0x69
  29. #define PCIBX_REG_MEASURE_DATA0 0x6A
  30. #define PCIBX_REG_MEASURE_DATA1 0x6B
  31. #define PCIBX_REG_PME 0x6F
  32. #define PCIBX_REG_RST_0 0x71
  33. #define PCIBX_REG_RST_1 0x72
  34. #define PCIBX_REG_RST_2 0x73
  35. #define PCIBX_REG_STATUS 0x76
  36. #define PCIBX_REG_CLEARBITSTAT 0x77
  37. #define PCIBX_REG_FREQMEASURE_CTL 0x7B
  38. #define PCIBX_REG_FREQMEASURE_0 0x78
  39. #define PCIBX_REG_FREQMEASURE_1 0x79
  40. #define PCIBX_REG_FREQMEASURE_2 0x7A
  41. #define PCIBX_REG_RAMP 0x7C
  42. #define PCIBX_REGOFFSET_PCI1 0x00
  43. #define PCIBX_REGOFFSET_PCI2 0x80
  44. #define PCIBX_STATUS_RSTDEASS (1 << 0)
  45. #define PCIBX_STATUS_64BIT (1 << 1)
  46. #define PCIBX_STATUS_32BIT (1 << 2)
  47. #define PCIBX_STATUS_MHZ (1 << 3)
  48. #define PCIBX_STATUS_DUTASS (1 << 4)
  49. struct pcibx_device {
  50. const char *port;
  51. int fd;
  52. uint8_t regoffset;
  53. };
  54. enum measure_id {
  55. MEASURE_V25REF = 0x08,
  56. MEASURE_V12UUT = 0x09,
  57. MEASURE_V5UUT = 0x0A,
  58. MEASURE_V33UUT = 0x0B,
  59. MEASURE_V5AUX = 0x0C,
  60. MEASURE_A5 = 0x0D,
  61. MEASURE_A12 = 0x0E,
  62. MEASURE_A33 = 0x0F,
  63. };
  64. int pcibx_device_init(struct pcibx_device *dev,
  65. const char *port,
  66. int is_pci1);
  67. void pcibx_device_exit(struct pcibx_device *dev);
  68. void pcibx_cmd_global_pwr(struct pcibx_device *dev, int on);
  69. void pcibx_cmd_uut_pwr(struct pcibx_device *dev, int on);
  70. uint8_t pcibx_cmd_getboardid(struct pcibx_device *dev);
  71. uint8_t pcibx_cmd_getfirmrev(struct pcibx_device *dev);
  72. uint8_t pcibx_cmd_getstatus(struct pcibx_device *dev);
  73. void pcibx_cmd_clearbitstat(struct pcibx_device *dev);
  74. void pcibx_cmd_aux5(struct pcibx_device *dev, int on);
  75. void pcibx_cmd_aux33(struct pcibx_device *dev, int on);
  76. float pcibx_cmd_sysfreq(struct pcibx_device *dev);
  77. float pcibx_cmd_measure(struct pcibx_device *dev, enum measure_id id);
  78. void pcibx_cmd_ramp(struct pcibx_device *dev, int fast);
  79. void pcibx_cmd_rst(struct pcibx_device *dev, double sec);
  80. void pcibx_cmd_rstdefault(struct pcibx_device *dev);
  81. uint8_t pcibx_cmd_getpme(struct pcibx_device *dev);
  82. #endif /* PCIBX_DEVICE_H_ */