140f73875eeea12307ab4f9a481109feb5ca0137
1 /*!**************************************************************************
5 *! IO_STATE(reg,field,state)
6 *! IO_EXTRACT(reg,field,val)
7 *! IO_STATE_VALUE(reg,field,state)
10 *! IO_FIELD(reg,field,val)
12 *! All moderegister addresses and fields of these.
14 *!**************************************************************************/
16 #ifndef __sv_addr_ag_h__
17 #define __sv_addr_ag_h__
20 #define __test_sv_addr__ 0
22 /*------------------------------------------------------------
23 !* General macros to manipulate moderegisters.
24 !*-----------------------------------------------------------*/
26 /* IO_MASK returns a mask for a specified bitfield in a register.
27 Note that this macro doesn't work when field width is 32 bits. */
28 #define IO_MASK(reg, field) IO_MASK_ (reg##_, field##_)
29 #define IO_MASK_(reg_, field_) \
30 ( ( ( 1 << reg_##_##field_##_WIDTH ) - 1 ) << reg_##_##field_##_BITNR )
32 /* IO_STATE returns a constant corresponding to a one of the symbolic
33 states that the bitfield can have. (Shifted to correct position) */
34 #define IO_STATE(reg, field, state) IO_STATE_ (reg##_, field##_, _##state)
35 #define IO_STATE_(reg_, field_, _state) \
36 ( reg_##_##field_##_state << reg_##_##field_##_BITNR )
38 /* IO_EXTRACT returns the masked and shifted value corresponding to the
40 #define IO_EXTRACT(reg, field, val) IO_EXTRACT_ (reg##_, field##_, val)
41 #define IO_EXTRACT_(reg_, field_, val) ( (( ( ( 1 << reg_##_##field_##_WIDTH ) \
42 - 1 ) << reg_##_##field_##_BITNR ) & (val)) >> reg_##_##field_##_BITNR )
44 /* IO_STATE_VALUE returns a constant corresponding to a one of the symbolic
45 states that the bitfield can have. (Not shifted) */
46 #define IO_STATE_VALUE(reg, field, state) \
47 IO_STATE_VALUE_ (reg##_, field##_, _##state)
48 #define IO_STATE_VALUE_(reg_, field_, _state) ( reg_##_##field_##_state )
50 /* IO_FIELD shifts the val parameter to be aligned with the bitfield
52 #define IO_FIELD(reg, field, val) IO_FIELD_ (reg##_, field##_, val)
53 #define IO_FIELD_(reg_, field_, val) ((val) << reg_##_##field_##_BITNR)
55 /* IO_BITNR returns the starting bitnumber of a bitfield. Bit 0 is
56 LSB and the returned bitnumber is LSB of the field. */
57 #define IO_BITNR(reg, field) IO_BITNR_ (reg##_, field##_)
58 #define IO_BITNR_(reg_, field_) (reg_##_##field_##_BITNR)
60 /* IO_WIDTH returns the width, in bits, of a bitfield. */
61 #define IO_WIDTH(reg, field) IO_WIDTH_ (reg##_, field##_)
62 #define IO_WIDTH_(reg_, field_) (reg_##_##field_##_WIDTH)
64 /*--- Obsolete. Kept for backw compatibility. ---*/
65 /* Reads (or writes) a byte/uword/udword from the specified mode
67 #define IO_RD(reg) (*(volatile udword*)(reg))
68 #define IO_RD_B(reg) (*(volatile byte*)(reg))
69 #define IO_RD_W(reg) (*(volatile uword*)(reg))
70 #define IO_RD_D(reg) (*(volatile udword*)(reg))
72 /*------------------------------------------------------------
73 !* Start addresses of the different memory areas.
74 !*-----------------------------------------------------------*/
76 #define MEM_CSE0_START (0x00000000)
77 #define MEM_CSE1_START (0x04000000)
78 #define MEM_CSR0_START (0x08000000)
79 #define MEM_CSR1_START (0x0c000000)
80 #define MEM_CSP0_START (0x10000000)
81 #define MEM_CSP1_START (0x14000000)
82 #define MEM_CSP2_START (0x18000000)
83 #define MEM_CSP3_START (0x1c000000)
84 #define MEM_CSP4_START (0x20000000)
85 #define MEM_CSP5_START (0x24000000)
86 #define MEM_CSP6_START (0x28000000)
87 #define MEM_CSP7_START (0x2c000000)
88 #define MEM_DRAM_START (0x40000000)
90 #define MEM_NON_CACHEABLE (0x80000000)
92 /*------------------------------------------------------------
93 !* Type casts used in mode register macros, making pointer
94 !* dereferencing possible. Empty in assembler.
95 !*-----------------------------------------------------------*/
98 # define IO_TYPECAST_UDWORD (volatile udword*)
99 # define IO_TYPECAST_RO_UDWORD (const volatile udword*)
100 # define IO_TYPECAST_UWORD (volatile uword*)
101 # define IO_TYPECAST_RO_UWORD (const volatile uword*)
102 # define IO_TYPECAST_BYTE (volatile byte*)
103 # define IO_TYPECAST_RO_BYTE (const volatile byte*)
105 # define IO_TYPECAST_UDWORD
106 # define IO_TYPECAST_RO_UDWORD
107 # define IO_TYPECAST_UWORD
108 # define IO_TYPECAST_RO_UWORD
109 # define IO_TYPECAST_BYTE
110 # define IO_TYPECAST_RO_BYTE
113 /*------------------------------------------------------------*/
115 #include "sv_addr.agh"
118 /* IO_MASK( R_BUS_CONFIG , CE ) */
119 IO_MASK( R_WAITSTATES
, SRAM_WS
)
120 IO_MASK( R_TEST
, W32
)
122 IO_STATE( R_BUS_CONFIG
, CE
, DISABLE
)
123 IO_STATE( R_BUS_CONFIG
, CE
, ENABLE
)
125 IO_STATE( R_DRAM_TIMING
, REF
, IVAL2
)
127 IO_MASK( R_DRAM_TIMING
, REF
)
129 IO_MASK( R_EXT_DMA_0_STAT
, TFR_COUNT
) >> IO_BITNR( R_EXT_DMA_0_STAT
, TFR_COUNT
)
131 IO_RD(R_EXT_DMA_0_STAT
) & IO_MASK( R_EXT_DMA_0_STAT
, S
)
132 == IO_STATE( R_EXT_DMA_0_STAT
, S
, STARTED
)
136 #endif /* ifndef __sv_addr_ag_h__ */
This page took 0.049616 seconds and 3 git commands to generate.