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
329aa2e7
Commit
329aa2e7
authored
Apr 29, 2014
by
Lucas Russo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'smio-devel'
parents
c9ca6619
c6efdcff
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
10 deletions
+120
-10
fmc130m_4ch.mk
hal/sm_io/modules/fmc130m_4ch/fmc130m_4ch.mk
+2
-1
sm_io_fmc130m_4ch_core.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.c
+67
-0
sm_io_fmc130m_4ch_core.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.h
+28
-0
sm_io_fmc130m_4ch_exp.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
+17
-8
sm_io_fmc130m_4ch_exp.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.h
+1
-0
sm_io_mod_dispatch.c
hal/sm_io/modules/sm_io_mod_dispatch.c
+1
-1
sm_io.h
hal/sm_io/sm_io.h
+3
-0
sm_io_bootstrap.c
hal/sm_io/sm_io_bootstrap.c
+1
-0
No files found.
hal/sm_io/modules/fmc130m_4ch/fmc130m_4ch.mk
View file @
329aa2e7
sm_io_fmc130m_4ch_DIR = hal/sm_io/modules/fmc130m_4ch
sm_io_fmc130m_4ch_DIR = hal/sm_io/modules/fmc130m_4ch
sm_io_fmc130m_4ch_OBJS = $(sm_io_fmc130m_4ch_DIR)/sm_io_fmc130m_4ch.o
sm_io_fmc130m_4ch_OBJS = $(sm_io_fmc130m_4ch_DIR)/sm_io_fmc130m_4ch_core.o \
$(sm_io_fmc130m_4ch_DIR)/sm_io_fmc130m_4ch_exp.o
sm_io_fmc130m_4ch_INCLUDE_DIRS = $(sm_io_fmc130m_4ch_DIR)
sm_io_fmc130m_4ch_INCLUDE_DIRS = $(sm_io_fmc130m_4ch_DIR)
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.c
0 → 100644
View file @
329aa2e7
/*
* 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 <stdlib.h>
#include <assert.h>
#include <czmq.h>
#include "sm_io_fmc130m_4ch_core.h"
#include "sm_io_err.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) \
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io_fmc130m_4ch_core]", \
err_str, err_goto_label)
#ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC
#endif
#define ASSERT_ALLOC(ptr, err_goto_label) \
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io_fmc130m_4ch_core]", \
smio_err_str(SMIO_ERR_ALLOC), \
err_goto_label)
#ifdef CHECK_ERR
#undef CHECK_ERR
#endif
#define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, SM_IO, "[sm_io_fmc130m_4ch_core]", \
smio_err_str (err_type))
/* Creates a new instance of Device Information */
smio_fmc130m_4ch_t
*
smio_fmc130m_4ch_new
(
uint32_t
dummy
)
{
smio_fmc130m_4ch_t
*
self
=
(
smio_fmc130m_4ch_t
*
)
zmalloc
(
sizeof
*
self
);
ASSERT_ALLOC
(
self
,
err_self_alloc
);
self
->
dummy
=
dummy
;
return
self
;
err_self_alloc:
return
NULL
;
}
/* Destroy an instance of the Device Information */
smio_err_e
smio_fmc130m_4ch_destroy
(
smio_fmc130m_4ch_t
**
self_p
)
{
assert
(
self_p
);
if
(
*
self_p
)
{
smio_fmc130m_4ch_t
*
self
=
*
self_p
;
free
(
self
);
*
self_p
=
NULL
;
}
return
SMIO_SUCCESS
;
}
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.h
0 → 100644
View file @
329aa2e7
/*
* 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_FMC130M_4CH_CORE_H_
#define _SM_IO_FMC130M_4CH_CORE_H_
#include <inttypes.h>
#include "sm_io_err.h"
struct
_smio_fmc130m_4ch_t
{
uint32_t
dummy
;
/* Just a dummy value to illustrate the idea */
};
/* Opaque class structure */
typedef
struct
_smio_fmc130m_4ch_t
smio_fmc130m_4ch_t
;
/***************** Our methods *****************/
/* Creates a new instance of the smio realizationn */
smio_fmc130m_4ch_t
*
smio_fmc130m_4ch_new
(
uint32_t
dummy
);
/* Destroys the smio realizationn */
smio_err_e
smio_fmc130m_4ch_destroy
(
smio_fmc130m_4ch_t
**
self_p
);
#endif
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch.c
→
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch
_exp
.c
View file @
329aa2e7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include "sm_io_fmc130m_4ch.h"
#include "sm_io_fmc130m_4ch
_exp
.h"
#include "sm_io.h"
#include "sm_io.h"
#include "dev_io.h"
#include "dev_io.h"
#include "hal_assert.h"
#include "hal_assert.h"
...
@@ -17,14 +17,14 @@
...
@@ -17,14 +17,14 @@
#undef ASSERT_TEST
#undef ASSERT_TEST
#endif
#endif
#define ASSERT_TEST(test_boolean, err_str, err_goto_label) \
#define ASSERT_TEST(test_boolean, err_str, err_goto_label) \
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io:fmc130m_4ch
]",
\
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io:fmc130m_4ch
_exp]",
\
err_str, err_goto_label)
err_str, err_goto_label)
#ifdef ASSERT_ALLOC
#ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC
#undef ASSERT_ALLOC
#endif
#endif
#define ASSERT_ALLOC(ptr, err_goto_label) \
#define ASSERT_ALLOC(ptr, err_goto_label) \
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io:fmc130m_4ch
]",
\
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io:fmc130m_4ch
_exp]",
\
smio_err_str(SMIO_ERR_ALLOC), \
smio_err_str(SMIO_ERR_ALLOC), \
err_goto_label)
err_goto_label)
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#undef CHECK_ERR
#undef CHECK_ERR
#endif
#endif
#define CHECK_ERR(err, err_type) \
#define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc130m_4ch
]",
\
CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc130m_4ch
_exp]",
\
smio_err_str (err_type))
smio_err_str (err_type))
/************************************************************/
/************************************************************/
...
@@ -63,11 +63,11 @@ static void *_fmc130m_4ch_leds (void *owner, void *args)
...
@@ -63,11 +63,11 @@ static void *_fmc130m_4ch_leds (void *owner, void *args)
exp_msg_zmq_t
*
exp_msg
=
(
exp_msg_zmq_t
*
)
args
;
exp_msg_zmq_t
*
exp_msg
=
(
exp_msg_zmq_t
*
)
args
;
assert
(
zmsg_size
(
*
exp_msg
->
msg
)
>
0
);
assert
(
zmsg_size
(
*
exp_msg
->
msg
)
>
0
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch] Calling _fmc130m_4ch_leds
\n
"
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch
_exp
] Calling _fmc130m_4ch_leds
\n
"
);
uint32_t
leds
=
*
(
uint32_t
*
)
zframe_data
(
zmsg_pop
(
*
exp_msg
->
msg
));
uint32_t
leds
=
*
(
uint32_t
*
)
zframe_data
(
zmsg_pop
(
*
exp_msg
->
msg
));
smio_thsafe_client_write_32
(
self
,
BAR4_ADDR
|
FMC1_ADDR
|
FMC_MONITOR_REG
,
smio_thsafe_client_write_32
(
self
,
BAR4_ADDR
|
FMC1_ADDR
|
FMC_MONITOR_REG
,
&
leds
);
&
leds
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch_
boot
] Led write: 0x%08x
\n
"
,
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch_
exp
] Led write: 0x%08x
\n
"
,
leds
);
leds
);
/* Don't send any response, for now... */
/* Don't send any response, for now... */
...
@@ -151,7 +151,7 @@ const smio_ops_t fmc130m_4ch_ops = {
...
@@ -151,7 +151,7 @@ const smio_ops_t fmc130m_4ch_ops = {
smio_err_e
fmc130m_4ch_init
(
smio_t
*
self
)
smio_err_e
fmc130m_4ch_init
(
smio_t
*
self
)
{
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch] Initializing fmc130m_4ch
\n
"
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch
_exp
] Initializing fmc130m_4ch
\n
"
);
smio_err_e
err
=
SMIO_ERR_ALLOC
;
smio_err_e
err
=
SMIO_ERR_ALLOC
;
...
@@ -163,8 +163,16 @@ smio_err_e fmc130m_4ch_init (smio_t * self)
...
@@ -163,8 +163,16 @@ smio_err_e fmc130m_4ch_init (smio_t * self)
self
->
ops
=
&
fmc130m_4ch_ops
;
self
->
ops
=
&
fmc130m_4ch_ops
;
self
->
thsafe_client_ops
=
&
smio_thsafe_client_zmq_ops
;
self
->
thsafe_client_ops
=
&
smio_thsafe_client_zmq_ops
;
self
->
exp_ops
=
fmc130m_exp_ops
;
self
->
exp_ops
=
fmc130m_exp_ops
;
/* Initialize specific structure */
self
->
smio_handler
=
smio_fmc130m_4ch_new
(
0
);
ASSERT_ALLOC
(
self
->
smio_handler
,
err_smio_handler_alloc
);
err
=
SMIO_SUCCESS
;
err
=
SMIO_SUCCESS
;
return
err
;
err_smio_handler_alloc:
free
(
self
->
name
);
err_name_alloc:
err_name_alloc:
return
err
;
return
err
;
}
}
...
@@ -172,8 +180,9 @@ err_name_alloc:
...
@@ -172,8 +180,9 @@ err_name_alloc:
/* Destroy sm_io instance of fmc130m_4ch */
/* Destroy sm_io instance of fmc130m_4ch */
smio_err_e
fmc130m_4ch_shutdown
(
smio_t
*
self
)
smio_err_e
fmc130m_4ch_shutdown
(
smio_t
*
self
)
{
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch] Shutting down fmc130m_4ch
\n
"
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc130m_4ch
_exp
] Shutting down fmc130m_4ch
\n
"
);
smio_fmc130m_4ch_destroy
(
self
->
smio_handler
);
self
->
exp_ops
=
NULL
;
self
->
exp_ops
=
NULL
;
self
->
thsafe_client_ops
=
NULL
;
self
->
thsafe_client_ops
=
NULL
;
self
->
ops
=
NULL
;
self
->
ops
=
NULL
;
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch.h
→
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch
_exp
.h
View file @
329aa2e7
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include "sm_io_bootstrap.h"
#include "sm_io_bootstrap.h"
#include "smio_thsafe_zmq_client.h"
#include "smio_thsafe_zmq_client.h"
#include "exp_ops_codes.h"
#include "exp_ops_codes.h"
#include "sm_io_fmc130m_4ch_core.h"
/* Known modules IDs (from SDB records defined in FPGA) */
/* Known modules IDs (from SDB records defined in FPGA) */
#define FMC130M_4CH_SDB_DEVID 0x7085ef15
#define FMC130M_4CH_SDB_DEVID 0x7085ef15
...
...
hal/sm_io/modules/sm_io_mod_dispatch.c
View file @
329aa2e7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include "sm_io_mod_dispatch.h"
#include "sm_io_mod_dispatch.h"
/* Include all available module we can handle */
/* Include all available module we can handle */
#include "sm_io_fmc130m_4ch.h"
#include "sm_io_fmc130m_4ch
_exp
.h"
/* Table of all known modules we can handle */
/* Table of all known modules we can handle */
const
smio_mod_dispatch_t
smio_mod_dispatch
[
MOD_DISPATCH_END
]
=
{
const
smio_mod_dispatch_t
smio_mod_dispatch
[
MOD_DISPATCH_END
]
=
{
...
...
hal/sm_io/sm_io.h
View file @
329aa2e7
...
@@ -37,6 +37,9 @@ struct _smio_t {
...
@@ -37,6 +37,9 @@ struct _smio_t {
/* int verbose; */
/* Print activity to stdout */
/* int verbose; */
/* Print activity to stdout */
mdp_worker_t
*
worker
;
/* zeroMQ Majordomo worker */
mdp_worker_t
*
worker
;
/* zeroMQ Majordomo worker */
struct
_devio_t
*
parent
;
/* Pointer back to parent dev_io */
struct
_devio_t
*
parent
;
/* Pointer back to parent dev_io */
void
*
smio_handler
;
/* Generic pointer to a device handler. This
must be cast to a specific type by the
devices functions */
zctx_t
*
ctx
;
/* Our context */
zctx_t
*
ctx
;
/* Our context */
void
*
pipe
;
/* Pipe back to parent to exchange messages */
void
*
pipe
;
/* Pipe back to parent to exchange messages */
...
...
hal/sm_io/sm_io_bootstrap.c
View file @
329aa2e7
...
@@ -165,6 +165,7 @@ static struct _smio_t *_smio_new (struct _devio_t *parent, struct _zctx_t *ctx,
...
@@ -165,6 +165,7 @@ static struct _smio_t *_smio_new (struct _devio_t *parent, struct _zctx_t *ctx,
self
->
exp_ops_dtable
=
disp_table_new
();
self
->
exp_ops_dtable
=
disp_table_new
();
ASSERT_ALLOC
(
self
->
exp_ops_dtable
,
err_exp_ops_dtable_alloc
);
ASSERT_ALLOC
(
self
->
exp_ops_dtable
,
err_exp_ops_dtable_alloc
);
self
->
smio_handler
=
NULL
;
/* This is set by the device functions */
self
->
ctx
=
ctx
;
self
->
ctx
=
ctx
;
self
->
pipe
=
pipe
;
self
->
pipe
=
pipe
;
...
...
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