| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
#ifndef MICROPY_INCLUDED_MIMXRT_CYW43_CONFIGPORT_H |
| 28 |
#define MICROPY_INCLUDED_MIMXRT_CYW43_CONFIGPORT_H |
| 29 |
|
| 30 |
|
| 31 |
#include "extmod/mpbthci.h" |
| 32 |
#include "extmod/cyw43_config_common.h" |
| 33 |
#include "sdio.h" |
| 34 |
|
| 35 |
#define CYW43_USE_SPI (0) |
| 36 |
#define CYW43_ENABLE_BLUETOOTH_OVER_UART (1) |
| 37 |
#define CYW43_LWIP (1) |
| 38 |
#define CYW43_USE_STATS (0) |
| 39 |
|
| 40 |
#ifndef CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE |
| 41 |
#define CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE "lib/cyw43-driver/firmware/w4343WA1_7_45_98_50_combined.h" |
| 42 |
#endif |
| 43 |
|
| 44 |
#ifndef CYW43_WIFI_NVRAM_INCLUDE_FILE |
| 45 |
#define CYW43_WIFI_NVRAM_INCLUDE_FILE "lib/cyw43-driver/firmware/wifi_nvram_1dx.h" |
| 46 |
#endif |
| 47 |
|
| 48 |
#ifndef CYW43_BT_FIRMWARE_INCLUDE_FILE |
| 49 |
#define CYW43_BT_FIRMWARE_INCLUDE_FILE "lib/cyw43-driver/firmware/cyw43_btfw_4343A1.h" |
| 50 |
#endif |
| 51 |
|
| 52 |
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY |
| 53 |
#define CYW43_BT_UART_BAUDRATE_ACTIVE_USE MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY |
| 54 |
#endif |
| 55 |
|
| 56 |
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_DOWNLOAD_FIRMWARE |
| 57 |
#define CYW43_BT_UART_BAUDRATE_DOWNLOAD_FIRMWARE MICROPY_HW_BLE_UART_BAUDRATE_DOWNLOAD_FIRMWARE |
| 58 |
#endif |
| 59 |
|
| 60 |
#define CYW43_CLEAR_SDIO_INT (1) |
| 61 |
|
| 62 |
#define CYW43_SDPCM_SEND_COMMON_WAIT __WFI(); |
| 63 |
#define CYW43_DO_IOCTL_WAIT __WFI(); |
| 64 |
|
| 65 |
#define cyw43_hal_uart_set_baudrate mp_bluetooth_hci_uart_set_baudrate |
| 66 |
#define cyw43_hal_uart_write mp_bluetooth_hci_uart_write |
| 67 |
#define cyw43_hal_uart_readchar mp_bluetooth_hci_uart_readchar |
| 68 |
|
| 69 |
#define cyw43_bluetooth_controller_init mp_bluetooth_hci_controller_init |
| 70 |
#define cyw43_bluetooth_controller_deinit mp_bluetooth_hci_controller_deinit |
| 71 |
#define cyw43_bluetooth_controller_woken mp_bluetooth_hci_controller_woken |
| 72 |
#define cyw43_bluetooth_controller_wakeup mp_bluetooth_hci_controller_wakeup |
| 73 |
#define cyw43_bluetooth_controller_sleep_maybe mp_bluetooth_hci_controller_sleep_maybe |
| 74 |
|
| 75 |
#define CYW43_PIN_WL_REG_ON MICROPY_HW_WL_REG_ON |
| 76 |
#define CYW43_PIN_WL_HOST_WAKE MICROPY_HW_WL_HOST_WAKE |
| 77 |
#define CYW43_PIN_WL_SDIO_1 MICROPY_HW_SDIO_D1 |
| 78 |
|
| 79 |
#define CYW43_PIN_BT_REG_ON MICROPY_HW_BT_REG_ON |
| 80 |
#ifdef MICROPY_HW_BT_HOST_WAKE |
| 81 |
#define CYW43_PIN_BT_HOST_WAKE MICROPY_HW_BT_HOST_WAKE |
| 82 |
#endif |
| 83 |
#ifdef MICROPY_HW_BT_DEV_WAKE |
| 84 |
#define CYW43_PIN_BT_DEV_WAKE MICROPY_HW_BT_DEV_WAKE |
| 85 |
#endif |
| 86 |
#ifdef MICROPY_HW_BT_CTS |
| 87 |
#define CYW43_PIN_BT_CTS MICROPY_HW_BT_CTS |
| 88 |
#endif |
| 89 |
|
| 90 |
#if MICROPY_HW_ENABLE_RF_SWITCH |
| 91 |
#define CYW43_PIN_RFSW_VDD pin_WL_RFSW_VDD |
| 92 |
#endif |
| 93 |
|
| 94 |
#undef cyw43_hal_pin_config // mp_hal_pin_config not yet implemented on this port |
| 95 |
|
| 96 |
static inline void cyw43_hal_pin_config(cyw43_hal_pin_obj_t pin, uint8_t mode, uint8_t pull, uint8_t alt) { |
| 97 |
machine_pin_set_mode(pin, mode); |
| 98 |
} |
| 99 |
|
| 100 |
static inline void cyw43_hal_pin_config_irq_falling(cyw43_hal_pin_obj_t pin, int enable) { |
| 101 |
if (enable) { |
| 102 |
machine_pin_config(pin, PIN_MODE_IT_FALLING, PIN_PULL_UP_100K, 0, 0, PIN_AF_MODE_ALT5); |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
static inline void cyw43_sdio_init(void) { |
| 107 |
sdio_init(NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 14, 0)); |
| 108 |
} |
| 109 |
|
| 110 |
static inline void cyw43_sdio_reinit(void) { |
| 111 |
sdio_reenable(); |
| 112 |
} |
| 113 |
|
| 114 |
static inline void cyw43_sdio_deinit(void) { |
| 115 |
sdio_deinit(); |
| 116 |
} |
| 117 |
|
| 118 |
static inline void cyw43_sdio_set_irq(bool enable) { |
| 119 |
sdio_enable_irq(enable); |
| 120 |
} |
| 121 |
|
| 122 |
static inline void cyw43_sdio_enable_high_speed_4bit(void) { |
| 123 |
sdio_enable_high_speed_4bit(); |
| 124 |
} |
| 125 |
|
| 126 |
static inline int cyw43_sdio_transfer(uint32_t cmd, uint32_t arg, uint32_t *resp) { |
| 127 |
return sdio_transfer(cmd, arg, resp); |
| 128 |
} |
| 129 |
|
| 130 |
static inline int cyw43_sdio_transfer_cmd53(bool write, uint32_t block_size, uint32_t arg, size_t len, uint8_t *buf) { |
| 131 |
return sdio_transfer_cmd53(write, block_size, arg, len, buf); |
| 132 |
} |
| 133 |
|
| 134 |
#endif |