:
"
ARM Cortex-M3 -
ARM microcontroller . - -- - .
? - . "" . , , , 1 -. ( -) , , . , , (, ).
"( )
() :
int rwl_FreeLock(volatile uint32_t *lock){
*lock = 0;
return 1;
}
int rwl_TryLock(volatile uint32_t *lock, int who){
if(*lock == 0){
Var_SetBit_BB((uint32_t)lock, who);
if(*lock == (1<<who)){
return 1;
} else {
Var_ResetBit_BB((uint32_t)lock, who);
return 0;
}
}
}
Var_Set_BB/Var_Reset_BB: / , -. ()
!!!