[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6966 - in usrp2/branches/developers/eb/u2-eb/firmware
From: |
eb |
Subject: |
[Commit-gnuradio] r6966 - in usrp2/branches/developers/eb/u2-eb/firmware: . apps lib |
Date: |
Fri, 16 Nov 2007 12:51:35 -0700 (MST) |
Author: eb
Date: 2007-11-16 12:51:28 -0700 (Fri, 16 Nov 2007)
New Revision: 6966
Added:
usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.c
usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.h
Modified:
usrp2/branches/developers/eb/u2-eb/firmware/Makefile.common
usrp2/branches/developers/eb/u2-eb/firmware/apps/blink_leds2.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/buf_ram_test.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/eth.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/eth_test.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/gen_eth_packets.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/hello.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_rx_test.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_tx_test.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/rcv_eth_packets.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/test1.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/test_phy_comm.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/test_printf.c
usrp2/branches/developers/eb/u2-eb/firmware/apps/timer_test.c
usrp2/branches/developers/eb/u2-eb/firmware/bootstrap
usrp2/branches/developers/eb/u2-eb/firmware/lib/Makefile.am
usrp2/branches/developers/eb/u2-eb/firmware/lib/eth_driver.c
usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.c
usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.h
usrp2/branches/developers/eb/u2-eb/firmware/lib/pic.c
usrp2/branches/developers/eb/u2-eb/firmware/lib/printf.c
usrp2/branches/developers/eb/u2-eb/firmware/lib/stdio.h
Log:
renamed hal_put* to put*
Modified: usrp2/branches/developers/eb/u2-eb/firmware/Makefile.common
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/Makefile.common 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/Makefile.common 2007-11-16
19:51:28 UTC (rev 6966)
@@ -23,10 +23,10 @@
AM_CPPFLAGS = $(HAL_IO) $(STD_INCLUDES)
-STD_CFLAGS = -Wall -O2 -g -mxl-soft-div -msoft-float
+STD_CFLAGS = -O2 -g -Wall -Werror-implicit-function-declaration -mxl-soft-div
-msoft-float
-#AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul
-AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul -mxl-barrel-shift
+AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul
+#AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul -mxl-barrel-shift
#AM_CFLAGS = $(STD_CFLAGS) -mno-xl-soft-mul
#AM_CFLAGS = $(STD_CFLAGS) -mno-xl-soft-mul -mxl-barrel-shift
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/blink_leds2.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/blink_leds2.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/blink_leds2.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -41,7 +41,7 @@
{
u2_init();
- //hal_puts("Setting up timer\n");
+ //putstr("Setting up timer\n");
pic_register_handler(IRQ_TIMER, timer_handler);
hal_set_timeout(DELTA_T); // schedule next timeout
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/buf_ram_test.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/buf_ram_test.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/buf_ram_test.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -17,13 +17,13 @@
#include "u2_init.h"
#include "memory_map.h"
-#include "hal_io.h"
#include "eth_driver.h"
#include "eth_mac.h"
#include "pic.h"
#include "bool.h"
+#include "nonstdio.h"
+#include "hal_io.h"
-
// Delay about one millisecond.
//
// Need 33,333 cycles at 33 MHz.
@@ -79,14 +79,14 @@
for (i = 0; i < BUFFER_POOL_BUFFER_SIZE; i++, counter++){
int rd = p[i];
if (rd != counter){
- hal_putc('b');
- hal_putc(n + '0');
- hal_putc('[');
- hal_puthex16(i);
- hal_puts("] exp: ");
- hal_puthex32(counter);
- hal_puts(" got: ");
- hal_puthex32_nl(rd);
+ putchar('b');
+ putchar(n + '0');
+ putchar('[');
+ puthex16(i);
+ putstr("] exp: ");
+ puthex32(counter);
+ putstr(" got: ");
+ puthex32_nl(rd);
nerrors++;
}
}
@@ -117,11 +117,11 @@
if (nerrors == 0){
output_regs->leds = 0x3; // leds on -> PASS
- hal_puts("PASS\n");
+ putstr("PASS\n");
}
else {
output_regs->leds = 0x0; // leds off -> FAIL
- hal_puts("FAIL\n");
+ putstr("FAIL\n");
}
hal_finish();
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/eth.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/eth.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/eth.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -16,14 +16,14 @@
for(i=0;i<BUFFER_SIZE;i++)
buf[i] = i;
- hal_puts("Filled buffer 0\n");
+ putstr("Filled buffer 0\n");
// Write to buffer 1
int *buffer = (int *)(BUFFER_BASE + BUFFER_1);
for(i=0;i<BUFFER_SIZE;i++)
buf[i] = i + ((i^0xFFFF) << 16);
- hal_puts("Filled buffer 1\n");
+ putstr("Filled buffer 1\n");
// Control LEDs
while(1) {
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/eth_test.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/eth_test.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/eth_test.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -3,6 +3,7 @@
#include "spi.h"
#include "hal_io.h"
#include "buffer_pool.h"
+#include "nonstdio.h"
// Globals
#define EMPTY 0
@@ -36,19 +37,19 @@
volatile unsigned int *buffer1 = buffer_ram(1);
- hal_puts("Starting to fill in RAM\n");
+ putstr("Starting to fill in RAM\n");
for(i=0;i<512;i++)
buffer0[i] = ((437+i)<<16) + 5395-i;
- hal_puts("Filled in RAM\n");
+ putstr("Filled in RAM\n");
// Set up receive buffer
bp_receive_to_buf(1, 2, 1, 0, 511); // Fill from ethernet
- hal_puts("Set up RX buffer\n");
+ putstr("Set up RX buffer\n");
// Set up send buffer
bp_send_from_buf(0, 2, 1, 0, 20);
- hal_puts("Set up TX Buffer\n");
+ putstr("Set up TX Buffer\n");
while (buffer_pool_status->status != (BPS_DONE_0 | BPS_DONE_1))
;
@@ -56,12 +57,12 @@
bp_clear_buf(0);
bp_clear_buf(1);
- hal_puts("Both are done\n");
+ putstr("Both are done\n");
// Send a bunch, let them pile up in FIFO
bp_send_from_buf(0, 2, 1, 21, 80); wait_until_status_nonzero();
bp_clear_buf(0);
- hal_puts("First add'l TX done\n");
+ putstr("First add'l TX done\n");
bp_send_from_buf(0, 2, 1, 81, 288); wait_until_status_nonzero();
bp_clear_buf(0);
bp_send_from_buf(0, 2, 1, 289, 292); wait_until_status_nonzero();
@@ -72,11 +73,11 @@
bp_clear_buf(0);
bp_send_from_buf(0, 2, 1, 400, 511); wait_until_status_nonzero();
bp_clear_buf(0);
- hal_puts("All add'l TX done\n");
+ putstr("All add'l TX done\n");
bp_receive_to_buf(1, 2, 1, 21, 80); wait_until_status_nonzero();
bp_clear_buf(1);
- hal_puts("First add'l RX done\n");
+ putstr("First add'l RX done\n");
bp_receive_to_buf(1, 2, 1, 81, 288); wait_until_status_nonzero();
bp_clear_buf(1);
bp_receive_to_buf(1, 2, 1, 289, 292); wait_until_status_nonzero();
@@ -87,20 +88,20 @@
bp_clear_buf(1);
bp_receive_to_buf(1, 2, 1, 400, 511); wait_until_status_nonzero();
bp_clear_buf(1);
- hal_puts("All add'l RX done\n");
+ putstr("All add'l RX done\n");
for(i=0;i<512;i++)
if(buffer0[i] != buffer1[i]) {
- hal_puts("ERROR at location: ");
- hal_puthex_nl(i);
- hal_puts("Value sent: ");
- hal_puthex_nl(buffer0[i]);
- hal_puts("Value rcvd: ");
- hal_puthex_nl(buffer1[i]);
+ putstr("ERROR at location: ");
+ puthex_nl(i);
+ putstr("Value sent: ");
+ puthex_nl(buffer0[i]);
+ putstr("Value rcvd: ");
+ puthex_nl(buffer1[i]);
//break;
}
- hal_puts("Done Testing\n");
+ putstr("Done Testing\n");
hal_finish();
return 1;
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/gen_eth_packets.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/gen_eth_packets.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/gen_eth_packets.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -24,6 +24,7 @@
#include "bool.h"
#include "eth_driver.h"
#include "eth_mac.h"
+#include "nonstdio.h"
typedef int intptr_t;
typedef unsigned size_t;
@@ -110,8 +111,8 @@
hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */
- hal_puts("\neth link changed: speed = ");
- hal_puthex16_nl(speed);
+ putstr("\neth link changed: speed = ");
+ puthex16_nl(speed);
}
void
@@ -194,7 +195,7 @@
hal_gpio_set_tx_mode(15, 0, GPIOM_FPGA_0);
hal_gpio_set_rx_mode(15, 0, GPIOM_FPGA_0); // no printing...
- hal_puts("\ngen_eth_packets\n");
+ putstr("\ngen_eth_packets\n");
// Control LEDs
output_regs->leds = 0x00;
@@ -268,7 +269,7 @@
else
serdes_tx_idle = 1;
}
- hal_puts("Int Proc'ed 0\n");
+ putstr("Int Proc'ed 0\n");
}
if(localstatus & BPS_DONE_1) {
bp_clear_buf(1);
@@ -300,7 +301,7 @@
else
serdes_tx_idle = 1;
}
- hal_puts("Int Proc'ed 1\n");
+ putstr("Int Proc'ed 1\n");
}
if(localstatus & BPS_DONE_2) {
bp_clear_buf(2);
@@ -332,7 +333,7 @@
else
dsp_tx_idle = 1;
}
- hal_puts("Int Proc'ed 2\n");
+ putstr("Int Proc'ed 2\n");
}
if(localstatus & BPS_DONE_3) {
bp_clear_buf(3);
@@ -364,7 +365,7 @@
else
dsp_tx_idle = 1;
}
- hal_puts("Int Proc'ed 3\n");
+ putstr("Int Proc'ed 3\n");
}
}
#endif
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/hello.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/hello.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/hello.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -16,14 +16,15 @@
*/
#include "u2_init.h"
-#include "hal_io.h"
+#include "stdio.h"
int
main(void)
{
u2_init();
- hal_puts("Hello World\n");
+ puts("Hello World");
+ puts("Goodbye World");
return 0;
}
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_rx_test.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_rx_test.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_rx_test.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -3,6 +3,7 @@
#include "spi.h"
#include "hal_io.h"
#include "buffer_pool.h"
+#include "nonstdio.h"
#define PORT 2 // ethernet = 2, serdes = 0
int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf;
@@ -35,7 +36,7 @@
volatile unsigned int *buffer1 = buffer_ram(1);
volatile unsigned int *buffer2 = buffer_ram(2);
- hal_puts("Starting RX\n");
+ putstr("Starting RX\n");
bp_clear_buf(0);
bp_receive_to_buf(0, 1, 1, 0, 99);
@@ -58,24 +59,24 @@
;
for(i=0;i<100;i++) {
- hal_puthex(i);
- hal_puts(" ");
- hal_puthex_nl(buffer0[i]);
+ puthex(i);
+ putstr(" ");
+ puthex_nl(buffer0[i]);
}
for(i=0;i<60;i++) {
- hal_puthex(i);
- hal_puts(" ");
- hal_puthex_nl(buffer1[i]);
+ puthex(i);
+ putstr(" ");
+ puthex_nl(buffer1[i]);
}
for(i=0;i<60;i++) {
- hal_puthex(i);
- hal_puts(" ");
- hal_puthex_nl(buffer2[i]);
+ puthex(i);
+ putstr(" ");
+ puthex_nl(buffer2[i]);
}
//while(timer_regs -> time < 0x6000)
// {}
- hal_puts("Done\n");
+ putstr("Done\n");
hal_finish();
return 1;
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_tx_test.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_tx_test.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/ibs_tx_test.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -3,6 +3,7 @@
#include "spi.h"
#include "hal_io.h"
#include "buffer_pool.h"
+#include "nonstdio.h"
// Globals
#define EMPTY 0
@@ -40,10 +41,10 @@
volatile unsigned int *buffer1 = buffer_ram(1);
- hal_puts("Starting to fill in RAM\n");
+ putstr("Starting to fill in RAM\n");
for(i=0;i<512;i++)
buffer0[i] = i;
- hal_puts("Filled in RAM\n");
+ putstr("Filled in RAM\n");
buffer0[0] = 7; // start and end of buffer, send immediately
buffer0[1] = 0x0000; // start time
@@ -105,7 +106,7 @@
while(timer_regs -> time < 0xa000)
{}
- hal_puts("Done\n");
+ putstr("Done\n");
while(1)
{}
@@ -114,7 +115,7 @@
// Send a bunch, let them pile up in FIFO
bp_send_from_buf(0, 2, 1, 21, 80); wait_until_status_nonzero();
bp_clear_buf(0);
- hal_puts("First add'l TX done\n");
+ putstr("First add'l TX done\n");
bp_send_from_buf(0, 2, 1, 81, 288); wait_until_status_nonzero();
bp_clear_buf(0);
bp_send_from_buf(0, 2, 1, 289, 292); wait_until_status_nonzero();
@@ -125,11 +126,11 @@
bp_clear_buf(0);
bp_send_from_buf(0, 2, 1, 400, 511); wait_until_status_nonzero();
bp_clear_buf(0);
- hal_puts("All add'l TX done\n");
+ putstr("All add'l TX done\n");
bp_receive_to_buf(1, 2, 1, 21, 80); wait_until_status_nonzero();
bp_clear_buf(1);
- hal_puts("First add'l RX done\n");
+ putstr("First add'l RX done\n");
bp_receive_to_buf(1, 2, 1, 81, 288); wait_until_status_nonzero();
bp_clear_buf(1);
bp_receive_to_buf(1, 2, 1, 289, 292); wait_until_status_nonzero();
@@ -140,20 +141,20 @@
bp_clear_buf(1);
bp_receive_to_buf(1, 2, 1, 400, 511); wait_until_status_nonzero();
bp_clear_buf(1);
- hal_puts("All add'l RX done\n");
+ putstr("All add'l RX done\n");
for(i=0;i<512;i++)
if(buffer0[i] != buffer1[i]) {
- hal_puts("ERROR at location: ");
- hal_puthex_nl(i);
- hal_puts("Value sent: ");
- hal_puthex_nl(buffer0[i]);
- hal_puts("Value rcvd: ");
- hal_puthex_nl(buffer1[i]);
+ putstr("ERROR at location: ");
+ puthex_nl(i);
+ putstr("Value sent: ");
+ puthex_nl(buffer0[i]);
+ putstr("Value rcvd: ");
+ puthex_nl(buffer1[i]);
//break;
}
- hal_puts("Done Testing\n");
+ putstr("Done Testing\n");
hal_finish();
return 1;
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/rcv_eth_packets.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/rcv_eth_packets.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/rcv_eth_packets.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -24,7 +24,9 @@
#include "bool.h"
#include "eth_driver.h"
#include "eth_mac.h"
+#include "nonstdio.h"
+
typedef int intptr_t;
typedef unsigned size_t;
void exit(int status);
@@ -110,8 +112,8 @@
hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */
- hal_puts("\neth link changed: speed = ");
- hal_puthex16_nl(speed);
+ putstr("\neth link changed: speed = ");
+ puthex16_nl(speed);
}
void
@@ -200,12 +202,12 @@
void
print_mac_addr(const char *addr) /* 6-bytes */
{
- hal_puthex8(addr[0]); hal_putc(':');
- hal_puthex8(addr[1]); hal_putc(':');
- hal_puthex8(addr[2]); hal_putc(':');
- hal_puthex8(addr[3]); hal_putc(':');
- hal_puthex8(addr[4]); hal_putc(':');
- hal_puthex8(addr[5]);
+ puthex8(addr[0]); putchar(':');
+ puthex8(addr[1]); putchar(':');
+ puthex8(addr[2]); putchar(':');
+ puthex8(addr[3]); putchar(':');
+ puthex8(addr[4]); putchar(':');
+ puthex8(addr[5]);
}
@@ -223,7 +225,7 @@
// setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output
hal_gpio_set_tx_mode(15, 0, GPIOM_FPGA_1);
- hal_puts("\nrcv_eth_packets\n");
+ putstr("\nrcv_eth_packets\n");
init_packets();
@@ -257,22 +259,22 @@
// copy to stack buffer so we can byte address it
memcpy_wordaligned(&pkt, (void *)buffer_ram(2), sizeof(pkt));
- hal_puts("Rx: src: ");
+ putstr("Rx: src: ");
print_mac_addr(pkt.ehdr.dst_addr);
- hal_puts(" dst: ");
+ putstr(" dst: ");
print_mac_addr(pkt.ehdr.src_addr);
- hal_puts(" ethtype: ");
- hal_puthex16(pkt.ehdr.ethertype);
- hal_puts(" len: ");
+ putstr(" ethtype: ");
+ puthex16(pkt.ehdr.ethertype);
+ putstr(" len: ");
int len = (buffer_pool_status->last_line[2] + 1) * 4;
- hal_puthex16_nl(len);
+ puthex16_nl(len);
#else
volatile int *bp = buffer_ram(2);
int i;
for (i = 0; i < 16; i++){
- hal_puthex8(i);
- hal_putc(':');
- hal_puthex32_nl(bp[i]);
+ puthex8(i);
+ putchar(':');
+ puthex32_nl(bp[i]);
}
#endif
@@ -333,7 +335,7 @@
else
serdes_tx_idle = 1;
}
- hal_puts("Int Proc'ed 0\n");
+ putstr("Int Proc'ed 0\n");
}
if(localstatus & BPS_DONE_1) {
bp_clear_buf(1);
@@ -365,7 +367,7 @@
else
serdes_tx_idle = 1;
}
- hal_puts("Int Proc'ed 1\n");
+ putstr("Int Proc'ed 1\n");
}
if(localstatus & BPS_DONE_2) {
bp_clear_buf(2);
@@ -397,7 +399,7 @@
else
dsp_tx_idle = 1;
}
- hal_puts("Int Proc'ed 2\n");
+ putstr("Int Proc'ed 2\n");
}
if(localstatus & BPS_DONE_3) {
bp_clear_buf(3);
@@ -429,7 +431,7 @@
else
dsp_tx_idle = 1;
}
- hal_puts("Int Proc'ed 3\n");
+ putstr("Int Proc'ed 3\n");
}
}
#endif
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/test1.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/test1.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/test1.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -4,6 +4,7 @@
#include "hal_io.h"
#include "buffer_pool.h"
#include "pic.h"
+#include "nonstdio.h"
// Globals
#define EMPTY 0
@@ -65,7 +66,7 @@
bp_receive_to_buf(0, 1, 1, 10, 509); // DSP_RX to buffer 0, use 500 lines
//dsp_rx_regs->run_rx = 1; // Start DSP_RX
- hal_puts("Done DSP RX setup\n");
+ putstr("Done DSP RX setup\n");
// Set up serdes RX
buffer_state[2] = FILLING;
@@ -75,7 +76,7 @@
while (buffer_pool_status->status == 0) // wait for completion of DSP RX
;
- hal_puts("Done DSP TX setup\n");
+ putstr("Done DSP TX setup\n");
//dsp_tx_regs->run_tx = 1;
// register interrupt handler
@@ -121,7 +122,7 @@
else
serdes_tx_idle = 1;
}
- hal_puts("Int Proc'ed 0\n");
+ putstr("Int Proc'ed 0\n");
}
if(localstatus & BPS_DONE_1) {
bp_clear_buf(1);
@@ -153,7 +154,7 @@
else
serdes_tx_idle = 1;
}
- hal_puts("Int Proc'ed 1\n");
+ putstr("Int Proc'ed 1\n");
}
if(localstatus & BPS_DONE_2) {
bp_clear_buf(2);
@@ -185,7 +186,7 @@
else
dsp_tx_idle = 1;
}
- hal_puts("Int Proc'ed 2\n");
+ putstr("Int Proc'ed 2\n");
}
if(localstatus & BPS_DONE_3) {
bp_clear_buf(3);
@@ -217,7 +218,7 @@
else
dsp_tx_idle = 1;
}
- hal_puts("Int Proc'ed 3\n");
+ putstr("Int Proc'ed 3\n");
}
}
@@ -236,47 +237,47 @@
#if 0
// Write to buffer 0
int *buf = (int *)(BUFFER_BASE + BUFFER_0);
- hal_puthex_nl((int)buf);
+ puthex_nl((int)buf);
for(i=0;i<BUFFER_SIZE;i++)
buf[i] = i;
- hal_puts("Filled buffer 0\n");
+ putstr("Filled buffer 0\n");
// Write to buffer 1
buf = (int *)(BUFFER_BASE + BUFFER_1);
- hal_puthex_nl((int)buf);
+ puthex_nl((int)buf);
for(i=0;i<BUFFER_SIZE;i++)
buf[i] = i + ((i^0xFFFF) << 16);
- hal_puts("Filled buffer 1\n");
+ putstr("Filled buffer 1\n");
#endif
#if 0
// rx SERDES into buffer #2 (buf,port,step,fl,ll)
bp_receive_to_buf(2, 0, 1, 10, 300);
- hal_puts("SERDES RX buffer setup\n");
+ putstr("SERDES RX buffer setup\n");
// send SERDES from buffer #0 (buf,port,step,fl,ll)
bp_send_from_buf(0, 0, 1, 20, 200);
- hal_puts("SERDES TX buffer setup\n");
+ putstr("SERDES TX buffer setup\n");
#endif
#if 0
// send to DACs from buffer #1
bp_send_from_buf(1 /*buf#*/, 1 /*port*/, 1 /*step*/, 20 /*fl*/, 250 /*ll*/);
- hal_puts("DAC Buffer setup\n");
+ putstr("DAC Buffer setup\n");
#endif
#if 0
- //hal_puts("ENTER INT\n");
+ //putstr("ENTER INT\n");
for(i=0;i<8;i++)
if(*status & (1<<i)) {
- //hal_puts("Clearing buf ");
- hal_puthex_nl(i);
+ //putstr("Clearing buf ");
+ puthex_nl(i);
bp_clear_buf(i);
}
- //hal_puts("EXIT INT\n");
+ //putstr("EXIT INT\n");
#endif
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/test_phy_comm.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/test_phy_comm.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/test_phy_comm.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -23,6 +23,7 @@
#include "eth_driver.h"
#include "eth_mac.h"
#include "pic.h"
+#include "nonstdio.h"
#define DELTA_T 12500000 // .125s (10ns per tick)
@@ -68,8 +69,8 @@
hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */
- hal_puts("\neth link changed: speed = ");
- hal_puthex_nl(speed);
+ putstr("\neth link changed: speed = ");
+ puthex_nl(speed);
}
void
@@ -86,7 +87,7 @@
{
u2_init();
- hal_puts("\n test_phy_comm\n");
+ putstr("\n test_phy_comm\n");
pic_register_handler(IRQ_TIMER, timer_handler);
hal_set_timeout(DELTA_T); // schedule timeout
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/test_printf.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/test_printf.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/test_printf.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -32,8 +32,10 @@
u2_init();
printf("Hello %s%c\n", "world", '!');
+ puts("Another line");
+
- for (i = -31; i < 32; i++)
+ for (i = -15; i < 16; i++)
print_number(i);
print_number(0xffffffff);
Modified: usrp2/branches/developers/eb/u2-eb/firmware/apps/timer_test.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/apps/timer_test.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/apps/timer_test.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -20,6 +20,7 @@
#include "hal_io.h"
#include "buffer_pool.h"
#include "pic.h"
+#include "nonstdio.h"
#define DELTA_T 500 // 5 us (10ns per tick)
@@ -31,8 +32,8 @@
int t = timer_regs->time;
timer_regs->time = t + DELTA_T;
- hal_puts("Tick: ");
- hal_puthex_nl(t);
+ putstr("Tick: ");
+ puthex_nl(t);
}
int
@@ -42,7 +43,7 @@
// setup timer
- hal_puts("Setting up timer\n");
+ putstr("Setting up timer\n");
pic_register_handler(IRQ_TIMER, timer_handler);
int t = timer_regs->time;
@@ -50,7 +51,7 @@
u2_infinite_loop();
- hal_puts("Done Testing\n");
+ putstr("Done Testing\n");
hal_finish();
return 1;
Modified: usrp2/branches/developers/eb/u2-eb/firmware/bootstrap
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/bootstrap 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/bootstrap 2007-11-16
19:51:28 UTC (rev 6966)
@@ -26,4 +26,5 @@
autoconf
# autoheader
# libtoolize --automake
-automake --add-missing
+automake --add-missing -Wno-portability
+
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/Makefile.am
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/Makefile.am 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/Makefile.am 2007-11-16
19:51:28 UTC (rev 6966)
@@ -27,6 +27,7 @@
hal_io.c \
hal_uart.c \
i2c.c \
+ nonstdio.c \
pic.c \
printf.c \
spi.c \
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/eth_driver.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/eth_driver.c
2007-11-16 18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/eth_driver.c
2007-11-16 19:51:28 UTC (rev 6966)
@@ -22,6 +22,7 @@
#include "eth_mac_regs.h"
#include "pic.h"
#include "hal_io.h"
+#include "nonstdio.h"
static eth_driver_t ed_state;
static ed_link_changed_callback_t ed_callback = 0;
@@ -54,7 +55,7 @@
static void
ed_link_up(int speed)
{
- // hal_puts("ed_link_up: "); hal_puthex16_nl(speed);
+ // putstr("ed_link_up: "); puthex16_nl(speed);
ed_set_mac_speed(speed);
@@ -65,7 +66,7 @@
static void
ed_link_down(void)
{
- // hal_puts("ed_link_down\n");
+ // putstr("ed_link_down\n");
if (ed_callback) // fire link changed callback
(*ed_callback)(0);
@@ -75,7 +76,7 @@
static void
ed_link_speed_change(int speed)
{
- hal_puts("ed_link_speed_change: "); hal_puthex16_nl(speed);
+ putstr("ed_link_speed_change: "); puthex16_nl(speed);
ed_link_down();
ed_link_up(speed);
@@ -91,10 +92,10 @@
eth_link_state_t new_state = LS_UNKNOWN;
int new_speed = S_UNKNOWN;
- hal_puts("LANSR: "); hal_puthex16_nl(lansr);
+ putstr("LANSR: "); puthex16_nl(lansr);
if (lansr & LANSR_LINK_GOOD){ // link's up
- hal_puts_nl(" LINK_GOOD");
+ puts(" LINK_GOOD");
new_state = LS_UP;
switch (lansr & LANSR_SPEED_MASK){
@@ -116,7 +117,7 @@
}
}
else { // link's down
- hal_puts_nl(" NOT LINK_GOOD");
+ puts(" NOT LINK_GOOD");
new_state = LS_DOWN;
new_speed = S_UNKNOWN;
@@ -131,7 +132,7 @@
}
else if (new_state == LS_UP && new_speed != ed_state.link_speed){
ed_state.link_speed = new_speed; // remember new speed
- hal_puts_nl(" New Speed: "); hal_puthex_nl(new_speed);
+ puts(" New Speed: "); puthex_nl(new_speed);
ed_link_speed_change(new_speed);
}
}
@@ -175,7 +176,7 @@
| PHY_INT_SPD_CNG // speed changed
);
- hal_putc('$');
+ putchar('$');
eth_mac_miim_write(PHY_INT_CLEAR, ~0); // clear all pending interrupts
eth_mac_miim_write(PHY_INT_MASK, mask); // enable the ones we want
@@ -183,10 +184,10 @@
#if 0
unsigned read_back = eth_mac_miim_read(PHY_INT_MASK);
- hal_puts("eth_driver: wr INT_MASK = ");
- hal_puthex16_nl(mask);
- hal_puts("eth_driver: rd INT_MASK = ");
- hal_puthex16_nl(read_back);
+ putstr("eth_driver: wr INT_MASK = ");
+ puthex16_nl(mask);
+ putstr("eth_driver: rd INT_MASK = ");
+ puthex16_nl(read_back);
#endif
pic_register_handler(IRQ_PHY, eth_phy_irq_handler);
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -21,6 +21,7 @@
#include "hal_io.h"
#include "memory_map.h"
#include "hal_uart.h"
+#include <stdio.h>
unsigned int
hal_gpio_mode_mask(int high_bitno, int low_bitno, int mode)
@@ -109,14 +110,6 @@
hal_gpio_set_rx(0x0000, 0xff80);
}
-// %c
-inline void
-hal_putc(unsigned char s)
-{
- hal_gpio_set_rx((s << 8) | W, 0xff80);
- hal_gpio_set_rx(0, 0xff80);
-}
-
void
hal_finish(void)
{
@@ -124,6 +117,15 @@
*p = 0;
}
+// %c
+inline int
+putchar(int ch)
+{
+ hal_gpio_set_rx((s << 8) | W, 0xff80);
+ hal_gpio_set_rx(0, 0xff80);
+ return ch;
+}
+
#elif defined(HAL_IO_USES_UART)
void
@@ -132,19 +134,19 @@
hal_uart_init();
}
-// %c
-inline void
-hal_putc(unsigned char s)
+void
+hal_finish(void)
{
- hal_uart_putc(s);
}
-void
-hal_finish(void)
+// %c
+inline int
+putchar(int ch)
{
+ hal_uart_putc(ch);
+ return ch;
}
-
#else // nop all i/o
void
@@ -152,98 +154,47 @@
{
}
-// %c
-inline void
-hal_putc(unsigned char s)
+void
+hal_finish(void)
{
}
-void
-hal_finish(void)
+// %c
+inline int
+putchar(int ch)
{
+ return ch;
}
#endif
// ================================================================
-// (slightly) higher level functions
+// (slightly) higher level functions
+//
+// These are here so we can inline the calls to putchar.
+// The rest of the stuff was moved to nonstdio.c
// ================================================================
// \n
inline void
-hal_newline(void)
+newline(void)
{
- hal_putc('\n');
+ putchar('\n');
}
-// %c\n
-inline void
-hal_putc_nl(unsigned char s)
+int
+putstr(const char *s)
{
- hal_putc(s);
- hal_newline();
-}
-
-
-void
-hal_puts(const char *s)
-{
while (*s)
- hal_putc(*s++);
-}
+ putchar(*s++);
-void
-hal_puts_nl(const char *s)
-{
- hal_puts(s);
- hal_newline();
+ return 0;
}
-// %02x
-void
-hal_puthex8(unsigned long x)
+int
+puts(const char *s)
{
- static const char hex[16] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
- };
- hal_putc(hex[(x >> 4) & 0xf]);
- hal_putc(hex[x & 0xf]);
+ putstr(s);
+ putchar('\n');
+ return 0;
}
-
-// %04x
-void
-hal_puthex16(unsigned long x)
-{
- hal_puthex8(x >> 8);
- hal_puthex8(x);
-}
-
-// %08x
-void
-hal_puthex32(unsigned long x)
-{
- hal_puthex16(x >> 16);
- hal_puthex16(x);
-}
-
-void
-hal_puthex8_nl(unsigned long x)
-{
- hal_puthex8(x);
- hal_newline();
-}
-
-void
-hal_puthex16_nl(unsigned long x)
-{
- hal_puthex16(x);
- hal_newline();
-}
-
-void
-hal_puthex32_nl(unsigned long x)
-{
- hal_puthex32(x);
- hal_newline();
-}
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.h
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.h 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/hal_io.h 2007-11-16
19:51:28 UTC (rev 6966)
@@ -24,21 +24,7 @@
void hal_io_init(void);
void hal_finish();
-void hal_putc(unsigned char s);
-void hal_putc_nl(unsigned char s); // adds \n
-void hal_puts(const char *);
-void hal_puts_nl(const char *s);
-void hal_puthex8(unsigned long x);
-void hal_puthex16(unsigned long x);
-void hal_puthex32(unsigned long x);
-void hal_puthex8_nl(unsigned long x);
-void hal_puthex16_nl(unsigned long x);
-void hal_puthex32_nl(unsigned long x);
-#define hal_puthex hal_puthex32
-#define hal_puthex_nl hal_puthex32_nl
-void hal_newline();
-
void hal_gpio_set_rx_mode(int high_bitno, int low_bitno, int mode);
void hal_gpio_set_tx_mode(int high_bitno, int low_bitno, int mode);
Added: usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.c
(rev 0)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -0,0 +1,80 @@
+/* -*- c -*- */
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <nonstdio.h>
+
+static const char hex[16] = "0123456789ABCDEF";
+
+// %x
+void
+puthex4(unsigned long x)
+{
+ putchar(hex[x & 0xf]);
+}
+
+// %02x
+void
+puthex8(unsigned long x)
+{
+ putchar(hex[(x >> 4) & 0xf]);
+ putchar(hex[x & 0xf]);
+}
+
+// %04x
+void
+puthex16(unsigned long x)
+{
+ puthex8(x >> 8);
+ puthex8(x);
+}
+
+// %08x
+void
+puthex32(unsigned long x)
+{
+ puthex16(x >> 16);
+ puthex16(x);
+}
+
+void
+puthex4_nl(unsigned long x)
+{
+ puthex4(x);
+ newline();
+}
+
+void
+puthex8_nl(unsigned long x)
+{
+ puthex8(x);
+ newline();
+}
+
+void
+puthex16_nl(unsigned long x)
+{
+ puthex16(x);
+ newline();
+}
+
+void
+puthex32_nl(unsigned long x)
+{
+ puthex32(x);
+ newline();
+}
Property changes on: usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.h
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.h
(rev 0)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.h 2007-11-16
19:51:28 UTC (rev 6966)
@@ -0,0 +1,37 @@
+/* -*- c -*- */
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INCLUDED_NONSTDIO_H
+#define INCLUDED_NONSTDIO_H
+
+#include <stdio.h>
+
+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')
+
+#endif /* INCLUDED_NONSTDIO_H */
Property changes on: usrp2/branches/developers/eb/u2-eb/firmware/lib/nonstdio.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/pic.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/pic.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/pic.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -69,7 +69,7 @@
int mask;
for (i=0, mask=1; i < NVECTORS; i++, mask <<= 1){
if (mask & live){ // handle this one
- // hal_puthex_nl(i);
+ // puthex_nl(i);
(*pic_vector[i])(i);
pic_regs->pending = mask; // clear pending interrupt
return;
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/printf.c
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/printf.c 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/printf.c 2007-11-16
19:51:28 UTC (rev 6966)
@@ -22,11 +22,10 @@
#include <stdarg.h>
#include <stdio.h>
-#include <hal_io.h> /* FIXME refactor into stdio */
static void
_printn(unsigned u, unsigned base, char issigned,
- volatile void (*emitter)(char, void *), void *pData)
+ void (*emitter)(char, void *), void *pData)
{
const char *_hex = "0123456789ABCDEF";
if (issigned && ((int)u < 0)) {
@@ -39,7 +38,7 @@
}
static void
-_printf(const char *format, volatile void (*emitter)(char, void *),
+_printf(const char *format, void (*emitter)(char, void *),
void *pData, va_list va)
{
while (*format) {
@@ -92,7 +91,7 @@
static void
_char_emitter(char c, void *pData __attribute__((unused)))
{
- hal_putc(c);
+ putchar(c);
}
int
@@ -103,6 +102,8 @@
_printf(format, _char_emitter, NULL, va);
+ va_end(va);
+
// wrong return value...
return 0;
}
@@ -125,6 +126,8 @@
_printf(format, _buf_emitter, &pInto, va);
*pInto++ = '\0';
+ va_end(va);
+
// FIXME wrong return value
return 0;
}
Modified: usrp2/branches/developers/eb/u2-eb/firmware/lib/stdio.h
===================================================================
--- usrp2/branches/developers/eb/u2-eb/firmware/lib/stdio.h 2007-11-16
18:17:29 UTC (rev 6965)
+++ usrp2/branches/developers/eb/u2-eb/firmware/lib/stdio.h 2007-11-16
19:51:28 UTC (rev 6966)
@@ -19,12 +19,20 @@
#ifndef INCLUDED_STDIO_H
#define INCLUDED_STDIO_H
+// very trimmed down stdio.h See also nonstdio.h
+
#ifndef NULL
#define NULL 0
#endif
+#ifndef EOF
+#define EOF (-1)
+#endif
+
int putchar(int c);
int puts(const char *s);
int printf(const char *format, ...);
+// int getchar(void);
+
#endif /* INCLUDED_STDIO_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6966 - in usrp2/branches/developers/eb/u2-eb/firmware: . apps lib,
eb <=