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 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
helmut 0:5150b09127e3 3 * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv>
helmut 0:5150b09127e3 4 * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
helmut 0:5150b09127e3 5 * All rights reserved.
helmut 0:5150b09127e3 6 *
helmut 0:5150b09127e3 7 * Redistribution and use in source and binary forms, with or without modification,
helmut 0:5150b09127e3 8 * are permitted provided that the following conditions are met:
helmut 0:5150b09127e3 9 *
helmut 0:5150b09127e3 10 * 1. Redistributions of source code must retain the above copyright notice,
helmut 0:5150b09127e3 11 * this list of conditions and the following disclaimer.
helmut 0:5150b09127e3 12 * 2. Redistributions in binary form must reproduce the above copyright notice,
helmut 0:5150b09127e3 13 * this list of conditions and the following disclaimer in the documentation
helmut 0:5150b09127e3 14 * and/or other materials provided with the distribution.
helmut 0:5150b09127e3 15 * 3. The name of the author may not be used to endorse or promote products
helmut 0:5150b09127e3 16 * derived from this software without specific prior written permission.
helmut 0:5150b09127e3 17 *
helmut 0:5150b09127e3 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
helmut 0:5150b09127e3 19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
helmut 0:5150b09127e3 20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
helmut 0:5150b09127e3 21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
helmut 0:5150b09127e3 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
helmut 0:5150b09127e3 23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
helmut 0:5150b09127e3 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
helmut 0:5150b09127e3 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
helmut 0:5150b09127e3 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
helmut 0:5150b09127e3 27 * OF SUCH DAMAGE.
helmut 0:5150b09127e3 28 *
helmut 0:5150b09127e3 29 * This file is part of the lwIP TCP/IP stack.
helmut 0:5150b09127e3 30 *
helmut 0:5150b09127e3 31 * Author: Adam Dunkels <adam@sics.se>
helmut 0:5150b09127e3 32 *
helmut 0:5150b09127e3 33 */
helmut 0:5150b09127e3 34
helmut 0:5150b09127e3 35 #ifndef __NETIF_ETHARP_H__
helmut 0:5150b09127e3 36 #define __NETIF_ETHARP_H__
helmut 0:5150b09127e3 37
helmut 0:5150b09127e3 38 #include "lwip/opt.h"
helmut 0:5150b09127e3 39
helmut 0:5150b09127e3 40 #if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */
helmut 0:5150b09127e3 41
helmut 0:5150b09127e3 42 #include "lwip/pbuf.h"
helmut 0:5150b09127e3 43 #include "lwip/ip_addr.h"
helmut 0:5150b09127e3 44 #include "lwip/netif.h"
helmut 0:5150b09127e3 45 #include "lwip/ip.h"
helmut 0:5150b09127e3 46
helmut 0:5150b09127e3 47 #ifdef __cplusplus
helmut 0:5150b09127e3 48 extern "C" {
helmut 0:5150b09127e3 49 #endif
helmut 0:5150b09127e3 50
helmut 0:5150b09127e3 51 #ifndef ETHARP_HWADDR_LEN
helmut 0:5150b09127e3 52 #define ETHARP_HWADDR_LEN 6
helmut 0:5150b09127e3 53 #endif
helmut 0:5150b09127e3 54
helmut 0:5150b09127e3 55 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 56 # include "arch/bpstruct.h"
helmut 0:5150b09127e3 57 #endif
helmut 0:5150b09127e3 58 PACK_STRUCT_BEGIN
helmut 0:5150b09127e3 59 struct eth_addr {
helmut 0:5150b09127e3 60 PACK_STRUCT_FIELD(u8_t addr[ETHARP_HWADDR_LEN]);
helmut 0:5150b09127e3 61 } PACK_STRUCT_STRUCT;
helmut 0:5150b09127e3 62 PACK_STRUCT_END
helmut 0:5150b09127e3 63 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 64 # include "arch/epstruct.h"
helmut 0:5150b09127e3 65 #endif
helmut 0:5150b09127e3 66
helmut 0:5150b09127e3 67 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 68 # include "arch/bpstruct.h"
helmut 0:5150b09127e3 69 #endif
helmut 0:5150b09127e3 70 PACK_STRUCT_BEGIN
helmut 0:5150b09127e3 71 /* Ethernet header */
helmut 0:5150b09127e3 72 struct eth_hdr {
helmut 0:5150b09127e3 73 #if ETH_PAD_SIZE
helmut 0:5150b09127e3 74 PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
helmut 0:5150b09127e3 75 #endif
helmut 0:5150b09127e3 76 PACK_STRUCT_FIELD(struct eth_addr dest);
helmut 0:5150b09127e3 77 PACK_STRUCT_FIELD(struct eth_addr src);
helmut 0:5150b09127e3 78 PACK_STRUCT_FIELD(u16_t type);
helmut 0:5150b09127e3 79 } PACK_STRUCT_STRUCT;
helmut 0:5150b09127e3 80 PACK_STRUCT_END
helmut 0:5150b09127e3 81 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 82 # include "arch/epstruct.h"
helmut 0:5150b09127e3 83 #endif
helmut 0:5150b09127e3 84
helmut 0:5150b09127e3 85 #define SIZEOF_ETH_HDR (14 + ETH_PAD_SIZE)
helmut 0:5150b09127e3 86
helmut 0:5150b09127e3 87 #if ETHARP_SUPPORT_VLAN
helmut 0:5150b09127e3 88
helmut 0:5150b09127e3 89 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 90 # include "arch/bpstruct.h"
helmut 0:5150b09127e3 91 #endif
helmut 0:5150b09127e3 92 PACK_STRUCT_BEGIN
helmut 0:5150b09127e3 93 /* VLAN header inserted between ethernet header and payload
helmut 0:5150b09127e3 94 * if 'type' in ethernet header is ETHTYPE_VLAN.
helmut 0:5150b09127e3 95 * See IEEE802.Q */
helmut 0:5150b09127e3 96 struct eth_vlan_hdr {
helmut 0:5150b09127e3 97 PACK_STRUCT_FIELD(u16_t tpid);
helmut 0:5150b09127e3 98 PACK_STRUCT_FIELD(u16_t prio_vid);
helmut 0:5150b09127e3 99 } PACK_STRUCT_STRUCT;
helmut 0:5150b09127e3 100 PACK_STRUCT_END
helmut 0:5150b09127e3 101 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 102 # include "arch/epstruct.h"
helmut 0:5150b09127e3 103 #endif
helmut 0:5150b09127e3 104
helmut 0:5150b09127e3 105 #define SIZEOF_VLAN_HDR 4
helmut 0:5150b09127e3 106 #define VLAN_ID(vlan_hdr) (htons((vlan_hdr)->prio_vid) & 0xFFF)
helmut 0:5150b09127e3 107
helmut 0:5150b09127e3 108 #endif /* ETHARP_SUPPORT_VLAN */
helmut 0:5150b09127e3 109
helmut 0:5150b09127e3 110 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 111 # include "arch/bpstruct.h"
helmut 0:5150b09127e3 112 #endif
helmut 0:5150b09127e3 113 PACK_STRUCT_BEGIN
helmut 0:5150b09127e3 114 /* the ARP message, see RFC 826 ("Packet format") */
helmut 0:5150b09127e3 115 struct etharp_hdr {
helmut 0:5150b09127e3 116 PACK_STRUCT_FIELD(u16_t hwtype);
helmut 0:5150b09127e3 117 PACK_STRUCT_FIELD(u16_t proto);
helmut 0:5150b09127e3 118 PACK_STRUCT_FIELD(u8_t hwlen);
helmut 0:5150b09127e3 119 PACK_STRUCT_FIELD(u8_t protolen);
helmut 0:5150b09127e3 120 PACK_STRUCT_FIELD(u16_t opcode);
helmut 0:5150b09127e3 121 PACK_STRUCT_FIELD(struct eth_addr shwaddr);
helmut 0:5150b09127e3 122 PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
helmut 0:5150b09127e3 123 PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
helmut 0:5150b09127e3 124 PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
helmut 0:5150b09127e3 125 } PACK_STRUCT_STRUCT;
helmut 0:5150b09127e3 126 PACK_STRUCT_END
helmut 0:5150b09127e3 127 #ifdef PACK_STRUCT_USE_INCLUDES
helmut 0:5150b09127e3 128 # include "arch/epstruct.h"
helmut 0:5150b09127e3 129 #endif
helmut 0:5150b09127e3 130
helmut 0:5150b09127e3 131 #define SIZEOF_ETHARP_HDR 28
helmut 0:5150b09127e3 132 #define SIZEOF_ETHARP_PACKET (SIZEOF_ETH_HDR + SIZEOF_ETHARP_HDR)
helmut 0:5150b09127e3 133
helmut 0:5150b09127e3 134 /* 5 seconds period */
helmut 0:5150b09127e3 135 #define ARP_TMR_INTERVAL 5000
helmut 0:5150b09127e3 136
helmut 0:5150b09127e3 137 #define ETHTYPE_ARP 0x0806
helmut 0:5150b09127e3 138 #define ETHTYPE_IP 0x0800
helmut 0:5150b09127e3 139 #define ETHTYPE_VLAN 0x8100
helmut 0:5150b09127e3 140 #define ETHTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
helmut 0:5150b09127e3 141 #define ETHTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
helmut 0:5150b09127e3 142
helmut 0:5150b09127e3 143 /* MEMCPY-like macro to copy to/from struct eth_addr's that are local variables
helmut 0:5150b09127e3 144 * or known to be 32-bit aligned within the protocol header. */
helmut 0:5150b09127e3 145 #ifndef ETHADDR32_COPY
helmut 0:5150b09127e3 146 #define ETHADDR32_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN)
helmut 0:5150b09127e3 147 #endif
helmut 0:5150b09127e3 148
helmut 0:5150b09127e3 149 /* MEMCPY-like macro to copy to/from struct eth_addr's that are no local
helmut 0:5150b09127e3 150 * variables and known to be 16-bit aligned within the protocol header. */
helmut 0:5150b09127e3 151 #ifndef ETHADDR16_COPY
helmut 0:5150b09127e3 152 #define ETHADDR16_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN)
helmut 0:5150b09127e3 153 #endif
helmut 0:5150b09127e3 154
helmut 0:5150b09127e3 155 #if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
helmut 0:5150b09127e3 156
helmut 0:5150b09127e3 157 /* ARP message types (opcodes) */
helmut 0:5150b09127e3 158 #define ARP_REQUEST 1
helmut 0:5150b09127e3 159 #define ARP_REPLY 2
helmut 0:5150b09127e3 160
helmut 0:5150b09127e3 161 /* Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type)
helmut 0:5150b09127e3 162 * to a filter function that returns the correct netif when using multiple
helmut 0:5150b09127e3 163 * netifs on one hardware interface where the netif's low-level receive
helmut 0:5150b09127e3 164 * routine cannot decide for the correct netif (e.g. when mapping multiple
helmut 0:5150b09127e3 165 * IP addresses to one hardware interface).
helmut 0:5150b09127e3 166 */
helmut 0:5150b09127e3 167 #ifndef LWIP_ARP_FILTER_NETIF
helmut 0:5150b09127e3 168 #define LWIP_ARP_FILTER_NETIF 0
helmut 0:5150b09127e3 169 #endif
helmut 0:5150b09127e3 170
helmut 0:5150b09127e3 171 #if ARP_QUEUEING
helmut 0:5150b09127e3 172 /* struct for queueing outgoing packets for unknown address
helmut 0:5150b09127e3 173 * defined here to be accessed by memp.h
helmut 0:5150b09127e3 174 */
helmut 0:5150b09127e3 175 struct etharp_q_entry {
helmut 0:5150b09127e3 176 struct etharp_q_entry *next;
helmut 0:5150b09127e3 177 struct pbuf *p;
helmut 0:5150b09127e3 178 };
helmut 0:5150b09127e3 179 #endif /* ARP_QUEUEING */
helmut 0:5150b09127e3 180
helmut 0:5150b09127e3 181 #define etharp_init() /* Compatibility define, not init needed. */
helmut 0:5150b09127e3 182 void etharp_tmr(void);
helmut 0:5150b09127e3 183 s8_t etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
helmut 0:5150b09127e3 184 struct eth_addr **eth_ret, ip_addr_t **ip_ret);
helmut 0:5150b09127e3 185 err_t etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr);
helmut 0:5150b09127e3 186 err_t etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q);
helmut 0:5150b09127e3 187 err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr);
helmut 0:5150b09127e3 188 /* For Ethernet network interfaces, we might want to send "gratuitous ARP";
helmut 0:5150b09127e3 189 * this is an ARP packet sent by a node in order to spontaneously cause other
helmut 0:5150b09127e3 190 * nodes to update an entry in their ARP cache.
helmut 0:5150b09127e3 191 * From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */
helmut 0:5150b09127e3 192 #define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr)
helmut 0:5150b09127e3 193
helmut 0:5150b09127e3 194 #if ETHARP_SUPPORT_STATIC_ENTRIES
helmut 0:5150b09127e3 195 err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr);
helmut 0:5150b09127e3 196 err_t etharp_remove_static_entry(ip_addr_t *ipaddr);
helmut 0:5150b09127e3 197 #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
helmut 0:5150b09127e3 198
helmut 0:5150b09127e3 199 #if LWIP_AUTOIP
helmut 0:5150b09127e3 200 err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
helmut 0:5150b09127e3 201 const struct eth_addr *ethdst_addr,
helmut 0:5150b09127e3 202 const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr,
helmut 0:5150b09127e3 203 const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr,
helmut 0:5150b09127e3 204 const u16_t opcode);
helmut 0:5150b09127e3 205 #endif /* LWIP_AUTOIP */
helmut 0:5150b09127e3 206
helmut 0:5150b09127e3 207 #endif /* LWIP_ARP */
helmut 0:5150b09127e3 208
helmut 0:5150b09127e3 209 err_t ethernet_input(struct pbuf *p, struct netif *netif);
helmut 0:5150b09127e3 210
helmut 0:5150b09127e3 211 #define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETHARP_HWADDR_LEN) == 0)
helmut 0:5150b09127e3 212
helmut 0:5150b09127e3 213 extern const struct eth_addr ethbroadcast, ethzero;
helmut 0:5150b09127e3 214
helmut 0:5150b09127e3 215 #ifdef __cplusplus
helmut 0:5150b09127e3 216 }
helmut 0:5150b09127e3 217 #endif
helmut 0:5150b09127e3 218
helmut 0:5150b09127e3 219 #endif /* LWIP_ARP || LWIP_ETHERNET */
helmut 0:5150b09127e3 220
helmut 0:5150b09127e3 221 #endif /* __NETIF_ARP_H__ */