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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [zipos/] [taskp.c] - Diff between revs 22 and 45

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

Rev 22 Rev 45
Line 37... Line 37...
//
//
//
//
#include "ksched.h"
#include "ksched.h"
#include "kfildes.h"
#include "kfildes.h"
#include "taskp.h"
#include "taskp.h"
 
#include "txfns.h"
 
 
extern  void *sys_malloc(int sz);
extern  void *sys_malloc(int sz);
TASKP   new_task(unsigned ln, VENTRYP entry) {
TASKP   new_task(unsigned ln, VENTRYP entry) {
        int     i;
        int     i;
        TASKP   tsk = (TASKP)sys_malloc(sizeof(struct TASK_S)+ln);
        TASKP   tsk = (TASKP)sys_malloc(sizeof(struct TASK_S)+ln);
 
 
        for(i=0; (unsigned)i<sizeof(struct TASK_S)+ln; i++)
        for(i=0; (unsigned)i<sizeof(struct TASK_S)+ln; i++)
                ((unsigned int *)tsk)[i] = 0;
                ((unsigned int *)tsk)[i] = 0;
        tsk->context[ 0] = (int)((long)(int *)idle_task);
        tsk->context[ 0] = (int)(idle_task);
        tsk->context[12] = (int)&tsk->user_data[ln]; // Set the stack pointer
        tsk->context[12] = (int)&tsk->user_data[ln]; // Set the stack pointer
        tsk->context[13] = (int)&tsk->user_data[ln]; // Set the stack pointer
        tsk->context[13] = (int)&tsk->user_data[ln]; // Set the stack pointer
        tsk->context[14] = 0x20; // GIE bit only
        tsk->context[14] = 0x20; // GIE bit only
        tsk->context[15] = (int)((long)(int *)entry);
        tsk->context[15] = (int)((int *)entry);
        tsk->user_heap   = &tsk->user_data[0];
        tsk->user_heap   = &tsk->user_data[0];
        tsk->state = SCHED_READY;
        tsk->state = SCHED_READY;
 
 
        return tsk;
        return tsk;
}
}

powered by: WebSVN 2.1.0

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