Skip to content

Commit

Permalink
force the status read from speech chip to not inline
Browse files Browse the repository at this point in the history
When it inlined, it optimized it out...
  • Loading branch information
jedimatt42 committed Apr 1, 2021
1 parent 11d1f5f commit 3e1ed3e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions example/gcc/say/speech.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ void copy_safe_read() {
}
}

unsigned char __attribute__((noinline)) call_safe_read() {
READ_WITH_DELAY();
return SPEECH_BYTE_BOX;
}

void load_speech_addr(int phrase_addr) {
SPCHWT = SPCH_CMD_ADDR | (char)(phrase_addr & 0x000F);
SPCHWT = SPCH_CMD_ADDR | (char)((phrase_addr >> 4) & 0x000F);
Expand Down Expand Up @@ -76,9 +81,9 @@ void say_data(const char* addr, int len) {
}
// Next check for buffer low, and add upto 8 bytes at a time
while(len > 0) {
SPEECH_BYTE_BOX = 0;
while (SPEECH_BYTE_BOX & SPCH_STATUS_LOW == 0) {
READ_WITH_DELAY();
int statusLow = 0;
while (!statusLow) {
statusLow = ((int)call_safe_read()) & SPCH_STATUS_LOW;
}
// there is room for at least 8 bytes in the FIFO, so send upto 8
i = 8;
Expand Down

0 comments on commit 3e1ed3e

Please sign in to comment.