##// END OF EJS Templates
Added Oplayer BSP, Fixed bug on GPIO library(gpiosetval change all the port...
Added Oplayer BSP, Fixed bug on GPIO library(gpiosetval change all the port instead of the desired bit).

File last commit:

r18:bd9ab647f70a default
r60:17402611bd25 dev_alexis
Show More
mbr.c
82 lines | 2.3 KiB | text/x-c | CLexer
just backup
r12 /*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2012, Alexis Jeandet
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------
-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@gmail.com
-------------------------------------------------------------------------------*/
#include "mbr.h"
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 #include <stdio.h>
just backup
r12
int mbropen(blkdevice* phy,dikpartition* part,char partNum)
{
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 printf("enter MBR open function\n");
just backup
r12 char mbr[512];
if((part==0) || (phy ==0) || (partNum>4) || (partNum==0) ) return MBRBabArg;
part->phy = phy;
jeandet@pc-de-jeandet3.LAB-LPP.LOCAL
Now uses qmake to compile an Qt-creator compatible!
r18 if(phy->read(phy,mbr,0,1)!=RES_OK)
{
printf("can't read MBR!\n");
return MBRReadErr;
}
if(((mbr[510]) == (char)0x55) && ((mbr[511]) == (char)0xAA))
{
part->TypeCode = mbr[(512-82+TypeCodeoffset)+partNum*16];
part->LBABegin = (unsigned int)mbr[(512-82+LBABeginoffset)+partNum*16] + ((unsigned int)mbr[(512-82+LBABeginoffset+1)+partNum*16]<<8)+ ((unsigned int)mbr[(512-82+LBABeginoffset+2)+partNum*16]<<16)+ ((unsigned int)mbr[(512-82+LBABeginoffset+3)+partNum*16]<<24);
part->NumOfSec = (unsigned int)mbr[(512-82+NumOfSecoffset)+partNum*16] + ((unsigned int)mbr[(512-82+NumOfSecoffset+1)+partNum*16]<<8)+ ((unsigned int)mbr[(512-82+NumOfSecoffset+2)+partNum*16]<<16)+ ((unsigned int)mbr[(512-82+NumOfSecoffset+3)+partNum*16]<<24);
printf("MBR Ok\n");
return MBRnoErr;
}
printf("Bad MBR MBR[510]=0x%.2X MBR[511]=0x%.2X!\n",0xff&mbr[510],0xff&mbr[511]);
return MBRBadMbr;
just backup
r12 }