Mistake on this page?
Report an issue in GitHub or email us
whd_bus_protocol_interface.h
1 /*
2  * Copyright 2021, 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 #include "cyabs_rtos.h"
19 
20 #include "whd.h"
21 #include "whd_network_types.h"
22 #include "whd_types_int.h"
23 
24 #ifndef INCLUDED_WHD_BUS_PROTOCOL_INTERFACE_H_
25 #define INCLUDED_WHD_BUS_PROTOCOL_INTERFACE_H_
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 /******************************************************
33 * Constants
34 ******************************************************/
35 
36 typedef enum
37 {
38  BUS_FUNCTION = 0,
39  BACKPLANE_FUNCTION = 1,
40  WLAN_FUNCTION = 2
41 } whd_bus_function_t;
42 
43 #define BUS_FUNCTION_MASK (0x3) /* Update this if adding functions */
44 #define WHD_BUS_FAIL (0xFFFFFFFF)
45 
46 /******************************************************
47 * Macros
48 ******************************************************/
49 #define PLATFORM_WLAN_ALLOW_BUS_TO_SLEEP_DELAY_MS 10
50 
51 #define DELAYED_BUS_RELEASE_SCHEDULE(whd_driver, schedule) do { whd_delayed_bus_release_schedule_update(whd_driver, \
52  schedule); \
53 } while (0)
54 
55 /******************************************************
56 * Structures
57 ******************************************************/
58 
59 #pragma pack(1)
60 
61 typedef struct
62 {
63  uint8_t bus_header[MAX_BUS_HEADER_SIZE];
64  uint32_t data[1];
66 
67 #pragma pack()
68 
69 typedef void (*whd_bus_irq_callback_t)(void *handler_arg, uint32_t event);
70 
71 /******************************************************
72 * Function declarations
73 ******************************************************/
74 
75 /* Initialisation functions */
76 extern whd_result_t whd_bus_init(whd_driver_t whd_driver);
77 extern whd_result_t whd_bus_deinit(whd_driver_t whd_driver);
78 
79 /* Device register access functions */
80 extern whd_result_t whd_bus_write_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
81  uint32_t value);
82 extern whd_result_t whd_bus_read_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
83  uint8_t *value);
84 extern whd_result_t whd_bus_write_register_value(whd_driver_t whd_driver, whd_bus_function_t function, uint32_t address,
85  uint8_t value_length, uint32_t value);
86 extern whd_result_t whd_bus_read_register_value(whd_driver_t whd_driver, whd_bus_function_t function, uint32_t address,
87  uint8_t value_length, uint8_t *value);
88 
89 /* Device data transfer functions */
90 extern whd_result_t whd_bus_send_buffer(whd_driver_t whd_driver, whd_buffer_t buffer);
91 extern whd_result_t whd_bus_transfer_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
92  whd_bus_function_t function, uint32_t address, uint16_t size,
94 
95 /* Frame transfer function */
96 extern whd_result_t whd_bus_read_frame(whd_driver_t whd_driver, whd_buffer_t *buffer);
97 
98 extern uint32_t whd_bus_packet_available_to_read(whd_driver_t whd_driver);
99 extern whd_result_t whd_bus_poke_wlan(whd_driver_t whd_driver);
100 extern whd_result_t whd_bus_wait_for_wlan_event(whd_driver_t whd_driver, cy_semaphore_t *transceive_semaphore);
101 
102 extern whd_result_t whd_bus_ack_interrupt(whd_driver_t whd_driver, uint32_t intstatus);
103 extern whd_bool_t whd_bus_wake_interrupt_present(whd_driver_t whd_driver);
104 
105 extern whd_result_t whd_bus_set_flow_control(whd_driver_t whd_driver, uint8_t value);
106 extern whd_bool_t whd_bus_is_flow_controlled(whd_driver_t whd_driver);
107 
108 extern whd_result_t whd_bus_wakeup(whd_driver_t whd_driver);
109 extern whd_result_t whd_bus_sleep(whd_driver_t whd_driver);
110 
111 extern uint8_t whd_bus_backplane_read_padd_size(whd_driver_t whd_driver);
112 extern whd_bool_t whd_bus_use_status_report_scheme(whd_driver_t whd_driver);
113 extern uint32_t whd_bus_get_max_transfer_size(whd_driver_t whd_driver);
114 
115 extern void whd_bus_init_stats(whd_driver_t whd_driver);
116 extern whd_result_t whd_bus_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print);
117 extern whd_result_t whd_bus_reinit_stats(whd_driver_t whd_driver, whd_bool_t wake_from_firmware);
118 extern whd_result_t whd_bus_irq_enable(whd_driver_t whd_driver, whd_bool_t enable);
119 extern whd_result_t whd_bus_irq_register(whd_driver_t whd_driver);
120 /******************************************************
121 * Global variables
122 ******************************************************/
123 
124 #ifdef __cplusplus
125 } /* extern "C" */
126 #endif
127 
128 #endif /* ifndef INCLUDED_WHD_BUS_PROTOCOL_INTERFACE_H_ */
129 
#define MAX_BUS_HEADER_SIZE
Max bus header size for all bus types (sdio/spi)
Definition: whd_types.h:103
Provides abstract pointer type to act as instance for: driver, interface, buffer funcs, network funcs, resource funcs and bus funcs.
whd_bus_transfer_direction_t
Transfer direction for the WHD platform bus interface.
Definition: whd_types.h:172
whd_bool_t
Boolean values.
Definition: whd_types.h:162
uint32_t whd_result_t
WHD result is specified as uint32_t value.
Definition: whd_types.h:776
Defines common constants used with WHD within src folder.
Prototypes of functions corresponding to Buffer and Network Interface.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.