1 /* bootstd.h: Bootloader system call interface
3 * (c) 1999, Rt-Control, Inc.
9 #define NR_BSC 21 /* last used bootloader system call */
11 #define __BN_reset 0 /* reset and start the bootloader */
12 #define __BN_test 1 /* tests the system call interface */
13 #define __BN_exec 2 /* executes a bootloader image */
14 #define __BN_exit 3 /* terminates a bootloader image */
15 #define __BN_program 4 /* program FLASH from a chain */
16 #define __BN_erase 5 /* erase sector(s) of FLASH */
21 #define __BN_mmap 10 /* map a file descriptor into memory */
22 #define __BN_munmap 11 /* remove a file to memory mapping */
23 #define __BN_gethwaddr 12 /* get the hardware address of my interfaces */
24 #define __BN_getserialnum 13 /* get the serial number of this board */
25 #define __BN_getbenv 14 /* get a bootloader envvar */
26 #define __BN_setbenv 15 /* get a bootloader envvar */
27 #define __BN_setpmask 16 /* set the protection mask */
28 #define __BN_readenv 17 /* read environment variables */
29 #define __BN_flash_chattr_range 18
30 #define __BN_flash_erase_range 19
31 #define __BN_flash_write_range 20
33 /* Calling conventions compatible to (uC)linux/68k
34 * We use simmilar macros to call into the bootloader as for uClinux
37 #define __bsc_return(type, res) \
39 if ((unsigned long)(res) >= (unsigned long)(-64)) { \
40 /* let errno be a function, preserve res in %d0 */ \
48 #define _bsc0(type,name) \
51 register long __res __asm__ ("%d0") = __BN_##name; \
52 __asm__ __volatile__ ("trap #2" \
56 __bsc_return(type,__res); \
59 #define _bsc1(type,name,atype,a) \
62 register long __res __asm__ ("%d0") = __BN_##name; \
63 register long __a __asm__ ("%d1") = (long)a; \
64 __asm__ __volatile__ ("trap #2" \
66 : "0" (__res), "d" (__a) \
68 __bsc_return(type,__res); \
71 #define _bsc2(type,name,atype,a,btype,b) \
72 type name(atype a, btype b) \
74 register long __res __asm__ ("%d0") = __BN_##name; \
75 register long __a __asm__ ("%d1") = (long)a; \
76 register long __b __asm__ ("%d2") = (long)b; \
77 __asm__ __volatile__ ("trap #2" \
79 : "0" (__res), "d" (__a), "d" (__b) \
81 __bsc_return(type,__res); \
84 #define _bsc3(type,name,atype,a,btype,b,ctype,c) \
85 type name(atype a, btype b, ctype c) \
87 register long __res __asm__ ("%d0") = __BN_##name; \
88 register long __a __asm__ ("%d1") = (long)a; \
89 register long __b __asm__ ("%d2") = (long)b; \
90 register long __c __asm__ ("%d3") = (long)c; \
91 __asm__ __volatile__ ("trap #2" \
93 : "0" (__res), "d" (__a), "d" (__b), \
96 __bsc_return(type,__res); \
99 #define _bsc4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
100 type name(atype a, btype b, ctype c, dtype d) \
102 register long __res __asm__ ("%d0") = __BN_##name; \
103 register long __a __asm__ ("%d1") = (long)a; \
104 register long __b __asm__ ("%d2") = (long)b; \
105 register long __c __asm__ ("%d3") = (long)c; \
106 register long __d __asm__ ("%d4") = (long)d; \
107 __asm__ __volatile__ ("trap #2" \
109 : "0" (__res), "d" (__a), "d" (__b), \
110 "d" (__c), "d" (__d) \
112 __bsc_return(type,__res); \
115 #define _bsc5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
116 type name(atype a, btype b, ctype c, dtype d, etype e) \
118 register long __res __asm__ ("%d0") = __BN_##name; \
119 register long __a __asm__ ("%d1") = (long)a; \
120 register long __b __asm__ ("%d2") = (long)b; \
121 register long __c __asm__ ("%d3") = (long)c; \
122 register long __d __asm__ ("%d4") = (long)d; \
123 register long __e __asm__ ("%d5") = (long)e; \
124 __asm__ __volatile__ ("trap #2" \
126 : "0" (__res), "d" (__a), "d" (__b), \
127 "d" (__c), "d" (__d), "d" (__e) \
129 __bsc_return(type,__res); \
132 #endif /* __BOOTSTD_H__ */