LineLedControl

Dependencies:   LPD8806 mbed

Fork of LPD8806_Test by Jelmer Tiete

Committer:
sfjmt
Date:
Mon Aug 19 12:14:37 2013 +0000
Revision:
3:b0a1b4b24d3c
LPD8806 control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sfjmt 3:b0a1b4b24d3c 1 /*****************************************************************************
sfjmt 3:b0a1b4b24d3c 2 * lcp.h - Network Link Control Protocol header file.
sfjmt 3:b0a1b4b24d3c 3 *
sfjmt 3:b0a1b4b24d3c 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
sfjmt 3:b0a1b4b24d3c 5 * portions Copyright (c) 1997 Global Election Systems Inc.
sfjmt 3:b0a1b4b24d3c 6 *
sfjmt 3:b0a1b4b24d3c 7 * The authors hereby grant permission to use, copy, modify, distribute,
sfjmt 3:b0a1b4b24d3c 8 * and license this software and its documentation for any purpose, provided
sfjmt 3:b0a1b4b24d3c 9 * that existing copyright notices are retained in all copies and that this
sfjmt 3:b0a1b4b24d3c 10 * notice and the following disclaimer are included verbatim in any
sfjmt 3:b0a1b4b24d3c 11 * distributions. No written agreement, license, or royalty fee is required
sfjmt 3:b0a1b4b24d3c 12 * for any of the authorized uses.
sfjmt 3:b0a1b4b24d3c 13 *
sfjmt 3:b0a1b4b24d3c 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
sfjmt 3:b0a1b4b24d3c 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
sfjmt 3:b0a1b4b24d3c 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
sfjmt 3:b0a1b4b24d3c 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
sfjmt 3:b0a1b4b24d3c 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
sfjmt 3:b0a1b4b24d3c 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
sfjmt 3:b0a1b4b24d3c 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
sfjmt 3:b0a1b4b24d3c 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
sfjmt 3:b0a1b4b24d3c 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
sfjmt 3:b0a1b4b24d3c 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sfjmt 3:b0a1b4b24d3c 24 *
sfjmt 3:b0a1b4b24d3c 25 ******************************************************************************
sfjmt 3:b0a1b4b24d3c 26 * REVISION HISTORY
sfjmt 3:b0a1b4b24d3c 27 *
sfjmt 3:b0a1b4b24d3c 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
sfjmt 3:b0a1b4b24d3c 29 * Ported to lwIP.
sfjmt 3:b0a1b4b24d3c 30 * 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
sfjmt 3:b0a1b4b24d3c 31 * Original derived from BSD codes.
sfjmt 3:b0a1b4b24d3c 32 *****************************************************************************/
sfjmt 3:b0a1b4b24d3c 33 /*
sfjmt 3:b0a1b4b24d3c 34 * lcp.h - Link Control Protocol definitions.
sfjmt 3:b0a1b4b24d3c 35 *
sfjmt 3:b0a1b4b24d3c 36 * Copyright (c) 1989 Carnegie Mellon University.
sfjmt 3:b0a1b4b24d3c 37 * All rights reserved.
sfjmt 3:b0a1b4b24d3c 38 *
sfjmt 3:b0a1b4b24d3c 39 * Redistribution and use in source and binary forms are permitted
sfjmt 3:b0a1b4b24d3c 40 * provided that the above copyright notice and this paragraph are
sfjmt 3:b0a1b4b24d3c 41 * duplicated in all such forms and that any documentation,
sfjmt 3:b0a1b4b24d3c 42 * advertising materials, and other materials related to such
sfjmt 3:b0a1b4b24d3c 43 * distribution and use acknowledge that the software was developed
sfjmt 3:b0a1b4b24d3c 44 * by Carnegie Mellon University. The name of the
sfjmt 3:b0a1b4b24d3c 45 * University may not be used to endorse or promote products derived
sfjmt 3:b0a1b4b24d3c 46 * from this software without specific prior written permission.
sfjmt 3:b0a1b4b24d3c 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
sfjmt 3:b0a1b4b24d3c 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
sfjmt 3:b0a1b4b24d3c 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
sfjmt 3:b0a1b4b24d3c 50 *
sfjmt 3:b0a1b4b24d3c 51 * $Id: lcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $
sfjmt 3:b0a1b4b24d3c 52 */
sfjmt 3:b0a1b4b24d3c 53
sfjmt 3:b0a1b4b24d3c 54 #ifndef LCP_H
sfjmt 3:b0a1b4b24d3c 55 #define LCP_H
sfjmt 3:b0a1b4b24d3c 56 /*
sfjmt 3:b0a1b4b24d3c 57 * Options.
sfjmt 3:b0a1b4b24d3c 58 */
sfjmt 3:b0a1b4b24d3c 59 #define CI_MRU 1 /* Maximum Receive Unit */
sfjmt 3:b0a1b4b24d3c 60 #define CI_ASYNCMAP 2 /* Async Control Character Map */
sfjmt 3:b0a1b4b24d3c 61 #define CI_AUTHTYPE 3 /* Authentication Type */
sfjmt 3:b0a1b4b24d3c 62 #define CI_QUALITY 4 /* Quality Protocol */
sfjmt 3:b0a1b4b24d3c 63 #define CI_MAGICNUMBER 5 /* Magic Number */
sfjmt 3:b0a1b4b24d3c 64 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
sfjmt 3:b0a1b4b24d3c 65 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
sfjmt 3:b0a1b4b24d3c 66 #define CI_CALLBACK 13 /* callback */
sfjmt 3:b0a1b4b24d3c 67 #define CI_MRRU 17 /* max reconstructed receive unit; multilink */
sfjmt 3:b0a1b4b24d3c 68 #define CI_SSNHF 18 /* short sequence numbers for multilink */
sfjmt 3:b0a1b4b24d3c 69 #define CI_EPDISC 19 /* endpoint discriminator */
sfjmt 3:b0a1b4b24d3c 70
sfjmt 3:b0a1b4b24d3c 71 /*
sfjmt 3:b0a1b4b24d3c 72 * LCP-specific packet types (code numbers).
sfjmt 3:b0a1b4b24d3c 73 */
sfjmt 3:b0a1b4b24d3c 74 #define PROTREJ 8 /* Protocol Reject */
sfjmt 3:b0a1b4b24d3c 75 #define ECHOREQ 9 /* Echo Request */
sfjmt 3:b0a1b4b24d3c 76 #define ECHOREP 10 /* Echo Reply */
sfjmt 3:b0a1b4b24d3c 77 #define DISCREQ 11 /* Discard Request */
sfjmt 3:b0a1b4b24d3c 78 #define CBCP_OPT 6 /* Use callback control protocol */
sfjmt 3:b0a1b4b24d3c 79
sfjmt 3:b0a1b4b24d3c 80 /*
sfjmt 3:b0a1b4b24d3c 81 * The state of options is described by an lcp_options structure.
sfjmt 3:b0a1b4b24d3c 82 */
sfjmt 3:b0a1b4b24d3c 83 typedef struct lcp_options {
sfjmt 3:b0a1b4b24d3c 84 u_int passive : 1; /* Don't die if we don't get a response */
sfjmt 3:b0a1b4b24d3c 85 u_int silent : 1; /* Wait for the other end to start first */
sfjmt 3:b0a1b4b24d3c 86 u_int restart : 1; /* Restart vs. exit after close */
sfjmt 3:b0a1b4b24d3c 87 u_int neg_mru : 1; /* Negotiate the MRU? */
sfjmt 3:b0a1b4b24d3c 88 u_int neg_asyncmap : 1; /* Negotiate the async map? */
sfjmt 3:b0a1b4b24d3c 89 u_int neg_upap : 1; /* Ask for UPAP authentication? */
sfjmt 3:b0a1b4b24d3c 90 u_int neg_chap : 1; /* Ask for CHAP authentication? */
sfjmt 3:b0a1b4b24d3c 91 u_int neg_magicnumber : 1; /* Ask for magic number? */
sfjmt 3:b0a1b4b24d3c 92 u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
sfjmt 3:b0a1b4b24d3c 93 u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
sfjmt 3:b0a1b4b24d3c 94 u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
sfjmt 3:b0a1b4b24d3c 95 u_int neg_cbcp : 1; /* Negotiate use of CBCP */
sfjmt 3:b0a1b4b24d3c 96 #ifdef PPP_MULTILINK
sfjmt 3:b0a1b4b24d3c 97 u_int neg_mrru : 1; /* Negotiate multilink MRRU */
sfjmt 3:b0a1b4b24d3c 98 u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
sfjmt 3:b0a1b4b24d3c 99 u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
sfjmt 3:b0a1b4b24d3c 100 #endif
sfjmt 3:b0a1b4b24d3c 101 u_short mru; /* Value of MRU */
sfjmt 3:b0a1b4b24d3c 102 #ifdef PPP_MULTILINK
sfjmt 3:b0a1b4b24d3c 103 u_short mrru; /* Value of MRRU, and multilink enable */
sfjmt 3:b0a1b4b24d3c 104 #endif
sfjmt 3:b0a1b4b24d3c 105 u_char chap_mdtype; /* which MD type (hashing algorithm) */
sfjmt 3:b0a1b4b24d3c 106 u32_t asyncmap; /* Value of async map */
sfjmt 3:b0a1b4b24d3c 107 u32_t magicnumber;
sfjmt 3:b0a1b4b24d3c 108 int numloops; /* Number of loops during magic number neg. */
sfjmt 3:b0a1b4b24d3c 109 u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
sfjmt 3:b0a1b4b24d3c 110 #ifdef PPP_MULTILINK
sfjmt 3:b0a1b4b24d3c 111 struct epdisc endpoint; /* endpoint discriminator */
sfjmt 3:b0a1b4b24d3c 112 #endif
sfjmt 3:b0a1b4b24d3c 113 } lcp_options;
sfjmt 3:b0a1b4b24d3c 114
sfjmt 3:b0a1b4b24d3c 115 /*
sfjmt 3:b0a1b4b24d3c 116 * Values for phase from BSD pppd.h based on RFC 1661.
sfjmt 3:b0a1b4b24d3c 117 */
sfjmt 3:b0a1b4b24d3c 118 typedef enum {
sfjmt 3:b0a1b4b24d3c 119 PHASE_DEAD = 0,
sfjmt 3:b0a1b4b24d3c 120 PHASE_INITIALIZE,
sfjmt 3:b0a1b4b24d3c 121 PHASE_ESTABLISH,
sfjmt 3:b0a1b4b24d3c 122 PHASE_AUTHENTICATE,
sfjmt 3:b0a1b4b24d3c 123 PHASE_CALLBACK,
sfjmt 3:b0a1b4b24d3c 124 PHASE_NETWORK,
sfjmt 3:b0a1b4b24d3c 125 PHASE_TERMINATE
sfjmt 3:b0a1b4b24d3c 126 } LinkPhase;
sfjmt 3:b0a1b4b24d3c 127
sfjmt 3:b0a1b4b24d3c 128
sfjmt 3:b0a1b4b24d3c 129
sfjmt 3:b0a1b4b24d3c 130 extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
sfjmt 3:b0a1b4b24d3c 131 extern lcp_options lcp_wantoptions[];
sfjmt 3:b0a1b4b24d3c 132 extern lcp_options lcp_gotoptions[];
sfjmt 3:b0a1b4b24d3c 133 extern lcp_options lcp_allowoptions[];
sfjmt 3:b0a1b4b24d3c 134 extern lcp_options lcp_hisoptions[];
sfjmt 3:b0a1b4b24d3c 135 extern ext_accm xmit_accm[];
sfjmt 3:b0a1b4b24d3c 136
sfjmt 3:b0a1b4b24d3c 137
sfjmt 3:b0a1b4b24d3c 138 void lcp_init (int);
sfjmt 3:b0a1b4b24d3c 139 void lcp_open (int);
sfjmt 3:b0a1b4b24d3c 140 void lcp_close (int, char *);
sfjmt 3:b0a1b4b24d3c 141 void lcp_lowerup (int);
sfjmt 3:b0a1b4b24d3c 142 void lcp_lowerdown(int);
sfjmt 3:b0a1b4b24d3c 143 void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
sfjmt 3:b0a1b4b24d3c 144
sfjmt 3:b0a1b4b24d3c 145 extern struct protent lcp_protent;
sfjmt 3:b0a1b4b24d3c 146
sfjmt 3:b0a1b4b24d3c 147 /* Default number of times we receive our magic number from the peer
sfjmt 3:b0a1b4b24d3c 148 before deciding the link is looped-back. */
sfjmt 3:b0a1b4b24d3c 149 #define DEFLOOPBACKFAIL 10
sfjmt 3:b0a1b4b24d3c 150
sfjmt 3:b0a1b4b24d3c 151 #endif /* LCP_H */