27#define DISPFILE "c:\\display.ini"
28#define DISP_MODE_VGA 1
29#define DISP_MODE_GENESIS 2
31#if defined (IM_DEV_ODYSSEY)
32#define DISP_FLAG 0x3000000
34#define DISP_FLAG 0x5000000
50static _IM_DISP_PARAMS_ST DispParams;
51static long GetDisplayParams(_IM_DISP_PARAMS_ST *DispParams);
53void myDevAlloc(
long System,
long Node,
char *ShellFile,
long Mode,
long *DevPtr);
54void myBufChild(
long Thread,
long Buf,
long StartX,
long StartY,
long SizeX,
long SizeY,
long *ChildPtr);
55void myBufCopy(
long Thread,
long SrcBuf,
long DstBuf,
long Control,
long OSB);
56void myBufCopyVM(
long Thread,
long SrcBuf,
long DstBuf,
long SrcControl,
long DstControl,
long OSB);
57void myBufClear(
long Thread,
long Buf,
double Value,
long OSB);
58long myDispInquire(
long Thread,
long Disp,
long Item,
void *ValuePtr);
59void myDispControl(
long Thread,
long Disp,
long Control,
long Mode);
60void myDispAlloc(
long Thread,
long System,
long Display,
char *DispFile,
long Mode,
long *DispPtr);
61void myDispFree(
long Thread,
long Display);
64void myDevAlloc(
long System,
long Node,
char *ShellFile,
long Mode,
long *DevPtr)
66 GetDisplayParams(&DispParams);
68 imDevAlloc(System, Node, ShellFile, Mode, DevPtr);
72long myDispInquire(
long Thread,
long Disp,
long Item,
void *ValuePtr)
84 if (DispParams.Bands == 1)
86 else if (DispParams.Bands == 3)
93 Value = DispParams.SizeX;
97 Value = DispParams.SizeY;
106 Value = DispParams.KeyVal;
128 *(
long *)ValuePtr = Value;
134void myDispControl(
long Thread,
long Disp,
long Control,
long Mode)
143void myDispAlloc(
long Thread,
long System,
long Display,
char *DispFile,
long Mode,
long *DispPtr)
158void myDispFree(
long Thread,
long Display)
165void myBufChild(
long Thread,
long Buf,
long StartX,
long StartY,
long SizeX,
long SizeY,
long *ChildPtr)
167 long Address[3], Pitch, BytesPerPixel, Type, NumBands;
171 imBufChild(Thread, Buf, StartX, StartY, SizeX, SizeY, ChildPtr);
175 if (SizeX ==
IM_ALL || (StartX + SizeX ) > DispParams.SizeX)
176 SizeX = DispParams.SizeX - StartX;
177 if (SizeY ==
IM_ALL || (StartY + SizeY ) > DispParams.SizeY)
178 SizeY = DispParams.SizeY - StartY;
180 if (DispParams.Address != 0)
182 Address[0] = DispParams.Address;
183 Pitch = DispParams.Pitch;
184 NumBands = DispParams.Bands;
186 if (DispParams.Mode == DISP_MODE_VGA)
198 Address[0] += (StartX * BytesPerPixel) + (StartY * Pitch);
205 Address[0] += (StartX * BytesPerPixel) + (StartY * Pitch);
208 Address[1] = Address[0] + 0x200000;
209 Address[2] = Address[1] + 0x200000;
220void myBufCopy(
long Thread,
long SrcBuf,
long DstBuf,
long Control,
long OSB)
222 if ((DstBuf & DISP_FLAG) != DISP_FLAG)
224 imBufCopy(Thread, SrcBuf, DstBuf, Control, OSB);
228 if (DispParams.Mode == DISP_MODE_VGA)
230#if defined(IM_DEV_ODYSSEY)
231 if (DispParams.Bands == 3)
237 if (DispParams.Bands == 1)
250 long Bands[4], Buf4Band;
252 Bands[0] = Bands[1] = Bands[2] = Bands[3] = SrcBuf;
254 imBufCopy(Thread, Buf4Band, DstBuf, 0, OSB);
257 else if (NumBands == 3)
269#if defined(IM_DEV_ODYSSEY)
273 if (DispParams.Bands == 1)
285 long Bands[3], Buf3Band;
287 Bands[0] = Bands[1] = Bands[2] = SrcBuf;
289 imBufCopy(Thread, Buf3Band, DstBuf, 0, OSB);
292 else if (NumBands == 3)
302void myBufCopyVM(
long Thread,
long SrcBuf,
long DstBuf,
long SrcControl,
long DstControl,
long OSB)
304 myBufCopy(Thread, SrcBuf, DstBuf, SrcControl, OSB);
308void myBufClear(
long Thread,
long Buf,
double Value,
long OSB)
310 long RGBValue = (
long) Value;
311 long BGRValue = RGBValue;
313 if (DispParams.Mode == DISP_MODE_VGA && DispParams.Bands == 3)
314 BGRValue = (RGBValue & 0x00ff00) | ((RGBValue >> 16) & 0xff) | ((RGBValue & 0xff) << 16);
316#if defined(IM_DEV_ODYSSEY)
317 if ((Buf & DISP_FLAG) != DISP_FLAG)
337static long GetDisplayParams(_IM_DISP_PARAMS_ST *DispParams)
343 memset(DispParams,
sizeof(_IM_DISP_PARAMS_ST), 0);
344 DispParams->KeyVal = -1;
346 fp = fopen(DISPFILE,
"r");
349 while (fgets(Line, MAX_LINE-1, fp))
351 if (strstr(Line,
"Mode ="))
353 if (strstr(Line,
"VGA"))
354 DispParams->Mode = DISP_MODE_VGA;
356 DispParams->Mode = DISP_MODE_GENESIS;
358 else if (strstr(Line,
"SizeX ="))
359 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->SizeX);
360 else if (strstr(Line,
"SizeY ="))
361 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->SizeY);
362 else if (strstr(Line,
"Bits ="))
363 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->Bits);
364 else if (strstr(Line,
"Bands ="))
365 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->Bands);
366 else if (strstr(Line,
"Address ="))
367 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->Address);
368 else if (strstr(Line,
"Pitch ="))
369 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->Pitch);
370 else if (strstr(Line,
"KeyVal ="))
371 sscanf(strstr(Line,
"=")+1,
"%i", &DispParams->KeyVal);
379 if (DispParams->Address == 0 || DispParams->SizeX == 0 || DispParams->SizeY == 0 || DispParams->Pitch == 0)
381#if defined(IM_DEV_ODYSSEY)
382 printf(
"*** The Odyssey display is not properly configured\n");
384 printf(
"*** The display is not properly configured\n");
386 printf(
"*** Please configure it before running this application\n");
396#define imDevAlloc(System, Node, ShellFile, Mode, DevPtr) myDevAlloc(System, Node, ShellFile, Mode, DevPtr)
397#define imBufChild(Thread, Buf, StartX, StartY, SizeX, SizeY, ChildPtr) myBufChild(Thread, Buf, StartX, StartY, SizeX, SizeY, ChildPtr)
398#define imBufCopy(Thread, SrcBuf, DstBuf, Control, OSB) myBufCopy(Thread, SrcBuf, DstBuf, Control, OSB)
399#define imBufCopyVM(Thread, SrcBuf, DstBuf, SrcControl, DstControl, OSB) myBufCopyVM(Thread, SrcBuf, DstBuf, SrcControl, DstControl, OSB)
400#define imBufClear(Thread, Buf, Value, OSB) myBufClear(Thread, Buf, Value, OSB)
401#define imDispInquire(Thread, Disp, Item, ValuePtr) myDispInquire(Thread, Disp, Item, ValuePtr)
402#define imDispControl(Thread, Disp, Control, Mode) myDispControl(Thread, Disp, Control, Mode)
403#define imDispAlloc(Thread, System, Display, DispFile, Mode, DispPtr) myDispAlloc(Thread, System, Display, DispFile, Mode, DispPtr)
404#define imDispFree(Thread, Display) myDispFree(Thread, Display)
#define IM_DISP_RESOLUTION_X
Definition: imapidef.h:980
#define IM_ENABLE
Definition: imapidef.h:267
#define IM_DISP_PAN_X
Definition: imapidef.h:976
#define IM_DISP_VGA_MODE
Definition: imapidef.h:982
#define IM_DISP_KEY_MODE
Definition: imapidef.h:971
#define IM_DISP_MODE
Definition: imapidef.h:975
#define IM_DISP_COLOR
Definition: imapidef.h:839
#define IM_ALL
Definition: imapidef.h:266
#define IM_DUAL_SCREEN
Definition: imapidef.h:353
#define IM_DISP_KEY_HIGH
Definition: imapidef.h:973
#define IM_DISP_WRTMSK
Definition: imapidef.h:978
#define IM_KEY_ALWAYS
Definition: imapidef.h:347
#define IM_BUF_NUM_BANDS
Definition: imapidef.h:129
#define IM_DEFAULT
Definition: imapidef.h:262
#define IM_24_TO_32
Definition: imapidef.h:337
#define IM_DISP_ZOOM
Definition: imapidef.h:979
#define IM_DISP_PAN_Y
Definition: imapidef.h:977
#define IM_CTL_PACK
Definition: imapidef.h:910
#define IM_LONG
Definition: imapidef.h:50
#define IM_DISP
Definition: imapidef.h:454
#define IM_DISP_MONO
Definition: imapidef.h:838
#define IM_COMPLETED
Definition: imapidef.h:437
#define IM_PROC
Definition: imapidef.h:453
#define IM_CTL_BYTE_SWAP
Definition: imapidef.h:907
#define IM_SINGLE_SCREEN
Definition: imapidef.h:352
#define IM_DISP_RESOLUTION_Y
Definition: imapidef.h:981
#define IM_KEY_IN_RANGE
Definition: imapidef.h:348
#define IM_DISP_KEY_LOW
Definition: imapidef.h:972
#define IM_UBYTE
Definition: imapidef.h:45
#define IM_NON_PAGED
Definition: imapidef.h:456
#define IM_NONE
Definition: imapidef.h:263
IM_EXTC void IM_FTYPE imDevAlloc(long System, long ProcessingNode, char *ShellFile, long Mode, long *DevPtr) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufClone(long Thread, long Buf, long NewLocation, long *NewBufPtr) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufClear(long Thread, long Buf, double Value, long OSB) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufCopyPCI(long Thread, long SrcBuf, long DstBuf, long Control, long OSB) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufFree(long Thread, long Buf) IM_LFTYPE
IM_EXTC long IM_FTYPE imBufInquire(long Thread, long Buf, long Item, void *ValuePtr) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufChild(long Thread, long Buf, long Xstart, long Ystart, long Xsize, long Ysize, long *ChildPtr) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufCreate(long Thread, long Xsize, long Ysize, long Nbands, long Type, long Location, void **AddrPtr, long Pitch, long *BufPtr) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufCopy(long Thread, long SrcBuf, long DstBuf, long Control, long OSB) IM_LFTYPE
IM_EXTC void IM_FTYPE imBufPutField(long Thread, long Buf, long Tag, double Value) IM_LFTYPE
IM_EXTC long IM_FTYPE imSyncHost(long Thread, long OSB, long State) IM_LFTYPE
MFTYPE32 long(MFTYPE MPTYPE *MOCRHOOKFCTPTR)(long HookType
Definition: milocr.h:32
#define NULL
Definition: nidaqmx.h:84