Minimig: fix behaviour of disk led, add led activity to shared folder access.

This commit is contained in:
sorgelig
2021-07-31 06:57:18 +08:00
parent 97ad1c07e7
commit aebed6b479
5 changed files with 18 additions and 5 deletions

View File

@@ -1050,6 +1050,12 @@ int toggle_kbdled(int mask)
return state;
}
static int sysled_is_enabled = 1;
void sysled_enable(int en)
{
sysled_is_enabled = en;
}
#define JOYMAP_DIR "inputs/"
static int load_map(const char *name, void *pBuffer, int size)
{
@@ -4047,7 +4053,10 @@ int input_test(int getchar)
if ((pool[NUMDEV + 2].fd >= 0) && (pool[NUMDEV + 2].revents & POLLPRI))
{
static char status[16];
if (read(pool[NUMDEV + 2].fd, status, sizeof(status) - 1) && status[0] != '0') DISKLED_ON;
if (read(pool[NUMDEV + 2].fd, status, sizeof(status) - 1) && status[0] != '0')
{
if (sysled_is_enabled || video_fb_state()) DISKLED_ON;
}
lseek(pool[NUMDEV + 2].fd, 0, SEEK_SET);
}
}

View File

@@ -74,6 +74,7 @@
void set_kbdled(int mask, int state);
int get_kbdled(int mask);
int toggle_kbdled(int mask);
void sysled_enable(int en);
void input_notify_mode();
int input_poll(int getchar);

View File

@@ -614,19 +614,15 @@ void HandleFDD(unsigned char c1, unsigned char c2)
if (c1 & CMD_RDTRK)
{
DISKLED_ON;
sel = (c1 >> 6) & 0x03;
df[sel].track = c2;
ReadTrack(&df[sel]);
DISKLED_OFF;
}
else if (c1 & CMD_WRTRK)
{
DISKLED_ON;
sel = (c1 >> 6) & 0x03;
df[sel].track = c2;
WriteTrack(&df[sel]);
DISKLED_OFF;
}
}

View File

@@ -620,6 +620,7 @@ static int process_request(void *reqres_buffer)
break;
}
DISKLED_ON;
uint32_t length = SWAP_INT(req->length);
length = FileReadAdv(&open_file_handles[key], shmem + DATA_BUFFER, length);
@@ -642,6 +643,7 @@ static int process_request(void *reqres_buffer)
break;
}
DISKLED_ON;
uint32_t length = SWAP_INT(req->length);
length = FileWriteAdv(&open_file_handles[key], shmem + DATA_BUFFER, length);
@@ -720,6 +722,7 @@ static int process_request(void *reqres_buffer)
break;
}
DISKLED_ON;
if (PathIsDir(name, 0))
{
ret = DirDelete(name) ? 0 : ERROR_DIRECTORY_NOT_EMPTY;
@@ -784,6 +787,7 @@ static int process_request(void *reqres_buffer)
break;
}
DISKLED_ON;
if (rename(buf, fp2))
{
ret = ERROR_OBJECT_NOT_FOUND;
@@ -801,6 +805,7 @@ static int process_request(void *reqres_buffer)
CreateDirResponse *res = (CreateDirResponse*)reqres_buffer;
sz_res = sizeof(CreateDirResponse);
DISKLED_ON;
char *name = find_path(SWAP_INT(req->key), req->name + 1);
if (!FileCreatePath(name))
{

View File

@@ -2513,7 +2513,9 @@ void user_io_poll()
spi_w(0);
spi_w(0);
DisableFpga();
sysled_enable(0);
HandleFDD(c1, c2);
sysled_enable(1);
uint16_t sd_req = ide_check();
if (sd_req & 0x8000)