-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core, make: remove cproto dependency
ubx_proto.h header is split into several smaller ones which shall be maintained by hand in the future. If convenient, cproto can still be used a a dev tool, but it's not a build dependency anymore. By this, the cproto error about the missing expected symbol in rtlog is removed too. Signed-off-by: Markus Klotzbuecher <mk@mkio.de>
- Loading branch information
Showing
13 changed files
with
232 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ addons: | |
- libtool | ||
- pkg-config | ||
- gcc | ||
- cproto | ||
- g++ | ||
- git-core | ||
- luajit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* prototypes for accessors */ | ||
|
||
#ifndef _ACCESSORS_H | ||
#define _ACCESSORS_H | ||
|
||
int write_char_array(const ubx_port_t *p, const char *val, const int len); | ||
int write_char(const ubx_port_t *p, const char *val); | ||
long read_char_array(const ubx_port_t *p, char *val, const int len); | ||
long read_char(const ubx_port_t *p, char *val); | ||
long cfg_getptr_char(const ubx_block_t *b, const char *cfg_name, const char **valptr); | ||
int write_int_array(const ubx_port_t *p, const int *val, const int len); | ||
int write_int(const ubx_port_t *p, const int *val); | ||
long read_int_array(const ubx_port_t *p, int *val, const int len); | ||
long read_int(const ubx_port_t *p, int *val); | ||
long cfg_getptr_int(const ubx_block_t *b, const char *cfg_name, const int **valptr); | ||
int write_uint_array(const ubx_port_t *p, const unsigned int *val, const int len); | ||
int write_uint(const ubx_port_t *p, const unsigned int *val); | ||
long read_uint_array(const ubx_port_t *p, unsigned int *val, const int len); | ||
long read_uint(const ubx_port_t *p, unsigned int *val); | ||
long cfg_getptr_uint(const ubx_block_t *b, const char *cfg_name, const unsigned int **valptr); | ||
int write_long_array(const ubx_port_t *p, const long *val, const int len); | ||
int write_long(const ubx_port_t *p, const long *val); | ||
long read_long_array(const ubx_port_t *p, long *val, const int len); | ||
long read_long(const ubx_port_t *p, long *val); | ||
long cfg_getptr_long(const ubx_block_t *b, const char *cfg_name, const long **valptr); | ||
int write_ulong_array(const ubx_port_t *p, const unsigned long *val, const int len); | ||
int write_ulong(const ubx_port_t *p, const unsigned long *val); | ||
long read_ulong_array(const ubx_port_t *p, unsigned long *val, const int len); | ||
long read_ulong(const ubx_port_t *p, unsigned long *val); | ||
long cfg_getptr_ulong(const ubx_block_t *b, const char *cfg_name, const unsigned long **valptr); | ||
int write_uint8_array(const ubx_port_t *p, const uint8_t *val, const int len); | ||
int write_uint8(const ubx_port_t *p, const uint8_t *val); | ||
long read_uint8_array(const ubx_port_t *p, uint8_t *val, const int len); | ||
long read_uint8(const ubx_port_t *p, uint8_t *val); | ||
long cfg_getptr_uint8(const ubx_block_t *b, const char *cfg_name, const uint8_t **valptr); | ||
int write_uint16_array(const ubx_port_t *p, const uint16_t *val, const int len); | ||
int write_uint16(const ubx_port_t *p, const uint16_t *val); | ||
long read_uint16_array(const ubx_port_t *p, uint16_t *val, const int len); | ||
long read_uint16(const ubx_port_t *p, uint16_t *val); | ||
long cfg_getptr_uint16(const ubx_block_t *b, const char *cfg_name, const uint16_t **valptr); | ||
int write_uint32_array(const ubx_port_t *p, const uint32_t *val, const int len); | ||
int write_uint32(const ubx_port_t *p, const uint32_t *val); | ||
long read_uint32_array(const ubx_port_t *p, uint32_t *val, const int len); | ||
long read_uint32(const ubx_port_t *p, uint32_t *val); | ||
long cfg_getptr_uint32(const ubx_block_t *b, const char *cfg_name, const uint32_t **valptr); | ||
int write_uint64_array(const ubx_port_t *p, const uint64_t *val, const int len); | ||
int write_uint64(const ubx_port_t *p, const uint64_t *val); | ||
long read_uint64_array(const ubx_port_t *p, uint64_t *val, const int len); | ||
long read_uint64(const ubx_port_t *p, uint64_t *val); | ||
long cfg_getptr_uint64(const ubx_block_t *b, const char *cfg_name, const uint64_t **valptr); | ||
int write_int8_array(const ubx_port_t *p, const int8_t *val, const int len); | ||
int write_int8(const ubx_port_t *p, const int8_t *val); | ||
long read_int8_array(const ubx_port_t *p, int8_t *val, const int len); | ||
long read_int8(const ubx_port_t *p, int8_t *val); | ||
long cfg_getptr_int8(const ubx_block_t *b, const char *cfg_name, const int8_t **valptr); | ||
int write_int16_array(const ubx_port_t *p, const int16_t *val, const int len); | ||
int write_int16(const ubx_port_t *p, const int16_t *val); | ||
long read_int16_array(const ubx_port_t *p, int16_t *val, const int len); | ||
long read_int16(const ubx_port_t *p, int16_t *val); | ||
long cfg_getptr_int16(const ubx_block_t *b, const char *cfg_name, const int16_t **valptr); | ||
int write_int32_array(const ubx_port_t *p, const int32_t *val, const int len); | ||
int write_int32(const ubx_port_t *p, const int32_t *val); | ||
long read_int32_array(const ubx_port_t *p, int32_t *val, const int len); | ||
long read_int32(const ubx_port_t *p, int32_t *val); | ||
long cfg_getptr_int32(const ubx_block_t *b, const char *cfg_name, const int32_t **valptr); | ||
int write_int64_array(const ubx_port_t *p, const int64_t *val, const int len); | ||
int write_int64(const ubx_port_t *p, const int64_t *val); | ||
long read_int64_array(const ubx_port_t *p, int64_t *val, const int len); | ||
long read_int64(const ubx_port_t *p, int64_t *val); | ||
long cfg_getptr_int64(const ubx_block_t *b, const char *cfg_name, const int64_t **valptr); | ||
int write_size_t_array(const ubx_port_t *p, const size_t *val, const int len); | ||
int write_size_t(const ubx_port_t *p, const size_t *val); | ||
long read_size_t_array(const ubx_port_t *p, size_t *val, const int len); | ||
long read_size_t(const ubx_port_t *p, size_t *val); | ||
long cfg_getptr_size_t(const ubx_block_t *b, const char *cfg_name, const size_t **valptr); | ||
int write_float_array(const ubx_port_t *p, const float *val, const int len); | ||
int write_float(const ubx_port_t *p, const float *val); | ||
long read_float_array(const ubx_port_t *p, float *val, const int len); | ||
long read_float(const ubx_port_t *p, float *val); | ||
long cfg_getptr_float(const ubx_block_t *b, const char *cfg_name, const float **valptr); | ||
int write_double_array(const ubx_port_t *p, const double *val, const int len); | ||
int write_double(const ubx_port_t *p, const double *val); | ||
long read_double_array(const ubx_port_t *p, double *val, const int len); | ||
long read_double(const ubx_port_t *p, double *val); | ||
long cfg_getptr_double(const ubx_block_t *b, const char *cfg_name, const double **valptr); | ||
|
||
#endif /* _ACCESSORS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* ubx core API */ | ||
|
||
#include "ubx_types.h" | ||
|
||
#ifndef UBX_CORE_H | ||
#define UBX_CORE_H | ||
|
||
/* node API */ | ||
int ubx_node_init(ubx_node_info_t *ni, const char *name, uint32_t attrs); | ||
void ubx_node_clear(ubx_node_info_t *ni); | ||
void ubx_node_cleanup(ubx_node_info_t *ni); | ||
void ubx_node_rm(ubx_node_info_t *ni); | ||
|
||
int ubx_num_blocks(ubx_node_info_t *ni); | ||
int ubx_num_types(ubx_node_info_t *ni); | ||
int ubx_num_modules(ubx_node_info_t *ni); | ||
|
||
/* blocks */ | ||
ubx_block_t *ubx_block_get(ubx_node_info_t *ni, const char *name); | ||
ubx_block_t *ubx_block_create(ubx_node_info_t *ni, const char *type, const char *name); | ||
void ubx_block_free(ubx_block_t *b); | ||
int ubx_block_rm(ubx_node_info_t *ni, const char *name); | ||
|
||
/* modules and registration */ | ||
int ubx_module_load(ubx_node_info_t *ni, const char *lib); | ||
ubx_module_t *ubx_module_get(ubx_node_info_t *ni, const char *lib); | ||
void ubx_module_unload(ubx_node_info_t *ni, const char *lib); | ||
|
||
/* TODO drop? int ubx_block_check(ubx_node_info_t *ni, ubx_block_t *b); */ | ||
|
||
int ubx_block_register(ubx_node_info_t *ni, struct ubx_proto_block *prot); | ||
int ubx_block_unregister(ubx_node_info_t *ni, const char *name); | ||
|
||
int ubx_type_register(ubx_node_info_t *ni, ubx_type_t *type); | ||
ubx_type_t *ubx_type_unregister(ubx_node_info_t *ni, const char *name); | ||
|
||
/* ubx_type_t */ | ||
ubx_type_t *ubx_type_get(ubx_node_info_t *ni, const char *name); | ||
ubx_type_t *ubx_type_get_by_hash(ubx_node_info_t *ni, const uint8_t *hash); | ||
ubx_type_t *ubx_type_get_by_hashstr(ubx_node_info_t *ni, const char *hashstr); | ||
const char *get_typename(const ubx_data_t *data); | ||
void ubx_type_hashstr(const ubx_type_t *t, char *buf); | ||
|
||
/* ubx_data_t */ | ||
ubx_data_t *__ubx_data_alloc(const ubx_type_t *typ, const long array_len); | ||
ubx_data_t *ubx_data_alloc(ubx_node_info_t *ni, const char *typname, long array_len); | ||
int ubx_data_resize(ubx_data_t *d, long newlen); | ||
void ubx_data_free(ubx_data_t *d); | ||
long data_size(const ubx_data_t *d); | ||
|
||
/* ports (ubx_port_t) */ | ||
int ubx_port_add(ubx_block_t *b, const char *name, const char *doc, const uint32_t attrs, const char *in_type_name, const long in_data_len, const char *out_type_name, const long out_data_len); | ||
int ubx_outport_add(ubx_block_t *b, const char *name, const char *doc, uint32_t attrs, const char *out_type_name, long out_data_len); | ||
int ubx_inport_resize(struct ubx_port *p, long len); | ||
int ubx_outport_resize(struct ubx_port *p, long len); | ||
int ubx_inport_add(ubx_block_t *b, const char *name, const char *doc, uint32_t attrs, const char *in_type_name, long in_data_len); | ||
int ubx_port_rm(ubx_block_t *b, const char *name); | ||
ubx_port_t *ubx_port_get(const ubx_block_t *b, const char *name); | ||
void ubx_port_free(ubx_port_t *p); | ||
|
||
long __port_read(const ubx_port_t *port, ubx_data_t *data); | ||
void __port_write(const ubx_port_t *port, const ubx_data_t *data); | ||
|
||
/* configs (ubx_config_t */ | ||
int ubx_config_assign(ubx_config_t *c, ubx_data_t *d); | ||
ubx_config_t *ubx_config_get(const ubx_block_t *b, const char *name); | ||
ubx_data_t *ubx_config_get_data(const ubx_block_t *b, const char *name); | ||
long ubx_config_get_data_ptr(const ubx_block_t *b, const char *name, void **ptr); | ||
long ubx_config_data_len(const ubx_block_t *b, const char *cfg_name); | ||
int ubx_config_add2(ubx_block_t *b, const char *name, const char *doc, const char *type_name, uint16_t min, uint16_t max, uint32_t attrs); | ||
int ubx_config_add(ubx_block_t *b, const char *name, const char *doc, const char *type_name); | ||
int ubx_config_rm(ubx_block_t *b, const char *name); | ||
|
||
/* block lifecycle hooks */ | ||
int ubx_block_init(ubx_block_t *b); | ||
int ubx_block_start(ubx_block_t *b); | ||
int ubx_block_stop(ubx_block_t *b); | ||
int ubx_block_cleanup(ubx_block_t *b); | ||
int ubx_cblock_step(ubx_block_t *b); | ||
|
||
/* connecting ports */ | ||
int ubx_port_connect_out(ubx_port_t *p, ubx_block_t *iblock); | ||
int ubx_port_connect_in(ubx_port_t *p, ubx_block_t *iblock); | ||
int ubx_ports_connect_uni(ubx_port_t *out_port, ubx_port_t *in_port, ubx_block_t *iblock); | ||
int ubx_port_disconnect_out(ubx_port_t *out_port, ubx_block_t *iblock); | ||
int ubx_port_disconnect_in(ubx_port_t *in_port, ubx_block_t *iblock); | ||
int ubx_ports_disconnect_uni(ubx_port_t *out_port, ubx_port_t *in_port, ubx_block_t *iblock); | ||
|
||
/* rt logging */ | ||
void __ubx_log(const int level, const ubx_node_info_t *ni, const char *src, const char *fmt, ...); | ||
|
||
/* misc helpers */ | ||
const char *block_state_tostr(unsigned int state); | ||
const char *ubx_version(void); | ||
|
||
#endif /* UBX_CORE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* microblx time handling functions */ | ||
|
||
#ifndef _UBX_TIME_H | ||
#define _UBX_TIME_H | ||
|
||
int ubx_clock_mono_gettime(struct ubx_timespec *uts); | ||
int ubx_clock_mono_nanosleep(int flags, struct ubx_timespec *request); | ||
int ubx_gettime(struct ubx_timespec *uts); | ||
int ubx_nanosleep(int flags, struct ubx_timespec *uts); | ||
int ubx_ts_cmp(const struct ubx_timespec *ts1, const struct ubx_timespec *ts2); | ||
void ubx_ts_norm(struct ubx_timespec *ts); | ||
void ubx_ts_sub(const struct ubx_timespec *ts1, const struct ubx_timespec *ts2, struct ubx_timespec *out); | ||
void ubx_ts_add(const struct ubx_timespec *ts1, const struct ubx_timespec *ts2, struct ubx_timespec *out); | ||
void ubx_ts_div(const struct ubx_timespec *ts, const long div, struct ubx_timespec *out); | ||
double ubx_ts_to_double(const struct ubx_timespec *ts); | ||
uint64_t ubx_ts_to_ns(const struct ubx_timespec *ts); | ||
uint64_t ubx_ts_to_us(const struct ubx_timespec *ts); | ||
|
||
#endif /* _UBX_TIME_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef UBX_UTILS_H | ||
#define UBX_UTILS_H | ||
|
||
int ubx_wait_sigint(unsigned int timeout_s); | ||
void char_replace(char *s, const char find, const char rep); | ||
|
||
#endif /* UBX_UTILS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters