Пример #1
0
TYPE_IR_REG_RESULT ir_reg_irda_get_rxdata(uint16* a_dat, int32* a_len)
{






	register uint16*	p_dat	= a_dat;
	register int32		w_len;
	register int32		i	= 0;
	TYPE_IR_REG_RESULT	w_ret	= IR_REG_RESULT_SUCCESS;

	if (p_dat == NULL || a_len == NULL) {
		if (p_dat == NULL) {
			MSG_IRREG_ERR("a_dat = NULL\n");
		}
		if (a_len == NULL) {
			MSG_IRREG_ERR("a_len = NULL\n");
		}
		w_ret = IR_REG_RESULT_FAIL;
	} else {
		w_len  = IR_READ_SR4;
		*a_len = w_len;

		while( i < w_len ){
			*p_dat++ = IR_READ_SR6;
			i += IR_FIFO_UNIT_SIZE;
		}
	}


	return (w_ret);
}
Пример #2
0
TYPE_IR_REG_RESULT ir_reg_irda_set_txdata(
			uint16* a_dat, int32 a_len, TYPE_IR_SEND_KIND a_kind)
{
	register uint16*	p_dat	= a_dat;
	register int32		w_len	= a_len;
	TYPE_IR_REG_RESULT	w_ret	= IR_REG_RESULT_SUCCESS;

	if ((p_dat == NULL) || (w_len <= IR_LENGTH_ZERO) ||
						(w_len > IR_FIFO_MAX_SIZE)) {
		MSG_IRREG_ERR(
		 "[ir_reg_irda_set_txdata]a_dat = 0x%x, a_len = %d[%d]",
						(int)p_dat, (int)w_len, 0);
		w_ret = IR_REG_RESULT_FAIL;
	} else {
		if (a_kind == IR_SEND_CONTINUE) {
			IR_WRITE_CR6((uint16)w_len);
		} else {
			IR_WRITE_CR4((uint16)w_len);
		}

		while (w_len > IR_LENGTH_ZERO) {
			IR_WRITE_CR6(*p_dat++);
			w_len -= IR_FIFO_UNIT_SIZE;
		}

	}

	return (w_ret);
}
Пример #3
0
void ir_reg_irda_set_bof(uint32 a_bof)
{
	const uint16	w_bof_map[IR_CR28_ADDBOF_MAX + 1] = {
	IR_CR28_ADDBOF_0,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_2, IR_CR28_ADDBOF_3,IR_CR28_ADDBOF_4,
	IR_CR28_ADDBOF_5,IR_CR28_ADDBOF_6, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_8,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_10,IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_12,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_14,IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_16,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_20,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_24,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_32,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1,
	IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_1, IR_CR28_ADDBOF_1,IR_CR28_ADDBOF_48 };

	if (a_bof > IR_CR28_ADDBOF_MAX) {
		MSG_IRREG_ERR(
		"[ir_reg_irda_set_bof]a_bof = %d[%d,%d]", (int)a_bof, 0, 0);
		a_bof = 1;
	}

	IR_WRITE_CR28(w_bof_map[a_bof]);
}
Пример #4
0
void ir_reg_irda_set_mtt(uint32 a_mtt)
{
	uint16	w_mtt;

	if (a_mtt > IR_MTT_MAX) {
		MSG_IRREG_ERR("[ir_reg_irda_set_mtt]a_mtt = %d[%d,%d]",
							(int)a_mtt, 0, 0);
		a_mtt = IR_MTT_MAX;
	}

	w_mtt = (uint16)(a_mtt / 10);
	if (a_mtt % 10 != 0) {
		w_mtt++;
	}

	if (w_mtt < IR_MTT_MS_MASK) {
		IR_WRITE_CR31(w_mtt);
	} else {
		w_mtt = (uint16)(a_mtt / 1000);
		if (a_mtt % 1000 != 0) {
			w_mtt++;
		}

		IR_WRITE_CR31(IR_MTT_MS_MASK | (w_mtt - 1));
	}
}
Пример #5
0
void ir_reg_irda_set_mpi(uint32 a_mpi)
{
	uint16	w_mpi;

	if (a_mpi > IR_MTT_MAX) {
		MSG_IRREG_ERR("[ir_reg_irda_set_baud]a_mpi = %d[%d,%d]",
							(int)a_mpi, 0, 0);
		a_mpi = IR_MTT_MAX;
	}

	w_mpi = (uint16)(a_mpi / 10);
	if (a_mpi % 10 != 0) {
		w_mpi++;
	}

	if (w_mpi < IR_MTT_MS_MASK) {
		IR_WRITE_CR30(w_mpi);
	} else {
		w_mpi = (uint16)(a_mpi / 1000);
		if (a_mpi % 1000 != 0) {
			w_mpi++;
		}

		IR_WRITE_CR30(IR_MTT_MS_MASK | (w_mpi - 1));
	}
}
Пример #6
0
TYPE_IR_REG_RESULT ir_reg_irda_get_rxdata(uint16* a_dat, int32* a_len)
{
	register uint32*	p_dat	= (uint32*)a_dat;
	register int32		i, w_32b, w_16b;
	TYPE_IR_REG_RESULT	w_ret	= IR_REG_RESULT_SUCCESS;

	if (p_dat == NULL || a_len == NULL) {
		if (p_dat == NULL) {
			MSG_IRREG_ERR(
			"[ir_reg_irda_get_rxdata]a_dat = NULL[%d,%d,%d]\n",
								0, 0, 0);
		}
		if (a_len == NULL) {
			MSG_IRREG_ERR(
			"[ir_reg_irda_get_rxdata]a_len = NULL[%d,%d,%d]\n",
								0, 0, 0);
		}
		w_ret = IR_REG_RESULT_FAIL;
	} else {
		*a_len = (int32)IR_READ_SR4;

		if (*a_len <= IRDA_MEM_1FRAME_SIZE) {
			w_32b = *a_len / IR_FIFO_UNIT_SIZE_32BIT;
			w_16b = *a_len % IR_FIFO_UNIT_SIZE_32BIT;
			if (w_16b > IR_FIFO_UNIT_SIZE) {
				w_32b++;
				w_16b = 0;
			}

			for (i = IR_LENGTH_ZERO; i < w_32b; i++) {
				*p_dat++ = IR_READ_SR6_32BIT;
			}
			if (w_16b > IR_LENGTH_ZERO) {
				*p_dat++ = IR_READ_SR6;
			}
		} else {
			MSG_IRREG_ERR(
			"[ir_reg_irda_get_rxdata]size over a_len = %d[%d,%d]\n",
							(int)*a_len, 0, 0);
			w_ret = IR_REG_RESULT_FAIL;
		}
	}

	return (w_ret);
}
Пример #7
0
void ir_reg_irda_set_baud(TYPE_BAUD a_baud)
{
	const uint16	w_baud_map[6]	= {	IR_CR24_UART_BAUD_9600,
						IR_CR24_UART_BAUD_9600,
						IR_CR24_UART_BAUD_19200,
						IR_CR24_UART_BAUD_38400,
						IR_CR24_UART_BAUD_57600,
						IR_CR24_UART_BAUD_115200 };

	if (a_baud > IR_BAUD_115200) {
		MSG_IRREG_ERR("a_baud = %x\n", a_baud);
		a_baud = IR_BAUD_9600;
	}

	IR_WRITE_CR24(w_baud_map[a_baud]);
}
Пример #8
0
void ir_reg_CR0_reset(uint16 cr0_reset_val)
{
	register uint16	w_dmy = IR_CR_CLEAR;
	uint16 cr0_set_val;
	uint16 check_val = (IR_CR0_TX_RESET | IR_CR0_RX_RESET |
				IR_CR0_TIMER_RESET | IR_CR0_SYSTEM_RESET |
							IR_CR0_CAREER_RESET);

	if ((cr0_reset_val & ~check_val) != 0x0000) {
		MSG_IRREG_ERR(
			"cr0_reset_val = 0x%x\n", (int)cr0_reset_val);
	}

	cr0_set_val = cr0_reset_val & check_val;
	IR_WRITE_CR0(cr0_set_val);

	*(volatile uint16*)IR_REG_CR14 = w_dmy;
	w_dmy = IR_READ_SR14;

}