Commit 542f276e authored by Alessandro Rubini's avatar Alessandro Rubini

usersspace/hal: massive (manual) rename within hal_ports.c

After this commit, all symbols in hal_ports are of the form hal_port_*
(all but one, that is not used and I'll remove it in another commit).
I'm not smart enough to track the origin of the various names, so I
need this.  I need this especially in this file because I'm going to
export stuff using shmem, to avoid a lot of context switches.

Thus, the "private" structure hal_port_state is not a typedef any
more, as a first step in becoming public. It doesn't make sense to
have two almost-identical structures, where one is copied to the other
one item at a time to deal with the minor differences. (It happened
for some reason: I'm not complaining hard, but it's time to get rid of
this).

Unfortunately, two functions were called "halexp", and relied on a
prototype shared by the RPC server (this file) and the RPC client.
While the convention made sense at first, it now shows its limits, so
the exported one is called hal_port_* like everything in the file, but
for this I need to add structure names (but I left the typedef at this
point, to avoid massive name changes around).

If I didn't introduce bugs, the code is the same as it was. I did it
one symbol at a time while build-checking each steps (and I even have
the commits to track any error).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 95e8ba67
......@@ -90,7 +90,7 @@ typedef struct {
#define HEXP_PORT_TSC_FALLING 2
*/
typedef struct {
typedef struct hexp_port_state {
/* When non-zero: port state is valid */
int valid;
......@@ -134,7 +134,7 @@ typedef struct {
int32_t fiber_fix_alpha;
} hexp_port_state_t;
typedef struct {
typedef struct hexp_port_list {
int num_ports; /* Number of ports in the list */
int num_physical_ports; /* Number of physical ports compiled into the FPGA bitstream */
char port_names[HAL_MAX_PORTS][16];
......
......@@ -29,7 +29,7 @@ int halexp_lock_cmd(const char *port_name, int command, int priority)
switch (command) {
case HEXP_LOCK_CMD_ENABLE_TRACKING:
return hal_enable_tracking(port_name);
return hal_port_enable_tracking(port_name);
/* Start locking - i.e. tell the HAL locking state
machine to use the port (port_name) as the source
......@@ -129,7 +129,7 @@ int halexp_pps_cmd(int cmd, hexp_pps_params_t * params)
delay calculation. */
case HEXP_PPSG_CMD_POLL:
busy = shw_pps_gen_busy() || hal_phase_shifter_busy();
busy = shw_pps_gen_busy() || hal_port_pshifter_busy();
return busy ? 0 : 1;
case HEXP_PPSG_CMD_SET_VALID:
......@@ -139,12 +139,12 @@ int halexp_pps_cmd(int cmd, hexp_pps_params_t * params)
return -1; /* fixme: real error code */
}
extern int any_port_locked();
extern int hal_port_any_locked();
int halexp_get_timing_state(hexp_timing_state_t * state)
{
state->timing_mode = hal_get_timing_mode();
state->locked_port = any_port_locked();
state->locked_port = hal_port_any_locked();
return 0;
}
......@@ -171,7 +171,7 @@ static int export_get_port_state(const struct minipc_pd *pd,
{
hexp_port_state_t *state = ret;
return halexp_get_port_state(state, (char *)args /* name */ );
return hal_port_get_exported_state(state, (char *)args /* name */ );
}
static int export_lock_cmd(const struct minipc_pd *pd,
......@@ -192,7 +192,7 @@ static int export_query_ports(const struct minipc_pd *pd,
uint32_t * args, void *ret)
{
hexp_port_list_t *list = ret;
halexp_query_ports(list);
hal_port_query_ports(list);
return 0;
}
......
......@@ -108,7 +108,7 @@ static int hal_init()
assert_init(hal_init_timing());
/* Initialize port FSMs - see hal_ports.c */
assert_init(hal_init_ports());
assert_init(hal_port_init_all());
/* Create a WRIPC server for HAL public API */
assert_init(hal_init_wripc());
......@@ -128,7 +128,7 @@ static int hal_init()
static void hal_update()
{
hal_update_wripc();
hal_update_ports();
hal_port_update_all();
shw_update_fans();
// usleep(1000);
}
......
This diff is collapsed.
......@@ -57,8 +57,14 @@ int hal_config_get_string(const char *name, char *value, int max_len);
int hal_config_iterate(const char *section, int index,
char *subsection, int max_len);
int hal_init_ports();
void hal_update_ports();
int hal_port_init_all();
void hal_port_update_all();
struct hexp_port_state;
int hal_port_get_exported_state(struct hexp_port_state *state,
const char *port_name);
struct hexp_port_list;
int hal_port_query_ports(struct hexp_port_list *list);
int hal_init_wripc();
int hal_update_wripc();
......@@ -67,11 +73,11 @@ int hal_add_cleanup_callback(hal_cleanup_callback_t cb);
int hal_port_start_lock(const char *port_name, int priority);
int hal_port_check_lock(const char *port_name);
int hal_enable_tracking(const char *port_name);
int hal_port_enable_tracking(const char *port_name);
int hal_extsrc_check_lock(void); // added by ML
int hal_init_timing();
int hal_get_timing_mode();
int hal_phase_shifter_busy();
int hal_port_pshifter_busy();
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment