/*************************************************************************** simple.c - pass data through the MV200 This is a simple first ImageFlow program. It passes a video signal through the MV200 by digitizing it, storing the data in a memory, reading it back out, and converting it back to analog video. ***************************************************************************/ #include #include /* this file is always included */ /* define the display size */ #define DISPLAYXSIZE 512L #define DISPLAYYSIZE 484L /* you have to list all devices that the program will use */ dqLimitIPDevSet(AB AM AS AG); main() { DqSystem oSystem; DqIPDev oAb00, oAm00, oAg00, oAs00; DqSurf oDispSrcSurf, oDispDstSurf, oAcqSrcSurf, oAcqDstSurf; DqPipe oDispPipe, oAcqPipe; char pcUserInpBuf[80]; /* initialize the hardware and ImageFlow software */ dqInitEnv(); /* get handles for the system and all devices being used */ oSystem = dqCreateStdSys(); oAb00 = dqFindIPDev(oSystem, "ab00"); oAs00 = dqFindIPDev(oSystem, "as00"); oAg00 = dqFindIPDev(oSystem, "ag00"); /* memory is referenced a little differently. It is considered part of the AB device. */ oAm00 = dqFindIPDev(oSystem, "ab00:am00"); /********************* ACQUISITION PIPE ***************************** Define the source surface, attach a gateway to it, route it across the cross point switch, attach it to a destination memory and surface. */ /* 512x484 is the std size surface on the AS device */ oAcqSrcSurf = dqCreateStdSizeSurf(oAs00, AS_ADC); dqAttachSurf(oAcqSrcSurf, AS_XMT); dqConnect(oAb00, DQ_CSG, AB_OP00); /* use unsigned output of AS */ /* memories have some internal hardware that must be set up correctly even just to get something in or out of them */ amSetRcvGateway20MHz(oAm00); /* this will be the end of the acquisition pipe */ oAcqDstSurf = dqCreateSameSizeSurf(oAm00, AM_MEM_R8,oAcqSrcSurf); dqAttachSurf(oAcqDstSurf,AM_RCV); /* create a continuously running pipe, arm and fire it */ oAcqPipe = dqCreatePipe(oAcqDstSurf, DQ_TRG_CONTINUOUS); dqArmPipe(oAcqPipe, DQ_DSM_PIPE); dqFirePipe(oAcqPipe); /*********************** DISPLAY PIPE ******************************** Define the display source surface, attach a gateway to it, route it across the cross point switch, attach it the display memory and get it running. */ /* dup'ing the surface makes this new surface be the same physical memory as the other surface. It is not allocated from a new section of memory */ oDispSrcSurf = dqDupSurf(oAcqDstSurf); dqAttachSurf(oDispSrcSurf,AM_XMT); /* the gateways into the AG memory always are set to run 40MHz. If you are sending data from a memory back to the cross point switch then the gateway is set for 20MHz. */ amSetDispGateway40MHz(oAm00); /* because the AG gateway always runs at 40MHz you have to make sure that you provide a flow of 40MHz data. The AG manual tell you what factors to use based on the type of display that you are using. */ dqSpecXmtExpansion(oAm00,AM_XMT,4,1); /* connections within the AG device */ dqConnect(oAg00, AG_RED, AG_DAC_LUT_SRC); dqConnect(oAg00, AG_DAC_LUT, AG_DAC_SRC); oDispDstSurf = dqCreateSurf(oAg00, AG_DAC,DISPLAYXSIZE,DISPLAYYSIZE); dqAttachSurfGate(oDispDstSurf, AG_RCV); /* take away the dummy expansion */ dqSpecRcvShrinkage(oAg00,AG_RCV,4,1); /* create the display pipe, arm and fire it */ oDispPipe = dqCreatePipe(oDispDstSurf, DQ_TRG_CONTINUOUS); dqArmPipe(oDispPipe, DQ_DSM_PIPE); dqFirePipe(oDispPipe); printf("Hit any key to exit.\n"); fgets(pcUserInpBuf, 80, stdin); dqDisposeSys(oSystem); } /* auxiliary functions to set up the AM gateways to the correct speed */ amSetRcvGateway20MHz(oAmDev) DqIPDev oAmDev; { dqConnect(oAmDev,AM_SPUP0,AM_INPUT0); dqConnect(oAmDev,AM_INPUT0,AM_OP0); dqSpecLogic(oAmDev,AM_LOGIC4,0,1); dqSpecLogic(oAmDev,AM_LOGIC0,0xffffffff,0); amSetGateSysClkMult(oAmDev,AM_RCV,2); } amSetDispGateway40MHz(oAmDev) DqIPDev oAmDev; { amSetGateSysClkMult(oAmDev,AM_XMT,4); dqConnect(oAmDev,AM_XMT_OUT,AM_OP3); dqSpecLogic(oAmDev,AM_LOGIC3,0xff,0); dqConnect(oAmDev,AM_LOGIC3,AM_OUTPUT0); dqConnect(oAmDev,AM_XMT,AM_XMT_OUT); }