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


C++ panicf函数代码示例

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


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

示例1: fflush

int fflush(FILE *stream) {
  if(stream == 0) {
    panicf("not yet implemented (fflush(0))");
    /*
    int res;
    FILE *f;
    __fflush_stdin();
    __fflush_stdout();
    __fflush_stderr(); 
    for(res=0, f=__stdio_root; f; f=f->next)
      if(fflush(f))
        res=-1;
    return res; */
  }
//  if (stream->flags&NOBUF) return 0;
  if(stream->flags & BUFINPUT) {
    register int tmp;
    if ((tmp=stream->bm-stream->bs)) {
      panicf("not yet implemented (fflush lseek)");
      //      lseek(stream->fd,tmp,SEEK_CUR);
    }
    stream->bs=stream->bm=0;
  } else {
    if (stream->bm && write(stream->fd,stream->buf,stream->bm)!=(int)stream->bm) {
      stream->flags|=ERRORINDICATOR;
      return -1;
    }
    stream->bm=0;
  }
  return 0;
}
开发者ID:mmikulicic,项目名称:mikucos,代码行数:31,代码来源:stdio.c

示例2: handle_out_ep

static void handle_out_ep(int ep)
{
    struct usb_ctrlrequest *req = (void*)AS3525_UNCACHED_ADDR(&setup_desc->data1);
    int ep_sts = USB_OEP_STS(ep) & ~USB_OEP_STS_MASK(ep);

    if (ep > 3)
        panicf("out_ep > 3!?");

    USB_OEP_STS(ep) = ep_sts; /* ACK */

    if (ep_sts & USB_EP_STAT_BNA) { /* Buffer was not set up */
        int ctrl = USB_OEP_CTRL(ep);
        logf("ep%d OUT, status %x ctrl %x (BNA)\n", ep, ep_sts, ctrl);
        panicf("ep%d OUT 0x%x 0x%x (BNA)", ep, ep_sts, ctrl);
        ep_sts &= ~USB_EP_STAT_BNA;
    }

    if (ep_sts & USB_EP_STAT_OUT_RCVD) {
        struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc;
        int dma_sts = uc_desc->status;
        int dma_len = dma_sts & 0xffff;

        if (!(dma_sts & USB_DMA_DESC_ZERO_LEN)) {
             logf("EP%d OUT token, st:%08x len:%d frm:%x data=%s epstate=%d\n",
                 ep, dma_sts & 0xf8000000, dma_len, (dma_sts >> 16) & 0x7ff,
                 make_hex(uc_desc->data_ptr, dma_len), endpoints[ep][1].state);
             /*
              * If parts of the just dmaed range are in cache, dump them now.
              */
             discard_dcache_range(uc_desc->data_ptr, dma_len);
        } else{
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:31,代码来源:usb-drv-as3525.c

示例3: usb_slave_mode

/* inline since branch is chosen at compile time */
static inline void usb_slave_mode(bool on)
{
    int rc;

    if(on)
    {
        DEBUGF("Entering USB slave mode\n");
        storage_soft_reset();
        storage_init();
        storage_enable(false);
        usb_enable(true);
        cpu_idle_mode(true);
    }
    else
    {
        DEBUGF("Leaving USB slave mode\n");

        cpu_idle_mode(false);

        /* Let the ISDx00 settle */
        sleep(HZ*1);

        usb_enable(false);

        rc = storage_init();
        if(rc)
            panicf("storage: %d",rc);

        rc = disk_mount_all();
        if (rc <= 0) /* no partition */
            panicf("mount: %d",rc);
    }
}
开发者ID:shuffle2,项目名称:rockbox_psgroove,代码行数:34,代码来源:usb.c

示例4: handle_ep0_complete

static void handle_ep0_complete(bool is_ack)
{
    switch(ep0_state)
    {
        case EP0_WAIT_SETUP:
            panicf("usb-drv: EP0 completion while waiting for SETUP");
        case EP0_WAIT_ACK:
            if(is_ack)
                /* everything is done, prepare next setup */
                prepare_setup_ep0();
            else
                panicf("usb-drv: EP0 data completion while waiting for ACK");
            break;
        case EP0_WAIT_DATA:
            if(is_ack)
                panicf("usb-drv: EP0 ACK while waiting for data completion");
            else
                /* everything is done, prepare next setup */
                prepare_setup_ep0();
            break;
        case EP0_WAIT_DATA_ACK:
            /* update state */
            if(is_ack)
                ep0_state = EP0_WAIT_DATA;
            else
                ep0_state = EP0_WAIT_ACK;
            break;
        default:
            panicf("usb-drv: invalid EP0 state");
    }
    logf("usb-drv: EP0 state updated to %d", ep0_state);
}
开发者ID:ntj,项目名称:rockbox,代码行数:32,代码来源:usb-drv-as3525v2.c

示例5: sim_kernel_init

static bool sim_kernel_init(void)
{
    sim_irq_mtx = SDL_CreateMutex();
    if (sim_irq_mtx == NULL)
    {
        panicf("Cannot create sim_handler_mtx\n");
        return false;
    }

    sim_thread_cond = SDL_CreateCond();
    if (sim_thread_cond == NULL)
    {
        panicf("Cannot create sim_thread_cond\n");
        return false;
    }
#ifndef HAVE_SDL_THREADS
    wfi_cond = SDL_CreateCond();
    if (wfi_cond == NULL)
    {
        panicf("Cannot create wfi\n");
        return false;
    }
    wfi_mutex = SDL_CreateMutex();
    if (wfi_mutex == NULL)
    {
        panicf("Cannot create wfi mutex\n");
        return false;
    }
#endif
    return true;
}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:31,代码来源:kernel-sdl.c

示例6: uart1_puts

void uart1_puts(const char *str, int size)
{
    if(size>SEND_RING_SIZE)
        panicf("Too much data passed to uart1_puts");

    /* Wait for the previous transfer to finish */
    while(uart1_send_count>0);
        
    memcpy(uart1_send_buffer_ring, str, size);
    
    /* Disable interrupt while modifying the pointers */
    bitclr16(&IO_INTC_EINT0, INTR_EINT0_UART1);
    
    uart1_send_count=size;
    uart1_send_read=0;
    
    /* prime the hardware buffer */
    while(((IO_UART1_TFCR & 0x3f) < 0x20) && (uart1_send_count > 0))
    {
        IO_UART1_DTRR=uart1_send_buffer_ring[uart1_send_read++];
        uart1_send_count--;
    }
    
    /* Enable interrupt */
    bitset16(&IO_INTC_EINT0, INTR_EINT0_UART1);
}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:26,代码来源:uart-dm320.c

示例7: tick_start

void tick_start(unsigned int interval_in_ms)
{
    unsigned long count;
    int prescale;

    count = CPU_FREQ/2 * interval_in_ms / 1000 / 16;

    if(count > 0x10000)
    {
        panicf("Error! The tick interval is too long (%d ms)\n",
               interval_in_ms);
        return;
    }

    prescale = cpu_frequency / CPU_FREQ;
    /* Note: The prescaler is later adjusted on-the-fly on CPU frequency
       changes within timer.c */
    
    /* We are using timer 0 */

    TRR0 = (unsigned short)(count - 1); /* The reference count */
    TCN0 = 0; /* reset the timer */
    TMR0 = 0x001d | ((unsigned short)(prescale - 1) << 8); 
           /* restart, CLK/16, enabled, prescaler */

    TER0 = 0xff; /* Clear all events */

    ICR1 = 0x8c; /* Interrupt on level 3.0 */
    IMR &= ~0x200;
}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:30,代码来源:kernel-coldfire.c

示例8: do_add_event

static bool do_add_event(unsigned short id, bool oneshot, bool user_data_valid,
                         void *handler, void *user_data)
{
    int i;
    
    /* Check if the event already exists. */
    for (i = 0; i < MAX_SYS_EVENTS; i++)
    {
        if (events[i].handler.callback == handler && events[i].id == id
                && (!user_data_valid || (user_data == events[i].handler.user_data)))
            return false;
    }
    
    /* Try to find a free slot. */
    for (i = 0; i < MAX_SYS_EVENTS; i++)
    {
        if (events[i].handler.callback == NULL)
        {
            events[i].id = id;
            events[i].oneshot = oneshot;
            if ((events[i].has_user_data = user_data_valid))
                events[i].handler.user_data = user_data;
            events[i].handler.callback = handler;
            return true;
        }
    }
    
    panicf("event line full");
    return false;
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:30,代码来源:events.c

示例9: dbg_append

int dbg_append(char* name)
{
    int x=0;
    int size, fd, rc;
    char tmp[CHUNKSIZE+1];

    fd = open(name,O_RDONLY);
    if (fd<0) {
        DEBUGF("Failed opening file\n");
        return -1;
    }

    size = lseek(fd, 0, SEEK_END);
    DEBUGF("File is %d bytes\n", size);
    x = size / CHUNKSIZE;
    LDEBUGF("Check base is %x (%d)\n",x,size);

    if (close(fd) < 0)
        return -1;

    fd = open(name,O_RDWR|O_APPEND);
    if (fd<0) {
        DEBUGF("Failed opening file\n");
        return -1;
    }

    sprintf(tmp,"%c%06x,",name[1],x++);
    rc = write(fd, tmp, 8);
    if ( rc < 0 )
        panicf("Failed writing data\n");

    return close(fd);
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:33,代码来源:main.c

示例10: target_set_medium

int target_set_medium(target_context_t *tc, const char *medium)
{
	char cmdbuf [CMDBUF_LENGTH];

	msgf("setting medium to %s\n", medium);

#ifndef WIN32
	/* if medium is Ethernet, negotiate remote MAC before switching */
	if (!strcmp(medium, TM_ETHERNET))
		if(target_negotiate_mac(tc) == -1){
			return -1;
		}
#endif

	snprintf(cmdbuf, sizeof cmdbuf, "medium %s", medium);
	target_write_command(tc, cmdbuf);
	if(target_confirm_response(tc) == -1){
		return -1;
	}
	if (!strcmp(medium, TM_ETHERNET)) {
		tc->mtu = ETHERNET_MTU;
#ifndef WIN32
		tc->write = target_write_ethernet;
#endif
	} else if (!strcmp(medium, TM_SERIAL)) {
		tc->mtu = SERIAL_MTU;
		tc->write = target_write_serial;
	} else{
		panicf("unknown medium: %s", medium);
		return -1;
	}
	tc->medium = medium;
	return 0;
}
开发者ID:miettal,项目名称:armadillo420_standard_linux314,代码行数:34,代码来源:target.c

示例11: target_get_mac

static int target_get_mac(target_context_t *tc)
{
	char buf [LINE_LENGTH];

	/* read MAC address from target */
	msg("getting target MAC\n");
	target_write_command(tc, "mac");
	target_gets(tc, buf, sizeof buf);
	if(target_confirm_response(tc) == -1){
		return -1;
	}

	/* and parse it */
	msgf("target-provided remote MAC: %s", buf);
	if (parsemac(tc->remote_mac, buf)){
		panicf("can't parse target-provided remote MAC: %s", buf);
		return -1;
	}
	if (opt_verbose) {
		msg("target-provided remote MAC (parsed): ");
		printmac(stdout, tc->remote_mac);
		msg("\n");
	}
	return 0;
}
开发者ID:miettal,项目名称:armadillo420_standard_linux314,代码行数:25,代码来源:target.c

示例12: system_init

void system_init(void)
{
    SDL_sem *s;
    /* fake stack, OS manages size (and growth) */
    stackbegin = stackend = (uintptr_t*)&s;

#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
    /* Make glib thread safe */
    g_thread_init(NULL);
    g_type_init();
#endif

    if (SDL_Init(SDL_INIT_TIMER))
        panicf("%s", SDL_GetError());

    s = SDL_CreateSemaphore(0); /* 0-count so it blocks */

    evt_thread = SDL_CreateThread(sdl_event_thread, s);

    /* wait for sdl_event_thread to run so that it can initialize the surfaces
     * and video subsystem needed for SDL events */
    SDL_SemWait(s);
    /* cleanup */
    SDL_DestroySemaphore(s);
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:25,代码来源:system-sdl.c

示例13: imx233_touchscreen_init

void imx233_touchscreen_init(void)
{
    touch_chan = imx233_lradc_acquire_channel(TIMEOUT_NOBLOCK);
    touch_delay = imx233_lradc_acquire_delay(TIMEOUT_NOBLOCK);
    if(touch_chan < 0 || touch_delay < 0)
        panicf("Cannot acquire channel and delays for touchscreen measurement");
    imx233_touchscreen_enable(false);
}
开发者ID:4nykey,项目名称:rockbox,代码行数:8,代码来源:touchscreen-imx233.c

示例14: arbiter_reserve

// doesn't check in use !
void arbiter_reserve(struct channel_arbiter_t *a, unsigned channel)
{
    // assume semaphore has a free slot immediately
    if(semaphore_wait(&a->sema, TIMEOUT_NOBLOCK) != OBJ_WAIT_SUCCEEDED)
        panicf("arbiter_reserve failed on semaphore_wait !");
    mutex_lock(&a->mutex);
    a->free_bm &= ~(1 << channel);
    mutex_unlock(&a->mutex);
}
开发者ID:albb0920,项目名称:rockbox,代码行数:10,代码来源:kernel-imx233.c

示例15: dma_release

void dma_release(void)
{
    if(--dma_used == 0)
    {
        DMAC_CONFIGURATION &= ~(1<<0);
        CGU_PERI &= ~CGU_DMA_CLOCK_ENABLE;
    }
    if (dma_used < 0)
        panicf("dma_used < 0!");
}
开发者ID:eisnerd,项目名称:rockbox,代码行数:10,代码来源:dma-pl081.c


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