Specifications

Table Of Contents
Code for Third-Party Readers
38 SkyePlus™ MXH and MXU Multiplexer Reference Guide
Copyright 2008 SkyeTek, Inc. All Rights Reserved. Version 080715
/******************************************************************************
* Purpose: mux_open_port writes the control line values to activate mux ports.
* @param unsigned char device: The mux device type as defined by the mux_detect() function
* @param unsigned char port: The mux port number to be opened (0 through 7 for 8-port)
* or (0, 2, 5, 7 for 4-port)
* @return unsigned char: 0x42 is returned if no errors are found.
* The error code 0xC2 is returned if the requested port is invalid or
* if the device is not recognized.
* @note
*****************************************************************************/
unsigned char mux_open_port(unsigned char device, unsigned char port){
unsigned char response_value = 0x42;
//If the device is a 4 port mux and if port 0, 2, 5, or 7 is accessed, then continue.
if(((device == 1) || (device == 5)) && ((port == 0) || (port == 2) || (port == 5) || (port
== 7))){
}
//If the device is an 8 port mux and if port 0 through 7 is accessed, then continue.
if(((device == 2) || (device == 6)) && ((port >= 0) && (port <= 7))){
}
else{
//the port must be unavailable or there is no device detected
//set the port to a value out of range and let the case statement catch it.
port = 0x09;
}
//Enable specified port.
switch(port) {
case 0: MUX_PORT0; break;
case 1: MUX_PORT1; break;
case 2: MUX_PORT2; break;
case 3: MUX_PORT3; break;
case 4: MUX_PORT4; break;
case 5: MUX_PORT5; break;
case 6: MUX_PORT6; break;
case 7: MUX_PORT7; break;
default:
MUX_PORT0;
response_value = 0xC2;
}
return response_value;
}