Example #1
0
        private static void Reset_Control_Block_Thread()
        {
            m_reset_cb.WaitOne();
            string str = "";

            byte[] array   = new byte[0x41];
            byte[] buffer2 = new byte[0x41];
            string str2    = "";

            Array.Clear(array, 0, array.Length);
            Array.Clear(buffer2, 0, buffer2.Length);
            I2CS.reset_buffers();
            if (USBWrite.Update_Status_Packet())
            {
                Utilities.m_flags.g_status_packet_mutex.WaitOne();
                for (int i = 0; i < array.Length; i++)
                {
                    array[i] = Constants.STATUS_PACKET_DATA[i];
                }
                Utilities.m_flags.g_status_packet_mutex.ReleaseMutex();
                USBWrite.configure_outbound_control_block_packet(ref buffer2, ref str, ref array);
                USBWrite.write_and_verify_config_block(ref buffer2, ref str, true, ref str2);
            }
            m_reset_cb.ReleaseMutex();
        }
Example #2
0
        public static bool Clear_Comm_Errors()
        {
            bool result = false;

            I2CS.reset_buffers();
            if (USBWrite.Send_CommReset_Cmd() && USBWrite.Send_Warm_Reset_Cmd())
            {
                result = true;
            }
            return(result);
        }
Example #3
0
        private static void process_i2c_slave_data(ref bool p_error)
        {
            I2CS.m_slave_address_was_just_set = false;
            I2CS.m_master_is_waiting_for_data = false;
            I2CS.m_stop_command_issued        = false;
            switch (m_raw_cbuf2_data_array[m_cb2_array_tag_index])
            {
            case 0xc0:
            case 0xc1:
            case 0xc2:
            case 0xc7:
                if ((m_raw_cbuf2_data_array_index - m_cb2_array_tag_index) < 2)
                {
                    m_we_need_next_packet_to_continue = true;
                    return;
                }
                switch (m_raw_cbuf2_data_array[m_cb2_array_tag_index])
                {
                case 0xc0:
                    I2CS.m_previous_slave_addr_received = I2CS.m_last_slave_addr_received;
                    I2CS.m_last_slave_addr_received     = m_raw_cbuf2_data_array[(int)((IntPtr)(m_cb2_array_tag_index + 1))];
                    I2CS.m_slave_address_was_just_set   = true;
                    I2CS.issue_event();
                    goto Label_0131;

                case 0xc1:
                    add_data_to_cbuf2_data_array(ref m_raw_cbuf2_data_array, m_cb2_array_tag_index + 1, 1);
                    goto Label_0131;

                case 0xc7:
                    I2CS.issue_error();
                    goto Label_0131;
                }
                break;

            case 0xc3:
                m_cb2_array_tag_index++;
                return;

            case 0xc4:
                m_cb2_array_tag_index++;
                return;

            case 0xc6:
                m_cb2_array_tag_index++;
                I2CS.m_stop_command_issued = true;
                I2CS.issue_event();
                I2CS.reset_buffers();
                return;

            case 200:
                m_cb2_array_tag_index++;
                I2CS.m_master_is_waiting_for_data = true;
                I2CS.issue_event();
                return;

            case 0xc9:
            case 0xca:
                if ((m_raw_cbuf2_data_array_index - m_cb2_array_tag_index) < 3)
                {
                    m_we_need_next_packet_to_continue = true;
                    return;
                }
                switch (m_raw_cbuf2_data_array[m_cb2_array_tag_index])
                {
                }
                m_cb2_array_tag_index += 3;
                return;

            case 0xcb:
                m_cb2_array_tag_index += (uint)(m_raw_cbuf2_data_array[(int)((IntPtr)(m_cb2_array_tag_index + 3))] + 4);
                return;

            default:
                p_error = true;
                return;
            }
Label_0131:
            m_cb2_array_tag_index += 2;
        }