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