Added coding style document.

This commit is contained in:
Florian Pose 2011-10-28 11:31:54 +02:00
parent 7555b87512
commit e5f4a278f1
2 changed files with 62 additions and 10 deletions

44
CodingStyle.txt Normal file
View File

@ -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)

28
README
View File

@ -1,4 +1,4 @@
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
This is the README file of the IgH EtherCAT Master.
@ -6,7 +6,7 @@ $Id$
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 <DEV>).
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
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.
------------------------------------------------------------------------------