From 22ed61f97815856bf74cec25ae6bca88bfbe5f44 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 22 Dec 2010 19:19:14 -0800 Subject: zpu: renamed the directory for the usrp2 fw to zpu to reflect the cpu type --- firmware/zpu/lib/nonstdio.h | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 firmware/zpu/lib/nonstdio.h (limited to 'firmware/zpu/lib/nonstdio.h') diff --git a/firmware/zpu/lib/nonstdio.h b/firmware/zpu/lib/nonstdio.h new file mode 100644 index 000000000..6aca7ed9a --- /dev/null +++ b/firmware/zpu/lib/nonstdio.h @@ -0,0 +1,50 @@ +// +// Copyright 2010 Ettus Research LLC +// +/* + * Copyright 2007 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef INCLUDED_NONSTDIO_H +#define INCLUDED_NONSTDIO_H + +#include +#include +#include + +void putstr(const char *s); // cf puts, no added newline +void puthex4(unsigned long x); // output 1 hex digit +void puthex8(unsigned long x); // output 2 hex digits +void puthex16(unsigned long x); // output 4 hex digits +void puthex32(unsigned long x); // output 8 hex digits +void puthex4_nl(unsigned long x); // ... followed by newline +void puthex8_nl(unsigned long x); +void puthex16_nl(unsigned long x); +void puthex32_nl(unsigned long x); +#define puthex puthex32 +#define puthex_nl puthex32_nl +void newline(); // putchar('\n') + +void print_mac_addr(const unsigned char addr[6]); +void print_uint64(uint64_t v); + +void print_buffer(uint32_t *buf, size_t n); +//char *itoa(signed long value, char *result, int base); +//void reverse(char s[]); + +void print_ip_addr(const void *t); + +#endif /* INCLUDED_NONSTDIO_H */ -- cgit v1.2.3 From e0005a2a00b49b1c6802fd7e78e8f92ff22a6bce Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 7 Jan 2011 11:51:31 -0800 Subject: usrp2: tweaking firmware added delay to the link up/down code to space out calls removed the pkt_ctrl init and just do it when the mode changes tweaked the addr printing --- firmware/zpu/apps/txrx_uhd.c | 19 +++++++--------- firmware/zpu/lib/nonstdio.h | 9 +++----- firmware/zpu/lib/pkt_ctrl.c | 49 ++++++++++++++++++------------------------ firmware/zpu/lib/pkt_ctrl.h | 3 --- firmware/zpu/lib/print_addrs.c | 9 ++++---- 5 files changed, 37 insertions(+), 52 deletions(-) (limited to 'firmware/zpu/lib/nonstdio.h') diff --git a/firmware/zpu/apps/txrx_uhd.c b/firmware/zpu/apps/txrx_uhd.c index cd66c18f1..3fcda8a4e 100644 --- a/firmware/zpu/apps/txrx_uhd.c +++ b/firmware/zpu/apps/txrx_uhd.c @@ -77,14 +77,14 @@ static void handle_udp_data_packet( sr_udp_sm->dsp0_port = (((uint32_t)dst.port) << 16) | src.port; printf("Storing for fast path:\n"); printf(" source mac addr: "); - print_mac_addr(fp_mac_addr_src.addr); newline(); + print_mac_addr(&fp_mac_addr_src); newline(); printf(" source ip addr: "); - print_ip_addr(&fp_socket_src.addr); newline(); + print_ip_addr(&fp_socket_src); newline(); printf(" source udp port: %d\n", fp_socket_src.port); printf(" destination mac addr: "); - print_mac_addr(fp_mac_addr_dst.addr); newline(); + print_mac_addr(&fp_mac_addr_dst); newline(); printf(" destination ip addr: "); - print_ip_addr(&fp_socket_dst.addr); newline(); + print_ip_addr(&fp_socket_dst); newline(); printf(" destination udp port: %d\n", fp_socket_dst.port); newline(); @@ -332,7 +332,6 @@ int main(void) { u2_init(); - pkt_ctrl_init(); //we do this to see if we should set a default ip addr or not #ifdef USRP2P @@ -344,9 +343,8 @@ main(void) } #endif - putstr("\nTxRx-NEWETH\n"); - print_mac_addr(ethernet_mac_addr()->addr); - newline(); + putstr("\nTxRx-UHD-ZPU\n"); + print_mac_addr(ethernet_mac_addr()); newline(); print_ip_addr(get_ip_addr()); newline(); printf("FPGA compatibility number: %d\n", USRP2_FPGA_COMPAT_NUM); printf("Firmware compatibility number: %d\n", USRP2_FW_COMPAT_NUM); @@ -364,9 +362,8 @@ main(void) register_udp_listener(USRP2_UDP_UPDATE_PORT, handle_udp_fw_update_packet); #endif - //3) set the routing mode to slave and send a garp + //3) set the routing mode to slave to set defaults pkt_ctrl_set_routing_mode(PKT_CTRL_ROUTING_MODE_SLAVE); - send_gratuitous_arp(); //4) setup ethernet hardware to bring the link up ethernet_register_link_changed_callback(link_changed_callback); @@ -390,7 +387,7 @@ main(void) } if (pending & PIC_OVERRUN_INT){ - pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt + pic_regs->pending = PIC_OVERRUN_INT; // clear interrupt putchar('O'); } } diff --git a/firmware/zpu/lib/nonstdio.h b/firmware/zpu/lib/nonstdio.h index 6aca7ed9a..2c4aeb961 100644 --- a/firmware/zpu/lib/nonstdio.h +++ b/firmware/zpu/lib/nonstdio.h @@ -38,13 +38,10 @@ void puthex32_nl(unsigned long x); #define puthex_nl puthex32_nl void newline(); // putchar('\n') -void print_mac_addr(const unsigned char addr[6]); -void print_uint64(uint64_t v); +void print_mac_addr(const void *addr); -void print_buffer(uint32_t *buf, size_t n); -//char *itoa(signed long value, char *result, int base); -//void reverse(char s[]); +void print_ip_addr(const void *addr); -void print_ip_addr(const void *t); +void print_buffer(uint32_t *buf, size_t n); #endif /* INCLUDED_NONSTDIO_H */ diff --git a/firmware/zpu/lib/pkt_ctrl.c b/firmware/zpu/lib/pkt_ctrl.c index df5851c35..341ad44e1 100644 --- a/firmware/zpu/lib/pkt_ctrl.c +++ b/firmware/zpu/lib/pkt_ctrl.c @@ -18,20 +18,7 @@ #include "pkt_ctrl.h" #include "memory_map.h" #include - -void pkt_ctrl_program_inspector( - const struct ip_addr *ip_addr, uint16_t data_port -){ - router_ctrl->ip_addr = ip_addr->addr; - router_ctrl->data_ports = data_port; -} - -void pkt_ctrl_set_routing_mode(pkt_ctrl_routing_mode_t mode){ - switch(mode){ - case PKT_CTRL_ROUTING_MODE_SLAVE: router_ctrl->mode_ctrl = 0; break; - case PKT_CTRL_ROUTING_MODE_MASTER: router_ctrl->mode_ctrl = 1; break; - } -} +#include //status signals from WB into PR #define CPU_STAT_RD_DONE (1 << 0) @@ -51,7 +38,22 @@ void pkt_ctrl_set_routing_mode(pkt_ctrl_routing_mode_t mode){ #define CPU_CTRL_WR_CLEAR (1 << 2) #define CPU_CTRL_WR_START (1 << 3) -static bool i_am_writing; +void pkt_ctrl_program_inspector( + const struct ip_addr *ip_addr, uint16_t data_port +){ + router_ctrl->ip_addr = ip_addr->addr; + router_ctrl->data_ports = data_port; +} + +void pkt_ctrl_set_routing_mode(pkt_ctrl_routing_mode_t mode){ + mdelay(100); //give a little delay to space out subsequent calls + switch(mode){ + case PKT_CTRL_ROUTING_MODE_SLAVE: router_ctrl->mode_ctrl = 0; break; + case PKT_CTRL_ROUTING_MODE_MASTER: router_ctrl->mode_ctrl = 1; break; + } + router_ctrl->iface_ctrl = CPU_CTRL_WR_CLEAR; //reset the write state machine + pkt_ctrl_release_incoming_buffer(); //reset the read state machine, and read +} static inline void cpu_stat_wait_for(int bm){ while((router_status->status & bm) == 0){ @@ -59,11 +61,6 @@ static inline void cpu_stat_wait_for(int bm){ } } -void pkt_ctrl_init(void){ - router_ctrl->iface_ctrl = CPU_CTRL_WR_CLEAR | CPU_CTRL_RD_START; - i_am_writing = false; -} - void *pkt_ctrl_claim_incoming_buffer(size_t *num_lines){ uint32_t status = router_status->status; @@ -74,7 +71,7 @@ void *pkt_ctrl_claim_incoming_buffer(size_t *num_lines){ } //if error: drop the packet and start a new read - else if (status & CPU_STAT_RD_EROR){ + if (status & CPU_STAT_RD_EROR){ putstr("E"); pkt_ctrl_release_incoming_buffer(); } @@ -91,12 +88,6 @@ void pkt_ctrl_release_incoming_buffer(void){ } void *pkt_ctrl_claim_outgoing_buffer(void){ - if (i_am_writing){ - //wait for the write to become done - cpu_stat_wait_for(CPU_STAT_WR_DONE); - router_ctrl->iface_ctrl = CPU_CTRL_WR_CLEAR; - i_am_writing = false; - } //wait for idle and return the buffer cpu_stat_wait_for(CPU_STAT_WR_IDLE); return ((uint32_t *) ROUTER_RAM_BASE); @@ -105,5 +96,7 @@ void *pkt_ctrl_claim_outgoing_buffer(void){ void pkt_ctrl_commit_outgoing_buffer(size_t num_lines){ //start a new write with the given length router_ctrl->iface_ctrl = ((num_lines & 0xffff) << 16) | CPU_CTRL_WR_START; - i_am_writing = true; + //wait for the write to become done + cpu_stat_wait_for(CPU_STAT_WR_DONE); + router_ctrl->iface_ctrl = CPU_CTRL_WR_CLEAR; } diff --git a/firmware/zpu/lib/pkt_ctrl.h b/firmware/zpu/lib/pkt_ctrl.h index 06b81538d..410ffdaa4 100644 --- a/firmware/zpu/lib/pkt_ctrl.h +++ b/firmware/zpu/lib/pkt_ctrl.h @@ -23,9 +23,6 @@ #include #include -//! Initialize the packet router into a good state -void pkt_ctrl_init(void); - typedef enum { PKT_CTRL_ROUTING_MODE_SLAVE, PKT_CTRL_ROUTING_MODE_MASTER, diff --git a/firmware/zpu/lib/print_addrs.c b/firmware/zpu/lib/print_addrs.c index 29601c47c..fa2a49fc3 100644 --- a/firmware/zpu/lib/print_addrs.c +++ b/firmware/zpu/lib/print_addrs.c @@ -18,15 +18,16 @@ #include "nonstdio.h" void -print_mac_addr(const unsigned char addr[6]) +print_mac_addr(const void *addr) { + uint8_t *p = (uint8_t *)addr; for(size_t i = 0; i < 6; i++){ if(i) putchar(':'); - puthex8(addr[i]); + puthex8(p[i]); } } -void print_ip_addr(const void *t){ - uint8_t *p = (uint8_t *)t; +void print_ip_addr(const void *addr){ + uint8_t *p = (uint8_t *)addr; printf("%d.%d.%d.%d", p[0], p[1], p[2], p[3]); } -- cgit v1.2.3 From b61cdb8dde9938ffa4ffabc639807e3df6df2621 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 13 Jan 2011 16:34:13 -0800 Subject: usrp2: update copyright dates on firmware code --- firmware/zpu/lib/arp_cache.c | 2 +- firmware/zpu/lib/arp_cache.h | 2 +- firmware/zpu/lib/banal.c | 2 +- firmware/zpu/lib/banal.h | 2 +- firmware/zpu/lib/eth_addrs.c | 2 +- firmware/zpu/lib/ethertype.h | 2 +- firmware/zpu/lib/net/eth_mac_addr.h | 2 +- firmware/zpu/lib/nonstdio.h | 2 +- firmware/zpu/usrp2/sd.c | 2 +- firmware/zpu/usrp2/sd.h | 2 +- firmware/zpu/usrp2p/bootconfig.h | 2 +- firmware/zpu/usrp2p/bootloader/fpga_bootloader.c | 2 +- firmware/zpu/usrp2p/bootloader/fw_bootloader.c | 2 +- firmware/zpu/usrp2p/bootloader/init_bootloader.c | 2 +- firmware/zpu/usrp2p/bootloader/serial_loader_burner.c | 2 +- firmware/zpu/usrp2p/bootloader/spi_bootloader.c | 2 +- firmware/zpu/usrp2p/spi_flash.c | 2 +- firmware/zpu/usrp2p/spi_flash.h | 2 +- firmware/zpu/usrp2p/spi_flash_private.h | 2 +- firmware/zpu/usrp2p/spi_flash_read.c | 2 +- firmware/zpu/usrp2p/spif.c | 2 +- firmware/zpu/usrp2p/xilinx_s3_icap.c | 2 +- firmware/zpu/usrp2p/xilinx_s3_icap.h | 2 +- fix-copyright-years | 15 ++++++++++----- 24 files changed, 33 insertions(+), 28 deletions(-) (limited to 'firmware/zpu/lib/nonstdio.h') diff --git a/firmware/zpu/lib/arp_cache.c b/firmware/zpu/lib/arp_cache.c index 9c586fa6b..8e14d8f17 100644 --- a/firmware/zpu/lib/arp_cache.c +++ b/firmware/zpu/lib/arp_cache.c @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/lib/arp_cache.h b/firmware/zpu/lib/arp_cache.h index 8e84a1f94..e0e125d89 100644 --- a/firmware/zpu/lib/arp_cache.h +++ b/firmware/zpu/lib/arp_cache.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/lib/banal.c b/firmware/zpu/lib/banal.c index 42937957f..dfb8df355 100644 --- a/firmware/zpu/lib/banal.c +++ b/firmware/zpu/lib/banal.c @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/lib/banal.h b/firmware/zpu/lib/banal.h index eb7ed509a..e9e55bca5 100644 --- a/firmware/zpu/lib/banal.h +++ b/firmware/zpu/lib/banal.h @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/lib/eth_addrs.c b/firmware/zpu/lib/eth_addrs.c index fc35a3c9b..c45ce7559 100644 --- a/firmware/zpu/lib/eth_addrs.c +++ b/firmware/zpu/lib/eth_addrs.c @@ -1,5 +1,5 @@ /* - * Copyright 2010 Ettus Research LLC + * Copyright 2010-2011 Ettus Research LLC * Copyright 2007 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify diff --git a/firmware/zpu/lib/ethertype.h b/firmware/zpu/lib/ethertype.h index 11f4bafec..235981193 100644 --- a/firmware/zpu/lib/ethertype.h +++ b/firmware/zpu/lib/ethertype.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/lib/net/eth_mac_addr.h b/firmware/zpu/lib/net/eth_mac_addr.h index b44fb68f7..01bf91988 100644 --- a/firmware/zpu/lib/net/eth_mac_addr.h +++ b/firmware/zpu/lib/net/eth_mac_addr.h @@ -1,5 +1,5 @@ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/lib/nonstdio.h b/firmware/zpu/lib/nonstdio.h index 2c4aeb961..a47a6df6e 100644 --- a/firmware/zpu/lib/nonstdio.h +++ b/firmware/zpu/lib/nonstdio.h @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 Ettus Research LLC // /* * Copyright 2007 Free Software Foundation, Inc. diff --git a/firmware/zpu/usrp2/sd.c b/firmware/zpu/usrp2/sd.c index d000b28ae..d634baea8 100644 --- a/firmware/zpu/usrp2/sd.c +++ b/firmware/zpu/usrp2/sd.c @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2008 Ettus Research LLC + * Copyright 2008-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2/sd.h b/firmware/zpu/usrp2/sd.h index e2d0ae38e..e4b4aae8b 100644 --- a/firmware/zpu/usrp2/sd.h +++ b/firmware/zpu/usrp2/sd.h @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2008 Ettus Research LLC + * Copyright 2008-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/bootconfig.h b/firmware/zpu/usrp2p/bootconfig.h index 35c2726ed..b64834d22 100644 --- a/firmware/zpu/usrp2p/bootconfig.h +++ b/firmware/zpu/usrp2p/bootconfig.h @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This file is part of GNU Radio * diff --git a/firmware/zpu/usrp2p/bootloader/fpga_bootloader.c b/firmware/zpu/usrp2p/bootloader/fpga_bootloader.c index 9feff6ecd..f5a71a8bb 100644 --- a/firmware/zpu/usrp2p/bootloader/fpga_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/fpga_bootloader.c @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/bootloader/fw_bootloader.c b/firmware/zpu/usrp2p/bootloader/fw_bootloader.c index a2c32bf8e..de561cf22 100644 --- a/firmware/zpu/usrp2p/bootloader/fw_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/fw_bootloader.c @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/bootloader/init_bootloader.c b/firmware/zpu/usrp2p/bootloader/init_bootloader.c index e960fe474..f8b432c46 100644 --- a/firmware/zpu/usrp2p/bootloader/init_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/init_bootloader.c @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Ettus Research LLC + * Copyright 2010-2011 Ettus Research LLC * */ diff --git a/firmware/zpu/usrp2p/bootloader/serial_loader_burner.c b/firmware/zpu/usrp2p/bootloader/serial_loader_burner.c index 4ac4df454..6d5d135ab 100644 --- a/firmware/zpu/usrp2p/bootloader/serial_loader_burner.c +++ b/firmware/zpu/usrp2p/bootloader/serial_loader_burner.c @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/bootloader/spi_bootloader.c b/firmware/zpu/usrp2p/bootloader/spi_bootloader.c index 678e66cf7..3e66d41cb 100644 --- a/firmware/zpu/usrp2p/bootloader/spi_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/spi_bootloader.c @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/spi_flash.c b/firmware/zpu/usrp2p/spi_flash.c index 09b74a513..25fc239be 100644 --- a/firmware/zpu/usrp2p/spi_flash.c +++ b/firmware/zpu/usrp2p/spi_flash.c @@ -1,7 +1,7 @@ /* -*- c++ -*- */ /* * Copyright 2009 Free Software Foundation, Inc. - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/spi_flash.h b/firmware/zpu/usrp2p/spi_flash.h index 9a04df86b..a10533e08 100644 --- a/firmware/zpu/usrp2p/spi_flash.h +++ b/firmware/zpu/usrp2p/spi_flash.h @@ -1,7 +1,7 @@ /* -*- c -*- */ /* * Copyright 2009 Free Software Foundation, Inc. - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/spi_flash_private.h b/firmware/zpu/usrp2p/spi_flash_private.h index 9a1b8d3e3..6bf06fda8 100644 --- a/firmware/zpu/usrp2p/spi_flash_private.h +++ b/firmware/zpu/usrp2p/spi_flash_private.h @@ -1,7 +1,7 @@ /* -*- c++ -*- */ /* * Copyright 2009 Free Software Foundation, Inc. - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/spi_flash_read.c b/firmware/zpu/usrp2p/spi_flash_read.c index 47a79e7d1..fffc2a671 100644 --- a/firmware/zpu/usrp2p/spi_flash_read.c +++ b/firmware/zpu/usrp2p/spi_flash_read.c @@ -1,7 +1,7 @@ /* -*- c++ -*- */ /* * Copyright 2009 Free Software Foundation, Inc. - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/spif.c b/firmware/zpu/usrp2p/spif.c index 1c1a348f4..91da73155 100644 --- a/firmware/zpu/usrp2p/spif.c +++ b/firmware/zpu/usrp2p/spif.c @@ -1,6 +1,6 @@ /* * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/xilinx_s3_icap.c b/firmware/zpu/usrp2p/xilinx_s3_icap.c index 50c85231c..8995aa23d 100644 --- a/firmware/zpu/usrp2p/xilinx_s3_icap.c +++ b/firmware/zpu/usrp2p/xilinx_s3_icap.c @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/firmware/zpu/usrp2p/xilinx_s3_icap.h b/firmware/zpu/usrp2p/xilinx_s3_icap.h index 7b7e9eccc..d4238eee9 100644 --- a/firmware/zpu/usrp2p/xilinx_s3_icap.h +++ b/firmware/zpu/usrp2p/xilinx_s3_icap.h @@ -1,6 +1,6 @@ /* -*- c -*- */ /* - * Copyright 2009 Ettus Research LLC + * Copyright 2009-2011 Ettus Research LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/fix-copyright-years b/fix-copyright-years index c6ee16a21..97630041b 100755 --- a/fix-copyright-years +++ b/fix-copyright-years @@ -1,7 +1,7 @@ #!/usr/bin/env python import re -import sys +import optparse import datetime import subprocess import multiprocessing @@ -15,7 +15,7 @@ def get_co_line(lines): if co_line_matcher.match(line): return line, i return None, None -def fix_co_years(files): +def fix_co_years(files, keep_years): for file in files: print file lines = open(file).readlines() @@ -41,6 +41,9 @@ def fix_co_years(files): print ' format error on line %d: "%s"'%(num, line), e continue + #keep years means log years is a superset + if keep_years: log_years = min(co_years+log_years), max(co_years+log_years) + if log_years != co_years: print ' log years: %s != copyright years: %s'%(log_years, co_years) year_now = datetime.datetime.now().year @@ -51,15 +54,17 @@ def fix_co_years(files): open(file, 'w').write(new_text) if __name__ == "__main__": - if len(sys.argv) < 2: print "Usage: %s path/"%sys.argv[0]; exit() + parser = optparse.OptionParser(usage="usage: %prog [options] path") + parser.add_option("-k", "--keep", action="store_true", help="keep copyright years", default=False) + (options, args) = parser.parse_args() #get recursive list of files in the repo - files = command('git', 'ls-tree', '--name-only', 'HEAD', '-r', sys.argv[1]).splitlines() + files = command('git', 'ls-tree', '--name-only', 'HEAD', '-r', args[0]).splitlines() #start n+1 processes to handle the files num_procs = multiprocessing.cpu_count() procs = [multiprocessing.Process( - target=lambda *files: fix_co_years(files), + target=lambda *files: fix_co_years(files, keep_years=options.keep), args=files[num::num_procs], ) for num in range(num_procs)] map(multiprocessing.Process.start, procs) -- cgit v1.2.3