// grant_actions.c

#include "1394.h"
#include "data_structures.h"
#include "phy_services.h"
#include "arb.h"
#include "shared.h"

void grant_actions() {                  // called to send a grant to the requesting junior
  int i;
  if (!DS_stuck) {  
    max_beta_timer = 0;                 // timer  only needs to be implemented in border capable nodes
    DS_stuck = TRUE;                    // and note that this will have to be released by sending
                                        // a Legacy format packet
  }
  for (i = 0; i < NPORT; i++) {
    if (i == requesting_port)           // Send grant to requesting junior
      portTarb(i, grant_to_give);
    else {                              // send DATA_PREFIX/DATA_NULL to all non_requesting ports
                                        // including the senior_port
                                        // send_null_packet cleans up the case of starting a packet
                                        // for a request which is subsequently canceled
      portTarb(i,DATA_NULL);
    }
  }
}
