Example #1
0
static int spi_bulkread(HANDLE hDevice, fci_u8 addr, fci_u8 *data, fci_u16 length)
{
	fci_s32 ret;

	tx_data[0] = SPI_CMD_BURST_READ;
	tx_data[1] = addr;

	ret = fc8050_spi_write_then_read(fc8050_spi, &tx_data[0], 2, &data[0], length);

	if(!ret)
	{
		PRINTF(0, "fc8050_spi_bulkread fail : %d\n", ret);
		return BBM_NOK;
	}

	return BBM_OK;
}
static int spi_bulkread(HANDLE hDevice, u8 addr, u8 *data, u16 length)
{
	s32 ret;

	tx_data[0] = SPI_CMD_BURST_READ;
	tx_data[1] = addr;

	fc8050_spi = tdmb_get_spi_handle();
	ret = fc8050_spi_write_then_read(
		fc8050_spi, &tx_data[0], 2, &data[0], length);

	if (ret) {
		print_log(0, "fc8050_spi_bulkread fail : %d\n", ret);
		return BBM_NOK;
	}

	return BBM_OK;
}
Example #3
0
static int spi_dataread(HANDLE hDevice, fci_u8 addr, fci_u8* data, fci_u16 length)
{
	fci_s32 ret=0;

	tx_data[0] = SPI_CMD_BURST_READ;
	tx_data[1] = addr;

	if(length>384)
		ret = fc8050_spi_write_then_read_burst(fc8050_spi, &tx_data[0], 2, &data[0], length);
	else
		ret = fc8050_spi_write_then_read(fc8050_spi, &tx_data[0], 2, &data[0], length);
	//printk("spi_dataread  (0x%x,0x%x,0x%x,0x%x)\n", data[0], data[1], data[2], data[3]);
	if(!ret)
	{
		PRINTF(0, "fc8050_spi_dataread fail : %d\n", ret);
		return BBM_NOK;
	}

	return BBM_OK;
}
static int spi_bulkwrite(HANDLE hDevice, u8 addr, u8 *data, u16 length)
{
	s32 ret;
	s32 i;

	tx_data[0] = SPI_CMD_BURST_WRITE;
	tx_data[1] = addr;

	for (i = 0; i < length; i++)
		tx_data[2+i] = data[i];

	fc8050_spi = tdmb_get_spi_handle();
	ret = fc8050_spi_write_then_read(
		fc8050_spi, &tx_data[0], length+2, NULL, 0);

	if (ret) {
		print_log(0, "fc8050_spi_bulkwrite fail : %d\n", ret);
		return BBM_NOK;
	}

	return BBM_OK;
}
Example #5
0
static int spi_bulkwrite(HANDLE hDevice, fci_u8 addr, fci_u8* data, fci_u16 length)
{
	fci_s32 ret;
	fci_s32 i;
	
	tx_data[0] = SPI_CMD_BURST_WRITE;
	tx_data[1] = addr;

	for(i=0;i<length;i++)
	{
		tx_data[2+i] = data[i];
	}

	ret =fc8050_spi_write_then_read(fc8050_spi, &tx_data[0], length+2, NULL, 0);

	if(!ret)
	{
		PRINTF(0, "fc8050_spi_bulkwrite fail : %d\n", ret);
		return BBM_NOK;
	}
	
	return BBM_OK;
}