RocketLogger  1.0
sem.c File Reference
#include "sem.h"
+ Include dependency graph for sem.c:

Go to the source code of this file.

Functions

int create_sem (void)
 
int remove_sem (int sem_id)
 
int open_sem (void)
 
int wait_sem (int sem_id, int sem_num, int time_out)
 
int set_sem (int sem_id, int sem_num, int val)
 

Function Documentation

int create_sem ( void  )

Copyright (c) 2016-2017, ETH Zurich, Computer Engineering Group Create RocketLogger semaphore set

Returns
ID of created set

Definition at line 11 of file sem.c.

References ERROR, NUM_SEMS, rl_log(), sem_id, and SEM_KEY.

Referenced by pru_sample().

+ Here is the call graph for this function:

int open_sem ( void  )

Open existing RocketLogger semaphore set

Returns
ID of opened set

Definition at line 37 of file sem.c.

References ERROR, NUM_SEMS, rl_log(), sem_id, and SEM_KEY.

Referenced by main().

+ Here is the call graph for this function:

int remove_sem ( int  sem_id)

Remove semaphore set

Parameters
sem_idID of set to remove
Returns
SUCCESS on success, FAILURE otherwise

Definition at line 24 of file sem.c.

References DATA_SEM, ERROR, FAILURE, rl_log(), and SUCCESS.

Referenced by pru_sample().

+ Here is the call graph for this function:

int set_sem ( int  sem_id,
int  sem_num,
int  val 
)

Set value to semaphore

Parameters
sem_idID of semaphore set
sem_numNumber of semaphore in set
valValue to be set to semaphore
Returns
SUCCESS on success (access granted), TIME_OUT on time out, FAILURE otherwise

Definition at line 85 of file sem.c.

References ERROR, FAILURE, NO_FLAG, rl_log(), SEM_SET_TIME_OUT, SUCCESS, and TIME_OUT.

Referenced by handle_data_buffer(), main(), print_data(), and pru_sample().

+ Here is the call graph for this function:

int wait_sem ( int  sem_id,
int  sem_num,
int  time_out 
)

Wait on a semaphore until access granted

Parameters
sem_idID of semaphore set
sem_numNumber of semaphore in set
time_outMaximum waiting time
Returns
SUCCESS on success (access granted), TIME_OUT on time out, FAILURE otherwise

Definition at line 52 of file sem.c.

References ERROR, FAILURE, INFO, NO_FLAG, rl_log(), SUCCESS, TIME_OUT, and WARNING.

Referenced by handle_data_buffer(), main(), and print_data().

+ Here is the call graph for this function: