20130112 (T.S.) - Release 2.4 cut Changes since Release 2.3 20121214 (T.S.) - src/drvPadUdpComm.c, src/wavBuf.h, src/wavBuf.c: document semantics of 'wavBufPost()': buffer is *always* taken over by this call. drvPadUdpComm must not wavBufFree() if wavBufPost() fails. - src/drvPadUdpComm.c: BUGFIX: must increase packet reference count *before* calling drvPadUdpCommPostRaw. 20121128 (T.S.) - src/drvPadUdpComm.c: added iocsh function 'drvPadUdpCommMaxCookReset()' for reading and resetting the 'max cook' statistics. - src/padProtoHost.c: -m now accepts an optional ': ' suffix so that the interface for incoming multicast traffic can be defined. - src/drvPadUdpComm.c, src/padUdpCommSupport.dbd: made 'drvPadUdpCommDebug' accessible from iocsh. - src/drvPadUdpComm.c: moved consistency checks for stream fragments so that they are not performed on the first fragment of a stream (where they trivially pass) so that non-fragmented streams incur no overhead. - src/drvPadUdpComm.c: keep a copy of the i/o methods in local scope (stack) of the Listener. This is in preparation for supporting multiple listener threads so that each one can have its own 'cookClosure'. - src/drvPadUdpComm.c: BUGFIX - drvPadUdpCommSetupFunc() should only return and do nothing if arguments are wrong (had 'return' outside of compound instead of inside). - src/drvPadUdpComm.h, src/drvPadUdpComm.c, src/hwtime.c, src/Makefile, src/fidProcess.c: o drvPadUdpCommPktTimeBaseline: now set directly from start command (rather than using XID to transport across the channel forth and back). Not an per-channel array anymore but just one number. - modified drvPadUdpCommHWTime() so that ErGetTicks() can be used under the hood. Non-EVR implementation may supply its own version. New drvPadUdpCommHWBaseTime() sets 'fidTimeBaseline' (to zero if EVR is used). - max cook time is now with respect to fidTimeBaseline. 20121120 (T.S.) - src/drvPadUdpComm.c: o made iocsh string arguments 'persistent' strings. o treat empty string args like NULL strings o fixed typo reported by Sonya o use MAX_BPM (not 1) when scanning for SQRY 20121113 (T.S.) - src/drvPadUdpComm.c, src/drvPadUdpCommIO.h: added 'int fd' argument to packet allocation function. This allows for supporting 'per-channel/per-fd' allocators (as needed by the future sis8300 driver). 20121112 (T.S.) - src/drvPadUdpComm.c: use 'recv' with indefinite timeout and use the watchdog task to issue drvPadUdpCommSendStartAll() if no data of any kind on no used channel has arrived. - README, README.drvPadUdpComm: updated docs. - src/udpCommBSD.c FIX: udpCommRecv timeout < 0 indicates wait forever; BSD implementation didn't implement that correctly. Fixed now. - src/padStream.h, src/padStream.c, src/padProto.h, src/padProto.c, src/hostStream.c, src/drvPadAdcStream.h, src/drvPadAdcStream.c, src/drvPadUdpComm.c: PADPROTO_VERSION4 adds a 'feature query' command which allows the client to find the stream formats supported by the server. - src/fidProcess.c: Use macros from event module only if TEST_ONLY is not defined. - src/drvPadUdpCommIO.h, src/drvPadUdpComm.h, src/drvPadUdpComm.c added a new 'setup' callback which is used to negotiate features requested by the client and features supported by the server. Server features are determined using the new 'stream query' protocol command provided by PADPROTO_VERSION4. drvPadUdpCommSetup() does not determine the IO methods based on the name ("VME" string vs. IP address) anymore but requires a new, third argument which passes/defines the IO methods. By default, udpComm is used. - src/drvPadUdpComm.c: BUGFIX: timeout parameters are passed to padRequest in host-byte order. - src/drvPadAdcStream.h, src/drvPadAdcStream.c: Moved several generic routines supporting the PAD digitizer into separate 'drvPadAdcStream' module (can be used by multiple apps employing PADs). Changes since Release 2.2 20120524 (T.S.) - BUGFIX: src/drvPadAdcStream.c - when reading the FIFOS the first couple of samples must be skipped as they generate initial clock cycles. Until now we used the stream packet index == 0 condition to detect the first samples. With multi-packet streams this is no longer correct. E.g., in row-major format a new row is started at a non-zero index. As a result, the second argument to 'drvPadReadFifosXXXMajor()' was changed (but is backwards compatible for streams with only single packets). - API CHANGE: src/padStream.h, src/drvPadAdcStream.h, src/drvPadAdcStream.c: PadStreamGetdataProc() received a new, additional argument: the total number of samples per channel (= 'row dimension'). This helps the low-level driver with formatting the data. CAVEAT: 'getdata' routines on PADs need to be updated to respect the new API. - src/drvPadUdpComm.c UDP listener thread priority increased from epicsThreadPriorityHigh -> epicsThreadPriorityMax. - src/padStream.c: FIXED maximum number of samples accepted into a packet. It turns out that the previous value of 1440 would not fit (adding all the headers) into a typical MTU of 1500. Rounded down to the next multiple of 16 (be vector-aligned to help SIMD on the master side) which are 1424 bytes. Updated 'getdata' variants to respect new API (see above). 20120514 (T.S.) - src/fidProcess.c, src/fidProcess.h: Added fidProcessGeneric(). 20120514 (T.S.) - src/fidProcess.c, src/fidProcess.h: made global variables 'fidProcessHasBeam', 'fidHeartbeat' volatile. 20120304 (T.S.) - src/drvPadUdpComm.c: if 'cook' returns a debug code then still post with ordinary 'kind'. - src/devWfRawSig.c: added more debugging messages (if debug flag set). 20120206 (S.H.) - configure/RELEASE - use event-R3-2-2-br_generaltime-2-0 20120109 (T.S.) - src/padProto.c: Fix padRequest() - resend request when retrying. - src/drvPadUdpComm.c: restore old behavior: starting/stopping stream sends drvPadUdpCommChannelsInUseMask regardless of success/failure status of PAD command. Make drvPadUdpCommStrmStopReq() non-blocking (use PADCMD_QUIET; restored old behavior). New: use PADCMD_QUIET (non-blocking) for drvPadUdpCommStrmStartReq(), too. 20120109 (T.S.) - src/drvPadAdcStream.c start_stop_cb must check if the 'req' parameter is non-NULL (which is only the case during the 'start' operation). 20110606 (T.S.) - drvPadUdpComm.c: fixed run-time check - need to make sure EVR is fully initialized. Unfortunately, that adds knowledge about EVR to drvPadUdpComm.c :-( 20110606 (T.S.) - drvPadUdpComm.c: defined TS1_OR_4_TIME for post- base-3.14.9 (bundled generalTime) where we use epicsTimeEventBestTime (== -1). However, this requires evrTimeGet():event/evrTime.c to be modified. Added a run-time check for this modification and fail driver initialization if the check doesn't pass. 20110606 (T.S.) - fidProcess.c, wavBuf.c, devWfRawSig.c: include to silence compiler warnings under base-3.14.12 20110509 (T.S.) - RELEASE_NOTES: updated; cut R2-1-0 20110502 (T.S.) - src/drvPadAdcStream.c, src/drvPadAdcStream.h: unbundled driver pieces that suck data from the PAD ADC FIFO into a padStream from BPM and added to 'udpComm'. This is quick-and-dirty (should probably be its own module and more complete, i.e, contain ISR etc. also). 20110502 (T.S.) - src/drvPadUdpComm.c, src/drvPadUdpComm.h, src/hostStream.c, src/padStream.c, src/padProto.h, src/padProtoHost.c, src/padStreamTestClntMain.c: Added now 'channels' byte to stream command request. Use remaining flags and CM to convey channel number in single-channel mode reply. CM is no longer directly tested by user but he/she must now use PADRPLY_STRM_IS_CM() macro. C1 is no longer directly set by user but managed internally, based on the channel bit mask in the stream-start command. - src/padProto.c: fixed propagation of PAD errno to padRequest return value (error # < 0). 20110427 (T.S.) - first stab at supporting fragmented streams. This is still untested and is 'hackish' since it was done very quickly and could not be designed from scratch (bwds compatibility). 20110425 (T.S.) - src/hostStream.c, src/padProto.h, src/padStream.c: removed implicit 4-channel assumption (NCHANS). Replaced by run-time detection of channel number via C1 flag. - src/padProtoHost.c: added new -1 flag to request single-channel data. Handle single-channel data when dumping stream. - src/padStream.c, src/padStream.h: Removed 'idx' argument from padStreamSend. This routine now iterates over all the fragments of a stream and calls 'getdata' repeatedly. Fragmented streams must request multiple of 1k payload size. Fragmented stream uses its own XID and changes this each time a new stream packet is sent. This allows for association of fragments. 20110422 (T.S.) - README, README.drvPadUdpComm: updated documentation. - src/padStream.c, src/padStream.h: o Added PadStreamStartStopCB() additional 'PadRequest' argument so that e.g., protocol version may be verified/checked. o Added 'nchannels' argument to 'getdata' callback so that channel numbers other than 4 can be supported. o PadStripSimValRec now contains an array of PADRPLY_STRM_NCHANNELS instead of four discrete values. This helps supporting different values for nchannels in the simulation 'getdata' callback. o padStreamSim_iir2_getdata() and streamTest() 'getdata' callbacks now support variable 'nchannels'. - src/drvPadUdpComm.c, src/drvPadUdpComm.h: Added drvPadUdpCommPostReply() [convenience routine for LLRF]. 20110422 (T.S.) - src/padProto.h, src/padProtoHost.c: added new 'more-fragments' flag to 'index' and a macro to extract the index number (masking the MF flag). - src/padStream.c: No longer reject non-zero index (preparation for idx support in drvPadUdpComm). 20110421 (T.S.) - src/drvPadUdpComm.c, src/drvPadUdpComm.h: Support up to PADRPLY_STRM_NUM_KINDS. This is the max. currently defined by the padProtocol (8). 'cook' callback has a new return value with an optional 'redirected' kind encoded. I.e., the cook callback can choose to have the buffer posted as a different 'kind' from the original one. drvPadUdpCommListener() checks for padProto version (added paranoia). - src/wavBuf.c: check for legal 'kind' parameter in wavBufPost(). - src/drvPadUdpComm.c, src/drvPadUdpComm.h, src/padProto.h, src/padProto.c, src/hostStream.c: Added new protocol feature: PADCMD_STRM_FLAG_C1 allows the user to request that only a single ADC channel is streamed. The Channel number may e.g., be encoded in the data 'kind'. This new feature in the protocol made it necessary to bump the protocol version number. 20110420 (T.S.) - src/udpComm.c, src/udpComm.h, src/udpCommBSD.c: Added support for packet reference count (udpCommRefPacket()). This requires support from underlying lanIpBasic (udpSockRefBuf()). Added thread-safety to udpCommBSD.c. - src/drvPadUdpComm.c, src/drvPadUdpComm.h, src/drvPadUdpCommIO.h: Added support for packet reference count (udpCommRefPacket()) (padReplyRef(), padReplyFree()). This includes a new 'creatref' member in DrvPadUdpCommIORec (which needs to be implemented by vmeDigiComm[BPM]). 20110404 (T.S.) - README.drvPadUdpComm: updated (minor). 20100524 (T.S.) - src/padStream.c: added more statistics counters. - README: updated. 20100423 (T.S.) - updated RELEASE_NOTES; released udpComm-R1-2-0 20100416 (T.S.) - src/udpComm.h, src/udpCommBSD.c: REMOVED wrong UDPCOMM_ALIGNMENT definition. The payload of lanIpBasic UDP packetes is ***NOT*** aligned but at a well defined offset (-4) from an alignment boundary. In order to alert users the UDPCOMM_ALIGNMENT symbol was replaced by UDPCOMM_DATA_ALGN and UDPCOMM_DATA_ALGN_OFF, the offset that takes you to an alignment boundary was added. 20100407 (T.S.) - Added README.drvPadUdpComm: (rudimentary documentation). 20100407 (T.S.) - src/drvPadUdpComm.h, src/drvPadUdpComm.c: Support special return values for 'cook' callback which cause the raw data to be posted to dedicated wavBufs for debugging purposes. Added definitions for 'cook' callback return values. 20100407 (T.S.) - src/wavBuf.h: Increased number of 'KINDS' to 10. 20100330 (T.S.) - MOD: src/padStream.c: Avoid an ARP lookup! Instead, use peer's MAC address (from request packet) and issue arpPutEntry() to ensure. 20100330 (T.S.) - FIX: src/padStream.c: padStreamSend() would often fail after a successful padStreamStart(). This was because recent lanIpBasic only asynchronously updates the ARP cache. Hence, it was likely that no valid entry was present immediately after processing the padStreamStart(). To fix this we explicitly do a synchronous ARP lookup from padStreamStart(). 20100218 (T.S.) - BUGFIX: src/drvPadUdpComm.c: padUdpCommInit() must call io.open() only *after* installing vmeUdpComm IO methods. 20100208 (T.S.) - src/udpComm.h, src/udpCommBSD.c: Let udpCommConnect() treat broadcast peer addresses the same as multicast peers (BSD semantics also reject any incoming traffic if peer is a BC address). Documented this change in udpComm.h (and README). 20100208 (T.S.) - src/padStream.h, src/padStream.c: o Introduced typedef for stream 'getdata' routine. o Made padStreamSim_getdata a global function pointer variable (defaults to padStreamSim_iir2_getdata) so that users could install their own simulation 'getdata' routine. 20100208 (T.S.) - src/padProtoHost.c: Use PADREQ_BCST macro instead of hardcoding -128. 20100208 (T.S.) - src/padProto.c: let padProtoHandler() ignore requests with a command array too small to hold data for the active ('this') channel. 20100202 (T.S.) - src/udpComm.c: udpCommReturnPacket() failed to set length in UDP and IP header. This must be done before reflecting the headers so that the IP header checksum is computed correctly. 20100125 (T.S.) - removed typedef of BpmNumber (-> Bpm app) - public declaration of drvPadUdpCommChannelsInUseMask (used by Bpm FCOM source). 20100122 (T.S.) - configure/CONFIG: only include CONFIG_SITE if present. 20100122 (T.S.) - src/drvPadUdpComm.c: replaced strdup() by epicsStrDup(). 20100122 (T.S.) - src/fidProcess.c: forgot to #define E_MOD1 and E_MOD5. Removed unused variable. 20100122 (T.S.) - src/padProto.h, src/padProto.c, src/drvPadUdpComm.c, src/padProtoHost.c, src/hostStream.c, src/padStream.c: ************************************************** PROTOCOL VERSION CHANGE: PadReply layout modified: ************************************************** - reduced size of 'status' to 8-bits - increased timestampHi -> 32-bits 20100122 (T.S.) - src/drvPadUdpComm.c: PADRPLY_STRM_NSAMPLES macro arg is now pointer to reply. (Support for 32-bit stream data.) - src/padProto.c: set cmdSize based on actual command (SIM's command struct is bigger than previously hardcoded 16 bytes). - src/padProto.h: PADRPLY_STRM_NSAMPLES macro arg is now pointer to reply. (Support for 32-bit stream data.) - src/padProtoHost.c: o New '-L' option to request 32-bit data streams. o Compute nsamples using PADRPLY_STRM_NSAMPLES macro. o Let SIM command send values 0xaaaa, 0xbbbb, 0xcccc, 0xdddd. (Should have another option to specivy values). - src/padStream.c: BUGFIX: must check for 32-bit data flag when copying data into lan9118's FIFO. - src/padUdpCommSupport.dbd: add driver and registrar for drvPadUdpComm. 20100118 (T.S.) - src/Makefile, src/devWfRawSig.c, src/drvPadUdpComm.c, src/drvPadUdpComm.h, src/drvPadUdpCommIO.h, src/fidProcess.c, src/fidProcess.h, src/padUdpCommSupport.dbd, src/wavBuf.c, src/wavBuf.h: unbundled drvPadUdpComm/wavBuf from Bpm IOC application and moved into udpComm EPICS module (tag udpComm_post_unbundle_drvPadUdpComm). 20100118 (T.S.) - BUGFIX - src/udpCommBSD.c: make sure udpComm routines don't pass the return value of system calls (like 'connect') but the negative 'errno' value. 20100118 (T.S.) - src/sddsrd.c, src/sddsrd.h: added support for 32-bit stream data. 20100118 (T.S.) - src/padStream.c, src/padStream.h: o changed semantics of 'start' argument to start_stop_cb(); this is now a pointer to the STRM command (start) or NULL (stop). o added support for 32-bit stream data. o added 'd32' argument to stream 'getdata' callback. o let padStreamSim() succeed even if stream is not connected provided that 'nosend' option is set. 20100118 (T.S.) - src/padProtoHost.c: o updated usage info (-d flag). o added 32-bit stream data support. o added option to set stream timeout. 20100118 (T.S.) - src/padProto.c: o ignore return value of padStreamPet() (PADCMD_SIM command). 20100118 (T.S.) - src/padProto.h: added PADCMD_STRM_FLAG_32 (32-bit stream data). 20100118 (T.S.) - src/hostStream.c: o added timeout functionality (stream times out and stops if no PET or STRM command is received withing timeout). o added support for 32-bit stream data. o added padStreamPet(). o include to ensure API compatibility. o let padStreamSim() succeed even if stream is not connected provided that 'nosend' option is set. - src/hostStream.h: export/declare padStreamTimeoutSecs; 20100113 (T.S.) - src/padProto.c, src/padStream.c, src/padStream.h: moved stream connection state handling into the padStream module and added a 'timeout' feature so that a stream that is not 'petted' or re-'started' within padStreamTimeoutSecs seconds it is forcefully stopped. - src/padStream.c: BUGFIX: ensure proper alignment of 'replyPacket'. - src/padStream.c: padStreamStart() resets connection state to 'unconnected' if start_stop_callback() returns nonzero and passes this return code to caller. - src/padStream.c: padStreamStart(), padStreamStop() - moved execution of start_stop_callback() into mutex-protected section. - src/padStream.c: padStreamStop() - reset/clear connection regardless of result returned by start_stop_callback(). 20100112 (T.S.) - src/padProto.c: let 'padRequest' use a RBUF instead of our own stack memory so that we can use udpCommSendPkt() (avoiding a copy operation). - src/udpComm.c, src/udpComm.h, src/udpCommBSD.c: CHANGED udpCommConnect() semantics DEVIATING FROM BSD 'connect()'. If the peer address is an IPv4 multicast-address then 'udpCommConnect()' just 'memorizes' the peer's address/port for sending. However, when receiving packets they are *not* filtered against the peer address/port (this would never succeed since the sender is never the connected MC address). Added extra argument to udpSockConnect() allowing the user to choose the desired semantics. udpCommConnect() chooses the 'multicast-passthrough' option. 20091215 (T.S.) - configure/CONFIG_SITE, src/Makefile: define CROSS_COMPILER_TARGET_ARCHS in the former file. - configure/RELEASE, src/Makefile: Determine from SDDS_LIB (optionally defined by 'configure/RELEASE') variable whether to build with SDDS support or without. - src/hostStream.h, src/hostStream.c, src/padProtoHost.c: add 'unused' arg to padStreamSimulated() so that the declaration matches the (newly added) padUdpHandler() callback prototype. - src/padProto.c, src/padProto.h: Add 'timeout' and 'poll_cb' arguments to padUdpHandler thus omitting a clone in padProtoHost which now can use the vanilla version of padUdpHandler(). 'poll_cb()' is executed (if non-NULL) every time there is no padProto activity for 'timeout' milli-seconds. - src/padProto.c, src/padProto.h: Added 'mcaddr' argument to padUdpHandler(). If nonzero then the MC address is set on the socket used for communication. - src/padProto.h: killed 'alias rule violation' warnings by declaring most protocol headers/structs with 'may_alias' attribute. - src/padProtoHost.c: Added -m option to let the server listen to a multicast address (server mode only). Use padUdpHandler() from library instead of a local, modified copy. - src/padStream.c, src/padStream.h: made 'streamSim()' routine public as 'padStreamSim_getdata()' -- a callback that may be used with padStreamSend. - src/udpComm.c: Check for UDPCOMM_ALIGNMENT being satisfied by LAN_IP_BASIC_ALIGNMENT. - src/udpComm.h: Define UDPCOMM_ALIGNMENT. - src/udpCommBSD.c: Use UDPCOMM_ALIGNMENT; LAN_IP_BASIC_ALIGNMENT is not available here; however, we check compatibility when building the non-BSD variant.