00001
00002
00003
00004
00005
00006
00007
00008
00009 #pragma once
00010 #include <oska/all.h>
00011 #include <sdioemb/slot_api.h>
00012 #include <sdioemb/windows/slot_api.h>
00013 #include <sdioemb/slot_shc.h>
00014 #include <sdioemb/trace.h>
00015
00016 #define SHC_DMA_BUFFER_LEN 8192
00017
00018 typedef struct shc_device_context {
00019 const char *name;
00020 BUS_INTERFACE_STANDARD bus_interface;
00021 WDFINTERRUPT interrupt;
00022 WDFDMAENABLER dma_enabler;
00023 uint32_t quirks;
00024 int num_slots;
00025 struct sdioemb_slot **slots;
00026 bool registered;
00027 } SHC_DEVICE_CONTEXT, *PSHC_DEVICE_CONTEXT;
00028 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(SHC_DEVICE_CONTEXT, shc_get_device_context);
00029
00030 struct shc_data {
00031 struct sdioemb_wdf_slot_data wdf_data;
00032 struct sdioemb_shc shc;
00033 WDFDEVICE device;
00034 WDFCOMMONBUFFER dma_buf;
00035 void *dma_buf_virt;
00036 uint64_t dma_buf_phys;
00037 size_t addr_len;
00038 uint32_t int_status;
00039 bool use_dma;
00040 };
00041
00042 NTSTATUS shc_registry_init(WDFDEVICE device);
00043 void shc_registry_cleanup(WDFDEVICE device);
00044
00045 NTSTATUS shc_pci_config_init(WDFDEVICE device);
00046 void shc_pci_config_cleanup(WDFDEVICE device);
00047 void shc_pci_config_read8(WDFDEVICE device, uint32_t offset, uint8_t *val);
00048 void shc_pci_config_write8(WDFDEVICE device, uint32_t offset, uint8_t val);
00049
00050 NTSTATUS shc_interrupt_init(WDFDEVICE device);
00051 NTSTATUS shc_dma_init(WDFDEVICE device);
00052
00053 NTSTATUS shc_create_slot(WDFDEVICE device, struct sdioemb_slot **new_slot, int slot_idx);
00054 void shc_destroy_slot(WDFDEVICE device, struct sdioemb_slot *slot);