NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_twd.h
Go to the documentation of this file.
1// ================================================================================ //
2// The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 //
3// Copyright (c) NEORV32 contributors. //
4// Copyright (c) 2020 - 2025 Stephan Nolting. All rights reserved. //
5// Licensed under the BSD-3-Clause license, see LICENSE for details. //
6// SPDX-License-Identifier: BSD-3-Clause //
7// ================================================================================ //
8
13
14#ifndef NEORV32_TWD_H
15#define NEORV32_TWD_H
16
17#include <stdint.h>
18
19
20/**********************************************************************/
25typedef volatile struct __attribute__((packed,aligned(4))) {
26 uint32_t CTRL;
27 uint32_t DATA;
29
31#define NEORV32_TWD ((neorv32_twd_t*) (NEORV32_TWD_BASE))
32
58
64
65
66
67/**********************************************************************/
71int neorv32_twd_available(void);
72void neorv32_twd_setup(int device_addr, int fsel, uint32_t irq_mask);
75void neorv32_twd_disable(void);
76void neorv32_twd_enable(void);
77void neorv32_twd_clear_rx(void);
78void neorv32_twd_clear_tx(void);
79int neorv32_twd_sense_scl(void);
80int neorv32_twd_sense_sda(void);
81int neorv32_twd_busy(void);
83int neorv32_twd_rx_full(void);
84int neorv32_twd_tx_empty(void);
85int neorv32_twd_tx_full(void);
86void neorv32_twd_put(uint8_t data);
87uint8_t neorv32_twd_get(void);
88void neorv32_twd_set_tx_dummy(uint8_t data);
90
91
92#endif // NEORV32_TWD_H
void neorv32_twd_put(uint8_t data)
Definition neorv32_twd.c:230
int neorv32_twd_rx_full(void)
Definition neorv32_twd.c:180
void neorv32_twd_clear_tx(void)
Definition neorv32_twd.c:105
int neorv32_twd_sense_scl(void)
Definition neorv32_twd.c:116
NEORV32_TWD_CTRL_enum
Definition neorv32_twd.h:34
@ TWD_CTRL_CLR_RX
Definition neorv32_twd.h:36
@ TWD_CTRL_TX_FULL
Definition neorv32_twd.h:53
@ TWD_CTRL_RX_FIFO_MSB
Definition neorv32_twd.h:46
@ TWD_CTRL_DEV_ADDR0
Definition neorv32_twd.h:39
@ TWD_CTRL_TX_EMPTY
Definition neorv32_twd.h:52
@ TWD_CTRL_TX_FIFO_LSB
Definition neorv32_twd.h:47
@ TWD_CTRL_BUSY
Definition neorv32_twd.h:56
@ TWD_CTRL_IRQ_TX_EMPTY
Definition neorv32_twd.h:43
@ TWD_CTRL_SENSE_SCL
Definition neorv32_twd.h:54
@ TWD_CTRL_RX_FIFO_LSB
Definition neorv32_twd.h:45
@ TWD_CTRL_RX_AVAIL
Definition neorv32_twd.h:50
@ TWD_CTRL_CLR_TX
Definition neorv32_twd.h:37
@ TWD_CTRL_DEV_ADDR6
Definition neorv32_twd.h:40
@ TWD_CTRL_SENSE_SDA
Definition neorv32_twd.h:55
@ TWD_CTRL_RX_FULL
Definition neorv32_twd.h:51
@ TWD_CTRL_IRQ_RX_AVAIL
Definition neorv32_twd.h:41
@ TWD_CTRL_EN
Definition neorv32_twd.h:35
@ TWD_CTRL_FSEL
Definition neorv32_twd.h:38
@ TWD_CTRL_TX_FIFO_MSB
Definition neorv32_twd.h:48
@ TWD_CTRL_IRQ_RX_FULL
Definition neorv32_twd.h:42
uint8_t neorv32_twd_get(void)
Definition neorv32_twd.c:243
NEORV32_TWD_DATA_enum
Definition neorv32_twd.h:60
@ TWD_DATA_LSB
Definition neorv32_twd.h:61
@ TWD_DATA_MSB
Definition neorv32_twd.h:62
void neorv32_twd_set_tx_dummy(uint8_t data)
Definition neorv32_twd.c:256
int neorv32_twd_sense_sda(void)
Definition neorv32_twd.c:132
void neorv32_twd_enable(void)
Definition neorv32_twd.c:87
int neorv32_twd_busy(void)
Definition neorv32_twd.c:148
int neorv32_twd_get_tx_fifo_depth(void)
Definition neorv32_twd.c:68
void neorv32_twd_clear_rx(void)
Definition neorv32_twd.c:96
int neorv32_twd_get_rx_fifo_depth(void)
Definition neorv32_twd.c:56
int neorv32_twd_tx_full(void)
Definition neorv32_twd.c:212
int neorv32_twd_tx_empty(void)
Definition neorv32_twd.c:196
int neorv32_twd_available(void)
Definition neorv32_twd.c:22
void neorv32_twd_setup(int device_addr, int fsel, uint32_t irq_mask)
Definition neorv32_twd.c:35
int neorv32_twd_rx_available(void)
Definition neorv32_twd.c:164
void neorv32_twd_disable(void)
Definition neorv32_twd.c:78
Definition neorv32_twd.h:25
uint32_t DATA
Definition neorv32_twd.h:27
uint32_t CTRL
Definition neorv32_twd.h:26