Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 120 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
347406f
Setting up GitHub Classroom Feedback
github-classroom[bot] Feb 11, 2023
b1ffac3
seadanya dululahya
mikeleo03 Feb 19, 2023
356ec11
Makefile 75%
mikeleo03 Feb 19, 2023
71ccc03
refactor: fix makefile, supposedly running
GoDillonAudris512 Feb 19, 2023
56971fb
Update makefile again
mikeleo03 Feb 20, 2023
83e35a6
framebuffer write and clear
Nat10k Feb 20, 2023
f5e832a
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
Nat10k Feb 20, 2023
23a30e6
refactor: add portio.o, delete framebuffer linker
GoDillonAudris512 Feb 20, 2023
3f12309
feat: add the set cursor position function
GoDillonAudris512 Feb 20, 2023
8287d68
Basic gdt.c
mikeleo03 Feb 20, 2023
bdf712e
refactor: complete the segment descriptor structure
GoDillonAudris512 Feb 20, 2023
2ac2a1a
Inserting gdt vals
mikeleo03 Feb 20, 2023
e17407d
gdt and gdtr implementation done
mikeleo03 Feb 21, 2023
0ef9925
Protected Mode
AustinPardosi Feb 27, 2023
c14241f
refactor: add command to makefile, implement protected mode in kernel.c
GoDillonAudris512 Feb 27, 2023
468c554
delete unnecessary file
GoDillonAudris512 Feb 27, 2023
f6443b8
Initial setup for Milestone #2
mikeleo03 Mar 18, 2023
761b55b
Setup filesystem
Nat10k Mar 19, 2023
bec19f7
Add Keyboard (Testing) Not Final
AustinPardosi Mar 19, 2023
3a3dc47
trying to initiate file system
GoDillonAudris512 Mar 19, 2023
b1a0159
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 Mar 19, 2023
f73f940
Interrupt + IDT done?
mikeleo03 Mar 19, 2023
01d62f8
fixed make file and launch task
GoDillonAudris512 Mar 19, 2023
9846e95
better file arrangement
mikeleo03 Mar 19, 2023
70796a0
Interrupt?????
mikeleo03 Mar 19, 2023
4f4ea5f
Update filesystem
Nat10k Mar 19, 2023
414c571
Updating IDT struct
mikeleo03 Mar 19, 2023
1168ed1
Updating reference path
mikeleo03 Mar 19, 2023
7606d17
finished doing initialize fat32
GoDillonAudris512 Mar 19, 2023
0e7c81e
Initialize interrupt - keyboard joining process
mikeleo03 Mar 19, 2023
f148bdb
refactor: add comment to improve readability and understandability. m…
GoDillonAudris512 Mar 19, 2023
9dd8105
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 Mar 19, 2023
7e8c7db
fixed kernel loader and linker, refactor the makefile a bit
GoDillonAudris512 Mar 20, 2023
026af78
feat: read operation done, not yet tested. delete function header com…
GoDillonAudris512 Mar 20, 2023
1c259dc
fixed the mechanism to check if parent directory validity
GoDillonAudris512 Mar 20, 2023
080a0a8
add read and read_directory
Nat10k Mar 20, 2023
0a185de
feat: add delete operation, not tested yet. fixed some checking mecha…
GoDillonAudris512 Mar 20, 2023
b43f454
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 Mar 20, 2023
20e9f52
refactor: delete name and extension, and write extension for extra gu…
GoDillonAudris512 Mar 20, 2023
1cb8fec
refactor: fixed write and delete checking mechanism a bit
GoDillonAudris512 Mar 21, 2023
9d37c03
fix: change mechanism for file write to avoid buffer overflow and oth…
GoDillonAudris512 Mar 25, 2023
7738064
Add README.md
mikeleo03 Mar 26, 2023
3b113cc
Support keyboard on makefile and interrupt
mikeleo03 Mar 27, 2023
b48ac9b
Fix: Keyboard Interrupt
AustinPardosi Mar 27, 2023
bbd4ccf
fix keyboard, read, interrupt, change kernel test code
Nat10k Mar 27, 2023
7c5a836
add testcase for writing and reading from non-root directory
Nat10k Mar 27, 2023
346a05a
refactor: change kernel setup back to test case, change some flag in …
GoDillonAudris512 Mar 28, 2023
704422b
fix keyboard mini bugs -- leon
GoDillonAudris512 Mar 28, 2023
391e220
feat: add cmos device driver to supports date and time in file system
GoDillonAudris512 Mar 30, 2023
77c63ca
feat: implements the cmos driver to filesystem
GoDillonAudris512 Mar 30, 2023
6a34c25
Update keyboard, kernel and README
mikeleo03 Mar 30, 2023
c4518f7
Initial setup for Milestone #3
mikeleo03 Mar 31, 2023
ed8bbfe
feat: implement paging to the os
GoDillonAudris512 Apr 3, 2023
3b74c54
add user mode setup
Nat10k Apr 6, 2023
952c63a
continue user mode
Nat10k Apr 6, 2023
5e8678e
Fix switch to user mode
Nat10k Apr 12, 2023
ed0362d
syscall done (?)
mikeleo03 Apr 14, 2023
96dd161
unfinshed shell
mikeleo03 Apr 14, 2023
ab9f67d
sycall berjalan dengan baik :D
mikeleo03 Apr 15, 2023
7ace88a
Temporary initial screen template for shell
mikeleo03 Apr 15, 2023
41d36cb
main shell interface done
mikeleo03 Apr 15, 2023
15c3ea0
input processer - ready to parse
mikeleo03 Apr 15, 2023
cc5d738
add buffer clear mechanism
mikeleo03 Apr 17, 2023
364a8ac
fix : page-fault handling while giving input
mikeleo03 Apr 24, 2023
57dcedd
feat : argparse mechanism
mikeleo03 Apr 24, 2023
9384599
fix: add a proper end of line char to input argument
GoDillonAudris512 Apr 24, 2023
aa82f8f
fix : input parser
mikeleo03 Apr 25, 2023
beb75b8
feat : initialize print current working dir
mikeleo03 Apr 25, 2023
eb85560
chore: change some file to enable user-shell link with other file , s…
GoDillonAudris512 Apr 25, 2023
8c9ebc0
Determine how input will be processed
GoDillonAudris512 Apr 25, 2023
f2baf20
fix: extern the current_directory and initialize it in c instead. nee…
GoDillonAudris512 Apr 25, 2023
4230fd2
fix : puts enter mechanism
mikeleo03 Apr 25, 2023
17a90d1
feat : cat + FAT32 req
mikeleo03 Apr 25, 2023
53a4c75
mkdir command working
GoDillonAudris512 Apr 25, 2023
50461d8
chore: change comment and include file
GoDillonAudris512 Apr 25, 2023
41b14e8
refactor: bigger argument buffer, add ls to command processing
GoDillonAudris512 Apr 25, 2023
6678e76
feat: mkdir enable to create multiple folder with different path argu…
GoDillonAudris512 Apr 25, 2023
9e37a7c
ls command working with 0, 1, or multiple argument path
GoDillonAudris512 Apr 25, 2023
ff71433
fix: ensure that there is no folder/file with a same name in the same…
GoDillonAudris512 Apr 26, 2023
f0b349e
fix: change how ls behaves with a path containing file
GoDillonAudris512 Apr 26, 2023
d3d9afe
fix: change how mkdir behaves with path containing file
GoDillonAudris512 Apr 26, 2023
6f85bfa
feat : add cat + update user-shell
mikeleo03 Apr 26, 2023
13ce4d4
cd command working properly
GoDillonAudris512 Apr 26, 2023
f1b66fd
feat : print current working directory
mikeleo03 Apr 26, 2023
faa8883
feat : cp command
Nat10k Apr 26, 2023
9f18161
chore : delete unused comments
Nat10k Apr 26, 2023
2360660
fix : cat support extensions
mikeleo03 Apr 26, 2023
3724193
feat : basic scheme of whereis
mikeleo03 Apr 26, 2023
718044b
fix: filesystem: enable a subdir to have the same name as its parent
GoDillonAudris512 Apr 27, 2023
59e1f64
fix : whereis and extension file-folder handling
mikeleo03 Apr 27, 2023
26e3dc9
feat: add rm command
AustinPardosi Apr 27, 2023
2546d05
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
AustinPardosi Apr 27, 2023
10bf043
fix: rm working properly for folder
AustinPardosi Apr 27, 2023
528ce77
chore : cat extension handling update mechanism
mikeleo03 Apr 27, 2023
dc99829
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
mikeleo03 Apr 27, 2023
bf78f48
fix : update whereis and run well
mikeleo03 Apr 27, 2023
428b4cc
feat : space handling on whereis and done
mikeleo03 Apr 27, 2023
2890906
update README
mikeleo03 Apr 28, 2023
b002ea4
fix: rm can handle extention
AustinPardosi Apr 28, 2023
9588eb5
feat: add initial screen
AustinPardosi Apr 28, 2023
ff587d8
fix : change one of cp error message
Nat10k Apr 28, 2023
57ca5ff
feat : splash screen
Nat10k Apr 28, 2023
8c84617
fix : error when pressing enter without args
Nat10k Apr 28, 2023
a165ef1
fix: rm fixing some bug
AustinPardosi Apr 28, 2023
8ca7a0c
fix: filesystem : wrong operation to fill dir table (write -> read)
GoDillonAudris512 Apr 28, 2023
9481fcc
Merge branch 'main' of https://github.com/Sister20/if2230-2023-apagakeos
GoDillonAudris512 Apr 28, 2023
ffbac04
fix : rm errors
Nat10k Apr 28, 2023
ca010eb
feat : add new command : clear
mikeleo03 Apr 29, 2023
b5ddb4a
feat : clear restriction + edit filename
mikeleo03 Apr 29, 2023
00b0fb2
chore : update README
mikeleo03 Apr 29, 2023
027e485
fix : cp handle if extension longer than 3 characters
Nat10k Apr 29, 2023
f8beabd
feat: add command mv
AustinPardosi Apr 29, 2023
b8dda37
fix : cp error message
Nat10k Apr 29, 2023
ff573f7
fix: mv checking error
AustinPardosi Apr 29, 2023
b5f067a
fix: mv parse function
GoDillonAudris512 Apr 29, 2023
a62f9a5
fix : whereis extension handling
mikeleo03 Apr 29, 2023
9463ca7
fix : mv features complete
Nat10k Apr 29, 2023
0517f91
Change output of command error and fix delete filesystem
GoDillonAudris512 Apr 29, 2023
05b4cc3
fix : rm handles exception
Nat10k Apr 29, 2023
0a9cae3
FINAL COMMIT
GoDillonAudris512 Apr 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"type": "shell",
"label": "Launch QEMU",
"command": "echo Starting QEMU&qemu-system-i386 -s -S -cdrom os2023.iso",
"command": "echo Starting QEMU&qemu-system-i386 -s -S -drive file=storage.bin,format=raw,if=ide,index=0,media=disk -cdrom os2023.iso",
"isBackground": true,
"dependsOn": "Build OS",
"options": {
Expand Down
28 changes: 19 additions & 9 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CC = gcc
# Directory
SOURCE_FOLDER = src
OUTPUT_FOLDER = bin
ISO_NAME = os2023
ISO_NAME = OS2023.iso

# Flags
WARNING_CFLAG = -Wall -Wextra -Werror
Expand All @@ -15,20 +15,25 @@ STRIP_CFLAG = -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfi
CFLAGS = $(DEBUG_CFLAG) $(WARNING_CFLAG) $(STRIP_CFLAG) -m32 -c -I$(SOURCE_FOLDER)
AFLAGS = -f elf32 -g -F dwarf
LFLAGS = -T $(SOURCE_FOLDER)/linker.ld -melf_i386

ISOFLAGS = -no-emul-boot -boot-load-size 4 -A os -input-charset utf8 -quiet -boot-info-table

run: all
@qemu-system-i386 -s -S -cdrom $(OUTPUT_FOLDER)/$(ISO_NAME).iso
@qemu-system-i386 -s -S -drive file=storage.bin,format=raw,if=ide,index=0,media=disk -cdrom os2023.iso

all: build
build: iso
clean:
rm -rf *.o *.iso $(OUTPUT_FOLDER)/kernel



kernel:
@$(ASM) $(AFLAGS) $(SOURCE_FOLDER)/kernel_loader.s -o $(OUTPUT_FOLDER)/kernel_loader.o
# TODO: Compile C file with CFLAGS
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/portio/portio.c -o $(OUTPUT_FOLDER)/portio.o
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/std/stdmem.c -o $(OUTPUT_FOLDER)/stdmem.o
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/filesystem/disk.c -o $(OUTPUT_FOLDER)/disk.o
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/filesystem/fat32.c -o $(OUTPUT_FOLDER)/fat32.o
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/framebuffer/framebuffer.c -o $(OUTPUT_FOLDER)/framebuffer.o
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/gdt/gdt.c -o $(OUTPUT_FOLDER)/gdt.o
@$(ASM) $(AFLAGS) $(SOURCE_FOLDER)/kernel/kernel_loader.s -o $(OUTPUT_FOLDER)/kernel_loader.o
@$(CC) $(CFLAGS) $(SOURCE_FOLDER)/kernel/kernel.c -o $(OUTPUT_FOLDER)/kernel.o
@$(LIN) $(LFLAGS) bin/*.o -o $(OUTPUT_FOLDER)/kernel
@echo Linking object files and generate elf32...
@rm -f *.o
Expand All @@ -38,5 +43,10 @@ iso: kernel
@cp $(OUTPUT_FOLDER)/kernel $(OUTPUT_FOLDER)/iso/boot/
@cp other/grub1 $(OUTPUT_FOLDER)/iso/boot/grub/
@cp $(SOURCE_FOLDER)/menu.lst $(OUTPUT_FOLDER)/iso/boot/grub/
# TODO: Create ISO image
@rm -r $(OUTPUT_FOLDER)/iso/
@cd bin && genisoimage -R -b boot/grub/grub1 $(ISOFLAGS) -o $(ISO_NAME) iso

# Disk
DISK_NAME = storage

disk:
@qemu-img create -f raw $(OUTPUT_FOLDER)/$(DISK_NAME).bin 4M
51 changes: 51 additions & 0 deletions src/filesystem/disk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "disk.h"
#include "../portio/portio.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor tips, flag -I(SOURCE_FOLDER) di GCC sebenarnya menambah header file search location, jadi semestinya #include "lib-header/portio.h" atau #include "portio/portio.h" bisa

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oiyaa bisa, Thanks kak buat tipsnya!


static void ATA_busy_wait() {
while (in(0x1F7) & ATA_STATUS_BSY);
}

static void ATA_DRQ_wait() {
while (!(in(0x1F7) & ATA_STATUS_RDY));
}

void read_blocks(void *ptr, uint32_t logical_block_address, uint8_t block_count) {
ATA_busy_wait();
out(0x1F6, 0xE0 | ((logical_block_address >> 24) & 0xF));
out(0x1F2, block_count);
out(0x1F3, (uint8_t) logical_block_address);
out(0x1F4, (uint8_t) (logical_block_address >> 8));
out(0x1F5, (uint8_t) (logical_block_address >> 16));
out(0x1F7, 0x20);

uint16_t *target = (uint16_t*) ptr;

for (uint32_t i = 0; i < block_count; i++) {
ATA_busy_wait();
ATA_DRQ_wait();
for (uint32_t j = 0; j < HALF_BLOCK_SIZE; j++)
target[j] = in16(0x1F0);
// Note : uint16_t => 2 bytes, HALF_BLOCK_SIZE*2 = BLOCK_SIZE with pointer arithmetic
target += HALF_BLOCK_SIZE;
}
}

void write_blocks(const void *ptr, uint32_t logical_block_address, uint8_t block_count) {
ATA_busy_wait();
out(0x1F6, 0xE0 | ((logical_block_address >> 24) & 0xF));
out(0x1F2, block_count);
out(0x1F3, (uint8_t) logical_block_address);
out(0x1F4, (uint8_t) (logical_block_address >> 8));
out(0x1F5, (uint8_t) (logical_block_address >> 16));
out(0x1F7, 0x30);

for (uint32_t i = 0; i < block_count; i++) {
ATA_busy_wait();
ATA_DRQ_wait();
/* Note : uint16_t => 2 bytes, i is current block number to write
HALF_BLOCK_SIZE*i = block_offset with pointer arithmetic
*/
for (uint32_t j = 0; j < HALF_BLOCK_SIZE; j++)
out16(0x1F0, ((uint16_t*) ptr)[HALF_BLOCK_SIZE*i + j]);
}
}
44 changes: 44 additions & 0 deletions src/filesystem/disk.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef _DISK_H
#define _DISK_H

