2 * Boiler System Bus Gateway -- Interface Definitions
4 * (c) 2020 Martin Mareš <mj@ucw.cz>
7 #define BSB_USB_VENDOR 0x4242
8 #define BSB_USB_PRODUCT 0x0003
9 #define BSB_USB_VERSION 0x0100
14 * 0x00 = control endpoint
15 * Vendor-defined request 0x00 sends struct bsb_stats in little endian.
17 * 0x01 = bulk endpoint
18 * Used for sending frames to BSB. Accepts BSB frames. CRC will be calculated
21 * 0x82 = interrupt endpoint
22 * Used for receiving frames from BSB and status reports on sent frames.
23 * The first byte is a status byte (TX_RESULT_xxx), the rest is a frame.
24 * If status == TX_RESULT_NONE, the frame is a received frame.
25 * If status == TX_RESULT_OK, the frame is a received reply to the sent frame.
26 * Otherwise, the status indicates transmit error and the frame is empty.
29 // Status sent on the interrupt endpoint
30 #define BSB_TX_RESULTS \
40 #define P(x) TX_RESULT_##x,
45 // Statistics sent on the control endpoint
58 P(tx_reply_timeouts) \
69 * Structure of BSB frames
71 * start of frame (0xdc)
72 * source address XOR 0x80
76 * <parameters depending on operation>
80 // Positions of fields in a frame
91 BSB_ADDR_EXT_BOARD = 3,
94 BSB_ADDR_GATEWAY = 0x42, // That's us
95 BSB_ADDR_BROADCAST = 0x7f,
99 BSB_OP_REQUEST_INFO = 1,
107 BSB_OP_QUERY_DEFAULT = 0x0f,
108 BSB_OP_ANSWER_DEFAULT = 0x10,