ee_dev.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* By Thomas.Lange@Corelatus.com 001025 */
  2. /* Definitions for EEPROM/VOLT METER DS2438 */
  3. /* Copyright (C) 2000-2005 Corelatus AB */
  4. /* This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  17. * MA 02111-1307 USA
  18. */
  19. #ifndef INCeedevh
  20. #define INCeedevh
  21. #define E_DEBUG(fmt,args...) if( Debug ) printk(KERN_DEBUG"EE: " fmt, ##args)
  22. /* MIPS */
  23. #define WRITE_PORT(Value) write_gpio_data(Value)
  24. #define READ_PORT (gpio_read()&GPIO_EEDQ)
  25. /* 64 bytes chip */
  26. #define EE_CHIP_SIZE 64
  27. /* Board with new current resistor */
  28. #define EE_GTH_0304 1
  29. /* new dsp and 64 MB SDRAM */
  30. #define EE_DSP_64 0x10
  31. /* microsecs */
  32. /* Pull line down at least this long for reset pulse */
  33. #define RESET_LOW_TIME 490
  34. /* Read presence pulse after we release reset pulse */
  35. #define PRESENCE_TIMEOUT 100
  36. #define PRESENCE_LOW_TIME 200
  37. #define WRITE_0_LOW 60
  38. #define WRITE_1_LOW 1
  39. #define TOTAL_WRITE_LOW 60
  40. #define READ_LOW 1
  41. #define READ_TIMEOUT 10
  42. #define TOTAL_READ_LOW 70
  43. /* Rom function commands */
  44. #define READ_ROM 0x33
  45. #define MATCH_ROM 0x55
  46. #define SKIP_ROM 0xCC
  47. #define SEARCH_ROM 0xF0
  48. /* Memory_command_function */
  49. #define WRITE_SCRATCHPAD 0x4E
  50. #define READ_SCRATCHPAD 0xBE
  51. #define COPY_SCRATCHPAD 0x48
  52. #define RECALL_MEMORY 0xB8
  53. #define CONVERT_TEMP 0x44
  54. #define CONVERT_VOLTAGE 0xB4
  55. /* Chip is divided in 8 pages, 8 bytes each */
  56. #define EE_PAGE_SIZE 8
  57. /* All chip data we want are in page 0 */
  58. /* Bytes in page 0 */
  59. #define EE_P0_STATUS 0
  60. #define EE_P0_TEMP_LSB 1
  61. #define EE_P0_TEMP_MSB 2
  62. #define EE_P0_VOLT_LSB 3
  63. #define EE_P0_VOLT_MSB 4
  64. #define EE_P0_CURRENT_LSB 5
  65. #define EE_P0_CURRENT_MSB 6
  66. /* 40 byte user data is located at page 3-7 */
  67. #define EE_USER_PAGE_0 3
  68. #define USER_PAGES 5
  69. /* Layout of gth user pages usage */
  70. /* Bytes 0-16 ethernet addr in ascii ( len 17 ) */
  71. #define EE_ETHERNET_OFFSET 0
  72. #endif /* INCeedevh */