/*************************************************************/
#define NUM_MONS 8 /* the number of outputs in this switcher */
#define PAR_CTL1 0x379 /* hardware I/O port for parallel status */
char switdat[NUM_MONS]; /* an array to hold the data for the patch */
/* switdat[0] is output 1 */
/* each byte has a value of 0-7 */
/* representing inputs 1-8*/
/*************************************************************/
/* this routine sends out the initialization stream to the switcher */
/* it is run once, usually at the very beginning of the program */
void Init_Vmux(void)
{
int i;
while(~inportb(PAR_CTL1) & 0x80) ; /* wait for the 'BUSY' bit on the */
/* parallel port to clear. */
for(i=0; i<NUM_MONS; i++) { /* do for each output ..... */
(void)biosprint(0, 1, 0); /* output a binary 1 */
(void)biosprint(0, 0, 0); /* output a binary 0 */
(void)biosprint(0, 0, 0); /* output a binary 0 */
(void)biosprint(0, 1, 0); /* output a binary 1 */
} /* then finish with ..... */
(void)biosprint(0, 1, 0); /* output a binary 1 */
(void)biosprint(0, 0, 0); /* output a binary 0 */
(void)biosprint(0, 3, 0); /* output a binary 3 */
}
/*************************************************************/
/* this routine sends out the control stream to the switcher */
/* it is run any time you want to re-patch the switcher */
void Set_Vmux(void)
{
int i;
while(~inportb(PAR_CTL1) & 0x80) ; /* wait for the 'BUSY' bit on the */
/* parallel port to clear */
for(i=NUM_MONS-1; i>=0; i--) { /* for each output .... */
(void)biosprint(0, 0, 0); /* output a binary 0 */
(void)biosprint(0, (switdat[i]>>2) & 1, 0); /* output bit 2 of data */
(void)biosprint(0, (switdat[i]>>1) & 1, 0); /* output bit 1 of data */
(void)biosprint(0, switdat[i] & 1, 0); /* output bit 0 of data */
} /* then finish with ..... */
(void)biosprint(0, 1, 0); /* output a binary 1 */
(void)biosprint(0, 0, 0); /* output a binary 0 */
(void)biosprint(0, 3, 0); /* output a binary 3 */
}
/*************************************************************/
|