EE445M RTOS
Taken at the University of Texas Spring 2015
test-uart.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "libuart/uart.h"
#include "libhw/hardware.h"
#include "libheart/heartbeat.h"
Include dependency graph for test-uart.c:

Go to the source code of this file.

Macros

#define HEARTBEAT_MODAL
 

Functions

void led_blink_red ()
 
void led_blink_green ()
 
void led_blink_blue ()
 
void uart_handler (notification note)
 
int main (void)
 

Variables

uint32_t red_work = 0
 
uint32_t blue_work = 0
 
uint32_t green_work = 0
 

Macro Definition Documentation

#define HEARTBEAT_MODAL

Definition at line 22 of file test-uart.c.

Function Documentation

void led_blink_blue ( )

Definition at line 47 of file test-uart.c.

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

Referenced by main().

47  {
48  while (1) {
49  ++blue_work;
53  }
54 }
void GPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
Definition: gpio.c:1038
#define GPIO_PIN_2
Definition: gpio.h:62
uint32_t blue_work
Definition: test-uart.c:26
#define os_surrender_context()
Definition: os.h:142
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_green ( )

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

References GPIO_PIN_3, GPIO_PORTF_BASE, GPIOPinRead(), GPIOPinWrite(), and green_work.

Referenced by uart_handler().

38  {
39  /* while (1) { */
40  ++green_work;
43  /* os_surrender_context(); */
44  /* } */
45 }
void GPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
Definition: gpio.c:1038
#define GPIO_PIN_3
Definition: gpio.h:63
int32_t GPIOPinRead(uint32_t ui32Port, uint8_t ui8Pins)
Definition: gpio.c:1006
uint32_t green_work
Definition: test-uart.c:27
#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 29 of file test-uart.c.

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

Referenced by main().

29  {
30  while (1) {
31  ++red_work;
35  }
36 }
void GPIOPinWrite(uint32_t ui32Port, uint8_t ui8Pins, uint8_t ui8Val)
Definition: gpio.c:1038
#define GPIO_PIN_1
Definition: gpio.h:61
uint32_t red_work
Definition: test-uart.c:25
#define os_surrender_context()
Definition: os.h:142
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:

int main ( void  )

Accept input on UART 0, and parrot input back out to UART 0.

Returns
Exit status

Definition at line 70 of file test-uart.c.

References DL_SOFT, GPIO_PIN_1, GPIO_PIN_2, GPIO_PIN_3, GPIO_PORTF_BASE, heart_init(), hw_daemon(), hw_init_and_subscribe, HW_UART, Hz, INT_UART0, IntMasterDisable(), IntMasterEnable(), led_blink_blue(), led_blink_red(), os_launch(), os_threading_init(), postpone_death, schedule(), SYSCTL_OSC_MAIN, SYSCTL_SYSDIV_1, SYSCTL_USE_OSC, SYSCTL_XTAL_16MHZ, SysCtlClockSet(), UART0_BASE, UART_DEFAULT_BAUD_RATE, uart_handler(), uart_metadata_init, and uart_send_string().

70  {
71 
74 
76 
77  heart_init();
78  heart_init_(GPIO_PORTF_BASE, GPIO_PIN_1);
79  heart_init_(GPIO_PORTF_BASE, GPIO_PIN_2);
80  heart_init_(GPIO_PORTF_BASE, GPIO_PIN_3);
81 
84 
89 
90  /* Prompt for text to be entered. */
91  uart_send_string("Enter text:");
92 
94  os_launch();
96 }
void uart_send_string(const char *text)
Definition: uart.c:71
void led_blink_red()
Definition: test-uart.c:29
#define SYSCTL_OSC_MAIN
Definition: sysctl.h:378
#define SYSCTL_USE_OSC
Definition: sysctl.h:350
#define GPIO_PIN_2
Definition: gpio.h:62
#define SYSCTL_XTAL_16MHZ
Definition: sysctl.h:372
#define GPIO_PIN_1
Definition: gpio.h:61
#define UART_DEFAULT_BAUD_RATE
Definition: uart.h:14
void os_threading_init()
Definition: os.c:34
void schedule(task_t task, frequency_t frequency, DEADLINE_TYPE seriousness)
Definition: os.c:386
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
#define INT_UART0
Definition: hw_ints.h:451
bool IntMasterDisable(void)
Definition: interrupt.c:249
#define uart_metadata_init(_baud_rate, _channel, _interrupt)
Definition: uart.h:29
#define GPIO_PIN_3
Definition: gpio.h:63
bool IntMasterEnable(void)
#define hw_init_and_subscribe(type, metadata, pseudo_isr)
Definition: hardware.h:149
void uart_handler(notification note)
Definition: test-uart.c:59
#define Hz
Definition: nexus.h:45
#define UART0_BASE
Definition: hw_memmap.h:61
#define SYSCTL_SYSDIV_1
Definition: sysctl.h:221
void SysCtlClockSet(uint32_t ui32Config)
Definition: sysctl.c:2532
void led_blink_blue()
Definition: test-uart.c:47
void hw_daemon(void)
Definition: hardware.c:172
#define GPIO_PORTF_BASE
Definition: hw_memmap.h:74

Here is the call graph for this function:

void uart_handler ( notification  note)

Read the next character from the UART and write it back to the UART.

Returns
void

Definition at line 59 of file test-uart.c.

References notification::_char, led_blink_green(), and uart_send_char().

Referenced by main().

59  {
60 
61  char recv = note._char;
62 
63  uart_send_char(recv);
65 }
void led_blink_green()
Definition: test-uart.c:38
void uart_send_char(const char text)
Definition: uart.c:59
char _char
Definition: notify.h:25

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

uint32_t blue_work = 0

Definition at line 26 of file test-uart.c.

Referenced by led_blink_blue().

uint32_t green_work = 0

Definition at line 27 of file test-uart.c.

Referenced by led_blink_green().

uint32_t red_work = 0

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

Referenced by led_blink_red().