1 #ifndef DEVICES_PRTBASE_H
    2 #define DEVICES_PRTBASE_H
    3 
    4 /*
    5 	printer driver definitions (V45)
    6 
    7 	Copyright © 2002 The MorphOS Development Team, All Rights Reserved.
    8 */
    9 
   10 #ifndef UTILITY_TAGITEM_H
   11 # include <utility/tagitem.h>
   12 #endif
   13 
   14 #ifndef EXEC_DEVICES_H
   15 # include <exec/devices.h>
   16 #endif
   17 
   18 #ifndef DEVICES_PARALLEL_H
   19 # include <devices/parallel.h>
   20 #endif
   21 
   22 #ifndef DEVICES_SERIAL_H
   23 # include <devices/serial.h>
   24 #endif
   25 
   26 #ifndef DEVICES_TIMER_H
   27 # include <devices/timer.h>
   28 #endif
   29 
   30 #ifndef DOS_DOSEXTENS_H
   31 # include <dos/dosextens.h>
   32 #endif
   33 
   34 #ifndef INTUITION_INTUITION_H
   35 # include <intuition/intuition.h>
   36 #endif
   37 
   38 #pragma pack(2)
   39 
   40 
   41 struct DeviceData
   42 {
   43 	struct Library dd_Device;
   44 	APTR           dd_Segment;
   45 	APTR           dd_ExecBase;
   46 	APTR           dd_CmdVectors;
   47 	APTR           dd_CmdBytes;
   48 	UWORD          dd_NumCommands;
   49 };
   50 
   51 
   52 /*** V44 ***/
   53 
   54 #define IOB_QUEUED     4
   55 #define IOB_CURRENT    5
   56 #define IOB_SERVICING  6
   57 #define IOB_DONE       7
   58 
   59 #define IOF_QUEUED     (1<<IOB_QUEUED)
   60 #define IOF_CURRENT    (1<<IOB_CURRENT)
   61 #define IOF_SERVICING  (1<<IOB_SERVICING)
   62 #define IOF_DONE       (1<<IOB_DONE)
   63 
   64 
   65 #define PB_IOR0       0
   66 #define PB_IOR1       1
   67 #define PB_IOOPENED   2
   68 #define PB_EXPUNGED   7
   69 
   70 #define PBF_IOR0      (1<<PB_IOR0)
   71 #define PBF_IOR1      (1<<PB_IOR1)
   72 #define PBF_IOOPENED  (1<<PB_IOOPENED)
   73 #define PBF_EXPUNGED  (1<<PB_EXPUNGED)
   74 
   75 /* Typo fix */
   76 
   77 #define PBF_IOOPENDED  PBF_IOOPENED
   78 
   79 
   80 #define DUB_STOPPED  0
   81 #define DUF_STOPPED  (1<<DUB_STOPPED)
   82 
   83 
   84 #define P_OLDSTKSIZE  0x0800
   85 #define P_STKSIZE     0x1000
   86 #define P_BUFSIZE     256
   87 #define P_SAFESIZE    128
   88 
   89 
   90 struct PrinterData
   91 {
   92 	struct DeviceData       pd_Device;
   93 	struct MsgPort          pd_Unit;
   94 	BPTR                    pd_PrinterSegment;
   95 	UWORD                   pd_PrinterType;
   96 	struct PrinterSegment  *pd_SegmentData;
   97 	UBYTE                  *pd_PrintBuf;
   98 
   99 	LONG                  (*pd_PWrite)(VOID);
  100 	LONG                  (*pd_PBothReady)(VOID);
  101 
  102 	union
  103 	{
  104 		struct IOExtPar pd_p0;
  105 		struct IOExtSer pd_s0;
  106 	}                       pd_ior0;
  107 
  108 #	define pd_PIOR0 pd_ior0.pd_p0
  109 #	define pd_SIOR0 pd_ior0.pd_s0
  110 
  111 	union
  112 	{
  113 		struct IOExtPar pd_p1;
  114 		struct IOExtSer pd_s1;
  115 	}                       pd_ior1;
  116 
  117 #	define pd_PIOR1 pd_ior1.pd_p1
  118 #	define pd_SIOR1 pd_ior1.pd_s1
  119 
  120 	struct timerequest      pd_TIOR;
  121 	struct MsgPort          pd_IORPort;
  122 	struct Task             pd_TC;
  123 	UBYTE                   pd_OldStk[P_OLDSTKSIZE];
  124 	UBYTE                   pd_Flags;
  125 	UBYTE                   pd_pad;
  126 
  127 	struct Preferences      pd_Preferences;
  128 	UBYTE                   pd_PWaitEnabled;
  129 	UBYTE                   pd_Flags1;
  130 	UBYTE                   pd_Stk[P_STKSIZE];
  131 
  132 	/*** V44 ***/
  133 
  134 	struct PrinterUnit     *pd_PUnit;
  135 
  136 	LONG                  (*pd_PRead)(VOID);
  137 	LONG                  (*pd_CallErrHook)(VOID);
  138 
  139 	ULONG                   pd_UnitNumber;
  140 	STRPTR                  pd_DriverName;
  141 
  142 	LONG                  (*pd_PQuery)(VOID);
  143 };
  144 
  145 
  146 #define PPCB_GFX        0
  147 #define PPCF_GFX        (1<<PPCB_GFX)
  148 #define PPCB_COLOR      1
  149 #define PPCF_COLOR      (1<<PPCB_COLOR)
  150 
  151 #define PPC_BWALPHA     0x00
  152 #define PPC_BWGFX       0x01
  153 #define PPC_COLORALPHA  0x02
  154 #define PPC_COLORGFX    0x03
  155 
  156 /*** V44 ***/
  157 
  158 #define PPCB_EXTENDED   2
  159 #define PPCF_EXTENDED   (1<<PPCB_EXTENDED)
  160 #define PPCB_NOSTRIP    3
  161 #define PPCF_NOSTRIP    (1<<PPCB_NOSTRIP)
  162 
  163 
  164 #define PCC_BW          0x01
  165 #define PCC_YMC         0x02
  166 #define PCC_YMC_BW      0x03
  167 #define PCC_YMCB        0x04
  168 #define PCC_4COLOR      0x04
  169 #define PCC_ADDITIVE    0x08
  170 #define PCC_WB          0x09
  171 #define PCC_BGR         0x0A
  172 #define PCC_BGR_WB      0x0B
  173 #define PCC_BGRW        0x0C
  174 #define PCC_MULTI_PASS  0x10
  175 
  176 
  177 struct PrinterExtendedData
  178 {
  179 	char            *ped_PrinterName;
  180 
  181 	VOID           (*ped_Init)(VOID);
  182 	VOID           (*ped_Expunge)(VOID);
  183 	LONG           (*ped_Open)(VOID);
  184 	VOID           (*ped_Close)(VOID);
  185 
  186 	UBYTE            ped_PrinterClass;
  187 	UBYTE            ped_ColorClass;
  188 	UBYTE            ped_MaxColumns;
  189 	UBYTE            ped_NumCharSets;
  190 	UWORD            ped_NumRows;
  191 	ULONG            ped_MaxXDots;
  192 	ULONG            ped_MaxYDots;
  193 	UWORD            ped_XDotsInch;
  194 	UWORD            ped_YDotsInch;
  195 	STRPTR         **ped_Commands;
  196 
  197 	LONG           (*ped_DoSpecial)(VOID);
  198 	LONG           (*ped_Render)(VOID);
  199 
  200 	LONG             ped_TimeoutSecs;
  201 	STRPTR          *ped_8BitChars;
  202 	LONG             ped_PrintMode;
  203 
  204 	LONG           (*ped_ConvFunc)(VOID);
  205 
  206 	/*** V44 ***/
  207 
  208 	struct TagItem  *ped_TagList;
  209 
  210 	LONG           (*ped_DoPreferences)(VOID);
  211 	VOID           (*ped_CallErrHook)(VOID);
  212 };
  213 
  214 
  215 /*** V44 ***/
  216 
  217 #define PRTA_Dummy            (TAG_USER + 0x50000)
  218 #define PRTA_8BitGuns         (PRTA_Dummy + 1)
  219 #define PRTA_ConvertSource    (PRTA_Dummy + 2)
  220 #define PRTA_FloydDithering   (PRTA_Dummy + 3)
  221 #define PRTA_AntiAlias        (PRTA_Dummy + 4)
  222 #define PRTA_ColorCorrection  (PRTA_Dummy + 5)
  223 #define PRTA_NoIO             (PRTA_Dummy + 6)
  224 #define PRTA_NewColor         (PRTA_Dummy + 7)
  225 #define PRTA_ColorSize        (PRTA_Dummy + 8)
  226 #define PRTA_NoScaling        (PRTA_Dummy + 9)
  227 
  228 #define PRTA_DitherNames      (PRTA_Dummy + 20)
  229 #define PRTA_ShadingNames     (PRTA_Dummy + 21)
  230 #define PRTA_ColorCorrect     (PRTA_Dummy + 22)
  231 #define PRTA_DensityInfo      (PRTA_Dummy + 23)
  232 
  233 #define PRTA_LeftBorder       (PRTA_Dummy + 30)
  234 #define PRTA_TopBorder        (PRTA_Dummy + 31)
  235 
  236 #define PRTA_MixBWColor       (PRTA_Dummy + 32)
  237 
  238 #define PRTA_Preferences      (PRTA_Dummy + 40)
  239 
  240 
  241 struct PrinterSegment
  242 {
  243 	BPTR                       ps_NextSegment;
  244 	ULONG                      ps_runAlert;
  245 	UWORD                      ps_Version;
  246 	UWORD                      ps_Revision;
  247 	struct PrinterExtendedData ps_PED;
  248 };
  249 
  250 
  251 /*** V44 ***/
  252 
  253 struct PrtDriverPreferences
  254 {
  255 	UWORD pdp_Version;
  256 	UBYTE pdp_PrinterID[32];
  257 	char  pdp_PrefName[FILENAME_SIZE-16];
  258 	ULONG pdp_Length;
  259 };
  260 
  261 
  262 #pragma pack()
  263 
  264 #endif /* DEVICES_PRTBASE_H */