xref: /qemu/include/hw/s390x/3270-ccw.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
1 /*
2  * Emulated ccw-attached 3270 definitions
3  *
4  * Copyright 2017 IBM Corp.
5  * Author(s): Yang Chen <bjcyang@linux.vnet.ibm.com>
6  *            Jing Liu <liujbjl@linux.vnet.ibm.com>
7  *
8  * This work is licensed under the terms of the GNU GPL, version 2 or (at
9  * your option) any later version. See the COPYING file in the top-level
10  * directory.
11  */
12 
13 #ifndef HW_S390X_3270_CCW_H
14 #define HW_S390X_3270_CCW_H
15 
16 #include "hw/sysbus.h"
17 #include "hw/s390x/css.h"
18 #include "hw/s390x/ccw-device.h"
19 #include "qom/object.h"
20 
21 #define EMULATED_CCW_3270_CU_TYPE 0x3270
22 #define EMULATED_CCW_3270_CHPID_TYPE 0x1a
23 
24 #define TYPE_EMULATED_CCW_3270 "emulated-ccw-3270"
25 
26 /* Local Channel Commands */
27 #define TC_WRITE   0x01         /* Write */
28 #define TC_RDBUF   0x02         /* Read buffer */
29 #define TC_EWRITE  0x05         /* Erase write */
30 #define TC_READMOD 0x06         /* Read modified */
31 #define TC_EWRITEA 0x0d         /* Erase write alternate */
32 #define TC_WRITESF 0x11         /* Write structured field */
33 
34 typedef struct EmulatedCcw3270Class EmulatedCcw3270Class;
35 typedef struct EmulatedCcw3270Device EmulatedCcw3270Device;
36 #define EMULATED_CCW_3270(obj) \
37      OBJECT_CHECK(EmulatedCcw3270Device, (obj), TYPE_EMULATED_CCW_3270)
38 #define EMULATED_CCW_3270_CLASS(klass) \
39      OBJECT_CLASS_CHECK(EmulatedCcw3270Class, (klass), TYPE_EMULATED_CCW_3270)
40 #define EMULATED_CCW_3270_GET_CLASS(obj) \
41      OBJECT_GET_CLASS(EmulatedCcw3270Class, (obj), TYPE_EMULATED_CCW_3270)
42 
43 struct EmulatedCcw3270Device {
44     CcwDevice parent_obj;
45 };
46 
47 struct EmulatedCcw3270Class {
48     CCWDeviceClass parent_class;
49 
50     void (*init)(EmulatedCcw3270Device *, Error **);
51     int (*read_payload_3270)(EmulatedCcw3270Device *);
52     int (*write_payload_3270)(EmulatedCcw3270Device *, uint8_t);
53 };
54 
55 #endif
56