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 #include "whd.h"
18 #include <stdint.h>
19 
20 #ifndef INCLUDED_WHD_BUS_COMMON_H
21 #define INCLUDED_WHD_BUS_COMMON_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define WHD_BACKPLAIN_BUF_TIMEOUT   (0xFFFFFFFF)
28 #define WHD_RX_BUF_TIMEOUT          (10)
29 
30 
31 struct whd_bus_common_info;
32 
33 void whd_bus_common_info_init(whd_driver_t whd_driver);
34 void whd_bus_common_info_deinit(whd_driver_t whd_driver);
35 
36 /* Configure delayed sleep of bus.
37  * A high number will mean a longer delay before sleep after the last operation (higher performance)
38  * A shorter delay will mean quicker sleep after last operation (lower power use)
39  */
40 extern void         whd_bus_sdio_wlan_set_delayed_bus_powersave_milliseconds(whd_driver_t whd_driver, uint32_t time_ms);
41 extern whd_result_t whd_bus_resume_after_deep_sleep(whd_driver_t whd_driver);
42 
43 extern whd_result_t whd_bus_write_wifi_firmware_image(whd_driver_t whd_driver);
44 extern whd_result_t whd_bus_write_wifi_nvram_image(whd_driver_t whd_driver);
45 extern void         whd_bus_set_resource_download_halt(whd_driver_t whd_driver, whd_bool_t halt);
46 
47 extern whd_result_t whd_bus_transfer_backplane_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
48                                                      uint32_t address, uint32_t size, uint8_t *data);
49 extern void whd_bus_init_backplane_window(whd_driver_t whd_driver);
50 whd_result_t whd_bus_set_backplane_window(whd_driver_t whd_driver, uint32_t addr);
51 
52 whd_bool_t whd_bus_is_up(whd_driver_t whd_driver);
53 extern whd_result_t whd_bus_set_flow_control(whd_driver_t whd_driver, uint8_t value);
54 extern whd_bool_t whd_bus_is_flow_controlled(whd_driver_t whd_driver);
55 
56 void whd_bus_set_state(whd_driver_t whd_driver, whd_bool_t state);
57 
58 extern void whd_delayed_bus_release_schedule_update(whd_driver_t whd_driver, whd_bool_t is_scheduled);
59 
60 /* handle delayed sleep of bus */
61 extern uint32_t     whd_bus_handle_delayed_release(whd_driver_t whd_driver);
62 whd_bool_t whd_bus_platform_mcu_power_save_deep_sleep_enabled(whd_driver_t whd_driver);
63 #ifdef __cplusplus
64 } /*extern "C" */
65 #endif
66 
67 #endif
68