EE445M RTOS
Taken at the University of Texas Spring 2015
Test of cpp functionality

Classes

class  blinker
 
class  ctlsys
 

Functions

 blinker::blinker ()
 
 blinker::blinker (port_t port_base)
 
 blinker::blinker (port_t port_base, port_t output_pins)
 
virtual void blinker::set_base (port_t port)
 
virtual void blinker::turn_on (pin_t pin)
 
virtual void blinker::turn_off (pin_t pin)
 
virtual void blinker::toggle (pin_t pin)
 
virtual void blinker::blink (pin_t pin)
 
static void ctlsys::enable_periph (uint32_t sys_periph)
 
static uint32_t ctlsys::timer_timeout_from_subtimer (uint32_t subtimer)
 
static uint32_t ctlsys::gpio_pin_to_int (uint32_t pin)
 
static uint32_t ctlsys::periph_to_int (uint32_t periph)
 
static void ctlsys::gpio_int_clear (uint32_t base, uint32_t pin)
 
static void ctlsys::gpio_int_disable (uint32_t base, uint32_t pin)
 
static void ctlsys::gpio_int_enable (uint32_t base, uint32_t pin, bool clear_int=false)
 
static void ctlsys::set_clock (void)
 

Variables

const pin_t PIN_RED = GPIO_PIN_1
 
const pin_t PIN_GREEN = GPIO_PIN_3
 
const pin_t PIN_BLUE = GPIO_PIN_2
 
uint32_t blinker::port_base
 

Detailed Description

Function Documentation

void blinker::blink ( pin_t  pin)
virtual

Implements gpio_twiddler.

Definition at line 38 of file blinker.cpp.

References blinker::port_base.

Referenced by UART0_Handler().

38  {
39  GPIOPinWrite(port_base, pin, pin ^ GPIOPinRead(port_base, pin));
40  GPIOPinWrite(port_base, pin, pin ^ GPIOPinRead(port_base, pin));
41 }
uint32_t port_base
Definition: blinker.hpp:34

Here is the caller graph for this function:

blinker::blinker ( )

Definition at line 8 of file blinker.cpp.

8 { }
blinker::blinker ( port_t  port_base)

Definition at line 10 of file blinker.cpp.

References blinker::set_base().

10  {
12 }
uint32_t port_base
Definition: blinker.hpp:34
virtual void set_base(port_t port)
Definition: blinker.cpp:22

Here is the call graph for this function:

blinker::blinker ( port_t  port_base,
port_t  output_pins 
)

Initialize at outputs

Definition at line 14 of file blinker.cpp.

References ctlsys::enable_periph(), and blinker::set_base().

14  {
15 
17 
19  GPIOPinTypeGPIOOutput(port_base, output_pins);
20 }
uint32_t port_base
Definition: blinker.hpp:34
virtual void set_base(port_t port)
Definition: blinker.cpp:22
static void enable_periph(uint32_t sys_periph)
Definition: ctlsysctl.hpp:24

Here is the call graph for this function:

static void ctlsys::enable_periph ( uint32_t  sys_periph)
inlinestatic

Enable peripherals based on a GPIO_PORTx_BASE.

Definition at line 24 of file ctlsysctl.hpp.

References critical::static_EndCritical(), and critical::static_StartCritical().

Referenced by blinker::blinker(), can::init(), lswitch::lswitch(), motor::motor(), ping::ping(), and motor::pwm_init().

