Project

General

Profile

Code-audit » History » Version 57

gnutoo, 02/19/2016 10:49 PM

1 57 gnutoo
2
h2. Introduction
3
4 1 gnutoo
This page is a code audit that:
5 57 gnutoo
* Verify if the license are correct(not copied from osmocom-bb and changed from GPL to BSD)
6
* permit to view the license of each file, that's important for the inclusion into the official nuttx that only accepts BSD code for the non-applications part.
7
8
h2. Audit
9
10 1 gnutoo
Currently the following files were added or modified by nuttx-bb(on top of nuttx):
11 57 gnutoo
<pre>
12 1 gnutoo
 apps/examples/calypsotest/Makefile             
13
 apps/examples/calypsotest/bounce_analyze.c     
14
 apps/examples/calypsotest/main.c               
15 22 gnutoo
 apps/examples/ostest/main.c                    
16 30 gnutoo
 nuttx/arch/arm/include/calypso/armio.h         OK,BSD only definitions of functions
17 26 gnutoo
 nuttx/arch/arm/include/calypso/clock.h         no license, copied from omsocombb's src/target/firmware/include/clock.h(which has no license too)
18
 nuttx/arch/arm/include/calypso/debug.h         no license, copied from omsocombb's src/target/firmware/include/debug.h(which has no license too), debug macros
19 57 gnutoo
 nuttx/arch/arm/include/calypso/defines.h       no license, copied from osmocombb's src/target/firmware/include/defines.h(which has no license too), trivial defines like #define +unused attribute+((unused))
20 26 gnutoo
 nuttx/arch/arm/include/calypso/irq.h           GPL, copyright Harald Welte and Stefan Richter
21 57 gnutoo
 nuttx/arch/arm/include/calypso/memory.h        no license,copied from osmocombb's src/target/firmware/include/memory.h(which has no license too),  trivial defines like #define readb(a) +arch_getb(a)
22 19 gnutoo
 nuttx/arch/arm/include/calypso/timer.h         no license, copied from osmocombb's src/target/firmware/include/timer.h(which has no license too), only definitions of functions
23
 nuttx/arch/arm/src/Makefile                    OK,BSD
24 17 gnutoo
 nuttx/arch/arm/src/calypso/Make.defs           OK,BSD
25 29 gnutoo
 nuttx/arch/arm/src/calypso/calypso_armio.c     BSD,copyright Stefan Richter, seem ok(grep found nothing in osmocom-bb)
26 17 gnutoo
 nuttx/arch/arm/src/calypso/calypso_head.S      no license, specific to nuttx( it jumps to functions like up_ which are nuttx functions)
27 32 gnutoo
 nuttx/arch/arm/src/calypso/calypso_heap.c      problematic?, see below
28 13 gnutoo
 nuttx/arch/arm/src/calypso/calypso_irq.c       OK,GPL, copied from osmocombb's src/target/firmware/calypso/irq.c , copyright Harald Welte and Stefan Richter
29 15 gnutoo
 nuttx/arch/arm/src/calypso/calypso_keypad.c    OK,BSD, totally different from osmocom-bb's src/target/firmware/calypso/keypad.c 
30 18 gnutoo
 nuttx/arch/arm/src/calypso/calypso_lowputc.S   OK,BSD, not found in osmocom-bb source
31 1 gnutoo
 nuttx/arch/arm/src/calypso/calypso_serial.c    OK,BSD, based on nuttx/arch/arm/src/c5471/c5471_serial.c from nuttx (verified with diff)
32 14 gnutoo
 nuttx/arch/arm/src/calypso/calypso_spi.c       OK,BSD, wrapper arround osmocombb's SPI, incomplete
33 21 gnutoo
 nuttx/arch/arm/src/calypso/calypso_timer.c     OK,GPL, copyright Harald Welte and Stefan Richter
34 14 gnutoo
 nuttx/arch/arm/src/calypso/chip.h              OK,BSD,based on nuttx/arch/arm/src/c5471/chip.h
35 20 gnutoo
 nuttx/arch/arm/src/calypso/clock.c             OK,GPL, copyright Harald Welte
36 3 gnutoo
 nuttx/arch/arm/src/common/up_internal.h        OK,BSD,trivial modification(part of nuttx)
