Sound Open Firmware
Loading...
Searching...
No Matches
ringbuffer.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2019 Intel Corporation. All rights reserved.
4 *
5 * Author: Marcin Rajwa <marcin.rajwa@linux.intel.com>
6 */
7
8#ifndef __SOF_DEBUG_GDB_RINGBUFFER_H__
9#define __SOF_DEBUG_GDB_RINGBUFFER_H__
10
11#include <sof/lib/mailbox.h>
12
13#define RING_SIZE 128
14#define DEBUG_RX_BASE (mailbox_get_debug_base())
15#define DEBUG_TX_BASE (mailbox_get_debug_base() + 0x100)
16
17unsigned char get_debug_char(void);
18void put_debug_char(unsigned char c);
19void put_exception_char(char c);
20void init_buffers(void);
21struct ring {
22 unsigned char head;
23 unsigned char fill1[63];
24 unsigned char tail;
25 unsigned char fill2[63];
26 unsigned char data[RING_SIZE];
27};
28
29static inline unsigned int ring_next_head(const volatile struct ring *ring)
30{
31 return (ring->head + 1) & (RING_SIZE - 1);
32}
33
34static inline unsigned int ring_next_tail(const volatile struct ring *ring)
35{
36 return (ring->tail + 1) & (RING_SIZE - 1);
37}
38
39static inline int ring_have_space(const volatile struct ring *ring)
40{
41 return ring_next_head(ring) != ring->tail;
42}
43
44static inline int ring_have_data(const volatile struct ring *ring)
45{
46 return ring->head != ring->tail;
47}
48
49#endif /* __SOF_DEBUG_GDB_RINGBUFFER_H__ */
#define RING_SIZE
Definition ringbuffer.h:13
void put_debug_char(unsigned char c)
unsigned char get_debug_char(void)
static unsigned int ring_next_tail(const volatile struct ring *ring)
Definition ringbuffer.h:34
static int ring_have_space(const volatile struct ring *ring)
Definition ringbuffer.h:39
void put_exception_char(char c)
void init_buffers(void)
static int ring_have_data(const volatile struct ring *ring)
Definition ringbuffer.h:44
static unsigned int ring_next_head(const volatile struct ring *ring)
Definition ringbuffer.h:29
Definition ringbuffer.h:21
unsigned char fill2[63]
Definition ringbuffer.h:25
unsigned char tail
Definition ringbuffer.h:24
unsigned char head
Definition ringbuffer.h:22
unsigned char data[RING_SIZE]
Definition ringbuffer.h:26
unsigned char fill1[63]
Definition ringbuffer.h:23