Exemple #1
0
// bus locking at a higher level
GOOD_OR_BAD DS2480_detect(struct port_in *pin)
{
    struct connection_in * in = pin->first ;

    if (pin->init_data == NULL) {
        LEVEL_DEFAULT("DS2480B-based bus master needs a port name");
        return gbBAD;
    }

    /* Set up low-level routines */
    DS2480_setroutines(in);

    in->overdrive = 0 ;
    in->flex = Globals.serial_flextime ;
    pin->busmode = bus_serial;

    // Now set desired baud and polarity
    // BUS_reset will do the actual changes
    in->master.serial.reverse_polarity = Globals.serial_reverse ;
    COM_set_standard( in ) ; // standard COM port settings

    // first pass with hardware flow control
    RETURN_GOOD_IF_GOOD( DS2480_detect_serial(in) ) ;

    pin->flow = flow_second; // flow control
    RETURN_BAD_IF_BAD(COM_change(in)) ;
    return DS2480_detect_serial(in) ;
}
Exemple #2
0
// bus locking done at a higher level
GOOD_OR_BAD LINK_detect(struct port_in *pin)
{
	struct connection_in * in = pin->first ;

	if (pin->init_data == NULL) {
		// requires input string
		LEVEL_DEFAULT("LINK busmaster requires port name");
		return gbBAD;
	}

	COM_set_standard( in ) ; // standard COM port settings

	switch( pin->type ) {
		case ct_telnet:
			// LinkHub-E
			pin->baud = B115200 ;
			LEVEL_DEBUG("Attempt connection to networked LINK at 115200 baud");
			RETURN_GOOD_IF_GOOD(  LINK_detect_net( in )  );

			// Xport or ser2net
			pin->baud = B9600 ;
			LEVEL_DEBUG("Attempt connection to networked LINK at 9600 baud");
			RETURN_GOOD_IF_GOOD(  LINK_detect_net( in )  );

			break ;

			

		case ct_serial:
			pin->baud = B9600 ;

			pin->flow = flow_first ;
			RETURN_GOOD_IF_GOOD( LINK_detect_serial(in) ) ;

			LEVEL_DEBUG("Second attempt at serial LINK setup");
			pin->flow = flow_second ;
			RETURN_GOOD_IF_GOOD( LINK_detect_serial(in) ) ;

			LEVEL_DEBUG("Third attempt at serial LINK setup");
			pin->flow = flow_first ;
			RETURN_GOOD_IF_GOOD( LINK_detect_serial(in) ) ;

			LEVEL_DEBUG("Fourth attempt at serial LINK setup");
			pin->flow = flow_second ;
			RETURN_GOOD_IF_GOOD( LINK_detect_serial(in) ) ;
			break ;

		default:
			return gbBAD ;
	}
	return gbBAD ;
}
Exemple #3
0
// no bus locking here (higher up)
GOOD_OR_BAD DS9097_detect(struct port_in *pin)
{
	struct connection_in * in = pin->first ;
	/* Set up low-level routines */
	DS9097_setroutines(in);

	in->Adapter = adapter_DS9097;
	// in->adapter_name already set, to support HA3 and HA4B
	pin->busmode = bus_passive;	// in case initially tried DS9097U

	/* open the COM port in 9600 Baud  */
	COM_set_standard( in ) ; // standard COM port settings
	pin->vmin = 1; // minimum chars
	pin->vtime = 0; // decisec wait
	
	if (pin->init_data == NULL) {
		LEVEL_DEFAULT("DS9097 (passive) busmaster requires port name");
		return gbBAD;
	}
	RETURN_BAD_IF_BAD(COM_open(in)) ;

	pin->flow = flow_first; // flow control
	switch( DS9097_reset_in(in) ) {
		case BUS_RESET_OK:
		case BUS_RESET_SHORT:
			return gbGOOD ;
		default:
			break ;
	}
	if ( GOOD(serial_powercycle(in)) ) {
		switch( DS9097_reset_in(in) ) {
			case BUS_RESET_OK:
			case BUS_RESET_SHORT:
				return gbGOOD ;
			default:
				break ;
		}
	}

	/* open the COM port in 9600 Baud  */
	/* Second pass */
	pin->flow = flow_second ;
	RETURN_BAD_IF_BAD(COM_change(in)) ;

	switch( DS9097_reset_in(in) ) {
		case BUS_RESET_OK:
		case BUS_RESET_SHORT:
			return gbGOOD ;
		default:
			break ;
	}

	/* open the COM port in 9600 Baud  */
	/* Third pass, hardware flow control */
	pin->flow = flow_first ;
	RETURN_BAD_IF_BAD(COM_change(in)) ;

	switch( DS9097_reset_in(in) ) {
		case BUS_RESET_OK:
		case BUS_RESET_SHORT:
			return gbGOOD ;
		default:
			break ;
	}
	
	return gbBAD ;
}