Beispiel #1
0
PUBLIC void task_hd()
{
    MESSAGE msg;
    init_hd();

    while (true) {
        send_recv(RECEIVE, ANY, &msg);
        int src = msg.source;

        switch (msg.type) {
        case DEV_OPEN:
            hd_identify(0);
            //hd_open(msg.DEVICE);
            break;
        case DEV_CLOSE:
            hd_close(msg.DEVICE);
            break;
        case DEV_READ:
        case DEV_WRITE:
            hd_rdwt(&msg);
            break;
        case DEV_IOCTL:
            hd_ioctl(&msg);
            break;
        default:
            kprintf("[KERNEL ERROR]HD driveer::unknown msg");
            break;
        }

        send_recv(SEND, src, &msg);
    }
}
Beispiel #2
0
/**
 * Main loop of HD driver.
 *
 *****************************************************************************/
PUBLIC void task_hd()
{
    MESSAGE msg;
    init_hd();
    while (1) {
        send_recv(RECEIVE, ANY, &msg);
        int src = msg.source;

        switch (msg.type) {
        case DEV_OPEN:
            hd_open(msg.DEVICE);
            break;

        case DEV_CLOSE:
            hd_close(msg.DEVICE);
            break;

        case DEV_READ:
        case DEV_WRITE:
            hd_rdwt(&msg);
            break;

        case DEV_IOCTL:
            hd_ioctl(&msg);
            break;

        default:
            dump_msg("HD driver::unknown msg", &msg);
            spin("FS::main_loop (invalid msg.type)");
            break;
        }

        send_recv(SEND, src, &msg);
    }
}
Beispiel #3
0
Datei: hd.c Projekt: Zach41/OS
PUBLIC void task_hd() {
    MESSAGE msg;

    init_hd();
    printl("Task HD begins.\n");
    while (TRUE) {
	send_recv(RECEIVE, ANY, &msg);

	int src = msg.source;

	switch(msg.type) {
	case DEV_OPEN:
	    /* 获得硬盘的信息 */
	    /* hd_identify(0); */
	    hd_open(msg.DEVICE);
	    break;
	case DEV_CLOSE:
	    hd_close(msg.DEVICE);
	    break;
	case DEV_READ:
	case DEV_WRITE:
	    hd_rdwt(&msg);
	    break;
	case DEV_IOCTL:
	    hd_ioctl(&msg);
	    break;
	default:
	    panic("HD driver::unknown msg");
	}

	send_recv(SEND, src, &msg);
    }
}
Beispiel #4
0
/*
功能:
    处理硬盘相关请求的任务进程。初始化后,永久运行接收有关硬盘请求的信息
参数:
    (无)
返回值:
    (无)
*/
void task_hd(){
    MESSAGE message;
#ifdef DEBUG_HD
    printl("in task_hd\n");
#endif 
   //初始化硬盘
    init_hd();

    while(1){
        reset_message(&message);
        send_receive(RECEIVE,ANY,&message);
        
        int src=message.source_pid;
        switch(message.type){
        case INFO_FS_OPEN:
            hd_open(&message);
            break;
        case INFO_FS_CLOSE:
            hd_close(&message);
            break;
        case INFO_FS_READ:
        case INFO_FS_WRITE:
            hd_rdwt(&message);
            break;
        case INFO_FS_IOCTL:
            hd_ioctl(&message);
            break;
        case INFO_FS_DEVICE:
            hd_device_info(&message);
            break;
        default:
            //panic("unkonw message type(%d) in task_hd",src);
            break;
        }
        
#ifdef DEBUG_HD
        printl("in task_hd\n");
#endif
        /* message.source_pid=process2pid(p_process_ready); */
        send_receive(SEND,src,&message);
    }
}