Skip to content

Commit

Permalink
Merge pull request #6 from nasa-itc/nos3#88-cfs-upgrade
Browse files Browse the repository at this point in the history
nos3#88 - cFS Upgrade
  • Loading branch information
jlucas9 authored Aug 1, 2023
2 parents dd57a2a + 4a8d2f8 commit eb38ad4
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 17 deletions.
2 changes: 2 additions & 0 deletions fsw/public_inc/libgpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ typedef struct
} gpio_info_t;

/* Prototypes */
void gpio_dummy(void);

/*
* Initialize GPIO pin
* @param device - GPIO device information
Expand Down
2 changes: 2 additions & 0 deletions fsw/public_inc/libmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ extern "C" {
#define MEM_SUCCESS OS_SUCCESS
#define MEM_ERROR OS_ERROR

void mem_dummy(void);

int32_t devmem_write(uint32_t addr, uint8_t *in, int32_t length);
int32_t devmem_read(uint32_t addr, uint8_t *out, int32_t length);

Expand Down
1 change: 1 addition & 0 deletions fsw/public_inc/libsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef struct {
} socket_info_t;

/* Function Prototypes */
void socket_dummy(void);
int32_t socket_create(socket_info_t* socket_info);
int32_t socket_listen(socket_info_t* socket_info);
int32_t socket_accept(socket_info_t* socket_info);
Expand Down
2 changes: 2 additions & 0 deletions fsw/public_inc/libtrq.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ typedef struct {
bool enabled;
} trq_info_t;

void trq_dummy(void);

int32_t trq_set_time_high(trq_info_t* device, uint32_t new_time);
int32_t trq_set_period(trq_info_t* device);
int32_t trq_set_direction(trq_info_t* device, bool direction);
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/gpio_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "libgpio.h"

// ok... dummy usage... just so when the linker creates hwlib.so it does not throw out the libgpio.c.o object from libnoslink.a as not used
void dummy2()
void gpio_dummy()
{
gpio_info_t device;
int32_t status = gpio_init(&device);
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/mem_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "libmem.h"

// ok... dummy usage... just so when the linker creates hwlib.so it does not throw out the libmem.c.o object from libnoslink.a as not used
void dummy4()
void mem_dummy()
{
uint8_t tmp;
int32_t status = devmem_read(0,&tmp, 1);
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/socket_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "libsocket.h"

// ok... dummy usage... just so when the linker creates hwlib.so it does not throw out the libsocket.c.o object from libnoslink.a as not used
void dummy3()
void socket_dummy()
{
socket_info_t device;
int32_t status = socket_create(&device);
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/torquer_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "libtrq.h"

// ok... dummy usage... just so when the linker creates hwlib.so it does not throw out the libtrq.c.o object from libnoslink.a as not used
void dummy()
void trq_dummy()
{
trq_info_t device;
int32_t status = trq_init(&device);
Expand Down
2 changes: 1 addition & 1 deletion sim/src/libcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int32_t can_init_dev(can_info_t* device)
if (*dev == NULL)
{
result = OS_ERROR;
OS_printf("LIBCAN: %s: FAILED TO INITIALIZE NOS CAN MASTER\n", __FUNCTION__);
OS_printf("LIBCAN: %s: FAILED TO INITIALIZE NOS CAN MASTER\n", __func__);
device->isUp = CAN_INTERFACE_DOWN;
}
return result;
Expand Down
6 changes: 3 additions & 3 deletions sim/src/libgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int32_t gpio_init(gpio_info_t* device)
//fd = open(buffer, O_WRONLY | O_CREAT);
// Set open
device->isOpen = GPIO_OPEN;
gpio_write(device, 0b0);
gpio_write(device, 0x00);
return GPIO_SUCCESS;
}

Expand All @@ -81,9 +81,9 @@ int32_t gpio_read(gpio_info_t* device, uint8_t* value)
}
close(fd);
if (*value == '1') {
*value = 0b1;
*value = 0x01;
} else {
*value = 0b0;
*value = 0x00;
}
return GPIO_SUCCESS;
}
Expand Down
1 change: 1 addition & 0 deletions sim/src/libmem.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <sys/mman.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
Expand Down
4 changes: 2 additions & 2 deletions sim/src/libspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void nos_init_spi_link(void)
{
// Init the mutexes for chip select
int i;
for(i = 0; i < NUM_SPI_DEVICES; i++)
for(i = 0; i < MAX_SPI_BUSES; i++)
{
if (pthread_mutex_init(&spi_bus_mutex[i], NULL) != 0)
{
Expand All @@ -59,7 +59,7 @@ void nos_destroy_spi_link(void)
{
/* clean up spi buses */
int i;
for(i = 0; i < NUM_SPI_DEVICES; i++)
for(i = 0; i < MAX_SPI_BUSES; i++)
{
NE_SpiHandle *dev = spi_device[i];
if(dev) NE_spi_close(&dev);
Expand Down
9 changes: 3 additions & 6 deletions sim/src/libtrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ [email protected]
#include <arpa/inet.h>
#include <netinet/in.h>

/* psp */
#include <cfe_psp.h>

/* nos */
#include <Spi/Client/CInterface.h>

Expand All @@ -45,7 +42,7 @@ int32_t trq_update(trq_info_t* device)
float percent_high_dir = 100.0 * device->timer_high_ns / device->timer_period_ns;

// Take into account the direction
if (device->positive_direction == FALSE)
if (device->positive_direction == false)
{
percent_high_dir = percent_high_dir * -1;
}
Expand All @@ -60,15 +57,15 @@ int32_t trq_update(trq_info_t* device)
{
if (num_send_errors++ < 10)
{ // don't spam
OS_printf("NOS command_torquer: Only sent %d bytes of %d bytes. Message was: %s\n", bytes_sent, strlen(message), message);
printf("NOS command_torquer: Only sent %d bytes of %d bytes. Message was: %s\n", bytes_sent, strlen(message), message);
}
status = TRQ_ERROR;
}
} else
{
if (num_conn_errors++ < 10)
{ // don't spam
OS_printf("NOS command_torquer: Socket not connected (%d).\n", sockfd);
printf("NOS command_torquer: Socket not connected (%d).\n", sockfd);
}
status = TRQ_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion sim/src/libuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int32_t uart_read_port(uart_info_t* device, uint8_t data[], const uint32_t numBy

if (data != NULL) //Check that there is actually data to read
{
char c = 0xFF;
uint8_t c = 0xFF;
int i;
int stat;
NE_Uart *dev = nos_get_usart_device((int)device->handle);
Expand Down

0 comments on commit eb38ad4

Please sign in to comment.