Line 51... |
Line 51... |
#include "taskp.h"
|
#include "taskp.h"
|
#include "syspipe.h"
|
#include "syspipe.h"
|
#include "ktraps.h"
|
#include "ktraps.h"
|
#include "errno.h"
|
#include "errno.h"
|
#include "swint.h"
|
#include "swint.h"
|
|
#include "txfns.h"
|
|
|
#include "../dev/display.h"
|
#include "../dev/display.h"
|
#include "../dev/rtcsim.h"
|
#include "../dev/rtcsim.h"
|
#include "../dev/keypad.h"
|
#include "../dev/keypad.h"
|
|
|
|
typedef unsigned size_t;
|
|
|
|
size_t strlen(const char *);
|
|
char *strcat(char *, const char *);
|
|
char *strcpy(char *, const char *);
|
|
|
/* Our system will need some pipes to handle ... life. How about these:
|
/* Our system will need some pipes to handle ... life. How about these:
|
*
|
*
|
* rxpipe - read()s from this pipe read from the UART
|
* rxpipe - read()s from this pipe read from the UART
|
* Interrupt fed
|
* Interrupt fed
|
* txpipe - write()s to this pipe write to the UART
|
* txpipe - write()s to this pipe write to the UART
|
Line 138... |
Line 145... |
/*
|
/*
|
* Wait for a button press, and then based upon the clock set a light
|
* Wait for a button press, and then based upon the clock set a light
|
*/
|
*/
|
#define DOORBELL_TASK doorbell_task_id
|
#define DOORBELL_TASK doorbell_task_id
|
|
|
|
|
|
/*
|
|
* Just print Hello World every 15 seconds or so. This is really a test of the
|
|
* write() and txpipe infrastructure, but not really a valid part of the task.
|
|
*
|
|
*/
|
|
// #define HELLO_TASK hello_task_id
|
|
|
#define LAST_TASK last_task_id
|
#define LAST_TASK last_task_id
|
|
|
typedef enum {
|
typedef enum {
|
#ifdef RTCCLOCK_TASK
|
#ifdef RTCCLOCK_TASK
|
RTCCLOCK_TASK,
|
RTCCLOCK_TASK,
|
Line 155... |
Line 170... |
//KEYPAD_TASK,
|
//KEYPAD_TASK,
|
//#endif
|
//#endif
|
#ifdef MENU_TASK
|
#ifdef MENU_TASK
|
MENU_TASK,
|
MENU_TASK,
|
#endif
|
#endif
|
#ifdef COMMAND_TASK
|
#ifdef HELLO_TASK
|
COMMAND_TASK,
|
HELLO_TASK,
|
#endif
|
#endif
|
LAST_TASK
|
LAST_TASK
|
} TASKNAME;
|
} TASKNAME;
|
|
|
|
|
void rtctask(void),
|
void rtctask(void),
|
doorbell_task(void),
|
doorbell_task(void),
|
display_task(void),
|
display_task(void),
|
keypad_task(void),
|
keypad_task(void),
|
menu_task(void);
|
menu_task(void),
|
|
hello_task(void);
|
// idle_task ... is accomplished within the kernel
|
// idle_task ... is accomplished within the kernel
|
extern void restore_context(int *), save_context(int *);
|
extern void restore_context(int *), save_context(int *);
|
extern SYSPIPE *rxpipe, *txpipe, *pwmpipe, *lcdpipe;
|
extern SYSPIPE *rxpipe, *txpipe, *pwmpipe, *lcdpipe;
|
SYSPIPE *midpipe;
|
SYSPIPE *midpipe;
|
extern KDEVICE *pipedev;
|
extern KDEVICE *pipedev;
|
|
|
int kntasks(void) {
|
int kntasks(void) {
|
return LAST_TASK;
|
return LAST_TASK;
|
} void kinit(TASKP *tasklist) {
|
} void kinit(TASKP *tasklist) {
|
#ifdef RTCCLOCK_TASK
|
#ifdef RTCCLOCK_TASK
|
//
|
// Stack = 36 (rtctask) + 4(rtcdatenext)
|
tasklist[RTCCLOCK_TASK] = new_task(16, rtctask);
|
tasklist[RTCCLOCK_TASK] = new_task(64, rtctask);
|
#endif
|
#endif
|
|
|
#ifdef DOORBELL_TASK
|
#ifdef DOORBELL_TASK
|
#ifdef DISPLAY_TASK
|
#ifdef DISPLAY_TASK
|
// 13 + 10 +9(uwrite)+4(uarthex)+2(uartstr)+2(uartchr)
|
// Stack = 36 + 36 (uread/write) + 24(memcpy) + 32(uarthex)+8(uartchr)
|
tasklist[DOORBELL_TASK] = new_task(96, doorbell_task);
|
tasklist[DOORBELL_TASK] = new_task(256, doorbell_task);
|
// tasklist[DOORBELL_TASK]->fd[FILENO_STDOUT]= kopen((int)lcdpipe,pipedev);
|
// tasklist[DOORBELL_TASK]->fd[FILENO_STDOUT]= kopen((int)lcdpipe,pipedev);
|
tasklist[DOORBELL_TASK]->fd[FILENO_STDERR]= kopen((int)txpipe, pipedev);
|
tasklist[DOORBELL_TASK]->fd[FILENO_STDERR]= kopen((int)txpipe, pipedev);
|
tasklist[DOORBELL_TASK]->fd[FILENO_AUX] = kopen((int)pwmpipe, pipedev);
|
tasklist[DOORBELL_TASK]->fd[FILENO_AUX] = kopen((int)pwmpipe, pipedev);
|
|
|
//
|
// Stack = 16 + 36(uread/write) + 24(memcpy)
|
tasklist[DISPLAY_TASK] = new_task(32, display_task);
|
tasklist[DISPLAY_TASK] = new_task(128, display_task);
|
tasklist[DISPLAY_TASK]->fd[FILENO_STDIN] = kopen((int)lcdpipe,pipedev);
|
tasklist[DISPLAY_TASK]->fd[FILENO_STDIN] = kopen((int)lcdpipe,pipedev);
|
#endif
|
#endif
|
#endif
|
#endif
|
|
|
|
|
#ifdef KEYPAD_TASK
|
#ifdef KEYPAD_TASK
|
// Stack = 7 + 9(uwrite) + 2*4
|
// Stack = 28 + 36(uwrite) + 24(memcpy) = 88 bytes
|
tasklist[KEYPAD_TASK] = new_task(32, keypad_task);
|
tasklist[KEYPAD_TASK] = new_task(128, keypad_task);
|
tasklist[KEYPAD_TASK]->fd[FILENO_STDOUT] = kopen((int)keypipe,pipedev);
|
tasklist[KEYPAD_TASK]->fd[FILENO_STDOUT] = kopen((int)keypipe,pipedev);
|
#endif
|
#endif
|
#ifdef MENU_TASK
|
#ifdef MENU_TASK
|
// Stack = 18 + 10(showbell/shownow) + 9(uwrite) + 2(menu_readkey)
|
// Stack = 76 + 48(showbell/shownow)
|
// + 18 (time_menu/dawn_menu/dusk_menu)
|
// + 36(uwrite)
|
tasklist[MENU_TASK] = new_task(72, menu_task);
|
// + 8(menu_readkey)
|
|
// + 24(memcpy)
|
|
// +100(time_menu/dawn_menu/dusk_menu)
|
|
//
|
|
tasklist[MENU_TASK] = new_task(512, menu_task);
|
// tasklist[MENU_TASK]->fd[FILENO_STDIN] = kopen((int)keypipe,pipedev);
|
// tasklist[MENU_TASK]->fd[FILENO_STDIN] = kopen((int)keypipe,pipedev);
|
tasklist[MENU_TASK]->fd[FILENO_STDOUT]= kopen((int)lcdpipe,pipedev);
|
tasklist[MENU_TASK]->fd[FILENO_STDOUT]= kopen((int)lcdpipe,pipedev);
|
tasklist[MENU_TASK]->fd[FILENO_STDERR]= kopen((int)txpipe, pipedev);
|
tasklist[MENU_TASK]->fd[FILENO_STDERR]= kopen((int)txpipe, pipedev);
|
#endif
|
#endif
|
|
|
|
#ifdef HELLO_TASK
|
|
tasklist[HELLO_TASK] = new_task(512, hello_task);
|
|
tasklist[HELLO_TASK]->fd[FILENO_STDOUT]= kopen((int)txpipe,pipedev);
|
|
#endif
|
}
|
}
|
|
|
// #define HALF_HOUR_S 1800 // Seconds per half hour
|
// #define HALF_HOUR_S 1800 // Seconds per half hour
|
// #define HALF_HOUR_S 180 // Seconds per three minutes--for test
|
// #define HALF_HOUR_S 180 // Seconds per three minutes--for test
|
#define HALF_HOUR_S 30 // 3 Mins is to long, here's 3 seconds
|
#define HALF_HOUR_S 30 // 3 Mins is to long, here's 3 seconds
|
Line 221... |
Line 246... |
unsigned dawn = 0x060000, dusk = 0x180000;
|
unsigned dawn = 0x060000, dusk = 0x180000;
|
#else
|
#else
|
const unsigned dawn = 0x060000, dusk = 0x180000;
|
const unsigned dawn = 0x060000, dusk = 0x180000;
|
#endif
|
#endif
|
|
|
void shownow(unsigned now) { // Uses 10 stack slots + 8 for write()
|
const char basemsg[] = "\e[jTime: xx:xx:xx\e[1;0H ";
|
char dmsg[9];
|
const char nighttime[] = "Night time";
|
dmsg[0] = PACK(0x1b,'[','j','T');
|
const char daylight[] = "Daylight!";
|
dmsg[1] = PACK('i','m','e',':');
|
const char dbellstr[] = "Doorbell!";
|
dmsg[2] = PACK(' ',((now>>20)&0x3)+'0',
|
void shownow(unsigned now) {
|
((now>>16)&0xf)+'0',':');
|
char dmsg[40];
|
dmsg[3] = PACK( ((now>>12)&0xf)+'0',
|
strcpy(dmsg, basemsg);
|
((now>> 8)&0xf)+'0',
|
|
':',
|
dmsg[ 9] = ((now>>20)&0x0f)+'0';
|
((now>> 4)&0xf)+'0');
|
dmsg[10] = ((now>>16)&0x0f)+'0';
|
dmsg[4] = PACK( ((now )&0xf)+'0',
|
//
|
0x1b, '[', '1');
|
dmsg[12] = ((now>>12)&0x0f)+'0';
|
dmsg[5] = PACK(';','0','H',' ');
|
dmsg[13] = ((now>> 8)&0x0f)+'0';
|
|
//
|
|
dmsg[15] = ((now>> 4)&0x0f)+'0';
|
|
dmsg[16] = ((now )&0x0f)+'0';
|
|
|
if ((now < dawn)||(now > dusk)) {
|
if ((now < dawn)||(now > dusk)) {
|
dmsg[6] = PACK('N','i','g','h');
|
strcat(dmsg, nighttime);
|
dmsg[7] = PACK('t',' ','t','i');
|
|
dmsg[8] = PACK('m','e',0,0);
|
|
} else {
|
} else {
|
dmsg[6] = PACK('D','a','y','l');
|
strcat(dmsg, daylight);
|
dmsg[7] = PACK('i','g','h','t');
|
} write(FILENO_STDOUT, dmsg, strlen(dmsg));
|
dmsg[8] = PACK('!',' ',0,0);
|
|
} write(FILENO_STDOUT, dmsg, 9);
|
|
}
|
}
|
|
|
void showbell(unsigned now) { // Uses 10 stack slots + 8 for write()
|
void showbell(unsigned now) { // Uses 10 stack slots + 8 for write()
|
char dmsg[9];
|
char dmsg[40];
|
dmsg[0] = PACK(0x1b,'[','j','T');
|
|
dmsg[1] = PACK('i','m','e',':');
|
strcpy(dmsg, basemsg);
|
dmsg[2] = PACK(' ',((now>>20)&0x3)+'0',
|
|
((now>>16)&0xf)+'0',':');
|
dmsg[ 9] = ((now>>20)&0x0f)+'0';
|
dmsg[3] = PACK( ((now>>12)&0xf)+'0',
|
dmsg[10] = ((now>>16)&0x0f)+'0';
|
((now>> 8)&0xf)+'0',
|
//
|
':',
|
dmsg[12] = ((now>>12)&0x0f)+'0';
|
((now>> 4)&0xf)+'0');
|
dmsg[13] = ((now>> 8)&0x0f)+'0';
|
dmsg[4] = PACK( ((now )&0xf)+'0',
|
//
|
0x1b, '[', '1');
|
dmsg[15] = ((now>> 4)&0x0f)+'0';
|
dmsg[5] = PACK(';','0','H',' ');
|
dmsg[16] = ((now )&0x0f)+'0';
|
dmsg[6] = PACK('D','o','o','r');
|
|
dmsg[7] = PACK('b','e','l','l');
|
strcat(dmsg, dbellstr);
|
dmsg[8] = PACK('!',' ',0,0);
|
write(FILENO_STDOUT, dmsg, strlen(dmsg));
|
write(FILENO_STDOUT, dmsg, 9);
|
|
}
|
}
|
|
|
void uartchr(char v) {
|
void uartchr(char v) {
|
if (write(FILENO_STDERR, &v, 1) != 1)
|
if (write(FILENO_STDERR, &v, 1) != 1)
|
write(FILENO_STDERR, "APPLE-PANIC", 11);
|
write(FILENO_STDERR, "APPLE-PANIC\r\n", 13);
|
}
|
}
|
|
|
void uartstr(const char *str) {
|
void uartstr(const char *str) {
|
int cnt=0;
|
int cnt;
|
while(str[cnt])
|
cnt = strlen(str);
|
cnt++;
|
|
if (cnt != write(FILENO_STDERR, str, cnt))
|
if (cnt != write(FILENO_STDERR, str, cnt))
|
write(FILENO_STDERR, "PIPE-PANIC", 10);
|
write(FILENO_STDERR, "PIPE-PANIC\r\n", 12);
|
}
|
}
|
|
|
void uarthex(int num) {
|
void uarthex(int num) {
|
for(int ds=28; ds>=0; ds-=4) {
|
for(int ds=28; ds>=0; ds-=4) {
|
int ch;
|
int ch;
|
Line 293... |
Line 316... |
|
|
#ifdef DOORBELL_TASK
|
#ifdef DOORBELL_TASK
|
#include "../dev/samples.c"
|
#include "../dev/samples.c"
|
|
|
void belllight(unsigned now) {
|
void belllight(unsigned now) {
|
IOSPACE *sys = (IOSPACE *)IOADDR;
|
|
if ((now < dawn)||(now > dusk))
|
if ((now < dawn)||(now > dusk))
|
sys->io_spio = 0x088; // Turn our light on
|
_sys->io_spio = 0x088; // Turn our light on
|
else
|
else
|
sys->io_spio = 0x80; // Turn light off
|
_sys->io_spio = 0x80; // Turn light off
|
}
|
}
|
|
|
void doorbell_task(void) {
|
void doorbell_task(void) {
|
// Controls LED 0x08
|
// Controls LED 0x08
|
|
|
// Start by initializing the display to GT Gisselquist\nTechnology
|
// Start by initializing the display to GT Gisselquist\nTechnology
|
// write(KFD_STDOUT, disp_build_backslash,sizeof(disp_build_backslash));
|
// write(KFD_STDOUT, disp_build_backslash,sizeof(disp_build_backslash));
|
// write(KFD_STDOUT, disp_build_gtlogo, sizeof(disp_build_gtlogo));
|
// write(KFD_STDOUT, disp_build_gtlogo, sizeof(disp_build_gtlogo));
|
// write(KFD_STDOUT, disp_reset_data, sizeof(disp_reset_data));
|
// write(KFD_STDOUT, disp_reset_data, sizeof(disp_reset_data));
|
// write(KFD_STDOUT, disp_gtech_data, sizeof(disp_gtech_data));
|
// write(KFD_STDOUT, disp_gtech_data, sizeof(disp_gtech_data));
|
IOSPACE *sys = (IOSPACE *)IOADDR;
|
|
|
|
while(1) {
|
while(1) {
|
int event;
|
int event;
|
// Initial state: doorbell is not ringing. In this state, we
|
// Initial state: doorbell is not ringing. In this state, we
|
// can wait forever for an event
|
// can wait forever for an event
|
sys->io_spio = 0x080; // Turn our light off
|
_sys->io_spio = 0x080; // Turn our light off
|
event = wait(INT_BUTTON|SWINT_PPS,-1);
|
event = wait(INT_BUTTON|SWINT_PPS,-1);
|
|
|
#ifndef MENU_TASK
|
#ifndef MENU_TASK
|
unsigned when = rtcclock;
|
unsigned when = rtcclock;
|
if (event & INT_BUTTON)
|
if (event & INT_BUTTON)
|
Line 338... |
Line 359... |
// button was last pressed.
|
// button was last pressed.
|
int seconds = 0;
|
int seconds = 0;
|
|
|
// Check time: should we turn our light on or not?
|
// Check time: should we turn our light on or not?
|
belllight((volatile unsigned)rtcclock);
|
belllight((volatile unsigned)rtcclock);
|
const int *sptr = sound_data;
|
const short *sptr = sound_data;
|
// uartchr('N');
|
|
while(sptr < &sound_data[NSAMPLE_WORDS]) {
|
while(sptr < &sound_data[NSAMPLE_WORDS]) {
|
int len = &sound_data[NSAMPLE_WORDS]-sptr;
|
int len = &sound_data[NSAMPLE_WORDS]-sptr;
|
if (len > 256)
|
if (len > 512)
|
len = 256;
|
len = 512;
|
|
|
// We will stall here, if the audio FIFO is full
|
// We will stall here, if the audio FIFO is full
|
write(FILENO_AUX, sptr, len);
|
write(FILENO_AUX, sptr,
|
|
sizeof(sound_data[0])*len);
|
sptr += len;
|
sptr += len;
|
|
|
// If the user presses the button more than
|
// If the user presses the button more than
|
// once, we start the sound over as well as
|
// once, we start the sound over as well as
|
// our light counter.
|
// our light counter.
|
Line 396... |
Line 417... |
}
|
}
|
}
|
}
|
#endif
|
#endif
|
|
|
#ifdef MENU_TASK
|
#ifdef MENU_TASK
|
|
const char menustr[] = "\e[1;0H : ";
|
|
|
void entered_menu_str(char *str, unsigned now,int pos) {
|
void entered_menu_str(char *str, unsigned now,int pos) {
|
//
|
//
|
// Set current time
|
// Set current time
|
// xx:xx:xx
|
// xx:xx:xx
|
//
|
//
|
str[0] = PACK(0x1b, '[', '1',';');
|
strcpy(str, menustr);
|
str[1] = PACK('0','H',' ',' ');
|
|
str[2] = PACK(' ','x','x',':');
|
|
str[3] = PACK('x','x',' ',' ');
|
|
//str[3]=PACK('x','x',':','x');
|
|
str[4] = PACK(' ','\0','\0','\0');
|
|
|
|
if (pos>0) {
|
if (pos>0) {
|
int ch = ((now >> 20)&0x0f)+'0';
|
int ch = ((now >> 20)&0x0f)+'0';
|
str[2] &= ~0x0ff0000;
|
str[9] = ch;
|
str[2] |= (ch<<16);
|
|
|
|
if (pos > 1) {
|
if (pos > 1) {
|
int ch = ((now >> 16)&0x0f)+'0';
|
ch = ((now >> 16)&0x0f)+'0';
|
str[2] &= ~0x0ff00;
|
str[10] = ch;
|
str[2] |= (ch<<8);
|
|
|
|
if (pos > 2) {
|
if (pos > 2) {
|
int ch = ((now >> 12)&0x0f)+'0';
|
ch = ((now >> 12)&0x0f)+'0';
|
str[3] &= ~0xff000000;
|
str[12] = ch;
|
str[3] |= (ch<<24);
|
|
|
|
if (pos > 3) {
|
if (pos > 3) {
|
int ch = ((now >> 8)&0x0f)+'0';
|
int ch = ((now >> 8)&0x0f)+'0';
|
str[3] &= ~0x0ff0000;
|
str[13] = ch;
|
str[3] |= (ch<<16);
|
|
|
|
if (pos > 4) {
|
if (pos > 4) {
|
int ch = ((now >> 4)&0x0f)+'0';
|
ch = ((now >> 4)&0x0f)+'0';
|
str[3] &= ~0x0ff00;
|
str[15] = ch;
|
str[3] |= ':'<<8;
|
str[14] = ':';
|
str[3] &= ~0x0ff;
|
|
str[3] |= (ch);
|
|
|
|
if (pos > 5)
|
if (pos > 5)
|
ch = (now&0x0f)+'0';
|
ch = (now&0x0f)+'0';
|
else
|
else
|
ch = 'x';
|
ch = 'x';
|
str[4] &= ~0x0ff000000;
|
str[16] = ch;
|
str[4] |= (ch<<24);
|
}}}}} str[17] = '\0';
|
}}}}}
|
|
}
|
}
|
|
|
|
const char timmenu[] = "\e[jSet current time:";
|
|
|
void show_time_menu(unsigned when, int posn) {
|
void show_time_menu(unsigned when, int posn) {
|
char dmsg[10];
|
char dmsg[64];
|
dmsg[0] = PACK(0x1b,'[','j','S');
|
strcpy(dmsg, timmenu);
|
dmsg[1] = PACK('e','t',' ','c');
|
entered_menu_str(&dmsg[20], when, posn);
|
dmsg[2] = PACK('u','r','r','e');
|
write(FILENO_STDOUT, dmsg, strlen(dmsg));
|
dmsg[3] = PACK('n','t',' ','t');
|
|
dmsg[4] = PACK('i','m','e',':');
|
|
entered_menu_str(&dmsg[5], when, posn);
|
|
write(FILENO_STDOUT, dmsg, 9);
|
|
}
|
}
|
|
|
|
const char dawnmenu[] = "\e[jSet sunrise: ";
|
void show_dawn_menu(unsigned when, int posn) {
|
void show_dawn_menu(unsigned when, int posn) {
|
char dmsg[10];
|
char dmsg[64];
|
dmsg[0] = PACK(0x1b,'[','j','S');
|
strcpy(dmsg, dawnmenu);
|
dmsg[1] = PACK('e','t',' ','s');
|
entered_menu_str(&dmsg[16], when, posn);
|
dmsg[2] = PACK('u','n','r','i');
|
write(FILENO_STDOUT, dmsg, strlen(dmsg));
|
dmsg[3] = PACK('s','e',':','\0');
|
|
entered_menu_str(&dmsg[4], when, posn);
|
|
write(FILENO_STDOUT, dmsg, 8);
|
|
}
|
}
|
|
|
|
const char duskmenu[] = "\e[;Set sunset: ";
|
void show_dusk_menu(unsigned when, int posn) {
|
void show_dusk_menu(unsigned when, int posn) {
|
char dmsg[10];
|
char dmsg[64];
|
dmsg[0] = PACK(0x1b,'[','j','S');
|
entered_menu_str(&dmsg[15], when, posn);
|
dmsg[1] = PACK('e','t',' ','s');
|
write(FILENO_STDOUT, dmsg, strlen(dmsg));
|
dmsg[2] = PACK('u','n','s','e');
|
|
dmsg[3] = PACK('t',':','\0','\0');
|
|
entered_menu_str(&dmsg[4], when, posn);
|
|
write(FILENO_STDOUT, dmsg, 8);
|
|
}
|
}
|
|
|
int menu_readkey(void) {
|
int menu_readkey(void) {
|
int key;
|
int key;
|
wait(0,3);
|
wait(0,3);
|
Line 603... |
Line 606... |
}
|
}
|
} while(0 == (event&INT_KEYPAD));
|
} while(0 == (event&INT_KEYPAD));
|
} dusk = newdusk;
|
} dusk = newdusk;
|
}
|
}
|
|
|
|
const char unknownstr[] = "\e[jUnknown Cmd Key\e[1;0HA/Tm B/Dwn C/Dsk";
|
void unknown_menu(void) {
|
void unknown_menu(void) {
|
// 0123456789ABCDEF
|
// 0123456789ABCDEF
|
// Unknown Cmd Key
|
// Unknown Cmd Key
|
// A/Tm B/Dwn C/Dsk
|
// A/Tm B/Dwn C/Dsk
|
char dmsg[11];
|
write(FILENO_STDOUT, unknownstr, strlen(unknownstr));
|
dmsg[0] = PACK(0x1b,'[','j','U');
|
|
dmsg[1] = PACK('n','k','n','o');
|
|
dmsg[2] = PACK('w','n',' ','C');
|
|
dmsg[3] = PACK('m','d',' ','K');
|
|
dmsg[4] = PACK('e','y','\0','\0');
|
|
dmsg[5] = PACK(0x1b,'[','1',';');
|
|
dmsg[6] = PACK('0','H','A','/');
|
|
dmsg[7] = PACK('T','m',' ','B');
|
|
dmsg[8] = PACK('/','D','w','n');
|
|
dmsg[9] = PACK(' ','C','/','D');
|
|
dmsg[10] = PACK('s','k',0,0);
|
|
write(FILENO_STDOUT, dmsg, 11);
|
|
}
|
}
|
void menu_task(void) {
|
void menu_task(void) {
|
// Controls LED 0x08
|
// Controls LED 0x08
|
|
|
// Start by initializing the display to GT Gisselquist\nTechnology
|
// Start by initializing the display to GT Gisselquist\nTechnology
|
// write(KFD_STDOUT, disp_build_backslash,sizeof(disp_build_backslash));
|
// write(KFD_STDOUT, disp_build_backslash,sizeof(disp_build_backslash));
|
// write(KFD_STDOUT, disp_build_gtlogo, sizeof(disp_build_gtlogo));
|
// write(KFD_STDOUT, disp_build_gtlogo, sizeof(disp_build_gtlogo));
|
// write(KFD_STDOUT, disp_reset_data, sizeof(disp_reset_data));
|
// write(KFD_STDOUT, disp_reset_data, sizeof(disp_reset_data));
|
// write(KFD_STDOUT, disp_gtech_data, sizeof(disp_gtech_data));
|
// write(KFD_STDOUT, disp_gtech_data, sizeof(disp_gtech_data));
|
// IOSPACE *sys = (IOSPACE *)IOADDR;
|
|
unsigned belltime = 0, when;
|
unsigned belltime = 0, when;
|
|
|
|
|
when = (volatile unsigned)rtcclock;
|
when = (volatile unsigned)rtcclock;
|
while(1) {
|
while(1) {
|
int event;
|
int event;
|
// Initial state: doorbell is not ringing. In this state, we
|
// Initial state: doorbell is not ringing. In this state, we
|
// can wait forever for an event
|
// can wait forever for an event
|
Line 671... |
Line 661... |
}
|
}
|
}
|
}
|
#endif
|
#endif
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|
|
#ifdef HELLO_TASK
|
|
static const char *hello_string = "Hello, World!\r\n";
|
|
void hello_task(void) {
|
|
while(1) {
|
|
for(int i=0; i<15; i++)
|
|
wait(SWINT_CLOCK, -1);
|
|
write(FILENO_STDOUT, hello_string, strlen(hello_string));
|
|
}
|
|
}
|
|
#endif
|
|
|
No newline at end of file
|
No newline at end of file
|