37
 nuttx/configs/compal_e88/calypsotest/Make.defs OK,BSD
38
 nuttx/configs/compal_e88/calypsotest/appconfig OK,BSD
39
 nuttx/configs/compal_e88/calypsotest/defconfig OK,BSD
40
 nuttx/configs/compal_e88/calypsotest/setenv.sh OK,BSD
41
 nuttx/configs/compal_e88/include/board.h       OK,BSD
42
 nuttx/configs/compal_e88/ld.script             OK,BSD
43
 nuttx/configs/compal_e88/nsh/Make.defs         OK,BSD
44
 nuttx/configs/compal_e88/nsh/appconfig         OK,BSD
45
 nuttx/configs/compal_e88/nsh/defconfig         OK,BSD
46
 nuttx/configs/compal_e88/nsh/ld.script         OK,BSD
47
 nuttx/configs/compal_e88/nsh/setenv.sh         OK,BSD
48
 nuttx/configs/compal_e88/ostest/Make.defs      OK,BSD
49
 nuttx/configs/compal_e88/ostest/appconfig      OK,BSD
50
 nuttx/configs/compal_e88/ostest/defconfig      OK,BSD
51
 nuttx/configs/compal_e88/ostest/setenv.sh      OK,BSD
52
 nuttx/configs/compal_e88/src/Make.dep          OK,BSD
53
 nuttx/configs/compal_e88/src/Makefile          OK,BSD
54
 nuttx/configs/compal_e88/src/dummy.c           OK,BSD
55
 nuttx/configs/compal_e99/calypsotest/Make.defs OK,BSD
56
 nuttx/configs/compal_e99/calypsotest/appconfig OK,BSD
57
 nuttx/configs/compal_e99/calypsotest/defconfig OK,BSD
58
 nuttx/configs/compal_e99/calypsotest/setenv.sh OK,BSD
59
 nuttx/configs/compal_e99/include/board.h       OK,BSD
60
 nuttx/configs/compal_e99/ld.script             OK,BSD
61
 nuttx/configs/compal_e99/nsh/Make.defs         OK,BSD
62
 nuttx/configs/compal_e99/nsh/appconfig         OK,BSD
63
 nuttx/configs/compal_e99/nsh/defconfig         OK,BSD
64
 nuttx/configs/compal_e99/nsh/ld.script         OK,BSD
65
 nuttx/configs/compal_e99/nsh/setenv.sh         OK,BSD
66
 nuttx/configs/compal_e99/ostest/Make.defs      OK,BSD
67
 nuttx/configs/compal_e99/ostest/appconfig      OK,BSD
68
 nuttx/configs/compal_e99/ostest/defconfig      OK,BSD
69
 nuttx/configs/compal_e99/ostest/setenv.sh      OK,BSD
70
 nuttx/configs/compal_e99/src/Makefile          OK,BSD
71 9 gnutoo
 nuttx/configs/compal_e99/src/dummy.c           OK,BSD
72 12 gnutoo
 nuttx/drivers/Makefile                         OK,BSD
73 5 gnutoo
 nuttx/drivers/sercomm/Make.defs                OK,BSD
74 1 gnutoo
 nuttx/drivers/sercomm/console.c                mostly OK(see below), BSD
75
 nuttx/drivers/sercomm/loadwriter.py            no copyright at all, small enough
76
 nuttx/drivers/sercomm/uart.c                   OK,GPL, copyright Harald Welte and Ingo Albrecht
77
 nuttx/drivers/sercomm/uart.h                   no license, copied from osmocom-bb's src/target/firmware/include/uart.h which had no license too
78
 nuttx/include/nuttx/spi.h                      OK,BSD, only small change made
79
 nuttx/include/sercomm/msgb.h                   OK,GPL,copyright Harald Welte
80
 nuttx/include/sercomm/sercomm.h                copy of src/target/firmware/include/comm/sercomm.h, no license in both.
81
 nuttx/include/sercomm/sercomm_cons.h           no license,copied from osmocom-bb's src/target/firmware/include/comm/sercomm_cons.h which had no license, interface only(only 2 definitions of functions inside)
82
 70 files changed, 9221 insertions(+), 3 deletions(-)
83 57 gnutoo
</pre>
84 1 gnutoo
85
We can safely assume that the config dir weren't took from osmocom-bb.
86 57 gnutoo
87
h2. init.c and console.c ==
88
 nuttx-bb ===
89
* Copyright Stefan Richter
90
* BSD License
91
* nuttx/drivers/sercomm/console.c
92
<pre>
93 1 gnutoo
        /* XXX: initialize MODEMUART to be used for sercomm*/
94 10 gnutoo
        uart_init(SERCOMM_UART_NR, 1);
95
        uart_baudrate(SERCOMM_UART_NR, UART_115200);
96 57 gnutoo
</pre>
97
98
h3. osmocom-bb
99
100
* GPL
101
* Copyright Harald Welte and Steve Markgraf
102
* src/target/firmware/board/compal_e99/init.c
103
<pre>
104 33 gnutoo
        /* initialize MODEM UART to be used for sercomm*/
105
        uart_init(SERCOMM_UART_NR, 1);
106
        uart_baudrate(SERCOMM_UART_NR, UART_115200);
107 57 gnutoo
</pre>
108 1 gnutoo
109
110 57 gnutoo
h2. calypsotest/bounce_analyze.c ==
111
 nuttx-bb ===
112
* Copyright Stefan Richter
113
* GPL License (could keep as GPL since it is an application)
114
* apps/examples/calypsotest/bounce_analyze.c
115 1 gnutoo
116 57 gnutoo
h3. osmocom-bb
117
118
* nothing found
119
120
121
122
h2. calypsotest/main.c ==
123
 nuttx-bb ===
124
* Copyright Stefan Richter
125
* BSD License
126
* apps/examples/calypsotest/main.c
127
<pre>
128 40 gnutoo
static void lights_on(void)
129
{
130
	uint16_t reg;
131
132 1 gnutoo
	reg = readw(ASIC_CONF_REG);
133
	/* LCD Set I/O(3) / SA0 to I/O(3) mode */
134
	reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ;
135
	/* don't set function pins to I2C Mode, C155 uses UWire */
136
	/* TWL3025: Set SPI+RIF RX clock to rising edge */
137
	reg |= (1 << 13) | (1 << 14);
138
	writew(reg, ASIC_CONF_REG);
139
140
	/* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */
141
	/* FIXME: Put the display backlight control to backlight.c */
142
	reg = readw(IO_CNTL_REG);
143
	reg &= ~( (1 << 3) | (1 << 1));
144
	writew(reg, IO_CNTL_REG);
145
146
	/* LCD Set I/O(3) output low */
147
	reg = readw(ARMIO_LATCH_OUT);
148
	reg &= ~(1 << 3);
149
	reg |= (1 << 1);
150
	writew(reg, ARMIO_LATCH_OUT);
151
}
152 57 gnutoo
</pre>
153
154
h3. osmocom-bb
155
156
* Copyright Harald Welte and Steve Markgraf
157
* GPL License
158
* src/target/firmware/board/compal_e99/init.c
159
<pre>
160 40 gnutoo
static void board_io_init(void)
161
{
162
	uint16_t reg;
163
164
	reg = readw(ASIC_CONF_REG);
165
	/* LCD Set I/O(3) / SA0 to I/O(3) mode */
166
	reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ;
167
	/* don't set function pins to I2C Mode, C155 uses UWire */
168 1 gnutoo
	/* TWL3025: Set SPI+RIF RX clock to rising edge */
169
	reg |= (1 << 13) | (1 << 14);
170
	writew(reg, ASIC_CONF_REG);
171
172
	/* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */
173
	/* FIXME: Put the display backlight control to backlight.c */
174
	reg = readw(IO_CNTL_REG);
175
	reg &= ~( (1 << 3) | (1 << 1));
176 38 gnutoo
	writew(reg, IO_CNTL_REG);
177
178 1 gnutoo
	/* LCD Set I/O(3) output low */
179
	reg = readw(ARMIO_LATCH_OUT);
180
	reg &= ~(1 << 3);
181
	reg |= (1 << 1);
182
	writew(reg, ARMIO_LATCH_OUT);
183
}
184 57 gnutoo
</pre>
185 1 gnutoo
186 57 gnutoo
h2. ostest/main.c ==
187
 nuttx-bb ===
