5 echo "usage: Ltypes filename" >&2
10 #TMPFILE='mktemp "${FILE}.XXXXXX"' || exit 1
11 TMPFILE=${FILE}.`date "+%s"`
12 touch $TMPFILE || exit 1
14 # Change all the Xilinx types to Linux types and put the result into a temp file
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}"
30 # Overlay the original file with the temp file
31 mv "${TMPFILE}" "${FILE}"
33 # Are we doing xbasic_types.h?
34 if [ "${FILE##*/}" = xbasic_types.h ]
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
42 -e '/u32 true/,/#define false/Ic\
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}"
54 mv "${TMPFILE}" "${FILE}"