Skip to content

Commit

Permalink
Started work on ASSIGN
Browse files Browse the repository at this point in the history
  • Loading branch information
fachat committed Jul 15, 2012
1 parent 3971952 commit 1cff9f9
Show file tree
Hide file tree
Showing 10 changed files with 816 additions and 687 deletions.
2 changes: 1 addition & 1 deletion firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SERIAL=/dev/ttyUSB0

TARGET=fw

FILES=ieee.c bus.c main.c errormsg.c cmd.c file.c term.c name.c channel.c serial.c
FILES=ieee.c bus.c main.c errormsg.c cmd.c file.c term.c name.c channel.c serial.c provider.c
DEPS=ieee.h bus.h main.h errormsg.h channel.h status.h debug.h cmd.h term.h packet.h name.h provider.h petscii.h serial.h delay.h wireformat.h

all:$(TARGET).hex
Expand Down
8 changes: 8 additions & 0 deletions firmware/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ int8_t command_execute(uint8_t channel_no, cmd_t *command, errormsg_t *errormsg,

return file_submit_call(channel_no, type, errormsg, callback);
}
if (nameinfo.cmd == CMD_ASSIGN) {

if (provider_assign(nameinfo.drive, nameinfo.name) < 0) {

return file_submit_call(channel_no, FS_ASSIGN, errormsg, callback);
}
}

return -1;
}

25 changes: 11 additions & 14 deletions firmware/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,21 @@ uint8_t file_submit_call(uint8_t channel_no, uint8_t type, errormsg_t *errormsg,
nameinfo.name[0] = 0;
}

// check filename

// TODO: keep a local end point registry just in case...
// So the drive number could select the provider (which is currently fixed
// as serial_provider below
// For now just allow all drive numbers to be passed as endpoint numbers
// if (nameinfo.drive != 0) {
// // here would be a place to handle multiple drives in a device..
// debug_puts("ILLEGAL DRIVE: "); debug_putc(0x30+nameinfo.drive); debug_putcrlf();
// set_error(errormsg, ERROR_DRIVE_NOT_READY);
// return -1;
// }

// here is the place to plug in other file system providers,
// like SD-Card, or even an outgoing IEC or IEEE, to convert between
// the two bus systems. This could be done depending on the drive number
// and be managed with the ASSIGN call.
provider_t *provider = &serial_provider;
//provider_t *provider = &serial_provider;
provider_t *provider = provider_lookup(nameinfo.drive);

// check the validity of the drive (note that in general provider_lookup
// returns a default provider - serial-over-USB to the PC, which then
// may do further checks
if (provider == NULL) {
debug_puts("ILLEGAL DRIVE: "); debug_putc(0x30+nameinfo.drive); debug_putcrlf();
set_error(errormsg, ERROR_DRIVE_NOT_READY);
return -1;
}

// find open slot
//int8_t slot = -1;
Expand Down
Binary file modified firmware/fw
Binary file not shown.
Loading

0 comments on commit 1cff9f9

Please sign in to comment.