Blame tools/fpgad/api/opae_events_api.h

Packit Service 3975d1
// Copyright(c) 2018-2019, Intel Corporation
Packit Service 3975d1
//
Packit Service 3975d1
// Redistribution  and  use  in source  and  binary  forms,  with  or  without
Packit Service 3975d1
// modification, are permitted provided that the following conditions are met:
Packit Service 3975d1
//
Packit Service 3975d1
// * Redistributions of  source code  must retain the  above copyright notice,
Packit Service 3975d1
//   this list of conditions and the following disclaimer.
Packit Service 3975d1
// * Redistributions in binary form must reproduce the above copyright notice,
Packit Service 3975d1
//   this list of conditions and the following disclaimer in the documentation
Packit Service 3975d1
//   and/or other materials provided with the distribution.
Packit Service 3975d1
// * Neither the name  of Intel Corporation  nor the names of its contributors
Packit Service 3975d1
//   may be used to  endorse or promote  products derived  from this  software
Packit Service 3975d1
//   without specific prior written permission.
Packit Service 3975d1
//
Packit Service 3975d1
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit Service 3975d1
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO,  THE
Packit Service 3975d1
// IMPLIED WARRANTIES OF  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit Service 3975d1
// ARE DISCLAIMED.  IN NO EVENT  SHALL THE COPYRIGHT OWNER  OR CONTRIBUTORS BE
Packit Service 3975d1
// LIABLE  FOR  ANY  DIRECT,  INDIRECT,  INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR
Packit Service 3975d1
// CONSEQUENTIAL  DAMAGES  (INCLUDING,  BUT  NOT LIMITED  TO,  PROCUREMENT  OF
Packit Service 3975d1
// SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE,  DATA, OR PROFITS;  OR BUSINESS
Packit Service 3975d1
// INTERRUPTION)  HOWEVER CAUSED  AND ON ANY THEORY  OF LIABILITY,  WHETHER IN
Packit Service 3975d1
// CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE  OR OTHERWISE)
Packit Service 3975d1
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,  EVEN IF ADVISED OF THE
Packit Service 3975d1
// POSSIBILITY OF SUCH DAMAGE.
Packit Service 3975d1
Packit Service 3975d1
#ifndef __FPGAD_API_OPAE_EVENTS_API_H__
Packit Service 3975d1
#define __FPGAD_API_OPAE_EVENTS_API_H__
Packit Service 3975d1
Packit Service 3975d1
#ifndef __USE_GNU
Packit Service 3975d1
#define __USE_GNU
Packit Service 3975d1
#endif
Packit Service 3975d1
#ifndef _GNU_SOURCE
Packit Service 3975d1
#define _GNU_SOURCE
Packit Service 3975d1
#endif
Packit Service 3975d1
Packit Service 3975d1
#include <opae/types.h>
Packit Service 3975d1
Packit Service 3975d1
#include "fpgad/fpgad.h"
Packit Service 3975d1
#include "fpgad/monitored_device.h"
Packit Service 3975d1
Packit Service 3975d1
enum request_type {
Packit Service 3975d1
	REGISTER_EVENT = 0,
Packit Service 3975d1
	UNREGISTER_EVENT
Packit Service 3975d1
};
Packit Service 3975d1
Packit Service 3975d1
struct event_request {
Packit Service 3975d1
	enum request_type type;
Packit Service 3975d1
	fpga_event_type event;
Packit Service 3975d1
	uint64_t object_id;
Packit Service 3975d1
};
Packit Service 3975d1
Packit Service 3975d1
typedef struct _api_client_event_registry {
Packit Service 3975d1
	int conn_socket;
Packit Service 3975d1
	int fd;
Packit Service 3975d1
	uint64_t data;
Packit Service 3975d1
	fpga_event_type event;
Packit Service 3975d1
	uint64_t object_id;
Packit Service 3975d1
	struct _api_client_event_registry *next;
Packit Service 3975d1
} api_client_event_registry;
Packit Service 3975d1
Packit Service 3975d1
// 0 on success
Packit Service 3975d1
int opae_api_register_event(int conn_socket,
Packit Service 3975d1
			    int fd,
Packit Service 3975d1
			    fpga_event_type e,
Packit Service 3975d1
			    uint64_t object_id);
Packit Service 3975d1
Packit Service 3975d1
// 0 on success
Packit Service 3975d1
int opae_api_unregister_event(int conn_socket,
Packit Service 3975d1
			      fpga_event_type e,
Packit Service 3975d1
			      uint64_t object_id);
Packit Service 3975d1
Packit Service 3975d1
void opae_api_unregister_all_events_for(int conn_socket);
Packit Service 3975d1
Packit Service 3975d1
void opae_api_unregister_all_events(void);
Packit Service 3975d1
Packit Service 3975d1
void opae_api_for_each_registered_event(void (*cb)(api_client_event_registry *r,
Packit Service 3975d1
						   void *context),
Packit Service 3975d1
					void *context);
Packit Service 3975d1
Packit Service 3975d1
void opae_api_send_EVENT_ERROR(fpgad_monitored_device *d);
Packit Service 3975d1
Packit Service 3975d1
void opae_api_send_EVENT_POWER_THERMAL(fpgad_monitored_device *d);
Packit Service 3975d1
Packit Service 3975d1
#endif /* __FPGAD_API_OPAE_EVENTS_API_H__ */