Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ezekiel Dohmen
advLigoRTS
Commits
25334efc
Commit
25334efc
authored
Nov 22, 2022
by
Ezekiel Dohmen
Browse files
Merge branch 'ipc-off' into dolphin-segment-id-decongestion-ipc-off
parents
444e2373
1e97c0d7
Changes
20
Hide whitespace changes
Inline
Side-by-side
src/epics/util/feCodeGen.pl
View file @
25334efc
...
...
@@ -1224,13 +1224,16 @@ $fpartCnt = 0;
$inCnt
=
0
;
# END OF CODE PARSING and LINKED LIST GENERATION**************************************************************************
#//
#// Now have all info necessary to produce the supporting code and text files. \n
#// Start the process of writing files.\n
#// - Write Epics/real-time data structures to header file.
#// - Write Epics structs common to all CDS front ends to the .h file.
my
$subs
=
substr
(
$skeleton
,
5
);
print
OUTH
"
#define MAX_FIR
\t
$firCnt
\n
";
print
OUTH
"
#define MAX_FIR_POLY
\t
$firCnt
\n\n
";
print
EPICS
"
\n
EPICS CDS_EPICS dspSpace coeffSpace epicsSpace
\n\n
";
...
...
@@ -1294,6 +1297,11 @@ print OUTH "\tint burtRestore_mask;\n";
print
OUTH
"
\t
int dacDuoSet_mask;
\n
";
print
OUTH
"
\t
int dacDuoSet;
\n
";
print
EPICS
"
INVARIABLE FEC
\
_
$dcuId
\
_DACDT_ENABLE epicsInput.dacDuoSet int bi 0 field(ZNAM,
\"
OFF
\"
) field(ONAM,
\"
ON
\"
)
\n
";
print
OUTH
"
\t
int disableRemoteIpc;
\n
";
print
OUTH
"
\t
int disableRemoteIpc_mask;
\n
";
print
EPICS
"
INVARIABLE
\U
$subs
\E
_REMOTE_IPC_PAUSE epicsInput.disableRemoteIpc int ai 0
\n
";
print
OUTH
"
\t
int pad1;
\n
";
if
(
$diagTest
>
-
1
)
{
...
...
@@ -1304,7 +1312,6 @@ print OUTH "\tint longAdcRd;\n";
print
OUTH
"
} CDS_EPICS_IN;
\n\n
";
print
OUTH
"
typedef struct CDS_EPICS_OUT {
\n
";
print
OUTH
"
\t
int dcuId;
\n
";
my
$subs
=
substr
(
$skeleton
,
5
);
if
(
0
==
length
(
$subs
))
{
print
EPICS
"
OUTVARIABLE DCU_ID epicsOutput.dcuId int ao 0
\n
";
}
else
{
...
...
src/epics/util/lib/test_util.pl
View file @
25334efc
...
...
@@ -2,7 +2,7 @@
require
"
lib/Util.pm
";
@res
=
CDS::Util::
findDefine
("
/opt/rtcds/rtscore/release/src/include/commData
2
.h
",
"
MAX_IPC
",
"
MAX_IPC_RFM
");
@res
=
CDS::Util::
findDefine
("
/opt/rtcds/rtscore/release/src/include/commData
3
.h
",
"
MAX_IPC
",
"
MAX_IPC_RFM
");
#define MAX_ADC_MODULES 12
#define MAX_DAC_MODULES 12
...
...
src/fe/commData3.c
View file @
25334efc
...
...
@@ -40,18 +40,11 @@ commData3Init(
//Set ipcMemOffset to default value, will re-set below
unsigned
long
ipcMemOffset
=
IPC_PCIE_BASE_OFFSET
+
RFM0_OFFSET
;
//RTSLOG_DEBUG("size of data block = 0x%x\n", sizeof(CDS_IPC_COMMS));
//RTSLOG_DEBUG("Dolphin num = %d \n",cdsPciModules.dolphinCount);
//RTSLOG_DEBUG("\tLocal at 0x%x and 0x%x\n",
// cdsPciModules.dolphinRead[0],
// cdsPciModules.dolphinWrite[0]);
//RTSLOG_DEBUG("\tRFM at 0x%x and 0x%x\n",
// cdsPciModules.dolphinRead[1],
// cdsPciModules.dolphinWrite[1]);
#ifdef RFM_DELAY
//
RTSLOG_
DEBUG
("Model compiled with RFM DELAY !!\n");
//RTSLOG_
WARN
("Model compiled with RFM DELAY !!\n");
#endif
for
(
ii
=
0
;
ii
<
connects
;
ii
++
)
{
// Set the sendCycle field, used by all send/rcv to determine IPC data
...
...
@@ -91,22 +84,22 @@ commData3Init(
if
(
(
ipcInfo
[
ii
].
netType
==
IRFM0
||
ipcInfo
[
ii
].
netType
==
IRFM1
)
&&
(
ipcInfo
[
ii
].
mode
==
ISND
)
&&
(
cdsPciModules
.
dolphinWrite
[
1
]
)
)
(
cdsPciModules
.
dolphin
Rfm
Write
Ptr
)
)
{
ipcInfo
[
ii
].
pIpcDataWrite
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinWrite
[
1
]
)
+
ipcMemOffset
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphin
Rfm
Write
Ptr
)
+
ipcMemOffset
);
}
if
(
(
ipcInfo
[
ii
].
netType
==
IRFM0
||
ipcInfo
[
ii
].
netType
==
IRFM1
)
&&
(
ipcInfo
[
ii
].
mode
==
IRCV
)
&&
(
cdsPciModules
.
dolphinR
ead
[
1
]
)
)
(
cdsPciModules
.
dolphinR
fmReadPtr
)
)
{
ipcInfo
[
ii
].
pIpcDataRead
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinRead
[
1
]
)
+
ipcMemOffset
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinR
fmR
ead
Ptr
)
+
ipcMemOffset
);
}
if
(
ipcInfo
[
ii
].
netType
==
ISHME
)
// Computer shared memory ******************************
...
...
@@ -122,21 +115,22 @@ commData3Init(
// second one for receiving data.
if
(
(
ipcInfo
[
ii
].
netType
==
IPCIE
)
&&
(
ipcInfo
[
ii
].
mode
==
IRCV
)
&&
(
cdsPciModules
.
dolphin
Read
[
0
]
)
)
(
cdsPciModules
.
dolphin
PcieReadPtr
)
)
{
ipcInfo
[
ii
].
pIpcDataRead
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinRead
[
0
]
)
+
IPC_PCIE_BASE_OFFSET
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinPcieReadPtr
)
+
IPC_PCIE_BASE_OFFSET
);
}
if
(
(
ipcInfo
[
ii
].
netType
==
IPCIE
)
&&
(
ipcInfo
[
ii
].
mode
==
ISND
)
&&
(
cdsPciModules
.
dolphinWrite
[
0
]
)
)
(
cdsPciModules
.
dolphin
Pcie
Write
Ptr
)
)
{
ipcInfo
[
ii
].
pIpcDataWrite
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinWrite
[
0
]
)
+
IPC_PCIE_BASE_OFFSET
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinPcieWritePtr
)
+
IPC_PCIE_BASE_OFFSET
);
// RTSLOG_DEBUG("Net Type = PCIE SEND IPC at 0x%p
// *********************************\n",ipcInfo[ii].pIpcData);
}
...
...
@@ -206,6 +200,12 @@ void commData3Send(
syncWord
=
timeSec
;
syncWord
=
(
syncWord
<<
32
)
+
dataCycle
;
#else
//If the IOP model has signaled us to not send remote IPCs, just return
if
(
ioMemData
->
stop_dolphin_ipcs
!=
0
)
return
;
sendBlock
=
(
(
cycle
+
1
)
*
(
IPC_MAX_RATE
/
IPC_RATE
)
)
%
IPC_BLOCKS
;
// Calculate the SYNC word to be sent with all data.
// Determine the cycle count to be sent with the data
...
...
src/fe/commDataUsp.c
View file @
25334efc
...
...
@@ -49,12 +49,6 @@ commData3Init(
int
ii
;
unsigned
long
ipcMemOffset
;
// RTSLOG_DEBUG("size of data block = 0x%x\n", sizeof(CDS_IPC_COMMS));
// RTSLOG_DEBUG("Dolphin num = %d \n",cdsPciModules.dolphinCount);
// RTSLOG_DEBUG("\tLocal at 0x%x and 0x%x
// \n",cdsPciModules.dolphinRead[0],cdsPciModules.dolphinWrite[0]);
// RTSLOG_DEBUG("\tRFM at 0x%x and 0x%x
// \n",cdsPciModules.dolphinRead[1],cdsPciModules.dolphinWrite[1]);
#ifdef RFM_DELAY
// RTSLOG_INFO("Model compiled with RFM DELAY !!\n");
#endif
...
...
@@ -96,22 +90,22 @@ commData3Init(
if
(
(
ipcInfo
[
ii
].
netType
==
IRFM0
||
ipcInfo
[
ii
].
netType
==
IRFM1
)
&&
(
ipcInfo
[
ii
].
mode
==
ISND
)
&&
(
cdsPciModules
.
dolphinWrite
[
1
]
)
)
(
cdsPciModules
.
dolphin
Rfm
Write
Ptr
)
)
{
ipcInfo
[
ii
].
pIpcDataWrite
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinWrite
[
1
]
)
+
ipcMemOffset
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphin
Rfm
Write
Ptr
)
+
ipcMemOffset
);
}
if
(
(
ipcInfo
[
ii
].
netType
==
IRFM0
||
ipcInfo
[
ii
].
netType
==
IRFM1
)
&&
(
ipcInfo
[
ii
].
mode
==
IRCV
)
&&
(
cdsPciModules
.
dolphinR
ead
[
1
]
)
)
(
cdsPciModules
.
dolphinR
fmReadPtr
)
)
{
ipcInfo
[
ii
].
pIpcDataRead
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinRead
[
1
]
)
+
ipcMemOffset
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinR
fmR
ead
Ptr
)
+
ipcMemOffset
);
}
if
(
ipcInfo
[
ii
].
netType
==
ISHME
)
// Computer shared memory ******************************
...
...
@@ -127,21 +121,21 @@ commData3Init(
// second one for receiving data.
if
(
(
ipcInfo
[
ii
].
netType
==
IPCIE
)
&&
(
ipcInfo
[
ii
].
mode
==
IRCV
)
&&
(
cdsPciModules
.
dolphin
Read
[
0
]
)
)
(
cdsPciModules
.
dolphin
PcieReadPtr
)
)
{
ipcInfo
[
ii
].
pIpcDataRead
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinRead
[
0
]
)
+
IPC_PCIE_BASE_OFFSET
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinPcieReadPtr
)
+
IPC_PCIE_BASE_OFFSET
);
}
if
(
(
ipcInfo
[
ii
].
netType
==
IPCIE
)
&&
(
ipcInfo
[
ii
].
mode
==
ISND
)
&&
(
cdsPciModules
.
dolphinWrite
[
0
]
)
)
(
cdsPciModules
.
dolphin
Pcie
Write
Ptr
)
)
{
ipcInfo
[
ii
].
pIpcDataWrite
[
0
]
=
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinWrite
[
0
]
)
+
IPC_PCIE_BASE_OFFSET
);
(
CDS_IPC_COMMS
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphin
Pcie
Write
Ptr
)
+
IPC_PCIE_BASE_OFFSET
);
// RTSLOG_INFO("Net Type = PCIE SEND IPC at 0x%p
// *********************************\n",ipcInfo[ii].pIpcData);
}
...
...
@@ -212,6 +206,11 @@ commData3Send(
syncWord
=
timeSec
;
syncWord
=
(
syncWord
<<
32
)
+
dataCycle
;
#else
//If the IOP model has signaled us to not send remote IPCs, just return
if
(
ioMemData
->
stop_dolphin_ipcs
!=
0
)
return
;
sendBlock
=
(
(
cycle
+
1
)
*
(
IPC_MAX_RATE
/
IPC_RATE
)
)
%
IPC_BLOCKS
;
// Calculate the SYNC word to be sent with all data.
// Determine the cycle count to be sent with the data
...
...
src/fe/controllerIop.c
View file @
25334efc
...
...
@@ -379,19 +379,17 @@ fe_start_controller( void )
// Other options based on Parameter block settings
#ifdef XMIT_DOLPHIN_TIME
// This is an IOP that transmits time and cycle count over Dolphin net
pcieTimer
=
(
volatile
TIMING_SIGNAL
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinWrite
[
0
]
)
+
IPC_PCIE_TIME_OFFSET
);
pcieTimer
=
(
volatile
TIMING_SIGNAL
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinPcieWritePtr
)
+
IPC_PCIE_TIME_OFFSET
);
#endif
#ifdef USE_DOLPHIN_TIMING
// This is an IOP w/o an I/O chassis, runs by receiving time/cycle over
// Dolphin net.
syncSource
=
SYNC_SRC_DOLPHIN
;
pcieTimer
=
(
volatile
TIMING_SIGNAL
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinRead
[
0
]
)
+
IPC_PCIE_TIME_OFFSET
);
pcieTimer
=
(
volatile
TIMING_SIGNAL
*
)(
(
volatile
char
*
)(
cdsPciModules
.
dolphinPcieReadPtr
)
+
IPC_PCIE_TIME_OFFSET
);
#endif
#ifdef NO_SYNC
...
...
@@ -901,8 +899,17 @@ fe_start_controller( void )
// *****************************************************************
/// \> Check if code exit is requested
if
(
cycleNum
==
MAX_MODULES
)
{
if
(
pLocalEpics
->
epicsInput
.
disableRemoteIpc
!=
0
)
{
ioMemData
->
stop_dolphin_ipcs
=
1
;
}
else
{
ioMemData
->
stop_dolphin_ipcs
=
0
;
}
vmeDone
=
atomic_read
(
&
g_atom_should_exit
)
|
checkEpicsReset
(
cycleNum
,
(
struct
CDS_EPICS
*
)
pLocalEpics
);
}
// *****************************************************************
// If synced to 1PPS on startup, continue to check that code
...
...
src/fe/controllerIopUser.c
View file @
25334efc
...
...
@@ -747,9 +747,17 @@ fe_start_iop_user( )
}
/// \> Check if code exit is requested
if
(
cycleNum
==
MAX_MODULES
)
if
(
cycleNum
==
MAX_MODULES
)
{
if
(
pLocalEpics
->
epicsInput
.
disableRemoteIpc
!=
0
)
{
ioMemData
->
stop_dolphin_ipcs
=
1
;
}
else
{
ioMemData
->
stop_dolphin_ipcs
=
0
;
}
vmeDone
=
stop_working_threads
|
checkEpicsReset
(
cycleNum
,
(
struct
CDS_EPICS
*
)
pLocalEpics
);
}
/// \> Write data to DAQ.
#ifndef NO_DAQ
...
...
src/fe/dolphin.c
deleted
100644 → 0
View file @
444e2373
/// @file dolphin.c
/// @brief File containing the Dolphin functions. \n
/// @detail This file contains Dolphin init and cleanup routines for kernel
/// module code.
/// @author R.Bork
#include
"../fe/dolphin.h"
#include
"commData3.h"
#include
"controller.h"
//MAX_UDELAY, cdsPciModules
#include
"drv/rts-logger.h"
#include
"../drv/mbuf/mbuf_kernel.h"
//Dolphin Header
#include
<genif.h>
sci_l_segment_handle_t
segment
[
4
];
sci_map_handle_t
client_map_handle
[
4
];
sci_r_segment_handle_t
remote_segment_handle
[
4
];
sci_device_info_t
sci_dev_info
[
4
];
/*
R_OK,
SR_DISABLED,
SR_WAITING,
SR_CHECKING,
SR_CHECK_TIMEOUT,
SR_LOST,
SR_OPEN_TIMEOUT,
SR_HEARTBEAT_RECEIVED
} session_cb_reason_t;
*/
static
int32_t
session_callback
(
session_cb_arg_t
IN
arg
,
session_cb_reason_t
IN
reason
,
session_cb_status_t
IN
status
,
uint32_t
IN
target_node
,
uint32_t
IN
local_adapter_number
)
{
/// @brief This function contains the required Dolphin callback routine. \n
// RTSLOG_INFO("Session callback reason=%d status=%d target_node=%d\n", reason,
// status, target_node); if (reason == SR_OK) iop_rfm_valid = 1;
if
(
reason
==
SR_OK
||
status
==
SS_NONE
)
//TODO: This does not seem like a good check, we could pass if reason has an error and status is SR_NONE
iop_rfm_valid
=
1
;
else
iop_rfm_valid
=
0
;
// This is being called when the one of the other nodes is prepared for
// shutdown :TODO: may need to check target_node == <our local node>
// if (reason == SR_DISABLED || reason == SR_LOST) iop_rfm_valid = 0;
return
0
;
}
/// Function for Dolphin connection callback
static
int32_t
connect_callback
(
void
IN
*
arg
,
sci_r_segment_handle_t
IN
remote_segment_handle
,
uint32_t
IN
reason
,
uint32_t
IN
status
)
{
// RTSLOG_INFO("Connect callback reason=%d status=%d\n", reason, status);
if
(
reason
==
1
)
iop_rfm_valid
=
1
;
if
(
reason
==
3
)
iop_rfm_valid
=
0
;
if
(
reason
==
5
)
iop_rfm_valid
=
1
;
return
0
;
}
static
int32_t
create_segment_callback
(
void
IN
*
arg
,
sci_l_segment_handle_t
IN
local_segment_handle
,
uint32_t
IN
reason
,
uint32_t
IN
source_node
,
uint32_t
IN
local_adapter_number
)
{
// RTSLOG_INFO("Create segment callback reason=%d source_node=%d\n", reason,
// source_node);
return
0
;
}
int
init_dolphin
(
int
modules
)
{
scierror_t
err
;
char
*
addr
;
char
*
read_addr
;
int
ii
;
cdsPciModules
.
dolphinCount
=
0
;
for
(
ii
=
0
;
ii
<
modules
;
ii
++
)
{
err
=
sci_create_segment
(
NO_BINDING
,
0
,
ii
,
DIS_BROADCAST
,
IPC_TOTAL_ALLOC_SIZE
,
create_segment_callback
,
0
,
&
segment
[
ii
]
);
RTSLOG_INFO
(
"DIS segment alloc status %d
\n
"
,
err
);
if
(
err
)
return
-
1
;
err
=
sci_set_local_segment_available
(
segment
[
ii
],
0
);
RTSLOG_INFO
(
"DIS segment making available status %d
\n
"
,
err
);
if
(
err
)
{
sci_remove_segment
(
&
segment
[
ii
],
0
);
return
-
2
;
}
err
=
sci_export_segment
(
segment
[
ii
],
0
,
DIS_BROADCAST
);
RTSLOG_INFO
(
"DIS segment export status 0x%x
\n
"
,
err
);
if
(
err
)
{
sci_remove_segment
(
&
segment
[
ii
],
0
);
return
-
3
;
}
read_addr
=
sci_local_kernel_virtual_address
(
segment
[
ii
]
);
if
(
read_addr
==
0
)
{
RTSLOG_INFO
(
"DIS sci_local_kernel_virtual_address returned 0
\n
"
);
sci_unexport_segment
(
segment
[
ii
],
0
,
0
);
sci_remove_segment
(
&
segment
[
ii
],
0
);
return
-
4
;
}
else
{
RTSLOG_INFO
(
"Dolphin memory read at 0x%p
\n
"
,
read_addr
);
cdsPciModules
.
dolphinRead
[
ii
]
=
(
volatile
unsigned
long
*
)
read_addr
;
}
udelay
(
MAX_UDELAY
);
udelay
(
MAX_UDELAY
);
err
=
sci_connect_segment
(
NO_BINDING
,
252
,
//broadcast node - should not match any
// actual node number.
// 252 taken from sisci driver code.
0
,
0
,
ii
,
DIS_BROADCAST
,
connect_callback
,
0
,
&
remote_segment_handle
[
ii
]
);
RTSLOG_INFO
(
"DIS connect segment status %d
\n
"
,
err
);
if
(
err
)
{
sci_unexport_segment
(
segment
[
ii
],
0
,
0
);
sci_remove_segment
(
&
segment
[
ii
],
0
);
return
-
5
;
}
udelay
(
MAX_UDELAY
);
udelay
(
MAX_UDELAY
);
err
=
sci_map_segment
(
remote_segment_handle
[
ii
],
DIS_BROADCAST
,
0
,
IPC_TOTAL_ALLOC_SIZE
,
&
client_map_handle
[
ii
]
);
RTSLOG_INFO
(
"DIS segment mapping status 0x%x
\n
"
,
err
);
if
(
err
)
{
sci_disconnect_segment
(
&
remote_segment_handle
[
ii
],
0
);
sci_unexport_segment
(
segment
[
ii
],
0
,
0
);
sci_remove_segment
(
&
segment
[
ii
],
0
);
return
-
6
;
}
addr
=
sci_kernel_virtual_address_of_mapping
(
client_map_handle
[
ii
]
);
if
(
addr
==
0
)
{
// RTSLOG_INFO ("Got zero pointer from
// sci_kernel_virtual_address_of_mapping\n");
sci_disconnect_segment
(
&
remote_segment_handle
[
ii
],
0
);
sci_unexport_segment
(
segment
[
ii
],
0
,
0
);
sci_remove_segment
(
&
segment
[
ii
],
0
);
return
-
7
;
}
else
{
RTSLOG_INFO
(
"Dolphin memory write at 0x%p
\n
"
,
addr
);
cdsPciModules
.
dolphinWrite
[
ii
]
=
(
volatile
unsigned
long
*
)
addr
;
}
sci_register_session_cb
(
ii
,
0
,
session_callback
,
0
);
cdsPciModules
.
dolphinCount
+=
1
;
}
return
0
;
}
void
finish_dolphin
(
void
)
{
int
ii
;
for
(
ii
=
0
;
ii
<
cdsPciModules
.
dolphinCount
;
ii
++
)
{
sci_unmap_segment
(
&
client_map_handle
[
ii
],
0
);
sci_disconnect_segment
(
&
remote_segment_handle
[
ii
],
0
);
sci_unexport_segment
(
segment
[
ii
],
0
,
0
);
sci_remove_segment
(
&
segment
[
ii
],
0
);
sci_cancel_session_cb
(
ii
,
0
);
}
}
src/fe/dolphin.h
View file @
25334efc
...
...
@@ -5,7 +5,15 @@
extern
"C"
{
#endif
int
init_dolphin
(
int
modules
,
int
segment_ids
[]
);
//We have two segments per model, one for "PCIE" IPCs,
//these are IPCs to/from models on a single
//dolphin netowrk (CS, EX, EY). The second segment is
//for "RFM" IPCs, these are for IPCs to/from models
//on diffrent networks EX <-> CS <-> EY and are
//trasfered by the cdsrfm model/FE
#define NUM_DOLPHIN_SEGMENTS_PER_MODEL 2
int
init_dolphin
(
void
);
void
finish_dolphin
(
void
);
...
...
src/fe/dolphin_netlink.c
View file @
25334efc
...
...
@@ -90,12 +90,13 @@ static void netlink_recv_resp(struct sk_buff *skb)
return
;
}
for
(
int
i
=
0
;
i
<
any_msg
.
as_alloc_resp
->
num_addrs
;
++
i
)
{
//Store pointers for use later, int div on the right
cdsPciModules
.
dolphinRead
[
i
]
=
(
volatile
unsigned
long
*
)
any_msg
.
as_alloc_resp
->
addrs
[
i
].
read_addr
;
cdsPciModules
.
dolphinWrite
[
i
]
=
(
volatile
unsigned
long
*
)
any_msg
.
as_alloc_resp
->
addrs
[
i
].
write_addr
;
}
//At this point g_requested_addrs = NUM_DOLPHIN_SEGMENTS_PER_MODEL(2)
cdsPciModules
.
dolphinPcieReadPtr
=
(
volatile
unsigned
long
*
)
any_msg
.
as_alloc_resp
->
addrs
[
0
].
read_addr
;
cdsPciModules
.
dolphinPcieWritePtr
=
(
volatile
unsigned
long
*
)
any_msg
.
as_alloc_resp
->
addrs
[
0
].
write_addr
;
cdsPciModules
.
dolphinRfmReadPtr
=
(
volatile
unsigned
long
*
)
any_msg
.
as_alloc_resp
->
addrs
[
1
].
read_addr
;
cdsPciModules
.
dolphinRfmWritePtr
=
(
volatile
unsigned
long
*
)
any_msg
.
as_alloc_resp
->
addrs
[
1
].
write_addr
;
break
;
default:
...
...
@@ -111,7 +112,7 @@ static void netlink_recv_resp(struct sk_buff *skb)
}
int
init_dolphin
(
int
num_segments
,
int
segment_ids
[]
)
int
init_dolphin
(
)
{
struct
sk_buff
*
skb_out
;
struct
nlmsghdr
*
nlh
;
...
...
@@ -131,8 +132,8 @@ int init_dolphin( int num_segments , int segment_ids[])
//Start message creation
g_requested_addrs
=
num_segments
;
unsigned
total_payload_sz
=
GET_ALLOC_REQ_SZ
(
num_segments
);
g_requested_addrs
=
NUM_DOLPHIN_SEGMENTS_PER_MODEL
;
unsigned
total_payload_sz
=
GET_ALLOC_REQ_SZ
(
NUM_DOLPHIN_SEGMENTS_PER_MODEL
);
///Allocate the request's msg space, OS does free once it is sent
skb_out
=
nlmsg_new
(
total_payload_sz
,
0
);
...
...
@@ -148,15 +149,18 @@ int init_dolphin( int num_segments , int segment_ids[])
alloc_req
=
(
dolphin_mc_alloc_req
*
)
nlmsg_data
(
nlh
);
alloc_req
->
header
.
msg_id
=
DOLPHIN_DAEMON_ALLOC_REQ
;
alloc_req
->
header
.
preamble_seq
=
DOLPHIN_DAEMON_MSG_PREAMBLE
;
alloc_req
->
num_segments
=
num_segments
;
for
(
int
i
=
0
;
i
<
num_segments
;
++
i
)
{
//This loop is inline with lagacy functionality, instead of passing
//segment ids it requests a number, and segment IDs are requested < that number
alloc_req
->
segments
[
i
].
segment_id
=
segment_ids
[
i
];
alloc_req
->
segments
[
i
].
adapter_num
=
0
;
alloc_req
->
segments
[
i
].
segment_sz_bytes
=
IPC_TOTAL_ALLOC_SIZE
;
}
alloc_req
->
num_segments
=
NUM_DOLPHIN_SEGMENTS_PER_MODEL
;
//PCIE (local) Dolphin Segment
alloc_req
->
segments
[
0
].
segment_id
=
DOLPHIN_PCIE_SEGMENT_ID
;
alloc_req
->
segments
[
0
].
adapter_num
=
0
;
alloc_req
->
segments
[
0
].
segment_sz_bytes
=
IPC_TOTAL_ALLOC_SIZE
;
//RFM (remote) Dolphin Segment
alloc_req
->
segments
[
1
].
segment_id
=
DOLPHIN_RFM_SEGMENT_ID
;
alloc_req
->
segments
[
1
].
adapter_num
=
0
;
alloc_req
->
segments
[
1
].
segment_sz_bytes
=
IPC_TOTAL_ALLOC_SIZE
;
res
=
nlmsg_multicast
(
g_nl_sock
,
skb_out
,
0
,
DOLPHIN_DAEMON_REQ_GRP_ID
,
GFP_KERNEL
);
if
(
res
!=
0
)
...
...
src/fe/dolphin_usp.c
View file @
25334efc
...
...
@@ -54,7 +54,9 @@ void PrintParameters(void)
// *************************************************************************************
sci_error_t
dolphin_init
(
CDS_HARDWARE
*
cdspci
)
{
int
ii
;
int
ii
;
volatile
unsigned
long
*
dolphinRead
[
2
];
volatile
unsigned
long
*
dolphinWrite
[
2
];
/* Initialize the SISCI library */
SCIInitialize
(
NO_FLAGS
,
&
error
);
if
(
error
!=
SCI_ERR_OK
)
{
...
...
@@ -103,93 +105,99 @@ sci_error_t dolphin_init(CDS_HARDWARE *cdspci)
* All nodes within the broadcast group must have the same segmentId to communicate.
*/
for
(
ii
=
0
;
ii
<
2
;
ii
++
)
{
/* Create local reflective memory segment */
segmentId
=
ii
;
SCICreateSegment
(
sd
,
&
localSegment
,
segmentId
,
segmentSize
,
NO_CALLBACK
,
NULL
,
SCI_FLAG_BROADCAST
,
&
error
);
if
(
error
==
SCI_ERR_OK
)
{
printf
(
"Local segment (id=0x%x, size=%d) is created.
\n
"
,
segmentId
,
segmentSize
);