Skip to content

Commit

Permalink
add endian.h for arm
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryjianjun committed May 18, 2011
1 parent 5bc2957 commit 68415e7
Show file tree
Hide file tree
Showing 23 changed files with 230 additions and 374 deletions.
28 changes: 28 additions & 0 deletions src/arch/arm/include/endian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef __ARM_ENDIAN_H__
#define __ARM_ENDIAN_H__

#define __LITTLE_ENDIAN

#if defined(__LITTLE_ENDIAN)
# undef __LITTLE_ENDIAN
# define __LITTLE_ENDIAN 1234
# define __BIG_ENDIAN 4321
# define __PDP_ENDIAN 3412
# define __BYTE_ORDER __LITTLE_ENDIAN
#elif defined(__BIG_ENDIAN)
# undef __BIG_ENDIAN
# define __LITTLE_ENDIAN 1234
# define __BIG_ENDIAN 4321
# define __PDP_ENDIAN 3412
# define __BYTE_ORDER __BIG_ENDIAN
#elif defined(__PDP_ENDIAN)
# undef __PDP_ENDIAN
# define __LITTLE_ENDIAN 1234
# define __BIG_ENDIAN 4321
# define __PDP_ENDIAN 3412
# define __BYTE_ORDER __PDP_ENDIAN
#else
# error "Unknown byte order!"
#endif

#endif /* __ARM_ENDIAN_H__ */
13 changes: 0 additions & 13 deletions src/arch/arm/mach-mid560/include/configs.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
#ifndef __CONFIGS_H__
#define __CONFIGS_H__

/*
* define the format of endian, little endian or big endian.
*/
#define __LITTLE_ENDIAN
#undef __BIG_ENDIAN

/*
* define the bits of system, 32bits or 64bits.
*/
#define __SYS_32BIT
#undef __SYS_64BIT

/*
* malloc heap size
*/
#define CONFIG_HEAP_SIZE (SZ_1M * 16)


