blob: 97c7d1b3a99e8c4c3ede1addef46f2bb5b3647b3 [file] [log] [blame]
package body FS.FILO.Dev is
procedure Read
(Buffer : in out Buffer_Type;
Offset : in Natural;
Success : out Boolean)
is
use Interfaces.C;
Sector : constant unsigned_long := unsigned_long (Offset) / 512;
Byte_Offset : constant unsigned_long := unsigned_long (Offset) rem 512;
Byte_Len : constant unsigned_long := unsigned_long (Buffer'Length);
Buf : constant System.Address := Buffer'Address;
-- NOTE: C_devread returns 1 on success
function To_Success (Item : Interfaces.C.int) return Boolean is
(if Item = 1 then True else False);
begin
Success := To_Success (C_devread (Sector, Byte_Offset, Byte_Len, Buf));
end Read;
end FS.FILO.Dev;