whd_chip_specific_init = whd_enable_save_restore
whd_is_fw_sr_capable
read backplane CHIPCOMMON_SR_CONTROL1(0x18000508),4 = 0x000001F8
return WHD_TRUE
// Configure WakeupCtrl register to set HtAvail request bit in chipClockCSR register
// after the sdiod core is powered on.
read func1 SDIO_WAKEUP_CTRL(0x0001001E),1 = 0x00
write func1 SDIO_WAKEUP_CTRL(0x0001001E),1 = 0x02
// Set brcmCardCapability to noCmdDecode mode.
// It makes sdiod_aos to wakeup host for any activity of cmd line, even though
// module won't decode cmd or respond
write func0 0xF0,1 = 0x08
write func1 0x1000E,1 = 0x02
// Enable KeepSdioOn (KSO) bit for normal operation
read func1 0x1001F,1 = 0x03
// SPI bus can be configured for sleep by default.
// KSO bit solely controls the wlan chip sleep
whd_bus_sleep
return WHD_SUCCESS
// Put SPI interface block to sleep
write func1 0x1000F,1 = 0x0f
whd_ensure_wlan_bus_is_up
whd_bus_is_up
return whd_driver->bus_common_info->bus_is_up (=0)
whd_kso_enable
write_value = SBSDIO_SLPCSR_KEEP_WL_KSO (=0x01)
// 1st KSO write goes to AOS wake up core if device is asleep
// Possibly device might not respond to this cmd. So, don't check return value here
// 2 Sequential writes to KSO bit are required for SR module to wakeup, both write can fail
write func1 0x1001F,1 = 0x01
write func1 0x1001F,1 = 0x01
// device WAKEUP through KSO:
write bit 0 & read back until both bits 0(kso bit) & 1 (dev on status) are set
compare_value = SBSDIO_SLPCSR_KEEP_WL_KSO | SBSDIO_SLPCSR_WL_DEVON (=0x03)
bmask = compare_value;
do:
// Reliable KSO bit set/clr:
// Sdiod sleep write access appears to be in sync with PMU 32khz clk
// just one write attempt may fail,(same is with read ?)
// in any case, read it back until it matches written value
read func1 0x1001F,1 = 0x03
while ((read_value & bmask) != compare_value || read_value == 0xFF)
whd_proto_attach
whd_cdc_bdc_info_init
/* Download blob file if exists */
whd_process_clm_data
clm_blob_size = 7222
blocks_count = 8
data_offset = 12
size2alloc = 12+1024 = 1036
C:\Users\Octopus\Desktop\test\f4_20251119_4bit\Middlewares\Third_Party\Infineon_Wireless_Connectivity\wifi-host-driver\COMPONENT_WIFI5\resources\clm\COMPONENT_43439\COMPONENT_MURATA-1YN\43439A0_clm_blob.c
wifi_firmware_clm_blob
dl_flag = DL_BEGIN
if (end)
dl_flag |= DL_END
whd_download_wifi_clm_image(ifp, IOVAR_STR_CLMLOAD, dl_flag, DL_TYPE_CLM, chunk_buf, data_offset + chunk_len)
dload_ptr->flag = (1 << 12) | dl_flag = 0x1002
dload_ptr->dload_type = DL_TYPE_CLM (=2)
dload_ptr->len = 1036-12=1024
crc = ?
len = size2alloc = 1036
len = len + 8 - (len % 8) = 1036+8-(1036%8)=1036+8-4=1040
name = "clmload"
name_length = 8
name_length_alignment_offset = 0
pbuf->len = IOCTL_OFFSET(36) + data_length(1040) + name_length(8) + name_length_alignment_offset = 1084
iov_data = &pbuf->payload[IOCTL_OFFSET + name_length + name_length_alignment_offset] = &pbuf->payload[44]
memcpy(iov_data, (wl_dload_data_t *)dload_ptr, 1040)
whd_proto_set_iovar(pbuf)
whd_cdc_set_iovar
whd_cdc_send_iovar
whd_cdc_send_ioctl (type=CDC_SET=2, command=WLC_SET_VAR=263)
data_length = pbuf->len - sizeof(bus_common_header_t) - sizeof(cdc_header_t) = 1048
send_packet = pbuf->payload
data = (uint8_t *)send_packet + sizeof(control_header_t) = &pbuf->payload[36] = &pbuf->payload[IOCTL_OFFSET]
/* Calculate the offset added to compensate for IOVAR string creating unaligned data section */
// remove name_length_alignment_offset
memmove(data, data + name_length_alignment_offset, data_length - name_length_alignment_offset)
data_length -= name_length_alignment_offset
/* Prepare the CDC header */
send_packet->cdc_header.cmd = 263
send_packet->cdc_header.len = 1048 = data_length(1040) + name_length(8)
send_packet->cdc_header.flags = 0x50002
send_packet->cdc_header.status = 0
whd_send_to_bus
size=pbuf->len-sizeof(whd_buffer_header_t)=1084-8=1076
(control_header_t *)(pbuf->payload)->common.bus_header = (sdpcm_header_t)sdpcm_header // sizeof(sdpcm_header_t)=12
prio=8 // prio 8 : Control(4)(ex: IOVAR/IOCTL)
ac=4
cy_rtos_set_semaphore(&sdpcm_info->send_queue_mutex, WHD_FALSE)
whd_thread_notify(whd_driver)
cy_rtos_set_semaphore(&whd_driver->thread_info.transceive_semaphore, WHD_FALSE)
* whd_thread_send_one_packet
whd_sdpcm_get_packet_to_send
send_packet->common.bus_header.sw_header.sequence = sdpcm_info->tx_seq
whd_bus_send_buffer
whd_bus_transfer_bytes(pbuf->payload + sizeof(struct pbuf *), pbuf->len - sizeof(struct pbuf *)) // pbuf->payload+4, 1084-4=1080
whd_bus_sdio_transfer_bytes(((whd_transfer_bytes_packet_t *)data)->data, 1080) // pbuf->payload+8, 1080
CMD53 WRITE func2 addr=0 size=1024 BLOCK_MODE
CMD53 WRITE func2 addr=1024 size=56 MULTIBYTE_MODE
* whd_bus_packet_available_to_read
whd_bus_sdio_packet_available_to_read
// Read the IntStatus
read backplane SDIO_INT_STATUS(0x18002020),4 = 0x00820040
#define SDIO_INT_STATUS(wd) GET_C_VAR(wd, SDIOD_CORE_BASE_ADDRESS) + 0x20 (=0x18002000+0x20)
// Clear any interrupts
write backplane SDIO_INT_STATUS(0x18002020),4 = (int_status & HOSTINTMASK)
if (int_status & I_HMB_FRAME_IND) // &0x40
whd_thread_receive_one_packet
whd_bus_read_frame
whd_bus_sdio_read_frame
hwtag = CMD53 READ func2 addr=0 size=4 MULTIBYTE_MODE
if (*(uint16_t *)data != 12)
extra_space_required = hwtag - INITIAL_READ;
alloc buffer(INITIAL_READ + extra_space_required + sizeof(whd_buffer_header_t)) //(1084)
// the first byte read is the first byte of sdpcm_header_t
memcpy(packet->common.bus_header, hwtag, 4)
CMD53 READ func2 addr=0 size=extra_space_required
if (failed)
whd_bus_sdio_abort_read
* whd_thread_receive_one_packet
dl_flag &= ~DL_BEGIN