EE445M RTOS
Taken at the University of Texas Spring 2015
test-edf.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "libbutton/button.h"
#include "libtimer/timer.h"
#include "libschedule/schedule.h"
#include "libos/os.h"
#include "libheart/heartbeat.h"
Include dependency graph for test-edf.c:

Go to the source code of this file.

Macros

#define HEARTBEAT_MODAL
 
#define SCHEDLUE_PRIORITY
 
#define SCHEDULER_MAX_THREADS   16
 
#define HEART_RED   GPIO_PIN_1
 
#define HEART_BLUE   GPIO_PIN_2
 
#define HEART_GREEN   GPIO_PIN_3
 

Functions

void button_debounce_end (notification button_notification)
 
void button_debounce_start (notification button_notification)
 
void postpone_suicide ()
 
void led_blink_red ()
 
void led_blink_blue ()
 
void main (void)
 

Variables

volatile uint32_t button_left_pressed
 
volatile uint32_t button_right_pressed
 
volatile uint32_t button_debounced_mailbox
 
volatile uint32_t button_debounced_wtf
 
volatile semaphore_t button_debounced_new_data
 
volatile uint32_t red_work = 0
 
volatile uint32_t blue_work = 0
 

Macro Definition Documentation

#define HEART_BLUE   GPIO_PIN_2

Definition at line 34 of file test-edf.c.

#define HEART_GREEN   GPIO_PIN_3

Definition at line 35 of file test-edf.c.

#define HEART_RED   GPIO_PIN_1

Definition at line 33 of file test-edf.c.

#define HEARTBEAT_MODAL

Definition at line 23 of file test-edf.c.

#define SCHEDLUE_PRIORITY

Definition at line 24 of file test-edf.c.

#define SCHEDULER_MAX_THREADS   16

Definition at line 25 of file test-edf.c.

Function Documentation

void button_debounce_end ( notification  button_notification)

Definition at line 48 of file test-edf.c.

References button_debounced_mailbox, button_debounced_new_data, BUTTONS_BOTH, GPIO_PORTF_BASE, GPIOPinRead(), and sem_post.

Referenced by button_debounce_start(), and main().

48  {
49 
52 }
volatile uint32_t button_debounced_mailbox
Definition: test-edf.c:40
#define sem_post(sem)
#define BUTTONS_BOTH
Definition: button.h:28
volatile semaphore_t button_debounced_new_data
Definition: test-edf.c:43
int32_t GPIOPinRead(uint32_t ui32Port, uint8_t ui8Pins)
Definition: gpio.c:1006
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

void button_debounce_start ( notification  button_notification)

Definition at line 55 of file test-edf.c.

References button_debounce_end(), button_debounced_wtf, BUTTONS_BOTH, GPIO_PORTF_BASE, GPIOPinRead(), hw_channel_init(), hw_subscribe_single_shot, HW_TIMER, Hz, INT_TIMER0A, TIMER0_BASE, TIMER_CFG_ONE_SHOT, and timer_metadata_init.