24  {
25  uint32_t periph_base = 0xDEADBEEF;
26  switch(sys_periph) {
27  case GPIO_PORTA_BASE: periph_base = SYSCTL_PERIPH_GPIOA; break;
28  case GPIO_PORTB_BASE: periph_base = SYSCTL_PERIPH_GPIOB; break;
29  case GPIO_PORTC_BASE: periph_base = SYSCTL_PERIPH_GPIOC; break;
30  case GPIO_PORTD_BASE: periph_base = SYSCTL_PERIPH_GPIOD; break;
31  case GPIO_PORTE_BASE: periph_base = SYSCTL_PERIPH_GPIOE; break;
32  case GPIO_PORTF_BASE: periph_base = SYSCTL_PERIPH_GPIOF; break;
33  case GPIO_PORTG_BASE: periph_base = SYSCTL_PERIPH_GPIOG; break;
34  case GPIO_PORTH_BASE: periph_base = SYSCTL_PERIPH_GPIOH; break;
35  case GPIO_PORTJ_BASE: periph_base = SYSCTL_PERIPH_GPIOJ; break;
36  case PWM0_BASE: periph_base = SYSCTL_PERIPH_PWM0; break;
37  case PWM1_BASE: periph_base = SYSCTL_PERIPH_PWM1; break;
38  case CAN0_BASE: periph_base = SYSCTL_PERIPH_CAN0; break;
39  case CAN1_BASE: periph_base = SYSCTL_PERIPH_CAN1; break;
40  default: while(1) {}
41  }
42  uint32_t ui32Status = static_StartCritical();
43  SysCtlPeripheralEnable(periph_base);
44  static_EndCritical(ui32Status);
45  }
static void static_EndCritical(uint32_t primask)
Definition: criticalpp.hpp:23
static uint32_t static_StartCritical(void)
Definition: criticalpp.hpp:18

Here is the call graph for this function:

Here is the caller graph for this function:

static void ctlsys::gpio_int_clear ( uint32_t  base,
uint32_t  pin 
)
inlinestatic

Definition at line 88 of file ctlsysctl.hpp.

References ctlsys::gpio_pin_to_int().

Referenced by ctlsys::gpio_int_enable().

88  {
89  uint32_t interrupt = gpio_pin_to_int(pin);
90  GPIOIntClear(base, interrupt);
91  }
static uint32_t gpio_pin_to_int(uint32_t pin)
Definition: ctlsysctl.hpp:59

Here is the call graph for this function:

Here is the caller graph for this function:

static void ctlsys::gpio_int_disable ( uint32_t  base,
uint32_t  pin 
)
inlinestatic

Definition at line 93 of file ctlsysctl.hpp.

References ctlsys::gpio_pin_to_int().

Referenced by ping::sample().

93  {
94 
95  uint32_t interrupt = gpio_pin_to_int(pin);
96  GPIOIntDisable(base, interrupt);
97  }
static uint32_t gpio_pin_to_int(uint32_t pin)
Definition: ctlsysctl.hpp:59

Here is the call graph for this function:

Here is the caller graph for this function:

static void ctlsys::gpio_int_enable ( uint32_t  base,
uint32_t  pin,
bool  clear_int = false 
)
inlinestatic

Definition at line 99 of file ctlsysctl.hpp.

References ctlsys::gpio_int_clear(), and ctlsys::gpio_pin_to_int().

Referenced by ping::sample().

99  {
100 
101  uint32_t interrupt = gpio_pin_to_int(pin);
102  if (clear_int) {
103  gpio_int_clear(base, interrupt);
104  }
105  GPIOIntEnable(base, interrupt);
106  }
static uint32_t gpio_pin_to_int(uint32_t pin)
Definition: ctlsysctl.hpp:59
static void gpio_int_clear(uint32_t base, uint32_t pin)
Definition: ctlsysctl.hpp:88

Here is the call graph for this function:

Here is the caller graph for this function:

static uint32_t ctlsys::gpio_pin_to_int ( uint32_t  pin)
inlinestatic

Definition at line 59 of file ctlsysctl.hpp.

Referenced by ctlsys::gpio_int_clear(), ctlsys::gpio_int_disable(), and ctlsys::gpio_int_enable().

59  {
60  switch(pin) {
61  case GPIO_PIN_0: return GPIO_INT_PIN_0;
62  case GPIO_PIN_1: return GPIO_INT_PIN_1;
63  case GPIO_PIN_2: return GPIO_INT_PIN_2;
64  case GPIO_PIN_3: return GPIO_INT_PIN_3;
65  case GPIO_PIN_4: return GPIO_INT_PIN_4;
66  case GPIO_PIN_5: return GPIO_INT_PIN_5;
67  case GPIO_PIN_6: return GPIO_INT_PIN_6;
68  case GPIO_PIN_7: return GPIO_INT_PIN_7;
69  default: while(1) {}
70  }
71  }

Here is the caller graph for this function:

static uint32_t ctlsys::periph_to_int ( uint32_t  periph)
inlinestatic

