dag_firmware_load_pci(3)

NAME
dag_firmware_load_pci. loads a PCI firmware image onto a card

SYNOPSIS
#include "dag_config.h "

dag_err_t
dag_firmware_load_pci(const char* name, dag_card_ref_t* card_ref,const char *filename);

DESCRIPTION
dag_firmware_load_pci is passed the reference to the DAG card,the dag name of the form /dev/dagN and the full path of the image to be loaded.It returns kDagErrNone on success. card_ref must be a valid. This function will destroy the card and build the object again,including all components and attributes. Therefore any reference to the card prior tousing this function will be in valid by the time the function returns. Any reference to a component or attribute will also be in valid by the time the function returns. After returning,card_ref will be a reference to a valid object.

RETURN VALUE
returns kDagErrNone on success and kDagErrInvalidCardRef if the card reference is invalid.

EXAMPLES
The following program illustrates how the function is used.This is an example usage of this function.This code has not necessarily been tested.The function below loads the pci image into the card.It also returns the new root component obtained using the newly returned card reference
 dag_component_t
 test_load_pci_image(const char* image_path)
 {
        dag_err_t result = 0;
        dag_card_ref_t card;
        dag_component_t root;
        const char* image_path = NULL;
        char error_buf[ERROR_BUFFER_BYTES];
        char dagname[DAGNAME_BUFSIZE] = "/dev/dag0";
        assert(image_path);
        card = dag_config_init(dagname);
        /* Load PCI firmware*/
        result=dag_firmware_load_pci(dagname,&card,
                        image_path);
        sleep(1);
        snprintf(error_buf,ERROR_BUFFER_BYTES,
                 "failed to load PCI image%s"
                 ,image_path);

        CU_ASSERT_WITH_MESSAGE((kDagErrNone == result),error_buf,TRUE);
        /*Reinitialize root component as card ref got disposed*/
        root=dag_config_get_root_component(card);

        snprintf(error_buf, ERROR_BUFFER_BYTES,"dag_config_default()
                 failed after loading PCI image%s",
                 image_path);
        CU_ASSERT_WITH_MESSAGE((kDagErrNone == result),error_buf,TRUE);
        free((char*) image_path);
        return root;
  }

SEE ALSO
dag_firmware_load_pp(3),dag_firmware_read_swid(3),dag_firmware_write_swid(3),

BUGS
Report bugs to <support@endace.com>.

LAST UPDATED
$Author: nuwan.gunasekara $
$Revision: 13756 $
$Date: 2011-01-17 11:22:36 +1300 (Mon, 17 Jan 2011) $

COPYRIGHT
(c) 2009 Endace Technology Ltd, Hamilton, New Zealand.All Rights Reserved.