Intel IXP1200 Network Router User Manual


 
IXP1200 Network Processor Family ATM OC-3/12/Ethernet IP Router Example Design
Application Note 53
Modified on: 3/20/02,
// sram[read, $foo], ordered, ctx_swap
4.10 Mutex Vectors
Mutex vectors are an extension to critical sections that allows multiple critical sections to be
contained within a single absolute register. (critsect.uc implements critical sections, critsect macros
are documented in the IXP1200 Macro Library Reference Manual.) Critsect macros are used to
allow only 1 of the 4 threads of a microengine to execute a critical code section at one time. The
critsect macros allow the four threads within a microengine to use a semaphore implemented in an
absolute register. The semaphore is used to restrict use of a resource shared by the threads in a
microengine. The OC-3 Ethernet receiver uses them to prevent multiple threads from enqueuing on
the same transmit queue, while allowing them to concurrently enqueue on different transmit
queues. The mutex vector subsystem is implemented in mutex_vector.uc.
The following critical section macros are for use within a microengine. Up to 32 critical sections
can be implemented with each absolute register. These macros are used where run-time selection
between multiple mutexes is necessary. If only one mutex is needed, the macros in critsect.uc are
slightly smaller and faster.
4.10.1 mutex_vector_init()
Initializes critical sections to enable subsequent mutex_vector_enter() to succeed.
mutex_vector_init(out_abs_reg)
4.10.2 mutex_vector_enter()
Enters the specified microengine critical section.
mutex_vector_enter(io_abs_reg, in_bit_number)
4.10.3 mutex_vector_exit()
Exits the specified microengine critical section.
mutex_vector_exit(io_abs_reg, in_bit_number)
Parameter Description
out_abs_reg Absolute register containing the semaphores.
Parameter Description
out_abs_reg Absolute register containing the semaphores.
in_bit_number
bit number of the semaphore
0 bits: critical section available
1 bits: critical section occupied
init: clears all bits