cmd_i2c.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * (C) Copyright 2001
  3. * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * I2C Functions
  25. */
  26. #ifndef _CMD_I2C_H
  27. #define _CMD_I2C_H
  28. #if (CONFIG_COMMANDS & CFG_CMD_I2C)
  29. #define CMD_TBL_IMD MK_CMD_TBL_ENTRY( \
  30. "imd", 3, 4, 1, do_i2c_md, \
  31. "imd - i2c memory display\n", \
  32. "chip address[.0, .1, .2] [# of objects]\n - i2c memory display\n" \
  33. ),
  34. #define CMD_TBL_IMM MK_CMD_TBL_ENTRY( \
  35. "imm", 3, 3, 1, do_i2c_mm, \
  36. "imm - i2c memory modify (auto-incrementing)\n", \
  37. "chip address[.0, .1, .2]\n" \
  38. " - memory modify, auto increment address\n" \
  39. ),
  40. #define CMD_TBL_INM MK_CMD_TBL_ENTRY( \
  41. "inm", 3, 3, 1, do_i2c_nm, \
  42. "inm - memory modify (constant address)\n", \
  43. "chip address[.0, .1, .2]\n - memory modify, read and keep address\n" \
  44. ),
  45. #define CMD_TBL_IMW MK_CMD_TBL_ENTRY( \
  46. "imw", 3, 5, 1, do_i2c_mw, \
  47. "imw - memory write (fill)\n", \
  48. "chip address[.0, .1, .2] value [count]\n - memory write (fill)\n" \
  49. ),
  50. #define CMD_TBL_ICRC MK_CMD_TBL_ENTRY( \
  51. "icrc32", 4, 5, 1, do_i2c_crc, \
  52. "icrc32 - checksum calculation\n", \
  53. "chip address[.0, .1, .2] count\n - compute CRC32 checksum\n" \
  54. ),
  55. #define CMD_TBL_IPROBE MK_CMD_TBL_ENTRY( \
  56. "iprobe", 3, 1, 1, do_i2c_probe, \
  57. "iprobe - probe to discover valid I2C chip addresses\n", \
  58. "\n -discover valid I2C chip addresses\n" \
  59. ),
  60. /*
  61. * Require full name for "iloop" because it is an infinite loop!
  62. */
  63. #define CMD_TBL_ILOOP MK_CMD_TBL_ENTRY( \
  64. "iloop", 5, 5, 1, do_i2c_loop, \
  65. "iloop - infinite loop on address range\n", \
  66. "chip address[.0, .1, .2] [# of objects]\n" \
  67. " - loop, reading a set of addresses\n" \
  68. ),
  69. #if (CONFIG_COMMANDS & CFG_CMD_SDRAM)
  70. #define CMD_TBL_ISDRAM MK_CMD_TBL_ENTRY( \
  71. "isdram", 6, 2, 1, do_sdram, \
  72. "isdram - print SDRAM configuration information\n", \
  73. "chip\n - print SDRAM configuration information\n" \
  74. " (valid chip values 50..57)\n" \
  75. ),
  76. #else
  77. #define CMD_TBL_ISDRAM
  78. #endif
  79. int do_i2c_md(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  80. int do_i2c_mm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  81. int do_i2c_nm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  82. int do_i2c_mw(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  83. int do_i2c_crc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  84. int do_i2c_probe(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  85. int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  86. int do_sdram(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  87. #else
  88. #define CMD_TBL_IMD
  89. #define CMD_TBL_IMM
  90. #define CMD_TBL_INM
  91. #define CMD_TBL_IMW
  92. #define CMD_TBL_ICRC
  93. #define CMD_TBL_IPROBE
  94. #define CMD_TBL_ILOOP
  95. #define CMD_TBL_ISDRAM
  96. #endif /* CFG_CMD_MEMORY */
  97. #endif /* _CMD_I2C_H */