Project

General

Profile

Code-audit » History » Version 54

gnutoo, 02/19/2016 10:49 PM
nuttx-bb audit: fix typo

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