ipoctal232.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /*
  2. * QEMU GE IP-Octal 232 IndustryPack emulation
  3. *
  4. * Copyright (C) 2012 Igalia, S.L.
  5. * Author: Alberto Garcia <berto@igalia.com>
  6. *
  7. * This code is licensed under the GNU GPL v2 or (at your option) any
  8. * later version.
  9. */
  10. #include "qemu/osdep.h"
  11. #include "hw/ipack/ipack.h"
  12. #include "hw/irq.h"
  13. #include "hw/qdev-properties.h"
  14. #include "migration/vmstate.h"
  15. #include "qemu/bitops.h"
  16. #include "qemu/module.h"
  17. #include "chardev/char-fe.h"
  18. /* #define DEBUG_IPOCTAL */
  19. #ifdef DEBUG_IPOCTAL
  20. #define DPRINTF2(fmt, ...) \
  21. do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
  22. #else
  23. #define DPRINTF2(fmt, ...) do { } while (0)
  24. #endif
  25. #define DPRINTF(fmt, ...) DPRINTF2("IP-Octal: " fmt, ## __VA_ARGS__)
  26. #define RX_FIFO_SIZE 3
  27. /* The IP-Octal has 8 channels (a-h)
  28. divided into 4 blocks (A-D) */
  29. #define N_CHANNELS 8
  30. #define N_BLOCKS 4
  31. #define REG_MRa 0x01
  32. #define REG_MRb 0x11
  33. #define REG_SRa 0x03
  34. #define REG_SRb 0x13
  35. #define REG_CSRa 0x03
  36. #define REG_CSRb 0x13
  37. #define REG_CRa 0x05
  38. #define REG_CRb 0x15
  39. #define REG_RHRa 0x07
  40. #define REG_RHRb 0x17
  41. #define REG_THRa 0x07
  42. #define REG_THRb 0x17
  43. #define REG_ACR 0x09
  44. #define REG_ISR 0x0B
  45. #define REG_IMR 0x0B
  46. #define REG_OPCR 0x1B
  47. #define CR_ENABLE_RX BIT(0)
  48. #define CR_DISABLE_RX BIT(1)
  49. #define CR_ENABLE_TX BIT(2)
  50. #define CR_DISABLE_TX BIT(3)
  51. #define CR_CMD(cr) ((cr) >> 4)
  52. #define CR_NO_OP 0
  53. #define CR_RESET_MR 1
  54. #define CR_RESET_RX 2
  55. #define CR_RESET_TX 3
  56. #define CR_RESET_ERR 4
  57. #define CR_RESET_BRKINT 5
  58. #define CR_START_BRK 6
  59. #define CR_STOP_BRK 7
  60. #define CR_ASSERT_RTSN 8
  61. #define CR_NEGATE_RTSN 9
  62. #define CR_TIMEOUT_ON 10
  63. #define CR_TIMEOUT_OFF 12
  64. #define SR_RXRDY BIT(0)
  65. #define SR_FFULL BIT(1)
  66. #define SR_TXRDY BIT(2)
  67. #define SR_TXEMT BIT(3)
  68. #define SR_OVERRUN BIT(4)
  69. #define SR_PARITY BIT(5)
  70. #define SR_FRAMING BIT(6)
  71. #define SR_BREAK BIT(7)
  72. #define ISR_TXRDYA BIT(0)
  73. #define ISR_RXRDYA BIT(1)
  74. #define ISR_BREAKA BIT(2)
  75. #define ISR_CNTRDY BIT(3)
  76. #define ISR_TXRDYB BIT(4)
  77. #define ISR_RXRDYB BIT(5)
  78. #define ISR_BREAKB BIT(6)
  79. #define ISR_MPICHG BIT(7)
  80. #define ISR_TXRDY(CH) (((CH) & 1) ? BIT(4) : BIT(0))
  81. #define ISR_RXRDY(CH) (((CH) & 1) ? BIT(5) : BIT(1))
  82. #define ISR_BREAK(CH) (((CH) & 1) ? BIT(6) : BIT(2))
  83. typedef struct IPOctalState IPOctalState;
  84. typedef struct SCC2698Channel SCC2698Channel;
  85. typedef struct SCC2698Block SCC2698Block;
  86. struct SCC2698Channel {
  87. IPOctalState *ipoctal;
  88. CharBackend dev;
  89. bool rx_enabled;
  90. uint8_t mr[2];
  91. uint8_t mr_idx;
  92. uint8_t sr;
  93. uint8_t rhr[RX_FIFO_SIZE];
  94. uint8_t rhr_idx;
  95. uint8_t rx_pending;
  96. };
  97. struct SCC2698Block {
  98. uint8_t imr;
  99. uint8_t isr;
  100. };
  101. struct IPOctalState {
  102. IPackDevice parent_obj;
  103. SCC2698Channel ch[N_CHANNELS];
  104. SCC2698Block blk[N_BLOCKS];
  105. uint8_t irq_vector;
  106. };
  107. #define TYPE_IPOCTAL "ipoctal232"
  108. #define IPOCTAL(obj) \
  109. OBJECT_CHECK(IPOctalState, (obj), TYPE_IPOCTAL)
  110. static const VMStateDescription vmstate_scc2698_channel = {
  111. .name = "scc2698_channel",
  112. .version_id = 1,
  113. .minimum_version_id = 1,
  114. .fields = (VMStateField[]) {
  115. VMSTATE_BOOL(rx_enabled, SCC2698Channel),
  116. VMSTATE_UINT8_ARRAY(mr, SCC2698Channel, 2),
  117. VMSTATE_UINT8(mr_idx, SCC2698Channel),
  118. VMSTATE_UINT8(sr, SCC2698Channel),
  119. VMSTATE_UINT8_ARRAY(rhr, SCC2698Channel, RX_FIFO_SIZE),
  120. VMSTATE_UINT8(rhr_idx, SCC2698Channel),
  121. VMSTATE_UINT8(rx_pending, SCC2698Channel),
  122. VMSTATE_END_OF_LIST()
  123. }
  124. };
  125. static const VMStateDescription vmstate_scc2698_block = {
  126. .name = "scc2698_block",
  127. .version_id = 1,
  128. .minimum_version_id = 1,
  129. .fields = (VMStateField[]) {
  130. VMSTATE_UINT8(imr, SCC2698Block),
  131. VMSTATE_UINT8(isr, SCC2698Block),
  132. VMSTATE_END_OF_LIST()
  133. }
  134. };
  135. static const VMStateDescription vmstate_ipoctal = {
  136. .name = "ipoctal232",
  137. .version_id = 1,
  138. .minimum_version_id = 1,
  139. .fields = (VMStateField[]) {
  140. VMSTATE_IPACK_DEVICE(parent_obj, IPOctalState),
  141. VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS, 1,
  142. vmstate_scc2698_channel, SCC2698Channel),
  143. VMSTATE_STRUCT_ARRAY(blk, IPOctalState, N_BLOCKS, 1,
  144. vmstate_scc2698_block, SCC2698Block),
  145. VMSTATE_UINT8(irq_vector, IPOctalState),
  146. VMSTATE_END_OF_LIST()
  147. }
  148. };
  149. /* data[10] is 0x0C, not 0x0B as the doc says */
  150. static const uint8_t id_prom_data[] = {
  151. 0x49, 0x50, 0x41, 0x43, 0xF0, 0x22,
  152. 0xA1, 0x00, 0x00, 0x00, 0x0C, 0xCC
  153. };
  154. static void update_irq(IPOctalState *dev, unsigned block)
  155. {
  156. IPackDevice *idev = IPACK_DEVICE(dev);
  157. /* Blocks A and B interrupt on INT0#, C and D on INT1#.
  158. Thus, to get the status we have to check two blocks. */
  159. SCC2698Block *blk0 = &dev->blk[block];
  160. SCC2698Block *blk1 = &dev->blk[block^1];
  161. unsigned intno = block / 2;
  162. if ((blk0->isr & blk0->imr) || (blk1->isr & blk1->imr)) {
  163. qemu_irq_raise(idev->irq[intno]);
  164. } else {
  165. qemu_irq_lower(idev->irq[intno]);
  166. }
  167. }
  168. static void write_cr(IPOctalState *dev, unsigned channel, uint8_t val)
  169. {
  170. SCC2698Channel *ch = &dev->ch[channel];
  171. SCC2698Block *blk = &dev->blk[channel / 2];
  172. DPRINTF("Write CR%c %u: ", channel + 'a', val);
  173. /* The lower 4 bits are used to enable and disable Tx and Rx */
  174. if (val & CR_ENABLE_RX) {
  175. DPRINTF2("Rx on, ");
  176. ch->rx_enabled = true;
  177. }
  178. if (val & CR_DISABLE_RX) {
  179. DPRINTF2("Rx off, ");
  180. ch->rx_enabled = false;
  181. }
  182. if (val & CR_ENABLE_TX) {
  183. DPRINTF2("Tx on, ");
  184. ch->sr |= SR_TXRDY | SR_TXEMT;
  185. blk->isr |= ISR_TXRDY(channel);
  186. }
  187. if (val & CR_DISABLE_TX) {
  188. DPRINTF2("Tx off, ");
  189. ch->sr &= ~(SR_TXRDY | SR_TXEMT);
  190. blk->isr &= ~ISR_TXRDY(channel);
  191. }
  192. DPRINTF2("cmd: ");
  193. /* The rest of the bits implement different commands */
  194. switch (CR_CMD(val)) {
  195. case CR_NO_OP:
  196. DPRINTF2("none");
  197. break;
  198. case CR_RESET_MR:
  199. DPRINTF2("reset MR");
  200. ch->mr_idx = 0;
  201. break;
  202. case CR_RESET_RX:
  203. DPRINTF2("reset Rx");
  204. ch->rx_enabled = false;
  205. ch->rx_pending = 0;
  206. ch->sr &= ~SR_RXRDY;
  207. blk->isr &= ~ISR_RXRDY(channel);
  208. break;
  209. case CR_RESET_TX:
  210. DPRINTF2("reset Tx");
  211. ch->sr &= ~(SR_TXRDY | SR_TXEMT);
  212. blk->isr &= ~ISR_TXRDY(channel);
  213. break;
  214. case CR_RESET_ERR:
  215. DPRINTF2("reset err");
  216. ch->sr &= ~(SR_OVERRUN | SR_PARITY | SR_FRAMING | SR_BREAK);
  217. break;
  218. case CR_RESET_BRKINT:
  219. DPRINTF2("reset brk ch int");
  220. blk->isr &= ~(ISR_BREAKA | ISR_BREAKB);
  221. break;
  222. default:
  223. DPRINTF2("unsupported 0x%x", CR_CMD(val));
  224. }
  225. DPRINTF2("\n");
  226. }
  227. static uint16_t io_read(IPackDevice *ip, uint8_t addr)
  228. {
  229. IPOctalState *dev = IPOCTAL(ip);
  230. uint16_t ret = 0;
  231. /* addr[7:6]: block (A-D)
  232. addr[7:5]: channel (a-h)
  233. addr[5:0]: register */
  234. unsigned block = addr >> 5;
  235. unsigned channel = addr >> 4;
  236. /* Big endian, accessed using 8-bit bytes at odd locations */
  237. unsigned offset = (addr & 0x1F) ^ 1;
  238. SCC2698Channel *ch = &dev->ch[channel];
  239. SCC2698Block *blk = &dev->blk[block];
  240. uint8_t old_isr = blk->isr;
  241. switch (offset) {
  242. case REG_MRa:
  243. case REG_MRb:
  244. ret = ch->mr[ch->mr_idx];
  245. DPRINTF("Read MR%u%c: 0x%x\n", ch->mr_idx + 1, channel + 'a', ret);
  246. ch->mr_idx = 1;
  247. break;
  248. case REG_SRa:
  249. case REG_SRb:
  250. ret = ch->sr;
  251. DPRINTF("Read SR%c: 0x%x\n", channel + 'a', ret);
  252. break;
  253. case REG_RHRa:
  254. case REG_RHRb:
  255. ret = ch->rhr[ch->rhr_idx];
  256. if (ch->rx_pending > 0) {
  257. ch->rx_pending--;
  258. if (ch->rx_pending == 0) {
  259. ch->sr &= ~SR_RXRDY;
  260. blk->isr &= ~ISR_RXRDY(channel);
  261. qemu_chr_fe_accept_input(&ch->dev);
  262. } else {
  263. ch->rhr_idx = (ch->rhr_idx + 1) % RX_FIFO_SIZE;
  264. }
  265. if (ch->sr & SR_BREAK) {
  266. ch->sr &= ~SR_BREAK;
  267. blk->isr |= ISR_BREAK(channel);
  268. }
  269. }
  270. DPRINTF("Read RHR%c (0x%x)\n", channel + 'a', ret);
  271. break;
  272. case REG_ISR:
  273. ret = blk->isr;
  274. DPRINTF("Read ISR%c: 0x%x\n", block + 'A', ret);
  275. break;
  276. default:
  277. DPRINTF("Read unknown/unsupported register 0x%02x\n", offset);
  278. }
  279. if (old_isr != blk->isr) {
  280. update_irq(dev, block);
  281. }
  282. return ret;
  283. }
  284. static void io_write(IPackDevice *ip, uint8_t addr, uint16_t val)
  285. {
  286. IPOctalState *dev = IPOCTAL(ip);
  287. unsigned reg = val & 0xFF;
  288. /* addr[7:6]: block (A-D)
  289. addr[7:5]: channel (a-h)
  290. addr[5:0]: register */
  291. unsigned block = addr >> 5;
  292. unsigned channel = addr >> 4;
  293. /* Big endian, accessed using 8-bit bytes at odd locations */
  294. unsigned offset = (addr & 0x1F) ^ 1;
  295. SCC2698Channel *ch = &dev->ch[channel];
  296. SCC2698Block *blk = &dev->blk[block];
  297. uint8_t old_isr = blk->isr;
  298. uint8_t old_imr = blk->imr;
  299. switch (offset) {
  300. case REG_MRa:
  301. case REG_MRb:
  302. ch->mr[ch->mr_idx] = reg;
  303. DPRINTF("Write MR%u%c 0x%x\n", ch->mr_idx + 1, channel + 'a', reg);
  304. ch->mr_idx = 1;
  305. break;
  306. /* Not implemented */
  307. case REG_CSRa:
  308. case REG_CSRb:
  309. DPRINTF("Write CSR%c: 0x%x\n", channel + 'a', reg);
  310. break;
  311. case REG_CRa:
  312. case REG_CRb:
  313. write_cr(dev, channel, reg);
  314. break;
  315. case REG_THRa:
  316. case REG_THRb:
  317. if (ch->sr & SR_TXRDY) {
  318. uint8_t thr = reg;
  319. DPRINTF("Write THR%c (0x%x)\n", channel + 'a', reg);
  320. /* XXX this blocks entire thread. Rewrite to use
  321. * qemu_chr_fe_write and background I/O callbacks */
  322. qemu_chr_fe_write_all(&ch->dev, &thr, 1);
  323. } else {
  324. DPRINTF("Write THR%c (0x%x), Tx disabled\n", channel + 'a', reg);
  325. }
  326. break;
  327. /* Not implemented */
  328. case REG_ACR:
  329. DPRINTF("Write ACR%c 0x%x\n", block + 'A', val);
  330. break;
  331. case REG_IMR:
  332. DPRINTF("Write IMR%c 0x%x\n", block + 'A', val);
  333. blk->imr = reg;
  334. break;
  335. /* Not implemented */
  336. case REG_OPCR:
  337. DPRINTF("Write OPCR%c 0x%x\n", block + 'A', val);
  338. break;
  339. default:
  340. DPRINTF("Write unknown/unsupported register 0x%02x %u\n", offset, val);
  341. }
  342. if (old_isr != blk->isr || old_imr != blk->imr) {
  343. update_irq(dev, block);
  344. }
  345. }
  346. static uint16_t id_read(IPackDevice *ip, uint8_t addr)
  347. {
  348. uint16_t ret = 0;
  349. unsigned pos = addr / 2; /* The ID PROM data is stored every other byte */
  350. if (pos < ARRAY_SIZE(id_prom_data)) {
  351. ret = id_prom_data[pos];
  352. } else {
  353. DPRINTF("Attempt to read unavailable PROM data at 0x%x\n", addr);
  354. }
  355. return ret;
  356. }
  357. static void id_write(IPackDevice *ip, uint8_t addr, uint16_t val)
  358. {
  359. IPOctalState *dev = IPOCTAL(ip);
  360. if (addr == 1) {
  361. DPRINTF("Write IRQ vector: %u\n", (unsigned) val);
  362. dev->irq_vector = val; /* Undocumented, but the hw works like that */
  363. } else {
  364. DPRINTF("Attempt to write 0x%x to 0x%x\n", val, addr);
  365. }
  366. }
  367. static uint16_t int_read(IPackDevice *ip, uint8_t addr)
  368. {
  369. IPOctalState *dev = IPOCTAL(ip);
  370. /* Read address 0 to ACK INT0# and address 2 to ACK INT1# */
  371. if (addr != 0 && addr != 2) {
  372. DPRINTF("Attempt to read from 0x%x\n", addr);
  373. return 0;
  374. } else {
  375. /* Update interrupts if necessary */
  376. update_irq(dev, addr);
  377. return dev->irq_vector;
  378. }
  379. }
  380. static void int_write(IPackDevice *ip, uint8_t addr, uint16_t val)
  381. {
  382. DPRINTF("Attempt to write 0x%x to 0x%x\n", val, addr);
  383. }
  384. static uint16_t mem_read16(IPackDevice *ip, uint32_t addr)
  385. {
  386. DPRINTF("Attempt to read from 0x%x\n", addr);
  387. return 0;
  388. }
  389. static void mem_write16(IPackDevice *ip, uint32_t addr, uint16_t val)
  390. {
  391. DPRINTF("Attempt to write 0x%x to 0x%x\n", val, addr);
  392. }
  393. static uint8_t mem_read8(IPackDevice *ip, uint32_t addr)
  394. {
  395. DPRINTF("Attempt to read from 0x%x\n", addr);
  396. return 0;
  397. }
  398. static void mem_write8(IPackDevice *ip, uint32_t addr, uint8_t val)
  399. {
  400. IPOctalState *dev = IPOCTAL(ip);
  401. if (addr == 1) {
  402. DPRINTF("Write IRQ vector: %u\n", (unsigned) val);
  403. dev->irq_vector = val;
  404. } else {
  405. DPRINTF("Attempt to write 0x%x to 0x%x\n", val, addr);
  406. }
  407. }
  408. static int hostdev_can_receive(void *opaque)
  409. {
  410. SCC2698Channel *ch = opaque;
  411. int available_bytes = RX_FIFO_SIZE - ch->rx_pending;
  412. return ch->rx_enabled ? available_bytes : 0;
  413. }
  414. static void hostdev_receive(void *opaque, const uint8_t *buf, int size)
  415. {
  416. SCC2698Channel *ch = opaque;
  417. IPOctalState *dev = ch->ipoctal;
  418. unsigned pos = ch->rhr_idx + ch->rx_pending;
  419. int i;
  420. assert(size + ch->rx_pending <= RX_FIFO_SIZE);
  421. /* Copy data to the RxFIFO */
  422. for (i = 0; i < size; i++) {
  423. pos %= RX_FIFO_SIZE;
  424. ch->rhr[pos++] = buf[i];
  425. }
  426. ch->rx_pending += size;
  427. /* If the RxFIFO was empty raise an interrupt */
  428. if (!(ch->sr & SR_RXRDY)) {
  429. unsigned block, channel = 0;
  430. /* Find channel number to update the ISR register */
  431. while (&dev->ch[channel] != ch) {
  432. channel++;
  433. }
  434. block = channel / 2;
  435. dev->blk[block].isr |= ISR_RXRDY(channel);
  436. ch->sr |= SR_RXRDY;
  437. update_irq(dev, block);
  438. }
  439. }
  440. static void hostdev_event(void *opaque, QEMUChrEvent event)
  441. {
  442. SCC2698Channel *ch = opaque;
  443. switch (event) {
  444. case CHR_EVENT_OPENED:
  445. DPRINTF("Device %s opened\n", ch->dev->label);
  446. break;
  447. case CHR_EVENT_BREAK: {
  448. uint8_t zero = 0;
  449. DPRINTF("Device %s received break\n", ch->dev->label);
  450. if (!(ch->sr & SR_BREAK)) {
  451. IPOctalState *dev = ch->ipoctal;
  452. unsigned block, channel = 0;
  453. while (&dev->ch[channel] != ch) {
  454. channel++;
  455. }
  456. block = channel / 2;
  457. ch->sr |= SR_BREAK;
  458. dev->blk[block].isr |= ISR_BREAK(channel);
  459. }
  460. /* Put a zero character in the buffer */
  461. hostdev_receive(ch, &zero, 1);
  462. }
  463. break;
  464. default:
  465. DPRINTF("Device %s received event %d\n", ch->dev->label, event);
  466. }
  467. }
  468. static void ipoctal_realize(DeviceState *dev, Error **errp)
  469. {
  470. IPOctalState *s = IPOCTAL(dev);
  471. unsigned i;
  472. for (i = 0; i < N_CHANNELS; i++) {
  473. SCC2698Channel *ch = &s->ch[i];
  474. ch->ipoctal = s;
  475. /* Redirect IP-Octal channels to host character devices */
  476. if (qemu_chr_fe_backend_connected(&ch->dev)) {
  477. qemu_chr_fe_set_handlers(&ch->dev, hostdev_can_receive,
  478. hostdev_receive, hostdev_event,
  479. NULL, ch, NULL, true);
  480. DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label);
  481. } else {
  482. DPRINTF("Could not redirect channel %u, no chardev set\n", i);
  483. }
  484. }
  485. }
  486. static Property ipoctal_properties[] = {
  487. DEFINE_PROP_CHR("chardev0", IPOctalState, ch[0].dev),
  488. DEFINE_PROP_CHR("chardev1", IPOctalState, ch[1].dev),
  489. DEFINE_PROP_CHR("chardev2", IPOctalState, ch[2].dev),
  490. DEFINE_PROP_CHR("chardev3", IPOctalState, ch[3].dev),
  491. DEFINE_PROP_CHR("chardev4", IPOctalState, ch[4].dev),
  492. DEFINE_PROP_CHR("chardev5", IPOctalState, ch[5].dev),
  493. DEFINE_PROP_CHR("chardev6", IPOctalState, ch[6].dev),
  494. DEFINE_PROP_CHR("chardev7", IPOctalState, ch[7].dev),
  495. DEFINE_PROP_END_OF_LIST(),
  496. };
  497. static void ipoctal_class_init(ObjectClass *klass, void *data)
  498. {
  499. DeviceClass *dc = DEVICE_CLASS(klass);
  500. IPackDeviceClass *ic = IPACK_DEVICE_CLASS(klass);
  501. ic->realize = ipoctal_realize;
  502. ic->io_read = io_read;
  503. ic->io_write = io_write;
  504. ic->id_read = id_read;
  505. ic->id_write = id_write;
  506. ic->int_read = int_read;
  507. ic->int_write = int_write;
  508. ic->mem_read16 = mem_read16;
  509. ic->mem_write16 = mem_write16;
  510. ic->mem_read8 = mem_read8;
  511. ic->mem_write8 = mem_write8;
  512. set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
  513. dc->desc = "GE IP-Octal 232 8-channel RS-232 IndustryPack";
  514. device_class_set_props(dc, ipoctal_properties);
  515. dc->vmsd = &vmstate_ipoctal;
  516. }
  517. static const TypeInfo ipoctal_info = {
  518. .name = TYPE_IPOCTAL,
  519. .parent = TYPE_IPACK_DEVICE,
  520. .instance_size = sizeof(IPOctalState),
  521. .class_init = ipoctal_class_init,
  522. };
  523. static void ipoctal_register_types(void)
  524. {
  525. type_register_static(&ipoctal_info);
  526. }
  527. type_init(ipoctal_register_types)