]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/cmd_i2c.h
* Patches by Robert Schwebel, 26 Jun 2003:
[people/ms/u-boot.git] / include / cmd_i2c.h
CommitLineData
78f6622a
WD
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/*
25 * I2C Functions
26 */
27#ifndef _CMD_I2C_H
28#define _CMD_I2C_H
29
30#if (CONFIG_COMMANDS & CFG_CMD_I2C)
31#define CMD_TBL_IMD MK_CMD_TBL_ENTRY( \
32 "imd", 3, 4, 1, do_i2c_md, \
33 "imd - i2c memory display\n", \
34 "chip address[.0, .1, .2] [# of objects]\n - i2c memory display\n" \
35),
36#define CMD_TBL_IMM MK_CMD_TBL_ENTRY( \
37 "imm", 3, 3, 1, do_i2c_mm, \
38 "imm - i2c memory modify (auto-incrementing)\n", \
39 "chip address[.0, .1, .2]\n" \
40 " - memory modify, auto increment address\n" \
41),
42#define CMD_TBL_INM MK_CMD_TBL_ENTRY( \
43 "inm", 3, 3, 1, do_i2c_nm, \
44 "inm - memory modify (constant address)\n", \
45 "chip address[.0, .1, .2]\n - memory modify, read and keep address\n" \
46),
47#define CMD_TBL_IMW MK_CMD_TBL_ENTRY( \
48 "imw", 3, 5, 1, do_i2c_mw, \
49 "imw - memory write (fill)\n", \
50 "chip address[.0, .1, .2] value [count]\n - memory write (fill)\n" \
51),
52#define CMD_TBL_ICRC MK_CMD_TBL_ENTRY( \
53 "icrc32", 4, 5, 1, do_i2c_crc, \
54 "icrc32 - checksum calculation\n", \
55 "chip address[.0, .1, .2] count\n - compute CRC32 checksum\n" \
56),
57#define CMD_TBL_IPROBE MK_CMD_TBL_ENTRY( \
58 "iprobe", 3, 1, 1, do_i2c_probe, \
59 "iprobe - probe to discover valid I2C chip addresses\n", \
60 "\n -discover valid I2C chip addresses\n" \
61),
62/*
63 * Require full name for "iloop" because it is an infinite loop!
64 */
65#define CMD_TBL_ILOOP MK_CMD_TBL_ENTRY( \
66 "iloop", 5, 5, 1, do_i2c_loop, \
67 "iloop - infinite loop on address range\n", \
68 "chip address[.0, .1, .2] [# of objects]\n" \
69 " - loop, reading a set of addresses\n" \
70),
71#if (CONFIG_COMMANDS & CFG_CMD_SDRAM)
72#define CMD_TBL_ISDRAM MK_CMD_TBL_ENTRY( \
73 "isdram", 6, 2, 1, do_sdram, \
74 "isdram - print SDRAM configuration information\n", \
75 "chip\n - print SDRAM configuration information\n" \
76 " (valid chip values 50..57)\n" \
77),
78#else
79#define CMD_TBL_ISDRAM
80#endif
81
82
83int do_i2c_md(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
84int do_i2c_mm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
85int do_i2c_nm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
86int do_i2c_mw(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
87int do_i2c_crc(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
88int do_i2c_probe(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
89int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
90int do_sdram(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
91
92#else
93#define CMD_TBL_IMD
94#define CMD_TBL_IMM
95#define CMD_TBL_INM
96#define CMD_TBL_IMW
97#define CMD_TBL_ICRC
98#define CMD_TBL_IPROBE
99#define CMD_TBL_ILOOP
100#define CMD_TBL_ISDRAM
101#endif /* CFG_CMD_MEMORY */
102
103#endif /* _CMD_I2C_H */