1 Reply Latest reply on Aug 20, 2018 10:38 PM by GauravS_31 Branched from an earlier discussion.

    Re: CYW43907 SDIO Slave (con't)

    dezi_3554521

      RaktimR_11

      Per our previous closed discussion here: CYW43907 SDIO Slave

       

      Is it possible to receive 43907 Programmers Guide, and Register Map/Definitions with NDA agreement to implement SDIO slave by myself?

      I try to implement driver by pieces of info in library, but get stuck in several things.

      I`ve defined some structures for SDIO device (as analog of sdioh_info_t) and start to initialize structures like in sdioh_attach in bcmsdstd.c

      I have add info to core info

          {

              .curmap  = (void*)PLATFORM_SDIOD_REGBASE(0x0),

              .curwrap = (void*)PLATFORM_SDIOD_MASTER_WRAPPER_REGBASE(0x0),

              .coreid  = SDIOD_CORE_ID,

              .corerev = SDIOD_CORE_REV,

          },

       

      then Ive copy some function for reading and writing registers.

       

      static uint8 read_sdiod_reg8(sdio_device_info_t *sd, uint reg)

      {

      volatile uint8 data = *(volatile uint8 *) (sd->mem_space + reg);

      dsd_ctrl(("8: R Reg 0x%02x, Data 0x%x\n", reg, data));

      return data;

      }

       

      static void write_sdiod_reg8(sdio_device_info_t *sd, uint reg, uint8 data)

      {

          *(volatile uint8 *)(sd->mem_space + reg) = (uint8) data;

          dsd_ctrl(("8: W Reg 0x%02x, Data 0x%x\n", reg, data));

      }

       

      Then I`ve implement function for os allocation and free (sdiod_mos_init,sdiod_mos_free) and try to read and write registers, defined in sdio.h

       

      void application_start(void)

      {

      wiced_init();

      sdiod_init(0);

      while(1)

      {

          printf("hi\r\n");

          wiced_rtos_delay_milliseconds(10000);

      }

      }

       

       

      int sdiod_init( void *cb_func)

      {

      sdio_device_info_t *dsd;

      dsd_trace(("%s\n", __FUNCTION__));

       

       

      if ((dsd = (sdio_device_info_t *) malloc(sizeof(sdio_device_info_t))) == 0){

      dsd_err(("sdioh_attach: out of memory, malloced %d bytes\n", MALLOCED(0)));

      return 0;

      }

      memset((char*)dsd,0, sizeof(sdio_device_info_t));

      sdiod_mos_init(dsd);

      osl_core_enable(SDIOD_CORE_ID);

      dsd->mem_space = (volatile char *)PLATFORM_SDIOD_REGBASE(0x0);

       

          if (dsd->mem_space == NULL) {

              dsd_err(("%s:ioremap() failed\n", __FUNCTION__));

              sdiod_mos_free(dsd);

              free(dsd);

          }

       

          if(cb_func != NULL) {

          dsd->intr_handler = cb_func;

          dsd->intr_handler_arg = NULL;

          dsd->intr_handler_valid = TRUE;

          } else {

              dsd->intr_handler = NULL;

              dsd->intr_handler_arg = NULL;

              dsd->intr_handler_valid = FALSE;

          }

       

          read_sdiod_reg8(dsd, SDIOD_CCCR_REV);

          read_sdiod_reg8(dsd, SDIOD_CCCR_SDREV);

          read_sdiod_reg8(dsd, SDIOD_CCCR_IOEN);

          write_sdiod_reg8(dsd,SDIOD_CCCR_IOEN,SDIO_FUNC_ENABLE_1|SDIO_FUNC_ENABLE_2|SDIO_FUNC_ENABLE_3);

          read_sdiod_reg8(dsd, SDIOD_CCCR_IOEN);

           read_sdiod_reg8(dsd, SDIOD_CCCR_IORDY);

           read_sdiod_reg8(dsd, SDIOD_CCCR_INTEN);

           read_sdiod_reg8(dsd, SDIOD_CCCR_INTPEND);

           read_sdiod_reg8(dsd, SDIOD_CCCR_IOABORT);

           read_sdiod_reg8(dsd, SDIOD_CCCR_BICTRL);

          read_sdiod_reg8(dsd, SDIOD_CCCR_CISPTR_0);

      }

       

      At all CYW43907 have error while reading SDIOD_CCCR_CISPTR_0, and SDIOD_CCCR_IOEN didnt write a parameters.

      So, it`s nessesary for me to receive your guides to proceed my work, cause now I didn`t know what bus clocks I`ve missed to initialize or which register have R R/W W attributes etc....

      Thanks a lot for replies!