Mistake on this page?
Report an issue in GitHub or email us
whd_bus_spi_protocol.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 "whd.h"
19 #include "whd_bus_protocol_interface.h"
20 #include "cy_result.h"
21 #include "cyhal_spi.h"
22 
23 #ifndef INCLUDED_SPI_WHD_BUS_PROTOCOL_H
24 #define INCLUDED_SPI_WHD_BUS_PROTOCOL_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /******************************************************
31 * Constants
32 ******************************************************/
33 
34 /******************************************************
35 * Structures
36 ******************************************************/
37 
38 typedef uint32_t whd_bus_gspi_header_t;
39 
40 #pragma pack(1)
41 
42 typedef struct
43 {
44  whd_bus_gspi_header_t gspi_header;
46 
47 #pragma pack()
48 
49 #define WHD_BUS_SPI_HEADER_SIZE (sizeof(whd_bus_header_t) )
50 
51 #define WHD_BUS_SPI_USE_STATUS_REPORT_SCHEME (1 == 1)
52 
53 #define WHD_BUS_SPI_MAX_BACKPLANE_TRANSFER_SIZE (64) /* Max packet size on F1 */
54 #define WHD_BUS_SPI_BACKPLANE_READ_PADD_SIZE (4)
55 
56 /******************************************************
57 * Function declarations
58 ******************************************************/
59 extern whd_result_t whd_bus_spi_send_buffer(whd_driver_t whd_driver, whd_buffer_t buffer);
60 extern whd_result_t whd_bus_spi_poke_wlan(whd_driver_t whd_driver);
61 extern whd_result_t whd_bus_spi_ack_interrupt(whd_driver_t whd_driver, uint32_t intstatus);
62 extern uint32_t whd_bus_spi_packet_available_to_read(whd_driver_t whd_driver);
63 extern whd_result_t whd_bus_spi_read_frame(whd_driver_t whd_driver, whd_buffer_t *buffer);
64 extern whd_result_t whd_bus_spi_init(whd_driver_t whd_driver);
65 extern whd_result_t whd_bus_spi_deinit(whd_driver_t whd_driver);
66 extern whd_bool_t whd_bus_spi_wake_interrupt_present(whd_driver_t whd_driver);
67 extern whd_result_t whd_bus_spi_wait_for_wlan_event(whd_driver_t whd_driver,
68  cy_semaphore_t *transceive_semaphore);
69 extern whd_result_t whd_bus_spi_write_register_value(whd_driver_t whd_driver, whd_bus_function_t function,
70  uint32_t address, uint8_t value_length, uint32_t value);
71 extern whd_result_t whd_bus_spi_read_register_value(whd_driver_t whd_driver, whd_bus_function_t function,
72  uint32_t address, uint8_t value_length, uint8_t *value);
73 extern whd_result_t whd_bus_spi_write_backplane_value(whd_driver_t whd_driver, uint32_t address,
74  uint8_t register_length, uint32_t value);
75 extern whd_result_t whd_bus_spi_read_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
76  uint8_t *value);
77 extern whd_result_t whd_bus_spi_transfer_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
78  whd_bus_function_t function, uint32_t address, uint16_t size,
80 extern whd_result_t whd_bus_spi_wakeup(whd_driver_t whd_driver);
81 extern whd_result_t whd_bus_spi_sleep(whd_driver_t whd_driver);
82 extern void whd_bus_spi_init_stats(whd_driver_t whd_driver);
83 extern whd_result_t whd_bus_spi_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print);
84 extern whd_result_t whd_bus_spi_reinit_stats(whd_driver_t whd_driver, whd_bool_t wake_from_firmware);
85 extern uint8_t whd_bus_spi_backplane_read_padd_size(whd_driver_t whd_driver);
86 extern whd_bool_t whd_bus_spi_use_status_report_scheme(whd_driver_t whd_driver);
87 extern uint32_t whd_bus_spi_get_max_transfer_size(whd_driver_t whd_driver);
88 extern whd_result_t whd_bus_spi_irq_register(whd_driver_t whd_driver);
89 extern whd_result_t whd_bus_spi_irq_enable(whd_driver_t whd_driver, whd_bool_t enable);
90 extern void whd_bus_spi_irq_handler(void *handler_arg, cyhal_spi_irq_event_t event);
91 
92 /******************************************************
93 * Global variables
94 ******************************************************/
95 
96 #ifdef __cplusplus
97 } /*extern "C" */
98 #endif
99 
100 #endif /* ifndef INCLUDED_SPI_WHD_BUS_PROTOCOL_H */
101 
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
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.