From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/imio/iki/qpf/qpfopix.x | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sys/imio/iki/qpf/qpfopix.x (limited to 'sys/imio/iki/qpf/qpfopix.x') diff --git a/sys/imio/iki/qpf/qpfopix.x b/sys/imio/iki/qpf/qpfopix.x new file mode 100644 index 00000000..9b5750ff --- /dev/null +++ b/sys/imio/iki/qpf/qpfopix.x @@ -0,0 +1,55 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include +include "qpf.h" + +# QPF_OPIX -- Open the "pixel storage file", i.e., open the special QPF/QPOE +# virtual file driver, which samples the QPOE event list in real time to +# produce image "pixels", where each pixel contains a count of the number of +# photons mapping to that point in the output image matrix. + +procedure qpf_opix (im, status) + +pointer im #I image descriptor +int status #O return status + +pointer sp, fname, qpf +extern qpfzop(), qpfzrd(), qpfzwr(), qpfzwt(), qpfzst(), qpfzcl() +int fopnbf() + +begin + status = OK + if (IM_PFD(im) != NULL) + return + + # Verify that the QPIO open succeeded at open time; if not, the file + # may not have an event list (which is legal, but not for pixel i/o). + + qpf = IM_KDES(im) + if (QPF_IO(qpf) == NULL) { + status = ERR + return + } + + call smark (sp) + call salloc (fname, SZ_FNAME, TY_CHAR) + + # Encode the QPF descriptor as a pseudo-filename to pass the descriptor + # through fopnbf to the QPF virtual binary file driver. + + call sprintf (Memc[fname], SZ_FNAME, "QPF%d") + call pargi (IM_KDES(im)) + + # Open a file descriptor for the dummy QPOE file driver, used to access + # the event list as a virtual pixel array (sampled at runtime). + + iferr (IM_PFD(im) = fopnbf (Memc[fname], READ_ONLY, + qpfzop, qpfzrd, qpfzwr, qpfzwt, qpfzst, qpfzcl)) { + + IM_PFD(im) = NULL + status = ERR + } + + call sfree (sp) +end -- cgit