From f77a57a620d1df55e6d92bc0d4c8148c5ca598fe Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Fri, 28 Oct 2011 11:31:54 +0200 Subject: [PATCH] Added coding style document. --- CodingStyle.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ README | 30 +++++++++++++++++++----------- 2 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 CodingStyle.txt diff --git a/CodingStyle.txt b/CodingStyle.txt new file mode 100644 index 00000000..c34c34b8 --- /dev/null +++ b/CodingStyle.txt @@ -0,0 +1,44 @@ +$Id$ + +vim: spelllang=en tw=78 + +This is a short introduction to the coding style that shall be used. The below +rules are applicable for all C source files, except the Ethernet drivers, for +which the Linux Kernel coding style shall be used to minimize the +differences). + +* Lines shall not exceed 78 characters. + +* Indentation shall be done using 4 space characters + +* No whitespace shall be left at the end of a line. + +* After a comma, a single space shall be placed (if not followed by a + line break). + +* Braces shall be placed in the following way (K&R style): + + if (...) { + ... + } else if (...) { + ... + } else { + ... + } + + int function(...) + { + ... + } + +* Macros shall be named in CAPITAL letters. If a macro contains multiple + statements, they should be enclosed by a 'do {} while (0)' loop. Macro + parameters shall also be capital letters and shall be enclosed py parantheses + if necessary. + + #define MACRO(A, B) \ + do { \ + if ((A) == 1) { \ + statement(B); \ + } while (0) + diff --git a/README b/README index 777712f2..9b8fc69a 100644 --- a/README +++ b/README @@ -1,12 +1,12 @@ -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ This is the README file of the IgH EtherCAT Master. -$Id$ +$Id: README,v 11c0b2caa253 2009/02/24 12:51:39 fp $ vim: spelllang=en spell tw=78 -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ Contents: 1) General Information @@ -14,8 +14,9 @@ Contents: 3) Building and installing 4) Realtime & Tuning 5) License +6) Coding Style -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ 1) General Information ====================== @@ -33,7 +34,7 @@ Heinz-Baecker-Str. 34 D-45356 Essen http://igh-essen.com -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ 2) Requirements =============== @@ -48,27 +49,27 @@ master. A table of supported hardware can be found at http://etherlab.org/en/ethercat/hardware.php. -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ 3) Building and installing ========================== See the INSTALL file. -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ 4) Realtime & Tuning ==================== Realtime patches for the Linux kernel are supported, but not required. The realtime processing has to be done by the calling module (see API -documentation). The EtherCAT master code itself is passive (except for the idle -mode and EoE). +documentation). The EtherCAT master code itself is passive (except for the +idle mode and EoE). To avoid frame timeouts, deactivating DMA access for hard drives is recommended (hdparm -d0 ). -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ 5) License ========== @@ -96,4 +97,11 @@ The license mentioned above concerns the source code only. Using the EtherCAT technology and brand is only permitted in compliance with the industrial property and similar rights of Beckhoff Automation GmbH. -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ + +6) Coding Style +=============== + +Developers shall use the coding style rules in the CodingStyle.txt file. + +------------------------------------------------------------------------------