OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [zipos/] [pipesetup.c] - Diff between revs 27 and 45

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 27 Rev 45
Line 42... Line 42...
#include "board.h"
#include "board.h"
#include "taskp.h"
#include "taskp.h"
#include "syspipe.h"
#include "syspipe.h"
#include "zipsys.h"
#include "zipsys.h"
#include "ktraps.h"
#include "ktraps.h"
 
#include "txfns.h"
 
 
#ifndef NULL
#ifndef NULL
#define NULL    (void *)0
#define NULL    (void *)0
#endif
#endif
 
 
Line 75... Line 76...
        p->m_wrtask   = 0;
        p->m_wrtask   = 0;
        p->m_nread    = 0;
        p->m_nread    = 0;
        p->m_nwritten = 0;
        p->m_nwritten = 0;
}
}
 
 
// These routines really belong elsewhere in a uartdump.c file or some such.
 
// However, until placed there, they'll stay put here for a bit longer.
 
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) {
void    pipe_panic(SYSPIPE *pipe) {
        extern void     kpanic(void);
        extern void     kpanic(void);
        volatile IOSPACE        *sys = (IOSPACE *)IOADDR;
 
 
 
        sys->io_spio = 0x0fa;
        _sys->io_spio = 0x0fa;
 
 
        txstr("SYSPIPE PANIC!\r\n");
        txstr("SYSPIPE PANIC!\r\n");
        txstr("ADDR: "); txhex((int)pipe);
        txstr("ADDR: "); txhex((int)pipe);
        txstr("MASK: "); txhex(pipe->m_mask);
        txstr("MASK: "); txhex(pipe->m_mask);
        txstr("HEAD: "); txhex(pipe->m_head);
        txstr("HEAD: "); txhex(pipe->m_head);
Line 124... Line 92...
}
}
 
 
SYSPIPE *new_syspipe(const unsigned int len) {
SYSPIPE *new_syspipe(const unsigned int len) {
        unsigned        msk;
        unsigned        msk;
 
 
        for(msk=2; msk<len; msk<<=1)
        for(msk=16; msk<len; msk<<=1)
                ;
                ;
        SYSPIPE *pipe = sys_malloc(sizeof(SYSPIPE)-1+msk);
        SYSPIPE *pipe = sys_malloc(sizeof(SYSPIPE)-1+msk);
        pipe->m_mask = msk-1;
        pipe->m_mask = msk-1;
        pipe->m_rdtask = pipe->m_wrtask = 0;
        pipe->m_rdtask = pipe->m_wrtask = 0;
        clear_syspipe(pipe);
        clear_syspipe(pipe);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.