source: SVN/rincon/u-boot/board/xilinx/ml300/sw_services/uboot_v1_00_a/data/Ltypes @ 55

Last change on this file since 55 was 55, checked in by Tim Harvey, 22 months ago

rincon: added latest u-boot source

restored form server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 1.6 KB
Line 
1#!/bin/bash
2
3if [ $# -ne 1 ]
4then
5    echo "usage: Ltypes filename" >&2
6    exit 2
7fi
8
9FILE="$1"
10#TMPFILE='mktemp "${FILE}.XXXXXX"' || exit 1
11TMPFILE=${FILE}.`date "+%s"`
12touch $TMPFILE || exit 1
13
14# Change all the Xilinx types to Linux types and put the result into a temp file
15sed     \
16        -e 's/\bXTRUE\b/TRUE/g' \
17        -e 's/\bXFALSE\b/FALSE/g' \
18        -e 's/\bXNULL\b/NULL/g' \
19        -e 's/"xenv.h"/<asm\/delay.h>/g' \
20        -e 's/\bXENV_USLEEP\b/udelay/g' \
21        -e 's/\bXuint8\b/u8/g' \
22        -e 's/\bXuint16\b/u16/g' \
23        -e 's/\bXuint32\b/u32/g' \
24        -e 's/\bXint8\b/s8/g' \
25        -e 's/\bXint16\b/s16/g' \
26        -e 's/\bXint32\b/s32/g' \
27        -e 's/\bXboolean\b/u32/g' \
28        "${FILE}" > "${TMPFILE}"
29
30# Overlay the original file with the temp file
31mv "${TMPFILE}" "${FILE}"
32
33# Are we doing xbasic_types.h?
34if [ "${FILE##*/}" = xbasic_types.h ]
35then
36    # Remember as you're reading this that we've already gone through the prior
37    # sed script.  We need to do some other things to xbasic_types.h:
38    #   1) Add ifndefs around TRUE and FALSE defines
39    #   2) Remove definition of NULL as NULL
40    #   3) Replace most of the primitive types section with a #include
41    sed \
42        -e '/u32 true/,/#define false/Ic\
43#ifndef TRUE\
44#define TRUE 1\
45#endif\
46#ifndef FALSE\
47#define FALSE 0\
48#endif' \
49        -e '/#define[[:space:]][[:space:]]*NULL[[:space:]][[:space:]]*NULL/d' \
50        -e '/typedef[[:space:]][[:space:]]*unsigned[[:space:]][[:space:]]*char[[:space:]][[:space:]]*u8/,/typedef[[:space:]][[:space:]]*unsigned[[:space:]][[:space:]]*long[[:space:]][[:space:]]*u32.*boolean/c\
51#include <linux/types.h>' \
52        "${FILE}" > "${TMPFILE}"
53
54    mv "${TMPFILE}" "${FILE}"
55fi
Note: See TracBrowser for help on using the repository browser.