本文整理汇总了C++中BIT_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ BIT_CHECK函数的具体用法?C++ BIT_CHECK怎么用?C++ BIT_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BIT_CHECK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RS485_ReceiveError
/****************************************************************************
* DESCRIPTION: Return true if a framing or overrun error is present
* RETURN: true if error
* ALGORITHM: autobaud - if there are a lot of errors, switch baud rate
* NOTES: Clears any error flags.
*****************************************************************************/
bool RS485_ReceiveError(
void)
{
bool ReceiveError = false;
uint8_t dummy_data;
/* check for framing error */
#if 0
if (BIT_CHECK(UCSRA, FE0)) {
/* FIXME: how do I clear the error flags? */
BITMASK_CLEAR(UCSRA, (_BV(FE) | _BV(DOR) | _BV(UPE)));
ReceiveError = true;
}
#endif
/* check for overrun error */
if (BIT_CHECK(UCSRA, DOR)) {
/* flush the receive buffer */
do {
dummy_data = UDR;
} while (BIT_CHECK(UCSRA, RXC));
ReceiveError = true;
}
return ReceiveError;
}
开发者ID:charador,项目名称:PropRes_Receiver,代码行数:31,代码来源:rs485.c
示例2: rs485_bytes_send
void rs485_bytes_send(
uint8_t * buffer, /* data to send */
uint16_t nbytes)
{ /* number of bytes of data */
led_on(LED_2);
while (!BIT_CHECK(UCSR0A, UDRE0)) {
/* do nothing - wait until Tx buffer is empty */
}
while (nbytes) {
/* Send the data byte */
UDR0 = *buffer;
while (!BIT_CHECK(UCSR0A, UDRE0)) {
/* do nothing - wait until Tx buffer is empty */
}
buffer++;
nbytes--;
}
/* was the frame sent? */
while (!BIT_CHECK(UCSR0A, TXC0)) {
/* do nothing - wait until the entire frame in the
Transmit Shift Register has been shifted out */
}
/* Clear the Transmit Complete flag by writing a one to it. */
BIT_SET(UCSR0A, TXC0);
timer_reset(TIMER_SILENCE);
led_off_delay(LED_2, 1);
return;
}
开发者ID:Jongil-Park,项目名称:Lin_PRJ,代码行数:29,代码来源:rs485.c
示例3: test_pin_state
/*************************************************************************
* Description: Get the state of the test pin
* Returns: true if on, false if off.
* Notes: none
*************************************************************************/
static inline bool test_pin_state(
void)
{
#if (BDK_VERSION==4)
return (BIT_CHECK(PIND, PD5));
#else
return (BIT_CHECK(PINB, PB0));
#endif
}
开发者ID:8bitgeek,项目名称:bacnet-stack,代码行数:14,代码来源:test.c
示例4: compress_directory
result_t compress_directory(struct pak_file* pak, struct paki_args* args, const char* subdir)
{
result_t r;
char directory[DH_PATH_MAX];
char filepath[DH_PATH_MAX];
char fullfilepath[DH_PATH_MAX];
strcpy(directory, args->path);
if (subdir[0] != 0) {
path_join(directory, directory, subdir, NULL);
}
WIN32_FIND_DATA fdata;
char filter[DH_PATH_MAX];
path_join(filter, directory, "*", NULL);
HANDLE find_hdl = FindFirstFile(filter, &fdata);
if (find_hdl == INVALID_HANDLE_VALUE) {
printf(TERM_BOLDRED "Creating pak failed: directory '%s' does not exist.\n" TERM_RESET,
directory);
return RET_FAIL;
}
/* read directory recuresively, and compress files into pak */
BOOL fr = TRUE;
while (fr) {
if (!str_isequal(fdata.cFileName, ".") && !str_isequal(fdata.cFileName, "..")) {
filepath[0] = 0;
if (subdir[0] != 0) {
strcpy(filepath, subdir);
}
if (!BIT_CHECK(fdata.dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY)) {
/* put the file into the archive */
path_join(filepath, filepath, fdata.cFileName, NULL);
path_join(fullfilepath, directory, fdata.cFileName, NULL);
r = archive_put(pak, args, fullfilepath, filepath);
if (IS_OK(r) && BIT_CHECK(args->usage, PAKI_USAGE_VERBOSE)) {
puts(filepath);
} else if (IS_FAIL(r)) {
err_sendtolog(FALSE);
args->err_cnt ++;
}
args->file_cnt ++;
} else {
/* it's a directory, recurse */
path_join(filepath, filepath, fdata.cFileName, NULL);
compress_directory(pak, args, filepath);
}
}
fr = FindNextFile(find_hdl, &fdata);
}
FindClose(find_hdl);
return RET_OK;
}
开发者ID:shadercoder,项目名称:darkhammer,代码行数:56,代码来源:paki.c
示例5: awaitCommandResponse
uint32_t
awaitCommandResponse()
{
// NOTE: for dependencies between error flags and command complete in MMCHS_STAT see page 3157f
while ( 1 )
{
// NOTE: CTO occured, is mutually exclusive with CC and the errors CIE, CEB and CERR cannot occur with CTO.
if ( isCommandTimeout() )
{
// NOTE: CTO can occur at the same time as CCRC: it indicates a command abort due to a contention on CMD line. In this case no CC appears.
if ( BIT_CHECK( MMCHS_STAT, MMCHS_STAT_CCRC_BIT ) )
{
// NOTE: fuck it, don't care for this type of error
}
clearInterruptBits( MMCHS_STAT_CTO_BIT | MMCHS_STAT_CCRC_BIT );
// always need to reset CMD line after error
resetMMCICmdLine( 0xFF );
// reset DATA line after error occured during a command which transmits data
resetMMCIDataLine( 0xFF );
// return 1 to indicate failure
return 1;
}
// command complete
else if ( isCommandComplete() )
{
clearCommandComplete();
// NOTE: CC is set upon CIE, CEB, CCRC (if no CTO) and CERR => need to check for those errors anyway although command has completed
if ( BIT_CHECK( MMCHS_STAT, MMCHS_STAT_CIE_BIT ) ||
BIT_CHECK( MMCHS_STAT, MMCHS_STAT_CEB_BIT ) ||
BIT_CHECK( MMCHS_STAT, MMCHS_STAT_CCRC_BIT ) ||
BIT_CHECK( MMCHS_STAT, MMCHS_STAT_CERR_BIT ) )
{
clearInterruptBits( MMCHS_STAT_CIE_BIT | MMCHS_STAT_CEB_BIT | MMCHS_STAT_CCRC_BIT | MMCHS_STAT_CERR_BIT );
// Command index error / Command end bit error / Command CRC Error / Card error ?
// return 1 to indicate failure
return 1;
}
return 0;
}
else
{
// not yet completed, check again
}
}
}
开发者ID:FHV-S1-FFPST,项目名称:BOSS,代码行数:51,代码来源:sd_hal.c
示例6: setBusPower
uint32_t
setBusPower( bool enable )
{
if ( enable )
{
uint32_t i = 0;
BIT_SET( MMCHS_HCTL, MMCHS_HCTL_SDBP_BIT );
for ( i = 0xFF; i > 0; --i )
{
if ( BIT_CHECK( MMCHS_HCTL, MMCHS_HCTL_SDBP_BIT ) )
{
return 0;
}
}
return 1;
}
else
{
BIT_CLEAR( MMCHS_HCTL, MMCHS_HCTL_SDBP_BIT );
}
return 0;
}
开发者ID:FHV-S1-FFPST,项目名称:BOSS,代码行数:26,代码来源:sd_hal.c
示例7: get_random_number_from_candidate_list_and_remove_it
unsigned int get_random_number_from_candidate_list_and_remove_it(CandidateListType *list, unsigned int index)
{
unsigned int randomIndex; // index of the selected candidate in the list
unsigned int count; // number of remaining candidates in the list
unsigned int candidate; // selected candidate
assert(NULL != list && index < (NROWS*NCOLS) && "get_random_number_from_candidate_list_and_remove_it(): Bad input");
// 1. count how many remaining numbers we have (how many set bits)
count = count_bits(list[index]);
assert(count > 0 && "get_random_number_from_candidate_list_and_remove_it(): No candidate remaining");
// 2. generate random index (will be 0 when count is 1)
randomIndex = (unsigned int) arc4random() % count;
// 3. get the corresponding candidate
for (candidate = 0; candidate < NCOLS; ++candidate)
{
if (BIT_CHECK(list[index],candidate)) {
if (0 == randomIndex) {
break;
}
else {
--randomIndex;
}
}
}
assert(0 <= candidate && candidate < NCOLS && 0 == randomIndex && "get_random_number_from_candidate_list_and_remove_it(): Bad index");
// 4. remove it from the candidate list
BIT_CLEAR(list[index],candidate);
return (unsigned int)(candidate+1); // Indices start at 0 but values start at 1, need to increase
}
开发者ID:julien-l,项目名称:mysudoku,代码行数:34,代码来源:SudokuAlgorithms.c
示例8: crea_POWER_CR
static void crea_POWER_CR(int c)
{
REGFN_BEGIN(POWER_CR);
int i;
for(i = 0; i < POWER_CR_SIZE(c); i++) { POWER_CR_SKIP(c); BIT_CHECK(i, i, (c==0?powercr9_strings:powercr7_strings)[i]); }
CREA_END();
}
开发者ID:snowasnow,项目名称:DeSmuME,代码行数:7,代码来源:ioregsView.cpp
示例9: crea_REG_SPICNT
static void crea_REG_SPICNT(int c)
{
REGFN_BEGIN(REG_SPICNT);
int i;
for(i = 0; i < 16; i++) { REG_SPICNT_SKIP(c);
if(REG_SPICNT_ISCHECK(c)) { BIT_CHECK(i, i, spicnt_strings[i]); }
else if(i == 0) { BIT_COMBO(i, "0-1", spicnt_strings[0]);
BIT_COMBO_ADD(i, "0= 4Mhz");
BIT_COMBO_ADD(i, "1= 2Mhz");
BIT_COMBO_ADD(i, "2= 1Mhz");
BIT_COMBO_ADD(i, "3= 512Khz");
BIT_COMBO_END(i); }
else if(i == 8) { BIT_COMBO(i, "8-9", spicnt_strings[8]);
BIT_COMBO_ADD(i, "0= Power management device");
BIT_COMBO_ADD(i, "1= Firmware");
BIT_COMBO_ADD(i, "2= Touchscreen/Microphone");
BIT_COMBO_ADD(i, "3= Reserved/Prohibited");
BIT_COMBO_END(i); }
else if(i == 10) { BIT_COMBO(i, "10", spicnt_strings[10]);
BIT_COMBO_ADD(i, "0= 8 bits");
BIT_COMBO_ADD(i, "1= 16 bits");
BIT_COMBO_END(i); }
}
CREA_END();
}
开发者ID:snowasnow,项目名称:DeSmuME,代码行数:25,代码来源:ioregsView.cpp
示例10: crea_REG_IPCFIFOCNT
static void crea_REG_IPCFIFOCNT(int c)
{
REGFN_BEGIN(REG_IPCFIFOCNT);
int i;
for(i = 0; i < 16; i++) { FIFOCNT_SKIP(c); BIT_CHECK(i, i, fifocnt_strings[i]); }
CREA_END();
}
开发者ID:snowasnow,项目名称:DeSmuME,代码行数:7,代码来源:ioregsView.cpp
示例11: crea_REG_IF
static void crea_REG_IF(int c)
{
REGFN_BEGIN(REG_IF);
int i;
for(i = 0; i < 24; i++) { INTERRUPT_SKIP(c); BIT_CHECK(i, i, interrupt_strings[i]); }
CREA_END();
}
开发者ID:snowasnow,项目名称:DeSmuME,代码行数:7,代码来源:ioregsView.cpp
示例12: PS2WaitInputBuffer
void PS2WaitInputBuffer() {
for(;;) {
/* Check if the input buffer flag is clear. */
if(!BIT_CHECK(PS2ReadStatus(), 1)) {
break;
}
}
}
开发者ID:MatthewEdgmon,项目名称:Zylix,代码行数:8,代码来源:ps2.c
示例13: eng_release
void eng_release()
{
if (g_eng == NULL)
return;
rs_release_resources();
lod_releasemgr();
#if !defined(_DEBUG_)
pak_close(&g_eng->data_pak);
#endif
prf_releasemgr();
sct_release();
wld_releasemgr();
scn_releasemgr();
cmp_releasemgr();
phx_release();
hud_release();
gfx_release();
rs_reportleaks();
rs_releasemgr();
tsk_releasemgr();
if (g_eng->timer != NULL)
timer_destroyinstance(g_eng->timer);
/* check for main memory leaks */
if (BIT_CHECK(g_eng->params.flags, ENG_FLAG_DEV)) {
int leak_cnt = mem_freelist_getleaks(&g_eng->data_freelist, NULL);
if (leak_cnt > 0)
log_printf(LOG_WARNING, "%d leaks found on dynamic 'data' memory", leak_cnt);
}
mem_freelist_destroy(&g_eng->data_freelist);
mem_stack_destroy(&g_eng->lsr_stack);
log_print(LOG_TEXT, "engine released.");
if (BIT_CHECK(g_eng->params.flags, ENG_FLAG_CONSOLE)) {
log_outputfunc(FALSE, NULL, NULL);
con_release();
}
FREE(g_eng);
g_eng = NULL;
}
开发者ID:septag,项目名称:darkhammer,代码行数:46,代码来源:engine.c
示例14: load_pak
void load_pak(struct paki_args* args)
{
result_t r;
struct pak_file pak;
char filename[DH_PATH_MAX];
path_norm(args->pakfile, args->pakfile);
path_tounix(args->path, args->path);
r = pak_open(&pak, mem_heap(), args->pakfile, 0);
if (IS_FAIL(r)) {
err_sendtolog(FALSE);
return;
}
uint file_id = pak_findfile(&pak, args->path);
if (file_id == INVALID_INDEX) {
printf(TERM_BOLDRED "Extract failed: file '%s' not found in pak.\n" TERM_RESET, args->path);
pak_close(&pak);
return;
}
path_getfullfilename(filename, args->path);
file_t f = fio_createdisk(filename);
if (f == NULL) {
printf(TERM_BOLDRED "Extract failed: could not create '%s' for writing.\n" TERM_RESET,
filename);
pak_close(&pak);
err_sendtolog(FALSE);
return;
}
file_t src_file = pak_getfile(&pak, mem_heap(), mem_heap(), file_id, 0);
if (src_file == NULL) {
pak_close(&pak);
fio_close(f);
err_sendtolog(FALSE);
return;
}
size_t size;
struct allocator* alloc;
void* buffer = fio_detachmem(src_file, &size, &alloc);
fio_write(f, buffer, size, 1);
A_FREE(alloc, buffer);
fio_close(f);
pak_close(&pak);
if (BIT_CHECK(args->usage, PAKI_USAGE_VERBOSE)) {
printf(TERM_WHITE "%s -> %s\n" TERM_RESET, args->path, filename);
}
args->file_cnt ++;
// report
printf(TERM_BOLDWHITE "Finished: total %d file(s) - %d error(s), %d warning(s)\n" TERM_RESET,
args->file_cnt, args->err_cnt, args->warn_cnt);
}
开发者ID:shadercoder,项目名称:darkhammer,代码行数:58,代码来源:paki.c
示例15: gfx_csm_resize
result_t gfx_csm_resize(uint width, uint height)
{
if (BIT_CHECK(eng_get_params()->flags, ENG_FLAG_DEV)) {
csm_destroy_prevrt();
if (IS_FAIL(csm_create_prevrt(width, height)))
return RET_FAIL;
}
return RET_OK;
}
开发者ID:septag,项目名称:darkhammer,代码行数:9,代码来源:gfx-csm.c
示例16: isCardBusy
uint32_t
isCardBusy()
{
uint32_t busyBit = BIT_CHECK( MMCHS_RSP10, MMCHS_RSP10_BUSY_BIT );
uint32_t busyFlag = busyBit == 0;
// NOTE: if bit 31 of RSP10 is 0 then card is busy
return busyFlag;
}
开发者ID:FHV-S1-FFPST,项目名称:BOSS,代码行数:9,代码来源:sd_hal.c
示例17: rs_add_flags
void rs_add_flags(uint flags)
{
BIT_REMOVE(flags, RS_FLAG_PREPARE_BGLOAD);
if (!BIT_CHECK(g_rs.flags, RS_FLAG_PREPARE_BGLOAD))
BIT_REMOVE(flags, RS_FLAG_BGLOADING);
BIT_ADD(g_rs.flags, flags);
}
开发者ID:septag,项目名称:darkhammer,代码行数:9,代码来源:res-mgr.c
示例18: MultibootDumpInfo
void MultibootDumpInfo(multiboot_info_t* multiboot_info) {
printf("Multiboot Information:\n");
printf(" Flags: 0x%X\n", multiboot_info->flags);
printf(" Bootloader: %s\n", multiboot_info->boot_loader_name);
if(BIT_CHECK(multiboot_info->flags, 0)) {
printf(" Lower memory: %uKB\n", multiboot_info->mem_lower);
uint32_t mem_upper_mb = multiboot_info->mem_upper / 1024;
printf(" Upper memory: %uKB (%uMB)\n", multiboot_info->mem_upper, mem_upper_mb);
}
if(BIT_CHECK(multiboot_info->flags, 1)) {
printf(" Boot device: 0x%X\n", multiboot_info->boot_device);
}
if(BIT_CHECK(multiboot_info->flags, 2)) {
printf(" Command line: %s\n", multiboot_info->cmdline);
}
if(BIT_CHECK(multiboot_info->flags, 3)) {
printf(" Module Information:\n");
printf(" Count: %d\n", multiboot_info->mods_count);
printf(" Modules start at: 0x%X\n", multiboot_info->mods_addr);
multiboot_module_t* module = (multiboot_module_t*) multiboot_info->mods_addr;
for(size_t i = 0; i < multiboot_info->mods_count; i++) {
printf(" Module #%d, Start: 0x%X, End: 0x%X, Cmdline: %s\n", i, module->mod_start, module->mod_end, module->cmdline);
module++;
}
}
if(BIT_CHECK(multiboot_info->flags, 4) && BIT_CHECK(multiboot_info->flags, 5)) {
KernelPanic("Invalid Mutliboot flags! Bits 4 and 5 both set.\n", NULL);
}
if(BIT_CHECK(multiboot_info->flags, 4)) {
multiboot_aout_symbol_table_t* aout_symbol_table = &(multiboot_info->u.aout_sym);
}
if(BIT_CHECK(multiboot_info->flags, 5)) {
multiboot_elf_section_header_table_t* elf_header = &(multiboot_info->u.elf_sec);
}
if(BIT_CHECK(multiboot_info->flags, 6)) {
printf(" Memory Map Information:\n");
printf(" Map address: 0x%X\n", multiboot_info->mmap_addr);
printf(" Map length: 0x%X\n", multiboot_info->mmap_length);
multiboot_memory_map_t* memory_map = (multiboot_memory_map_t*) multiboot_info->mmap_addr;
for(; memory_map < multiboot_info->mmap_addr + multiboot_info->mmap_length;
memory_map = (multiboot_memory_map_t*) ((uint32_t) memory_map + memory_map->size + sizeof(memory_map->size))) {
printf(" Size: 0x%X, Base Address: 0x%X%X, Length: 0x%X%X, Type: 0x%X\n",
memory_map->size,
memory_map->base_addr >> 32, memory_map->base_addr & 0xFFFFFFFF,
memory_map->length >> 32, memory_map->length & 0xFFFFFFFF,
memory_map->type);
}
}
开发者ID:MatthewEdgmon,项目名称:Zylix,代码行数:48,代码来源:multiboot.c
示例19: kicker_pbm_by_dlpt
/*
* kicker: 0
* who call : PMIC
* i_max: mA
* condition: persentage decrease 1%, then update i_max
*/
void kicker_pbm_by_dlpt(unsigned int i_max)
{
struct pbm *pwrctrl = &pbm_ctrl;
struct mrp mrpmgr;
mrpmgr.loading_dlpt = ma_to_mw(i_max);
if (BIT_CHECK(pwrctrl->hpf_en, KR_DLPT))
mtk_power_budget_manager(KR_DLPT, &mrpmgr);
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:16,代码来源:mt_pbm.c
示例20: kicker_pbm_by_flash
/*
* kicker: 4
* who call : Flash
* condition: on/off
*/
void kicker_pbm_by_flash(bool status)
{
struct pbm *pwrctrl = &pbm_ctrl;
struct mrp mrpmgr;
mrpmgr.switch_flash = status;
if (BIT_CHECK(pwrctrl->hpf_en, KR_FLASH))
mtk_power_budget_manager(KR_FLASH, &mrpmgr);
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:15,代码来源:mt_pbm.c
注:本文中的BIT_CHECK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论