moved all third-party lib to separate folder
This commit is contained in:
22
thirdparty/libcsp/include/csp/drivers/can_socketcan.h
vendored
Normal file
22
thirdparty/libcsp/include/csp/drivers/can_socketcan.h
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* can_socketcan.h
|
||||
*
|
||||
* Created on: Feb 6, 2017
|
||||
* Author: johan
|
||||
*/
|
||||
|
||||
#ifndef LIB_CSP_INCLUDE_CSP_DRIVERS_CAN_SOCKETCAN_H_
|
||||
#define LIB_CSP_INCLUDE_CSP_DRIVERS_CAN_SOCKETCAN_H_
|
||||
|
||||
#include <csp/csp_types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
csp_iface_t * csp_can_socketcan_init(const char * ifc, int bitrate, int promisc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* LIB_CSP_INCLUDE_CSP_DRIVERS_CAN_SOCKETCAN_H_ */
|
120
thirdparty/libcsp/include/csp/drivers/i2c.h
vendored
Normal file
120
thirdparty/libcsp/include/csp/drivers/i2c.h
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
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
|
||||
* Common I2C interface,
|
||||
* This file is derived from the Gomspace I2C driver,
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef I2C_H_
|
||||
#define I2C_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The return value of the driver is a bit strange,
|
||||
* It should return E_NO_ERR if successfull and the value is -1
|
||||
*/
|
||||
#define E_NO_ERR -1
|
||||
|
||||
/**
|
||||
* Maximum transfer length on I2C
|
||||
*/
|
||||
#define I2C_MTU 256
|
||||
|
||||
/**
|
||||
I2C device modes
|
||||
@{
|
||||
*/
|
||||
/**
|
||||
I2C Master mode.
|
||||
*/
|
||||
#define I2C_MASTER 0
|
||||
/**
|
||||
I2C Slave mode.
|
||||
*/
|
||||
#define I2C_SLAVE 1
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
Data structure for I2C frames.
|
||||
This structs fits on top of #csp_packet_t, removing the need for copying data.
|
||||
*/
|
||||
typedef struct __attribute__((packed)) i2c_frame_s {
|
||||
//! Not used by CSP
|
||||
uint8_t padding;
|
||||
//! Not used by CSP - cleared before Tx
|
||||
uint8_t retries;
|
||||
//! Not used by CSP
|
||||
uint32_t reserved;
|
||||
//! Destination address
|
||||
uint8_t dest;
|
||||
//! Not used by CSP - cleared before Tx
|
||||
uint8_t len_rx;
|
||||
//! Length of \a data part
|
||||
uint16_t len;
|
||||
//! CSP data
|
||||
uint8_t data[I2C_MTU];
|
||||
} i2c_frame_t;
|
||||
|
||||
/**
|
||||
Callback for receiving data.
|
||||
|
||||
@param[in] frame received I2C frame
|
||||
@param[out] pxTaskWoken can be set, if context switch is required due to received data.
|
||||
*/
|
||||
typedef void (*i2c_callback_t) (i2c_frame_t * frame, void * pxTaskWoken);
|
||||
|
||||
/**
|
||||
Initialise the I2C driver
|
||||
|
||||
Functions is called by csp_i2c_init().
|
||||
|
||||
@param handle Which I2C bus (if more than one exists)
|
||||
@param mode I2C device mode. Must be either I2C_MASTER or I2C_SLAVE
|
||||
@param addr Own slave address
|
||||
@param speed Bus speed in kbps
|
||||
@param queue_len_tx Length of transmit queue
|
||||
@param queue_len_rx Length of receive queue
|
||||
@param callback If this value is set, the driver will call this function instead of using an RX queue
|
||||
@return Error code
|
||||
*/
|
||||
int i2c_init(int handle, int mode, uint8_t addr, uint16_t speed, int queue_len_tx, int queue_len_rx, i2c_callback_t callback);
|
||||
|
||||
/**
|
||||
User I2C transmit function.
|
||||
|
||||
Called by CSP, when sending message over I2C.
|
||||
|
||||
@param handle Handle to the device
|
||||
@param frame Pointer to I2C frame
|
||||
@param timeout Ticks to wait
|
||||
@return Error code
|
||||
*/
|
||||
int i2c_send(int handle, i2c_frame_t * frame, uint16_t timeout);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
107
thirdparty/libcsp/include/csp/drivers/usart.h
vendored
Normal file
107
thirdparty/libcsp/include/csp/drivers/usart.h
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
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
|
||||
* 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>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Usart configuration, to be used with the usart_init call.
|
||||
*/
|
||||
struct usart_conf {
|
||||
//! USART device.
|
||||
const char *device;
|
||||
//! bits per second.
|
||||
uint32_t baudrate;
|
||||
//! Number of data bits.
|
||||
uint8_t databits;
|
||||
//! Number of stop bits.
|
||||
uint8_t stopbits;
|
||||
//! Parity setting.
|
||||
uint8_t paritysetting;
|
||||
//! Enable parity checking (Windows only).
|
||||
uint8_t checkparity;
|
||||
};
|
||||
|
||||
/**
|
||||
Initialise UART with the usart_conf data structure
|
||||
@param[in] 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[in] handle usart[0,1,2,3]
|
||||
@param[in] callback function pointer
|
||||
*/
|
||||
typedef void (*usart_callback_t) (uint8_t *buf, int len, void *pxTaskWoken);
|
||||
|
||||
/**
|
||||
Set callback for receiving data.
|
||||
*/
|
||||
void usart_set_callback(usart_callback_t callback);
|
||||
|
||||
/**
|
||||
Insert a character to the RX buffer of a usart
|
||||
|
||||
@param[in] c character to insert
|
||||
@param[out] pxTaskWoken can be set, if context switch is required due to received data.
|
||||
*/
|
||||
void usart_insert(char c, void *pxTaskWoken);
|
||||
|
||||
/**
|
||||
Polling putchar (stdin).
|
||||
|
||||
@param[in] c Character to transmit
|
||||
*/
|
||||
void usart_putc(char c);
|
||||
|
||||
/**
|
||||
Send char buffer on UART (stdout).
|
||||
|
||||
@param[in] buf Pointer to data
|
||||
@param[in] len Length of data
|
||||
*/
|
||||
void usart_putstr(char *buf, int len);
|
||||
|
||||
/**
|
||||
Buffered getchar (stdin).
|
||||
|
||||
@return Character received
|
||||
*/
|
||||
char usart_getc(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* USART_H_ */
|
Reference in New Issue
Block a user