aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/lib/pkt_ctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/microblaze/lib/pkt_ctrl.c')
-rw-r--r--firmware/microblaze/lib/pkt_ctrl.c24
1 files changed, 24 insertions, 0 deletions
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: