/************************************************************************* $Archive: /PACS/OnBoard/link1355.h $ $Revision: 1.11 $ $Date: 2009/04/23 13:51:12 $ $Author: amazy $ $Log: link1355.h,v $ Revision 1.11 2009/04/23 13:51:12 amazy 6.029 * * 22 3/14/06 4:32p Pacs Egse * Version 6.001 * Cleaned and commented *************************************************************************/ #define LINK1355_H #ifdef CSL_SHOW_INCLUDE #pragma message( "Including " __FILE__ ) #endif #define K_BPOS_TRANSMIT_COMPLETED 1 #define K_BPOS_RECEIVE_COMPLETED 2 #define K_BMASK_TRANSMIT_COMPLETED 0x00000002 #define K_BMASK_RECEIVE_COMPLETED 0x00000004 #ifndef INCLUDE_DEFINE_ONLY extern int gaEventsSmcsTransmitCompleted[6]; extern int gaEventsSmcsReceiveCompleted[6]; /* During the development process, we will use some function either in the simulators (running on PC) or in the OnBoard application (running with virtuoso). So, we redefine the functions used to control the links 1355 in order to use the same syntax in all situation even if the communication channel we use is different. According to the platform and the mode of operation, the two functions Link1355Read and Link1355Write will use : - the Link 1355 of the mosaic board (when running with Virtuoso) - the Link 1355 of the 4Link Board (when running on a PC and when connected directly to a board) - the TCP/IP protocol over the internet (when running on a PC and when connected remotly to a board). */ #define DPRAM_BUFFER_SIZE 512 //8KWords / 6 channels / 2 directions #define MASTER 1 #define SLAVE 2 #define RESET_SMCS 4 #define NO_SMCS_RESET 0 /* ENUM : Link Status ****************** AUTHOR : AMazy USE : Defines the status of a 1355 link */ enum { NOT_STARTED = 0x0000, WAITING_CONNECTION_MASTER = 0x0002, WAITING_CONNECTION_SLAVE = 0x0003, WAITING_CONNECTION = 0x0002, CONNECTED_AS_MASTER = 0x0008, CONNECTED_AS_SLAVE = 0x000C, CONNECTED = 0x0008, DISCONNECTED = 0x0010, CONN_STATUS_MASTER_SLAVE_MASK = 0x0001, CONN_STATUS_MASTER = 0x0000, CONN_STATUS_SLAVE = 0x0001, CONN_STATUS_MASK = 0x007F, RETRY_TO_CONNECT = 0x0080, //used for DPU only. Indicates that we must perform a chip reset every 5 sec if we can't connect READ_FROM_LINK1355_READ = 0x0200, READ_FROM_SMCS_DRV = 0x0300, READ_FROM = 0x0300, READING = 0x1000, RETRY_TO_CONNECT_RESET_CHIP = 0x2000, }; #ifdef WIN32 // if our application is a simulator (it is running under Windows) /********************************************************************* SIMULATORS *********************************************************************/ #include "stdlib.h" typedef enum { TCP_IP, LINK1355, NOT_DEF } ConnectionMode; typedef enum { COM_SERVER = 0x02, // = SERVER in "u_socket.h", COM_MASTER = COM_SERVER, COM_CLIENT = 0x01, // = CLIENT in "u_socket.h", COM_SLAVE = COM_CLIENT, } ConnectionType; /*Link1355 may be replaced by Sockets. According to the value of gConnectionMode, the Link1355Read and Link1355Write functions will use sockets or the link1355 on the 4 Link Board. */ #ifdef COMDLL_EXPORTS #define COM_API __declspec(dllexport) #else #define COM_API __declspec(dllimport) #endif COM_API void OpenLinkTCP(int device, ConnectionType type, int port, const char* p_serverName); COM_API void OpenLink1355(int device, ConnectionType type, int pciChannelNb); COM_API void CloseLink(int device); COM_API void Link1355Read(int device, int sizeInWords, void* pDataBlock); COM_API void Link1355Write(int device, int sizeInWords, void* pDataBlock); COM_API int Link1355Test(int device); #define StartLink(device, reset) #define StopLink(device) #define StartReadingOnLink(device) #define K_SMCSCHANNEL_1 0 #define K_SMCSCHANNEL_2 1 #define K_SMCSCHANNEL_3 2 #define K_SMCSCHANNEL_4 3 #define K_SMCSCHANNEL_5 4 #define K_SMCSCHANNEL_6 5 #else //WIN32 : our application is running under Virtuoso /********************************************************************* VIRTUOSO *********************************************************************/ #include "m_smcstr.h" #include "m_smcsge.h" extern void Link1355Read(int device, int size, void* pDataBlock); extern void Link1355Write(int device, int size, void* pDataBlock); extern int Link1355Test(int device); extern void StartReadingOnLink(int device); extern void ConfigureLinkToAutoReconnect(int device); extern int GetSmcsChipForLink(int device); extern void EnableInterruptsForLink(int device); extern void DisableInterruptsForLink(int device); extern void EnableReadingAndWritingOnLink(int device); extern void StartLink(int device, int resetChip); extern void _StartLink(int device, int masterSlave, int resetChip); extern void StopLink(int device); #endif //WIN32 #endif //INCLUDE_DEFINE_ONLY