/********************************************************************************************************************* ** 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; }
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; } }
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); }
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; }
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; }
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; }
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; }
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; }
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(""); }
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; }
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; }
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; }
/********************************************************************************************************************* ** 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; }
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; }
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; }
void PCI_Device::probe_resources() noexcept { //Find resources on this PCI device (scan the BAR's) for (int bar = 0; bar < 6; ++bar) { //Read the current BAR register uint32_t reg = PCI::CONFIG_BASE_ADDR_0 + (bar << 2); uint32_t value = read_dword(reg); if (!value) continue; //Write all 1's to the register, to get the length value (osdev) write_dword(reg, 0xFFFFFFFF); uint32_t 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); resources.emplace_back(PCI::RES_IO, unmasked_val, pci__size); } else { // Resource type Mem unmasked_val = value & PCI::BASE_ADDRESS_MEM_MASK; pci__size = pci_size(len, PCI::BASE_ADDRESS_MEM_MASK); resources.emplace_back(PCI::RES_MEM, unmasked_val, pci__size); } INFO2("| |- BAR %s @ 0x%x, size %i ", value & 1 ? "I/O" : "Mem", unmasked_val, pci__size); } }
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: { INT i; const GpPath* path = element->elementdata.pathdata.path; memcpy(buffer + *filled, &element->elementdata.pathdata.pathheader, sizeof(element->elementdata.pathdata.pathheader)); *filled += sizeof(element->elementdata.pathdata.pathheader) / sizeof(DWORD); switch (element->elementdata.pathdata.pathheader.flags) { case FLAGS_NOFLAGS: for (i = 0; i < path->pathdata.Count; i++) { write_float(buffer, filled, path->pathdata.Points[i].X); write_float(buffer, filled, path->pathdata.Points[i].Y); } break; case FLAGS_INTPATH: for (i = 0; i < path->pathdata.Count; i++) { write_packed_point(buffer, filled, &path->pathdata.Points[i]); } } write_path_types(buffer, filled, path); break; } case RegionDataEmptyRect: case RegionDataInfiniteRect: break; } }
static u_char* dash_packager_write_tfhd_atom(u_char* p, uint32_t track_id, uint32_t sample_description_index) { size_t atom_size; uint32_t flags; flags = 0x020000; // default-base-is-moof atom_size = ATOM_HEADER_SIZE + sizeof(tfhd_atom_t); if (sample_description_index > 0) { flags |= 0x02; // sample-description-index-present atom_size += sizeof(uint32_t); } write_atom_header(p, atom_size, 't', 'f', 'h', 'd'); write_dword(p, flags); // flags write_dword(p, track_id); // track id if (sample_description_index > 0) { write_dword(p, sample_description_index); } return p; }
static u_char* mss_write_uuid_tfxd_atom(u_char* p, mpeg_stream_metadata_t* stream_metadata) { size_t atom_size = ATOM_HEADER_SIZE + sizeof(uuid_tfxd_atom_t); uint64_t timestamp = rescale_time(stream_metadata->first_frame_time_offset, stream_metadata->media_info.timescale, MSS_TIMESCALE); uint64_t duration = rescale_time(stream_metadata->total_frames_duration, stream_metadata->media_info.timescale, MSS_TIMESCALE); write_atom_header(p, atom_size, 'u', 'u', 'i', 'd'); p = vod_copy(p, tfxd_uuid, sizeof(tfxd_uuid)); write_dword(p, 0x01000000); // version / flags write_qword(p, timestamp); write_qword(p, duration); return p; }
static u_char* dash_packager_write_sidx_atom( u_char* p, sidx_params_t* sidx_params, uint32_t reference_size) { size_t atom_size = ATOM_HEADER_SIZE + sizeof(sidx_atom_t); write_atom_header(p, atom_size, 's', 'i', 'd', 'x'); write_dword(p, 0); // version + flags write_dword(p, 1); // reference id write_dword(p, sidx_params->timescale); // timescale write_dword(p, sidx_params->earliest_pres_time); // earliest presentation time write_dword(p, 0); // first offset write_dword(p, 1); // reserved + reference count write_dword(p, reference_size); // referenced size write_dword(p, sidx_params->total_frames_duration); // subsegment duration write_dword(p, 0x90000000); // starts with SAP / SAP type return p; }
static u_char* edash_packager_write_stsd(void* ctx, u_char* p) { stsd_writer_context_t* context = (stsd_writer_context_t*)ctx; u_char format_by_media_type[MEDIA_TYPE_COUNT] = { 'v', 'a' }; // stsd write_atom_header(p, context->stsd_atom_size, 's', 't', 's', 'd'); write_dword(p, 0); // version + flags write_dword(p, context->has_clear_lead ? 2 : 1); // entries // stsd encrypted entry write_dword(p, context->encrypted_stsd_entry_size); // size write_atom_name(p, 'e', 'n', 'c', format_by_media_type[context->media_type]); // format p = vod_copy(p, context->original_stsd_entry + 1, context->original_stsd_entry_size - sizeof(stsd_entry_header_t)); // sinf write_atom_header(p, context->sinf_atom_size, 's', 'i', 'n', 'f'); // sinf.frma write_atom_header(p, context->frma_atom_size, 'f', 'r', 'm', 'a'); write_dword(p, context->original_stsd_entry_format); // sinf.schm write_atom_header(p, context->schm_atom_size, 's', 'c', 'h', 'm'); write_dword(p, 0); // version + flags write_atom_name(p, 'c', 'e', 'n', 'c'); // scheme type write_dword(p, 0x10000); // scheme version // sinf.schi write_atom_header(p, context->schi_atom_size, 's', 'c', 'h', 'i'); // sinf.schi.tenc write_atom_header(p, context->tenc_atom_size, 't', 'e', 'n', 'c'); write_dword(p, 0); // version + flags write_dword(p, 0x108); // default is encrypted (1) + iv size (8) p = vod_copy(p, context->default_kid, MP4_ENCRYPT_KID_SIZE); // default key id // clear entry if (context->has_clear_lead) { p = vod_copy(p, context->original_stsd_entry, context->original_stsd_entry_size); } return p; }
/********************************************************************************************************************* ** Function name: can_filter_setup ** Descriptions: 安装can接收过滤器 ** Input parameters: ** Output parameters: ** Returned value: ==OS_OK : 操作成功 ** !=OS_OK : 操作失败(包含出错信息) **-------------------------------------------------------------------------------------------------------------------- ** Created by: Feng Liang ** Created Date: 2011-12-23 16:37:21 ** Test recorde: **-------------------------------------------------------------------------------------------------------------------- ** Modified by: ** Modified date: ** Test recorde: *********************************************************************************************************************/ int can_filter_setup(void) { int i; INT32U Address; /* * 由于CAN1与CAN2共用同一个CAN报文过滤器,为防止重复安装CAN报文过滤器. */ if (0 != InitCounter) { return OK; } InitCounter++; write_dword(AFMR, 0x01); /* 进入关闭模式(所有消息报文都将被拒收) */ /* 1) * 添加滤波标识符项目 */ Address = FILTER_RAM; for (i = 0; i < sizeof(aStandardID)/sizeof(INT32U); i++) { int Index = i << 1; write_dword(Address, (aStandardID[Index] << 16) | aStandardID[Index + 1]); /* 硬件规定只能以字的方式访问 */ Address += 4; } /* 2) * 设置边界寄存器 */ write_dword(SFF_SA, 0); /* 设置散列标准标识符起始地址 */ write_dword(SFF_GRP_SA, sizeof(aStandardID) / sizeof(INT8U)); /* 设置组列标准标识符起始地址 */ write_dword(EFF_SA, sizeof(aStandardID) / sizeof(INT8U)); /* 设置散列扩展标识符起始地址 */ write_dword(EFF_GRP_SA, sizeof(aStandardID) / sizeof(INT8U)); /* 设置组列扩展标识符起始地址 */ write_dword(ENDOFTABLE, sizeof(aStandardID) / sizeof(INT8U)); /* 设置滤波表线束地址 */ write_dword(AFMR, 0x00); /* 进入工作模式(仅接收过滤后的消息报文) */ return OK; }
static vod_status_t hds_muxer_end_frame(hds_muxer_state_t* state) { uint32_t packet_size = state->frame_header_size + state->cur_frame->size; vod_status_t rc; u_char* p; // write the frame size rc = write_buffer_get_bytes(&state->write_buffer_state, sizeof(uint32_t), &p); if (rc != VOD_OK) { vod_log_debug1(VOD_LOG_DEBUG_LEVEL, state->request_context->log, 0, "hds_muxer_end_frame: write_buffer_get_bytes failed %i", rc); return rc; } write_dword(p, packet_size); return VOD_OK; }
void BIOSCALL int70_function(pusha_regs_t regs, uint16_t ds, uint16_t es, iret_addr_t iret_addr) { // INT 70h: IRQ 8 - CMOS RTC interrupt from periodic or alarm modes uint8_t registerB = 0, registerC = 0; // Check which modes are enabled and have occurred. registerB = inb_cmos( 0xB ); registerC = inb_cmos( 0xC ); if( ( registerB & 0x60 ) != 0 ) { if( ( registerC & 0x20 ) != 0 ) { // Handle Alarm Interrupt. int_enable(); call_int_4a(); int_disable(); } if( ( registerC & 0x40 ) != 0 ) { // Handle Periodic Interrupt. if( read_byte( 0x40, 0xA0 ) != 0 ) { // Wait Interval (Int 15, AH=83) active. uint32_t time; time = read_dword( 0x40, 0x9C ); // Time left in microseconds. if( time < 0x3D1 ) { // Done waiting. uint16_t segment, offset; segment = read_word( 0x40, 0x98 ); offset = read_word( 0x40, 0x9A ); write_byte( 0x40, 0xA0, 0 ); // Turn of status byte. outb_cmos( 0xB, registerB & 0x37 ); // Clear the Periodic Interrupt. write_byte( segment, offset, read_byte(segment, offset) | 0x80 ); // Write to specified flag byte. } else { // Continue waiting. time -= 0x3D1; write_dword( 0x40, 0x9C, time ); } } } } eoi_both_pics(); }
static u_char* dash_packager_write_trex_atom(u_char* p, uint32_t track_id) { size_t atom_size = ATOM_HEADER_SIZE + sizeof(trex_atom_t); write_atom_header(p, atom_size, 't', 'r', 'e', 'x'); write_dword(p, 0); // version + flags write_dword(p, track_id); // track id write_dword(p, 1); // default sample description index write_dword(p, 0); // default sample duration write_dword(p, 0); // default sample size write_dword(p, 0); // default sample size return p; }
/********************************************************************************************************************* ** Function name: putchar ** Descriptions: 输出字符 ** Input parameters: Char : 输出字符 ** Output parameters: ** Returned value: ==OS_OK : 操作成功 ** !=OS_OK : 操作失败(包含出错信息) **-------------------------------------------------------------------------------------------------------------------- ** Created by: Fengliang ** Created Date: 2010-12-9 10:53:33 ** Test recorde: **-------------------------------------------------------------------------------------------------------------------- ** Modified by: ** Modified date: ** Test recorde: *********************************************************************************************************************/ INT32S uart_send(const UART_INFO *This, char *pBuffer, int Size) { /* * 以查询方式输出 */ INT32U BaseAddress; /* 寄存器基址 */ BaseAddress = This->BaseAddress; /* * 等待FIFO空闲 */ while(!(read_dword(BaseAddress + LSR) & (0x01<<5))) { ; } write_dword(BaseAddress + THR, *pBuffer); /* 发送字符 */ return OK; }
static u_char* hds_muxer_write_codec_config(u_char* p, hds_muxer_state_t* state, uint64_t cur_frame_dts) { mpeg_stream_metadata_t* cur_stream; hds_muxer_stream_state_t* stream_state; size_t packet_size; for (stream_state = state->first_stream; stream_state < state->last_stream; stream_state++) { cur_stream = stream_state->metadata; packet_size = sizeof(adobe_mux_packet_header_t)+cur_stream->media_info.extra_data_size; switch (cur_stream->media_info.media_type) { case MEDIA_TYPE_VIDEO: p = hds_write_video_tag_header( p, cur_stream->media_info.extra_data_size, cur_frame_dts, FRAME_TYPE_KEY_FRAME, AVC_PACKET_TYPE_SEQUENCE_HEADER, 0); packet_size += sizeof(video_tag_header_avc); break; case MEDIA_TYPE_AUDIO: p = hds_write_audio_tag_header( p, cur_stream->media_info.extra_data_size, cur_frame_dts, stream_state->sound_info, AAC_PACKET_TYPE_SEQUENCE_HEADER); packet_size += sizeof(audio_tag_header_aac); break; } p = vod_copy(p, cur_stream->media_info.extra_data, cur_stream->media_info.extra_data_size); write_dword(p, packet_size); } return p; }
static u_char* hds_write_single_video_frame_trun_atom(u_char* p, input_frame_t* frame, uint32_t offset) { size_t atom_size; atom_size = TRUN_SIZE_SINGLE_VIDEO_FRAME; write_atom_header(p, atom_size, 't', 'r', 'u', 'n'); write_dword(p, 0xF01); // flags = data offset, duration, size, key, delay 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); if (frame->key_frame) { write_dword(p, 0x02000000); // I-frame } else { write_dword(p, 0x01010000); // not I-frame + non key sample } write_dword(p, frame->pts_delay); return p; }
PCI_Device::PCI_Device(const uint16_t pci_addr, const uint32_t device_id, const uint32_t devclass) : pci_addr_{pci_addr}, device_id_{device_id} { // set master, mem and io flags uint32_t cmd = read_dword(PCI_CMD_REG); cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEM | PCI_COMMAND_IO; write_dword(PCI_CMD_REG, cmd); // device class info is coming from pci manager to save a PCI read this->devtype_.reg = devclass; INFO2("|"); switch (PCI::classcode(devtype_.classcode)) { case PCI::classcode::BRIDGE: INFO2("+--[ %s, %s, %s (0x%x) ]", PCI::classcode_str(classcode()), PCI::vendor_str(vendor_id()), bridge_subclasses[devtype_.subclass < SS_BR ? devtype_.subclass : SS_BR-1], devtype_.subclass); break; case PCI::classcode::NIC: INFO2("+--[ %s, %s, %s (0x%x) ]", PCI::classcode_str(devtype_.classcode), PCI::vendor_str(vendor_id()), nic_subclasses[devtype_.subclass < SS_NIC ? devtype_.subclass : SS_NIC-1], devtype_.subclass); break; default: INFO2("+--[ %s, %s ]", PCI::classcode_str(devtype_.classcode), PCI::vendor_str(vendor_id())); } //< switch (devtype_.classcode) // bridges are different from other PCI devices if (classcode() == PCI::classcode::BRIDGE) return; }
static u_char* dash_packager_write_sidx64_atom( u_char* p, mpeg_stream_metadata_t* stream_metadata, uint64_t earliest_pres_time, uint32_t reference_size) { size_t atom_size = ATOM_HEADER_SIZE + sizeof(sidx64_atom_t); write_atom_header(p, atom_size, 's', 'i', 'd', 'x'); write_dword(p, 0x01000000); // version + flags write_dword(p, 1); // reference id write_dword(p, stream_metadata->media_info.timescale); // timescale write_qword(p, earliest_pres_time); // earliest presentation time write_qword(p, 0LL); // first offset write_dword(p, 1); // reserved + reference count write_dword(p, reference_size); // referenced size write_dword(p, stream_metadata->total_frames_duration); // subsegment duration write_dword(p, 0x90000000); // starts with SAP / SAP type return p; }