本文整理汇总了C++中write_dword函数的典型用法代码示例。如果您正苦于以下问题:C++ write_dword函数的具体用法?C++ write_dword怎么用?C++ write_dword使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_dword函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uart_setup
/*********************************************************************************************************************
** Function name: uart_setup
** Descriptions: 安装uart类设备
** Input parameters: This : 设备特征清单指针
** Speed : 通信频率(单位: Hz)
** Output parameters:
** Returned value:
**--------------------------------------------------------------------------------------------------------------------
** Created by: Fengliang
** Created Date: 2010-9-25 13:49:39
** Test recorde:
**--------------------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Test recorde:
*********************************************************************************************************************/
int uart_setup(const UART_INFO *This, int Speed)
{
INT32U BaseAddress; /* 寄存器基址 */
BaseAddress = This->BaseAddress;
write_dword(BaseAddress + LCR, (3ul << 0) | /* 初始化帧格式 */
(0ul << 2) |
(0ul << 3) |
(0ul << 4) |
(0ul << 6) |
(0ul << 7));
dword_set_bits(BaseAddress + FCR, (1ul << 0) | /* 使能FIFO */
(1ul << 2)); /* 复位FIFO */
dword_set_bits(BaseAddress + LCR, 1ul << 7); /* 解锁除法器 */
/*
* 设置分频系数
*/
write_dword(BaseAddress + DLM, DLi>>8);
write_dword(BaseAddress + DLL, DLi&0xFF);
write_dword(BaseAddress + FDR, (DLm<<4) | (DLn<<0)); /* 小数分频系数 */
dword_clear_bits(BaseAddress + LCR, 1ul<<7); /* 锁定除法器 */
return OK;
}
示例2: write_element
static void write_element(const region_element* element, DWORD *buffer,
INT* filled)
{
write_dword(buffer, filled, element->type);
switch (element->type)
{
case CombineModeReplace:
case CombineModeIntersect:
case CombineModeUnion:
case CombineModeXor:
case CombineModeExclude:
case CombineModeComplement:
write_element(element->elementdata.combine.left, buffer, filled);
write_element(element->elementdata.combine.right, buffer, filled);
break;
case RegionDataRect:
write_float(buffer, filled, element->elementdata.rect.X);
write_float(buffer, filled, element->elementdata.rect.Y);
write_float(buffer, filled, element->elementdata.rect.Width);
write_float(buffer, filled, element->elementdata.rect.Height);
break;
case RegionDataPath:
{
DWORD size = write_path_data(element->elementdata.path, buffer + *filled + 1);
write_dword(buffer, filled, size);
*filled += size / sizeof(DWORD);
break;
}
case RegionDataEmptyRect:
case RegionDataInfiniteRect:
break;
}
}
示例3: flash_write
static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen,const u_char *buf)
{
__u8 tmp[4];
int i,n;
#ifdef LART_DEBUG
printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n",__FUNCTION__,(__u32) to,len);
#endif
*retlen = 0;
/* sanity checks */
if (!len) return (0);
if (to + len > mtd->size) return (-EINVAL);
/* first, we write a 0xFF.... padded byte until we reach a dword boundary */
if (to & (BUSWIDTH - 1))
{
__u32 aligned = to & ~(BUSWIDTH - 1);
int gap = to - aligned;
i = n = 0;
while (gap--) tmp[i++] = 0xFF;
while (len && i < BUSWIDTH) tmp[i++] = buf[n++], len--;
while (i < BUSWIDTH) tmp[i++] = 0xFF;
if (!write_dword (aligned,*((__u32 *) tmp))) return (-EIO);
to += n;
buf += n;
*retlen += n;
}
/* now we write dwords until we reach a non-dword boundary */
while (len >= BUSWIDTH)
{
if (!write_dword (to,*((__u32 *) buf))) return (-EIO);
to += BUSWIDTH;
buf += BUSWIDTH;
*retlen += BUSWIDTH;
len -= BUSWIDTH;
}
/* top up the last unaligned bytes, padded with 0xFF.... */
if (len & (BUSWIDTH - 1))
{
i = n = 0;
while (len--) tmp[i++] = buf[n++];
while (i < BUSWIDTH) tmp[i++] = 0xFF;
if (!write_dword (to,*((__u32 *) tmp))) return (-EIO);
*retlen += n;
}
return (0);
}
示例4: hds_write_afra_atom_header
static u_char*
hds_write_afra_atom_header(u_char* p, size_t atom_size, uint32_t video_key_frame_count)
{
write_atom_header(p, atom_size, 'a', 'f', 'r', 'a');
write_dword(p, 0);
*p++ = 0xC0; // LongIDs | LongOffsets
write_dword(p, HDS_TIMESCALE); // timescale
write_dword(p, video_key_frame_count); // entries
return p;
}
示例5: dash_packager_write_tfdt_atom
static u_char*
dash_packager_write_tfdt_atom(u_char* p, uint32_t earliest_pres_time)
{
size_t atom_size = ATOM_HEADER_SIZE + sizeof(tfdt_atom_t);
write_atom_header(p, atom_size, 't', 'f', 'd', 't');
write_dword(p, 0);
write_dword(p, earliest_pres_time);
return p;
}
示例6: mss_write_tfhd_atom
static u_char*
mss_write_tfhd_atom(u_char* p, uint32_t track_id, uint32_t flags)
{
size_t atom_size = ATOM_HEADER_SIZE + sizeof(tfhd_atom_t);
write_atom_header(p, atom_size, 't', 'f', 'h', 'd');
write_dword(p, 0x20); // default sample flags
write_dword(p, track_id);
write_dword(p, flags);
return p;
}
示例7: mss_playready_video_write_uuid_piff_atom
static u_char*
mss_playready_video_write_uuid_piff_atom(u_char* p, mp4_encrypt_video_state_t* state, media_sequence_t* sequence, size_t atom_size)
{
write_atom_header(p, atom_size, 'u', 'u', 'i', 'd');
p = vod_copy(p, piff_uuid, sizeof(piff_uuid));
write_dword(p, 2);
write_dword(p, sequence->total_frame_count);
p = vod_copy(p, state->auxiliary_data.start, state->auxiliary_data.pos - state->auxiliary_data.start);
return p;
}
示例8: hds_write_tfhd_atom
static u_char*
hds_write_tfhd_atom(u_char* p, uint32_t track_id, uint64_t base_data_offset)
{
size_t atom_size = ATOM_HEADER_SIZE + sizeof(tfhd_atom_t);
write_atom_header(p, atom_size, 't', 'f', 'h', 'd');
write_dword(p, 3); // flags - base data offset | sample description
write_dword(p, track_id);
write_qword(p, base_data_offset);
write_dword(p, 1); // sample_desc_index
return p;
}
示例9: read_dword
void PCI_Device::probe_resources() noexcept {
//Find resources on this PCI device (scan the BAR's)
uint32_t value {PCI::WTF};
uint32_t reg {0};
uint32_t len {0};
for(int bar {0}; bar < 6; ++bar) {
//Read the current BAR register
reg = PCI::CONFIG_BASE_ADDR_0 + (bar << 2);
value = read_dword(reg);
if (!value) continue;
//Write all 1's to the register, to get the length value (osdev)
write_dword(reg, 0xFFFFFFFF);
len = read_dword(reg);
//Put the value back
write_dword(reg, value);
uint32_t unmasked_val {0};
uint32_t pci__size {0};
if (value & 1) { // Resource type IO
unmasked_val = value & PCI::BASE_ADDRESS_IO_MASK;
pci__size = pci_size(len, PCI::BASE_ADDRESS_IO_MASK & 0xFFFF);
// Add it to resource list
add_resource(new Resource(unmasked_val, pci__size), res_io_);
assert(res_io_ != nullptr);
} else { //Resource type Mem
unmasked_val = value & PCI::BASE_ADDRESS_MEM_MASK;
pci__size = pci_size(len, PCI::BASE_ADDRESS_MEM_MASK);
//Add it to resource list
add_resource(new Resource(unmasked_val, pci__size), res_mem_);
assert(res_mem_ != nullptr);
}
INFO2("");
INFO2("[ Resource @ BAR %i ]", bar);
INFO2(" Address: 0x%x Size: 0x%x", unmasked_val, pci__size);
INFO2(" Type: %s", value & 1 ? "IO Resource" : "Memory Resource");
}
INFO2("");
}
示例10: dash_packager_write_mvhd64_atom
static u_char*
dash_packager_write_mvhd64_atom(u_char* p, uint32_t timescale, uint64_t duration)
{
size_t atom_size = ATOM_HEADER_SIZE + sizeof(mvhd64_atom_t);
write_atom_header(p, atom_size, 'm', 'v', 'h', 'd');
write_dword(p, 0x01000000); // version + flags
write_qword(p, 0LL); // creation time
write_qword(p, 0LL); // modification time
write_dword(p, timescale); // timescale
write_qword(p, duration); // duration
p = dash_packager_write_mvhd_constants(p);
write_dword(p, 0xffffffff); // next track id
return p;
}
示例11: hds_write_single_audio_frame_trun_atom
static u_char*
hds_write_single_audio_frame_trun_atom(u_char* p, input_frame_t* frame, uint32_t offset)
{
size_t atom_size;
atom_size = TRUN_SIZE_SINGLE_AUDIO_FRAME;
write_atom_header(p, atom_size, 't', 'r', 'u', 'n');
write_dword(p, 0x301); // flags = data offset, duration, size
write_dword(p, 1); // frame count
write_dword(p, offset); // offset from mdat start to frame raw data (excluding the tag)
write_dword(p, frame->duration);
write_dword(p, frame->size);
return p;
}
示例12: dash_packager_write_matrix
static u_char*
dash_packager_write_matrix(u_char* p, int16_t a, int16_t b, int16_t c,
int16_t d, int16_t tx, int16_t ty)
{
write_dword(p, a << 16); // 16.16 format
write_dword(p, b << 16); // 16.16 format
write_dword(p, 0); // u in 2.30 format
write_dword(p, c << 16); // 16.16 format
write_dword(p, d << 16); // 16.16 format
write_dword(p, 0); // v in 2.30 format
write_dword(p, tx << 16); // 16.16 format
write_dword(p, ty << 16); // 16.16 format
write_dword(p, 1 << 30); // w in 2.30 format
return p;
}
示例13: restart
/*********************************************************************************************************************
** Function name: restart
** Descriptions: 复位系统
** Input parameters: pOption : (保留)
** Output parameters:
** Returned value: ==OK : 操作成功
** !=OK : 操作失败(包含出错信息)
**--------------------------------------------------------------------------------------------------------------------
** Created by: Feng Liang
** Created Date: 2011-11-29 21:13:48
** Test recorde:
**--------------------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Test recorde:
*********************************************************************************************************************/
int restart(char *pOption)
{
int Register;
Register = read_dword(AIRCR);
Register &= 0x0000ff00;
Register |= (0x05FA << 16) | (1ul << 2);
write_dword(AIRCR, Register);
return OK;
}
示例14: edash_packager_write_pssh
static u_char*
edash_packager_write_pssh(void* context, u_char* p)
{
mp4_encrypt_system_info_array_t* pssh_array = (mp4_encrypt_system_info_array_t*)context;
mp4_encrypt_system_info_t* cur_info;
size_t pssh_atom_size;
for (cur_info = pssh_array->first; cur_info < pssh_array->last; cur_info++)
{
pssh_atom_size = ATOM_HEADER_SIZE + sizeof(pssh_atom_t) + cur_info->data.len;
write_atom_header(p, pssh_atom_size, 'p', 's', 's', 'h');
write_dword(p, 0); // version + flags
p = vod_copy(p, cur_info->system_id, MP4_ENCRYPT_SYSTEM_ID_SIZE); // system id
write_dword(p, cur_info->data.len); // data size
p = vod_copy(p, cur_info->data.data, cur_info->data.len);
}
return p;
}
示例15: dash_packager_write_mvhd_constants
static u_char*
dash_packager_write_mvhd_constants(u_char* p)
{
write_dword(p, 0x00010000); // preferred rate, 1.0
write_word(p, 0x0100); // volume, full
write_word(p, 0); // reserved
write_dword(p, 0); // reserved
write_dword(p, 0); // reserved
p = dash_packager_write_matrix(p, 1, 0, 0, 1, 0, 0); // matrix
write_dword(p, 0); // reserved (preview time)
write_dword(p, 0); // reserved (preview duration)
write_dword(p, 0); // reserved (poster time)
write_dword(p, 0); // reserved (selection time)
write_dword(p, 0); // reserved (selection duration)
write_dword(p, 0); // reserved (current time)
return p;
}