Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Beam Positoning Monitor - Software
Commits
b877a247
Commit
b877a247
authored
Jan 12, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hal/dev_io/utils/*: add new utilities functions
parent
60880352
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
0 deletions
+89
-0
dev_io_utils.c
hal/dev_io/utils/dev_io_utils.c
+54
-0
dev_io_utils.h
hal/dev_io/utils/dev_io_utils.h
+29
-0
utils.mk
hal/dev_io/utils/utils.mk
+6
-0
No files found.
hal/dev_io/utils/dev_io_utils.c
0 → 100644
View file @
b877a247
/*
* Copyright (C) 2015 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU LGPL, version 3 or any later version.
*/
#include "dev_io_utils.h"
#include "ll_io_utils.h"
#include "hal_assert.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
#undef ASSERT_TEST
#endif
#define ASSERT_TEST(test_boolean, err_str, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_TEST(test_boolean, DEV_IO, "[dev_io:utils]", \
err_str, err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC
#endif
#define ASSERT_ALLOC(ptr, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_ALLOC(ptr, DEV_IO, "[dev_io:utils]", \
devio_err_str(DEVIO_ERR_ALLOC), \
err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef CHECK_ERR
#undef CHECK_ERR
#endif
#define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, DEV_IO, "[dev_io:utils]", \
devio_err_str (err_type))
/************** Utility functions ****************/
const
llio_types_t
devio_types_map
[]
=
{
{.
name
=
BE_DEVIO_STR
,
.
type
=
BE_DEVIO
},
{.
name
=
FE_DEVIO_STR
,
.
type
=
FE_DEVIO
},
{.
name
=
INVALID_DEVIO_STR
,
.
type
=
INVALID_DEVIO
},
{.
name
=
LLIO_TYPE_NAME_END
,
.
type
=
LLIO_TYPE_END
}
/* End marker */
};
devio_type_e
devio_str_to_type
(
const
char
*
type_str
)
{
devio_type_e
ret
=
llio_str_to_gen_type
(
type_str
,
devio_types_map
);
return
(
ret
==
LLIO_TYPE_END
)
?
INVALID_DEVIO
:
ret
;
}
char
*
devio_type_to_str
(
devio_type_e
type
)
{
return
llio_gen_type_to_str
(
type
,
devio_types_map
);
}
hal/dev_io/utils/dev_io_utils.h
0 → 100644
View file @
b877a247
/*
* Copyright (C) 2015 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU LGPL, version 3 or any later version.
*/
#ifndef _DEV_IO_UTILS_H_
#define _DEV_IO_UTILS_H_
#include <inttypes.h>
/* Device type */
enum
_devio_type_e
{
BE_DEVIO
=
0
,
/* Back-End DEVIO */
FE_DEVIO
,
/* Front-End DEVIO */
INVALID_DEVIO
};
typedef
enum
_devio_type_e
devio_type_e
;
#define BE_DEVIO_STR "be"
#define FE_DEVIO_STR "fe"
#define INVALID_DEVIO_STR "invalid"
devio_type_e
devio_str_to_type
(
const
char
*
type_str
);
char
*
devio_type_to_str
(
devio_type_e
type
);
#endif
hal/dev_io/utils/utils.mk
0 → 100644
View file @
b877a247
dev_io_utils_DIR = hal/dev_io/utils
dev_io_utils_OBJS = $(dev_io_utils_DIR)/dev_io_utils.o
dev_io_utils_INCLUDE_DIRS = $(dev_io_utils_DIR)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment