Testandset support, Test-and-set support, Spinlocks – Comtrol eCos User Manual
Page 298

Chapter 9. HAL Interfaces
HAL_SMP_CPU_MAX
The maximum number of CPUs that can be supported. This is used to provide the size of any arrays that have
an element per CPU.
HAL_SMP_CPU_COUNT()
Returns the number of CPUs currently operational. This may differ from HAL_SMP_CPU_MAX depending
on the runtime environment.
HAL_SMP_CPU_THIS()
Returns the CPU id of the current CPU.
HAL_SMP_CPU_NONE
A value that does not match any real CPU id. This is uses where a CPU type variable must be set to a null
value.
HAL_SMP_CPU_START( cpu )
Starts the given CPU executing at a defined HAL entry point. After performing any HAL level initialization,
the CPU calls up into the kernel at
cyg_kernel_cpu_startup()
.
HAL_SMP_CPU_RESCHEDULE_INTERRUPT( cpu, wait )
Sends the CPU a reschedule interrupt, and if
wait
is non-zero, waits for an acknowledgment. The interrupted
CPU should call
cyg_scheduler_set_need_reschedule()
in its DSR to cause the reschedule to occur.
HAL_SMP_CPU_TIMESLICE_INTERRUPT( cpu, wait )
Sends the CPU a timeslice interrupt, and if
wait
is non-zero, waits for an acknowledgment. The interrupted
CPU should call
cyg_scheduler_timeslice_cpu()
to cause the timeslice event to be processed.
Test-and-set Support
Test-and-set is the foundation of the SMP synchronization mechanisms.
HAL_TAS_TYPE
The type for all test-and-set variables. The test-and-set macros only support operations on a single bit (usually
the least significant bit) of this location. This allows for maximum flexibility in the implementation.
HAL_TAS_SET( tas, oldb )
Performs a test and set operation on the location
tas
.
oldb
will contain
true
if the location was already set,
and
false
if it was clear.
HAL_TAS_CLEAR( tas, oldb )
Performs a test and clear operation on the location
tas
.
oldb
will contain
true
if the location was already
set, and
false
if it was clear.
194