URL
https://opencores.org/ocsvn/s6soc/s6soc/trunk
Subversion Repositories s6soc
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 27 to Rev 26
- ↔ Reverse comparison
Rev 27 → Rev 26
/s6soc/trunk/sw/zipos/ksetup.c
File deleted
/s6soc/trunk/sw/zipos/bootloader.c
File deleted
/s6soc/trunk/sw/zipos/cmodram.ld
File deleted
/s6soc/trunk/sw/zipos/pipesetup.c
File deleted
/s6soc/trunk/sw/zipos/syspipe.h
80,7 → 80,6
int m_head, m_tail; |
volatile TASKP m_rdtask, m_wrtask; |
unsigned int m_nread, m_nwritten; |
int dummy; |
int m_error; |
|
int m_buf[1]; |
/s6soc/trunk/sw/zipos/doorbell.c
170,14 → 170,11
|
#ifdef DOORBELL_TASK |
#ifdef DISPLAY_TASK |
// 13 + 10 +9(uwrite)+4(uarthex)+2(uartstr)+2(uartchr) |
// |
tasklist[DOORBELL_TASK] = new_task(64, doorbell_task); |
tasklist[DOORBELL_TASK]->fd[FILENO_STDOUT] = sys_malloc(sizeof(KFILDES)); |
tasklist[DOORBELL_TASK]->fd[FILENO_STDOUT]->id = (int)lcdpipe; |
tasklist[DOORBELL_TASK]->fd[FILENO_STDOUT]->dev= pipedev; |
tasklist[DOORBELL_TASK]->fd[FILENO_STDERR] = sys_malloc(sizeof(KFILDES)); |
tasklist[DOORBELL_TASK]->fd[FILENO_STDERR]->id = (int)txpipe; |
tasklist[DOORBELL_TASK]->fd[FILENO_STDERR]->dev= pipedev; |
tasklist[DOORBELL_TASK]->fd[FILENO_AUX] = sys_malloc(sizeof(KFILDES)); |
tasklist[DOORBELL_TASK]->fd[FILENO_AUX]->id = (int)pwmpipe; |
tasklist[DOORBELL_TASK]->fd[FILENO_AUX]->dev= pipedev; |
207,7 → 204,6
#include "../dev/samples.c" |
|
const unsigned dawn = 0x060000, dusk = 0x180000; |
int nwritten = 0, nread = 0, nstarts = 0; |
|
void shownow(unsigned now) { // Uses 10 stack slots + 8 for write() |
char dmsg[9]; |
260,31 → 256,6
sys->io_spio = 0x80; // Turn light off |
} |
|
void uartchr(char v) { |
if (write(FILENO_STDERR, &v, 1) != 1) |
write(FILENO_STDERR, "APPLE-PANIC", 11); |
} |
|
void uartstr(const char *str) { |
int cnt=0; |
while(str[cnt]) |
cnt++; |
if (cnt != write(FILENO_STDERR, str, cnt)) |
write(FILENO_STDERR, "PIPE-PANIC", 10); |
} |
|
void uarthex(int num) { |
for(int ds=28; ds>=0; ds-=4) { |
int ch; |
ch = (num>>ds)&0x0f; |
if (ch >= 10) |
ch = 'A'+ch-10; |
else |
ch += '0'; |
uartchr(ch); |
} uartstr("\r\n\0"); |
} |
|
void doorbell_task(void) { |
// Controls LED 0x08 |
|
297,7 → 268,6
IOSPACE *sys = (IOSPACE *)IOADDR; |
|
while(1) { |
nread = nwritten = 0; |
int event; |
// Initial state: doorbell is not ringing. In this state, we |
// can wait forever for an event |
320,24 → 290,15
// Check time: should we turn our light on or not? |
belllight(rtcclock); |
const int *sptr = sound_data; |
// uartchr('N'); |
sys->io_uart = 'N'; |
while(sptr < &sound_data[NSAMPLE_WORDS]) { |
int len = &sound_data[NSAMPLE_WORDS]-sptr; |
if (len > 256) |
len = 256; |
|
/* |
while(len > 64) { |
write(FILENO_AUX, sptr, 64); |
sptr += 64; |
len -= 64; |
}*/ |
|
// We will stall here, if the audio FIFO is full |
// We stall here, if the audio FIFO is full |
write(FILENO_AUX, sptr, len); |
sptr += len; |
nwritten += len; |
|
// If the user presses the button more than |
// once, we start the sound over as well as |
// our light counter. |
356,7 → 317,7
} |
} |
|
uartchr('D'); |
sys->io_uart = 'D'; |
|
// Next state: the doorbell is no longer ringing, but |
// we have yet to return to normal--the light is still |
370,27 → 331,10
if (event&INT_BUTTON) { |
when = (volatile unsigned)rtcclock; |
showbell(when); |
uartchr('B'); |
sys->io_uart = 'S'; |
} |
} |
|
// uartstr("\r\n"); |
uartstr("\r\nNWritten: "); uarthex(nwritten); |
uartstr("NRead : "); uarthex(nread); |
uartstr("NStarts : "); uarthex(nstarts); |
nwritten = nread = nstarts = 0; |
} |
} |
#endif |
|
|
|
/* |
|
|
NWritten: 000018E7 |
NRead : 000018E7 |
NStarts : 00000001 |
|
|
*/ |
/s6soc/trunk/sw/zipos/zipsys.h
85,7 → 85,7
|
static inline void ENABLE_INTS(void) { |
IOSPACE *sys = (IOSPACE *)IOADDR; |
sys->io_pic = INT_ENABLE; |
sys->io_pic = 0x80000000; |
} |
|
#endif |
/s6soc/trunk/sw/zipos/kernel.c
68,25 → 68,58
void kwrite_txuart(TASKP tsk, int dev, int *dst, int len); |
int kpost(TASKP *task, unsigned events, int milliseconds); |
TASKP kschedule(int LAST_TASK, TASKP *tasklist, TASKP last); |
extern TASKP *ksetup(void); |
|
int LAST_TASK; |
|
extern int nwritten, nread, nstarts; |
|
void kernel_entry(void) { |
int nheartbeats= 0, tickcount = 0, milliseconds=0, ticks = 0; |
int audiostate = 0, buttonstate = 0; |
int audiostate = 0; |
TASKP *tasklist, current; |
int *last_context; |
IOSPACE *sys = (IOSPACE *)IOADDR; |
sys->io_spio = 0x0f0; |
sys->io_timb = 0; // Turn off the watchdog timer |
LAST_TASK = kntasks(); |
heap = _top_of_heap; |
|
tasklist = ksetup(); |
pipedev = sys_malloc(sizeof(KDEVICE)); |
pipedev->write = (RWFDFUN)kwrite_syspipe; |
pipedev->read = (RWFDFUN)kread_syspipe; |
pipedev->close = NULL; |
|
current = tasklist[0]; |
/* |
txdev = sys_malloc(sizeof(KDEVICE)); |
txdev->write = (RWFDFUN)kwrite_txuart; |
txdev->read = (RWFDFUN)kread_syspipe; |
txdev->close = NULL; |
|
pwmdev = sys_malloc(sizeof(KDEVICE)); |
pwmdev->write = (RWFDFUN)kwrite_audio; |
pwmdev->read = (RWFDFUN)kread_syspipe; |
pwmdev->close = NULL; |
*/ |
|
txdev = pwmdev = pipedev; |
|
rxpipe = new_syspipe(16); //rxpipe->m_wrtask=INTERRUPT_WRITE_TASK; |
txpipe = new_syspipe(16); txpipe->m_rdtask = INTERRUPT_READ_TASK; |
keypipe = new_syspipe(16); |
lcdpipe = new_syspipe(16); |
pwmpipe = new_syspipe(256); pwmpipe->m_rdtask= INTERRUPT_READ_TASK; |
cmdpipe = new_syspipe(16); |
|
tasklist = sys_malloc(sizeof(TASKP)*(1+LAST_TASK)); |
kinit(tasklist); |
tasklist[LAST_TASK] = new_task(2, idle_task); |
|
|
// current = tasklist[0]; |
current = tasklist[LAST_TASK]; |
restore_context(current->context); |
last_context = current->context; |
|
// Turn all interrupts off, acknowledge all at the same time |
sys->io_pic = 0x7fff7fff; |
unsigned enableset = |
INT_ENABLEV(INT_BUTTON) |
|INT_ENABLEV(INT_TIMA) |
97,13 → 130,48
// |INT_ENABLEV(INT_TIMB); |
; |
// Then selectively turn some of them back on |
sys->io_pic = INT_ENABLE | enableset | 0x07fff; |
sys->io_pic = INT_ENABLE | enableset; |
|
sys->io_tima = CONTEXT_LENGTH | TM_REPEAT; |
|
sys->io_spio = 0x0f1; |
if (1) { |
// Reset our wishbone scope for debug later |
SCOPE *scope = (SCOPE *)SCOPEADDR; |
scope->s_control = 12; |
} |
|
if (0) { |
// Wait on a button press before starting |
while((sys->io_spio & 0x0f0)==0) |
; |
sys->io_spio = 0xf3; |
for(int i=0; i<0x40000; i++) |
sys->io_spio = ((i>>14)&2)|0x20; |
sys->io_spio = 0xf7; |
} |
sys->io_pic = 0x7fff|INT_ENABLE; |
|
do { |
int need_resched = 0, context_has_been_saved, pic; |
nheartbeats++; |
|
if (0) { |
int v = 0xe4, p = sys->io_pic; |
if (p < 0) // LED 4 if interrupts enabled |
v &= ~4; |
if(p & 0x8000) // LED 8 if any already active |
v |= 8; |
sys->io_spio = v; |
} |
|
// if (sys->io_timb == 0) |
// sys->io_timb = 1600000000; // CONTEXT_LENGTH; |
// sys->io_timb = (sys->io_tima & 0x7fffffff) + 350; |
// sys->io_spio = 0x0e0; |
zip_rtu(); |
// sys->io_spio = 0xe2; |
// sys->io_timb = CONTEXT_LENGTH; |
|
last_context = current->context; |
context_has_been_saved = 0; |
131,10 → 199,6
sys->io_spio = ((sys->io_spio&1)^1)|0x010; |
pic |= SWINT_CLOCK; |
} |
if (buttonstate) |
buttonstate--; |
else |
enableset |= INT_ENABLEV(INT_BUTTON); |
} |
// |
if (pic&INT_BUTTON) { |
142,8 → 206,9
enableset &= ~(INT_ENABLEV(INT_BUTTON)); |
if ((sys->io_spio&0x0f0)==0x030) |
kpanic(); |
buttonstate = 3; |
} |
} else // We can turn it back on when the button |
// is released |
enableset |= INT_ENABLEV(INT_BUTTON); |
if (pic & INT_UARTRX) { |
int v = sys->io_uart; |
|
151,23 → 216,18
kpush_syspipe(rxpipe, v); |
|
// Local Echo |
if (pic & INT_UARTTX) { |
if (pic & INT_UARTTX) |
sys->io_uart = v; |
sys->io_pic = INT_UARTTX; |
pic &= ~INT_UARTTX; |
} |
} |
} if (pic & INT_UARTTX) { |
int v; |
if (kpop_syspipe(txpipe, &v)==0) { |
if (kpop_syspipe(txpipe, (int *)&sys->io_uart)==0) { |
enableset |= (INT_ENABLEV(INT_UARTTX)); |
sys->io_uart= v; |
sys->io_pic = INT_UARTTX; |
// if (v == 'W') |
// sys->io_timb = 5; |
// 75k was writing the 'e' |
} else |
} else { |
if (txpipe->m_wrtask) |
txpipe->m_wrtask->state = SCHED_READY; |
enableset &= ~(INT_ENABLEV(INT_UARTTX)); |
} |
} if (audiostate) { |
if (pic & INT_AUDIO) { |
int v; |
183,7 → 243,6
} else if (kpop_syspipe(pwmpipe, &v)==0) { |
audiostate = (2|(v<<2))&0x03ffff; |
sys->io_pwm_audio = (v>>16)&0x0ffff; |
nread++; |
} else { |
audiostate = 0; |
// Turn the device off |
196,17 → 255,13
// This particular interrupt cannot be cleared |
// until the port has been written to. Hence, |
// now that we've written to the port, we clear |
// it now. If it needs retriggering, the port |
// will retrigger itself -- despite being |
// cleared here. |
// it now. |
sys->io_pic = INT_AUDIO; |
}} else { // if (audiostate == 0) |
int sample; |
if (kpop_syspipe(pwmpipe, &sample)==0) { |
nstarts++; |
nread++; |
audiostate = (2|(sample<<2))&0x03ffff; |
sys->io_pwm_audio = 0x310000 | ((sample>>16)&0x0ffff); |
int v; |
if (kpop_syspipe(pwmpipe, &v)==0) { |
audiostate = (2|(v<<2))&0x03ffff; |
sys->io_pwm_audio = 0x310000 | ((v>>16)&0x0ffff); |
enableset |= (INT_ENABLEV(INT_AUDIO)); |
sys->io_spio = 0x022; |
sys->io_pic = INT_AUDIO; |
218,34 → 273,34
sys->io_pic = INT_ENABLE|enableset; |
} else { |
sys->io_pic = INT_ENABLE; // Make sure interrupts are on |
int sample; |
int v; |
|
// Check for the beginning of an audio pipe. If the |
// interrupt is not enabled, we still might need to |
// enable it. |
if ((audiostate==0)&&(kpop_syspipe(pwmpipe, &sample)==0)) { |
audiostate = (2|(sample<<2))&0x03ffff; |
sys->io_pwm_audio = 0x310000 | ((sample>>16)&0x0ffff); |
sys->io_pic = INT_AUDIO; |
if ((audiostate==0)&&(kpop_syspipe(pwmpipe, &v)==0)) { |
audiostate = (2|(v<<2))&0x03ffff; |
sys->io_pwm_audio = 0x310000 | ((v>>16)&0x0ffff); |
enableset |= (INT_ENABLEV(INT_AUDIO)); |
sys->io_spio = 0x022; |
nstarts++; |
nread++; |
} // else sys->io_spio = 0x020; |
|
// Or the beginning of a transmit pipe. |
if (pic & INT_UARTTX) { |
int v; |
if (kpop_syspipe(txpipe, &v)==0) { |
if (kpop_syspipe(txpipe, (int *)&sys->io_uart)==0) { |
enableset |= (INT_ENABLEV(INT_UARTTX)); |
sys->io_uart = v; |
sys->io_pic = INT_UARTTX; |
// if (v == 'W') |
// sys->io_timb = 5; |
} else |
} else { |
if (txpipe->m_wrtask) |
txpipe->m_wrtask = SCHED_READY; |
enableset &= ~(INT_ENABLEV(INT_UARTTX)); |
} |
} |
|
// What if the interrupt bit for the buttons is off? |
if ((sys->io_spio & 0x0f0)==0) |
enableset |= INT_ENABLEV(INT_BUTTON); |
|
// What if someone left interrupts off? |
// This might happen as part of a wait trap call, such |
// as syspipe() accomplishes within uwrite_syspipe() |
448,4 → 503,50
} return milliseconds; |
} |
|
void kuserexit(int a) { |
syscall(TRAPID_EXIT, a, 0, 0); |
} |
|
void *sys_malloc(int sz) { |
{ |
SCOPE *s = (SCOPE *)SCOPEADDR; |
s->s_control = TRIGGER_SCOPE_NOW | (s->s_control & 0x0ffff); |
} |
|
void *res = heap; |
heap += sz; |
if ((int)heap > ((int)&res)-32) { |
IOSPACE *sys = (IOSPACE *)IOADDR; |
sys->io_spio = 0xf3; |
asm("break 0"); |
} |
return res; |
} |
|
/* |
// This won't work. Once we apply an rtu(), there will be an immediate |
// interrupt before the task has had a chance to fill in a first value. By |
// instead waiting until the task comes back from it's first task swap, perhaps |
// having stalled it's pipe, then we can get our interrupt up and running. |
// Not only that, but at that time we'll have plenty of info to stuff into the |
// interrupt as well. |
void kwrite_audio(TASKP tsk, int dev, int *dst, int len) { |
kwrite_syspipe(tsk,dev,dst,len); |
if (tsk->context[15] == (int)uwrite_syspipe) { |
IOSPACE *io = (IOSPACE *)IOADDR; |
// Turn our audio interrupt on. |
io->pic = INT_ENABLEV(INT_AUDIO); |
} |
} |
|
void kwrite_txuart(TASKP tsk, int dev, int *dst, int len) { |
kwrite_syspipe(tsk,dev,dst,len); |
if (tsk->context[15] == (int)uwrite_syspipe) { |
IOSPACE *io = (IOSPACE *)IOADDR; |
// Turn our UART transmit interrupt on. |
io->pic = INT_ENABLEV(INT_UARTTX); |
} |
} |
|
*/ |
|
/s6soc/trunk/sw/zipos/resetdump.s
66,8 → 66,7
MOV PC+1,R0 |
BRA internal_kpanic |
LDI _top_of_stack,SP |
LDI kernel_entry,R0 |
BRA bootloader |
BRA kernel_entry |
|
.global kpanic |
.type kpanic,@function |
106,15 → 105,6
LOD 2(DBG),R2 |
MOV PC+1,R0 |
JMP internal_kpanic |
kpanic_wait_for_button_release: |
LOD (SPIO),R0 |
TEST 0x010,R0 |
BNZ kpanic_wait_for_button_release |
kpanic_wait_for_button: |
LOD (SPIO),R0 |
TEST 0x010,R0 |
BZ kpanic_wait_for_button |
BRA _start |
HALT |
|
internal_kpanic: |
/s6soc/trunk/sw/zipos/syspipe.c
51,6 → 51,33
#define NULL (void *)0 |
#endif |
|
static void clear_syspipe(SYSPIPE *p) { |
p->m_head = 0; |
p->m_tail = 0; |
p->m_error = 0; |
|
for(int i=0; i<=(int)p->m_mask; i++) |
p->m_buf[i] = 0; |
|
if ((p->m_rdtask)&&(p->m_rdtask != INTERRUPT_READ_TASK)) { |
p->m_rdtask->context[1] = p->m_nread; |
if (p->m_nread == 0) |
p->m_rdtask->errno = -EFAULT; |
p->m_rdtask->state = SCHED_READY; |
} else if (p->m_wrtask) { |
p->m_wrtask->context[1] = p->m_nwritten; |
if (p->m_nwritten == 0) |
p->m_wrtask->errno = -EFAULT; |
p->m_wrtask->state = SCHED_READY; |
} |
|
if (p->m_rdtask != INTERRUPT_READ_TASK) |
p->m_rdtask = 0; |
p->m_wrtask = 0; |
p->m_nread = 0; |
p->m_nwritten = 0; |
} |
|
void kpush_syspipe(SYSPIPE *pipe, int val) { |
int tst = (pipe->m_head+1)&pipe->m_mask; |
if (tst != pipe->m_tail) { |
61,35 → 88,79
} else pipe->m_error = 1; |
} |
|
extern void pipe_panic(SYSPIPE *p); |
void txchr(char v) { |
volatile IOSPACE *sys = (IOSPACE *)IOADDR; |
if (v < 10) |
return; |
v &= 0x0ff; |
sys->io_pic = INT_UARTTX; |
while((sys->io_pic&INT_UARTTX)==0) |
; |
sys->io_uart = v; |
} |
|
void txstr(const char *str) { |
const char *ptr = str; |
while(*ptr) { |
txchr(*ptr++); |
} |
} |
|
void txhex(int num) { |
for(int ds=28; ds>=0; ds-=4) { |
int ch; |
ch = (num>>ds)&0x0f; |
if (ch >= 10) |
ch = 'A'+ch-10; |
else |
ch += '0'; |
txchr(ch); |
} txstr("\r\n"); |
} |
|
void pipe_panic(SYSPIPE *pipe) { |
extern void kpanic(void); |
volatile IOSPACE *sys = (IOSPACE *)IOADDR; |
|
sys->io_spio = 0x0fa; |
|
txstr("SYSPIPE PANIC!\r\n"); |
txstr("ADDR: "); txhex((int)pipe); |
txstr("MASK: "); txhex(pipe->m_mask); |
txstr("HEAD: "); txhex(pipe->m_head); |
txstr("TAIL: "); txhex(pipe->m_tail); |
kpanic(); |
} |
|
int kpop_syspipe(SYSPIPE *pipe, int *vl) { |
if (pipe->m_head != pipe->m_tail) { |
*vl = pipe->m_buf[pipe->m_tail]; |
pipe->m_tail = (pipe->m_tail+1)&pipe->m_mask; |
pipe->m_tail++; |
if ((unsigned)pipe->m_tail > pipe->m_mask) |
pipe->m_tail = 0; |
if (pipe->m_wrtask) |
pipe->m_wrtask->state = SCHED_READY; |
return 0; |
} |
return 1; // Error condition |
} return 1; // Error condition |
} |
|
/* Returns how many values are in the pipe |
*/ |
/* Of course ... if it's not used, why include it? |
SYSPIPE *new_syspipe(const unsigned int len) { |
unsigned msk; |
|
for(msk=2; msk<len; msk<<=1) |
; |
SYSPIPE *pipe = sys_malloc(sizeof(SYSPIPE)-1+msk); |
pipe->m_mask = msk-1; |
pipe->m_rdtask = pipe->m_wrtask = 0; |
clear_syspipe(pipe); |
return pipe; |
} |
|
int len_syspipe(SYSPIPE *p) { |
return (p->m_head-p->m_tail) & p->m_mask; |
} */ |
/* Returns how many empty spaces are in the pipe |
*/ |
} |
int num_avail_syspipe(SYSPIPE *p) { |
// if (head+1 == tail) PIPE is full |
// (mask+tail-tail+1)=mask+1 &mask = 0 |
// if (head == tail) PIPE is empty |
// (mask+tail-tail)=mask & mask = mask |
// if (head == tail+2) PIPE has two within it |
// (mask+tail-tail-2)=mask-2 & mask = mask-2 |
// |
return (p->m_tail-p->m_head-1) & p->m_mask; |
return (p->m_mask + p->m_tail-p->m_head) & p->m_mask; |
} |
|
// This will be called from a user context. |
122,11 → 193,9
|
p->m_nread += ln1; |
nleft -= ln1; |
|
int nt = p->m_tail+ln1; |
if ((unsigned)nt > p->m_mask) |
nt = 0; |
p->m_tail = nt; |
p->m_tail += ln1; |
if ((unsigned)p->m_tail > p->m_mask) |
p->m_tail = 0; |
} |
|
// nleft is either zero, or tail |
150,10 → 219,9
|
p->m_nread += ln1; |
nleft -= ln1; |
int nt = p->m_tail+ln1; // nt = new tail value |
if ((unsigned)nt > p->m_mask) |
nt = 0; |
p->m_tail = nt; |
p->m_tail += ln1; |
if (p->m_tail == (int)p->m_mask+1) |
p->m_tail = 0; |
|
if (nleft & -2) |
exit(nleft); |
243,8 → 311,7
return len; |
} |
|
static int uwrite_syspipe(TASKP tsk __attribute__((__unused__)), |
SYSPIPE *p, int *src, int len) { |
static int uwrite_syspipe(TASKP tsk __attribute__((__unused__)), SYSPIPE *p, int *src, int len) { |
int nleft = len; |
|
// The kernel guarantees, before we come into here, that we have a |
260,6 → 327,8
if (rdtask == INTERRUPT_READ_TASK) { |
// We need to copy everything to the buffer |
} else if (rdtask) { |
// #warning "The previous code should have worked" |
// if (((unsigned)rdtask+1) & -2) |
int ln = nleft; |
if (ln > p->m_rdtask->context[4]) |
ln = p->m_rdtask->context[4]; |
302,9 → 371,7
} |
|
// Copy whatever we have into the pipe's buffer |
int navail = num_avail_syspipe(p); |
if ((nleft <= navail) |
||((rdtask == INTERRUPT_READ_TASK)&&(navail>0))) { |
if ((nleft <= num_avail_syspipe(p))||(rdtask == INTERRUPT_READ_TASK)) { |
// Either there is no immediate reader task, or |
// the reader has been exhausted, but we've go |
// more to write. |
314,27 → 381,23
// rest of our buffer will fit. |
|
{ // Write into the first half of the pipe |
// Be careful not to change head until all is written |
// so that it remains consistent under interrupt |
// conditions. |
int ln = p->m_mask+1-p->m_head; |
int *dst = &p->m_buf[p->m_head]; |
if (ln > nleft) ln = nleft; |
if (ln > navail) ln = navail; |
|
for(int i=0; i<ln; i++) |
*dst++ = *src++; |
|
p->m_head = (p->m_head+ln)&p->m_mask; |
p->m_head += ln; |
nleft -= ln; |
p->m_nwritten += ln; |
navail -= ln; |
if (p->m_head > (int)p->m_mask) |
p->m_head = 0; |
} |
|
/* |
// Write into the rest of the pipe |
if ((0 == p->m_head)&&(nleft>0)&&(navail>0)) { |
int ln = navail; |
if (nleft > 0) { |
int ln = num_avail_syspipe(p); |
if (nleft < ln) |
ln = nleft; |
int *dst = &p->m_buf[p->m_head]; |
345,13 → 408,13
p->m_head += ln; |
p->m_nwritten += ln; |
nleft -= ln; |
}*/ |
} |
} |
|
if ((nleft > 0)&&(navail == 0)) { |
if (nleft > 0) { |
if (rdtask == INTERRUPT_READ_TASK) { |
DISABLE_INTS(); |
if (0==num_avail_syspipe(p)) |
if (num_avail_syspipe(p)==0) |
wait(0,-1); |
else ENABLE_INTS(); |
} else { |
/s6soc/trunk/sw/zipos/Makefile
45,14 → 45,14
DEVSRCSR:= display.c keypad.c rtcsim.c |
DEVSRCS := $(addprefix ../dev/,$(DEVSRCSR)) |
DEVOBJS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(DEVSRCSR))) |
SOURCES := bootloader.c kernel.c ksetup.c syspipe.c pipesetup.c taskp.c doorbell.c zipsys.c # ziplib.c |
SOURCES := kernel.c syspipe.c taskp.c doorbell.c zipsys.c # ziplib.c |
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(SOURCES))) $(DEVOBJS) $(OBJDIR)/resetdump.o |
HEADERS := $(wildcard *.h) $(subst .c,.h,$(DEVSRCS)) |
# CFLAGS := -O3 -fdump-tree-all -Wall -Wextra -nostdlib -fno-builtin |
# CFLAGS := -O3 -fdump-rtl-all -DZIPOS -Wall -Wextra -nostdlib -fno-builtin |
# CFLAGS := -O3 -fdump-rtl-all -Wall -Wextra -nostdlib -fno-builtin |
CFLAGS := -O3 -DZIPOS -Wall -Wextra -nostdlib -fno-builtin |
# CFLAGS := -Wall -Wextra -nostdlib -fno-builtin |
LDFLAGS := -T cmodram.ld -Wl,-Map,$(OBJDIR)/doorbell.map |
LDFLAGS := -T cmod.ld -Wl,-Map,$(OBJDIR)/doorbell.map |
|
all: $(OBJDIR)/ doorbell |
$(OBJDIR)/: |
76,7 → 76,7
$(OBJDIR)/resetdump.o: resetdump.s |
$(AS) $^ -o $@ |
|
doorbell: $(OBJECTS) cmodram.ld |
doorbell: $(OBJECTS) cmod.ld |
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ |
|
$(OBJDIR)/doorbell.txt: doorbell |