Example #1
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;
}
Example #2
0
/*====================================================================
FUNCTION       fc8050_spi_write_then_read  
DESCRIPTION 
DEPENDENCIES
RETURN VALUE
SIDE EFFECTS
======================================================================*/
int tdmb_spi_write_then_read(u8 *txbuf, unsigned n_tx,u8 *rxbuf, unsigned n_rx)
{
  int ret;
  
  //TDMB_MSG_SPI("[%s] \n", __func__);

  //TDMB_MSG_SPI("[%s] tdmb_spi_dev[0x%x]\n", __func__, (unsigned int) tdmb_spi_dev);

#if 0//def FEATURE_QTDMB_USE_FCI_FC8050
  //ret = fc8050_spi_write_then_read(tdmb_spi_dev, txbuf, n_tx, rxbuf, n_rx);
  ret = fc8050_spi_write_then_read_burst(tdmb_spi_dev, txbuf, n_tx, rxbuf, n_rx);
#else
  ret = spi_write_then_read(tdmb_spi_dev, txbuf, n_tx, rxbuf, n_rx);
#endif

  if(ret)
  {
    TDMB_MSG_SPI("[%s] fail : %d\n", __func__, ret);
    return 1;
  }

  return 0;
}
/*====================================================================
FUNCTION       dmb_spi_write_then_read  
DESCRIPTION 
DEPENDENCIES
RETURN VALUE
SIDE EFFECTS
======================================================================*/
int dmb_spi_write_then_read(u8 *txbuf, unsigned n_tx, u8 *rxbuf, unsigned n_rx)
{
  int ret;
  
  //DMB_MSG_SPI("[%s] \n", __func__);

  //DMB_MSG_SPI("[%s] dmb_spi_dev[0x%x]\n", __func__, (unsigned int) dmb_spi_dev);

#if 0//def CONFIG_SKY_TDMB_FCI_BB_FC8050
  //ret = fc8050_spi_write_then_read(dmb_spi_dev, txbuf, n_tx, rxbuf, n_rx);
  ret = fc8050_spi_write_then_read_burst(dmb_spi_dev, txbuf, n_tx, rxbuf, n_rx);
#else
  ret = spi_write_then_read(dmb_spi_dev, txbuf, n_tx, rxbuf, n_rx);
#endif

  if(ret)
  {
    DMB_MSG_SPI("[%s] fail : %d\n", __func__, ret);
    return 1;
  }

  return 0;
}