| /* --COPYRIGHT--,EPL |
| * Copyright (c) 2008-2020 Texas Instruments Incorporated |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Texas Instruments - initial implementation |
| * |
| * --/COPYRIGHT--*/ |
| %var q = "`"; |
| /*! @_nodoc |
| * ======== ScalarStructs ======== |
| * Structures used to read scalar types from an arbitrary address |
| * |
| * The first field of a structure is guarenteed to be at |
| * a zero offset from the address of the structure itself. |
| * |
| * From C99 Section 6.7.2.1 bullet point 13: |
| * @p(blist) |
| * - Within a structure object, the non-bit-field members and the units in |
| * which bit-fields reside have addresses that increase in the order in |
| * which they are declared. A pointer to a structure object, suitably |
| * converted, points to its initial member (or if that member is a bit-field, |
| * then to the unit in which it resides), and vice versa. There may be |
| * unnamed padding within a structure object, but not at its beginning. |
| * @p |
| * |
| * As a result, it's possible to use the structures below together with |
| * `q`Program.fetchStruct()`q` to fetch scalar values; e.g., the following can |
| * be used to read a 32-bit value from address `q`addr`q`: |
| * |
| * @p(code) |
| * var v; // value located at address specified by addr |
| * v = Program.fetchStruct(ScalarStructs.S_Bits32$fetchDesc, addr, false) |
| * @p |
| */ |
| module ScalarStructs { |
| |
| %for (var i = 0; i < $args.length; i++) { |
| %var T = $args[i]; |
| /*! @_nodoc */ |
| struct S_`T` { |
| `T` elem; |
| }; |
| |
| %} |
| } |