next up previous
Next: Including the New Drivers Up: Creating I/O Drivers Previous: The A/D Driver

The D/A Driver

The D/A driver has almost the same structure as the A/D board, except that it adds an additional function, reset_DA() and replaces the two run-time functions with one function. The bare minimum device driver description is shown in what follows:

#include ``main.h''
int RTiC_init_DA_card(void)
{
  /* do all card initialization here and do not forget to 
     reset the DA card !! */	

  return(RTIC_SUCCESS);        /* or RTIC_ERROR, depending */
}

void RTiC_DA_run(void)
{
  /* do all periodic jobs here */
}

int RTiC_stop_DA_card(void)
{
  /* do all card ``stopping'' functions here */
  return(RTIC_SUCCESS);        /* or RTIC_ERROR, depending */
}

void RTIC_reset_DA(void)
{
  /* reset the card */
}

Once again, the first function RTiC_init_DA_card is run immediately after the user releases the ``RUN'' button in xrtic and is used to initialize the D/A board. Similarly, the last function, RTiC_stop_DA_card is run immediately after the user releases the ``STOP'' button in xrtic. In both of these cases, the functions must return either ``RTIC_ERROR'' or ``RTIC_SUCCESS'', depending on whether an error was encountered or not, respectively.

The periodic function RTiC_stop_DA_card is run once per controller cycle and should write out the values stored in the data pointer (float *RTiC_control), for example:

for (i=0; i<NUM_CONTROL_OUTPUTS; i++) 
   OUTW(*(RTiC_control+i),DA_BASE);

The last function, RTiC_reset_DA is used to reset the D/A boards. It takes no arguments and returns none either.



Michael Barabanov 2001-06-19