-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Interface to the FXPak/FXPak Pro USB interface -- -- Wraps Serial interaction with FXPak/FXPak Pro devices @package fxpak @version 0.1.2 -- | Interface to working with the FXPak/FXPak Pro flash cart devices for -- the SNES/Super Famicom module System.Hardware.FXPak -- | An FXPak device (which is exposed as a serial device) type FXPak = SerialPort -- | A packet representing a single complete to send to the FXPak type Packet = Packet -- | The Opcode representing the command to perform data Opcode o -- | Depending on context, either return the contents of a given file, or -- read memory [Get] :: Opcode (Opcode' 'Get) -- | Depending on context, either allow the upload of a file, or write -- bytes to memory [Put] :: Opcode (Opcode' 'Put) -- | Retrieve from 1-4 regions of memory [VGet] :: Opcode (Opcode' 'VGet) -- | Write from 1-4 bytes to memory [VPut] :: Opcode (Opcode' 'VPut) -- | List files in a given directory [List] :: Opcode (Opcode' 'List) -- | Make a given directory on the FXPak's filesystem [Mkdir] :: Opcode (Opcode' 'Mkdir) -- | Delete a given path on the FXPak's filesystem [Delete] :: Opcode (Opcode' 'Delete) -- | Move a given path on the FXPak's filesystem to a new location [Move] :: Opcode (Opcode' 'Move) -- | Reset the SNES/SFC [Reset] :: Opcode (Opcode' 'Reset) -- | Boot a given file [Boot] :: Opcode (Opcode' 'Boot) -- | Reset the SNES/SFC [PowerCycle] :: Opcode (Opcode' 'PowerCycle) -- | Return information about the running FXPak [Info] :: Opcode (Opcode' 'Info) -- | Reset the SNES/SFC, returning to the FXPak's main menu [MenuReset] :: Opcode (Opcode' 'MenuReset) [Stream] :: Opcode (Opcode' 'Stream) [Time] :: Opcode (Opcode' 'Time) -- | Indicates a response packet [Response] :: Opcode (Opcode' 'Response) -- | The context in which a packet's command operates data Context c -- | In the File mode, files can be managed directly, and booted [File] :: Context (Context' 'File) -- | In the SNES context, bytes can be written to and read from memory, and -- all system commands (e.g. reset, powercycle, reset to menu, system -- info, and stream data) are passed through [SNES] :: Context (Context' 'SNES) [MSU] :: Context (Context' 'MSU) [Config] :: Context (Context' 'Config) -- | Arguments indicating the desired action taken by a given operation data Arguments a -- | No arguments - valid only with the Reset, MenuReset, Info, Stream, and -- PowerCycle opcodes [None] :: Arguments (Arguments' 'None) -- | Path to a given object - valid for Get, List, Mkdir, Delete, and Boot -- in the File context [Path] :: FilePath -> Arguments (Arguments' ('Path (a :: FilePath))) -- | Path with an accompanying ByteString - valid only for Put in the File -- context [PathContents] :: FilePath -> ByteString -> Arguments (Arguments' ('PathContents (a :: FilePath) (b :: ByteString))) -- | Source and destination paths - valid only for Move in the File context [PathRename] :: FilePath -> FilePath -> Arguments (Arguments' ('PathRename (a :: FilePath) a)) -- | An address and length of data to be read for non-File context Get and -- VGet opcodes [GetBytes] :: AddressGet -> Arguments (Arguments' ('GetBytes (a :: AddressGet))) -- | Two address/length pairs to be read for non-File context VGet [GetBytes2] :: AddressGet -> AddressGet -> Arguments (Arguments' ('GetBytes2 (a :: (AddressGet, AddressGet)))) -- | Three address/length pairs to be read for non-File context VGet [GetBytes3] :: AddressGet -> AddressGet -> AddressGet -> Arguments (Arguments' ('GetBytes3 (a :: (AddressGet, AddressGet, AddressGet)))) -- | Four address/length pairs to be read for non-File context VGet [GetBytes4] :: AddressGet -> AddressGet -> AddressGet -> AddressGet -> Arguments (Arguments' ('GetBytes4 (a :: (AddressGet, AddressGet, AddressGet, AddressGet)))) -- | A target address and byte to be written for non-File context Put and -- VPut opcodes [SetByte] :: AddressSet -> Arguments (Arguments' ('SetByte (a :: AddressSet))) -- | Two address/data pairs to be written for non-File context VPut [SetByte2] :: AddressSet -> AddressSet -> Arguments (Arguments' ('SetByte2 (a :: (AddressSet, AddressSet)))) -- | Three address/data pairs to be written for non-File context VPut [SetByte3] :: AddressSet -> AddressSet -> AddressSet -> Arguments (Arguments' ('SetByte3 (a :: (AddressSet, AddressSet, AddressSet)))) -- | Four address/data pairs to be written for non-File context VPut [SetByte4] :: AddressSet -> AddressSet -> AddressSet -> AddressSet -> Arguments (Arguments' ('SetByte4 (a :: (AddressSet, AddressSet, AddressSet, AddressSet)))) -- | Represents an address to fetch memory from and a length to read data AddressGet AddressGet :: Int -> Int -> AddressGet [start] :: AddressGet -> Int [dataLength] :: AddressGet -> Int -- | Represents a value and the address to which it should be written data AddressSet AddressSet :: Int -> Int -> AddressSet [target] :: AddressSet -> Int [value] :: AddressSet -> Int -- | Flags to be encoded as a 1-byte bit map Note: No checking of flag -- validity is done in the original usb2snesw software and as such -- research into which combinations produce expected results is still -- underway data Flag SkipReset :: Flag OnlyReset :: Flag ClearX :: Flag SetX :: Flag StreamBurst :: Flag NoResponse :: Flag Data64Bytes :: Flag -- | List of Flags to be encoded for a given packet type Flags = Flags -- | Open a given serial device as an FXPak open :: FilePath -> IO FXPak with :: FilePath -> (FXPak -> IO a) -> IO a -- | Encode a packet to send to an FXPak, preventing encoding of invalid -- packets packet :: ValidPacket c o a ~ 'True => Context (Context' c) -> Opcode (Opcode' o) -> Flags -> Arguments (Arguments' a) -> Packet -- | Sends a given packet to an FXPak device, returning a ByteString if a -- response is expected send :: FXPak -> Packet -> IO (Maybe ByteString)