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
/* Get the name of cipher at priority level passed in. */
char* wolfSSL_get_cipher_list(int priority)
/* Get the name of cipher at priority level passed in. */ char* wolfSSL_get_cipher_list(int priority)
{ const char* const* ciphers = GetCipherNames(); if (priority >= GetCipherNamesSize() || priority < 0) { return 0; } return (char*)ciphers[priority]; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* The tasks as described in the comments at the top of this file. */
static void prvQueueReceiveTask(void *pvParameters)
/* The tasks as described in the comments at the top of this file. */ static void prvQueueReceiveTask(void *pvParameters)
{ unsigned long ulReceivedValue; for( ;; ) { xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); if( ulReceivedValue == 100UL ) { if( ( ulGPIOState & mainTASK_CONTROLLED_LED ) != 0 ) { ulGPIOState &= ~mainTASK_CONTROLLED_LED; } else { ulGPIOState |= mainTASK_CONTROLLED_LED; } MSS_GPIO_set_outputs( ulGPIOState ); } } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Allocate and initialize an IP4 route cache entry. */
IP4_ROUTE_CACHE_ENTRY* Ip4CreateRouteCacheEntry(IN IP4_ADDR Dst, IN IP4_ADDR Src, IN IP4_ADDR GateWay, IN UINTN Tag)
/* Allocate and initialize an IP4 route cache entry. */ IP4_ROUTE_CACHE_ENTRY* Ip4CreateRouteCacheEntry(IN IP4_ADDR Dst, IN IP4_ADDR Src, IN IP4_ADDR GateWay, IN UINTN Tag)
{ IP4_ROUTE_CACHE_ENTRY *RtCacheEntry; RtCacheEntry = AllocatePool (sizeof (IP4_ROUTE_CACHE_ENTRY)); if (RtCacheEntry == NULL) { return NULL; } InitializeListHead (&RtCacheEntry->Link); RtCacheEntry->RefCnt = 1; RtCacheEntry->Dest = Dst; RtCacheEntry->Src = Src; RtCacheEntry->NextHop = GateWay; RtCacheEntry->Tag = Tag; return RtCacheEntry; }
tianocore/edk2
C++
Other
4,240
/* This function provides accurate delay (in milliseconds) based on SysTick counter flag. */
void LL_mDelay(uint32_t Delay)
/* This function provides accurate delay (in milliseconds) based on SysTick counter flag. */ void LL_mDelay(uint32_t Delay)
{ uint32_t count = Delay; __IO uint32_t tmp = SysTick->CTRL; ((void)tmp); if(count < LL_MAX_DELAY) { count++; } while (count != 0U) { if((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U) { count--; } } }
ua1arn/hftrx
C++
null
69
/* Internal function to read the initial timer count of local APIC. */
UINT32 InternalX86GetInitTimerCount(IN UINTN ApicBase)
/* Internal function to read the initial timer count of local APIC. */ UINT32 InternalX86GetInitTimerCount(IN UINTN ApicBase)
{ return MmioRead32 (ApicBase + APIC_TMICT); }
tianocore/edk2
C++
Other
4,240
/* Deselect given device on the SPI bus. Calls board chip deselect. */
void spi_deselect_device(volatile void *spi, struct spi_device *device)
/* Deselect given device on the SPI bus. Calls board chip deselect. */ void spi_deselect_device(volatile void *spi, struct spi_device *device)
{ ioport_set_pin_high(device->id); }
memfault/zero-to-main
C++
null
200
/* port_mmio - Get the MMIO address of PDC2027x extended registers @ap: Port @offset: offset from mmio base */
static void __iomem* port_mmio(struct ata_port *ap, unsigned int offset)
/* port_mmio - Get the MMIO address of PDC2027x extended registers @ap: Port @offset: offset from mmio base */ static void __iomem* port_mmio(struct ata_port *ap, unsigned int offset)
{ return ap->host->iomap[PDC_MMIO_BAR] + ap->port_no * 0x100 + offset; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @key_state: receives the state of the shift, alt, control, and logo keys */
static int analyze_modifiers(struct efi_key_state *key_state)
/* @key_state: receives the state of the shift, alt, control, and logo keys */ static int analyze_modifiers(struct efi_key_state *key_state)
{ int c, mod = 0, ret = 0; c = getc(); if (c != ';') { ret = c; if (c == '~') goto out; c = getc(); } for (;;) { switch (c) { case '0'...'9': mod *= 10; mod += c - '0'; case ';': c = getc(); break; default: goto out; } } out: set_shift_mask(mod, key_state); if (!ret) ret = c; return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* get_ioc3_port - given a uart port, return the control structure @the_port: uart port to find */
static struct ioc3_port* get_ioc3_port(struct uart_port *the_port)
/* get_ioc3_port - given a uart port, return the control structure @the_port: uart port to find */ static struct ioc3_port* get_ioc3_port(struct uart_port *the_port)
{ struct ioc3_driver_data *idd = dev_get_drvdata(the_port->dev); struct ioc3_card *card_ptr = idd->data[Submodule_slot]; int ii, jj; if (!card_ptr) { NOT_PROGRESS(); return NULL; } for (ii = 0; ii < PORTS_PER_CARD; ii++) { for (jj = 0; jj < LOGICAL_PORTS; jj++) { if (the_port == &card_ptr->ic_port[ii].icp_uart_port[jj]) return card_ptr->ic_port[ii].icp_port; } } NOT_PROGRESS(); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the PWM interrupt flag of the PWM module. The */
xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Get the PWM interrupt flag of the PWM module. The */ xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulIntStatus; xASSERT(PWMBaseValid(ulBase)); xASSERT(((ulChannel >= 0) || (ulChannel <= 3))); xASSERT((ulIntType == PWM_INT_CHXCC) || (ulIntType == PWM_INT_UEV1)); if (ulIntType == PWM_INT_UEV1) { ulIntStatus = xHWREG(ulBase + TIMER_SR) & ulIntType; if(ulIntStatus != 0) { return xtrue; } } else { ulIntStatus = xHWREG(ulBase + TIMER_SR) & (PWM_INT_CHXCC << ulChannel); if(ulIntStatus != 0) { return xtrue; } } return xfalse; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reads timer registers in posted and non-posted mode. The posted mode bit is encoded in reg. Note that in posted mode write pending bit must be checked. Otherwise a read of a non completed write will produce an error. */
static u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
/* Reads timer registers in posted and non-posted mode. The posted mode bit is encoded in reg. Note that in posted mode write pending bit must be checked. Otherwise a read of a non completed write will produce an error. */ static u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
{ if (timer->posted) while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)) & (reg >> WPSHIFT)) cpu_relax(); return readl(timer->io_base + (reg & 0xff)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: 0 in case of success, a negative error code otherwise. */
int nanddev_markbad(struct nand_device *nand, const struct nand_pos *pos)
/* Return: 0 in case of success, a negative error code otherwise. */ int nanddev_markbad(struct nand_device *nand, const struct nand_pos *pos)
{ struct mtd_info *mtd = nanddev_to_mtd(nand); unsigned int entry; int ret = 0; if (nanddev_isbad(nand, pos)) return 0; ret = nand->ops->markbad(nand, pos); if (ret) pr_warn("failed to write BBM to block @%llx (err = %d)\n", nanddev_pos_to_offs(nand, pos), ret); if (!nanddev_bbt_is_initialized(nand)) goto out; entry = nanddev_bbt_pos_to_entry(nand, pos); ret = nanddev_bbt_set_block_status(nand, entry, NAND_BBT_BLOCK_WORN); if (ret) goto out; ret = nanddev_bbt_update(nand); out: if (!ret) mtd->ecc_stats.badblocks++; return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* NOTE: it's important to be fast here because this operation will add to the overall exit latency. */
static void menu_reflect(struct cpuidle_device *dev)
/* NOTE: it's important to be fast here because this operation will add to the overall exit latency. */ static void menu_reflect(struct cpuidle_device *dev)
{ struct menu_device *data = &__get_cpu_var(menu_devices); data->needs_update = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is invoked to unset the HBA device initialization steps to a device with SLI-3 interface spec. */
static void lpfc_unset_hba(struct lpfc_hba *phba)
/* This routine is invoked to unset the HBA device initialization steps to a device with SLI-3 interface spec. */ static void lpfc_unset_hba(struct lpfc_hba *phba)
{ struct lpfc_vport *vport = phba->pport; struct Scsi_Host *shost = lpfc_shost_from_vport(vport); spin_lock_irq(shost->host_lock); vport->load_flag |= FC_UNLOADING; spin_unlock_irq(shost->host_lock); lpfc_stop_hba_timers(phba); phba->pport->work_port_events = 0; lpfc_sli_hba_down(phba); lpfc_sli_brdrestart(phba); lpfc_sli_disable_intr(phba); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the new list of CRAdditionalSel or NULL if an error arises. */
CRAdditionalSel* cr_additional_sel_append(CRAdditionalSel *a_this, CRAdditionalSel *a_sel)
/* Returns the new list of CRAdditionalSel or NULL if an error arises. */ CRAdditionalSel* cr_additional_sel_append(CRAdditionalSel *a_this, CRAdditionalSel *a_sel)
{ CRAdditionalSel *cur_sel = NULL; g_return_val_if_fail (a_sel, NULL); if (a_this == NULL) { return a_sel; } if (a_sel == NULL) return NULL; for (cur_sel = a_this; cur_sel && cur_sel->next; cur_sel = cur_sel->next) ; g_return_val_if_fail (cur_sel != NULL, NULL); cur_sel->next = a_sel; a_sel->prev = cur_sel; return a_this; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* i2400m_tx_release - Tear down the TX queue and infrastructure */
void i2400m_tx_release(struct i2400m *i2400m)
/* i2400m_tx_release - Tear down the TX queue and infrastructure */ void i2400m_tx_release(struct i2400m *i2400m)
{ unsigned long flags; spin_lock_irqsave(&i2400m->tx_lock, flags); kfree(i2400m->tx_buf); i2400m->tx_buf = NULL; spin_unlock_irqrestore(&i2400m->tx_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* iopgtable_lookup_entry - Lookup an iommu pte entry @obj: target iommu @da: iommu device virtual address @ppgd: iommu pgd entry pointer to be returned @ppte: iommu pte entry pointer to be returned */
void iopgtable_lookup_entry(struct iommu *obj, u32 da, u32 **ppgd, u32 **ppte)
/* iopgtable_lookup_entry - Lookup an iommu pte entry @obj: target iommu @da: iommu device virtual address @ppgd: iommu pgd entry pointer to be returned @ppte: iommu pte entry pointer to be returned */ void iopgtable_lookup_entry(struct iommu *obj, u32 da, u32 **ppgd, u32 **ppte)
{ u32 *iopgd, *iopte = NULL; iopgd = iopgd_offset(obj, da); if (!*iopgd) goto out; if (*iopgd & IOPGD_TABLE) iopte = iopte_offset(iopgd, da); out: *ppgd = iopgd; *ppte = iopte; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Registers an interrupt handler for an ADC interrupt. */
void ADCIntRegister(uint32_t ui32Base, uint32_t ui32SequenceNum, void(*pfnHandler)(void))
/* Registers an interrupt handler for an ADC interrupt. */ void ADCIntRegister(uint32_t ui32Base, uint32_t ui32SequenceNum, void(*pfnHandler)(void))
{ uint_fast8_t ui8Int; ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); ASSERT(ui32SequenceNum < 4); ui8Int = _ADCIntNumberGet(ui32Base, ui32SequenceNum); ASSERT(ui8Int != 0); IntRegister(ui8Int, pfnHandler); IntEnable(ui8Int); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field. */
s32 igb_get_cable_length_82580(struct e1000_hw *hw)
/* Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field. */ s32 igb_get_cable_length_82580(struct e1000_hw *hw)
{ struct e1000_phy_info *phy = &hw->phy; s32 ret_val; u16 phy_data, length; ret_val = phy->ops.read_reg(hw, I82580_PHY_DIAG_STATUS, &phy_data); if (ret_val) goto out; length = (phy_data & I82580_DSTATUS_CABLE_LENGTH) >> I82580_DSTATUS_CABLE_LENGTH_SHIFT; if (length == E1000_CABLE_LENGTH_UNDEFINED) ret_val = -E1000_ERR_PHY; phy->cable_length = length; out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek optimisation) right after the fstat() that finds the buffer size. */
void __smakebuf(FILE *fp)
/* As a side effect, we set __SOPT or __SNPT (en/dis-able fseek optimisation) right after the fstat() that finds the buffer size. */ void __smakebuf(FILE *fp)
{ register void *p; register int flags; size_t size; int couldbetty; if (fp->_flags & __SNBF) { fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; return; } flags = __swhatbuf(fp, &size, &couldbetty); if ((p = malloc(size)) == NULL) { fp->_flags |= __SNBF; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; return; } __cleanup = _cleanup; flags |= __SMBF; fp->_bf._base = fp->_p = p; fp->_bf._size = size; if (couldbetty && isatty(fp->_file)) flags |= __SLBF; fp->_flags |= flags; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If HmacMdContext is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. */
STATIC BOOLEAN HmacMdFinal(IN OUT VOID *HmacMdContext, OUT UINT8 *HmacValue)
/* If HmacMdContext is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. */ STATIC BOOLEAN HmacMdFinal(IN OUT VOID *HmacMdContext, OUT UINT8 *HmacValue)
{ UINT32 Length; if ((HmacMdContext == NULL) || (HmacValue == NULL)) { return FALSE; } if (HMAC_Final ((HMAC_CTX *)HmacMdContext, HmacValue, &Length) != 1) { return FALSE; } if (HMAC_CTX_reset ((HMAC_CTX *)HmacMdContext) != 1) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Enable an individual interrupt (IRQ) The irq_enable() routine is provided by the interrupt controller driver due to the IRQ virtualization that is performed by this platform. See the comments in _interrupt_vector_allocate() for more information regarding IRQ virtualization. */
__pinned_func void arch_irq_enable(unsigned int irq)
/* Enable an individual interrupt (IRQ) The irq_enable() routine is provided by the interrupt controller driver due to the IRQ virtualization that is performed by this platform. See the comments in _interrupt_vector_allocate() for more information regarding IRQ virtualization. */ __pinned_func void arch_irq_enable(unsigned int irq)
{ if (IS_IOAPIC_IRQ(irq)) { z_ioapic_irq_enable(irq); } else { z_loapic_irq_enable(irq - z_loapic_irq_base()); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Enables the wake-on-LAN feature of the MAC controller. */
void EMACWoLEnter(uint32_t ui32Base)
/* Enables the wake-on-LAN feature of the MAC controller. */ void EMACWoLEnter(uint32_t ui32Base)
{ ASSERT(ui32Base == EMAC0_BASE); while (HWREG(ui32Base + EMAC_O_DMARIS) == EMAC_DMARIS_TI) { } HWREG(ui32Base + EMAC_O_CFG) &= ~EMAC_CFG_TE; HWREG(ui32Base + EMAC_O_DMAOPMODE) &= ~EMAC_DMAOPMODE_ST; while ((HWREG(ui32Base + EMAC_O_STATUS) & EMAC_STATUS_RX_FIFO_LEVEL_MASK) == EMAC_STATUS_RX_FIFO_EMPTY) { } HWREG(ui32Base + EMAC_O_DMAOPMODE) &= ~EMAC_DMAOPMODE_SR; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* These two objects don't have a data node holding a value. This require special handling. */
BOOLEAN EFIAPI IsSpecialIntegerNode(IN AML_OBJECT_NODE *Node)
/* These two objects don't have a data node holding a value. This require special handling. */ BOOLEAN EFIAPI IsSpecialIntegerNode(IN AML_OBJECT_NODE *Node)
{ UINT8 OpCode; if (!IS_AML_OBJECT_NODE (Node) || (Node->AmlByteEncoding == NULL)) { return FALSE; } OpCode = Node->AmlByteEncoding->OpCode; if ((OpCode != AML_ZERO_OP) && (OpCode != AML_ONE_OP) && (OpCode != AML_ONES_OP)) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Adapted from arch/i386/kernel/ldt.c read_ldt() is not really atomic - this is not a problem since synchronization of reads and writes done to the LDT has to be assured by user-space anyway. Writes are atomic, to protect the security checks done on new descriptors. */
static int read_ldt(void __user *ptr, unsigned long bytecount)
/* Adapted from arch/i386/kernel/ldt.c read_ldt() is not really atomic - this is not a problem since synchronization of reads and writes done to the LDT has to be assured by user-space anyway. Writes are atomic, to protect the security checks done on new descriptors. */ static int read_ldt(void __user *ptr, unsigned long bytecount)
{ unsigned long bytes_left, n; char __user *src, *dst; char buf[256]; if (bytecount > IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE) bytecount = IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE; bytes_left = bytecount; src = (void __user *) IA32_LDT_OFFSET; dst = ptr; while (bytes_left) { n = sizeof(buf); if (n > bytes_left) n = bytes_left; if (__copy_from_user(buf, src, n)) return -EFAULT; if (copy_to_user(dst, buf, n)) return -EFAULT; src += n; dst += n; bytes_left -= n; } return bytecount; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets processor information on the requested processor at the instant this call is made. */
EFI_STATUS EFIAPI SmmGetProcessorInfo(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
/* Gets processor information on the requested processor at the instant this call is made. */ EFI_STATUS EFIAPI SmmGetProcessorInfo(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
{ if ((ProcessorNumber >= mMaxNumberOfCpus) || (ProcessorInfoBuffer == NULL)) { return EFI_INVALID_PARAMETER; } if (gSmmCpuPrivate->ProcessorInfo[ProcessorNumber].ProcessorId == INVALID_APIC_ID) { return EFI_NOT_FOUND; } CopyMem (ProcessorInfoBuffer, &gSmmCpuPrivate->ProcessorInfo[ProcessorNumber], sizeof (EFI_PROCESSOR_INFORMATION)); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns: 1 if work to do / 0 if not */
static int ibmvfc_dev_init_to_do(struct ibmvfc_host *vhost)
/* Returns: 1 if work to do / 0 if not */ static int ibmvfc_dev_init_to_do(struct ibmvfc_host *vhost)
{ struct ibmvfc_target *tgt; list_for_each_entry(tgt, &vhost->targets, queue) { if (tgt->action == IBMVFC_TGT_ACTION_INIT || tgt->action == IBMVFC_TGT_ACTION_INIT_WAIT) return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Absolute Wrist Tilt latency register (r/w). Absolute wrist tilt latency parameters. 1 LSB = 40 ms. Default value: 0Fh (600 ms).. */
int32_t lsm6dsl_tilt_latency_get(stmdev_ctx_t *ctx, uint8_t *buff)
/* Absolute Wrist Tilt latency register (r/w). Absolute wrist tilt latency parameters. 1 LSB = 40 ms. Default value: 0Fh (600 ms).. */ int32_t lsm6dsl_tilt_latency_get(stmdev_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_B); if(ret == 0){ ret = lsm6dsl_read_reg(ctx, LSM6DSL_A_WRIST_TILT_LAT, buff, 1); if(ret == 0){ ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK); } } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Starts a new thread with priority "prio" that will begin its execution in the function "thread()". The "arg" argument will be passed as an argument to the thread() function. The id of the new thread is returned. Both the id and the priority are system dependent. */
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
/* Starts a new thread with priority "prio" that will begin its execution in the function "thread()". The "arg" argument will be passed as an argument to the thread() function. The id of the new thread is returned. Both the id and the priority are system dependent. */ sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
{ xTaskHandle created_task; portBASE_TYPE result; result = xTaskCreatePinnedToCore(thread, name, stacksize, arg, prio, &created_task, CONFIG_TCPIP_TASK_AFFINITY); if (result != pdPASS) { return NULL; } return created_task; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Command response callback function for sd_ble_gap_tx_power_set BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_tx_power_set_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_tx_power_set BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_tx_power_set_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_tx_power_set_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Configures the main PLL clock source, multiplication and division factors. */
void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP, uint32_t PLLQ)
/* Configures the main PLL clock source, multiplication and division factors. */ void RCC_PLLConfig(uint32_t RCC_PLLSource, uint32_t PLLM, uint32_t PLLN, uint32_t PLLP, uint32_t PLLQ)
{ assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource)); assert_param(IS_RCC_PLLM_VALUE(PLLM)); assert_param(IS_RCC_PLLN_VALUE(PLLN)); assert_param(IS_RCC_PLLP_VALUE(PLLP)); assert_param(IS_RCC_PLLQ_VALUE(PLLQ)); RCC->PLLCFGR = PLLM | (PLLN << 6) | (((PLLP >> 1) -1) << 16) | (RCC_PLLSource) | (PLLQ << 24); }
MaJerle/stm32f429
C++
null
2,036
/* Close a TCP socket from the lwip thread. */
static void tcp_close_cb(void *ctx_p)
/* Close a TCP socket from the lwip thread. */ static void tcp_close_cb(void *ctx_p)
{ struct socket_t *socket_p = ctx_p; if (socket_p->pcb_p != NULL) { tcp_arg(socket_p->pcb_p, NULL); tcp_recv(socket_p->pcb_p, NULL); tcp_sent(socket_p->pcb_p, NULL); tcp_err(socket_p->pcb_p, NULL); tcp_close(socket_p->pcb_p); } resume_thrd(socket_p->input.cb.thrd_p, 0); }
eerimoq/simba
C++
Other
337
/* All locking is handled for the caller. On return data may still be present if it arrived during the flush. */
static void z8530_flush_fifo(struct z8530_channel *c)
/* All locking is handled for the caller. On return data may still be present if it arrived during the flush. */ static void z8530_flush_fifo(struct z8530_channel *c)
{ read_zsreg(c, R1); read_zsreg(c, R1); read_zsreg(c, R1); read_zsreg(c, R1); if(c->dev->type==Z85230) { read_zsreg(c, R1); read_zsreg(c, R1); read_zsreg(c, R1); read_zsreg(c, R1); } }
robutest/uclinux
C++
GPL-2.0
60
/* Each buffer in the virtqueues is actually a chain of descriptors. This function returns the next descriptor in the chain, or vq->vring.num if we're at the end. */
static unsigned next_desc(struct vring_desc *desc, unsigned int i, unsigned int max)
/* Each buffer in the virtqueues is actually a chain of descriptors. This function returns the next descriptor in the chain, or vq->vring.num if we're at the end. */ static unsigned next_desc(struct vring_desc *desc, unsigned int i, unsigned int max)
{ unsigned int next; if (!(desc[i].flags & VRING_DESC_F_NEXT)) return max; next = desc[i].next; wmb(); if (next >= max) errx(1, "Desc next is %u", next); return next; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns true if the TX fifo is ready for transmission. */
static int ug_is_txfifo_ready(void)
/* Returns true if the TX fifo is ready for transmission. */ static int ug_is_txfifo_ready(void)
{ return ug_io_transaction(0xc0000000) & 0x04000000; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get EC group order. This function will set the provided Big Number object to the corresponding value. The caller needs to make sure that the "out" BigNumber parameter is properly initialized. */
BOOLEAN EFIAPI EcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder)
/* Get EC group order. This function will set the provided Big Number object to the corresponding value. The caller needs to make sure that the "out" BigNumber parameter is properly initialized. */ BOOLEAN EFIAPI EcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder)
{ return (BOOLEAN)EC_GROUP_get_order (EcGroup, BnOrder, NULL); }
tianocore/edk2
C++
Other
4,240
/* Returns a reference to the object named by the handle. */
struct drm_gem_object* drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, u32 handle)
/* Returns a reference to the object named by the handle. */ struct drm_gem_object* drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, u32 handle)
{ struct drm_gem_object *obj; spin_lock(&filp->table_lock); obj = idr_find(&filp->object_idr, handle); if (obj == NULL) { spin_unlock(&filp->table_lock); return NULL; } drm_gem_object_reference(obj); spin_unlock(&filp->table_lock); return obj; }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int main()
/* This file is part of the Simba project. */ int main()
{ sys_start(); esp_wifi_set_op_mode(esp_wifi_op_mode_station_softap_t); if (esp_wifi_softap_init("Simba", NULL) != 0) { std_printf(FSTR("Failed to configure the Soft AP.\r\n")); } if (esp_wifi_station_init("Qvist2", "maxierik", NULL, NULL) != 0) { std_printf(FSTR("Failed to configure the Station.\r\n")); } while (1) { esp_wifi_print(sys_get_stdout()); thrd_sleep(2); } return (0); }
eerimoq/simba
C++
Other
337
/* Setup response header. TCP has a 4B record length field. */
static void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp)
/* Setup response header. TCP has a 4B record length field. */ static void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp)
{ struct kvec *resv = &rqstp->rq_res.head[0]; svc_putnl(resv, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert wake-up controller (WUC) group to the corresponding wake-up edge sense register (WUESR). Return pointer to the register. */
static volatile uint8_t* wuesr(uint8_t grp)
/* Convert wake-up controller (WUC) group to the corresponding wake-up edge sense register (WUESR). Return pointer to the register. */ static volatile uint8_t* wuesr(uint8_t grp)
{ return (grp <= 4) ? (volatile uint8_t *)(IT8XXX2_WUC_WUESR1 + grp-1) : (volatile uint8_t *)(IT8XXX2_WUC_WUESR5 + 4*(grp-5)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Get bit value in bitmap table for the given address. */
UINTN EFIAPI GetGuardMapBit(IN EFI_PHYSICAL_ADDRESS Address)
/* Get bit value in bitmap table for the given address. */ UINTN EFIAPI GetGuardMapBit(IN EFI_PHYSICAL_ADDRESS Address)
{ UINT64 *GuardMap; FindGuardedMemoryMap (Address, FALSE, &GuardMap); if (GuardMap != NULL) { if (RShiftU64 ( *GuardMap, GUARDED_HEAP_MAP_ENTRY_BIT_INDEX (Address) ) & 1) { return 1; } } return 0; }
tianocore/edk2
C++
Other
4,240
/* Compares the prefix of two abstract address objects. */
int nl_addr_cmp_prefix(struct nl_addr *a, struct nl_addr *b)
/* Compares the prefix of two abstract address objects. */ int nl_addr_cmp_prefix(struct nl_addr *a, struct nl_addr *b)
{ int d = a->a_family - b->a_family; if (d == 0) { int len = min(a->a_prefixlen, b->a_prefixlen); int bytes = len / 8; d = memcmp(a->a_addr, b->a_addr, bytes); if (d == 0) { int mask = (1UL << (len % 8)) - 1UL; d = (a->a_addr[bytes] & mask) - (b->a_addr[bytes] & mask); } } return d; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Routine to get the next Handle, when you are searching for register protocol notifies. */
IHANDLE* UnitTestGetNextLocateByRegisterNotify(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
/* Routine to get the next Handle, when you are searching for register protocol notifies. */ IHANDLE* UnitTestGetNextLocateByRegisterNotify(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
{ IHANDLE *Handle; PROTOCOL_NOTIFY *ProtNotify; PROTOCOL_INTERFACE *Prot; LIST_ENTRY *Link; Handle = NULL; *Interface = NULL; ProtNotify = Position->SearchKey; if (ProtNotify != NULL) { ASSERT (ProtNotify->Signature == PROTOCOL_NOTIFY_SIGNATURE); Position->SearchKey = NULL; Link = ProtNotify->Position->ForwardLink; if (Link != &ProtNotify->Protocol->Protocols) { Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE); Handle = Prot->Handle; *Interface = Prot->Interface; } } return Handle; }
tianocore/edk2
C++
Other
4,240
/* Returns current physical source address for the given DMA channel. If the channel is running the caller must disable interrupts prior calling this function and process the returned value before re-enabling interrupt to prevent races with the interrupt handler. Note that in continuous mode there is a chance for CSSA_L register overflow inbetween the two reads resulting in incorrect return value. */
dma_addr_t omap_get_dma_src_pos(int lch)
/* Returns current physical source address for the given DMA channel. If the channel is running the caller must disable interrupts prior calling this function and process the returned value before re-enabling interrupt to prevent races with the interrupt handler. Note that in continuous mode there is a chance for CSSA_L register overflow inbetween the two reads resulting in incorrect return value. */ dma_addr_t omap_get_dma_src_pos(int lch)
{ dma_addr_t offset = 0; if (cpu_is_omap15xx()) offset = dma_read(CPC(lch)); else offset = dma_read(CSAC(lch)); if (!cpu_is_omap15xx() && offset == 0) offset = dma_read(CSAC(lch)); if (cpu_class_is_omap1()) offset |= (dma_read(CSSA_U(lch)) << 16); return offset; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to the device from the USB host before passing along unhandled control requests to the library for processing internally. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to the device from the USB host before passing along unhandled control requests to the library for processing internally. */ void EVENT_USB_Device_ControlRequest(void)
{ switch (USB_ControlRequest.bRequest) { case MS_REQ_MassStorageReset: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); IsMassStoreReset = true; } break; case MS_REQ_GetMaxLUN: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); Endpoint_Write_8(TOTAL_LUNS - 1); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); } break; } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Enables or disables the selected ADC software start conversion . */
void ADC_SoftwareStartConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the selected ADC software start conversion . */ void ADC_SoftwareStartConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->ADCR |= ADCR_SWSTART_Set; } else { ADCx->ADCR &= ADCR_SWSTART_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
/* Checks whether the specified RTC interrupt has occurred or not. */ ITStatus RTC_GetITStatus(uint32_t RTC_IT)
{ ITStatus bitstatus = RESET; uint32_t tmpreg = 0, enablestatus = 0; assert_param(IS_RTC_GET_IT(RTC_IT)); tmpreg = (uint32_t)(RTC->TAFCR & (RTC_TAFCR_TAMPIE)); enablestatus = (uint32_t)((RTC->CR & RTC_IT) | (tmpreg & (RTC_IT >> 15)) | (tmpreg & (RTC_IT >> 16))); tmpreg = (uint32_t)((RTC->ISR & (uint32_t)(RTC_IT >> 4))); if ((enablestatus != (uint32_t)RESET) && ((tmpreg & 0x0000FFFF) != (uint32_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
MaJerle/stm32f429
C++
null
2,036
/* tioce_init_provider - init SN PCI provider ops for TIO CE */
int tioce_init_provider(void)
/* tioce_init_provider - init SN PCI provider ops for TIO CE */ int tioce_init_provider(void)
{ sn_pci_provider[PCIIO_ASIC_TYPE_TIOCE] = &tioce_pci_interfaces; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If PatchVariable is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). */
VOID* EFIAPI LibPatchPcdSetPtr(OUT VOID *PatchVariable, IN UINTN MaximumDatumSize, IN OUT UINTN *SizeOfBuffer, IN CONST VOID *Buffer)
/* If PatchVariable is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). */ VOID* EFIAPI LibPatchPcdSetPtr(OUT VOID *PatchVariable, IN UINTN MaximumDatumSize, IN OUT UINTN *SizeOfBuffer, IN CONST VOID *Buffer)
{ ASSERT (PatchVariable != NULL); ASSERT (SizeOfBuffer != NULL); if (*SizeOfBuffer > 0) { ASSERT (Buffer != NULL); } if ((*SizeOfBuffer > MaximumDatumSize) || (*SizeOfBuffer == MAX_ADDRESS)) { *SizeOfBuffer = MaximumDatumSize; return NULL; } CopyMem (PatchVariable, Buffer, *SizeOfBuffer); return (VOID *)Buffer; }
tianocore/edk2
C++
Other
4,240
/* ubi_dump_aeb - dump a &struct ubi_ainf_peb object. @aeb: the object to dump @type: object type: 0 - not corrupted, 1 - corrupted */
void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type)
/* ubi_dump_aeb - dump a &struct ubi_ainf_peb object. @aeb: the object to dump @type: object type: 0 - not corrupted, 1 - corrupted */ void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type)
{ pr_err("eraseblock attaching information dump:\n"); pr_err("\tec %d\n", aeb->ec); pr_err("\tpnum %d\n", aeb->pnum); if (type == 0) { pr_err("\tlnum %d\n", aeb->lnum); pr_err("\tscrub %d\n", aeb->scrub); pr_err("\tsqnum %llu\n", aeb->sqnum); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns the last ADC1, ADC2 and ADC3 regular conversions results data in the selected multi mode. */
uint32_t ADC_GetMultiModeConversionValue(void)
/* Returns the last ADC1, ADC2 and ADC3 regular conversions results data in the selected multi mode. */ uint32_t ADC_GetMultiModeConversionValue(void)
{ return (*(__IO uint32_t *) CDR_ADDRESS); }
MaJerle/stm32f429
C++
null
2,036
/* Erase all chip of Serial Flash device. The CE instruction is for erasing the data of the whole chip to be "1". */
enum status_code mx25v_erase_chip(void)
/* Erase all chip of Serial Flash device. The CE instruction is for erasing the data of the whole chip to be "1". */ enum status_code mx25v_erase_chip(void)
{ enum status_code status; uint8_t tx_buf[1] = {MX25V_CMD_CE}; if (_mx25v_is_flash_busy()) { return STATUS_BUSY; } _mx25v_send_cmd_write_latch(MX25V_CMD_WREN); _mx25v_chip_select(); status = spi_write_buffer_wait(&_mx25v_spi, tx_buf, 1); if (status != STATUS_OK) { return STATUS_ERR_IO; } _mx25v_chip_deselect(); if (!_mx25v_wait_flash_ready(MX25V_WAIT_TIMEOUT)) { return STATUS_ERR_IO; } return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* This function is a hook for Spi to enable BIOS Write Protect. */
VOID EFIAPI EnableBiosWriteProtect(IN UINTN PchSpiBase, IN UINT8 CpuSmmBwp)
/* This function is a hook for Spi to enable BIOS Write Protect. */ VOID EFIAPI EnableBiosWriteProtect(IN UINTN PchSpiBase, IN UINT8 CpuSmmBwp)
{ MmioAnd8 (PchSpiBase + R_SPI_BCR, (UINT8)(~B_SPI_BCR_BIOSWE)); if (CpuSmmBwp != 0) { CpuSmmDisableBiosWriteProtect (FALSE); } }
tianocore/edk2
C++
Other
4,240
/* The function returns a value which should be given to the corresponding xfs_iunlock_map_shared(). This value is the mode in which the lock was actually taken. */
uint xfs_ilock_map_shared(xfs_inode_t *ip)
/* The function returns a value which should be given to the corresponding xfs_iunlock_map_shared(). This value is the mode in which the lock was actually taken. */ uint xfs_ilock_map_shared(xfs_inode_t *ip)
{ uint lock_mode; if ((ip->i_d.di_format == XFS_DINODE_FMT_BTREE) && ((ip->i_df.if_flags & XFS_IFEXTENTS) == 0)) { lock_mode = XFS_ILOCK_EXCL; } else { lock_mode = XFS_ILOCK_SHARED; } xfs_ilock(ip, lock_mode); return lock_mode; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the padding between the option length and the start of the link addr. Currently only IP-over-InfiniBand needs this, although if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may also need a pad of 2. */
static int ndisc_addr_option_pad(unsigned short type)
/* Return the padding between the option length and the start of the link addr. Currently only IP-over-InfiniBand needs this, although if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may also need a pad of 2. */ static int ndisc_addr_option_pad(unsigned short type)
{ switch (type) { case ARPHRD_INFINIBAND: return 2; default: return 0; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* reset_dp_phy() - Reset a device @dev: The LogiCore DP TX device in question @reset: Bit mask determining which bits in the device's config register should be set for the reset */
static void reset_dp_phy(struct udevice *dev, u32 reset)
/* reset_dp_phy() - Reset a device @dev: The LogiCore DP TX device in question @reset: Bit mask determining which bits in the device's config register should be set for the reset */ static void reset_dp_phy(struct udevice *dev, u32 reset)
{ struct dp_tx *dp_tx = dev_get_priv(dev); u32 val; set_reg(dev, REG_ENABLE, 0x0); val = get_reg(dev, REG_PHY_CONFIG); set_reg(dev, REG_PHY_CONFIG, val | reset); set_reg(dev, REG_PHY_CONFIG, val); wait_phy_ready(dev, phy_status_lanes_ready_mask(dp_tx->max_lane_count)); set_reg(dev, REG_ENABLE, 0x1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: a short description of the content type @type. Free the returned string with g_free() */
gchar* g_content_type_get_description(const gchar *type)
/* Returns: a short description of the content type @type. Free the returned string with g_free() */ gchar* g_content_type_get_description(const gchar *type)
{ static GHashTable *type_comment_cache = NULL; gchar *comment; g_return_val_if_fail (type != NULL, NULL); G_LOCK (gio_xdgmime); type = xdg_mime_unalias_mime_type (type); if (type_comment_cache == NULL) type_comment_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); comment = g_hash_table_lookup (type_comment_cache, type); comment = g_strdup (comment); G_UNLOCK (gio_xdgmime); if (comment != NULL) return comment; comment = load_comment_for_mime (type); G_LOCK (gio_xdgmime); g_hash_table_insert (type_comment_cache, g_strdup (type), g_strdup (comment)); G_UNLOCK (gio_xdgmime); return comment; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The Userspace watchdog got a KeepAlive: schedule the next timeout. */
static int bfin_wdt_keepalive(void)
/* The Userspace watchdog got a KeepAlive: schedule the next timeout. */ static int bfin_wdt_keepalive(void)
{ stampit(); bfin_write_WDOG_STAT(0); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Locking: Locking free; the function MUST be called holding hp->lock */
void __hvc_resize(struct hvc_struct *hp, struct winsize ws)
/* Locking: Locking free; the function MUST be called holding hp->lock */ void __hvc_resize(struct hvc_struct *hp, struct winsize ws)
{ hp->ws = ws; schedule_work(&hp->tty_resize); }
robutest/uclinux
C++
GPL-2.0
60
/* Try to allocate a physical channel. When successful, assign it to this virtual channel, and initiate the next descriptor. The virtual channel lock must be held at this point. */
static void pl08x_phy_alloc_and_start(struct pl08x_dma_chan *plchan)
/* Try to allocate a physical channel. When successful, assign it to this virtual channel, and initiate the next descriptor. The virtual channel lock must be held at this point. */ static void pl08x_phy_alloc_and_start(struct pl08x_dma_chan *plchan)
{ struct pl08x_driver_data *pl08x = plchan->host; struct pl08x_phy_chan *ch; ch = pl08x_get_phy_channel(pl08x, plchan); if (!ch) { dev_dbg(&pl08x->adev->dev, "no physical channel available for xfer on %s\n", plchan->name); plchan->state = PL08X_CHAN_WAITING; return; } dev_dbg(&pl08x->adev->dev, "allocated physical channel %d for xfer on %s\n", ch->id, plchan->name); plchan->phychan = ch; plchan->state = PL08X_CHAN_RUNNING; pl08x_start_next_txd(plchan); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* An event is triggered whenever a path is taken out of use. Includes path failure and PG bypass. */
static void trigger_event(struct work_struct *work)
/* An event is triggered whenever a path is taken out of use. Includes path failure and PG bypass. */ static void trigger_event(struct work_struct *work)
{ struct multipath *m = container_of(work, struct multipath, trigger_event); dm_table_event(m->ti->table); }
robutest/uclinux
C++
GPL-2.0
60
/* This is a helper function user to inform the user about possibility to write the data to the device. */
static void audio_dc_sof(struct usb_cfg_data *cfg, struct usb_audio_dev_data *dev_data)
/* This is a helper function user to inform the user about possibility to write the data to the device. */ static void audio_dc_sof(struct usb_cfg_data *cfg, struct usb_audio_dev_data *dev_data)
{ uint8_t ep_addr; ep_addr = cfg->endpoint[0].ep_addr; if ((ep_addr & USB_EP_DIR_MASK) && (dev_data->tx_enable)) { if (dev_data->ops && dev_data->ops->data_request_cb) { dev_data->ops->data_request_cb( dev_data->common.dev); } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ack GPIO irq's Ack only for edge triggered int's valid */
static void ack_gpio_irq(u32 irq)
/* ack GPIO irq's Ack only for edge triggered int's valid */ static void ack_gpio_irq(u32 irq)
{ u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq)); u32 bit = IRQ_TO_BIT(irq); if ( (CPU_REG (reg_base, GPIO_EDGE) & bit)) CPU_REG (reg_base, GPIO_CLR) = bit; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: This is used to register a hardware specific ACPI driver that manipulates the attention LED. All the fields in info must be set. */
int acpiphp_register_attention(struct acpiphp_attention_info *info)
/* Description: This is used to register a hardware specific ACPI driver that manipulates the attention LED. All the fields in info must be set. */ int acpiphp_register_attention(struct acpiphp_attention_info *info)
{ int retval = -EINVAL; if (info && info->owner && info->set_attn && info->get_attn && !attention_info) { retval = 0; attention_info = info; } return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* 3. Emergency Set Indication No data 3. Talker Identity */
static guint16 be_talker_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3. Emergency Set Indication No data 3. Talker Identity */ static guint16 be_talker_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_bits_item(tree, hf_gsm_a_bssmap_spare_bits, tvb, curr_offset<<3, 5, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gsm_a_bssmap_filler_bits, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; proto_tree_add_item(tree, hf_gsm_a_bssmap_talker_identity_field, tvb, curr_offset, len-1, ENC_NA); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* convert a sampling rate into our full speed format (fs/1000 in Q16.16) this will overflow at approx 524 kHz */
static unsigned get_usb_full_speed_rate(unsigned rate)
/* convert a sampling rate into our full speed format (fs/1000 in Q16.16) this will overflow at approx 524 kHz */ static unsigned get_usb_full_speed_rate(unsigned rate)
{ return ((rate << 13) + 62) / 125; }
robutest/uclinux
C++
GPL-2.0
60
/* Wait for User push-button press to start transfer. */
void WaitForUserButtonPress(void)
/* Wait for User push-button press to start transfer. */ void WaitForUserButtonPress(void)
{ while (ubButtonPress == 0) { LL_GPIO_TogglePin(LED1_GPIO_PORT, LED1_PIN); LL_mDelay(LED_BLINK_FAST); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This uses a different ratio than the anonymous pages, because the page cache uses a use-once replacement algorithm. */
static int inactive_file_is_low(struct zone *zone, struct scan_control *sc)
/* This uses a different ratio than the anonymous pages, because the page cache uses a use-once replacement algorithm. */ static int inactive_file_is_low(struct zone *zone, struct scan_control *sc)
{ int low; if (scanning_global_lru(sc)) low = inactive_file_is_low_global(zone); else low = mem_cgroup_inactive_file_is_low(sc->mem_cgroup); return low; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the gc stale time of a neighbour table to the specified value */
void rtnl_neightbl_set_gc_stale_time(struct rtnl_neightbl *ntbl, uint64_t ms)
/* Set the gc stale time of a neighbour table to the specified value */ void rtnl_neightbl_set_gc_stale_time(struct rtnl_neightbl *ntbl, uint64_t ms)
{ ntbl->nt_parms.ntp_gc_stale_time = ms; ntbl->nt_parms.ntp_mask |= NEIGHTBLPARM_ATTR_GC_STALETIME; ntbl->ce_mask |= NEIGHTBL_ATTR_PARMS; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables TIMx peripheral Preload register on ARR. */
void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables TIMx peripheral Preload register on ARR. */ void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR1 |= TIM_CR1_ARPE; } else { TIMx->CR1 &= (uint16_t)~((uint16_t)TIM_CR1_ARPE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* NOTE: Another possibility is to store the formatted records off the audit context (for those records that have a context), and emit them all at syscall exit. However, this could delay the reporting of significant errors until syscall exit (or never, if the system halts). */
unsigned int audit_serial(void)
/* NOTE: Another possibility is to store the formatted records off the audit context (for those records that have a context), and emit them all at syscall exit. However, this could delay the reporting of significant errors until syscall exit (or never, if the system halts). */ unsigned int audit_serial(void)
{ static DEFINE_SPINLOCK(serial_lock); static unsigned int serial = 0; unsigned long flags; unsigned int ret; spin_lock_irqsave(&serial_lock, flags); do { ret = ++serial; } while (unlikely(!ret)); spin_unlock_irqrestore(&serial_lock, flags); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function installs a notification service to be called back when a given interface is installed or reinstalled. The purpose of the service is to publish an interface that other parties can use to call additional PPIs that may materialize later. */
EFI_STATUS EFIAPI UnitTestNotifyPpi(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
/* This function installs a notification service to be called back when a given interface is installed or reinstalled. The purpose of the service is to publish an interface that other parties can use to call additional PPIs that may materialize later. */ EFI_STATUS EFIAPI UnitTestNotifyPpi(IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
{ return InternalPeiNotifyPpi (PeiServices, NotifyList, FALSE); }
tianocore/edk2
C++
Other
4,240
/* Returns 0 on success or negative error code on failure. */
static int i2o_block_release(struct gendisk *disk, fmode_t mode)
/* Returns 0 on success or negative error code on failure. */ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
{ struct i2o_block_device *dev = disk->private_data; u8 operation; if (!dev->i2o_dev) return 0; i2o_block_device_flush(dev->i2o_dev); i2o_block_device_unlock(dev->i2o_dev, -1); if (dev->flags & (1 << 3 | 1 << 4)) operation = 0x21; else operation = 0x24; i2o_block_device_power(dev, operation); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Read a single byte from the transport channel. */
static int read_byte(struct xbee_driver_t *self_p, uint8_t *byte_p)
/* Read a single byte from the transport channel. */ static int read_byte(struct xbee_driver_t *self_p, uint8_t *byte_p)
{ int res; res = chan_read(self_p->transport.chin_p, byte_p, sizeof(*byte_p)); if (res == 0) { res = -EIO; } return (res); }
eerimoq/simba
C++
Other
337
/* Check if a time difference calculation is valid and return the difference. */
static bool isoal_get_time_diff(uint32_t time_before, uint32_t time_after, uint32_t *result)
/* Check if a time difference calculation is valid and return the difference. */ static bool isoal_get_time_diff(uint32_t time_before, uint32_t time_after, uint32_t *result)
{ bool valid = false; LL_ASSERT(time_before <= ISOAL_TIME_WRAPPING_POINT_US); LL_ASSERT(time_after <= ISOAL_TIME_WRAPPING_POINT_US); if (time_before > time_after) { if (time_before >= ISOAL_TIME_MID_POINT_US && time_after <= ISOAL_TIME_MID_POINT_US) { if ((time_before - time_after) <= ISOAL_TIME_SPAN_HALF_US) { } else { *result = time_after + ISOAL_TIME_SPAN_FULL_US - time_before; valid = true; } } } else { *result = time_after - time_before; if (*result <= ISOAL_TIME_SPAN_HALF_US) { valid = true; } else { } } return valid; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Note that the xfer->seg thingies follow the URB life cycle, so we need to put them, not free them. */
static void wa_xfer_destroy(struct kref *_xfer)
/* Note that the xfer->seg thingies follow the URB life cycle, so we need to put them, not free them. */ static void wa_xfer_destroy(struct kref *_xfer)
{ struct wa_xfer *xfer = container_of(_xfer, struct wa_xfer, refcnt); if (xfer->seg) { unsigned cnt; for (cnt = 0; cnt < xfer->segs; cnt++) { if (xfer->is_inbound) usb_put_urb(xfer->seg[cnt]->dto_urb); usb_put_urb(&xfer->seg[cnt]->urb); } } kfree(xfer); }
robutest/uclinux
C++
GPL-2.0
60
/* Printk the given error with the address of the client that caused it. */
static int __attribute__((format(printf, 2, 3)))
/* Printk the given error with the address of the client that caused it. */ static int __attribute__((format(printf, 2, 3)))
{ va_list args; int r; char buf[RPC_MAX_ADDRBUFLEN]; if (!net_ratelimit()) return 0; printk(KERN_WARNING "svc: %s: ", svc_print_addr(rqstp, buf, sizeof(buf))); va_start(args, fmt); r = vprintk(fmt, args); va_end(args); return r; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USB_OTG_BSP_uDelay This function provides delay time in micro sec. */
void USB_OTG_BSP_uDelay(const uint32_t usec)
/* USB_OTG_BSP_uDelay This function provides delay time in micro sec. */ void USB_OTG_BSP_uDelay(const uint32_t usec)
{ if ( ++count > utime ) { return ; } } while (1); }
MaJerle/stm32f429
C++
null
2,036
/* Enable Off-State in Idle Mode. Enables the off-state in idle mode for the break function of an advanced timer. When the master output is disabled the output is set to its inactive level as defined by the output polarity. */
void timer_set_enabled_off_state_in_idle_mode(uint32_t timer_peripheral)
/* Enable Off-State in Idle Mode. Enables the off-state in idle mode for the break function of an advanced timer. When the master output is disabled the output is set to its inactive level as defined by the output polarity. */ void timer_set_enabled_off_state_in_idle_mode(uint32_t timer_peripheral)
{ TIM_BDTR(timer_peripheral) |= TIM_BDTR_OSSI; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Enables a PCI driver to copy one region of PCI memory space to another region of PCI memory space. */
STATIC EFI_STATUS EFIAPI PciIoCopyMem(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 DestBarIndex, IN UINT64 DestOffset, IN UINT8 SrcBarIndex, IN UINT64 SrcOffset, IN UINTN Count)
/* Enables a PCI driver to copy one region of PCI memory space to another region of PCI memory space. */ STATIC EFI_STATUS EFIAPI PciIoCopyMem(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 DestBarIndex, IN UINT64 DestOffset, IN UINT8 SrcBarIndex, IN UINT64 SrcOffset, IN UINTN Count)
{ NON_DISCOVERABLE_PCI_DEVICE *Dev; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *DestDesc; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *SrcDesc; EFI_STATUS Status; if ((UINT32)Width > EfiPciIoWidthUint64) { return EFI_INVALID_PARAMETER; } Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO (This); Status = GetBarResource (Dev, DestBarIndex, &DestDesc); if (EFI_ERROR (Status)) { return Status; } if (DestOffset + (Count << (Width & 0x3)) > DestDesc->AddrLen) { return EFI_UNSUPPORTED; } Status = GetBarResource (Dev, SrcBarIndex, &SrcDesc); if (EFI_ERROR (Status)) { return Status; } if (SrcOffset + (Count << (Width & 0x3)) > SrcDesc->AddrLen) { return EFI_UNSUPPORTED; } ASSERT (FALSE); return EFI_UNSUPPORTED; }
tianocore/edk2
C++
Other
4,240
/* Function for configuring I2C slave module. This function will configure the I2C slave module with the SERCOM module to be used, required slave address, address mode mask and pinmux settings */
static void configure_i2c(void)
/* Function for configuring I2C slave module. This function will configure the I2C slave module with the SERCOM module to be used, required slave address, address mode mask and pinmux settings */ static void configure_i2c(void)
{ struct i2c_slave_config config_i2c; i2c_slave_get_config_defaults(&config_i2c); config_i2c.address = SLAVE_ADDRESS; config_i2c.address_mode = I2C_SLAVE_ADDRESS_MODE_MASK; config_i2c.pinmux_pad0 = BOOT_I2C_PAD0; config_i2c.pinmux_pad1 = BOOT_I2C_PAD1; i2c_slave_init(&slave, BOOT_SERCOM, &config_i2c); i2c_slave_enable(&slave); }
memfault/zero-to-main
C++
null
200
/* configure the free watchdog timer counter window value */
ErrStatus fwdgt_window_value_config(uint16_t window_value)
/* configure the free watchdog timer counter window value */ ErrStatus fwdgt_window_value_config(uint16_t window_value)
{ uint32_t time_index = FWDGT_WND_TIMEOUT; uint32_t flag_status = RESET; FWDGT_CTL = FWDGT_WRITEACCESS_ENABLE; do{ flag_status = FWDGT_STAT & FWDGT_STAT_WUD; }while((--time_index > 0) && ((uint32_t)RESET != flag_status)); if ((uint32_t)RESET != flag_status) return ERROR; FWDGT_WND = (uint32_t)WND_WND(window_value); return SUCCESS; }
liuxuming/trochili
C++
Apache License 2.0
132
/* If Map is NULL, then ASSERT(). If Key is NULL, then ASSERT(). */
EFI_STATUS EFIAPI NetMapInsertHead(IN OUT NET_MAP *Map, IN VOID *Key, IN VOID *Value OPTIONAL)
/* If Map is NULL, then ASSERT(). If Key is NULL, then ASSERT(). */ EFI_STATUS EFIAPI NetMapInsertHead(IN OUT NET_MAP *Map, IN VOID *Key, IN VOID *Value OPTIONAL)
{ NET_MAP_ITEM *Item; ASSERT (Map != NULL && Key != NULL); Item = NetMapAllocItem (Map); if (Item == NULL) { return EFI_OUT_OF_RESOURCES; } Item->Key = Key; Item->Value = Value; InsertHeadList (&Map->Used, &Item->Link); Map->Count++; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This function checks write protection for a range of flash chunks. */
bool am_hal_flash_write_protect_check(uint32_t *pui32StartAddress, uint32_t *pui32StopAddress)
/* This function checks write protection for a range of flash chunks. */ bool am_hal_flash_write_protect_check(uint32_t *pui32StartAddress, uint32_t *pui32StopAddress)
{ uint64_t ui64Mask; uint32_t ui32Work; uint32_t *pui32Protection = (uint32_t *)AM_HAL_FLASH_INFO_WRITPROT_ADDR; ui64Mask = generate_chunk_mask(pui32StartAddress, pui32StopAddress); if ( ~ui64Mask == 0x0 ) { return false; } ui32Work = (uint32_t)ui64Mask; if ( ~ui32Work & pui32Protection[0] ) { return false; } ui32Work = (uint32_t)(ui64Mask >> 32); if ( ~ui32Work & pui32Protection[1] ) { return false; } return true; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used). */
u16_t inet_chksum_pbuf(struct pbuf *p)
/* Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used). */ u16_t inet_chksum_pbuf(struct pbuf *p)
{ u32_t acc; struct pbuf *q; u8_t swapped; acc = 0; swapped = 0; for (q = p; q != NULL; q = q->next) { acc += LWIP_CHKSUM(q->payload, q->len); acc = FOLD_U32T(acc); if (q->len % 2 != 0) { swapped = 1 - swapped; acc = SWAP_BYTES_IN_WORD(acc); } } if (swapped) { acc = SWAP_BYTES_IN_WORD(acc); } return (u16_t)~(acc & 0xffffUL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* This function returns the low power audio clock. */
u32 get_lp_apm(void)
/* This function returns the low power audio clock. */ u32 get_lp_apm(void)
{ u32 ret_val = 0; u32 ccsr = __raw_readl(&mxc_ccm->ccsr); if (((ccsr >> 9) & 1) == 0) ret_val = CONFIG_MX51_HCLK_FREQ; else ret_val = ((32768 * 1024)); return ret_val; }
EmcraftSystems/u-boot
C++
Other
181
/* Called when the PCI registration layer (or the IDE initialization) finds a device matching our IDE device tables. */
static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* Called when the PCI registration layer (or the IDE initialization) finds a device matching our IDE device tables. */ static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ return ide_pci_init_one(dev, &atiixp_pci_info[id->driver_data], NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_ENABLE(); } else if(hadc->Instance==ADC3) { __HAL_RCC_ADC3_CLK_ENABLE(); __HAL_RCC_GPIOF_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Amount of free RAM allocatable within all zones */
unsigned int nr_free_pagecache_pages(void)
/* Amount of free RAM allocatable within all zones */ unsigned int nr_free_pagecache_pages(void)
{ return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE)); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_get_parsing_location(CRInput *a_this, CRParsingLocation *a_loc)
/* Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_get_parsing_location(CRInput *a_this, CRParsingLocation *a_loc)
{ g_return_val_if_fail (a_this && PRIVATE (a_this) && a_loc, CR_BAD_PARAM_ERROR) ; a_loc->line = PRIVATE (a_this)->line ; a_loc->column = PRIVATE (a_this)->col ; if (PRIVATE (a_this)->next_byte_index) { a_loc->byte_offset = PRIVATE (a_this)->next_byte_index - 1 ; } else { a_loc->byte_offset = PRIVATE (a_this)->next_byte_index ; } return CR_OK ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base Pointer to FLEXIO_I2C_Type structure. param mask Interrupt source. */
void FLEXIO_I2C_MasterDisableInterrupts(FLEXIO_I2C_Type *base, uint32_t mask)
/* param base Pointer to FLEXIO_I2C_Type structure. param mask Interrupt source. */ void FLEXIO_I2C_MasterDisableInterrupts(FLEXIO_I2C_Type *base, uint32_t mask)
{ if ((mask & (uint32_t)kFLEXIO_I2C_TxEmptyInterruptEnable) != 0U) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1UL << base->shifterIndex[0]); } if ((mask & (uint32_t)kFLEXIO_I2C_RxFullInterruptEnable) != 0U) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1UL << base->shifterIndex[1]); } }
eclipse-threadx/getting-started
C++
Other
310
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI UdfComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI UdfComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mUdfDriverNameTable, DriverName, (BOOLEAN)(This == &gUdfComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Tells whether the region of a page is locked. */
bool flashcalw_is_page_region_locked(uint32_t page_number)
/* Tells whether the region of a page is locked. */ bool flashcalw_is_page_region_locked(uint32_t page_number)
{ return flashcalw_is_region_locked(flashcalw_get_page_region(page_number)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* check whether the xattr bucket is filled up with the same hash value. If we want to insert the xattr with the same hash, return -ENOSPC. If we want to insert a xattr with different hash value, go ahead and ocfs2_divide_xattr_bucket will handle this. */
static int ocfs2_check_xattr_bucket_collision(struct inode *inode, struct ocfs2_xattr_bucket *bucket, const char *name)
/* check whether the xattr bucket is filled up with the same hash value. If we want to insert the xattr with the same hash, return -ENOSPC. If we want to insert a xattr with different hash value, go ahead and ocfs2_divide_xattr_bucket will handle this. */ static int ocfs2_check_xattr_bucket_collision(struct inode *inode, struct ocfs2_xattr_bucket *bucket, const char *name)
{ struct ocfs2_xattr_header *xh = bucket_xh(bucket); u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name)); if (name_hash != le32_to_cpu(xh->xh_entries[0].xe_name_hash)) return 0; if (xh->xh_entries[le16_to_cpu(xh->xh_count) - 1].xe_name_hash == xh->xh_entries[0].xe_name_hash) { mlog(ML_ERROR, "Too much hash collision in xattr bucket %llu, " "hash = %u\n", (unsigned long long)bucket_blkno(bucket), le32_to_cpu(xh->xh_entries[0].xe_name_hash)); return -ENOSPC; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Emit code for binary expressions that "produce values" (everything but logical operators 'and'/'or' and comparison operators). Expression to produce final result will be encoded in 'e1'. */
static void finishbinexpval(FuncState *fs, expdesc *e1, expdesc *e2, OpCode op, int v2, int flip, int line, OpCode mmop, TMS event)
/* Emit code for binary expressions that "produce values" (everything but logical operators 'and'/'or' and comparison operators). Expression to produce final result will be encoded in 'e1'. */ static void finishbinexpval(FuncState *fs, expdesc *e1, expdesc *e2, OpCode op, int v2, int flip, int line, OpCode mmop, TMS event)
{ int v1 = luaK_exp2anyreg(fs, e1); int pc = luaK_codeABCk(fs, op, 0, v1, v2, 0); freeexps(fs, e1, e2); e1->u.info = pc; e1->k = VRELOC; luaK_fixline(fs, line); luaK_codeABCk(fs, mmop, v1, v2, event, flip); luaK_fixline(fs, line); }
Nicholas3388/LuaNode
C++
Other
1,055
/* This API is used to reads filter setting in the register 0xF5 bit 3 and 4. */
BMP280_RETURN_FUNCTION_TYPE bmp280_get_filter(u8 *v_value_u8)
/* This API is used to reads filter setting in the register 0xF5 bit 3 and 4. */ BMP280_RETURN_FUNCTION_TYPE bmp280_get_filter(u8 *v_value_u8)
{ BMP280_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 v_data_u8 = BMP280_INIT_VALUE; if (p_bmp280 == BMP280_NULL) { com_rslt = E_BMP280_NULL_PTR; } else { com_rslt = p_bmp280->BMP280_BUS_READ_FUNC(p_bmp280->dev_addr, BMP280_CONFIG_REG_FILTER__REG, &v_data_u8, BMP280_GEN_READ_WRITE_DATA_LENGTH); *v_value_u8 = BMP280_GET_BITSLICE(v_data_u8, BMP280_CONFIG_REG_FILTER); } return com_rslt; }
remotemcu/remcu-chip-sdks
C++
null
436
/* smr = at91_sys_read(AT91_AIC_SMR(irq)) & ~AT91_AIC_SRCTYPE; at91_sys_write(AT91_AIC_SMR(irq), smr | srctype); return 0; } */
rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq)
/* smr = at91_sys_read(AT91_AIC_SMR(irq)) & ~AT91_AIC_SRCTYPE; at91_sys_write(AT91_AIC_SMR(irq), smr | srctype); return 0; } */ rt_uint32_t rt_hw_interrupt_get_active(rt_uint32_t fiq_irq)
{ rt_uint32_t id; if (fiq_irq == INT_FIQ) return 0; at91_sys_read(AT91_AIC_IVR); id = at91_sys_read(AT91_AIC_ISR); return id; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 64bit Octeon IO base address for read/write */
static uint64_t cvmx_pcie_get_io_base_address(int pcie_port)
/* Returns 64bit Octeon IO base address for read/write */ static uint64_t cvmx_pcie_get_io_base_address(int pcie_port)
{ union cvmx_pcie_address pcie_addr; pcie_addr.u64 = 0; pcie_addr.io.upper = 0; pcie_addr.io.io = 1; pcie_addr.io.did = 3; pcie_addr.io.subdid = 2; pcie_addr.io.es = 1; pcie_addr.io.port = pcie_port; return pcie_addr.u64; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Add a buffer to the Buffer To Free List for safely returning buffers to other places without risking letting them modify internal shell information. */
VOID* AddBufferToFreeList(VOID *Buffer)
/* Add a buffer to the Buffer To Free List for safely returning buffers to other places without risking letting them modify internal shell information. */ VOID* AddBufferToFreeList(VOID *Buffer)
{ BUFFER_LIST *BufferListEntry; if (Buffer == NULL) { return (NULL); } BufferListEntry = AllocateZeroPool (sizeof (BUFFER_LIST)); if (BufferListEntry == NULL) { return NULL; } BufferListEntry->Buffer = Buffer; InsertTailList (&ShellInfoObject.BufferToFreeList.Link, &BufferListEntry->Link); return (Buffer); }
tianocore/edk2
C++
Other
4,240
/* write_eeprom_reg - write specified value into specified register in EEPROM */
static int write_eeprom_reg(struct eth_device *dev, u8 value, u8 reg)
/* write_eeprom_reg - write specified value into specified register in EEPROM */ static int write_eeprom_reg(struct eth_device *dev, u8 value, u8 reg)
{ int ret; ret = do_eeprom_cmd(dev, E2P_CMD_EPC_CMD_EWEN, reg); if (ret) goto done; ret = do_eeprom_cmd(dev, E2P_CMD_EPC_CMD_ERASE, reg); if (ret) goto done; smc911x_reg_write(dev, E2P_DATA, value); ret = do_eeprom_cmd(dev, E2P_CMD_EPC_CMD_WRITE, reg); if (ret) goto done; ret = do_eeprom_cmd(dev, E2P_CMD_EPC_CMD_EWDS, reg); done: return ret; }
EmcraftSystems/u-boot
C++
Other
181