本文整理汇总了C++中DBG_PRINTF函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_PRINTF函数的具体用法?C++ DBG_PRINTF怎么用?C++ DBG_PRINTF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBG_PRINTF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MapFile
/**********************************************************************
* 函数名称: MapFile
* 功能描述: 使用mmap函数映射一个文件到内存,以后就可以直接通过内存来访问文件
* 输入参数: ptFileMap - 内含文件名strFileName
* 输出参数: ptFileMap - tFp : 所打开的文件句柄
* iFileSize : 文件大小
* pucFileMapMem : 映射内存的首地址
* 返 回 值: 0 - 成功
* 其他值 - 失败
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
* 2013/02/08 V1.0 韦东山 创建
***********************************************************************/
int MapFile(PT_FileMap ptFileMap)
{
int iFd;
FILE *tFp;
struct stat tStat;
/* 打开文件 */
tFp = fopen(ptFileMap->strFileName, "r+");
if (tFp == NULL)
{
DBG_PRINTF("can't open %s\n", ptFileMap->strFileName);
return -1;
}
ptFileMap->tFp = tFp;
/*fileno()用来取得参数stream指定的文件流所使用的文件描述符*/
iFd = fileno(tFp);
fstat(iFd, &tStat);
ptFileMap->iFileSize = tStat.st_size;
ptFileMap->pucFileMapMem = (unsigned char *)mmap(NULL , tStat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, iFd, 0);
if (ptFileMap->pucFileMapMem == (unsigned char *)-1)
{
DBG_PRINTF("mmap error!\n");
return -1;
}
return 0;
}
示例2: CscsInit
/*******************************************************************************
* Function Name: CscsInit()
********************************************************************************
*
* Summary:
* Initializes the Cycling Speed and Cadence Service.
*
*******************************************************************************/
void CscsInit(void)
{
uint8 buff[CSC_MEASUREMENT_CHAR_SIZE];
/* Register service specific callback function */
CyBle_CscsRegisterAttrCallback(CscsCallback);
/* Get initial value of CSC Measurement Characteristic */
if(CyBle_CscssGetCharacteristicValue(CYBLE_CSCS_CSC_MEASUREMENT, CSC_MEASUREMENT_CHAR_SIZE, buff) !=
CYBLE_ERROR_OK)
{
DBG_PRINTF("Failed to read the CSC Measurement value.\r\n");
}
/* Set initial CSC Characteristic flags as per values set in the customizer */
cscFlags = buff[0u];
/* Get the CSC Feature */
/* Get the characteristic into the buffer */
if((CyBle_CscssGetCharacteristicValue(CYBLE_CSCS_CSC_FEATURE, CSC_FEATURE_SIZE, buff)) == CYBLE_ERROR_OK)
{
cscFeature = (uint16) ((((uint16) buff[1u]) << ONE_BYTE_SHIFT) | ((uint16) buff[0u]));
}
else
{
DBG_PRINTF("Failed to read the CSC Feature value.\r\n");
}
}
示例3: DBG_PRINTF
void
db_error_dialog::handle_error()
{
int btn_id = m_btn_group->checkedId();
DBG_PRINTF(3, "handle_error clicked=%d", btn_id);
if (btn_id == action_quit) {
gl_pApplication->cleanup();
// we want to really quit, not just leave the main event loop
::exit(1);
}
if (btn_id == action_reconnect) {
db_cnx db;
if (!db.ping()) {
DBG_PRINTF(3, "No reply to database ping");
if (!db.datab()->reconnect()) {
DBG_PRINTF(3, "Failed to reconnect to database");
return;
}
else {
DBG_PRINTF(3, "Database reconnect successful");
}
}
}
// when btn_id == action_continue, there is nothing to do.
close();
}
示例4: FreeTypeFontInit
static int FreeTypeFontInit(char *pcFontFile, unsigned int dwFontSize)
{
int iError;
/* ÏÔʾʸÁ¿×ÖÌå */
iError = FT_Init_FreeType(&g_tLibrary ); /* initialize library */
/* error handling omitted */
if (iError)
{
DBG_PRINTF("FT_Init_FreeType failed\n");
return -1;
}
iError = FT_New_Face(g_tLibrary, pcFontFile, 0, &g_tFace); /* create face object */
/* error handling omitted */
if (iError)
{
DBG_PRINTF("FT_Init_FreeType failed\n");
return -1;
}
g_tSlot = g_tFace->glyph;
iError = FT_Set_Pixel_Sizes(g_tFace, dwFontSize, 0);
if (iError)
{
DBG_PRINTF("FT_Set_Pixel_Sizes failed : %d\n", dwFontSize);
return -1;
}
return 0;
}
示例5: set_volume
/* Do the actual work */
void set_volume(int l, int r)
{
int fd, v, cmd, devs;
DBG_PRINTF("mixer: set_volume(%d, %d)\n", l, r);
fd = open(MIXER_DEV, O_WRONLY);
if (fd == -1) {
DBG_PRINTF("mixer: Unable to open mixer device\n");
return;
}
ioctl(fd, SOUND_MIXER_DEVMASK, &devs);
if (devs & SOUND_MASK_PCM) {
cmd = SOUND_MIXER_WRITE_PCM;
}
else if (devs & SOUND_MASK_VOLUME) {
cmd = SOUND_MIXER_WRITE_VOLUME;
}
else {
close(fd);
return;
}
v = (r << 8) | l;
ioctl(fd, cmd, &v);
close(fd);
}
示例6: tres_mem_arch_pf_store_step
/*----------------------------------------------------------------------------*/
int
tres_mem_arch_pf_store_step(int id, const uint8_t * buf, int len)
{
int j;
uint16_t tmp;
uint8_t *tmp8;
DBG_PRINTF("tres_mem_arch_pf_store_step()\n");
// ensure that we don't exceed the slot limit
DBG_PRINTF("Len: %d\n", len);
DBG_PRINTF("Cur: %x\n", cur[id]);
DBG_PRINTF("SLOT_END_ADDR: %x\n", SLOT_END_ADDR(id));
if(((SLOT_END_ADDR(id)) - cur[id]) < len) {
return -1;
}
flash_setup();
// write to flash
tmp8 = (uint8_t *) &tmp;
for(j = 0; j < len; j += 2) {
// we need this because buf may be misaligned
tmp8[0] = buf[j];
// don't worry about possible buffer overflow in read mode
tmp8[1] = buf[j + 1];
DBG_PRINTF("Writing @%x\n", cur[id]);
flash_write((unsigned short *)cur[id], tmp);
cur[id] += 2;
}
return 0;
}
示例7: mail
/*
Iterate through the tree items of the Current mail (=unprocessed) tags
to find the one matching 'tag_id'.
If found, change its counters.
*/
void
query_listview::update_tag_current_counter(uint tag_id)
{
if (tag_id!=0) {
if (!m_item_current_tags)
return;
int child_index=0;
query_tag_lvitem* q = static_cast<query_tag_lvitem*>(m_item_current_tags->child(child_index));
while (q) {
if (q->m_tag_id==tag_id) {
DBG_PRINTF(5, "update_tag_current_counter(%d)", tag_id);
qs_tag_map::const_iterator it = m_tagged.find(tag_id);
q->set_title(tags_repository::hierarchy(tag_id),
it != m_tagged.end() ? it->second : NULL);
break; // tag found, stop iterating
}
q = static_cast<query_tag_lvitem*>(m_item_current_tags->child(++child_index));
}
}
else {
if (m_item_current_untagged) {
DBG_PRINTF(5, "update_tag_current_counter(%d)", tag_id);
qs_tag_map::const_iterator it = m_tagged.find(0); // 0=>not tagged
m_item_current_untagged->set_title(tr("Not tagged"),
it != m_tagged.end() ? it->second : NULL);
}
}
}
示例8: ScpsCallBack
/*******************************************************************************
* Function Name: ScpsCallBack()
********************************************************************************
*
* Summary:
* This is an event callback function to receive service specific events from
* SCPS Service.
*
* Parameters:
* event - the event code
* *eventParam - the event parameters
*
* Return:
* None.
*
********************************************************************************/
void ScpsCallBack (uint32 event, void *eventParam)
{
DBG_PRINTF("SCPS event: %lx, ", event);
switch(event)
{
case CYBLE_EVT_SCPSS_NOTIFICATION_ENABLED:
DBG_PRINTF("CYBLE_EVT_SCPSS_NOTIFICATION_ENABLED \r\n");
requestScanRefresh = ENABLED;
break;
case CYBLE_EVT_SCPSS_NOTIFICATION_DISABLED:
DBG_PRINTF("CYBLE_EVT_SCPSS_NOTIFICATION_DISABLED \r\n");
requestScanRefresh = DISABLED;
break;
case CYBLE_EVT_SCPSS_SCAN_INT_WIN_CHAR_WRITE:
scanInterval = CyBle_Get16ByPtr(((CYBLE_SCPS_CHAR_VALUE_T *)eventParam)->value->val);
scanWindow = CyBle_Get16ByPtr(((CYBLE_SCPS_CHAR_VALUE_T *)eventParam)->value->val + sizeof(scanInterval));
DBG_PRINTF("CYBLE_EVT_SCPSS_SCAN_INT_WIN_CHAR_WRITE scanInterval: %x, scanWindow: %x \r\n", scanInterval, scanWindow);
break;
case CYBLE_EVT_SCPSC_NOTIFICATION:
break;
case CYBLE_EVT_SCPSC_READ_DESCR_RESPONSE:
break;
case CYBLE_EVT_SCPSC_WRITE_DESCR_RESPONSE:
break;
default:
DBG_PRINTF("Not supported event\r\n");
break;
}
}
示例9: sni_mem_init
static void sni_mem_init(void )
{
int i, memsize;
struct membank {
u32 size;
u32 base;
u32 size2;
u32 pad1;
u32 pad2;
} memconf[8];
/* MemSIZE from prom in 16MByte chunks */
memsize=*((unsigned char *) SNI_IDPROM_MEMSIZE) * 16;
DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize);
/* get memory bank layout from prom */
__prom_get_memconf(&memconf);
DBG_PRINTF("prom_get_mem_conf memory configuration:\n");
for(i=0;i<8 && memconf[i].size;i++) {
prom_printf("Bank%d: %08x @ %08x\n", i,
memconf[i].size, memconf[i].base);
add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM);
}
}
示例10: dyndns_win32_signal_handler_func
/**
The actual signal handler for Windows.
Does not respond on LOGOFF signal.
Exits on shutdown ..., Ctl-C,...
*/
static int dyndns_win32_signal_handler_func(OS_SIGNAL_TYPE signal, void *p_in)
{
int ret_flag = 0;
DYN_DNS_CLIENT *p_self = (DYN_DNS_CLIENT *) p_in;
if (p_self == NULL)
{
return 0;
}
switch (signal.signal)
{
case OS_CTRL_C_SIGNAL :
case OS_CTRL_CLOSE_SIGNAL :
case OS_CTRL_BREAK_SIGNAL :
case OS_CTRL_SHUTDOWN_SIGNAL :
DBG_PRINTF((LOG_INFO,MODULE_TAG "Signal '0x%x' received. Sending 'Shutdown cmd'.\n", signal));
ret_flag = 1;
p_self->cmd = CMD_STOP;
break;
case OS_CTRL_LOGOFF_SIGNAL :
default:
DBG_PRINTF((LOG_DEBUG,MODULE_TAG "Signal '0x%x' received. NO ACTION.\n", signal));
}
return ret_flag;
}
示例11: tcp_test_connect
RC_TYPE tcp_test_connect(TCP_SOCKET *p_self,CB_EXIT_COND p_exit_func,void *p_cb_data)
{
RC_TYPE rc_is_online=RC_OK;
DBG_PRINTF((LOG_INFO,"I:" MODULE_TAG "entered tcp_test_connect...\n"));
if (get_mutex_try(&test_timer_loop_mutex)==0) {
DBG_PRINTF((LOG_INFO,"I:" MODULE_TAG "timer loop mutex is free in tcp_test_connect...\n"));
rc_is_online=tcp_initialize_async(p_self,p_exit_func,p_cb_data);
release_mutex(&test_timer_loop_mutex);
DBG_PRINTF((LOG_INFO,"I:" MODULE_TAG "tcp_initialize_async returned %d in tcp_test_connect...\n",(rc_is_online==RC_OK)));
}
else {
/*init async presently in timeout loop -- wait for it*/
DBG_PRINTF((LOG_INFO,"I:" MODULE_TAG "timer loop mutex is not free in tcp_test_connect...\n"));
get_mutex(&test_timer_loop_mutex);
release_mutex(&test_timer_loop_mutex);
rc_is_online=global_is_online;
DBG_PRINTF((LOG_INFO,"I:" MODULE_TAG "got timer loop mutex in tcp_test_connect, return to be %d...\n",(rc_is_online==RC_OK)));
}
return rc_is_online;
}
示例12: ShowIntervalPage
/**********************************************************************
* 函数名称: ShowIntervalPage
* 功能描述: 显示"interval页面"
* 输入参数: ptPageLayout - 内含多个图标的文件名和显示区域
* 输出参数: 无
* 返 回 值: 无
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
* 2013/02/08 V1.0 韦东山 创建
***********************************************************************/
static void ShowIntervalPage(PT_PageLayout ptPageLayout)
{
PT_VideoMem ptVideoMem;
int iError;
PT_Layout atLayout = ptPageLayout->atLayout;
/* 1. 获得显存 */
ptVideoMem = GetVideoMem(ID("interval"), 1);
if (ptVideoMem == NULL)
{
DBG_PRINTF("can't get video mem for interval page!\n");
return;
}
/* 2. 描画数据 */
/* 如果还没有计算过各图标的坐标 */
if (atLayout[0].iTopLeftX == 0)
{
CalcIntervalPageLayout(ptPageLayout);
}
iError = GeneratePage(ptPageLayout, ptVideoMem);
iError = GenerateIntervalPageSpecialIcon(g_iIntervalSecond, ptVideoMem);
if (iError)
{
DBG_PRINTF("GenerateIntervalPageSpecialIcon error!\n");
}
/* 3. 刷到设备上去 */
FlushVideoMemToDev(ptVideoMem);
/* 4. 解放显存 */
PutVideoMem(ptVideoMem);
}
示例13: videoin_mmap
static int videoin_mmap (struct file *file, struct vm_area_struct *vma)
{
struct video_device *dev = video_devdata(file);
videoin_priv_t *priv = (videoin_priv_t *)dev->priv;
unsigned long start = vma->vm_start;
unsigned long size = vma->vm_end-vma->vm_start;
unsigned long page, pos;
DBG_PRINTF("%s\n",__FUNCTION__);
DBG_PRINTF("start = 0x%x\n",start);
DBG_PRINTF("size = 0x%x\n",size);
if(bDumpframeBuffer==0)
pos = videoIn_buf[0].u32VirtAddr;
else
pos = videoIn_buf[3].u32VirtAddr;
priv->mmap_bufsize = size;
while (size > 0)
{
page = vmalloc_to_pfn((void *)pos);
if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
{
ERR_PRINTF("remap error\n");
return -EAGAIN;
}
start += PAGE_SIZE;
pos += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
else
size = 0;
}
return 0;
}
示例14: videoin_dmamalloc_phy
unsigned long videoin_dmamalloc_phy(unsigned int u32Buf, unsigned long size)
{
videoin_priv_t *priv = (videoin_priv_t *)&videoin_priv;
void *mem;
unsigned long adr;
DBG_PRINTF("%s\n",__FUNCTION__);
size = PAGE_ALIGN(size);
priv->vaddr = dma_alloc_writecombine(NULL/*dev*/,
size,&priv->paddr,
GFP_KERNEL);
printk("videoin priv->paddr=%x,priv->vaddr=%x\n", priv->paddr, priv->vaddr);
if (!priv->vaddr)
return NULL;
adr = (unsigned long) priv->vaddr;
videoIn_buf[u32Buf].u32PhysAddr = priv->paddr;
if(u32Buf<3)
videoIn_buf[u32Buf+5].u32PhysAddr;
videoIn_buf[u32Buf].u32VirtAddr = adr;
while (size > 0) {
SetPageReserved(vmalloc_to_page((void *)adr));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
DBG_PRINTF("SetPageReserved = 0x%x\n", adr);
return priv->paddr;
}
示例15: dyn_dns_update_ip
/* the real action:
- increment the forced update times counter
- detect current IP
- connect to an HTTP server
- parse the response for IP addr
- for all the names that have to be maintained
- get the current DYN DNS address from DYN DNS server
- compare and update if neccessary
*/
RC_TYPE dyn_dns_update_ip(DYN_DNS_CLIENT *p_self)
{
RC_TYPE rc;
if (p_self == NULL)
{
return RC_INVALID_POINTER;
}
do
{
/*ask IP server something so he will respond and give me my IP */
rc = do_ip_server_transaction(p_self);
if (rc != RC_OK)
{
DBG_PRINTF((LOG_WARNING,"W: DYNDNS: Error '%s' (0x%x) when talking to IP server\n",
errorcode_get_name(rc), rc));
break;
}
if (p_self->dbg.level > 1)
{
DBG_PRINTF((LOG_DEBUG,"DYNDNS: IP server response: %s\n", p_self->p_work_buffer));
}
/*extract my IP, check if different than previous one*/
rc = do_parse_my_ip_address(p_self);
if (rc != RC_OK)
{
break;
}
if (p_self->dbg.level > 1)
{
DBG_PRINTF((LOG_WARNING,"W: DYNDNS: My IP address: %s\n", p_self->info.my_ip_address.name));
}
/*step through aliases list, resolve them and check if they point to my IP*/
rc = do_check_alias_update_table(p_self);
if (rc != RC_OK)
{
break;
}
/*update IPs marked as not identical with my IP*/
rc = do_update_alias_table(p_self);
if (rc != RC_OK)
{
break;
}
}
while(0);
return rc;
}