mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
sdio_slave: allow disabling highspeed mode
This commit is contained in:
parent
3d47d8ae38
commit
1d09c78c17
@ -48,6 +48,9 @@ typedef struct {
|
||||
the internal pull-ups are not sufficient for stable communication, please do connect external pull-ups on the
|
||||
bus. This is only for example and debug use.
|
||||
*/
|
||||
#define SDIO_SLAVE_FLAG_DEFAULT_SPEED BIT(3) /**< Disable the highspeed support of the hardware. */
|
||||
#define SDIO_SLAVE_FLAG_HIGH_SPEED 0 /**< Enable the highspeed support of the hardware. This is the
|
||||
default option. The host will see highspeed capability, but the mode actually used is determined by the host. */
|
||||
} sdio_slave_config_t;
|
||||
|
||||
/** Handle of a receive buffer, register a handle by calling ``sdio_slave_recv_register_buf``. Use the handle to load the buffer to the
|
||||
|
@ -230,6 +230,7 @@ static esp_err_t init_context(const sdio_slave_config_t *config)
|
||||
|
||||
context.hal->sending_mode = config->sending_mode;
|
||||
context.hal->timing = config->timing;
|
||||
context.hal->no_highspeed = (config->flags & SDIO_SLAVE_FLAG_DEFAULT_SPEED) == SDIO_SLAVE_FLAG_DEFAULT_SPEED;
|
||||
context.hal->send_queue_size = config->send_queue_size;
|
||||
context.hal->recv_buffer_size = config->recv_buffer_size;
|
||||
//initialize ringbuffer resources
|
||||
@ -312,7 +313,6 @@ static inline esp_err_t sdio_slave_hw_init(sdio_slave_config_t *config)
|
||||
periph_module_enable(PERIPH_SDIO_SLAVE_MODULE);
|
||||
|
||||
sdio_slave_hal_hw_init(context.hal);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* NOTICE
|
||||
@ -210,6 +202,10 @@ typedef struct {
|
||||
* configured before using the HAL. `SDIO_SLAVE_TIMING_PSEND_PSAMPLE` is
|
||||
* recommended by default.
|
||||
*/
|
||||
//some boolean flags
|
||||
struct {
|
||||
uint32_t no_highspeed: 1; /**< Disable the highspeed support */
|
||||
};
|
||||
int send_queue_size; /**< Max buffers that can be queued before sending. Should be manually
|
||||
* configured before using the HAL.
|
||||
*/
|
||||
@ -220,6 +216,7 @@ typedef struct {
|
||||
sdio_ringbuf_t send_desc_queue; /**< The ring buffer used to hold queued descriptors. Should be manually
|
||||
* initialized before using the HAL.
|
||||
*/
|
||||
|
||||
//Internal status, no need to touch.
|
||||
send_state_t send_state; // Current state of sending part.
|
||||
uint32_t tail_pkt_len; // The accumulated send length of the tail packet.
|
||||
|
@ -25,9 +25,14 @@ typedef enum {
|
||||
/// Timing of SDIO slave
|
||||
typedef enum {
|
||||
SDIO_SLAVE_TIMING_PSEND_PSAMPLE = 0,/**< Send at posedge, and sample at posedge. Default value for HS mode.
|
||||
* If :c:macro:`SDIO_SLAVE_FLAG_HIGH_SPEED` is specified in
|
||||
* :cpp:class:`sdio_slave_config_t`, this should be selected.
|
||||
* Normally there's no problem using this to work in DS mode.
|
||||
*/
|
||||
SDIO_SLAVE_TIMING_NSEND_PSAMPLE ,///< Send at negedge, and sample at posedge. Default value for DS mode and below.
|
||||
SDIO_SLAVE_TIMING_NSEND_PSAMPLE, /**< Send at negedge, and sample at posedge. Default value for DS mode and
|
||||
* below. If :c:macro:`SDIO_SLAVE_FLAG_DEFAULT_SPEED` is specified in
|
||||
* :cpp:class:`sdio_slave_config_t`, this should be selected.
|
||||
*/
|
||||
SDIO_SLAVE_TIMING_PSEND_NSAMPLE, ///< Send at posedge, and sample at negedge
|
||||
SDIO_SLAVE_TIMING_NSEND_NSAMPLE, ///< Send at negedge, and sample at negedge
|
||||
} sdio_slave_timing_t;
|
||||
|
@ -168,7 +168,7 @@ void sdio_slave_hal_init(sdio_slave_context_t *hal)
|
||||
void sdio_slave_hal_hw_init(sdio_slave_context_t *hal)
|
||||
{
|
||||
sdio_slave_ll_init(hal->slc);
|
||||
sdio_slave_ll_enable_hs(hal->hinf, true);
|
||||
sdio_slave_ll_enable_hs(hal->hinf, !hal->no_highspeed);
|
||||
sdio_slave_ll_set_timing(hal->host, hal->timing);
|
||||
sdio_slave_ll_slvint_t intr_ena = 0xff;
|
||||
sdio_slave_ll_slvint_set_ena(hal->slc, &intr_ena);
|
||||
|
@ -778,7 +778,6 @@ components/hal/include/hal/esp_flash_err.h
|
||||
components/hal/include/hal/mpu_hal.h
|
||||
components/hal/include/hal/mpu_types.h
|
||||
components/hal/include/hal/rtc_io_types.h
|
||||
components/hal/include/hal/sdio_slave_hal.h
|
||||
components/hal/include/hal/sdio_slave_ll.h
|
||||
components/hal/include/hal/sha_hal.h
|
||||
components/hal/include/hal/spi_flash_encrypt_hal.h
|
||||
|
Loading…
Reference in New Issue
Block a user