📄 dps2spc3.lst
字号:
659 dps2_set_io_data_len() 主调user_dps_reset .U
660 ~*/
661 /*
662 +------------------------------------------------------------------------+
663 | Function: d p s 2 _ s e t _ i o _ d a t a _ l e n ( ) |
664 +------------------------------------------------------------------------+
665 | Description: (相对与初始化检查lens,如果正确,SPC3的指针和lens将装入) |
666 | The lens are checked against the initialization-lens. If they are |
667 | correct, the pointers and lens in the SPC3 are armed. |
668 +------------------------------------------------------------------------+
669 | Parameters: |
670 |-len_ptr: pointer to len-structure(即user_io_data_len_ptr,I/O数据长度指针)|
671 | |
672 | Returncode: |
C51 COMPILER V7.02b DPS2SPC3 11/01/2004 20:51:04 PAGE 12
673 | TRUE: ok |
674 | FALSE: len-mismatch |
675 +------------------------------------------------------------------------+
676 */
677 UBYTE dps2_set_io_data_len(DPS2_IO_DATA_LEN SPC3_DATA_ATTR *len_ptr)
678 {
679 1 UBYTE ri_len, ro_len; /* real lens */
680 1 UBYTE ri_off; /* input-buffer-offset */
681 1 UBYTE i;
682 1
683 1 if(len_ptr->outp_data_len > 244)
684 1 {
685 2 return FALSE;
686 2 }
687 1 if(len_ptr->inp_data_len > 244)
688 1 {
689 2 return FALSE;
690 2 }
691 1 if((UWORD)len_ptr->inp_data_len + (UWORD)len_ptr->outp_data_len >
692 1 dps2_binit.din_dout_buf_len)
693 1 {
694 2 return FALSE;
695 2 }
696 1 /*-- lens correkt, arm buffers --*/
697 1 spc3.r_len_dout_buf = len_ptr->outp_data_len;
698 1 spc3.r_len_din_buf = len_ptr->inp_data_len;
699 1 ro_len = ((len_ptr->outp_data_len) + 7) >> 3;
700 1 ri_len = ((len_ptr->inp_data_len) + 7) >> 3;
701 1
702 1 for(i = 0; i < sizeof(spc3.r_dout_buf_ptr); i++)/*r_dout_buf_ptr 3元素数组*/
703 1 {
704 2 spc3.r_dout_buf_ptr[i] = SPC3_BUF_START + ro_len * i;
705 2 }
706 1 ri_off = ro_len * sizeof(spc3.r_dout_buf_ptr);
707 1
708 1 for(i = 0; i < sizeof(spc3.r_din_buf_ptr); i++)
709 1 {
710 2 spc3.r_din_buf_ptr[i] = SPC3_BUF_START + ri_off + ri_len * i;
711 2 }
712 1 return TRUE;
713 1 }
714 /* Ende dps2_set_io_data_len */
715
716 /*~
717 dps2_cfg_data_ok()
718 ~*/
719 /*
720 +------------------------------------------------------------------------+
721 | Function: d p s 2 _ c f g _ d a t a _ o k ( ) |
722 +------------------------------------------------------------------------+
723 | Description: |
724 | New config-data is marked as ok. |
725 +------------------------------------------------------------------------+
726 | Parameters: - |
727 | |
728 | Returncode: |
729 | UBYTE: DPS2_CFG_FINISHED: ok |
730 | DPS2_CFG_CONFLICT: data overridden while check |
731 +------------------------------------------------------------------------+
732 */
733 UBYTE dps2_cfg_data_ok(void)
734 {
C51 COMPILER V7.02b DPS2SPC3 11/01/2004 20:51:04 PAGE 13
735 1 spc3.x1.w.mode_reg1_r = EN_CHG_CFG_BUFFER;
736 1 return spc3.user_cfg_data_ok;
737 1 }
738 /* Ende dps2_cfg_data_ok() */
739
740 /*~
741 dps2_cfg_data_update()
742 ~*/
743 /*
744 +------------------------------------------------------------------------+
745 | Function: d p s 2 _ c f g _ d a t a _ u p d a t e ( ) |
746 +------------------------------------------------------------------------+
747 | Description: |
748 | see dps2_cfg_data_ok(), additional there are new cfg-data. |
749 +------------------------------------------------------------------------+
750 | Parameters: - |
751 | |
752 | Returncode: see dps2_cfg_data_ok() |
753 +------------------------------------------------------------------------+
754 */
755 UBYTE dps2_cfg_data_update(void)
756 {
757 1 spc3.x1.w.mode_reg1_s = EN_CHG_CFG_BUFFER;
758 1 spc3.r_len_read_cfg_buf = spc3.r_len_cfg_buf;
759 1 return spc3.user_cfg_data_ok;
760 1 }
761 /* Ende dps2_cfg_data_update() */
762
763 /*~
764 dps2_cfg_data_not_ok()
765 ~*/
766 /*
767 +------------------------------------------------------------------------+
768 | Function: d p s 2 _ c f g _ d a t a _ n o t _ o k ( ) |
769 +------------------------------------------------------------------------+
770 | Description: |
771 | See dps2_cfg_data_ok(), but config-data is not correct. |
772 +------------------------------------------------------------------------+
773 | Parameters: - |
774 | |
775 | Returncode: see dps2_cfg_data_ok() |
776 +------------------------------------------------------------------------+
777 */
778 UBYTE dps2_cfg_data_not_ok(void)
779 {
780 1 spc3.x1.w.mode_reg1_r = EN_CHG_CFG_BUFFER;
781 1 return spc3.user_cfg_data_nok;
782 1 }
783 /* Ende dps2_cfg_data_not_ok() */
784
785 /*~
786 dps2_output_update_state()
787 ~*/
788 /*
789 +------------------------------------------------------------------------+
790 | Function: d p s 2 _ o u t p u t _ u p d a t e _ s t a t e ( ) |
791 +------------------------------------------------------------------------+
792 | Description: |
793 | This function causes the output-update. The state is returned. |
794 +------------------------------------------------------------------------+
795 | Parameters: |
796 | -state_ptr: pointer to state-value |
C51 COMPILER V7.02b DPS2SPC3 11/01/2004 20:51:04 PAGE 14
797 | |
798 | Returncode: |
799 | void*: pointer to output-buffer |
800 +------------------------------------------------------------------------+
801 */ /*查看next_dout_buf_cmd,判断用哪个Dout_Buffer,然后计算指针*/
802 void SPC3_PTR_ATTR* dps2_output_update_state(UBYTE SPC3_DATA_ATTR *state_ptr)
803 {
804 1 UBYTE temp;
805 1 temp = spc3.x1.r.next_dout_buf_cmd;/* 0BH,The user fetches the last DP Dout-Buffer from the N state,
-PDF36 */
806 1 *state_ptr = temp & (NEW_DOUT_BUF | DOUT_BUF_CLEARED);
807 1 return (void SPC3_PTR_ATTR*)
808 1 ((((SPC3_ADTYP)(spc3.r_dout_buf_ptr[(temp & 0x03)-1]))<<3)\
809 1 + (SPC3_ADTYP)&spc3);
810 1 }
811 /* Ende dps2_output_update_state() */
812
813 /*~
814 dps2_diag_update()
815 ~*/
816 /*
817 +------------------------------------------------------------------------+
818 | Function: d p s 2 _ d i a g _ u p d a t e ( ) |
819 +------------------------------------------------------------------------+
820 | Description: |
821 | This function causes the diagnostic-update in the SPC3. |
822 +------------------------------------------------------------------------+
823 | Parameter: |
824 | |
825 | Returncode: (如可用,返回指向新诊断buf的指针; 否则返回0) |
826 | -pointer to new diagnostic-buffer, if available; else 0 |
827 +------------------------------------------------------------------------+
828 */
829 void SPC3_PTR_ATTR* dps2_diag_update(void)
830 {
831 1 UBYTE temp;
832 1
833 1 temp = spc3.new_diag_buffer_cmd & 0x03;
834 1 /* new_diag_buffer_cmd为0DH,PDF35 */
835 1 switch(temp)
836 1 {
837 2 case 1: /* buffer with Index 0 */
838 2 {
839 3 return (void SPC3_PTR_ATTR*)((SPC3_ADTYP)(((UWORD)
840 3 spc3.r_diag_buf_ptr[0])<<3) + (SPC3_ADTYP)&spc3);
841 3 }
842 2 case 2: /* buffer with Index 1 */
843 2 {
844 3 return (void SPC3_PTR_ATTR*)((SPC3_ADTYP)(((UWORD)
845 3 spc3.r_diag_buf_ptr[1])<<3) + (SPC3_ADTYP)&spc3);
846 3 }
847 2 default:
848 2 {
849 3 /* no buffer */
850 3 return SPC3_NIL;
851 3 }
852 2 }
853 1 }
854 /* Ende dps2_diag_update() */
855
856 #ifdef _C166
#pragma public
C51 COMPILER V7.02b DPS2SPC3 11/01/2004 20:51:04 PAGE 15
#endif
859
860
861
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 2985 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 13 47
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 + -