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 Integer to BCD 33 * Convert BCD To Integer 34 */ 35 36// 32-bit 37Name(p352, Package() 38{ 39 0, 40 1, 41 12, 42 345, 43 6789, 44 12345, 45 678901, 46 2345678, 47 90123456, 48 99999999, 49 0xff, 50 0xffff, 51}) 52 53Name(p353, Package() 54{ 55 0x0, 56 0x1, 57 0x12, 58 0x345, 59 0x6789, 60 0x12345, 61 0x678901, 62 0x2345678, 63 0x90123456, 64 0x99999999, 65 0x255, 66 0x65535, 67}) 68 69// 64-bit 70Name(p354, Package() 71{ 72 512346789, 73 9999999999, 74 10000000000, 75 30123456790, 76 123456789012, 77 3456789012345, 78 26789012346789, 79 123456789012345, 80 3789012345678901, 81 9999999999999999, 82}) 83 84Name(p355, Package() 85{ 86 0x512346789, 87 0x9999999999, 88 0x10000000000, 89 0x30123456790, 90 0x123456789012, 91 0x3456789012345, 92 0x26789012346789, 93 0x123456789012345, 94 0x3789012345678901, 95 0x9999999999999999, 96}) 97 98Method(BCD1,, Serialized) 99{ 100 Name(ts, "BCD1") 101 102 Store("TEST: BCD1, Convert Integer to BCD", Debug) 103 104 if (LEqual(F64, 1)) { 105 m302(ts, 12, "p352", p352, p353, 5) 106 m302(ts, 10, "p354", p354, p355, 5) 107 } else { 108 m302(ts, 12, "p352", p352, p353, 5) 109 } 110} 111 112Method(BCD2,, Serialized) 113{ 114 Name(ts, "BCD2") 115 116 Store("TEST: BCD2, Convert BCD To Integer", Debug) 117 118 if (LEqual(F64, 1)) { 119 m302(ts, 12, "p353", p353, p352, 6) 120 m302(ts, 10, "p355", p355, p354, 6) 121 } else { 122 m302(ts, 12, "p353", p353, p352, 6) 123 } 124} 125 126// Run-method 127Method(BCD0) 128{ 129 BCD1() 130 BCD2() 131}