当前位置: 首页>>代码示例>>C++>>正文


C++ PDEBUG函数代码示例

本文整理汇总了C++中PDEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ PDEBUG函数的具体用法?C++ PDEBUG怎么用?C++ PDEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PDEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: citty_ioctl

/* the real citty_ioctl function.
 * The above is done to get the small functions*/
static int citty_ioctl(struct tty_struct *tty,
		       unsigned int cmd, unsigned long arg)
{
	struct file *file = NULL;
	F_ENTER();

	switch (cmd) {
	case TIOCGSERIAL:
		return citty_ioctl_tiocgserial(tty, file, cmd, arg);
	case TIOCMIWAIT:
		return citty_ioctl_tiocmiwait(tty, file, cmd, arg);
	case TIOCGICOUNT:
		return citty_ioctl_tiocgicount(tty, file, cmd, arg);
#ifndef TCGETS2
	case TCSETS:
		if (user_termios_to_kernel_termios(&tty->termios,
				(struct termios __user *) arg))
			return -EFAULT;
		else
			return 0;
	case TCGETS:
		if (kernel_termios_to_user_termios(
				(struct termios __user *)arg, &tty->termios))
			return -EFAULT;
		else
			return 0;
#else
	case TCSETS:
		if (user_termios_to_kernel_termios_1(&tty->termios,
				(struct termios __user *) arg))
			return -EFAULT;
		else
			return 0;
	case TCSETS2:
		if (user_termios_to_kernel_termios(&tty->termios,
				(struct termios2 __user *) arg))
			return -EFAULT;
		else
			return 0;
	case TCGETS:
		if (kernel_termios_to_user_termios_1(
				(struct termios __user *)arg, &tty->termios))
			return -EFAULT;
		else
			return 0;
	case TCGETS2:
		if (kernel_termios_to_user_termios(
				(struct termios2 __user *)arg, &tty->termios))
			return -EFAULT;
		else
			return 0;
#endif
	case TCSETSF:             /* 0x5404 */
	case TCSETAF:             /* 0x5408 */

		return 0;         /* has to return zero for qtopia to work */
	default:
		PDEBUG("citty_ioctl cmd: %d.\n", cmd);
		return -ENOIOCTLCMD;           /* for PPPD to work? */

		break;
	}

	F_LEAVE();

}
开发者ID:acorn-marvell,项目名称:brillo_pxa_kernel,代码行数:68,代码来源:citty.c

示例2: pthread_handle_create


//.........这里部分代码省略.........
			__pthread_sig_cancel, new_thread);
#else
	  pid = clone(pthread_start_thread_event, (void **) new_thread,
			CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
			__pthread_sig_cancel, new_thread);
