diff options
author | Josh Blum <josh@joshknows.com> | 2010-12-22 19:11:45 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-12-22 19:11:45 -0800 |
commit | 71fc99d006f2347a356c5339905593f64ff902ec (patch) | |
tree | 36c141adca7a2e5cf2f84660b5a2e3543f1dfaba /firmware/microblaze | |
parent | 434ee07c4ba1ce9faee8ecf3a309042ca424cbda (diff) | |
download | uhd-71fc99d006f2347a356c5339905593f64ff902ec.tar.gz uhd-71fc99d006f2347a356c5339905593f64ff902ec.tar.bz2 uhd-71fc99d006f2347a356c5339905593f64ff902ec.zip |
usrp2: got fw working on usrp2+nseries (crosses fingers)
The abort issue seemed to be cause by the listeners table not being initialized.
Also gave the pic handler the initialization works to be consistent but not needed as it was static initialized.
And finally, doubly set the packet router handshake ctrl before entering the claim calls (seemed to fix the lockup, perhaps a bad init state?)
Diffstat (limited to 'firmware/microblaze')
-rw-r--r-- | firmware/microblaze/apps/txrx_uhd.c | 1 | ||||
-rw-r--r-- | firmware/microblaze/lib/net_common.c | 8 | ||||
-rw-r--r-- | firmware/microblaze/lib/net_common.h | 2 | ||||
-rw-r--r-- | firmware/microblaze/lib/pic.c | 18 | ||||
-rw-r--r-- | firmware/microblaze/lib/pic.h | 2 | ||||
-rw-r--r-- | firmware/microblaze/lib/pkt_ctrl.c | 2 |
6 files changed, 19 insertions, 14 deletions
diff --git a/firmware/microblaze/apps/txrx_uhd.c b/firmware/microblaze/apps/txrx_uhd.c index 7dc44f09f..ea74f032e 100644 --- a/firmware/microblaze/apps/txrx_uhd.c +++ b/firmware/microblaze/apps/txrx_uhd.c @@ -363,6 +363,7 @@ main(void) pkt_ctrl_program_inspector(get_ip_addr(), USRP2_UDP_CTRL_PORT, USRP2_UDP_DATA_PORT); //2) register callbacks for udp ports we service + init_udp_listeners(); register_udp_listener(USRP2_UDP_CTRL_PORT, handle_udp_ctrl_packet); register_udp_listener(USRP2_UDP_DATA_PORT, handle_udp_data_packet); register_udp_listener(USRP2_UDP_ERR0_PORT, handle_udp_err0_packet); diff --git a/firmware/microblaze/lib/net_common.c b/firmware/microblaze/lib/net_common.c index a34ca615b..c1ca280d9 100644 --- a/firmware/microblaze/lib/net_common.c +++ b/firmware/microblaze/lib/net_common.c @@ -64,6 +64,12 @@ struct listener_entry { static struct listener_entry listeners[MAX_UDP_LISTENERS]; +void init_udp_listeners(void){ + for (int i = 0; i < MAX_UDP_LISTENERS; i++){ + listeners[i].rcvr = NULL; + } +} + static struct listener_entry * find_listener_by_port(unsigned short port) { @@ -78,7 +84,7 @@ static struct listener_entry * find_free_listener(void) { for (int i = 0; i < MAX_UDP_LISTENERS; i++){ - if (listeners[i].rcvr == 0) + if (listeners[i].rcvr == NULL) return &listeners[i]; } abort(); diff --git a/firmware/microblaze/lib/net_common.h b/firmware/microblaze/lib/net_common.h index 4004ca6e6..409022352 100644 --- a/firmware/microblaze/lib/net_common.h +++ b/firmware/microblaze/lib/net_common.h @@ -33,6 +33,8 @@ unsigned int CHKSUM(unsigned int x, unsigned int *chksum); typedef void (*udp_receiver_t)(struct socket_address src, struct socket_address dst, unsigned char *payload, int payload_len); +void init_udp_listeners(void); + void register_addrs(const eth_mac_addr_t *mac_addr, const struct ip_addr *ip_addr); void register_udp_listener(int port, udp_receiver_t rcvr); diff --git a/firmware/microblaze/lib/pic.c b/firmware/microblaze/lib/pic.c index b8beda311..bd627ce6b 100644 --- a/firmware/microblaze/lib/pic.c +++ b/firmware/microblaze/lib/pic.c @@ -26,17 +26,7 @@ /* * Our secondary interrupt vector. */ -irq_handler_t pic_vector[NVECTORS] = { - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler -}; - +irq_handler_t pic_vector[NVECTORS]; void pic_init(void) @@ -47,6 +37,10 @@ pic_init(void) pic_regs->edge_enable = PIC_ONETIME_INT | PIC_UNDERRUN_INT | PIC_OVERRUN_INT | PIC_PPS_INT; pic_regs->polarity = ~0 & ~PIC_PHY_INT; // rising edge pic_regs->pending = ~0; // clear all pending ints + + for (int i = 0; i < NVECTORS; i++){ + pic_vector[i] = pic_nop_handler; + } } /* @@ -89,7 +83,7 @@ pic_register_handler(unsigned irq, irq_handler_t handler) } void -nop_handler(unsigned irq) +pic_nop_handler(unsigned irq) { // nop } diff --git a/firmware/microblaze/lib/pic.h b/firmware/microblaze/lib/pic.h index 6cbffb441..cfdf721f4 100644 --- a/firmware/microblaze/lib/pic.h +++ b/firmware/microblaze/lib/pic.h @@ -24,7 +24,7 @@ typedef void (*irq_handler_t)(unsigned irq); void pic_init(void); void pic_register_handler(unsigned irq, irq_handler_t handler); -void nop_handler(unsigned irq); // default handler does nothing +void pic_nop_handler(unsigned irq); // default handler does nothing // FIXME inline assembler int pic_disable_interrupts(); diff --git a/firmware/microblaze/lib/pkt_ctrl.c b/firmware/microblaze/lib/pkt_ctrl.c index 7e095ec00..a5659eb33 100644 --- a/firmware/microblaze/lib/pkt_ctrl.c +++ b/firmware/microblaze/lib/pkt_ctrl.c @@ -46,6 +46,7 @@ static inline bool is_status_bit_set(int bit){ #define CPU_INP_HS_BIT 1 //from CPU to packet router void *pkt_ctrl_claim_incoming_buffer(size_t *num_lines){ + buffer_pool_ctrl->cpu_out_ctrl = 0; if (!is_status_bit_set(CPU_OUT_HS_BIT)) return NULL; *num_lines = (buffer_pool_status->status >> 16) & 0xffff; return buffer_ram(0); @@ -58,6 +59,7 @@ void pkt_ctrl_release_incoming_buffer(void){ } void *pkt_ctrl_claim_outgoing_buffer(void){ + buffer_pool_ctrl->cpu_inp_ctrl = 0; while (!is_status_bit_set(CPU_INP_HS_BIT)){} return buffer_ram(1); } |