本文整理汇总了C++中FLAG_SET函数的典型用法代码示例。如果您正苦于以下问题:C++ FLAG_SET函数的具体用法?C++ FLAG_SET怎么用?C++ FLAG_SET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLAG_SET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g_free
/**
* 更新好友信息数据.
* @param pal 好友数据
*/
void UdpData::UpdatePalInfo(PalInfo *pal)
{
g_free(pal->segdes);
pal->segdes = progdt.FindNetSegDescription(ipv4);
g_free(pal->version);
if (!(pal->version = iptux_get_section_string(buf, ':', 0)))
pal->version = g_strdup("?");
g_free(pal->user);
if (!(pal->user = iptux_get_section_string(buf, ':', 2)))
pal->user = g_strdup("???");
g_free(pal->host);
if (!(pal->host = iptux_get_section_string(buf, ':', 3)))
pal->host = g_strdup("???");
if (!FLAG_ISSET(pal->flags, 2)) {
g_free(pal->name);
if (!(pal->name = ipmsg_get_attach(buf, ':', 5)))
pal->name = g_strdup(_("mysterious"));
g_free(pal->group);
pal->group = GetPalGroup();
g_free(pal->iconfile);
if (!(pal->iconfile = GetPalIcon()))
pal->iconfile = g_strdup(progdt.palicon);
FLAG_CLR(pal->flags, 0);
g_free(pal->encode);
if ( (pal->encode = GetPalEncode()))
FLAG_SET(pal->flags, 0);
else
pal->encode = g_strdup(encode ? encode : "utf-8");
}
FLAG_SET(pal->flags, 1);
pal->packetn = 0;
pal->rpacketn = 0;
}
示例2: g_strdup
/**
* 创建好友信息数据.
* @return 好友数据
*/
PalInfo *UdpData::CreatePalInfo()
{
PalInfo *pal;
pal = new PalInfo;
pal->ipv4 = ipv4;
pal->segdes = progdt.FindNetSegDescription(ipv4);
if (!(pal->version = iptux_get_section_string(buf, ':', 0)))
pal->version = g_strdup("?");
if (!(pal->user = iptux_get_section_string(buf, ':', 2)))
pal->user = g_strdup("???");
if (!(pal->host = iptux_get_section_string(buf, ':', 3)))
pal->host = g_strdup("???");
if (!(pal->name = ipmsg_get_attach(buf, ':', 5)))
pal->name = g_strdup(_("mysterious"));
pal->group = GetPalGroup();
pal->photo = NULL;
pal->sign = NULL;
if (!(pal->iconfile = GetPalIcon()))
pal->iconfile = g_strdup(progdt.palicon);
if ( (pal->encode = GetPalEncode()))
FLAG_SET(pal->flags, 0);
else
pal->encode = g_strdup(encode ? encode : "utf-8");
FLAG_SET(pal->flags, 1);
pal->packetn = 0;
pal->rpacketn = 0;
return pal;
}
示例3: clientAutoMaximize
static void
clientAutoMaximize (Client * c, int full_w, int full_h)
{
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN) ||
!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER))
{
/*
* Fullscreen or undecorated windows should not be
* automatically maximized...
*/
return;
}
if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ) &&
(frameWidth (c) > full_w))
{
TRACE ("The application \"%s\" has requested a window width "
"(%u) larger than the actual width available in the workspace (%u), "
"the window will be maximized horizontally.", c->name, frameWidth (c), full_w);
FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ);
}
if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT) &&
(frameHeight (c) > full_h))
{
TRACE ("The application \"%s\" has requested a window height "
"(%u) larger than the actual height available in the workspace (%u), "
"the window will be maximized vertically.", c->name, frameHeight (c), full_h);
FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_VERT);
}
}
示例4: tail_recursion_elimination
tail_recursion_elimination ()
{
int alt;
int tre = 0;
if (no_recursion_elm_flag)
return false;
for (alt = SON (ulhs); alt != nil; alt = BROTHER (alt))
{
int mem = SON (alt);
if (mem == nil)
continue;
if (FLAG_MARKED (alt, no_tail_recursion_opt_f))
continue;
mem = get_last_but_cut_mem (mem);
if (DEF (mem) == ulhs)
{
FLAG_SET (alt, tail_recursion_opt_f);
FLAG_SET (mem, tail_recursion_opt_f);
tre = 1;
}
}
return tre;
}
示例5: nvmed_handle_feature_set
/*
* Set Handle Features
*/
int nvmed_handle_feature_set(NVMED_HANDLE* nvmed_handle, int feature, int value) {
switch(feature) {
case HANDLE_DIRECT_IO:
if(value)
FLAG_SET(nvmed_handle, HANDLE_DIRECT_IO);
else
FLAG_UNSET(nvmed_handle, HANDLE_DIRECT_IO);
break;
case HANDLE_SYNC_IO:
if(value)
FLAG_SET(nvmed_handle, HANDLE_SYNC_IO);
else
FLAG_UNSET(nvmed_handle, HANDLE_SYNC_IO);
break;
case HANDLE_HINT_DMEM:
if(value)
FLAG_SET(nvmed_handle, HANDLE_HINT_DMEM);
else
FLAG_UNSET(nvmed_handle, HANDLE_HINT_DMEM);
break;
}
return value;
}
示例6: USB_Init
void USB_Init(void)
{
extern uint32 __VECTOR_RAM[];
/* Software Configuration */
Setup_Pkt=(tUSB_Setup*)BufferPointer[bEP0OUT_ODD];
gu8USB_State=uPOWER;
/* MPU Configuration */
MPU_CESR=0; // MPU is disable. All accesses from all bus masters are allowed
/* SIM Configuration */
#ifdef USB_CLOCK_CLKIN
FLAG_SET(SIM_SCGC5_PORTE_SHIFT,SIM_SCGC5);
PORTE_PCR26=(0|PORT_PCR_MUX(7)); // Enabling PTE26 as CLK input
#endif
#ifdef USB_CLOCK_PLL
FLAG_SET(SIM_SOPT2_PLLFLLSEL_SHIFT,SIM_SOPT2); // Select PLL output
#endif
#ifndef USB_CLOCK_CLKIN
FLAG_SET(SIM_SOPT2_USBSRC_SHIFT,SIM_SOPT2); // PLL/FLL selected as CLK source
#endif
SIM_CLKDIV2|=USB_FARCTIONAL_VALUE; // USB Freq Divider
SIM_SCGC4|=(SIM_SCGC4_USBOTG_MASK); // USB Clock Gating
/* NVIC Configuration */
__VECTOR_RAM[89]=(UINT32)USB_ISR; //replace ISR
//NVICICER2|=(1<<9); //Clear any pending interrupts on USB
NVICISER2|=(1<<9); //Enable interrupts from USB module
/* USB Module Configuration */
// Reset USB Module
USB0_USBTRC0|=USB_USBTRC0_USBRESET_MASK;
while(FLAG_CHK(USB_USBTRC0_USBRESET_SHIFT,USB0_USBTRC0)){};
// Set BDT Base Register
USB0_BDTPAGE1=(UINT8)((UINT32)tBDTtable>>8);
USB0_BDTPAGE2=(UINT8)((UINT32)tBDTtable>>16);
USB0_BDTPAGE3=(UINT8)((UINT32)tBDTtable>>24);
// Clear USB Reset flag
FLAG_SET(USB_ISTAT_USBRST_MASK,USB0_ISTAT);
// Enable USB Reset Interrupt
FLAG_SET(USB_INTEN_USBRSTEN_SHIFT,USB0_INTEN);
// Enable weak pull downs
USB0_USBCTRL=0x40;
USB0_USBTRC0|=0x40;
USB0_CTL|=0x01;
}
示例7: USB_Reset_Handler
void USB_Reset_Handler(void)
{
//PMC_VLPR_Exit();
/* Software Flags */
u8CDCState=0;
gu8USBClearFlags=0xFF;
gu8USB_Toogle_flags=0;
gu8USB_PingPong_flags=0x00;
/* Disable all data EP registers */
USB0_ENDPT1=0x00;
USB0_ENDPT2=0x00;
USB0_ENDPT3=0x00;
USB0_ENDPT4=0x00;
USB0_ENDPT5=0x00;
USB0_ENDPT6=0x00;
/* EP0 BDT Setup */
// EP0 OUT BDT Settings
tBDTtable[bEP0OUT_ODD].Cnt = EP0_SIZE;
tBDTtable[bEP0OUT_ODD].Addr =(UINT32)gu8EP0_OUT_ODD_Buffer;
tBDTtable[bEP0OUT_ODD].Stat._byte = kUDATA1;
// EP0 OUT BDT Settings
tBDTtable[bEP0OUT_EVEN].Cnt = EP0_SIZE;
tBDTtable[bEP0OUT_EVEN].Addr =(UINT32)gu8EP0_OUT_EVEN_Buffer;
tBDTtable[bEP0OUT_EVEN].Stat._byte = kUDATA1;
// EP0 IN BDT Settings
tBDTtable[bEP0IN_ODD].Cnt = EP0_SIZE;
tBDTtable[bEP0IN_ODD].Addr =(UINT32)gu8EP0_IN_ODD_Buffer;
tBDTtable[bEP0IN_ODD].Stat._byte = kUDATA0;
// EP0 IN BDT Settings
tBDTtable[bEP0IN_EVEN].Cnt = (EP0_SIZE);
tBDTtable[bEP0IN_EVEN].Addr =(UINT32)gu8EP0_IN_EVEN_Buffer;
tBDTtable[bEP0IN_EVEN].Stat._byte = kUDATA0;
// Enable EP0
USB0_ENDPT0=0x0D;
// Clear all Error flags
USB0_ERRSTAT=0xFF;
// CLear all USB ISR flags
USB0_ISTAT=0xFF;
// Set default Address
USB0_ADDR=0x00;
// Enable all error sources
USB0_ERREN=0xFF;
// USB Interrupt Enablers
FLAG_SET(USB_INTEN_TOKDNEEN_SHIFT,USB0_INTEN);
FLAG_SET(USB_INTEN_SOFTOKEN_SHIFT,USB0_INTEN);
FLAG_SET(USB_INTEN_ERROREN_SHIFT,USB0_INTEN);
FLAG_SET(USB_INTEN_USBRSTEN_SHIFT,USB0_INTEN);
}
示例8: nvmed_cache_alloc
/*
* Allocation cache slot and memory
*/
int nvmed_cache_alloc(NVMED* nvmed, unsigned int size, bool lazy_init) {
int i;
unsigned int req_size;
NVMED_CACHE_SLOT *slot;
NVMED_CACHE *info;
u64 *paList;
pthread_spin_lock(&nvmed->mngt_lock);
if(size == 0) return -NVMED_FAULT;
if(size == nvmed->num_cache_size) return 0;
if(size < nvmed->num_cache_size) {
nvmed_printf("%s: Cache shrinking is not supported\n", nvmed->ns_path);
return -NVMED_FAULT;
}
req_size = size - nvmed->num_cache_size;
slot = malloc(sizeof(NVMED_CACHE_SLOT));
slot->cache_info = malloc(sizeof(NVMED_CACHE) * req_size);
slot->cache_ptr = mmap(NULL, PAGE_SIZE * req_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_LOCKED | MAP_SHARED, -1, 0);
slot->size = req_size;
LIST_INSERT_HEAD(&nvmed->slot_head, slot, slot_list);
/* Initialize memory and translate virt to phys addr */
if(!lazy_init) {
paList = malloc(sizeof(u64) * req_size);
virt_to_phys(nvmed, slot->cache_ptr, paList, PAGE_SIZE * req_size);
}
/* fill cache info and add to free list */
for(i=0; i<req_size; i++) {
info = slot->cache_info + i;
info->lpaddr = 0;
info->ref = 0;
if(lazy_init == false) {
info->paddr = paList[i];
FLAG_SET(info, CACHE_FREE);
}
else {
info->paddr = 0;
FLAG_SET(info, CACHE_UNINIT | CACHE_FREE);
}
info->ptr = slot->cache_ptr + (i*PAGE_SIZE);
TAILQ_INSERT_HEAD(&nvmed->free_head, info, cache_list);
}
nvmed->num_cache_size = size;
pthread_spin_unlock(&nvmed->mngt_lock);
return req_size;
}
示例9: hw_usb_reset_handler
//=========================================================================
//函数名: hw_usb_reset_handler
//功 能: 处理复位中断
//参 数: 无
//返 回: 无
//=========================================================================
void hw_usb_reset_handler(void)
{
//清标志
gu8USBClearFlags=0xFF;
gu8USB_Toogle_flags=0;
//禁止所有端点
USB0_ENDPT1=0x00;
USB0_ENDPT2=0x00;
USB0_ENDPT3=0x00;
USB0_ENDPT4=0x00;
USB0_ENDPT5=0x00;
USB0_ENDPT6=0x00;
// EP0 BDT Setup
// EP0 OUT BDT 设置
tBDTtable[bEP0OUT_ODD].Cnt = EP0_SIZE;
tBDTtable[bEP0OUT_ODD].Addr =(uint_32)gu8EP0_OUT_ODD_Buffer;
tBDTtable[bEP0OUT_ODD].Stat._byte = kUDATA1;
// EP0 OUT BDT 设置
tBDTtable[bEP0OUT_EVEN].Cnt = EP0_SIZE;
tBDTtable[bEP0OUT_EVEN].Addr =(uint_32)gu8EP0_OUT_EVEN_Buffer;
tBDTtable[bEP0OUT_EVEN].Stat._byte = kUDATA1;
// EP0 IN BDT 设置
tBDTtable[bEP0IN_ODD].Cnt = EP0_SIZE;
tBDTtable[bEP0IN_ODD].Addr =(uint_32)gu8EP0_IN_ODD_Buffer;
tBDTtable[bEP0IN_ODD].Stat._byte = kUDATA0;
// EP0 IN BDT 设置
tBDTtable[bEP0IN_EVEN].Cnt = (EP0_SIZE);
tBDTtable[bEP0IN_EVEN].Addr =(uint_32)gu8EP0_IN_EVEN_Buffer;
tBDTtable[bEP0IN_EVEN].Stat._byte = kUDATA0;
// 使能 EP0
USB0_ENDPT0=0x0D;
// 清除所有的错误
USB0_ERRSTAT=0xFF;
// 清除所有的中断标志
USB0_ISTAT=0xFF;
// USB设备地址
USB0_ADDR=0x00;
// 使能所有的错误中断
USB0_ERREN=0xFF;
// USB模块中断使能
FLAG_SET(USB_INTEN_TOKDNEEN_SHIFT,USB0_INTEN);
FLAG_SET(USB_INTEN_SOFTOKEN_SHIFT,USB0_INTEN);
FLAG_SET(USB_INTEN_ERROREN_SHIFT,USB0_INTEN);
FLAG_SET(USB_INTEN_USBRSTEN_SHIFT,USB0_INTEN);
}
示例10: _bsp_platform_init
void _bsp_platform_init(void)
{
/* MPU Configuration */
MPU_CESR=0; // MPU is disable. All accesses from all bus masters are allowed
/* SIM Configuration */
FLAG_SET(SIM_SOPT2_USBSRC_SHIFT,SIM_SOPT2); // PLL/FLL selected as CLK source
FLAG_SET(SIM_SOPT2_PLLFLLSEL_SHIFT,SIM_SOPT2); // Select PLL output
SIM_CLKDIV2=0x02; // USB Freq Divider
SIM_SCGC4|=(SIM_SCGC4_USBOTG_MASK); // USB Clock Gating
// weak pulldowns
USB0_USBCTRL=0x40;
}
示例11: hw_usb_endpoint_setup_handler
//=========================================================================
//函数名: hw_usb_endpoint_setup_handler
//功 能: 当主机请求接口配置请求时,执行该函数
//参 数: 无
//返 回: 无
//=========================================================================
void hw_usb_endpoint_setup_handler(void)
{
uint_16 u16Status;
switch(Setup_Pkt->bRequest)
{
case GET_STATUS:
if(FLAG_CHK(Setup_Pkt->wIndex_h,gu8HALT_EP))
u16Status=0x0100;
else
u16Status=0x0000;
hw_usb_ep_in_transfer(EP0,(uint_8*)&u16Status,2);
break;
case CLEAR_FEATURE:
FLAG_CLR(Setup_Pkt->wIndex_h,gu8HALT_EP);
hw_usb_ep_in_transfer(EP0,0,0);
break;
case SET_FEATURE:
FLAG_SET(Setup_Pkt->wIndex_h,gu8HALT_EP);
hw_usb_ep_in_transfer(EP0,0,0);
break;
default:
break;
}
}
示例12: vfnInitUSBClock
void vfnInitUSBClock (uint8_t u8ClkOption)
{
switch (u8ClkOption)
{
case MCGPLL0:
{
SIM_SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK /** PLL reference */
| SIM_SOPT2_USBSRC_MASK; /** USB clock source MCGPLLCLK/2 or MCGFLLCLK */
break;
}
case MCGFLL:
{
/** Configure FLL to generate a 48MHz core clock */
fll_init();
SIM_SOPT2 &= ~SIM_SOPT2_PLLFLLSEL_MASK; /** FLL reference */
SIM_SOPT2 |= SIM_SOPT2_USBSRC_MASK; /** USB clock source MCGPLLCLK/2 or MCGFLLCLK */
break;
}
case CLKIN:
{
SIM_SOPT2 &= (uint32_t)(~SIM_SOPT2_USBSRC_MASK); /** PTA5 selected as USBFS CLK source */
FLAG_SET(SIM_SCGC5_PORTA_SHIFT,SIM_SCGC5);
PORTA_PCR5=(0|PORT_PCR_MUX(2)); /** Enable PTA5 as CLK input */
}
}
SIM_SCGC4|=(SIM_SCGC4_USBOTG_MASK); // USB Clock Gating
}
示例13: block_store_link
void block_store_link(block_store_t *const bs, const char *const filename) {
if (bs && filename) {
if (! FLAG_CHECK(bs, FILE_LINKED)) {
// Ok, I can make a giant complicated hunk of logic to:
// Create if it doesn't exist
// Increase size if smaller
// Decrease size if larger
// and It'll be a giant headache for various reasons (error checking, portability)
// OR, I can just do it in two commands and call it a day.
bs->fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP);
if (bs->fd != -1) {
if (utility_write_file(bs->fd, bs->data_blocks, BLOCK_COUNT * BLOCK_SIZE) == BLOCK_COUNT * BLOCK_SIZE) {
// Kill the DBM and dirty flag, set link state
bitmap_format(bs->dbm, 0x00);
FLAG_CLEAR(bs, DIRTY);
FLAG_SET(bs, FILE_LINKED);
bs_errno = BS_OK;
return;
}
bs_errno = BS_FILE_IO;
return;
}
bs_errno = BS_FILE_ACCESS;
return;
}
bs_errno = BS_LINK_EXISTS;
return;
}
bs_errno = BS_PARAM;
}
示例14: FLAG_SET
void I8254Pit::writePeriodicIo(void)
{
state.lock.acquire();
io::write8(
i8254_CHAN0_IO_CONTROL,
i8254_CHAN0_CONTROL_SELECT_COUNTER
| i8254_CHAN0_CONTROL_MODE2_RATEGEN
| i8254_CHAN0_CONTROL_COUNTER_WRITE_LOWHIGH);
atomicAsm::memoryBarrier();
// Write out the currently set periodic rate.
io::write8(
i8254_CHAN0_IO_COUNTER,
i8254State.currentIntervalClks & 0xFF);
io::write8(
i8254_CHAN0_IO_COUNTER,
i8254State.currentIntervalClks >> 8);
FLAG_SET(
state.rsrc.flags,
ZKCM_TIMERDEV_STATE_FLAGS_ENABLED
| ZKCM_TIMERDEV_STATE_FLAGS_SOFT_ENABLED);
state.lock.release();
}
示例15: esys_isolate
int esys_isolate(struct esys* esys, ocn_entity_token_t token, entity_t** entity)
{
if(token >= OCN_MAX_ENTITIES)
return OCN_ENTITY_ERR_RANGE;
*entity = NULL;
pthread_spin_lock(&esys->lock);
struct entityslot* slot = &esys->slots[token];
if(!FLAG_GET(slot->flags, ENTITYSLOT_FLAG_USED))
{
pthread_spin_unlock(&esys->lock);
return OCN_ENTITY_ERR_NONEXIST;
}
if(FLAG_GET(slot->flags, ENTITYSLOT_FLAG_ISOLATED))
{
pthread_spin_unlock(&esys->lock);
return OCN_ENTITY_ERR_ISOLATED;
}
/* --- */
FLAG_SET(slot->flags, ENTITYSLOT_FLAG_ISOLATED);
*entity = &slot->entity;
/* --- */
pthread_spin_unlock(&esys->lock);
return OCN_OK;
}