fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
at master 88 lines 2.5 kB view raw
1/***************************************************************************** 2 * pce * 3 *****************************************************************************/ 4 5/***************************************************************************** 6 * File name: src/utils/pri/list.c * 7 * Created: 2013-12-19 by Hampa Hug <hampa@hampa.ch> * 8 * Copyright: (C) 2013-2018 Hampa Hug <hampa@hampa.ch> * 9 *****************************************************************************/ 10 11/***************************************************************************** 12 * This program is free software. You can redistribute it and / or modify it * 13 * under the terms of the GNU General Public License version 2 as published * 14 * by the Free Software Foundation. * 15 * * 16 * This program is distributed in the hope that it will be useful, but * 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 * Public License for more details. * 20 *****************************************************************************/ 21 22 23#include "main.h" 24 25#include <stdio.h> 26#include <string.h> 27 28#include <drivers/pri/pri.h> 29 30 31static 32int pri_list_track_cb (pri_img_t *img, pri_trk_t *trk, unsigned long c, unsigned long h, void *opaque) 33{ 34 unsigned i; 35 double rpm; 36 pri_evt_t *evt; 37 const char *str; 38 39 if ((trk->clock > 0) && (trk->size > 0)) { 40 rpm = (60.0 * trk->clock) / trk->size; 41 } 42 else { 43 rpm = 0.0; 44 } 45 46 printf ("%2lu/%lu: CLK: %lu BITS: %lu RPM: %.4f\n", 47 c, h, 48 pri_trk_get_clock (trk), 49 pri_trk_get_size (trk), 50 rpm 51 ); 52 53 if (par_list_long) { 54 evt = trk->evt; 55 56 i = 0; 57 58 while (evt != NULL) { 59 switch (evt->type) { 60 case PRI_EVENT_WEAK: 61 str = "WEAK"; 62 break; 63 64 case PRI_EVENT_CLOCK: 65 str = "CLOCK"; 66 break; 67 68 default: 69 str = "UNK"; 70 break; 71 } 72 73 printf ("\t%u: EVT(%lu): %-6s %6lu 0x%08lx\n", 74 i, evt->type, str, evt->pos, evt->val 75 ); 76 77 i += 1; 78 evt = evt->next; 79 } 80 } 81 82 return (0); 83} 84 85int pri_list_tracks (pri_img_t *img) 86{ 87 return (pri_for_all_tracks (img, pri_list_track_cb, NULL)); 88}