embedded RTOS class project.
Fork of RTOS_project by
Revision 1:a3df81701818, committed 2013-09-17
- Comitter:
- gatedClock
- Date:
- Tue Sep 17 20:40:09 2013 +0000
- Parent:
- 0:8e898e1270d6
- Child:
- 2:4336e18b60fe
- Commit message:
- update.
Changed in this revision
--- a/main.cpp Tue Sep 17 19:42:49 2013 +0000
+++ b/main.cpp Tue Sep 17 20:40:09 2013 +0000
@@ -2,7 +2,7 @@
student : m-moore
email : gated.clock@gmail.com
class : embedded RTOS
- directory : USB_device_project
+ directory : RTOS_project
file : main.cpp
date : september 19, 2013.
----copyright-----------------------------------//------------------------------
@@ -39,10 +39,10 @@
features:
1. multi-threaded design, use of memory-pools to transfer data between threads.
2. use of USBDevice library for communication with PC host.
- 3. use of mmSPI custom library for communication with FPGA.
+ 3. use of mmSPI_RTOS custom library for communication with FPGA.
4. main thread provides USBSerial communication to/from host.
5. SPI processing thread provides SPI communication to/from DUT.
- 6. mmSPI library generates non-overlapping SPI and CPU clocks.
+ 6. mmSPI_RTOS library generates non-overlapping SPI and CPU clocks.
7. background diagnostic thread provides LCD & error updates.
8. meta watchdog thread monitors itself & the other threads.
@@ -57,10 +57,10 @@
1. main.processIncomingSerial(): accept incoming serial data from host,
and map it into tFromHost structures.
2. SPIprocessingThread: take the incoming data structures instances, and
- feed their content into mmSPI commands.
- 3. mmSPI object: given commands/data passed from caller,
+ feed their content into mmSPI_RTOS commands.
+ 3. mmSPI_RTOS object: given commands/data passed from caller,
map them into SPI outgoing vectors and scan them into the FPGA.
- 4. mmSPI object: receive incoming SPI vectors from FPGA.
+ 4. mmSPI_RTOS object: receive incoming SPI vectors from FPGA.
make FPGA payload data available to caller.
5. SPIprocessingThread: load tToHost structures with said FPGA payload data.
6. main.processOutgoingSerial(): transfer tToHost structure data into a
@@ -135,7 +135,7 @@
#include "USBSerial.h" // serial over USB.
#include "C12832_lcd.h" // LCD display.
#include "rtos.h" // RTOS.
- #include "mmSPI.h" // SPI.
+ #include "mmSPI_RTOS.h" // SPI.
#include "watchdog.h" // watchdog.
//---defines------------------------------------//------------------------------
#define LCD1 lcd.locate(0, 0); // LCD line 1.
@@ -574,21 +574,21 @@
/*----------------------------------------------//----------------------------*/
// the pcSendBuffer and pcReceiveBuffer arrays are not used by this function,
// but they are declared by this function, and their pointers are passed
-// down to the mmSPI library for its use of them.
+// down to the mmSPI_RTOS library for its use of them.
// note- the prefix 'pc' means 'pointer of type character', not 'personal computer'.
void SPIprocessingThread(void const *args) // process host-commands via SPI.
{
- char pcSendBuffer [SPI_BYTES]; // SPI send buffer.
- char pcReceiveBuffer[SPI_BYTES]; // SPI receive buffer.
- char pcRegisters [SPI_BYTES]; // fetch-all-registers vector.
- int dHeartbeat; // heartbeat counter.
- int dMemoryRead; // read main-memory into this.
- int dLoop; // loop index.
- osEvent qFromHostEvent; // incoming message event.
- tFromHost * pFromHost; // message structure.
- tToHost * gpToHost; // message structure.
- mmSPI * pSPI; // SPI.
+ char pcSendBuffer [SPI_BYTES]; // SPI send buffer.
+ char pcReceiveBuffer[SPI_BYTES]; // SPI receive buffer.
+ char pcRegisters [SPI_BYTES]; // fetch-all-registers vector.
+ int dHeartbeat; // heartbeat counter.
+ int dMemoryRead; // read main-memory into this.
+ int dLoop; // loop index.
+ osEvent qFromHostEvent; // incoming message event.
+ tFromHost * pFromHost; // message structure.
+ tToHost * gpToHost; // message structure.
+ mmSPI_RTOS * pSPI; // SPI.
pFromHost = NULL; // NULL pointers.
gpToHost = NULL;
@@ -600,7 +600,7 @@
for (dLoop = 0; dLoop < SPI_BYTES; dLoop++) pcSendBuffer [dLoop] = 0;
for (dLoop = 0; dLoop < SPI_BYTES; dLoop++) pcReceiveBuffer[dLoop] = 0;
- pSPI = new mmSPI; // SPI allocation.
+ pSPI = new mmSPI_RTOS; // SPI allocation.
if (!pSPI) // failure detection.
{
if (ERROR_BOOT) mbed_reset(); else
@@ -811,7 +811,6 @@
void watchdogThread(void const *args) // overall watchdog.
{
int dHeartbeat; // heartbeat counter.
- osEvent queueEvent; // queue event
Watchdog watchdog; // the one and only watchdog.
dHeartbeat = 0; // initialize.
@@ -822,9 +821,9 @@
{
// all other threads report-in.
// blocking wait on all of them.
- queueEvent = queueWatchdogThread_0.get(osWaitForever);
- queueEvent = queueWatchdogThread_1.get(osWaitForever);
- queueEvent = queueWatchdogThread_2.get(osWaitForever);
+ queueWatchdogThread_0.get(osWaitForever);
+ queueWatchdogThread_1.get(osWaitForever);
+ queueWatchdogThread_2.get(osWaitForever);
watchdog.kick(); // reset watchdog timer.
--- a/mmSPI.lib Tue Sep 17 19:42:49 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -mmSPI#adca2b413bf1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmSPI_RTOS.lib Tue Sep 17 20:40:09 2013 +0000 @@ -0,0 +1,1 @@ +mmSPI_RTOS#7b8e6b90c874
