2 * Unix Eicon active card driver
3 * XLOG related functions
5 * Copyright (C) Eicon Technology Corporation, 2000.
7 * Eicon File Revision : 1.2
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
24 * convert/copy XLOG info into a KLOG entry
28 void xlog_to_klog(byte *b, int size, int card_num)
44 x = (card_xlog_t *) b;
46 memset(&klog, 0, sizeof(klog));
48 klog.time_stamp = (dword) x->time_hi;
49 klog.time_stamp = (klog.time_stamp << 16) | (dword) x->time_lo;
51 klog.length = size > sizeof(klog.buffer) ? sizeof(klog.buffer) : size;
56 klog.type = KLOG_XTXT_MSG;
58 memcpy(klog.buffer, &x->xcode, klog.length);
60 else if (x->code == 2)
62 klog.type = KLOG_XLOG_MSG;
64 memcpy(klog.buffer, &x->data, klog.length);
69 klog.type = KLOG_TEXT_MSG;
71 c = "divas: invalid xlog message code from card";
82 /* send to the log driver and return */
84 DivasLogAdd(&klog, sizeof(klog));
90 * send an XLOG request down to specified card
91 * if response available from previous request then read it
92 * if not then just send down new request, ready for next time
95 void DivasXlogReq(int card_num)
101 if ((card_num < 0) || (card_num > DivasCardNext))
103 DPRINTF(("xlog: invalid card number"));
107 card = &DivasCards[card_num];
109 if (DivasXlogRetrieve(card))
114 /* send down request for next time */
118 a->ram_out(a, (word *) (card->xlog_offset + 1), 0);
119 a->ram_out(a, (word *) (dword) (card->xlog_offset), DO_LOG);
125 * retrieve XLOG request from specified card
126 * returns non-zero if new request sent to card
129 int DivasXlogRetrieve(card_t *card)
133 struct mi_pc_maint pcm;
137 /* get status of last request */
139 pcm.rc = a->ram_in(a, (word *)(card->xlog_offset + 1));
141 /* if nothing there from previous request, send down a new one */
145 /* read in response */
147 a->ram_in_buffer(a, (word *) (dword) card->xlog_offset, &pcm, sizeof(pcm));
149 xlog_to_klog((byte *) &pcm.data, sizeof(pcm.data),
150 (int) (card - DivasCards));
153 /* if any response received from card, re-send request */
157 a->ram_out(a, (word *) (card->xlog_offset + 1), 0);
158 a->ram_out(a, (word *) (dword) (card->xlog_offset), DO_LOG);