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: 0 on success, 1 if the header was invalid or incomplete, errno on error */
static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, struct gfs2_log_header_host *head)
/* Returns: 0 on success, 1 if the header was invalid or incomplete, errno on error */ static int get_log_header(struct gfs2_jdesc *jd, unsigned int blk, struct gfs2_log_header_host *head)
{ struct buffer_head *bh; struct gfs2_log_header_host uninitialized_var(lh); const u32 nothing = 0; u32 hash; int error; error = gfs2_replay_read_block(jd, blk, &bh); if (error) return error; hash = crc32_le((u32)~0, bh->b_data, sizeof(struct gfs2_log_header) - sizeof(u32)); hash = crc32_le(hash, (...
robutest/uclinux
C++
GPL-2.0
60
/* If Hex it must be preceeded with a 0x or has ForceHex, set TRUE. */
BOOLEAN EFIAPI ShellIsHexOrDecimalNumber(IN CONST CHAR16 *String, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
/* If Hex it must be preceeded with a 0x or has ForceHex, set TRUE. */ BOOLEAN EFIAPI ShellIsHexOrDecimalNumber(IN CONST CHAR16 *String, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
{ if (ShellConvertStringToUint64 (String, NULL, ForceHex, StopAtSpace) == EFI_NOT_FOUND) { return (TRUE); } return (FALSE); }
tianocore/edk2
C++
Other
4,240
/* See mss_uart.h for details of how to use this function. */
size_t MSS_UART_get_rx(mss_uart_instance_t *this_uart, uint8_t *rx_buff, size_t buff_size)
/* See mss_uart.h for details of how to use this function. */ size_t MSS_UART_get_rx(mss_uart_instance_t *this_uart, uint8_t *rx_buff, size_t buff_size)
{ size_t rx_size = 0U; ASSERT( (this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1) ); while (( this_uart->hw_reg_bit->LSR_DR != 0U) && ( rx_size < buff_size ) ) { rx_buff[rx_size] = this_uart->hw_reg->RBR; ++rx_size; } return rx_size; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* bitmap_file_kick - if an error occurs while manipulating the bitmap file then it is no longer reliable, so we stop using it and we mark the file as failed in the superblock */
static void bitmap_file_kick(struct bitmap *bitmap)
/* bitmap_file_kick - if an error occurs while manipulating the bitmap file then it is no longer reliable, so we stop using it and we mark the file as failed in the superblock */ static void bitmap_file_kick(struct bitmap *bitmap)
{ char *path, *ptr = NULL; if (bitmap_mask_state(bitmap, BITMAP_STALE, MASK_SET) == 0) { bitmap_update_sb(bitmap); if (bitmap->file) { path = kmalloc(PAGE_SIZE, GFP_KERNEL); if (path) ptr = d_path(&bitmap->file->f_path, path, PAGE_SIZE); printk(KERN_ALERT "%s: kicking failed bitmap...
robutest/uclinux
C++
GPL-2.0
60
/* DMA get current source offset in non-sequence mode. */
uint32_t DMA_GetNonSeqSrcOffset(const CM_DMA_TypeDef *DMAx, uint8_t u8Ch)
/* DMA get current source offset in non-sequence mode. */ uint32_t DMA_GetNonSeqSrcOffset(const CM_DMA_TypeDef *DMAx, uint8_t u8Ch)
{ DDL_ASSERT(IS_DMA_UNIT(DMAx)); DDL_ASSERT(IS_DMA_CH(u8Ch)); return (READ_REG32_BIT(DMA_CH_REG(DMAx->MONSNSEQCTL0, u8Ch), DMA_SNSEQCTL_SOFFSET)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The following function is implemented, although very few audio discs give Universal Product Code information, which should just be the Medium Catalog Number on the box. Note, that the way the code is written on the CD is /not/ uniform across all discs! */
static int cdrom_ioctl_get_mcn(struct cdrom_device_info *cdi, void __user *argp)
/* The following function is implemented, although very few audio discs give Universal Product Code information, which should just be the Medium Catalog Number on the box. Note, that the way the code is written on the CD is /not/ uniform across all discs! */ static int cdrom_ioctl_get_mcn(struct cdrom_device_info *cdi...
{ struct cdrom_mcn mcn; int ret; cdinfo(CD_DO_IOCTL, "entering CDROM_GET_MCN\n"); if (!(cdi->ops->capability & CDC_MCN)) return -ENOSYS; ret = cdi->ops->get_mcn(cdi, &mcn); if (ret) return ret; if (copy_to_user(argp, &mcn, sizeof(mcn))) return -EFAULT; cdinfo(CD_DO_IOCTL, "CDROM_GET_MCN successful\n"); r...
robutest/uclinux
C++
GPL-2.0
60
/* This routine returns the numbers of characteres the tty driver will accept for queuing to be written. o return MTU */
static int cpc_tty_write_room(struct tty_struct *tty)
/* This routine returns the numbers of characteres the tty driver will accept for queuing to be written. o return MTU */ static int cpc_tty_write_room(struct tty_struct *tty)
{ st_cpc_tty_area *cpc_tty; if (!tty || !tty->driver_data ) { CPC_TTY_DBG("hdlcX-tty: no TTY to write room\n"); return -ENODEV; } cpc_tty = (st_cpc_tty_area *) tty->driver_data; if ((cpc_tty->tty != tty) || (cpc_tty->state != CPC_TTY_ST_OPEN)) { CPC_TTY_DBG("%s: TTY is not opened\n",cpc_tty->name); ...
robutest/uclinux
C++
GPL-2.0
60
/* Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in WAKE_UP_DUR.. */
int32_t lsm6dso_wkup_threshold_set(lsm6dso_ctx_t *ctx, uint8_t val)
/* Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in WAKE_UP_DUR.. */ int32_t lsm6dso_wkup_threshold_set(lsm6dso_ctx_t *ctx, uint8_t val)
{ lsm6dso_wake_up_ths_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_THS, (uint8_t*)&reg, 1); if (ret == 0) { reg.wk_ths = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_WAKE_UP_THS, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* configure counter value, window value, and prescaler divider value */
void wwdgt_config(uint16_t counter, uint16_t window, uint32_t prescaler)
/* configure counter value, window value, and prescaler divider value */ void wwdgt_config(uint16_t counter, uint16_t window, uint32_t prescaler)
{ WWDGT_CTL = (uint32_t)(CTL_CNT(counter)); WWDGT_CFG = (uint32_t)(CFG_WIN(window) | prescaler); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if Receive overrun error interrupt is enabled @rmtoll IER RXOVRIE LL_SWPMI_IsEnabledIT_RXOVR. */
uint32_t LL_SWPMI_IsEnabledIT_RXOVR(SWPMI_TypeDef *SWPMIx)
/* Check if Receive overrun error interrupt is enabled @rmtoll IER RXOVRIE LL_SWPMI_IsEnabledIT_RXOVR. */ uint32_t LL_SWPMI_IsEnabledIT_RXOVR(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RXOVRIE) == (SWPMI_IER_RXOVRIE)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Enables the clock of a peripheral. The peripheral ID (AT91C_ID_xxx) is used to identify which peripheral is targetted. Note that the ID must NOT be shifted (i.e. 1 << AT91C_ID_xxx). */
void PMC_EnablePeripheral(unsigned int id)
/* Enables the clock of a peripheral. The peripheral ID (AT91C_ID_xxx) is used to identify which peripheral is targetted. Note that the ID must NOT be shifted (i.e. 1 << AT91C_ID_xxx). */ void PMC_EnablePeripheral(unsigned int id)
{ SANITY_CHECK(id < 32); if ((AT91C_BASE_PMC->PMC_PCSR & (1 << id)) == (1 << id)) { trace_LOG(trace_INFO, "-I- PMC_EnablePeripheral: clock of peripheral" " %u is already enabled\n\r", id); } else { AT91C_BASE_PMC->PMC_PCER = 1 << id; ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* gfs2_io_error_i - Flag an I/O error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */
int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file, unsigned int line)
/* gfs2_io_error_i - Flag an I/O error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file, unsigned int line)
{ int rv; rv = gfs2_lm_withdraw(sdp, "GFS2: fsid=%s: fatal: I/O error\n" "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", sdp->sd_fsname, sdp->sd_fsname, function, file, line); return rv; }
robutest/uclinux
C++
GPL-2.0
60
/* returns 1 if write is successful, 0 else. */
static int write_acpi_int(acpi_handle handle, const char *method, int val, struct acpi_buffer *output)
/* returns 1 if write is successful, 0 else. */ static int write_acpi_int(acpi_handle handle, const char *method, int val, struct acpi_buffer *output)
{ struct acpi_object_list params; union acpi_object in_obj; acpi_status status; params.count = 1; params.pointer = &in_obj; in_obj.type = ACPI_TYPE_INTEGER; in_obj.integer.value = val; status = acpi_evaluate_object(handle, (char *)method, &params, output); return (status == AE_OK); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: (transfer none): a list of icon names. */
const char* const* g_themed_icon_get_names(GThemedIcon *icon)
/* Returns: (transfer none): a list of icon names. */ const char* const* g_themed_icon_get_names(GThemedIcon *icon)
{ g_return_val_if_fail (G_IS_THEMED_ICON (icon), NULL); return (const char * const *)icon->names; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Lookup a swap entry in the swap cache. A found page will be returned unlocked and with its refcount incremented - we rely on the kernel lock getting page table operations atomic even if we drop the page lock before returning. */
struct page* lookup_swap_cache(swp_entry_t entry)
/* Lookup a swap entry in the swap cache. A found page will be returned unlocked and with its refcount incremented - we rely on the kernel lock getting page table operations atomic even if we drop the page lock before returning. */ struct page* lookup_swap_cache(swp_entry_t entry)
{ struct page *page; page = find_get_page(&swapper_space, entry.val); if (page) INC_CACHE_INFO(find_success); INC_CACHE_INFO(find_total); return page; }
robutest/uclinux
C++
GPL-2.0
60
/* Function to dispatch the correct function based on a function key (F1...) */
EFI_STATUS MenuBarDispatchFunctionKey(IN CONST EFI_INPUT_KEY *Key)
/* Function to dispatch the correct function based on a function key (F1...) */ EFI_STATUS MenuBarDispatchFunctionKey(IN CONST EFI_INPUT_KEY *Key)
{ UINTN Index; Index = Key->ScanCode - SCAN_F1; if (Index > (NumItems - 1)) { StatusBarSetStatusString (L"Unknown Command"); return EFI_SUCCESS; } return (MenuItems[Index].Function ()); }
tianocore/edk2
C++
Other
4,240
/* Allows use of a mempolicy for, e.g., multiple allocations with a single policy lookup, even if the policy needs/has extra ref on lookup. shmem_readahead needs this. */
struct mempolicy* __mpol_cond_copy(struct mempolicy *tompol, struct mempolicy *frompol)
/* Allows use of a mempolicy for, e.g., multiple allocations with a single policy lookup, even if the policy needs/has extra ref on lookup. shmem_readahead needs this. */ struct mempolicy* __mpol_cond_copy(struct mempolicy *tompol, struct mempolicy *frompol)
{ if (!mpol_needs_cond_ref(frompol)) return frompol; *tompol = *frompol; tompol->flags &= ~MPOL_F_SHARED; __mpol_put(frompol); return tompol; }
robutest/uclinux
C++
GPL-2.0
60
/* Return TRUE if ADDRESS points at a page in the kernel's mapped segment (inside region 5, on ia64) and that page is present. */
static int mapped_kernel_page_is_present(unsigned long address)
/* Return TRUE if ADDRESS points at a page in the kernel's mapped segment (inside region 5, on ia64) and that page is present. */ static int mapped_kernel_page_is_present(unsigned long address)
{ pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *ptep, pte; pgd = pgd_offset_k(address); if (pgd_none(*pgd) || pgd_bad(*pgd)) return 0; pud = pud_offset(pgd, address); if (pud_none(*pud) || pud_bad(*pud)) return 0; pmd = pmd_offset(pud, address); if (pmd_none(*pmd) || pmd_bad(*pmd)) return 0; ptep = pte_of...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Attach a free interrupt line to a GPIO. */
static int pintsel_attach(const struct gpio_lpc11u6x_shared *shared, uint8_t intpin)
/* Attach a free interrupt line to a GPIO. */ static int pintsel_attach(const struct gpio_lpc11u6x_shared *shared, uint8_t intpin)
{ uint8_t irq; int ret = -EBUSY; uint32_t *pintsel_reg = (uint32_t *) (shared->syscon_base + LPC11U6X_PINTSEL_REGS); for (irq = 0; irq < shared->nirqs; irq++) { if ((pintsel_reg[irq] & BIT_MASK(5)) == intpin) { return irq; } if (ret < 0 && (pintsel_reg[irq] & BIT_MASK(5)) == 0) { ret = irq; } } if...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns 0 on success or a negative error code. */
int __rtnl_link_register(struct rtnl_link_ops *ops)
/* Returns 0 on success or a negative error code. */ int __rtnl_link_register(struct rtnl_link_ops *ops)
{ if (!ops->dellink) ops->dellink = unregister_netdevice_queue; list_add_tail(&ops->list, &link_ops); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable a module clock derived from the PBB clock. */
void sysclk_enable_pbb_module(unsigned int index)
/* Enable a module clock derived from the PBB clock. */ void sysclk_enable_pbb_module(unsigned int index)
{ irqflags_t flags; flags = cpu_irq_save(); if (!sysclk_pbb_refcount) sysclk_enable_hsb_module(SYSCLK_PBB_BRIDGE); sysclk_pbb_refcount++; cpu_irq_restore(flags); sysclk_priv_enable_module(AVR32_PM_CLK_GRP_PBB, index); }
memfault/zero-to-main
C++
null
200
/* No need to worry about fullstop here, since this one doesn't reference volatile state or register callbacks. */
static int rcu_torture_stats(void *arg)
/* No need to worry about fullstop here, since this one doesn't reference volatile state or register callbacks. */ static int rcu_torture_stats(void *arg)
{ VERBOSE_PRINTK_STRING("rcu_torture_stats task started"); do { schedule_timeout_interruptible(stat_interval * HZ); rcu_torture_stats_print(); rcutorture_shutdown_absorb("rcu_torture_stats"); } while (!kthread_should_stop()); VERBOSE_PRINTK_STRING("rcu_torture_stats task stopping"); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Important notice: handling of individual fields MUST be kept in sync with include/asm-arm/u-boot.h and include/asm-arm/global_data.h, so any changes need to reflect their current state and layout of structures involved! */
int platform_sys_info(struct sys_info *si)
/* Important notice: handling of individual fields MUST be kept in sync with include/asm-arm/u-boot.h and include/asm-arm/global_data.h, so any changes need to reflect their current state and layout of structures involved! */ int platform_sys_info(struct sys_info *si)
{ int i; for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) platform_set_mr(si, gd->bd->bi_dram[i].start, gd->bd->bi_dram[i].size, MR_ATTR_DRAM); return 1; }
EmcraftSystems/u-boot
C++
Other
181
/* Checks whether the specified USART flag is set or not. */
FlagStatus USART_GetFlagStatus(USART_Module *USARTx, uint16_t USART_FLAG)
/* Checks whether the specified USART flag is set or not. */ FlagStatus USART_GetFlagStatus(USART_Module *USARTx, uint16_t USART_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_USART_FLAG(USART_FLAG)); if (USART_FLAG == USART_FLAG_CTSF) { assert_param(IS_USART_123_PERIPH(USARTx)); } if ((USARTx->STS & USART_FLAG) != (uint16_t)RESET) { bitstatus = SET; ...
pikasTech/PikaPython
C++
MIT License
1,403
/* Caller passes in a qp_attr pointer - don't waste stack spacv by allocation this twice. */
static void rds_ib_tune_rnr(struct rds_ib_connection *ic, struct ib_qp_attr *attr)
/* Caller passes in a qp_attr pointer - don't waste stack spacv by allocation this twice. */ static void rds_ib_tune_rnr(struct rds_ib_connection *ic, struct ib_qp_attr *attr)
{ int ret; attr->min_rnr_timer = IB_RNR_TIMER_000_32; ret = ib_modify_qp(ic->i_cm_id->qp, attr, IB_QP_MIN_RNR_TIMER); if (ret) printk(KERN_NOTICE "ib_modify_qp(IB_QP_MIN_RNR_TIMER): err=%d\n", -ret); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Like is_allocated_sectors, but if the buffer starts with a used sector, up to 'min' consecutive sectors containing zeros are ignored. This avoids breaking up write requests for only small sparse areas. */
static int is_allocated_sectors_min(const uint8_t *buf, int n, int *pnum, int min)
/* Like is_allocated_sectors, but if the buffer starts with a used sector, up to 'min' consecutive sectors containing zeros are ignored. This avoids breaking up write requests for only small sparse areas. */ static int is_allocated_sectors_min(const uint8_t *buf, int n, int *pnum, int min)
{ int ret; int num_checked, num_used; if (n < min) { min = n; } ret = is_allocated_sectors(buf, n, pnum); if (!ret) { return ret; } num_used = *pnum; buf += BDRV_SECTOR_SIZE * *pnum; n -= *pnum; num_checked = num_used; while (n > 0) { ret = is_allo...
ve3wwg/teensy3_qemu
C
Other
15
/* param base AIPSTZ peripheral base pointer param master Peripheral for AIPSTZ. param accessControl Configuration is ORed from aipstz_peripheral_access_control_t. */
void AIPSTZ_SetPeripheralAccessControl(AIPSTZ_Type *base, aipstz_peripheral_t peripheral, uint32_t accessControl)
/* param base AIPSTZ peripheral base pointer param master Peripheral for AIPSTZ. param accessControl Configuration is ORed from aipstz_peripheral_access_control_t. */ void AIPSTZ_SetPeripheralAccessControl(AIPSTZ_Type *base, aipstz_peripheral_t peripheral, uint32_t accessControl)
{ volatile uint32_t *reg = (uint32_t *)((uint32_t)base + ((uint32_t)peripheral >> 16U)); uint32_t mask = (((uint32_t)peripheral & 0xFF00U) >> 8U) - 1U; uint32_t shift = (uint32_t)peripheral & 0xFFU; *reg = (*reg & (~(mask << shift))) | ((accessControl & mask) << shift); }
eclipse-threadx/getting-started
C++
Other
310
/* Split a vma into two pieces at address 'addr', a new vma is allocated either for the first part or the tail. */
int split_vma(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, int new_below)
/* Split a vma into two pieces at address 'addr', a new vma is allocated either for the first part or the tail. */ int split_vma(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, int new_below)
{ if (mm->map_count >= sysctl_max_map_count) return -ENOMEM; return __split_vma(mm, vma, addr, new_below); }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the status of a job. Gets the status of an ongoing or the last job. */
enum status_code trng_get_job_status(struct trng_module *module_inst, enum trng_job_type type)
/* Gets the status of a job. Gets the status of an ongoing or the last job. */ enum status_code trng_get_job_status(struct trng_module *module_inst, enum trng_job_type type)
{ Assert(module_inst); if (type == TRNG_JOB_READ_BUFFER) { return module_inst->job_status; } else { return STATUS_ERR_INVALID_ARG; } }
memfault/zero-to-main
C++
null
200
/* Write a word (16 bits) to a memory location after the value has been byte swapped (big to little endian or vice versa) */
void mpc824x_mpc107_write16(unsigned int address, unsigned short data)
/* Write a word (16 bits) to a memory location after the value has been byte swapped (big to little endian or vice versa) */ void mpc824x_mpc107_write16(unsigned int address, unsigned short data)
{ *(volatile unsigned short *) address = BYTE_SWAP_16_BIT (data); __asm__ ("sync"); }
EmcraftSystems/u-boot
C++
Other
181
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
UINT32 EFIAPI S3IoWrite32(IN UINTN Port, IN UINT32 Value)
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ UINT32 EFIAPI S3IoWrite32(IN UINTN Port, IN UINT32 Value)
{ return InternalSaveIoWrite32ValueToBootScript (Port, IoWrite32 (Port, Value)); }
tianocore/edk2
C++
Other
4,240
/* Unregister all ccw devices that are offline and on the blacklist. */
int ccw_purge_blacklisted(void)
/* Unregister all ccw devices that are offline and on the blacklist. */ int ccw_purge_blacklisted(void)
{ CIO_MSG_EVENT(2, "ccw: purging blacklisted devices\n"); bus_for_each_dev(&ccw_bus_type, NULL, NULL, purge_fn); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns the current setting for GPIO retention in the hibernate module. */
bool HibernateGPIORetentionGet(void)
/* This function returns the current setting for GPIO retention in the hibernate module. */ bool HibernateGPIORetentionGet(void)
{ if ((HWREG(HIB_CTL) & (HIB_CTL_RETCLR | HIB_CTL_VDD3ON)) == (HIB_CTL_RETCLR | HIB_CTL_VDD3ON)) { return (true); } return (false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: 0 on successful update, error code otherwise */
static int gfs2_ri_update(struct gfs2_inode *ip)
/* Returns: 0 on successful update, error code otherwise */ static int gfs2_ri_update(struct gfs2_inode *ip)
{ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct inode *inode = &ip->i_inode; struct file_ra_state ra_state; u64 rgrp_count = ip->i_disksize; int error; do_div(rgrp_count, sizeof(struct gfs2_rindex)); clear_rgrpdi(sdp); file_ra_state_init(&ra_state, inode->i_mapping); for (sdp->sd_rgrps = 0; sdp->sd_rgrp...
robutest/uclinux
C++
GPL-2.0
60
/* Read corresponds to send data from memory to device */
int XAxiVdma_StartReadFrame(XAxiVdma *InstancePtr, XAxiVdma_DmaSetup *DmaConfigPtr)
/* Read corresponds to send data from memory to device */ int XAxiVdma_StartReadFrame(XAxiVdma *InstancePtr, XAxiVdma_DmaSetup *DmaConfigPtr)
{ XAxiVdma_Channel *Channel; Channel = XAxiVdma_GetChannel(InstancePtr, XAXIVDMA_READ); if (Channel->IsValid) { return XAxiVdma_ChannelStartTransfer(Channel, (XAxiVdma_ChannelSetup *)DmaConfigPtr); } else { return XST_DEVICE_NOT_FOUND; } }
ua1arn/hftrx
C++
null
69
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClrStallEP(U32 EPNum)
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ClrStallEP(U32 EPNum)
{ U32 *ptr; ptr = GetEpCmdStatPtr(EPNum); if (EPNum & 0x80) { *ptr &= ~EP_STALL; } else { *ptr &= ~EP_STALL; *ptr |= BUF_ACTIVE; } USBD_ResetEP(EPNum); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Future: use high four bits of block for coalesce-on-delete flags Mask them off for now. */
static ext4_lblk_t dx_get_block(struct dx_entry *entry)
/* Future: use high four bits of block for coalesce-on-delete flags Mask them off for now. */ static ext4_lblk_t dx_get_block(struct dx_entry *entry)
{ return le32_to_cpu(entry->block) & 0x00ffffff; }
robutest/uclinux
C++
GPL-2.0
60
/* In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. */
VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
/* In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. */ VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
{ UINT16 *Buffer16; Buffer16 = (UINT16 *)Buffer; while (Count-- > 0) { IoWrite16 (Port, *Buffer16++); } }
tianocore/edk2
C++
Other
4,240
/* Clear the wake-up inputs for fast startup mode registers (remove event generation). */
void pmc_clr_fast_startup_input(uint32_t ul_inputs)
/* Clear the wake-up inputs for fast startup mode registers (remove event generation). */ void pmc_clr_fast_startup_input(uint32_t ul_inputs)
{ ul_inputs &= PMC_FAST_STARTUP_Msk; PMC->PMC_FSMR &= ~ul_inputs; }
remotemcu/remcu-chip-sdks
C++
null
436
/* check whether the @pc is valid for moving account and call __mem_cgroup_move_account() */
static int mem_cgroup_move_account(struct page_cgroup *pc, struct mem_cgroup *from, struct mem_cgroup *to)
/* check whether the @pc is valid for moving account and call __mem_cgroup_move_account() */ static int mem_cgroup_move_account(struct page_cgroup *pc, struct mem_cgroup *from, struct mem_cgroup *to)
{ int ret = -EINVAL; lock_page_cgroup(pc); if (PageCgroupUsed(pc) && pc->mem_cgroup == from) { __mem_cgroup_move_account(pc, from, to); ret = 0; } unlock_page_cgroup(pc); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* set the SSL if we can read as many as data */
void SSL_set_read_ahead(SSL *ssl, int yes)
/* set the SSL if we can read as many as data */ void SSL_set_read_ahead(SSL *ssl, int yes)
{ SSL_ASSERT3(ssl); ssl->rlayer.read_ahead = yes; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Sets the designated bits in a 16/32-bit data word at a local CPU system address */
void IPCRtoLSetBits(tIpcMessage *psMessage)
/* Sets the designated bits in a 16/32-bit data word at a local CPU system address */ void IPCRtoLSetBits(tIpcMessage *psMessage)
{ uint16_t usLength; usLength = (uint16_t)psMessage->uldataw1; if (usLength == IPC_LENGTH_16_BITS) { *(volatile uint16_t*)psMessage->uladdress |= (uint16_t) psMessage->uldataw2; } else if (usLength == IPC_LENGTH_32_BITS) { *(vol...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Cleans up open file handle and state when upload is finished. */
static void fs_mgmt_upload_download_finish_check(void)
/* Cleans up open file handle and state when upload is finished. */ static void fs_mgmt_upload_download_finish_check(void)
{ if (fs_mgmt_ctxt.len > 0 && fs_mgmt_ctxt.off >= fs_mgmt_ctxt.len) { k_work_cancel_delayable(&fs_mgmt_ctxt.file_close_work); fs_mgmt_cleanup(); } else { k_work_reschedule(&fs_mgmt_ctxt.file_close_work, FILE_CLOSE_IDLE_TIME); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Load DMA cycle times into the chip ready for a DMA transfer to occur. */
static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *adev)
/* Load DMA cycle times into the chip ready for a DMA transfer to occur. */ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *adev)
{ struct pci_dev *pdev = to_pci_dev(ap->host->dev); static u16 dma_timing[3] = { 0x707, 0x201, 0x200 }; u16 dummy; int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno); int dma = adev->dma_mode - XFER_MW_DMA_0; pci_write_config_word(pdev, timing, dma_timing[dma]); pci_read_config_word(pdev, timing, &dumm...
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base Pointer to the FLEXIO_SPI_Type structure. param baudRate_Bps Baud Rate needed in Hz. param srcClockHz SPI source clock frequency in Hz. */
void FLEXIO_SPI_MasterSetBaudRate(FLEXIO_SPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClockHz)
/* param base Pointer to the FLEXIO_SPI_Type structure. param baudRate_Bps Baud Rate needed in Hz. param srcClockHz SPI source clock frequency in Hz. */ void FLEXIO_SPI_MasterSetBaudRate(FLEXIO_SPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClockHz)
{ uint16_t timerDiv = 0; uint16_t timerCmp = 0; FLEXIO_Type *flexioBase = base->flexioBase; timerDiv = srcClockHz / baudRate_Bps; timerDiv = timerDiv / 2 - 1U; timerCmp = flexioBase->TIMCMP[base->timerIndex[0]]; timerCmp &= 0xFF00U; timerCmp |= timerDiv; flexioBase->TIMCM...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each EXTI_InitStruct member with its reset value. */
void EXTI_StructInit(EXTI_InitTypeDef *EXTI_InitStruct)
/* Fills each EXTI_InitStruct member with its reset value. */ void EXTI_StructInit(EXTI_InitTypeDef *EXTI_InitStruct)
{ EXTI_InitStruct->EXTI_Line = EXTI_LINENONE; EXTI_InitStruct->EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStruct->EXTI_Trigger = EXTI_Trigger_Rising_Falling; EXTI_InitStruct->EXTI_LineCmd = DISABLE; }
ajhc/demo-cortex-m3
C++
null
38
/* Set the full display drawing limits. Use this function to set the full drawing limit box. */
void ili93xx_set_limits(ili93xx_coord_t start_x, ili93xx_coord_t start_y, ili93xx_coord_t end_x, ili93xx_coord_t end_y)
/* Set the full display drawing limits. Use this function to set the full drawing limit box. */ void ili93xx_set_limits(ili93xx_coord_t start_x, ili93xx_coord_t start_y, ili93xx_coord_t end_x, ili93xx_coord_t end_y)
{ limit_start_x = start_x; limit_start_y = start_y; limit_end_x = end_x; limit_end_y = end_y; ili93xx_send_draw_limits(true); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info. */
FORM_BROWSER_STATEMENT* GetBrowserStatement(IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement)
/* Get FORM_BROWSER_STATEMENT from FORM_DISPLAY_ENGINE_STATEMENT based on the OpCode info. */ FORM_BROWSER_STATEMENT* GetBrowserStatement(IN FORM_DISPLAY_ENGINE_STATEMENT *DisplayStatement)
{ FORM_BROWSER_STATEMENT *Statement; LIST_ENTRY *Link; Link = GetFirstNode (&gCurrentSelection->Form->StatementListHead); while (!IsNull (&gCurrentSelection->Form->StatementListHead, Link)) { Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link); if (Statement->OpCode == DisplayStatement->Op...
tianocore/edk2
C++
Other
4,240
/* This function authenticates image with asymmetric cryptography. The NBOOT context has to be initialized by the function nboot_context_init before calling this function. */
nboot_status_protected_t NBOOT_ImgAuthenticateEcdsa(nboot_context_t *context, uint8_t imageStartAddress[], nboot_bool_t *isSignatureVerified, nboot_img_auth_ecdsa_parms_t *parms)
/* This function authenticates image with asymmetric cryptography. The NBOOT context has to be initialized by the function nboot_context_init before calling this function. */ nboot_status_protected_t NBOOT_ImgAuthenticateEcdsa(nboot_context_t *context, uint8_t imageStartAddress[], nboot_bool_t *isSignatureVerified, nb...
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->nbootDriver->nboot_img_authenticate_ecdsa(context, imageStartAddress, isSignatureVerified, parms); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handles I2Cx communication when starting transfer or during transfer. */
void I2C_HandlingTransfer(I2C_T *i2c, uint16_t address, uint8_t number, I2C_RELOAD_MODE_T reloadend, I2C_GENERATE_T generates)
/* Handles I2Cx communication when starting transfer or during transfer. */ void I2C_HandlingTransfer(I2C_T *i2c, uint16_t address, uint8_t number, I2C_RELOAD_MODE_T reloadend, I2C_GENERATE_T generates)
{ uint32_t temp = 0; temp = i2c->CTRL2; temp &= (uint32_t)~((uint32_t)(I2C_CTRL2_SADD | I2C_CTRL2_NUMBYT | I2C_CTRL2_MASK)); temp |= (uint32_t)(((uint32_t)address & I2C_CTRL2_SADD) | (((uint32_t)number << 16) & I2C_CTRL2_NUMBYT) | \ (uint32_t)reloadend | (uint32_t)generates); ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* megasas_shutdown - Shutdown entry point @device: Generic device structure */
static void megasas_shutdown(struct pci_dev *pdev)
/* megasas_shutdown - Shutdown entry point @device: Generic device structure */ static void megasas_shutdown(struct pci_dev *pdev)
{ struct megasas_instance *instance = pci_get_drvdata(pdev); instance->unload = 1; megasas_flush_cache(instance); megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); }
robutest/uclinux
C++
GPL-2.0
60
/* Load dummy page to descriptor registers. This prevents generating of spurious interrupts. (execute only with vino_lock locked) */
static void vino_clear_interrupt(struct vino_channel_settings *vcs)
/* Load dummy page to descriptor registers. This prevents generating of spurious interrupts. (execute only with vino_lock locked) */ static void vino_clear_interrupt(struct vino_channel_settings *vcs)
{ struct sgi_vino_channel *ch; ch = (vcs->channel == VINO_CHANNEL_A) ? &vino->a : &vino->b; ch->page_index = 0; ch->line_count = 0; ch->start_desc_tbl = vino_drvdata->dummy_desc_table.dma; ch->next_4_desc = vino_drvdata->dummy_desc_table.dma; udelay(VINO_DESC_FETCH_DELAY); dprintk("channel %c clear interrupt co...
robutest/uclinux
C++
GPL-2.0
60
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). */
VOID* EFIAPI SetMem32(OUT VOID *Buffer, IN UINTN Length, IN UINT32 Value)
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). */ VOID* EFIAPI SetMem32(OUT VOID *Buffer, IN UINTN Length, IN UINT32 Value...
{ if (Length == 0) { return Buffer; } ASSERT (Buffer != NULL); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); ASSERT ((Length & (sizeof (Value) - 1)) == 0); return InternalMemSetMem32 (Buffer, Length / sizeof (Value), Value); }
tianocore/edk2
C++
Other
4,240
/* This function enables programming of the powerdown temperature for the OverTemp signal in the OT Powerdown register. */
void XAdcPs_EnableUserOverTemp(XAdcPs *InstancePtr)
/* This function enables programming of the powerdown temperature for the OverTemp signal in the OT Powerdown register. */ void XAdcPs_EnableUserOverTemp(XAdcPs *InstancePtr)
{ u16 OtUpper; Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); OtUpper = (u16)(XAdcPs_ReadInternalReg(InstancePtr, XADCPS_ATR_OT_UPPER_OFFSET)); OtUpper &= ~((u16)XADCPS_ATR_OT_UPPER_ENB_MASK); OtUpper |= XADCPS_ATR_OT_UPPER_ENB_VAL; XAdcPs_WriteIn...
ua1arn/hftrx
C++
null
69
/* Write a byte to the PS2 port. We have to wait for the port to indicate that the transmitter is empty. */
static int ps2_write(struct serio *io, unsigned char val)
/* Write a byte to the PS2 port. We have to wait for the port to indicate that the transmitter is empty. */ static int ps2_write(struct serio *io, unsigned char val)
{ struct ps2if *ps2if = io->port_data; unsigned long flags; unsigned int head; spin_lock_irqsave(&ps2if->lock, flags); if (sa1111_readl(ps2if->base + SA1111_PS2STAT) & PS2STAT_TXE) { sa1111_writel(val, ps2if->base + SA1111_PS2DATA); } else { if (ps2if->head == ps2if->tail) enable_irq(ps2if->dev->irq[1]); ...
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to return if the provided JSON value contains a TRUE value. */
BOOLEAN EFIAPI JsonValueIsTrue(IN EDKII_JSON_VALUE Json)
/* The function is used to return if the provided JSON value contains a TRUE value. */ BOOLEAN EFIAPI JsonValueIsTrue(IN EDKII_JSON_VALUE Json)
{ if (json_is_true ((json_t *)Json)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Weight of 1 LSB of wakeup threshold. 0: 1 LSB =FS_XL / 64 1: 1 LSB = FS_XL / 256. */
int32_t lsm6dso_wkup_ths_weight_get(lsm6dso_ctx_t *ctx, lsm6dso_wake_ths_w_t *val)
/* Weight of 1 LSB of wakeup threshold. 0: 1 LSB =FS_XL / 64 1: 1 LSB = FS_XL / 256. */ int32_t lsm6dso_wkup_ths_weight_get(lsm6dso_ctx_t *ctx, lsm6dso_wake_ths_w_t *val)
{ lsm6dso_wake_up_dur_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&reg, 1); switch (reg.wake_ths_w) { case LSM6DSO_LSb_FS_DIV_64: *val = LSM6DSO_LSb_FS_DIV_64; break; case LSM6DSO_LSb_FS_DIV_256: *val = LSM6DSO_LSb_FS_DIV_256; break; default...
alexander-g-dean/ESF
C++
null
41
/* Set the PLL clock divisor (from 400MHz) USERCC2 must have been set by a call to */
void rcc_set_pll_divisor(uint8_t div400)
/* Set the PLL clock divisor (from 400MHz) USERCC2 must have been set by a call to */ void rcc_set_pll_divisor(uint8_t div400)
{ uint32_t reg32; SYSCTL_RCC |= SYSCTL_RCC_USESYSDIV; reg32 = SYSCTL_RCC2; reg32 &= ~SYSCTL_RCC2_SYSDIV400_MASK; reg32 |= ((div400 - 1) << 22) & SYSCTL_RCC2_SYSDIV400_MASK; reg32 |= SYSCTL_RCC2_DIV400; SYSCTL_RCC2 = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This routine is called when a Clear Request is needed outside of the context of a connected socket. */
void x25_transmit_clear_request(struct x25_neigh *nb, unsigned int lci, unsigned char cause)
/* This routine is called when a Clear Request is needed outside of the context of a connected socket. */ void x25_transmit_clear_request(struct x25_neigh *nb, unsigned int lci, unsigned char cause)
{ unsigned char *dptr; int len = X25_MAX_L2_LEN + X25_STD_MIN_LEN + 2; struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC); if (!skb) return; skb_reserve(skb, X25_MAX_L2_LEN); dptr = skb_put(skb, X25_STD_MIN_LEN + 2); *dptr++ = ((lci >> 8) & 0x0F) | (nb->extended ? X25_GFI_EXTSEQ : X25_GFI_STDSEQ); *...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Like smp_call_function_single(), but allow caller to pass in a pre-allocated data structure. Useful for embedding @data inside other structures, for instance. */
void __smp_call_function_single(int cpu, struct call_single_data *data, int wait)
/* Like smp_call_function_single(), but allow caller to pass in a pre-allocated data structure. Useful for embedding @data inside other structures, for instance. */ void __smp_call_function_single(int cpu, struct call_single_data *data, int wait)
{ csd_lock(data); WARN_ON_ONCE(cpu_online(smp_processor_id()) && wait && irqs_disabled() && !oops_in_progress); generic_exec_single(cpu, data, wait); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set CNTP_CTL This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL). param value: CNTP_CTL Register value to set */
static void __set_cntp_ctl(rt_uint32_t value)
/* Set CNTP_CTL This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL). param value: CNTP_CTL Register value to set */ static void __set_cntp_ctl(rt_uint32_t value)
{ __set_cp(15, 0, value, 14, 2, 1); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function to find the file name associated with a LoadedImageProtocol. */
CHAR16* FindLoadedImageFileName(IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage)
/* Function to find the file name associated with a LoadedImageProtocol. */ CHAR16* FindLoadedImageFileName(IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage)
{ EFI_GUID *NameGuid; EFI_STATUS Status; EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; VOID *Buffer; UINTN BufferSize; UINT32 AuthenticationStatus; if ((LoadedImage == NULL) || (LoadedImage->FilePath...
tianocore/edk2
C++
Other
4,240
/* Transform 8x8 block of data with a double precision forward DCT */
void ff_ref_fdct(short *block)
/* Transform 8x8 block of data with a double precision forward DCT */ void ff_ref_fdct(short *block)
{ unsigned int i, j, k; double out[8 * 8]; for (i = 0; i < 64; i += 8) { for (j = 0; j < 8; ++j) { double tmp = 0; for (k = 0; k < 8; ++k) { tmp += coefficients[i + k] * block[k * 8 + j]; } out[i + j] = tmp * 8; } } for ...
DC-SWAT/DreamShell
C++
null
404
/* Description: Removes/resets the default entry for the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Returns zero on success, non-zero on failure. */
int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info)
/* Description: Removes/resets the default entry for the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Returns zero on success, non-zero on failure. */ int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info)
{ return netlbl_domhsh_remove(NULL, audit_info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* access 16bit words to the code or data regions of the dsp's memory. index addresses 16bit words. */
static u16 snd_m3_assp_read(struct snd_m3 *chip, u16 region, u16 index)
/* access 16bit words to the code or data regions of the dsp's memory. index addresses 16bit words. */ static u16 snd_m3_assp_read(struct snd_m3 *chip, u16 region, u16 index)
{ snd_m3_outw(chip, region & MEMTYPE_MASK, DSP_PORT_MEMORY_TYPE); snd_m3_outw(chip, index, DSP_PORT_MEMORY_INDEX); return snd_m3_inw(chip, DSP_PORT_MEMORY_DATA); }
robutest/uclinux
C++
GPL-2.0
60
/* This service enables PEIMs to discover sections of a given type within a valid FFS file. */
EFI_STATUS EFIAPI PeiServicesFfsFindSectionData(IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
/* This service enables PEIMs to discover sections of a given type within a valid FFS file. */ EFI_STATUS EFIAPI PeiServicesFfsFindSectionData(IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
{ CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FileHandle, SectionData); }
tianocore/edk2
C++
Other
4,240
/* Get ASCII format string exception name by exception type. */
STATIC CONST CHAR8* GetExceptionNameStr(IN EFI_EXCEPTION_TYPE ExceptionType)
/* Get ASCII format string exception name by exception type. */ STATIC CONST CHAR8* GetExceptionNameStr(IN EFI_EXCEPTION_TYPE ExceptionType)
{ if (EXCEPT_RISCV_IS_IRQ (ExceptionType)) { if (EXCEPT_RISCV_IRQ_INDEX (ExceptionType) > EXCEPT_RISCV_MAX_IRQS) { return mExceptionOrIrqUnknown; } return mIrqNameStr[EXCEPT_RISCV_IRQ_INDEX (ExceptionType)]; } if (ExceptionType > EXCEPT_RISCV_MAX_EXCEPTIONS) { return mExceptionOrIrqUnknown; ...
tianocore/edk2
C++
Other
4,240
/* We need to convert the system time value stored in the RX/TXSTMP registers into a hwtstamp which can be used by the upper level timestamping functions */
static void igb_systim_to_hwtstamp(struct igb_adapter *adapter, struct skb_shared_hwtstamps *shhwtstamps, u64 regval)
/* We need to convert the system time value stored in the RX/TXSTMP registers into a hwtstamp which can be used by the upper level timestamping functions */ static void igb_systim_to_hwtstamp(struct igb_adapter *adapter, struct skb_shared_hwtstamps *shhwtstamps, u64 regval)
{ u64 ns; if (adapter->hw.mac.type == e1000_82580) regval <<= IGB_82580_TSYNC_SHIFT; ns = timecounter_cyc2time(&adapter->clock, regval); timecompare_update(&adapter->compare, ns); memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); shhwtstamps->hwtstamp = ns_to_ktime(ns); shhwtstamps->syststamp = time...
robutest/uclinux
C++
GPL-2.0
60
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */
void PWMA_CMP0_IRQHandler(void)
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */ void PWMA_CMP0_IRQHandler(void)
{ PWM_HAL_ClearCmpFlags(g_pwmBase[0], 0U, 0x3fU); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Restart the card from scratch, as if from a cold-boot. */
static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
/* Restart the card from scratch, as if from a cold-boot. */ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
{ struct net_device *dev = pci_get_drvdata(pdev); struct bnx2x *bp = netdev_priv(dev); rtnl_lock(); if (pci_enable_device(pdev)) { dev_err(&pdev->dev, "Cannot re-enable PCI device after reset\n"); rtnl_unlock(); return PCI_ERS_RESULT_DISCONNECT; } pci_set_master(pdev); pci_restore_state(pdev); if (neti...
robutest/uclinux
C++
GPL-2.0
60
/* Return milliseconds of random delay, up to "secs" seconds. */
static unsigned random_delay_ms(unsigned secs)
/* Return milliseconds of random delay, up to "secs" seconds. */ static unsigned random_delay_ms(unsigned secs)
{ return rand_r(&seed) % (secs * 1000); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Look for a particular board name in the EISA configuration space */
static int EISA_signature(char *name, struct device *device)
/* Look for a particular board name in the EISA configuration space */ static int EISA_signature(char *name, struct device *device)
{ int i, status = 0, siglen = ARRAY_SIZE(de4x5_signatures); struct eisa_device *edev; *name = '\0'; edev = to_eisa_device (device); i = edev->id.driver_data; if (i >= 0 && i < siglen) { strcpy (name, de4x5_signatures[i]); status = 1; } return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_set_cur_pos(CRInput *a_this, CRInputPos *a_pos)
/* Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_set_cur_pos(CRInput *a_this, CRInputPos *a_pos)
{ g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos, CR_BAD_PARAM_ERROR); cr_input_set_column_num (a_this, a_pos->col); cr_input_set_line_num (a_this, a_pos->line); cr_input_set_cur_index (a_this, a_pos->next_byte_index); cr_input_set_end_of_...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxFull(unsigned long ulBase)
/* Check the status of the Tx buffer of the specified SPI port. */ xtBoolean SPIIsTxFull(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_FULL)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* NOTE: this function does not set the LL data pdu header nor does it set the opcode in the buffer. */
static void ble_ll_ctrl_datalen_upd_make(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
/* NOTE: this function does not set the LL data pdu header nor does it set the opcode in the buffer. */ static void ble_ll_ctrl_datalen_upd_make(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
{ put_le16(dptr + 1, connsm->max_rx_octets); put_le16(dptr + 3, connsm->max_rx_time); put_le16(dptr + 5, connsm->max_tx_octets); put_le16(dptr + 7, connsm->max_tx_time); }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* USART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_USART_MspDeInit(USART_HandleTypeDef *husart)
/* USART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_USART_MspDeInit(USART_HandleTypeDef *husart)
{ if(husart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This will set the gpio bit specified to the desired value. It will set the gpio pin low if value is 0 otherwise it will be high. */
static void msp71xx_exd_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
/* This will set the gpio bit specified to the desired value. It will set the gpio pin low if value is 0 otherwise it will be high. */ static void msp71xx_exd_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ struct msp71xx_exd_gpio_chip *msp71xx_chip = to_msp71xx_exd_gpio_chip(chip); const unsigned bit = MSP71XX_DATA_OFFSET(offset); __raw_writel(1 << (bit + (value ? 1 : 0)), msp71xx_chip->reg); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function allocates an aligned buffer for the SCSI disk to perform SCSI IO operations. The alignment requirement is from SCSI IO interface. */
VOID* AllocateAlignedBuffer(IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINTN BufferSize)
/* This function allocates an aligned buffer for the SCSI disk to perform SCSI IO operations. The alignment requirement is from SCSI IO interface. */ VOID* AllocateAlignedBuffer(IN SCSI_DISK_DEV *ScsiDiskDevice, IN UINTN BufferSize)
{ return AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), ScsiDiskDevice->ScsiIo->IoAlign); }
tianocore/edk2
C++
Other
4,240
/* Programs a word at a specified address in data memory without erase. */
FLASH_Status DATA_EEPROM_ProgramWord(uint32_t Address, uint32_t Data)
/* Programs a word at a specified address in data memory without erase. */ FLASH_Status DATA_EEPROM_ProgramWord(uint32_t Address, uint32_t Data)
{ FLASH_Status status = FLASH_COMPLETE; assert_param(IS_FLASH_DATA_ADDRESS(Address)); status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT); if(status == FLASH_COMPLETE) { *(__IO uint32_t *)Address = Data; status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT); } return status; }
avem-labs/Avem
C++
MIT License
1,752
/* A move is what happens when you rename a file in a directory, and a new name is unique, i.e. you didnt overwrite any existing files with this one. */
static int dl_detect_moves(dep_list **removed, dep_list **added, const traverse_cbs *cbs, void *udata)
/* A move is what happens when you rename a file in a directory, and a new name is unique, i.e. you didnt overwrite any existing files with this one. */ static int dl_detect_moves(dep_list **removed, dep_list **added, const traverse_cbs *cbs, void *udata)
{ assert (cbs != NULL); EXCLUDE_SIMILAR (removed, added, (removed_iter->inode == added_iter->inode), { cb_invoke (cbs, moved, udata, removed_iter->path, removed_iter->inode, added_iter->path, added_iter->inode); });...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Parse motor codes, directions and enable motors accordingly. */
static StepEventFlag_t setup_axis()
/* Parse motor codes, directions and enable motors accordingly. */ static StepEventFlag_t setup_axis()
{ const char axis_code = axis_codes[i]; if (parser.seen(axis_code)) { stepper_microsteps((AxisEnum)i, 128); axis_flag |= (StepEventFlag::STEP_EVENT_FLAG_STEP_X << i); if (parser.seenval(axis_code) && (-1 == (parser.value_long()))) { axis_flag |= (StepE...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Initializes the TIM5/TIMM05 device, include TIM5/TIMM05 registers and function. */
void pwmout_timer5_init(pwmout_t *obj)
/* Initializes the TIM5/TIMM05 device, include TIM5/TIMM05 registers and function. */ void pwmout_timer5_init(pwmout_t *obj)
{ RTIM_TimeBaseInitTypeDef TIM_InitStruct; RTIM_TimeBaseStructInit(&TIM_InitStruct); TIM_InitStruct.TIM_Idx = PWM_TIMER; RTIM_TimeBaseInit(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], &TIM_InitStruct, TIMER5_IRQ, NULL, (u32)&TIM_InitStruct); RTIM_Cmd(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], ENABLE); if (o...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Read from the user flash. Reads words from the 0.5k user flash area. Must be performed only when the system clock is 18Mhz. */
uint32_t flash_read(uint32_t *src, uint32_t *dest, uint8_t cnt)
/* Read from the user flash. Reads words from the 0.5k user flash area. Must be performed only when the system clock is 18Mhz. */ uint32_t flash_read(uint32_t *src, uint32_t *dest, uint8_t cnt)
{ return iap_write_read(src, dest, cnt, 0); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* looks up the dentry of the parent directory for child. taken from ext2_get_parent */
struct dentry* reiserfs_get_parent(struct dentry *child)
/* looks up the dentry of the parent directory for child. taken from ext2_get_parent */ struct dentry* reiserfs_get_parent(struct dentry *child)
{ int retval; struct inode *inode = NULL; struct reiserfs_dir_entry de; INITIALIZE_PATH(path_to_entry); struct inode *dir = child->d_inode; if (dir->i_nlink == 0) { return ERR_PTR(-ENOENT); } de.de_gen_number_bit_string = NULL; reiserfs_write_lock(dir->i_sb); retval = reiserfs_find_entry(dir, "..", 2, &path...
robutest/uclinux
C++
GPL-2.0
60
/* The register selects a DWORD (32 bit) register offset. Hence it doesn't get shifted by 2 bits as we want to "drop" the bottom two bits. */
static int mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where, unsigned long *pci_addr, unsigned char *type1)
/* The register selects a DWORD (32 bit) register offset. Hence it doesn't get shifted by 2 bits as we want to "drop" the bottom two bits. */ static int mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where, unsigned long *pci_addr, unsigned char *type1)
{ struct pci_controller *hose = pbus->sysdata; unsigned long addr; u8 bus = pbus->number; DBG_CFG(("mk_conf_addr(bus=%d ,device_fn=0x%x, where=0x%x, " "pci_addr=0x%p, type1=0x%p)\n", bus, device_fn, where, pci_addr, type1)); if (!pbus->parent) bus = 0; *type1 = (bus != 0); addr = (bus << 16...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Guarantee that the kzalloc'd memory is cacheline aligned. */
void* xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
/* Guarantee that the kzalloc'd memory is cacheline aligned. */ void* xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
{ *base = kzalloc(size, flags); if (*base == NULL) return NULL; if ((u64)*base == L1_CACHE_ALIGN((u64)*base)) return *base; kfree(*base); *base = kzalloc(size + L1_CACHE_BYTES, flags); if (*base == NULL) return NULL; return (void *)L1_CACHE_ALIGN((u64)*base); }
robutest/uclinux
C++
GPL-2.0
60
/* reset HDMI-CEC controller , 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 cec_deinit(void)
/* reset HDMI-CEC controller , 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 cec_deinit(void)
{ rcu_periph_reset_enable(RCU_CECRST); rcu_periph_reset_disable(RCU_CECRST); }
liuxuming/trochili
C++
Apache License 2.0
132
/* Internal function. Converts a memory range to the specified type. The range must exist in the memory map. */
EFI_STATUS CoreConvertPages(IN UINT64 Start, IN UINT64 NumberOfPages, IN EFI_MEMORY_TYPE NewType)
/* Internal function. Converts a memory range to the specified type. The range must exist in the memory map. */ EFI_STATUS CoreConvertPages(IN UINT64 Start, IN UINT64 NumberOfPages, IN EFI_MEMORY_TYPE NewType)
{ return CoreConvertPagesEx (Start, NumberOfPages, TRUE, NewType, FALSE, 0); }
tianocore/edk2
C++
Other
4,240
/* Convert a text string of hexdecimal values into a byte string. */
void* parse_byte_string(char *bytes, u8 *data, size_t *count_ptr)
/* Convert a text string of hexdecimal values into a byte string. */ void* parse_byte_string(char *bytes, u8 *data, size_t *count_ptr)
{ char byte[3]; size_t count, length; int i; if (!bytes) return NULL; length = strlen(bytes); count = length / 2; if (!data) data = malloc(count); if (!data) return NULL; byte[2] = '\0'; for (i = 0; i < length; i += 2) { byte[0] = bytes[i]; byte[1] = bytes[i + 1]; data[i / 2] = (u8)simple_strtoul(...
4ms/stm32mp1-baremetal
C++
Other
137
/* Check if a point is on an area */
bool lv_area_is_point_on(const lv_area_t *a_p, const lv_point_t *p_p)
/* Check if a point is on an area */ bool lv_area_is_point_on(const lv_area_t *a_p, const lv_point_t *p_p)
{ bool is_on = false; if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) && ((p_p->y >= a_p->y1 && p_p->y <= a_p->y2))) { is_on = true; } return is_on; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Check if it is to delete auth variable. */
BOOLEAN IsDeleteAuthVariable(IN UINT32 OrgAttributes, IN VOID *Data, IN UINTN DataSize, IN UINT32 Attributes)
/* Check if it is to delete auth variable. */ BOOLEAN IsDeleteAuthVariable(IN UINT32 OrgAttributes, IN VOID *Data, IN UINTN DataSize, IN UINT32 Attributes)
{ BOOLEAN Del; UINTN PayloadSize; Del = FALSE; if ((Attributes == OrgAttributes) && ((Attributes & (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) != 0)) { if ((Attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) { PayloadS...
tianocore/edk2
C++
Other
4,240
/* Subpanel display is only possible when the LCD controller is in raster mode and is configured to drive an active matrix display. */
void LCDRasterSubPanelEnable(uint32_t ui32Base)
/* Subpanel display is only possible when the LCD controller is in raster mode and is configured to drive an active matrix display. */ void LCDRasterSubPanelEnable(uint32_t ui32Base)
{ ASSERT(ui32Base == LCD0_BASE); HWREG(ui32Base + LCD_O_RASTRSUBP1) |= LCD_RASTRSUBP1_SPEN; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* LZ4_saveDict() : If previously compressed data block is not guaranteed to remain available at its memory location, save it into a safer place (char* safeBuffer). Note : you don't need to call LZ4_loadDict() afterwards, dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue(). Return : sa...
int LZ4_saveDict(LZ4_stream_t *LZ4_dict, char *safeBuffer, int dictSize)
/* LZ4_saveDict() : If previously compressed data block is not guaranteed to remain available at its memory location, save it into a safer place (char* safeBuffer). Note : you don't need to call LZ4_loadDict() afterwards, dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue(). Return : sa...
{ LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse; const BYTE* const previousDictEnd = dict->dictionary + dict->dictSize; if ((U32)dictSize > 64 KB) { dictSize = 64 KB; } if ((U32)dictSize > dict->dictSize) { dictSize = (int)dict->dictSize; } if (safeBuffer == NULL) assert(dictSize ...
xboot/xboot
C++
MIT License
779
/* Resets or collects the statistics on a network interface. */
EFI_STATUS EmuSnpStatistics(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
/* Resets or collects the statistics on a network interface. */ EFI_STATUS EmuSnpStatistics(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
{ EMU_SNP_PRIVATE *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This); return EFI_UNSUPPORTED; }
tianocore/edk2
C++
Other
4,240
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); } if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_DISABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_DISABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_DISABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_DISABLE(); } e...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* only highlevel and lowlevel intr can use for wakeup */
void gpio_pin_wakeup_enable(uint32 i, GPIO_INT_TYPE intr_state)
/* only highlevel and lowlevel intr can use for wakeup */ void gpio_pin_wakeup_enable(uint32 i, GPIO_INT_TYPE intr_state)
{ uint32 pin_reg; if ((intr_state == GPIO_PIN_INTR_LOLEVEL) || (intr_state == GPIO_PIN_INTR_HILEVEL)) { portENTER_CRITICAL(); pin_reg = GPIO_REG_READ(GPIO_PIN_ADDR(i)); pin_reg &= (~GPIO_PIN_INT_TYPE_MASK); pin_reg |= (intr_state << GPIO_PIN_INT_TYPE_LSB); pin_reg |= GPIO...
eerimoq/simba
C++
Other
337
/* Configures the device by setting it into the Configured state and initializing all endpoints. */
static void SetConfiguration(USBDDriver *pDriver, unsigned char cfgnum)
/* Configures the device by setting it into the Configured state and initializing all endpoints. */ static void SetConfiguration(USBDDriver *pDriver, unsigned char cfgnum)
{ USBEndpointDescriptor *pEndpoints[CHIP_USB_NUMENDPOINTS+1]; const USBConfigurationDescriptor *pConfiguration; if (USBD_IsHighSpeed()) { pConfiguration = pDriver->pDescriptors->pHsConfiguration; } else { pConfiguration = pDriver->pDescriptors->pFsConfiguration; } USBD_SetCon...
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* A TRNG may be implemented by the system firmware, in which case this function shall return the version of the Arm TRNG backend. The implementation must return NOT_SUPPORTED if a Back end is not present. */
RETURN_STATUS EFIAPI GetArmTrngVersion(OUT UINT16 *MajorRevision, OUT UINT16 *MinorRevision)
/* A TRNG may be implemented by the system firmware, in which case this function shall return the version of the Arm TRNG backend. The implementation must return NOT_SUPPORTED if a Back end is not present. */ RETURN_STATUS EFIAPI GetArmTrngVersion(OUT UINT16 *MajorRevision, OUT UINT16 *MinorRevision)
{ RETURN_STATUS Status; ARM_MONITOR_ARGS Parameters; INT32 Revision; if ((MajorRevision == NULL) || (MinorRevision == NULL)) { return RETURN_INVALID_PARAMETER; } ZeroMem (&Parameters, sizeof (Parameters)); Parameters.Arg0 = ARM_SMC_ID_TRNG_VERSION; ArmMonitorCall (&Parameters); Re...
tianocore/edk2
C++
Other
4,240
/* Adjust the FSP data pointers after the stack is migrated to memory. */
VOID FspDataPointerFixUp(IN UINTN OffsetGap)
/* Adjust the FSP data pointers after the stack is migrated to memory. */ VOID FspDataPointerFixUp(IN UINTN OffsetGap)
{ FSP_GLOBAL_DATA *NewFspData; NewFspData = (FSP_GLOBAL_DATA *)((UINTN)GetFspGlobalDataPointer () + (UINTN)OffsetGap); SetFspGlobalDataPointer (NewFspData); }
tianocore/edk2
C++
Other
4,240