Ejemplo n.º 1
0
int profilerThread(void *data)
{
	PROFILER *instance = (PROFILER *) data;
	int index;
	int i;

	KNLLOG("************* Starting Profiler Thread **************\n");

	while (1) {
		set_current_state(TASK_INTERRUPTIBLE);
		schedule();

		if (kthread_should_stop()) {
			break;
		}

		gosSemTake(instance->semData);

		for (index = 0; index < (HISTORY_SIZE); index++) {
			instance->profilerStats.currTime =
			    microSec(instance->profilerData.end[index] -
				     instance->profilerData.start[index]);

			for (i = (HISTORY_SIZE - 1); i > 0; i--) {
				instance->profilerData.history[i] =
				    instance->profilerData.history[i - 1];
			}

			instance->profilerData.history[0] =
			    instance->profilerStats.currTime;

			if (instance->profilerStats.maxTime <
			    instance->profilerStats.currTime) {
				instance->profilerStats.maxTime =
				    instance->profilerStats.currTime;
			}

			instance->profilerStats.avgPercentTime =
			    percentAvg(instance, index);

			if (instance->profilerStats.maxAvgPercentTime <
			    instance->profilerStats.avgPercentTime) {
				instance->profilerStats.maxAvgPercentTime =
				    instance->profilerStats.avgPercentTime;
			}

			instance->profilerStats.avgWeightedTime =
			    weightedAvg(instance);

			if (instance->profilerStats.maxAvgWeightedTime <
			    instance->profilerStats.avgWeightedTime) {
				instance->profilerStats.maxAvgWeightedTime =
				    instance->profilerStats.avgWeightedTime;
			}
		}
		gosSemGive(instance->semData);
	}
	KNLLOG("************* Exiting Profiler Thread **************\n");
	return 0;
}
Ejemplo n.º 2
0
static int dec_filereadThread( void * unused )
{
   VC03_FrameBuffer_t  * frameBuf;
   mm_segment_t old_fs;
   int nbytes = 0;
   int seqNum = 0;
   int framesize = 0;
   char * framesizep = vmalloc( 10 );

   while( dec_quitnow == 0 )
   {
      if( read_hdl )
      {
         framesize = 0;

         old_fs = get_fs();
         set_fs( get_ds() );

         /* write the size of this frame, take this line out if you just want the raw bit stream */
         /* you will need the size in case you want the decoder side of this test to work */
         read_hdl->f_op->read( read_hdl, (void *)&framesize, sizeof(int), &read_hdl->f_pos ); 

         KNLLOG("framesize=%d\n", framesize);
         if( framesize <= 0 )
         {
            printk("framesize is incorrect %d\n", framesize );
            set_fs(old_fs);
            break;
         }
         frameBuf = (VC03_FrameBuffer_t *)vmalloc( framesize + sizeof( VC03_FrameBufferHdr_t ) );
         
         read_hdl->f_op->read( read_hdl, frameBuf->data, framesize, &read_hdl->f_pos ); 

         set_fs( old_fs );
         /* timestamp is a don't care*/
         frameBuf->hdr.frame.seq_num = seqNum++;
         frameBuf->hdr.frame.timestamp = 0;
         frameBuf->hdr.frame.flags = 1;
         /* data length is the one that matters */
         frameBuf->hdr.frame.data_len = framesize;

         enqueueFrameBuffer( &gVCTest_decFramesList, frameBuf, 0 );

         /* tell the VC03 that there are frames available for decode */
         vc03_sendframe( 0 );
      }

      /* sleep for the amount of time requested */
      set_current_state(  TASK_INTERRUPTIBLE );
      schedule_timeout( ((HZ)/dec_framerate) );
   }
   printk("file done\n");
   
}
Ejemplo n.º 3
0
/*
 * do_IRQ handles all hardware IRQ's.  Decoded IRQs should not
 * come via this function.  Instead, they should provide their
 * own 'handler'
 */
