word_t setMRs_fault(tcb_t *sender, tcb_t *receiver, word_t *receiveIPCBuffer) { switch (seL4_Fault_get_seL4_FaultType(sender->tcbFault)) { case seL4_Fault_CapFault: setMR(receiver, receiveIPCBuffer, seL4_CapFault_IP, getRestartPC(sender)); setMR(receiver, receiveIPCBuffer, seL4_CapFault_Addr, seL4_Fault_CapFault_get_address(sender->tcbFault)); setMR(receiver, receiveIPCBuffer, seL4_CapFault_InRecvPhase, seL4_Fault_CapFault_get_inReceivePhase(sender->tcbFault)); return setMRs_lookup_failure(receiver, receiveIPCBuffer, sender->tcbLookupFailure, seL4_CapFault_LookupFailureType); case seL4_Fault_UnknownSyscall: { copyMRsFault(sender, receiver, MessageID_Syscall, n_syscallMessage, receiveIPCBuffer); return setMR(receiver, receiveIPCBuffer, n_syscallMessage, seL4_Fault_UnknownSyscall_get_syscallNumber(sender->tcbFault)); } case seL4_Fault_UserException: { copyMRsFault(sender, receiver, MessageID_Exception, n_exceptionMessage, receiveIPCBuffer); setMR(receiver, receiveIPCBuffer, n_exceptionMessage, seL4_Fault_UserException_get_number(sender->tcbFault)); return setMR(receiver, receiveIPCBuffer, n_exceptionMessage + 1u, seL4_Fault_UserException_get_code(sender->tcbFault)); } #ifdef CONFIG_HARDWARE_DEBUG_API case seL4_Fault_DebugException: { word_t reason = seL4_Fault_DebugException_get_exceptionReason(sender->tcbFault); setMR(receiver, receiveIPCBuffer, seL4_DebugException_FaultIP, getRestartPC(sender)); unsigned int ret = setMR(receiver, receiveIPCBuffer, seL4_DebugException_ExceptionReason, reason); if (reason != seL4_SingleStep && reason != seL4_SoftwareBreakRequest) { ret = setMR(receiver, receiveIPCBuffer, seL4_DebugException_TriggerAddress, seL4_Fault_DebugException_get_breakpointAddress(sender->tcbFault)); /* Breakpoint messages also set a "breakpoint number" register. */ ret = setMR(receiver, receiveIPCBuffer, seL4_DebugException_BreakpointNumber, seL4_Fault_DebugException_get_breakpointNumber(sender->tcbFault)); } return ret; } #endif /* CONFIG_HARDWARE_DEBUG_API */ default: return Arch_setMRs_fault(sender, receiver, receiveIPCBuffer, seL4_Fault_get_seL4_FaultType(sender->tcbFault)); } }
/* The default handler of ip chaged */ void default_ip_conflict(void) { // WIZchip Software Reset setMR(MR_RST); getMR(); // for delay setSHAR(DHCP_CHADDR); }
/** @brief This function is for resetting of the iinchip. Initializes the iinchip to work in whether DIRECT or INDIRECT mode */ void wizSWReset() { setMR( MR_RST ); #ifdef __DEF_IINCHIP_DBG__ printf("MR value is %02x \r\n",IINCHIP_READ(MR)); #endif }
/** @brief This function is for resetting of the iinchip. Initializes the iinchip to work in whether DIRECT or INDIRECT mode */ void iinchip_init(void) { setMR( MR_RST ); #ifdef __DEF_IINCHIP_DBG__ printf("MR value is %02x \r\n",IINCHIP_READ_COMMON(MR)); #endif }
/* The default handler of ip chaged */ void default_ip_update(void) { /* WIZchip Software Reset */ setMR(MR_RST); getMR(); // for delay default_ip_assign(); setSHAR(DHCP_CHADDR); }
int8_t wizchip_setnetmode(netmode_type netmode) { uint8_t tmp = 0; #if _WIZCHIP_ != 5500 if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK)) return -1; #else if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK | NM_FORCEARP)) return -1; #endif tmp = getMR(); tmp |= (uint8_t)netmode; setMR(tmp); return 0; }
void wizchip_sw_reset(void) { uint8_t gw[4], sn[4], sip[4]; uint8_t mac[6]; getSHAR(mac); getGAR(gw); getSUBR(sn); getSIPR(sip); setMR(MR_RST); getMR(); // for delay setSHAR(mac); setGAR(gw); setSUBR(sn); setSIPR(sip); }
void wizchip_sw_reset(void) { uint8_t gw[4], sn[4], sip[4]; uint8_t mac[6]; //A20150601 #if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_ uint16_t mr = (uint16_t)getMR(); setMR(mr | MR_IND); #endif // getSHAR(mac); getGAR(gw); getSUBR(sn); getSIPR(sip); setMR(MR_RST); getMR(); // for delay //A2015051 : For indirect bus mode #if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_ setMR(mr | MR_IND); #endif // setSHAR(mac); setGAR(gw); setSUBR(sn); setSIPR(sip); }
static inline unsigned int setMRs_lookup_failure(tcb_t *receiver, word_t *receiveIPCBuffer, lookup_fault_t luf, unsigned int offset) { word_t lufType = lookup_fault_get_lufType(luf); word_t i; i = setMR(receiver, receiveIPCBuffer, offset, lufType + 1); /* check constants match libsel4 */ if (offset == seL4_CapFault_LookupFailureType) { assert(offset + 1 == seL4_CapFault_BitsLeft); assert(offset + 2 == seL4_CapFault_DepthMismatch_BitsFound); assert(offset + 2 == seL4_CapFault_GuardMismatch_GuardFound); assert(offset + 3 == seL4_CapFault_GuardMismatch_BitsFound); } else { assert(offset == 1); } switch (lufType) { case lookup_fault_invalid_root: return i; case lookup_fault_missing_capability: return setMR(receiver, receiveIPCBuffer, offset + 1, lookup_fault_missing_capability_get_bitsLeft(luf)); case lookup_fault_depth_mismatch: setMR(receiver, receiveIPCBuffer, offset + 1, lookup_fault_depth_mismatch_get_bitsLeft(luf)); return setMR(receiver, receiveIPCBuffer, offset + 2, lookup_fault_depth_mismatch_get_bitsFound(luf)); case lookup_fault_guard_mismatch: setMR(receiver, receiveIPCBuffer, offset + 1, lookup_fault_guard_mismatch_get_bitsLeft(luf)); setMR(receiver, receiveIPCBuffer, offset + 2, lookup_fault_guard_mismatch_get_guardFound(luf)); return setMR(receiver, receiveIPCBuffer, offset + 3, lookup_fault_guard_mismatch_get_bitsFound(luf)); default: fail("Invalid lookup failure"); } }
word_t Arch_setMRs_fault(tcb_t *sender, tcb_t* receiver, word_t *receiveIPCBuffer, word_t faultType) { switch (faultType) { case seL4_Fault_VMFault: { if (config_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) { word_t ipa, va; va = getRestartPC(sender); ipa = (addressTranslateS1CPR(va) & ~MASK(PAGE_BITS)) | (va & MASK(PAGE_BITS)); setMR(receiver, receiveIPCBuffer, seL4_VMFault_IP, ipa); } else { setMR(receiver, receiveIPCBuffer, seL4_VMFault_IP, getRestartPC(sender)); } setMR(receiver, receiveIPCBuffer, seL4_VMFault_Addr, seL4_Fault_VMFault_get_address(sender->tcbFault)); setMR(receiver, receiveIPCBuffer, seL4_VMFault_PrefetchFault, seL4_Fault_VMFault_get_instructionFault(sender->tcbFault)); return setMR(receiver, receiveIPCBuffer, seL4_VMFault_FSR, seL4_Fault_VMFault_get_FSR(sender->tcbFault)); } #ifdef CONFIG_ARM_HYPERVISOR_SUPPORT case seL4_Fault_VGICMaintenance: if (seL4_Fault_VGICMaintenance_get_idxValid(sender->tcbFault)) { return setMR(receiver, receiveIPCBuffer, seL4_VGICMaintenance_IDX, seL4_Fault_VGICMaintenance_get_idx(sender->tcbFault)); } else { return setMR(receiver, receiveIPCBuffer, seL4_VGICMaintenance_IDX, -1); } case seL4_Fault_VCPUFault: return setMR(receiver, receiveIPCBuffer, seL4_VCPUFault_HSR, seL4_Fault_VCPUFault_get_hsr(sender->tcbFault)); #endif default: fail("Invalid fault"); } }