1 /* Copyright (c) 2014, Nordic Semiconductor ASA
\r
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
4 * of this software and associated documentation files (the "Software"), to deal
\r
5 * in the Software without restriction, including without limitation the rights
\r
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
7 * copies of the Software, and to permit persons to whom the Software is
\r
8 * furnished to do so, subject to the following conditions:
\r
10 * The above copyright notice and this permission notice shall be included in all
\r
11 * copies or substantial portions of the Software.
\r
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
23 * @brief Interface for buffer.
\r
26 /** @defgroup aci_queue aci_queue
\r
32 #ifndef ACI_QUEUE_H__
\r
33 #define ACI_QUEUE_H__
\r
36 #include "hal_aci_tl.h"
\r
38 /*********************************************************************** */
\r
39 /* The ACI_QUEUE_SIZE determines the memory usage of the system. */
\r
40 /* Successfully tested to a ACI_QUEUE_SIZE of 4 (interrupt) and 4 (polling) */
\r
41 /*********************************************************************** */
\r
42 #define ACI_QUEUE_SIZE 4
\r
44 /** Data type for queue of data packets to send/receive from radio.
\r
46 * A FIFO queue is maintained for packets. New packets are added (enqueued)
\r
47 * at the tail and taken (dequeued) from the head. The head variable is the
\r
48 * index of the next packet to dequeue while the tail variable is the index of
\r
49 * where the next packet should be queued.
\r
53 hal_aci_data_t aci_data[ACI_QUEUE_SIZE];
\r
58 void aci_queue_init(aci_queue_t *aci_q);
\r
60 bool aci_queue_dequeue(aci_queue_t *aci_q, hal_aci_data_t *p_data);
\r
61 bool aci_queue_dequeue_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data);
\r
63 bool aci_queue_enqueue(aci_queue_t *aci_q, hal_aci_data_t *p_data);
\r
64 bool aci_queue_enqueue_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data);
\r
66 bool aci_queue_is_empty(aci_queue_t *aci_q);
\r
67 bool aci_queue_is_empty_from_isr(aci_queue_t *aci_q);
\r
69 bool aci_queue_is_full(aci_queue_t *aci_q);
\r
70 bool aci_queue_is_full_from_isr(aci_queue_t *aci_q);
\r
72 bool aci_queue_peek(aci_queue_t *aci_q, hal_aci_data_t *p_data);
\r
73 bool aci_queue_peek_from_isr(aci_queue_t *aci_q, hal_aci_data_t *p_data);
\r
75 #endif /* ACI_QUEUE_H__ */
\r