RC1000-PP Host:
Initialising and Closing Functions


 

PP1000CloseCard


   PP1000_STATUS PP1000CloseCard(
                       PP1000_HANDLE Card);
  

 

Arguments
Card Handle of card to close.
Return Values
PP1000_SUCCESS Success.
PP1000_INVALID_HANDLE Card is not a valid card handle.
Description

This function is used to close a handle for a card and free the card for use elsewhere. It should be called after an application has finished with the board to allow the support software to clean up.

Card must be a valid handle returned by PP1000OpenCard() or PP1000OpenFirstCard().

 

 

PP1000GetCards

  
  PP1000_STATUS PP1000GetCards(
                      unsigned * NumCards,
                      PP1000_DEVICE_COUNT ** CardIDs);
  

 

Arguments
NumCards Pointer to location to receive number of cards in the system.
CardIDs Pointer to location to receive list of cards in the system.
Return Values
PP1000_SUCCESS Success.
PP1000_NO_DRIVER RC1000-PP driver is not installed.
PP1000_INTERNAL_ERROR Error while talking to driver.
PP1000_NO_MEMORY Not enough memory to complete operation.
Description

This function is used to retrieve information about the number of RC1000-PP cards in a system. The function returns the total number of cards via the NumCards parameter. It also returns a list of the card IDs and the number of cards with each card ID via the CardIDs parameter. To display all the cards in a system you could use the following Handel C code:

unsigned long NumCards;
PP1000_DEVICE_COUNT *Present;
unsigned long Count;

PP1000GetCards(&NumCards, &Present);
printf("Number of cards = %d\n", NumCards);
for (Count=0; NumCards>0; Count++) {
  printf("Card ID : %d, ", Present[Count].CardID);
  printf("number present : %d\n", Present[Count].Count);
  NumCards-=Present[Count].Count;
}
free(Present);

Note that it is the caller's responsibility to free the array pointed to by CardIDs.

 

 

PP1000OpenCard


   PP1000_STATUS PP1000OpenCard(
                       PP1000_DEVICE_NUM CardID,
                       PP1000_HANDLE * Card);
  

 

Arguments
CardID ID of card to open
Card Pointer to location to receive handle of open card
Return Values
PP1000_SUCCESS Success.
PP1000_NULL_POINTER Card is a NULL pointer.
PP1000_INTERNAL_ERROR Error while talking to driver.
PP1000_NO_MEMORY Not enough memory to complete operation.
PP1000_INVALID_CARDID No cards with ID of CardID found.
PP1000_NO_FREE_CARDS No free cards with ID of CardID found.
Description

This function is used to obtain a handle to an RC1000-PP card in the system. The card is identified by its card ID passed via the CardID parameter.

In the event of there being more than one card with the same ID, the function will open the first card with the correct ID that it finds that has not already been opened.

The handle returned in the Card parameter should be used in all further functions to access this board.

When access to the card is no longer required, you should call the PP1000CloseCard() function to free the handle and allow other programs access to the card.

 

 

PP1000OpenFirstCard

  
   PP1000_STATUS PP1000OpenFirstCard(
                       PP1000_HANDLE * Card);
  

 

Arguments
Card Pointer to location to receive handle of open card
Return Values
PP1000_SUCCESS Success.
PP1000_NULL_POINTER Card is a NULL pointer.
PP1000_INTERNAL_ERROR Error while talking to driver.
PP1000_NO_MEMORY Not enough memory to complete operation.
PP1000_NO_FREE_CARDS No free cards with ID of CardID found.
Description

This function is used to obtain a handle to an RC1000-PP card in the system. The card opened is the first free card found in the system. This function should be used when it is not critical which card is opened or when there is only one card in the system.

The handle returned in the Card parameter should be used in all further functions to access this board.

When access to the card is no longer required, you should call the PP1000CloseCard() function to free the handle and allow other programs access to the card.