コード例 #1
0
ファイル: rtc6.cs プロジェクト: li1794/rtclib
        private bool IsListReady(uint count)
        {
            if (this.CtlGetStatus(RtcStatus.Aborted))
            {
                return(false);
            }
            const uint RTC6_LIST_BUFFER_MAX = 4000;

            if ((this.listCount + count) >= RTC6_LIST_BUFFER_MAX)
            {
                uint busy, position;
                busy = position = 0;
                RTC6Wrap.n_get_status(this.Index + 1, out busy, out position);
                if (0 != busy)
                {
                    RTC6Wrap.n_set_end_of_list(this.Index + 1);
                    RTC6Wrap.n_execute_list(this.Index + 1, this.listIndex);
                    this.listIndex = this.listIndex ^ 0x03;
                    RTC6Wrap.n_set_start_list(this.Index + 1, this.listIndex);
                }
                else
                {
                    RTC6Wrap.n_set_end_of_list(this.Index + 1);
                    if (this.CtlGetStatus(RtcStatus.Aborted))
                    {
                        return(false);
                    }

                    RTC6Wrap.n_auto_change(this.Index + 1);
                    uint readStatus = 0;
                    switch (this.listIndex)
                    {
                    case 1:
                        do
                        {
                            readStatus = RTC6Wrap.n_read_status(this.Index + 1);
                            System.Threading.Thread.Sleep(1);
                        }while (Convert.ToBoolean(readStatus & 0x20));
                        break;

                    case 2:
                        do
                        {
                            readStatus = RTC6Wrap.n_read_status(this.Index + 1);
                            System.Threading.Thread.Sleep(1);
                        }while (Convert.ToBoolean(readStatus & 0x10));
                        break;
                    }
                    if (this.CtlGetStatus(RtcStatus.Aborted))
                    {
                        return(false);
                    }
                    this.listIndex = this.listIndex ^ 0x03;
                    RTC6Wrap.n_set_start_list(this.Index + 1, this.listIndex);
                }
                this.listCount = count;
            }
            this.listCount += count;
            return(true);
        }
コード例 #2
0
ファイル: rtc6.cs プロジェクト: li1794/rtclib
        public bool ListExecute(bool busyWait = true)
        {
            if (this.CtlGetStatus(RtcStatus.Aborted))
            {
                return(false);
            }
            uint busy, position;

            busy = position = 0;
            RTC6Wrap.n_get_status(this.Index + 1, out busy, out position);
            if (busy > 0)
            {
                RTC6Wrap.n_auto_change(this.Index + 1);
            }
            if (busyWait)
            {
                this.CtlBusyWait();
            }
            if (this.CtlGetStatus(RtcStatus.Aborted))
            {
                return(false);
            }
            return(true);
        }