Exemplo n.º 1
0
 void set_response(Address address, const SharedRefPtr<Response>& response) {
   ScopedMutex lock(&mutex_);
   address_ = address;
   response_ = response;
   internal_set(lock);
 }
Exemplo n.º 2
0
/*
 * Synopsis:  set data transfer speed
 *
 * Paras:     speed - speed value will be set; value is from enum eTrans_Speed
 *
 * Return:    none
 */
int irda_hw_set_speed(u32 speed)
{
	u32 mode;
	u8 modeChg = 0;

	/* do nothing if speed is same as current */
	RK29IR_DBG("line %d: enter %s, speed=%d\n", __LINE__, __FUNCTION__, speed);

	if (speed == curTrans_speed)
		return 0;

	/* mode */
	switch (speed) {
	case 2400:
	case 9600:
	case 19200:
	case 38400:
	case 57600:
	case 115200:
		mode = BU92725GUW_SIR;
		break;
	case 576000:
	case 1152000:
		mode = BU92725GUW_MIR;
		break;
	case 4000000:
		mode = BU92725GUW_FIR;
		break;
	default:
		return -1; //invalid
	}

	/* speed */
	curTrans_speed = speed;

	/* change trans way if needed */
	switch (curTrans_way) {
	case BU92725GUW_IDLE:
		break;
	case BU92725GUW_REV:
		if (mode == BU92725GUW_MIR)
			curTrans_way = BU92725GUW_MIR_REV;
		else if (mode == BU92725GUW_FIR)
			curTrans_way = BU92725GUW_AUTO_MULTI_REV;
			//curTrans_way = BU92725GUW_MULTI_REV;
			//curTrans_way = BU92725GUW_FIR_REV;
		break;
	case BU92725GUW_SEND:
		if (mode == BU92725GUW_MIR)
			curTrans_way = BU92725GUW_MIR_SEND;
		else if (mode == BU92725GUW_FIR)
			curTrans_way = BU92725GUW_MULTI_SEND;
			//curTrans_way = BU92725GUW_FIR_SEND;
		break;
	case BU92725GUW_MIR_REV:
		if (mode == BU92725GUW_SIR)
			curTrans_way = BU92725GUW_REV;
		else if (mode == BU92725GUW_FIR)
			curTrans_way = BU92725GUW_AUTO_MULTI_REV;
			//curTrans_way = BU92725GUW_MULTI_REV;
			//curTrans_way = BU92725GUW_FIR_REV;
		break;
	case BU92725GUW_MIR_SEND:
		if (mode == BU92725GUW_SIR)
			curTrans_way = BU92725GUW_SEND;
		else if (mode == BU92725GUW_FIR)
			curTrans_way = BU92725GUW_MULTI_SEND;
			//curTrans_way = BU92725GUW_FIR_SEND;
		break;
	case BU92725GUW_FIR_REV:
	case BU92725GUW_AUTO_MULTI_REV:
	case BU92725GUW_MULTI_REV:
		if (mode == BU92725GUW_SIR)
			curTrans_way = BU92725GUW_REV;
		else if (mode == BU92725GUW_MIR)
			curTrans_way = BU92725GUW_MIR_REV;
		break;
	case BU92725GUW_FIR_SEND:
	case BU92725GUW_MULTI_SEND:
		if (mode == BU92725GUW_SIR)
			curTrans_way = BU92725GUW_SEND;
		else if (mode == BU92725GUW_MIR)
			curTrans_way = BU92725GUW_MIR_SEND;
		break;
	}

	if (mode != curTrans_mode) {
		if ((mode == BU92725GUW_FIR) || (curTrans_mode == BU92725GUW_FIR))
			modeChg = 1; /* need set TRCR5:MS_EN */
	}

	curTrans_mode = mode;

	/* set bu92725guw registers */
	//internal_set(modeChg);
	internal_set(1);

    return 0;
}