phsa-queue-interface.h revision 1.1.1.1
1/* phsa_queue_interface.h -- Definition for a minimalistic generic in-memory
2   representation of a user mode queue to be used with the phsa/gccbrig
3   implementation.
4
5   Copyright (C) 2015-2017 Free Software Foundation, Inc.
6   Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
7   for General Processor Tech.
8
9   Permission is hereby granted, free of charge, to any person obtaining a
10   copy of this software and associated documentation files
11   (the "Software"), to deal in the Software without restriction, including
12   without limitation the rights to use, copy, modify, merge, publish,
13   distribute, sublicense, and/or sell copies of the Software, and to
14   permit persons to whom the Software is furnished to do so, subject to
15   the following conditions:
16
17   The above copyright notice and this permission notice shall be included
18   in all copies or substantial portions of the Software.
19
20   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24   DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26   USE OR OTHER DEALINGS IN THE SOFTWARE.
27*/
28
29#ifndef PHSA_QUEUE_INTERFACE_H
30#define PHSA_QUEUE_INTERFACE_H
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include <stdbool.h>
37#include <stddef.h>
38#include <stdint.h>
39#include "hsa.h"
40
41typedef __attribute__ ((aligned (64))) struct phsa_queue_s
42{
43  /* An HSA Architectured Queue object.  Must be in the beginning
44     of the struct to enable direct pointer casting between hsa_queue_
45     and phsa_queue_t.  */
46  hsa_queue_t hsa_queue;
47
48  volatile uint64_t write_index;
49  volatile uint64_t read_index;
50
51  /* True if global mem addresses are 64b.  */
52  uint64_t is_ptr64 : 1;
53
54} phsa_queue_t;
55
56#ifdef __cplusplus
57}
58#endif
59
60#endif
61