Added debug_level module parameter. debug_level is now unsigned int.
This commit is contained in:
parent
2c81e5b9b4
commit
4694cde027
2
NEWS
2
NEWS
|
|
@ -30,6 +30,8 @@ Changes since 1.4.0:
|
|||
* Introduced ecrt_master_slave() to get information about a certain slave.
|
||||
* SDO entry access rights are shown in 'ethercat sdos'.
|
||||
* Added 64-bit data access macros to application header.
|
||||
* Added debug level for all masters as a module parameter. Thanks to Erwin
|
||||
Burgstaller.
|
||||
|
||||
Changes in 1.4.0:
|
||||
|
||||
|
|
|
|||
|
|
@ -425,6 +425,10 @@ to $0$.
|
|||
\label{fig:masters}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{Debug Level} The master module also has a parameter
|
||||
\textit{debug\_level} to set the initial debug level for all masters (see
|
||||
also~\ref{sec:ethercat-debug}).
|
||||
|
||||
\paragraph{Init Script}
|
||||
\index{Init script}
|
||||
|
||||
|
|
@ -2091,6 +2095,7 @@ sec.~\ref{sec:autonode} for how to install and configure it.
|
|||
%------------------------------------------------------------------------------
|
||||
|
||||
\subsection{Setting a Master's Debug Level}
|
||||
\label{sec:ethercat-debug}
|
||||
|
||||
\lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_debug}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
|||
const uint8_t *main_mac, /**< MAC address of main device */
|
||||
const uint8_t *backup_mac, /**< MAC address of backup device */
|
||||
dev_t device_number, /**< Character device number. */
|
||||
struct class *class /**< Device class. */
|
||||
struct class *class, /**< Device class. */
|
||||
unsigned int debug_level /**< Debug level (module parameter). */
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -142,7 +143,7 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
|||
|
||||
INIT_LIST_HEAD(&master->domains);
|
||||
|
||||
master->debug_level = 0;
|
||||
master->debug_level = debug_level;
|
||||
master->stats.timeouts = 0;
|
||||
master->stats.corrupted = 0;
|
||||
master->stats.unmatched = 0;
|
||||
|
|
@ -1327,17 +1328,17 @@ const ec_domain_t *ec_master_find_domain_const(
|
|||
*/
|
||||
int ec_master_debug_level(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
int level /**< Debug level. May be 0, 1 or 2. */
|
||||
unsigned int level /**< Debug level. May be 0, 1 or 2. */
|
||||
)
|
||||
{
|
||||
if (level < 0 || level > 2) {
|
||||
EC_ERR("Invalid debug level %i!\n", level);
|
||||
if (level > 2) {
|
||||
EC_ERR("Invalid debug level %u!\n", level);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (level != master->debug_level) {
|
||||
master->debug_level = level;
|
||||
EC_INFO("Master debug level set to %i.\n", master->debug_level);
|
||||
EC_INFO("Master debug level set to %u.\n", master->debug_level);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ struct ec_master {
|
|||
|
||||
struct list_head domains; /**< List of domains. */
|
||||
|
||||
int debug_level; /**< Master debug level. */
|
||||
unsigned int debug_level; /**< Master debug level. */
|
||||
ec_stats_t stats; /**< Cyclic statistics. */
|
||||
unsigned int frames_timed_out; /**< There were frame timeouts in the last
|
||||
call to ecrt_master_receive(). */
|
||||
|
|
@ -187,7 +187,7 @@ void ec_master_init_static(void);
|
|||
|
||||
// master creation/deletion
|
||||
int ec_master_init(ec_master_t *, unsigned int, const uint8_t *,
|
||||
const uint8_t *, dev_t, struct class *);
|
||||
const uint8_t *, dev_t, struct class *, unsigned int);
|
||||
void ec_master_clear(ec_master_t *);
|
||||
|
||||
// phase transitions
|
||||
|
|
@ -227,7 +227,7 @@ ec_domain_t *ec_master_find_domain(ec_master_t *, unsigned int);
|
|||
const ec_domain_t *ec_master_find_domain_const(const ec_master_t *,
|
||||
unsigned int);
|
||||
|
||||
int ec_master_debug_level(ec_master_t *, int);
|
||||
int ec_master_debug_level(ec_master_t *, unsigned int);
|
||||
|
||||
ec_domain_t *ecrt_master_create_domain_err(ec_master_t *);
|
||||
ec_slave_config_t *ecrt_master_slave_config_err(ec_master_t *, uint16_t,
|
||||
|
|
|
|||
|
|
@ -55,12 +55,13 @@ static int ec_mac_parse(uint8_t *, const char *, int);
|
|||
/*****************************************************************************/
|
||||
|
||||
static char *main_devices[MAX_MASTERS]; /**< Main devices parameter. */
|
||||
static unsigned int master_count; /**< Number of masters. */
|
||||
static char *backup_devices[MAX_MASTERS]; /**< Backup devices parameter. */
|
||||
static unsigned int backup_count; /**< Number of backup devices. */
|
||||
static unsigned int debug_level; /**< Debug level parameter. */
|
||||
|
||||
static ec_master_t *masters; /**< Array of masters. */
|
||||
static struct semaphore master_sem; /**< Master semaphore. */
|
||||
static unsigned int master_count; /**< Number of masters. */
|
||||
static unsigned int backup_count; /**< Number of backup devices. */
|
||||
|
||||
dev_t device_number; /**< Device number for master cdevs. */
|
||||
struct class *class; /**< Device class. */
|
||||
|
|
@ -82,6 +83,8 @@ module_param_array(main_devices, charp, &master_count, S_IRUGO);
|
|||
MODULE_PARM_DESC(main_devices, "MAC addresses of main devices");
|
||||
module_param_array(backup_devices, charp, &backup_count, S_IRUGO);
|
||||
MODULE_PARM_DESC(backup_devices, "MAC addresses of backup devices");
|
||||
module_param_named(debug_level, debug_level, uint, S_IRUGO);
|
||||
MODULE_PARM_DESC(debug_level, "Debug level");
|
||||
|
||||
/** \endcond */
|
||||
|
||||
|
|
@ -145,7 +148,7 @@ int __init ec_init_module(void)
|
|||
|
||||
for (i = 0; i < master_count; i++) {
|
||||
ret = ec_master_init(&masters[i], i, macs[i][0], macs[i][1],
|
||||
device_number, class);
|
||||
device_number, class, debug_level);
|
||||
if (ret)
|
||||
goto out_free_masters;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue