int main(int argc, char *argv[])
{
    int i;

    // Zero out the register
    for (i = 0; i < SKIROC2_SC_NWORDS; i++) {
        control_register->data[i] = 0;
    }

    //printf("'lookup_table' has %d entries.\n", LOOKUP_TABLE_SIZE);

    //dump_table();

    // Before config
    printf("'control_register' has %d bits encoded in %d words.\n", SKIROC2_SC_NBITS, SKIROC2_SC_NWORDS);

    dump_register();

    // After config
    printf("'control_register' after initialization with default values.\n");

    skiroc2_slow_control_set_default();

    dump_register();

    // Write to file
    dump_register_to_file();

    printf("Created file '%s'.\n", control_register_file);

    return 0;
}
Exemplo n.º 2
0
static void
register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int properties)
{
  char *dot_name, *flag_name, *glob_name;
  const char *prefix;
  char num[10];
  int flags;

  /* See below in next_pass_1.  */
  num[0] = '\0';
  if (pass->static_pass_number != -1)
    sprintf (num, "%d", ((int) pass->static_pass_number < 0
			 ? 1 : pass->static_pass_number));

  dot_name = concat (".", pass->name, num, NULL);
  if (ipa)
    prefix = "ipa-", flags = TDF_IPA;
  else if (properties & PROP_trees)
    prefix = "tree-", flags = TDF_TREE;
  else
    prefix = "rtl-", flags = TDF_RTL;

  flag_name = concat (prefix, pass->name, num, NULL);
  glob_name = concat (prefix, pass->name, NULL);
  pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
                                            flags, pass->letter);
}
Exemplo n.º 3
0
void panic(char *str, unsigned long sp)
{
	kernel_fatal("PANIC: caused by %s loop forever\n", str);

	dump_register(sp);

	while(1);
}
Exemplo n.º 4
0
int dump_registers(hackrf_device* device) {
	uint16_t register_number;
	int result = HACKRF_SUCCESS;
	
	for(register_number=0; register_number<256; register_number++) {
		result = dump_register(device, register_number);
		if( result != HACKRF_SUCCESS ) {
			break;
		}
	}
	
	return result;
}
Exemplo n.º 5
0
static void
register_one_dump_file (struct tree_opt_pass *pass, bool ipa, int n)
{
  char *dot_name, *flag_name, *glob_name;
  char num[10];

  /* See below in next_pass_1.  */
  num[0] = '\0';
  if (pass->static_pass_number != -1)
    sprintf (num, "%d", ((int) pass->static_pass_number < 0
			 ? 1 : pass->static_pass_number));

  dot_name = concat (".", pass->name, num, NULL);
  if (ipa)
    {
      flag_name = concat ("ipa-", pass->name, num, NULL);
      glob_name = concat ("ipa-", pass->name, NULL);
      /* First IPA dump is cgraph that is dumped via separate channels.  */
      pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
                                                TDF_IPA, n + 1, 0);
    }
  else if (pass->properties_provided & PROP_trees)
    {
      flag_name = concat ("tree-", pass->name, num, NULL);
      glob_name = concat ("tree-", pass->name, NULL);
      pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
                                                TDF_TREE, n + TDI_tree_all, 0);
    }
  else
    {
      flag_name = concat ("rtl-", pass->name, num, NULL);
      glob_name = concat ("rtl-", pass->name, NULL);
      pass->static_pass_number = dump_register (dot_name, flag_name, glob_name,
                                                TDF_RTL, n, pass->letter);
    }
}
/** @brief Dump register value 
*	
*	@param vfile virtual file which provide information to the user or system administrator
*	@param v
*
*/
int dump_laura_register_read(struct seq_file *vfile, void *v){
	int rc = 0;
	struct msm_laser_focus_ctrl_t *dev_t = get_laura_ctrl();

	LOG_Handler(LOG_FUN, "%s: Enter\n", __func__);

	mutex_ctrl(dev_t, MUTEX_LOCK);
	
	/* Dump register value */
	rc = dump_register(vfile, dev_t, DUMP_REGISTER_RANGE_MIN, DUMP_REGISTER_RANGE_MAX);
	
	mutex_ctrl(dev_t, MUTEX_UNLOCK);

	LOG_Handler(LOG_FUN, "%s: Exit\n", __func__);

	return rc;
}
Exemplo n.º 7
0
static void dump_registers(uint32_t regbase,
		uint32_t *dwords, uint32_t sizedwords, int level)
{
	while (sizedwords--) {
		int last_summary = summary;

		/* access to non-banked registers needs a WFI:
		 * TODO banked register range for a2xx??
		 */
		if (needs_wfi && !is_banked_reg(regbase))
			printf("NEEDS WFI: %s (%x)\n", regname(regbase, 1), regbase);

		type0_reg_vals[regbase] = *dwords;
		type0_reg_written[regbase/8] |= (1 << (regbase % 8));
		dump_register(regbase, *dwords, level);
		regbase++;
		dwords++;
		summary = last_summary;
	}
}
Exemplo n.º 8
0
static int dbug_thread(void *unused) 
{
   while(g_start_debug_thread)
   	{
      ACCFIX_DEBUG("dbug_thread INREG32(ACCDET_BASE + 0x0008)=%x\n",INREG32(ACCDET_BASE + 0x0008));
	  ACCFIX_DEBUG("[accfix]dbug_thread:sample_in:%x!\n", INREG32(ACCDET_SAMPLE_IN));	
	  ACCFIX_DEBUG("[accfix]dbug_thread:curr_in:%x!\n", INREG32(ACCDET_CURR_IN));
	  ACCFIX_DEBUG("[accfix]dbug_thread:mem_in:%x!\n", INREG32(ACCDET_MEMORIZED_IN));
	  ACCFIX_DEBUG("[accfix]dbug_thread:FSM:%x!\n", INREG32(ACCDET_BASE + 0x0050));
      ACCFIX_DEBUG("[accfix]dbug_thread:IRQ:%x!\n", INREG32(ACCDET_IRQ_STS));
      if(g_dump_register)
	  {
	    dump_register();
		dump_pmic_register(); 
      }

	  msleep(500);

   	}
   return 0;
}
Exemplo n.º 9
0
#include <linux/usb/ch9.h>

