annotate cons.h @ 51:cb184206344d

Rejig command parsing and assume the compiler isn't dumb (eg it can reuse stack variables).
author darius@Inchoate
date Wed, 29 Oct 2008 16:09:55 +1030
parents 5898fba6593c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
1 /*
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
2 * Console code headers
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
3 *
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
4 * Copyright (c) 2008
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
5 * Daniel O'Connor <darius@dons.net.au>. All rights reserved.
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
6 *
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
7 * Redistribution and use in source and binary forms, with or without
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
8 * modification, are permitted provided that the following conditions
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
9 * are met:
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
10 * 1. Redistributions of source code must retain the above copyright
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
11 * notice, this list of conditions and the following disclaimer.
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
15 *
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
26 * SUCH DAMAGE.
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
27 */
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
28
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
29 typedef volatile struct {
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
30 char buf[40];
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
31 uint8_t state;
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
32 uint8_t len;
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
33 } consbuf_t;
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
34
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
35 extern consbuf_t cmd;
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
36
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
37 void cons_init(void);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
38 void cons_putsP(const char *addr);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
39 void cons_puts(const char *addr);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
40 int cons_putc(char c);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
41 void cons_puts_dec(uint8_t a, uint8_t l);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
42 void cons_puts_hex(uint8_t a);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
43 char cons_getc(void);
5898fba6593c Add temperature control.
darius@inchoate.localdomain
parents:
diff changeset
44