Bit indexing, Idle thread activity, Reorder barrier – Comtrol eCos User Manual

Page 284: Breakpoint support, Gdb support

Advertising
background image

Chapter 9. HAL Interfaces

Note that interrupts are not disabled during this process, any interrupts that occur will be delivered onto the stack
to which the current CPU stack pointer points. Hence the stack pointer should never be invalid, or loaded with a
value that might cause the saved state to become corrupted by an interrupt. However, the current interrupt state
is saved and restored as part of the thread context. If a thread disables interrupts and does something to cause a
context switch, interrupts may be re-enabled on switching to another thread. Interrupts will be disabled again when
the original thread regains control.

Bit indexing

HAL_LSBIT_INDEX( index, mask )

HAL_MSBIT_INDEX( index, mask )

These macros place in

index

the bit index of the least significant bit in

mask

. Some architectures have instruction

level support for one or other of these operations. If no architectural support is available, then these macros may
call C functions to do the job.

Idle thread activity

HAL_IDLE_THREAD_ACTION( count )

It may be necessary under some circumstances for the HAL to execute code in the kernel idle thread’s loop. An
example might be to execute a processor halt instruction. This macro provides a portable way of doing this. The
argument is a copy of the idle thread’s loop counter, and may be used to trigger actions at longer intervals than
every loop.

Reorder barrier

HAL_REORDER_BARRIER()

When optimizing the compiler can reorder code. In some parts of multi-threaded systems, where the order of
actions is vital, this can sometimes cause problems. This macro may be inserted into places where reordering
should not happen and prevents code being migrated across it by the compiler optimizer. It should be placed
between statements that must be executed in the order written in the code.

Breakpoint support

HAL_BREAKPOINT( label )

HAL_BREAKINST

HAL_BREAKINST_SIZE

These macros provide support for breakpoints.

HAL_BREAKPOINT()

executes a breakpoint instruction. The label is defined at the breakpoint instruction so that

exception code can detect which breakpoint was executed.

180

Advertising