[][src]Struct pir_8_emu::binutils::pir_8_emu::RawNativePortHandler

pub struct RawNativePortHandler {
    pub port_count: extern "C" fn() -> u8,
    pub init: extern "C" fn(ports: *const u8, ports_len: u8) -> *mut c_void,
    pub uninit: extern "C" fn(state: *mut c_void),
    pub handle_read: extern "C" fn(state: *mut c_void, port: u8) -> u8,
    pub handle_write: extern "C" fn(state: *mut c_void, port: u8, byte: u8),
}

Raw C funxion pointers into a loaded DLL

The raw in-/exported names are prefixed with pir_8_emu_

Consult PortHandler for timings and invariants

These correspond to the following C declaration set:

unsigned char pir_8_emu_port_count();

void * pir_8_emu_init(const unsigned char * ports, unsigned char ports_len);

void pir_8_emu_uninit(void * state);

unsigned char pir_8_emu_handle_read(void * state, unsigned char port);

void pir_8_emu_handle_write(void * state, unsigned char port, unsigned char byte);

These can also be obtained from the include/pir-8-emu/port_handler.h file in the git repo

Fields

port_count: extern "C" fn() -> u8

Get the amount of ports this handler handles

Returning 0 from this funxion will panic

init: extern "C" fn(ports: *const u8, ports_len: u8) -> *mut c_void

Get the handler-allocated state corresponding to the specified ports set

It is valid to return nullptr from this funxion

The ports_len argument will always be equal to the last return value of port_count()

uninit: extern "C" fn(state: *mut c_void)

Release all resources associated with the specified state

The state argument will always be equal to the one returned from init()

handle_read: extern "C" fn(state: *mut c_void, port: u8) -> u8

Handle the program reading from one of the handled ports

The port argument will always have been contained within the set passed to init()

The state argument will always be equal to the one returned from init()

handle_write: extern "C" fn(state: *mut c_void, port: u8, byte: u8)

Handle the program writing to one of the handled ports

The port argument will always have been contained within the set passed to init()

The state argument will always be equal to the one returned from init()

Methods

impl RawNativePortHandler[src]

pub const PORT_COUNT_NAME: ConstCStr

pub const INIT_NAME: ConstCStr

pub const UNINIT_NAME: ConstCStr

pub const HANDLE_READ_NAME: ConstCStr

pub const HANDLE_WRITE_NAME: ConstCStr

Trait Implementations

impl Clone for RawNativePortHandler[src]

impl Copy for RawNativePortHandler[src]

impl Debug for RawNativePortHandler[src]

impl Eq for RawNativePortHandler[src]

impl Hash for RawNativePortHandler[src]

impl Ord for RawNativePortHandler[src]

impl PartialEq<RawNativePortHandler> for RawNativePortHandler[src]

impl PartialOrd<RawNativePortHandler> for RawNativePortHandler[src]

impl StructuralEq for RawNativePortHandler[src]

impl StructuralPartialEq for RawNativePortHandler[src]

Auto Trait Implementations

impl RefUnwindSafe for RawNativePortHandler

impl Send for RawNativePortHandler

impl Sync for RawNativePortHandler

impl Unpin for RawNativePortHandler

impl UnwindSafe for RawNativePortHandler

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.