コード例 #1
0
        /* Configuration Space Items*/
        private void menuCfgOffset_Click(object sender, System.EventArgs e)
        {
            C6678DSP_Device dev =
                pciDevList.Get(lstBxDevices.SelectedIndex);
            CfgTransfersForm cfgOffsetFrom = new CfgTransfersForm(dev);

            cfgOffsetFrom.GetInput();
        }
コード例 #2
0
        private void menuCfgReg_Click(object sender, System.EventArgs e)
        {
            C6678DSP_Device dev =
                pciDevList.Get(lstBxDevices.SelectedIndex);
            RegistersForm regForm = new RegistersForm(dev, ACTION_TYPE.CFG);

            regForm.GetInput();
        }
コード例 #3
0
        /* Address Space Item */
        private void menuAddrRW_Click(object sender, System.EventArgs e)
        {
            C6678DSP_Device dev =
                pciDevList.Get(lstBxDevices.SelectedIndex);

            string[] sBars = dev.AddrDescToString(false);
            AddrSpaceTransferForm addrSpcFrm = new
                                               AddrSpaceTransferForm(dev, sBars);

            addrSpcFrm.GetInput();
        }
コード例 #4
0
        /* Event Items*/
        private void menuEvents_Select(object sender, System.EventArgs e)
        {
            if (menuEvents.Enabled == false)
            {
                return;
            }
            C6678DSP_Device dev = pciDevList.Get(lstBxDevices.SelectedIndex);

            menuRegisterEvent.Text = dev.IsEventRegistered() ?
                                     "Unregister Events" : "Register Events";
        }
コード例 #5
0
        /* Interrupts items*/

        private void menuInterrupts_Select(object sender,
                                           System.EventArgs e)
        {
            if (menuInterrupts.Enabled == false)
            {
                return;
            }
            C6678DSP_Device dev    = pciDevList.Get(lstBxDevices.SelectedIndex);
            bool            bIsEnb = dev.IsEnabledInt();

            menuEnableInt.Text = bIsEnb? "Disable Interrupts":
                                 "Enable Interrupts";
        }
コード例 #6
0
        /* Menu*/
        private void UpdateMenu(int index)
        {
            C6678DSP_Device dev =
                pciDevList.Get(lstBxDevices.SelectedIndex);

            if (dev.Handle == IntPtr.Zero)
            {
                DisableMenu();
            }
            else
            {
                EnableMenu();
            }
        }
コード例 #7
0
        private void menuItem2_Click(object sender, EventArgs e)
        {
            C6678DSP_Device dev  = pciDevList.Get(lstBxDevices.SelectedIndex);
            IntPtr          data = IntPtr.Zero;

            dev.ReadDMA(0x0c000000, 0x1000, ref data);
            FileStream fs;

            fs = new FileStream("F:\\test", FileMode.OpenOrCreate, FileAccess.Write);
            byte[] array = new byte[1024];
            Marshal.Copy(data, array, 0, 1024);
            fs.Write(array, 0, 1024);
            fs.Close();
        }
コード例 #8
0
        /* Close handle to a C6678DSP device */
        private BOOL DeviceClose(int iSelectedIndex)
        {
            C6678DSP_Device device  = pciDevList.Get(iSelectedIndex);
            BOOL            bStatus = false;

            if (device.Handle != IntPtr.Zero && !(bStatus = device.Close()))
            {
                Log.ErrLog("C6678DSP_diag.DeviceClose: Failed closing C6678DSP "
                           + "device (" + device.ToString(false) + ")");
            }
            else
            {
                device.Handle = IntPtr.Zero;
            }
            return(bStatus);
        }
コード例 #9
0
        /* Open a handle to a device */
        private bool DeviceOpen(int iSelectedIndex)
        {
            DWORD           dwStatus;
            C6678DSP_Device device = pciDevList.Get(iSelectedIndex);

            /* Open a handle to the device */
            dwStatus = device.Open();
            if (dwStatus != (DWORD)wdc_err.WD_STATUS_SUCCESS)
            {
                Log.ErrLog("C6678DSP_diag.DeviceOpen: Failed opening a " +
                           "handle to the device (" + device.ToString(false) + ")");
                return(false);
            }
            Log.TraceLog("C6678DSP_diag.DeviceOpen: The device was successfully open." +
                         "You can now activate the device through the enabled menu above");
            return(true);
        }
コード例 #10
0
        public AddrSpaceTransferForm(C6678DSP_Device dev, string[] sBars)
        {
            InitializeComponent();

            m_device = dev;

            for (int i = 0; i < sBars.Length; ++i)
            {
                cmboBar.Items.Add(sBars[i]);
            }

            this.Text = "Read/Write Address Space Form";

            cmboMode.Items.AddRange(new object[] { "8 bits", "16 bits", "32 bits", "64 bits" });
            cmboTransType.Items.AddRange(new object[] { "block", "non-block" });
            chkBoxInc.Enabled   = false;
            txtNumBytes.Enabled = false;
        }
