summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-06-14 22:43:44 +0000
committerChristian Pointner <equinox@mur.at>2012-06-14 22:43:44 +0000
commit79468677c94139526e15fd2cca89a45426184d2e (patch)
tree6388c3fa510561ae19a18e0fd40f29fafca5174f /tools
parentimproved output for invalid byte (diff)
added cmd_read flag, remove cbl
git-svn-id: https://svn.spreadspace.org/mur.sat@530 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools')
-rw-r--r--tools/idm-ringbuffer/ringbuffer.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/idm-ringbuffer/ringbuffer.c b/tools/idm-ringbuffer/ringbuffer.c
index 0ab35f2..2fc028e 100644
--- a/tools/idm-ringbuffer/ringbuffer.c
+++ b/tools/idm-ringbuffer/ringbuffer.c
@@ -55,7 +55,7 @@ char* writePtr = 0;
char* readPtr = 0;
BOOL overrun = FALSE;
BOOL underrun = TRUE;
-BOOL currentByteLoaded = FALSE;
+BOOL cmd_read = FALSE;
char spiData = 0;
void incrementWriteIdx()
@@ -86,12 +86,10 @@ void beginRead()
{
spiData = underrun ? -1 : *readPtr;
printf("SPI Buf: %02x\n", (int)spiData);
- currentByteLoaded = TRUE;
}
void endRead()
{
- currentByteLoaded = FALSE;
incrementReadIdx();
}
@@ -106,12 +104,14 @@ void storeSample()
void triggerByteTransferred()
{
- if (spiData == 0) {
+ if (cmd_read && spiData == 0) {
endRead();
beginRead();
} else if (spiData == 'r') {
+ cmd_read = TRUE;
beginRead();
} else {
+ cmd_read = FALSE;
printf("%s\n", "I don't like you!");
}
}
@@ -120,11 +120,10 @@ void triggerByteTransferred()
/* ##### test environment ##### */
void debugPrint(char cmd) {
- printf("cmd('%c'): wPtr=%d, rPtr=%d, cbl=%d, ovr=%d, udr=%d\n",
+ printf("cmd('%c'): wPtr=%d, rPtr=%d, ovr=%d, udr=%d\n",
cmd,
(int) (writePtr - bufferStart),
(int) (readPtr - bufferStart),
- (int) currentByteLoaded,
(int) overrun,
(int) underrun);
int i;