Atlas Runtime
alarm_clock.c File Reference
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
Include dependency graph for alarm_clock.c:

Classes

struct  AlarmClockInfo
 

Macros

#define AC_TABLE_SIZE   32
 
#define AC_TABLE_MASK   (AC_TABLE_SIZE - 1)
 
#define AC_TABLE_ENTRY(hour, min)   (AlarmClockTab + (((hour) + (min)) & AC_TABLE_MASK))
 
#define AC_LOCK(hour, min)   (AlarmClockLockTab + (((hour) + (min)) & AC_TABLE_MASK))
 

Typedefs

typedef struct AlarmClockInfo AlarmClockInfo
 

Functions

AlarmClockInfoCreateNewInfo (uint8_t hour, uint8_t min, uint8_t mode, uint8_t repeat_factor, const char *name)
 
int add_or_update_alarm (uint8_t hour, uint8_t min, uint8_t mode, uint8_t repeat_factor, const char *name)
 
int cancel_alarm (uint8_t hour, uint8_t min, int play)
 
void print_alarms ()
 
void * play_alarms ()
 
int main ()
 

Variables

AlarmClockInfo ** AlarmClockTab
 
pthread_mutex_t AlarmClockLockTab [AC_TABLE_SIZE]
 
int set_alarms = 0
 
int update_alarms = 0
 
int cancelled_alarms = 0
 
int failed_cancel_alarms = 0
 

Macro Definition Documentation

#define AC_LOCK (   hour,
  min 
)    (AlarmClockLockTab + (((hour) + (min)) & AC_TABLE_MASK))
#define AC_TABLE_ENTRY (   hour,
  min 
)    (AlarmClockTab + (((hour) + (min)) & AC_TABLE_MASK))
#define AC_TABLE_MASK   (AC_TABLE_SIZE - 1)
#define AC_TABLE_SIZE   32

Typedef Documentation

Function Documentation

int add_or_update_alarm ( uint8_t  hour,
uint8_t  min,
uint8_t  mode,
uint8_t  repeat_factor,
const char *  name 
)
int cancel_alarm ( uint8_t  hour,
uint8_t  min,
int  play 
)
AlarmClockInfo* CreateNewInfo ( uint8_t  hour,
uint8_t  min,
uint8_t  mode,
uint8_t  repeat_factor,
const char *  name 
)
int main ( )
void* play_alarms ( )
void print_alarms ( )

Variable Documentation

pthread_mutex_t AlarmClockLockTab[AC_TABLE_SIZE]
AlarmClockInfo** AlarmClockTab
int cancelled_alarms = 0
int failed_cancel_alarms = 0
int set_alarms = 0
int update_alarms = 0