1 /* 2 * Copyright 2023, 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 * Header for using WHD with no RTOS or network stack 20 * 21 * It is possible to use these WHD without any operating system. To do this, 22 * the user application is required to periodically use the functions in this 23 * file to allow WHD to send and receive data across the SPI/SDIO bus. 24 * 25 */ 26 27 #include "whd.h" 28 29 #ifndef INCLUDED_WHD_POLL_H 30 #define INCLUDED_WHD_POLL_H 31 32 #ifdef __cplusplus 33 extern "C" 34 { 35 #endif 36 37 /****************************************************** 38 * Function declarations 39 ******************************************************/ 40 41 42 /** Sends the first queued packet 43 * 44 * Checks the queue to determine if there is any packets waiting 45 * to be sent. If there are, then it sends the first one. 46 * 47 * This function is normally used by the WHD Thread, but can be 48 * called periodically by systems which have no RTOS to ensure 49 * packets get sent. 50 * 51 * @return 1 : packet was sent 52 * 0 : no packet sent 53 */ 54 extern int8_t whd_thread_send_one_packet(whd_driver_t whd_driver); 55 56 57 /** Receives a packet if one is waiting 58 * 59 * Checks the wifi chip fifo to determine if there is any packets waiting 60 * to be received. If there are, then it receives the first one, and calls 61 * the callback @ref whd_sdpcm_process_rx_packet (in whd_sdpcm.c). 62 * 63 * This function is normally used by the WHD Thread, but can be 64 * called periodically by systems which have no RTOS to ensure 65 * packets get received properly. 66 * 67 * @return 1 : packet was received 68 * 0 : no packet waiting 69 */ 70 extern int8_t whd_thread_receive_one_packet(whd_driver_t whd_driver); 71 72 73 /** Sends and Receives all waiting packets 74 * 75 * Repeatedly calls whd_thread_send_one_packet and whd_thread_receive_one_packet 76 * to send and receive packets, until there are no more packets waiting to 77 * be transferred. 78 * 79 * This function is normally used by the WHD Thread, but can be 80 * called periodically by systems which have no RTOS to ensure 81 * packets get send and received properly. 82 * 83 * @return 1 : packet was sent or received 84 * 0 : no packet was sent or received 85 */ 86 extern int8_t whd_thread_poll_all(whd_driver_t whd_driver); 87 88 89 #ifdef __cplusplus 90 } /* extern "C" */ 91 #endif 92 #endif /* ifndef INCLUDED_WHD_POLL_H */ 93 94