]> rtime.felk.cvut.cz Git - fpga/plasma.git/blob - kernel/os_stubs.c
Local copy of Plasma MIPS project.
[fpga/plasma.git] / kernel / os_stubs.c
1 /*--------------------------------------------------------------------
2  * TITLE: OS stubs
3  * AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
4  * DATE CREATED: 2/18/08
5  * FILENAME: os_stubs.c
6  * PROJECT: Plasma CPU core
7  * COPYRIGHT: Software placed into the public domain by the author.
8  *    Software 'as is' without warranty.  Author liable for nothing.
9  * DESCRIPTION:
10  *--------------------------------------------------------------------*/
11 #include <stdlib.h>
12 #include "plasma.h"
13 #include "rtos.h"
14
15 unsigned char *flash;
16 int beenInit;
17
18
19 void FlashRead(uint16 *dst, uint32 byteOffset, int bytes)
20 {
21    if(beenInit == 0)
22    {
23       beenInit = 1;
24       flash = (unsigned char*)malloc(1024*1024*16);
25       memset(flash, 0xff, sizeof(flash));
26    }
27    memcpy(dst, flash+byteOffset, bytes);
28 }
29
30
31 void FlashWrite(uint16 *src, uint32 byteOffset, int bytes)
32 {
33    memcpy(flash+byteOffset, src, bytes);
34 }
35
36
37 void FlashErase(uint32 byteOffset)
38 {
39    memset(flash+byteOffset, 0xff, 1024*128);
40 }
41
42
43 //Stub out RTOS functions
44 void UartPrintfCritical(const char *format, ...) {(void)format;}
45 uint32 OS_AsmInterruptEnable(uint32 state)   {(void)state; return 0;}
46 void OS_Assert(void)                         {}
47 OS_Thread_t *OS_ThreadSelf(void)             {return NULL;}
48 void OS_ThreadSleep(int ticks)               {(void)ticks;}
49 uint32 OS_ThreadTime(void)                   {return 0;}
50 OS_Mutex_t *OS_MutexCreate(const char *name) {(void)name; return NULL; }
51 void OS_MutexDelete(OS_Mutex_t *semaphore)   {(void)semaphore;}
52 void OS_MutexPend(OS_Mutex_t *semaphore)     {(void)semaphore;}
53 void OS_MutexPost(OS_Mutex_t *semaphore)     {(void)semaphore;}
54
55 OS_MQueue_t *OS_MQueueCreate(const char *name,
56                              int messageCount,
57                              int messageBytes)
58 {(void)name;(void)messageCount;(void)messageBytes; return NULL;}
59
60 void OS_MQueueDelete(OS_MQueue_t *mQueue)    {(void)mQueue;}
61
62 int OS_MQueueSend(OS_MQueue_t *mQueue, void *message) 
63 {(void)mQueue;(void)message; return 0;}
64
65 int OS_MQueueGet(OS_MQueue_t *mQueue, void *message, int ticks)
66 {(void)mQueue;(void)message;(void)ticks; return 0;}
67
68 void OS_Job(void (*funcPtr)(), void *arg0, void *arg1, void *arg2)
69 {funcPtr(arg0, arg1, arg2);}
70
71