1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #include <common/bk_typedef.h> 22 #include <common/sys_config.h> 23 24 #define sddev_control(handle, cmd, param) ddev_control(handle, cmd, param) 25 26 #define DD_HANDLE_MAGIC_WORD (0xA5A50000) 27 #define DD_HANDLE_MAGIC_MASK (0xFFFF0000) 28 #define DD_HANDLE_ID_MASK (0x0000FFFF) 29 30 typedef UINT32 DD_HANDLE; 31 typedef enum _dd_device_type_ 32 { 33 DD_DEV_TYPE_NONE, 34 DD_DEV_TYPE_START = DD_HANDLE_MAGIC_WORD-1, 35 #if (!CONFIG_SOC_BK7231) 36 DD_DEV_TYPE_TIMER, 37 #endif 38 #if ((!CONFIG_SOC_BK7231) && (CONFIG_BLE == 1)) 39 DD_DEV_TYPE_BLE, 40 #endif 41 #if ((!CONFIG_SOC_BK7271) && (!CONFIG_SOC_BK7256XX)) 42 #if CONFIG_FFT 43 DD_DEV_TYPE_FFT, 44 #endif 45 #endif 46 #if CONFIG_GENERAL_DMA 47 DD_DEV_TYPE_GDMA, 48 #endif 49 DD_DEV_TYPE_GPIO, 50 #if CONFIG_I2S 51 DD_DEV_TYPE_I2S, 52 #endif 53 DD_DEV_TYPE_ICU, 54 #if (!CONFIG_SOC_BK7231) 55 DD_DEV_TYPE_IRDA, 56 #endif 57 #if CONFIG_MAC_PHY_BYPASS 58 DD_DEV_TYPE_MPB, 59 #endif 60 61 #if 0 62 DD_DEV_TYPE_PWM, 63 #endif 64 65 #if !CFG_CONFIG_FULLY_HOSTED 66 DD_DEV_TYPE_SPI, 67 #endif 68 #if (CONFIG_SOC_BK7271) 69 DD_DEV_TYPE_SPI2, 70 DD_DEV_TYPE_SPI3, 71 #endif 72 #if CONFIG_QSPI 73 DD_DEV_TYPE_QSPI, 74 #endif 75 DD_DEV_TYPE_SCTRL, 76 DD_DEV_TYPE_WDT, 77 #if (CONFIG_SOC_BK7231N) || (CONFIG_SOC_BK7236A) || (CONFIG_SOC_BK7256XX) 78 DD_DEV_TYPE_CAL, 79 #endif 80 DD_DEV_TYPE_TRNG, 81 82 DD_DEV_TYPE_UART1, 83 84 #if CONFIG_UART2 85 DD_DEV_TYPE_UART2, 86 #endif 87 #if CONFIG_UART3 88 DD_DEV_TYPE_UART3, 89 #endif 90 #if CONFIG_FLASH_ORIGIN_API 91 DD_DEV_TYPE_FLASH, 92 #endif 93 #if CONFIG_HSLAVE_SPI 94 DD_DEV_TYPE_SPIDMA, 95 #endif 96 #if CONFIG_CAMERA 97 DD_DEV_TYPE_EJPEG, 98 #endif 99 DD_DEV_TYPE_I2C1, 100 DD_DEV_TYPE_I2C2, 101 #if (CONFIG_SOC_BK7271) 102 DD_DEV_TYPE_DSP, 103 DD_DEV_TYPE_MAILBOX, 104 #if (CONFIG_BT) 105 DD_DEV_TYPE_BT, 106 #endif 107 #endif 108 DD_DEV_TYPE_AUD_DAC, 109 #if CONFIG_SDIO || CONFIG_SDIO_TRANS 110 DD_DEV_TYPE_SDIO, 111 #endif 112 DD_DEV_TYPE_USB, 113 DD_DEV_TYPE_USB_PLUG, 114 #if CONFIG_SDCARD_HOST 115 DD_DEV_TYPE_SDCARD, 116 #endif 117 DD_DEV_TYPE_SARADC, 118 DD_DEV_TYPE_RF, 119 DD_DEV_TYPE_END 120 } dd_device_type; 121 UINT32 ddev_control(DD_HANDLE handle, UINT32 cmd, VOID *param); 122 123 #ifdef __cplusplus 124 } 125 #endif 126