55  {
56 
59  hw_channel_init(HW_TIMER, timer_metadata);
60  hw_subscribe_single_shot(HW_TIMER, timer_metadata,
62 }
#define TIMER_CFG_ONE_SHOT
Definition: timer.h:59
#define TIMER0_BASE
Definition: hw_memmap.h:81
#define hw_subscribe_single_shot(type, metadata, isr)
Definition: hardware.h:190
void button_debounce_end(notification button_notification)
Definition: test-edf.c:48
#define BUTTONS_BOTH
Definition: button.h:28
#define timer_metadata_init(_base, _frequency, _interrupt, _periodic)
Definition: timer.h:21
#define Hz
Definition: nexus.h:45
volatile uint32_t button_debounced_wtf
Definition: test-edf.c:41
void hw_channel_init(HW_TYPE type, hw_metadata metadata)
Definition: hardware.c:94
int32_t GPIOPinRead(uint32_t ui32Port, uint8_t ui8Pins)
Definition: gpio.c:1006
#define INT_TIMER0A
Definition: hw_ints.h:435
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

void led_blink_blue ( )

Definition at line 93 of file test-edf.c.

References blue_work, GPIO_PIN_2, GPIO_PORTF_BASE, GPIOPinRead(), and GPIOPinWrite().

Referenced by main().

93  {
94  while (1) {
95  ++blue_work;
98  /* os_surrender_context(); */
99  }
100 }
void GPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
Definition: gpio.c:1038
#define GPIO_PIN_2
Definition: gpio.h:62
volatile uint32_t blue_work
Definition: test-edf.c:46
int32_t GPIOPinRead(uint32_t ui32Port, uint8_t ui8Pins)
Definition: gpio.c:1006
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

void led_blink_red ( )

Definition at line 84 of file test-edf.c.

References GPIO_PIN_1, GPIO_PORTF_BASE, GPIOPinRead(), GPIOPinWrite(), and red_work.

Referenced by main().

84  {
85  while (1) {
86  ++red_work;
89  /* os_surrender_context(); */
90  }
91 }
void GPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
Definition: gpio.c:1038
#define GPIO_PIN_1
Definition: gpio.h:61
int32_t GPIOPinRead(uint32_t ui32Port, uint8_t ui8Pins)
Definition: gpio.c:1006
volatile uint32_t red_work
Definition: test-edf.c:45
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

void main ( void  )

Definition at line 102 of file test-edf.c.

References button_debounce_end(), button_metadata_init, BUTTONS_BOTH, DL_SOFT, GPIO_BOTH_EDGES, GPIO_PIN_1, GPIO_PIN_2, GPIO_PIN_3, GPIO_PORTF_BASE, heart_init(), HW_BUTTON, hw_driver_init(), hw_init, hw_subscribe, HW_TIMER, Hz, INT_TIMER0A, IntMasterDisable(), IntMasterEnable(), led_blink_blue(), led_blink_red(), os_launch(), os_threading_init(), pidwork_init(), postpone_death, postpone_suicide(), schedule(), SYSCTL_OSC_MAIN, SYSCTL_SYSDIV_1, SYSCTL_USE_OSC, SYSCTL_XTAL_16MHZ, SysCtlClockSet(), TIMER0_BASE, TIMER_CFG_ONE_SHOT, and timer_metadata_init.

102  {
103 
106 
108 
109  heart_init();
110  heart_init_(GPIO_PORTF_BASE, GPIO_PIN_1);
111  heart_init_(GPIO_PORTF_BASE, GPIO_PIN_2);
112  heart_init_(GPIO_PORTF_BASE, GPIO_PIN_3);
113 
114  /* begin timer init */
116  hw_driver_init(HW_TIMER, timer_metadata);
117  /* end timer init */
118 
119  /* button init */
121 
122  hw_init(HW_BUTTON, button_metadata);
123  hw_subscribe(HW_BUTTON, button_metadata, button_debounce_end);
124 
125  pidwork_init();
126 
129  /* schedule(led_blink_green, 10 Hz, DL_SOFT); */
132  /* next test: different frequencies,pools */
133 
134  IntMasterEnable();
135  os_launch();
136 
137  postpone_death();
138 }
void pidwork_init()
Definition: jitter.c:6
#define TIMER_CFG_ONE_SHOT
Definition: timer.h:59
#define TIMER0_BASE
Definition: hw_memmap.h:81
#define button_metadata_init(_base, _pin, _interrupt)
Definition: button.h:23
#define GPIO_BOTH_EDGES
Definition: gpio.h:87
#define SYSCTL_OSC_MAIN
Definition: sysctl.h:378
#define hw_subscribe(type, metadata, isr)
Definition: hardware.h:178
#define SYSCTL_USE_OSC
Definition: sysctl.h:350
void postpone_suicide()
Definition: test-edf.c:64
#define GPIO_PIN_2
Definition: gpio.h:62
#define SYSCTL_XTAL_16MHZ
Definition: sysctl.h:372
#define hw_init(type, metadata)
Definition: hardware.h:143
#define GPIO_PIN_1
Definition: gpio.h:61
void button_debounce_end(notification button_notification)
Definition: test-edf.c:48
void os_threading_init()
Definition: os.c:34
void schedule(task_t task, frequency_t frequency, DEADLINE_TYPE seriousness)
Definition: os.c:386
#define BUTTONS_BOTH
Definition: button.h:28
void heart_init()
Initialize for visible transformation.
Definition: heartbeat.h:49
void os_launch()
Definition: os.c:161
#define postpone_death()
Definition: nexus.h:40
void hw_driver_init(HW_TYPE type, hw_metadata metadata)
Definition: hardware.c:62
bool IntMasterDisable(void)
Definition: interrupt.c:249
#define GPIO_PIN_3
Definition: gpio.h:63
bool IntMasterEnable(void)
void led_blink_blue()
Definition: test-edf.c:93
#define timer_metadata_init(_base, _frequency, _interrupt, _periodic)
Definition: timer.h:21
#define Hz
Definition: nexus.h:45
#define SYSCTL_SYSDIV_1
Definition: sysctl.h:221
void led_blink_red()
Definition: test-edf.c:84
void SysCtlClockSet(uint32_t ui32Config)
Definition: sysctl.c:2532
#define INT_TIMER0A
Definition: hw_ints.h:435
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

void postpone_suicide ( )

Definition at line 64 of file test-edf.c.

References button_debounced_mailbox, button_debounced_new_data, BUTTON_LEFT, button_left_pressed, BUTTON_RIGHT, button_right_pressed, GPIO_PIN_2, GPIO_PIN_3, GPIO_PORTF_BASE, GPIOPinRead(), GPIOPinWrite(), sem_guard, and sem_take.

Referenced by main().

64  {
65 
66  while (1) {
73  }
78  }
79  }
80  /* os_surrender_context(); */
81  }
82 }
void GPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
Definition: gpio.c:1038
volatile uint32_t button_debounced_mailbox
Definition: test-edf.c:40
volatile uint32_t button_left_pressed
Definition: test-edf.c:37
#define GPIO_PIN_2
Definition: gpio.h:62
#define sem_take(sem)
volatile semaphore_t button_debounced_new_data
Definition: test-edf.c:43
volatile uint32_t button_right_pressed
Definition: test-edf.c:38
#define BUTTON_LEFT
Definition: button.h:26
#define GPIO_PIN_3
Definition: gpio.h:63
#define BUTTON_RIGHT
Definition: button.h:27
#define sem_guard(sem)
int32_t GPIOPinRead(uint32_t ui32Port, uint8_t ui8Pins)
Definition: gpio.c:1006
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

volatile uint32_t blue_work = 0

Definition at line 46 of file test-edf.c.

Referenced by led_blink_blue().

volatile uint32_t button_debounced_mailbox

Definition at line 40 of file test-edf.c.

Referenced by button_debounce_end(), and postpone_suicide().

volatile semaphore_t button_debounced_new_data

Definition at line 43 of file test-edf.c.

Referenced by button_debounce_end(), and postpone_suicide().

volatile uint32_t button_debounced_wtf

Definition at line 41 of file test-edf.c.

Referenced by button_debounce_start().

volatile uint32_t button_left_pressed

Definition at line 37 of file test-edf.c.

Referenced by postpone_suicide().

volatile uint32_t button_right_pressed

Definition at line 38 of file test-edf.c.

Referenced by postpone_suicide().

volatile uint32_t red_work = 0

Definition at line 45 of file test-edf.c.

Referenced by led_blink_red().