The goal is to be able to say "I want data at this rate on this channel" without worrying about the details; if that isn't possible there will be an error return.
There are two board-specific sets of functions (edt_ocm_xxx, edt_oc192_xxx) and a general set of edt_ocx_xxx. If a particular task is identical for both mezzanine cards, there will only be the edt_ocx_xxx version. Otherwise, the edt_ocx_xxx function will either call other edt_ocx_xxx functions or will call the board-specific version.
The initialization functions are separated into the following sequence of stages. It is possible to return to functions in the sequence for full or partial reinitialization a channel. At each stage in the sequence there will be different diagnostic functions available.
The definition of the target channel state is carried in the EdtOCConfig structure passed as a pointer to most of the library functions. This includes the target line rate, framing parameters, and any non-default bitfiles desired. The baseboard and channel are associated with the EdtDev * pointer passed to all of the functions.
Stage 1: edt_ocx_base_init()
First, to start with the base board in an unknown state, call edt_ocx_base_init. This will make sure that at least a default baseboard and mezzanine bitfile(s) are loaded so the mezzanine board can be identified, and the PLLs between baseboard and mezzanine are in synch (checking both SYS_LOCK and LOCAL_SYS_LOCK).
This function will abort any dma on the other channel on the OCM card.
At this point the mezzanine card can be identified, and the SFP or XFP modules can be queried for their status.
Normally this function need only be called once after poweron, unless a different baseboard interface bitfile is requested.
Stage 2: edt_ocx_channel_set_rate()
The rate setting step makes sure that the correct mezzanine bitfile is loaded for the target line rate, and the correct clock source is selected. If an improper rate for the channel is requested, there will be a non-zero error return.
Stage 3: edt_ocx_channel_setup()
This sets the framing parameters, descrambling, enables memory, etc.
Stage 4: edt_ocx_channel_lock_frontend()
This starts the framer and resets the frontend PLLs. The channel fifo is flushed. Failure to see the SIG_DET bit or if the LOL bit is set will cause a non-zero error return.
At this point framing errors can be checked by calling edt_ocx_get_framing_errors().
Stage 5: edt_ocx_channel_start()
This assumes that ring-buffers have been configured. It starts the ring-buffer acquisition, then turns on the channel enable bit to start DMA. If framing is enabled, it will wait for frame and return an error if framing times out.
Steps 1 through 4 can be executed at once using the function edt_ocx_configure(), which will run each step and return an error code if any step fails for some reason.
|OCM Mezzanine Access Functions|
|Setup and diagnostic functions specific to OCM mezzanine channels. |
|OC192 Mezzanine Access Functions|
|Setup and diagnostic functions specific to OC192 mezzanine channels. |
|OC192 LIU Access Functions|
|OC192 Mezzanine LIU Serial Access Functions The oc192_mdio functions are for reading and writing the LIU chip through its serial protocol. |