From 6004410a7b73a52d95b8f5f0cf0fa969bef4e910 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 21 Nov 2010 13:36:25 -0800 Subject: packet_router: implemented code to program the addresses into the router --- firmware/microblaze/lib/pkt_ctrl.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'firmware/microblaze/lib/pkt_ctrl.c') diff --git a/firmware/microblaze/lib/pkt_ctrl.c b/firmware/microblaze/lib/pkt_ctrl.c index 9f662122d..52ba80e3a 100644 --- a/firmware/microblaze/lib/pkt_ctrl.c +++ b/firmware/microblaze/lib/pkt_ctrl.c @@ -47,6 +47,30 @@ static bool is_status_bit_set(int bit){ #define MODE_BIT 2 #define CLR_BIT 8 +void pkt_ctrl_register_addrs( + const eth_mac_addr_t *mac_addr, const struct ip_addr *ip_addr +){ + //program in the ip addr + set_control(0x1 << 4, 0x7 << 4); + set_control((ip_addr->addr & 0x0000ffff) << 16, 0xffff << 16); + set_control(0x2 << 4, 0x7 << 4); + set_control((ip_addr->addr & 0xffff0000) << 0, 0xffff << 16); + + //program in the mac addr + set_control(0x3 << 4, 0x7 << 4); + set_control((uint32_t)mac_addr->addr[0] << 16, 0x00ff << 16); + set_control((uint32_t)mac_addr->addr[1] << 24, 0xff00 << 16); + set_control(0x4 << 4, 0x7 << 4); + set_control((uint32_t)mac_addr->addr[2] << 16, 0x00ff << 16); + set_control((uint32_t)mac_addr->addr[3] << 24, 0xff00 << 16); + set_control(0x5 << 4, 0x7 << 4); + set_control((uint32_t)mac_addr->addr[4] << 16, 0x00ff << 16); + set_control((uint32_t)mac_addr->addr[5] << 24, 0xff00 << 16); + + //clear cmd + set_control(0x0, 0x7 << 4); +} + void pkt_ctrl_set_routing_mode(pkt_ctrl_routing_mode_t mode){ switch(mode){ case PKT_CTRL_ROUTING_MODE_SLAVE: -- cgit v1.2.3