|
|
/*------------------------------------------------------------------------------
|
|
|
-- 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
|
|
|
-------------------------------------------------------------------------------*/
|
|
|
#ifndef UCDIRENT_H
|
|
|
#define UCDIRENT_H
|
|
|
#include <blkdevice.h>
|
|
|
|
|
|
|
|
|
#define ATTR_READ_ONLY 0x01
|
|
|
#define ATTR_HIDDEN 0x02
|
|
|
#define ATTR_SYSTEM 0x04
|
|
|
#define ATTR_VOLUME_ID 0x08
|
|
|
#define ATTR_DIRECTORY 0x10
|
|
|
#define ATTR_ARCHIVE 0x20
|
|
|
#define ATTR_LONGNAME 0x0F
|
|
|
|
|
|
#define DIRENT_EndOfDir 1
|
|
|
#define DIRENT_BabArg 2
|
|
|
#define DIRENT_ReadErr 3
|
|
|
#define DIRENT_LastSect 4
|
|
|
#define DIRENT_BadSect 5
|
|
|
#define DIRENT_noErr 0
|
|
|
|
|
|
typedef struct ucdirent* ucdirentptr;
|
|
|
typedef int (*getrootfirstent_t)(ucdirentptr entry);
|
|
|
typedef int (*nextdirent_t)(ucdirentptr entry);
|
|
|
typedef int (*getname_t)(ucdirentptr entry,char* name);
|
|
|
|
|
|
typedef struct dirent
|
|
|
{
|
|
|
unsigned char DIR_Name[16];
|
|
|
unsigned char DIR_Attr;
|
|
|
unsigned char DIR_CrtTimeTenth;
|
|
|
unsigned short DIR_CrtTime;
|
|
|
unsigned short DIR_CrtDate;
|
|
|
unsigned short DIR_LstAccDate;
|
|
|
unsigned short DIR_FstClusHI;
|
|
|
unsigned short DIR_WrtTime;
|
|
|
unsigned short DIR_WrtDate;
|
|
|
unsigned short DIR_FstClustLO;
|
|
|
unsigned int DIR_FileSize;
|
|
|
unsigned int CurrentSec;
|
|
|
unsigned char Currententry;
|
|
|
UHANDLE fs;
|
|
|
getrootfirstent_t getrootfirstent;
|
|
|
nextdirent_t nextdirent;
|
|
|
getname_t getname;
|
|
|
}dirent;
|
|
|
|
|
|
typedef struct ucdirent{
|
|
|
uint8_t DIR_Name[16];
|
|
|
uint8_t DIR_Attr;
|
|
|
uint8_t DIR_CrtTimeTenth;
|
|
|
uint16_t DIR_CrtTime;
|
|
|
uint16_t DIR_CrtDate;
|
|
|
uint16_t DIR_LstAccDate;
|
|
|
uint16_t DIR_FstClusHI;
|
|
|
uint16_t DIR_WrtTime;
|
|
|
uint16_t DIR_WrtDate;
|
|
|
uint16_t DIR_FstClustLO;
|
|
|
uint32_t DIR_FileSize;
|
|
|
uint32_t CurrentSec;
|
|
|
uint8_t Currententry;
|
|
|
UHANDLE fs;
|
|
|
getrootfirstent_t getrootfirstent;
|
|
|
nextdirent_t nextdirent;
|
|
|
getname_t getname;
|
|
|
}ucdirent;
|
|
|
|
|
|
|
|
|
|
|
|
#define direntgetroot(dirent) (dirent).getrootfirstent(&dirent)
|
|
|
#define direntgetnext(dirent) (dirent).nextdirent(&dirent)
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|