USRP Hardware Driver and USRP Manual
Version: 003.008.002-release
UHD and USRP Manual
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
status.h
Go to the documentation of this file.
1
//
2
// Copyright 2013-2014 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
//
17
18
19
#ifndef INCLUDED_UHD_TRANSPORT_NIRIO_STATUS_H
20
#define INCLUDED_UHD_TRANSPORT_NIRIO_STATUS_H
21
22
#include <stdio.h>
23
#include <stddef.h>
24
#include <stdint.h>
25
#include <string>
26
#include <
uhd/config.hpp
>
27
#include <
uhd/exception.hpp
>
28
29
#define ENABLE_EXTENDED_ERROR_INFO false
30
31
typedef
int32_t
nirio_status
;
32
33
namespace
uhd {
namespace
niusrprio {
34
struct
nirio_err_info
{
35
nirio_err_info
(
nirio_status
arg_code,
const
char
* arg_msg):
code
(arg_code),
msg
(arg_msg) {}
36
37
nirio_status
code
;
38
const
char
*
msg
;
39
40
static
const
nirio_err_info
NIRIO_ERROR_TABLE
[];
41
static
const
size_t
NIRIO_ERROR_TABLE_SIZE
;
42
};
43
44
UHD_API
const
std::string
lookup_err_msg
(
nirio_status
code);
45
46
UHD_API
void
nirio_status_to_exception
(
const
nirio_status
&
status
,
const
std::string& message);
47
}}
48
49
#define nirio_status_fatal(status) ((status) < 0)
50
#define nirio_status_not_fatal(status) ((status) >= 0)
51
52
#define nirio_status_chain(func, status) \
53
if (nirio_status_not_fatal(status)) { \
54
status = (func); \
55
if (ENABLE_EXTENDED_ERROR_INFO && nirio_status_fatal(status)) { \
56
fprintf(stderr,"ERROR: The following function call returned status code %d\n%s\n%s:%d\n",status,#func,__FILE__,__LINE__); \
57
} \
58
} \
59
60
61
#define NIRIO_ERR_INFO(CONST_NAME, ERR_CODE, ERR_MSG) \
62
static const nirio_status CONST_NAME = ERR_CODE;
63
#include "
nirio_err_template.h
"
64
#undef NIRIO_ERR_INFO
65
66
#endif
/* INCLUDED_UHD_TRANSPORT_NIRIO_STATUS_H */
include
uhd
transport
nirio
status.h
Generated on Sun May 4 2014 12:19:51 for USRP Hardware Driver and USRP Manual by
1.8.3.1