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
662deb67
Commit
662deb67
authored
Feb 20, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hal/dev_io/dev_io_core.c: WIP on github issue #79
parent
aa7501cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
22 deletions
+10
-22
dev_io_core.c
hal/dev_io/dev_io_core.c
+10
-22
No files found.
hal/dev_io/dev_io_core.c
View file @
662deb67
...
@@ -289,12 +289,15 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
...
@@ -289,12 +289,15 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
/* Stringify ID */
/* Stringify ID */
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Stringify hash ID
\n
"
);
"[dev_io_core:register_sm] Stringify hash ID
\n
"
);
char
*
key
=
halutils_stringify_hex_key
(
smio_mod_dispatch
[
i
].
id
);
char
*
key
=
halutils_concat_strings
(
smio_mod_dispatch
[
th_args
->
smio_id
].
name
,
inst_id
,
''
);
ASSERT_ALLOC
(
key
,
err_key_alloc
);
ASSERT_ALLOC
(
key
,
err_key_alloc
);
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Inserting hash with key: %s
\n
"
,
key
);
"[dev_io_core:register_sm] Inserting hash with key: %s
\n
"
,
key
);
zhash_insert
(
self
->
sm_io_h
,
key
,
self
->
pipes
[
pipe_idx
]);
int
zerr
=
zhash_insert
(
self
->
sm_io_h
,
key
,
self
->
pipes
[
pipe_idx
]);
ASSERT_TEST
(
zerr
==
0
,
"Could not insert PIPE hash key. Duplicated value?"
,
err_pipe_hash_insert
);
/* Configure default values of the recently created SMIO using the
/* Configure default values of the recently created SMIO using the
* bootstrap registered function config_defaults () */
* bootstrap registered function config_defaults () */
...
@@ -335,6 +338,8 @@ err_spawn_config_thread:
...
@@ -335,6 +338,8 @@ err_spawn_config_thread:
err_th_config_args_alloc:
err_th_config_args_alloc:
free
(
smio_service
);
free
(
smio_service
);
err_smio_service_alloc:
err_smio_service_alloc:
zhash_delete
(
self
->
sm_io_h
,
key
);
err_pipe_hash_insert:
free
(
key
);
free
(
key
);
err_key_alloc:
err_key_alloc:
/* This is safe to call more than once */
/* This is safe to call more than once */
...
@@ -519,16 +524,6 @@ err_hand_req:
...
@@ -519,16 +524,6 @@ err_hand_req:
static
void
_devio_destroy_smio_all
(
devio_t
*
self
)
static
void
_devio_destroy_smio_all
(
devio_t
*
self
)
{
{
#if 0
unsigned i;
for (i = 0; i < self->nnodes; ++i) {
/* This cannot fail at this point... but it can */
zmsg_t *msg = zmsg_new ();
/* An empty message means to selfdestruct */
zmsg_pushstr (msg, "");
zmsg_send (&msg, self->pipes [i]);
}
#endif
/* Get all hash keys */
/* Get all hash keys */
zlist_t
*
hash_keys
=
zhash_keys
(
self
->
sm_io_h
);
zlist_t
*
hash_keys
=
zhash_keys
(
self
->
sm_io_h
);
ASSERT_ALLOC
(
hash_keys
,
err_hash_keys_alloc
);
ASSERT_ALLOC
(
hash_keys
,
err_hash_keys_alloc
);
...
@@ -536,10 +531,7 @@ static void _devio_destroy_smio_all (devio_t *self)
...
@@ -536,10 +531,7 @@ static void _devio_destroy_smio_all (devio_t *self)
/* Iterate over all keys removing each of one */
/* Iterate over all keys removing each of one */
for
(;
hash_item
!=
NULL
;
hash_item
=
zlist_next
(
hash_keys
))
{
for
(;
hash_item
!=
NULL
;
hash_item
=
zlist_next
(
hash_keys
))
{
/* FIXME: Usage of stroul fucntion for reconverting the string
_devio_destroy_smio
(
self
,
hash_item
);
* into a uint32_t */
_devio_destroy_smio
(
self
,
(
uint32_t
)
strtoul
(
hash_item
,
(
char
**
)
NULL
,
16
));
}
}
zlist_destroy
(
&
hash_keys
);
zlist_destroy
(
&
hash_keys
);
...
@@ -548,16 +540,12 @@ err_hash_keys_alloc:
...
@@ -548,16 +540,12 @@ err_hash_keys_alloc:
return
;
return
;
}
}
static
void
_devio_destroy_smio
(
devio_t
*
self
,
uint32_t
smio_id
)
static
void
_devio_destroy_smio
(
devio_t
*
self
,
const
char
*
smio_key
)
{
{
assert
(
self
);
assert
(
self
);
/* Stringify ID */
char
*
key_c
=
halutils_stringify_hex_key
(
smio_id
);
ASSERT_ALLOC
(
key_c
,
err_key_alloc
);
/* Lookup SMIO reference in hash table */
/* Lookup SMIO reference in hash table */
void
*
pipe
=
zhash_lookup
(
self
->
sm_io_h
,
key_c
);
void
*
pipe
=
zhash_lookup
(
self
->
sm_io_h
,
smio_key
);
ASSERT_TEST
(
pipe
!=
NULL
,
"Could not find SMIO registered with this ID"
,
ASSERT_TEST
(
pipe
!=
NULL
,
"Could not find SMIO registered with this ID"
,
err_hash_lookup
);
err_hash_lookup
);
...
...
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