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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [kernel/] [os_stubs.c] - Blame information for rev 411

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 rhoads
/*--------------------------------------------------------------------
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 407 rhoads
#undef malloc
45
#undef free
46
void *OS_HeapMalloc(OS_Heap_t *heap, int bytes) {(void)heap; return malloc(bytes);}
47
void OS_HeapFree(void *block)                {free(block);}
48 302 rhoads
void UartPrintfCritical(const char *format, ...) {(void)format;}
49
uint32 OS_AsmInterruptEnable(uint32 state)   {(void)state; return 0;}
50
void OS_Assert(void)                         {}
51
OS_Thread_t *OS_ThreadSelf(void)             {return NULL;}
52
void OS_ThreadSleep(int ticks)               {(void)ticks;}
53
uint32 OS_ThreadTime(void)                   {return 0;}
54
OS_Mutex_t *OS_MutexCreate(const char *name) {(void)name; return NULL; }
55
void OS_MutexDelete(OS_Mutex_t *semaphore)   {(void)semaphore;}
56
void OS_MutexPend(OS_Mutex_t *semaphore)     {(void)semaphore;}
57
void OS_MutexPost(OS_Mutex_t *semaphore)     {(void)semaphore;}
58 402 rhoads
#if OS_CPU_COUNT > 1
59
   uint32 OS_SpinLock(void)                     {return 0;}
60
   void OS_SpinUnlock(uint32 state)             {(void)state;}
61
#endif
62 302 rhoads
 
63
OS_MQueue_t *OS_MQueueCreate(const char *name,
64
                             int messageCount,
65
                             int messageBytes)
66
{(void)name;(void)messageCount;(void)messageBytes; return NULL;}
67
 
68
void OS_MQueueDelete(OS_MQueue_t *mQueue)    {(void)mQueue;}
69
 
70
int OS_MQueueSend(OS_MQueue_t *mQueue, void *message)
71
{(void)mQueue;(void)message; return 0;}
72
 
73
int OS_MQueueGet(OS_MQueue_t *mQueue, void *message, int ticks)
74
{(void)mQueue;(void)message;(void)ticks; return 0;}
75
 
76 400 rhoads
void OS_Job(JobFunc_t funcPtr, void *arg0, void *arg1, void *arg2)
77 302 rhoads
{funcPtr(arg0, arg1, arg2);}
78
 
79
 

powered by: WebSVN 2.1.0

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