[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / um / drivers / slip_proto.h
blob7206361ace4501f8a438e7b9104e17225d9ccc3b
1 /*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #ifndef __UM_SLIP_PROTO_H__
7 #define __UM_SLIP_PROTO_H__
9 /* SLIP protocol characters. */
10 #define SLIP_END 0300 /* indicates end of frame */
11 #define SLIP_ESC 0333 /* indicates byte stuffing */
12 #define SLIP_ESC_END 0334 /* ESC ESC_END means END 'data' */
13 #define SLIP_ESC_ESC 0335 /* ESC ESC_ESC means ESC 'data' */
15 static inline int slip_unesc(unsigned char c,char *buf,int *pos, int *esc)
17 int ret;
19 switch(c){
20 case SLIP_END:
21 *esc = 0;
22 ret=*pos;
23 *pos=0;
24 return(ret);
25 case SLIP_ESC:
26 *esc = 1;
27 return(0);
28 case SLIP_ESC_ESC:
29 if(*esc){
30 *esc = 0;
31 c = SLIP_ESC;
33 break;
34 case SLIP_ESC_END:
35 if(*esc){
36 *esc = 0;
37 c = SLIP_END;
39 break;
41 buf[(*pos)++] = c;
42 return(0);
45 static inline int slip_esc(unsigned char *s, unsigned char *d, int len)
47 unsigned char *ptr = d;
48 unsigned char c;
51 * Send an initial END character to flush out any
52 * data that may have accumulated in the receiver
53 * due to line noise.
56 *ptr++ = SLIP_END;
59 * For each byte in the packet, send the appropriate
60 * character sequence, according to the SLIP protocol.
63 while (len-- > 0) {
64 switch(c = *s++) {
65 case SLIP_END:
66 *ptr++ = SLIP_ESC;
67 *ptr++ = SLIP_ESC_END;
68 break;
69 case SLIP_ESC:
70 *ptr++ = SLIP_ESC;
71 *ptr++ = SLIP_ESC_ESC;
72 break;
73 default:
74 *ptr++ = c;
75 break;
78 *ptr++ = SLIP_END;
79 return (ptr - d);
82 #endif
85 * Overrides for Emacs so that we follow Linus's tabbing style.
86 * Emacs will notice this stuff at the end of the file and automatically
87 * adjust the settings for this buffer only. This must remain at the end
88 * of the file.
89 * ---------------------------------------------------------------------------
90 * Local variables:
91 * c-file-style: "linux"
92 * End: