1 /** 2 ****************************************************************************** 3 * @file bflb_sdio2.h 4 * @version V1.0 5 * @date 2022-09-27 6 * @brief This file is the low hardware abstraction layer file 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© COPYRIGHT(c) 2022 Bouffalo Lab</center></h2> 11 * 12 * Redistribution and use in source and binary forms, with or without modification, 13 * are permitted provided that the following conditions are met: 14 * 1. Redistributions of source code must retain the above copyright notice, 15 * this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright notice, 17 * this list of conditions and the following disclaimer in the documentation 18 * and/or other materials provided with the distribution. 19 * 3. Neither the name of Bouffalo Lab nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 ****************************************************************************** 35 */ 36 37 #ifndef _BFLB_SDIO2_H 38 #define _BFLB_SDIO2_H 39 40 //#define BFLB_SDIO2_ENUM 1 41 42 #ifndef BFLB_SDIO2_ENUM 43 #include "bflb_core.h" 44 #else 45 #include "stdio.h" 46 #include "stdint.h" 47 struct bflb_device_s { 48 const char *name; 49 uint32_t reg_base; 50 uint8_t irq_num; 51 uint8_t idx; 52 uint8_t sub_idx; 53 uint8_t dev_type; 54 void *user_data; 55 }; 56 #endif 57 58 /* SDIO2 buffer size */ 59 #define SDIO2_BYTE_PER_BUF (1024 * 2) 60 #define SDIO2_MAX_PORT_NUM 16 61 #define SDIO2_MAX_FUNC 1 62 63 int bflb_sdio2_init(struct bflb_device_s *dev); 64 int bflb_sdio2_check_host_ready(struct bflb_device_s *dev); 65 uint32_t bflb_sdio2_get_block_size(struct bflb_device_s *dev); 66 int bflb_sdio2_tx_rx_queue_init(struct bflb_device_s *dev); 67 int bflb_sdio2_send_data(struct bflb_device_s *dev, int qos, uintptr_t *buff, int len); 68 int bflb_sdio2_recv_data(struct bflb_device_s *dev, int qos, uintptr_t *buff, int *len); 69 void bflb_sdio2_isr(int irq, void *arg); 70 71 #endif /* _BFLB_SDIO3_H */ 72