Skip to content

Commit

Permalink
Merge pull request #35 from pzanna/Dev_81_Stacking
Browse files Browse the repository at this point in the history
Dev 81 stacking
  • Loading branch information
pzanna authored May 17, 2017
2 parents edfb8b6 + 08d177a commit 0692a64
Show file tree
Hide file tree
Showing 7 changed files with 375 additions and 155 deletions.
29 changes: 29 additions & 0 deletions ZodiacFX/src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "eeprom.h"
#include "switch.h"
#include "flash.h"
#include "stacking.h"
#include "openflow/openflow.h"
#include "openflow/of_helper.h"
#include "lwip/def.h"
Expand Down Expand Up @@ -84,6 +85,8 @@ uint8_t uCLIContext = 0;
struct arp_header arp_test;
uint8_t esc_char = 0;

// ####### SPI debug output #######
extern struct spi_debug_stats spi_debug;

// Internal Functions
void saveConfig(void);
Expand Down Expand Up @@ -1661,6 +1664,32 @@ void command_debug(char *command, char *param1, char *param2, char *param3)
return;
}

if (strcmp(command, "spi_stats")==0)
{
printf("master tx packets: %d\r\nmaster rx packets: %d\r\nmaster rx bad size: %d\r\nmaster rx bad preamble: %d\r\nmaster rx bad crc: %d\r\n",\
spi_debug.master_tx_count,\
spi_debug.master_rx_count,\
spi_debug.master_rx_error_bad_size,\
spi_debug.master_rx_error_bad_preamble,\
spi_debug.master_rx_error_bad_crc
);
return;
}

if (strcmp(command, "spi_stats_slave")==0)
{
printf("slave tx packets: %d\r\nslave rx packets: %d\r\nslave tx timeout errors: %d\r\nslave rx timeout errors: %d\r\nslave rx bad size: %d\r\nslave rx bad preamble: %d\r\nslave rx bad crc: %d\r\n",\
spi_debug.slave_tx_count,\
spi_debug.slave_rx_count,\
spi_debug.slave_tx_error_timeout,\
spi_debug.slave_rx_error_timeout,\
spi_debug.slave_rx_error_bad_size,\
spi_debug.slave_rx_error_bad_preamble,\
spi_debug.slave_rx_error_bad_crc
);
return;
}

// Unknown Command response
printf("Unknown command\r\n");
return;
Expand Down
4 changes: 2 additions & 2 deletions ZodiacFX/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ int main (void)
while(1)
{
task_switch(&gs_net_if);
//task_command(cCommand, cCommand_last);
task_command(cCommand, cCommand_last);
// Only run the following tasks if set to Master
if(masterselect == false)
{
task_command(cCommand, cCommand_last);
//task_command(cCommand, cCommand_last);
sys_check_timeouts();
task_openflow();
}
Expand Down
3 changes: 3 additions & 0 deletions ZodiacFX/src/openflow/openflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
#include "lwip/tcp.h"
#include "lwip/err.h"
#include "timers.h"
#include "stacking.h"

// Global variables
extern struct zodiac_config Zodiac_Config;
extern uint8_t port_status[8];
extern struct ofp10_port_stats phys10_port_stats[8];
extern struct ofp13_port_stats phys13_port_stats[8];
extern bool stackenabled;

// Local Variables
struct ofp_switch_config Switch_config;
Expand Down Expand Up @@ -354,6 +356,7 @@ void task_openflow(void)
{
fast_of_timer = sys_get_ms();
nnOF_timer();
////if (stackenabled == true) masterslave_test();

if (heartbeat > (HB_INTERVAL * 2) && tcp_con_state == 1) //If we haven't heard anything from the controller for more then the heartbeat interval send an echo request
{
Expand Down
Loading

0 comments on commit 0692a64

Please sign in to comment.