-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | SVD (System view description) file handling -- -- Parse, print, diff SVD files @package data-svd @version 0.1.2.0 module Data.Bits.Pretty -- | Format number using binary notation with leading 0b, padded according -- to its bit size showBin :: (PrintfArg t, FiniteBits t) => t -> String -- | Format number using decimal notation showDec :: (PrintfArg t, FiniteBits t) => t -> String -- | Format number using hexadecimal notation with leading 0x, padded -- according to its bit size showHex :: (PrintfArg t, FiniteBits t) => t -> String -- | Format number using hexadecimal notation with leading 0x formatHex :: PrintfArg t => t -> String -- | Print number in binary with bits grouped by groupSize e.g. -- with `groupSize = 4` we would get `0000 1010 0000 0101` showBinGroups :: (PrintfArg b, Num b, FiniteBits b) => Int -> b -> String -- | Size of Int at the current platform platformSizeOfInt :: Int -- | Format Int as 8-bit unsigned hexadecimal string showHex8 :: Int -> String -- | Format Int as 16-bit unsigned hexadecimal string showHex16 :: Int -> String -- | Format Int as 32-bit unsigned hexadecimal string showHex32 :: Int -> String module Data.SVD.Types data AccessType ReadOnly :: AccessType WriteOnly :: AccessType ReadWrite :: AccessType WriteOnce :: AccessType ReadWriteOnce :: AccessType toAccessType :: String -> AccessType showAccessType :: AccessType -> String data AddressBlock AddressBlock :: Int -> Int -> String -> AddressBlock [addressBlockOffset] :: AddressBlock -> Int [addressBlockSize] :: AddressBlock -> Int [addressBlockUsage] :: AddressBlock -> String -- | Cluster describes a sequence of neighboring registers within a -- peripheral. A cluster specifies the addressOffset relative to -- the baseAddress of the grouping element. All register elements -- within a cluster specify their addressOffset relative to the -- cluster base address (peripheral.baseAddress + -- cluster.addressOffset). data Cluster Cluster :: String -> Maybe Dimension -> String -> Int -> [Register] -> [Cluster] -> Cluster [clusterName] :: Cluster -> String [clusterDimension] :: Cluster -> Maybe Dimension [clusterDescription] :: Cluster -> String [clusterAddressOffset] :: Cluster -> Int [clusterRegisters] :: Cluster -> [Register] [clusterNested] :: Cluster -> [Cluster] data Device Device :: String -> String -> String -> Int -> Int -> Int -> Int -> Int -> [Peripheral] -> Device [deviceName] :: Device -> String [deviceVersion] :: Device -> String [deviceDescription] :: Device -> String [deviceAddressUnitBits] :: Device -> Int [deviceWidth] :: Device -> Int [deviceSize] :: Device -> Int [deviceResetValue] :: Device -> Int [deviceResetMask] :: Device -> Int [devicePeripherals] :: Device -> [Peripheral] data Dimension Dimension :: Int -> Int -> DimensionIndex -> Dimension [dimensionSize] :: Dimension -> Int [dimensionIncrement] :: Dimension -> Int [dimensionIndex] :: Dimension -> DimensionIndex data DimensionIndex DimensionIndex_FromTo :: Int -> Int -> DimensionIndex DimensionIndex_List :: [String] -> DimensionIndex data Interrupt Interrupt :: String -> String -> Int -> Interrupt [interruptName] :: Interrupt -> String [interruptDescription] :: Interrupt -> String [interruptValue] :: Interrupt -> Int data Peripheral Peripheral :: String -> String -> Maybe String -> String -> Int -> Maybe AddressBlock -> [Interrupt] -> [Register] -> [Cluster] -> Peripheral [periphName] :: Peripheral -> String [periphDescription] :: Peripheral -> String [periphDerivedFrom] :: Peripheral -> Maybe String [periphGroupName] :: Peripheral -> String [periphBaseAddress] :: Peripheral -> Int [periphAddressBlock] :: Peripheral -> Maybe AddressBlock [periphInterrupts] :: Peripheral -> [Interrupt] [periphRegisters] :: Peripheral -> [Register] [periphClusters] :: Peripheral -> [Cluster] data Register Register :: String -> String -> Maybe Dimension -> String -> Int -> Int -> AccessType -> Maybe Int -> [Field] -> Register [regName] :: Register -> String [regDisplayName] :: Register -> String [regDimension] :: Register -> Maybe Dimension [regDescription] :: Register -> String [regAddressOffset] :: Register -> Int [regSize] :: Register -> Int [regAccess] :: Register -> AccessType [regResetValue] :: Register -> Maybe Int [regFields] :: Register -> [Field] data Field Field :: String -> String -> Maybe Dimension -> Int -> Int -> Bool -> Maybe String -> Field [fieldName] :: Field -> String [fieldDescription] :: Field -> String [fieldDimension] :: Field -> Maybe Dimension [fieldBitOffset] :: Field -> Int [fieldBitWidth] :: Field -> Int [fieldReserved] :: Field -> Bool [fieldRegType] :: Field -> Maybe String instance GHC.Show.Show Data.SVD.Types.AddressBlock instance GHC.Classes.Ord Data.SVD.Types.AddressBlock instance GHC.Classes.Eq Data.SVD.Types.AddressBlock instance GHC.Generics.Generic Data.SVD.Types.AddressBlock instance GHC.Show.Show Data.SVD.Types.Interrupt instance GHC.Classes.Ord Data.SVD.Types.Interrupt instance GHC.Classes.Eq Data.SVD.Types.Interrupt instance GHC.Generics.Generic Data.SVD.Types.Interrupt instance GHC.Show.Show Data.SVD.Types.DimensionIndex instance GHC.Classes.Ord Data.SVD.Types.DimensionIndex instance GHC.Classes.Eq Data.SVD.Types.DimensionIndex instance GHC.Generics.Generic Data.SVD.Types.DimensionIndex instance GHC.Show.Show Data.SVD.Types.Dimension instance GHC.Classes.Ord Data.SVD.Types.Dimension instance GHC.Classes.Eq Data.SVD.Types.Dimension instance GHC.Generics.Generic Data.SVD.Types.Dimension instance GHC.Show.Show Data.SVD.Types.AccessType instance GHC.Classes.Ord Data.SVD.Types.AccessType instance GHC.Classes.Eq Data.SVD.Types.AccessType instance GHC.Generics.Generic Data.SVD.Types.AccessType instance GHC.Show.Show Data.SVD.Types.Field instance GHC.Classes.Ord Data.SVD.Types.Field instance GHC.Classes.Eq Data.SVD.Types.Field instance GHC.Generics.Generic Data.SVD.Types.Field instance GHC.Show.Show Data.SVD.Types.Register instance GHC.Classes.Ord Data.SVD.Types.Register instance GHC.Classes.Eq Data.SVD.Types.Register instance GHC.Generics.Generic Data.SVD.Types.Register instance GHC.Show.Show Data.SVD.Types.Cluster instance GHC.Classes.Ord Data.SVD.Types.Cluster instance GHC.Classes.Eq Data.SVD.Types.Cluster instance GHC.Generics.Generic Data.SVD.Types.Cluster instance GHC.Show.Show Data.SVD.Types.Peripheral instance GHC.Classes.Ord Data.SVD.Types.Peripheral instance GHC.Classes.Eq Data.SVD.Types.Peripheral instance GHC.Generics.Generic Data.SVD.Types.Peripheral instance GHC.Show.Show Data.SVD.Types.Device instance GHC.Classes.Ord Data.SVD.Types.Device instance GHC.Classes.Eq Data.SVD.Types.Device instance GHC.Generics.Generic Data.SVD.Types.Device instance Data.Default.Class.Default Data.SVD.Types.Device instance Data.Serialize.Serialize Data.SVD.Types.Device instance Data.Default.Class.Default Data.SVD.Types.Peripheral instance Data.Serialize.Serialize Data.SVD.Types.Peripheral instance Data.Default.Class.Default Data.SVD.Types.Cluster instance Data.Serialize.Serialize Data.SVD.Types.Cluster instance Data.Default.Class.Default Data.SVD.Types.Register instance Data.Serialize.Serialize Data.SVD.Types.Register instance Data.Default.Class.Default Data.SVD.Types.Field instance Data.Serialize.Serialize Data.SVD.Types.Field instance Data.Serialize.Serialize Data.SVD.Types.AccessType instance Data.Serialize.Serialize Data.SVD.Types.Dimension instance Data.Serialize.Serialize Data.SVD.Types.DimensionIndex instance Data.Serialize.Serialize Data.SVD.Types.Interrupt instance Data.Serialize.Serialize Data.SVD.Types.AddressBlock module Data.SVD.Pretty ppList :: (a -> Doc AnsiStyle) -> [a] -> Doc AnsiStyle displayPretty :: Doc AnsiStyle -> String displayCompact :: Doc AnsiStyle -> String displayDevice :: Device -> String displayDeviceInfo :: Device -> String displayPeripheral :: Peripheral -> String displayRegister :: Register -> String displayMemMap :: [(String, String)] -> String displayMemMapCompact :: [(String, String)] -> String displayDevISR :: Device -> String displayISRs :: [Interrupt] -> String ppDevice :: Device -> Doc AnsiStyle ppPeriph :: Peripheral -> Doc AnsiStyle ppReg :: Register -> Doc AnsiStyle ppHex :: Int -> Doc AnsiStyle ppDevISR :: Device -> Doc AnsiStyle ppISR :: Interrupt -> Doc AnsiStyle ppDeviceInfo :: Device -> Doc AnsiStyle ppPeriphName :: Peripheral -> Doc AnsiStyle shortField :: Field -> String ppMem :: (String, String) -> Doc AnsiStyle module Data.SVD.Pretty.Box -- | Render fields as table using boxes If table would be too wide split it -- into two tables renderFields :: (Bits a, Num a, Show a, Integral a) => [(a, Field)] -> String module Data.SVD.Parse -- | SVD XML parser svd :: ArrowXml cat => cat (NTree XNode) Device module Data.SVD.Lens class HasAddressUnitBits s a | s -> a addressUnitBits :: HasAddressUnitBits s a => Lens' s a class HasDescription s a | s -> a description :: HasDescription s a => Lens' s a class HasName s a | s -> a name :: HasName s a => Lens' s a class HasPeripherals s a | s -> a peripherals :: HasPeripherals s a => Lens' s a class HasResetMask s a | s -> a resetMask :: HasResetMask s a => Lens' s a class HasResetValue s a | s -> a resetValue :: HasResetValue s a => Lens' s a class HasSize s a | s -> a size :: HasSize s a => Lens' s a class HasVersion s a | s -> a version :: HasVersion s a => Lens' s a class HasWidth s a | s -> a width :: HasWidth s a => Lens' s a class HasAddressBlock s a | s -> a addressBlock :: HasAddressBlock s a => Lens' s a class HasBaseAddress s a | s -> a baseAddress :: HasBaseAddress s a => Lens' s a class HasClusters s a | s -> a clusters :: HasClusters s a => Lens' s a class HasDerivedFrom s a | s -> a derivedFrom :: HasDerivedFrom s a => Lens' s a class HasGroupName s a | s -> a groupName :: HasGroupName s a => Lens' s a class HasInterrupts s a | s -> a interrupts :: HasInterrupts s a => Lens' s a class HasRegisters s a | s -> a registers :: HasRegisters s a => Lens' s a class HasAccess s a | s -> a access :: HasAccess s a => Lens' s a class HasAddressOffset s a | s -> a addressOffset :: HasAddressOffset s a => Lens' s a class HasDimension s a | s -> a dimension :: HasDimension s a => Lens' s a class HasDisplayName s a | s -> a displayName :: HasDisplayName s a => Lens' s a class HasFields s a | s -> a fields :: HasFields s a => Lens' s a class HasBitOffset s a | s -> a bitOffset :: HasBitOffset s a => Lens' s a class HasBitWidth s a | s -> a bitWidth :: HasBitWidth s a => Lens' s a class HasRegType s a | s -> a regType :: HasRegType s a => Lens' s a class HasReserved s a | s -> a reserved :: HasReserved s a => Lens' s a class HasNested s a | s -> a nested :: HasNested s a => Lens' s a class HasIncrement s a | s -> a increment :: HasIncrement s a => Lens' s a class HasIndex s a | s -> a index :: HasIndex s a => Lens' s a class HasValue s a | s -> a value :: HasValue s a => Lens' s a class HasOffset s a | s -> a offset :: HasOffset s a => Lens' s a class HasUsage s a | s -> a usage :: HasUsage s a => Lens' s a instance Data.SVD.Lens.HasUsage Data.SVD.Types.AddressBlock GHC.Base.String instance Data.SVD.Lens.HasOffset Data.SVD.Types.AddressBlock GHC.Types.Int instance Data.SVD.Lens.HasSize Data.SVD.Types.AddressBlock GHC.Types.Int instance Data.SVD.Lens.HasValue Data.SVD.Types.Interrupt GHC.Types.Int instance Data.SVD.Lens.HasDescription Data.SVD.Types.Interrupt GHC.Base.String instance Data.SVD.Lens.HasName Data.SVD.Types.Interrupt GHC.Base.String instance Data.SVD.Lens.HasIndex Data.SVD.Types.Dimension Data.SVD.Types.DimensionIndex instance Data.SVD.Lens.HasIncrement Data.SVD.Types.Dimension GHC.Types.Int instance Data.SVD.Lens.HasSize Data.SVD.Types.Dimension GHC.Types.Int instance Data.SVD.Lens.HasNested Data.SVD.Types.Cluster [Data.SVD.Types.Cluster] instance Data.SVD.Lens.HasAddressOffset Data.SVD.Types.Cluster GHC.Types.Int instance Data.SVD.Lens.HasDescription Data.SVD.Types.Cluster GHC.Base.String instance Data.SVD.Lens.HasDimension Data.SVD.Types.Cluster (GHC.Maybe.Maybe Data.SVD.Types.Dimension) instance Data.SVD.Lens.HasName Data.SVD.Types.Cluster GHC.Base.String instance Data.SVD.Lens.HasRegisters Data.SVD.Types.Cluster [Data.SVD.Types.Register] instance Data.SVD.Lens.HasReserved Data.SVD.Types.Field GHC.Types.Bool instance Data.SVD.Lens.HasRegType Data.SVD.Types.Field (GHC.Maybe.Maybe GHC.Base.String) instance Data.SVD.Lens.HasBitWidth Data.SVD.Types.Field GHC.Types.Int instance Data.SVD.Lens.HasBitOffset Data.SVD.Types.Field GHC.Types.Int instance Data.SVD.Lens.HasDescription Data.SVD.Types.Field GHC.Base.String instance Data.SVD.Lens.HasDimension Data.SVD.Types.Field (GHC.Maybe.Maybe Data.SVD.Types.Dimension) instance Data.SVD.Lens.HasName Data.SVD.Types.Field GHC.Base.String instance Data.SVD.Lens.HasFields Data.SVD.Types.Register [Data.SVD.Types.Field] instance Data.SVD.Lens.HasDisplayName Data.SVD.Types.Register GHC.Base.String instance Data.SVD.Lens.HasDimension Data.SVD.Types.Register (GHC.Maybe.Maybe Data.SVD.Types.Dimension) instance Data.SVD.Lens.HasAddressOffset Data.SVD.Types.Register GHC.Types.Int instance Data.SVD.Lens.HasAccess Data.SVD.Types.Register Data.SVD.Types.AccessType instance Data.SVD.Lens.HasDescription Data.SVD.Types.Register GHC.Base.String instance Data.SVD.Lens.HasName Data.SVD.Types.Register GHC.Base.String instance Data.SVD.Lens.HasResetValue Data.SVD.Types.Register (GHC.Maybe.Maybe GHC.Types.Int) instance Data.SVD.Lens.HasSize Data.SVD.Types.Register GHC.Types.Int instance Data.SVD.Lens.HasRegisters Data.SVD.Types.Peripheral [Data.SVD.Types.Register] instance Data.SVD.Lens.HasInterrupts Data.SVD.Types.Peripheral [Data.SVD.Types.Interrupt] instance Data.SVD.Lens.HasGroupName Data.SVD.Types.Peripheral GHC.Base.String instance Data.SVD.Lens.HasDerivedFrom Data.SVD.Types.Peripheral (GHC.Maybe.Maybe GHC.Base.String) instance Data.SVD.Lens.HasClusters Data.SVD.Types.Peripheral [Data.SVD.Types.Cluster] instance Data.SVD.Lens.HasBaseAddress Data.SVD.Types.Peripheral GHC.Types.Int instance Data.SVD.Lens.HasAddressBlock Data.SVD.Types.Peripheral (GHC.Maybe.Maybe Data.SVD.Types.AddressBlock) instance Data.SVD.Lens.HasDescription Data.SVD.Types.Peripheral GHC.Base.String instance Data.SVD.Lens.HasName Data.SVD.Types.Peripheral GHC.Base.String instance Data.SVD.Lens.HasWidth Data.SVD.Types.Device GHC.Types.Int instance Data.SVD.Lens.HasVersion Data.SVD.Types.Device GHC.Base.String instance Data.SVD.Lens.HasSize Data.SVD.Types.Device GHC.Types.Int instance Data.SVD.Lens.HasResetValue Data.SVD.Types.Device GHC.Types.Int instance Data.SVD.Lens.HasResetMask Data.SVD.Types.Device GHC.Types.Int instance Data.SVD.Lens.HasPeripherals Data.SVD.Types.Device [Data.SVD.Types.Peripheral] instance Data.SVD.Lens.HasName Data.SVD.Types.Device GHC.Base.String instance Data.SVD.Lens.HasDescription Data.SVD.Types.Device GHC.Base.String instance Data.SVD.Lens.HasAddressUnitBits Data.SVD.Types.Device GHC.Types.Int module Data.SVD.Dim -- | Expand all dimensions and clusters -- -- In order - Expand and eliminate each cluster - Expand fields of each -- register - Expand each register expandDevice :: Device -> Device -- | Expand Cluster into multiple cluster if it has a -- Dimension return just the cluster if not expandCluster :: Cluster -> [Cluster] -- | Expand Field into multiple fields if it has a -- Dimension return just the field if not expandField :: Field -> [Field] -- | Expand Register into multiple registers if it has a -- Dimension return just the register if not expandRegister :: Register -> [Register] module Data.SVD.Util -- | Fill in reserved fields for whole Device addReservedFields :: Device -> Device -- | Find holes in registers and create corresponding reserved fields for -- these -- -- First finds missing bits and then merges them to single reserved field procFields :: Register -> [Field] -- | Walk processed register fields top to bottom checking that the -- register is exactly n bits long continuityCheck :: Register -> Bool -- | Check all devices registers for continuity checkDeviceRegisterContinuity :: Device -> Either String Device mapPeriphs :: (Peripheral -> b) -> Device -> [b] mapRegs :: (Register -> b) -> Peripheral -> [b] mapFields :: (Field -> b) -> Register -> [b] mapDevFields :: (Field -> b) -> Device -> [b] -- | Get peripheral by groupName getPeriphByGroup :: String -> Device -> Peripheral -- | Get peripheral by name getPeriph :: String -> Device -> Peripheral -- | Get peripheral by name iff found, Nothing otherwise getPeriphMay :: String -> Device -> Maybe Peripheral -- | Get register of the peripheral by their names iff found, Nothing -- otherwise getPeriphRegMay :: String -> Peripheral -> Maybe Register -- | Get peripheral by name or its parent peripheral if it's a derived -- peripheral (for example USART2 is typically derived from USART1) getPeriphFollow :: String -> Device -> Either String Peripheral -- | Get registers of the peripheral getPeriphRegs :: String -> Device -> Either String [Register] -- | Get specific register of the peripheral Follows derived from. getPeriphReg :: String -> String -> Device -> Either String Register -- | Get address of the specific register of the peripheral with -- pName getPeriphRegAddr :: String -> String -> Device -> Either String Int -- | Get fields of the specific register of the peripheral with -- pName getPeriphRegFields :: String -> String -> Device -> Either String [Field] getRegFields :: String -> String -> Device -> [Field] -- | Get value of specific Field according to input x getFieldVal :: (Bits a, Num a) => a -> Field -> a -- | Decode integer x according to Fields fs getFieldValues :: (Bits a, Num a) => a -> [Field] -> [(a, Field)] -- | Check if any reserved field has value other than 0 anyReservedSet :: (Eq a, Num a) => [(a, Field)] -> Bool -- | Get memory map of the device according to its perhiperal addresses getDevMemMap :: Device -> [(String, String)] registerNames :: String -> Device -> [String] fieldNames :: String -> String -> Device -> [String] -- | Sort everything by memory address sortDeviceByAddresses :: Device -> Device -- | Sort everything by name sortDeviceByNames :: Device -> Device fillMissingInterrupts :: [Interrupt] -> [Interrupt] module Data.SVD.Pretty.Explore exploreRegister :: (PrintfArg a, FiniteBits a, Show a, Integral a) => a -> Int -> Register -> IO () module Data.SVD.IO parseSVD :: String -> IO (Either String Device) parseSVDOptions :: SVDOptions -> String -> IO (Either String Device) data SVDOptions SVDOptions :: Bool -> Bool -> Bool -> Bool -> SVDSort -> SVDOptions -- | Fill in dummy reserved fields where holes would be in registers [svdOptionsAddReservedFields] :: SVDOptions -> Bool -- | Cache parsed SVD in /tmp based on a hash of the input svd file [svdOptionsCache] :: SVDOptions -> Bool -- | Check register continuity [svdOptionsCheckContinuity] :: SVDOptions -> Bool -- | Expand dimensions and clusters [svdOptionsExpand] :: SVDOptions -> Bool -- | Sorting [svdOptionsSort] :: SVDOptions -> SVDSort instance GHC.Show.Show Data.SVD.IO.SVDSort instance GHC.Generics.Generic Data.SVD.IO.SVDSort instance GHC.Classes.Ord Data.SVD.IO.SVDSort instance GHC.Classes.Eq Data.SVD.IO.SVDSort instance GHC.Show.Show Data.SVD.IO.SVDOptions instance GHC.Generics.Generic Data.SVD.IO.SVDOptions instance GHC.Classes.Ord Data.SVD.IO.SVDOptions instance GHC.Classes.Eq Data.SVD.IO.SVDOptions instance Data.Default.Class.Default Data.SVD.IO.SVDOptions instance Data.Hashable.Class.Hashable Data.SVD.IO.SVDOptions instance Data.Hashable.Class.Hashable Data.SVD.IO.SVDSort module Data.SVD.Diff diffPeriphNames :: Device -> Device -> [Diff String] diffRegisterNames :: String -> Device -> Device -> [Diff String] regNames :: Peripheral -> [String] diffRegNames :: Peripheral -> Peripheral -> [Diff String] regNameFields :: String -> Peripheral -> [Field] diff :: Ord a => (t -> [a]) -> t -> t -> [Diff a] diffFieldNames :: String -> String -> Device -> Device -> [Diff String] diffFields :: [Field] -> [Field] -> [PolyDiff Field Field] diffDistance :: [PolyDiff a b] -> Int getBoths :: [PolyDiff a b] -> [a] module Data.SVD