/** * Close an interface. * Called from generic network layer when ifconfig down is run. * * dev Pointer to interface struct. * * returns 0 on success, -ERRNO on failure. (Never fails.) */ int ctcm_close(struct net_device *dev) { struct ctcm_priv *priv = dev->ml_priv; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); if (!IS_MPC(priv)) fsm_event(priv->fsm, DEV_EVENT_STOP, dev); return 0; }
void Start_fsm_managerTask(void const * argument) { osEvent event; fsm_event_f fsm_event; /* Initialize FSM */ fsm_client_init(&fsm); /* Infinite loop */ for(;;) { /* Get fsm event */ event = osMailGet(queue_fsm_eventsHandle, osWaitForever); if (event.status == osEventMail) { /* Retrieve event function */ fsm_event = *((fsm_event_f *) event.value.v); /* Trigger event */ fsm_event(&fsm); } } }
static void ctcmpc_send_sweep_req(struct channel *rch) { struct net_device *dev = rch->netdev; struct ctcm_priv *priv; struct mpc_group *grp; struct th_sweep *header; struct sk_buff *sweep_skb; struct channel *ch; /* int rc = 0; */ priv = dev->ml_priv; grp = priv->mpcg; ch = priv->channel[WRITE]; /* sweep processing is not complete until response and request */ /* has completed for all read channels in group */ if (grp->in_sweep == 0) { grp->in_sweep = 1; grp->sweep_rsp_pend_num = grp->active_channels[READ]; grp->sweep_req_pend_num = grp->active_channels[READ]; } sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); if (sweep_skb == NULL) { /* rc = -ENOMEM; */ goto nomem; } header = kmalloc(TH_SWEEP_LENGTH, gfp_type()); if (!header) { dev_kfree_skb_any(sweep_skb); /* rc = -ENOMEM; */ goto nomem; } header->th.th_seg = 0x00 ; header->th.th_ch_flag = TH_SWEEP_REQ; /* 0x0f */ header->th.th_blk_flag = 0x00; header->th.th_is_xid = 0x00; header->th.th_seq_num = 0x00; header->sw.th_last_seq = ch->th_seq_num; memcpy(skb_put(sweep_skb, TH_SWEEP_LENGTH), header, TH_SWEEP_LENGTH); kfree(header); dev->trans_start = jiffies; skb_queue_tail(&ch->sweep_queue, sweep_skb); fsm_addtimer(&ch->sweep_timer, 100, CTC_EVENT_RSWEEP_TIMER, ch); return; nomem: grp->in_sweep = 0; ctcm_clear_busy(dev); fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); return; }
/** * Check sense of a unit check. * * ch The channel, the sense code belongs to. * sense The sense code to inspect. */ static inline void ccw_unit_check(struct channel *ch, __u8 sense) { CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "%s(%s): %02x", CTCM_FUNTAIL, ch->id, sense); if (sense & SNS0_INTERVENTION_REQ) { if (sense & 0x01) { if (ch->sense_rc != 0x01) { pr_notice( "%s: The communication peer has " "disconnected\n", ch->id); ch->sense_rc = 0x01; } fsm_event(ch->fsm, CTC_EVENT_UC_RCRESET, ch); } else { if (ch->sense_rc != SNS0_INTERVENTION_REQ) { pr_notice( "%s: The remote operating system is " "not available\n", ch->id); ch->sense_rc = SNS0_INTERVENTION_REQ; } fsm_event(ch->fsm, CTC_EVENT_UC_RSRESET, ch); } } else if (sense & SNS0_EQUIPMENT_CHECK) { if (sense & SNS0_BUS_OUT_CHECK) { if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, "%s(%s): remote HW error %02x", CTCM_FUNTAIL, ch->id, sense); ch->sense_rc = SNS0_BUS_OUT_CHECK; } fsm_event(ch->fsm, CTC_EVENT_UC_HWFAIL, ch); } else { if (ch->sense_rc != SNS0_EQUIPMENT_CHECK) { CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, "%s(%s): remote read parity error %02x", CTCM_FUNTAIL, ch->id, sense); ch->sense_rc = SNS0_EQUIPMENT_CHECK; } fsm_event(ch->fsm, CTC_EVENT_UC_RXPARITY, ch); } } else if (sense & SNS0_BUS_OUT_CHECK) { if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, "%s(%s): BUS OUT error %02x", CTCM_FUNTAIL, ch->id, sense); ch->sense_rc = SNS0_BUS_OUT_CHECK; } if (sense & 0x04) /* data-streaming timeout */ fsm_event(ch->fsm, CTC_EVENT_UC_TXTIMEOUT, ch); else /* Data-transfer parity error */ fsm_event(ch->fsm, CTC_EVENT_UC_TXPARITY, ch); } else if (sense & SNS0_CMD_REJECT) { if (ch->sense_rc != SNS0_CMD_REJECT) { CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, "%s(%s): Command rejected", CTCM_FUNTAIL, ch->id); ch->sense_rc = SNS0_CMD_REJECT; } } else if (sense == 0) { CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, "%s(%s): Unit check ZERO", CTCM_FUNTAIL, ch->id); fsm_event(ch->fsm, CTC_EVENT_UC_ZERO, ch); } else { CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, "%s(%s): Unit check code %02x unknown", CTCM_FUNTAIL, ch->id, sense); fsm_event(ch->fsm, CTC_EVENT_UC_UNKNOWN, ch); } }