Forum Discussion
Altera_Forum
Honored Contributor
11 years ago1) If you aren't limited by onchip memory, I don't see a reason for you to take out code from the InterruptHandlerforUart files. Even if you never call out GetUart, it won't hurt to have it in your code - for the future...
I can't see why your code (.txt,.stack,.heap, etc) would take up a lot of memory. Normally I allocate at least 26000 bytes to onchip memory in qsys. That is more than enough for the complete Uart code. EmptyUart function is there to check if the data buffers are empty. You can use it if you want. You don't need it to transmit data. But again, even if you don't use it, don't remove it from the code if you have ample memory space. 2) "The way interrupts work is that when the main thread is interrupted, the state of that main thread is temporarily stored the variable - context_uart - until the interrupt service routine (Isr_Uart1) is completed. Then the main thread will resume where it left off." <-- this is from my last reply So in IsrUart, context and id are the what you pass context_uart into. Although it's not used directly in that function, i think its needed for the ic_isr_register function, so don't modify. 3) once again, if you aren't limited by on chip memory, don't delete this code. You might need it in the future. 4) rxhead/tail, txhead/tail are just position markers in the Rxbuffer and Txbuffer. Basically, when the head = tails then the buffer is empty. The code is using these location values to parse through the data buffers. This is needed because Uart data maybe coming in at one rate, but you are reading it in at a different rate (as you need it). 5) See answer 2 and middle section of previous reply. It is just a holder of the main thread's state, while the Uart Interrupt service routine is being processed. Here is a wiki on context switching / interrupt handling: http://en.wikipedia.org/wiki/context_switch#interrupt_handling So in summary, don't fiddle around with the interrupthandlerforuart code. It is more work then it's worth and you might damage the functionality.