#include "../std/stdtype.h"

/* -- ATA PIO status codes -- */
#define ATA_STATUS_BSY 0x80
#define ATA_STATUS_RDY 0x40
#define ATA_STATUS_DRQ 0x08
#define ATA_STATUS_DF 0x20
#define ATA_STATUS_ERR 0x01

#define BLOCK_SIZE 512
#define HALF_BLOCK_SIZE (BLOCK_SIZE/2)

// Block buffer data type - @param buf Byte buffer with size of BLOCK_SIZE
struct BlockBuffer {
uint8_t buf[BLOCK_SIZE];
} __attribute__((packed));

/**
* ATA PIO logical block address read blocks. Will blocking until read is completed.
* Note: ATA PIO will use 2-bytes per read/write operation.
* Recommended to use struct BlockBuffer
*
* @param ptr Pointer for storing reading data, this pointer should point to already allocated memory location.
* With allocated size positive integer multiple of BLOCK_SIZE, ex: buf[1024]
* @param logical_block_address Block address to read data from. Use LBA addressing
* @param block_count How many block to read, starting from block logical_block_address to lba-1
*/
void read_blocks(void *ptr, uint32_t logical_block_address, uint8_t block_count);

/**
* ATA PIO logical block address write blocks. Will blocking until write is completed.
* Note: ATA PIO will use 2-bytes per read/write operation.
* Recommended to use struct BlockBuffer
*
* @param ptr Pointer to data that to be written into disk. Memory pointed should be positive integer multiple of BLOCK_SIZE
* @param logical_block_address Block address to write data into. Use LBA addressing
* @param block_count How many block to write, starting from block logical_block_address to lba-1
*/
void write_blocks(const void *ptr, uint32_t logical_block_address, uint8_t block_count);

