Commit 0d0c688e authored by Jean-Claude BAU's avatar Jean-Claude BAU

Export LEDs control logic in PPSi

The logic used to control WR switch leds is removed from HAL and
imported into PPSi. It prevents HAL from reading PPSi shared memory.
parent 2a8fcfb5
......@@ -83,6 +83,22 @@ typedef struct {
uint32_t timing_mode;
} hexp_pps_params_t;
#define PORT_MODE_OTHER 0
#define PORT_MODE_SLAVE 1
#define PORT_MODE_MASTER 2
typedef struct {
char name[16]; // Interface name
int synchronized; // <>0 : Master/Slave are synchronized
int mode; // PORT_MODE_XXXX
}hexp_port_info_t;
typedef struct {
int numberPortInterfaces;
hexp_port_info_t hIFace[HAL_MAX_PORTS];
} hexp_port_info_params_t;
/* Port modes (hal_port_state.mode) */
#define HEXP_PORT_MODE_WR_MASTER 1
#define HEXP_PORT_MODE_WR_SLAVE 2
......@@ -98,6 +114,7 @@ typedef struct {
extern struct minipc_pd __rpcdef_lock_cmd;
extern struct minipc_pd __rpcdef_pps_cmd;
extern struct minipc_pd __rpcdef_port_info_cmd;
/* Prototypes of functions that call on rpc */
extern int halexp_lock_cmd(const char *port_name, int command, int priority);
......
......@@ -26,3 +26,13 @@ struct minipc_pd __rpcdef_pps_cmd = {
MINIPC_ARG_END,
},
};
//int halexp_info_cmd(hexp_info_params_t *params);
struct minipc_pd __rpcdef_port_info_cmd = {
.name = "info_cmd",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_STRUCT, hexp_port_info_params_t),
MINIPC_ARG_END,
},
};
......@@ -117,6 +117,11 @@ struct hal_port_state {
/* whether the port shall be monitored by SNMP */
int monitor;
/* PPSi instance information */
int portMode; // Instance state
int synchronized; // <>0 if port is synchronized
int portInfoUpdated; // Set to 1 when updated
};
struct hal_temp_sensors {
......
Subproject commit 4fe4f791512d075a5b2297c25d3e03950cd5ee9a
Subproject commit 8240a87d850dd23b6f003d4f071d3c063c992c2e
......@@ -159,6 +159,15 @@ int halexp_pps_cmd(int cmd, hexp_pps_params_t * params)
return -1; /* fixme: real error code */
}
/* Receive information about PPSi instances */
int halexp_port_info_cmd(hexp_port_info_params_t * params)
{
int i;
for ( i=0; i< params->numberPortInterfaces; i++ )
hal_update_port_info(params->hIFace[i].name, params->hIFace[i].mode, params->hIFace[i].synchronized);
return 1;
}
extern int hal_port_any_locked(void);
static void hal_cleanup_wripc(void)
......@@ -192,6 +201,18 @@ static int export_lock_cmd(const struct minipc_pd *pd,
return 0;
}
static int export_port_info_cmd(const struct minipc_pd *pd,
uint32_t * args, void *ret)
{
int rval;
/* First argument is command next is param structure */
rval = halexp_port_info_cmd((hexp_port_info_params_t *) args);
*(int *)ret = rval;
return 0;
}
/* Creates a wripc server and exports all public API functions */
int hal_init_wripc(struct hal_port_state *hal_ports, char *logfilename)
{
......@@ -219,9 +240,11 @@ int hal_init_wripc(struct hal_port_state *hal_ports, char *logfilename)
/* fill the function pointers */
__rpcdef_pps_cmd.f = export_pps_cmd;
__rpcdef_lock_cmd.f = export_lock_cmd;
__rpcdef_port_info_cmd.f = export_port_info_cmd;
minipc_export(hal_ch, &__rpcdef_pps_cmd);
minipc_export(hal_ch, &__rpcdef_lock_cmd);
minipc_export(hal_ch, &__rpcdef_port_info_cmd);
/* FIXME: pll_cmd is empty anyways???? */
......
This diff is collapsed.
......@@ -19,6 +19,8 @@ int hal_config_iterate(const char *section, int index,
int hal_port_init_shmem(char *logfilename);
int hal_port_init_wripc(char *logfilename);
void hal_port_update_all(void);
void hal_update_port_info(char *iface_name, int mode, int synchronized);
struct hexp_port_state;
struct hal_port_state;
......
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