| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <stdint.h> |
| 8 |
#include <stdbool.h> |
| 9 |
|
| 10 |
#define IEEE_HISTORY_MAX 64 |
| 11 |
|
| 12 |
typedef enum { |
| 13 |
IEEE_OP_OPEN = 0, |
| 14 |
IEEE_OP_OPEN_FAILED = 1, |
| 15 |
IEEE_OP_CLOSE = 2, |
| 16 |
IEEE_OP_DIR = 3, |
| 17 |
IEEE_OP_COMMAND = 4, |
| 18 |
IEEE_OP_STATUS = 5, |
| 19 |
} ieee_op_kind_t; |
| 20 |
|
| 21 |
typedef struct { |
| 22 |
uint32_t seq; |
| 23 |
uint8_t kind; |
| 24 |
int8_t channel; |
| 25 |
bool read; |
| 26 |
bool write; |
| 27 |
char name[80]; |
| 28 |
char status[48]; |
| 29 |
uint32_t bytes_read; |
| 30 |
uint32_t bytes_written; |
| 31 |
} ieee_history_entry_t; |
| 32 |
|
| 33 |
#ifdef __cplusplus |
| 34 |
extern "C" { |
| 35 |
#endif |
| 36 |
|
| 37 |
void ieee_init(); |
| 38 |
int SECOND(uint8_t a); |
| 39 |
int TKSA(uint8_t a); |
| 40 |
int ACPTR(uint8_t *a); |
| 41 |
int CIOUT(uint8_t a); |
| 42 |
int UNTLK(void); |
| 43 |
int UNLSN(void); |
| 44 |
int LISTEN(uint8_t a); |
| 45 |
int TALK(uint8_t a); |
| 46 |
int MACPTR(uint16_t addr, uint16_t *count, uint8_t stream_mode); |
| 47 |
int MCIOUT(uint16_t addr, uint16_t *count, uint8_t stream_mode); |
| 48 |
int XMACPTR(uint8_t stream_mode); |
| 49 |
int XMCIOUT(uint8_t stream_mode); |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
typedef struct { |
| 60 |
bool is_open; |
| 61 |
bool read; |
| 62 |
bool write; |
| 63 |
char name[80]; |
| 64 |
uint32_t bytes_read; |
| 65 |
uint32_t bytes_written; |
| 66 |
} ieee_channel_debug_t; |
| 67 |
|
| 68 |
typedef struct { |
| 69 |
bool using_hostfs; |
| 70 |
int ieee_unit; |
| 71 |
char hostfscwd[512]; |
| 72 |
int channel; |
| 73 |
bool listening; |
| 74 |
bool talking; |
| 75 |
bool opening; |
| 76 |
char cmd[256]; |
| 77 |
int cmdlen; |
| 78 |
char error_str[256]; |
| 79 |
ieee_channel_debug_t channels[16]; |
| 80 |
int history_count; |
| 81 |
ieee_history_entry_t history[IEEE_HISTORY_MAX]; |
| 82 |
} ieee_debug_state_t; |
| 83 |
|
| 84 |
void ieee_debug_get_state(ieee_debug_state_t *out); |
| 85 |
|
| 86 |
#ifdef __cplusplus |
| 87 |
} |
| 88 |
#endif |