#include "core.h"
#include "gadget.h"
#include "io.h"
#include "debug.h"

#define dump_register(nm)				\
{							\
	.name	= __stringify(nm),			\
	.offset	= DWC3_ ##nm - DWC3_GLOBALS_REGS_START,	\
}

static const struct debugfs_reg32 dwc3_regs[] = {
	dump_register(GSBUSCFG0),
	dump_register(GSBUSCFG1),
	dump_register(GTXTHRCFG),
	dump_register(GRXTHRCFG),
	dump_register(GCTL),
	dump_register(GEVTEN),
	dump_register(GSTS),
	dump_register(GSNPSID),
	dump_register(GGPIO),
	dump_register(GUID),
	dump_register(GUCTL),
	dump_register(GBUSERRADDR0),
	dump_register(GBUSERRADDR1),
	dump_register(GPRTBIMAP0),
	dump_register(GPRTBIMAP1),
	dump_register(GHWPARAMS0),
Exemplo n.º 10
0
/*
 * xhci-debugfs.c - xHCI debugfs interface
 *
 * Copyright (C) 2017 Intel Corporation
 *
 * Author: Lu Baolu <*****@*****.**>
 */

#include <linux/slab.h>
#include <linux/uaccess.h>

#include "xhci.h"
#include "xhci-debugfs.h"

static const struct debugfs_reg32 xhci_cap_regs[] = {
	dump_register(CAPLENGTH),
	dump_register(HCSPARAMS1),
	dump_register(HCSPARAMS2),
	dump_register(HCSPARAMS3),
	dump_register(HCCPARAMS1),
	dump_register(DOORBELLOFF),
	dump_register(RUNTIMEOFF),
	dump_register(HCCPARAMS2),
};

static const struct debugfs_reg32 xhci_op_regs[] = {
	dump_register(USBCMD),
	dump_register(USBSTS),
	dump_register(PAGESIZE),
	dump_register(DNCTRL),
	dump_register(CRCR),
Exemplo n.º 11
0
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/types.h>

#include "c8sectpfe-debugfs.h"

#define dump_register(nm ...)			\
{						\
	.name	= #nm,				\
	.offset	= nm,				\
}

static const struct debugfs_reg32 fei_sys_regs[] = {
    dump_register(SYS_INPUT_ERR_STATUS),
    dump_register(SYS_OTHER_ERR_STATUS),
    dump_register(SYS_INPUT_ERR_MASK),
    dump_register(SYS_DMA_ROUTE),
    dump_register(SYS_INPUT_CLKEN),
    dump_register(IBENABLE_MASK),
    dump_register(SYS_OTHER_CLKEN),
    dump_register(SYS_CFG_NUM_IB),
    dump_register(SYS_CFG_NUM_MIB),
    dump_register(SYS_CFG_NUM_SWTS),
    dump_register(SYS_CFG_NUM_TSOUT),
    dump_register(SYS_CFG_NUM_CCSC),
    dump_register(SYS_CFG_NUM_RAM),
    dump_register(SYS_CFG_NUM_TP),

    dump_register(C8SECTPFE_IB_IP_FMT_CFG(0)),
Exemplo n.º 12
0
int main(int argc, char** argv) {
	int opt;
	uint16_t register_number = REGISTER_INVALID;
	uint16_t register_value;
	
	int result = hackrf_init();
	if( result ) {
		printf("hackrf_init() failed: %s (%d)\n", hackrf_error_name(result), result);
		return -1;
	}
	
	hackrf_device* device = NULL;
	result = hackrf_open(&device);
	if( result ) {
		printf("hackrf_open() failed: %s (%d)\n", hackrf_error_name(result), result);
		return -1;
	}

	int option_index = 0;
	while( (opt = getopt_long(argc, argv, "cn:rw:", long_options, &option_index)) != EOF ) {
		switch( opt ) {
		case 'n':
			result = parse_int(optarg, &register_number);
			break;
		
		case 'w':
			result = parse_int(optarg, &register_value);
			if( result == HACKRF_SUCCESS ) {
				result = write_register(device, register_number, register_value);
			}
			break;
		
		case 'r':
			if( register_number == REGISTER_INVALID ) {
				result = dump_registers(device);
			} else {
				result = dump_register(device, register_number);
			}
			break;
		
		case 'c':
			dump_configuration(device);
			break;

		default:
			usage();
		}
		
		if( result != HACKRF_SUCCESS ) {
			printf("argument error: %s (%d)\n", hackrf_error_name(result), result);
			break;
		}
	}
	
	result = hackrf_close(device);
	if( result ) {
		printf("hackrf_close() failed: %s (%d)\n", hackrf_error_name(result), result);
		return -1;
	}
	
	hackrf_exit();
    
    return 0;
}