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 |
|---|---|---|---|---|---|---|---|
/* Clears a scheduled IN transaction for an endpoint in host mode. */ | void USBHostRequestINClear(uint32_t ui32Base, uint32_t ui32Endpoint) | /* Clears a scheduled IN transaction for an endpoint in host mode. */
void USBHostRequestINClear(uint32_t ui32Base, uint32_t ui32Endpoint) | {
uint32_t ui32Register;
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) ||
(ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) ||
(ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) ||
(ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7));
if (ui32Endpoint == USB_EP_0)
{
ui32Register = USB_O_CSRL0;
}
else
{
ui32Register = USB_O_RXCSRL1 + EP_OFFSET(ui32Endpoint);
}
HWREGB(ui32Base + ui32Register) &= ~USB_RXCSRL1_REQPKT;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the x and y coordinate of the next pixel to draw. */ | EMSTATUS setPixelAddress(uint16_t x, uint16_t y) | /* Set the x and y coordinate of the next pixel to draw. */
EMSTATUS setPixelAddress(uint16_t x, uint16_t y) | {
if (x > dimensions.clipWidth || y > dimensions.clipHeight)
{
return DMD_ERROR_PIXEL_OUT_OF_BOUNDS;
}
DMDIF_writeReg(DMD_SSD2119_SET_X_ADDRESS_COUNTER,
x + dimensions.xClipStart);
DMDIF_writeReg(DMD_SSD2119_SET_Y_ADDRESS_COUNTER,
y + dimensions.yClipStart);
return DMD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* filp may be NULL if called via the msync of a vma. */ | int file_fsync(struct file *filp, struct dentry *dentry, int datasync) | /* filp may be NULL if called via the msync of a vma. */
int file_fsync(struct file *filp, struct dentry *dentry, int datasync) | {
struct inode * inode = dentry->d_inode;
struct super_block * sb;
int ret, err;
ret = write_inode_now(inode, 0);
sb = inode->i_sb;
if (sb->s_dirt && sb->s_op->write_super)
sb->s_op->write_super(sb);
err = sync_blockdev(sb->s_bdev);
if (!ret)
ret = err;
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */ | u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | /* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */
u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | {
MPI2DefaultReply_t *mpi_reply;
mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply);
if (ioc->transport_cmds.status == MPT2_CMD_NOT_USED)
return 1;
if (ioc->transport_cmds.smid != smid)
return 1;
ioc->transport_cmds.status |= MPT2_CMD_COMPLETE;
if (mpi_reply) {
memcpy(ioc->transport_cmds.reply, mpi_reply,
mpi_reply->MsgLength*4);
ioc->transport_cmds.status |= MPT2_CMD_REPLY_VALID;
}
ioc->transport_cmds.status &= ~MPT2_CMD_PENDING;
complete(&ioc->transport_cmds.done);
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the selected DAC channel software trigger. */ | void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState) | /* Enables or disables the selected DAC channel software trigger. */
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState) | {
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DAC->SWTRIGR |= SWTRIGR_SWTRIG_Set << (DAC_Channel >> 4);
}
else
{
DAC->SWTRIGR &= ~(SWTRIGR_SWTRIG_Set << (DAC_Channel >> 4));
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Will trigger a complete discovery of WSS activated by this device and its neighbors. */ | ssize_t wlp_neighborhood_show(struct wlp *wlp, char *buf) | /* Will trigger a complete discovery of WSS activated by this device and its neighbors. */
ssize_t wlp_neighborhood_show(struct wlp *wlp, char *buf) | {
wlp_discover(wlp);
return wlp_wss_neighborhood_print_remove(wlp, buf, PAGE_SIZE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Calculates a scaled and compensated pressure value from raw data raw: raw temperature value read from Dps310 returns: temperature value in °C */ | int32_t calcTemp(int32_t raw) | /* Calculates a scaled and compensated pressure value from raw data raw: raw temperature value read from Dps310 returns: temperature value in °C */
int32_t calcTemp(int32_t raw) | {
double temp = raw;
temp /= scaling_facts[dps310_ctx.m_tempOsr];
dps310_ctx.m_lastTempScal = temp;
temp = dps310_ctx.m_c0Half + dps310_ctx.m_c1 * temp;
return (int32_t)temp;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Locking: takes tty_ldisc_lock to guard against ldisc races */ | int tty_unregister_ldisc(int disc) | /* Locking: takes tty_ldisc_lock to guard against ldisc races */
int tty_unregister_ldisc(int disc) | {
unsigned long flags;
int ret = 0;
if (disc < N_TTY || disc >= NR_LDISCS)
return -EINVAL;
spin_lock_irqsave(&tty_ldisc_lock, flags);
if (tty_ldiscs[disc]->refcount)
ret = -EBUSY;
else
tty_ldiscs[disc] = NULL;
spin_unlock_irqrestore(&tty_ldisc_lock, flags);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* After a CPU went down cycle through all the others and rediscover Must run in process context. */ | void cmci_rediscover(int dying) | /* After a CPU went down cycle through all the others and rediscover Must run in process context. */
void cmci_rediscover(int dying) | {
int banks;
int cpu;
cpumask_var_t old;
if (!cmci_supported(&banks))
return;
if (!alloc_cpumask_var(&old, GFP_KERNEL))
return;
cpumask_copy(old, ¤t->cpus_allowed);
for_each_online_cpu(cpu) {
if (cpu == dying)
continue;
if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
continue;
if (cmci_supported(&banks))
cmci_discover(banks, 0);
}
set_cpus_allowed_ptr(current, old);
free_cpumask_var(old);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clears a calibration point from the given buffer. */ | static void clear_calibration_point(const rtouch_point_t *p_point) | /* Clears a calibration point from the given buffer. */
static void clear_calibration_point(const rtouch_point_t *p_point) | {
gfx_draw_filled_rect(p_point->x - POINTS_SIZE / 2,
p_point->y - POINTS_SIZE / 2,
POINTS_SIZE,
POINTS_SIZE,
BGCOLOR
);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function makes USB host to recognize the device. */ | void USBD_Start(void) | /* This function makes USB host to recognize the device. */
void USBD_Start(void) | {
USBD_CLR_SE0();
USBD->ATTR = 0x7D0ul;
USBD_CLR_INT_FLAG(USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | USBD_INT_WAKEUP);
USBD_ENABLE_INT(USBD_INT_BUS | USBD_INT_USB | USBD_INT_FLDET | USBD_INT_WAKEUP);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Sha512Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceSha512Final(IN OUT VOID *Sha512Context, OUT UINT8 *HashValue) | /* If Sha512Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSha512Final(IN OUT VOID *Sha512Context, OUT UINT8 *HashValue) | {
return CALL_BASECRYPTLIB (Sha512.Services.Final, Sha512Final, (Sha512Context, HashValue), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function is the callback function of hub's int endpoint, it is invoked when data comes. */ | static void rt_usb_hub_irq(void *context) | /* This function is the callback function of hub's int endpoint, it is invoked when data comes. */
static void rt_usb_hub_irq(void *context) | {
upipe_t pipe;
uifinst_t ifinst;
uhubinst_t uhub;
int timeout = 100;
RT_ASSERT(context != RT_NULL);
pipe = (upipe_t)context;
ifinst = pipe->ifinst;
uhub = (uhubinst_t)ifinst->user_data;
if(pipe->status != UPIPE_STATUS_OK)
{
rt_kprintf("hub irq error\n");
return;
}
rt_usb_hub_port_change(uhub);
rt_kprintf("hub int xfer...\n");
RT_ASSERT(pipe->ifinst->uinst->hcd != RT_NULL);
rt_usb_hcd_int_xfer(ifinst->uinst->hcd, pipe, uhub->buffer,
pipe->ep.wMaxPacketSize, timeout);
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Resets a network adapter and re-initializes it with the parameters that were provided in the previous call to Initialize(). */ | EFI_STATUS EmuSnpReset(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN ExtendedVerification) | /* Resets a network adapter and re-initializes it with the parameters that were provided in the previous call to Initialize(). */
EFI_STATUS EmuSnpReset(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN ExtendedVerification) | {
EMU_SNP_PRIVATE *Private;
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
return EFI_UNSUPPORTED;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with */ | SPIN_LOCK* EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock) | /* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with */
SPIN_LOCK* EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock) | {
SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
LockValue = *SpinLock;
ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
_ReadWriteBarrier ();
*SpinLock = SPIN_LOCK_RELEASED;
_ReadWriteBarrier ();
return SpinLock;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* SYSCTRL I2C1 Bus Clock Disable and Reset Assert. */ | void LL_SYSCTRL_I2C1_ClkDisRstAssert(void) | /* SYSCTRL I2C1 Bus Clock Disable and Reset Assert. */
void LL_SYSCTRL_I2C1_ClkDisRstAssert(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_I2C1BusClk_Dis(SYSCTRL);
__LL_SYSCTRL_I2C1SoftRst_Assert(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Intercept ioremap() requests for addresses in our fixed mapping regions. */ | void __iomem* davinci_ioremap(unsigned long p, size_t size, unsigned int type) | /* Intercept ioremap() requests for addresses in our fixed mapping regions. */
void __iomem* davinci_ioremap(unsigned long p, size_t size, unsigned int type) | {
if (BETWEEN(p, IO_PHYS, IO_SIZE))
return XLATE(p, IO_PHYS, IO_VIRT);
return __arm_ioremap(p, size, type);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* All UBIFS nodes are protected by CRC checksums and UBIFS checks CRC when they are read from the flash media. ubifs_ro_mode - switch UBIFS to read read-only mode. */ | void ubifs_ro_mode(struct ubifs_info *c, int err) | /* All UBIFS nodes are protected by CRC checksums and UBIFS checks CRC when they are read from the flash media. ubifs_ro_mode - switch UBIFS to read read-only mode. */
void ubifs_ro_mode(struct ubifs_info *c, int err) | {
if (!c->ro_error) {
c->ro_error = 1;
c->no_chk_data_crc = 0;
c->vfs_sb->s_flags |= MS_RDONLY;
ubifs_warn(c, "switched to read-only mode, error %d", err);
dump_stack();
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Complete gameport port registration. Driver core will attempt to find appropriate driver for the port. */ | static void gameport_add_port(struct gameport *gameport) | /* Complete gameport port registration. Driver core will attempt to find appropriate driver for the port. */
static void gameport_add_port(struct gameport *gameport) | {
int error;
if (gameport->parent)
gameport->parent->child = gameport;
gameport->speed = gameport_measure_speed(gameport);
list_add_tail(&gameport->node, &gameport_list);
if (gameport->io)
printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n",
gameport->name, gameport->phys, gameport->io, gameport->speed);
else
printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n",
gameport->name, gameport->phys, gameport->speed);
error = device_add(&gameport->dev);
if (error)
printk(KERN_ERR
"gameport: device_add() failed for %s (%s), error: %d\n",
gameport->phys, gameport->name, error);
else
gameport->registered = 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* nilfs_segctor_reset_segment_buffer - reset the current segment buffer @sci: nilfs_sc_info */ | static int nilfs_segctor_reset_segment_buffer(struct nilfs_sc_info *sci) | /* nilfs_segctor_reset_segment_buffer - reset the current segment buffer @sci: nilfs_sc_info */
static int nilfs_segctor_reset_segment_buffer(struct nilfs_sc_info *sci) | {
struct nilfs_segment_buffer *segbuf = sci->sc_curseg;
struct buffer_head *sumbh;
unsigned sumbytes;
unsigned flags = 0;
int err;
if (nilfs_doing_gc())
flags = NILFS_SS_GC;
err = nilfs_segbuf_reset(segbuf, flags, sci->sc_seg_ctime);
if (unlikely(err))
return err;
sumbh = NILFS_SEGBUF_FIRST_BH(&segbuf->sb_segsum_buffers);
sumbytes = segbuf->sb_sum.sumbytes;
sci->sc_finfo_ptr.bh = sumbh; sci->sc_finfo_ptr.offset = sumbytes;
sci->sc_binfo_ptr.bh = sumbh; sci->sc_binfo_ptr.offset = sumbytes;
sci->sc_blk_cnt = sci->sc_datablk_cnt = 0;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */ | blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data) | /* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data) | {
blt_addr base_addr;
if ((len - 1) > (FLASH_END_ADDRESS - addr))
{
return BLT_FALSE;
}
if ((FlashGetSector(addr) == FLASH_INVALID_SECTOR) ||
(FlashGetSector(addr+len-1) == FLASH_INVALID_SECTOR))
{
return BLT_FALSE;
}
base_addr = (addr/FLASH_WRITE_BLOCK_SIZE)*FLASH_WRITE_BLOCK_SIZE;
if (base_addr == flashLayout[0].sector_start)
{
return FlashAddToBlock(&bootBlockInfo, addr, data, len);
}
return FlashAddToBlock(&blockInfo, addr, data, len);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Set shake rejection timeout. Sets the length of time after a shake rejection that the gyro must stay inside of the threshold before taps can be detected again. A mandatory 60 ms is added to this parameter. */ | int dmp_set_shake_reject_timeout(unsigned short time) | /* Set shake rejection timeout. Sets the length of time after a shake rejection that the gyro must stay inside of the threshold before taps can be detected again. A mandatory 60 ms is added to this parameter. */
int dmp_set_shake_reject_timeout(unsigned short time) | {
unsigned char tmp[2];
time /= (1000 / DMP_SAMPLE_RATE);
tmp[0] = time >> 8;
tmp[1] = time & 0xFF;
return mpu_write_mem(D_1_88,2,tmp);
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Copies all entries where the keycode is not KEY_UNKNOWN/KEY_RESERVED */ | int ir_copy_table(struct ir_scancode_table *destin, const struct ir_scancode_table *origin) | /* Copies all entries where the keycode is not KEY_UNKNOWN/KEY_RESERVED */
int ir_copy_table(struct ir_scancode_table *destin, const struct ir_scancode_table *origin) | {
int i, j = 0;
for (i = 0; i < origin->size; i++) {
if (origin->scan[i].keycode == KEY_UNKNOWN ||
origin->scan[i].keycode == KEY_RESERVED)
continue;
memcpy(&destin->scan[j], &origin->scan[i], sizeof(struct ir_scancode));
j++;
}
destin->size = j;
IR_dprintk(1, "Copied %d scancodes to the new keycode table\n", destin->size);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Status is equal to Expected, then TRUE is returned. If Status is not equal to Expected, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned. */ | BOOLEAN EFIAPI UnitTestAssertStatusEqual(IN EFI_STATUS Status, IN EFI_STATUS Expected, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description) | /* If Status is equal to Expected, then TRUE is returned. If Status is not equal to Expected, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned. */
BOOLEAN EFIAPI UnitTestAssertStatusEqual(IN EFI_STATUS Status, IN EFI_STATUS Expected, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description) | {
CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p expected:%p)", Description, (VOID *)Status, (VOID *)Expected);
_assert_true ((Status == Expected), TempStr, FileName, (INT32)LineNumber);
return (Status == Expected);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* With DMA abstraction, we use functions (methods), to distinguish between non DMAable memory and DMAable memory. */ | static void* ___mp0_get_mem_cluster(m_pool_p mp) | /* With DMA abstraction, we use functions (methods), to distinguish between non DMAable memory and DMAable memory. */
static void* ___mp0_get_mem_cluster(m_pool_p mp) | {
void *m = sym_get_mem_cluster();
if (m)
++mp->nump;
return m;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* These three functions initialize the on-chip clock framework, letting it generate the right frequencies for USB, MADC, and other purposes. */ | static int __init protect_pm_master(void) | /* These three functions initialize the on-chip clock framework, letting it generate the right frequencies for USB, MADC, and other purposes. */
static int __init protect_pm_master(void) | {
int e = 0;
e = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_LOCK,
R_PROTECT_KEY);
return e;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deallocates a mailbox. If there are messages still present in the mailbox when the mailbox is deallocated, it is an indication of a programming error in lwIP and the developer should be notified. */ | void k_mbox_free(k_mbox_t *mb) | /* Deallocates a mailbox. If there are messages still present in the mailbox when the mailbox is deallocated, it is an indication of a programming error in lwIP and the developer should be notified. */
void k_mbox_free(k_mbox_t *mb) | {
if (mb != NULL) {
k_mbox_t *mbox = mb;
k_sem_take(&mbox->mutex, K_FOREVER);
k_sem_delete(&mbox->not_empty);
k_sem_delete(&mbox->not_full);
k_sem_delete(&mbox->mutex);
BT_DBG("sys_mbox_free: mbox 0x%lx\n", mbox);
free(mbox);
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Load up a virtual<->physical translation for @eaddr<->@paddr in the pre-allocated TLB slot @config_addr (see sh64_get_wired_dtlb_entry). */ | void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr, unsigned long asid, unsigned long paddr) | /* Load up a virtual<->physical translation for @eaddr<->@paddr in the pre-allocated TLB slot @config_addr (see sh64_get_wired_dtlb_entry). */
void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr, unsigned long asid, unsigned long paddr) | {
unsigned long long pteh, ptel;
pteh = neff_sign_extend(eaddr);
pteh &= PAGE_MASK;
pteh |= (asid << PTEH_ASID_SHIFT) | PTEH_VALID;
ptel = neff_sign_extend(paddr);
ptel &= PAGE_MASK;
ptel |= (_PAGE_CACHABLE | _PAGE_READ | _PAGE_WRITE);
asm volatile("putcfg %0, 1, %1\n\t"
"putcfg %0, 0, %2\n"
: : "r" (config_addr), "r" (ptel), "r" (pteh));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The function is used to get the HFIRC trim interrupt status. */ | unsigned long SysCtlHFIRCTrimIntStatusGet(void) | /* The function is used to get the HFIRC trim interrupt status. */
unsigned long SysCtlHFIRCTrimIntStatusGet(void) | {
return (xHWREG(GCR_IRCTRIMINT));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* compare bundle parameters with what we're looking for */ | static int rxrpc_cmp_bundle(const struct rxrpc_conn_bundle *bundle, struct key *key, __be16 service_id) | /* compare bundle parameters with what we're looking for */
static int rxrpc_cmp_bundle(const struct rxrpc_conn_bundle *bundle, struct key *key, __be16 service_id) | {
return (bundle->service_id - service_id) ?:
((unsigned long) bundle->key - (unsigned long) key);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes the BKP peripheral, enable access to the backup registers. */ | void exBKP_Init(void) | /* Initializes the BKP peripheral, enable access to the backup registers. */
void exBKP_Init(void) | {
RCC_APB1PeriphClockCmd(RCC_APB1ENR_PWR, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1ENR_BKP, ENABLE);
RCC->BDCR |= RCC_BDCR_DBP;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Wait for the command register to be ready. We will poll this, since it won't usually take too long to be ready. */ | static void stl_cd1400ccrwait(struct stlport *portp) | /* Wait for the command register to be ready. We will poll this, since it won't usually take too long to be ready. */
static void stl_cd1400ccrwait(struct stlport *portp) | {
int i;
for (i = 0; i < CCR_MAXWAIT; i++)
if (stl_cd1400getreg(portp, CCR) == 0)
return;
printk("STALLION: cd1400 not responding, port=%d panel=%d brd=%d\n",
portp->portnr, portp->panelnr, portp->brdnr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Determines the new virtual address that is to be used on subsequent memory accesses for internal pointers. This is a internal function. */ | EFI_STATUS RuntimeDriverConvertInternalPointer(IN OUT VOID **ConvertAddress) | /* Determines the new virtual address that is to be used on subsequent memory accesses for internal pointers. This is a internal function. */
EFI_STATUS RuntimeDriverConvertInternalPointer(IN OUT VOID **ConvertAddress) | {
return RuntimeDriverConvertPointer (0x0, ConvertAddress);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* initialize TIMER channel output parameter struct with a default value */ | void timer_channel_output_struct_para_init(timer_oc_parameter_struct *ocpara) | /* initialize TIMER channel output parameter struct with a default value */
void timer_channel_output_struct_para_init(timer_oc_parameter_struct *ocpara) | {
ocpara->outputstate = TIMER_CCX_DISABLE;
ocpara->outputnstate = TIMER_CCXN_DISABLE;
ocpara->ocpolarity = TIMER_OC_POLARITY_HIGH;
ocpara->ocnpolarity = TIMER_OCN_POLARITY_HIGH;
ocpara->ocidlestate = TIMER_OC_IDLE_STATE_LOW;
ocpara->ocnidlestate = TIMER_OCN_IDLE_STATE_LOW;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets gain to the specified value from Lua. */ | int tcs34725LuaSetGain(lua_State *L) | /* Sets gain to the specified value from Lua. */
int tcs34725LuaSetGain(lua_State *L) | {
tcs34725Gain_t gain = luaL_checkinteger(L, 1);
return tcs34725SetGain(gain,L);
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Fills each DAC_InitStruct member with its default value. */ | void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct) | /* Fills each DAC_InitStruct member with its default value. */
void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct) | {
DAC_InitStruct->DAC_Trigger = DAC_Trigger_None;
DAC_InitStruct->DAC_WaveGeneration = DAC_WaveGeneration_None;
DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bit0;
DAC_InitStruct->DAC_OutputBuffer = DAC_OutputBuffer_Enable;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified DMA flag is set or not. */ | uint8_t DMA_ReadStatusFlag(DMA_FLAG_T flag) | /* Checks whether the specified DMA flag is set or not. */
uint8_t DMA_ReadStatusFlag(DMA_FLAG_T flag) | {
uint32_t status;
if((flag & 0x10000000) == SET)
{
status = DMA2->INTSTS & ((uint32_t)flag & 0x000FFFFF);
}
else
{
status = DMA1->INTSTS & ((uint32_t)flag & 0x0FFFFFFF);
}
if (status == flag)
{
return SET;
}
return RESET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Initializes the adc peripheral according to the specified parameters in the init_struct, Please use this function if you want to be compatible with older versions of the library. */ | void ADC_Init(ADC_TypeDef *adc, ADC_InitTypeDef *init_struct) | /* Initializes the adc peripheral according to the specified parameters in the init_struct, Please use this function if you want to be compatible with older versions of the library. */
void ADC_Init(ADC_TypeDef *adc, ADC_InitTypeDef *init_struct) | {
adc->ADCFG &= ~(ADC_CFGR_PRE | ADC_CFGR_RSLTCTL);
adc->ADCFG |= (u32)(init_struct->ADC_PRESCARE) | init_struct->ADC_Resolution;
adc->ADCR &= ~(ADC_CR_ALIGN | ADC_CR_MODE | ADC_CR_TRGSEL);
adc->ADCR |= ((u32)init_struct->ADC_DataAlign) | init_struct->ADC_ExternalTrigConv | ((u32)init_struct->ADC_Mode);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base Pointer to FLEXIO_I2S_Type structure param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. param callback FlexIO I2S callback function, which is called while finished a block. param userData User parameter for the FlexIO I2S callback. */ | void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData) | /* param base Pointer to FLEXIO_I2S_Type structure param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. param callback FlexIO I2S callback function, which is called while finished a block. param userData User parameter for the FlexIO I2S callback. */
void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData) | {
assert(handle != NULL);
IRQn_Type flexio_irqs[] = FLEXIO_IRQS;
(void)memset(handle, 0, sizeof(*handle));
handle->callback = callback;
handle->userData = userData;
(void)FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_I2S_TransferTxHandleIRQ);
handle->state = (uint32_t)kFLEXIO_I2S_Idle;
(void)EnableIRQ(flexio_irqs[FLEXIO_I2S_GetInstance(base)]);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Check if DAC channel is ready to receive data. */ | bool dac_is_ready(uint32_t dac, int channel) | /* Check if DAC channel is ready to receive data. */
bool dac_is_ready(uint32_t dac, int channel) | {
uint32_t mask = 0;
if (channel & DAC_CHANNEL1) {
mask |= DAC_SR_DAC1RDY;
}
if (channel & DAC_CHANNEL2) {
mask |= DAC_SR_DAC2RDY;
}
return (DAC_SR(dac) & mask) != 0;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* param enable Used to start or stop the tune logic. */ | void CLOCK_OSC_EnableOscRc400MTuneLogic(bool enable) | /* param enable Used to start or stop the tune logic. */
void CLOCK_OSC_EnableOscRc400MTuneLogic(bool enable) | {
if (enable)
{
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL2_SET, AI_RCOSC400M_CTRL2_TUNE_START_MASK);
}
else
{
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL2_CLR, AI_RCOSC400M_CTRL2_TUNE_START_MASK);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check whether the specified SPI/I2S flag is set or not. */ | uint8_t SPI_I2S_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag) | /* Check whether the specified SPI/I2S flag is set or not. */
uint8_t SPI_I2S_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag) | {
if ((spi->STS & flag) != RESET)
{
return SET;
}
else
{
return RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API function returns whether or not the policy engine is currently being enforced. */ | BOOLEAN EFIAPI IsVariablePolicyEnabled(VOID) | /* This API function returns whether or not the policy engine is currently being enforced. */
BOOLEAN EFIAPI IsVariablePolicyEnabled(VOID) | {
if (!IsVariablePolicyLibInitialized ()) {
return FALSE;
}
return !mProtectionDisabled;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Processes and authenticates blocks of data, either encrypt it or decrypts it. */ | bool AESDataProcessAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length, uint32_t *pui32AuthSrc, uint32_t ui32AuthLength, uint32_t *pui32Tag) | /* Processes and authenticates blocks of data, either encrypt it or decrypts it. */
bool AESDataProcessAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length, uint32_t *pui32AuthSrc, uint32_t ui32AuthLength, uint32_t *pui32Tag) | {
uint32_t ui32Count;
ASSERT(ui32Base == AES_BASE);
AESLengthSet(ui32Base, (uint64_t)ui32Length);
AESAuthLengthSet(ui32Base, ui32AuthLength);
for (ui32Count = 0; ui32Count < ui32AuthLength; ui32Count += 16)
{
AESDataWrite(ui32Base, pui32AuthSrc + (ui32Count / 4));
}
for (ui32Count = 0; ui32Count < ui32Length; ui32Count += 16)
{
AESDataWrite(ui32Base, pui32Src + (ui32Count / 4));
AESDataRead(ui32Base, pui32Dest + (ui32Count / 4));
}
AESTagRead(ui32Base, pui32Tag);
return (true);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* 3. Network Element Identity Network Element Identity element of 3GPP TS 49.031 BSSAP-LE. 3. GPS Assistance Data Requested GPS Data element of 3GPP TS 49.031 BSSAP-LE. */ | static guint16 be_gps_assist_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) | /* 3. Network Element Identity Network Element Identity element of 3GPP TS 49.031 BSSAP-LE. 3. GPS Assistance Data Requested GPS Data element of 3GPP TS 49.031 BSSAP-LE. */
static guint16 be_gps_assist_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) | {
guint32 curr_offset;
curr_offset = offset;
proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_not_decoded_yet, tvb, curr_offset, len);
return(len);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* timer callback reprogram the timer and call the interrupt job */ | static void snd_mpu401_uart_timer(unsigned long data) | /* timer callback reprogram the timer and call the interrupt job */
static void snd_mpu401_uart_timer(unsigned long data) | {
struct snd_mpu401 *mpu = (struct snd_mpu401 *)data;
unsigned long flags;
spin_lock_irqsave(&mpu->timer_lock, flags);
mpu->timer.expires = 1 + jiffies;
add_timer(&mpu->timer);
spin_unlock_irqrestore(&mpu->timer_lock, flags);
if (mpu->rmidi)
_snd_mpu401_uart_interrupt(mpu);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* fc_exch_mgr_add() - Add an exchange manager to a local port's list of EMs @lport: */ | struct fc_exch_mgr_anchor* fc_exch_mgr_add(struct fc_lport *lport, struct fc_exch_mgr *mp, bool(*match)(struct fc_frame *)) | /* fc_exch_mgr_add() - Add an exchange manager to a local port's list of EMs @lport: */
struct fc_exch_mgr_anchor* fc_exch_mgr_add(struct fc_lport *lport, struct fc_exch_mgr *mp, bool(*match)(struct fc_frame *)) | {
struct fc_exch_mgr_anchor *ema;
ema = kmalloc(sizeof(*ema), GFP_ATOMIC);
if (!ema)
return ema;
ema->mp = mp;
ema->match = match;
list_add_tail(&ema->ema_list, &lport->ema_list);
kref_get(&mp->kref);
return ema;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Un-Register the Service E and all its Characteristics... */ | void service_e_3_remove(void) | /* Un-Register the Service E and all its Characteristics... */
void service_e_3_remove(void) | {
bt_gatt_service_unregister(&service_e_3_svc);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function handles External line 5 to 9 interrupts request. */ | void EXTI9_5_IRQHandler(void) | /* This function handles External line 5 to 9 interrupts request. */
void EXTI9_5_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(MFX_IRQOUT_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* chip handler for MESSAGE REJECT received in response to PPR, WIDE or SYNCHRONOUS negotiation. */ | static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) | /* chip handler for MESSAGE REJECT received in response to PPR, WIDE or SYNCHRONOUS negotiation. */
static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym_ccb *cp) | {
sym_nego_default(np, tp, cp);
OUTB(np, HS_PRT, HS_BUSY);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configure DMA channel according to the specified parameter in the dma_handle_t structure. The DMA mode is basic. This mode is used to carry data from peripheral to memory or from memory to peripheral. */ | void ald_dma_config_basic(ald_dma_handle_t *hperh) | /* Configure DMA channel according to the specified parameter in the dma_handle_t structure. The DMA mode is basic. This mode is used to carry data from peripheral to memory or from memory to peripheral. */
void ald_dma_config_basic(ald_dma_handle_t *hperh) | {
dma_cbk[hperh->config.channel].cplt_tc_cbk = hperh->cplt_tc_cbk;
dma_cbk[hperh->config.channel].cplt_ht_cbk = hperh->cplt_ht_cbk;
dma_cbk[hperh->config.channel].cplt_tc_arg = hperh->cplt_tc_arg;
dma_cbk[hperh->config.channel].cplt_ht_arg = hperh->cplt_ht_arg;
ald_dma_clear_flag_status(hperh->config.channel, ALD_DMA_IT_FLAG_TC);
ald_dma_clear_flag_status(hperh->config.channel, ALD_DMA_IT_FLAG_HT);
ald_dma_config_base(&hperh->config);
ald_dma_channel_config(hperh->config.channel, ENABLE);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called if the journal is full enough to make a commit worthwhile, so background thread is kicked to start it. */ | void ubifs_request_bg_commit(struct ubifs_info *c) | /* This function is called if the journal is full enough to make a commit worthwhile, so background thread is kicked to start it. */
void ubifs_request_bg_commit(struct ubifs_info *c) | {
spin_lock(&c->cs_lock);
if (c->cmt_state == COMMIT_RESTING) {
dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
dbg_cstate(COMMIT_BACKGROUND));
c->cmt_state = COMMIT_BACKGROUND;
spin_unlock(&c->cs_lock);
ubifs_wake_up_bgt(c);
} else
spin_unlock(&c->cs_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function will check if page table entry should be splitted to smaller granularity. */ | BOOLEAN ToSplitPageTable(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN Size, IN EFI_PHYSICAL_ADDRESS StackBase, IN UINTN StackSize, IN EFI_PHYSICAL_ADDRESS GhcbBase, IN UINTN GhcbSize) | /* The function will check if page table entry should be splitted to smaller granularity. */
BOOLEAN ToSplitPageTable(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN Size, IN EFI_PHYSICAL_ADDRESS StackBase, IN UINTN StackSize, IN EFI_PHYSICAL_ADDRESS GhcbBase, IN UINTN GhcbSize) | {
if (IsNullDetectionEnabled () && (Address == 0)) {
return TRUE;
}
if (PcdGetBool (PcdCpuStackGuard)) {
if ((StackBase >= Address) && (StackBase < (Address + Size))) {
return TRUE;
}
}
if (PcdGetBool (PcdSetNxForStack)) {
if ((Address < StackBase + StackSize) && ((Address + Size) > StackBase)) {
return TRUE;
}
}
if (GhcbBase != 0) {
if ((Address < GhcbBase + GhcbSize) && ((Address + Size) > GhcbBase)) {
return TRUE;
}
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Accelerometer slope filter / high-pass filter selection on output.. */ | int32_t lsm6dso_xl_hp_path_on_out_set(stmdev_ctx_t *ctx, lsm6dso_hp_slope_xl_en_t val) | /* Accelerometer slope filter / high-pass filter selection on output.. */
int32_t lsm6dso_xl_hp_path_on_out_set(stmdev_ctx_t *ctx, lsm6dso_hp_slope_xl_en_t val) | {
lsm6dso_ctrl8_xl_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t *)®, 1);
if (ret == 0) {
reg.hp_slope_xl_en = ((uint8_t)val & 0x10U) >> 4;
reg.hp_ref_mode_xl = ((uint8_t)val & 0x20U) >> 5;
reg.hpcf_xl = (uint8_t)val & 0x07U;
ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t *)®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Routines to construction the finite state machine for the LEMON parser generator. */ | void FindRulePrecedences(struct lemon *) | /* Routines to construction the finite state machine for the LEMON parser generator. */
void FindRulePrecedences(struct lemon *) | {
struct rule *rp;
for(rp=xp->rule; rp; rp=rp->next){
if( rp->precsym==0 ){
int i, j;
for(i=0; i<rp->nrhs && rp->precsym==0; i++){
struct symbol *sp = rp->rhs[i];
if( sp->type==MULTITERMINAL ){
for(j=0; j<sp->nsubsym; j++){
if( sp->subsym[j]->prec>=0 ){
rp->precsym = sp->subsym[j];
break;
}
}
}else if( sp->prec>=0 ){
rp->precsym = rp->rhs[i];
}
}
}
}
return;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Find the export entry for a given dentry. */ | static struct svc_export* exp_parent(svc_client *clp, struct path *path) | /* Find the export entry for a given dentry. */
static struct svc_export* exp_parent(svc_client *clp, struct path *path) | {
struct dentry *saved = dget(path->dentry);
svc_export *exp = exp_get_by_name(clp, path, NULL);
while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) {
struct dentry *parent = dget_parent(path->dentry);
dput(path->dentry);
path->dentry = parent;
exp = exp_get_by_name(clp, path, NULL);
}
dput(path->dentry);
path->dentry = saved;
return exp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is called from ipath_ib_rcv() to process an incoming packet for the given QP. Called at interrupt level. */ | static void ipath_qp_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, int has_grh, void *data, u32 tlen, struct ipath_qp *qp) | /* This is called from ipath_ib_rcv() to process an incoming packet for the given QP. Called at interrupt level. */
static void ipath_qp_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, int has_grh, void *data, u32 tlen, struct ipath_qp *qp) | {
if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_RECV_OK)) {
dev->n_pkt_drops++;
return;
}
switch (qp->ibqp.qp_type) {
case IB_QPT_SMI:
case IB_QPT_GSI:
if (ib_ipath_disable_sma)
break;
case IB_QPT_UD:
ipath_ud_rcv(dev, hdr, has_grh, data, tlen, qp);
break;
case IB_QPT_RC:
ipath_rc_rcv(dev, hdr, has_grh, data, tlen, qp);
break;
case IB_QPT_UC:
ipath_uc_rcv(dev, hdr, has_grh, data, tlen, qp);
break;
default:
break;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables USI-SPI Tx or Rx path. */ | void USI_SSI_TRxPath_Cmd(USI_TypeDef *usi_dev, u32 path, u32 NewStatus) | /* Enables or disables USI-SPI Tx or Rx path. */
void USI_SSI_TRxPath_Cmd(USI_TypeDef *usi_dev, u32 path, u32 NewStatus) | {
if(NewStatus != DISABLE){
usi_dev->SPI_TRANS_EN |= path;
} else {
usi_dev->SPI_TRANS_EN &= ~path;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Takes jobs of the Q and sends them to the hardware, then puts it on the Q to wait for completion. */ | static void start_io(ctlr_info_t *h) | /* Takes jobs of the Q and sends them to the hardware, then puts it on the Q to wait for completion. */
static void start_io(ctlr_info_t *h) | {
CommandList_struct *c;
while (!hlist_empty(&h->reqQ)) {
c = hlist_entry(h->reqQ.first, CommandList_struct, list);
if ((h->access.fifo_full(h))) {
printk(KERN_WARNING "cciss: fifo full\n");
break;
}
removeQ(c);
h->Qdepth--;
h->access.submit_command(h, c);
addQ(&h->cmpQ, c);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the value of the RTC match 1 register. */ | void HibernateRTCMatch1Set(unsigned long ulMatch) | /* Sets the value of the RTC match 1 register. */
void HibernateRTCMatch1Set(unsigned long ulMatch) | {
HWREG(HIB_RTCM1) = ulMatch;
HibernateWriteComplete();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initializes basic routines and structures pointers, memory size (as given by the bios and saves the command line. */ | void __init plat_mem_setup(void) | /* Initializes basic routines and structures pointers, memory size (as given by the bios and saves the command line. */
void __init plat_mem_setup(void) | {
unsigned long io_base;
_machine_restart = ar7_machine_restart;
_machine_halt = ar7_machine_halt;
pm_power_off = ar7_machine_power_off;
panic_timeout = 3;
io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
if (!io_base)
panic("Can't remap IO base!\n");
set_io_port_base(io_base);
prom_meminit();
printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
get_system_type(),
ar7_chip_id(), ar7_chip_rev());
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function traces 8 bytes of data as specified by the format string. */ | VOID EFIAPI DumpUint64(IN CONST CHAR16 *Format, IN UINT8 *Ptr) | /* This function traces 8 bytes of data as specified by the format string. */
VOID EFIAPI DumpUint64(IN CONST CHAR16 *Format, IN UINT8 *Ptr) | {
UINT64 Val;
Val = *(UINT32 *)(Ptr + sizeof (UINT32));
Val = LShiftU64 (Val, 32);
Val |= (UINT64)*(UINT32 *)Ptr;
Print (Format, Val);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the last ADC1 and ADC2 conversion result data in dual mode. */ | uint32_t ADC_GetDualModeConversionValue(void) | /* Returns the last ADC1 and ADC2 conversion result data in dual mode. */
uint32_t ADC_GetDualModeConversionValue(void) | {
return (*(__IO uint32_t *) DR_ADDRESS);
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* I n d e x l i s t */ | BEGIN_NAMESPACE_QPOASES void IndexlistCON(Indexlist *_THIS, int n) | /* I n d e x l i s t */
BEGIN_NAMESPACE_QPOASES void IndexlistCON(Indexlist *_THIS, int n) | {
Indexlist_init( _THIS,n );
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* configure the PLLT clock multiplication and division factors */ | ErrStatus rcu_pllt_vco_config(uint32_t pllt_psc, uint32_t pllt_mul, uint32_t ppltr_psc) | /* configure the PLLT clock multiplication and division factors */
ErrStatus rcu_pllt_vco_config(uint32_t pllt_psc, uint32_t pllt_mul, uint32_t ppltr_psc) | {
uint32_t reg = 0U;
if((pllt_psc < 2U) || (pllt_psc > 63U)){
return ERROR;
}else{
}
if((pllt_mul < 49U) || (pllt_mul > 432U)){
return ERROR;
}else{
}
if((ppltr_psc < 2U) || (ppltr_psc > 7U)){
return ERROR;
}else{
}
reg = RCU_PLLTCFG;
reg &= ~(RCU_PLLTCFG_PLLTRPSC | RCU_PLLTCFG_PLLTMF | RCU_PLLTCFG_PLLTPSC);
reg |= (PLLTCFG_PLLTPSC(pllt_psc) | PLLTCFG_PLLTMF(pllt_mul) | PLLTCFG_PLLTRPSC(ppltr_psc));
RCU_PLLTCFG = reg;
return SUCCESS;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the PRINCE region base address register.
This function gets PRINCE BASE_ADDR register. */ | status_t PRINCE_GetRegionBaseAddress(PRINCE_Type *base, prince_region_t region, uint32_t *region_base_addr) | /* Gets the PRINCE region base address register.
This function gets PRINCE BASE_ADDR register. */
status_t PRINCE_GetRegionBaseAddress(PRINCE_Type *base, prince_region_t region, uint32_t *region_base_addr) | {
status_t status = kStatus_Success;
switch (region)
{
case kPRINCE_Region0:
*region_base_addr = base->BASE_ADDR0;
break;
case kPRINCE_Region1:
*region_base_addr = base->BASE_ADDR1;
break;
case kPRINCE_Region2:
*region_base_addr = base->BASE_ADDR2;
break;
default:
status = kStatus_InvalidArgument;
break;
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* qt2_boxstoprx - Start and stop reception of data by the FPGA UART in response to requests from the tty layer @serial: pointer to the usb_serial structure for the parent device @uart_number: which UART on the device we are addressing @stop: Whether to start or stop data reception. Set to 1 to stop data being received, and to 0 to start it being received. */ | static int qt2_boxstoprx(struct usb_serial *serial, unsigned short uart_number, unsigned short stop) | /* qt2_boxstoprx - Start and stop reception of data by the FPGA UART in response to requests from the tty layer @serial: pointer to the usb_serial structure for the parent device @uart_number: which UART on the device we are addressing @stop: Whether to start or stop data reception. Set to 1 to stop data being received, and to 0 to start it being received. */
static int qt2_boxstoprx(struct usb_serial *serial, unsigned short uart_number, unsigned short stop) | {
return usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
QT2_STOP_RECEIVE, 0x40, stop, uart_number, NULL, 0, 300);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Delays number of milliseconds in sleep mode (EM2) using the RTC. */ | void UTIL_sleep(uint32_t ms) | /* Delays number of milliseconds in sleep mode (EM2) using the RTC. */
void UTIL_sleep(uint32_t ms) | {
rtcComplete = false;
RTCDRV_StartTimer( rtcId, rtcdrvTimerTypeOneshot, ms, rtcCb, 0 );
while( !rtcComplete )
EMU_EnterEM2(true);
return;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This routine is called by tty_hangup() when a hangup is signaled. */ | static void mxser_hangup(struct tty_struct *tty) | /* This routine is called by tty_hangup() when a hangup is signaled. */
static void mxser_hangup(struct tty_struct *tty) | {
struct mxser_port *info = tty->driver_data;
mxser_flush_buffer(tty);
tty_port_hangup(&info->port);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Manage the Master DRDY signal on INT1 pad.. */ | int32_t lsm6dsl_sh_drdy_on_int1_get(stmdev_ctx_t *ctx, uint8_t *val) | /* Manage the Master DRDY signal on INT1 pad.. */
int32_t lsm6dsl_sh_drdy_on_int1_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lsm6dsl_master_config_t master_config;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_MASTER_CONFIG,
(uint8_t*)&master_config, 1);
*val = master_config.drdy_on_int1;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Disable Kinetis Processor System (PS) cache and save previous state */ | void kinetis_ps_cache_save(unsigned long *flags) | /* Disable Kinetis Processor System (PS) cache and save previous state */
void kinetis_ps_cache_save(unsigned long *flags) | {
*flags = KINETIS_LMEM_PSCCR &
(KINETIS_LMEM_CCR_ENWRBUF_MSK | KINETIS_LMEM_CCR_ENCACHE_MSK);
KINETIS_LMEM_PSCCR =
KINETIS_LMEM_CCR_GO_MSK |
KINETIS_LMEM_CCR_PUSHW1_MSK | KINETIS_LMEM_CCR_INVW1_MSK |
KINETIS_LMEM_CCR_PUSHW0_MSK | KINETIS_LMEM_CCR_INVW0_MSK;
while (KINETIS_LMEM_PSCCR & KINETIS_LMEM_CCR_GO_MSK);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configure the transmit engine with the ring buffers we have created and prepare it for use. */ | void ConfigTxDmaRegs(struct et131x_adapter *etdev) | /* Configure the transmit engine with the ring buffers we have created and prepare it for use. */
void ConfigTxDmaRegs(struct et131x_adapter *etdev) | {
struct _TXDMA_t __iomem *txdma = &etdev->regs->txdma;
writel((u32) ((u64)etdev->tx_ring.tx_desc_ring_pa >> 32),
&txdma->pr_base_hi);
writel((u32) etdev->tx_ring.tx_desc_ring_pa,
&txdma->pr_base_lo);
writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des);
writel((u32)((u64)etdev->tx_ring.tx_status_pa >> 32),
&txdma->dma_wb_base_hi);
writel((u32)etdev->tx_ring.tx_status_pa, &txdma->dma_wb_base_lo);
*etdev->tx_ring.tx_status = 0;
writel(0, &txdma->service_request);
etdev->tx_ring.send_idx = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fast approximation to the trigonometric cosine function for Q15 data. */ | q15_t arm_cos_q15(q15_t x) | /* Fast approximation to the trigonometric cosine function for Q15 data. */
q15_t arm_cos_q15(q15_t x) | {
q15_t cosVal;
int32_t index;
q15_t a, b;
q15_t fract;
x = (uint16_t)x + 0x2000;
if (x < 0)
{
x = (uint16_t)x + 0x8000;
}
index = (uint32_t)x >> FAST_MATH_Q15_SHIFT;
fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9;
a = sinTable_q15[index];
b = sinTable_q15[index+1];
cosVal = (q31_t) (0x8000 - fract) * a >> 16;
cosVal = (q15_t) ((((q31_t) cosVal << 16) + ((q31_t) fract * b)) >> 16);
return (cosVal << 1);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* CMU low frequency register synchronization freeze control.
Another usage scenario of this feature, is when using an API (such as the CMU API) for modifying several bit fields consecutively in the same register. If freeze mode is enabled during this sequence, stalling can be avoided. */ | void CMU_FreezeEnable(bool enable) | /* CMU low frequency register synchronization freeze control.
Another usage scenario of this feature, is when using an API (such as the CMU API) for modifying several bit fields consecutively in the same register. If freeze mode is enabled during this sequence, stalling can be avoided. */
void CMU_FreezeEnable(bool enable) | {
if (enable)
{
while (CMU->SYNCBUSY)
;
CMU->FREEZE = CMU_FREEZE_REGFREEZE;
}
else
{
CMU->FREEZE = 0;
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Stop and destroy the heartbeat timer for TCP driver. */ | VOID TcpDestroyTimer(VOID) | /* Stop and destroy the heartbeat timer for TCP driver. */
VOID TcpDestroyTimer(VOID) | {
ASSERT (mTcpTimer.RefCnt > 0);
mTcpTimer.RefCnt--;
if (mTcpTimer.RefCnt > 0) {
return;
}
gBS->SetTimer (mTcpTimer.TimerEvent, TimerCancel, 0);
gBS->CloseEvent (mTcpTimer.TimerEvent);
mTcpTimer.TimerEvent = NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* (The code to set that register will be generated later, but will be placed earlier in the code sequence.) */ | static struct slist * gen_abs_offset_varpart(compiler_state_t *, bpf_abs_offset *) | /* (The code to set that register will be generated later, but will be placed earlier in the code sequence.) */
static struct slist * gen_abs_offset_varpart(compiler_state_t *, bpf_abs_offset *) | {
struct slist *s;
if (off->is_variable) {
if (off->reg == -1) {
off->reg = alloc_reg(cstate);
}
s = new_stmt(cstate, BPF_LDX|BPF_MEM);
s->s.k = off->reg;
return s;
} else {
return NULL;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* this function is a POSIX compliant version, which will seek the offset for an open file descriptor. */ | off_t lseek(int fd, off_t offset, int whence) | /* this function is a POSIX compliant version, which will seek the offset for an open file descriptor. */
off_t lseek(int fd, off_t offset, int whence) | {
off_t result;
struct dfs_file *file;
file = fd_get(fd);
if (file == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
result = dfs_file_lseek(file, offset, whence);
if (result < 0)
{
rt_set_errno(result);
return -1;
}
return result;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* No need to lock here because we should be the only user. */ | static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, int psize, int ssize) | /* No need to lock here because we should be the only user. */
static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, int psize, int ssize) | {
unsigned long vsid, va;
long slot;
struct hash_pte *hptep;
vsid = get_kernel_vsid(ea, ssize);
va = hpt_va(ea, vsid, ssize);
slot = native_hpte_find(va, psize, ssize);
if (slot == -1)
panic("could not find page to bolt\n");
hptep = htab_address + slot;
hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) |
(newpp & (HPTE_R_PP | HPTE_R_N));
tlbie(va, psize, ssize, 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Handles a notification that a read-by-type response has been fully processed for the specified find-included-services proc. */ | static int ble_gattc_find_inc_svcs_rx_complete(struct ble_gattc_proc *proc, int status) | /* Handles a notification that a read-by-type response has been fully processed for the specified find-included-services proc. */
static int ble_gattc_find_inc_svcs_rx_complete(struct ble_gattc_proc *proc, int status) | {
int rc;
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status != 0) {
ble_gattc_find_inc_svcs_cb(proc, status, 0, NULL);
return BLE_HS_EDONE;
}
if (proc->find_inc_svcs.prev_handle == 0xffff) {
ble_gattc_find_inc_svcs_cb(proc, BLE_HS_EDONE, 0, NULL);
return BLE_HS_EDONE;
}
rc = ble_gattc_find_inc_svcs_resume(proc);
if (rc != 0) {
return BLE_HS_EDONE;
}
return 0;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* handle a delay specified in terms of microseconds */ | void __udelay(unsigned long usecs) | /* handle a delay specified in terms of microseconds */
void __udelay(unsigned long usecs) | {
signed long ioclk, stop;
stop = __muldiv64u(usecs, MN10300_TSCCLK, 1000000);
stop = TMTSCBC - stop;
do {
ioclk = TMTSCBC;
} while (stop < ioclk);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The function is used to configure several receive message objects. */ | int32_t CAN_SetMultiRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32MsgCount, uint32_t u32IDType, uint32_t u32ID) | /* The function is used to configure several receive message objects. */
int32_t CAN_SetMultiRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32MsgCount, uint32_t u32IDType, uint32_t u32ID) | {
uint32_t i;
uint32_t u32TimeOutCount;
uint32_t u32EOB_Flag = 0UL;
for(i = 1UL; i <= u32MsgCount; i++)
{
u32TimeOutCount = 0UL;
u32MsgNum += (i - 1UL);
if(i == u32MsgCount)
{
u32EOB_Flag = 1UL;
}
while(CAN_SetRxMsgObj(tCAN, (uint8_t)u32MsgNum, (uint8_t)u32IDType, u32ID, (uint8_t)u32EOB_Flag) == (int32_t)FALSE)
{
if(++u32TimeOutCount >= RETRY_COUNTS)
{
return (int32_t)FALSE;
}
}
}
return (int32_t)TRUE;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The peripheral clock is the same as the processor clock. This value is returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()). */ | void PECIConfigGet(unsigned long ulBase, unsigned long ulPECIClk, unsigned long *pulBaud, unsigned long *pulPoll, unsigned long *pulOffset, unsigned long *pulRetry) | /* The peripheral clock is the same as the processor clock. This value is returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()). */
void PECIConfigGet(unsigned long ulBase, unsigned long ulPECIClk, unsigned long *pulBaud, unsigned long *pulPoll, unsigned long *pulOffset, unsigned long *pulRetry) | {
unsigned long ulTemp;
ASSERT(ulBase == PECI0_BASE);
ASSERT(ulPECIClk != 0);
ASSERT(*pulBaud != 0);
ASSERT(*pulPoll != 0);
ASSERT(*pulOffset != 0);
ASSERT(*pulRetry != 0);
ulTemp = HWREG(ulBase + PECI_O_CTL);
*pulOffset = ((ulTemp & PECI_CTL_OFFSET_M) >> PECI_CTL_OFFSET_S);
*pulRetry = ((ulTemp & PECI_CTL_CRETRY_M) >> PECI_CTL_CRETRY_S);
ulTemp = HWREG(ulBase + PECI_O_DIV);
*pulBaud = ulPECIClk / ((ulTemp & PECI_DIV_BAUD_M) >> PECI_DIV_BAUD_S);
*pulPoll = ((((ulTemp & PECI_DIV_POLL_M) >> PECI_DIV_POLL_S) * 1000) /
(ulPECIClk / PECI_POLL_PRESCALE));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* t h r o w E r r o r */ | returnValue MessageHandling_throwError(MessageHandling *_THIS, returnValue Enumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus) | /* t h r o w E r r o r */
returnValue MessageHandling_throwError(MessageHandling *_THIS, returnValue Enumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus) | {
if ( Enumber <= SUCCESSFUL_RETURN )
return MessageHandling_throwError( _THIS,RET_ERROR_UNDEFINED,0,__FUNC__,__FILE__,__LINE__,VS_VISIBLE );
if ( _THIS->errorVisibility == VS_VISIBLE )
return MessageHandling_throwMessage( _THIS,Enumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"ERROR" );
else
return Enumber;
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* This function is called by SmmChildDispatcher module to report an existing SMI handler is unregistered, to SmmCore. */ | EFI_STATUS EFIAPI SmiHandlerProfileUnregisterHandler(IN EFI_GUID *HandlerGuid, IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN VOID *Context OPTIONAL, IN UINTN ContextSize OPTIONAL) | /* This function is called by SmmChildDispatcher module to report an existing SMI handler is unregistered, to SmmCore. */
EFI_STATUS EFIAPI SmiHandlerProfileUnregisterHandler(IN EFI_GUID *HandlerGuid, IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN VOID *Context OPTIONAL, IN UINTN ContextSize OPTIONAL) | {
if (mSmiHandlerProfile != NULL) {
return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, Context, ContextSize);
}
return EFI_UNSUPPORTED;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Check whether the current CPU operation mode is handler mode. */ | SL_WEAK bool CORE_InIrqContext(void) | /* Check whether the current CPU operation mode is handler mode. */
SL_WEAK bool CORE_InIrqContext(void) | {
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0U;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Description: Look through the domain hash table searching for an entry to match @domain and @addr, return a pointer to a copy of the entry or NULL. The caller is responsible for ensuring that rcu_read_lock() is called. */ | struct netlbl_domaddr4_map* netlbl_domhsh_getentry_af4(const char *domain, __be32 addr) | /* Description: Look through the domain hash table searching for an entry to match @domain and @addr, return a pointer to a copy of the entry or NULL. The caller is responsible for ensuring that rcu_read_lock() is called. */
struct netlbl_domaddr4_map* netlbl_domhsh_getentry_af4(const char *domain, __be32 addr) | {
struct netlbl_dom_map *dom_iter;
struct netlbl_af4list *addr_iter;
dom_iter = netlbl_domhsh_search_def(domain);
if (dom_iter == NULL)
return NULL;
if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT)
return NULL;
addr_iter = netlbl_af4list_search(addr,
&dom_iter->type_def.addrsel->list4);
if (addr_iter == NULL)
return NULL;
return netlbl_domhsh_addr4_entry(addr_iter);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function is called from finish_task_switch when task tk becomes dead, so that we can recycle any function-return probe instances associated with this task. These left over instances represent probed functions that have been called but will never return. */ | void __kprobes kprobe_flush_task(struct task_struct *tk) | /* This function is called from finish_task_switch when task tk becomes dead, so that we can recycle any function-return probe instances associated with this task. These left over instances represent probed functions that have been called but will never return. */
void __kprobes kprobe_flush_task(struct task_struct *tk) | {
struct kretprobe_instance *ri;
struct hlist_head *head, empty_rp;
struct hlist_node *node, *tmp;
unsigned long hash, flags = 0;
if (unlikely(!kprobes_initialized))
return;
hash = hash_ptr(tk, KPROBE_HASH_BITS);
head = &kretprobe_inst_table[hash];
kretprobe_table_lock(hash, &flags);
hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
if (ri->task == tk)
recycle_rp_inst(ri, &empty_rp);
}
kretprobe_table_unlock(hash, &flags);
INIT_HLIST_HEAD(&empty_rp);
hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If this interface is not supported, then return zero. */ | UINTN EFIAPI CryptoServiceSha1GetContextSize(VOID) | /* If this interface is not supported, then return zero. */
UINTN EFIAPI CryptoServiceSha1GetContextSize(VOID) | {
return CALL_BASECRYPTLIB (Sha1.Services.GetContextSize, Sha1GetContextSize, (), 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function decodes utc time, with peculiarity case for */ | static void decode_zcl_appl_stats_utc_time(gchar *s, guint32 value) | /* This function decodes utc time, with peculiarity case for */
static void decode_zcl_appl_stats_utc_time(gchar *s, guint32 value) | {
if (value == ZBEE_ZCL_APPL_STATS_INVALID_TIME)
g_snprintf(s, ITEM_LABEL_LENGTH, "Invalid UTC Time");
else {
gchar *utc_time;
value += ZBEE_ZCL_NSTIME_UTC_OFFSET;
utc_time = abs_time_secs_to_str (NULL, value, ABSOLUTE_TIME_LOCAL, TRUE);
g_snprintf(s, ITEM_LABEL_LENGTH, "%s", utc_time);
wmem_free(NULL, utc_time);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* e1000_write_vfta - Writes a value to the specified offset in the VLAN filter table. @hw: Struct containing variables accessed by shared code @offset: Offset in VLAN filer table to write @value: Value to write into VLAN filter table */ | void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) | /* e1000_write_vfta - Writes a value to the specified offset in the VLAN filter table. @hw: Struct containing variables accessed by shared code @offset: Offset in VLAN filer table to write @value: Value to write into VLAN filter table */
void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) | {
u32 temp;
if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) {
temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1));
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value);
E1000_WRITE_FLUSH();
E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp);
E1000_WRITE_FLUSH();
} else {
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value);
E1000_WRITE_FLUSH();
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) | /* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
TIMx_CLK_ENABLE();
TIMx_CHANNEL_GPIO_PORT;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = TIMx_GPIO_AF_CHANNEL1;
GPIO_InitStruct.Pin = TIMx_GPIO_PIN_CHANNEL1;
HAL_GPIO_Init(TIMx_GPIO_PORT_CHANNEL1, &GPIO_InitStruct);
GPIO_InitStruct.Alternate = TIMx_GPIO_AF_CHANNEL3;
GPIO_InitStruct.Pin = TIMx_GPIO_PIN_CHANNEL3;
HAL_GPIO_Init(TIMx_GPIO_PORT_CHANNEL3, &GPIO_InitStruct);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Set the IMU-3000 full scale range.
This routine sets the IMU-3000 full scale range using an index to a table of valid ranges: +/-250, +/-500, +/-1000, and +/-2000 deg/sec. */ | static bool imu3000_set_range(sensor_hal_t *hal, int16_t range) | /* Set the IMU-3000 full scale range.
This routine sets the IMU-3000 full scale range using an index to a table of valid ranges: +/-250, +/-500, +/-1000, and +/-2000 deg/sec. */
static bool imu3000_set_range(sensor_hal_t *hal, int16_t range) | {
sensor_fs_sel = range;
uint8_t const dlpf_fs = (~FS_SEL_FIELD) &
sensor_bus_get(hal, IMU3000_DLPF_FS);
sensor_bus_put(hal, IMU3000_DLPF_FS,
dlpf_fs | range_table [sensor_fs_sel].reserved_val);
return true;
} | memfault/zero-to-main | C++ | null | 200 |
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ | VOID* EFIAPI ReallocateReservedPool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | /* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocateReservedPool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | {
return ReallocatePool (OldSize, NewSize, OldBuffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Note: caller frees hostname and export path, even on error. */ | static int nfs_parse_devname(const char *dev_name, char **hostname, size_t maxnamlen, char **export_path, size_t maxpathlen) | /* Note: caller frees hostname and export path, even on error. */
static int nfs_parse_devname(const char *dev_name, char **hostname, size_t maxnamlen, char **export_path, size_t maxpathlen) | {
if (*dev_name == '[')
return nfs_parse_protected_hostname(dev_name,
hostname, maxnamlen,
export_path, maxpathlen);
return nfs_parse_simple_hostname(dev_name,
hostname, maxnamlen,
export_path, maxpathlen);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If PcdCpuFeaturesInitAfterSmmRelocation is TRUE, it will register one SMM Configuration Protocol notify function to perform CPU features initialization. Otherwise, it will perform CPU features initialization directly. */ | EFI_STATUS EFIAPI CpuFeaturesDxeInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* If PcdCpuFeaturesInitAfterSmmRelocation is TRUE, it will register one SMM Configuration Protocol notify function to perform CPU features initialization. Otherwise, it will perform CPU features initialization directly. */
EFI_STATUS EFIAPI CpuFeaturesDxeInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
VOID *Registration;
EFI_STATUS Status;
EFI_HANDLE Handle;
if (GetFirstGuidHob (&gEdkiiCpuFeaturesInitDoneGuid) != NULL) {
Handle = NULL;
Status = gBS->InstallProtocolInterface (
&Handle,
&gEdkiiCpuFeaturesInitDoneGuid,
EFI_NATIVE_INTERFACE,
NULL
);
ASSERT_EFI_ERROR (Status);
return Status;
}
if (PcdGetBool (PcdCpuFeaturesInitAfterSmmRelocation)) {
EfiCreateProtocolNotifyEvent (
&gEfiSmmConfigurationProtocolGuid,
TPL_CALLBACK,
SmmConfigurationEventNotify,
NULL,
&Registration
);
} else {
CpuFeaturesInitializeWorker ();
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The return value is guaranteed to be monotonic in that range as long as there is always less than 89 seconds between successive calls to this function. */ | unsigned long long sched_clock(void) | /* The return value is guaranteed to be monotonic in that range as long as there is always less than 89 seconds between successive calls to this function. */
unsigned long long sched_clock(void) | {
unsigned long long v = cnt32_to_63(readl(VERSATILE_REFCOUNTER));
v *= 125<<1;
do_div(v, 3<<1);
return v;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return the output level (high or low) of the selected comparator. */ | uint32_t COMP_ReadOutPutLevel(COMP_SELECT_T compSelect) | /* Return the output level (high or low) of the selected comparator. */
uint32_t COMP_ReadOutPutLevel(COMP_SELECT_T compSelect) | {
uint32_t compOUT = 0x00;
if (compSelect == COMP_SELECT_COMP1)
{
if ((COMP->CSTS & COMP_CSTS_COMP1OUT) != 0)
{
compOUT = COMP_OUTPUTLEVEL_HIGH;
}
else
compOUT = COMP_OUTPUTLEVEL_LOW;
}
else
{
if ((COMP->CSTS & COMP_CSTS_COMP2OUT) != 0)
{
compOUT = COMP_OUTPUTLEVEL_HIGH;
}
else
compOUT = COMP_OUTPUTLEVEL_LOW;
}
return (uint32_t)(compOUT);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* determine if the FPU registers have actually been used */ | static int fpuregs_active(struct task_struct *target, const struct user_regset *regset) | /* determine if the FPU registers have actually been used */
static int fpuregs_active(struct task_struct *target, const struct user_regset *regset) | {
return is_using_fpu(target) ? regset->n : 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Unregisters an interrupt handler for the I2S controller. */ | void I2SIntUnregister(unsigned long ulBase) | /* Unregisters an interrupt handler for the I2S controller. */
void I2SIntUnregister(unsigned long ulBase) | {
ASSERT(ulBase == I2S0_BASE);
IntDisable(INT_I2S0);
IntUnregister(INT_I2S0);
} | watterott/WebRadio | C++ | null | 71 |
/* Returns TRUE if the buffer parses against the core grammar, false otherwise. */ | gboolean cr_statement_does_buf_parses_against_core(const guchar *a_buf, enum CREncoding a_encoding) | /* Returns TRUE if the buffer parses against the core grammar, false otherwise. */
gboolean cr_statement_does_buf_parses_against_core(const guchar *a_buf, enum CREncoding a_encoding) | {
CRParser *parser = NULL;
enum CRStatus status = CR_OK;
gboolean result = FALSE;
parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
a_encoding, FALSE);
g_return_val_if_fail (parser, FALSE);
status = cr_parser_set_use_core_grammar (parser, TRUE);
if (status != CR_OK) {
goto cleanup;
}
status = cr_parser_parse_statement_core (parser);
if (status == CR_OK) {
result = TRUE;
}
cleanup:
if (parser) {
cr_parser_destroy (parser);
}
return result;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.