| 1 |
#ifndef CARD_GLOBAL_H |
| 2 |
#define CARD_GLOBAL_H |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#include "xdefs.h" |
| 26 |
#include "xbus-pcm.h" |
| 27 |
|
| 28 |
enum global_opcodes { |
| 29 |
XPROTO_NAME(GLOBAL, AB_REQUEST) = 0x07, |
| 30 |
XPROTO_NAME(GLOBAL, AB_DESCRIPTION) = 0x08, |
| 31 |
XPROTO_NAME(GLOBAL, REGISTER_REQUEST) = 0x0F, |
| 32 |
XPROTO_NAME(GLOBAL, REGISTER_REPLY) = 0x10, |
| 33 |
XPROTO_NAME(GLOBAL, PCM_WRITE) = 0x11, |
| 34 |
XPROTO_NAME(GLOBAL, PCM_READ) = 0x12, |
| 35 |
XPROTO_NAME(GLOBAL, SYNC_SOURCE) = 0x19, |
| 36 |
XPROTO_NAME(GLOBAL, SYNC_REPLY) = 0x1A, |
| 37 |
XPROTO_NAME(GLOBAL, ERROR_CODE) = 0x22, |
| 38 |
XPROTO_NAME(GLOBAL, XBUS_RESET) = 0x23, |
| 39 |
XPROTO_NAME(GLOBAL, NULL_REPLY) = 0xFE, |
| 40 |
}; |
| 41 |
|
| 42 |
struct unit_descriptor { |
| 43 |
struct xpd_addr addr; |
| 44 |
__u8 subtype:4; |
| 45 |
__u8 type:4; |
| 46 |
__u8 numchips; |
| 47 |
__u8 ports_per_chip; |
| 48 |
__u8 port_dir; |
| 49 |
__u8 reserved[2]; |
| 50 |
struct xpd_addr ec_addr; |
| 51 |
}; |
| 52 |
|
| 53 |
#define NUM_UNITS 6 |
| 54 |
|
| 55 |
DEF_RPACKET_DATA(GLOBAL, NULL_REPLY); |
| 56 |
DEF_RPACKET_DATA(GLOBAL, AB_REQUEST, __u8 rev; __u8 reserved;); |
| 57 |
DEF_RPACKET_DATA(GLOBAL, AB_DESCRIPTION, __u8 rev; __u8 reserved[3]; |
| 58 |
struct unit_descriptor unit_descriptor[NUM_UNITS];); |
| 59 |
DEF_RPACKET_DATA(GLOBAL, REGISTER_REQUEST, reg_cmd_t reg_cmd;); |
| 60 |
DEF_RPACKET_DATA(GLOBAL, PCM_WRITE, xpp_line_t lines; __u8 pcm[PCM_CHUNKSIZE];); |
| 61 |
DEF_RPACKET_DATA(GLOBAL, PCM_READ, xpp_line_t lines; __u8 pcm[PCM_CHUNKSIZE];); |
| 62 |
DEF_RPACKET_DATA(GLOBAL, SYNC_SOURCE, __u8 sync_mode; __u8 drift;); |
| 63 |
DEF_RPACKET_DATA(GLOBAL, SYNC_REPLY, __u8 sync_mode; __u8 drift;); |
| 64 |
DEF_RPACKET_DATA(GLOBAL, REGISTER_REPLY, reg_cmd_t regcmd;); |
| 65 |
DEF_RPACKET_DATA(GLOBAL, XBUS_RESET, __u8 mask;); |
| 66 |
DEF_RPACKET_DATA(GLOBAL, ERROR_CODE, __u8 category_code; __u8 errorbits; |
| 67 |
__u8 bad_packet[0];); |
| 68 |
|
| 69 |
DECLARE_CMD(GLOBAL, AB_REQUEST); |
| 70 |
DECLARE_CMD(GLOBAL, SYNC_SOURCE, enum sync_mode mode, int drift); |
| 71 |
DECLARE_CMD(GLOBAL, RESET_SPI); |
| 72 |
DECLARE_CMD(GLOBAL, RESET_SYNC_COUNTERS); |
| 73 |
|
| 74 |
int xpp_register_request(xbus_t *xbus, xpd_t *xpd, xportno_t portno, |
| 75 |
bool writing, __u8 regnum, bool do_subreg, __u8 subreg, |
| 76 |
__u8 data_low, bool do_datah, __u8 data_high, |
| 77 |
bool should_reply, bool do_expander); |
| 78 |
int send_multibyte_request(xbus_t *xbus, unsigned unit, xportno_t portno, |
| 79 |
bool eoftx, __u8 *buf, unsigned len); |
| 80 |
int xpp_ram_request(xbus_t *xbus, xpd_t *xpd, xportno_t portno, |
| 81 |
bool writing, |
| 82 |
__u8 addr_low, |
| 83 |
__u8 addr_high, |
| 84 |
__u8 data_0, |
| 85 |
__u8 data_1, |
| 86 |
__u8 data_2, |
| 87 |
__u8 data_3, |
| 88 |
bool should_reply); |
| 89 |
extern xproto_table_t PROTO_TABLE(GLOBAL); |
| 90 |
int run_initialize_registers(xpd_t *xpd); |
| 91 |
int parse_chip_command(xpd_t *xpd, char *cmdline); |
| 92 |
extern charp initdir; |
| 93 |
|
| 94 |
#endif |