• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/acpica/tests/aslts/src/runtime/collections/functional/manipulation/
1/*
2 * Some or all of this work - Copyright (c) 2006 - 2016, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * Data type conversion and manipulation
31 *
32 * Convert Data to Hexadecimal String
33 */
34
35// Integer
36
37// 32-bit
38Name(p346, Package()
39{
40	0,
41	0x1,
42	0x83,
43	0x456,
44	0x8232,
45	0xbcdef,
46	0x123456,
47	0x789abcd,
48	0xffffffff,
49	0x1234567,
50	0xff,
51	0xffff,
52})
53
54Name(p347, Package()
55{
56	"00000000",
57	"00000001",
58	"00000083",
59	"00000456",
60	"00008232",
61	"000BCDEF",
62	"00123456",
63	"0789ABCD",
64	"FFFFFFFF",
65	"01234567",
66	"000000FF",
67	"0000FFFF",
68})
69
70// 64-bit
71Name(p348, Package()
72{
73	0,
74	0x1,
75	0x83,
76	0x456,
77	0x8232,
78	0xbcdef,
79	0x123456,
80	0x789abcd,
81	0xffffffff,
82	0x1234567,
83	0xff,
84	0xffff,
85	0x123456789,
86	0x8123456789,
87	0xabcdef01234,
88	0x876543210abc,
89	0x1234567abcdef,
90	0x8234567abcdef1,
91	0x6789abcdef01234,
92	0x76543201f89abcde,
93	0xf89abcde76543201,
94	0xffffffffffffffff,
95	0x0123456789abcdef,
96})
97
98Name(p349, Package()
99{
100	"0000000000000000",
101	"0000000000000001",
102	"0000000000000083",
103	"0000000000000456",
104	"0000000000008232",
105	"00000000000BCDEF",
106	"0000000000123456",
107	"000000000789ABCD",
108	"00000000FFFFFFFF",
109	"0000000001234567",
110	"00000000000000FF",
111	"000000000000FFFF",
112	"0000000123456789",
113	"0000008123456789",
114	"00000ABCDEF01234",
115	"0000876543210ABC",
116	"0001234567ABCDEF",
117	"008234567ABCDEF1",
118	"06789ABCDEF01234",
119	"76543201F89ABCDE",
120	"F89ABCDE76543201",
121	"FFFFFFFFFFFFFFFF",
122	"0123456789ABCDEF",
123})
124
125// Buffer
126Name(p350, Package()
127{
128	Buffer(9) {},
129	Buffer() {9, 7, 5, 3},
130	Buffer(1) {1},
131	Buffer(4) {1,  2,  3,  4},
132	Buffer(8) {1,  2,  3,  4,  5,  6,  7,  8},
133	Buffer(16) {
134		  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16},
135
136	Buffer(55) {
137		202,203,204,205,206,207,208,
138		209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,
139		225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,
140		241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,  0},
141
142	// All buffers below result in 200 characters strings
143
144	Buffer(67) {
145		  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
146		 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
147		 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
148		 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
149		 65, 66, 67},
150	Buffer(67) {
151		 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
152		 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
153		 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,
154		113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,
155		129,130,131,132,133,134},
156	Buffer(67) {
157		135,136,137,138,139,140,141,142,143,144,
158		145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,
159		161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,
160		177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,
161		193,194,195,196,197,198,199,200,201},
162})
163
164Name(p351, Package()
165{
166	"00,00,00,00,00,00,00,00,00",
167	"09,07,05,03",
168	"01",
169	"01,02,03,04",
170	"01,02,03,04,05,06,07,08",
171	"01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,10",
172	"CA,CB,CC,CD,CE,CF,D0,D1,D2,D3,D4,D5,D6,D7,D8,D9,DA,DB,DC,DD,DE,DF,E0,E1,E2,E3,E4,E5,E6,E7,E8,E9,EA,EB,EC,ED,EE,EF,F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,FA,FB,FC,FD,FE,FF,00",
173	"01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20,21,22,23,24,25,26,27,28,29,2A,2B,2C,2D,2E,2F,30,31,32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,3F,40,41,42,43",
174	"44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A,5B,5C,5D,5E,5F,60,61,62,63,64,65,66,67,68,69,6A,6B,6C,6D,6E,6F,70,71,72,73,74,75,76,77,78,79,7A,7B,7C,7D,7E,7F,80,81,82,83,84,85,86",
175	"87,88,89,8A,8B,8C,8D,8E,8F,90,91,92,93,94,95,96,97,98,99,9A,9B,9C,9D,9E,9F,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,BA,BB,BC,BD,BE,BF,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9",
176})
177
178// Run-method
179Method(TOH0,, Serialized)
180{
181	Name(ts, "TOH0")
182
183	Store("TEST: TOH0, Convert Data to Hexadecimal String", Debug)
184
185	// From integer
186	if (LEqual(F64, 1)) {
187		m302(ts, 23, "p348", p348, p349, 4)
188	} else {
189		m302(ts, 12, "p346", p346, p347, 4)
190	}
191
192	// From string
193	m302(ts, 6, "p344", p344, p344, 4)
194
195	// From buffer
196	m302(ts, 10, "p350", p350, p351, 4)
197}
198