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 |
|---|---|---|---|---|---|---|---|
/* Set a single color register. Return != 0 for invalid regno. */ | static int clps7111fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) | /* Set a single color register. Return != 0 for invalid regno. */
static int clps7111fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) | {
unsigned int level, mask, shift, pal;
if (regno >= (1 << info->var.bits_per_pixel))
return 1;
level = (red * 77 + green * 151 + blue * 28) >> 20;
if (machine_is_edb7211()) {
level = 15 - level;
}
shift = 4 * (regno & 7);
level <<= shift;
mask = 15 << shift;
level &= mask;
regno = regno < 8 ? PALLSW : P... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* With page-unaligned ioremaps, one or two armed pages may contain addresses from outside the intended mapping. Events for these addresses are currently silently dropped. The events may result only from programming mistakes by accessing addresses before the beginning or past the end of a mapping. */ | int register_kmmio_probe(struct kmmio_probe *p) | /* With page-unaligned ioremaps, one or two armed pages may contain addresses from outside the intended mapping. Events for these addresses are currently silently dropped. The events may result only from programming mistakes by accessing addresses before the beginning or past the end of a mapping. */
int register_kmmi... | {
unsigned long flags;
int ret = 0;
unsigned long size = 0;
const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK);
spin_lock_irqsave(&kmmio_lock, flags);
if (get_kmmio_probe(p->addr)) {
ret = -EEXIST;
goto out;
}
kmmio_count++;
list_add_rcu(&p->list, &kmmio_probes);
while (size < size_lim) {
if... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Determines if the hardware module(s) are currently synchronizing to the bus.
Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus. This function can be used to delay further operations on a module until such time that it is ready... | bool dac_is_syncing(struct dac_module *const dev_inst) | /* Determines if the hardware module(s) are currently synchronizing to the bus.
Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus. This function can be used to delay further operations on a module until such time that it is ready... | {
Assert(dev_inst);
Dac *const dac_module = dev_inst->hw;
if (dac_module->SYNCBUSY.reg) {
return true;
}
return false;
} | memfault/zero-to-main | C++ | null | 200 |
/* brief Return Frequency of 32kHz osc return Frequency of 32kHz osc */ | uint32_t CLOCK_GetOsc32KFreq(void) | /* brief Return Frequency of 32kHz osc return Frequency of 32kHz osc */
uint32_t CLOCK_GetOsc32KFreq(void) | {
return ((0UL == (PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_FRO32K_MASK)) &&
(0UL == (PMC->RTCOSC32K & PMC_RTCOSC32K_SEL_MASK))) ?
CLK_RTC_32K_CLK :
((0UL == (PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_XTAL32K_MASK)) &&
(0UL != (PMC->RTCOSC32K & PMC_RTCOSC32K_SEL_MASK))... | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ... | UINT32 EFIAPI PciExpressBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and ... | {
ASSERT_INVALID_PCI_ADDRESS (Address);
if (Address >= PcdPciExpressBaseSize ()) {
return (UINT32)-1;
}
return MmioBitFieldWrite32 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Pinning Buffer Storage in Memory Ensure that no attempt to force a buffer to disk will succeed. */ | void xfs_buf_pin(xfs_buf_t *bp) | /* Pinning Buffer Storage in Memory Ensure that no attempt to force a buffer to disk will succeed. */
void xfs_buf_pin(xfs_buf_t *bp) | {
trace_xfs_buf_pin(bp, _RET_IP_);
atomic_inc(&bp->b_pin_count);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 'what should we do if we get a hw irq event on an illegal vector'. each architecture has to answer this themselves. */ | void ack_bad_irq(unsigned int irq) | /* 'what should we do if we get a hw irq event on an illegal vector'. each architecture has to answer this themselves. */
void ack_bad_irq(unsigned int irq) | {
if (printk_ratelimit())
pr_err("unexpected IRQ trap at vector %02x\n", irq);
ack_APIC_irq();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reset the GPIO bit data(status) for bit.
@method GPIO_ResetBit */ | void GPIO_ResetBit(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin) | /* Reset the GPIO bit data(status) for bit.
@method GPIO_ResetBit */
void GPIO_ResetBit(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin) | {
_ASSERT(IS_GPIO_PORT(GPIOx));
_ASSERT(IS_GPIO_PIN_SINGLE(GPIO_Pin));
MGPIO->CTRL.reg[GPIO_GetNum(GPIOx, GPIO_Pin)] = OUTPUT_LOW;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Calculate pointer to block from its index and channel configuration (RX or TX). No validation is performed. */ | static struct block_content* block_from_index(const struct channel_config *ch_conf, size_t block_index) | /* Calculate pointer to block from its index and channel configuration (RX or TX). No validation is performed. */
static struct block_content* block_from_index(const struct channel_config *ch_conf, size_t block_index) | {
return (struct block_content *)(ch_conf->blocks_ptr +
block_index * ch_conf->block_size);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* fc_exch_ptr_set() - Assign an exchange to a slot in an exchange pool @pool: */ | static void fc_exch_ptr_set(struct fc_exch_pool *pool, u16 index, struct fc_exch *ep) | /* fc_exch_ptr_set() - Assign an exchange to a slot in an exchange pool @pool: */
static void fc_exch_ptr_set(struct fc_exch_pool *pool, u16 index, struct fc_exch *ep) | {
((struct fc_exch **)(pool + 1))[index] = ep;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Update the AMP value with a bit mask. Returns 0 if the value is unchanged, 1 if changed. */ | int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, int direction, int idx, int mask, int val) | /* Update the AMP value with a bit mask. Returns 0 if the value is unchanged, 1 if changed. */
int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, int direction, int idx, int mask, int val) | {
struct hda_amp_info *info;
info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, direction, idx));
if (!info)
return 0;
val &= mask;
val |= get_vol_mute(codec, info, nid, ch, direction, idx) & ~mask;
if (info->vol[ch] == val)
return 0;
put_vol_mute(codec, info, nid, ch, direction, idx, val);
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note: the dentry argument is the parent dentry. */ | static int __affs_hash_dentry(struct dentry *dentry, struct qstr *qstr, toupper_t toupper) | /* Note: the dentry argument is the parent dentry. */
static int __affs_hash_dentry(struct dentry *dentry, struct qstr *qstr, toupper_t toupper) | {
const u8 *name = qstr->name;
unsigned long hash;
int i;
i = affs_check_name(qstr->name,qstr->len);
if (i)
return i;
hash = init_name_hash();
i = min(qstr->len, 30u);
for (; i > 0; name++, i--)
hash = partial_name_hash(toupper(*name), hash);
qstr->hash = end_name_hash(hash);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine is called when the 3270 tty is closed. We wait for the remaining request to be completed. Then we clean up. */ | static int fs3270_close(struct inode *inode, struct file *filp) | /* This routine is called when the 3270 tty is closed. We wait for the remaining request to be completed. Then we clean up. */
static int fs3270_close(struct inode *inode, struct file *filp) | {
struct fs3270 *fp;
fp = filp->private_data;
filp->private_data = NULL;
if (fp) {
put_pid(fp->fs_pid);
fp->fs_pid = NULL;
raw3270_reset(&fp->view);
raw3270_put_view(&fp->view);
raw3270_del_view(&fp->view);
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: TRUE if the drive has been poll_for_mediaed successfully, FALSE otherwise. */ | gboolean g_drive_poll_for_media_finish(GDrive *drive, GAsyncResult *result, GError **error) | /* Returns: TRUE if the drive has been poll_for_mediaed successfully, FALSE otherwise. */
gboolean g_drive_poll_for_media_finish(GDrive *drive, GAsyncResult *result, GError **error) | {
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
if (g_async_result_legacy_propagate_error (result, error))
return FALSE;
else if (g_async_result_is_tagged (result, g_drive_poll_for_media))
return g_task_propagate_boolean... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If Sha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceSha1Init(OUT VOID *Sha1Context) | /* If Sha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSha1Init(OUT VOID *Sha1Context) | {
return CALL_BASECRYPTLIB (Sha1.Services.Init, Sha1Init, (Sha1Context), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* host msd ufi command callback.
This function is used as callback function for ufi command . */ | static void USB_HostMsdUfiCallback(void *param, uint8_t *data, uint32_t dataLength, usb_status_t status) | /* host msd ufi command callback.
This function is used as callback function for ufi command . */
static void USB_HostMsdUfiCallback(void *param, uint8_t *data, uint32_t dataLength, usb_status_t status) | {
ufiIng = 0;
ufiStatus = status;
} | labapart/polymcu | C++ | null | 201 |
/* Helper function for splitting a string into an argv-like array. */ | static const char* skip_arg(const char *cp) | /* Helper function for splitting a string into an argv-like array. */
static const char* skip_arg(const char *cp) | {
while (*cp && !isspace(*cp))
cp++;
return cp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note that some PnP BIOSes (e.g., on Sony Vaio laptops) die a horrible death if they are asked to access the "current" configuration. Therefore, if it's a matter of indifference, it's better to call get_dev_node() and set_dev_node() with boot=1 rather than with boot=0. */ | static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data) | /* Note that some PnP BIOSes (e.g., on Sony Vaio laptops) die a horrible death if they are asked to access the "current" configuration. Therefore, if it's a matter of indifference, it's better to call get_dev_node() and set_dev_node() with boot=1 rather than with boot=0. */
static int __pnp_bios_get_dev_node(u8 *noden... | {
u16 status;
u16 tmp_nodenum;
if (!pnp_bios_present())
return PNP_FUNCTION_NOT_SUPPORTED;
if (!boot && pnpbios_dont_use_current_config)
return PNP_FUNCTION_NOT_SUPPORTED;
tmp_nodenum = *nodenum;
status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2,
boot ? 2 : 1, PNP_DS, 0, &tmp_noden... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to SATA device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSata(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to SATA device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSata(IN CHAR16 *TextDeviceNode) | {
SATA_DEVICE_PATH *Sata;
CHAR16 *Param1;
CHAR16 *Param2;
CHAR16 *Param3;
Param1 = GetNextParamStr (&TextDeviceNode);
Param2 = GetNextParamStr (&TextDeviceNode);
Param3 = GetNextParamStr (&TextDeviceNode);
Sata = (SATA_DEVICE_PATH *)CreateDeviceNode (
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Check board identity. Always successful (gives information only) */ | int checkboard(void) | /* Check board identity. Always successful (gives information only) */
int checkboard(void) | {
char *s;
char buf[64];
int i;
i = getenv_r ("board_id", buf, sizeof (buf));
s = (i > 0) ? buf : NULL;
if (s) {
printf ("%s ", s);
} else {
printf ("<unknown> ");
}
i = getenv_r ("serial#", buf, sizeof (buf));
s = (i > 0) ? buf : NULL;
if (s) {
printf ("S/N %s\n", s);
} else {
printf ("S/N <unknown... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* The bdstrat callback function for log bufs. This gives us a central place to trap bufs in case we get hit by a log I/O error and need to shutdown. Actually, in practice, even when we didn't get a log error, we transition the iclogs to IOERROR state */ | STATIC int xlog_bdstrat_cb(struct xfs_buf *) | /* The bdstrat callback function for log bufs. This gives us a central place to trap bufs in case we get hit by a log I/O error and need to shutdown. Actually, in practice, even when we didn't get a log error, we transition the iclogs to IOERROR state */
STATIC int xlog_bdstrat_cb(struct xfs_buf *) | {
xlog_in_core_t *iclog;
iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *);
if ((iclog->ic_state & XLOG_STATE_IOERROR) == 0) {
XFS_bdstrat(bp);
return 0;
}
XFS_BUF_ERROR(bp, EIO);
XFS_BUF_STALE(bp);
xfs_biodone(bp);
return XFS_ERROR(EIO);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reset setting Command Function: MX25_RSTEN Arguments: None. Description: Enable RST command Return Message: FlashOperationSuccess */ | ReturnMsg MX25_RSTEN(void) | /* Reset setting Command Function: MX25_RSTEN Arguments: None. Description: Enable RST command Return Message: FlashOperationSuccess */
ReturnMsg MX25_RSTEN(void) | {
CS_Low();
SendByte( FLASH_CMD_RSTEN, SIO );
CS_High();
return FlashOperationSuccess;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Return TRUE when Address is in the Range. */ | BOOLEAN AddressInRange(IN UINT64 Address, IN MTRR_MEMORY_RANGE Range) | /* Return TRUE when Address is in the Range. */
BOOLEAN AddressInRange(IN UINT64 Address, IN MTRR_MEMORY_RANGE Range) | {
return (Address >= Range.BaseAddress) && (Address <= Range.BaseAddress + Range.Length - 1);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This routine handles an ibm,sdram-4xx-ddr2 controller ECC correctable error. Per the aforementioned discussion, there's not enough status available to use the full EDAC correctable error interface, so we just pass driver-unique message to the "no info" interface. */ | static void ppc4xx_edac_handle_ce(struct mem_ctl_info *mci, const struct ppc4xx_ecc_status *status) | /* This routine handles an ibm,sdram-4xx-ddr2 controller ECC correctable error. Per the aforementioned discussion, there's not enough status available to use the full EDAC correctable error interface, so we just pass driver-unique message to the "no info" interface. */
static void ppc4xx_edac_handle_ce(struct mem_ctl_... | {
int row;
char message[PPC4XX_EDAC_MESSAGE_SIZE];
ppc4xx_edac_generate_message(mci, status, message, sizeof(message));
for (row = 0; row < mci->nr_csrows; row++)
if (ppc4xx_edac_check_bank_error(status, row))
edac_mc_handle_ce_no_info(mci, message);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Verify k_queue_unique_append()
Append the same data to the queue repeatedly, see if it returns expected value. And verify operation succeed if append different data to the queue. */ | ZTEST(queue_api, test_queue_unique_append) | /* Verify k_queue_unique_append()
Append the same data to the queue repeatedly, see if it returns expected value. And verify operation succeed if append different data to the queue. */
ZTEST(queue_api, test_queue_unique_append) | {
bool ret;
k_queue_init(&queue);
ret = k_queue_unique_append(&queue, (void *)&data[0]);
zassert_true(ret, "queue unique append failed");
ret = k_queue_unique_append(&queue, (void *)&data[0]);
zassert_false(ret, "queue unique append should fail");
ret = k_queue_unique_append(&queue, (void *)&data[1]);
zassert_t... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns whether a value's bits is a subset of another value's bits. */ | static bool bits_subset_of(uint32_t a, uint32_t b) | /* Returns whether a value's bits is a subset of another value's bits. */
static bool bits_subset_of(uint32_t a, uint32_t b) | {
return (((a) & (~(b))) == 0);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* __vxge_hw_fifo_delete - Removes the FIFO This function freeup the memory pool and removes the FIFO */ | enum vxge_hw_status __vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp) | /* __vxge_hw_fifo_delete - Removes the FIFO This function freeup the memory pool and removes the FIFO */
enum vxge_hw_status __vxge_hw_fifo_delete(struct __vxge_hw_vpath_handle *vp) | {
struct __vxge_hw_fifo *fifo = vp->vpath->fifoh;
__vxge_hw_fifo_abort(fifo);
if (fifo->mempool)
__vxge_hw_mempool_destroy(fifo->mempool);
vp->vpath->fifoh = NULL;
__vxge_hw_channel_free(&fifo->channel);
return VXGE_HW_OK;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will be invoked when usb hub plug out is detected and it would clean and release all hub class related resources. */ | static rt_err_t rt_usbh_hub_disable(void *arg) | /* This function will be invoked when usb hub plug out is detected and it would clean and release all hub class related resources. */
static rt_err_t rt_usbh_hub_disable(void *arg) | {
int i;
uhub_t hub;
struct uhintf* intf = (struct uhintf*)arg;
RT_ASSERT(intf != RT_NULL);
LOG_D("rt_usbh_hub_stop");
hub = (uhub_t)intf->user_data;
for(i=0; i<hub->num_ports; i++)
{
if(hub->child[i] != RT_NULL)
rt_usbh_detach_instance(hub->child[i]);
}
if(hu... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the specified SRAM1/2 parity error interrupts. */ | void RCC_ConfigSRAMParityErrorInt(uint32_t SramErrorInt, FunctionalState Cmd) | /* Enables or disables the specified SRAM1/2 parity error interrupts. */
void RCC_ConfigSRAMParityErrorInt(uint32_t SramErrorInt, FunctionalState Cmd) | {
assert_param(IS_RCC_SRAMERRORINT(SramErrorInt));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
RCC->SRAM_CTRLSTS |= SramErrorInt;
}
else
{
RCC->SRAM_CTRLSTS &= (~SramErrorInt);
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */ | void SPI3WireStartIntEnable(unsigned long ulBase) | /* Enable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntEnable(unsigned long ulBase) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SSTA_INTEN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Finds the bucket for a given name and reads the containing block; *ofs is set to the offset of the first list entry. */ | static struct buffer_head* omfs_get_bucket(struct inode *dir, const char *name, int namelen, int *ofs) | /* Finds the bucket for a given name and reads the containing block; *ofs is set to the offset of the first list entry. */
static struct buffer_head* omfs_get_bucket(struct inode *dir, const char *name, int namelen, int *ofs) | {
int nbuckets = (dir->i_size - OMFS_DIR_START)/8;
int block = clus_to_blk(OMFS_SB(dir->i_sb), dir->i_ino);
int bucket = omfs_hash(name, namelen, nbuckets);
*ofs = OMFS_DIR_START + bucket * 8;
return sb_bread(dir->i_sb, block);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 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);
}
else if(huart->Instance==USART6)
{
__HAL_RCC_USART6_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_6|GPIO_PIN_7);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Calculate motion vector component that should be added for direct blocks. */ | static int calc_add_mv(RV34DecContext *r, int dir, int val) | /* Calculate motion vector component that should be added for direct blocks. */
static int calc_add_mv(RV34DecContext *r, int dir, int val) | {
int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts);
int dist = dir ? -GET_PTS_DIFF(r->next_pts, r->cur_pts) : GET_PTS_DIFF(r->cur_pts, r->last_pts);
int mul;
if(!refdist) return 0;
mul = (dist << 14) / refdist;
return (val * mul + 0x2000) >> 14;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* this triggers the specified IRQ request returns 0 if successful, or a negative error code. */ | static int vx_send_irq_dsp(struct vx_core *chip, int num) | /* this triggers the specified IRQ request returns 0 if successful, or a negative error code. */
static int vx_send_irq_dsp(struct vx_core *chip, int num) | {
int nirq;
if (snd_vx_check_reg_bit(chip, VX_CVR, CVR_HC, 0, 200) < 0)
return -EIO;
nirq = num;
if (vx_has_new_dsp(chip))
nirq += VXP_IRQ_OFFSET;
vx_outb(chip, CVR, (nirq >> 1) | CVR_HC);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* It returns 0 if conversion is successful and *res is set to the converted value, otherwise it returns -EINVAL and *res is set to 0. */ | int strict_strtoll(const char *cp, unsigned int base, long long *res) | /* It returns 0 if conversion is successful and *res is set to the converted value, otherwise it returns -EINVAL and *res is set to 0. */
int strict_strtoll(const char *cp, unsigned int base, long long *res) | {
int ret;
if (*cp == '-') {
ret = strict_strtoull(cp + 1, base, (unsigned long long *)res);
if (!ret)
*res = -(*res);
} else {
ret = strict_strtoull(cp, base, (unsigned long long *)res);
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */ | UINT32 EFIAPI PciCf8Or32(IN UINTN Address, IN UINT32 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */
UINT32 EFIAPI PciCf8Or32(IN UINTN Address, IN UINT32 OrData) | {
BOOLEAN InterruptState;
UINT32 AddressPort;
UINT32 Result;
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoOr32 (... | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the Falling Latched PWM counter of the PWM module.
The */ | void PWMCAPLatchFlagClear(unsigned long ulBase, unsigned long ulChannel) | /* Get the Falling Latched PWM counter of the PWM module.
The */
void PWMCAPLatchFlagClear(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp >> 1)*4) |=
((PWM_CCR0_CRLRI0 |... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enable or disable HART modulator of the AD5700 chip on the board using the attached AD4111 GPIO pins. */ | static int32_t cn0414_hart_enable_modulator(struct cn0414_dev *dev, bool enable) | /* Enable or disable HART modulator of the AD5700 chip on the board using the attached AD4111 GPIO pins. */
static int32_t cn0414_hart_enable_modulator(struct cn0414_dev *dev, bool enable) | {
ad717x_st_reg *preg;
AD717X_ReadRegister(dev->ad4111_device, AD717X_GPIOCON_REG);
preg = AD717X_GetReg(dev->ad4111_device, AD717X_GPIOCON_REG);
if(enable) {
preg->value &= ~AD4111_GPIOCON_REG_DATA0;
preg->value |= AD4111_GPIOCON_REG_DATA1;
} else {
preg->value |= AD4111_GPIOCON_REG_DATA0;
preg->value &= ... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This function is intended to be called from the dev->set_multicast_list or dev->set_rx_mode function of layered software devices. */ | int dev_mc_sync(struct net_device *to, struct net_device *from) | /* This function is intended to be called from the dev->set_multicast_list or dev->set_rx_mode function of layered software devices. */
int dev_mc_sync(struct net_device *to, struct net_device *from) | {
int err = 0;
netif_addr_lock_bh(to);
err = __dev_addr_sync(&to->mc_list, &to->mc_count,
&from->mc_list, &from->mc_count);
if (!err)
__dev_set_rx_mode(to);
netif_addr_unlock_bh(to);
return err;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* omap_get_dma_chain_dst_pos - Get the destination position of the ongoing DMA in chain */ | int omap_get_dma_chain_dst_pos(int chain_id) | /* omap_get_dma_chain_dst_pos - Get the destination position of the ongoing DMA in chain */
int omap_get_dma_chain_dst_pos(int chain_id) | {
int lch;
int *channels;
if (unlikely((chain_id < 0 || chain_id >= dma_lch_count))) {
printk(KERN_ERR "Invalid chain id\n");
return -EINVAL;
}
if (dma_linked_lch[chain_id].linked_dmach_q == NULL) {
printk(KERN_ERR "Chain doesn't exists\n");
return -EINVAL;
}
channels = dma_linked_lch[chain_id].linked_dm... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Remove one pre-fetched key out of the FIFO buffer. */ | BOOLEAN EfiKeyFiFoForNotifyRemoveOneKey(EFI_KEY_FIFO *EfiKeyFiFo, EFI_INPUT_KEY *Output) | /* Remove one pre-fetched key out of the FIFO buffer. */
BOOLEAN EfiKeyFiFoForNotifyRemoveOneKey(EFI_KEY_FIFO *EfiKeyFiFo, EFI_INPUT_KEY *Output) | {
UINT8 Head;
Head = EfiKeyFiFo->Head;
ASSERT (Head < FIFO_MAX_NUMBER + 1);
if (IsEfiKeyFiFoForNotifyEmpty (EfiKeyFiFo)) {
Output->ScanCode = SCAN_NULL;
Output->UnicodeChar = 0;
return FALSE;
}
CopyMem (Output, &EfiKeyFiFo->Data[Head], sizeof (EFI_INPUT_KEY));
EfiKeyFiFo->Head = (UINT8)((H... | tianocore/edk2 | C++ | Other | 4,240 |
/* Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to see if a SCSI d... | EFI_STATUS EFIAPI UfsPassThruGetNextTarget(IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, IN OUT UINT8 **Target) | /* Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to see if a SCSI d... | {
if ((Target == NULL) || (*Target == NULL)) {
return EFI_INVALID_PARAMETER;
}
SetMem (mUfsTargetId, TARGET_MAX_BYTES, 0xFF);
if (CompareMem (*Target, mUfsTargetId, TARGET_MAX_BYTES) == 0) {
SetMem (*Target, TARGET_MAX_BYTES, 0x00);
return EFI_SUCCESS;
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* encrypt/decrypt columns of the key n.b. you can replace this with byte-wise xor if you wish. */ | static void add_round_key(u32 *state, u32 *key) | /* encrypt/decrypt columns of the key n.b. you can replace this with byte-wise xor if you wish. */
static void add_round_key(u32 *state, u32 *key) | {
int idx;
for (idx = 0; idx < 4; idx++)
state[idx] ^= key[idx];
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Registers a callback.
Registers a callback function which is implemented by the user. */ | enum status_code tcc_register_callback(struct tcc_module *const module, tcc_callback_t callback_func, const enum tcc_callback callback_type) | /* Registers a callback.
Registers a callback function which is implemented by the user. */
enum status_code tcc_register_callback(struct tcc_module *const module, tcc_callback_t callback_func, const enum tcc_callback callback_type) | {
Assert(module);
Assert(callback_func);
module->callback[callback_type] = callback_func;
module->register_callback_mask |= _tcc_intflag[callback_type];
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* Reset the Adaptive Interframe Spacing throttle to default values. */ | void e1000e_reset_adaptive(struct e1000_hw *hw) | /* Reset the Adaptive Interframe Spacing throttle to default values. */
void e1000e_reset_adaptive(struct e1000_hw *hw) | {
struct e1000_mac_info *mac = &hw->mac;
if (!mac->adaptive_ifs) {
e_dbg("Not in Adaptive IFS mode!\n");
goto out;
}
mac->current_ifs_val = 0;
mac->ifs_min_val = IFS_MIN;
mac->ifs_max_val = IFS_MAX;
mac->ifs_step_size = IFS_STEP;
mac->ifs_ratio = IFS_RATIO;
mac->in_ifs_mode = false;
ew32(AIT, 0);
out:
re... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* sysctl handler which just sets dac_mmap_min_addr = the new value and then calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly */ | int mmap_min_addr_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) | /* sysctl handler which just sets dac_mmap_min_addr = the new value and then calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly */
int mmap_min_addr_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) | {
int ret;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
update_mmap_min_addr();
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disable I2C master module of the specified I2C port.
The */ | void xI2CMasterDisable(unsigned long ulBase) | /* Disable I2C master module of the specified I2C port.
The */
void xI2CMasterDisable(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE));
xHWREG(ulBase + I2C_CON) &= ~I2C_CON_ENS1;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If any reserved bits in Address are set, then ASSERT(). */ | RETURN_STATUS EFIAPI PciSegmentRegisterForRuntimeAccess(IN UINTN Address) | /* If any reserved bits in Address are set, then ASSERT(). */
RETURN_STATUS EFIAPI PciSegmentRegisterForRuntimeAccess(IN UINTN Address) | {
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
return RETURN_UNSUPPORTED;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets this bit to mark the last descriptor in the transmit buffer descriptor list. */ | static void XEmacPs_BdSetTxWrap(UINTPTR BdPtr) | /* Sets this bit to mark the last descriptor in the transmit buffer descriptor list. */
static void XEmacPs_BdSetTxWrap(UINTPTR BdPtr) | {
u32 DataValueTx;
u32 *TempPtr;
BdPtr += (u32)(XEMACPS_BD_STAT_OFFSET);
TempPtr = (u32 *)BdPtr;
if(TempPtr != NULL) {
DataValueTx = *TempPtr;
DataValueTx |= XEMACPS_TXBUF_WRAP_MASK;
*TempPtr = DataValueTx;
}
} | ua1arn/hftrx | C++ | null | 69 |
/* This function can be called under rcu_read_lock iff the slot is not modified by radix_tree_replace_slot, otherwise it must be called exclusive from other writers. Any dereference of the slot must be done using radix_tree_deref_slot. */ | void** radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index) | /* This function can be called under rcu_read_lock iff the slot is not modified by radix_tree_replace_slot, otherwise it must be called exclusive from other writers. Any dereference of the slot must be done using radix_tree_deref_slot. */
void** radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index) | {
return (void **)radix_tree_lookup_element(root, index, 1);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the PWM frequency of the PWM module.
The */ | unsigned long PWMFrequencySet(unsigned long ulBase, unsigned long ulFrequency) | /* Set the PWM frequency of the PWM module.
The */
unsigned long PWMFrequencySet(unsigned long ulBase, unsigned long ulFrequency) | {
unsigned long ulFrepDiv;
unsigned long ulActualFrep;
unsigned long ulPreScale;
unsigned short usCNRData;
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT((ulFrequency > 0) || (ulFrequency <= xSysCtlClockGet(ulBase)));
ulFrepDiv = xSysCtlClockGet() / ulFrequency;
ulPreS... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* 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 main(int argc, char *argv[]) | /* 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 main(int argc, char *argv[]) | {
printf("No OpenGL support on this system\n");
return 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Process a futex-list entry, check whether it's owned by the dying task, and do notification if so: */ | int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) | /* Process a futex-list entry, check whether it's owned by the dying task, and do notification if so: */
int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) | {
u32 uval, nval, mval;
retry:
if (get_user(uval, uaddr))
return -1;
if ((uval & FUTEX_TID_MASK) == task_pid_vnr(curr)) {
mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
nval = futex_atomic_cmpxchg_inatomic(uaddr, uval, mval);
if (nval == -EFAULT)
return -1;
if (nval != uval)
goto retry;
if (!pi ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns an array of pointers to strings which are split out from @str. This is performed by strictly splitting on white-space; no quote processing is performed. Multiple whitespace characters are considered to be a single argument separator. The returned array is always NULL-terminated. Returns NULL on memory alloca... | char** argv_split(gfp_t gfp, const char *str, int *argcp) | /* Returns an array of pointers to strings which are split out from @str. This is performed by strictly splitting on white-space; no quote processing is performed. Multiple whitespace characters are considered to be a single argument separator. The returned array is always NULL-terminated. Returns NULL on memory alloca... | {
int argc = count_argc(str);
char **argv = kzalloc(sizeof(*argv) * (argc+1), gfp);
char **argvp;
if (argv == NULL)
goto out;
if (argcp)
*argcp = argc;
argvp = argv;
while (*str) {
str = skip_spaces(str);
if (*str) {
const char *p = str;
char *t;
str = skip_arg(str);
t = kstrndup(p, str-p, gf... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Search HSTI table in AIP protocol, and return the data. This API will return the HSTI table with indicated Role and ImplementationID, NULL ImplementationID means to find the first HSTI table with indicated Role. */ | EFI_STATUS EFIAPI HstiLibGetTable(IN UINT32 Role, IN CHAR16 *ImplementationID OPTIONAL, OUT VOID **Hsti, OUT UINTN *HstiSize) | /* Search HSTI table in AIP protocol, and return the data. This API will return the HSTI table with indicated Role and ImplementationID, NULL ImplementationID means to find the first HSTI table with indicated Role. */
EFI_STATUS EFIAPI HstiLibGetTable(IN UINT32 Role, IN CHAR16 *ImplementationID OPTIONAL, OUT VOID **Hst... | {
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
Aip = InternalHstiFindAip (Role, ImplementationID, Hsti, HstiSize);
if (Aip == NULL) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The Timer 0 default IRQ, declared in start up code. */ | void TIMER0IntHandler(void) | /* The Timer 0 default IRQ, declared in start up code. */
void TIMER0IntHandler(void) | {
unsigned long ulBase = TIMER0_BASE;
unsigned long ulTemp0,ulTemp1;
ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TISR) = ulTemp0;
ulTemp1 = (xHWREG(ulBase + TIMER_O_TEISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TEISR) = ulTemp1;
if (g_pfnTimer... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* It does work common to all Bluetooth encapsulations, and then calls the dissector registered in the bluetooth.encap table to handle the metadata header in the packet. */ | static gint dissect_bluetooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) | /* It does work common to all Bluetooth encapsulations, and then calls the dissector registered in the bluetooth.encap table to handle the metadata header in the packet. */
static gint dissect_bluetooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) | {
bluetooth_data_t *bluetooth_data;
bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree);
bluetooth_data->previous_protocol_data_type = BT_PD_NONE;
bluetooth_data->previous_protocol_data.none = NULL;
if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE,... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants. */ | static void MD5Init(struct MD5Context *ctx) | /* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants. */
static void MD5Init(struct MD5Context *ctx) | {
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This file is part of the Simba project. */ | int main() | /* This file is part of the Simba project. */
int main() | {
sys_start();
while (1) {
std_printf(FSTR("$ emacs\r\n"));
emacs(NULL, sys_get_stdin(), sys_get_stdout());
}
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Turn a config register offset into the right address in either PCI space or MMIO space to access the control register in question including accounting for the unit shift. */ | static unsigned long siimage_seldev(ide_drive_t *drive, int r) | /* Turn a config register offset into the right address in either PCI space or MMIO space to access the control register in question including accounting for the unit shift. */
static unsigned long siimage_seldev(ide_drive_t *drive, int r) | {
ide_hwif_t *hwif = drive->hwif;
unsigned long base = (unsigned long)hwif->hwif_data;
u8 unit = drive->dn & 1;
base += 0xA0 + r;
if (hwif->host_flags & IDE_HFLAG_MMIO)
base += hwif->channel << 6;
else
base += hwif->channel << 4;
base |= unit << unit;
return base;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the fields of structure stc_tmr6_pwm_init_t to default values. */ | int32_t TMR6_PWM_StructInit(stc_tmr6_pwm_init_t *pstcPwmInit) | /* Set the fields of structure stc_tmr6_pwm_init_t to default values. */
int32_t TMR6_PWM_StructInit(stc_tmr6_pwm_init_t *pstcPwmInit) | {
int32_t i32Ret = LL_ERR_INVD_PARAM;
uint32_t u32RefRegResetValue;
if (NULL != pstcPwmInit) {
pstcPwmInit->u32StartPolarity = TMR6_PWM_LOW;
pstcPwmInit->u32StopPolarity = TMR6_PWM_LOW;
u32RefRegResetValue = TMR6_REG_RST_VALUE_U16;
pstcPwmInit->u32CompareMatchPolarity = TMR6_... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @l_filename: preallocated buffer receiving the normalized name @filename: filename to normalize Return: 0 on success, -1 on failure */ | static int normalize_longname(char *l_filename, const char *filename) | /* @l_filename: preallocated buffer receiving the normalized name @filename: filename to normalize Return: 0 on success, -1 on failure */
static int normalize_longname(char *l_filename, const char *filename) | {
const char *p, illegal[] = "<>:\"/\\|?*";
if (strlen(filename) >= VFAT_MAXLEN_BYTES)
return -1;
for (p = filename; *p; ++p) {
if ((unsigned char)*p < 0x20)
return -1;
if (strchr(illegal, *p))
return -1;
}
strcpy(l_filename, filename);
downcase(l_filename, VFAT_MAXLEN_BYTES);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Prepare whatever needs to be prepared to be able to start threads */ | void posix_arch_init(void) | /* Prepare whatever needs to be prepared to be able to start threads */
void posix_arch_init(void) | {
thread_create_count = 0;
currently_allowed_thread = -1;
threads_table = calloc(PC_ALLOC_CHUNK_SIZE,
sizeof(struct threads_table_el));
if (threads_table == NULL) {
posix_print_error_and_exit(NO_MEM_ERR);
}
threads_table_size = PC_ALLOC_CHUNK_SIZE;
PC_SAFE_CALL(pthread_mutex_lock(&mtx_threads));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param pFifoXfer FlexCAN Rx FIFO transfer structure. See the ref flexcan_fifo_transfer_t. retval kStatus_Success - Start Rx FIFO receiving process successfully. retval kStatus_FLEXCAN_RxFifoBusy - Rx FIFO is currently in use. */ | status_t FLEXCAN_TransferReceiveFifoNonBlocking(CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *pFifoXfer) | /* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param pFifoXfer FlexCAN Rx FIFO transfer structure. See the ref flexcan_fifo_transfer_t. retval kStatus_Success - Start Rx FIFO receiving process successfully. retval kStatus_FLEXCAN_RxFifoBusy - Rx FIFO is currently in use. */
status_... | {
assert(NULL != handle);
assert(NULL != pFifoXfer);
status_t status;
uint32_t irqMask = (uint32_t)kFLEXCAN_RxFifoOverflowFlag | (uint32_t)kFLEXCAN_RxFifoWarningFlag;
if ((uint8_t)kFLEXCAN_StateIdle == handle->rxFifoState)
{
handle->rxFifoState = (uint8_t)kFLEXCAN_StateRxFifo;
ha... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* set the file creation context in a security record to the same as the objective context of the specified inode */ | static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode) | /* set the file creation context in a security record to the same as the objective context of the specified inode */
static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode) | {
struct inode_security_struct *isec = inode->i_security;
struct task_security_struct *tsec = new->security;
u32 sid = current_sid();
int ret;
ret = avc_has_perm(sid, isec->sid,
SECCLASS_KERNEL_SERVICE,
KERNEL_SERVICE__CREATE_FILES_AS,
NULL);
if (ret == 0)
tsec->create_sid = isec->sid;
return... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sorted add to a list. List is linear searched until first bigger element is found. */ | static void list_add_sorted(struct vtimer_list *timer, struct list_head *head) | /* Sorted add to a list. List is linear searched until first bigger element is found. */
static void list_add_sorted(struct vtimer_list *timer, struct list_head *head) | {
struct vtimer_list *event;
list_for_each_entry(event, head, entry) {
if (event->expires > timer->expires) {
list_add_tail(&timer->entry, &event->entry);
return;
}
}
list_add_tail(&timer->entry, head);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* incr is ignored in native Arbel (mem-free) mode, so cq->cons_index should be correct before calling update_cons_index(). */ | static void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq, int incr) | /* incr is ignored in native Arbel (mem-free) mode, so cq->cons_index should be correct before calling update_cons_index(). */
static void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq, int incr) | {
if (mthca_is_memfree(dev)) {
*cq->set_ci_db = cpu_to_be32(cq->cons_index);
wmb();
} else {
mthca_write64(MTHCA_TAVOR_CQ_DB_INC_CI | cq->cqn, incr - 1,
dev->kar + MTHCA_CQ_DOORBELL,
MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
mmiowb();
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function parses the IORT RMR Node Memory Range Descriptor array. */ | STATIC VOID DumpIortNodeRmrMemRangeDesc(IN UINT8 *Ptr, IN UINT32 Length, IN UINT32 DescCount) | /* This function parses the IORT RMR Node Memory Range Descriptor array. */
STATIC VOID DumpIortNodeRmrMemRangeDesc(IN UINT8 *Ptr, IN UINT32 Length, IN UINT32 DescCount) | {
UINT32 Index;
UINT32 Offset;
CHAR8 Buffer[40];
Index = 0;
Offset = 0;
while ((Index < DescCount) &&
(Offset < Length))
{
AsciiSPrint (
Buffer,
sizeof (Buffer),
"Mem range Descriptor [%d]",
Index
);
Offset += ParseAcpi (
TRUE,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Change Logs: Date Author Notes Bernard first version from QiuYi implementation */ | void rt_hw_show_memory(rt_uint32_t addr, rt_size_t size) | /* Change Logs: Date Author Notes Bernard first version from QiuYi implementation */
void rt_hw_show_memory(rt_uint32_t addr, rt_size_t size) | {
unsigned int i = 0, j = 0;
RT_ASSERT(addr);
addr = addr & ~0xF;
size = 4 * ((size + 3) / 4);
while (i < size)
{
rt_kprintf("0x%08x: ", addr);
for (j = 0; j < 4; j++)
{
rt_kprintf("0x%08x ", *(rt_uint32_t *)addr);
addr += 4;
i++;
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Selects decimation for timestamp batching in FIFO. Writing rate will be the maximum rate between XL and GYRO BDR divided by decimation decoder.. */ | int32_t lsm6dso_fifo_timestamp_decimation_get(stmdev_ctx_t *ctx, lsm6dso_odr_ts_batch_t *val) | /* Selects decimation for timestamp batching in FIFO. Writing rate will be the maximum rate between XL and GYRO BDR divided by decimation decoder.. */
int32_t lsm6dso_fifo_timestamp_decimation_get(stmdev_ctx_t *ctx, lsm6dso_odr_ts_batch_t *val) | {
lsm6dso_fifo_ctrl4_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL4, (uint8_t *)®, 1);
switch (reg.odr_ts_batch) {
case LSM6DSO_NO_DECIMATION:
*val = LSM6DSO_NO_DECIMATION;
break;
case LSM6DSO_DEC_1:
*val = LSM6DSO_DEC_1;
break;
case LSM6DSO_DEC_8:
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ServerEngines 209 N. Fair Oaks Ave Sunnyvale, CA 94085 */ | static void be_mcc_notify(struct beiscsi_hba *phba) | /* ServerEngines 209 N. Fair Oaks Ave Sunnyvale, CA 94085 */
static void be_mcc_notify(struct beiscsi_hba *phba) | {
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
u32 val = 0;
val |= mccq->id & DB_MCCQ_RING_ID_MASK;
val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* do_sync_erase - run the erase worker synchronously. @ubi: UBI device description object */ | static int do_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int vol_id, int lnum, int torture) | /* do_sync_erase - run the erase worker synchronously. @ubi: UBI device description object */
static int do_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int vol_id, int lnum, int torture) | {
struct ubi_work *wl_wrk;
dbg_wl("sync erase of PEB %i", e->pnum);
wl_wrk = kmalloc(sizeof(struct ubi_work), GFP_NOFS);
if (!wl_wrk)
return -ENOMEM;
wl_wrk->e = e;
wl_wrk->vol_id = vol_id;
wl_wrk->lnum = lnum;
wl_wrk->torture = torture;
return erase_worker(ubi, wl_wrk, 0);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Advance write pointer - intended to be used in combination with DMA. It is possible to fill the FIFO by use of a DMA in circular mode. Within DMA ISRs you may update the write pointer to be able to read from the FIFO. As long as the DMA is the only process writing into the FIFO this is safe to use.
USE WITH CARE - ... | void tu_fifo_advance_write_pointer(tu_fifo_t *f, uint16_t n) | /* Advance write pointer - intended to be used in combination with DMA. It is possible to fill the FIFO by use of a DMA in circular mode. Within DMA ISRs you may update the write pointer to be able to read from the FIFO. As long as the DMA is the only process writing into the FIFO this is safe to use.
USE WITH CARE - ... | {
f->wr_idx = advance_index(f->depth, f->wr_idx, n);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* sn_io_init - PROM does not have ACPI support to define nodes or root buses, so we need to do things the hard way, including initiating the bus scanning ourselves. */ | void __init sn_io_init(void) | /* sn_io_init - PROM does not have ACPI support to define nodes or root buses, so we need to do things the hard way, including initiating the bus scanning ourselves. */
void __init sn_io_init(void) | {
int i, j;
sn_fixup_ionodes();
for (i = 0; i <= max_segment_number; i++)
for (j = 0; j <= max_pcibus_number; j++)
sn_pci_controller_fixup(i, j, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the below-1MB memory attribute to fixed MTRR buffer. Modified flag array indicates which fixed MTRR is modified. */ | RETURN_STATUS MtrrLibSetBelow1MBMemoryAttribute(IN OUT UINT64 *ClearMasks, IN OUT UINT64 *OrMasks, IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN MTRR_MEMORY_CACHE_TYPE Type) | /* Set the below-1MB memory attribute to fixed MTRR buffer. Modified flag array indicates which fixed MTRR is modified. */
RETURN_STATUS MtrrLibSetBelow1MBMemoryAttribute(IN OUT UINT64 *ClearMasks, IN OUT UINT64 *OrMasks, IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN MTRR_MEMORY_CACHE_TYPE Type) | {
RETURN_STATUS Status;
UINT32 MsrIndex;
UINT64 ClearMask;
UINT64 OrMask;
ASSERT (BaseAddress < BASE_1MB);
MsrIndex = (UINT32)-1;
while ((BaseAddress < BASE_1MB) && (Length != 0)) {
Status = MtrrLibProgramFixedMtrr (Type, &BaseAddress, &Length, &MsrIndex, &ClearMask, &OrMask);... | tianocore/edk2 | C++ | Other | 4,240 |
/* Return: 0 if all goes good, else appropriate error message. */ | static int k3_arm64_probe(struct udevice *dev) | /* Return: 0 if all goes good, else appropriate error message. */
static int k3_arm64_probe(struct udevice *dev) | {
struct k3_arm64_privdata *priv;
int ret;
dev_dbg(dev, "%s\n", __func__);
priv = dev_get_priv(dev);
ret = k3_arm64_of_to_priv(dev, priv);
if (ret) {
dev_dbg(dev, "%s: Probe failed with error %d\n", __func__, ret);
return ret;
}
dev_dbg(dev, "Remoteproc successfully probed\n");
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Enables SIR (IrDA) mode on the specified UART. */ | void UARTEnableSIR(uint32_t ui32Base, bool bLowPower) | /* Enables SIR (IrDA) mode on the specified UART. */
void UARTEnableSIR(uint32_t ui32Base, bool bLowPower) | {
ASSERT(_UARTBaseValid(ui32Base));
if(bLowPower)
{
HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_SIREN | UART_CTL_SIRLP);
}
else
{
HWREG(ui32Base + UART_O_CTL) |= (UART_CTL_SIREN);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Search the upvalues of the function 'fs' for one with the given 'name'. */ | static int searchupvalue(FuncState *fs, TString *name) | /* Search the upvalues of the function 'fs' for one with the given 'name'. */
static int searchupvalue(FuncState *fs, TString *name) | {
if (eqstr(up[i].name, name)) return i;
}
return -1;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | UINT8 EFIAPI IoRead8(IN UINTN Port) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI IoRead8(IN UINTN Port) | {
return (UINT8)IoReadWorker (Port, SMM_IO_UINT8);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Converts a generic ACPI text device path node to ACPI device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextAcpiPath(CHAR16 *TextDeviceNode) | /* Converts a generic ACPI text device path node to ACPI device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextAcpiPath(CHAR16 *TextDeviceNode) | {
return DevPathFromTextGenericPath (ACPI_DEVICE_PATH, TextDeviceNode);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Must be called with kernel preemption disabled (in this case, local interrupts are disabled at the call-site in entry.S). */ | asmlinkage void math_state_restore(void) | /* Must be called with kernel preemption disabled (in this case, local interrupts are disabled at the call-site in entry.S). */
asmlinkage void math_state_restore(void) | {
struct thread_info *thread = current_thread_info();
struct task_struct *tsk = thread->task;
if (!tsk_used_math(tsk)) {
local_irq_enable();
if (init_fpu(tsk)) {
do_group_exit(SIGKILL);
return;
}
local_irq_disable();
}
clts();
__math_state_restore();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disable the clock to the TPIU module.
This function disables the clock to the TPIU module. */ | void am_hal_tpiu_clock_disable(void) | /* Disable the clock to the TPIU module.
This function disables the clock to the TPIU module. */
void am_hal_tpiu_clock_disable(void) | {
AM_REG(MCUCTRL, TPIUCTRL) &= ~AM_REG_MCUCTRL_TPIUCTRL_ENABLE_M;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get List of Active Connections.
This API is used to return the number of active connections and the active connection handles. */ | ADI_BLER_RESULT adi_radio_GetConnectionList(ADI_BLER_CONN_LIST *pConnectionList) | /* Get List of Active Connections.
This API is used to return the number of active connections and the active connection handles. */
ADI_BLER_RESULT adi_radio_GetConnectionList(ADI_BLER_CONN_LIST *pConnectionList) | {
ADI_BLER_RESULT bleResult;
ASSERT(pConnectionList != NULL);
ADI_BLE_LOGEVENT(LOGID_CMD_BLEGAP_GET_NUM_ACTIVE_CONNS);
ADI_BLE_RADIO_CMD_START(CMD_BLEGAP_GET_NUM_ACTIVE_CONNS);
bleResult = bler_process_cmd(CMD_BLEGAP_GET_NUM_ACTIVE_CONNS, 0u, pConnectionList, ADI_BLER_CONN_LIST_SIZE);
if(bleResu... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* edma_write_slot - write parameter RAM data for slot @slot: number of parameter RAM slot being modified */ | void edma_write_slot(unsigned slot, const struct edmacc_param *param) | /* edma_write_slot - write parameter RAM data for slot @slot: number of parameter RAM slot being modified */
void edma_write_slot(unsigned slot, const struct edmacc_param *param) | {
unsigned ctlr;
ctlr = EDMA_CTLR(slot);
slot = EDMA_CHAN_SLOT(slot);
if (slot >= edma_info[ctlr]->num_slots)
return;
memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot), param,
PARM_SIZE);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Converts a text device path node to USB device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsb(CHAR16 *TextDeviceNode) | /* Converts a text device path node to USB device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsb(CHAR16 *TextDeviceNode) | {
CHAR16 *PortStr;
CHAR16 *InterfaceStr;
USB_DEVICE_PATH *Usb;
PortStr = GetNextParamStr (&TextDeviceNode);
InterfaceStr = GetNextParamStr (&TextDeviceNode);
Usb = (USB_DEVICE_PATH *) CreateDeviceNode (
... | tianocore/edk2 | C++ | Other | 4,240 |
/* check if the given pointer is valid for pages */ | static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr) | /* check if the given pointer is valid for pages */
static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr) | {
if (addr & ~emu->dma_mask) {
snd_printk(KERN_ERR "max memory size is 0x%lx (addr = 0x%lx)!!\n", emu->dma_mask, (unsigned long)addr);
return 0;
}
if (addr & (EMUPAGESIZE-1)) {
snd_printk(KERN_ERR "page is not aligned\n");
return 0;
}
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* System calibration osc enable.
Use this function to able system calibration osc. */ | void system_osc_calibration_enable(void) | /* System calibration osc enable.
Use this function to able system calibration osc. */
void system_osc_calibration_enable(void) | {
LP_CLK_CAL_REGS0->CONFIG_REG.reg |= \
LP_CLK_CAL_REGS_CONFIG_REG_START_OSC_CALIB;
} | memfault/zero-to-main | C++ | null | 200 |
/* get the specified DAC0 interrupt flag(DAC0 DMA underrun interrupt flag) */ | FlagStatus dac0_interrupt_flag_get(void) | /* get the specified DAC0 interrupt flag(DAC0 DMA underrun interrupt flag) */
FlagStatus dac0_interrupt_flag_get(void) | {
if(((uint8_t)RESET !=(DAC_STAT & DAC_STAT_DDUDR0)) && (DAC_CTL & DAC_CTL_DDUDRIE0)){
return SET;
}else{
return RESET;
}
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Find a network profile through its' SSId and securit type, and the SSId is an unicode string. */ | WIFI_MGR_NETWORK_PROFILE* WifiMgrGetProfileByUnicodeSSId(IN CHAR16 *SSId, IN UINT8 SecurityType, IN LIST_ENTRY *ProfileList) | /* Find a network profile through its' SSId and securit type, and the SSId is an unicode string. */
WIFI_MGR_NETWORK_PROFILE* WifiMgrGetProfileByUnicodeSSId(IN CHAR16 *SSId, IN UINT8 SecurityType, IN LIST_ENTRY *ProfileList) | {
LIST_ENTRY *Entry;
WIFI_MGR_NETWORK_PROFILE *Profile;
if ((SSId == NULL) || (ProfileList == NULL)) {
return NULL;
}
NET_LIST_FOR_EACH (Entry, ProfileList) {
Profile = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_NETWORK_PROFILE,
Link,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* sg_free_table - Free a previously allocated sg table @table: The mapped sg table header */ | void sg_free_table(struct sg_table *table) | /* sg_free_table - Free a previously allocated sg table @table: The mapped sg table header */
void sg_free_table(struct sg_table *table) | {
__sg_free_table(table, SG_MAX_SINGLE_ALLOC, sg_kfree);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for searching connection instance matching the connection handle and the state requested.
Connection handle and state information is used to get a connection instance, it is possible to ignore the connection handle by using BLE_CONN_HANDLE_INVALID. */ | static ret_code_t connection_instance_find(uint16_t conn_handle, uint8_t state, uint32_t *p_instance) | /* Function for searching connection instance matching the connection handle and the state requested.
Connection handle and state information is used to get a connection instance, it is possible to ignore the connection handle by using BLE_CONN_HANDLE_INVALID. */
static ret_code_t connection_instance_find(uint16_t con... | {
ret_code_t err_code;
uint32_t index;
err_code = NRF_ERROR_INVALID_STATE;
for (index = 0; index < DEVICE_MANAGER_MAX_CONNECTIONS; index++)
{
if (state & m_connection_table[index].state)
{
if ((conn_handle == BLE_CONN_HANDLE_INVALID) ||
(conn_handle == m... | labapart/polymcu | C++ | null | 201 |
/* Routine to concatenate the given pair of 16-bit memory start and end addresses from the host, and store them in the StartAddr and EndAddr global variables. */ | static void LoadStartEndAddresses(void) | /* Routine to concatenate the given pair of 16-bit memory start and end addresses from the host, and store them in the StartAddr and EndAddr global variables. */
static void LoadStartEndAddresses(void) | {
union
{
uint8_t Bytes[2];
uint16_t Word;
} Address[2] = {{.Bytes = {SentCommand.Data[2], SentCommand.Data[1]}},
{.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}}};
StartAddr = Address[0].Word;
EndAddr = Address[1].Word;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* returns 0 if successful, or a negative error code. */ | static int vx_reset_chk(struct vx_core *chip) | /* returns 0 if successful, or a negative error code. */
static int vx_reset_chk(struct vx_core *chip) | {
if (vx_send_irq_dsp(chip, IRQ_RESET_CHK) < 0)
return -EIO;
if (vx_check_isr(chip, ISR_CHK, 0, 200) < 0)
return -EIO;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* msg_lock_(check_) routines are called in the paths where the rw_mutex is not held. */ | static struct msg_queue* msg_lock(struct ipc_namespace *ns, int id) | /* msg_lock_(check_) routines are called in the paths where the rw_mutex is not held. */
static struct msg_queue* msg_lock(struct ipc_namespace *ns, int id) | {
struct kern_ipc_perm *ipcp = ipc_lock(&msg_ids(ns), id);
if (IS_ERR(ipcp))
return (struct msg_queue *)ipcp;
return container_of(ipcp, struct msg_queue, q_perm);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function handles external line 13 interrupt request. */ | void USER_BUTTON_IRQHANDLER(void) | /* This function handles external line 13 interrupt request. */
void USER_BUTTON_IRQHANDLER(void) | {
if(LL_EXTI_IsActiveFlag_0_31(USER_BUTTON_EXTI_LINE) != RESET)
{
UserButton_Callback();
LL_EXTI_ClearFlag_0_31(USER_BUTTON_EXTI_LINE);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Return the maximum endpoint service interval time (ESIT) payload. Basically, this is the maxpacket size, multiplied by the burst size and mult size. */ | static u32 xhci_get_max_esit_payload(struct usb_device *udev, struct usb_endpoint_descriptor *endpt_desc, struct usb_ss_ep_comp_descriptor *ss_ep_comp_desc) | /* Return the maximum endpoint service interval time (ESIT) payload. Basically, this is the maxpacket size, multiplied by the burst size and mult size. */
static u32 xhci_get_max_esit_payload(struct usb_device *udev, struct usb_endpoint_descriptor *endpt_desc, struct usb_ss_ep_comp_descriptor *ss_ep_comp_desc) | {
int max_burst;
int max_packet;
if (usb_endpoint_xfer_control(endpt_desc) ||
usb_endpoint_xfer_bulk(endpt_desc))
return 0;
if (udev->speed >= USB_SPEED_SUPER)
return le16_to_cpu(ss_ep_comp_desc->wBytesPerInterval);
max_packet = usb_endpoint_maxp(endpt_desc);
max_burst = usb_endpoint_maxp_mult(endpt_desc... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Enables interrupts and triggers for the specified PWM generator block. */ | void PWMGenIntTrigEnable(unsigned long ulBase, unsigned long ulGen, unsigned long ulIntTrig) | /* Enables interrupts and triggers for the specified PWM generator block. */
void PWMGenIntTrigEnable(unsigned long ulBase, unsigned long ulGen, unsigned long ulIntTrig) | {
ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE));
ASSERT(PWMGenValid(ulGen));
ASSERT((ulIntTrig & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD |
PWM_INT_CNT_AU | PWM_INT_CNT_AD | PWM_INT_CNT_BU |
PWM_INT_CNT_BD | PWM_TR_CNT_ZERO | PWM_TR_CNT_LOAD |
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* They are not meant to be called directly, but via enable/disable_irq. */ | static void ecard_irq_unmask(unsigned int irqnr) | /* They are not meant to be called directly, but via enable/disable_irq. */
static void ecard_irq_unmask(unsigned int irqnr) | {
ecard_t *ec = slot_to_ecard(irqnr - 32);
if (ec) {
if (!ec->ops)
ec->ops = &ecard_default_ops;
if (ec->claimed && ec->ops->irqenable)
ec->ops->irqenable(ec, irqnr);
else
printk(KERN_ERR "ecard: rejecting request to "
"enable IRQs for %d\n", irqnr);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Increments a date with one second.
This function will add one second to specified date. If second is 59, it will increment minute. */ | void calendar_add_second_to_date(struct calendar_date *date) | /* Increments a date with one second.
This function will add one second to specified date. If second is 59, it will increment minute. */
void calendar_add_second_to_date(struct calendar_date *date) | {
Assert(calendar_is_date_valid(date));
if (++date->second == 60) {
date->second = 0;
calendar_add_minute_to_date(date);
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Check whether the incoming IPv6 address in IaAddr is one of the maintained addresses in the IA control block. */ | BOOLEAN Dhcp6AddrIsInCurrentIa(IN EFI_DHCP6_IA_ADDRESS *IaAddr, IN EFI_DHCP6_IA *CurrentIa) | /* Check whether the incoming IPv6 address in IaAddr is one of the maintained addresses in the IA control block. */
BOOLEAN Dhcp6AddrIsInCurrentIa(IN EFI_DHCP6_IA_ADDRESS *IaAddr, IN EFI_DHCP6_IA *CurrentIa) | {
UINT32 Index;
ASSERT (IaAddr != NULL && CurrentIa != NULL);
for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) {
if (EFI_IP6_EQUAL (&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) {
return TRUE;
}
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.