本文整理汇总了C++中panicf函数的典型用法代码示例。如果您正苦于以下问题:C++ panicf函数的具体用法?C++ panicf怎么用?C++ panicf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了panicf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: dma_release
void dma_release(void)
{
if(--dma_used == 0)
{
bitclr32(&DMAC_CONFIGURATION, 1<<0);
bitclr32(&CGU_PERI, CGU_DMA_CLOCK_ENABLE);
}
if (dma_used < 0)
panicf("dma_used < 0!");
}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:10,代码来源:dma-pl081.c
示例17: read_random_writes_cache
static void read_random_writes_cache(int bank, int phys_segment)
{
int page = 0;
short log_segment;
unsigned char spare_buf[16];
nand_read_raw(bank, phys_segment_to_page_addr(phys_segment, page),
SECTOR_SIZE, /* offset to first sector's spare */
16, spare_buf);
log_segment = get_log_segment_id(phys_segment, spare_buf);
if (log_segment == -1)
return;
/* Find which cache this is related to */
int cache_no = find_write_cache(log_segment);
if (cache_no == -1)
{
if (write_caches_in_use < MAX_WRITE_CACHES)
{
cache_no = write_caches_in_use;
write_caches_in_use++;
}
else
{
panicf("Max NAND write caches reached");
}
}
write_caches[cache_no].log_segment = log_segment;
write_caches[cache_no].random_bank = bank;
write_caches[cache_no].random_phys_segment = phys_segment;
#ifndef FTL_V1
/* Loop over each page in the phys segment (from page 1 onwards).
Read spare for 1st sector, store location of page in array. */
for (page = 1;
page < (nand_data->pages_per_block * nand_data->planes);
page++)
{
unsigned short cached_page;
nand_read_raw(bank, phys_segment_to_page_addr(phys_segment, page),
SECTOR_SIZE, /* offset to first sector's spare */
16, spare_buf);
cached_page = get_cached_page_id(spare_buf);
if (cached_page != 0xFFFF)
write_caches[cache_no].page_map[cached_page] = page;
}
#endif /* !FTL_V1 */
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:55,代码来源:ata-nand-telechips.c
示例18: usb_drv_recv
int usb_drv_recv(int ep, void *ptr, int len)
{
struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc;
ep &= 0x7f;
logf("usb_drv_recv(%d,%x,%d)\n", ep, (int)ptr, len);
if (len > USB_DMA_DESC_RXTX_BYTES)
panicf("usb_recv: len=%d > %d", len, USB_DMA_DESC_RXTX_BYTES);
if ((int)ptr & 31) {
logf("addr %08x not aligned!\n", (int)ptr);
}
endpoints[ep][1].state |= EP_STATE_BUSY;
endpoints[ep][1].len = len;
endpoints[ep][1].rc = -1;
/* remove data buffer from cache */
discard_dcache_range(ptr, len);
/* DMA setup */
uc_desc->status = USB_DMA_DESC_BS_HST_RDY |
USB_DMA_DESC_LAST |
len;
if (len == 0) {
uc_desc->status |= USB_DMA_DESC_ZERO_LEN;
uc_desc->data_ptr = 0;
} else {
uc_desc->data_ptr = AS3525_PHYSICAL_ADDR(ptr);
}
USB_OEP_DESC_PTR(ep) = AS3525_PHYSICAL_ADDR((int)&dmadescs[ep][1]);
USB_OEP_STS(ep) = USB_EP_STAT_OUT_RCVD; /* clear status */
/* Make sure receive DMA is on */
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE)){
USB_DEV_CTRL |= USB_DEV_CTRL_RDE;
if (!(USB_DEV_CTRL & USB_DEV_CTRL_RDE))
logf("failed to enable RDE!\n");
}
USB_OEP_CTRL(ep) |= USB_EP_CTRL_CNAK; /* Go! */
if (USB_OEP_CTRL(ep) & USB_EP_CTRL_NAK) {
int i = 0;
while (USB_OEP_CTRL(ep) & USB_EP_CTRL_NAK) {
USB_OEP_CTRL(ep) |= USB_EP_CTRL_CNAK; /* Go! */
i++;
}
logf("ep%d CNAK needed %d retries CTRL=%x\n", ep, i, (int)USB_OEP_CTRL(ep));
}
return 0;
}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:54,代码来源:usb-drv-as3525.c
示例19: dbg_chkfile
int dbg_chkfile(char* name, int size)
{
char text[81920];
int i;
int x=0;
int pos = 0;
int block=0;
int 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);
/* random start position */
if ( size )
pos = ((int)rand() % size) & ~7;
lseek(fd, pos, SEEK_SET);
x = pos / CHUNKSIZE;
LDEBUGF("Check base is %x (%d)\n",x,pos);
while (1) {
int rc = read(fd, text, sizeof text);
DEBUGF("read %d bytes\n",rc);
if (rc < 0) {
panicf("Failed reading data\n");
}
else {
char tmp[CHUNKSIZE+1];
if (!rc)
break;
for (i=0; i<rc/CHUNKSIZE; i++ ) {
sprintf(tmp,"%c%06x,",name[1],x++);
if (strncmp(text+i*CHUNKSIZE,tmp,CHUNKSIZE)) {
int idx = pos + block*sizeof(text) + i*CHUNKSIZE;
DEBUGF("Mismatch in byte 0x%x (byte 0x%x of sector 0x%x)."
"\nExpected %.8s found %.8s\n",
idx, idx % SECTOR_SIZE, idx / SECTOR_SIZE,
tmp,
text+i*CHUNKSIZE);
DEBUGF("i=%x, idx=%x\n",i,idx);
dbg_dump_buffer(text+i*CHUNKSIZE - 0x20, 0x40, idx - 0x20);
return -1;
}
}
}
block++;
}
return close(fd);
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:53,代码来源:main.c
示例20: font_get
/*
* Return a pointer to an incore font structure.
* If the requested font isn't loaded/compiled-in,
* decrement the font number and try again.
*/
struct font* font_get(int font)
{
struct font* pf;
while (1) {
pf = sysfonts[font];
if (pf && pf->height)
return pf;
if (--font < 0)
panicf("No font!");
}
}
开发者ID:CrashSerious,项目名称:rockbox_psgroove,代码行数:17,代码来源:font.c
注:本文中的panicf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论