Initial Import from SVN
This commit is contained in:
114
include/smallc/curses.h
Normal file
114
include/smallc/curses.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* SmallC: interface to curses library.
|
||||
*/
|
||||
#define WINDOW int
|
||||
|
||||
extern WINDOW *stdscr, *curscr;
|
||||
|
||||
extern int LINES, COLS;
|
||||
|
||||
/*
|
||||
* pseudo functions for standard screen
|
||||
*/
|
||||
#define addch(ch) waddch(stdscr, ch)
|
||||
#define getch() wgetch(stdscr)
|
||||
#define addstr(str) waddstr(stdscr, str)
|
||||
#define getstr(str) wgetstr(stdscr, str)
|
||||
#define move(y, x) wmove(stdscr, y, x)
|
||||
#define clear() wclear(stdscr)
|
||||
#define erase() werase(stdscr)
|
||||
#define clrtobot() wclrtobot(stdscr)
|
||||
#define clrtoeol() wclrtoeol(stdscr)
|
||||
#define insertln() winsertln(stdscr)
|
||||
#define deleteln() wdeleteln(stdscr)
|
||||
#define refresh() wrefresh(stdscr)
|
||||
#define inch() winch(stdscr)
|
||||
#define insch(c) winsch(stdscr,c)
|
||||
#define delch() wdelch(stdscr)
|
||||
#define standout() wstandout(stdscr)
|
||||
#define standend() wstandend(stdscr)
|
||||
|
||||
/*
|
||||
* mv functions
|
||||
*/
|
||||
#define mvwaddch(win,y,x,ch) wmove(win,y,x) == 0 ? 0 : waddch(win,ch)
|
||||
#define mvwgetch(win,y,x) wmove(win,y,x) == 0 ? 0 : wgetch(win)
|
||||
#define mvwaddstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : waddstr(win,str)
|
||||
#define mvwgetstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : wgetstr(win,str)
|
||||
#define mvwinch(win,y,x) wmove(win,y,x) == 0 ? 0 : winch(win)
|
||||
#define mvwdelch(win,y,x) wmove(win,y,x) == 0 ? 0 : wdelch(win)
|
||||
#define mvwinsch(win,y,x,c) wmove(win,y,x) == 0 ? 0 : winsch(win,c)
|
||||
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
|
||||
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
|
||||
#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
|
||||
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
|
||||
#define mvinch(y,x) mvwinch(stdscr,y,x)
|
||||
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
|
||||
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
|
||||
|
||||
#ifdef TODO
|
||||
|
||||
#define TRUE (1)
|
||||
#define FALSE (0)
|
||||
#define ERR (0)
|
||||
#define OK (1)
|
||||
|
||||
/*
|
||||
* Capabilities from termcap
|
||||
*/
|
||||
extern int AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
|
||||
XB, XN, XT, XS, XX;
|
||||
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
|
||||
*DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
|
||||
*K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
|
||||
*KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
|
||||
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
|
||||
*VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
|
||||
*LEFT_PARM, *RIGHT_PARM;
|
||||
extern char PC;
|
||||
|
||||
/*
|
||||
* From the tty modes...
|
||||
*/
|
||||
extern int GT, NONL, UPPERCASE, normtty, _pfast;
|
||||
|
||||
extern int My_term, _echoit, _rawmode, _endwin;
|
||||
|
||||
extern char *Def_term, ttytype[];
|
||||
|
||||
extern int _tty_ch, _res_flg;
|
||||
|
||||
extern SGTTY _tty;
|
||||
|
||||
/*
|
||||
* pseudo functions
|
||||
*/
|
||||
#define clearok(win,bf) (win->_clear = bf)
|
||||
#define leaveok(win,bf) (win->_leave = bf)
|
||||
#define scrollok(win,bf) (win->_scroll = bf)
|
||||
#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
|
||||
#define getyx(win,y,x) y = win->_cury, x = win->_curx
|
||||
#define winch(win) (win->_y[win->_cury][win->_curx] & 0177)
|
||||
|
||||
#define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
|
||||
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
|
||||
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
|
||||
#define erasechar() (_tty.sg_erase)
|
||||
#define killchar() (_tty.sg_kill)
|
||||
#define baudrate() (_tty.sg_ospeed)
|
||||
|
||||
/*
|
||||
* Used to be in unctrl.h.
|
||||
*/
|
||||
#define unctrl(c) _unctrl[(c) & 0177]
|
||||
extern char *_unctrl[];
|
||||
|
||||
#endif
|
||||
38
include/smallc/fcntl.h
Normal file
38
include/smallc/fcntl.h
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
/* open-only flags */
|
||||
#define O_RDONLY 0x0000 /* open for reading only */
|
||||
#define O_WRONLY 0x0001 /* open for writing only */
|
||||
#define O_RDWR 0x0002 /* open for reading and writing */
|
||||
#define O_ACCMODE 0x0003 /* mask for above modes */
|
||||
|
||||
#define O_NONBLOCK 0x0004 /* no delay */
|
||||
#define O_APPEND 0x0008 /* set append mode */
|
||||
#define O_SHLOCK 0x0010 /* open with shared file lock */
|
||||
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
|
||||
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
|
||||
#define O_FSYNC 0x0080 /* synchronous writes */
|
||||
#define O_CREAT 0x0200 /* create if nonexistant */
|
||||
#define O_TRUNC 0x0400 /* truncate to zero length */
|
||||
#define O_EXCL 0x0800 /* error if already exists */
|
||||
|
||||
/*
|
||||
* Constants used for fcntl(2)
|
||||
*/
|
||||
|
||||
/* command values */
|
||||
#define F_DUPFD 0 /* duplicate file descriptor */
|
||||
#define F_GETFD 1 /* get file descriptor flags */
|
||||
#define F_SETFD 2 /* set file descriptor flags */
|
||||
#define F_GETFL 3 /* get file status flags */
|
||||
#define F_SETFL 4 /* set file status flags */
|
||||
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
|
||||
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
|
||||
|
||||
/* file descriptor flags (F_GETFD, F_SETFD) */
|
||||
#define FD_CLOEXEC 1 /* close-on-exec flag */
|
||||
|
||||
/* lock operations for flock() */
|
||||
#define LOCK_SH 1 /* shared file lock */
|
||||
#define LOCK_EX 2 /* exclusive file lock */
|
||||
#define LOCK_NB 4 /* don't block when locking */
|
||||
#define LOCK_UN 8 /* unlock file */
|
||||
77
include/smallc/signal.h
Normal file
77
include/smallc/signal.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 1986 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
#ifndef NSIG
|
||||
|
||||
#define NSIG 32
|
||||
|
||||
#define SIGHUP 1 /* hangup */
|
||||
#define SIGINT 2 /* interrupt */
|
||||
#define SIGQUIT 3 /* quit */
|
||||
#define SIGILL 4 /* illegal instruction (not reset when caught) */
|
||||
#define SIGTRAP 5 /* trace trap (not reset when caught) */
|
||||
#define SIGIOT 6 /* IOT instruction */
|
||||
#define SIGABRT SIGIOT /* compatibility */
|
||||
#define SIGEMT 7 /* EMT instruction */
|
||||
#define SIGFPE 8 /* floating point exception */
|
||||
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
|
||||
#define SIGBUS 10 /* bus error */
|
||||
#define SIGSEGV 11 /* segmentation violation */
|
||||
#define SIGSYS 12 /* bad argument to system call */
|
||||
#define SIGPIPE 13 /* write on a pipe with no one to read it */
|
||||
#define SIGALRM 14 /* alarm clock */
|
||||
#define SIGTERM 15 /* software termination signal from kill */
|
||||
#define SIGURG 16 /* urgent condition on IO channel */
|
||||
#define SIGSTOP 17 /* sendable stop signal not from tty */
|
||||
#define SIGTSTP 18 /* stop signal from tty */
|
||||
#define SIGCONT 19 /* continue a stopped process */
|
||||
#define SIGCHLD 20 /* to parent on child stop or exit */
|
||||
#define SIGCLD SIGCHLD /* compatibility */
|
||||
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
|
||||
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
|
||||
#define SIGIO 23 /* input/output possible signal */
|
||||
#define SIGXCPU 24 /* exceeded CPU time limit */
|
||||
#define SIGXFSZ 25 /* exceeded file size limit */
|
||||
#define SIGVTALRM 26 /* virtual time alarm */
|
||||
#define SIGPROF 27 /* profiling time alarm */
|
||||
#define SIGWINCH 28 /* window size changes */
|
||||
#define SIGUSR1 30 /* user defined signal 1 */
|
||||
#define SIGUSR2 31 /* user defined signal 2 */
|
||||
|
||||
#define SIG_ERR -1
|
||||
#define SIG_DFL 0
|
||||
#define SIG_IGN 1
|
||||
#define BADSIG SIG_ERR
|
||||
|
||||
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
|
||||
#define SA_RESTART 0x0002 /* restart system on signal return */
|
||||
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
|
||||
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
|
||||
|
||||
/*
|
||||
* Flags for sigprocmask:
|
||||
*/
|
||||
#define SIG_BLOCK 1 /* block specified signal set */
|
||||
#define SIG_UNBLOCK 2 /* unblock specified signal set */
|
||||
#define SIG_SETMASK 3 /* set specified signal set */
|
||||
|
||||
#define MINSIGSTKSZ 128 /* minimum allowable stack */
|
||||
#define SIGSTKSZ (MINSIGSTKSZ + 384) /* recommended stack size */
|
||||
|
||||
#define SV_ONSTACK SA_ONSTACK /* take signal on signal stack */
|
||||
#define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
|
||||
|
||||
/*
|
||||
* Macro for converting signal number to a mask suitable for
|
||||
* sigblock().
|
||||
*/
|
||||
#define sigmask(m) (1L << ((m)-1))
|
||||
#define sigaddset(set, signo) (*(set) |= 1L << ((signo) - 1), 0)
|
||||
#define sigdelset(set, signo) (*(set) &= ~(1L << ((signo) - 1)), 0)
|
||||
#define sigemptyset(set) (*(set) = (sigset_t)0, (int)0)
|
||||
#define sigfillset(set) (*(set) = ~(sigset_t)0, (int)0)
|
||||
#define sigismember(set, signo) ((*(set) & (1L << ((signo) - 1))) != 0)
|
||||
|
||||
#endif /* NSIG */
|
||||
24
include/smallc/stdio.h
Normal file
24
include/smallc/stdio.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* SmallC: interface to stdio library.
|
||||
*/
|
||||
#define BUFSIZ 1024
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define FILE int
|
||||
#define EOF (-1)
|
||||
|
||||
extern int _iob[];
|
||||
|
||||
#define stdin (&_iob[0])
|
||||
#define stdout (&_iob[5])
|
||||
#define stderr (&_iob[10])
|
||||
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
|
||||
#define getc fgetc
|
||||
#define putc fputc
|
||||
22
include/smallc/sys/gpio.h
Normal file
22
include/smallc/sys/gpio.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Ioctl definitions for GPIO driver.
|
||||
*/
|
||||
#define GPIO_PORT(n) (n) /* port number */
|
||||
#define GPIO_PORTA 0
|
||||
#define GPIO_PORTB 1
|
||||
#define GPIO_PORTC 2
|
||||
#define GPIO_PORTD 3
|
||||
#define GPIO_PORTE 4
|
||||
#define GPIO_PORTF 5
|
||||
#define GPIO_PORTG 6
|
||||
|
||||
#define GPIO_CONFIN 0x20016700 /* configure as input */
|
||||
#define GPIO_CONFOUT 0x20026700 /* configure as output */
|
||||
#define GPIO_CONFOD 0x20046700 /* configure as open drain */
|
||||
#define GPIO_DECONF 0x20086700 /* deconfigure */
|
||||
#define GPIO_STORE 0x20106700 /* store all outputs */
|
||||
#define GPIO_SET 0x20206700 /* set to 1 by mask */
|
||||
#define GPIO_CLEAR 0x20406700 /* set to 0 by mask */
|
||||
#define GPIO_INVERT 0x20806700 /* invert by mask */
|
||||
#define GPIO_POLL 0x21006700 /* poll */
|
||||
#define GPIO_LOL 0x82006700 /* display lol picture */
|
||||
9
include/smallc/sys/spi.h
Normal file
9
include/smallc/sys/spi.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Ioctl definitions for SPI driver.
|
||||
*/
|
||||
#define SPICTL_SETMODE 0x20007000 /* set SPI mode */
|
||||
#define SPICTL_SETRATE 0x20007001 /* set clock rate, kHz */
|
||||
#define SPICTL_SETSELPIN 0x20007002 /* set select pin */
|
||||
#define SPICTL_IO8(n) (0xc0007003 | (n)<<16) /* transfer n*8 bits */
|
||||
#define SPICTL_IO16(n) (0xc0007004 | (n)<<16) /* transfer n*16 bits */
|
||||
#define SPICTL_IO32(n) (0xc0007005 | (n)<<16) /* transfer n*32 bits */
|
||||
12
include/smallc/wiznet.h
Normal file
12
include/smallc/wiznet.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SmallC: interface to wiznet library.
|
||||
*/
|
||||
#define MAX_SOCK_NUM 4 /* Max number of sockets per chip */
|
||||
#define CLIENT_SIZE 3 /* Size of client structure in words */
|
||||
#define UDP_SIZE 2 /* Size of UDP structure in words */
|
||||
|
||||
extern unsigned _socket_port[];
|
||||
|
||||
extern unsigned _client_srcport;
|
||||
|
||||
extern unsigned _server_port;
|
||||
Reference in New Issue
Block a user