Root/
| 1 | /* |
| 2 | * include/ubb/swuart.h - Software-implemented UART for UBB |
| 3 | * |
| 4 | * Written 2012 by Werner Almesberger |
| 5 | * Copyright 2012 Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #ifndef UBB_SWUART_H |
| 14 | #define UBB_SWUART_H |
| 15 | |
| 16 | #include <stdint.h> |
| 17 | |
| 18 | |
| 19 | struct swuart_err { |
| 20 | unsigned glitch; /* unstable start bit */ |
| 21 | unsigned framing; /* stop bit wasn't "1" */ |
| 22 | unsigned overflow; /* buffer overflow */ |
| 23 | }; |
| 24 | |
| 25 | |
| 26 | int swuart_trx(void *out, int out_size, void *in, int in_size, |
| 27 | int wait_bits, int idle_bits); |
| 28 | |
| 29 | unsigned swuart_get_errors(struct swuart_err *res); |
| 30 | void swuart_clear_errors(void); |
| 31 | |
| 32 | int swuart_open(uint32_t tx, uint32_t rx, int bps); |
| 33 | void swuart_close(void); |
| 34 | |
| 35 | #endif /* !UBB_SWUART_H */ |
| 36 |
Branches:
master
