-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nasa/nos3#176] Created quick stubs to further enable unit testing;
- Loading branch information
Showing
8 changed files
with
495 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* Copyright (C) 2009 - 2019 National Aeronautics and Space Administration. All Foreign Rights are Reserved to the U.S. Government. | ||
This software is provided "as is" without any warranty of any, kind either express, implied, or statutory, including, but not | ||
limited to, any warranty that the software will conform to, specifications any implied warranties of merchantability, fitness | ||
for a particular purpose, and freedom from infringement, and any warranty that the documentation will conform to the program, or | ||
any warranty that the software will be error free. | ||
In no event shall NASA be liable for any damages, including, but not limited to direct, indirect, special or consequential damages, | ||
arising out of, resulting from, or in any way connected with the software or its documentation. Whether or not based upon warranty, | ||
contract, tort or otherwise, and whether or not loss was sustained from, or arose out of the results of, or use of, the software, | ||
documentation or services provided hereunder | ||
ITC Team | ||
NASA IV&V | ||
[email protected] | ||
*/ | ||
|
||
#include "libcan.h" | ||
|
||
/* The `libsocketcan` library wraps many of the netlink operations to control a SocketCAN interface | ||
* Documentation here: https://lalten.github.io/libsocketcan/Documentation/html/group__extern.html */ | ||
|
||
// Bring CAN network interface | ||
int32_t can_init_dev(can_info_t* device) | ||
{ | ||
return CAN_SUCCESS; | ||
} | ||
|
||
// Call the `libsocketcan` function to set each CAN mode on/off | ||
int32_t can_set_modes(can_info_t* device) | ||
{ | ||
return CAN_SUCCESS; | ||
} | ||
|
||
// Write a can_frame from `device->tx_Frame` to CAN bus from SocketCAN socket specified by `device` | ||
int32_t can_write(can_info_t* device) | ||
{ | ||
return CAN_SUCCESS; | ||
} | ||
|
||
// Read a can_frame from SocketCAN interface specified by `device` into `device->rx_frame` | ||
// Does a nonblocking read call | ||
int32_t can_read(can_info_t* device) | ||
{ | ||
return CAN_SUCCESS; | ||
} | ||
|
||
// Bring CAN network interface down | ||
int32_t can_close_device(can_info_t* device) | ||
{ | ||
return CAN_SUCCESS; | ||
} | ||
|
||
// Perform non-blocking can transaction | ||
int32_t can_master_transaction(can_info_t* device) | ||
{ | ||
return CAN_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Copyright (C) 2009 - 2019 National Aeronautics and Space Administration. All Foreign Rights are Reserved to the U.S. Government. | ||
This software is provided "as is" without any warranty of any, kind either express, implied, or statutory, including, but not | ||
limited to, any warranty that the software will conform to, specifications any implied warranties of merchantability, fitness | ||
for a particular purpose, and freedom from infringement, and any warranty that the documentation will conform to the program, or | ||
any warranty that the software will be error free. | ||
In no event shall NASA be liable for any damages, including, but not limited to direct, indirect, special or consequential damages, | ||
arising out of, resulting from, or in any way connected with the software or its documentation. Whether or not based upon warranty, | ||
contract, tort or otherwise, and whether or not loss was sustained from, or arose out of the results of, or use of, the software, | ||
documentation or services provided hereunder | ||
ITC Team | ||
NASA IV&V | ||
[email protected] | ||
*/ | ||
|
||
#include "libgpio.h" | ||
|
||
int32_t gpio_init(gpio_info_t* device) | ||
{ | ||
return GPIO_SUCCESS; | ||
} | ||
|
||
int32_t gpio_read(gpio_info_t* device, uint8_t* value) | ||
{ | ||
return GPIO_SUCCESS; | ||
} | ||
|
||
int32_t gpio_write(gpio_info_t* device, uint8_t value) | ||
{ | ||
return GPIO_SUCCESS; | ||
} | ||
|
||
int32_t gpio_close(gpio_info_t* device) | ||
{ | ||
return GPIO_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* Copyright (C) 2009 - 2018 National Aeronautics and Space Administration. All Foreign Rights are Reserved to the U.S. Government. | ||
This software is provided "as is" without any warranty of any, kind either express, implied, or statutory, including, but not | ||
limited to, any warranty that the software will conform to, specifications any implied warranties of merchantability, fitness | ||
for a particular purpose, and freedom from infringement, and any warranty that the documentation will conform to the program, or | ||
any warranty that the software will be error free. | ||
In no event shall NASA be liable for any damages, including, but not limited to direct, indirect, special or consequential damages, | ||
arising out of, resulting from, or in any way connected with the software or its documentation. Whether or not based upon warranty, | ||
contract, tort or otherwise, and whether or not loss was sustained from, or arose out of the results of, or use of, the software, | ||
documentation or services provided hereunder | ||
ITC Team | ||
NASA IV&V | ||
[email protected] | ||
*/ | ||
|
||
#include <errno.h> | ||
#include <string.h> | ||
|
||
#include "libi2c.h" | ||
|
||
/* Call to configure a specific i2c device from /dev | ||
** i2c_bus- struct with bus configuration | ||
** speed - currently unused | ||
*/ | ||
int32_t i2c_master_init(i2c_bus_info_t* device) | ||
{ | ||
return I2C_SUCCESS; | ||
} | ||
|
||
int32_t i2c_master_transaction(i2c_bus_info_t* device, uint8_t addr, void * txbuf, uint8_t txlen, void * rxbuf, uint8_t rxlen, uint16_t timeout) | ||
{ | ||
return I2C_SUCCESS; | ||
} | ||
|
||
int32_t i2c_read_transaction(i2c_bus_info_t* device, uint8_t addr, void * rxbuf, uint8_t rxlen, uint8_t timeout) | ||
{ | ||
return I2C_SUCCESS; | ||
} | ||
|
||
int32_t i2c_write_transaction(i2c_bus_info_t* device, uint8_t addr, void * txbuf, uint8_t txlen, uint8_t timeout) | ||
{ | ||
return I2C_SUCCESS; | ||
} | ||
|
||
int32_t i2c_multiple_transaction(i2c_bus_info_t* device, uint8_t addr, struct i2c_rdwr_ioctl_data* rdwr_data, uint16_t timeout) | ||
{ | ||
return I2C_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include "libsocket.h" | ||
|
||
#include <sys/socket.h> | ||
#include <arpa/inet.h> | ||
#include <fcntl.h> | ||
#include <errno.h> | ||
|
||
// Creates an endpoint for communication | ||
// Binds stream, server sockets to localhost and port number | ||
// | ||
// Inputs: | ||
// socket_info->address_family | ||
// socket_info->type | ||
// socket_info->port_num (used for stream sockets) | ||
// socket_info->block | ||
// | ||
// Outputs: | ||
// socket_info->sockfd | ||
// socket_info->created | ||
// socket_info->bound | ||
int32_t socket_create(socket_info_t* socket_info) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} | ||
|
||
// Listens on a connection on a socket | ||
// | ||
// Inputs: | ||
// socket_info->bound | ||
// socket_info->sockfd | ||
// | ||
// Outputs: | ||
// socket_info->listening | ||
int32_t socket_listen(socket_info_t* socket_info) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} | ||
|
||
// Accepts a connection on a socket | ||
// | ||
// Inputs: | ||
// socket_info->listening | ||
// socket_info->sockfd | ||
// | ||
// Outputs: | ||
// socket_info->connected | ||
// socket_info->sockfd | ||
int32_t socket_accept(socket_info_t* socket_info) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} | ||
|
||
// Initiates a connection to a remote ip address and port number | ||
// | ||
// Inputs: | ||
// socket_info->created | ||
// socket_info->category | ||
// socket_info->address_family | ||
// socket_info->sockfd | ||
// remote_ip_address (the remote ip address) | ||
// remote_port_num (the remote port number) | ||
// | ||
// Outputs: | ||
// socket_info->connected | ||
int32_t socket_connect(socket_info_t* socket_info, char* remote_ip_address, int remote_port_num) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} | ||
|
||
int32_t socket_send(socket_info_t* socket_info, uint8_t* buffer, size_t buflen, size_t* bytes_sent, char* remote_ip_address, int remote_port_num) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} | ||
|
||
int32_t socket_recv(socket_info_t* socket_info, uint8_t* buffer, size_t buflen, size_t* bytes_recvd) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} | ||
|
||
int32_t socket_close(socket_info_t* socket_info) | ||
{ | ||
return SOCKET_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* Copyright (C) 2009 - 2018 National Aeronautics and Space Administration. All Foreign Rights are Reserved to the U.S. Government. | ||
This software is provided "as is" without any warranty of any, kind either express, implied, or statutory, including, but not | ||
limited to, any warranty that the software will conform to, specifications any implied warranties of merchantability, fitness | ||
for a particular purpose, and freedom from infringement, and any warranty that the documentation will conform to the program, or | ||
any warranty that the software will be error free. | ||
In no event shall NASA be liable for any damages, including, but not limited to direct, indirect, special or consequential damages, | ||
arising out of, resulting from, or in any way connected with the software or its documentation. Whether or not based upon warranty, | ||
contract, tort or otherwise, and whether or not loss was sustained from, or arose out of the results of, or use of, the software, | ||
documentation or services provided hereunder | ||
ITC Team | ||
NASA IV&V | ||
[email protected] | ||
*/ | ||
|
||
#include "libspi.h" | ||
|
||
spi_mutex_t spi_bus_mutex[MAX_SPI_BUSES]; | ||
|
||
int32_t spi_init_dev(spi_info_t* device) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_set_mode(spi_info_t* device) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_get_mode(spi_info_t* device) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_write(spi_info_t* device, uint8_t data[], const uint32_t numBytes) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_read(spi_info_t* device, uint8_t data[], const uint32_t numBytes) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_transaction(spi_info_t* device, uint8_t *txBuff, uint8_t * rxBuffer, uint32_t length, uint16_t delay, uint8_t bits, uint8_t deselect) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_select_chip(spi_info_t* device) | ||
{ | ||
return SPI_SUCCESS; | ||
} | ||
|
||
int32_t spi_close_device(spi_info_t* device) | ||
{ | ||
return SPI_SUCCESS; | ||
} |
Oops, something went wrong.