Skip to content

Commit

Permalink
Remove some TODOs, remove spi_slave.c (old design)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter O'Hanley committed Sep 7, 2018
1 parent 212a804 commit b6f432d
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 181 deletions.
3 changes: 1 addition & 2 deletions spi_linux_monitor/linux_test_end.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ static void pabort(const char *s)
static const char *device = "/dev/spidev0.0";
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 8388608U; // TODO
static uint32_t speed = 8388608U;
static uint16_t delay;

#define SPI_TRANSFER_SIZE SPI_PACKET_LEN

//TODO make this less brittle
extern uint8_t spi_in_buf[SPI_TRANSFER_SIZE], spi_out_buf[SPI_TRANSFER_SIZE];
void transfer(int fd)
{
Expand Down
2 changes: 1 addition & 1 deletion spi_linux_test_endpoint/linux_test_end.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void pabort(const char *s)
static const char *device = "/dev/spidev0.0";
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 8388608U; // TODO
static uint32_t speed = 8388608U;
static uint16_t delay;

#define SPI_TRANSFER_SIZE SPI_PACKET_LEN
Expand Down
1 change: 0 additions & 1 deletion spi_proto_lib/spi_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ spi_proto_prep_msg(struct spi_state *s, void *buf, size_t n)
s->queue[s->first_unsent_seq].magic = SPI_PROTO_MAGIC_REAL;
pack = &s->queue[s->first_unsent_seq];

//TODO maybe bump seq?
s->queue[s->first_unsent_seq].crc = spi_msg_crc(&s->queue[s->first_unsent_seq]);
s->first_unsent_seq++;
s->first_unsent_seq %= 16;
Expand Down
3 changes: 2 additions & 1 deletion spi_proto_lib/spi_proto_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ print_spi_state_full(struct spi_state *s)
return;
print_spi_state(s);
if (s) {
//TODO print out spi queue
//print out spi queue
for (unsigned int j = 0; j < SPI_MSG_QUEUE_SIZE; j++) {
print_spi_packet(&s->queue[j]);
}
//TODO is there anything else that isn't printed?
}
}

Expand Down
9 changes: 3 additions & 6 deletions spi_remote_host.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//TODO temp for compilation
int unknown_chunk_type_msg_count;
extern int out_of_range_chunks;

#include <stdint.h>
#include <pthread.h>
#include "binary_semaphore.h"
Expand All @@ -16,10 +12,11 @@ extern int out_of_range_chunks;
#define CHUNK_LEN_GPIO CHUNK_LEN_GPIO_S2M

//TODO temp for compilation
int unknown_chunk_type_msg_count;
extern int out_of_range_chunks;
uint16_t bad_chunk_counter;


//TODO put semaphores on each endpoint to allow waiting on them, give on the semaphore for each value that is received. the give should be nonblocking
//TODO possible issue, when the thread takes on the semaphore it could end up getting the value of a previous read that some other thread triggered
//a sempahore with a queue where only one taker is released per give would solve this issue

Expand All @@ -42,7 +39,7 @@ host_remote_init(struct host_remote *r)
int
remote_chunk_handler(struct host_remote *r, uint8_t *buf, size_t len)
{
//TODO go through chunk types and bounce semaphores
//go through chunk types and bounce semaphores, maybe store a value
if (len < 2) return -1; // length zero isn't a real chunk, length 1 can't carry data
switch(buf[1]) {
case CHUNK_TYPE_GPIO:
Expand Down
3 changes: 1 addition & 2 deletions spi_remote_host.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//here for now, if we had multiple boards this would need to be separate
//TODO centralize in a config file
//TODO temp for compilation
//TODO centralize in a config file, temp for compilation
#define SOLENOID_NUM 8
#define FLOW_NUM 1
#define GPIO_NUM 17
Expand Down
167 changes: 0 additions & 167 deletions spi_slave.c

This file was deleted.

1 change: 0 additions & 1 deletion test/test_chunks.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ num_free_chunks(struct waiting_chunk *c, size_t n)
}

//FIXED somehow the first chunk written is getting its length put into the spi_state num_sent_but_unconfirmed.
//TODO The issue was in the amm spi_proto, so it's basically junk at this point. Ice it
void
prepare_chunks(struct spi_state *s, unsigned char *msg, size_t msg_len, struct waiting_chunk *wait_chunks, size_t wait_len,
int (*send_chunk)(uint8_t *buf, size_t len))
Expand Down

0 comments on commit b6f432d

Please sign in to comment.