コード例 #11
0
 /* device button */
 private void btDevice_Click(object sender, System.EventArgs e)
 {
     if (btDevice.Text == "Open Device")
     {
         if (DeviceOpen(lstBxDevices.SelectedIndex) == true)
         {
             btDevice.Text = "Close Device";
             EnableMenu();
         }
     }
     else
     {
         C6678DSP_Device dev =
             pciDevList.Get(lstBxDevices.SelectedIndex);
         DeviceClose(lstBxDevices.SelectedIndex);
         btDevice.Text = "Open Device";
         DisableMenu();
     }
 }
コード例 #12
0
        public RegistersForm(C6678DSP_Device dev, ACTION_TYPE regType)
        {
            InitializeComponent();

            m_device  = dev;
            m_regType = regType;

            switch (regType)
            {
            case ACTION_TYPE.CFG:
            {
                this.Text        = "Read/Write Configuration Space by Registers";
                lblRegs.Visible  = true;
                lblRegs.Text     = "Choose a Cfg Register";
                cmboRegs.Visible = true;
                WDC_REG[] regs = dev.Regs.gC6678DSP_CfgRegs;
                for (int i = 0; i < regs.GetLength(0); ++i)
                {
                    cmboRegs.Items.AddRange(new object[] { regs[i].sName +
                                                           " size: " + regs[i].dwSize.ToString("X") +
                                                           " - " + regs[i].sDesc });
                }
                break;
            }

            case ACTION_TYPE.RT:
            {
                this.Text        = "Read/Write RunTime Registers";
                lblRegs.Visible  = true;
                lblRegs.Text     = "Choose a RunTime Register";
                cmboRegs.Visible = true;
                WDC_REG[] regs = m_device.Regs.gC6678DSP_RT_Regs;
                for (int i = 0; i < regs.GetLength(0); ++i)
                {
                    cmboRegs.Items.AddRange(new object[] { regs[i].sName +
                                                           " size: " + regs[i].dwSize.ToString("X") +
                                                           " - " + regs[i].sDesc });
                }
                break;
            }
            }
        }
コード例 #13
0
        private void menuEnableInt_Click(object sender,
                                         System.EventArgs e)
        {
            C6678DSP_Device dev = pciDevList.Get(lstBxDevices.SelectedIndex);

            if (menuEnableInt.Text == "Enable Interrupts")
            {
                DWORD dwStatus = dev.EnableInterrupts(new
                                                      USER_INTERRUPT_CALLBACK(C6678DSP_IntHandler), dev.Handle);
                if (dwStatus == (DWORD)wdc_err.WD_STATUS_SUCCESS)
                {
                    menuEnableInt.Text = "Disable Interrupts";
                }
            }
            else
            {
                DWORD dwStatus = dev.DisableInterrupts();
                if (dwStatus == (DWORD)wdc_err.WD_STATUS_SUCCESS)
                {
                    menuEnableInt.Text = "Enable Interrupts";
                }
            }
        }
コード例 #14
0
        public CfgTransfersForm(C6678DSP_Device dev)
        {
            InitializeComponent();

            m_device = dev;
        }
コード例 #15
0
 private void C6678DSP_IntHandler(C6678DSP_Device dev)
 {
     Log.TraceLog("interrupt for device {" + dev.ToString(false) +
                  "} received!");
 }
コード例 #16
0
        //initInbound
        private void menuItem3_Click(object sender, EventArgs e)
        {
            C6678DSP_Device dev = pciDevList.Get(lstBxDevices.SelectedIndex);

            dev.InitInBound();
        }
コード例 #17
0
        private void C6678DSP_EventHandler(ref WD_EVENT wdEvent, C6678DSP_Device dev)
        {
            string sAction;

            switch ((WD_EVENT_ACTION)wdEvent.dwAction)
            {
            case WD_EVENT_ACTION.WD_INSERT:
                sAction = "WD_INSERT";
                break;

            case WD_EVENT_ACTION.WD_REMOVE:
                sAction = "WD_REMOVE";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D0:
                sAction = "WD_POWER_CHANGED_D0";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D1:
                sAction = "WD_POWER_CHANGED_D1";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D2:
                sAction = "WD_POWER_CHANGED_D2";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D3:
                sAction = "WD_POWER_CHANGED_D3";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_WORKING:
                sAction = "WD_POWER_SYSTEM_WORKING";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SLEEPING1:
                sAction = "WD_POWER_SYSTEM_SLEEPING1";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SLEEPING2:
                sAction = "WD_POWER_SYSTEM_SLEEPING2";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SLEEPING3:
                sAction = "WD_POWER_SYSTEM_SLEEPING3";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_HIBERNATE:
                sAction = "WD_POWER_SYSTEM_HIBERNATE";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SHUTDOWN:
                sAction = "WD_POWER_SYSTEM_SHUTDOWN";
                break;

            default:
                sAction = wdEvent.dwAction.ToString("X");
                break;
            }
            Log.TraceLog("Received event notification of type " + sAction +
                         " on " + dev.ToString(false));
        }