This short program illustrates how to use the DS130x_I2C library. My objective is to share the same RTC with Microchip 18F MCU.

Dependencies:   mbed DebugLibrary

Committer:
Yann
Date:
Wed Feb 09 13:57:49 2011 +0000
Revision:
0:f30e2135b0db
V0.0.0.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Yann 0:f30e2135b0db 1 /*****************************************************************************
Yann 0:f30e2135b0db 2 * ipcp.h - PPP IP NCP: Internet Protocol Network Control Protocol header file.
Yann 0:f30e2135b0db 3 *
Yann 0:f30e2135b0db 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
Yann 0:f30e2135b0db 5 * portions Copyright (c) 1997 Global Election Systems Inc.
Yann 0:f30e2135b0db 6 *
Yann 0:f30e2135b0db 7 * The authors hereby grant permission to use, copy, modify, distribute,
Yann 0:f30e2135b0db 8 * and license this software and its documentation for any purpose, provided
Yann 0:f30e2135b0db 9 * that existing copyright notices are retained in all copies and that this
Yann 0:f30e2135b0db 10 * notice and the following disclaimer are included verbatim in any
Yann 0:f30e2135b0db 11 * distributions. No written agreement, license, or royalty fee is required
Yann 0:f30e2135b0db 12 * for any of the authorized uses.
Yann 0:f30e2135b0db 13 *
Yann 0:f30e2135b0db 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
Yann 0:f30e2135b0db 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Yann 0:f30e2135b0db 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Yann 0:f30e2135b0db 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
Yann 0:f30e2135b0db 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
Yann 0:f30e2135b0db 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Yann 0:f30e2135b0db 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Yann 0:f30e2135b0db 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Yann 0:f30e2135b0db 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
Yann 0:f30e2135b0db 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Yann 0:f30e2135b0db 24 *
Yann 0:f30e2135b0db 25 ******************************************************************************
Yann 0:f30e2135b0db 26 * REVISION HISTORY
Yann 0:f30e2135b0db 27 *
Yann 0:f30e2135b0db 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
Yann 0:f30e2135b0db 29 * Ported to lwIP.
Yann 0:f30e2135b0db 30 * 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
Yann 0:f30e2135b0db 31 * Original derived from BSD codes.
Yann 0:f30e2135b0db 32 *****************************************************************************/
Yann 0:f30e2135b0db 33 /*
Yann 0:f30e2135b0db 34 * ipcp.h - IP Control Protocol definitions.
Yann 0:f30e2135b0db 35 *
Yann 0:f30e2135b0db 36 * Copyright (c) 1989 Carnegie Mellon University.
Yann 0:f30e2135b0db 37 * All rights reserved.
Yann 0:f30e2135b0db 38 *
Yann 0:f30e2135b0db 39 * Redistribution and use in source and binary forms are permitted
Yann 0:f30e2135b0db 40 * provided that the above copyright notice and this paragraph are
Yann 0:f30e2135b0db 41 * duplicated in all such forms and that any documentation,
Yann 0:f30e2135b0db 42 * advertising materials, and other materials related to such
Yann 0:f30e2135b0db 43 * distribution and use acknowledge that the software was developed
Yann 0:f30e2135b0db 44 * by Carnegie Mellon University. The name of the
Yann 0:f30e2135b0db 45 * University may not be used to endorse or promote products derived
Yann 0:f30e2135b0db 46 * from this software without specific prior written permission.
Yann 0:f30e2135b0db 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
Yann 0:f30e2135b0db 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Yann 0:f30e2135b0db 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Yann 0:f30e2135b0db 50 *
Yann 0:f30e2135b0db 51 * $Id: ipcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $
Yann 0:f30e2135b0db 52 */
Yann 0:f30e2135b0db 53
Yann 0:f30e2135b0db 54 #ifndef IPCP_H
Yann 0:f30e2135b0db 55 #define IPCP_H
Yann 0:f30e2135b0db 56
Yann 0:f30e2135b0db 57 /*
Yann 0:f30e2135b0db 58 * Options.
Yann 0:f30e2135b0db 59 */
Yann 0:f30e2135b0db 60 #define CI_ADDRS 1 /* IP Addresses */
Yann 0:f30e2135b0db 61 #define CI_COMPRESSTYPE 2 /* Compression Type */
Yann 0:f30e2135b0db 62 #define CI_ADDR 3
Yann 0:f30e2135b0db 63
Yann 0:f30e2135b0db 64 #define CI_MS_DNS1 129 /* Primary DNS value */
Yann 0:f30e2135b0db 65 #define CI_MS_WINS1 128 /* Primary WINS value */
Yann 0:f30e2135b0db 66 #define CI_MS_DNS2 131 /* Secondary DNS value */
Yann 0:f30e2135b0db 67 #define CI_MS_WINS2 130 /* Secondary WINS value */
Yann 0:f30e2135b0db 68
Yann 0:f30e2135b0db 69 #define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */
Yann 0:f30e2135b0db 70 #define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */
Yann 0:f30e2135b0db 71 #define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */
Yann 0:f30e2135b0db 72 /* maxslot and slot number compression) */
Yann 0:f30e2135b0db 73
Yann 0:f30e2135b0db 74 #define IPCP_VJ_COMP 0x002d /* current value for VJ compression option */
Yann 0:f30e2135b0db 75 #define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */
Yann 0:f30e2135b0db 76 /* compression option */
Yann 0:f30e2135b0db 77
Yann 0:f30e2135b0db 78 typedef struct ipcp_options {
Yann 0:f30e2135b0db 79 u_int neg_addr : 1; /* Negotiate IP Address? */
Yann 0:f30e2135b0db 80 u_int old_addrs : 1; /* Use old (IP-Addresses) option? */
Yann 0:f30e2135b0db 81 u_int req_addr : 1; /* Ask peer to send IP address? */
Yann 0:f30e2135b0db 82 u_int default_route : 1; /* Assign default route through interface? */
Yann 0:f30e2135b0db 83 u_int proxy_arp : 1; /* Make proxy ARP entry for peer? */
Yann 0:f30e2135b0db 84 u_int neg_vj : 1; /* Van Jacobson Compression? */
Yann 0:f30e2135b0db 85 u_int old_vj : 1; /* use old (short) form of VJ option? */
Yann 0:f30e2135b0db 86 u_int accept_local : 1; /* accept peer's value for ouraddr */
Yann 0:f30e2135b0db 87 u_int accept_remote : 1; /* accept peer's value for hisaddr */
Yann 0:f30e2135b0db 88 u_int req_dns1 : 1; /* Ask peer to send primary DNS address? */
Yann 0:f30e2135b0db 89 u_int req_dns2 : 1; /* Ask peer to send secondary DNS address? */
Yann 0:f30e2135b0db 90 u_short vj_protocol; /* protocol value to use in VJ option */
Yann 0:f30e2135b0db 91 u_char maxslotindex; /* VJ slots - 1. */
Yann 0:f30e2135b0db 92 u_char cflag; /* VJ slot compression flag. */
Yann 0:f30e2135b0db 93 u32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
Yann 0:f30e2135b0db 94 u32_t dnsaddr[2]; /* Primary and secondary MS DNS entries */
Yann 0:f30e2135b0db 95 u32_t winsaddr[2]; /* Primary and secondary MS WINS entries */
Yann 0:f30e2135b0db 96 } ipcp_options;
Yann 0:f30e2135b0db 97
Yann 0:f30e2135b0db 98 extern fsm ipcp_fsm[];
Yann 0:f30e2135b0db 99 extern ipcp_options ipcp_wantoptions[];
Yann 0:f30e2135b0db 100 extern ipcp_options ipcp_gotoptions[];
Yann 0:f30e2135b0db 101 extern ipcp_options ipcp_allowoptions[];
Yann 0:f30e2135b0db 102 extern ipcp_options ipcp_hisoptions[];
Yann 0:f30e2135b0db 103
Yann 0:f30e2135b0db 104 extern struct protent ipcp_protent;
Yann 0:f30e2135b0db 105
Yann 0:f30e2135b0db 106 #endif /* IPCP_H */