Don't duplicate byteswap code. Invent system where NEED_GENERIC_BYTESWAPS is set...
[kugel-rb.git] / firmware / target / mips / ingenic_jz47xx / system-target.h
blobcaf1733158aea2e8d170322a372d65fa37642927
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Maurus Cuelenaere
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef __SYSTEM_TARGET_H_
23 #define __SYSTEM_TARGET_H_
25 #include <inttypes.h>
27 #include "config.h"
28 #include "jz4740.h"
29 #include "mipsregs.h"
31 #define CACHE_SIZE 16*1024
32 #define CACHE_LINE_SIZE 32
33 #include "mmu-mips.h"
35 /* no optimized byteswap functions implemented for mips, yet */
36 #define NEED_GENERIC_BYTESWAPS
38 /* This one returns the old status */
39 static inline int set_interrupt_status(int status, int mask)
41 unsigned int res, oldstatus;
43 res = oldstatus = read_c0_status();
44 res &= ~mask;
45 res |= (status & mask);
46 write_c0_status(res);
48 return oldstatus;
51 static inline void enable_interrupt(void)
53 /* Set IE bit */
54 set_c0_status(ST0_IE);
57 static inline void disable_interrupt(void)
59 /* Clear IE bit */
60 clear_c0_status(ST0_IE);
63 static inline int disable_interrupt_save(int mask)
65 return set_interrupt_status(0, mask);
68 static inline void restore_interrupt(int status)
70 write_c0_status(status);
73 #define disable_irq() disable_interrupt()
74 #define enable_irq() enable_interrupt()
75 #define HIGHEST_IRQ_LEVEL 0
76 #define set_irq_level(status) set_interrupt_status((status), ST0_IE)
77 #define disable_irq_save() disable_interrupt_save(ST0_IE)
78 #define restore_irq(c0_status) restore_interrupt(c0_status)
79 #define UNCACHED_ADDRESS(addr) ((unsigned int)(addr) | 0xA0000000)
80 #define UNCACHED_ADDR(x) UNCACHED_ADDRESS((x))
81 #define PHYSADDR(x) ((x) & 0x1fffffff)
83 void system_enable_irq(unsigned int irq);
84 void udelay(unsigned int usec);
85 void mdelay(unsigned int msec);
86 void dma_enable(void);
87 void dma_disable(void);
89 #define DMA_AIC_TX_CHANNEL 0
90 #define DMA_NAND_CHANNEL 1
91 #define DMA_USB_CHANNEL 2
92 #define DMA_LCD_CHANNEL 3
94 #define XDMA_CALLBACK(n) DMA ## n
95 #define DMA_CALLBACK(n) XDMA_CALLBACK(n)
97 #define DMA_IRQ(n) (IRQ_DMA_0 + (n))
98 #define GPIO_IRQ(n) (IRQ_GPIO_0 + (n))
100 #endif /* __SYSTEM_TARGET_H_ */