-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Cpu information and properties helpers.
--   
--   Lowlevel cpu routines to get basic properties of the cpu platform,
--   like endianness and architecture.
@package cpu
@version 0.1.2


module System.Arch

-- | List of all cpu architecture
data Arch
X86 :: Arch
X86_64 :: Arch
PPC :: Arch
PPC64 :: Arch
Sparc :: Arch
Arm :: Arch
Mips :: Arch
SH :: Arch
IA64 :: Arch
S390 :: Arch
Alpha :: Arch
Hppa :: Arch
Rs6000 :: Arch
M68K :: Arch
VAX :: Arch

-- | Return the system's cpu architecture
getSystemArch :: Arch
instance GHC.Classes.Eq System.Arch.Arch
instance GHC.Internal.Show.Show System.Arch.Arch


module System.Cpuid

-- | complete cpuid call with eax and ecx set.
cpuidWithIndex :: Word32 -> Word32 -> IO (Word32, Word32, Word32, Word32)

-- | simple cpuid call.
cpuid :: Word32 -> IO (Word32, Word32, Word32, Word32)


module System.Endian

-- | represent the CPU endianness
--   
--   Big endian system stores bytes with the MSB as the first byte. Little
--   endian system stores bytes with the LSB as the first byte.
--   
--   middle endian is purposely avoided.
data Endianness
LittleEndian :: Endianness
BigEndian :: Endianness

-- | return the system endianness
getSystemEndianness :: Endianness

-- | Convert from a little endian 32 bit value to the cpu endianness
fromLE32 :: Word32 -> Word32

-- | Convert from a little endian 64 bit value to the cpu endianness
fromLE64 :: Word64 -> Word64

-- | Convert from a little endian 16 bit value to the cpu endianness
fromLE16 :: Word16 -> Word16

-- | Convert a 32 bit value in cpu endianess to little endian
toLE32 :: Word32 -> Word32

-- | Convert a 64 bit value in cpu endianess to little endian
toLE64 :: Word64 -> Word64

-- | Convert a 16 bit value in cpu endianness to little endian
toLE16 :: Word16 -> Word16

-- | Convert from a big endian 32 bit value to the cpu endianness
fromBE32 :: Word32 -> Word32

-- | Convert from a big endian 64 bit value to the cpu endianness
fromBE64 :: Word64 -> Word64

-- | Convert from a big endian 16 bit value to the cpu endianness
fromBE16 :: Word16 -> Word16

-- | Convert a 32 bit value in cpu endianess to big endian
toBE32 :: Word32 -> Word32

-- | Convert a 64 bit value in cpu endianess to big endian
toBE64 :: Word64 -> Word64

-- | Convert a 16 bit value in cpu endianness to big endian
toBE16 :: Word16 -> Word16
instance GHC.Classes.Eq System.Endian.Endianness
instance GHC.Internal.Show.Show System.Endian.Endianness
