1235537Sgber/*-
2235537Sgber * Copyright (c) 2010-2012 Semihalf.
3235537Sgber * All rights reserved.
4235537Sgber *
5235537Sgber * Redistribution and use in source and binary forms, with or without
6235537Sgber * modification, are permitted provided that the following conditions
7235537Sgber * are met:
8235537Sgber * 1. Redistributions of source code must retain the above copyright
9235537Sgber *    notice, this list of conditions and the following disclaimer.
10235537Sgber * 2. Redistributions in binary form must reproduce the above copyright
11235537Sgber *    notice, this list of conditions and the following disclaimer in the
12235537Sgber *    documentation and/or other materials provided with the distribution.
13235537Sgber *
14235537Sgber * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15235537Sgber * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16235537Sgber * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17235537Sgber * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18235537Sgber * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19235537Sgber * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20235537Sgber * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21235537Sgber * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22235537Sgber * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23235537Sgber * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24235537Sgber * SUCH DAMAGE.
25235537Sgber *
26235537Sgber * $FreeBSD$
27235537Sgber */
28235537Sgber
29235537Sgber#ifndef	__UTILS_H
30235537Sgber#define	__UTILS_H
31235537Sgber
32235537Sgberstruct cmd_param
33235537Sgber{
34235537Sgber	char	name[64];
35235537Sgber	char	value[64];
36235537Sgber};
37235537Sgber
38235537Sgberchar *param_get_string(struct cmd_param *, const char *);
39235537Sgberint param_get_int(struct cmd_param *, const char *);
40235537Sgberint param_get_intx(struct cmd_param *, const char *);
41235537Sgberint param_get_boolean(struct cmd_param *, const char *);
42235537Sgberint param_has_value(struct cmd_param *, const char *);
43235537Sgberint param_get_count(struct cmd_param *);
44235537Sgbervoid perrorf(const char *, ...);
45235537Sgbervoid hexdumpoffset(uint8_t *, int, int);
46235537Sgbervoid hexdump(uint8_t *, int);
47235537Sgbervoid *xmalloc(size_t);
48235537Sgber
49235537Sgber/* Command handlers */
50235537Sgberint nand_read(struct cmd_param *);
51235537Sgberint nand_write(struct cmd_param *);
52235537Sgberint nand_read_oob(struct cmd_param *);
53235537Sgberint nand_write_oob(struct cmd_param *);
54235537Sgberint nand_erase(struct cmd_param *);
55235537Sgberint nand_info(struct cmd_param *);
56235537Sgber
57235537Sgber#endif	/* __UTILS_H */
58