Ejemplo n.º 1
0
wwd_result_t host_platform_bus_deinit( void )
{
    if ( sdio_bus_initted == WICED_TRUE )
    {
        uint8_t a = 0;

        platform_mcu_powersave_disable();

//        host_rtos_deinit_semaphore( &sdio_transfer_done_semaphore );
//        disable_sdio_block_transfer_done_irq();

        MCI_Disable( HSMCI );
        NVIC_DisableIRQ( HSMCI_IRQn );

#ifdef WICED_WIFI_USE_GPIO_FOR_BOOTSTRAP
        platform_gpio_deinit( &wifi_control_pins[WWD_PIN_BOOTSTRAP_0] );
        platform_gpio_deinit( &wifi_control_pins[WWD_PIN_BOOTSTRAP_1] );
#endif /* WICED_WIFI_USE_GPIO_FOR_BOOTSTRAP */

        /* Reset all SDIO pins to input pull-up to save power */
        for ( a = WWD_PIN_SDIO_CLK; a < WWD_PIN_SDIO_MAX; a++ )
        {
            platform_gpio_deinit( &wifi_sdio_pins[a] );
        }

        platform_mcu_powersave_enable();

        sdio_bus_initted = WICED_FALSE;
    }

    return WICED_SUCCESS;
}
Ejemplo n.º 2
0
platform_result_t platform_uart_deinit( platform_uart_driver_t* driver )
{

    usart_disable_interrupt( driver->peripheral->peripheral, 0xffffffff );

    NVIC_DisableIRQ( platform_uarts_irq_numbers[driver->peripheral->uart_id] );

    pdc_disable_transfer( usart_get_pdc_base( driver->peripheral->peripheral ), PERIPH_PTCR_TXTDIS | PERIPH_PTCR_RXTDIS );

    usart_disable_tx( driver->peripheral->peripheral );
    usart_disable_rx( driver->peripheral->peripheral );

    sysclk_disable_peripheral_clock( driver->peripheral->peripheral_id );

    platform_gpio_deinit( driver->peripheral->tx_pin );
    platform_gpio_deinit( driver->peripheral->rx_pin );

    if ( driver->peripheral->cts_pin != NULL )
    {
        platform_gpio_deinit( driver->peripheral->cts_pin );
    }

    if ( driver->peripheral->rts_pin != NULL )
    {
        platform_gpio_deinit( driver->peripheral->rts_pin );
    }

    host_rtos_deinit_semaphore( &driver->tx_dma_complete );
    host_rtos_deinit_semaphore( &driver->rx_dma_complete );

    driver->peripheral = NULL;
    memset( driver, 0, sizeof(platform_uart_driver_t) );

    return WICED_SUCCESS;
}
Ejemplo n.º 3
0
OSStatus platform_uart_deinit( platform_uart_driver_t* driver )
{
    OSStatus          err = kNoErr;

    platform_mcu_powersave_disable();
    require_action_quiet( ( driver != NULL ), exit, err = kParamErr);

    usart_disable_interrupt( driver->peripheral->port, 0xffffffff );

    NVIC_DisableIRQ( platform_flexcom_irq_numbers[driver->peripheral->uart_id] );

    pdc_disable_transfer( usart_get_pdc_base( driver->peripheral->port ), PERIPH_PTCR_TXTDIS | PERIPH_PTCR_RXTDIS );

    usart_disable_tx( driver->peripheral->port );
    usart_disable_rx( driver->peripheral->port );

    if( pmc_is_periph_clk_enabled( driver->peripheral->peripheral_id ) == 1  ) {
        flexcom_disable( driver->peripheral->flexcom_base );
    }

    platform_gpio_deinit( driver->peripheral->tx_pin );
    platform_gpio_deinit( driver->peripheral->rx_pin );

    if ( driver->peripheral->cts_pin != NULL )
    {
        platform_gpio_deinit( driver->peripheral->cts_pin );
    }

    if ( driver->peripheral->rts_pin != NULL )
    {
        platform_gpio_deinit( driver->peripheral->rts_pin );
    }

#ifndef NO_MICO_RTOS
    mico_rtos_deinit_semaphore(&driver->rx_complete);
    mico_rtos_deinit_semaphore(&driver->tx_complete);
#endif

    driver->peripheral = NULL;
    memset( driver, 0, sizeof(platform_uart_driver_t) );

exit:
    platform_mcu_powersave_enable();
    return err;
}
Ejemplo n.º 4
0
OSStatus host_platform_bus_deinit( void )
{
    OSStatus result;
    uint32_t     a;

    result = mico_rtos_deinit_semaphore( &sdio_transfer_finished_semaphore );

    platform_mcu_powersave_disable();

    /* Disable SPI and SPI DMA */
    sdio_disable_bus_irq( );
    SDIO_ClockCmd( DISABLE );
    SDIO_SetPowerState( SDIO_PowerState_OFF );
    SDIO_DeInit( );
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_SDIO, DISABLE );

#ifdef SDIO_1_BIT
    platform_gpio_deinit( &wifi_sdio_pins[WIFI_PIN_SDIO_IRQ] );
    platform_gpio_irq_disable( &wifi_sdio_pins[WIFI_PIN_SDIO_IRQ] );
#endif

    for ( a = 0; a < WIFI_PIN_SDIO_MAX; a++ )
    {
        platform_gpio_deinit( &wifi_sdio_pins[ a ] );
    }

#if defined ( MICO_WIFI_USE_GPIO_FOR_BOOTSTRAP )
    platform_gpio_deinit( &wifi_control_pins[WIFI_PIN_BOOTSTRAP_0] );
    platform_gpio_deinit( &wifi_control_pins[WIFI_PIN_BOOTSTRAP_1] );
#endif

    /* Turn off SDIO IRQ */
    NVIC_DisableIRQ( SDIO_IRQ_CHANNEL );
    NVIC_DisableIRQ( DMA2_3_IRQ_CHANNEL );

    platform_mcu_powersave_enable();

    return result;
}
Ejemplo n.º 5
0
OSStatus MicoGpioFinalize( mico_gpio_t gpio )
{
  if ( gpio >= MICO_GPIO_NONE )
    return kUnsupportedErr;
  return (OSStatus) platform_gpio_deinit( &platform_gpio_pins[gpio] );
}