Definition at line 73 of file ctlsysctl.hpp.

Referenced by ping::sample().

73  {
74  switch(periph) {
75  case GPIO_PORTA_BASE: return INT_GPIOA_TM4C123;
76  case GPIO_PORTB_BASE: return INT_GPIOB_TM4C123;
77  case GPIO_PORTC_BASE: return INT_GPIOC_TM4C123;
78  case GPIO_PORTD_BASE: return INT_GPIOD_TM4C123;
79  case GPIO_PORTE_BASE: return INT_GPIOE_TM4C123;
80  case GPIO_PORTF_BASE: return INT_GPIOF_TM4C123;
81  case GPIO_PORTG_BASE: return INT_GPIOG_TM4C123;
82  case GPIO_PORTH_BASE: return INT_GPIOH_TM4C123;
83  case CAN0_BASE: return INT_CAN0_TM4C123;
84  default: while(1) {}
85  }
86  }

Here is the caller graph for this function:

void blinker::set_base ( port_t  port)
virtual

Implements gpio_twiddler.

Definition at line 22 of file blinker.cpp.

References blinker::port_base.

Referenced by blinker::blinker().

22  {
23  this->port_base = port_base;
24 }
uint32_t port_base
Definition: blinker.hpp:34

Here is the caller graph for this function:

static void ctlsys::set_clock ( void  )
inlinestatic

Set the clock as used in our labs.

Definition at line 109 of file ctlsysctl.hpp.

Referenced by main().

109  {
110  SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
111  SYSCTL_XTAL_16MHZ);
112  }

Here is the caller graph for this function:

static uint32_t ctlsys::timer_timeout_from_subtimer ( uint32_t  subtimer)
inlinestatic

Definition at line 47 of file ctlsysctl.hpp.

Referenced by lswitch::lswitch().

47  {
48 
49  uint32_t timeout = 0x0;
50  switch(subtimer) {
51  case TIMER_BOTH:
52  case TIMER_A: timeout = TIMER_TIMA_TIMEOUT; break;
53  case TIMER_B: timeout = TIMER_TIMB_TIMEOUT; break;
54  default: while(1) {}
55  }
56  return timeout;
57  }

Here is the caller graph for this function:

void blinker::toggle ( pin_t  pin)
virtual

Implements gpio_twiddler.

Definition at line 34 of file blinker.cpp.

References blinker::port_base.

Referenced by can_handler(), can_transmitter(), shell::doctor(), shell::jester(), thread_blink_blue(), thread_blink_green(), thread_blink_red(), Timer1A_Handler(), Timer2A_Handler(), and shell::witch().

34  {
35  GPIOPinWrite(port_base, pin, pin ^ GPIOPinRead(port_base, pin));
36 }
uint32_t port_base
Definition: blinker.hpp:34

Here is the caller graph for this function:

void blinker::turn_off ( pin_t  pin)
virtual

Implements gpio_twiddler.

Definition at line 30 of file blinker.cpp.

References blinker::port_base.

Referenced by ping::sample(), and motor::set().

30  {
31  GPIOPinWrite(port_base, pin, 0);
32 }
uint32_t port_base
Definition: blinker.hpp:34

Here is the caller graph for this function:

void blinker::turn_on ( pin_t  pin)
virtual

Implements gpio_twiddler.

Definition at line 26 of file blinker.cpp.

References blinker::port_base.

Referenced by ping::sample(), and motor::set().

26  {
27  GPIOPinWrite(port_base, pin, pin);
28 }
uint32_t port_base
Definition: blinker.hpp:34

Here is the caller graph for this function:

Variable Documentation

const pin_t PIN_BLUE = GPIO_PIN_2

Definition at line 20 of file blinker.hpp.

Referenced by can_handler(), can_transmitter(), shell::jester(), and thread_blink_blue().

const pin_t PIN_GREEN = GPIO_PIN_3

Definition at line 19 of file blinker.hpp.

Referenced by thread_blink_green(), Timer1A_Handler(), and shell::witch().

const pin_t PIN_RED = GPIO_PIN_1

Definition at line 18 of file blinker.hpp.

Referenced by shell::doctor(), thread_blink_red(), Timer2A_Handler(), and UART0_Handler().

uint32_t blinker::port_base
private