35 lines
891 B
Haskell
35 lines
891 B
Haskell
package ServerMap(
|
|
ramServerStart,
|
|
ramServerEnd,
|
|
uartServerStart,
|
|
uartServerEnd,
|
|
serverMap
|
|
) where
|
|
|
|
import Types
|
|
import BusTypes
|
|
|
|
bytesInRam :: Types.Addr
|
|
bytesInRam = 1024
|
|
|
|
-- number of servers currently supported by this bus map
|
|
type NumServers = 2
|
|
|
|
ramServerStart :: Types.Addr
|
|
ramServerStart = 0x80000000
|
|
ramServerEnd :: Types.Addr
|
|
ramServerEnd = ramServerStart + (bytesInRam - 1)
|
|
|
|
uartServerStart :: Types.Addr
|
|
uartServerStart = 0x10000000
|
|
uartServerEnd :: Types.Addr
|
|
uartServerEnd = uartServerStart + 7
|
|
|
|
-- be careful when hooking up the servers that
|
|
-- the uart is attached to index 0 whilst the ram
|
|
-- is attached to index 1
|
|
serverMap :: Types.Addr -> Maybe (MkServerIdx 2)
|
|
serverMap addr =
|
|
if addr >= ramServerStart && addr <= ramServerEnd then Just 1
|
|
else if addr >= uartServerStart && addr <= uartServerEnd then Just 0
|
|
else Nothing |