182 lines
7.5 KiB
C
182 lines
7.5 KiB
C
//
|
|
// Coreco API - Coreco Auxiliary Bus module functions.
|
|
//
|
|
|
|
#ifndef _CAPICAB_H_
|
|
#define _CAPICAB_H_
|
|
|
|
#include <capidef.h>
|
|
|
|
/****************************************************************************
|
|
* CAB Related Capabilities
|
|
****************************************************************************/
|
|
|
|
#define CORCAB_CAP_FIRST 0
|
|
#define CORCAB_CAP( n, size) ((((n) + CORCAB_CAP_FIRST) << 16) | (size))
|
|
|
|
#define CORCAB_CAP_PORT CORCAB_CAP( 0x00, 4)
|
|
#define CORCAB_CAP_PORT_COUNT CORCAB_CAP( 0x01, 4)
|
|
#define CORCAB_CAP_CHANNEL_COUNT CORCAB_CAP( 0x02, 4)
|
|
#define CORCAB_CAP_CLK_MIN CORCAB_CAP( 0x03, 4)
|
|
#define CORCAB_CAP_CLK_MAX CORCAB_CAP( 0x04, 4)
|
|
#define CORCAB_CAP_BLOCK_SIZE_MIN CORCAB_CAP( 0x05, 4)
|
|
#define CORCAB_CAP_BLOCK_SIZE_MAX CORCAB_CAP( 0x06, 4)
|
|
|
|
#define CORCAB_CAP_LAST (CORCAB_CAP_FIRST + 0x07)
|
|
|
|
|
|
/****************************************************************************
|
|
* CAB Related Parameters
|
|
****************************************************************************/
|
|
|
|
#define CORCAB_PRM_FIRST 0
|
|
#define CORCAB_PRM( n, size) ((((n) + CORCAB_PRM_FIRST) << 16) | (size))
|
|
|
|
#define CORCAB_PRM_TRANS_MODE CORCAB_PRM( 0x00, 4)
|
|
#define CORCAB_PRM_TRANSFER_MODE CORCAB_PRM_TRANS_MODE
|
|
#define CORCAB_PRM_DST_CHANNEL CORCAB_PRM( 0x01, 4)
|
|
#define CORCAB_PRM_DST_CHANNEL_FIRST CORCAB_PRM( 0x02, 4)
|
|
#define CORCAB_PRM_DST_CHANNEL_LAST CORCAB_PRM( 0x03, 4)
|
|
#define CORCAB_PRM_FRAME_LENGTH CORCAB_PRM( 0x04, 4)
|
|
#define CORCAB_PRM_BLOCK_SIZE CORCAB_PRM_FRAME_LENGTH
|
|
#define CORCAB_PRM_LABEL CORCAB_PRM( 0x05, 128)
|
|
#define CORCAB_PRM_CAB_ID CORCAB_PRM( 0x06, 4)
|
|
#define CORCAB_PRM_CAB_MASTER CORCAB_PRM( 0x07, 4)
|
|
#define CORCAB_PRM_CAB_ARBITRATOR CORCAB_PRM_CAB_MASTER
|
|
#define CORCAB_PRM_CAB_CLK CORCAB_PRM( 0x08, 4)
|
|
#define CORCAB_PRM_SRC_CHANNEL_FIRST CORCAB_PRM( 0x09, 4)
|
|
#define CORCAB_PRM_SRC_CHANNEL_LAST CORCAB_PRM( 0x0a, 4)
|
|
#define CORCAB_PRM_CAB_CLK_MASTER CORCAB_PRM( 0x0b, 4)
|
|
#define CORCAB_PRM_CAB_CLK_GENERATOR CORCAB_PRM_CAB_CLK_MASTER
|
|
#define CORCAB_PRM_STATE CORCAB_PRM( 0x0c, 4)
|
|
#define CORCAB_PRM_STATUS CORCAB_PRM_STATE
|
|
#define CORCAB_PRM_CHANNEL CORCAB_PRM( 0x0d, 4)
|
|
#define CORCAB_PRM_CONNECTION_SIGNAL CORCAB_PRM( 0x0e, 4)
|
|
#define CORCAB_PRM_PORT_INDEX CORCAB_PRM( 0x0f, 4)
|
|
|
|
#define CORCAB_PRM_LAST (CORCAB_PRM_FIRST + 0x10)
|
|
|
|
|
|
/****************************************************************************
|
|
* CAB Related Values
|
|
****************************************************************************/
|
|
|
|
// Port capabilities
|
|
#define CORCAB_VAL_PORT_MULTICAST_RX 0x00000001
|
|
#define CORCAB_VAL_PORT_MULTICAST_TX 0x00000002
|
|
#define CORCAB_VAL_PORT_MULTICAST_THROUGH 0x00000004
|
|
#define CORCAB_VAL_PORT_MULTICAST 0x0000000f
|
|
|
|
#define CORCAB_VAL_PORT_ROUND_ROBIN_RX 0x00000010
|
|
#define CORCAB_VAL_PORT_ROUND_ROBIN_TX 0x00000020
|
|
#define CORCAB_VAL_PORT_ROUND_ROBIN_THROUGH 0x00000040
|
|
#define CORCAB_VAL_PORT_ROUND_ROBIN 0x000000f0
|
|
|
|
#define CORCAB_VAL_PORT_POINT_TO_POINT_RX 0x00000100
|
|
#define CORCAB_VAL_PORT_POINT_TO_POINT_TX 0x00000200
|
|
#define CORCAB_VAL_PORT_POINT_TO_POINT_THROUGH 0x00000400
|
|
#define CORCAB_VAL_PORT_POINT_TO_POINT 0x00000f00
|
|
|
|
#define CORCAB_VAL_PORT_RX 0x00000111
|
|
#define CORCAB_VAL_PORT_TX 0x00000222
|
|
#define CORCAB_VAL_PORT_THROUGH 0x00000444
|
|
|
|
// Transfer modes (STANDARD is now obsolete, use MULTICAST instead)
|
|
#define CORCAB_VAL_TRANS_MODE_STANDARD 0x00000000
|
|
#define CORCAB_VAL_TRANSFER_MODE_MULTICAST CORCAB_VAL_TRANS_MODE_STANDARD
|
|
#define CORCAB_VAL_TRANS_MODE_ROUND_ROBIN 0x00000001
|
|
#define CORCAB_VAL_TRANSFER_MODE_ROUND_ROBIN CORCAB_VAL_TRANS_MODE_ROUND_ROBIN
|
|
#define CORCAB_VAL_TRANS_MODE_RANDOM 0x00000010
|
|
#define CORCAB_VAL_TRANSFER_MODE_POINT_TO_POINT CORCAB_VAL_TRANS_MODE_RANDOM
|
|
|
|
// Channel numbers
|
|
#define CORCAB_VAL_CHANNEL_0 0x00000001
|
|
#define CORCAB_VAL_CHANNEL_1 0x00000002
|
|
#define CORCAB_VAL_CHANNEL_2 0x00000004
|
|
#define CORCAB_VAL_CHANNEL_3 0x00000008
|
|
#define CORCAB_VAL_CHANNEL_4 0x00000010
|
|
#define CORCAB_VAL_CHANNEL_5 0x00000020
|
|
#define CORCAB_VAL_CHANNEL_6 0x00000040
|
|
#define CORCAB_VAL_CHANNEL_7 0x00000080
|
|
#define CORCAB_VAL_CHANNEL_8 0x00000100
|
|
#define CORCAB_VAL_CHANNEL_9 0x00000200
|
|
#define CORCAB_VAL_CHANNEL_10 0x00000400
|
|
#define CORCAB_VAL_CHANNEL_11 0x00000800
|
|
#define CORCAB_VAL_CHANNEL_12 0x00001000
|
|
#define CORCAB_VAL_CHANNEL_13 0x00002000
|
|
#define CORCAB_VAL_CHANNEL_14 0x00004000
|
|
#define CORCAB_VAL_CHANNEL_15 0x00008000
|
|
#define CORCAB_VAL_CHANNEL(n) (1 << (n))
|
|
|
|
#define CORCAB_VAL_DST_CHANNEL_0 CORCAB_VAL_CHANNEL_0
|
|
#define CORCAB_VAL_DST_CHANNEL_1 CORCAB_VAL_CHANNEL_1
|
|
#define CORCAB_VAL_DST_CHANNEL_2 CORCAB_VAL_CHANNEL_2
|
|
#define CORCAB_VAL_DST_CHANNEL_3 CORCAB_VAL_CHANNEL_3
|
|
#define CORCAB_VAL_DST_CHANNEL_4 CORCAB_VAL_CHANNEL_4
|
|
#define CORCAB_VAL_DST_CHANNEL_5 CORCAB_VAL_CHANNEL_5
|
|
#define CORCAB_VAL_DST_CHANNEL_6 CORCAB_VAL_CHANNEL_6
|
|
#define CORCAB_VAL_DST_CHANNEL_7 CORCAB_VAL_CHANNEL_7
|
|
#define CORCAB_VAL_DST_CHANNEL_8 CORCAB_VAL_CHANNEL_8
|
|
#define CORCAB_VAL_DST_CHANNEL_9 CORCAB_VAL_CHANNEL_9
|
|
#define CORCAB_VAL_DST_CHANNEL_10 CORCAB_VAL_CHANNEL_10
|
|
#define CORCAB_VAL_DST_CHANNEL_11 CORCAB_VAL_CHANNEL_11
|
|
#define CORCAB_VAL_DST_CHANNEL_12 CORCAB_VAL_CHANNEL_12
|
|
#define CORCAB_VAL_DST_CHANNEL_13 CORCAB_VAL_CHANNEL_13
|
|
#define CORCAB_VAL_DST_CHANNEL_14 CORCAB_VAL_CHANNEL_14
|
|
#define CORCAB_VAL_DST_CHANNEL_15 CORCAB_VAL_CHANNEL_15
|
|
|
|
#define CORCAB_VAL_DST_CHANNEL_MASK CORCAB_VAL_CHANNEL_MASK
|
|
#define CORCAB_VAL_DST_CHANNEL(n) CORCAB_VAL_CHANNEL(n)
|
|
|
|
#define CORCAB_VAL_SRC_CHANNEL_0 CORCAB_VAL_CHANNEL_0
|
|
#define CORCAB_VAL_SRC_CHANNEL_1 CORCAB_VAL_CHANNEL_1
|
|
#define CORCAB_VAL_SRC_CHANNEL_2 CORCAB_VAL_CHANNEL_2
|
|
#define CORCAB_VAL_SRC_CHANNEL_3 CORCAB_VAL_CHANNEL_3
|
|
#define CORCAB_VAL_SRC_CHANNEL_4 CORCAB_VAL_CHANNEL_4
|
|
#define CORCAB_VAL_SRC_CHANNEL_5 CORCAB_VAL_CHANNEL_5
|
|
#define CORCAB_VAL_SRC_CHANNEL_6 CORCAB_VAL_CHANNEL_6
|
|
#define CORCAB_VAL_SRC_CHANNEL_7 CORCAB_VAL_CHANNEL_7
|
|
#define CORCAB_VAL_SRC_CHANNEL_8 CORCAB_VAL_CHANNEL_8
|
|
#define CORCAB_VAL_SRC_CHANNEL_9 CORCAB_VAL_CHANNEL_9
|
|
#define CORCAB_VAL_SRC_CHANNEL_10 CORCAB_VAL_CHANNEL_10
|
|
#define CORCAB_VAL_SRC_CHANNEL_11 CORCAB_VAL_CHANNEL_11
|
|
#define CORCAB_VAL_SRC_CHANNEL_12 CORCAB_VAL_CHANNEL_12
|
|
#define CORCAB_VAL_SRC_CHANNEL_13 CORCAB_VAL_CHANNEL_13
|
|
#define CORCAB_VAL_SRC_CHANNEL_14 CORCAB_VAL_CHANNEL_14
|
|
#define CORCAB_VAL_SRC_CHANNEL_15 CORCAB_VAL_CHANNEL_15
|
|
|
|
#define CORCAB_VAL_SRC_CHANNEL_MASK CORCAB_VAL_CHANNEL_MASK
|
|
#define CORCAB_VAL_SRC_CHANNEL(n) CORCAB_VAL_CHANNEL(n)
|
|
|
|
// CAB status
|
|
#define CORCAB_VAL_STATUS_GRANTED 0x00000001
|
|
#define CORCAB_VAL_STATUS_CONNECTION_SIGNAL 0x00000002
|
|
|
|
|
|
/****************************************************************************
|
|
* Application programming interface
|
|
****************************************************************************/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
CORSTATUS CORAPIFUNC CorCabResetModule(CORSERVER hServer);
|
|
CORSTATUS CORAPIFUNC CorCabGetHandle(CORSERVER hServer, UINT32 instance, CORCAB *hCab);
|
|
CORSTATUS CORAPIFUNC CorCabRelease(CORCAB hCab);
|
|
CORSTATUS CORAPIFUNC CorCabGetCount( CORSERVER hServer, PUINT32 count);
|
|
CORSTATUS CORAPIFUNC CorCabReset(CORCAB hCab);
|
|
|
|
CORSTATUS CORAPIFUNC CorCabGetCap (CORCAB hCab, UINT32 cap, void *value);
|
|
CORSTATUS CORAPIFUNC CorCabGetPrm (CORCAB hCab, UINT32 prm, void *value);
|
|
CORSTATUS CORAPIFUNC CorCabGetPrms (CORCAB hCab, CORPARAM hParam);
|
|
CORSTATUS CORAPIFUNC CorCabSetPrm (CORCAB hCab, UINT32 prm, UINT32 value);
|
|
CORSTATUS CORAPIFUNC CorCabSetPrmEx(CORCAB hCab, UINT32 prm, const void *value);
|
|
CORSTATUS CORAPIFUNC CorCabSetPrms (CORCAB hCab, CORPARAM hParam);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _CAPICAB_H_
|