Compare commits

..

2 commits

Author SHA1 Message Date
Stephan I. Böttcher
e097927d5d libirena: add i2c(), to ahepamfile 2025-03-04 00:18:58 +01:00
Stephan I. Böttcher
ae5b55f5c6 more to .gitignore, now that we are online 2025-03-04 00:18:06 +01:00
4 changed files with 60 additions and 0 deletions

3
.gitignore vendored
View file

@ -14,3 +14,6 @@ irenarc.py
irenafile
*/data
ahepamfile
*.log
nm64file
mustang

View file

@ -124,6 +124,7 @@ int main(int argc, const char * const * argv)
case 0xc264:
case 0xc364: x = nm_counters(h1); break;
default:
if ((h1 & 0xfff0)==0x12c0) { x = i2c(h1); break; }
switch (h1 & 0xfffc) {
case 0x5710: x = dorn_hk(h1, n_adcs, 1); break;
case 0x5714: x = dorn_samples(h1, n_adcs, 1); break;

View file

@ -391,6 +391,61 @@ int mcs_pulse(unsigned int h1)
return 0;
}
int i2c_seth();
int i2c(unsigned int h1)
{
unsigned int magic = h1 & 0xf;
unsigned int size = next(1);
if (size & 0xff00 || !size) {
printf("\nXI²C 0x%04x 0x%04x", h1, size);
return 1;
}
if (size==132 && magic==5)
return i2c_seth();
printf("\nI²C %u %u", magic, --size);
while (size--)
printf(" %04x", next(1));
return 0;
}
void seth_vector(unsigned short *d, const char *sensor, int idx)
{
printf("\nI2C-%s %2u %5d %5d %5d",
sensor, idx, d[0], d[1], d[2]);
}
int i2c_seth()
{
unsigned short d[131];
for (int i=0; i<131; i++)
d[i] = next(1);
unsigned short mag_status = d[0];
short mag_temp = d[4];
unsigned short acc_aux = d[5];
short acc_adc1 = d[6];
short acc_adc2 = d[7];
short acc_temp = d[8];
unsigned short acc_fifo = d[63];
unsigned short acc_status = d[64];
const char *ok = "";
if (mag_status != 0xffa7
|| acc_status != 0xffa7
|| acc_aux != 0xff87
|| (acc_fifo & 0xff) != 0x2f)
ok = "!";
printf("\nISETH %s %04x %04x %04x %u %d %d %d %d", ok,
mag_status, acc_status, acc_aux, acc_fifo>>8,
mag_temp+25, acc_temp+25, acc_adc1, acc_adc2 );
seth_vector(d+1, "MAG", 0);
for (int i=0; i<18; i++)
seth_vector(d+9+3*i, "MAG", i+1);
seth_vector(d+128, "MAG", 19);
for (int i=0; i<21; i++)
seth_vector(d+65+3*i, "ACC", i);
return 0;
}
const char libirena_usage[] =
" [opts] < infile > outfile\n"
" -f --follow follow mode\n"

View file

@ -74,6 +74,7 @@ static inline unsigned short next(int inp)
extern int n_counters;
extern int nm_counter_gap[];
int nm_counters(unsigned int h1);
int i2c(unsigned int h1);
static inline unsigned long uftoi(unsigned int f, unsigned int m)
{