#endif
138 changes: 138 additions & 0 deletions src/filesystem/fat32.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#include "../std/stdtype.h"
#include "fat32.h"
#include "../std/stdmem.h"

const uint8_t fs_signature[BLOCK_SIZE] = {
'C', 'o', 'u', 'r', 's', 'e', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'D', 'e', 's', 'i', 'g', 'n', 'e', 'd', ' ', 'b', 'y', ' ', ' ', ' ', ' ', ' ',
'L', 'a', 'b', ' ', 'S', 'i', 's', 't', 'e', 'r', ' ', 'I', 'T', 'B', ' ', ' ',
'M', 'a', 'd', 'e', ' ', 'w', 'i', 't', 'h', ' ', '<', '3', ' ', ' ', ' ', ' ',
'-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '2', '0', '2', '3', '\n',
[BLOCK_SIZE-2] = 'O',
[BLOCK_SIZE-1] = 'k',
};

struct FAT32DriverState driverState;

/* -- Driver Interfaces -- */

/**
* Convert cluster number to logical block address
*
* @param cluster Cluster number to convert
* @return uint32_t Logical Block Address
*/
uint32_t cluster_to_lba(uint32_t cluster) {
return cluster * CLUSTER_SIZE;
}

/**
* Initialize DirectoryTable value with parent DirectoryEntry and directory name
*
* @param dir_table Pointer to directory table
* @param name 8-byte char for directory name
* @param parent_dir_cluster Parent directory cluster number
*/
void init_directory_table(struct FAT32DirectoryTable *dir_table, char *name, uint32_t parent_dir_cluster);

