docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* This function returns the real bus clock of USCI_I2C module. */
uint32_t UI2C_GetBusClockFreq(UI2C_T *ui2c)
/* This function returns the real bus clock of USCI_I2C module. */ uint32_t UI2C_GetBusClockFreq(UI2C_T *ui2c)
{ uint32_t u32Divider; uint32_t u32Pclk; if (ui2c == UI2C0) { u32Pclk = CLK_GetPCLK0Freq(); } else { u32Pclk = CLK_GetPCLK1Freq(); } u32Divider = (ui2c->BRGEN & UI2C_BRGEN_CLKDIV_Msk) >> UI2C_BRGEN_CLKDIV_Pos; return ( u32Pclk / ((u32Divider+1U)<<1U) ); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the specified SPI receive CRC register value. */
uint16_t SPI_ReadRxCRC(SPI_T *spi)
/* Reads the specified SPI receive CRC register value. */ uint16_t SPI_ReadRxCRC(SPI_T *spi)
{ return spi->RXCRC_B.RXCRC; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Queries the current Ethernet MAC remote wake-up configuration. */
uint32_t EMACPowerManagementControlGet(uint32_t ui32Base)
/* Queries the current Ethernet MAC remote wake-up configuration. */ uint32_t EMACPowerManagementControlGet(uint32_t ui32Base)
{ ASSERT(ui32Base == EMAC0_BASE); return(HWREG(ui32Base + EMAC_O_PMTCTLSTAT) & (EMAC_PMTCTLSTAT_GLBLUCAST | EMAC_PMTCTLSTAT_WUPFREN | EMAC_PMTCTLSTAT_MGKPKTEN | EMAC_PMTCTLSTAT_PWRDWN)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read or write a bunch of msrs. All parameters are kernel addresses. */
static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs, struct kvm_msr_entry *entries, int(*do_msr)(struct kvm_vcpu *vcpu, unsigned index, u64 *data))
/* Read or write a bunch of msrs. All parameters are kernel addresses. */ static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs, struct kvm_msr_entry *entries, int(*do_msr)(struct kvm_vcpu *vcpu, unsigned index, u64 *data))
{ int i; vcpu_load(vcpu); down_read(&vcpu->kvm->slots_lock); for (i = 0; i < msrs->nmsrs; ++i) if (do_msr(vcpu, entries[i].index, &entries[i].data)) break; up_read(&vcpu->kvm->slots_lock); vcpu_put(vcpu); return i; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ADC Set Clock Prescale. The ADC clock taken from the APB2 clock can be scaled down by 2, 4, 6 or 8. */
void adc_set_clk_prescale(uint32_t prescale)
/* ADC Set Clock Prescale. The ADC clock taken from the APB2 clock can be scaled down by 2, 4, 6 or 8. */ void adc_set_clk_prescale(uint32_t prescale)
{ uint32_t reg32 = ((ADC_CCR & ~ADC_CCR_ADCPRE_MASK) | prescale); ADC_CCR = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns 0 on success or negative error code on failure. */
static int __init i2o_bus_init(void)
/* Returns 0 on success or negative error code on failure. */ static int __init i2o_bus_init(void)
{ int rc; printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); rc = i2o_driver_register(&i2o_bus_driver); if (rc) { osm_err("Could not register Bus Adapter OSM\n"); return rc; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Description: This function is designed to be used as a callback to the call_rcu() function so that memory allocated to a hash table address entry can be released safely. */
static void netlbl_unlhsh_free_addr4(struct rcu_head *entry)
/* Description: This function is designed to be used as a callback to the call_rcu() function so that memory allocated to a hash table address entry can be released safely. */ static void netlbl_unlhsh_free_addr4(struct rcu_head *entry)
{ struct netlbl_unlhsh_addr4 *ptr; ptr = container_of(entry, struct netlbl_unlhsh_addr4, rcu); kfree(ptr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Execute the transfer by polling the URB. This is a synchronous operation. */
EFI_STATUS EhcExecTransfer(IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb, IN UINTN TimeOut)
/* Execute the transfer by polling the URB. This is a synchronous operation. */ EFI_STATUS EhcExecTransfer(IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb, IN UINTN TimeOut)
{ EFI_STATUS Status; UINTN Index; UINTN Loop; BOOLEAN Finished; BOOLEAN InfiniteLoop; Status = EFI_SUCCESS; Loop = TimeOut * EHC_1_MILLISECOND; Finished = FALSE; InfiniteLoop = FALSE; if (TimeOut == 0) { InfiniteLoop = TRUE; } for (Index = 0; InfiniteLoop || (Index < Loop); Index++) { Finished = EhcCheckUrbResult (Ehc, Urb); if (Finished) { break; } MicroSecondDelay (EHC_1_MICROSECOND); } if (!Finished) { Status = EFI_TIMEOUT; } else if (Urb->Result != EFI_USB_NOERROR) { Status = EFI_DEVICE_ERROR; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Ensure that all unmapped FMRs are fully invalidated. */
int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
/* Ensure that all unmapped FMRs are fully invalidated. */ int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
{ int serial; struct ib_pool_fmr *fmr, *next; spin_lock_irq(&pool->pool_lock); list_for_each_entry_safe(fmr, next, &pool->free_list, list) { if (fmr->remap_count > 0) list_move(&fmr->list, &pool->dirty_list); } spin_unlock_irq(&pool->pool_lock); serial = atomic_inc_return(&pool->req_ser); wake_up_process(pool->thread); if (wait_event_interruptible(pool->force_wait, atomic_read(&pool->flush_ser) - serial >= 0)) return -EINTR; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; if(huart->Instance==USART1) { PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1; PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_D2PCLK2; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { Error_Handler(); } __HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF4_USART1; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The constructor function caches the pointer of the MM Services Table. */
EFI_STATUS EFIAPI MmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer of the MM Services Table. */ EFI_STATUS EFIAPI MmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_MM_BASE_PROTOCOL *InternalMmBase; InternalMmBase = NULL; Status = SystemTable->BootServices->LocateProtocol ( &gEfiMmBaseProtocolGuid, NULL, (VOID **)&InternalMmBase ); ASSERT_EFI_ERROR (Status); ASSERT (InternalMmBase != NULL); InternalMmBase->GetMmstLocation (InternalMmBase, &gMmst); ASSERT (gMmst != NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Moves data beyond the current pointer position from the XDR head buffer into the page list. Any data that lies beyond current position + "len" bytes is moved into the XDR tail. The current pointer is then repositioned at the beginning of the first XDR page. */
void xdr_enter_page(struct xdr_stream *xdr, unsigned int len)
/* Moves data beyond the current pointer position from the XDR head buffer into the page list. Any data that lies beyond current position + "len" bytes is moved into the XDR tail. The current pointer is then repositioned at the beginning of the first XDR page. */ void xdr_enter_page(struct xdr_stream *xdr, unsigned int len)
{ char * kaddr = page_address(xdr->buf->pages[0]); xdr_read_pages(xdr, len); if (len > PAGE_CACHE_SIZE - xdr->buf->page_base) len = PAGE_CACHE_SIZE - xdr->buf->page_base; xdr->p = (__be32 *)(kaddr + xdr->buf->page_base); xdr->end = (__be32 *)((char *)xdr->p + len); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: 0 if the link status is OK, -ve if a error occurred during checking */
static int check_link_status(struct udevice *dev, u8 lane_count)
/* Return: 0 if the link status is OK, -ve if a error occurred during checking */ static int check_link_status(struct udevice *dev, u8 lane_count)
{ u8 retry_count = 0; if (!is_connected(dev)) return -ENODEV; do { int status; status = get_lane_status_adj_reqs(dev); if (status) return -EIO; if ((check_clock_recovery(dev, lane_count) == 0) && (check_channel_equalization(dev, lane_count) == 0)) return 0; retry_count++; } while (retry_count < 5); return -EIO; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns enum type. search returns the pointer to use for comparison. not returns 1 if buff started with a '!' 0 otherwise. */
enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
/* Returns enum type. search returns the pointer to use for comparison. not returns 1 if buff started with a '!' 0 otherwise. */ enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
{ int type = MATCH_FULL; int i; if (buff[0] == '!') { *not = 1; buff++; len--; } else *not = 0; *search = buff; for (i = 0; i < len; i++) { if (buff[i] == '*') { if (!i) { *search = buff + 1; type = MATCH_END_ONLY; } else { if (type == MATCH_END_ONLY) type = MATCH_MIDDLE_ONLY; else type = MATCH_FRONT_ONLY; buff[i] = 0; break; } } } return type; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Fills each ADC_InitStruct member with its default value. */
void ADC_StructInit(ADC_InitType *ADC_InitStruct)
/* Fills each ADC_InitStruct member with its default value. */ void ADC_StructInit(ADC_InitType *ADC_InitStruct)
{ ADC_InitStruct->Mode = ADC_MODE_DC; ADC_InitStruct->ClockSource = ADC_CLKSRC_RCH; ADC_InitStruct->ClockFrq = ADC_CLKFRQ_HIGH; ADC_InitStruct->SkipSample = ADC_SKIP_0; ADC_InitStruct->AverageSample = ADC_AVERAGE_2; ADC_InitStruct->TriggerSource = ADC_TRIGSOURCE_OFF; ADC_InitStruct->Channel = ADC_CHANNEL_GND0; ADC_InitStruct->ResDivEnable = 0; ADC_InitStruct->AverageEnable = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write value to the a PHY register Note: MDI interface is assumed to already have been enabled. */
static void write_phy(unsigned char phy_addr, unsigned char address, unsigned int value)
/* Write value to the a PHY register Note: MDI interface is assumed to already have been enabled. */ static void write_phy(unsigned char phy_addr, unsigned char address, unsigned int value)
{ at91_emac_write(AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_W | ((phy_addr & 0x1f) << 23) | (address << 18) | (value & AT91_EMAC_DATA)); at91_phy_wait(); }
robutest/uclinux
C++
GPL-2.0
60
/* Send a request and place it on the recvq if successfully sent. Must be called with the server lock held. */
static int smb_request_send_req(struct smb_request *req)
/* Send a request and place it on the recvq if successfully sent. Must be called with the server lock held. */ static int smb_request_send_req(struct smb_request *req)
{ struct smb_sb_info *server = req->rq_server; int result; if (req->rq_bytes_sent == 0) { WSET(req->rq_header, smb_tid, server->opt.tid); WSET(req->rq_header, smb_pid, 1); WSET(req->rq_header, smb_uid, server->opt.server_uid); } result = smb_send_request(req); if (result < 0 && result != -EAGAIN) goto out; result = 0; if (!(req->rq_flags & SMB_REQ_TRANSMITTED)) goto out; list_move_tail(&req->rq_queue, &server->recvq); result = 1; out: return result; }
robutest/uclinux
C++
GPL-2.0
60
/* SYSCTRL HSTIMER Bus Clock Disable and Reset Assert. */
void LL_SYSCTRL_HSTMR_ClkDisRstAssert(void)
/* SYSCTRL HSTIMER Bus Clock Disable and Reset Assert. */ void LL_SYSCTRL_HSTMR_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_HSTIMERBusClk_Dis(SYSCTRL); __LL_SYSCTRL_HSTIMERSoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called by the kernel when a firmware is made available, or if it times out waiting for the firmware. */
static void uart_firmware_cont(const struct firmware *fw, void *context)
/* This function is called by the kernel when a firmware is made available, or if it times out waiting for the firmware. */ static void uart_firmware_cont(const struct firmware *fw, void *context)
{ struct qe_firmware *firmware; struct device *dev = context; int ret; if (!fw) { dev_err(dev, "firmware not found\n"); return; } firmware = (struct qe_firmware *) fw->data; if (firmware->header.length != fw->size) { dev_err(dev, "invalid firmware\n"); goto out; } ret = qe_upload_firmware(firmware); if (ret) { dev_err(dev, "could not load firmware\n"); goto out; } firmware_loaded = 1; out: release_firmware(fw); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads from CLASS internal bus peripherals (ccu, pe-lem) from the host through indirect access registers. */
static u32 class_bus_read(u32 addr, u8 size)
/* Reads from CLASS internal bus peripherals (ccu, pe-lem) from the host through indirect access registers. */ static u32 class_bus_read(u32 addr, u8 size)
{ u32 offset = addr & 0x3; u32 mask = 0xffffffff >> ((4 - size) << 3); u32 val; writel((addr & CLASS_BUS_ACCESS_BASE_MASK), CLASS_BUS_ACCESS_BASE); addr = (addr & ~CLASS_BUS_ACCESS_BASE_MASK) | (size << 24); writel(addr, CLASS_BUS_ACCESS_ADDR); val = be32_to_cpu(readl(CLASS_BUS_ACCESS_RDATA)); return (val >> (offset << 3)) & mask; }
4ms/stm32mp1-baremetal
C++
Other
137
/* I2C Core Support Routines (Interface to higher level I2C code) */
static u32 mv64xxx_i2c_functionality(struct i2c_adapter *adap)
/* I2C Core Support Routines (Interface to higher level I2C code) */ static u32 mv64xxx_i2c_functionality(struct i2c_adapter *adap)
{ return I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR | I2C_FUNC_SMBUS_EMUL; }
robutest/uclinux
C++
GPL-2.0
60
/* This inv_shift_rows also implements the matrix flip required for inv_mix_columns, but performs it here to reduce the number of memory operations. */
static void inv_shift_rows(uint8_t *s)
/* This inv_shift_rows also implements the matrix flip required for inv_mix_columns, but performs it here to reduce the number of memory operations. */ static void inv_shift_rows(uint8_t *s)
{ uint8_t t[Nb*Nk]; t[0] = s[0]; t[1] = s[13]; t[2] = s[10]; t[3] = s[7]; t[4] = s[4]; t[5] = s[1]; t[6] = s[14]; t[7] = s[11]; t[8] = s[8]; t[9] = s[5]; t[10] = s[2]; t[11] = s[15]; t[12] = s[12]; t[13] = s[9]; t[14] = s[6]; t[15] = s[3]; (void)_copy(s, sizeof(t), t, sizeof(t)); }
Nicholas3388/LuaNode
C++
Other
1,055
/* ZigBee Device Profile dissector for the recover source */
void dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the recover source */ void dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 0 on success, a negative error code otherwise. */
int nand_write_data_op(struct nand_chip *chip, const void *buf, unsigned int len, bool force_8bit)
/* Returns 0 on success, a negative error code otherwise. */ int nand_write_data_op(struct nand_chip *chip, const void *buf, unsigned int len, bool force_8bit)
{ struct mtd_info *mtd = nand_to_mtd(chip); if (!len || !buf) return -EINVAL; if (force_8bit) { const u8 *p = buf; unsigned int i; for (i = 0; i < len; i++) chip->write_byte(mtd, p[i]); } else { chip->write_buf(mtd, buf, len); } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reads N bytes of data from the Mailbox, starting at the specified byte offset. */
int32_t BSP_NFCTAG_ReadMailboxData(uint32_t Instance, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
/* Reads N bytes of data from the Mailbox, starting at the specified byte offset. */ int32_t BSP_NFCTAG_ReadMailboxData(uint32_t Instance, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
{ UNUSED(Instance); return ST25DV_ReadMailboxData(&NfcTagObj, pData, TarAddr, NbByte); }
eclipse-threadx/getting-started
C++
Other
310
/* s e t u p A l l F r e e */
returnValue Bounds_setupAllFree(Bounds *_THIS)
/* s e t u p A l l F r e e */ returnValue Bounds_setupAllFree(Bounds *_THIS)
{ return Bounds_setupAll( _THIS,ST_INACTIVE ); }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Fetch a robust-list pointer. Bit 0 signals PI futexes: */
static int fetch_robust_entry(struct robust_list __user **entry, struct robust_list __user *__user *head, int *pi)
/* Fetch a robust-list pointer. Bit 0 signals PI futexes: */ static int fetch_robust_entry(struct robust_list __user **entry, struct robust_list __user *__user *head, int *pi)
{ unsigned long uentry; if (get_user(uentry, (unsigned long __user *)head)) return -EFAULT; *entry = (void __user *)(uentry & ~1UL); *pi = uentry & 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Register the Service B.2 and all its Characteristics... */
void service_b_2_3_init(void)
/* Register the Service B.2 and all its Characteristics... */ void service_b_2_3_init(void)
{ bt_gatt_service_register(&service_b_2_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* whether to stretch SCL low when data is not ready in slave mode */
void i2c_stretch_scl_low_config(uint32_t i2c_periph, i2c_stretchscl_enum stretchpara)
/* whether to stretch SCL low when data is not ready in slave mode */ void i2c_stretch_scl_low_config(uint32_t i2c_periph, i2c_stretchscl_enum stretchpara)
{ I2C_CTL0(i2c_periph) &= ~(I2C_CTL0_DISSTRC); I2C_CTL0(i2c_periph) |= ((I2C_CTL0_DISSTRC)&(stretchpara)); }
liuxuming/trochili
C++
Apache License 2.0
132
/* Converts a text device path node to VLAN device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVlan(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to VLAN device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVlan(IN CHAR16 *TextDeviceNode)
{ CHAR16 *VlanStr; VLAN_DEVICE_PATH *Vlan; VlanStr = GetNextParamStr (&TextDeviceNode); Vlan = (VLAN_DEVICE_PATH *)CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_VLAN_DP, (UINT16)sizeof (VLAN_DEVICE_PATH) ); Vlan->VlanId = (UINT16)Strtoi (VlanStr); return (EFI_DEVICE_PATH_PROTOCOL *)Vlan; }
tianocore/edk2
C++
Other
4,240
/* all driver entry declared with POST_DRIVER_ENTRY or POST_DRIVER_FULL_ENTRY will be called with specified sequence */
int _os_post_driver_entry(void)
/* all driver entry declared with POST_DRIVER_ENTRY or POST_DRIVER_FULL_ENTRY will be called with specified sequence */ int _os_post_driver_entry(void)
{ {DODE(&__post_driver_start__), DODE(&__post_driver_end__)}, }; for (i = 0; i < sizeof(g_drv_section_entry)/sizeof(g_drv_section_entry[0]); i++) { s = g_drv_section_entry[i].s; e = g_drv_section_entry[i].e; drv_entry = s; while (drv_entry < e) { ddkc_dbg("drv_entry:%p, *drv_entry:%p\r\n", drv_entry, *drv_entry); (*((OS_DRIVER_ENTRY *)drv_entry))(); drv_entry++; } } return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This service executes a caller provided function on all enabled CPUs. CPUs can run either simultaneously or one at a time in sequence. This service may only be called from the BSP. */
EFI_STATUS EFIAPI EdkiiPeiStartupAllCPUs(IN EDKII_PEI_MP_SERVICES2_PPI *This, IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument OPTIONAL)
/* This service executes a caller provided function on all enabled CPUs. CPUs can run either simultaneously or one at a time in sequence. This service may only be called from the BSP. */ EFI_STATUS EFIAPI EdkiiPeiStartupAllCPUs(IN EDKII_PEI_MP_SERVICES2_PPI *This, IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument OPTIONAL)
{ return MpInitLibStartupAllCPUs ( Procedure, TimeoutInMicroSeconds, ProcedureArgument ); }
tianocore/edk2
C++
Other
4,240
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SGTL5000_SetMute(void *handle, uint32_t playChannel, bool isMute)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_SGTL5000_SetMute(void *handle, uint32_t playChannel, bool isMute)
{ assert(handle != NULL); if (playChannel & (kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight)) { return SGTL_SetMute((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), kSGTL_ModuleHP, isMute); } if (playChannel & (kCODEC_PlayChannelLineOutLeft | kCODEC_PlayChannelLineOutRight)) { return SGTL_SetMute((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), kSGTL_ModuleLineOut, isMute); } return kStatus_CODEC_NotSupport; }
eclipse-threadx/getting-started
C++
Other
310
/* If NextNode is not NULL, return the next node. */
STATIC EFI_STATUS EFIAPI AmlIteratorGetNextBranch(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **NextNode)
/* If NextNode is not NULL, return the next node. */ STATIC EFI_STATUS EFIAPI AmlIteratorGetNextBranch(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **NextNode)
{ AML_TREE_ITERATOR_INTERNAL *InternalIterator; AML_NODE_HEADER *Node; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator; if ((InternalIterator == NULL) || (InternalIterator->Mode != EAmlIteratorBranch) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) { ASSERT (0); return EFI_INVALID_PARAMETER; } Node = AmlGetNextNode (InternalIterator->CurrentNode); if (AmlGetParent (Node) == AmlGetParent ((AML_NODE_HEADER *)InternalIterator->InitialNode)) { Node = NULL; } InternalIterator->CurrentNode = Node; if (NextNode != NULL) { *NextNode = Node; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Configure the link capabilities and speed in the PCIe root complex. */
static void pcie_dw_configure(struct pcie_dw_ti *pci, u32 cap_speed)
/* Configure the link capabilities and speed in the PCIe root complex. */ static void pcie_dw_configure(struct pcie_dw_ti *pci, u32 cap_speed)
{ u32 val; dw_pcie_dbi_write_enable(pci, true); val = readl(pci->dbi_base + PCIE_LINK_CAPABILITY); val &= ~TARGET_LINK_SPEED_MASK; val |= cap_speed; writel(val, pci->dbi_base + PCIE_LINK_CAPABILITY); val = readl(pci->dbi_base + PCIE_LINK_CTL_2); val &= ~TARGET_LINK_SPEED_MASK; val |= cap_speed; writel(val, pci->dbi_base + PCIE_LINK_CTL_2); dw_pcie_dbi_write_enable(pci, false); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Disable the assertion of core reset signal when a supply monitor detection occurs. */
void supc_disable_monitor_reset(Supc *p_supc)
/* Disable the assertion of core reset signal when a supply monitor detection occurs. */ void supc_disable_monitor_reset(Supc *p_supc)
{ p_supc->SUPC_SMMR &= ~SUPC_SMMR_SMRSTEN; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check if the ARP request is probing the private IP address dedicated to iSCSI, generate an ARP reply if so. */
static void cxgb3_arp_process(struct port_info *pi, struct sk_buff *skb)
/* Check if the ARP request is probing the private IP address dedicated to iSCSI, generate an ARP reply if so. */ static void cxgb3_arp_process(struct port_info *pi, struct sk_buff *skb)
{ struct net_device *dev = skb->dev; struct arphdr *arp; unsigned char *arp_ptr; unsigned char *sha; __be32 sip, tip; if (!dev) return; skb_reset_network_header(skb); arp = arp_hdr(skb); if (arp->ar_op != htons(ARPOP_REQUEST)) return; arp_ptr = (unsigned char *)(arp + 1); sha = arp_ptr; arp_ptr += dev->addr_len; memcpy(&sip, arp_ptr, sizeof(sip)); arp_ptr += sizeof(sip); arp_ptr += dev->addr_len; memcpy(&tip, arp_ptr, sizeof(tip)); if (tip != pi->iscsi_ipv4addr) return; arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha, pi->iscsic.mac_addr, sha); }
robutest/uclinux
C++
GPL-2.0
60
/* Helper function for rcu_process_callbacks() that operates on the specified rcu_ctrlkblk structure. */
static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
/* Helper function for rcu_process_callbacks() that operates on the specified rcu_ctrlkblk structure. */ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
{ struct rcu_head *next, *list; unsigned long flags; if (&rcp->rcucblist == rcp->donetail) return; local_irq_save(flags); list = rcp->rcucblist; rcp->rcucblist = *rcp->donetail; *rcp->donetail = NULL; if (rcp->curtail == rcp->donetail) rcp->curtail = &rcp->rcucblist; rcp->donetail = &rcp->rcucblist; local_irq_restore(flags); while (list) { next = list->next; prefetch(next); list->func(list); list = next; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if there is an overrun and if there is warn about it. */
static gboolean c_warn_overrun(proto_tree *tree, tvbuff_t *tvb, guint start, guint end, c_pkt_data *data)
/* Check if there is an overrun and if there is warn about it. */ static gboolean c_warn_overrun(proto_tree *tree, tvbuff_t *tvb, guint start, guint end, c_pkt_data *data)
{ guint diff; DISSECTOR_ASSERT_CMPUINT(start, <=, end); diff = end - start; if (!diff) return FALSE; proto_tree_add_expert_format(tree, data->pinfo, &ei_overrun, tvb, start, diff, "%u overrun byte%s", diff, diff == 1? "":"s"); return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Flushes the store queue cache from @start to @start + @len in a linear fashion. */
void sq_flush_range(unsigned long start, unsigned int len)
/* Flushes the store queue cache from @start to @start + @len in a linear fashion. */ void sq_flush_range(unsigned long start, unsigned int len)
{ unsigned long *sq = (unsigned long *)start; for (len >>= 5; len--; sq += 8) prefetchw(sq); store_queue_barrier(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Message: OffHookMessage Opcode: 0x0006 Type: CallControl Direction: dev2pbx VarLength: no */
static void handle_OffHookMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: OffHookMessage Opcode: 0x0006 Type: CallControl Direction: dev2pbx VarLength: no */ static void handle_OffHookMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0); if (hdr_data_length > 4) { si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN); si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Insert a root bridge into PCI device pool. */
VOID InsertRootBridge(IN PCI_IO_DEVICE *RootBridge)
/* Insert a root bridge into PCI device pool. */ VOID InsertRootBridge(IN PCI_IO_DEVICE *RootBridge)
{ InsertTailList (&mPciDevicePool, &(RootBridge->Link)); }
tianocore/edk2
C++
Other
4,240
/* Note that if 7 descriptors are allocated, it's perfectly acceptable to initialize the ring with a smaller number of descriptors. The amount of memory allocated for the descriptor ring will not be reduced, and the descriptor ring may be reinitialized later */
int dma_init_descriptor_ring(DMA_DescriptorRing_t *ring, int numDescriptors)
/* Note that if 7 descriptors are allocated, it's perfectly acceptable to initialize the ring with a smaller number of descriptors. The amount of memory allocated for the descriptor ring will not be reduced, and the descriptor ring may be reinitialized later */ int dma_init_descriptor_ring(DMA_DescriptorRing_t *ring, int numDescriptors)
{ if (ring->virtAddr == NULL) { return -EINVAL; } if (dmacHw_initDescriptor(ring->virtAddr, ring->physAddr, ring->bytesAllocated, numDescriptors) < 0) { printk(KERN_ERR "dma_init_descriptor_ring: dmacHw_initDescriptor failed\n"); return -ENOMEM; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Flush spi tx, rx fifos and reset the SPI controller */
static void spi_flush_fifo(struct exynos_spi *regs)
/* Flush spi tx, rx fifos and reset the SPI controller */ static void spi_flush_fifo(struct exynos_spi *regs)
{ clrsetbits_le32(&regs->ch_cfg, SPI_CH_HS_EN, SPI_CH_RST); clrbits_le32(&regs->ch_cfg, SPI_CH_RST); setbits_le32(&regs->ch_cfg, SPI_TX_CH_ON | SPI_RX_CH_ON); }
4ms/stm32mp1-baremetal
C++
Other
137
/* ixgbe_atr_set_dst_port_82599 - Sets the destination port @input: input stream to modify @dst_port: the destination port to load */
s32 ixgbe_atr_set_dst_port_82599(struct ixgbe_atr_input *input, u16 dst_port)
/* ixgbe_atr_set_dst_port_82599 - Sets the destination port @input: input stream to modify @dst_port: the destination port to load */ s32 ixgbe_atr_set_dst_port_82599(struct ixgbe_atr_input *input, u16 dst_port)
{ input->byte_stream[IXGBE_ATR_DST_PORT_OFFSET + 1] = dst_port >> 8; input->byte_stream[IXGBE_ATR_DST_PORT_OFFSET] = dst_port & 0xff; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable a DMA channel (by index ch: 0..15) by clearing a DMA_SxCR bit. */
int stm32_dma_ch_disable(int ch)
/* Enable or disable a DMA channel (by index ch: 0..15) by clearing a DMA_SxCR bit. */ int stm32_dma_ch_disable(int ch)
{ return __stm32_dma_ch_enable(ch, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Search for any interface with the given flags. Returns NULL if a device is not found or a pointer to the device. The device returned has had a reference added and the pointer is safe until the user calls dev_put to indicate they have finished with it. */
struct net_device* dev_get_by_flags(struct net *net, unsigned short if_flags, unsigned short mask)
/* Search for any interface with the given flags. Returns NULL if a device is not found or a pointer to the device. The device returned has had a reference added and the pointer is safe until the user calls dev_put to indicate they have finished with it. */ struct net_device* dev_get_by_flags(struct net *net, unsigned short if_flags, unsigned short mask)
{ struct net_device *dev, *ret; ret = NULL; rcu_read_lock(); for_each_netdev_rcu(net, dev) { if (((dev->flags ^ if_flags) & mask) == 0) { dev_hold(dev); ret = dev; break; } } rcu_read_unlock(); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* We are picking a new current task - update its stats: */
static void update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
/* We are picking a new current task - update its stats: */ static void update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
{ se->exec_start = rq_of(cfs_rq)->clock; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set Deadtime. The deadtime and sampling clock (DTSC) is set in the clock division ratio part of the timer mode settings. The deadtime count is an 8 bit value defined in terms of the number of DTSC cycles: */
void timer_set_deadtime(uint32_t timer_peripheral, uint32_t deadtime)
/* Set Deadtime. The deadtime and sampling clock (DTSC) is set in the clock division ratio part of the timer mode settings. The deadtime count is an 8 bit value defined in terms of the number of DTSC cycles: */ void timer_set_deadtime(uint32_t timer_peripheral, uint32_t deadtime)
{ TIM_BDTR(timer_peripheral) |= deadtime; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* param base CMP peripheral base address. param config Pointer to the configuration structure. "NULL" disables the feature. */
void CMP_SetDACConfig(CMP_Type *base, const cmp_dac_config_t *config)
/* param base CMP peripheral base address. param config Pointer to the configuration structure. "NULL" disables the feature. */ void CMP_SetDACConfig(CMP_Type *base, const cmp_dac_config_t *config)
{ uint8_t tmp8 = 0U; if (NULL == config) { base->DACCR = 0U; return; } tmp8 |= CMP_DACCR_DACEN_MASK; if (kCMP_VrefSourceVin2 == config->referenceVoltageSource) { tmp8 |= CMP_DACCR_VRSEL_MASK; } tmp8 |= CMP_DACCR_VOSEL(config->DACValue); base->DACCR = tmp8; }
eclipse-threadx/getting-started
C++
Other
310
/* Fills the first n bytes of the memory area pointed to by s with the constant byte c. */
static void MAC_memset(uint8_t *s, uint8_t c, uint32_t n)
/* Fills the first n bytes of the memory area pointed to by s with the constant byte c. */ static void MAC_memset(uint8_t *s, uint8_t c, uint32_t n)
{ uint8_t *sb = s; while( n > 0u ) { n--; sb[n] = c; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* @src: source buffer @uefi: target buffer, possibly unaligned */
static void path_to_uefi(void *uefi, const char *src)
/* @src: source buffer @uefi: target buffer, possibly unaligned */ static void path_to_uefi(void *uefi, const char *src)
{ u16 *pos = uefi; allow_unaligned(); while (*src) { s32 code = utf8_get(&src); if (code < 0) code = '?'; else if (code == '/') code = '\\'; utf16_put(code, &pos); } *pos = 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set a specified LED in a specified mode. */
void LED_Set(enum LED_id id, enum LED_mode mode)
/* Set a specified LED in a specified mode. */ void LED_Set(enum LED_id id, enum LED_mode mode)
{ if( id == LED_GREEN ) { GreenLED_newmode = mode; } else if( id == LED_RED ) { RedLED_newmode = mode; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* HPF or SLOPE filter selection on wake-up and Activity/Inactivity functions.. */
int32_t lsm6dso_xl_hp_path_internal_set(stmdev_ctx_t *ctx, lsm6dso_slope_fds_t val)
/* HPF or SLOPE filter selection on wake-up and Activity/Inactivity functions.. */ int32_t lsm6dso_xl_hp_path_internal_set(stmdev_ctx_t *ctx, lsm6dso_slope_fds_t val)
{ lsm6dso_tap_cfg0_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_TAP_CFG0, (uint8_t *)&reg, 1); if (ret == 0) { reg.slope_fds = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_TAP_CFG0, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* UART Disable. At the end of the current frame, the UART is disabled to reduce power. */
void uart_disable(uint32_t uart)
/* UART Disable. At the end of the current frame, the UART is disabled to reduce power. */ void uart_disable(uint32_t uart)
{ UART_C2(uart) &= ~(UART_C2_TE | UART_C2_RE); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */
EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */ EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
{ CALL_CRYPTO_SERVICE (TlsSetSessionId, (Tls, SessionId, SessionIdLen), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Converts a text device path node to PCIE root device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPcieRoot(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to PCIE root device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPcieRoot(IN CHAR16 *TextDeviceNode)
{ return ConvertFromTextAcpi (TextDeviceNode, 0x0a08); }
tianocore/edk2
C++
Other
4,240
/* Initialize a Xilinx PS GPIO controller parent device. Initialize a Xilinx PS GPIO controller parent device, whose task it is to handle the IRQ line of each controller instance, while the configuration, status and data acquisition of each MIO / EMIO GPIO pin associated with the parent controller instance is handled via the respective GPIO pin bank's child device. */
static int gpio_xlnx_ps_init(const struct device *dev)
/* Initialize a Xilinx PS GPIO controller parent device. Initialize a Xilinx PS GPIO controller parent device, whose task it is to handle the IRQ line of each controller instance, while the configuration, status and data acquisition of each MIO / EMIO GPIO pin associated with the parent controller instance is handled via the respective GPIO pin bank's child device. */ static int gpio_xlnx_ps_init(const struct device *dev)
{ const struct gpio_xlnx_ps_dev_cfg *dev_conf = dev->config; dev_conf->config_func(dev); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Command response callback function for sd_ble_gatts_hvx BLE command. Callback for decoding the command response return code. */
static uint32_t gatts_hvx_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gatts_hvx BLE command. Callback for decoding the command response return code. */ static uint32_t gatts_hvx_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_gatts_hvx_rsp_dec(p_buffer, length, &result_code, (uint16_t * *)&mp_out_params[0]); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Write a word into Region 0 of the device specified by VirtIo Device protocol. */
EFI_STATUS EFIAPI VirtioPciDeviceWrite(IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINT64 Value)
/* Write a word into Region 0 of the device specified by VirtIo Device protocol. */ EFI_STATUS EFIAPI VirtioPciDeviceWrite(IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINT64 Value)
{ VIRTIO_PCI_DEVICE *Dev; Dev = VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE (This); return VirtioPciIoWrite ( Dev, Dev->DeviceSpecificConfigurationOffset + FieldOffset, FieldSize, Value ); }
tianocore/edk2
C++
Other
4,240
/* registers hash matching methods Note that it is compulsory to call this in ixEthDBInit(), otherwise hashtable searching and removal will not work */
IX_ETH_DB_PUBLIC UINT32 ixEthDBMatchMethodsRegister(MatchFunction *matchFunctions)
/* registers hash matching methods Note that it is compulsory to call this in ixEthDBInit(), otherwise hashtable searching and removal will not work */ IX_ETH_DB_PUBLIC UINT32 ixEthDBMatchMethodsRegister(MatchFunction *matchFunctions)
{ UINT32 i; for ( i = 0 ; i < IX_ETH_DB_MAX_KEY_INDEX + 1 ; i++) { matchFunctions[i] = ixEthDBNullMatch; } matchFunctions[IX_ETH_DB_MAC_KEY] = ixEthDBAddressRecordMatch; matchFunctions[IX_ETH_DB_MAC_PORT_KEY] = ixEthDBPortRecordMatch; matchFunctions[IX_ETH_DB_MAC_VLAN_KEY] = ixEthDBVlanRecordMatch; return 3; }
EmcraftSystems/u-boot
C++
Other
181
/* There is an implicit parport_get_port() done already; to throw away the reference to the port that parport_find_number() gives you, use parport_put_port(). */
struct parport* parport_find_number(int number)
/* There is an implicit parport_get_port() done already; to throw away the reference to the port that parport_find_number() gives you, use parport_put_port(). */ struct parport* parport_find_number(int number)
{ struct parport *port, *result = NULL; if (list_empty(&portlist)) get_lowlevel_driver (); spin_lock (&parportlist_lock); list_for_each_entry(port, &portlist, list) { if (port->number == number) { result = parport_get_port (port); break; } } spin_unlock (&parportlist_lock); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Clears the underflow condition on a sample sequence. */
void ADCSequenceUnderflowClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
/* Clears the underflow condition on a sample sequence. */ void ADCSequenceUnderflowClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
{ ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); ASSERT(ui32SequenceNum < 4); HWREG(ui32Base + ADC_O_USTAT) = 1 << ui32SequenceNum; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* tree_destroy - destroy an RB-tree. @root: the root of the tree to destroy */
static void tree_destroy(struct rb_root *root)
/* tree_destroy - destroy an RB-tree. @root: the root of the tree to destroy */ static void tree_destroy(struct rb_root *root)
{ struct rb_node *rb; struct ubi_wl_entry *e; rb = root->rb_node; while (rb) { if (rb->rb_left) rb = rb->rb_left; else if (rb->rb_right) rb = rb->rb_right; else { e = rb_entry(rb, struct ubi_wl_entry, rb); rb = rb_parent(rb); if (rb) { if (rb->rb_left == &e->rb) rb->rb_left = NULL; else rb->rb_right = NULL; } kmem_cache_free(ubi_wl_entry_slab, e); } } }
EmcraftSystems/u-boot
C++
Other
181
/* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI IoOr8(IN UINTN Port, IN UINT8 OrData)
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ UINT8 EFIAPI IoOr8(IN UINTN Port, IN UINT8 OrData)
{ return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData)); }
tianocore/edk2
C++
Other
4,240
/* set up the iterator to start reading from the cells list and return the first item */
static void * afs_proc_cell_servers_start(struct seq_file *p, loff_t *pos)
/* set up the iterator to start reading from the cells list and return the first item */ static void * afs_proc_cell_servers_start(struct seq_file *p, loff_t *pos)
{ struct afs_cell *cell = m->private; _enter("cell=%p pos=%Ld", cell, *_pos); read_lock(&cell->servers_lock); return seq_list_start_head(&cell->servers, *_pos); }
robutest/uclinux
C++
GPL-2.0
60
/* kill_all_requests - remove all requests from the endpoint's queue @hsotg: The device state. @ep: The endpoint the requests may be on. */
static void kill_all_requests(struct s3c_hsotg *hsotg, struct s3c_hsotg_ep *ep, int result, bool force)
/* kill_all_requests - remove all requests from the endpoint's queue @hsotg: The device state. @ep: The endpoint the requests may be on. */ static void kill_all_requests(struct s3c_hsotg *hsotg, struct s3c_hsotg_ep *ep, int result, bool force)
{ struct s3c_hsotg_req *req, *treq; unsigned long flags; spin_lock_irqsave(&ep->lock, flags); list_for_each_entry_safe(req, treq, &ep->queue, queue) { if (ep->req == req && ep->dir_in && !force) continue; s3c_hsotg_complete_request(hsotg, ep, req, result); } spin_unlock_irqrestore(&ep->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified EXTI line flag is set or not. */
FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
/* Checks whether the specified EXTI line flag is set or not. */ FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
{ FlagStatus bitstatus = RESET; assert_param(IS_GET_EXTI_LINE(EXTI_Line)); if ((EXTI->PR & EXTI_Line) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
ajhc/demo-cortex-m3
C++
null
38
/* This function will detach a static object from object system, and the memory of static object is not freed. */
void rt_object_detach(rt_object_t object)
/* This function will detach a static object from object system, and the memory of static object is not freed. */ void rt_object_detach(rt_object_t object)
{ rt_base_t level; struct rt_object_information *information; RT_ASSERT(object != RT_NULL); RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object)); information = rt_object_get_information((enum rt_object_class_type)object->type); RT_ASSERT(information != RT_NULL); level = rt_spin_lock_irqsave(&(information->spinlock)); rt_list_remove(&(object->list)); rt_spin_unlock_irqrestore(&(information->spinlock), level); object->type = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Append data to tail of a netlink message */
int nlmsg_append(struct nl_msg *n, void *data, size_t len, int pad)
/* Append data to tail of a netlink message */ int nlmsg_append(struct nl_msg *n, void *data, size_t len, int pad)
{ void *tmp; tmp = nlmsg_reserve(n, len, pad); if (tmp == NULL) return -NLE_NOMEM; memcpy(tmp, data, len); NL_DBG(2, "msg %p: Appended %zu bytes with padding %d\n", n, len, pad); return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Free a frame_data_sequence and all the frame_data structures in it. */
void free_frame_data_sequence(frame_data_sequence *fds)
/* Free a frame_data_sequence and all the frame_data structures in it. */ void free_frame_data_sequence(frame_data_sequence *fds)
{ guint32 count = fds->count; guint levels = 0; while (count) { levels++; count >>= LOG2_NODES_PER_LEVEL; } if (levels > 0) { free_frame_data_array(fds->ptree_root, fds->count, levels, TRUE); } g_free(fds); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns pointer to next response iocb entry in the response ring. The caller must hold hbalock to make sure that no other thread consume the next response iocb. SLI-2/SLI-3 provide different sized iocbs. */
static IOCB_t* lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
/* This function returns pointer to next response iocb entry in the response ring. The caller must hold hbalock to make sure that no other thread consume the next response iocb. SLI-2/SLI-3 provide different sized iocbs. */ static IOCB_t* lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{ return (IOCB_t *) (((char *) pring->rspringaddr) + pring->rspidx * phba->iocb_rsp_size); }
robutest/uclinux
C++
GPL-2.0
60
/* Tell controller to flush both TX and RX FIFOs. */
static void mcux_i3c_fifo_flush(I3C_Type *base)
/* Tell controller to flush both TX and RX FIFOs. */ static void mcux_i3c_fifo_flush(I3C_Type *base)
{ base->MDATACTRL = I3C_MDATACTRL_FLUSHFB_MASK | I3C_MDATACTRL_FLUSHTB_MASK; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function solves a real-life problem observed on NOR flashes when an PEB erase operation starts, then the system is rebooted before the erase is finishes, and the boot loader gets confused and dies. So we prefer to finish the ongoing operation before rebooting. */
static int ubi_reboot_notifier(struct notifier_block *n, unsigned long state, void *cmd)
/* This function solves a real-life problem observed on NOR flashes when an PEB erase operation starts, then the system is rebooted before the erase is finishes, and the boot loader gets confused and dies. So we prefer to finish the ongoing operation before rebooting. */ static int ubi_reboot_notifier(struct notifier_block *n, unsigned long state, void *cmd)
{ struct ubi_device *ubi; ubi = container_of(n, struct ubi_device, reboot_notifier); if (ubi->bgt_thread) kthread_stop(ubi->bgt_thread); ubi_sync(ubi->ubi_num); return NOTIFY_DONE; }
robutest/uclinux
C++
GPL-2.0
60
/* loop_switch performs the hard work of switching a backing store. First it needs to flush existing IO, it does this by sending a magic BIO down the pipe. The completion of this BIO does the actual switch. */
static int loop_switch(struct loop_device *lo, struct file *file)
/* loop_switch performs the hard work of switching a backing store. First it needs to flush existing IO, it does this by sending a magic BIO down the pipe. The completion of this BIO does the actual switch. */ static int loop_switch(struct loop_device *lo, struct file *file)
{ struct switch_request w; struct bio *bio = bio_alloc(GFP_KERNEL, 0); if (!bio) return -ENOMEM; init_completion(&w.wait); w.file = file; bio->bi_private = &w; bio->bi_bdev = NULL; loop_make_request(lo->lo_queue, bio); wait_for_completion(&w.wait); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Copy data from sbuf to a normal, straight buffer Don't update the sbuf rptr, this will be done in sbdrop when the data is acked */
void sbcopy(struct sbuf *sb, int off, int len, char *to)
/* Copy data from sbuf to a normal, straight buffer Don't update the sbuf rptr, this will be done in sbdrop when the data is acked */ void sbcopy(struct sbuf *sb, int off, int len, char *to)
{ char *from; from = sb->sb_rptr + off; if (from >= sb->sb_data + sb->sb_datalen) from -= sb->sb_datalen; if (from < sb->sb_wptr) { if (len > sb->sb_cc) len = sb->sb_cc; memcpy(to,from,len); } else { off = (sb->sb_data + sb->sb_datalen) - from; if (off > len) off = len; memcpy(to,from,off); len -= off; if (len) memcpy(to+off,sb->sb_data,len); } }
ve3wwg/teensy3_qemu
C++
Other
15
/* Dump information about all ports, in response to GETLINK */
static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
/* Dump information about all ports, in response to GETLINK */ static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
{ struct net *net = sock_net(skb->sk); struct net_device *dev; int idx; idx = 0; for_each_netdev(net, dev) { if (dev->br_port == NULL || idx < cb->args[0]) goto skip; if (br_fill_ifinfo(skb, dev->br_port, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI) < 0) break; skip: ++idx; } cb->args[0] = idx; return skb->len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{ __HAL_RCC_RTC_ENABLE(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeEPI(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeEPI(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Calls the @use_plugin function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself. */
void g_type_plugin_use(GTypePlugin *plugin)
/* Calls the @use_plugin function from the #GTypePluginClass of @plugin. There should be no need to use this function outside of the GObject type system itself. */ void g_type_plugin_use(GTypePlugin *plugin)
{ GTypePluginClass *iface; g_return_if_fail (G_IS_TYPE_PLUGIN (plugin)); iface = G_TYPE_PLUGIN_GET_CLASS (plugin); iface->use_plugin (plugin); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enable or disable port output TMR4 counter direction signal. */
void TMR4_PortOutputCmd(CM_TMR4_TypeDef *TMR4x, en_functional_state_t enNewState)
/* Enable or disable port output TMR4 counter direction signal. */ void TMR4_PortOutputCmd(CM_TMR4_TypeDef *TMR4x, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_TMR4_UNIT(TMR4x)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); if (ENABLE == enNewState) { SET_REG16_BIT(TMR4x->SCER, TMR4_SCER_PCTS); } else { CLR_REG16_BIT(TMR4x->SCER, TMR4_SCER_PCTS); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @new_blocks: on return it will store the new block numbers for the indirect blocks(if needed) and the first direct block, @blks: on return it will store the total number of allocated direct blocks */
static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, ext3_fsblk_t goal, int indirect_blks, int blks, ext3_fsblk_t new_blocks[4], int *err)
/* @new_blocks: on return it will store the new block numbers for the indirect blocks(if needed) and the first direct block, @blks: on return it will store the total number of allocated direct blocks */ static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, ext3_fsblk_t goal, int indirect_blks, int blks, ext3_fsblk_t new_blocks[4], int *err)
{ int target, i; unsigned long count = 0; int index = 0; ext3_fsblk_t current_block = 0; int ret = 0; target = blks + indirect_blks; while (1) { count = target; current_block = ext3_new_blocks(handle,inode,goal,&count,err); if (*err) goto failed_out; target -= count; while (index < indirect_blks && count) { new_blocks[index++] = current_block++; count--; } if (count > 0) break; } new_blocks[index] = current_block; ret = count; *err = 0; return ret; failed_out: for (i = 0; i <index; i++) ext3_free_blocks(handle, inode, new_blocks[i], 1); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* unregister_dock_notifier - remove yourself from the dock notifier list @nb: the callers notifier block */
void unregister_dock_notifier(struct notifier_block *nb)
/* unregister_dock_notifier - remove yourself from the dock notifier list @nb: the callers notifier block */ void unregister_dock_notifier(struct notifier_block *nb)
{ if (!dock_station_count) return; atomic_notifier_chain_unregister(&dock_notifier_list, nb); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int mock_write_std_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_std_module_init(int res)
{ harness_mock_write("std_module_init()", NULL, 0); harness_mock_write("std_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Check if the received data are ready. Check if Data have been received and loaded into USART_RHR. */
uint32_t usart_is_rx_ready(Usart *p_usart)
/* Check if the received data are ready. Check if Data have been received and loaded into USART_RHR. */ uint32_t usart_is_rx_ready(Usart *p_usart)
{ return (p_usart->US_CSR & US_CSR_RXRDY) > 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function is used by qsort to sort a T2P_PAGE* array of page structures by page number. If the page numbers are the same, we fall back to comparing directory numbers to preserve the order of the input file. */
int t2p_cmp_t2p_page(const void *, const void *)
/* This function is used by qsort to sort a T2P_PAGE* array of page structures by page number. If the page numbers are the same, we fall back to comparing directory numbers to preserve the order of the input file. */ int t2p_cmp_t2p_page(const void *, const void *)
{ d = (int32)(((T2P_PAGE*)e1)->page_directory) - (int32)(((T2P_PAGE*)e2)->page_directory); } return d; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function will unregister a range of @count device numbers, starting with @from. The caller should normally be the one who allocated those numbers in the first place... */
void unregister_chrdev_region(dev_t from, unsigned count)
/* This function will unregister a range of @count device numbers, starting with @from. The caller should normally be the one who allocated those numbers in the first place... */ void unregister_chrdev_region(dev_t from, unsigned count)
{ dev_t to = from + count; dev_t n, next; for (n = from; n < to; n = next) { next = MKDEV(MAJOR(n)+1, 0); if (next > to) next = to; kfree(__unregister_chrdev_region(MAJOR(n), MINOR(n), next - n)); } }
robutest/uclinux
C++
GPL-2.0
60
/* Write the seed value for CRC operations in the EC module. */
void CRCSeedSet(uint32_t ui32Base, uint32_t ui32Seed)
/* Write the seed value for CRC operations in the EC module. */ void CRCSeedSet(uint32_t ui32Base, uint32_t ui32Seed)
{ ASSERT(ui32Base == DTHE_BASE); HWREG(ui32Base + DTHE_O_CRC_SEED) = ui32Seed; }
micropython/micropython
C++
Other
18,334
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */
void Reset_Handler(void)
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */ void Reset_Handler(void)
{ uint32_t *init_values_ptr = &_etext; uint32_t *data_ptr = &_sdata; if (init_values_ptr != data_ptr) { for (; data_ptr < &_edata;) { *data_ptr++ = *init_values_ptr++; } } for (uint32_t *bss_ptr = &_sbss; bss_ptr < &_ebss;) { *bss_ptr++ = 0; } NVMCTRL->CTRLB.bit.MANW = 1; main(); while (1); }
memfault/zero-to-main
C++
null
200
/* This function waits until all asynchronous function calls prior to @cookie have been done. */
void async_synchronize_cookie(async_cookie_t cookie)
/* This function waits until all asynchronous function calls prior to @cookie have been done. */ void async_synchronize_cookie(async_cookie_t cookie)
{ async_synchronize_cookie_domain(cookie, &async_running); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will read the eeprom data as host-endian word into the given data pointer. */
void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word, u16 *data)
/* This function will read the eeprom data as host-endian word into the given data pointer. */ void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word, u16 *data)
{ u16 command; eeprom_93cx6_startup(eeprom); command = (PCI_EEPROM_READ_OPCODE << eeprom->width) | word; eeprom_93cx6_write_bits(eeprom, command, PCI_EEPROM_WIDTH_OPCODE + eeprom->width); eeprom_93cx6_read_bits(eeprom, data, 16); eeprom_93cx6_cleanup(eeprom); }
robutest/uclinux
C++
GPL-2.0
60
/* Set Address USB Device Request Parameters: None Return Value: TRUE - Success, FALSE - Error */
static BOOL USBD_ReqSetAddress(void)
/* Set Address USB Device Request Parameters: None Return Value: TRUE - Success, FALSE - Error */ static BOOL USBD_ReqSetAddress(void)
{ switch (USBD_SetupPacket.bmRequestType.Recipient) { case REQUEST_TO_DEVICE: USBD_DeviceAddress = 0x80 | USBD_SetupPacket.wValueL; break; default: return (__FALSE); } return (__TRUE); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
EFI_STATUS SdCardReset(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot)
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */ EFI_STATUS SdCardReset(IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot)
{ EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk; EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk; EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet; EFI_STATUS Status; ZeroMem (&SdMmcCmdBlk, sizeof (SdMmcCmdBlk)); ZeroMem (&SdMmcStatusBlk, sizeof (SdMmcStatusBlk)); ZeroMem (&Packet, sizeof (Packet)); Packet.SdMmcCmdBlk = &SdMmcCmdBlk; Packet.SdMmcStatusBlk = &SdMmcStatusBlk; Packet.Timeout = SD_MMC_HC_GENERIC_TIMEOUT; SdMmcCmdBlk.CommandIndex = SD_GO_IDLE_STATE; SdMmcCmdBlk.CommandType = SdMmcCommandTypeBc; Status = SdMmcPassThruPassThru (PassThru, Slot, &Packet, NULL); return Status; }
tianocore/edk2
C++
Other
4,240
/* This function disables the floating-point unit, preventing floating-point instructions from executing (generating a NOCP usage fault instead). */
void FPUDisable(void)
/* This function disables the floating-point unit, preventing floating-point instructions from executing (generating a NOCP usage fault instead). */ void FPUDisable(void)
{ HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | NVIC_CPAC_CP10_DIS | NVIC_CPAC_CP11_DIS); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Initialize all ISS Ethernet devices previously registered in iss_net_setup. */
static int iss_net_init(void)
/* Initialize all ISS Ethernet devices previously registered in iss_net_setup. */ static int iss_net_init(void)
{ struct list_head *ele, *next; list_for_each_safe(ele, next, &eth_cmd_line) { struct iss_net_init *eth; eth = list_entry(ele, struct iss_net_init, list); iss_net_configure(eth->index, eth->init); } return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Restart the card from scratch, as if from a cold-boot. Implementation resembles the first-half of the e1000_resume routine. */
static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
/* Restart the card from scratch, as if from a cold-boot. Implementation resembles the first-half of the e1000_resume routine. */ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
{ struct net_device *netdev = pci_get_drvdata(pdev); struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; int err; if (adapter->need_ioport) err = pci_enable_device(pdev); else err = pci_enable_device_mem(pdev); if (err) { printk(KERN_ERR "e1000: Cannot re-enable PCI device after reset.\n"); return PCI_ERS_RESULT_DISCONNECT; } pci_set_master(pdev); pci_enable_wake(pdev, PCI_D3hot, 0); pci_enable_wake(pdev, PCI_D3cold, 0); e1000_reset(adapter); ew32(WUS, ~0); return PCI_ERS_RESULT_RECOVERED; }
robutest/uclinux
C++
GPL-2.0
60
/* Callback for the subscription to the ble logger notification characteristic. This callback enables/disables automatically the logger when the notification is subscribed. */
void log_notify_changed(const struct bt_gatt_attr *attr, uint16_t value)
/* Callback for the subscription to the ble logger notification characteristic. This callback enables/disables automatically the logger when the notification is subscribed. */ void log_notify_changed(const struct bt_gatt_attr *attr, uint16_t value)
{ ARG_UNUSED(attr); const bool notify_enabled = value == BT_GATT_CCC_NOTIFY; if (notify_enabled) { if (first_enable == false) { first_enable = true; log_backend_enable(log_backend_ble_get(), NULL, CONFIG_LOG_MAX_LEVEL); } else { log_backend_activate(log_backend_ble_get(), NULL); } } else { log_backend_deactivate(log_backend_ble_get()); } if (user_hook != NULL) { user_hook(notify_enabled, user_ctx); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The Timer 3 default IRQ, declared in start up code. */
void TIMER3IntHandler(void)
/* The Timer 3 default IRQ, declared in start up code. */ void TIMER3IntHandler(void)
{ unsigned long ulBase = TIMER3_BASE; unsigned long ulTemp0; ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF); xHWREG(ulBase + TIMER_O_TISR) = ulTemp0; if (g_pfnTimerHandlerCallbacks[3] != 0) { g_pfnTimerHandlerCallbacks[3](0, 0, ulTemp0, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Clears or safeguards the OCREF4 signal on an external event. */
void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF4 signal on an external event. */ void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC4CE; tmpccmr2 |= (uint16_t)(TIM_OCClear << 8); TIMx->CCMR2 = tmpccmr2; }
MaJerle/stm32f429
C++
null
2,036
/* This routine is called to check if CapsuleOnDisk flag in OsIndications Variable is enabled. */
BOOLEAN EFIAPI CoDCheckCapsuleOnDiskFlag(VOID)
/* This routine is called to check if CapsuleOnDisk flag in OsIndications Variable is enabled. */ BOOLEAN EFIAPI CoDCheckCapsuleOnDiskFlag(VOID)
{ EFI_STATUS Status; UINT64 OsIndication; UINTN DataSize; OsIndication = 0; DataSize = sizeof (UINT64); Status = gRT->GetVariable ( EFI_OS_INDICATIONS_VARIABLE_NAME, &gEfiGlobalVariableGuid, NULL, &DataSize, &OsIndication ); if (!EFI_ERROR (Status) && ((OsIndication & EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED) != 0)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240