Commit 756f9d6b authored by Alessandro Rubini's avatar Alessandro Rubini

arch-spec: removed unused source files

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 54bcd48a
/*
* Alessandro Rubini for CERN, 2011 -- GNU LGPL v2.1 or later
*/
/*
* This is the main loop for the Spec board
*/
#include <ppsi/ppsi.h>
#include <ppsi/diag.h>
#include <syscon.h>
#include "spec.h"
void spec_main_loop(struct pp_instance *ppi)
{
int i, delay_ms;
const int eth_ofst = sizeof(struct spec_ethhdr);
/*pp_diag_verbosity = 1;*/
/* SPEC is raw ethernet by default */
NP(ppi)->proto_ofst = eth_ofst;
/* FIXME now it is end-to-end mode by default */
OPTS(ppi)->e2e_mode = 1;
/*
* The main loop here is polling every ms. While we are not
* doing anything else but the protocol, this allows extra stuff
* to fit.
*/
delay_ms = pp_state_machine(ppi, NULL, 0);
while (1) {
unsigned char _packet[1500];
/* FIXME Alignment */
unsigned char *packet = _packet + 2;
/* Wait for a packet or for the timeout */
while (delay_ms && !minic_poll_rx()) {
timer_delay(1);
delay_ms--;
}
if (!minic_poll_rx()) {
delay_ms = pp_state_machine(ppi, NULL, 0);
continue;
}
/*
* We got a packet. If it's not ours, continue consuming
* the pending timeout
*/
i = spec_recv_packet(ppi, packet, sizeof(_packet), &ppi->last_rcv_time);
if (0) {
int j;
pp_printf("recvd: %i\n", i);
for (j = 0; j < i - eth_ofst; j++) {
pp_printf("%02x ", packet[j + eth_ofst]);
if( (j+1)%16==0 )
pp_printf("\n");
}
pp_printf("\n");
}
/* Warning: PP_ETHERTYPE is endian-agnostic by design */
if (((struct spec_ethhdr *)packet)->h_proto !=
htons(PP_ETHERTYPE))
continue;
delay_ms = pp_state_machine(ppi, packet + eth_ofst, i - eth_ofst);
}
pp_printf("OUT MAIN LOOP\n");
}
/*
* Alessandro Rubini for CERN, 2011 -- GNU LGPL v2.1 or later
*/
#include <syscon.h>
#include <uart.h>
#include <ppsi/ppsi.h>
#include <ppsi/diag.h>
#include "../proto-ext-whiterabbit/wr-api.h" /* FIXME: ugly */
#include "spec.h"
static struct pp_instance ppi_static;
/*ppi fields*/
static UInteger16 sent_seq_id[16];
static DSDefault defaultDS;
static DSCurrent currentDS;
static DSParent parentDS;
static DSPort portDS;
static DSTimeProperties timePropertiesDS;
static struct pp_net_path net_path;
static struct pp_servo servo;
static struct pp_frgn_master frgn_master;
/* Calibration data (should be read from EEPROM, if available) */
#ifdef PPSI_MASTER
int32_t sfp_alpha = -73622176;
#else
int32_t sfp_alpha = 73622176;
#endif
int32_t sfp_deltaTx = 0;
int32_t sfp_deltaRx = 0;
uint32_t cal_phase_transition = 595; /* 7000 */
void ppsi_main(void)
{
struct pp_instance *ppi = &ppi_static; /* no malloc, one instance */
sdb_find_devices();
uart_init();
pp_puts("Spec: starting. Compiled on " __DATE__ "\n");
/* leds are off and button is input */
//gpio_dir(GPIO_PIN_BTN1, 0);
//gpio_dir(GPIO_PIN_LED_LINK, 1);
//gpio_dir(GPIO_PIN_LED_STATUS, 1);
ppi->sent_seq_id = sent_seq_id;
ppi->defaultDS = &defaultDS;
ppi->currentDS = &currentDS;
ppi->parentDS = &parentDS;
ppi->portDS = &portDS;
ppi->timePropertiesDS = &timePropertiesDS;
ppi->net_path = &net_path;
ppi->servo = &servo;
ppi->frgn_master = &frgn_master;
ppi->arch_data = NULL;
gpio_out(GPIO_PIN_LED_LINK, 0);
gpio_out(GPIO_PIN_LED_STATUS, 0);
if (spec_open_ch(ppi)) {
pp_diag_error(ppi, spec_errno);
pp_diag_fatal(ppi, "open_ch", "");
}
pp_open_instance(ppi, 0 /* no opts */);
#ifdef PPSI_SLAVE
OPTS(ppi)->slave_only = 1;
DSPOR(ppi)->wrConfig = WR_S_ONLY;
#endif
spec_main_loop(ppi);
}
/* Our crt0.S is unchanged: it wants a "main" function, and "_irq_entry" too" */
int main(void) __attribute__((alias("ppsi_main")));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment