Commit ea73580b authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

update, wip

parent bad00b56
#!/bin/bash
/sbin/rmmod fmc_adc_100m14b
/sbin/rmmod fmc-fine-delay
/sbin/rmmod fmc-tdc
/sbin/rmmod svec
/sbin/rmmod zio
/sbin/rmmod fmc
/sbin/rmmod fmc_adc_100m14b
/sbin/rmmod fmc-fine-delay
/sbin/rmmod fmc-tdc
/sbin/rmmod svec
/sbin/rmmod zio
/sbin/rmmod fmc
/sbin/insmod /user/twlostow/repos/fmc-bus/kernel/fmc.ko
/sbin/insmod /user/twlostow/repos/zio/zio.ko
/sbin/insmod /user/twlostow/repos/fmc-tdc-sw/kernel/fmc-tdc.ko show_sdb=1 verbose=1 gateware=fmc/test/svec-list-tdc-fd-y.bin
/sbin/insmod /user/twlostow/repos/fine-delay-sw/kernel/fmc-fine-delay.ko show_sdb=1 verbose=1 gateware=fmc/test/svec-list-tdc-fd-y.bin
/sbin/insmod /user/twlostow/repos/svec-sw/kernel/svec.ko slot=5,8,12 lun=0,1,2 verbose=1 #fw_name=fmc/test/svec-list-test.bin verbose=1
/user/twlostow/repos/svec-sw/tools/svec-config -u 0 -b 0xa00000 -w 0x100000 -v 0x86 -f 1
/user/twlostow/repos/svec-sw/tools/svec-config -u 1 -b 0xb00000 -w 0x100000 -v 0x88 -f 1
/user/twlostow/repos/svec-sw/tools/svec-config -u 2 -b 0xc00000 -w 0x100000 -v 0x90 -f 1
#/sbin/i
#./svec-fwloader /lib/firmware/fmc/test/svec-list-test.bin
./svec-wrc-loader -a /lib/firmware/fmc/wr-core-current.bin
sleep 2
/usr/local/bin/fmc-fdelay-pulse -i 2 -o 1 -T 89u+3n
/usr/local/bin/fmc-fdelay-pulse -i 2 -o 2 -T 89u+4n
/usr/local/bin/fmc-fdelay-board-time -i 0 wr
/usr/local/bin/fmc-fdelay-board-time -i 1 wr
../../fmc-tdc-sw/tools/fmc-tdc-time 0140 wr
../../fmc-tdc-sw/tools/fmc-tdc-time 0200 wr
/usr/local/bin/fmc-fdelay-pulse -i 0 -o 1 -p
/usr/local/bin/fmc-fdelay-pulse -i 1 -o 1 -p
......@@ -3,6 +3,41 @@
#define LOOP_QUEUE_SIZE 16
SMEM int head, tail, count;
SMEM struct list_trigger_entry buf[16];
static SMEM int head, tail, count;
static SMEM struct list_trigger_entry buf[16];
void loop_queue_init()
{
head = tail = count = 0;
}
void loop_queue_push(struct list_id *id, uint32_t seq, struct list_timestamp *ts)
{
if(count == LOOP_QUEUE_SIZE)
return;
buf[head].id = *id;
buf[head].seq = seq;
buf[head].ts = *ts;
head++;
if(head == LOOP_QUEUE_SIZE)
head = 0;
count++;
}
struct list_trigger_entry *loop_queue_pop()
{
if(!count)
return NULL;
struct list_trigger_entry *rv = &buf[tail];
tail++;
if(tail == LOOP_QUEUE_SIZE)
tail = 0;
count--;
return rv;
}
\ No newline at end of file
#ifndef __LOOP_QUEUE_H
#define __LOOP_QUEUE_H
#include "rt.h"
#include "list-common.h"
#define LOOP_QUEUE_SIZE 16
void loop_queue_init();
void loop_queue_push(struct list_id *id, uint32_t seq, struct list_timestamp *ts);
struct list_trigger_entry *loop_queue_pop();
#endif
OUTPUT_FORMAT("elf32-lm32")
ENTRY(_start)
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40000000,
LENGTH = 8192
}
SECTIONS
{
.boot : { *(.boot) } > ram
.text : { *(.text .text.*) } > ram =0
.rodata : { *(.rodata .rodata.*) } > ram
.data : {
*(.data .data.*)
_gp = ALIGN(16) + 0x7ff0;
} > ram
.bss : {
_fbss = .;
*(.bss .bss.*)
*(COMMON)
_ebss = .;
} > ram
.smem : { *(.smem) } > smem
PROVIDE(_endram = ORIGIN(stack));
PROVIDE(_fstack = ORIGIN(stack) + LENGTH(stack) - 4);
}
PROVIDE(mprintf = pp_printf);
/*
* This work is part of the White Rabbit Node Core project.
*
* Copyright (C) 2013-2014 CERN (www.cern.ch)
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
/*
* LHC Instability Trigger Distribution (LIST) Firmware
*
* hash.h: Trigger Output hash table
*/
#ifndef __LIST_HASH_H
#define __LIST_HASH_H
#include "rt.h"
#include "list-common.h"
struct lrt_output_rule {
uint32_t delay_cycles;
uint16_t delay_frac;
uint16_t state;
struct lrt_output_rule *cond_ptr;
};
struct lrt_hash_entry {
struct list_id id;
struct lrt_output_rule ocfg [FD_NUM_CHANNELS];
struct lrt_hash_entry *next;
};
extern struct lrt_hash_entry* htab [ FD_HASH_ENTRIES ];
void hash_init();
struct lrt_hash_entry *hash_add ( struct list_id *id, int output, struct lrt_output_rule *rule );
int hash_remove ( struct lrt_hash_entry *ent, int output );
int hash_free_count();
struct lrt_hash_entry *hash_get_entry (int bucket, int pos);
static inline int hash_func( struct list_id *id )
{
int h = 0;
h += id->system * 10291;
h += id->source_port * 10017;
h += id->trigger * 3111;
return h & (FD_HASH_ENTRIES - 1); // hash table size must be a power of 2
}
static inline struct lrt_hash_entry *hash_search( struct list_id *id, int *pos )
{
int p = hash_func( id );
struct lrt_hash_entry *ent = htab[ p ];
if(pos)
*pos = p;
while (ent)
{
if(ent->id.system == id->system &&
ent->id.source_port == id->source_port &&
ent->id.trigger == id->trigger)
return ent;
ent = ent->next;
}
return NULL;
};
#endif
#!/bin/bash
./test/list-boot 0
./test/list-boot 1
./test/list-input-test -l 0 1 enable
./test/list-input-test -l 0 1 assign 0:0:1
./test/list-input-test -l 0 1 mode auto
./test/list-input-test -l 0 1 arm
./test/list-input-test -l 1 2 enable
./test/list-input-test -l 1 2 assign 0:0:2
./test/list-input-test -l 1 2 mode auto
./test/list-input-test -l 1 2 arm
./test/list-output-test -l 1 1 assign 0:0:1
./test/list-output-test -l 1 1 delay 0 100u
./test/list-output-test -l 0 3 assign 0:0:1
./test/list-output-test -l 0 3 delay 0 80u
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