188
* Copyright Gregory Nutt
189
* BSD License
190
* apps/examples/ostest/main.c
191
* Note: lights_on function used snippet code of [[OsmocomBB]] src/target/firmware/board/compal_e99/init.c
192 1 gnutoo
193 57 gnutoo
h3. osmocom-bb
194 1 gnutoo
195 57 gnutoo
* nothing found
196
197
198
h2. calypso/calypso_armio.c ==
199
 nuttx-bb ===
200
* Copyright Stefan Richter
201
* BSD License
202
* nuttx/arch/arm/src/calypso/calypso_armio.c
203
204
h3. osmocom-bb
205
206
* nothing found
207
208
209
h2. calypso/calypso_head.S ==
210
 nuttx-bb ===
211
* No copyright
212
* No License
213
* nuttx/arch/arm/src/calypso/calypso_head.S
214
* Note: this is same file as nuttx/arch/arm/src/chip/calypso_head.S
215
216
h3. osmocom-bb
217
218
* nothing found
219
220
221
h2. calypso/calypso_irq.c ==
222
 nuttx-bb ===
223
* Copyright Harald Welte and Stefan Richter
224
* GPL License (need change to BSD)
225
* nuttx/arch/arm/src/calypso/calypso_irq.c
226
<pre>
227 1 gnutoo
static void _irq_enable(enum irq_nr nr, int enable)
228 42 gnutoo
{
229
	uint16_t *reg = IRQ_REG(MASK_IT_REG1);
230
	uint16_t val;
231
232
	if (nr > 15) {
233
		reg = IRQ_REG(MASK_IT_REG2);
234
		nr -= 16;
235
	}
236
237
	val = readw(reg);
238
	if (enable)
239 43 gnutoo
		val &= ~(1 << nr);
240
	else
241
		val |= (1 << nr);
242
	writew(val, reg);
243
}
244 57 gnutoo
</pre>
245
246
h3. osmocom-bb
247
248
* Copyright Harald Welte
249
* GPL License
250
* src/target/firmware/calypso/irq.c
251
<pre>
252 1 gnutoo
static void _irq_enable(enum irq_nr nr, int enable)
253
{
254
	uint16_t *reg = IRQ_REG(MASK_IT_REG1);
255
	uint16_t val;
256
257 43 gnutoo
	if (nr > 15) {
258 1 gnutoo
		reg = IRQ_REG(MASK_IT_REG2);
259
		nr -= 16;
260
	}
261
262 43 gnutoo
	val = readw(reg);
263
	if (enable)
264 44 gnutoo
		val &= ~(1 << nr);
265
	else
266
		val |= (1 << nr);
267
	writew(val, reg);
268
}
269 57 gnutoo
</pre>
270 44 gnutoo
271
272 57 gnutoo
h2. calypso_keypad.c ==
273
 nuttx-bb ===
274
* Copyright Stefan Richter
275
* BSD License
276
* nuttx/arch/arm/src/calypso/calypso_keypad.c
277 1 gnutoo
278 57 gnutoo
h3. osmocom-bb
279
280
* nothing found
281
282
283
h2. calypso_timer.c ==
284
 nuttx-bb ===
285
* Copyright Harald Welte and Stefan Richter
286
* GPL License (need change to BSD)
287
* nuttx/arch/arm/src/calypso/calypso_timer.c
288
* Note: verbatim copy from [[OsmocomBB]] calypso/timer.c
289
290
h3. osmocom-bb
291
292
* Copyright Harald Welte
293
* GPL License
294
* src/target/firmware/calypso/timer.c
295
296
297
h2. init.c and calypso_heap.c ==
298
 nuttx-bb ===
299
* Copyright Stefan Richter
300
* BSD License
301
* nuttx/arch/arm/src/calypso/calypso_heap.c
302
<pre>
303 1 gnutoo
void up_addregion(void)
304
{
305
#ifdef CONFIG_ARCH_BOARD_COMPALE99
306 10 gnutoo
        /* Disable watchdog in first non-common function */
307 1 gnutoo
        wdog_enable(0);
308
#endif
309
        // XXX: change to initialization of extern memory with save defaults
310
        /* Configure memory interface */
311
        calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
312
        calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1);
313
        calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1);
314
        calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1);
315
        calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1);
316
        calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1);
317
        calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0);
