Doxify more.

This commit is contained in:
Radosław Kujawa 2018-04-12 12:45:05 +02:00
parent 578955e4a1
commit 0ac5932e75
2 changed files with 51 additions and 29 deletions

View File

@ -1,15 +1,29 @@
/**
* @file log.h
* @brief Logging-related functions.
*/
#include <stdint.h>
#define LOG_TRACE 5
#define LOG_DEBUG 4
#define LOG_INFO 3
#define LOG_WARN 4
#define LOG_ERROR 2
#define LOG_CRIT 1
#define LOG_NOTHING 0 /* At 0 nothing will get logged, can be set as
#define LOG_TRACE 5 /**< Most verbose log level. Used for tracing. */
#define LOG_DEBUG 4 /**< Debug-level messages. */
#define LOG_INFO 3 /**< Informational messages. */
#define LOG_WARN 4 /**< Warning messages. */
#define LOG_ERROR 2 /**< Errors. */
#define LOG_CRIT 1 /**< Critical errors. */
#define LOG_NOTHING 0 /**< At 0 nothing will get logged, can be set as
current level, but not when creating new log
messages. */
void rk65c02_loglevel_set(uint8_t);
void rk65c02_log(uint8_t, const char *, ...);
/**
* @brief Set the logging verbosity level.
* @param level Desired log verbosity level.
*/
void rk65c02_loglevel_set(uint8_t level);
/**
* @brief Send a message to log.
* @param level Log level at which message should be logged.
* @param fmt Message in a printf-like format.
*/
void rk65c02_log(uint8_t level, const char *fmt, ...);

View File

@ -7,7 +7,7 @@
#include "bus.h"
/**
* @brief Current state of the emulator.
* @brief State of the emulator.
*/
typedef enum {
STOPPED, /**< Stopped. */
@ -29,7 +29,7 @@ typedef enum {
} emu_stop_reason_t;
/**
* @brief Current state of emulated CPU registers.
* @brief State of the emulated CPU registers.
*/
struct reg_state {
uint8_t A; /**< Accumulator. */
@ -45,14 +45,10 @@ typedef struct reg_state reg_state_t;
#define P_CARRY 0x1
#define P_ZERO 0x2
/** Status register flag: IRQ disabled */
#define P_IRQ_DISABLE 0x4
/** Status register flag: BCD mode */
#define P_DECIMAL 0x8
/** Status register flag: BRK was the cause of interrupt */
#define P_BREAK 0x10
/** Status register flag: Undefined (always 1) */
#define P_UNDEFINED 0x20
#define P_IRQ_DISABLE 0x4 /**< Status register flag: IRQ disabled */
#define P_DECIMAL 0x8 /**< Status register flag: BCD mode */
#define P_BREAK 0x10 /**< Status register flag: BRK was the cause of interrupt */
#define P_UNDEFINED 0x20 /**< Status register flag: Undefined (always 1) */
#define P_SIGN_OVERFLOW 0x40
#define P_NEGATIVE 0x80
@ -81,10 +77,10 @@ typedef struct trace_t {
* @brief Instance of the emulator.
*/
struct rk65c02emu {
emu_state_t state;
bus_t *bus;
reg_state_t regs;
emu_stop_reason_t stopreason;
emu_state_t state; /**< Current emulator status. */
bus_t *bus; /**< Bus to which CPU is attached. */
reg_state_t regs; /**< CPU registers. */
emu_stop_reason_t stopreason; /**< Reason for stopping emulation. */
bool irq; /**< Interrupt request line state, true is asserted. */
breakpoint_t *bps_head; /**< Pointer to linked list with breakpoints. */
@ -97,18 +93,23 @@ typedef struct rk65c02emu rk65c02emu_t;
/**
* @brief Initialize the new emulator instance. Set initial CPU state.
* @param b Bus description.
* @return New emulator instance.
*/
rk65c02emu_t rk65c02_init(bus_t *);
rk65c02emu_t rk65c02_init(bus_t *b);
/**
* @brief Start the emulator.
* @param e Emulator instance.
*/
void rk65c02_start(rk65c02emu_t *);
void rk65c02_start(rk65c02emu_t *e);
/**
* @brief Execute as many instructions as specified in steps argument.
* @param e Emulator instance.
* @param steps Number of instructions to execute.
*/
void rk65c02_step(rk65c02emu_t *, uint16_t);
void rk65c02_step(rk65c02emu_t *e, uint16_t steps);
char *rk65c02_regs_string_get(reg_state_t);
void rk65c02_dump_regs(reg_state_t);
@ -116,15 +117,22 @@ void rk65c02_dump_stack(rk65c02emu_t *, uint8_t);
/**
* @brief Assert the IRQ line.
* @param e Emulator instance.
*/
void rk65c02_assert_irq(rk65c02emu_t *);
void rk65c02_assert_irq(rk65c02emu_t *e);
/**
* @brief Respond to interrupt and start the interrupt service routine.
* @param e Emulator instance.
*/
void rk65c02_irq(rk65c02emu_t *);
void rk65c02_irq(rk65c02emu_t *e);
void rk65c02_panic(rk65c02emu_t *, const char*, ...);
/**
* @brief Handle critical error - send message to log and stop emulation.
* @param e Emulator instance.
* @param fmt Message in printf-like format.
*/
void rk65c02_panic(rk65c02emu_t *e, const char *fmt, ...);
/**
* @brief Prep the emulator, load code from file, pass bus config optionally.