CAA.BOLT (FB; Prefix: blt)

 

(CAA_Types.library)

This function block gives exclusive or simultaneous access to a critical section. It is based on the runtime system function SysCpuTestAndSet. Exclusive access is only possible after all simultaneous accesses have been ended. As long as there is an exclusive access, the simultaneous access calls are rejected. Simultaneous accesses are initiated with the method Enter. This means the number of accesses in the critical section is increased by one. The method Leave is required to leave the critical section. It reduces the number of accesses in the critical section by one. Exclusive access is requested with the method Reserve . This call can only be successful if the number of accesses in the critical section equals zero. If this is not the case, all new calls of the method Enter are denied to make sure the number of accesses is not increased further. If all calls which previously accessed the critical section, have left with the method Leave, the next call of the method Reserve will be successful. The crit­ical section can now be accessed exclusively. When all work is done, the section has to be returned with the method Free. If exclusive access has already been granted, calls for simultaneous access are denied. Further calls for exclusive access are also denied but they are counted. The calls for simultaneous access are successful as soon as all exclusive accesses have been ended.

Notice

If the method was executed successfully, TRUE is returned, else FALSE is returned. A critical section may only be accessed if the methods Enter or Reserve have been returned TRUE

Enter (Method):

Return:

xOk

BOOL

TRUE => Request successful

Leave (Method):

Return:

xOk

BOOL

TRUE => Release successful

Reserve (Method):

VAR_IN_OUT:

ctValue

CAA.COUNT

Parameter for internal administration.

Return:

xOk

BOOL

TRUE => Reserve successful

Free (Method):

Return:

xOk

BOOL

TRUE => Free successful