📄 dps2spc3.lst
字号:
646 /*~
647 dps2_set_io_data_len()
648 ~*/
649 /*
650 +------------------------------------------------------------------------+
651 | Function: d p s 2 _ s e t _ i o _ d a t a _ l e n ( ) |
652 +------------------------------------------------------------------------+
653 | Description: |
654 | The lens are checked against the initialization-lens. If they are |
655 | correct, the pointers and lens in the SPC3 are armed. |
656 +------------------------------------------------------------------------+
657 | Parameters: |
658 | -len_ptr: pointer to len-structure |
659 | |
660 | Returncode: |
661 | TRUE: ok |
662 | FALSE: len-mismatch |
663 +------------------------------------------------------------------------+
664 */
665 UBYTE dps2_set_io_data_len(DPS2_IO_DATA_LEN SPC3_DATA_ATTR *len_ptr) reentrant
666 {
667 1 UBYTE ri_len, ro_len; /* real lens */
668 1 UBYTE ri_off; /* input-buffer-offset */
669 1 UBYTE i;
670 1
671 1 if(len_ptr->outp_data_len > 244)
672 1 {
673 2 return FALSE;
674 2 }
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 12
675 1 if(len_ptr->inp_data_len > 244)
676 1 {
677 2 return FALSE;
678 2 }
679 1 if((UWORD)len_ptr->inp_data_len + (UWORD)len_ptr->outp_data_len >
680 1 dps2_binit.din_dout_buf_len)
681 1 {
682 2 return FALSE;
683 2 }
684 1 /*-- lens correkt, arm buffers --*/
685 1 spc3.r_len_dout_buf = len_ptr->outp_data_len;
686 1 spc3.r_len_din_buf = len_ptr->inp_data_len;
687 1 ro_len = ((len_ptr->outp_data_len) + 7) >> 3;
688 1 ri_len = ((len_ptr->inp_data_len) + 7) >> 3;
689 1
690 1 for(i = 0; i < sizeof(spc3.r_dout_buf_ptr); i++)
691 1 {
692 2 spc3.r_dout_buf_ptr[i] = SPC3_BUF_START + ro_len * i;
693 2 }
694 1 ri_off = ro_len * sizeof(spc3.r_dout_buf_ptr);
695 1
696 1 for(i = 0; i < sizeof(spc3.r_din_buf_ptr); i++)
697 1 {
698 2 spc3.r_din_buf_ptr[i] = SPC3_BUF_START + ri_off + ri_len * i;
699 2 }
700 1 return TRUE;
701 1 }
702 /* Ende dps2_set_io_data_len */
703
704 /*~
705 dps2_cfg_data_ok()
706 ~*/
707 /*
708 +------------------------------------------------------------------------+
709 | Function: d p s 2 _ c f g _ d a t a _ o k ( ) |
710 +------------------------------------------------------------------------+
711 | Description: |
712 | New config-data is marked as ok. |
713 +------------------------------------------------------------------------+
714 | Parameters: - |
715 | |
716 | Returncode: |
717 | UBYTE: DPS2_CFG_FINISHED: ok |
718 | DPS2_CFG_CONFLICT: data overridden while check |
719 +------------------------------------------------------------------------+
720 */
721 UBYTE dps2_cfg_data_ok(void)
722 {
723 1 spc3.x1.w.mode_reg1_r = EN_CHG_CFG_BUFFER;
724 1 return spc3.user_cfg_data_ok;
725 1 }
726 /* Ende dps2_cfg_data_ok() */
727
728 /*~
729 dps2_cfg_data_update()
730 ~*/
731 /*
732 +------------------------------------------------------------------------+
733 | Function: d p s 2 _ c f g _ d a t a _ u p d a t e ( ) |
734 +------------------------------------------------------------------------+
735 | Description: |
736 | see dps2_cfg_data_ok(), additional there are new cfg-data. |
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 13
737 +------------------------------------------------------------------------+
738 | Parameters: - |
739 | |
740 | Returncode: see dps2_cfg_data_ok() |
741 +------------------------------------------------------------------------+
742 */
743 UBYTE dps2_cfg_data_update(void)
744 {
745 1 spc3.x1.w.mode_reg1_s = EN_CHG_CFG_BUFFER;
746 1 spc3.r_len_read_cfg_buf = spc3.r_len_cfg_buf;
747 1 return spc3.user_cfg_data_ok;
748 1 }
749 /* Ende dps2_cfg_data_update() */
750
751 /*~
752 dps2_cfg_data_not_ok()
753 ~*/
754 /*
755 +------------------------------------------------------------------------+
756 | Function: d p s 2 _ c f g _ d a t a _ n o t _ o k ( ) |
757 +------------------------------------------------------------------------+
758 | Description: |
759 | See dps2_cfg_data_ok(), but config-data is not correct. |
760 +------------------------------------------------------------------------+
761 | Parameters: - |
762 | |
763 | Returncode: see dps2_cfg_data_ok() |
764 +------------------------------------------------------------------------+
765 */
766 UBYTE dps2_cfg_data_not_ok(void)
767 {
768 1 spc3.x1.w.mode_reg1_r = EN_CHG_CFG_BUFFER;
769 1 return spc3.user_cfg_data_nok;
770 1 }
771 /* Ende dps2_cfg_data_not_ok() */
772
773 /*~
774 dps2_output_update_state()
775 ~*/
776 /*
777 +------------------------------------------------------------------------+
778 | Function: d p s 2 _ o u t p u t _ u p d a t e _ s t a t e ( ) |
779 +------------------------------------------------------------------------+
780 | Description: |
781 | This function causes the output-update. The state is returned. |
782 +------------------------------------------------------------------------+
783 | Parameters: |
784 | -state_ptr: pointer to state-value |
785 | |
786 | Returncode: |
787 | void*: pointer to output-buffer |
788 +------------------------------------------------------------------------+
789 */ //get gid in 070927
790 // void SPC3_PTR_ATTR* dps2_output_update_state(UBYTE SPC3_DATA_ATTR *state_ptr
791 // )
792 // {
793 // UBYTE temp;
794 //
795 // temp = spc3.x1.r.next_dout_buf_cmd;
796 // *state_ptr = temp & (NEW_DOUT_BUF | DOUT_BUF_CLEARED);
797 // return (void SPC3_PTR_ATTR*)
798 // ((((SPC3_ADTYP)(spc3.r_dout_buf_ptr[(temp & 0x03)-1]))<<3) + (SPC3_ADTYP)&spc3);
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 14
799 // }
800 /* Ende dps2_output_update_state() */
801
802 /*~
803 dps2_diag_update()
804 ~*/
805 /*
806 +------------------------------------------------------------------------+
807 | Function: d p s 2 _ d i a g _ u p d a t e ( ) |
808 +------------------------------------------------------------------------+
809 | Description: |
810 | This function causes the diagnostic-update in the SPC3. |
811 +------------------------------------------------------------------------+
812 | Parameter: |
813 | |
814 | Returncode: |
815 | -pointer to new diagnostic-buffer, if available; else 0 |
816 +------------------------------------------------------------------------+
817 */
818 void SPC3_PTR_ATTR* dps2_diag_update(void)
819 {
820 1 UBYTE temp;
821 1
822 1 temp = spc3.new_diag_buffer_cmd & 0x03;
823 1
824 1 switch(temp)
825 1 {
826 2 case 1: /* buffer with Index 0 */
827 2 {
828 3 return (void SPC3_PTR_ATTR*)((SPC3_ADTYP)(((UWORD)
829 3 spc3.r_diag_buf_ptr[0])<<3) + (SPC3_ADTYP)&spc3);
830 3 }
831 2 case 2: /* buffer with Index 1 */
832 2 {
833 3 return (void SPC3_PTR_ATTR*)((SPC3_ADTYP)(((UWORD)
834 3 spc3.r_diag_buf_ptr[1])<<3) + (SPC3_ADTYP)&spc3);
835 3 }
836 2 default:
837 2 {
838 3 /* no buffer */
839 3 return SPC3_NIL;
840 3 }
841 2 }
842 1 }
843 /* Ende dps2_diag_update() */
844
845 #ifdef _C166
#pragma public
#endif
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 3354 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 13 35
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -