Skip to content

Commit 9da3ad0

Browse files
committed
Modify host channel port IDs into an enum
1 parent 6fef594 commit 9da3ad0

File tree

6 files changed

+62
-61
lines changed

6 files changed

+62
-61
lines changed

include/MMD/aocl_mmd.h

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ typedef enum {
128128
AOCL_MMD_USES_YIELD = 5, /* 1 if yield must be called to poll hw (int) */
129129
/**
130130
* The following can be combined in a bit field:
131-
* AOCL_MMD_PHYSICAL_MEMORY, AOCL_MMD_SVM_COARSE_GRAIN_BUFFER, AOCL_MMD_SVM_FINE_GRAIN_BUFFER, AOCL_MMD_SVM_FINE_GRAIN_SYSTEM.
132-
* Prior to 14.1, all existing devices supported physical memory and no types of SVM memory, so this
133-
* is the default when this operation returns '0' for board MMDs with a version prior to 14.1
131+
* AOCL_MMD_PHYSICAL_MEMORY, AOCL_MMD_SVM_COARSE_GRAIN_BUFFER,
132+
* AOCL_MMD_SVM_FINE_GRAIN_BUFFER, AOCL_MMD_SVM_FINE_GRAIN_SYSTEM.
133+
* Prior to 14.1, all existing devices supported physical memory and no types
134+
* of SVM memory, so this is the default when this operation returns '0' for
135+
* board MMDs with a version prior to 14.1.
134136
*/
135137
AOCL_MMD_MEM_TYPES_SUPPORTED = 6,
136138
} aocl_mmd_offline_info_t;
@@ -140,7 +142,8 @@ typedef enum {
140142
* Possible capabilities to return from AOCL_MMD_*_MEM_CAPABILITIES query
141143
*/
142144
/**
143-
* If not set allocation function is not supported, even if other capabilities are set.
145+
* If not set allocation function is not supported, even if other capabilities
146+
* are set.
144147
*/
145148
#define AOCL_MMD_MEM_CAPABILITY_SUPPORTED (1 << 0)
146149
/**
@@ -172,7 +175,7 @@ typedef enum {
172175
* AOCL_MMD_PLL_INTERFACES - the handle for each pll associated with each
173176
* kernel interface. If a kernel interface is not clocked by acl_kernel_clk
174177
* then return -1
175-
**/
178+
*/
176179
typedef enum {
177180
AOCL_MMD_NUM_KERNEL_INTERFACES = 1, /* Number of Kernel interfaces (int) */
178181
AOCL_MMD_KERNEL_INTERFACES = 2, /* Kernel interface (int*) */
@@ -198,7 +201,7 @@ typedef struct {
198201
unsigned long long int exception_type;
199202
void *user_private_info;
200203
size_t user_cb;
201-
}aocl_mmd_interrupt_info;
204+
} aocl_mmd_interrupt_info;
202205

203206
typedef void (*aocl_mmd_interrupt_handler_fn)( int handle, void* user_data );
204207
typedef void (*aocl_mmd_device_interrupt_handler_fn)( int handle, aocl_mmd_interrupt_info* data_in, void* user_data );
@@ -207,29 +210,30 @@ typedef void (*aocl_mmd_status_handler_fn)( int handle, void* user_data, aocl_mm
207210
/**
208211
* Host channel port IDs
209212
*/
210-
typedef int aocl_mmd_hostchannel_port_id_t;
211-
/**
212-
* Port ID for Avalon streaming interface startofpacket signal.
213-
*/
214-
#define AOCL_MMD_HOSTCHANNEL_PORT_AVALON_SOP 1
215-
/**
216-
* Port ID for Avalon streaming interface endofpacket signal.
217-
* This port ID is currently shared with AXI streaming interface tlast signal.
218-
*/
219-
#define AOCL_MMD_HOSTCHANNEL_PORT_AVALON_EOP 2
220-
/**
221-
* Port ID for Avalon streaming interface empty signal.
222-
*/
223-
#define AOCL_MMD_HOSTCHANNEL_PORT_AVALON_EMPTY 3
224-
/**
225-
* Port ID for AXI streaming interface tlast signal.
226-
* This port ID is currently shared with Avalon streaming interface endofpacket signal.
227-
*/
228-
#define AOCL_MMD_HOSTCHANNEL_PORT_AXI_TLAST 2
229-
/**
230-
* Port ID for AXI streaming interface tuser signal.
231-
*/
232-
#define AOCL_MMD_HOSTCHANNEL_PORT_AXI_TUSER 4
213+
typedef enum {
214+
/**
215+
* Unknown port ID.
216+
*/
217+
AOCL_MMD_HOSTCHANNEL_PORT_UNKNOWN = -1,
218+
/**
219+
* Port ID for general data signal. This port ID is not to be used with
220+
* aocl_mmd_hostchannel_get_sideband_buffer(), to get the MMD buffer for
221+
* data port, user aocl_mmd_hostchannel_get_buffer() directly.
222+
*/
223+
AOCL_MMD_HOSTCHANNEL_PORT_DATA = 0,
224+
/**
225+
* Port ID for Avalon streaming interface startofpacket signal.
226+
*/
227+
AOCL_MMD_HOSTCHANNEL_PORT_AVALON_SOP = 1,
228+
/**
229+
* Port ID for Avalon streaming interface endofpacket signal.
230+
*/
231+
AOCL_MMD_HOSTCHANNEL_PORT_AVALON_EOP = 2,
232+
/**
233+
* Port ID for Avalon streaming interface empty signal.
234+
*/
235+
AOCL_MMD_HOSTCHANNEL_PORT_AVALON_EMPTY = 3,
236+
} aocl_mmd_hostchannel_port_id_t;
233237

234238

235239
/**
@@ -254,10 +258,10 @@ typedef enum {
254258
*/
255259
AOCL_MMD_MEM_PROPERTIES_GLOBAL_MEMORY=1,
256260
/**
257-
* Specifies the index of a bank inside the global memory interface that can be found in
258-
* the board_spec.xml file for the BSP. Allocations will be allocated to this
259-
* memory bank. It is invalid to specify this property without also specifying
260-
* AOCL_MMD_GLOBAL_MEMORY_INTERFACE.
261+
* Specifies the index of a bank inside the global memory interface that can be
262+
* found in the board_spec.xml file for the BSP. Allocations will be allocated
263+
* to this memory bank. It is invalid to specify this property without also
264+
* specifying AOCL_MMD_GLOBAL_MEMORY_INTERFACE.
261265
*/
262266
AOCL_MMD_MEM_PROPERTIES_MEMORY_BANK,
263267
/**
@@ -463,11 +467,13 @@ AOCL_MMD_CALL int aocl_mmd_copy(
463467
* Host Channel create operation
464468
* Opens channel between host and kernel.
465469
*
466-
* @param channel_name: Name of channel to initialize. Same name as used in board_spec.xml
470+
* @param channel_name: Name of channel to initialize. Same name as used in
471+
board_spec.xml
467472
* @param queue_depth: The size in bytes of pinned memory queue in system memory
468473
* @param direction: The direction of the channel
469-
* @return negative if initialization was unsuccessful, and positive otherwise. Positive
470-
* return value is handle to the channel to be used for subsequent calls for the channel.
474+
* @return negative if initialization was unsuccessful, and positive otherwise.
475+
Positive return value is handle to the channel to be used for
476+
subsequent calls for the channel.
471477
*/
472478
AOCL_MMD_CALL int aocl_mmd_hostchannel_create(
473479
int handle,
@@ -481,8 +487,8 @@ AOCL_MMD_CALL int aocl_mmd_hostchannel_create(
481487
* Host Channel destroy operation
482488
* Closes channel between host and kernel.
483489
*
484-
* @param channel: The handle to the channel to close, that was obtained with
485-
* create channel
490+
* @param channel: The handle to the channel to close, that was obtained with
491+
* create channel
486492
* @return 0 if the destroy was successful, and negative otherwise.
487493
*/
488494
AOCL_MMD_CALL int aocl_mmd_hostchannel_destroy(

include/acl.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,6 @@ struct acl_sideband_signal_mapping {
559559
unsigned sideband_size; // bit
560560
};
561561

562-
// Must match the definition in the compiler
563-
// Analysis/FPGAAnalysis/Utils/StreamParameters.h
564-
enum signal_type {
565-
SignalUnknown = -1,
566-
AvalonData = 0,
567-
AvalonSOP = 1,
568-
AvalonEOP = 2, // Same as AXILast
569-
AvalonEmpty = 3,
570-
AXIUser = 4
571-
};
572-
573562
// Part of acl_device_def_t where members are populated from the information
574563
// in the autodiscovery string. This will get updated every time the device
575564
// is programmed with a new device binary as the new binary would contain a

include/acl_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ typedef struct host_op_struct {
296296
} host_op_t;
297297

298298
struct sideband_signal_t {
299-
unsigned port_identifier; // matches enum signal_type in acl.h
299+
unsigned port_identifier; // matches enum aocl_mmd_hostchannel_port_id_t in
300+
// aocl_mmd.h
300301
unsigned port_offset; // in bit
301302
unsigned side_band_size; // in bit
302303
};

src/acl_hal_mmd.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,10 +2559,11 @@ size_t acl_hal_mmd_hostchannel_sideband_pull_no_ack(
25592559

25602560
assert(device_info[physical_device_id]
25612561
.mmd_dispatch->aocl_mmd_hostchannel_get_sideband_buffer);
2562-
pull_buffer =
2563-
device_info[physical_device_id]
2564-
.mmd_dispatch->aocl_mmd_hostchannel_get_sideband_buffer(
2565-
pcie_dev_handle, channel_handle, port_name, &buffer_size, status);
2562+
pull_buffer = device_info[physical_device_id]
2563+
.mmd_dispatch->aocl_mmd_hostchannel_get_sideband_buffer(
2564+
pcie_dev_handle, channel_handle,
2565+
static_cast<aocl_mmd_hostchannel_port_id_t>(port_name),
2566+
&buffer_size, status);
25662567

25672568
if ((NULL == pull_buffer) || (0 == buffer_size)) {
25682569
return 0;
@@ -2595,10 +2596,11 @@ size_t acl_hal_mmd_hostchannel_sideband_push_no_ack(
25952596
assert(device_info[physical_device_id]
25962597
.mmd_dispatch->aocl_mmd_hostchannel_get_sideband_buffer);
25972598

2598-
push_buffer =
2599-
device_info[physical_device_id]
2600-
.mmd_dispatch->aocl_mmd_hostchannel_get_sideband_buffer(
2601-
pcie_dev_handle, channel_handle, port_name, &buffer_size, status);
2599+
push_buffer = device_info[physical_device_id]
2600+
.mmd_dispatch->aocl_mmd_hostchannel_get_sideband_buffer(
2601+
pcie_dev_handle, channel_handle,
2602+
static_cast<aocl_mmd_hostchannel_port_id_t>(port_name),
2603+
&buffer_size, status);
26022604

26032605
if ((NULL == push_buffer) || (0 == buffer_size)) {
26042606
return 0;

src/acl_hostch.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ static cl_int l_push_sideband_packet(unsigned int physical_device_id,
7171
for (auto const &sideband_signal_entry :
7272
host_pipe_info.side_band_signals_vector) {
7373
size_t pushed_data;
74-
if (sideband_signal_entry.port_identifier == AvalonData) {
74+
if (sideband_signal_entry.port_identifier ==
75+
static_cast<unsigned>(AOCL_MMD_HOSTCHANNEL_PORT_DATA)) {
7576
pushed_data = acl_get_hal()->hostchannel_push_no_ack(
7677
host_pipe_info.m_physical_device_id, host_pipe_info.m_channel_handle,
7778
(const void *)((char *)host_buffer +
@@ -117,7 +118,8 @@ static size_t l_pull_sideband_packet(unsigned int physical_device_id,
117118
for (auto const &sideband_signal_entry :
118119
host_pipe_info.side_band_signals_vector) {
119120
size_t pulled_data;
120-
if (sideband_signal_entry.port_identifier == AvalonData) {
121+
if (sideband_signal_entry.port_identifier ==
122+
static_cast<unsigned>(AOCL_MMD_HOSTCHANNEL_PORT_DATA)) {
121123
pulled_data = acl_get_hal()->hostchannel_pull_no_ack(
122124
host_pipe_info.m_physical_device_id, host_pipe_info.m_channel_handle,
123125
(void *)((char *)host_buffer + sideband_signal_entry.port_offset / 8),

src/acl_program.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,8 @@ l_register_hostpipes_to_program(acl_device_program_info_t *dev_prog,
13961396

13971397
auto &host_pipe_info =
13981398
dev_prog->program_hostpipe_map.at(sideband_signal_mapping.logical_name);
1399-
if (sideband_signal_mapping.port_identifier != AvalonData) {
1399+
if (sideband_signal_mapping.port_identifier !=
1400+
static_cast<unsigned>(AOCL_MMD_HOSTCHANNEL_PORT_DATA)) {
14001401
host_pipe_info.num_side_band_signals++;
14011402
}
14021403

0 commit comments

Comments
 (0)