xref: /titanic_41/usr/src/uts/common/io/cardbus/cardbus_parse.h (revision 3db86aab554edbb4244c8d1a1c90f152eee768af)
1*3db86aabSstevel /*
2*3db86aabSstevel  * CDDL HEADER START
3*3db86aabSstevel  *
4*3db86aabSstevel  * The contents of this file are subject to the terms of the
5*3db86aabSstevel  * Common Development and Distribution License (the "License").
6*3db86aabSstevel  * You may not use this file except in compliance with the License.
7*3db86aabSstevel  *
8*3db86aabSstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3db86aabSstevel  * or http://www.opensolaris.org/os/licensing.
10*3db86aabSstevel  * See the License for the specific language governing permissions
11*3db86aabSstevel  * and limitations under the License.
12*3db86aabSstevel  *
13*3db86aabSstevel  * When distributing Covered Code, include this CDDL HEADER in each
14*3db86aabSstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3db86aabSstevel  * If applicable, add the following below this CDDL HEADER, with the
16*3db86aabSstevel  * fields enclosed by brackets "[]" replaced with your own identifying
17*3db86aabSstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3db86aabSstevel  *
19*3db86aabSstevel  * CDDL HEADER END
20*3db86aabSstevel  */
21*3db86aabSstevel /*
22*3db86aabSstevel  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*3db86aabSstevel  * Use is subject to license terms.
24*3db86aabSstevel  */
25*3db86aabSstevel /*
26*3db86aabSstevel  * Copyright (c)  * Copyright (c) 2001 Tadpole Technology plc
27*3db86aabSstevel  * All rights reserved.
28*3db86aabSstevel  */
29*3db86aabSstevel 
30*3db86aabSstevel #ifndef	_SYS_CARDBUS_IMPL_H
31*3db86aabSstevel #define	_SYS_CARDBUS_IMPL_H
32*3db86aabSstevel 
33*3db86aabSstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*3db86aabSstevel 
35*3db86aabSstevel #ifdef  __cplusplus
36*3db86aabSstevel extern "C" {
37*3db86aabSstevel #endif
38*3db86aabSstevel 
39*3db86aabSstevel /*
40*3db86aabSstevel  * Device property initialization structures and defines
41*3db86aabSstevel  */
42*3db86aabSstevel struct cb_deviceset_props {
43*3db86aabSstevel 	struct cb_deviceset_props *next;
44*3db86aabSstevel 	char	*binding_name;
45*3db86aabSstevel 	uint16_t	venid;
46*3db86aabSstevel 	uint16_t	devid;
47*3db86aabSstevel 	char	*nodename;
48*3db86aabSstevel 	ddi_prop_t	*prop_list;
49*3db86aabSstevel };
50*3db86aabSstevel 
51*3db86aabSstevel typedef struct {
52*3db86aabSstevel 	char	*token;	/* token to look for */
53*3db86aabSstevel 	int	state;	/* state machine state */
54*3db86aabSstevel } cb_props_parse_tree_t;
55*3db86aabSstevel 
56*3db86aabSstevel #define	PARSE_QUOTE		'\''
57*3db86aabSstevel #define	PARSE_COMMENT		'#'
58*3db86aabSstevel #define	PARSE_ESCAPE		'\\'
59*3db86aabSstevel #define	PARSE_UNDERSCORE	'_'
60*3db86aabSstevel #define	PARSE_DASH		'-'
61*3db86aabSstevel #define	PARSE_SEMICOLON		';'
62*3db86aabSstevel #define	PARSE_COMMA		','
63*3db86aabSstevel #define	PARSE_EQUALS		'='
64*3db86aabSstevel 
65*3db86aabSstevel /*
66*3db86aabSstevel  * state defines for the valued variable state machine
67*3db86aabSstevel  */
68*3db86aabSstevel #define	PT_STATE_UNKNOWN	0
69*3db86aabSstevel #define	PT_STATE_TOKEN		1
70*3db86aabSstevel #define	PT_STATE_STRING_VAR	2
71*3db86aabSstevel #define	PT_STATE_HEX_VAR	3
72*3db86aabSstevel #define	PT_STATE_DEC_VAR	4
73*3db86aabSstevel #define	PT_STATE_ESCAPE		5
74*3db86aabSstevel #define	PT_STATE_CHECK		6
75*3db86aabSstevel 
76*3db86aabSstevel #undef	isalpha
77*3db86aabSstevel #undef	isxdigit
78*3db86aabSstevel #undef	ixdigit
79*3db86aabSstevel #undef	toupper
80*3db86aabSstevel 
81*3db86aabSstevel #define	isalpha(ch)	(((ch) >= 'a' && (ch) <= 'z') || \
82*3db86aabSstevel 			((ch) >= 'A' && (ch) <= 'Z'))
83*3db86aabSstevel #define	isxdigit(ch)	(isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \
84*3db86aabSstevel 			((ch) >= 'A' && (ch) <= 'F'))
85*3db86aabSstevel #define	isx(ch)		((ch) == 'x' || (ch) == 'X')
86*3db86aabSstevel #define	isdigit(ch)	((ch) >= '0' && (ch) <= '9')
87*3db86aabSstevel #define	toupper(C)	(((C) >= 'a' && (C) <= 'z')? (C) - 'a' + 'A': (C))
88*3db86aabSstevel 
89*3db86aabSstevel #ifdef  __cplusplus
90*3db86aabSstevel }
91*3db86aabSstevel #endif
92*3db86aabSstevel 
93*3db86aabSstevel #endif	/* _SYS_CARDBUS_IMPL_H */
94