From 92a035f82b1cd5a20d3378a3d851a5c82b549d01 Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Mon, 26 Jun 2006 16:05:30 +0000 Subject: [PATCH] Added missing documentation. --- devices/ecdev.h | 6 ++++- include/ecrt.h | 6 ++--- master/canopen.c | 47 ++++++++++++++++++++------------------- master/ethernet.c | 8 +++++++ master/ethernet.h | 2 +- master/fsm.c | 56 ++++++++++++++++++++++------------------------- master/fsm.h | 4 +--- master/master.h | 2 +- master/module.c | 6 ++--- master/types.h | 4 ++-- 10 files changed, 75 insertions(+), 66 deletions(-) diff --git a/devices/ecdev.h b/devices/ecdev.h index 3af5bb88..62d67d41 100644 --- a/devices/ecdev.h +++ b/devices/ecdev.h @@ -55,7 +55,11 @@ /*****************************************************************************/ struct ec_device; -typedef struct ec_device ec_device_t; +typedef struct ec_device ec_device_t; /**< \see ec_device */ + +/** + Interrupt-Service-Routine Type +*/ typedef irqreturn_t (*ec_isr_t)(int, void *, struct pt_regs *); diff --git a/include/ecrt.h b/include/ecrt.h index 0f1a819f..e28d50eb 100644 --- a/include/ecrt.h +++ b/include/ecrt.h @@ -60,13 +60,13 @@ /*****************************************************************************/ struct ec_master; -typedef struct ec_master ec_master_t; +typedef struct ec_master ec_master_t; /**< \see ec_master */ struct ec_domain; -typedef struct ec_domain ec_domain_t; +typedef struct ec_domain ec_domain_t; /**< \see ec_domain */ struct ec_slave; -typedef struct ec_slave ec_slave_t; +typedef struct ec_slave ec_slave_t; /**< \see ec_slave */ /** Initialization type for field registrations. diff --git a/master/canopen.c b/master/canopen.c index 171ca047..95c0da8c 100644 --- a/master/canopen.c +++ b/master/canopen.c @@ -54,10 +54,6 @@ int ec_slave_fetch_sdo_entries(ec_slave_t *, ec_command_t *, /*****************************************************************************/ -const ec_code_msg_t sdo_abort_messages[]; - -/*****************************************************************************/ - /** Reads 32 bit of a CANopen SDO in expedited mode. \return 0 in case of success, else < 0 @@ -529,26 +525,12 @@ int ec_slave_fetch_sdo_entries(ec_slave_t *slave, /**< EtherCAT slave */ /*****************************************************************************/ /** - Outputs an SDO abort message. + SDO abort messages. + The "abort SDO transfer request" supplies an abort code, + which can be translated to clear text. This table does + the mapping of the codes and messages. */ -void ec_canopen_abort_msg(uint32_t abort_code) -{ - const ec_code_msg_t *abort_msg; - - for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) { - if (abort_msg->code == abort_code) { - EC_ERR("SDO abort message 0x%08X: \"%s\".\n", - abort_msg->code, abort_msg->message); - return; - } - } - - EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code); -} - -/*****************************************************************************/ - const ec_code_msg_t sdo_abort_messages[] = { {0x05030000, "Toggle bit not changed"}, {0x05040000, "SDO protocol timeout"}, @@ -586,6 +568,27 @@ const ec_code_msg_t sdo_abort_messages[] = { {} }; +/*****************************************************************************/ + +/** + Outputs an SDO abort message. +*/ + +void ec_canopen_abort_msg(uint32_t abort_code) +{ + const ec_code_msg_t *abort_msg; + + for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) { + if (abort_msg->code == abort_code) { + EC_ERR("SDO abort message 0x%08X: \"%s\".\n", + abort_msg->code, abort_msg->message); + return; + } + } + + EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code); +} + /****************************************************************************** * Realtime interface *****************************************************************************/ diff --git a/master/ethernet.c b/master/ethernet.c index bad75a21..cddf492f 100644 --- a/master/ethernet.c +++ b/master/ethernet.c @@ -47,6 +47,14 @@ #include "mailbox.h" #include "ethernet.h" +/** + Defines the debug level of EoE processing + + 0 = No debug messages. + 1 = Output actions. + 2 = Output actions and frame data. +*/ + #define EOE_DEBUG_LEVEL 0 /*****************************************************************************/ diff --git a/master/ethernet.h b/master/ethernet.h index 1dc36719..25ae996c 100644 --- a/master/ethernet.h +++ b/master/ethernet.h @@ -61,7 +61,7 @@ ec_eoe_frame_t; /*****************************************************************************/ -typedef struct ec_eoe ec_eoe_t; +typedef struct ec_eoe ec_eoe_t; /**< \see ec_eoe */ /** Ethernet-over-EtherCAT (EoE) handler. diff --git a/master/fsm.c b/master/fsm.c index 8162b68e..cf385236 100644 --- a/master/fsm.c +++ b/master/fsm.c @@ -44,10 +44,6 @@ /*****************************************************************************/ -const ec_code_msg_t al_status_messages[]; - -/*****************************************************************************/ - void ec_fsm_master_start(ec_fsm_t *); void ec_fsm_master_broadcast(ec_fsm_t *); void ec_fsm_master_proc_states(ec_fsm_t *); @@ -1674,6 +1670,32 @@ void ec_fsm_change_status(ec_fsm_t *fsm /**< finite state machine */) /*****************************************************************************/ +/** + Application layer status messages. +*/ + +const ec_code_msg_t al_status_messages[] = { + {0x0001, "Unspecified error"}, + {0x0011, "Invalud requested state change"}, + {0x0012, "Unknown requested state"}, + {0x0013, "Bootstrap not supported"}, + {0x0014, "No valid firmware"}, + {0x0015, "Invalid mailbox configuration"}, + {0x0016, "Invalid mailbox configuration"}, + {0x0017, "Invalid sync manager configuration"}, + {0x0018, "No valid inputs available"}, + {0x0019, "No valid outputs"}, + {0x001A, "Synchronisation error"}, + {0x001B, "Sync manager watchdog"}, + {0x0020, "Slave needs cold start"}, + {0x0021, "Slave needs INIT"}, + {0x0022, "Slave needs PREOP"}, + {0x0023, "Slave needs SAVEOP"}, + {} +}; + +/*****************************************************************************/ + /** Change state: CODE. */ @@ -1790,29 +1812,3 @@ void ec_fsm_change_error(ec_fsm_t *fsm /**< finite state machine */) } /*****************************************************************************/ - -/** - Application layer status messages. -*/ - -const ec_code_msg_t al_status_messages[] = { - {0x0001, "Unspecified error"}, - {0x0011, "Invalud requested state change"}, - {0x0012, "Unknown requested state"}, - {0x0013, "Bootstrap not supported"}, - {0x0014, "No valid firmware"}, - {0x0015, "Invalid mailbox configuration"}, - {0x0016, "Invalid mailbox configuration"}, - {0x0017, "Invalid sync manager configuration"}, - {0x0018, "No valid inputs available"}, - {0x0019, "No valid outputs"}, - {0x001A, "Synchronisation error"}, - {0x001B, "Sync manager watchdog"}, - {0x0020, "Slave needs cold start"}, - {0x0021, "Slave needs INIT"}, - {0x0022, "Slave needs PREOP"}, - {0x0023, "Slave needs SAVEOP"}, - {} -}; - -/*****************************************************************************/ diff --git a/master/fsm.h b/master/fsm.h index 854c6304..6bbf8e92 100644 --- a/master/fsm.h +++ b/master/fsm.h @@ -47,9 +47,7 @@ /*****************************************************************************/ -typedef struct ec_fsm ec_fsm_t; - -/*****************************************************************************/ +typedef struct ec_fsm ec_fsm_t; /**< \see ec_fsm */ /** Finite state machine of an EtherCAT master. diff --git a/master/master.h b/master/master.h index 8bbb1880..c23186aa 100644 --- a/master/master.h +++ b/master/master.h @@ -115,7 +115,7 @@ struct ec_master ec_fsm_t fsm; /**< master state machine */ ec_master_mode_t mode; /**< master mode */ - struct timer_list eoe_timer; /** EoE timer object */ + struct timer_list eoe_timer; /**< EoE timer object */ unsigned int eoe_running; /**< non-zero, if EoE processing is active. */ struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers */ spinlock_t internal_lock; /**< spinlock used in freerun mode */ diff --git a/master/module.c b/master/module.c index 99ea6f82..eeca62ea 100644 --- a/master/module.c +++ b/master/module.c @@ -66,9 +66,9 @@ void __exit ec_cleanup_module(void); /*****************************************************************************/ -static int ec_master_count = 1; -static int ec_eoe_devices = 0; -static struct list_head ec_masters; +static int ec_master_count = 1; /**< parameter value, number of masters */ +static int ec_eoe_devices = 0; /**< parameter value, number of EoE interf. */ +static struct list_head ec_masters; /**< list of masters */ /*****************************************************************************/ diff --git a/master/types.h b/master/types.h index 8de07de7..00250244 100644 --- a/master/types.h +++ b/master/types.h @@ -47,8 +47,8 @@ /*****************************************************************************/ -#define EC_MAX_FIELDS 10 -#define EC_MAX_SYNC 16 +#define EC_MAX_FIELDS 10 /**< maximal number of data fields per sync manager */ +#define EC_MAX_SYNC 16 /**< maximal number of sync managers per type */ /*****************************************************************************/