armOS  0.1.0
Minimal ARM Operating System for the Raspberry Pi - Documentation generated for Pi 4.
console

Code for system console. More...

Files

file  console.c
 Implementation of a minimal console.
 
file  console.h
 Definition of functions and types for a minimal console.
 

Macros

#define DEVICE_LENGTH   5
 
#define PROMPT_LENGTH   11
 

Enumerations

enum  command {
  cmd_help,
  cmd_help_led,
  cmd_led_pin,
  cmd_led_on,
  cmd_led_off,
  cmd_led_irq_on,
  cmd_led_irq_off,
  cmd_led_on_ms,
  cmd_led_blink_times,
  cmd_led_blink_sos,
  cmd_create_procs,
  cmd_run_procs,
  cmd_kill_procs,
  cmd_halt
}
 

Functions

char * console_init (char *device)
 
int console_get_cmd (char *input)
 
void console (char *device)
 
void console_help ()
 
void console_help_led ()
 

Variables

uint8_t led_pin_num
 

Detailed Description

Code for system console.

Macro Definition Documentation

◆ DEVICE_LENGTH

#define DEVICE_LENGTH   5

Length of device name, based on running device.

Warning
It is a temporary solution, based on the supported devices.
See also
kernel_main()

◆ PROMPT_LENGTH

#define PROMPT_LENGTH   11

Length of total prompt string for the console.

Warning
It is a temporary solution, based on the supported devices.
See also
console_init()

Enumeration Type Documentation

◆ command

enum command

Available commands for the console.

Enumerator
cmd_help 

Prints available commands to the console.

cmd_help_led 

Prints available LED commands to the console.

cmd_led_pin 

Changes the GPIO Pin for the LED to control.

cmd_led_on 

Turns the LED on.

cmd_led_off 

Turns the LED off.

cmd_led_irq_on 

Pulses the LED with a msec milliseconds interval, using System Timer's Interrupt.

cmd_led_irq_off 

Stop the System Timer's Interrupt.

cmd_led_on_ms 

Turns the LED on for msec milliseconds.

cmd_led_blink_times 

Blinks LED count times for msec milliseconds.

cmd_led_blink_sos 

Blinks SOS on LED with a msec milliseconds interval.

cmd_create_procs 

Creates proc_num kernel processes.

cmd_run_procs 

Runs the created kernel processes concurrently.

cmd_kill_procs 

Kills all created kernel processes.

cmd_halt 

Halts the system.

Function Documentation

◆ console()

void console ( char *  device)

Main console function.

Parameters
deviceA string pointer for the name of the device.

Executes the commands from console input in an endless loop.

See also
command, console_init(), console_help(), console_help_led(), uart_gets(), kernel/timer.h, kernel/led.h, kernel/process.h

◆ console_get_cmd()

int console_get_cmd ( char *  input)

Returns the correct command number, parsed from console input.

Parameters
inputA string pointer for the input from the console.
Returns
  • On success: The command number that matches the input from the command enum.
  • On failure: -1
See also
command

◆ console_help()

void console_help ( )

Help command

Prints available commands to the console.

◆ console_help_led()

void console_help_led ( )

Help LED command

Prints available LED commands to the console.

◆ console_init()

char* console_init ( char *  device)

Creates the prompt for the minimal console, based on the device.

Parameters
deviceA string pointer for the name of the device.
Returns
A string pointer for the prompt.

Variable Documentation

◆ led_pin_num

uint8_t led_pin_num

Definition of GPIO pin of LED, in order to be accessible from other translation units.

For example, in order to manipulate the LED with timer interrupts it is used by the handle_timer_1_irq() handler.

See also
console(), handle_timer_1_irq()