- All subroutine calls are assumed to be of type void fn (void), so don't worry about parameters.
- If parameters are to be passed they will be specified along with their passing method.
- Macros are in CAPITALS
- Structures are just memory blocks. You have to interpret their internal contents when coding (using base + offset)
- All binary numbers are assumed to be in format (MSB) 0000 0000 (LSB). LSB is treated as bit0 and MSB bit7
- For compatibility purposes most subroutine use following registers to receive and pass certain key parameters:
- tmp_reg Stack pointer (of task) in EXTRAM
- r0:r1 Temporary pointer (usually to a TCB)
- r2 return code (usually error status)
- r3 Priority value
- It is highly recommended that you use these same regs for all functions. If the reg is not available, push it into stack and pop it back later on!
- Accumulator has been purposely left free for arithmetic
- Subroutine may change additional regs without backing them up, so make sure they donít contain important data before you call a subroutine.
- Usually A, r1, PSW are frequently changed
- Subroutines that begin with os_ prefix are internal kernel functions and not invoked by user task code at all. Also we need to backup/restore regs only in a non os_ prefixed function. os_ prefixed subroutines are tightly coupled with each other and will handle registers automatically between mutual calls.
Back to DocumentationIndex