diff --git a/quad/sw/comm_dev/Debug/comm_dev.elf b/quad/sw/comm_dev/Debug/comm_dev.elf index c89ec02fb8eca665daf9ce76ce9781fa6b69ab28..aaaed755a18e2062afa26e19d010e4bee5f05457 100755 Binary files a/quad/sw/comm_dev/Debug/comm_dev.elf and b/quad/sw/comm_dev/Debug/comm_dev.elf differ diff --git a/quad/sw/comm_dev/Debug/comm_dev.elf.size b/quad/sw/comm_dev/Debug/comm_dev.elf.size index 1cc576e697fc33d0beb2f08f71f67152bc29d7b2..b9055a946ae75b49369e83a3860ddbf3c0b62b9f 100644 --- a/quad/sw/comm_dev/Debug/comm_dev.elf.size +++ b/quad/sw/comm_dev/Debug/comm_dev.elf.size @@ -1,2 +1,2 @@ text data bss dec hex filename - 164976 68080 119152120 119385176 71dac58 comm_dev.elf + 165412 68080 119152504 119385996 71daf8c comm_dev.elf diff --git a/quad/sw/comm_dev/Debug/src/circ_buffer.o b/quad/sw/comm_dev/Debug/src/circ_buffer.o index 6992e3db9620a839c22d41b26406a6ada6fa7c4a..1ff124ee2498055d449bc5bf030c6a8b5fdb71eb 100644 Binary files a/quad/sw/comm_dev/Debug/src/circ_buffer.o and b/quad/sw/comm_dev/Debug/src/circ_buffer.o differ diff --git a/quad/sw/comm_dev/Debug/src/commands.d b/quad/sw/comm_dev/Debug/src/commands.d index f10d03163dbb9430c0f7f07433db3a7fd534fb6c..8a58884fbd95225831690c035838154f0869455e 100644 --- a/quad/sw/comm_dev/Debug/src/commands.d +++ b/quad/sw/comm_dev/Debug/src/commands.d @@ -15,7 +15,17 @@ src/commands.d: ../src/commands.c ../src/communication.h \ ../../system_bsp/ps7_cortexa9_0/include/xparameters.h \ ../src/stringBuilder.h ../../system_bsp/ps7_cortexa9_0/include/xscugic.h \ ../../system_bsp/ps7_cortexa9_0/include/xscugic_hw.h \ - ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h + ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h \ + ../src/new_comm.h \ + ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h \ + ../src/mio7_led.h ../../system_bsp/ps7_cortexa9_0/include/xgpiops.h \ + ../../system_bsp/ps7_cortexa9_0/include/xgpiops_hw.h \ + ../../system_bsp/ps7_cortexa9_0/include/sleep.h ../src/timer.h \ + ../src/log_data.h ../src/PID.h \ + ../../system_bsp/ps7_cortexa9_0/include/xtime_l.h \ + ../../system_bsp/ps7_cortexa9_0/include/xtmrctr.h \ + ../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h \ + ../src/packet_processing.h ../src/communication.h: @@ -58,3 +68,29 @@ src/commands.d: ../src/commands.c ../src/communication.h \ ../../system_bsp/ps7_cortexa9_0/include/xscugic_hw.h: ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h: + +../src/new_comm.h: + +../../system_bsp/ps7_cortexa9_0/include/xil_exception.h: + +../src/mio7_led.h: + +../../system_bsp/ps7_cortexa9_0/include/xgpiops.h: + +../../system_bsp/ps7_cortexa9_0/include/xgpiops_hw.h: + +../../system_bsp/ps7_cortexa9_0/include/sleep.h: + +../src/timer.h: + +../src/log_data.h: + +../src/PID.h: + +../../system_bsp/ps7_cortexa9_0/include/xtime_l.h: + +../../system_bsp/ps7_cortexa9_0/include/xtmrctr.h: + +../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h: + +../src/packet_processing.h: diff --git a/quad/sw/comm_dev/Debug/src/commands.o b/quad/sw/comm_dev/Debug/src/commands.o index 92e52e8fff23c5723f5527703e868c062f21c0f8..03ddc8e02dc171e75118595e4f0d5dda690acef3 100644 Binary files a/quad/sw/comm_dev/Debug/src/commands.o and b/quad/sw/comm_dev/Debug/src/commands.o differ diff --git a/quad/sw/comm_dev/Debug/src/initialize_components.d b/quad/sw/comm_dev/Debug/src/initialize_components.d index 4b01396863a0300a17b3fd2b5608c36c51419d97..03ae362ba4e55a875ade28b9b2fac4fce4619ef1 100644 --- a/quad/sw/comm_dev/Debug/src/initialize_components.d +++ b/quad/sw/comm_dev/Debug/src/initialize_components.d @@ -31,8 +31,9 @@ src/initialize_components.d: ../src/initialize_components.c \ ../../system_bsp/ps7_cortexa9_0/include/xiicps_hw.h \ ../src/packet_processing.h ../src/conversion.h ../src/platform.h \ ../src/platform_config.h ../src/communication.h ../src/commands.h \ - ../src/new_comm.h ../src/mio7_led.h \ - ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h + ../src/new_comm.h \ + ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h \ + ../src/mio7_led.h ../src/initialize_components.h: @@ -128,6 +129,6 @@ src/initialize_components.d: ../src/initialize_components.c \ ../src/new_comm.h: -../src/mio7_led.h: - ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h: + +../src/mio7_led.h: diff --git a/quad/sw/comm_dev/Debug/src/initialize_components.o b/quad/sw/comm_dev/Debug/src/initialize_components.o index 7d6919ccaf87d93a1ec121681a7e2caf8bab102b..1f1db58a17268c870461176aa01962830536259b 100644 Binary files a/quad/sw/comm_dev/Debug/src/initialize_components.o and b/quad/sw/comm_dev/Debug/src/initialize_components.o differ diff --git a/quad/sw/comm_dev/Debug/src/main.d b/quad/sw/comm_dev/Debug/src/main.d index f235cb78aca13fd0b9e16f08d8300496e95ae7bf..e8e6bc83e25eb3dcb9e536c298bcabed80145fc6 100644 --- a/quad/sw/comm_dev/Debug/src/main.d +++ b/quad/sw/comm_dev/Debug/src/main.d @@ -30,7 +30,9 @@ src/main.d: ../src/main.c ../src/timer.h ../src/log_data.h ../src/PID.h \ ../../system_bsp/ps7_cortexa9_0/include/xiicps_hw.h \ ../src/packet_processing.h ../src/conversion.h ../src/platform.h \ ../src/platform_config.h ../src/actuator_command_processing.h \ - ../src/send_actuator_commands.h ../src/update_gui.h + ../src/send_actuator_commands.h ../src/update_gui.h ../src/new_comm.h \ + ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h \ + ../src/mio7_led.h ../src/commands.h ../src/timer.h: @@ -125,3 +127,11 @@ src/main.d: ../src/main.c ../src/timer.h ../src/log_data.h ../src/PID.h \ ../src/send_actuator_commands.h: ../src/update_gui.h: + +../src/new_comm.h: + +../../system_bsp/ps7_cortexa9_0/include/xil_exception.h: + +../src/mio7_led.h: + +../src/commands.h: diff --git a/quad/sw/comm_dev/Debug/src/main.o b/quad/sw/comm_dev/Debug/src/main.o index 37ef66f399eb14bcbf5c019625bb5f75548b62cc..5008a65c8650cb6970d5730ef371e75cf7b31a11 100644 Binary files a/quad/sw/comm_dev/Debug/src/main.o and b/quad/sw/comm_dev/Debug/src/main.o differ diff --git a/quad/sw/comm_dev/Debug/src/new_comm.d b/quad/sw/comm_dev/Debug/src/new_comm.d index c17d385502e1da41d043991d223b60b5b295e85c..3cf41b96ccd13424bd49a67a1f0cc06b04dd3eb2 100644 --- a/quad/sw/comm_dev/Debug/src/new_comm.d +++ b/quad/sw/comm_dev/Debug/src/new_comm.d @@ -23,8 +23,7 @@ src/new_comm.d: ../src/new_comm.c ../src/new_comm.h \ ../src/log_data.h ../src/PID.h \ ../../system_bsp/ps7_cortexa9_0/include/xtime_l.h \ ../../system_bsp/ps7_cortexa9_0/include/xtmrctr.h \ - ../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h ../src/commands.h \ - ../src/circ_buffer.h + ../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h ../src/commands.h ../src/new_comm.h: @@ -89,5 +88,3 @@ src/new_comm.d: ../src/new_comm.c ../src/new_comm.h \ ../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h: ../src/commands.h: - -../src/circ_buffer.h: diff --git a/quad/sw/comm_dev/Debug/src/new_comm.o b/quad/sw/comm_dev/Debug/src/new_comm.o index 8acf99e4a5580543fbab13f4c496b5bff35db90f..eaa46c58ac60f9b7ffb931c0b2843bc58bcdfc7d 100644 Binary files a/quad/sw/comm_dev/Debug/src/new_comm.o and b/quad/sw/comm_dev/Debug/src/new_comm.o differ diff --git a/quad/sw/comm_dev/Debug/src/uart.d b/quad/sw/comm_dev/Debug/src/uart.d index 35601acf66cb37b90acb38e359f90c51224158d8..9d3b97b2f2e97de071beede2043c95c508c70cd2 100644 --- a/quad/sw/comm_dev/Debug/src/uart.d +++ b/quad/sw/comm_dev/Debug/src/uart.d @@ -16,6 +16,15 @@ src/uart.d: ../src/uart.c ../src/uart.h \ ../../system_bsp/ps7_cortexa9_0/include/xscugic.h \ ../../system_bsp/ps7_cortexa9_0/include/xscugic_hw.h \ ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h \ + ../src/new_comm.h \ + ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h \ + ../src/mio7_led.h ../../system_bsp/ps7_cortexa9_0/include/xgpiops.h \ + ../../system_bsp/ps7_cortexa9_0/include/xgpiops_hw.h \ + ../../system_bsp/ps7_cortexa9_0/include/sleep.h ../src/timer.h \ + ../src/log_data.h ../src/PID.h \ + ../../system_bsp/ps7_cortexa9_0/include/xtime_l.h \ + ../../system_bsp/ps7_cortexa9_0/include/xtmrctr.h \ + ../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h ../src/commands.h \ ../../system_bsp/ps7_cortexa9_0/include/xstatus.h ../src/uart.h: @@ -56,4 +65,30 @@ src/uart.d: ../src/uart.c ../src/uart.h \ ../../system_bsp/ps7_cortexa9_0/include/xil_exception.h: +../src/new_comm.h: + +../../system_bsp/ps7_cortexa9_0/include/xil_exception.h: + +../src/mio7_led.h: + +../../system_bsp/ps7_cortexa9_0/include/xgpiops.h: + +../../system_bsp/ps7_cortexa9_0/include/xgpiops_hw.h: + +../../system_bsp/ps7_cortexa9_0/include/sleep.h: + +../src/timer.h: + +../src/log_data.h: + +../src/PID.h: + +../../system_bsp/ps7_cortexa9_0/include/xtime_l.h: + +../../system_bsp/ps7_cortexa9_0/include/xtmrctr.h: + +../../system_bsp/ps7_cortexa9_0/include/xtmrctr_l.h: + +../src/commands.h: + ../../system_bsp/ps7_cortexa9_0/include/xstatus.h: diff --git a/quad/sw/comm_dev/Debug/src/uart.o b/quad/sw/comm_dev/Debug/src/uart.o index 20d3352604acf7e4e3b48e5b2a576322a7c75528..ff3ed33f1cc9faa83004cab28a066ae2c5302c2c 100644 Binary files a/quad/sw/comm_dev/Debug/src/uart.o and b/quad/sw/comm_dev/Debug/src/uart.o differ diff --git a/quad/sw/comm_dev/src/circ_buffer.c b/quad/sw/comm_dev/src/circ_buffer.c index a844220d7362f6daf480c5e6225e3ecc214d00dd..36d90a4cbddc998046ed9f8b9534616827a40ac3 100644 --- a/quad/sw/comm_dev/src/circ_buffer.c +++ b/quad/sw/comm_dev/src/circ_buffer.c @@ -10,10 +10,10 @@ _a < _b ? _a : _b; }) -unsigned char buffer[CIRC_BUFFER_SIZE]; -size_t buf_start = 0; -size_t buf_end = 0; -size_t size = 0; +static unsigned char buffer[CIRC_BUFFER_SIZE]; +static size_t buf_start = 0; +static size_t buf_end = 0; +static size_t size = 0; struct data_chunk getChunk(size_t amount) { diff --git a/quad/sw/comm_dev/src/commands.c b/quad/sw/comm_dev/src/commands.c index 06e9f5640b18d1a5d4007c51fd05c3996ee9eebc..c6ca889e751848251b98e31ce47a9bafc38ba74c 100644 --- a/quad/sw/comm_dev/src/commands.c +++ b/quad/sw/comm_dev/src/commands.c @@ -2,6 +2,7 @@ #include "commands.h" #include "type_def.h" #include "uart.h" +#include "packet_processing.h" struct MessageType MessageTypes[MAX_TYPE] = { @@ -473,7 +474,8 @@ int debug(unsigned char *packet, int dataLen, modular_structs_t *structs) control algorithm in order to get this to work. */ int update(unsigned char *packet, int dataLen, modular_structs_t *structs) { - printf("function for debug\n"); + //MIO7_led_on(); + processUpdate(packet, &(structs->raw_sensor_struct.currentQuadPosition)); return 0; } diff --git a/quad/sw/comm_dev/src/initialize_components.c b/quad/sw/comm_dev/src/initialize_components.c index 4064d7148c00632e2a29fb9b18be9d52d38f2fed..7bcae721bb209f45c0dcca9893abf51f6f628205 100644 --- a/quad/sw/comm_dev/src/initialize_components.c +++ b/quad/sw/comm_dev/src/initialize_components.c @@ -100,6 +100,8 @@ int initializeAllComponents(user_input_t * user_input_struct, log_t * log_struct if (initUartComms()) { return -1; } + // Initialize loop timers + timer_init(); return 0; // Initialize I2C controller and start the sensor board diff --git a/quad/sw/comm_dev/src/main.c b/quad/sw/comm_dev/src/main.c index 0c588ff1705970932f30d8f5b5d765d32d1eb72c..a648a6a836ac9ca8a96480541f8642b7d1bf7548 100644 --- a/quad/sw/comm_dev/src/main.c +++ b/quad/sw/comm_dev/src/main.c @@ -15,6 +15,7 @@ #include "actuator_command_processing.h" #include "send_actuator_commands.h" #include "update_gui.h" +#include "new_comm.h" int main() { @@ -34,7 +35,11 @@ int main() return -1; } - while(1) {} + while(1) { + timer_start_loop(); + process_received(&structs); + timer_end_loop(&(structs.log_struct)); + } // Loops to make sure the quad is responding correctly before starting the control loop protection_loops(); diff --git a/quad/sw/comm_dev/src/new_comm.c b/quad/sw/comm_dev/src/new_comm.c index b43a793abdf78e6b6881d5279b6072a05b7b26bc..17a9274a4f0c1549234267e1ba9c3bf171f38f9e 100644 --- a/quad/sw/comm_dev/src/new_comm.c +++ b/quad/sw/comm_dev/src/new_comm.c @@ -15,15 +15,20 @@ // Maximum number of bytes to be received within our loop time, plus 64 for a little buffer // (bit/s) * (seconds) / (10 bits / byte for UART) #define UART_BUF_SIZE (((BAUD_RATE * (DESIRED_USEC_PER_LOOP / 1000) / 1000) / 10) + 64) +#define MAX_PACKET_SIZE 256 // Declaration of interrupt handler void Handler(void *CallBackRef, u32 Event, unsigned int EventData); // Pointer to the UART driver instance -XUartPs* uartInstPtr; +static XUartPs* uartInstPtr; static u8 recvBuf[UART_BUF_SIZE]; -static size_t received_in_buf = 0; +static volatile size_t received_in_buf = 0; + +static u8 secondaryBuf[UART_BUF_SIZE + MAX_PACKET_SIZE]; +static volatile size_t secondaryEnd = 0; // Index of start of valid data in the secondary buffer +static size_t secondaryBegin = 0; // Index of one past end of valid data in the secondary buffer int initUartComms() { uartInstPtr = uart0_init(COMM_UART_DEVICE_ID, BAUD_RATE); @@ -34,7 +39,7 @@ int initUartComms() { uart0_clearFIFOs(); - if (uart0_int_init(COMM_UART_INT_IRQ_ID) != XST_SUCCESS) { + if (uart0_int_init(COMM_UART_INT_IRQ_ID, (Xil_ExceptionHandler) uartInterruptHandler) != XST_SUCCESS) { return -1; } @@ -45,7 +50,7 @@ int initUartComms() { * a pointer to the UART driver instance as the callback reference * so the handlers are able to access the instance data */ - XUartPs_SetHandler(uartInstPtr, (XUartPs_Handler)Handler, uartInstPtr); + //XUartPs_SetHandler(uartInstPtr, (XUartPs_Handler)Handler, uartInstPtr); u32 IntrMask = XUARTPS_IXR_RXFULL | XUARTPS_IXR_RXOVR | XUARTPS_IXR_TOUT; @@ -68,7 +73,7 @@ int initUartComms() { // Second argument is the number of bytes to trigger an interrupt at XUartPs_SetFifoThreshold(uartInstPtr, 12); - XUartPs_Recv(uartInstPtr, recvBuf, UART_BUF_SIZE); + //XUartPs_Recv(uartInstPtr, recvBuf, UART_BUF_SIZE); return 0; } @@ -105,47 +110,108 @@ int process_packet(unsigned char* packet, modular_structs_t *structs) { void parse_available(modular_structs_t *structs) { // Discard all data before packet begin character - struct data_chunk all_data = getChunk(circ_buf_size()); - size_t discard_data = 0; - while (all_data.length - discard_data > 0 && all_data.data[discard_data] != BEGIN_CHAR) { - discard_data++; + while (secondaryBegin < secondaryEnd && secondaryBuf[secondaryBegin] != BEGIN_CHAR) { + secondaryBegin++; } - markConsumed(discard_data); // Minimum size of a packet (header + checksum) int min_packet_size = sizeof(metadata_t) + 1; // TODO: Loop limit? - while (circ_buf_available() >= min_packet_size) { - struct data_chunk header = getChunk(sizeof(metadata_t)); - unsigned char* packet_header = header.data; + while (secondaryEnd - secondaryBegin >= min_packet_size) { + unsigned char* packet_header = secondaryBuf + secondaryBegin; size_t packet_len = (packet_header[6] << 8) | (packet_header[5]); - if (circ_buf_available() >= min_packet_size + packet_len) { - struct data_chunk packet = getChunk(min_packet_size + packet_len); - process_packet(packet.data, structs); - markConsumed(packet.length); + if (secondaryEnd - secondaryBegin >= min_packet_size + packet_len) { + process_packet(secondaryBuf + secondaryBegin, structs); + secondaryBegin += min_packet_size + packet_len; } else { // Not enough data for a packet break; } - } } +u32 disable_interrupts() { + u32 ImrRegister; + ImrRegister = XUartPs_ReadReg(uartInstPtr->Config.BaseAddress, XUARTPS_IMR_OFFSET); + XUartPs_WriteReg(uartInstPtr->Config.BaseAddress, XUARTPS_IDR_OFFSET, XUARTPS_IXR_MASK); + return ImrRegister; +} + +void restore_interrupts(u32 intr_state) { + XUartPs_WriteReg(uartInstPtr->Config.BaseAddress, XUARTPS_IER_OFFSET, intr_state); +} void process_received(modular_structs_t *structs) { - // Temporarily disable the receive interrupt - XUartPs_Recv(uartInstPtr, NULL, 0); - // Put received data into circular buffer - struct data_chunk to_place = {received_in_buf, recvBuf}; - size_t actually_placed = putChunk(to_place); - if (actually_placed != to_place.length) { - printf("Error: Couldn't place all data into circular buffer"); +// // Move unprocessed bytes to front of secondary buffer +// size_t unprocessed_size = secondaryEnd - secondaryBegin; +// memmove(secondaryBuf, secondaryBuf + secondaryBegin, unprocessed_size); +// secondaryBegin = 0; +// secondaryEnd = unprocessed_size; +// +// // Temporarily disable the receive interrupt +// XUartPs_Recv(uartInstPtr, recvBuf, 0); +// if (received_in_buf) { +// volatile int a = 3; +// } +// // Put received data into secondary buffer +// memcpy(secondaryBuf + secondaryEnd, recvBuf, received_in_buf); +// +// secondaryEnd += received_in_buf; +// received_in_buf = 0; +// // Re-enable interrupts and process copied data +// XUartPs_Recv(uartInstPtr, recvBuf, UART_BUF_SIZE); + if (secondaryEnd != 0) { + volatile int asdasdf = 3; + MIO7_led_off(); } - received_in_buf = 0; - // Re-enable interrupts and process copied data - XUartPs_Recv(uartInstPtr, recvBuf, UART_BUF_SIZE); + parse_available(structs); + + u32 intr_state = disable_interrupts(); + + // Move unprocessed bytes to front of secondary buffer + size_t unprocessed_size = secondaryEnd - secondaryBegin; + memmove(secondaryBuf, secondaryBuf + secondaryBegin, unprocessed_size); + secondaryBegin = 0; + secondaryEnd = unprocessed_size; + + restore_interrupts(intr_state); + //unsigned char in_fifo = XUartPs_ReadReg(uartInstPtr->Config.BaseAddress, XUARTPS_FIFO_OFFSET); + return; +} + +void uartInterruptHandler(XUartPs *InstancePtr) { + u32 IsrStatus; + + /* + * Read the interrupt ID register to determine which + * interrupt is active + */ + IsrStatus = XUartPs_ReadReg(InstancePtr->Config.BaseAddress, + XUARTPS_IMR_OFFSET); + + IsrStatus &= XUartPs_ReadReg(InstancePtr->Config.BaseAddress, + XUARTPS_ISR_OFFSET); + + u32 CsrRegister; + /* + * Read the Channel Status Register to determine if there is any data in + * the RX FIFO + */ + CsrRegister = XUartPs_ReadReg(InstancePtr->Config.BaseAddress, + XUARTPS_SR_OFFSET); + + while (0 == (CsrRegister & XUARTPS_SR_RXEMPTY)) { + secondaryBuf[secondaryEnd] = XUartPs_ReadReg(InstancePtr->Config.BaseAddress, XUARTPS_FIFO_OFFSET); + secondaryEnd += 1; + CsrRegister = XUartPs_ReadReg(InstancePtr->Config.BaseAddress, XUARTPS_SR_OFFSET); + MIO7_led_on(); + } + + // Clear the interrupt status. + XUartPs_WriteReg(InstancePtr->Config.BaseAddress, XUARTPS_ISR_OFFSET, + IsrStatus); } /**************************************************************************/ @@ -172,11 +238,9 @@ void process_received(modular_structs_t *structs) { void Handler(void *CallBackRef, u32 Event, unsigned int EventData) { /* data has been received */ - if (Event == XUARTPS_EVENT_RECV_DATA || Event == XUARTPS_EVENT_RECV_TOUT || Event == XUARTPS_IXR_RXOVR) { + if (Event == XUARTPS_EVENT_RECV_DATA || Event == XUARTPS_EVENT_RECV_TOUT + || Event == XUARTPS_IXR_RXOVR || Event == XUARTPS_IXR_RXFULL) { received_in_buf = EventData; - if (EventData >= UART_BUF_SIZE) { - MIO7_led_on(); - } } } diff --git a/quad/sw/comm_dev/src/new_comm.h b/quad/sw/comm_dev/src/new_comm.h index fa6ff4c45f43ef01f7daa420904522c264d19470..7044d6cb685bcab2e4269fc96f6b690a29be9a2d 100644 --- a/quad/sw/comm_dev/src/new_comm.h +++ b/quad/sw/comm_dev/src/new_comm.h @@ -18,8 +18,9 @@ #include "mio7_led.h" #include "timer.h" #include "commands.h" -#include "circ_buffer.h" int initUartComms(); +void process_received(modular_structs_t *structs); +void uartInterruptHandler(XUartPs *InstancePtr); #endif /* NEW_COMM_H_ */ diff --git a/quad/sw/comm_dev/src/uart.c b/quad/sw/comm_dev/src/uart.c index 7d42b9833ee3e810946582f2573a8e5163fac8bc..d4bf4ed444526605f1325eb66cb0ed032881da9d 100644 --- a/quad/sw/comm_dev/src/uart.c +++ b/quad/sw/comm_dev/src/uart.c @@ -214,7 +214,7 @@ char uart_recvByte(XUartPs* uartps_ptr) { * @note None. * ****************************************************************************/ -int SetupInterruptSystem(XUartPs *UartInstancePtr, u16 UartIntrId) +int SetupInterruptSystem(XUartPs *UartInstancePtr, u16 UartIntrId, Xil_ExceptionHandler handler) { int Status; @@ -246,7 +246,7 @@ int SetupInterruptSystem(XUartPs *UartInstancePtr, u16 UartIntrId) * performs the specific interrupt processing for the device */ Status = XScuGic_Connect(&Intc, UartIntrId, - (Xil_ExceptionHandler) XUartPs_InterruptHandler, + handler, (void *) UartInstancePtr); if (Status != XST_SUCCESS) { return XST_FAILURE; @@ -279,8 +279,8 @@ XUartPs* uart0_init(u16 deviceID, int baudRate){ } // Initializes the interrupt system for UART 0 -int uart0_int_init(u16 UartIntrId) { - return SetupInterruptSystem(_Uart0PS, UartIntrId); +int uart0_int_init(u16 UartIntrId, Xil_ExceptionHandler handler) { + return SetupInterruptSystem(_Uart0PS, UartIntrId, handler); } void uart0_clearFIFOs(){ diff --git a/quad/sw/comm_dev/src/uart.h b/quad/sw/comm_dev/src/uart.h index db3a66b445de06680ee09ad0774ea90c7674cbd1..838fb7635bf141e439bba80296217268c4788a5e 100644 --- a/quad/sw/comm_dev/src/uart.h +++ b/quad/sw/comm_dev/src/uart.h @@ -12,6 +12,7 @@ #include "xuartps.h" #include "stringBuilder.h" #include "xscugic.h" +#include "new_comm.h" #define PACKET_START_CHAR 2 #define PACKET_END_CHAR 3 @@ -51,7 +52,7 @@ char uart_recvByte(XUartPs* uartps_ptr); /************************************************/ /********** UART 0 convenience methods **********/ XUartPs* uart0_init(u16 deviceID, int baudRate); -int uart0_int_init(u16 deviceID); +int uart0_int_init(u16 UartIntrId, Xil_ExceptionHandler handler); void uart0_clearFIFOs(); void uart0_sendByte(u8 data); void uart0_sendStr(char* data); diff --git a/website/content/pages/documents.md b/website/content/pages/documents.md index fa60084a8a06c91bc7329ec80972bd4e85749973..0d4864f0eadef51c3e7567473d8d9badc32bfb4b 100644 --- a/website/content/pages/documents.md +++ b/website/content/pages/documents.md @@ -11,26 +11,7 @@ sortorder: 005 [Design Document 1](/files/DesignDocument1.docx.pdf) ## Weekly Reports - -[Weekly Report 1](/files/weeklyReports/may1716_microCART_report1.pdf) - -[Weekly Report 2](/files/weeklyReports/may1716_microCART_report2.pdf) - -[Weekly Report 3](/files/weeklyReports/may1716_microCART_report3.pdf) - -[Weekly Report 4](/files/weeklyReports/may1716_microCART_report4.pdf) - -[Weekly Report 5](/files/weeklyReports/may1716_microCART_report5.pdf) - -[Weekly Report 6](/files/weeklyReports/may1716_microCART_report6.pdf) - -[Weekly Report 7](/files/weeklyReports/may1716_microCART_report7.pdf) - -[Weekly Report 8](/files/weeklyReports/may1716_microCART_report8.pdf) - -[Weekly Report 9](/files/weeklyReports/may1716_microCART_report9.pdf) - -[Weekly Report 10](/files/weeklyReports/may1716_microCART_report10.pdf) +<iframe src="https://drive.google.com/embeddedfolderview?id=0BywzM7Q_7PUSeF8tdWpmMVN0eG8#list" width="100%" height="500" frameborder="0"></iframe> ## Documentation <iframe src="https://drive.google.com/embeddedfolderview?id=0B7xOyPfCRH4DTlZyaHZCRjN1Wmc#list" width="100%" height="500" frameborder="0"></iframe>