#ifndef AVR8EMU_LIBRARY_PRIVATE_H_ #define AVR8EMU_LIBRARY_PRIVATE_H_ #include "util.h" #include "avr8emu.h" #include #include #include #include struct avr8emu { /* Type of microcontroller we are emulating. */ enum avr_setup_type type; /* Pipes for communication with the worker. */ int message_to_worker; /* Result is received in result_from_worker */ int result_from_worker; /* Result for message_to_worker */ int message_from_worker; /* Has no result pipe */ /* Pipe for receiving error and status messages from the worker. */ int error_pipe; /* The worker process PID. */ pid_t worker_pid; /* Callbacks to the emulator controller. */ const struct avr8emu_callbacks *callback; }; struct avr8emu_worker { /* Type of microcontroller we are emulating. */ enum avr_setup_type type; /* Pipes for communication with the host. */ int message_to_host; /* Has no result pipe */ int message_from_host; /* Result is send through result_to_host */ int result_to_host; /* Result for message_from_host */ /* Pipe for sending error and status messages to the host. */ int error_pipe; /* True, if the microcontroller is initialized. */ bool initialized; }; #define AVR8EMU_MAX_MSG_SIZE (1024 * 8) /* Message from host to worker. */ enum avr8emu_worker_message { WORKERMSG_INIT, WORKERMSG_RESET, }; /* Messaging to the host. (From worker). This is reentrant safe, so it * can be called from multiple worker threads. */ enum avr8emu_host_message { HOSTMSG_PORTIO, /* I/O access to an I/O port. */ }; void send_host_message(enum avr8emu_host_message msg, const void *payload, uint32_t payload_len); #endif /* AVR8EMU_LIBRARY_PRIVATE_H_ */