#endif /* __CONFIGS_H__ */
32 changes: 16 additions & 16 deletions src/arch/arm/mach-mid560/mach-mid560.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ static struct machine mid560 = {
.res = {
.mem_banks = {
[0] = {
.start = (const void *)(0x50000000),
.end = (const void *)(0x50000000 + SZ_128M - 1),
.start = 0x50000000,
.end = 0x50000000 + SZ_128M - 1,
},

[1] = {
Expand All @@ -186,26 +186,26 @@ static struct machine mid560 = {
},

.link = {
.text_start = (const void *)__text_start,
.text_end = (const void *)__text_end,
.text_start = (const ptrdiff_t)__text_start,
.text_end = (const ptrdiff_t)__text_end,

.ramdisk_start = (const void *)__ramdisk_start,
.ramdisk_end = (const void *)__ramdisk_end,
.ramdisk_start = (const ptrdiff_t)__ramdisk_start,
.ramdisk_end = (const ptrdiff_t)__ramdisk_end,

.data_shadow_start = (const void *)__data_shadow_start,
.data_shadow_end = (const void *)__data_shadow_end,
.data_shadow_start = (const ptrdiff_t)__data_shadow_start,
.data_shadow_end = (const ptrdiff_t)__data_shadow_end,

.data_start = (const void *)__data_start,
.data_end = (const void *)__data_end,
.data_start = (const ptrdiff_t)__data_start,
.data_end = (const ptrdiff_t)__data_end,

.bss_start = (const void *)__bss_start,
.bss_end = (const void *)__bss_end,
.bss_start = (const ptrdiff_t)__bss_start,
.bss_end = (const ptrdiff_t)__bss_end,

.heap_start = (const void *)__heap_start,
.heap_end = (const void *)__heap_end,
.heap_start = (const ptrdiff_t)__heap_start,
.heap_end = (const ptrdiff_t)__heap_end,

.stack_start = (const void *)__stack_start,
.stack_end = (const void *)__stack_end,
.stack_start = (const ptrdiff_t)__stack_start,
.stack_end = (const ptrdiff_t)__stack_end,
},

.pm = {
Expand Down
13 changes: 0 additions & 13 deletions src/arch/arm/mach-mpad/include/configs.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
#ifndef __CONFIGS_H__
#define __CONFIGS_H__

/*
* define the format of endian, little endian or big endian.
*/
#define __LITTLE_ENDIAN
#undef __BIG_ENDIAN

/*
* define the bits of system, 32bits or 64bits.
*/
#define __SYS_32BIT
#undef __SYS_64BIT

/*
* define heap size
*/
#define CONFIG_HEAP_SIZE (SZ_128M)


#endif /* __CONFIGS_H__ */
36 changes: 18 additions & 18 deletions src/arch/arm/mach-mpad/mach-mpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ static struct machine mpad = {
.res = {
.mem_banks = {
[0] = {
.start = (void *)(0x30000000),
.end = (void *)(0x30000000 + SZ_256M - 1),
.start = 0x30000000,
.end = 0x30000000 + SZ_256M - 1,
},

[1] = {
.start = (void *)(0x40000000),
.end = (void *)(0x40000000 + SZ_256M - 1),
.start = 0x40000000,
.end = 0x40000000 + SZ_256M - 1,
},

[2] = {
Expand All @@ -190,26 +190,26 @@ static struct machine mpad = {
},

.link = {
.text_start = (const void *)__text_start,
.text_end = (const void *)__text_end,
.text_start = (const ptrdiff_t)__text_start,
.text_end = (const ptrdiff_t)__text_end,

.ramdisk_start = (const void *)__ramdisk_start,
.ramdisk_end = (const void *)__ramdisk_end,
.ramdisk_start = (const ptrdiff_t)__ramdisk_start,
.ramdisk_end = (const ptrdiff_t)__ramdisk_end,

.data_shadow_start = (const void *)__data_shadow_start,
.data_shadow_end = (const void *)__data_shadow_end,
.data_shadow_start = (const ptrdiff_t)__data_shadow_start,
.data_shadow_end = (const ptrdiff_t)__data_shadow_end,

.data_start = (const void *)__data_start,
.data_end = (const void *)__data_end,
.data_start = (const ptrdiff_t)__data_start,
.data_end = (const ptrdiff_t)__data_end,

.bss_start = (const void *)__bss_start,
.bss_end = (const void *)__bss_end,
.bss_start = (const ptrdiff_t)__bss_start,
.bss_end = (const ptrdiff_t)__bss_end,

.heap_start = (const void *)__heap_start,
.heap_end = (const void *)__heap_end,
.heap_start = (const ptrdiff_t)__heap_start,
.heap_end = (const ptrdiff_t)__heap_end,

.stack_start = (const void *)__stack_start,
.stack_end = (const void *)__stack_end,
.stack_start = (const ptrdiff_t)__stack_start,
.stack_end = (const ptrdiff_t)__stack_end,
},

.pm = {
Expand Down
15 changes: 1 addition & 14 deletions src/arch/arm/mach-realview/include/configs.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
#ifndef __CONFIGS_H__
#define __CONFIGS_H__

/*
* define the format of endian, little endian or big endian.
*/
#define __LITTLE_ENDIAN
#undef __BIG_ENDIAN

/*
* define the bits of system, 32bits or 64bits.
*/
#define __SYS_32BIT
#undef __SYS_64BIT

/*
* malloc heap size
*/
#define CONFIG_HEAP_SIZE (SZ_32M)

#define CONFIG_HEAP_SIZE (SZ_32M)

#endif /* __CONFIGS_H__ */
32 changes: 16 additions & 16 deletions src/arch/arm/mach-realview/mach-realview.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ static struct machine realview = {
.res = {
.mem_banks = {
[0] = {
.start = (void *)(0x00000000),
.end = (void *)(0x00000000 + SZ_128M - 1),
.start = 0x00000000,
.end = 0x00000000 + SZ_128M - 1,
},

[1] = {
Expand All @@ -143,26 +143,26 @@ static struct machine realview = {
},

.link = {
.text_start = (const void *)__text_start,
.text_end = (const void *)__text_end,
.text_start = (const ptrdiff_t)__text_start,
.text_end = (const ptrdiff_t)__text_end,

.ramdisk_start = (const void *)__ramdisk_start,
.ramdisk_end = (const void *)__ramdisk_end,
.ramdisk_start = (const ptrdiff_t)__ramdisk_start,
.ramdisk_end = (const ptrdiff_t)__ramdisk_end,

.data_shadow_start = (const void *)__data_shadow_start,
.data_shadow_end = (const void *)__data_shadow_end,
.data_shadow_start = (const ptrdiff_t)__data_shadow_start,
.data_shadow_end = (const ptrdiff_t)__data_shadow_end,

.data_start = (const void *)__data_start,
.data_end = (const void *)__data_end,
.data_start = (const ptrdiff_t)__data_start,
.data_end = (const ptrdiff_t)__data_end,

.bss_start = (const void *)__bss_start,
.bss_end = (const void *)__bss_end,
.bss_start = (const ptrdiff_t)__bss_start,
.bss_end = (const ptrdiff_t)__bss_end,

.heap_start = (const void *)__heap_start,
.heap_end = (const void *)__heap_end,
.heap_start = (const ptrdiff_t)__heap_start,
.heap_end = (const ptrdiff_t)__heap_end,

.stack_start = (const void *)__stack_start,
.stack_end = (const void *)__stack_end,
.stack_start = (const ptrdiff_t)__stack_start,
.stack_end = (const ptrdiff_t)__stack_end,
},

.pm = {
Expand Down
12 changes: 0 additions & 12 deletions src/arch/arm/mach-sbc2410x/include/configs.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
#ifndef __CONFIGS_H__
#define __CONFIGS_H__

/*
* define the format of endian, little endian or big endian.
*/
#define __LITTLE_ENDIAN
#undef __BIG_ENDIAN

/*
* define the bits of system, 32bits or 64bits.
*/
#define __SYS_32BIT
#undef __SYS_64BIT


#endif /* __CONFIGS_H__ */
7 changes: 3 additions & 4 deletions src/arch/arm/mach-sbc2410x/include/s3c2410/reg-iis.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
#define S3C2410_IISPSR (0x55000008)
#define S3C2410_IISFCON (0x5500000c)

#if defined(__LITTLE_ENDIAN)
#define S3C2410_IISFIFO (0x55000010)
#elif defined(__BIG_ENDIAN)
#if (__BYTE_ORDER == __BIG_ENDIAN)
#define S3C2410_IISFIFO (0x55000012)
#else
#define S3C2410_IISFIFO (0x55000010)
#endif


#endif /* __S3C2410_REG_IIS_H__ */
42 changes: 19 additions & 23 deletions src/arch/arm/mach-sbc2410x/include/s3c2410/reg-rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,7 @@

#include <xboot.h>

#if defined(__LITTLE_ENDIAN) /* little endian */

#define S3C2410_RTCCON (0x57000040)
#define S3C2410_TICNT (0x57000044)
#define S3C2410_RTCALM (0x57000050)
#define S3C2410_ALMSEC (0x57000054)
#define S3C2410_ALMMIN (0x57000058)
#define S3C2410_ALMHOUR (0x5700005c)
#define S3C2410_ALMDATE (0x57000060)
#define S3C2410_ALMMON (0x57000064)
#define S3C2410_ALMYEAR (0x57000068)
#define S3C2410_RTCRST (0x5700006c)
#define S3C2410_BCDSEC (0x57000070)
#define S3C2410_BCDMIN (0x57000074)
#define S3C2410_BCDHOUR (0x57000078)
#define S3C2410_BCDDATE (0x5700007c)
#define S3C2410_BCDDAY (0x57000080)
#define S3C2410_BCDMON (0x57000084)
#define S3C2410_BCDYEAR (0x57000088)

#elif defined(__BIG_ENDIAN) /* big endian */

#if (__BYTE_ORDER == __BIG_ENDIAN)
#define S3C2410_RTCCON (0x57000043)
#define S3C2410_TICNT (0x57000047)
#define S3C2410_RTCALM (0x57000053)
Expand All @@ -42,7 +21,24 @@
#define S3C2410_BCDDAY (0x57000083)
#define S3C2410_BCDMON (0x57000087)
#define S3C2410_BCDYEAR (0x5700008b)

#else
#define S3C2410_RTCCON (0x57000040)
#define S3C2410_TICNT (0x57000044)
#define S3C2410_RTCALM (0x57000050)
#define S3C2410_ALMSEC (0x57000054)
#define S3C2410_ALMMIN (0x57000058)
#define S3C2410_ALMHOUR (0x5700005c)
#define S3C2410_ALMDATE (0x57000060)
#define S3C2410_ALMMON (0x57000064)
#define S3C2410_ALMYEAR (0x57000068)
#define S3C2410_RTCRST (0x5700006c)
#define S3C2410_BCDSEC (0x57000070)
#define S3C2410_BCDMIN (0x57000074)
#define S3C2410_BCDHOUR (0x57000078)
#define S3C2410_BCDDATE (0x5700007c)
#define S3C2410_BCDDAY (0x57000080)
#define S3C2410_BCDMON (0x57000084)
#define S3C2410_BCDYEAR (0x57000088)
#endif

#endif /* __S3C2410_REG_RTC_H__ */
6 changes: 3 additions & 3 deletions src/arch/arm/mach-sbc2410x/include/s3c2410/reg-sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#define S3C2410_SDIFSTA (0x5a000038)
#define S3C2410_SDIIMSK (0x5a000040)

#if defined(__LITTLE_ENDIAN)
#define S3C2410_SDIDAT (0x5a00003c)
#elif defined(__BIG_ENDIAN)
#if (__BYTE_ORDER == __BIG_ENDIAN)
#define S3C2410_SDIDAT (0x5a00003f)
#else
#define S3C2410_SDIDAT (0x5a00003c)
#endif


Expand Down
Loading

0 comments on commit 68415e7

Please sign in to comment.