#endif

	  saved_errno = errno;
	  if (pid != -1)
	    {
	      /* Now fill in the information about the new thread in
	         the newly created thread's data structure.  We cannot let
	         the new thread do this since we don't know whether it was
	         already scheduled when we send the event.  */
	      new_thread->p_eventbuf.eventdata = new_thread;
	      new_thread->p_eventbuf.eventnum = TD_CREATE;
	      __pthread_last_event = new_thread;

	      /* We have to set the PID here since the callback function
		 in the debug library will need it and we cannot guarantee
		 the child got scheduled before the debugger.  */
	      new_thread->p_pid = pid;

	      /* Now call the function which signals the event.  */
	      __linuxthreads_create_event ();

	      /* Now restart the thread.  */
	      __pthread_unlock(new_thread->p_lock);
	    }
	}
    }
  if (pid == 0)
    {
      PDEBUG("cloning new_thread = %p\n", new_thread);
#ifdef __ia64__
      pid = __clone2(pthread_start_thread, (void **) new_thread,
			(char *)new_thread - new_thread_bottom,
		    CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
		    __pthread_sig_cancel, new_thread);
#else
      pid = clone(pthread_start_thread, (void **) new_thread,
		    CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
		    __pthread_sig_cancel, new_thread);
#endif
      saved_errno = errno;
    }
  /* Check if cloning succeeded */
  if (pid == -1) {
    /******************************************************** 
     * Code inserted to remove the thread from our list of active
     * threads in case of failure (needed to cope with uClinux), 
     * See comment below. */
    new_thread->p_nextlive->p_prevlive = new_thread->p_prevlive;
    new_thread->p_prevlive->p_nextlive = new_thread->p_nextlive;
    /********************************************************/

    /* Free the stack if we allocated it */
    if (attr == NULL || !attr->__stackaddr_set)
      {
#ifdef __ARCH_USE_MMU__
	if (new_thread->p_guardsize != 0)
	  munmap(new_thread->p_guardaddr, new_thread->p_guardsize);
	munmap((caddr_t)((char *)(new_thread+1) - INITIAL_STACK_SIZE),
	       INITIAL_STACK_SIZE);
#else
	free(new_thread_bottom);
开发者ID:OPSF,项目名称:uClinux,代码行数:67,代码来源:manager.c

示例3: spi_worker_thread

static void spi_worker_thread(void *arg)
{
    struct _spi_device_st *spi_device = spi_dev;
    struct _smsspi_txmsg *msg = NULL;
    struct _spi_msg txmsg;

    PDEBUG("worker start");
    do {
        /* do we have a msg to write ? */
        if (!msg && !list_empty(&spi_device->txqueue))
            msg = (struct _smsspi_txmsg *)
                  list_entry(spi_device->txqueue.
                             next, struct _smsspi_txmsg, node);

        if (msg) {
            if (msg->add_preamble)
            {
                txmsg.len =
                    min(msg->size + sizeof(smsspi_preamble),
                        (size_t) TX_BUFFER_SIZE);
                txmsg.buf = spi_device->txbuf;
                txmsg.buf_phy_addr = spi_device->txbuf_phy_addr;
                memcpy(txmsg.buf, smsspi_preamble,
                       sizeof(smsspi_preamble));
                memcpy(&txmsg.buf[sizeof(smsspi_preamble)],
                       msg->buffer,
                       txmsg.len - sizeof(smsspi_preamble));
                msg->add_preamble = 0;
                msg->buffer +=
                    txmsg.len - sizeof(smsspi_preamble);
                msg->size -=
                    txmsg.len - sizeof(smsspi_preamble);
                /* zero out the rest of aligned buffer */
                memset(&txmsg.buf[txmsg.len], 0,
                       TX_BUFFER_SIZE - txmsg.len);
                smsspi_common_transfer_msg(&spi_device->dev,
                                           &txmsg, 1);
            } else {
                txmsg.len =
                    min(msg->size, (size_t) TX_BUFFER_SIZE);
                txmsg.buf = spi_device->txbuf;
                txmsg.buf_phy_addr = spi_device->txbuf_phy_addr;
                memcpy(txmsg.buf, msg->buffer, txmsg.len);

                msg->buffer += txmsg.len;
                msg->size -= txmsg.len;
                /* zero out the rest of aligned buffer */
                memset(&txmsg.buf[txmsg.len], 0,
                       TX_BUFFER_SIZE - txmsg.len);
                smsspi_common_transfer_msg(&spi_device->dev,
                                           &txmsg, 0);
            }

        } else {
            smsspi_common_transfer_msg(&spi_device->dev, NULL, 1);
        }

        /* if there was write, have we finished ? */
        if (msg && !msg->size) {
            /* call postwrite call back */
            if (msg->postwrite)
                msg->postwrite(spi_device);

            list_del(&msg->node);
            complete(&msg->completion);
            msg = NULL;
        }
        /* if there was read, did we read anything ? */

    } while (!list_empty(&spi_device->txqueue) || msg);

    PDEBUG("worker end");

}
开发者ID:TeamButter,项目名称:android_kernel_samsung_mint,代码行数:74,代码来源:smsspidrv.c

示例4: startup

/* startup()
 *
 * Handles mundane tasks of setting up logging, becoming a daemon, and
 * initializing signal handlers.
 */
static int startup(int argc, char **argv)
{
	struct sigaction handler;
#ifdef MORE_FDS
	int filemax;
	struct rlimit lim;
#endif

	if (is_daemon) {
		int logfd;
#ifndef CAPFS_LOG_DIR
		/* old behavior */
		char logname[] = "/tmp/capfsdlog.XXXXXX";

		if ((logfd = mkstemp(logname)) == -1) 
#else
		/* new, less obtuse behavior */
		char logname[4096];

		snprintf(logname, 4095, "%s/capfsd", CAPFS_LOG_DIR);
		if ((logfd = open(logname, O_APPEND|O_CREAT|O_RDWR, 0700)) == -1) 
#endif
		{
			PDEBUG(D_SPECIAL, "couldn't create logfile...continuing...\n");
			close(0); close(1); close(2);
		}
		else {
			fchmod(logfd, 0755);
			dup2(logfd, 2);
			dup2(logfd, 1);
			close(0);
		}
		if (fork()) {
			exit(0); /* fork() and kill parent */
		}
		setsid();
	}	

#ifdef MORE_FDS
	/* Try to increase number of open FDs.
	 *
	 * NOTE:
	 * The system maximum must be increased in order for us to be able to
	 * take advantage of an increase for this process.  This value is
	 * stored in /proc/sys/fs/file-max and is manipulated here with the
	 * get_filemax() and set_filemax() functions.
	 *
	 * NONE OF THIS CODE IS ANY GOOD UNTIL THE UNDERLYING TRANSPORT IS
	 * BETTER.  Specifically the sockset code needs to utilize larger
	 * numbers of FDs, as well as the code that associates sockets with
	 * files in the job code.  I'm going to leave this code here, but
	 * it's useless for the moment.
	 */
	if ((filemax = get_filemax()) < 0) {
		PERROR( "warning: get_filemax failed\n");
	}
	/* let's make sure there are plenty of FDs to go around */
	else if (filemax < 2*CAPFSD_NOFILE) {
		if ((filemax = set_filemax(2*CAPFSD_NOFILE)) < 0) {
			PERROR( "warning: set_filemax failed\n");
		}
	}
	/* now we take care of the per-process limits */
	if (getrlimit(RLIMIT_NOFILE, &lim) < 0) {
		PERROR( "warning: getrlimit failed\n");
	}
	else {
		lim.rlim_cur=(lim.rlim_cur<CAPFSD_NOFILE) ? CAPFSD_NOFILE : lim.rlim_cur;
		lim.rlim_max=(lim.rlim_max<CAPFSD_NOFILE) ? CAPFSD_NOFILE : lim.rlim_max;
		if (setrlimit(RLIMIT_NOFILE, &lim) < 0) {
			PERROR( "warning: setrlimit failed\n");
		}
	}
#endif

	/* change working dir to avoid unnecessary busy file systems */
	if (chdir("/") != 0) {
		exiterror("could not change working directory to /\n");
		exit(1);
	}

	memset(&handler, 0, sizeof(struct sigaction));
	handler.sa_sigaction = (void *) do_signal;
	handler.sa_flags = SA_SIGINFO;
	/* set up SIGINT handler to shut things down */
	if (sigaction(SIGINT, &handler, NULL) != 0) {
		exiterror("Could not setup signal handler for SIGINT");
		exit(1);
	}
	/* set up SIGTERM handler to shut things down */
	if (sigaction(SIGTERM, &handler, NULL) != 0) {
		exiterror("Could not setup signal handler for SIGTERM");
		exit(1);
	}
	/* set up SIGHUP handler to restart the daemon */
//.........这里部分代码省略.........
开发者ID:mnv104,项目名称:capfs,代码行数:101,代码来源:capfsd.c

示例5: __pthread_manager

int attribute_noreturn __pthread_manager(void *arg)
{
  int reqfd = (int) (long int) arg;
#ifdef USE_SELECT
  struct timeval tv;
  fd_set fd;
#else
  struct pollfd ufd;
#endif
  sigset_t manager_mask;
  int n;
  struct pthread_request request;

  /* If we have special thread_self processing, initialize it.  */
#ifdef INIT_THREAD_SELF
  INIT_THREAD_SELF(&__pthread_manager_thread, 1);
#endif
  /* Set the error variable.  */
  __pthread_manager_thread.p_errnop = &__pthread_manager_thread.p_errno;
  __pthread_manager_thread.p_h_errnop = &__pthread_manager_thread.p_h_errno;

#ifdef __UCLIBC_HAS_XLOCALE__
  /* Initialize thread's locale to the global locale. */
  __pthread_manager_thread.locale = __global_locale;
#endif /* __UCLIBC_HAS_XLOCALE__ */

  /* Block all signals except __pthread_sig_cancel and SIGTRAP */
  sigfillset(&manager_mask);
  sigdelset(&manager_mask, __pthread_sig_cancel); /* for thread termination */
  sigdelset(&manager_mask, SIGTRAP);            /* for debugging purposes */
  if (__pthread_threads_debug && __pthread_sig_debug > 0)
      sigdelset(&manager_mask, __pthread_sig_debug);
  sigprocmask(SIG_SETMASK, &manager_mask, NULL);
  /* Raise our priority to match that of main thread */
  __pthread_manager_adjust_prio(__pthread_main_thread->p_priority);
  /* Synchronize debugging of the thread manager */
  n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request,
				     sizeof(request)));
#ifndef USE_SELECT
  ufd.fd = reqfd;
  ufd.events = POLLIN;
#endif
  /* Enter server loop */
  while(1) {
#ifdef USE_SELECT
    tv.tv_sec = 2;
    tv.tv_usec = 0;
    FD_ZERO (&fd);
    FD_SET (reqfd, &fd);
    n = select (reqfd + 1, &fd, NULL, NULL, &tv);
#else
    PDEBUG("before poll\n");
    n = poll(&ufd, 1, 2000);
    PDEBUG("after poll\n");
#endif
    /* Check for termination of the main thread */
    if (getppid() == 1) {
      pthread_kill_all_threads(SIGKILL, 0);
      _exit(0);
    }
    /* Check for dead children */
    if (terminated_children) {
      terminated_children = 0;
      pthread_reap_children();
    }
    /* Read and execute request */
#ifdef USE_SELECT
    if (n == 1)
#else
    if (n == 1 && (ufd.revents & POLLIN))
#endif
    {

      PDEBUG("before __libc_read\n");
      n = __libc_read(reqfd, (char *)&request, sizeof(request));
      PDEBUG("after __libc_read, n=%d\n", n);
      switch(request.req_kind) {
      case REQ_CREATE:
        PDEBUG("got REQ_CREATE\n");
        request.req_thread->p_retcode =
          pthread_handle_create((pthread_t *) &request.req_thread->p_retval,
                                request.req_args.create.attr,
                                request.req_args.create.fn,
                                request.req_args.create.arg,
                                &request.req_args.create.mask,
                                request.req_thread->p_pid,
                                request.req_thread->p_report_events,
                                &request.req_thread->p_eventbuf.eventmask);
        PDEBUG("restarting %d\n", request.req_thread);
        restart(request.req_thread);
        break;
      case REQ_FREE:
        PDEBUG("got REQ_FREE\n");
        pthread_handle_free(request.req_args.free.thread_id);
        break;
      case REQ_PROCESS_EXIT:
        PDEBUG("got REQ_PROCESS_EXIT from %d, exit code = %d\n", 
        request.req_thread, request.req_args.exit.code);
        pthread_handle_exit(request.req_thread,
                            request.req_args.exit.code);
//.........这里部分代码省略.........
开发者ID:OPSF,项目名称:uClinux,代码行数:101,代码来源:manager.c

示例6: PDEBUG

int QpskSymbolMapper::process(Buffer* const dataIn, Buffer* dataOut)
{
    PDEBUG("QpskSymbolMapper::process"
            "(dataIn: %p, dataOut: %p)\n",
            dataIn, dataOut);

    dataOut->setLength(dataIn->getLength() * 4 * 2 * sizeof(float));   // 4 output complex symbols per input byte
#ifdef __SSE__
    const uint8_t* in = reinterpret_cast<const uint8_t*>(dataIn->getData());
    __m128* out = reinterpret_cast<__m128*>(dataOut->getData());

    if (dataIn->getLength() % (d_carriers / 4) != 0) {
        fprintf(stderr, "%zu (input size) %% (%zu (carriers) / 4) != 0\n",
                dataIn->getLength(), d_carriers);
        throw std::runtime_error(
                "QpskSymbolMapper::process input size not valid!");
    }

    const static __m128 symbols[16] = {
        _mm_setr_ps( M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps( M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,- M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,- M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,- M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2),
        _mm_setr_ps(-M_SQRT1_2,- M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2)
    };
    size_t inOffset = 0;
    size_t outOffset = 0;
    uint8_t tmp = 0;
    for (size_t i = 0; i < dataIn->getLength(); i += d_carriers / 4) {
        for (size_t j = 0; j < d_carriers / 8; ++j) {
            tmp =  (in[inOffset] & 0xc0) >> 4;
            tmp |= (in[inOffset + (d_carriers / 8)] & 0xc0) >> 6;
            out[outOffset] = symbols[tmp];
            tmp =  (in[inOffset] & 0x30) >> 2;
            tmp |= (in[inOffset + (d_carriers / 8)] & 0x30) >> 4;
            out[outOffset + 1] = symbols[tmp];
            tmp =  (in[inOffset] & 0x0c);
            tmp |= (in[inOffset + (d_carriers / 8)] & 0x0c) >> 2;
            out[outOffset + 2] = symbols[tmp];
            tmp =  (in[inOffset] & 0x03) << 2;
            tmp |= (in[inOffset + (d_carriers / 8)] & 0x03);
            out[outOffset + 3] = symbols[tmp];
            ++inOffset;
            outOffset += 4;
        }
        inOffset += d_carriers / 8;
    }
#else // !__SSE__
    const uint8_t* in = reinterpret_cast<const uint8_t*>(dataIn->getData());
    float* out = reinterpret_cast<float*>(dataOut->getData());
    if (dataIn->getLength() % (d_carriers / 4) != 0) {
        throw std::runtime_error(
                "QpskSymbolMapper::process input size not valid!");
    }
    if (dataOut->getLength() / sizeof(float) != dataIn->getLength() * 4 * 2) {    // 4 output complex symbols per input byte
        throw std::runtime_error(
                "QpskSymbolMapper::process output size not valid!");
    }

    const static float symbols[16][4] = {
        { M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2},
        { M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2},
        { M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2},
        { M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2},
        { M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2},
        { M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2},
        { M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2},
        { M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2},
        {-M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2},
        {-M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2},
        {-M_SQRT1_2,- M_SQRT1_2,  M_SQRT1_2,  M_SQRT1_2},
        {-M_SQRT1_2,- M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2},
        {-M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2},
        {-M_SQRT1_2,  M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2},
        {-M_SQRT1_2,- M_SQRT1_2, -M_SQRT1_2,  M_SQRT1_2},
        {-M_SQRT1_2,- M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2}
    };
    size_t inOffset = 0;
    size_t outOffset = 0;
    uint8_t tmp;
    for (size_t i = 0; i < dataIn->getLength(); i += d_carriers / 4) {
        for (size_t j = 0; j < d_carriers / 8; ++j) {
            tmp =  (in[inOffset] & 0xc0) >> 4;
            tmp |= (in[inOffset + (d_carriers / 8)] & 0xc0) >> 6;
            memcpy(&out[outOffset], symbols[tmp], sizeof(float) * 4);
            tmp =  (in[inOffset] & 0x30) >> 2;
            tmp |= (in[inOffset + (d_carriers / 8)] & 0x30) >> 4;
            memcpy(&out[outOffset + 4], symbols[tmp], sizeof(float) * 4);
            tmp =  (in[inOffset] & 0x0c);
//.........这里部分代码省略.........
开发者ID:smallscaledab,项目名称:ODR-DabMod,代码行数:101,代码来源:QpskSymbolMapper.cpp

示例7: PDEBUG

int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
{
    PDEBUG("DabModulator::process(dataIn: %p, dataOut: %p)\n",
            dataIn, dataOut);

    myEtiReader.process(dataIn);
    if (myFlowgraph == NULL) {
        unsigned mode = myEtiReader.getMode();
        if (myDabMode != 0) {
            mode = myDabMode;
        } else if (mode == 0) {
            mode = 4;
        }
        setMode(mode);

        myFlowgraph = new Flowgraph();
        ////////////////////////////////////////////////////////////////
        // CIF data initialisation
        ////////////////////////////////////////////////////////////////
        FrameMultiplexer* cifMux = NULL;
        PrbsGenerator* cifPrbs = NULL;
        BlockPartitioner* cifPart = NULL;
        QpskSymbolMapper* cifMap = NULL;
        FrequencyInterleaver* cifFreq = NULL;
        PhaseReference* cifRef = NULL;
        DifferentialModulator* cifDiff = NULL;
        NullSymbol* cifNull = NULL;
        SignalMultiplexer* cifSig = NULL;
        CicEqualizer* cifCicEq = NULL;
        OfdmGenerator* cifOfdm = NULL;
        GainControl* cifGain = NULL;
        GuardIntervalInserter* cifGuard = NULL;
        FIRFilter* cifFilter = NULL;
        Resampler* cifRes = NULL;

        cifPrbs = new PrbsGenerator(864 * 8, 0x110);
        cifMux = new FrameMultiplexer(myFicSizeOut + 864 * 8,
                &myEtiReader.getSubchannels());
        cifPart = new BlockPartitioner(mode, myEtiReader.getFp());
        cifMap = new QpskSymbolMapper(myNbCarriers);
        cifRef = new PhaseReference(mode);
        cifFreq = new FrequencyInterleaver(mode);
        cifDiff = new DifferentialModulator(myNbCarriers);
        cifNull = new NullSymbol(myNbCarriers);
        cifSig = new SignalMultiplexer(
                (1 + myNbSymbols) * myNbCarriers * sizeof(complexf));

        if (myClockRate) {
            unsigned ratio = myClockRate / myOutputRate;
            ratio /= 4; // FPGA DUC
            if (myClockRate == 400000000) { // USRP2
                if (ratio & 1) { // odd
                    cifCicEq = new CicEqualizer(myNbCarriers,
                            (float)mySpacing * (float)myOutputRate / 2048000.0f,
                            ratio);
                } // even, no filter
            } else {
                cifCicEq = new CicEqualizer(myNbCarriers,
                        (float)mySpacing * (float)myOutputRate / 2048000.0f,
                        ratio);
            }
        }

        cifOfdm = new OfdmGenerator((1 + myNbSymbols), myNbCarriers, mySpacing);
        cifGain = new GainControl(mySpacing, myGainMode, myFactor);
        cifGuard = new GuardIntervalInserter(myNbSymbols, mySpacing,
                myNullSize, mySymSize);
        if (myFilterTapsFilename != "") {
            cifFilter = new FIRFilter(myFilterTapsFilename);
            cifFilter->enrol_at(*myRC);
        }
        myOutput = new OutputMemory();

        if (myOutputRate != 2048000) {
            cifRes = new Resampler(2048000, myOutputRate, mySpacing);
        } else {
            fprintf(stderr, "No resampler\n");
        }

        myFlowgraph->connect(cifPrbs, cifMux);

        ////////////////////////////////////////////////////////////////
        // Processing FIC
        ////////////////////////////////////////////////////////////////
        FicSource* fic = myEtiReader.getFic();
        PrbsGenerator* ficPrbs = NULL;
        ConvEncoder* ficConv = NULL;
        PuncturingEncoder* ficPunc = NULL;
        ////////////////////////////////////////////////////////////////
        // Data initialisation
        ////////////////////////////////////////////////////////////////
        myFicSizeIn = fic->getFramesize();

        ////////////////////////////////////////////////////////////////
        // Modules configuration
        ////////////////////////////////////////////////////////////////

        // Configuring FIC channel

        PDEBUG("FIC:\n");
//.........这里部分代码省略.........
开发者ID:barczynsky,项目名称:ODR-DabMod,代码行数:101,代码来源:DabModulator.cpp

示例8: sio_open

/**********************************************************************
 *  sio_open
 *
 *  Open and initiate serial port
 *  default open port in noncanonical mode
 *
 *  Arguments:
 *    port    a string point to the name of serial device,
 *				such as "/dev/ttyS0"
 *    baud    B0, B50... B9600, B19200, B38400...
 *    data    Data bit(s), unsigned char
 *    parity  Parity, unsigned char
 *    stop    Stop bit(s), unsigned char
 *
 *  Returned:
 *    This function returns int port descriptor for the port opened
 *    successfully. Return value ERR_PORT_OPEN if failed.
 *
 **********************************************************************/
int
sio_open(const char *port, speed_t baud, tcflag_t data, tcflag_t parity,
		 tcflag_t stop)
{
	struct sio *sio;			/* point to current sio structure */

	int fd;						/* file descriptor for current port */
	int r;

	struct termios *options;	/* options for current port */

	PDEBUG("sio_open: start\n");

  /***************
   *  open port  *
   ***************/
	fd = _sio_device(port);
	if (fd == 0) {				/* device is not yet opened, so, open it */
		// fd = open(port, O_RDWR | O_NOCTTY | O_NDELAY);
		//printf("%s ... open %s\n",__FUNCTION__, port);
		fd = open(port, O_RDWR | O_NOCTTY);
	}
	PDEBUG("          fd = %u\n", fd);

	if (fd == -1) {				/* Could not open the port */
		PDEBUG("sio_open: Unable to open %s - %s\n", strerror(errno),
			   port);
		return (ERR_PORT_OPEN);
	}

  /********************************
   *  allocate new sio structure  *
   ********************************/
	sio = _sio_follow(fd);
	if (!sio) {					/* out of memory */
		close(fd);
		return (ERR_PORT_OPEN);
	}

	sio->fd = fd;
	sio->name = port;

	// fcntl(fd, F_SETFL, FNDELAY); /* nonblocking */

	tcgetattr(fd, sio->old_options);	/* save the original options */
	tcgetattr(fd, sio->options);	/* Get the current options */

	options = sio->options;

	/*
	 * printf("\nsio_open\n"); printf("name : %s\n", sio->name);
	 * printf("fd : %d\n", fd); printf("sio : %lx\n", sio);
	 * printf("sio->options : %lx\n", sio->options);
	 * printf("sio->old_options : %lx\n", sio->old_options);
	 * printf("options : %lx\n", options); printf("\n"); 
	 */

  /*********************
   *  select Baudrate  *
   *********************/
	r = cfsetispeed(options, baud);	/* input */
	if (r) {
		PDEBUG("sio_open: fails to set input baudrate!\n", r);
		close(fd);
		return (r);
	}
	r = cfsetospeed(options, baud);	/* output */
	if (r) {
		PDEBUG("sio_open: fails to set output baudrate!\n", r);
		close(fd);
		return (r);
	}

  /**********************
   *  select data bits  *
   **********************/
	options->c_cflag &= ~CSIZE;	/* bit mask for data bits */
	options->c_cflag |= data;
	/*
	 * close(fd); PDEBUG("undefined data bits number %d, port %s
	 * closed.\n", data, port); return (ERR_PORT_OPEN); 
//.........这里部分代码省略.........
开发者ID:boris-r-v,项目名称:RIO,代码行数:101,代码来源:sio.c

示例9: rpc_kern_write

ssize_t rpc_kern_write(int opt, const char *buf, size_t count)
{
    RPC_KERN_Dev *dev;
    int temp, size;
    ssize_t ret = 0;
    char *ptmp;

    dev = &rpc_kern_devices[opt*RPC_NR_KERN_DEVS/RPC_NR_PAIR];
    PDEBUG("read rpc_kern_device: %x \n", (unsigned int)dev);
    if (down_interruptible(&dev->writeSem))
        return -ERESTARTSYS;

    if (dev->ringIn == dev->ringOut)
        size = 0;   // the ring is empty
    else if (dev->ringIn > dev->ringOut)
        size = dev->ringIn - dev->ringOut;
    else
        size = RPC_RING_SIZE + dev->ringIn - dev->ringOut;

	if (count > (RPC_RING_SIZE - size - 1))
		goto out;

	temp = dev->ringEnd - dev->ringIn;
	if (temp >= count) {
		if (my_copy_user((int *)dev->ringIn, (int *)buf, count)) {
        	ret = -EFAULT;
			goto out;
		}
		ret += count;
		ptmp = dev->ringIn + ((count+3) & 0xfffffffc);

		__asm__ __volatile__ ("sync;");

		if (ptmp == dev->ringEnd)
			dev->ringIn = dev->ringStart;
		else
			dev->ringIn = ptmp;
    	
    	PDEBUG("RPC Write is in 1st kind...\n");
	} else {
		if (my_copy_user((int *)dev->ringIn, (int *)buf, temp)) {
        	ret = -EFAULT;
			goto out;
		}
		count -= temp;
		
		if (my_copy_user((int *)dev->ringStart, (int *)(buf+temp), count)) {
        	ret = -EFAULT;
			goto out;
		}
		ret += (temp + count);

		__asm__ __volatile__ ("sync;");

		dev->ringIn = dev->ringStart+((count+3) & 0xfffffffc);
    	
    	PDEBUG("RPC Write is in 2nd kind...\n");
	}

	if (opt == RPC_AUDIO)
		writel(0x3, (void *)0xb801a104);        // audio
	else if (opt == RPC_VIDEO)
		writel(0x5, (void *)0xb801a104);        // video
	else
		printk("error device number...\n");

out:
    PDEBUG("RPC kern ringIn pointer is : 0x%8x\n", (int)dev->ringIn);
    up(&dev->writeSem);
    return ret;
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:71,代码来源:RPCkern.c

示例10: _sio_poptions

void _sio_poptions(int fd)
{
	struct sio *sio;

	sio = _sio_follow(fd);

	PDEBUG("sio->old_options->c_iflag = %08x\n",
		   sio->old_options->c_iflag);
	PDEBUG("sio->old_options->c_oflag = %08x\n",
		   sio->old_options->c_oflag);
	PDEBUG("sio->old_options->c_cflag = %08x\n",
		   sio->old_options->c_cflag);
	PDEBUG("sio->old_options->c_lflag = %08x\n",
		   sio->old_options->c_lflag);
	PDEBUG("sio->old_options->c_line  = %08x\n", sio->old_options->c_line);
	PDEBUG("-----------------------------------\n");
	PDEBUG("sio->options->c_iflag = %08x\n", sio->options->c_iflag);
	PDEBUG("sio->options->c_oflag = %08x\n", sio->options->c_oflag);
	PDEBUG("sio->options->c_cflag = %08x\n", sio->options->c_cflag);
	PDEBUG("sio->options->c_lflag = %08x\n", sio->options->c_lflag);
	PDEBUG("sio->options->c_line  = %08x\n", sio->options->c_line);
	PDEBUG("-----------------------------------\n");
}
开发者ID:boris-r-v,项目名称:RIO,代码行数:23,代码来源:sio.c

示例11: gl860_guess_sensor

static int gl860_guess_sensor(struct gspca_dev *gspca_dev,
				u16 vendor_id, u16 product_id)
{
	struct sd *sd = (struct sd *) gspca_dev;
	u8 probe, nb26, nb96, nOV, ntry;

	if (product_id == 0xf191)
		sd->sensor = ID_MI1320;

	if (sd->sensor == 0xff) {
		ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0004, 1, &probe);
		ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0004, 1, &probe);

		ctrl_out(gspca_dev, 0x40, 1, 0x0000, 0x0000, 0, NULL);
		msleep(3);
		ctrl_out(gspca_dev, 0x40, 1, 0x0010, 0x0010, 0, NULL);
		msleep(3);
		ctrl_out(gspca_dev, 0x40, 1, 0x0008, 0x00c0, 0, NULL);
		msleep(3);
		ctrl_out(gspca_dev, 0x40, 1, 0x0001, 0x00c1, 0, NULL);
		msleep(3);
		ctrl_out(gspca_dev, 0x40, 1, 0x0001, 0x00c2, 0, NULL);
		msleep(3);
		ctrl_out(gspca_dev, 0x40, 1, 0x0020, 0x0006, 0, NULL);
		msleep(3);
		ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL);
		msleep(56);

		PDEBUG(D_PROBE, "probing for sensor MI2020 or OVXXXX");
		nOV = 0;
		for (ntry = 0; ntry < 4; ntry++) {
			ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000, 0, NULL);
			msleep(3);
			ctrl_out(gspca_dev, 0x40, 1, 0x0063, 0x0006, 0, NULL);
			msleep(3);
			ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL);
			msleep(10);
			ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, &probe);
			PDEBUG(D_PROBE, "probe=0x%02x", probe);
			if (probe == 0xff)
				nOV++;
		}

		if (nOV) {
			PDEBUG(D_PROBE, "0xff -> OVXXXX");
			PDEBUG(D_PROBE, "probing for sensor OV2640 or OV9655");

			nb26 = nb96 = 0;
			for (ntry = 0; ntry < 4; ntry++) {
				ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000,
						0, NULL);
				msleep(3);
				ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x800a,
						0, NULL);
				msleep(10);

				/* Wait for 26(OV2640) or 96(OV9655) */
				ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x800a,
						1, &probe);

				if (probe == 0x26 || probe == 0x40) {
					PDEBUG(D_PROBE,
						"probe=0x%02x -> OV2640",
						probe);
					sd->sensor = ID_OV2640;
					nb26 += 4;
					break;
				}
				if (probe == 0x96 || probe == 0x55) {
					PDEBUG(D_PROBE,
						"probe=0x%02x -> OV9655",
						probe);
					sd->sensor = ID_OV9655;
					nb96 += 4;
					break;
				}
				PDEBUG(D_PROBE, "probe=0x%02x", probe);
				if (probe == 0x00)
					nb26++;
				if (probe == 0xff)
					nb96++;
				msleep(3);
			}
			if (nb26 < 4 && nb96 < 4)
				return -1;
		} else {
			PDEBUG(D_PROBE, "Not any 0xff -> MI2020");
			sd->sensor = ID_MI2020;
		}
	}

	if (_MI1320_) {
		PDEBUG(D_PROBE, "05e3:f191 sensor MI1320 (1.3M)");
	} else if (_MI2020_) {
		PDEBUG(D_PROBE, "05e3:0503 sensor MI2020 (2.0M)");
	} else if (_OV9655_) {
		PDEBUG(D_PROBE, "05e3:0503 sensor OV9655 (1.3M)");
	} else if (_OV2640_) {
		PDEBUG(D_PROBE, "05e3:0503 sensor OV2640 (2.0M)");
	} else {
//.........这里部分代码省略.........
开发者ID:3null,项目名称:fastsocket,代码行数:101,代码来源:gl860.c

示例12: PDEBUG

PrbsGenerator::~PrbsGenerator()
{
    PDEBUG("PrbsGenerator::~PrbsGenerator() @ %p\n", this);

}
开发者ID:barczynsky,项目名称:ODR-DabMod,代码行数:5,代码来源:PrbsGenerator.cpp

示例13: plx_drv_ioctl

/*
**===========================================================================
** 8.0			pcidriver_ioctl()
**===========================================================================
** Description: 
**
** Parameters:  cmd and a argument
**              
**
** Returns:     some stuff ...
**
** Globals:     
*/
int plx_drv_ioctl(struct inode *inode, struct file *file,
		    unsigned int cmd, unsigned long arg)
{

driver_t  *dev = file->private_data;

  static unsigned char localbuf[IOC_BUFSIZE];
  /* Define "alias" names for the localbuf */
  void *karg = localbuf;
  Register *reg = karg;
  unsigned long *klong = karg;
  Container *container = karg;
 int size = _IOC_SIZE(cmd); /* the size bitfield in cmd */
  int retval = 0; /* success by default */

#if ZERO
PDEBUG(("function: %s, file: %s line: %d invoked\n", __FUNCTION__, __FILE__, __LINE__));
#endif

 /*
   * Extract the type and number bitfields, and don't decode
   * wrong cmds: return EINVAL before verify_area()
   */
  if (_IOC_TYPE(cmd) != MAG_NUM) return -ENOTTY;
  if (_IOC_NR(cmd) > IOC_MAXNR) return -ENOTTY;

  /*
   * The direction is a bitmask, and VERIFY_WRITE catches R/W
   * transfers. `Dir' is user-oriented, while
   * verify_area is kernel-oriented, so the concept of "read" and
   * "write" is reversed
   */
  if (_IOC_DIR(cmd) & _IOC_READ) {
    if (!access_ok(VERIFY_WRITE, (void *)arg, size))
      return -EFAULT;
  }
  else if (_IOC_DIR(cmd) & _IOC_WRITE) {
    if (!access_ok(VERIFY_READ, (void *)arg, size))
      return -EFAULT;
  }

#if ZERO
  PDEBUG(("ioctl.c: %08x %08lx: nr %i, size %i, dir %i\n",
	 cmd, arg, _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd)));
#endif

  /* First, retrieve data from userspace */
  if ((_IOC_DIR(cmd) & _IOC_WRITE) && (size <= IOC_BUFSIZE))
    if (copy_from_user(karg, (void *)arg, size))
      return -EFAULT;

  /* We are ready to switch ... */
  switch (cmd) {

  case READ_PLX_REG:
   {
     if ((plx_read_plx_reg(dev, reg->addr, &(reg->data)) == 0)) { 
//       PDEBUG(("plx_read_fpga_reg: addr: %x and data %x\n", reg->addr, reg->data));
      }
      else
       return -EIO;
 
   }
   break;
  case WRITE_PLX_REG:
   {
     if((plx_write_plx_reg(dev, reg->addr, reg->data)) == 0) {
//         PDEBUG(("plx_write_fpga_reg: addr: %x and data %x\n", reg->addr, reg->data));
      }
      else
       return -EIO; 
 
   }

  break;


  case FILL_PCI_MEM:
    PDEBUG(("plx_ioctl: Fill PCI memory with test pattern!\n")); 

   memset_io(dev->PciBar[2].pVa, 0x11, DMA_SIZE/4);
   memset_io((dev->PciBar[2].pVa)+0x2000, 0x22, DMA_SIZE/4); 
   memset_io((dev->PciBar[2].pVa)+(0x2000*2), 0x33, DMA_SIZE/4); 
   memset_io((dev->PciBar[2].pVa)+(0x2000*3), 0x44, DMA_SIZE/4); 
  break;


//.........这里部分代码省略.........
开发者ID:chalermlab,项目名称:mylittleproject,代码行数:101,代码来源:plx_ioctl.c

示例14: PDEBUG

me_device_t *me4600_pci_constructor(struct pci_dev *pci_device)
#endif				//BOSCH
{
	me4600_device_t *me4600_device;
	me_subdevice_t *subdevice;
	unsigned int version_idx;
	int err;
	int i;

	PDEBUG("executed.\n");

	// Allocate structure for device instance.
	me4600_device = kmalloc(sizeof(me4600_device_t), GFP_KERNEL);

	if (!me4600_device) {
		PERROR("Cannot get memory for ME-4600 device instance.\n");
		return NULL;
	}

	memset(me4600_device, 0, sizeof(me4600_device_t));

	// Initialize base class structure.
	err = me_device_pci_init((me_device_t *) me4600_device, pci_device);

	if (err) {
		kfree(me4600_device);
		PERROR("Cannot initialize device base class.\n");
		return NULL;
	}
	// Download the xilinx firmware.
	if (me4600_device->base.info.pci.device_id == PCI_DEVICE_ID_MEILHAUS_ME4610) {	//Jekyll <=> me4610
		err =
		    me_xilinx_download(me4600_device->base.info.pci.
				       reg_bases[1],
				       me4600_device->base.info.pci.
				       reg_bases[5], &pci_device->dev,
				       "me4610.bin");
	} else {		// General me4600 firmware
#ifdef BOSCH
		err =
		    me_xilinx_download(me4600_device->base.info.pci.
				       reg_bases[1],
				       me4600_device->base.info.pci.
				       reg_bases[5], &pci_device->dev,
				       (me_bosch_fw) ? "me4600_bosch.bin" :
				       "me4600.bin");
#else //~BOSCH
		err =
		    me_xilinx_download(me4600_device->base.info.pci.
				       reg_bases[1],
				       me4600_device->base.info.pci.
				       reg_bases[5], &pci_device->dev,
				       "me4600.bin");
#endif
	}

	if (err) {
		me_device_deinit((me_device_t *) me4600_device);
		kfree(me4600_device);
		PERROR("Cannot download firmware.\n");
		return NULL;
	}
	// Get the index in the device version information table.
	version_idx =
	    me4600_versions_get_device_index(me4600_device->base.info.pci.
					     device_id);

	// Initialize spin locks.
	spin_lock_init(&me4600_device->preload_reg_lock);

	me4600_device->preload_flags = 0;

	spin_lock_init(&me4600_device->dio_lock);
	spin_lock_init(&me4600_device->ai_ctrl_lock);
	spin_lock_init(&me4600_device->ctr_ctrl_reg_lock);
	spin_lock_init(&me4600_device->ctr_clk_src_reg_lock);

	// Create digital input instances.
	for (i = 0; i < me4600_versions[version_idx].di_subdevices; i++) {
		subdevice =
		    (me_subdevice_t *) me4600_di_constructor(me4600_device->
							     base.info.pci.
							     reg_bases[2],
							     &me4600_device->
							     dio_lock);

		if (!subdevice) {
			me_device_deinit((me_device_t *) me4600_device);
			kfree(me4600_device);
			PERROR("Cannot get memory for subdevice.\n");
			return NULL;
		}

		me_slist_add_subdevice_tail(&me4600_device->base.slist,
					    subdevice);
	}

	// Create digital output instances.
	for (i = 0; i < me4600_versions[version_idx].do_subdevices; i++) {
		subdevice =
//.........这里部分代码省略.........
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:101,代码来源:me4600_device.c

示例15: vboxvfs_guest_path_to_char_path_internal

/**
 * Convert guest absolute VFS path (starting from VFS root) to a host path
 * within mounted shared folder (returning it as a char *).
 *
 * @param mp            Mount data structure
 * @param pszGuestPath  Guest absolute VFS path (starting from VFS root)
 * @param cbGuestPath   Size of pszGuestPath
 * @param pszHostPath   Returned char * wich contains host path
 * @param cbHostPath    Returned pszHostPath size
 *
 * @return 0 on success, error code otherwise
 */
int
vboxvfs_guest_path_to_char_path_internal(mount_t mp, char *pszGuestPath, int cbGuestPath, char **pszHostPath, int *cbHostPath)
{
    vboxvfs_mount_t *pMount;

    /* Guest side: mount point path buffer and its size */
    char       *pszMntPointPath;
    int         cbMntPointPath = MAXPATHLEN;

    /* Host side: path within mounted shared folder and its size */
    char       *pszHostPathInternal;
    size_t      cbHostPathInternal;

    int rc;

    AssertReturn(mp, EINVAL);
    AssertReturn(pszGuestPath, EINVAL); AssertReturn(cbGuestPath >= 0, EINVAL);
    AssertReturn(pszHostPath,  EINVAL); AssertReturn(cbHostPath,       EINVAL);

    pMount = (vboxvfs_mount_t *)vfs_fsprivate(mp); AssertReturn(pMount, EINVAL); AssertReturn(pMount->pRootVnode, EINVAL);

    /* Get mount point path */
    pszMntPointPath = (char *)RTMemAllocZ(cbMntPointPath);
    if (pszMntPointPath)
    {
        rc = vn_getpath(pMount->pRootVnode, pszMntPointPath, &cbMntPointPath);
        if (rc == 0 && cbGuestPath >= cbMntPointPath)
        {
            cbHostPathInternal  = cbGuestPath - cbMntPointPath + 1;
            pszHostPathInternal = (char *)RTMemAllocZ(cbHostPathInternal);
            if (pszHostPathInternal)
            {
                memcpy(pszHostPathInternal, pszGuestPath + cbMntPointPath, cbGuestPath - cbMntPointPath);
                PDEBUG("guest<->host path converion result: '%s' mounted to '%s'", pszHostPathInternal, pszMntPointPath);

                RTMemFree(pszMntPointPath);

                *pszHostPath = pszHostPathInternal;
                *cbHostPath  = cbGuestPath - cbMntPointPath;

                return 0;

            }
            else
            {
                PDEBUG("No memory to allocate buffer for guest<->host path conversion (cbHostPathInternal)");
                rc = ENOMEM;
            }

        }
        else
        {
            PDEBUG("Unable to get guest vnode path: %d", rc);
        }

        RTMemFree(pszMntPointPath);
    }
    else
    {
        PDEBUG("No memory to allocate buffer for guest<->host path conversion (pszMntPointPath)");
        rc = ENOMEM;
    }

    return rc;
}
开发者ID:jbremer,项目名称:virtualbox,代码行数:77,代码来源:VBoxVFS-utils.cpp


注:本文中的PDEBUG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。