-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectPut.h
117 lines (104 loc) · 5.05 KB
/
DirectPut.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* begin_generated_IBM_copyright_prolog */
/* */
/* This is an automatically generated copyright prolog. */
/* After initializing, DO NOT MODIFY OR MOVE */
/* ================================================================ */
/* */
/* Licensed Materials - Property of IBM */
/* */
/* Blue Gene/Q */
/* */
/* (C) Copyright IBM Corp. 2008, 2012 */
/* */
/* US Government Users Restricted Rights - */
/* Use, duplication or disclosure restricted */
/* by GSA ADP Schedule Contract with IBM Corp. */
/* */
/* This software is available to you under the */
/* Eclipse Public License (EPL). */
/* */
/* ================================================================ */
/* */
/* end_generated_IBM_copyright_prolog */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <stdint.h>
#include <malloc.h>
#include <assert.h>
#include <string.h>
// Basic SPI and HWI includes
#include <hwi/include/bqc/A2_core.h>
#include <hwi/include/bqc/A2_inlines.h>
#include <hwi/include/bqc/MU_PacketCommon.h>
#include <firmware/include/personality.h>
#include <spi/include/mu/Descriptor.h>
#include <spi/include/mu/Descriptor_inlines.h>
#include <spi/include/mu/InjFifo.h>
#include <spi/include/mu/Addressing.h>
#include <spi/include/mu/Addressing_inlines.h>
#include <spi/include/mu/GIBarrier.h>
#include <spi/include/kernel/MU.h>
#include <spi/include/kernel/process.h>
#include <spi/include/kernel/location.h>
#define NUM_DIRS 8
// pointers to send and receive buffers
extern char * SPIrecvBuffers;
extern char * SPIsendBuffers;
extern MUHWI_Descriptor_t *muDescriptors;
/**
* \brief Injection Fifo Handle
*
* This is a "handle" returned from msg_InjFifoInit() and passed into subsequent
* calls to msg_InjFifoXXXX() functions. It is used internally within the
* msg_InjFifoXXXX() functions to anchor resources that have been allocated.
*/
typedef struct {
void* pOpaqueObject;
} msg_InjFifoHandle_t;
int msg_InjFifoInit ( msg_InjFifoHandle_t *injFifoHandlePtr,
uint32_t startingSubgroupId,
uint32_t startingFifoId,
uint32_t numFifos,
size_t fifoSize,
Kernel_InjFifoAttributes_t *injFifoAttrs );
/**
* \brief Terminate Injection Fifos
*
* Terminate the usage of injection fifos. This deactivates the fifos and
* frees all of the storage associated with them (previously allocated during
* msg_InjFifoInit()).
*
* \param [in] injFifoHandle The handle returned from msg_InjFifoInit().
* It must be passed into this function untouched
* from when it was returned from msg_InjFifoInit().
*
* \note After this function returns, no more InjFifo functions should be called
* with this injFifoHandle.
*/
void msg_InjFifoTerm ( msg_InjFifoHandle_t injFifoHandle );
/**
* \brief Inject Descriptor into Injection Fifo
*
* Inject the specified descriptor into the specified injection fifo.
*
* \param [in] injFifoHandle The handle returned from msg_InjFifoInit().
* It must be passed into this function untouched
* from when it was returned from msg_InjFifoInit().
* \param [in] relativeFifoId The fifo number, relative to the start of
* the fifos managed by this opaque object.
* For example, if msg_InjFifoInit() was called
* to init fifos in subgroup 2, starting with
* fifo Id 3, the relativeFifoNumber of the
* first fifo is 0, not 3.
* \param [in] descPtr Pointer to the descriptor to be injected.
*
* \retval positiveNumber The descriptor was successfully injected. The
* returned value is the sequence number of this
* descriptor.
* \retval -1 The descriptor was not injected, most likely because
* there is no room in the fifo.
*/
uint64_t msg_InjFifoInject ( msg_InjFifoHandle_t injFifoHandle,
uint32_t relativeFifoId,
MUHWI_Descriptor_t *descPtr );