tkernel_2/driver/tef_em1d/sysdsk/src/inthdr.c | bare source | permlink (0.01 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T-Kernel 2.0 Software Package 4: * 5: * Copyright 2011 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17. 10: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01. 11: * 12: *---------------------------------------------------------------------- 13: */ 14: 15: 16: /* 17: * inthdr.c System disk driver 18: * 19: * Common interrupt handler ("ATA" and "PC" card) 20: */ 21: 22: #include "sdisk.h" 23: 24: /* 25: * Register the interrupt handler 26: */ 27: EXPORT ER sdDefIntHdr(DrvTab *drv, BOOL regist) 28: { 29: ER er; 30: T_DINT dint; 31: 32: dint.intatr = TA_HLNG; 33: 34: if (drv->Spec.accif == MEM_ACCIF) return E_OK; /* Ignore */ 35: 36: if (drv->Spec.pccard) { /* PC card */ 37: er = E_NOSPT; 38: 39: } else { /* Fixed hardware */ 40: er = E_NOSPT; 41: } 42: if (er >= E_OK) { 43: if (regist && drv->Spec.accif == ATA_ACCIF) { 44: ataEnbInt(drv); /* ATA interrupt enabled */ 45: } 46: return E_OK; 47: } 48: return er; 49: } 50: /* 51: * Set the wait-for-interrupt 52: */ 53: EXPORT void sdSetIntWait(DrvTab *drv) 54: { 55: /* Get the task number that waits for interrupt */ 56: drv->WaitTskId = tk_get_tid(); 57: 58: /* Clear the previous wakeup request */ 59: tk_can_wup(drv->WaitTskId); 60: }