projekty/Source/example1/src/status.c

Go to the documentation of this file.
00001 /*
00002  * $Id: status.h,v 1 2007/06/20 22:00:00 BorisK Exp $
00003  *
00004  * Copyright (C) 2007 ONTRACK s.r.o.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    
00019  * 02111-1307, USA.
00020  *
00021  * Written by Boris Kralik <kralikbo@yahoo.com>, 2007
00022  *
00023  */
00024 #include "status.h"
00025 /***********************************************************************************
00026         Name:           GetStatus
00027         Description:    Read status of computer from FRAM 
00028         Parameters:     void
00029         Return:         uint16_t
00030 ************************************************************************************/
00031 uint16_t GetStatus(void)
00032 {
00033         WD_Reset();
00034         return ((RamtronReadByte(MEM_STATUS_H) << 4) | RamtronReadByte(MEM_STATUS_L));
00035 #if 0
00036         printf("\n\r\tGS:GetStatus=0x%x",uiStatus);
00037 #endif
00038 }
00039 /***********************************************************************************
00040         Name:           SetStatus
00041         Description:    Write Status of computer to FRAM
00042         Parameters:     uint16_t uiStatus
00043         Return:         uint16_t
00044 ************************************************************************************/
00045 uint16_t SetStatus(uint16_t uiStatus)
00046 {
00047         uint8_t H,L;
00048         WD_Reset();
00049         #if 0
00050                 printf("\n\rSS:uiStatus=0x%X",uiStatus);
00051                 printf("\n\rSS:RamtronWrite(%d,0x%X)=0x%X",100,(L=RamtronWriteByte(100,     (uiStatus & 0x0F))),(uiStatus & 0x0F));
00052                 printf("\n\rSS:RamtronWrite(%d,0x%X)=0x%X",101,(H=(RamtronWriteByte(101,((uiStatus & 0xF0) >> 4)))),((uiStatus & 0xF0) >> 4));
00053         #else
00054                 RamtronWriteByte(MEM_STATUS_L,(uiStatus & 0x0F));WD_Reset();
00055                 RamtronWriteByte(MEM_STATUS_H,((uiStatus & 0xF0) >> 4));WD_Reset();
00056         #endif
00057         uiStatus = (H+L);
00058         #if 0
00059                 printf("\n\rSS:uiStatus=0x%X",uiStatus);
00060         #endif
00061         return uiStatus;
00062 }

Generated on Fri Sep 21 13:41:54 2007 for example1 by  doxygen 1.4.7