/*****************************************************************************
* Copyright (c) 2007 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/

#ifndef canTable_h

#define canTable_h

#ifdef __cplusplus
extern "C"
{
#endif

#include "fwtypes.h"
#include "iop_api.h"


/**
 * NET+OS supports CAN on platforms with the required hardware support.
 *
 * @since 7.3
 * @external
 * @category BSP:Device_Drivers:CAN
 * @include "canTable.h"
 * @library bsp
 * @platform connectcore9p9215_a
**/

/*
 * This type defines the functions used by the NET+OS CAN driver to perform
 * semaphore operations.  Functions to wait on semaphores and release semaphores
 * use this type.
 *
 * The wait for semaphore function should wait forever for the semaphore to become
 * available. 
 *
 * The release semaphore function should release the semaphore and return.
 *
 * Both functions should call __panic if an error occurs accessing the semaphore.
 *
 * @since 7.3
 * @external   
 * @category BSP:Device_Drivers:CAN
 *
 * @param interface     CAN interface number, either 0 or 1
 * @param context       value of context argument set by semaphore create function
 *
*/
typedef void (* NaSdioSemaphoreFn_t)(unsigned interface, void * context);




/*
 * This type defines the function used by the NET+OS CAN driver to create
 * a new semaphore.  The function should create the semaphore and then set
 * *context to a value which will be passed to the functions that wait for
 * and release the semaphore.
 *
 * The function should call __panic if it is not able to create the semaphore.
 *
 * @since 7.3
 * @external    
 * @category BSP:Device_Drivers:CAN
 *
 * @param interface     CAN interface number, either 0 or 1
 * @param context       Function should set *context to a value which will be passed
 *                      to the functions to read and write semaphores
 *
*/
typedef void (* NaSdioSemaphoreCreateFn_t)(unsigned interface, void * * context);




#define NA_CAN_MAX_INTERFACES          (2)



/*
 * This type defines a table entry in naCanTable.  These table entries 
 * contain parameters for each interface supported by the CAN driver.
 *
 * @since 7.4
 * @external    
 * @category BSP:Device_Drivers:CAN
 *
 * @param processor         set to indicate which I/O processor will be used
 * @param program           pointer to program to execute on I/O processor
*/
typedef struct NaCanTable_t
{
    NaIopProcessor_t processor;
    NaIopProgram_t * program;
} NaCanTable_t;

extern NaCanTable_t naCanTable[];

extern const unsigned naCanTableSize;


#ifdef __cplusplus
}
#endif

#endif
