Give water to plants if dry amd pla meanwhile music the music vou can define with note length bind and breake also select several instruments for the sound

Dependencies:   mbed

Committer:
helmut
Date:
Wed Sep 19 14:16:56 2012 +0000
Revision:
0:5150b09127e3
plays mostly music that you can do with notes length breakes and bind; Some already defined; Tool is to start a pump for water to give plant is too dry.; Meanwhie plays music the most part of all

Who changed what in which revision?

UserRevisionLine numberNew contents of line
helmut 0:5150b09127e3 1 /*****************************************************************************
helmut 0:5150b09127e3 2 * ppp_oe.h - PPP Over Ethernet implementation for lwIP.
helmut 0:5150b09127e3 3 *
helmut 0:5150b09127e3 4 * Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc.
helmut 0:5150b09127e3 5 *
helmut 0:5150b09127e3 6 * The authors hereby grant permission to use, copy, modify, distribute,
helmut 0:5150b09127e3 7 * and license this software and its documentation for any purpose, provided
helmut 0:5150b09127e3 8 * that existing copyright notices are retained in all copies and that this
helmut 0:5150b09127e3 9 * notice and the following disclaimer are included verbatim in any
helmut 0:5150b09127e3 10 * distributions. No written agreement, license, or royalty fee is required
helmut 0:5150b09127e3 11 * for any of the authorized uses.
helmut 0:5150b09127e3 12 *
helmut 0:5150b09127e3 13 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
helmut 0:5150b09127e3 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
helmut 0:5150b09127e3 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
helmut 0:5150b09127e3 16 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
helmut 0:5150b09127e3 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
helmut 0:5150b09127e3 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
helmut 0:5150b09127e3 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
helmut 0:5150b09127e3 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
helmut 0:5150b09127e3 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
helmut 0:5150b09127e3 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
helmut 0:5150b09127e3 23 *
helmut 0:5150b09127e3 24 ******************************************************************************
helmut 0:5150b09127e3 25 * REVISION HISTORY
helmut 0:5150b09127e3 26 *
helmut 0:5150b09127e3 27 * 06-01-01 Marc Boucher <marc@mbsi.ca>
helmut 0:5150b09127e3 28 * Ported to lwIP.
helmut 0:5150b09127e3 29 *****************************************************************************/
helmut 0:5150b09127e3 30
helmut 0:5150b09127e3 31
helmut 0:5150b09127e3 32
helmut 0:5150b09127e3 33 /* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */
helmut 0:5150b09127e3 34
helmut 0:5150b09127e3 35 /*-
helmut 0:5150b09127e3 36 * Copyright (c) 2002 The NetBSD Foundation, Inc.
helmut 0:5150b09127e3 37 * All rights reserved.
helmut 0:5150b09127e3 38 *
helmut 0:5150b09127e3 39 * This code is derived from software contributed to The NetBSD Foundation
helmut 0:5150b09127e3 40 * by Martin Husemann <martin@NetBSD.org>.
helmut 0:5150b09127e3 41 *
helmut 0:5150b09127e3 42 * Redistribution and use in source and binary forms, with or without
helmut 0:5150b09127e3 43 * modification, are permitted provided that the following conditions
helmut 0:5150b09127e3 44 * are met:
helmut 0:5150b09127e3 45 * 1. Redistributions of source code must retain the above copyright
helmut 0:5150b09127e3 46 * notice, this list of conditions and the following disclaimer.
helmut 0:5150b09127e3 47 * 2. Redistributions in binary form must reproduce the above copyright
helmut 0:5150b09127e3 48 * notice, this list of conditions and the following disclaimer in the
helmut 0:5150b09127e3 49 * documentation and/or other materials provided with the distribution.
helmut 0:5150b09127e3 50 * 3. All advertising materials mentioning features or use of this software
helmut 0:5150b09127e3 51 * must display the following acknowledgement:
helmut 0:5150b09127e3 52 * This product includes software developed by the NetBSD
helmut 0:5150b09127e3 53 * Foundation, Inc. and its contributors.
helmut 0:5150b09127e3 54 * 4. Neither the name of The NetBSD Foundation nor the names of its
helmut 0:5150b09127e3 55 * contributors may be used to endorse or promote products derived
helmut 0:5150b09127e3 56 * from this software without specific prior written permission.
helmut 0:5150b09127e3 57 *
helmut 0:5150b09127e3 58 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
helmut 0:5150b09127e3 59 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
helmut 0:5150b09127e3 60 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
helmut 0:5150b09127e3 61 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
helmut 0:5150b09127e3 62 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
helmut 0:5150b09127e3 63 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
helmut 0:5150b09127e3 64 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
helmut 0:5150b09127e3 65 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
helmut 0:5150b09127e3 66 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
helmut 0:5150b09127e3 67 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
helmut 0:5150b09127e3 68 * POSSIBILITY OF SUCH DAMAGE.
helmut 0:5150b09127e3 69 */
helmut 0:5150b09127e3 70 #ifndef PPP_OE_H
helmut 0:5150b09127e3 71 #define PPP_OE_H
helmut 0:5150b09127e3 72
helmut 0:5150b09127e3 73 #include "lwip/opt.h"
helmut 0:5150b09127e3 74
helmut 0:5150b09127e3 75 #if PPPOE_SUPPORT > 0
helmut 0:5150b09127e3 76
helmut 0:5150b09127e3 77 #include "netif/etharp.h"
helmut 0:5150b09127e3 78
helmut 0:5150b09127e3 79 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 80 # include "arch/bpstruct.h"
helmut 0:5150b09127e3 81 #endif
helmut 0:5150b09127e3 82 PACK_STRUCT_BEGIN
helmut 0:5150b09127e3 83 struct pppoehdr {
helmut 0:5150b09127e3 84 PACK_STRUCT_FIELD(u8_t vertype);
helmut 0:5150b09127e3 85 PACK_STRUCT_FIELD(u8_t code);
helmut 0:5150b09127e3 86 PACK_STRUCT_FIELD(u16_t session);
helmut 0:5150b09127e3 87 PACK_STRUCT_FIELD(u16_t plen);
helmut 0:5150b09127e3 88 } PACK_STRUCT_STRUCT;
helmut 0:5150b09127e3 89 PACK_STRUCT_END
helmut 0:5150b09127e3 90 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 91 # include "arch/epstruct.h"
helmut 0:5150b09127e3 92 #endif
helmut 0:5150b09127e3 93
helmut 0:5150b09127e3 94 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 95 # include "arch/bpstruct.h"
helmut 0:5150b09127e3 96 #endif
helmut 0:5150b09127e3 97 PACK_STRUCT_BEGIN
helmut 0:5150b09127e3 98 struct pppoetag {
helmut 0:5150b09127e3 99 PACK_STRUCT_FIELD(u16_t tag);
helmut 0:5150b09127e3 100 PACK_STRUCT_FIELD(u16_t len);
helmut 0:5150b09127e3 101 } PACK_STRUCT_STRUCT;
helmut 0:5150b09127e3 102 PACK_STRUCT_END
helmut 0:5150b09127e3 103 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 104 # include "arch/epstruct.h"
helmut 0:5150b09127e3 105 #endif
helmut 0:5150b09127e3 106
helmut 0:5150b09127e3 107
helmut 0:5150b09127e3 108 #define PPPOE_STATE_INITIAL 0
helmut 0:5150b09127e3 109 #define PPPOE_STATE_PADI_SENT 1
helmut 0:5150b09127e3 110 #define PPPOE_STATE_PADR_SENT 2
helmut 0:5150b09127e3 111 #define PPPOE_STATE_SESSION 3
helmut 0:5150b09127e3 112 #define PPPOE_STATE_CLOSING 4
helmut 0:5150b09127e3 113 /* passive */
helmut 0:5150b09127e3 114 #define PPPOE_STATE_PADO_SENT 1
helmut 0:5150b09127e3 115
helmut 0:5150b09127e3 116 #define PPPOE_HEADERLEN sizeof(struct pppoehdr)
helmut 0:5150b09127e3 117 #define PPPOE_VERTYPE 0x11 /* VER=1, TYPE = 1 */
helmut 0:5150b09127e3 118
helmut 0:5150b09127e3 119 #define PPPOE_TAG_EOL 0x0000 /* end of list */
helmut 0:5150b09127e3 120 #define PPPOE_TAG_SNAME 0x0101 /* service name */
helmut 0:5150b09127e3 121 #define PPPOE_TAG_ACNAME 0x0102 /* access concentrator name */
helmut 0:5150b09127e3 122 #define PPPOE_TAG_HUNIQUE 0x0103 /* host unique */
helmut 0:5150b09127e3 123 #define PPPOE_TAG_ACCOOKIE 0x0104 /* AC cookie */
helmut 0:5150b09127e3 124 #define PPPOE_TAG_VENDOR 0x0105 /* vendor specific */
helmut 0:5150b09127e3 125 #define PPPOE_TAG_RELAYSID 0x0110 /* relay session id */
helmut 0:5150b09127e3 126 #define PPPOE_TAG_SNAME_ERR 0x0201 /* service name error */
helmut 0:5150b09127e3 127 #define PPPOE_TAG_ACSYS_ERR 0x0202 /* AC system error */
helmut 0:5150b09127e3 128 #define PPPOE_TAG_GENERIC_ERR 0x0203 /* gerneric error */
helmut 0:5150b09127e3 129
helmut 0:5150b09127e3 130 #define PPPOE_CODE_PADI 0x09 /* Active Discovery Initiation */
helmut 0:5150b09127e3 131 #define PPPOE_CODE_PADO 0x07 /* Active Discovery Offer */
helmut 0:5150b09127e3 132 #define PPPOE_CODE_PADR 0x19 /* Active Discovery Request */
helmut 0:5150b09127e3 133 #define PPPOE_CODE_PADS 0x65 /* Active Discovery Session confirmation */
helmut 0:5150b09127e3 134 #define PPPOE_CODE_PADT 0xA7 /* Active Discovery Terminate */
helmut 0:5150b09127e3 135
helmut 0:5150b09127e3 136 #ifndef ETHERMTU
helmut 0:5150b09127e3 137 #define ETHERMTU 1500
helmut 0:5150b09127e3 138 #endif
helmut 0:5150b09127e3 139
helmut 0:5150b09127e3 140 /* two byte PPP protocol discriminator, then IP data */
helmut 0:5150b09127e3 141 #define PPPOE_MAXMTU (ETHERMTU-PPPOE_HEADERLEN-2)
helmut 0:5150b09127e3 142
helmut 0:5150b09127e3 143 #ifndef PPPOE_MAX_AC_COOKIE_LEN
helmut 0:5150b09127e3 144 #define PPPOE_MAX_AC_COOKIE_LEN 64
helmut 0:5150b09127e3 145 #endif
helmut 0:5150b09127e3 146
helmut 0:5150b09127e3 147 struct pppoe_softc {
helmut 0:5150b09127e3 148 struct pppoe_softc *next;
helmut 0:5150b09127e3 149 struct netif *sc_ethif; /* ethernet interface we are using */
helmut 0:5150b09127e3 150 int sc_pd; /* ppp unit number */
helmut 0:5150b09127e3 151 void (*sc_linkStatusCB)(int pd, int up);
helmut 0:5150b09127e3 152
helmut 0:5150b09127e3 153 int sc_state; /* discovery phase or session connected */
helmut 0:5150b09127e3 154 struct eth_addr sc_dest; /* hardware address of concentrator */
helmut 0:5150b09127e3 155 u16_t sc_session; /* PPPoE session id */
helmut 0:5150b09127e3 156
helmut 0:5150b09127e3 157 #ifdef PPPOE_TODO
helmut 0:5150b09127e3 158 char *sc_service_name; /* if != NULL: requested name of service */
helmut 0:5150b09127e3 159 char *sc_concentrator_name; /* if != NULL: requested concentrator id */
helmut 0:5150b09127e3 160 #endif /* PPPOE_TODO */
helmut 0:5150b09127e3 161 u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
helmut 0:5150b09127e3 162 size_t sc_ac_cookie_len; /* length of cookie data */
helmut 0:5150b09127e3 163 #ifdef PPPOE_SERVER
helmut 0:5150b09127e3 164 u8_t *sc_hunique; /* content of host unique we must echo back */
helmut 0:5150b09127e3 165 size_t sc_hunique_len; /* length of host unique */
helmut 0:5150b09127e3 166 #endif
helmut 0:5150b09127e3 167 int sc_padi_retried; /* number of PADI retries already done */
helmut 0:5150b09127e3 168 int sc_padr_retried; /* number of PADR retries already done */
helmut 0:5150b09127e3 169 };
helmut 0:5150b09127e3 170
helmut 0:5150b09127e3 171
helmut 0:5150b09127e3 172 #define pppoe_init() /* compatibility define, no initialization needed */
helmut 0:5150b09127e3 173
helmut 0:5150b09127e3 174 err_t pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr);
helmut 0:5150b09127e3 175 err_t pppoe_destroy(struct netif *ifp);
helmut 0:5150b09127e3 176
helmut 0:5150b09127e3 177 int pppoe_connect(struct pppoe_softc *sc);
helmut 0:5150b09127e3 178 void pppoe_disconnect(struct pppoe_softc *sc);
helmut 0:5150b09127e3 179
helmut 0:5150b09127e3 180 void pppoe_disc_input(struct netif *netif, struct pbuf *p);
helmut 0:5150b09127e3 181 void pppoe_data_input(struct netif *netif, struct pbuf *p);
helmut 0:5150b09127e3 182
helmut 0:5150b09127e3 183 err_t pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb);
helmut 0:5150b09127e3 184
helmut 0:5150b09127e3 185 /** used in ppp.c */
helmut 0:5150b09127e3 186 #define PPPOE_HDRLEN (sizeof(struct eth_hdr) + PPPOE_HEADERLEN)
helmut 0:5150b09127e3 187
helmut 0:5150b09127e3 188 #endif /* PPPOE_SUPPORT */
helmut 0:5150b09127e3 189
helmut 0:5150b09127e3 190 #endif /* PPP_OE_H */