; ==== ISUAL Flight Software -- Univ of California, Berkeley, SSL ==== ; PVCFDPU - generate PVCFs from Packets - DPU version ; (this version does not use DCM) ; ; Revision History: ; 18-Dec-2002 - SPG - ISUAL Flight Software rev 7.3 ; First Official Release ; 26-July-2004 ; Bring up-to-date with PVCFDCM ; 26-Mar-2003 - SPG - FSW rev 7.7 ; PVCF_FLUSH writes dummy packet with PVCF_DPU, not PVCF_MM ; 6-Aug-2003 ; fixed PVCF_FLUSH to not write last PVCF ; from partly undefined MM ; 13-Oct-2003 if MM off, pretend SC buffers are full ; (which prevents writing any more PVCFs) ; 16-Oct-2003 ; implement GBL_PVSTART ; 21-Oct-2003 - eliminate "P" debug output ; 30-Oct-03 - release ILK if SC fault dummy_packet db 0,0,0,0 ds 2 PVCF_FLUSH: ; force a flush of the current PVCF by sending ; a dummy packet which begins with zero ; (marking the end of a PVCF stream for the ; ground software) and a length of 1105 ; ; do nothing if PVCF_START hasn't been called lda GBL_PVSTART cpi 0 rz lxi h,1105 mov a,h sta dummy_packet+4 mov a,l sta dummy_packet+5 lxi h,dummy_packet ; (header) ; ***6-Aug-2003 lxi d,GBL_PP_MMSC1 ; (MM addr of data) call PVCF_MM ret include pvcf.i include ioports.i include util.i include gbl.i include mm.i include debug.i ; Functions to generate PVCFs from Packets - DPU version ;mm_fetch equ GBL_PVCF_PROM ;mm_store equ GBL_PVCF_PROM+16 G equ GBL_PVCF_PROM+32 vcfc equ G+0 ; ds 1 ; Virtual Channel Frame Count p_pvcf equ G+1 ; ds 2 ; pointer into PVCF mm_addr equ G+3 ; ds 4 ; MM addr of current PVCF ; pointer to count of PVCFs stored pCount equ G+7 ; ds 2 ; location and size of spacecraft buffers current_store_buffer equ G+9 ; ds 1 ; 1 or 2 source_count equ G+10 ; ds 2 dest_count equ G+12 ; ds 2 chktlr equ G+14 ; ds 1 ; db 0AAh p_source equ G+16 ; ds 2 checksum equ G+18 ; ds 1 PVCF_INIT: mvi a,0FFh sta GBL_DCM_STATUS ; not using the DCM mvi a,0 sta GBL_PVCF_ILK ; not using interlock either sta vcfc ; Virtual Frame counter =0 mvi a,0AAh sta chktlr+1 ret ; GBL.I allocates 60 bytes to "PVCF_PROM" workarea ; GBL_PVCF is a work area for building a PVCF ; includes one byte slop for storing final 0 pvcf equ GBL_BPVCF ; high 5 bits of 2nd byte of PVCF header ; 0 - sec header flag ; 0 - synchro ; 0 - packet order ; 11- segment length code hdrbits equ 18h ; size of PVCF = 1108 bytes, or 277 32-bit words (115 hex) ; as a 4-byte number C1108 db 0,0,01h,15h PVCF_START: push psw push b push d push h ; setup first PVCF call new_pvcf ; set pointer to 1st spacecraft buffer lxi h,GBL_PP_MMSC1 lxi d,mm_addr mvi c,4 call copy_bytes ; we are filling buffer 1 mvi a,1 sta current_store_buffer ; set SC buffers to empty mvi a,0 sta GBL_SC_BUF1 sta GBL_SC_BUF2 lxi h,0 shld GBL_SOH+71 shld GBL_SOH+73 ; set pointer to PVCF count lxi h,GBL_SOH+71 shld pCount mvi a,1 sta GBL_PVSTART ; PVCF_START has now been called pop h pop d pop b pop psw ret ; Send packet from DPU memory ; HL - address of Primary and Secondary headers ; DE - address of data PVCF_DPU: push psw push b push d push h ; if both SC buffers full, throw away data lda GBL_SC_BUF1 cpi 1 jnz okdpu lda GBL_SC_BUF2 cpi 1 jnz okdpu scfault: lxi h,GBL_SOH+75 ; SC Fault inr M mvi a,1 sta GBL_SOH+12 ; at least one fault happened jmp xit okdpu: push d ; >>save data pointer ; copy primary header call copy_header_to_pvcf ; get data length lxi b,4 dad b ; point to last 2 bytes of pri hdr mov b,M inx h mov c,M push b ; >>save length inx h ; clear checksum (accumulated by 'copy_to_pvcf') mvi a,0 sta checksum ; copy secondary header to PVCF lxi b,10 call copy_to_pvcf ; get length of data to follow pop b ; <>save MM address pointer push h ; >>save pointer th headers plus ; copy primary header call copy_header_to_pvcf ; clear checksum (accumulated by 'copy_to_pvcf') mvi a,0 sta checksum ; copy secondary header and other stuff to PVCF lxi b,6 ; step past pri hdr dad b lxi b,14 call copy_to_pvcf ; get number-of-valid-words from packet data pop h ; <