/**
* Checking whether filesystem signature is missing or not in boot sector
*
* @return True if memcmp(boot_sector, fs_signature) returning inequality
*/
bool is_empty_storage(void) {
return memcmp(fs_signature, BOOT_SECTOR, BLOCK_SIZE);
}

/**
* Create new FAT32 file system. Will write fs_signature into boot sector and
* proper FileAllocationTable (contain CLUSTER_0_VALUE, CLUSTER_1_VALUE,
* and initialized root directory) into cluster number 1
*/
void create_fat32(void) {
struct FAT32FileAllocationTable table;
table.cluster_map[0] = CLUSTER_0_VALUE;
table.cluster_map[1] = CLUSTER_1_VALUE;
table.cluster_map[2] = FAT32_FAT_END_OF_FILE;

write_blocks(fs_signature, cluster_to_lba(0), (uint8_t) CLUSTER_SIZE);
write_blocks(&table, cluster_to_lba(1), (uint8_t) CLUSTER_SIZE);
}

/**
* Initialize file system driver state, if is_empty_storage() then create_fat32()
* Else, read and cache entire FileAllocationTable (located at cluster number 1) into driver state
*/
void initialize_filesystem_fat32(void) {
if (is_empty_storage()) {
create_fat32();
}
else {
read_blocks(&(driverState.fat_table), cluster_to_lba(1), (uint8_t) CLUSTER_SIZE);

}
}

