| 1 |
This is short howto about adding new l_down into build system |
| 2 |
============================================================= |
| 3 |
|
| 4 |
In this howto we are using 'example' as an example name for the new ldown. On |
| 5 |
known l_downs example can be changed to 'single', 'tcp' or 'usb' |
| 6 |
|
| 7 |
So just replace the 'example' on following chapters. There is also actual example |
| 8 |
l_down to be used when creating new l_down. |
| 9 |
|
| 10 |
|
| 11 |
Creating directory |
| 12 |
================== |
| 13 |
|
| 14 |
Directory needs to be in form ld_example |
| 15 |
|
| 16 |
e.g. |
| 17 |
|
| 18 |
l_in/ld_example |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
Adding to build harness |
| 23 |
======================= |
| 24 |
|
| 25 |
|
| 26 |
Makefile.am needs to be added to ld_example folder. |
| 27 |
|
| 28 |
Includings of the l_in/ld_example/Makefile.am: |
| 29 |
---------------------------- |
| 30 |
# Copyright (c) 2009 Nokia Corporation |
| 31 |
# All rights reserved. |
| 32 |
# |
| 33 |
# Redistribution and use in source and binary forms, with or without |
| 34 |
# modification, are permitted provided that the following conditions are |
| 35 |
# met: |
| 36 |
# |
| 37 |
# * Redistributions of source code must retain the above copyright |
| 38 |
# notice, this list of conditions and the following disclaimer. |
| 39 |
# * Redistributions in binary form must reproduce the above copyright |
| 40 |
# notice, this list of conditions and the following disclaimer in the |
| 41 |
# documentation and/or other materials provided with the distribution. |
| 42 |
# * Neither the name of the Nokia Corporation nor the names of its |
| 43 |
# contributors may be used to endorse or promote products derived from |
| 44 |
# this software without specific prior written permission. |
| 45 |
# |
| 46 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 47 |
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 48 |
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 49 |
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
| 50 |
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 51 |
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 52 |
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 53 |
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 54 |
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 55 |
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 56 |
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 57 |
|
| 58 |
INCLUDES=\ |
| 59 |
-I${top_srcdir}/inc \ |
| 60 |
-I${top_srcdir}/l_in_up \ |
| 61 |
-I. |
| 62 |
|
| 63 |
|
| 64 |
noinst_LTLIBRARIES=\ |
| 65 |
libld_example.la |
| 66 |
|
| 67 |
libld_example_la_SOURCES=\ |
| 68 |
ld_if_example.c \ |
| 69 |
ld_example.c \ |
| 70 |
ld_example.h |
| 71 |
---------------------------- |
| 72 |
|
| 73 |
|
| 74 |
l_in/configure.ac |
| 75 |
|
| 76 |
If l_down is wanted to be added as part of the --with-transports=all command one |
| 77 |
needs to add the example to be included when checking if transports is all. |
| 78 |
|
| 79 |
---------------------------- |
| 80 |
if test "x$transports" = "xall"; then |
| 81 |
transports="tcp,fifo,usb,bt,simple,dummy,single,example" |
| 82 |
fi |
| 83 |
---------------------------- |
| 84 |
|
| 85 |
in l_in/configure.ac one needs to add ld_example to be part of the AC_OUTPUT |
| 86 |
by adding ld_example/Makefile to file. This is required for actual makefile |
| 87 |
to be created. |
| 88 |
|
| 89 |
---------------------------- |
| 90 |
AC_OUTPUT([ |
| 91 |
... |
| 92 |
ld_single/Makefile |
| 93 |
ld_example/Makefile |
| 94 |
nota-l_in-3.0.pc]) |
| 95 |
---------------------------- |
| 96 |
|
| 97 |
now ld_example is automatically taken into build, when making |
| 98 |
|
| 99 |
l_in$ ./configure --with-transports=example |
| 100 |
|
| 101 |
If l_down is also wanted to be added in distributions, folder needs to be listed |
| 102 |
in l_in/Makefile.am DIST_SUBDIRS. |
| 103 |
|
| 104 |
---------------------------- |
| 105 |
DIST_SUBDIRS= \ |
| 106 |
.... \ |
| 107 |
ld_usb \ |
| 108 |
ld_example |
| 109 |
|
| 110 |
---------------------------- |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
l_down files |
| 116 |
============ |
| 117 |
|
| 118 |
l_in/inc/l_in/ld_types.h |
| 119 |
|
| 120 |
definition for l_down type needs to be added |
| 121 |
|
| 122 |
#define LD_TYPE_MAIN_EXAMPLE 0x00006000 |
| 123 |
#define LD_TYPE_EXT_EXAMPLE_EXAMPLE 0x00006000 |
| 124 |
|
| 125 |
|
| 126 |
ld_if_example.c |
| 127 |
|
| 128 |
LdActivate function needs to point to ld_types.h values and set the type of |
| 129 |
the l_down to reference parameter provided by l_in_up. |
| 130 |
|
| 131 |
Also parameter checking is usually implemented here. |
| 132 |
|
| 133 |
Also has |
| 134 |
ld_example_module_init |
| 135 |
ld_example_module_destroy |
| 136 |
|
| 137 |
which are called by l_in_up and ld_tester to initialize and destroy the |
| 138 |
l_down. These function names are automatically generated from the parameters |
| 139 |
of the ./configure --with-transports=example and they are generated when |
| 140 |
l_in_up is compiled. funtions are always in the form of ld_??????_module_init. |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
ld_example.c |
| 145 |
|
| 146 |
implementation of ld_if functions. |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
Building l_down for the first time |
| 151 |
================================== |
| 152 |
|
| 153 |
First update the build instruction scripts |
| 154 |
l_in$ autoreconf -i |
| 155 |
|
| 156 |
Update the configuration of l_in |
| 157 |
|
| 158 |
l_in$ ./configure --with-transports=example |
| 159 |
|
| 160 |
now you should see L_IN configure results to similiar to |
| 161 |
|
| 162 |
L_IN configure results |
| 163 |
----------------------------------- |
| 164 |
Transport (Ldown) : example |
| 165 |
Transport libs : ../ld_example/libld_example.la |
| 166 |
Platform : posix |
| 167 |
Build / Target : i686-pc-linux-gnu / |
| 168 |
Endianness : little |
| 169 |
Plugin support : no |
| 170 |
Multiple ref l_up : no |
| 171 |
|
| 172 |
Prefix : /usr/local |
| 173 |
|
| 174 |
|
| 175 |
to build now type |
| 176 |
make clean all |
| 177 |
|
| 178 |
to check if all were succesfull, check that l_in/l_in_up/ld_modules.h |
| 179 |
was created and it includes: |
| 180 |
|
| 181 |
ld_status_t ld_example_module_init (ld_callback_t *, void *, struct ld_ops **, ld_t **); |
| 182 |
ld_status_t ld_example_module_destroy (ld_t *); |
| 183 |
|
| 184 |
|
| 185 |
Congratulations! |
| 186 |
Now your done it, and new l_down is introduced to build harness, and it is usable by |
| 187 |
l_in_up and ld_tester. |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
Testing l_down |
| 193 |
============== |
| 194 |
|
| 195 |
To start testing the l_down, goto ld_tester folder and tun the tester. |
| 196 |
|
| 197 |
More info about the tester in testers README. |