Skip to content
Browse files

lab2: fuckit, i just lost everything i was messing with, messed with …

…the OSFifo functions

Signed-off-by: Austin B <austinblackstone@aol.com>
  • Loading branch information...
1 parent 61775f0 commit 9842acbe170b21630184321823fc67f07c062fe5 @AustinBlackstone committed Feb 26, 2012
Showing with 14 additions and 7 deletions.
  1. +2 −1 Lab2/Lab2.uvproj
  2. +12 −6 Lab2/os.c
View
3 Lab2/Lab2.uvproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
- <SchemaVersion>1.0</SchemaVersion>
+ <SchemaVersion>1.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
@@ -29,6 +29,7 @@
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
+ <SFDFile></SFDFile>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
View
18 Lab2/os.c
@@ -493,6 +493,8 @@ return;
// e.g., 4 to 64 elements
// e.g., must be a power of 2,4,8,16,32,64,128
void OS_Fifo_Init(unsigned long size){
+ //TODO: Implement Size Restraint
+ OSFifo_Init();
return;
}
@@ -505,7 +507,7 @@ return;
// Since this is called by interrupt handlers
// this function can not disable or enable interrupts
int OS_Fifo_Put(unsigned long data){
-return OSFifo_Put(data);
+ return OSFifo_Put(data);
}
// ******** OS_Fifo_Get ************
@@ -514,8 +516,12 @@ return OSFifo_Put(data);
// Inputs: none
// Outputs: data
unsigned long OS_Fifo_Get(void){
-long temp;
-return OSFifo_Get(&temp);
+ long temp;
+ while(OS_Fifo_Size<=0){
+ ; //Splin Lock //TODO: Implement Blocking here
+ }
+
+ return OSFifo_Get(&temp);
}
// ******** OS_Fifo_Size ************
@@ -526,7 +532,7 @@ return OSFifo_Get(&temp);
// zero or less than zero if the Fifo is empty
// zero or less than zero if a call to OS_Fifo_Get will spin or block
long OS_Fifo_Size(void){
-return OSFifo_Size();
+ return OSFifo_Size();
}
// ******** OS_MailBox_Init ************
@@ -535,7 +541,7 @@ return OSFifo_Size();
// Outputs: none
void OS_MailBox_Init(void){
OS_InitSemaphore(&OSMailBoxSema4,0);
-return;
+ return;
}
// ******** OS_MailBox_Send ************
@@ -547,7 +553,7 @@ return;
void OS_MailBox_Send(unsigned long data){
OS_Wait(&OSMailBoxSema4);
OSMAILBOX=data;
-return;
+ return;
}
// ******** OS_MailBox_Recv ************

0 comments on commit 9842acb

Please sign in to comment.
Something went wrong with that request. Please try again.