private void masterCardInitialize() { Thread.Sleep(100); I16 rc; U16 ringStatus = 0; int getRingStatusRt = CMNET_L132.CS_mnet_get_ring_status((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard, ref ringStatus); if (getRingStatusRt != 0) { I16 exitsCard = 0; CPCI_L132.CS_l132_open(ref exitsCard); if (exitsCard == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DidntFindL132"))); } Thread.Sleep(30); rc = CPCI_L132.CS_l132_dsp_pci_boot((U16)Parameter.CardSwitchNo); Thread.Sleep(30); rc = CMNET_L132.CS_mnet_initial((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("InitializeErrorL132"))); } } Thread.Sleep(30); rc = CMNET_L132.CS_mnet_reset_ring((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard); Thread.Sleep(30); rc = CMNET_L132.CS_mnet_start_ring((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("StartupErrorL132"))); } }
private void slaveModuleInitialize() { uint mask = 0x00000001; uint[] deviceTable = new uint[2]; I16 retOfGetTable = CMNET_L132.CS_mnet_get_ring_active_table((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, ref deviceTable[0]); if (retOfGetTable != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DeviceTableError") + "(" + DeviceName + ")")); } if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DidntFindM1X1") + "(" + DeviceName + ")")); } for (int i = 0; i < 64; i++) { if (axisPara.SlaveIP > 63) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } if (axisPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } } } mask = mask << 1; } I16 retOfStartRing = CMNET_L132.CS_mnet_start_ring((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard); if (retOfStartRing != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("StartCommError") + "(" + DeviceName + ")")); } U8 slaveType = 0; I16 retOfGetSlaveType = CMNET_L132.CS_mnet_get_slave_type((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, ref slaveType); if (retOfGetSlaveType == 0) { if (slaveType != 0xA3) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongDeviceTypeM1X1") + "(" + DeviceName + ")")); } } else { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DeviceTableError") + "(" + DeviceName + ")")); } I16 retOfInitial = CMNET_L132.CS_mnet_m1_initial((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); if (retOfInitial != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("InitializeErrorM1X1") + "(" + DeviceName + ")")); } }