asmlinkage void __exception_irq_entry
asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
{
	struct pt_regs *old_regs = set_irq_regs(regs);
#ifdef CONFIG_BCM_KNLLOG_IRQ
	struct irq_desc *desc;
#endif

	irq_enter();

	/*
	 * Some hardware gives randomly wrong interrupts.  Rather
	 * than crashing, do something sensible.
	 */
	if (unlikely(irq >= nr_irqs)) {
		if (printk_ratelimit())
			printk(KERN_WARNING "Bad IRQ%u\n", irq);
		ack_bad_irq(irq);
	} else {
#ifdef CONFIG_BCM_KNLLOG_IRQ
		desc = irq_desc + irq;
		if (gKnllogIrqSchedEnable & KNLLOG_IRQ)
			KNLLOG("in  [%d] (0x%x)\n", irq, (int)desc);
#endif
		generic_handle_irq(irq);
	}

#ifdef CONFIG_BCM_KNLLOG_IRQ
	if (gKnllogIrqSchedEnable & KNLLOG_IRQ)
		KNLLOG("out [%d] (0x%x)\n", irq, (int)desc);
#endif

	/* AT91 specific workaround */
	irq_finish(irq);

	irq_exit();
	set_irq_regs(old_regs);
}
Ejemplo n.º 4
0
static int halAudioHss_egress( void )
{
   int i, len;
   DMA_CFG *cfgp;
   char * dmaBufp;
   numEgressCalled++;
   for( i=0; i < HSS_NUM_CHANNEL; i++ )
   {
#if 0
      /* Note this piece of code that commented out is for forming the DMA samples
       * from 2 media streams, where the media samples should be interleaved */
      /* convert media samples to dma samples */
      {
         int k;
         short * ptr1 = (short *)hssMixerEgressBuf[i];
         short * ptr2 = (short *)hssMixerEgressBuf[i+1];

         for( k = ((hssCblk.cfg[i].packetLen / 4)-1); k >= 0; k-- )
         {
            ptr1[2*k] = ptr1[k];
            ptr1[2*k+1] = ptr2[k];
         }
      }
#endif
      /* since the DMA samples are directly being used as media samples, no change is necessary */
      dmaBufp = hssMixerEgressBuf[i];

      /* Write data to Tx DMA */
      cfgp = &dmaCblk.cfg[i];
#ifdef CONFIG_BCM_IODUMP_SUPPORT
      iodump_write( i+halAudioHSSCodecOffset, IODUMP_TDM_EGRESS_WB, hssCblk.cfg[i].packetLen, dmaBufp );
#endif
      
      len = dmalTx( dmaCblk.drvp, cfgp->tx.ch, dmaBufp, hssCblk.cfg[i].packetLen );
      if( unlikely( len != hssCblk.cfg[i].packetLen ) )
      {
         KNLLOG( "HSS Unable to write Tx buffer for codec %i, len %i\n", i, len );
         numEgressError[i]++;
      }
   }
   
   return 0;
}
Ejemplo n.º 5
0
/*
 * Initialize by setting up the sysctl and proc/knllog entries, allocating
 * default storage and resetting the variables.
 */
void knllog_init(void)
{
   /* register sysctl table */
   printk(KERN_NOTICE "%s\n", __FUNCTION__);

#ifdef CONFIG_MAGIC_SYSRQ
   register_sysrq_key('z', &sysrq_knllog_op);
#endif
   gSysCtlHeader = register_sysctl_table( gSysCtl );
   if ( gSysCtlHeader == NULL )
   {
      printk(KERN_ERR "%s: could not register sysctl table\n", __FUNCTION__);
   }

   memset(&knllog, 0, sizeof(KNLLOG_OBJ));   /* zero entries, idx, wrap, and enable */
   knllog.entries = 0;
   knllog.idx = 0;
   knllog.wrap = 0;
   knllog.enable = 0;   /* Logging on by default */
   knllog.entries = KNLLOG_DEFAULT_ENTRIES;
   knllog.maxargs = MAXARGS;
   knllog.bufp = (KNLLOG_ENTRY *)vmalloc(sizeof(KNLLOG_ENTRY) * knllog.entries);
   if (knllog.bufp == NULL)
   {
      knllog.entries = 0;
      knllog.enable = 0;
      printk(KERN_ERR "%s: Cannot allocate memory for knllog buffer\n", __FUNCTION__);   /* i.e. don't enable it. */
      return;
   }
   strcpy(knllog.filename, "/tmp/knllog.txt");  /* default local file name */
   knllog.logfile = 1;                          /* log to local file by default */
   strcpy(knllog.ipaddr, "10.136.49.91");       /* dummy host ip address */
   knllog.port = 4000;                          /* default logging ip:port */
   knllog.sleeptime = 0;                        /* default sleep time between events */
   knllog.dumping = 0;                          /* not dumping at init */

#if defined ( CONFIG_BCM_PERFCNT_SUPPORT )
   knllog.use_perfcnt = 0;                      /* don't use perf counters by default */
#endif

   /* Create dumping to file or socket thread */
   init_completion(&knllogExited);
   knllogThreadPid = kernel_thread(knllog_thread, 0, 0);

#if 0 /* TEST */
   KNLLOG("testnoarg\n", 0);
   KNLLOG("test %d\n", 0);
   KNLLOG("test2 val1=0x%x, val2=%d", 1, 2);
   KNLLOG("test3 val1=%d val2=0x%08x, val3=%05d", 1,2,3);
   KNLLOG("test4 %d %d %d %d\n", 0xf000,2,3,4);
   KNLLOG("test4 0x%x 0x%04x 0x%08x %u", 0xf000,2,3,4);
   KNLLOG("test5 %d\n\n\n\n\n\n", 0);
   KNLLOG("test6\n\n\n\n\n\n");
   KNLLOG("test7\nbla1\nbla2\n%d\n\n\n\n\n\n", 1234);
   KNLLOG("\n\n\n");
   KNLLOG("\n");
   KNLLOG("");
   {
       uint8_t  mem[] =
       {
           'T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 't', 'e', 's', 't', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 126, 127, 128, 129, 130
       };

       KNLLOG_DUMP_MEM( 0, mem, sizeof( mem ));
   }
#endif
}