AutosarOS
Resource.c File Reference

Implementation of resource management. More...

#include "Resource.h"
#include "Types.h"
#include "OS.h"
#include "assert.h"
#include <util/atomic.h>
Include dependency graph for Resource.c:

Go to the source code of this file.

Functions

StatusType Resource_GetResource (ResourceType ResID)
 Request a resource. More...
 
StatusType Resource_ReleaseResource (ResourceType ResID)
 Release a resource. More...
 
void Resource_GetInternalResource (void)
 Get internal resource of the current task if one is assigned. More...
 
void Resource_ReleaseInternalResource (void)
 Release internal resource of the current task if one is assigned. More...
 

Detailed Description

Implementation of resource management.

Date
2020-04-27
Author
Pascal Romahn

Definition in file Resource.c.

Function Documentation

◆ Resource_GetInternalResource()

void Resource_GetInternalResource ( void  )

Get internal resource of the current task if one is assigned.

Warning
This function should only be called with interrupts disabled!

Definition at line 161 of file Resource.c.

Here is the caller graph for this function:

◆ Resource_GetResource()

StatusType Resource_GetResource ( ResourceType  ResID)

Request a resource.

This call serves to enter critical sections in the code that are assigned to the resource referenced by ResID. A critical section shall always be left using Resource_ReleaseResource().

Parameters
ResIDReference to resource
Returns
E_OK No error
E_OS_ID Invalid resource ID
E_OS_ACCESS Attempt to get a resource which is already occupied by any task or ISR, or the statically assigned priority of the calling task or interrupt routine is higher than the calculated ceiling priority

Definition at line 21 of file Resource.c.

◆ Resource_ReleaseInternalResource()

void Resource_ReleaseInternalResource ( void  )

Release internal resource of the current task if one is assigned.

Warning
This function should only be called with interrupts disabled!

Definition at line 174 of file Resource.c.

Here is the caller graph for this function:

◆ Resource_ReleaseResource()

StatusType Resource_ReleaseResource ( ResourceType  ResID)

Release a resource.

This function is the counterpart of Resource_GetResource() and serves to leave critical sections in the code that are assigned to the resource referenced by ResID.

Parameters
ResIDReference to resource
Returns
E_OK No error
E_OS_ID Invalid resource ID
E_OS_NOFUNC Attempt to release a resource which is not occupied or another resource shall be released before
E_OS_ACCESS Attempt to release a resource which has a lower ceiling priority than the statically assigned priority of the calling task or interrupt routine

Definition at line 77 of file Resource.c.

Here is the call graph for this function: