1 /* 2 * Copyright 2022, Cypress Semiconductor Corporation (an Infineon company) 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** @file 19 * 20 */ 21 22 #include "whd_bus_protocol_interface.h" 23 #include "whd_resource_api.h" 24 25 #ifndef INCLUDED_WHD_BUS_H_ 26 #define INCLUDED_WHD_BUS_H_ 27 28 #ifdef __cplusplus 29 extern "C" 30 { 31 #endif 32 33 #if 0 34 typedef struct whd_bus_if *whd_bus_if_t; 35 36 typedef whd_result_t (*whd_bus_transfer_t)(whd_bus_if_t *bus_if, whd_bus_transfer_direction_t dir, 37 uint8_t *data, uint16_t data_size, void *arg1, void *arg2, void *arg3, 38 void *arg4); 39 #endif 40 41 typedef whd_result_t (*whd_bus_init_t)(whd_driver_t whd_driver); 42 typedef whd_result_t (*whd_bus_deinit_t)(whd_driver_t whd_driver); 43 44 typedef whd_result_t (*whd_bus_ack_interrupt_t)(whd_driver_t whd_driver, uint32_t intstatus); 45 typedef whd_bool_t (*whd_bus_wake_interrupt_present_t)(whd_driver_t whd_driver); 46 typedef uint32_t (*whd_bus_packet_available_to_read_t)(whd_driver_t whd_driver); 47 typedef whd_result_t (*whd_bus_read_frame_t)(whd_driver_t whd_driver, whd_buffer_t *buffer); 48 49 typedef whd_result_t (*whd_bus_set_backplane_window_t)(whd_driver_t whd_driver, uint32_t addr, uint32_t *cur_base_addr); 50 typedef whd_result_t (*whd_bus_write_backplane_value_t)(whd_driver_t whd_driver, uint32_t address, 51 uint8_t register_length, uint32_t value); 52 typedef whd_result_t (*whd_bus_read_backplane_value_t)(whd_driver_t whd_driver, uint32_t address, 53 uint8_t register_length, uint8_t *value); 54 55 typedef whd_result_t (*whd_bus_write_register_value_t)(whd_driver_t whd_driver, whd_bus_function_t function, 56 uint32_t address, uint8_t value_length, uint32_t value); 57 typedef whd_result_t (*whd_bus_read_register_value_t)(whd_driver_t whd_driver, whd_bus_function_t function, 58 uint32_t address, uint8_t value_length, uint8_t *value); 59 60 typedef whd_result_t (*whd_bus_transfer_bytes_t)(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction, 61 whd_bus_function_t function, uint32_t address, uint16_t size, 62 whd_transfer_bytes_packet_t *data); 63 64 typedef whd_result_t (*whd_bus_poke_wlan_t)(whd_driver_t whd_driver); 65 66 typedef whd_result_t (*whd_bus_wakeup_t)(whd_driver_t whd_driver); 67 typedef whd_result_t (*whd_bus_sleep_t)(whd_driver_t whd_driver); 68 typedef uint8_t (*whd_bus_backplane_read_padd_size_t)(whd_driver_t whd_driver); 69 typedef whd_result_t (*whd_bus_send_buffer_t)(whd_driver_t whd_driver, whd_buffer_t buffer); 70 typedef whd_result_t (*whd_bus_wait_for_wlan_event_t)(whd_driver_t whd_driver, 71 cy_semaphore_t *transceive_semaphore); 72 typedef whd_bool_t (*whd_bus_use_status_report_scheme_t)(whd_driver_t whd_driver); 73 typedef uint32_t (*whd_bus_get_max_transfer_size_t)(whd_driver_t whd_driver); 74 75 typedef void (*whd_bus_init_stats_t)(whd_driver_t whd_driver); 76 typedef whd_result_t (*whd_bus_print_stats_t)(whd_driver_t whd_driver, whd_bool_t reset_after_print); 77 typedef whd_result_t (*whd_bus_reinit_stats_t)(whd_driver_t whd_driver, whd_bool_t wake_from_firmware); 78 typedef whd_result_t (*whd_bus_irq_register_t)(whd_driver_t whd_driver); 79 typedef whd_result_t (*whd_bus_irq_enable_t)(whd_driver_t whd_driver, whd_bool_t enable); 80 typedef whd_result_t (*whd_bus_download_resource_t)(whd_driver_t whd_driver, whd_resource_type_t resource, 81 whd_bool_t direct_resource, uint32_t address, 82 uint32_t image_size); 83 84 typedef struct whd_bus_info 85 { 86 whd_bus_init_t whd_bus_init_fptr; 87 whd_bus_deinit_t whd_bus_deinit_fptr; 88 89 whd_bus_ack_interrupt_t whd_bus_ack_interrupt_fptr; 90 whd_bus_send_buffer_t whd_bus_send_buffer_fptr; 91 92 whd_bus_wake_interrupt_present_t whd_bus_wake_interrupt_present_fptr; 93 whd_bus_packet_available_to_read_t whd_bus_packet_available_to_read_fptr; 94 whd_bus_read_frame_t whd_bus_read_frame_fptr; 95 96 whd_bus_set_backplane_window_t whd_bus_set_backplane_window_fptr; 97 whd_bus_write_backplane_value_t whd_bus_write_backplane_value_fptr; 98 whd_bus_read_backplane_value_t whd_bus_read_backplane_value_fptr; 99 100 whd_bus_write_register_value_t whd_bus_write_register_value_fptr; 101 whd_bus_read_register_value_t whd_bus_read_register_value_fptr; 102 103 whd_bus_transfer_bytes_t whd_bus_transfer_bytes_fptr; 104 105 whd_bus_poke_wlan_t whd_bus_poke_wlan_fptr; 106 107 whd_bus_wakeup_t whd_bus_wakeup_fptr; 108 whd_bus_sleep_t whd_bus_sleep_fptr; 109 110 whd_bus_backplane_read_padd_size_t whd_bus_backplane_read_padd_size_fptr; 111 112 whd_bus_wait_for_wlan_event_t whd_bus_wait_for_wlan_event_fptr; 113 whd_bus_use_status_report_scheme_t whd_bus_use_status_report_scheme_fptr; 114 115 whd_bus_get_max_transfer_size_t whd_bus_get_max_transfer_size_fptr; 116 117 whd_bus_init_stats_t whd_bus_init_stats_fptr; 118 whd_bus_print_stats_t whd_bus_print_stats_fptr; 119 whd_bus_reinit_stats_t whd_bus_reinit_stats_fptr; 120 whd_bus_irq_register_t whd_bus_irq_register_fptr; 121 whd_bus_irq_enable_t whd_bus_irq_enable_fptr; 122 whd_bus_download_resource_t whd_bus_download_resource_fptr; 123 } whd_bus_info_t; 124 125 126 #ifdef __cplusplus 127 } /* extern "C" */ 128 #endif 129 #endif /* ifndef INCLUDED_WHD_BUS_H_ */ 130