Cygdrvspinlockspinintsave, Cygdrvspinlockclearintsave, Cyg_drv_spinlock_spin_intsave – Comtrol eCos User Manual

Page 396: Cyg_drv_spinlock_clear_intsave

Advertising
background image

Chapter 18. Device Driver Interface to the Kernel

Level:

ISR

Description:

Inspect the state of the spinlock. If the spinlock is not locked then the result is

TRUE

. If it is locked then the

result will be

FALSE

.

cyg_drv_spinlock_spin_intsave

Function:

void cyg_drv_spinlock_spin_intsave(cyg_spinlock_t *lock,

cyg_addrword_t *istate )

Arguments:

lock

- pointer to spinlock to claim

istate

- pointer to interrupt state save location

Result:

None

Level:

ISR

Description:

This function behaves exactly like

cyg_drv_spinlock_spin()

except that it also disables interrupts

before attempting to claim the lock. The current interrupt enable state is saved in

*istate

.

Interrupts remain disabled once the spinlock had been claimed and must be restored by calling

cyg_drv_spinlock_clear_intsave()

.

In general, device drivers should use this function to claim and release spinlocks rather than the
non-

_intsave()

variants, to ensure proper exclusion with code running on both other CPUs and this CPU.

cyg_drv_spinlock_clear_intsave

Function:

void cyg_drv_spinlock_clear_intsave( cyg_spinlock_t *lock,

cyg_addrword_t istate )

292

Advertising