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
e694cb4a
Commit
e694cb4a
authored
Dec 06, 2014
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hal/sm_io/modules/acq/*: separate exported function descriptors
Step number 1 on fixing github issue #48
parent
5c5fa829
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
35 deletions
+87
-35
acq.mk
hal/sm_io/modules/acq/acq.mk
+1
-0
sm_io_acq_exp.c
hal/sm_io/modules/acq/sm_io_acq_exp.c
+22
-35
sm_io_acq_exports.c
hal/sm_io/modules/acq/sm_io_acq_exports.c
+46
-0
sm_io_acq_exports.h
hal/sm_io/modules/acq/sm_io_acq_exports.h
+18
-0
No files found.
hal/sm_io/modules/acq/acq.mk
View file @
e694cb4a
...
...
@@ -2,6 +2,7 @@ sm_io_acq_DIR = hal/sm_io/modules/acq
sm_io_acq_OBJS = $(sm_io_acq_DIR)/sm_io_acq_core.o \
$(sm_io_acq_DIR)/sm_io_acq_exp.o \
$(sm_io_acq_DIR)/sm_io_acq_exports.o \
$(sm_io_acq_DIR)/ddr3_map.o
sm_io_acq_INCLUDE_DIRS = $(sm_io_acq_DIR)
hal/sm_io/modules/acq/sm_io_acq_exp.c
View file @
e694cb4a
...
...
@@ -17,6 +17,8 @@
#include "board.h"
#include "rw_param.h"
#include "wb_acq_core_regs.h"
#include "sm_io_acq_exports.h"
#include "hal_stddef.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
...
...
@@ -147,19 +149,6 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
return
-
ACQ_OK
;
}
disp_op_t
acq_data_acquire_exp
=
{
.
name
=
ACQ_NAME_DATA_ACQUIRE
,
.
opcode
=
ACQ_OPCODE_DATA_ACQUIRE
,
.
func_fp
=
_acq_data_acquire
,
.
retval
=
DISP_ARG_END
,
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
static
int
_acq_check_data_acquire
(
void
*
owner
,
void
*
args
,
void
*
ret
)
{
(
void
)
ret
;
...
...
@@ -188,17 +177,6 @@ static int _acq_check_data_acquire (void *owner, void *args, void *ret)
return
-
ACQ_OK
;
}
disp_op_t
acq_check_data_acquire_exp
=
{
.
name
=
ACQ_NAME_CHECK_DATA_ACQUIRE
,
.
opcode
=
ACQ_OPCODE_CHECK_DATA_ACQUIRE
,
.
func_fp
=
_acq_check_data_acquire
,
.
retval
=
DISP_ARG_END
,
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_END
}
};
static
int
_acq_get_data_block
(
void
*
owner
,
void
*
args
,
void
*
ret
)
{
assert
(
owner
);
...
...
@@ -298,19 +276,15 @@ static int _acq_get_data_block (void *owner, void *args, void *ret)
return
sizeof
(
*
data_block
);
}
disp_op_t
acq_get_data_block_exp
=
{
.
name
=
ACQ_NAME_GET_DATA_BLOCK
,
.
opcode
=
ACQ_OPCODE_GET_DATA_BLOCK
,
.
func_fp
=
_acq_get_data_block
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_STRUCT
,
smio_acq_data_block_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
/* Exported function pointers */
const
disp_table_func_fp
acq_exp_fp
[]
=
{
_acq_data_acquire
,
_acq_check_data_acquire
,
_acq_get_data_block
,
NULL
};
/* Exported function description */
const
disp_op_t
*
acq_exp_ops
[]
=
{
&
acq_data_acquire_exp
,
&
acq_check_data_acquire_exp
,
...
...
@@ -395,6 +369,18 @@ smio_err_e acq_init (smio_t * self)
/* Set SMIO ops pointers */
self
->
ops
=
&
acq_ops
;
self
->
thsafe_client_ops
=
&
smio_thsafe_client_zmq_ops
;
/* Fill the disp_op_t description structure with the callbacks. */
/* disp_op_t structure is const and all of the functions performing on it
* obviously receives a const argument, but here (and only on the SMIO
* initialization) we need to make an exception if we want to keep the
* functions' description and the function pointers separate */
err
=
smio_init_exp_ops
(
self
,
(
disp_op_t
**
)
acq_exp_ops
,
acq_exp_fp
,
ARRAY_SIZE
(
acq_exp_ops
));
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not fill SMIO "
"function descriptors with the callbacks"
,
err_fill_desc
);
self
->
exp_ops
=
acq_exp_ops
;
/* Initialize specific structure */
...
...
@@ -404,6 +390,7 @@ smio_err_e acq_init (smio_t * self)
return
err
;
err_smio_handler_alloc:
err_fill_desc:
free
(
self
->
name
);
err_name_alloc:
return
err
;
...
...
hal/sm_io/modules/acq/sm_io_acq_exports.c
0 → 100644
View file @
e694cb4a
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU LGPL, version 3 or any later version.
*/
#include "sm_io_acq_exports.h"
#include "sm_io_acq_codes.h"
/* Description SMIO ACQ functions */
disp_op_t
acq_data_acquire_exp
=
{
.
name
=
ACQ_NAME_DATA_ACQUIRE
,
.
opcode
=
ACQ_OPCODE_DATA_ACQUIRE
,
.
retval
=
DISP_ARG_END
,
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
disp_op_t
acq_check_data_acquire_exp
=
{
.
name
=
ACQ_NAME_CHECK_DATA_ACQUIRE
,
.
opcode
=
ACQ_OPCODE_CHECK_DATA_ACQUIRE
,
.
retval
=
DISP_ARG_END
,
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_END
}
};
disp_op_t
acq_get_data_block_exp
=
{
.
name
=
ACQ_NAME_GET_DATA_BLOCK
,
.
opcode
=
ACQ_OPCODE_GET_DATA_BLOCK
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_STRUCT
,
smio_acq_data_block_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
hal/sm_io/modules/acq/sm_io_acq_exports.h
0 → 100644
View file @
e694cb4a
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU LGPL, version 3 or any later version.
*/
#ifndef _SM_IO_ACQ_EXPORTS_H_
#define _SM_IO_ACQ_EXPORTS_H_
#include "dispatch_table.h"
extern
disp_op_t
acq_data_acquire_exp
;
extern
disp_op_t
acq_check_data_acquire_exp
;
extern
disp_op_t
acq_get_data_block_exp
;
#endif
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