AnsweredAssumed Answered

how to  replace adc_write() with  ad9361_spi_write(),using no-OS Driver

Question asked by east.xie on Apr 15, 2015
Latest reply on Apr 16, 2015 by east.xie

  We are doing wireless transceiver with the AD9364, We are working with the no-OS Drivers in atmel at91sam9g45. I config the no-OS Drivers with the platform_linux, so my project include adc_core.c which in platform_linux diretory. in the file  the function adc_init(struct ad9361_rf_phy *phy) call the function adc_write(phy, ADC_REG_RSTN, 0); adc_write(phy, ADC_REG_RSTN, ADC_RSTN);

    But my cpu only has spi bus connect to  ad9364, so I must rewrite function , replace adc_write() with  ad9361_spi_write(), and there a problem is what relationship between the parameter regAddr(adc_write()) and parameter reg (ad9361_spi_write() ). for example,in the adc_init()  code:

  adc_write(phy, ADC_REG_RSTN, 0);

  if write by ad9361_spi_write(), how write?   can i pass ADC_REG_RSTN to  function  ad9361_spi_write() directly? or must be recalculated?



* @brief adc_write  


void adc_write(struct ad9361_rf_phy *phy, uint32_t regAddr, uint32_t data)


  switch (phy->id_no) {

  case 0:

  *((unsigned *) (ad9361_uio_addr + regAddr)) = data;


  case 1:

#ifdef FMCOMMS5

  *((unsigned *) (ad9361_b_uio_addr + regAddr)) = data;








the function is defined in ad9364.c

ad9361_spi_write(struct spi_device *spi, int32_t reg, uint32_t val)