/**
* Write cluster operation, wrapper for write_blocks().
* Recommended to use struct ClusterBuffer
*
* @param ptr Pointer to source data
* @param cluster_number Cluster number to write
* @param cluster_count Cluster count to write, due limitation of write_blocks block_count 255 => max cluster_count = 63
*/
void write_clusters(const void *ptr, uint32_t cluster_number, uint8_t cluster_count);

/**
* Read cluster operation, wrapper for read_blocks().
* Recommended to use struct ClusterBuffer
*
* @param ptr Pointer to buffer for reading
* @param cluster_number Cluster number to read
* @param cluster_count Cluster count to read, due limitation of read_blocks block_count 255 => max cluster_count = 63
*/
void read_clusters(void *ptr, uint32_t cluster_number, uint8_t cluster_count);





/* -- CRUD Operation -- */

/**
* FAT32 Folder / Directory read
*
* @param request buf point to struct FAT32DirectoryTable,
* name is directory name,
* ext is unused,
* parent_cluster_number is target directory table to read,
* buffer_size must be exactly sizeof(struct FAT32DirectoryTable)
* @return Error code: 0 success - 1 not a folder - 2 not found - -1 unknown
*/
int8_t read_directory(struct FAT32DriverRequest request);


/**
* FAT32 read, read a file from file system.
*
* @param request All attribute will be used for read, buffer_size will limit reading count
* @return Error code: 0 success - 1 not a file - 2 not enough buffer - 3 not found - -1 unknown
*/
int8_t read(struct FAT32DriverRequest request);

/**
* FAT32 write, write a file or folder to file system.
*
* @param request All attribute will be used for write, buffer_size == 0 then create a folder / directory
* @return Error code: 0 success - 1 file/folder already exist - 2 invalid parent cluster - -1 unknown
*/
int8_t write(struct FAT32DriverRequest request);


/**
* FAT32 delete, delete a file or empty directory (only 1 DirectoryEntry) in file system.
*
* @param request buf and buffer_size is unused
* @return Error code: 0 success - 1 not found - 2 folder is not empty - -1 unknown
*/
int8_t delete(struct FAT32DriverRequest request);
Loading