ironman package¶
Submodules¶
ironman.communicator module¶
This file implements all of the various communications one might need to do.
Jarvis provides a callback structure that looks up (in its registry) for an appropriate communication protocol.
-
class
ironman.communicator.Jarvis[source]¶ Bases:
objectThis is the general communication slave.
Jarvis is what lets us pass around communications to various routes/protocols while keeping the details separated from us. Here’s an example of how one might use it:
>>> from ironman.communicator import Jarvis, SimpleIO >>> # create a Jarvis instance to manage what we want to register >>> j = Jarvis() >>> # tell Jarvis to register this class for the given route >>> @j.register('fpgaOne') ... class FileOne(SimpleIO): ... __f__ = '/path/to/fileOne' ... >>> # tell Jarvis to register this class for the given route >>> @j.register('fpgaTwo') ... class FileTwo(SimpleIO): ... __f__ = '/path/to/fileTwo' ... >>> # print the available registered classes >>> import pprint >>> pprint.pprint(j.registry) {'fpgaOne': <class 'ironman.communicator.FileOne'>, 'fpgaTwo': <class 'ironman.communicator.FileTwo'>}
Jarvis does the wrapping for
Jarvis.register()so that a class defined at run-time is automatically inserted.
ironman.globals module¶
ironman.hardware module¶
-
class
ironman.hardware.HardwareManager[source]¶ Bases:
dict-
add(new_hw_map)[source]¶ Add the HW map only if it doesn’t exist for a given key, and no address collisions
-
raw_maps= {}¶
-
-
class
ironman.hardware.HardwareNode(node, hw_map)[source]¶ Bases:
dict-
property
allowed¶
-
property
disallowed¶
-
property
isOk¶
-
property
permissions¶
-
property
readable¶
-
property
writeable¶
-
property
ironman.history module¶
ironman.interfaces module¶
-
interface
ironman.interfaces.ICommunicationDriver[source]¶ The standard driver that is expected for all methods of communication on the board
-
read(offset, size)¶ Read from the given address (offset) for N bytes (size)
-
write(offset, value)¶ Write to the given address (offset) for N bytes (len(value))
-
-
interface
ironman.interfaces.ICommunicationSlave[source]¶ Manages the communication with the programmable logic for us
-
__call__(packet)¶ A non-blocking I/O call passing along the packet
Returns the responses
-
__transaction__(transaction)¶ Handle a single transaction and return the response
-
parse_address(address)¶ Parses address and returns what function to call
-
set_hardware_manager(hwmanager)¶ Set the hardware manager that the slave communications with
-
-
interface
ironman.interfaces.IHardwareManager[source]¶ Our Hardware Maps manager
-
add(hw_map)¶ Add the Map object to the Hardware
-
check_address(address)¶ Given an address, checks if it is valid
-
check_data(address, data)¶ Given an address, checks if the data is a valid value to write
-
get_checksum(route)¶ Look up the checksum for a given map name (route)
-
get_node(address)¶ Given an address, return the node associated with it
-
get_route(address)¶ Given an address, return the route for it
-
raw_maps¶ A dictionary of the maps added so we can keep track which makes it easier to add and remove.
-
subtract(route)¶ Remove the route from the hardware manager
-
-
interface
ironman.interfaces.IHardwareMap[source]¶ Manages information about a single map, should be an overloaded dictionary
-
__init__(xml, route)¶ Initialize a hardware map object by giving it the data to parse and associate it with a route
-
isOk()¶ Whether or not the given hardware map is ok. Should just be a loop over
IHardwareNode.isOk().
-
parse(xml)¶ Parse the xml hardware map data to set things up
-
route¶ The route associated for this hardware map.
-
-
interface
ironman.interfaces.IHardwareNode[source]¶ Manages information about a single address. Simply a well-defined dictionary.
-
__init__(node, hw_map)¶ Initialize the node by giving it the parsed xml data as well as the hw_map
-
allowed¶ A list of allowed values for the node.
-
disallowed¶ A list of disallowed values for the node.
-
hw_map¶ The hardware map this is associated with.
-
isOk¶ Is the given node ok? EG: can’t set allowed and disallowed objects at the same time and cannot block a node from being readable.
-
isValueValid(val)¶ Whether the given value is a valid value for the node
-
permissions¶ Mark the node’s read/write capabilities.
-
readable¶ Is the given node readable?
-
writeable¶ Is the given node writeable?
-
-
interface
ironman.interfaces.IHistory[source]¶ Enhanced dictionary to store inbound and outbound packet pairs
-
record(packet)¶ record the packet
-
-
interface
ironman.interfaces.IIPBusPacket[source]¶ IPBus Packet object
-
__eq__(other)¶ Define a way to identify two packets as being equivalent. Best way is to compare the underlying structs
-
__init__(blob)¶ Packet is initialized with a data blob to decode. Determine if it is big or little endian.
-
__ne__(other)¶ This should just be
return not self.__eq__(other).
-
_raw¶ The raw request packet
-
byteorder¶ The byte-order in the header. Should assert == 0xf.
-
packet_id¶ The id of the ipbus packet.
-
packet_type¶ The type of packet.
Value
Type
0x0
Control
0x1
Status
0x2
Re-send request
0x3-f
Reserved
-
protocol_version¶ The packet header protocol version. This does not check that the encapsulated transactions also match.
-
raw¶ The raw datagram blob.
-
request¶ The parsed request packet
-
reserved¶ Reserved. Should be 0x0.
-
response¶ The data response to be passed along to another function that builds the response packet. This should be a list [] to append responses to.
-
ironman.packet module¶
ironman.server module¶
-
class
ironman.server.FauxFactory(dgen)[source]¶ Bases:
twisted.internet.protocol.ServerFactory-
buildProtocol(addr)[source]¶ Create an instance of a subclass of Protocol.
The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.
Alternatively, L{None} may be returned to immediately close the new connection.
Override this method to alter how Protocol instances get created.
@param addr: an object implementing L{twisted.internet.interfaces.IAddress}
-
protocol¶ alias of
ironman.server.FauxCP
-
-
class
ironman.server.TCPFactory(dgen)[source]¶ Bases:
twisted.internet.protocol.ServerFactory-
buildProtocol(addr)[source]¶ Create an instance of a subclass of Protocol.
The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.
Alternatively, L{None} may be returned to immediately close the new connection.
Override this method to alter how Protocol instances get created.
@param addr: an object implementing L{twisted.internet.interfaces.IAddress}
-
protocol¶ alias of
ironman.server.TCP
-