318
319
        /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */
320
        calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2);
321
322
        /* Configure the RHEA bridge with some sane default values */
323
        calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0);
324
}
325
326 57 gnutoo
</pre>
327
328
h3. Osmocom-bb
329
330
* GPL
331
* Copyright Harald Welte and Steve Markgraf
332
* src/target/firmware/board/compal_e99/init.c
333
<pre>
334 47 gnutoo
void board_init(void)
335
{
336
        /* Disable watchdog (compal loader leaves it enabled) */
337
        wdog_enable(0);
338
339
        /* Configure memory interface */
340
        calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
341
        calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1);
342
        calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1);
343
        calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1);
344
        calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1);
345
        calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1);
346 45 gnutoo
        calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0);
347
348 55 gnutoo
        /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */
349
        calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2);
350
351 56 gnutoo
        /* Configure the RHEA bridge with some sane default values */
352
        calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0);
353
354 57 gnutoo
</pre>
355
356
h2. Relicensing permissions
357
358
* "Harald Welte":http://lists.osmocom.org/pipermail/baseband-devel/2012-February/002813.html
359
* Ingo Albrecht:
360 48 gnutoo
By private mail
361 57 gnutoo
<pre>
362 48 gnutoo
I am open to relicensing and other such agreements.
363 57 gnutoo
</pre>
364
* Stefan Richter:
365 48 gnutoo
By private mail
366 57 gnutoo
<pre>
367 48 gnutoo
Sure, go ahead. I don't mind which license but we agreed (I think) to
368
use the nuttx one. Mostly such that we can submit to upstream some day
369 54 gnutoo
if desired.
370 57 gnutoo
</pre>
371
* Denis Carikli
372
* Alan Carvalho de Assis
373
* "Sylvain Munaut":http://lists.osmocom.org/pipermail/baseband-devel/2012-May/002967.html:
374
** src/target/firmware/calypso/uwire.c has permission
375
** "anything close to the GSM function (dsp / tsp / l1 / ....)." does *not* have permission
376
* Steve Markgraf
377 54 gnutoo
On the #osmocom channel on Freenode IRC server:
378 57 gnutoo
<pre>
379 51 gnutoo
May 13 21:55:40 <GNUtoo-desktop>	hi steve|m, we need permission for relicensing the commit a13a4fda926aa272e55964c8f86cb31fb4065995 (uwire: add a chip-select for CS0, needed by the J100i display) for inclusion in nuttx(BSD licensed).
380
May 13 22:00:03 <steve|m>	I don't mind such trivial changes being relicensed, but I second what tnt stated on the ml, for the actual GSM parts of the code that's different
381 57 gnutoo
</pre>
382 51 gnutoo
383 57 gnutoo
384
h2. Listing authors by file
385
386
<pre>
387 1 gnutoo
src/target/firmware/calypso/irq.c:
388
Author: Harald Welte <laforge@gnumonks.org>
389
390
src/target/firmware/calypso/timer.c:
391
Author: Harald Welte <laforge@gnumonks.org>
392
Author: Ingo Albrecht <prom@berlin.ccc.de>
393
394
src/target/firmware/calypso/clock.c:
395
Author: Harald Welte <laforge@gnumonks.org>
396
Author: Ingo Albrecht <prom@berlin.ccc.de> (very small modifications)
397
Author: Steve Markgraf <steve@steve-m.de> (very small modifications)
398
399
src/target/firmware/calypso/uart.c:
400
Author: Alex Badea <vamposdecampos@gmail.com> (very small modifications)
401
Author: Christian Vogel <vogelchr@vogel.cx>
402
Author: Harald Welte <laforge@gnumonks.org>
403
Author: Ingo Albrecht <prom@berlin.ccc.de>
404
Author: Wolfram Sang <wolfram@the-dreams.de> (very small modifications)
405
406
src/target/firmware/board/compal_e99/init.c:
407
Author: Harald Welte <laforge@gnumonks.org>
408
Author: Ingo Albrecht <prom@berlin.ccc.de> (small modifications)
409
Author: Steve Markgraf <steve@steve-m.de>
410
Author: Wolfram Sang <wolfram@the-dreams.de> (very small modifications)
411
412 57 gnutoo
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)