1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge branch 'master' of ssh://ukleos.des-mesh.net/home/git/ukleos

This commit is contained in:
Oliver Hahm 2010-11-04 16:23:11 +01:00
commit d1bff5cb3d
7 changed files with 74 additions and 11 deletions

View File

@ -71,14 +71,6 @@
#define PRIORITY_IDLE PRIORITY_MIN
#define PRIORITY_MAIN PRIORITY_MIN-1
#define PRIORITY_CMD_THREADS PRIORITY_MIN-2 ///< all cmd handler threads
#define PRIORITY_CBD PRIORITY_MIN-3
#define PRIORITY_CMDD PRIORITY_MIN-4 ///< cmdengine demon
#define PRIORITY_PRINTTHREAD PRIORITY_MIN-5 ///< mprint worker thread
#define PRIORITY_HAL PRIORITY_MIN-6
#define PRIORITY_UTIMER PRIORITY_MIN-7
#define PRIORITY_MMREQ PRIORITY_MIN-8
#define PRIORITY_CC1100 PRIORITY_MIN-9
/**
* @brief Check whether called from interrupt service routine

View File

@ -60,6 +60,8 @@ and the mailinglist (subscription via web site)
#include "msg.h"
#include "debug.h"
#define PRIORITY_CC1100 PRIORITY_MIN-9
#define MSG_POLL 12346
#define FLAGS_IDENTIFICATION (0x01) ///< Bit mask for reading the identification out of the flags field

11
projects/default/Jamfile Normal file
View File

@ -0,0 +1,11 @@
#
# ukleos default project. Consists of a shell.
#
# Copyright (C) 2008, 2009 Kaspar Schleiser <kaspar@schleiser.de>
#
SubDir TOP projects default ;
Module default_project : main.c : shell posix_io uart0 shell_commands ps ;
UseModule default_project ;

37
projects/default/main.c Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2008, 2009, 2010 Kaspar Schleiser <kaspar@schleiser.de>
*/
#include <stdio.h>
#include <string.h>
#include <posix_io.h>
#include <shell.h>
#include <shell_commands.h>
#include <board_uart0.h>
int shell_readc() {
char c = 0;
posix_read(uart0_handler_pid, &c, 1);
return c;
}
void shell_putchar(int c) {
putchar(c);
}
int main(void) {
board_uart0_init();
posix_open(uart0_handler_pid, 0);
puts("Welcome to ukleos!");
shell_t shell;
shell_init(&shell, _shell_command_list, shell_readc, shell_putchar);
shell_run(&shell);
return 0;
}

View File

@ -36,6 +36,7 @@ and the mailinglist (subscription via web site)
typedef struct shell_command_t {
char* name;
char* desc;
void (*handler)(char*);
} shell_command_t;

View File

@ -61,6 +61,17 @@ static void(*find_handler(const shell_command_t *command_list, char *command))(c
return NULL;
}
static void print_help(const shell_command_t *command_list) {
const shell_command_t *entry = command_list;
printf("%-20s %s\n", "Command", "Description");
while(entry->name != NULL) {
printf("%-20s %s\n", entry->name, entry->desc);
entry++;
}
}
static void handle_input_line(shell_t *shell, char* line) {
char* saveptr;
char* linedup = strdup(line);
@ -73,7 +84,11 @@ static void handle_input_line(shell_t *shell, char* line) {
if (handler != NULL) {
handler(line);
} else {
puts("shell: command not found.");
if ( strcmp("help", command) == 0) {
print_help(shell->command_list);
} else {
puts("shell: command not found.");
}
}
}

View File

@ -1,9 +1,14 @@
#include <shell.h>
#include <stdlib.h>
#ifdef MODULE_PS
extern void _ps_handler(char* unnused);
#endif
const shell_command_t _shell_command_list[] = {
#ifdef MODULE_PS
{"ps", ps_handler},
{"ps", "Prints information about running threads.", _ps_handler},
#endif
{NULL, NULL}
{NULL, NULL, NULL}
};