File hello_events.c¶
FileList > docs > sw > samples > hello_events > hello_events.c
Go to the source code of this file.
A code sample of using OPAE event API. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <poll.h>
#include <errno.h>
#include <sys/stat.h>
#include <pthread.h>
#include <opae/fpga.h>
#include <argsfilter.h>
#include "mock/opae_std.h"
Classes¶
Type | Name |
---|---|
struct | ras_inject_error |
Public Functions¶
Type | Name |
---|---|
void * | error_thread (void * arg) |
fpga_result | find_fpga (fpga_properties device_filter, fpga_token * fpga, uint32_t * num_matches) |
void | help (void) |
fpga_result | inject_ras_fatal_error (fpga_token fme_token, uint8_t err) |
int | main (int argc, char * argv) |
fpga_result | parse_args (int argc, char * argv) |
void | print_err (const char * s, fpga_result res) |
int | usleep (unsigned) |
Macros¶
Type | Name |
---|---|
define | FME_SYSFS_INJECT_ERROR "errors/inject_errors" |
define | GETOPT_STRING "hv" |
define | ON_ERR_GOTO (res, label, desc) |
Detailed Description¶
This sample starts two processes. One process injects an artificial fatal error to sysfs; while the other tries to asynchronously capture and handle the event. This sample code exercises all major functions of the event API, including creating and destroying event handles, register and unregister events, polling on event file descriptor, and getting the OS object associated with an event. For a full discussion of OPAE event API, refer to event.h.
Public Functions Documentation¶
function error_thread¶
function find_fpga¶
function help¶
function inject_ras_fatal_error¶
function main¶
function parse_args¶
function print_err¶
function usleep¶
Macro Definition Documentation¶
define FME_SYSFS_INJECT_ERROR¶
define GETOPT_STRING¶
define ON_ERR_GOTO¶
#define ON_ERR_GOTO (
res,
label,
desc
) do { \
if ((res) != FPGA_OK ) { \ print_err ((desc), (res)); \
goto label; \
} \
} while (0)
The documentation for this class was generated from the following file docs/sw/samples/hello_events/hello_events.c