1 /* 2 * drivers/s390/char/hwc_rw.h 3 * interface to the HWC-read/write driver 4 * 5 * S390 version 6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 7 * Author(s): Martin Peschke <mpeschke@de.ibm.com> 8 */ 9 10 #ifndef __HWC_RW_H__ 11 #define __HWC_RW_H__ 12 13 #include <linux/ioctl.h> 14 15 typedef struct { 16 17 void (*move_input) (unsigned char *, unsigned int); 18 19 void (*wake_up) (void); 20 } hwc_high_level_calls_t; 21 22 struct _hwc_request; 23 24 typedef void hwc_callback_t (struct _hwc_request *); 25 26 typedef struct _hwc_request { 27 void *block; 28 u32 word; 29 hwc_callback_t *callback; 30 void *data; 31 } __attribute__ ((packed)) 32 33 hwc_request_t; 34 35 #define HWC_ASCEBC(x) ((MACHINE_IS_VM ? _ascebc[x] : _ascebc_500[x])) 36 37 #define HWC_EBCASC_STR(s,c) ((MACHINE_IS_VM ? EBCASC(s,c) : EBCASC_500(s,c))) 38 39 #define HWC_ASCEBC_STR(s,c) ((MACHINE_IS_VM ? ASCEBC(s,c) : ASCEBC_500(s,c))) 40 41 #define IN_HWCB 1 42 #define IN_WRITE_BUF 2 43 #define IN_BUFS_TOTAL (IN_HWCB | IN_WRITE_BUF) 44 45 typedef unsigned short int ioctl_htab_t; 46 typedef unsigned char ioctl_echo_t; 47 typedef unsigned short int ioctl_cols_t; 48 typedef signed char ioctl_nl_t; 49 typedef unsigned short int ioctl_obuf_t; 50 typedef unsigned char ioctl_case_t; 51 typedef unsigned char ioctl_delim_t; 52 53 typedef struct { 54 ioctl_htab_t width_htab; 55 ioctl_echo_t echo; 56 ioctl_cols_t columns; 57 ioctl_nl_t final_nl; 58 ioctl_obuf_t max_hwcb; 59 ioctl_obuf_t kmem_hwcb; 60 ioctl_case_t tolower; 61 ioctl_delim_t delim; 62 } hwc_ioctls_t; 63 64 static hwc_ioctls_t _hwc_ioctls; 65 66 #define HWC_IOCTL_LETTER 'B' 67 68 #define TIOCHWCSHTAB _IOW(HWC_IOCTL_LETTER, 0, _hwc_ioctls.width_htab) 69 70 #define TIOCHWCSECHO _IOW(HWC_IOCTL_LETTER, 1, _hwc_ioctls.echo) 71 72 #define TIOCHWCSCOLS _IOW(HWC_IOCTL_LETTER, 2, _hwc_ioctls.columns) 73 74 #define TIOCHWCSNL _IOW(HWC_IOCTL_LETTER, 4, _hwc_ioctls.final_nl) 75 76 #define TIOCHWCSOBUF _IOW(HWC_IOCTL_LETTER, 5, _hwc_ioctls.max_hwcb) 77 78 #define TIOCHWCSINIT _IO(HWC_IOCTL_LETTER, 6) 79 80 #define TIOCHWCSCASE _IOW(HWC_IOCTL_LETTER, 7, _hwc_ioctls.tolower) 81 82 #define TIOCHWCSDELIM _IOW(HWC_IOCTL_LETTER, 9, _hwc_ioctls.delim) 83 84 #define TIOCHWCGHTAB _IOR(HWC_IOCTL_LETTER, 10, _hwc_ioctls.width_htab) 85 86 #define TIOCHWCGECHO _IOR(HWC_IOCTL_LETTER, 11, _hwc_ioctls.echo) 87 88 #define TIOCHWCGCOLS _IOR(HWC_IOCTL_LETTER, 12, _hwc_ioctls.columns) 89 90 #define TIOCHWCGNL _IOR(HWC_IOCTL_LETTER, 14, _hwc_ioctls.final_nl) 91 92 #define TIOCHWCGOBUF _IOR(HWC_IOCTL_LETTER, 15, _hwc_ioctls.max_hwcb) 93 94 #define TIOCHWCGINIT _IOR(HWC_IOCTL_LETTER, 16, _hwc_ioctls) 95 96 #define TIOCHWCGCASE _IOR(HWC_IOCTL_LETTER, 17, _hwc_ioctls.tolower) 97 98 #define TIOCHWCGDELIM _IOR(HWC_IOCTL_LETTER, 19, _hwc_ioctls.delim) 99 100 #define TIOCHWCGKBUF _IOR(HWC_IOCTL_LETTER, 20, _hwc_ioctls.max_hwcb) 101 102 #define TIOCHWCGCURR _IOR(HWC_IOCTL_LETTER, 21, _hwc_ioctls) 103 104 #ifndef __HWC_RW_C__ 105 106 extern int hwc_init (void); 107 108 extern int hwc_write (int from_user, const unsigned char *, unsigned int); 109 110 extern unsigned int hwc_chars_in_buffer (unsigned char); 111 112 extern unsigned int hwc_write_room (unsigned char); 113 114 extern void hwc_flush_buffer (unsigned char); 115 116 extern void hwc_unblank (void); 117 118 extern signed int hwc_ioctl (unsigned int, unsigned long); 119 120 extern void do_hwc_interrupt (void); 121 122 extern int hwc_printk (const char *,...); 123 124 extern signed int hwc_register_calls (hwc_high_level_calls_t *); 125 126 extern signed int hwc_unregister_calls (hwc_high_level_calls_t *); 127 128 extern int hwc_send (hwc_request_t *); 129 130 #endif 131 132 #endif 133