Project

General

Profile

Code-audit » History » Revision 51

Revision 50 (acassis, 02/19/2016 10:49 PM) → Revision 51/57 (acassis, 02/19/2016 10:49 PM)

== Introduction == 
 This page is a code audit that: 
  * Verify if the license are correct(not copied from osmocom-bb and changed from GPL to BSD) 
  * 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. 
 == Audit == 
 Currently the following files were added or modified by nuttx-bb(on top of nuttx): 
 {{{ 
  apps/examples/calypsotest/Makefile              
  apps/examples/calypsotest/bounce_analyze.c      
  apps/examples/calypsotest/main.c                
  apps/examples/ostest/main.c                     
  nuttx/arch/arm/include/calypso/armio.h           OK,BSD only definitions of functions 
  nuttx/arch/arm/include/calypso/clock.h           no license, copied from omsocombb's src/target/firmware/include/clock.h(which has no license too) 
  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 
  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)) 
  nuttx/arch/arm/include/calypso/irq.h             GPL, copyright Harald Welte and Stefan Richter 
  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) 
  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 
  nuttx/arch/arm/src/Makefile                      OK,BSD 
  nuttx/arch/arm/src/calypso/Make.defs             OK,BSD 
  nuttx/arch/arm/src/calypso/calypso_armio.c       BSD,copyright Stefan Richter, seem ok(grep found nothing in osmocom-bb) 
  nuttx/arch/arm/src/calypso/calypso_head.S        no license, specific to nuttx( it jumps to functions like up_ which are nuttx functions) 
  nuttx/arch/arm/src/calypso/calypso_heap.c        problematic?, see below 
  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 
  nuttx/arch/arm/src/calypso/calypso_keypad.c      OK,BSD, totally different from osmocom-bb's src/target/firmware/calypso/keypad.c  
  nuttx/arch/arm/src/calypso/calypso_lowputc.S     OK,BSD, not found in osmocom-bb source 
  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) 
  nuttx/arch/arm/src/calypso/calypso_spi.c         OK,BSD, wrapper arround osmocombb's SPI, incomplete 
  nuttx/arch/arm/src/calypso/calypso_timer.c       OK,GPL, copyright Harald Welte and Stefan Richter 
  nuttx/arch/arm/src/calypso/chip.h                OK,BSD,based on nuttx/arch/arm/src/c5471/chip.h 
  nuttx/arch/arm/src/calypso/clock.c               OK,GPL, copyright Harald Welte 
  nuttx/arch/arm/src/common/up_internal.h          OK,BSD,trivial modification(part of nuttx) 
  nuttx/configs/compal_e88/calypsotest/Make.defs OK,BSD 
  nuttx/configs/compal_e88/calypsotest/appconfig OK,BSD 
  nuttx/configs/compal_e88/calypsotest/defconfig OK,BSD 
  nuttx/configs/compal_e88/calypsotest/setenv.sh OK,BSD 
  nuttx/configs/compal_e88/include/board.h         OK,BSD 
  nuttx/configs/compal_e88/ld.script               OK,BSD 
  nuttx/configs/compal_e88/nsh/Make.defs           OK,BSD 
  nuttx/configs/compal_e88/nsh/appconfig           OK,BSD 
  nuttx/configs/compal_e88/nsh/defconfig           OK,BSD 
  nuttx/configs/compal_e88/nsh/ld.script           OK,BSD 
  nuttx/configs/compal_e88/nsh/setenv.sh           OK,BSD 
  nuttx/configs/compal_e88/ostest/Make.defs        OK,BSD 
  nuttx/configs/compal_e88/ostest/appconfig        OK,BSD 
  nuttx/configs/compal_e88/ostest/defconfig        OK,BSD 
  nuttx/configs/compal_e88/ostest/setenv.sh        OK,BSD 
  nuttx/configs/compal_e88/src/Make.dep            OK,BSD 
  nuttx/configs/compal_e88/src/Makefile            OK,BSD 
  nuttx/configs/compal_e88/src/dummy.c             OK,BSD 
  nuttx/configs/compal_e99/calypsotest/Make.defs OK,BSD 
  nuttx/configs/compal_e99/calypsotest/appconfig OK,BSD 
  nuttx/configs/compal_e99/calypsotest/defconfig OK,BSD 
  nuttx/configs/compal_e99/calypsotest/setenv.sh OK,BSD 
  nuttx/configs/compal_e99/include/board.h         OK,BSD 
  nuttx/configs/compal_e99/ld.script               OK,BSD 
  nuttx/configs/compal_e99/nsh/Make.defs           OK,BSD 
  nuttx/configs/compal_e99/nsh/appconfig           OK,BSD 
  nuttx/configs/compal_e99/nsh/defconfig           OK,BSD 
  nuttx/configs/compal_e99/nsh/ld.script           OK,BSD 
  nuttx/configs/compal_e99/nsh/setenv.sh           OK,BSD 
  nuttx/configs/compal_e99/ostest/Make.defs        OK,BSD 
  nuttx/configs/compal_e99/ostest/appconfig        OK,BSD 
  nuttx/configs/compal_e99/ostest/defconfig        OK,BSD 
  nuttx/configs/compal_e99/ostest/setenv.sh        OK,BSD 
  nuttx/configs/compal_e99/src/Makefile            OK,BSD 
  nuttx/configs/compal_e99/src/dummy.c             OK,BSD 
  nuttx/drivers/Makefile                           OK,BSD 
  nuttx/drivers/sercomm/Make.defs                  OK,BSD 
  nuttx/drivers/sercomm/console.c                  mostly OK(see below), BSD 
  nuttx/drivers/sercomm/loadwriter.py              no copyright at all, small enough 
  nuttx/drivers/sercomm/uart.c                     OK,GPL, copyright Harald Welte and Ingo Albrecht 
  nuttx/drivers/sercomm/uart.h                     no license, copied from osmocom-bb's src/target/firmware/include/uart.h which had no license too 
  nuttx/include/nuttx/spi.h                        OK,BSD, only small change made 
  nuttx/include/sercomm/msgb.h                     OK,GPL,copyright Harald Welte 
  nuttx/include/sercomm/sercomm.h                  copy of src/target/firmware/include/comm/sercomm.h, no license in both. 
  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) 
  70 files changed, 9221 insertions(+), 3 deletions(-) 
 }}} 

 We can safely assume that the config dir weren't took from osmocom-bb. 
 == init.c and console.c == 
 === nuttx-bb === 
  * Copyright Stefan Richter 
  * BSD License 
  * nuttx/drivers/sercomm/console.c 
 {{{ 
         /* XXX: initialize MODEMUART to be used for sercomm*/ 
         uart_init(SERCOMM_UART_NR, 1); 
         uart_baudrate(SERCOMM_UART_NR, UART_115200); 
 }}} 
 === osmocom-bb === 
  * GPL 
  * Copyright Harald Welte and Steve Markgraf 
  * src/target/firmware/board/compal_e99/init.c 
 {{{ 
         /* initialize MODEM UART to be used for sercomm*/ 
         uart_init(SERCOMM_UART_NR, 1); 
         uart_baudrate(SERCOMM_UART_NR, UART_115200); 
 }}} 

 == calypsotest/bounce_analyze.c == 
 === nuttx-bb === 
  * Copyright Stefan Richter 
  * GPL License (could keep as GPL since it is an application) 
  * apps/examples/calypsotest/bounce_analyze.c 
 === osmocom-bb === 
  * nothing found 


 == calypsotest/main.c == 
 === nuttx-bb === 
  * Copyright Stefan Richter 
  * BSD License 
  * apps/examples/calypsotest/main.c 
 {{{ 
 static void lights_on(void) 
 { 
	 uint16_t reg; 

	 reg = readw(ASIC_CONF_REG); 
	 /* LCD Set I/O(3) / SA0 to I/O(3) mode */ 
	 reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ; 
	 /* don't set function pins to I2C Mode, C155 uses UWire */ 
	 /* TWL3025: Set SPI+RIF RX clock to rising edge */ 
	 reg |= (1 << 13) | (1 << 14); 
	 writew(reg, ASIC_CONF_REG); 

	 /* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */ 
	 /* FIXME: Put the display backlight control to backlight.c */ 
	 reg = readw(IO_CNTL_REG); 
	 reg &= ~( (1 << 3) | (1 << 1)); 
	 writew(reg, IO_CNTL_REG); 

	 /* LCD Set I/O(3) output low */ 
	 reg = readw(ARMIO_LATCH_OUT); 
	 reg &= ~(1 << 3); 
	 reg |= (1 << 1); 
	 writew(reg, ARMIO_LATCH_OUT); 
 } 
 }}} 
 === osmocom-bb === 
  * Copyright Harald Welte and Steve Markgraf 
  * GPL License 
  * src/target/firmware/board/compal_e99/init.c 
 {{{ 
 static void board_io_init(void) 
 { 
	 uint16_t reg; 

	 reg = readw(ASIC_CONF_REG); 
	 /* LCD Set I/O(3) / SA0 to I/O(3) mode */ 
	 reg &= ~( (1 << 12) | (1 << 10) | (1 << 7) | (1 << 1)) ; 
	 /* don't set function pins to I2C Mode, C155 uses UWire */ 
	 /* TWL3025: Set SPI+RIF RX clock to rising edge */ 
	 reg |= (1 << 13) | (1 << 14); 
	 writew(reg, ASIC_CONF_REG); 

	 /* LCD Set I/O(3) to output mode and enable C155 backlight (IO1) */ 
	 /* FIXME: Put the display backlight control to backlight.c */ 
	 reg = readw(IO_CNTL_REG); 
	 reg &= ~( (1 << 3) | (1 << 1)); 
	 writew(reg, IO_CNTL_REG); 

	 /* LCD Set I/O(3) output low */ 
	 reg = readw(ARMIO_LATCH_OUT); 
	 reg &= ~(1 << 3); 
	 reg |= (1 << 1); 
	 writew(reg, ARMIO_LATCH_OUT); 
 } 
 }}} 
 == ostest/main.c == 
 === nuttx-bb === 
  * Copyright Gregory Nutt 
  * BSD License 
  * apps/examples/ostest/main.c 
  * Note: lights_on function used snippet code of OsmocomBB src/target/firmware/board/compal_e99/init.c 
 === osmocom-bb === 
  * nothing found 

 == calypso/calypso_armio.c == 
 === nuttx-bb === 
  * Copyright Stefan Richter 
  * BSD License 
  * nuttx/arch/arm/src/calypso/calypso_armio.c 
 === osmocom-bb === 
  * nothing found 

 == calypso/calypso_head.S == 
 === nuttx-bb === 
  * No copyright 
  * No License 
  * nuttx/arch/arm/src/calypso/calypso_head.S 
  * Note: this is same file as nuttx/arch/arm/src/chip/calypso_head.S 
 === osmocom-bb === 
  * nothing found 

 == calypso/calypso_irq.c == 
 === nuttx-bb === 
  * Copyright Harald Welte and Stefan Richter 
  * GPL License (need change to BSD) 
  * nuttx/arch/arm/src/calypso/calypso_irq.c 
 {{{ 
 static void _irq_enable(enum irq_nr nr, int enable) 
 { 
	 uint16_t *reg = IRQ_REG(MASK_IT_REG1); 
	 uint16_t val; 

	 if (nr > 15) { 
		 reg = IRQ_REG(MASK_IT_REG2); 
		 nr -= 16; 
	 } 

	 val = readw(reg); 
	 if (enable) 
		 val &= ~(1 << nr); 
	 else 
		 val |= (1 << nr); 
	 writew(val, reg); 
 } 
 }}} 
 === osmocom-bb === 
  * Copyright Harald Welte 
  * GPL License 
  * src/target/firmware/calypso/irq.c 
 {{{ 
 static void _irq_enable(enum irq_nr nr, int enable) 
 { 
	 uint16_t *reg = IRQ_REG(MASK_IT_REG1); 
	 uint16_t val; 

	 if (nr > 15) { 
		 reg = IRQ_REG(MASK_IT_REG2); 
		 nr -= 16; 
	 } 

	 val = readw(reg); 
	 if (enable) 
		 val &= ~(1 << nr); 
	 else 
		 val |= (1 << nr); 
	 writew(val, reg); 
 } 
 }}} 

 == calypso_keypad.c == 
 === nuttx-bb === 
  * Copyright Stefan Richter 
  * BSD License 
  * nuttx/arch/arm/src/calypso/calypso_keypad.c 
 === osmocom-bb === 
  * nothing found 

 == calypso_timer.c == 
 === nuttx-bb === 
  * Copyright Harald Welte and Stefan Richter 
  * GPL License (need change to BSD) 
  * nuttx/arch/arm/src/calypso/calypso_timer.c 
  * Note: verbatim copy from OsmocomBB calypso/timer.c 
 === osmocom-bb === 
  * Copyright Harald Welte 
  * GPL License 
  * src/target/firmware/calypso/timer.c 

 == init.c and calypso_heap.c == 
 === nuttx-bb === 
  * Copyright Stefan Richter 
  * BSD License 
  * nuttx/arch/arm/src/calypso/calypso_heap.c 
 {{{ 
 void up_addregion(void) 
 { 
 #ifdef CONFIG_ARCH_BOARD_COMPALE99 
         /* Disable watchdog in first non-common function */ 
         wdog_enable(0); 
 #endif 
         // XXX: change to initialization of extern memory with save defaults 
         /* Configure memory interface */ 
         calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0); 

         /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */ 
         calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2); 

         /* Configure the RHEA bridge with some sane default values */ 
         calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0); 
 } 

 }}} 
 === Osmocom-bb === 
  * GPL 
  * Copyright Harald Welte and Steve Markgraf 
  * src/target/firmware/board/compal_e99/init.c 
 {{{ 
 void board_init(void) 
 { 
         /* Disable watchdog (compal loader leaves it enabled) */ 
         wdog_enable(0); 

         /* Configure memory interface */ 
         calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1); 
         calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1); 
         calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0); 

         /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */ 
         calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2); 

         /* Configure the RHEA bridge with some sane default values */ 
         calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0); 

 }}} 
 == Relicensing permissions == 
  * [http://lists.osmocom.org/pipermail/baseband-devel/2012-February/002813.html Harald Welte] 
  * Ingo Albrecht: 
 By private mail 
 {{{ 
 I am open to relicensing and other such agreements. 
 }}} 
  * Stefan Richter: 
 By private mail 
 {{{ 
 Sure, go ahead. I don't mind which license but we agreed (I think) to 
 use the nuttx one. Mostly such that we can submit to upstream some day 
 if desired. 
 }}} 
  * Denis Carikli 
  * Alan Carvalho de Assis 

 == Listing authors by file == 
 {{{ 
 src/target/firmware/calypso/irq.c: 
 Author: Harald Welte <laforge@gnumonks.org> 

 src/target/firmware/calypso/timer.c: 
 Author: Harald Welte <laforge@gnumonks.org> 
 Author: Ingo Albrecht <prom@berlin.ccc.de> 

 src/target/firmware/calypso/clock.c: 
 Author: Harald Welte <laforge@gnumonks.org> 
 Author: Ingo Albrecht <prom@berlin.ccc.de> 
 Author: Steve Markgraf <steve@steve-m.de> 

 src/target/firmware/calypso/uart.c: 
 Author: Alex Badea <vamposdecampos@gmail.com> 
 Author: Christian Vogel <vogelchr@vogel.cx> 
 Author: Harald Welte <laforge@gnumonks.org> 
 Author: Ingo Albrecht <prom@berlin.ccc.de> 
 Author: Wolfram Sang <wolfram@the-dreams.de> 

 src/target/firmware/board/compal_e99/init.c: 
 Author: Harald Welte <laforge@gnumonks.org> 
 Author: Ingo Albrecht <prom@berlin.ccc.de> 
 Author: Steve Markgraf <steve@steve-m.de> 
 Author: Wolfram Sang <wolfram@the-dreams.de> 

 }}}
Add picture from clipboard (Maximum size: 48.8 MB)