GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / arch / arm / board / bcm947xx / src / platform.c
blobeb9cefede70b73fe5b7e1540472ac3618266f266
1 /*
2 ** Copyright 2000, 2001 Broadcom Corporation
3 ** All Rights Reserved
4 **
5 ** No portions of this material may be reproduced in any form
6 ** without the written permission of:
7 **
8 ** Broadcom Corporation
9 ** 5300 California Avenue
10 ** Irvine, California 92617
12 ** All information contained in this document is Broadcom
13 ** Corporation company private proprietary, and trade secret.
15 ** ----------------------------------------------------------
17 **
19 ** $Id:: $:
20 ** $Rev::file = : Global SVN Revision = 1780 $:
24 /* platform.c
26 * Use those header files for the northstar build
29 #include <typedefs.h>
30 #include <bcmdefs.h>
31 #include <osl.h>
32 #include <bcmutils.h>
33 #include <ddr_core.h>
35 #include <platform.h>
37 #define CACHE_LINE_SIZE (32)
39 void flush_dcache_range(unsigned long start, unsigned long stop)
41 unsigned long i;
43 for (i = start; i < stop; i += CACHE_LINE_SIZE) {
44 asm volatile("MCR p15, 0, %0, c7, c10, 1"::"r"(i));
46 asm volatile("MCR p15, 0, r0, c7, c10, 4":::); /* DSB */
49 void invalidate_dcache_range(unsigned long start, unsigned long stop)
51 unsigned long i;
53 for (i = start; i < stop; i += CACHE_LINE_SIZE) {
54 asm volatile("MCR p15, 0, %0, c7, c6, 1"::"r"(i));
57 asm volatile("MCR p15, 0, r0, c7, c10, 4":::); /* DSB */
60 void SHMOO_FLUSH_DATA_TO_DRAM(ddr40_addr_t Address, unsigned int bytes)
62 unsigned long const EndAddress = Address + bytes;
63 flush_dcache_range(Address, EndAddress);
66 void SHMOO_INVALIDATE_DATA_FROM_DRAM(ddr40_addr_t Address, unsigned int bytes)
68 unsigned long const EndAddress = Address + bytes;
69 invalidate_dcache_range(Address, EndAddress);
72 void UART_OUT(unsigned int val)
74 printf("%c", val);
77 void plot_dec_number(unsigned int val)
79 printf("%08d", val);
82 void plot_hex_number(unsigned int val)
84 printf("%08X", val);
87 unsigned int tb_r(ddr40_addr_t Address)
89 unsigned int const Data = *(unsigned int *)Address;
91 return Data;
94 void tb_w(ddr40_addr_t Address, unsigned int Data)
96 *(unsigned int *)Address = Data;
99 unsigned int SHMOO_DRAM_READ_32(ddr40_addr_t Address)
101 return (*(unsigned int *)Address);
104 void SHMOO_DRAM_WRITE_32(ddr40_addr_t Address, unsigned int Data)
106 *(unsigned int *)Address = Data;
109 int rewrite_dram_mode_regs(void *sih)
111 return rewrite_mode_registers(sih);
115 * Functions for the PHY init
117 void PrintfLog(char * const ptFormatStr, ...)
119 char __tmp_buf[128] = {'L', 'o', 'g', ':', ' '};
120 va_list arg;
122 va_start(arg, ptFormatStr);
123 vsprintf(&__tmp_buf[5], ptFormatStr, arg);
124 va_end(arg);
126 printf(__tmp_buf);
129 void PrintfErr(char * const ptFormatStr, ...)
131 char __tmp_buf[128] = {'E', 'r', 'r', 'o', 'r', ':', ' '};
132 va_list arg;
134 va_start(arg, ptFormatStr);
135 vsprintf(&__tmp_buf[7], ptFormatStr, arg);
136 va_end(arg);
138 printf(__tmp_buf);
141 void PrintfFatal(char * const ptFormatStr, ...)
143 char __tmp_buf[128] = {'F', 'a', 't', 'a', 'l', ':', ' '};
144 va_list arg;
146 va_start(arg, ptFormatStr);
147 vsprintf(&__tmp_buf[7], ptFormatStr, arg);
148 va_end(arg);
150 printf(__tmp_buf);