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
/* Returns: the data of the first element in the queue, or NULL if the queue is empty */
gpointer g_queue_pop_head(GQueue *queue)
/* Returns: the data of the first element in the queue, or NULL if the queue is empty */ gpointer g_queue_pop_head(GQueue *queue)
{ g_return_val_if_fail (queue != NULL, NULL); if (queue->head) { GList *node = queue->head; gpointer data = node->data; queue->head = node->next; if (queue->head) queue->head->prev = NULL; else queue->tail = NULL; g_list_free_1 (node); queue->length--; ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* i2c_isr_set_cleared: - wait until certain bits of the I2C status register are set and cleared */
static int i2c_isr_set_cleared(struct mv_i2c *base, unsigned long set_mask, unsigned long cleared_mask)
/* i2c_isr_set_cleared: - wait until certain bits of the I2C status register are set and cleared */ static int i2c_isr_set_cleared(struct mv_i2c *base, unsigned long set_mask, unsigned long cleared_mask)
{ int timeout = 1000, isr; do { isr = readl(&base->isr); udelay(10); if (timeout-- < 0) return 0; } while (((isr & set_mask) != set_mask) || ((isr & cleared_mask) != 0)); return 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* The valid interrupt status bits when the USB controller is acting as a device are the following: */
void USBLPMIntDisable(uint32_t ui32Base, uint32_t ui32Ints)
/* The valid interrupt status bits when the USB controller is acting as a device are the following: */ void USBLPMIntDisable(uint32_t ui32Base, uint32_t ui32Ints)
{ ASSERT(ui32Base == USB0_BASE); HWREGB(ui32Base + USB_O_LPMIM) &= ~ui32Ints; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI IoRead16(IN UINTN Port)
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI IoRead16(IN UINTN Port)
{ CONST EFI_PEI_SERVICES **PeiServices; EFI_PEI_CPU_IO_PPI *CpuIo; PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; ASSERT (CpuIo != NULL); ASSERT ((Port & 1) == 0); return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64)Port); }
tianocore/edk2
C++
Other
4,240
/* Returns: (type GObject.Object) (transfer none): the same @object */
gpointer g_object_ref(gpointer _object)
/* Returns: (type GObject.Object) (transfer none): the same @object */ gpointer g_object_ref(gpointer _object)
{ GObject *object = _object; gint old_val; g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (object->ref_count > 0, NULL); old_val = g_atomic_int_add (&object->ref_count, 1); if (old_val == 1 && OBJECT_HAS_TOGGLE_REF (object)) toggle_refs_notify (object, FALSE); TRACE (GOBJECT_O...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void)
/* Task function for blinking the LED as a fixed timer interval. */ void LedBlinkTask(void)
{ static blt_bool ledOn = BLT_FALSE; static blt_int32u nextBlinkEvent = 0; if (TimerGet() >= nextBlinkEvent) { if (ledOn == BLT_FALSE) { ledOn = BLT_TRUE; LL_GPIO_SetOutputPin(GPIOB, LL_GPIO_PIN_7); } else { ledOn = BLT_FALSE; LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Try to retrieve the next record to the left/right from the current one. */
STATIC int xfs_ialloc_next_rec(struct xfs_btree_cur *cur, xfs_inobt_rec_incore_t *rec, int *done, int left)
/* Try to retrieve the next record to the left/right from the current one. */ STATIC int xfs_ialloc_next_rec(struct xfs_btree_cur *cur, xfs_inobt_rec_incore_t *rec, int *done, int left)
{ int error; int i; if (left) error = xfs_btree_decrement(cur, 0, &i); else error = xfs_btree_increment(cur, 0, &i); if (error) return error; *done = !i; if (i) { error = xfs_inobt_get_rec(cur, rec, &i); if (error) return error; XFS_WANT_CORRUPTED_RETURN(i == 1); } return 0...
robutest/uclinux
C++
GPL-2.0
60
/* The kmem_shake interface is invoked when memory is running low. */
STATIC int xfs_qm_shake(int, gfp_t)
/* The kmem_shake interface is invoked when memory is running low. */ STATIC int xfs_qm_shake(int, gfp_t)
{ int ndqused, nfree, n; if (!kmem_shake_allow(gfp_mask)) return 0; if (!xfs_Gqm) return 0; nfree = xfs_Gqm->qm_dqfreelist.qh_nelems; ndqused = atomic_read(&xfs_Gqm->qm_totaldquots) - nfree; ASSERT(ndqused >= 0); if (nfree <= ndqused && nfree < ndquot) return 0; ndqused *= xfs_Gqm->qm_dqfree_ratio; n = n...
robutest/uclinux
C++
GPL-2.0
60
/* USB Device Suspend Function Called automatically on USB Device Suspend Return Value: None */
void USBD_Suspend(void)
/* USB Device Suspend Function Called automatically on USB Device Suspend Return Value: None */ void USBD_Suspend(void)
{ CNTR |= CNTR_FSUSP; CNTR |= CNTR_LPMODE; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Configure the FT6206 device to stop generating IT on the given INT pin connected to MCU as EXTI. */
void ft6x06_TS_DisableIT(uint16_t DeviceAddr)
/* Configure the FT6206 device to stop generating IT on the given INT pin connected to MCU as EXTI. */ void ft6x06_TS_DisableIT(uint16_t DeviceAddr)
{ uint8_t regValue = 0; regValue = (FT6206_G_MODE_INTERRUPT_POLLING & (FT6206_G_MODE_INTERRUPT_MASK >> FT6206_G_MODE_INTERRUPT_SHIFT)) << FT6206_G_MODE_INTERRUPT_SHIFT; TS_IO_Write(DeviceAddr, FT6206_GMODE_REG, regValue); }
eclipse-threadx/getting-started
C++
Other
310
/* Patch a character to the end of a string. */
VOID EFIAPI PatchForAsciiStrTokenAfter(IN CHAR8 *Buffer, IN CHAR8 Patch)
/* Patch a character to the end of a string. */ VOID EFIAPI PatchForAsciiStrTokenAfter(IN CHAR8 *Buffer, IN CHAR8 Patch)
{ CHAR8 *Str; if (Buffer == NULL) { return; } Str = Buffer; while (*Str != 0) { Str++; } *Str = Patch; while (*(Str++) != '\0') { if (*Str == 0) { *Str = Patch; } else { break; } } return; }
tianocore/edk2
C++
Other
4,240
/* Note: leave the hash unchanged if the directory is case-sensitive. */
static int ncp_hash_dentry(struct dentry *, struct qstr *)
/* Note: leave the hash unchanged if the directory is case-sensitive. */ static int ncp_hash_dentry(struct dentry *, struct qstr *)
{ struct nls_table *t; unsigned long hash; int i; t = NCP_IO_TABLE(dentry); if (!ncp_case_sensitive(dentry->d_inode)) { hash = init_name_hash(); for (i=0; i<this->len ; i++) hash = partial_name_hash(ncp_tolower(t, this->name[i]), hash); this->hash = end_name_hash(hash); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If Sha256Context is NULL, then return FALSE. If NewSha256Context is NULL, then return FALSE. */
BOOLEAN EFIAPI Sha256Duplicate(IN CONST VOID *Sha256Context, OUT VOID *NewSha256Context)
/* If Sha256Context is NULL, then return FALSE. If NewSha256Context is NULL, then return FALSE. */ BOOLEAN EFIAPI Sha256Duplicate(IN CONST VOID *Sha256Context, OUT VOID *NewSha256Context)
{ if ((Sha256Context == NULL) || (NewSha256Context == NULL)) { return FALSE; } mbedtls_sha256_clone (NewSha256Context, Sha256Context); return TRUE; }
tianocore/edk2
C++
Other
4,240
/* This is called from dput() when d_count is going to 0. */
static int nfs_dentry_delete(struct dentry *dentry)
/* This is called from dput() when d_count is going to 0. */ static int nfs_dentry_delete(struct dentry *dentry)
{ dfprintk(VFS, "NFS: dentry_delete(%s/%s, %x)\n", dentry->d_parent->d_name.name, dentry->d_name.name, dentry->d_flags); if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode)) return 1; if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { return 1; } if (!(dentry->d_sb->s_flags & MS_ACTIVE)) { return 1; } ...
robutest/uclinux
C++
GPL-2.0
60
/* cx231xx_v4l2_poll() will allocate buffers when called for the first time */
static unsigned int cx231xx_v4l2_poll(struct file *filp, poll_table *wait)
/* cx231xx_v4l2_poll() will allocate buffers when called for the first time */ static unsigned int cx231xx_v4l2_poll(struct file *filp, poll_table *wait)
{ struct cx231xx_fh *fh = filp->private_data; struct cx231xx *dev = fh->dev; int rc; rc = check_dev(dev); if (rc < 0) return rc; mutex_lock(&dev->lock); rc = res_get(fh); mutex_unlock(&dev->lock); if (unlikely(rc < 0)) return POLLERR; if ((V4L2_BUF_TYPE_VIDEO_CAPTURE == fh->type) || (V4L2_BUF_TYPE_VB...
robutest/uclinux
C++
GPL-2.0
60
/* This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed to the PeiCore by PrePeiCore. */
VOID ArmPlatformGetPlatformPpiList(OUT UINTN *PpiListSize, OUT EFI_PEI_PPI_DESCRIPTOR **PpiList)
/* This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed to the PeiCore by PrePeiCore. */ VOID ArmPlatformGetPlatformPpiList(OUT UINTN *PpiListSize, OUT EFI_PEI_PPI_DESCRIPTOR **PpiList)
{ *PpiListSize = 0; *PpiList = NULL; }
tianocore/edk2
C++
Other
4,240
/* This function handles external line 13 interrupt request. */
void EXTI15_10_IRQHandler(void)
/* This function handles external line 13 interrupt request. */ void EXTI15_10_IRQHandler(void)
{ if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_13) != RESET) { LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_13); UserButton_Callback(); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This internal API reads the calibration data from the sensor, parse it and store in the device structure. */
static int8_t get_calib_data(struct bme280_dev *dev)
/* This internal API reads the calibration data from the sensor, parse it and store in the device structure. */ static int8_t get_calib_data(struct bme280_dev *dev)
{ int8_t rslt; uint8_t reg_addr = BME280_TEMP_PRESS_CALIB_DATA_ADDR; uint8_t calib_data[BME280_TEMP_PRESS_CALIB_DATA_LEN] = { 0 }; rslt = bme280_get_regs(reg_addr, calib_data, BME280_TEMP_PRESS_CALIB_DATA_LEN, dev); if (rslt == BME280_OK) { parse_temp_press_calib_data(calib_data, dev); ...
eclipse-threadx/getting-started
C++
Other
310
/* Program the PIO/MWDMA timing for this channel according to the current clock. */
static void it821x_program(ide_drive_t *drive, u16 timing)
/* Program the PIO/MWDMA timing for this channel according to the current clock. */ static void it821x_program(ide_drive_t *drive, u16 timing)
{ ide_hwif_t *hwif = drive->hwif; struct pci_dev *dev = to_pci_dev(hwif->dev); struct it821x_dev *itdev = ide_get_hwifdata(hwif); int channel = hwif->channel; u8 conf; if(itdev->clock_mode == ATA_66) conf = timing >> 8; else conf = timing & 0xFF; pci_write_config_byte(dev, 0x54 + 4 * channel, conf); }
robutest/uclinux
C++
GPL-2.0
60
/* Indicates that SUSPEND state has been detected on the USB. */
static void usb_susp_isr(usb_core_instance *pdev)
/* Indicates that SUSPEND state has been detected on the USB. */ static void usb_susp_isr(usb_core_instance *pdev)
{ uint32_t u32dsts; uint8_t u8PrevStatus; dev_int_cbkpr->Suspend(pdev); u32dsts = READ_REG32(pdev->regs.DREGS->DSTS); WRITE_REG32(pdev->regs.GREGS->GINTSTS, USBFS_GINTSTS_USBSUSP); u8PrevStatus = pdev->dev.device_old_status; if ((pdev->dev.connection_status == 1U) && (u8PrevStatus == USB_DEV...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ip6_tnl_unlink - remove tunnel from hash table @t: tunnel to be removed */
static void ip6_tnl_unlink(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
/* ip6_tnl_unlink - remove tunnel from hash table @t: tunnel to be removed */ static void ip6_tnl_unlink(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
{ struct ip6_tnl **tp; for (tp = ip6_tnl_bucket(ip6n, &t->parms); *tp; tp = &(*tp)->next) { if (t == *tp) { spin_lock_bh(&ip6_tnl_lock); *tp = t->next; spin_unlock_bh(&ip6_tnl_lock); break; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads the specified ADC conversion result data in dual mode. */
uint32_t ADC_ReadDualModeConversionValue(ADC_T *adc)
/* Reads the specified ADC conversion result data in dual mode. */ uint32_t ADC_ReadDualModeConversionValue(ADC_T *adc)
{ return (*(__IOM uint32_t *) RDG_ADDRESS); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Copies the string from Source into Destination and updates Length with the size of the string. */
VOID CopyStringIntoPerfRecordAndUpdateLength(IN OUT CHAR8 *Destination, IN CONST CHAR8 *Source, IN OUT UINT8 *Length)
/* Copies the string from Source into Destination and updates Length with the size of the string. */ VOID CopyStringIntoPerfRecordAndUpdateLength(IN OUT CHAR8 *Destination, IN CONST CHAR8 *Source, IN OUT UINT8 *Length)
{ UINTN StringLen; UINTN DestMax; ASSERT (Source != NULL); if (PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) { DestMax = STRING_SIZE; } else { DestMax = AsciiStrSize (Source); if (DestMax > STRING_SIZE) { DestMax = STRING_SIZE; } } StringLen = AsciiStrLen (Source); if (StringL...
tianocore/edk2
C++
Other
4,240
/* Just mark this as a continuation of an earlier packet. */
static void dissect_rpc_continuation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Just mark this as a continuation of an earlier packet. */ static void dissect_rpc_continuation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ proto_item *rpc_item; proto_tree *rpc_tree; col_set_str(pinfo->cinfo, COL_PROTOCOL, "RPC"); col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); if (tree) { rpc_item = proto_tree_add_item(tree, proto_rpc, tvb, 0, -1, ENC_NA); rpc_tree = proto_item_add_subtree(rpc_item, ett_rpc); proto_tree_add_item(rpc_tre...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sets the states of the DTR and/or RTS modem control signals. The */
void xUARTModemControlSet(unsigned long ulBase, unsigned long ulControl)
/* Sets the states of the DTR and/or RTS modem control signals. The */ void xUARTModemControlSet(unsigned long ulBase, unsigned long ulControl)
{ UARTModemControlSet(ulBase, ulControl); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function should be called before entering WAIT/VLPW modes. */
void SMC_PreEnterWaitModes(void)
/* This function should be called before entering WAIT/VLPW modes. */ void SMC_PreEnterWaitModes(void)
{ g_savedPrimask = DisableGlobalIRQ(); __ISB(); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Set all interrupt status bits in Normal and Error Interrupt Status Enable register. */
EFI_STATUS EmmcPeimHcEnableInterrupt(IN UINTN Bar)
/* Set all interrupt status bits in Normal and Error Interrupt Status Enable register. */ EFI_STATUS EmmcPeimHcEnableInterrupt(IN UINTN Bar)
{ EFI_STATUS Status; UINT16 IntStatus; IntStatus = 0xFFFF; Status = EmmcPeimHcRwMmio (Bar + EMMC_HC_ERR_INT_STS_EN, FALSE, sizeof (IntStatus), &IntStatus); if (EFI_ERROR (Status)) { return Status; } IntStatus = 0xFFFF; Status = EmmcPeimHcRwMmio (Bar + EMMC_HC_NOR_INT_STS_EN, FALSE, sizeo...
tianocore/edk2
C++
Other
4,240
/* Return GPIO port pin mask for a GPIO pin. */
uint32_t pio_get_pin_group_mask(uint32_t ul_pin)
/* Return GPIO port pin mask for a GPIO pin. */ uint32_t pio_get_pin_group_mask(uint32_t ul_pin)
{ uint32_t ul_mask = 1 << (ul_pin & 0x1F); return ul_mask; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Return the clock source which is used as system clock. */
RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
/* Return the clock source which is used as system clock. */ RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
{ return (RCM_SYSCLK_SEL_T)RCM->CFG_B.SCLKSELSTS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* When configured to generate an NMI, the watchdog interrupt must still be enabled with */
void WatchdogIntTypeSet(unsigned long ulBase, unsigned long ulType)
/* When configured to generate an NMI, the watchdog interrupt must still be enabled with */ void WatchdogIntTypeSet(unsigned long ulBase, unsigned long ulType)
{ ASSERT((ulBase == WATCHDOG0_BASE) || (ulBase == WATCHDOG1_BASE)); ASSERT((ulType == WATCHDOG_INT_TYPE_INT) || (ulType == WATCHDOG_INT_TYPE_NMI)); HWREG(ulBase + WDT_O_CTL) = (HWREG(ulBase + WDT_O_CTL) & ~WDT_CTL_INTTYPE) | ulType; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disables the pmt interrupt generation in powerdown mode. */
void synopGMAC_disable_pmt_interrupt(synopGMACdevice *gmacdev)
/* Disables the pmt interrupt generation in powerdown mode. */ void synopGMAC_disable_pmt_interrupt(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacInterruptMask, GmacPmtIntMask); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Move every URB to unused list (a reset has occured) */
void usbd_purge_all_transfer(usbd_device *dev, usbd_transfer_status status)
/* Move every URB to unused list (a reset has occured) */ void usbd_purge_all_transfer(usbd_device *dev, usbd_transfer_status status)
{ flush_queue(dev, &dev->urbs.active, status); flush_queue(dev, &dev->urbs.waiting, status); usbd_put_all_urb_into_unused(dev); dev->urbs.ep_free = ~0; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ BSP_LED_On(LED3); while (1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Measure CPU clock speed (core clock GCLK1) (Approx. GCLK frequency in Hz) */
ulong bab7xx_get_gclk_freq(void)
/* Measure CPU clock speed (core clock GCLK1) (Approx. GCLK frequency in Hz) */ ulong bab7xx_get_gclk_freq(void)
{ static const int pllratio_to_factor[] = { 00, 75, 70, 00, 20, 65, 100, 45, 30, 55, 40, 50, 80, 60, 35, 00, }; return pllratio_to_factor[get_hid1 () >> 28] * (bab7xx_get_bus_freq () / 10); }
EmcraftSystems/u-boot
C++
Other
181
/* release and free resources for the SSP port. */
void ssp_exit(void)
/* release and free resources for the SSP port. */ void ssp_exit(void)
{ Ser4SSCR0 &= ~SSCR0_SSE; free_irq(IRQ_Ser4SSP, NULL); release_mem_region(__PREG(Ser4SSCR0), 0x18); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. */
UINTN EFIAPI Sha256GetContextSize(VOID)
/* Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. */ UINTN EFIAPI Sha256GetContextSize(VOID)
{ CALL_CRYPTO_SERVICE (Sha256GetContextSize, (), 0); }
tianocore/edk2
C++
Other
4,240
/* configure RCU , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void rcu_config(void)
/* configure RCU , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void rcu_config(void)
{ rcu_periph_clock_enable(RCU_GPIOA); rcu_periph_clock_enable(RCU_GPIOB); rcu_periph_clock_enable(RCU_GPIOC); rcu_periph_clock_enable(RCU_TIMER1); rcu_periph_clock_enable(RCU_CFGCMP); }
liuxuming/trochili
C++
Apache License 2.0
132
/* If s is not NULL and *s is not a null byte the argument string is printed, followed by a colon and a blank. Then the error message and a new-line. */
void nl_perror(int error, const char *s)
/* If s is not NULL and *s is not a null byte the argument string is printed, followed by a colon and a blank. Then the error message and a new-line. */ void nl_perror(int error, const char *s)
{ if (s && *s) fprintf(stderr, "%s: %s\n", s, nl_geterror(error)); else fprintf(stderr, "%s\n", nl_geterror(error)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciBitFieldAnd8(IN UINTN...
{ return mRunningOnQ35 ? PciExpressBitFieldAnd8 (Address, StartBit, EndBit, AndData) : PciCf8BitFieldAnd8 (Address, StartBit, EndBit, AndData); }
tianocore/edk2
C++
Other
4,240
/* 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)
{ register rt_base_t temp; RT_ASSERT(object != RT_NULL); RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object)); object->type = 0; temp = rt_hw_interrupt_disable(); rt_list_remove(&(object->list)); rt_hw_interrupt_enable(temp); }
pikasTech/PikaPython
C++
MIT License
1,403
/* The main polling 'check' function, called FROM the edac core to perform the error checking and if an error is encountered, error processing. */
static void amd64_check(struct mem_ctl_info *mci)
/* The main polling 'check' function, called FROM the edac core to perform the error checking and if an error is encountered, error processing. */ static void amd64_check(struct mem_ctl_info *mci)
{ struct err_regs regs; if (amd64_get_error_info(mci, &regs)) { struct amd64_pvt *pvt = mci->pvt_info; amd_decode_nb_mce(pvt->mc_node_id, &regs, 1); } }
robutest/uclinux
C++
GPL-2.0
60
/* Restore the SSP configuration saved previously by ssp_save_state. */
void ssp_restore_state(struct ssp_dev *dev, struct ssp_state *state)
/* Restore the SSP configuration saved previously by ssp_save_state. */ void ssp_restore_state(struct ssp_dev *dev, struct ssp_state *state)
{ struct ssp_device *ssp = dev->ssp; uint32_t sssr = SSSR_ROR | SSSR_TUR | SSSR_BCE; __raw_writel(sssr, ssp->mmio_base + SSSR); __raw_writel(state->cr0 & ~SSCR0_SSE, ssp->mmio_base + SSCR0); __raw_writel(state->cr1, ssp->mmio_base + SSCR1); __raw_writel(state->to, ssp->mmio_base + SSTO); __raw_writel(state->psp...
EmcraftSystems/linux-emcraft
C++
Other
266
/* MMC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_MMC_MspDeInit(MMC_HandleTypeDef *hmmc)
/* MMC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_MMC_MspDeInit(MMC_HandleTypeDef *hmmc)
{ if(hmmc->Instance==SDMMC1) { __HAL_RCC_SDMMC1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_10|GPIO_PIN_9 |GPIO_PIN_8|GPIO_PIN_7|GPIO_PIN_6); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int IMG_InitWEBP()
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ int IMG_InitWEBP()
{ IMG_SetError("WEBP images are not supported"); return(-1); }
DC-SWAT/DreamShell
C++
null
404
/* speedstep_get_state - set the SpeedStep state @state: processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) */
static int speedstep_get_state(void)
/* speedstep_get_state - set the SpeedStep state @state: processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) */ static int speedstep_get_state(void)
{ u32 function = GET_SPEEDSTEP_STATE; u32 result, state, edi, command, dummy; command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); dprintk("trying to determine current setting with command %x " "at port %x\n", command, smi_port); __asm__ __volatile__( "push %%ebp\n" "out %%al, (%%dx)\n" "pop %%ebp\n" : "...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called from irq_enter to notify about the possible interruption of idle() */
void tick_check_idle(int cpu)
/* Called from irq_enter to notify about the possible interruption of idle() */ void tick_check_idle(int cpu)
{ tick_check_oneshot_broadcast(cpu); tick_check_nohz(cpu); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The reference count of the newly created net buffer is set to 1. The reference count of the associated net vector is increased by one. */
NET_BUF* EFIAPI NetbufClone(IN NET_BUF *Nbuf)
/* The reference count of the newly created net buffer is set to 1. The reference count of the associated net vector is increased by one. */ NET_BUF* EFIAPI NetbufClone(IN NET_BUF *Nbuf)
{ NET_BUF *Clone; NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); Clone = AllocatePool (NET_BUF_SIZE (Nbuf->BlockOpNum)); if (Clone == NULL) { return NULL; } Clone->Signature = NET_BUF_SIGNATURE; Clone->RefCnt = 1; InitializeListHead (&Clone->List); Clone->Ip = Nbuf->Ip; Clone->Tcp = Nbuf->T...
tianocore/edk2
C++
Other
4,240
/* param base XBARA peripheral address. return the mask of these status flag bits. */
uint32_t XBARA_GetStatusFlags(XBARA_Type *base)
/* param base XBARA peripheral address. return the mask of these status flag bits. */ uint32_t XBARA_GetStatusFlags(XBARA_Type *base)
{ uint32_t status_flag; status_flag = ((uint32_t)base->CTRL0 & (XBARA_CTRL0_STS0_MASK | XBARA_CTRL0_STS1_MASK)); status_flag |= (((uint32_t)base->CTRL1 & (XBARA_CTRL1_STS2_MASK | XBARA_CTRL1_STS3_MASK)) << 16U); return status_flag; }
eclipse-threadx/getting-started
C++
Other
310
/* Retrieves the connection info structure of a given connection to a host. */
TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, const IP_Address_t *RemoteAddress, const uint16_t RemotePort)
/* Retrieves the connection info structure of a given connection to a host. */ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port, const IP_Address_t *RemoteAddress, const uint16_t RemotePort)
{ for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++) { if ((ConnectionStateTable[CSTableEntry].Port == Port) && IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, RemoteAddress) && ConnectionStateTable[CSTableEntry].RemotePort == RemotePort) { return &Conne...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* @pointer: pointer @buf: pointer to buffer address on return position of terminating zero word */
static void pointer(void *pointer, u16 **buf)
/* @pointer: pointer @buf: pointer to buffer address on return position of terminating zero word */ static void pointer(void *pointer, u16 **buf)
{ int i; u16 c; uintptr_t p = (uintptr_t)pointer; u16 *pos = *buf; for (i = 8 * sizeof(p) - 4; i >= 0; i -= 4) { c = (p >> i) & 0x0f; c += '0'; if (c > '9') c += 'a' - '9' - 1; *pos++ = c; } *pos = 0; *buf = pos; }
4ms/stm32mp1-baremetal
C++
Other
137
/* IMPORTANT: We are using a spinlock here: the function executed on each element has to be atomic. */
int wlp_eda_for_each(struct wlp_eda *eda, wlp_eda_for_each_f function, void *priv)
/* IMPORTANT: We are using a spinlock here: the function executed on each element has to be atomic. */ int wlp_eda_for_each(struct wlp_eda *eda, wlp_eda_for_each_f function, void *priv)
{ int result = 0; struct wlp *wlp = container_of(eda, struct wlp, eda); struct wlp_eda_node *entry; unsigned long flags; spin_lock_irqsave(&eda->lock, flags); list_for_each_entry(entry, &eda->cache, list_node) { result = (*function)(wlp, entry, priv); if (result < 0) break; } spin_unlock_irqrestore(&eda-...
robutest/uclinux
C++
GPL-2.0
60
/* fc_change_queue_type() - Change a device's queue type @sdev: The SCSI device whose queue depth is to change @tag_type: Identifier for queue type */
int fc_change_queue_type(struct scsi_device *sdev, int tag_type)
/* fc_change_queue_type() - Change a device's queue type @sdev: The SCSI device whose queue depth is to change @tag_type: Identifier for queue type */ int fc_change_queue_type(struct scsi_device *sdev, int tag_type)
{ if (sdev->tagged_supported) { scsi_set_tag_type(sdev, tag_type); if (tag_type) scsi_activate_tcq(sdev, sdev->queue_depth); else scsi_deactivate_tcq(sdev, sdev->queue_depth); } else tag_type = 0; return tag_type; }
robutest/uclinux
C++
GPL-2.0
60
/* Change mtu size, this should work the same as olympic */
static int xl_change_mtu(struct net_device *dev, int mtu)
/* Change mtu size, this should work the same as olympic */ static int xl_change_mtu(struct net_device *dev, int mtu)
{ struct xl_private *xl_priv = netdev_priv(dev); u16 max_mtu ; if (xl_priv->xl_ring_speed == 4) max_mtu = 4500 ; else max_mtu = 18000 ; if (mtu > max_mtu) return -EINVAL ; if (mtu < 100) return -EINVAL ; dev->mtu = mtu ; xl_priv->pkt_buf_sz = mtu + TR_HLEN ; return 0 ; }
robutest/uclinux
C++
GPL-2.0
60
/* stop_nic - To stop the nic @nic ; device private variable. Description: This function does exactly the opposite of what the start_nic() function does. This function is called to stop the device. Return Value: void. */
static void stop_nic(struct s2io_nic *nic)
/* stop_nic - To stop the nic @nic ; device private variable. Description: This function does exactly the opposite of what the start_nic() function does. This function is called to stop the device. Return Value: void. */ static void stop_nic(struct s2io_nic *nic)
{ struct XENA_dev_config __iomem *bar0 = nic->bar0; register u64 val64 = 0; u16 interruptible; en_dis_err_alarms(nic, ENA_ALL_INTRS, DISABLE_INTRS); interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; interruptible |= TX_PIC_INTR; en_dis_able_nic_intrs(nic, interruptible, DISABLE_INTRS); val64 = readq(&bar0->ada...
robutest/uclinux
C++
GPL-2.0
60
/* Configure one or more pin(s) of a PIO controller as outputs, with the given default value. Optionally, the multi-drive feature can be enabled on the pin(s). */
void pio_set_output(Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_default_level, const uint32_t ul_multidrive_enable, const uint32_t ul_pull_up_enable)
/* Configure one or more pin(s) of a PIO controller as outputs, with the given default value. Optionally, the multi-drive feature can be enabled on the pin(s). */ void pio_set_output(Pio *p_pio, const uint32_t ul_mask, const uint32_t ul_default_level, const uint32_t ul_multidrive_enable, const uint32_t ul_pull_up_enab...
{ pio_disable_interrupt(p_pio, ul_mask); pio_pull_up(p_pio, ul_mask, ul_pull_up_enable); if (ul_multidrive_enable) { p_pio->PIO_MDER = ul_mask; } else { p_pio->PIO_MDDR = ul_mask; } if (ul_default_level) { p_pio->PIO_SODR = ul_mask; } else { p_pio->PIO_CODR = ul_mask; } p_pio->PIO_OER = ul_mask; p_pio...
remotemcu/remcu-chip-sdks
C++
null
436
/* If the return value is not NULL then it must be callee freed. */
CHAR16* EFIAPI ShellCommandCreateNewMappingName(IN CONST SHELL_MAPPING_TYPE Type)
/* If the return value is not NULL then it must be callee freed. */ CHAR16* EFIAPI ShellCommandCreateNewMappingName(IN CONST SHELL_MAPPING_TYPE Type)
{ CHAR16 *String; ASSERT (Type < MappingTypeMax); String = NULL; String = AllocateZeroPool (PcdGet8 (PcdShellMapNameLength) * sizeof (String[0])); UnicodeSPrint ( String, PcdGet8 (PcdShellMapNameLength) * sizeof (String[0]), Type == MappingTypeFileSystem ? L"FS%d:" : L"BLK%d:", Type == Mappin...
tianocore/edk2
C++
Other
4,240
/* Change Logs: Date Author Notes Bernard first implementation */
static void rt_hw_console_init(void)
/* Change Logs: Date Author Notes Bernard first implementation */ static void rt_hw_console_init(void)
{ SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NON...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* gfs2_rgrp_bh_put - Release RG bitmaps read in with gfs2_rgrp_bh_get() @rgd: the struct gfs2_rgrpd describing the RG to read in */
void gfs2_rgrp_bh_put(struct gfs2_rgrpd *rgd)
/* gfs2_rgrp_bh_put - Release RG bitmaps read in with gfs2_rgrp_bh_get() @rgd: the struct gfs2_rgrpd describing the RG to read in */ void gfs2_rgrp_bh_put(struct gfs2_rgrpd *rgd)
{ struct gfs2_sbd *sdp = rgd->rd_sbd; int x, length = rgd->rd_length; spin_lock(&sdp->sd_rindex_spin); gfs2_assert_warn(rgd->rd_sbd, rgd->rd_bh_count); if (--rgd->rd_bh_count) { spin_unlock(&sdp->sd_rindex_spin); return; } for (x = 0; x < length; x++) { struct gfs2_bitmap *bi = rgd->rd_bits + x; kfree(bi...
robutest/uclinux
C++
GPL-2.0
60
/* Programs a word (32-bit) at a specified address. */
FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
/* Programs a word (32-bit) at a specified address. */ FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
{ FLASH_Status status = FLASH_COMPLETE; assert_param(IS_FLASH_ADDRESS(Address)); status = FLASH_WaitForLastOperation(); if(status == FLASH_COMPLETE) { FLASH->CR &= CR_PSIZE_MASK; FLASH->CR |= FLASH_PSIZE_WORD; FLASH->CR |= FLASH_CR_PG; *(__IO uint32_t*)Address = Data; status = FLASH_WaitFo...
MaJerle/stm32f429
C++
null
2,036
/* If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildStackHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
/* If there is no additional space for HOB creation, then ASSERT(). */ VOID EFIAPI BuildStackHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
{ EFI_HOB_MEMORY_ALLOCATION_STACK *Hob; ASSERT ( ((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) && ((Length & (EFI_PAGE_SIZE - 1)) == 0) ); Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16)sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK)); if (Hob == NULL) { return; } CopyGuid (&(Hob...
tianocore/edk2
C++
Other
4,240
/* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t). */
static rt_ssize_t _pwm_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
/* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t). */ static rt_ssize_t _pwm_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ rt_err_t result = RT_EOK; struct rt_device_pwm *pwm = (struct rt_device_pwm *)dev; rt_uint32_t *pulse = (rt_uint32_t *)buffer; struct rt_pwm_configuration configuration = {0}; configuration.channel = (pos > 0) ? (pos) : (-pos); if (pwm->ops->control) { result = pwm->ops->control(pw...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | Reserved (R) | HI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
static void dissect_pmip6_opt_hi(const mip6_opt *optp _U_, tvbuff_t *tvb, int offset, guint optlen _U_, packet_info *pinfo _U_, proto_tree *opt_tree, proto_item *hdr_item _U_)
/* 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | Reserved (R) | HI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ static void dissect_pmip6_opt_hi(const mip6_opt *optp _U_, tvbuff_t *tv...
{ guint8 hi; offset++; proto_tree_add_item(opt_tree, hf_mip6_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(opt_tree, hf_pmip6_hi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; hi = tvb_get_guint8(tvb,offset); proto_tree_add_item(opt_tree, hf_pmip6_hi_hi, t...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function handles External line 0 interrupt request. */
void EXTI0_IRQHandler(void)
/* This function handles External line 0 interrupt request. */ void EXTI0_IRQHandler(void)
{ if(EXTI_GetITStatus(EXTI_Line0) != RESET) { STM_EVAL_LEDToggle(LED1); EXTI_ClearITPendingBit(EXTI_Line0); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* This is a helper function for 'check_leaf()' which searches inode @inum in the RB-tree of inodes and returns an inode information pointer or NULL if the inode was not found. */
static struct fsck_inode* search_inode(struct fsck_data *fsckd, ino_t inum)
/* This is a helper function for 'check_leaf()' which searches inode @inum in the RB-tree of inodes and returns an inode information pointer or NULL if the inode was not found. */ static struct fsck_inode* search_inode(struct fsck_data *fsckd, ino_t inum)
{ struct rb_node *p; struct fsck_inode *fscki; p = fsckd->inodes.rb_node; while (p) { fscki = rb_entry(p, struct fsck_inode, rb); if (inum < fscki->inum) p = p->rb_left; else if (inum > fscki->inum) p = p->rb_right; else return fscki; } return NULL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This routine is called by dma driver exit routines, dmaengine holds module references to prevent it being called while channels are in use. */
void dma_async_device_unregister(struct dma_device *device)
/* This routine is called by dma driver exit routines, dmaengine holds module references to prevent it being called while channels are in use. */ void dma_async_device_unregister(struct dma_device *device)
{ struct dma_chan *chan; mutex_lock(&dma_list_mutex); list_del_rcu(&device->global_node); dma_channel_rebalance(); mutex_unlock(&dma_list_mutex); list_for_each_entry(chan, &device->channels, device_node) { WARN_ONCE(chan->client_count, "%s called while %d clients hold a reference\n", __func__, chan->c...
robutest/uclinux
C++
GPL-2.0
60
/* Return the start index on success, -1 on failure. */
int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
/* Return the start index on success, -1 on failure. */ int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
{ int status; unsigned long flags; spin_lock_irqsave(&pcibus_info->pbi_lock, flags); status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count); spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags); return status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ib_modify_device() changes a device's attributes as specified by the @device_modify_mask and @device_modify structure. */
int ib_modify_device(struct ib_device *device, int device_modify_mask, struct ib_device_modify *device_modify)
/* ib_modify_device() changes a device's attributes as specified by the @device_modify_mask and @device_modify structure. */ int ib_modify_device(struct ib_device *device, int device_modify_mask, struct ib_device_modify *device_modify)
{ return device->modify_device(device, device_modify_mask, device_modify); }
robutest/uclinux
C++
GPL-2.0
60
/* Default decoder get frame count. Default reader can only ever service a single frame at a time. */
static int get_frame_count(const uint8_t *buffer, enum sensor_channel channel, size_t channel_idx, uint16_t *frame_count)
/* Default decoder get frame count. Default reader can only ever service a single frame at a time. */ static int get_frame_count(const uint8_t *buffer, enum sensor_channel channel, size_t channel_idx, uint16_t *frame_count)
{ struct sensor_data_generic_header *header = (struct sensor_data_generic_header *)buffer; size_t count = 0; switch (channel) { case SENSOR_CHAN_ACCEL_XYZ: channel = SENSOR_CHAN_ACCEL_X; break; case SENSOR_CHAN_GYRO_XYZ: channel = SENSOR_CHAN_GYRO_X; break; case SENSOR_CHAN_MAGN_XYZ: channel = SENSOR_CH...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Address Parameter and other parameter will not be wrapped in this function */
static struct sctp_chunk* sctp_make_asconf(struct sctp_association *asoc, union sctp_addr *addr, int vparam_len)
/* Address Parameter and other parameter will not be wrapped in this function */ static struct sctp_chunk* sctp_make_asconf(struct sctp_association *asoc, union sctp_addr *addr, int vparam_len)
{ sctp_addiphdr_t asconf; struct sctp_chunk *retval; int length = sizeof(asconf) + vparam_len; union sctp_addr_param addrparam; int addrlen; struct sctp_af *af = sctp_get_af_specific(addr->v4.sin_family); addrlen = af->to_addr_param(addr, &addrparam); if (!addrlen) return NULL; length += addrlen; retval = s...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function un-maps logical eraseblock @lnum and schedules corresponding physical eraseblock for erasure. Returns zero in case of success and a negative error code in case of failure. */
int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum)
/* This function un-maps logical eraseblock @lnum and schedules corresponding physical eraseblock for erasure. Returns zero in case of success and a negative error code in case of failure. */ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum)
{ int err, pnum, vol_id = vol->vol_id; if (ubi->ro_mode) return -EROFS; err = leb_write_lock(ubi, vol_id, lnum); if (err) return err; pnum = vol->eba_tbl[lnum]; if (pnum < 0) goto out_unlock; dbg_eba("erase LEB %d:%d, PEB %d", vol_id, lnum, pnum); down_read(&ubi->fm_eba_sem); vol->eba_tbl[lnum] = UBI_LEB...
4ms/stm32mp1-baremetal
C++
Other
137
/* nfs_free_unlinkdata - release data from a sillydelete operation. @data: pointer to unlink structure. */
static void nfs_free_unlinkdata(struct nfs_unlinkdata *data)
/* nfs_free_unlinkdata - release data from a sillydelete operation. @data: pointer to unlink structure. */ static void nfs_free_unlinkdata(struct nfs_unlinkdata *data)
{ iput(data->dir); put_rpccred(data->cred); kfree(data->args.name.name); kfree(data); }
robutest/uclinux
C++
GPL-2.0
60
/* @dev should have all relevant members pre-filled with the exception of the class member. In particular, the device_type member must be set. */
int drm_class_device_register(struct device *dev)
/* @dev should have all relevant members pre-filled with the exception of the class member. In particular, the device_type member must be set. */ int drm_class_device_register(struct device *dev)
{ dev->class = drm_class; return device_register(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* param config Pointer to configuration structure. See to "dcdc_loop_control_config_t" */
void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config)
/* param config Pointer to configuration structure. See to "dcdc_loop_control_config_t" */ void DCDC_GetDefaultLoopControlConfig(dcdc_loop_control_config_t *config)
{ assert(NULL != config); (void)memset(config, 0, sizeof(*config)); config->enableCommonHysteresis = false; config->enableCommonThresholdDetection = false; config->enableInvertHysteresisSign = false; config->enableRCThresholdDetection = false; config->enableRCScaleCircuit ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* System aon peripheral reset. Use this function to reset system aon peripheral. */
enum status_code system_peripheral_aon_reset(enum system_peripheral_aon peripheral_aon)
/* System aon peripheral reset. Use this function to reset system aon peripheral. */ enum status_code system_peripheral_aon_reset(enum system_peripheral_aon peripheral_aon)
{ switch (peripheral_aon) { case PERIPHERAL_AON_SLEEP_TIMER: AON_GP_REGS0->AON_GLOBAL_RESET.reg &= \ ~AON_GP_REGS_AON_GLOBAL_RESET_SLEEP_TIMER_RSTN; while (!AON_SLEEP_TIMER0->CONTROL.bit.SLEEP_TIMER_NOT_ACTIVE); AON_GP_REGS0->AON_GLOBAL_RESET.reg |= \ AON_GP_REGS_AON_GLOBAL_RESET_SLEEP_TIMER_RSTN; ...
remotemcu/remcu-chip-sdks
C++
null
436
/* Used to retrieve the two chars string from interface */
gchar* airpcap_get_if_string_number_from_description(gchar *description)
/* Used to retrieve the two chars string from interface */ gchar* airpcap_get_if_string_number_from_description(gchar *description)
{ gchar* number; gchar* pointer; number = (gchar*)g_malloc(sizeof(gchar)*3); pointer = g_strrstr(description,"#\0"); number[0] = *(pointer+1); number[1] = *(pointer+2); number[2] = '\0'; return number; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 3. Location Type (Location Type element of 3GPP TS 49.031 BSSAP-LE.) */
static guint16 be_loc_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3. Location Type (Location Type element of 3GPP TS 49.031 BSSAP-LE.) */ static guint16 be_loc_type(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; guint8 location_information; curr_offset = offset; location_information = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_gsm_a_bssmap_location_type_location_information, tvb, offset, 1, ENC_BIG_ENDIAN); curr_offset++; if (location_information == 1 || locati...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* nand_write_page_hwecc - hardware ecc based page write function @mtd: mtd info structure @chip: nand chip info structure @buf: data buffer */
static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf)
/* nand_write_page_hwecc - hardware ecc based page write function @mtd: mtd info structure @chip: nand chip info structure @buf: data buffer */ static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf)
{ int i, eccsize = chip->ecc.size; int eccbytes = chip->ecc.bytes; int eccsteps = chip->ecc.steps; uint8_t *ecc_calc = chip->buffers->ecccalc; const uint8_t *p = buf; uint32_t *eccpos = chip->ecc.layout->eccpos; for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { chip->ecc.hwctl(mtd, NAND_ECC_WRIT...
EmcraftSystems/u-boot
C++
Other
181
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint64ToUint16(IN UINT64 Operand, OUT UINT16 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint64ToUint16(IN UINT64 Operand, OUT UINT16 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_UINT16) { *Result = (UINT16)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT16_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* VA API requires a fixed-size reference picture array. */
static void init_vaapi_pic(VAPictureH264 *va_pic)
/* VA API requires a fixed-size reference picture array. */ static void init_vaapi_pic(VAPictureH264 *va_pic)
{ va_pic->picture_id = VA_INVALID_ID; va_pic->flags = VA_PICTURE_H264_INVALID; va_pic->TopFieldOrderCnt = 0; va_pic->BottomFieldOrderCnt = 0; }
DC-SWAT/DreamShell
C++
null
404
/* Callback run when a XOSC32K crystal operation is detected. */
static void xosc32k_ok_callback(struct tc_module *instance)
/* Callback run when a XOSC32K crystal operation is detected. */ static void xosc32k_ok_callback(struct tc_module *instance)
{ tc_disable_callback(&tc_xosc32k, TC_CALLBACK_CC_CHANNEL0); tc_enable_callback(&tc_osc32k, TC_CALLBACK_CC_CHANNEL0); init_dfll((enum system_clock_source)GCLK_GENERATOR_XOSC32K); port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE); }
memfault/zero-to-main
C++
null
200
/* Initializes @cdev, remembering @fops, making it ready to add to the system with cdev_add(). */
void cdev_init(struct cdev *cdev, const struct file_operations *fops)
/* Initializes @cdev, remembering @fops, making it ready to add to the system with cdev_add(). */ void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{ memset(cdev, 0, sizeof *cdev); INIT_LIST_HEAD(&cdev->list); kobject_init(&cdev->kobj, &ktype_cdev_default); cdev->ops = fops; }
robutest/uclinux
C++
GPL-2.0
60
/* DevicePathNode must be SerialSata type and this will populate the MappingItem. */
EFI_STATUS DevPathSerialSata(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* DevicePathNode must be SerialSata type and this will populate the MappingItem. */ EFI_STATUS DevPathSerialSata(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_STATUS Status; SATA_DEVICE_PATH *Sata; ASSERT (DevicePathNode != NULL); ASSERT (MappingItem != NULL); Sata = (SATA_DEVICE_PATH *)DevicePathNode; Status = AppendCSDNum (MappingItem, Sata->HBAPortNumber); if (!EFI_ERROR (Status)) { Status = AppendCSDNum (MappingItem, Sata->PortMultiplie...
tianocore/edk2
C++
Other
4,240
/* Return the RAM Disk device path created by LoadFile. */
EFI_DEVICE_PATH_PROTOCOL* BmGetRamDiskDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
/* Return the RAM Disk device path created by LoadFile. */ EFI_DEVICE_PATH_PROTOCOL* BmGetRamDiskDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
{ EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath; EFI_DEVICE_PATH_PROTOCOL *Node; EFI_HANDLE Handle; Node = FilePath; Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &Node, &Handle); if (!EFI_ERROR (Status) && (DevicePathType (Node) == MED...
tianocore/edk2
C++
Other
4,240
/* Get the captured data for a sample sequence. */
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
/* Get the captured data for a sample sequence. */ unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
{ unsigned long i; unsigned long ulEnableChannels; unsigned long ulValid; unsigned long ulWrite; xASSERT(ulBase == ADC0_BASE); xASSERT(pulBuffer != 0); ulEnableChannels = (xHWREG(ulBase + ADC_CHEN) & ADC_CHEN_CHEN_M) >> ADC_CHEN_CHEN_S; ulValid = (xHWREG(ulBase + A...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Dissects an SMB_FILE_ATTRIBUTES, to use the term given to it by section 2.2.1.2.4 of , in cases where it's search attributes. */
static int dissect_search_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
/* Dissects an SMB_FILE_ATTRIBUTES, to use the term given to it by section 2.2.1.2.4 of , in cases where it's search attributes. */ static int dissect_search_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{ static const int * flags[] = { &hf_smb_search_attribute_read_only, &hf_smb_search_attribute_hidden, &hf_smb_search_attribute_system, &hf_smb_search_attribute_volume, &hf_smb_search_attribute_directory, &hf_smb_search_attribute_archive, NULL }; proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_s...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Compute the ASL NameString/path size from NameString information (Root, ParentPrefix, SegCount). */
UINT32 EFIAPI AslComputeNameStringSize(IN UINT32 Root, IN UINT32 ParentPrefix, IN UINT32 SegCount)
/* Compute the ASL NameString/path size from NameString information (Root, ParentPrefix, SegCount). */ UINT32 EFIAPI AslComputeNameStringSize(IN UINT32 Root, IN UINT32 ParentPrefix, IN UINT32 SegCount)
{ UINT32 TotalSize; if (!AmlIsNameString (Root, ParentPrefix, SegCount)) { ASSERT (0); return 0; } TotalSize = Root + ParentPrefix; TotalSize += (SegCount * AML_NAME_SEG_SIZE); TotalSize += (SegCount > 1) ? (SegCount - 1) : 0; TotalSize += 1; return TotalSize; }
tianocore/edk2
C++
Other
4,240
/* Try to let xendev know that it is connected. Depends on the frontend being Connected. Note that this may be called more than once since the backend state is not modified. */
static void xen_be_try_connected(struct XenDevice *xendev)
/* Try to let xendev know that it is connected. Depends on the frontend being Connected. Note that this may be called more than once since the backend state is not modified. */ static void xen_be_try_connected(struct XenDevice *xendev)
{ if (!xendev->ops->connected) { return; } if (xendev->fe_state != XenbusStateConnected) { if (xendev->ops->flags & DEVOPS_FLAG_IGNORE_STATE) { xen_be_printf(xendev, 2, "frontend not ready, ignoring\n"); } else { xen_be_printf(xendev, 2, "frontend not ready (y...
ve3wwg/teensy3_qemu
C++
Other
15
/* Returns: a pointer to the found occurrence, or NULL if not found. */
gchar* g_strrstr(const gchar *haystack, const gchar *needle)
/* Returns: a pointer to the found occurrence, or NULL if not found. */ gchar* g_strrstr(const gchar *haystack, const gchar *needle)
{ gsize i; gsize needle_len; gsize haystack_len; const gchar *p; g_return_val_if_fail (haystack != NULL, NULL); g_return_val_if_fail (needle != NULL, NULL); needle_len = strlen (needle); haystack_len = strlen (haystack); if (needle_len == 0) return (gchar *)haystack; if (haystack_len < needle_le...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Locks a buffer object. Note that this in no way locks the underlying pages, so it is only useful for synchronizing concurrent use of buffer objects, not for synchronizing independent access to the underlying pages. */
void xfs_buf_lock(xfs_buf_t *bp)
/* Locks a buffer object. Note that this in no way locks the underlying pages, so it is only useful for synchronizing concurrent use of buffer objects, not for synchronizing independent access to the underlying pages. */ void xfs_buf_lock(xfs_buf_t *bp)
{ trace_xfs_buf_lock(bp, _RET_IP_); if (atomic_read(&bp->b_io_remaining)) blk_run_address_space(bp->b_target->bt_mapping); down(&bp->b_sema); XB_SET_OWNER(bp); trace_xfs_buf_lock_done(bp, _RET_IP_); }
robutest/uclinux
C++
GPL-2.0
60
/* Marks a start time, so that future calls to g_timer_elapsed() will report the time since g_timer_start() was called. g_timer_new() automatically marks the start time, so no need to call g_timer_start() immediately after creating the timer. */
void g_timer_start(GTimer *timer)
/* Marks a start time, so that future calls to g_timer_elapsed() will report the time since g_timer_start() was called. g_timer_new() automatically marks the start time, so no need to call g_timer_start() immediately after creating the timer. */ void g_timer_start(GTimer *timer)
{ g_return_if_fail (timer != NULL); timer->active = TRUE; timer->start = g_get_monotonic_time (); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function allocates and initializes a nand_bbt_descr for BBM detection based on the properties of "this". The new descriptor is stored in this->badblock_pattern. Thus, this->badblock_pattern should be NULL when passed to this function. */
static int nand_create_default_bbt_descr(struct nand_chip *this)
/* This function allocates and initializes a nand_bbt_descr for BBM detection based on the properties of "this". The new descriptor is stored in this->badblock_pattern. Thus, this->badblock_pattern should be NULL when passed to this function. */ static int nand_create_default_bbt_descr(struct nand_chip *this)
{ struct nand_bbt_descr *bd; if (this->badblock_pattern) { printk(KERN_WARNING "BBT descr already allocated; not replacing.\n"); return -EINVAL; } bd = kzalloc(sizeof(*bd), GFP_KERNEL); if (!bd) { printk(KERN_ERR "nand_create_default_bbt_descr: Out of memory\n"); return -ENOMEM; } bd->options = this->opt...
EmcraftSystems/u-boot
C++
Other
181
/* cmd->resp holds any four-byte response, for R3 (READ_OCR) and on newer cards R7 (IF_COND). */
static char* maptype(struct mmc_command *cmd)
/* cmd->resp holds any four-byte response, for R3 (READ_OCR) and on newer cards R7 (IF_COND). */ static char* maptype(struct mmc_command *cmd)
{ switch (mmc_spi_resp_type(cmd)) { case MMC_RSP_SPI_R1: return "R1"; case MMC_RSP_SPI_R1B: return "R1B"; case MMC_RSP_SPI_R2: return "R2/R5"; case MMC_RSP_SPI_R3: return "R3/R4/R7"; default: return "?"; } }
robutest/uclinux
C++
GPL-2.0
60
/* Read the bad block table for all chips starting at a given page. We assume that the bbt bits are in consecutive order. */
static int read_abs_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td, int chip)
/* Read the bad block table for all chips starting at a given page. We assume that the bbt bits are in consecutive order. */ static int read_abs_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td, int chip)
{ struct nand_chip *this = mtd_to_nand(mtd); int res = 0, i; if (td->options & NAND_BBT_PERCHIP) { int offs = 0; for (i = 0; i < this->numchips; i++) { if (chip == -1 || chip == i) res = read_bbt(mtd, buf, td->pages[i], this->chipsize >> this->bbt_erase_shift, td, offs); if (res) return r...
4ms/stm32mp1-baremetal
C++
Other
137
/* Given the contents of the status register and the DCPLB_DATA contents, return true if a write access should be permitted. */
static int write_permitted(int status, unsigned long data)
/* Given the contents of the status register and the DCPLB_DATA contents, return true if a write access should be permitted. */ static int write_permitted(int status, unsigned long data)
{ if (status & FAULT_USERSUPV) return !!(data & CPLB_SUPV_WR); else return !!(data & CPLB_USER_WR); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ADC MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ ADCx_FORCE_RESET(); ADCx_RELEASE_RESET(); HAL_GPIO_DeInit(ADCx_REG_CHANNEL_GPIO_PORT, ADCx_REG_CHANNEL_PIN); HAL_GPIO_DeInit(ADCx_INJ_CHANNEL_GPIO_PORT, ADCx_INJ_CHANNEL_PIN); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* param base SPDIF base pointer param handle SPDIF eDMA handle pointer. */
void SPDIF_TransferAbortReceiveEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle)
/* param base SPDIF base pointer param handle SPDIF eDMA handle pointer. */ void SPDIF_TransferAbortReceiveEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle)
{ assert(handle); EDMA_AbortTransfer(handle->dmaLeftHandle); EDMA_AbortTransfer(handle->dmaRightHandle); SPDIF_EnableDMA(base, kSPDIF_RxDMAEnable, false); memset(handle->spdifQueue, 0U, sizeof(handle->spdifQueue)); memset(handle->transferSize, 0U, sizeof(handle->transferSize)); handle->queue...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Register mailbox message handler function, to be called by common modules */
void bfa_ioc_mbox_regisr(struct bfa_ioc_s *ioc, enum bfi_mclass mc, bfa_ioc_mbox_mcfunc_t cbfn, void *cbarg)
/* Register mailbox message handler function, to be called by common modules */ void bfa_ioc_mbox_regisr(struct bfa_ioc_s *ioc, enum bfi_mclass mc, bfa_ioc_mbox_mcfunc_t cbfn, void *cbarg)
{ struct bfa_ioc_mbox_mod_s *mod = &ioc->mbox_mod; mod->mbhdlr[mc].cbfn = cbfn; mod->mbhdlr[mc].cbarg = cbarg; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is called when upper layer wants to send data using connection oriented communication mode. During sending data, connection will be locked and received frames and expired timers will be queued. Returns 0 for success, -ECONNABORTED when the connection already closed and -EBUSY when sending data is not p...
int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)
/* This function is called when upper layer wants to send data using connection oriented communication mode. During sending data, connection will be locked and received frames and expired timers will be queued. Returns 0 for success, -ECONNABORTED when the connection already closed and -EBUSY when sending data is not p...
{ struct llc_conn_state_ev *ev; int rc = -ECONNABORTED; struct llc_sock *llc = llc_sk(sk); if (unlikely(llc->state == LLC_CONN_STATE_ADM)) goto out; rc = -EBUSY; if (unlikely(llc_data_accept_state(llc->state) || llc->p_flag)) { llc->failed_data_req = 1; goto out; } ev = llc_conn_ev(skb); ev->type ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remove all pcbs on listen-, active- and time-wait-list (bound- isn't exported). */
void tcp_remove_all(void)
/* Remove all pcbs on listen-, active- and time-wait-list (bound- isn't exported). */ void tcp_remove_all(void)
{ tcp_remove(tcp_listen_pcbs.pcbs); tcp_remove(tcp_bound_pcbs); tcp_remove(tcp_active_pcbs); tcp_remove(tcp_tw_pcbs); fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0); fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB_LISTEN) == 0); fail_unless(MEMP_STATS_GET(used, MEMP_TCP_SEG) == 0); fail_unless(MEMP_...
ua1arn/hftrx
C++
null
69
/* This routine gets an entry from the non-embedded mailbox command at the sge index location. */
void lpfc_sli4_mbx_sge_get(struct lpfcMboxq *mbox, uint32_t sgentry, struct lpfc_mbx_sge *sge)
/* This routine gets an entry from the non-embedded mailbox command at the sge index location. */ void lpfc_sli4_mbx_sge_get(struct lpfcMboxq *mbox, uint32_t sgentry, struct lpfc_mbx_sge *sge)
{ struct lpfc_mbx_nembed_cmd *nembed_sge; nembed_sge = (struct lpfc_mbx_nembed_cmd *) &mbox->u.mqe.un.nembed_cmd; sge->pa_lo = nembed_sge->sge[sgentry].pa_lo; sge->pa_hi = nembed_sge->sge[sgentry].pa_hi; sge->length = nembed_sge->sge[sgentry].length; }
robutest/uclinux
C++
GPL-2.0
60