/usr/include/csp/drivers/usart.h is in libcsp-dev 1.4+fdd49b7+dfsg-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /*
Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
Copyright (C) 2012 GomSpace ApS (http://www.gomspace.com)
Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file usart.h
* Common USART interface,
* This file is derived from the Gomspace USART driver,
* the main difference is the assumption that only one USART will be present on a PC
*/
#ifndef USART_H_
#define USART_H_
#include <stdint.h>
/**
* Usart configuration, to be used with the usart_init call.
*/
struct usart_conf {
const char *device;
uint32_t baudrate;
uint8_t databits;
uint8_t stopbits;
uint8_t paritysetting;
uint8_t checkparity;
};
/**
* Initialise UART with the usart_conf data structure
* @param usart_conf full configuration structure
*/
void usart_init(struct usart_conf *conf);
/**
* In order to catch incoming chars use the callback.
* Only one callback per interface.
* @param handle usart[0,1,2,3]
* @param callback function pointer
*/
typedef void (*usart_callback_t) (uint8_t *buf, int len, void *pxTaskWoken);
void usart_set_callback(usart_callback_t callback);
/**
* Insert a character to the RX buffer of a usart
* @param handle usart[0,1,2,3]
* @param c Character to insert
*/
void usart_insert(char c, void *pxTaskWoken);
/**
* Polling putchar
*
* @param handle usart[0,1,2,3]
* @param c Character to transmit
*/
void usart_putc(char c);
/**
* Send char buffer on UART
*
* @param handle usart[0,1,2,3]
* @param buf Pointer to data
* @param len Length of data
*/
void usart_putstr(char *buf, int len);
/**
* Buffered getchar
*
* @param handle usart[0,1,2,3]
* @return Character received
*/
char usart_getc(void);
int usart_messages_waiting(int handle);
static inline int usart_stdio_msgwaiting(void) {
return usart_messages_waiting(0);
}
#endif /* USART_H_ */
|