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 |
|---|---|---|---|---|---|---|---|
/* This function will let current thread sleep for some ticks. */ | rt_err_t rt_thread_sleep(rt_tick_t tick) | /* This function will let current thread sleep for some ticks. */
rt_err_t rt_thread_sleep(rt_tick_t tick) | {
register rt_base_t temp;
struct rt_thread *thread;
thread = rt_thread_self();
RT_ASSERT(thread != RT_NULL);
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
temp = rt_hw_interrupt_disable();
rt_thread_suspend(thread);
rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &tick);
rt_timer_start(&(thread->thread_timer));
rt_hw_interrupt_enable(temp);
rt_schedule();
if (thread->error == -RT_ETIMEOUT)
thread->error = RT_EOK;
return RT_EOK;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Efi items have no locking or pushing. However, since EFIs are pulled from the AIL when their corresponding EFDs are committed to disk, their situation is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller will eventually flush the log. This should help in getting the EFI out of the AIL. */ | STATIC uint xfs_efi_item_trylock(xfs_efi_log_item_t *efip) | /* Efi items have no locking or pushing. However, since EFIs are pulled from the AIL when their corresponding EFDs are committed to disk, their situation is very similar to being pinned. Return XFS_ITEM_PINNED so that the caller will eventually flush the log. This should help in getting the EFI out of the AIL. */
STATIC uint xfs_efi_item_trylock(xfs_efi_log_item_t *efip) | {
return XFS_ITEM_PINNED;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Describe the mount options on this VFS mountpoint */ | static int nfs_show_options(struct seq_file *, struct vfsmount *) | /* Describe the mount options on this VFS mountpoint */
static int nfs_show_options(struct seq_file *, struct vfsmount *) | {
struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
nfs_show_mount_options(m, nfss, 0);
seq_printf(m, ",addr=%s",
rpc_peeraddr2str(nfss->nfs_client->cl_rpcclient,
RPC_DISPLAY_ADDR));
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Register an exception handler for exception code EXCn. */ | void Exception_Register_EXC(uint32_t EXCn, unsigned long exc_handler) | /* Register an exception handler for exception code EXCn. */
void Exception_Register_EXC(uint32_t EXCn, unsigned long exc_handler) | {
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn != 0)) {
SystemExceptionHandlers[EXCn] = exc_handler;
} else if (EXCn == NMI_EXCn) {
SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM] = exc_handler;
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* rb_head_page_dactivate - clears head page ptr (for free list) */ | static void rb_head_page_deactivate(struct ring_buffer_per_cpu *cpu_buffer) | /* rb_head_page_dactivate - clears head page ptr (for free list) */
static void rb_head_page_deactivate(struct ring_buffer_per_cpu *cpu_buffer) | {
struct list_head *hd;
rb_list_head_clear(cpu_buffer->pages);
list_for_each(hd, cpu_buffer->pages)
rb_list_head_clear(hd);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Note also that we support "console=ttySx" where "x" is either 0 or 1. */ | static void __init pnx8xxx_init_ports(void) | /* Note also that we support "console=ttySx" where "x" is either 0 or 1. */
static void __init pnx8xxx_init_ports(void) | {
static int first = 1;
int i;
if (!first)
return;
first = 0;
for (i = 0; i < NR_PORTS; i++) {
init_timer(&pnx8xxx_ports[i].timer);
pnx8xxx_ports[i].timer.function = pnx8xxx_timeout;
pnx8xxx_ports[i].timer.data = (unsigned long)&pnx8xxx_ports[i];
pnx8xxx_ports[i].port.ops = &pnx8xxx_pops;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. */ | static int summit_phys_pkg_id(int cpuid_apic, int index_msb) | /* See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. */
static int summit_phys_pkg_id(int cpuid_apic, int index_msb) | {
return hard_smp_processor_id() >> index_msb;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API reads the auxiliary I2C interface configuration which is set in the sensor. */ | uint16_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev) | /* This API reads the auxiliary I2C interface configuration which is set in the sensor. */
uint16_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_IF_CONFIG_ADDR, &data, 1, dev);
if (rslt == BMA4_OK)
*if_mode = BMA4_GET_BITSLICE(data, BMA4_IF_CONFIG_IF_MODE);
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Register the PSC interrupt dispatchers for autovector interrupts 3-6. */ | void __init psc_register_interrupts(void) | /* Register the PSC interrupt dispatchers for autovector interrupts 3-6. */
void __init psc_register_interrupts(void) | {
if (request_irq(IRQ_AUTO_3, psc_irq, 0, "psc3", (void *) 0x30))
pr_err("Couldn't register psc%d interrupt\n", 3);
if (request_irq(IRQ_AUTO_4, psc_irq, 0, "psc4", (void *) 0x40))
pr_err("Couldn't register psc%d interrupt\n", 4);
if (request_irq(IRQ_AUTO_5, psc_irq, 0, "psc5", (void *) 0x50))
pr_err("Couldn't register psc%d interrupt\n", 5);
if (request_irq(IRQ_AUTO_6, psc_irq, 0, "psc6", (void *) 0x60))
pr_err("Couldn't register psc%d interrupt\n", 6);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Build and insert the kernel module as done in the kprobe example. You will see the trace data in /var/log/messages and on the console whenever do_fork() is invoked to create a new process. (Some messages may be suppressed if syslogd is configured to eliminate duplicate messages.) Jumper probe for do_fork. Mirror principle enables access to arguments of the probed routine from the probe handler. */ | static long jdo_fork(unsigned long clone_flags, unsigned long stack_start, struct pt_regs *regs, unsigned long stack_size, int __user *parent_tidptr, int __user *child_tidptr) | /* Build and insert the kernel module as done in the kprobe example. You will see the trace data in /var/log/messages and on the console whenever do_fork() is invoked to create a new process. (Some messages may be suppressed if syslogd is configured to eliminate duplicate messages.) Jumper probe for do_fork. Mirror principle enables access to arguments of the probed routine from the probe handler. */
static long jdo_fork(unsigned long clone_flags, unsigned long stack_start, struct pt_regs *regs, unsigned long stack_size, int __user *parent_tidptr, int __user *child_tidptr) | {
printk(KERN_INFO "jprobe: clone_flags = 0x%lx, stack_size = 0x%lx,"
" regs = 0x%p\n",
clone_flags, stack_size, regs);
jprobe_return();
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function does not return until the protection has been saved. */ | long FlashProtectSave(void) | /* This function does not return until the protection has been saved. */
long FlashProtectSave(void) | {
unsigned long ulTemp, ulLimit;
ulLimit = CLASS_IS_SANDSTORM ? 2 : 8;
for(ulTemp = 0; ulTemp < ulLimit; ulTemp++)
{
HWREG(FLASH_FMA) = ulTemp;
HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT;
while(HWREG(FLASH_FMC) & FLASH_FMC_COMT)
{
}
}
return(0);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Processes an event, executes any transitions related to that event and updates the state of the station. */ | static u16 llc_station_next_state(struct sk_buff *skb) | /* Processes an event, executes any transitions related to that event and updates the state of the station. */
static u16 llc_station_next_state(struct sk_buff *skb) | {
u16 rc = 1;
struct llc_station_state_trans *trans;
if (llc_main_station.state > LLC_NBR_STATION_STATES)
goto out;
trans = llc_find_station_trans(skb);
if (trans) {
rc = llc_exec_station_trans_actions(trans, skb);
if (!rc)
llc_main_station.state = trans->next_state;
} else
rc = 0;
out:
llc_station_free_ev(skb);
return rc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* For simplicity, this calculation assumes that all the transfers in the periodic schedule may occur in the same (micro)frame */ | static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | /* For simplicity, this calculation assumes that all the transfers in the periodic schedule may occur in the same (micro)frame */
static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | {
int status;
s16 max_claimed_usecs;
status = 0;
if (qh->dev_speed == USB_SPEED_HIGH || qh->do_split) {
max_claimed_usecs = 100 - qh->usecs;
} else {
max_claimed_usecs = 900 - qh->usecs;
}
if (hsotg->periodic_usecs > max_claimed_usecs) {
dev_err(hsotg->dev,
"%s: already claimed usecs %d, required usecs %d\n",
__func__, hsotg->periodic_usecs, qh->usecs);
status = -ENOSPC;
}
return status;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base CDOG peripheral base address. param sub Value to be substracted. */ | void CDOG_Sub(CDOG_Type *base, uint32_t sub) | /* param base CDOG peripheral base address. param sub Value to be substracted. */
void CDOG_Sub(CDOG_Type *base, uint32_t sub) | {
base->SUB = (secure_counter_t)sub;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Send an initial DISCOVER or REQUEST message according to the DHCP service's current state. */ | EFI_STATUS DhcpInitRequest(IN DHCP_SERVICE *DhcpSb) | /* Send an initial DISCOVER or REQUEST message according to the DHCP service's current state. */
EFI_STATUS DhcpInitRequest(IN DHCP_SERVICE *DhcpSb) | {
EFI_STATUS Status;
ASSERT ((DhcpSb->DhcpState == Dhcp4Init) || (DhcpSb->DhcpState == Dhcp4InitReboot));
DhcpSb->ActiveChild->ElaspedTime = 0;
if (DhcpSb->DhcpState == Dhcp4Init) {
DhcpSetState (DhcpSb, Dhcp4Selecting, FALSE);
Status = DhcpSendMessage (DhcpSb, NULL, NULL, DHCP_MSG_DISCOVER, NULL);
if (EFI_ERROR (Status)) {
DhcpSb->DhcpState = Dhcp4Init;
return Status;
}
} else {
DhcpSetState (DhcpSb, Dhcp4Rebooting, FALSE);
Status = DhcpSendMessage (DhcpSb, NULL, NULL, DHCP_MSG_REQUEST, NULL);
if (EFI_ERROR (Status)) {
DhcpSb->DhcpState = Dhcp4InitReboot;
return Status;
}
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Master transmits the address byte to select the slave device. */ | void USI_I2C_SetSlaveAddress(USI_TypeDef *USIx, u16 Address) | /* Master transmits the address byte to select the slave device. */
void USI_I2C_SetSlaveAddress(USI_TypeDef *USIx, u16 Address) | {
u32 tar = USIx->I2C_TAR & ~(USI_I2C_IC_TAR);
assert_param(IS_USI_I2C_ALL_PERIPH(USIx));
USIx->I2C_TAR = (Address & USI_I2C_IC_TAR) | tar;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Description: Allocate and initialize an sg table. If @nents@ is larger than SG_MAX_SINGLE_ALLOC a chained sg table will be setup. */ | int sg_alloc_table(struct sg_table *table, unsigned int nents, gfp_t gfp_mask) | /* Description: Allocate and initialize an sg table. If @nents@ is larger than SG_MAX_SINGLE_ALLOC a chained sg table will be setup. */
int sg_alloc_table(struct sg_table *table, unsigned int nents, gfp_t gfp_mask) | {
int ret;
ret = __sg_alloc_table(table, nents, SG_MAX_SINGLE_ALLOC,
gfp_mask, sg_kmalloc);
if (unlikely(ret))
__sg_free_table(table, SG_MAX_SINGLE_ALLOC, sg_kfree);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If any reserved bits in Address are set, 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT32 EFIAPI S3PciSegmentBitFieldOr32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData) | /* If any reserved bits in Address are set, 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentBitFieldOr32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData) | {
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldOr32 (Address, StartBit, EndBit, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Sm3Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceSm3Final(IN OUT VOID *Sm3Context, OUT UINT8 *HashValue) | /* If Sm3Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSm3Final(IN OUT VOID *Sm3Context, OUT UINT8 *HashValue) | {
return CALL_BASECRYPTLIB (Sm3.Services.Final, Sm3Final, (Sm3Context, HashValue), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the TIMx peripheral Preload register on CCR4. */ | void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | /* Enables or disables the TIMx peripheral Preload register on CCR4. */
void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | {
uint16_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint16_t)(~TIM_CCMR2_OC4PE);
tmpccmr2 |= (uint16_t)(TIM_OCPreload << 8);
TIMx->CCMR2 = tmpccmr2;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Delay number of tick Systicks (happens every 1 ms).
Support and FAQ: visit */ | static __INLINE void delay_ms(uint32_t ul_dly_ticks) | /* Delay number of tick Systicks (happens every 1 ms).
Support and FAQ: visit */
static __INLINE void delay_ms(uint32_t ul_dly_ticks) | {
uint32_t ul_cur_ticks;
ul_cur_ticks = g_ul_ms_ticks;
while ((g_ul_ms_ticks - ul_cur_ticks) < ul_dly_ticks) {
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The generic VIA interrupt routines (shamelessly stolen from Alan Cox's via6522.c :-), disable/pending masks added. */ | irqreturn_t via1_irq(int, void *) | /* The generic VIA interrupt routines (shamelessly stolen from Alan Cox's via6522.c :-), disable/pending masks added. */
irqreturn_t via1_irq(int, void *) | {
int irq_num;
unsigned char irq_bit, events;
events = via1[vIFR] & via1[vIER] & 0x7F;
if (!events)
return IRQ_NONE;
irq_num = VIA1_SOURCE_BASE;
irq_bit = 1;
do {
if (events & irq_bit) {
via1[vIFR] = irq_bit;
m68k_handle_int(irq_num);
}
++irq_num;
irq_bit <<= 1;
} while (events >= irq_bit);
return IRQ_HANDLED;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* megasas_free_cmds - Free all the cmds in the free cmd pool @instance: Adapter soft state */ | static void megasas_free_cmds(struct megasas_instance *instance) | /* megasas_free_cmds - Free all the cmds in the free cmd pool @instance: Adapter soft state */
static void megasas_free_cmds(struct megasas_instance *instance) | {
int i;
megasas_teardown_frame_pool(instance);
for (i = 0; i < instance->max_fw_cmds; i++)
kfree(instance->cmd_list[i]);
kfree(instance->cmd_list);
instance->cmd_list = NULL;
INIT_LIST_HEAD(&instance->cmd_pool);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the main interrupt service routine. hardware_lock locked upon entry. runs in interrupt context. */ | void qla4xxx_interrupt_service_routine(struct scsi_qla_host *ha, uint32_t intr_status) | /* This is the main interrupt service routine. hardware_lock locked upon entry. runs in interrupt context. */
void qla4xxx_interrupt_service_routine(struct scsi_qla_host *ha, uint32_t intr_status) | {
if (intr_status & CSR_SCSI_COMPLETION_INTR)
qla4xxx_process_response_queue(ha);
if (intr_status & CSR_SCSI_PROCESSOR_INTR) {
qla4xxx_isr_decode_mailbox(ha,
readl(&ha->reg->mailbox[0]));
writel(set_rmask(CSR_SCSI_PROCESSOR_INTR),
&ha->reg->ctrl_status);
readl(&ha->reg->ctrl_status);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* f* bus_vcxk/vcxk_request FUNCTION requests viewing of display memory */ | int vcxk_request(void) | /* f* bus_vcxk/vcxk_request FUNCTION requests viewing of display memory */
int vcxk_request(void) | {
VCXK_CLR_PIN(CONFIG_SYS_VCXK_REQUEST_PORT,
CONFIG_SYS_VCXK_REQUEST_PIN)
VCXK_SET_PIN(CONFIG_SYS_VCXK_REQUEST_PORT,
CONFIG_SYS_VCXK_REQUEST_PIN);
return 1;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* cpqhp_set_attention_status - Turns the Amber LED for a slot on or off @ctrl: struct controller to use @func: PCI device/function info @status: LED control flag: 1 = LED on, 0 = LED off */ | static int cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, u32 status) | /* cpqhp_set_attention_status - Turns the Amber LED for a slot on or off @ctrl: struct controller to use @func: PCI device/function info @status: LED control flag: 1 = LED on, 0 = LED off */
static int cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, u32 status) | {
u8 hp_slot;
if (func == NULL)
return 1;
hp_slot = func->device - ctrl->slot_device_offset;
mutex_lock(&ctrl->crit_sect);
if (status == 1)
amber_LED_on (ctrl, hp_slot);
else if (status == 0)
amber_LED_off (ctrl, hp_slot);
else {
mutex_unlock(&ctrl->crit_sect);
return 1;
}
set_SOGO(ctrl);
wait_for_ctrl_irq (ctrl);
mutex_unlock(&ctrl->crit_sect);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* To be called with at most caution as there is no check before setting the actual voltage value. */ | int regulator_set_value_force(struct udevice *dev, int uV) | /* To be called with at most caution as there is no check before setting the actual voltage value. */
int regulator_set_value_force(struct udevice *dev, int uV) | {
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
if (!ops || !ops->set_value)
return -ENOSYS;
return ops->set_value(dev, uV);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Duration to go in sleep mode. 1 LSb = 512 / ODR. */ | int32_t lsm6dso_act_sleep_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val) | /* Duration to go in sleep mode. 1 LSb = 512 / ODR. */
int32_t lsm6dso_act_sleep_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val) | {
lsm6dso_wake_up_dur_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)®, 1);
*val = reg.sleep_dur;
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Checks whether the specified SPI interrupt has occurred or not. */ | ITStatus SPI_GetITStatus(SPI_TypeDef *SPIx, uint8_t SPI_IT) | /* Checks whether the specified SPI interrupt has occurred or not. */
ITStatus SPI_GetITStatus(SPI_TypeDef *SPIx, uint8_t SPI_IT) | {
ITStatus bitstatus = RESET;
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_GET_IT(SPI_IT));
if ((SPIx->INTSTAT & SPI_IT) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reverses the effect of usb_hcd_sa1111_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */ | void usb_hcd_sa1111_remove(struct usb_hcd *hcd, struct sa1111_dev *dev) | /* Reverses the effect of usb_hcd_sa1111_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */
void usb_hcd_sa1111_remove(struct usb_hcd *hcd, struct sa1111_dev *dev) | {
usb_remove_hcd(hcd);
sa1111_stop_hc(dev);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Event handler for the library USB Control Request reception event. */ | void EVENT_USB_Device_ControlRequest(void) | /* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void) | {
MS_Device_ProcessControlRequest(&Disk_MS_Interface);
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Equivalent to cpu_physical_memory_rw(addr + (req->df ? -1 : +1) * req->size * i, val, req->size, 0/1) except without the integer overflow problems. */ | static void rw_phys_req_item(hwaddr addr, ioreq_t *req, uint32_t i, void *val, int rw) | /* Equivalent to cpu_physical_memory_rw(addr + (req->df ? -1 : +1) * req->size * i, val, req->size, 0/1) except without the integer overflow problems. */
static void rw_phys_req_item(hwaddr addr, ioreq_t *req, uint32_t i, void *val, int rw) | {
hwaddr offset = (hwaddr)req->size * i;
if (req->df) {
addr -= offset;
} else {
addr += offset;
}
cpu_physical_memory_rw(addr, val, req->size, rw);
} | ve3wwg/teensy3_qemu | C | Other | 15 |
/* User-defined threshold value for xl interrupt event on generator 2. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */ | int32_t lis2dh12_int2_gen_threshold_get(stmdev_ctx_t *ctx, uint8_t *val) | /* User-defined threshold value for xl interrupt event on generator 2. LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */
int32_t lis2dh12_int2_gen_threshold_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lis2dh12_int2_ths_t int2_ths;
int32_t ret;
ret = lis2dh12_read_reg(ctx, LIS2DH12_INT2_THS, (uint8_t *)&int2_ths, 1);
*val = (uint8_t)int2_ths.ths;
return ret;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Start a memory to a peripheral DMA transfer. */ | Ecode_t DMADRV_MemoryPeripheral(unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst, void *src, bool srcInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam) | /* Start a memory to a peripheral DMA transfer. */
Ecode_t DMADRV_MemoryPeripheral(unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst, void *src, bool srcInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam) | {
return StartTransfer(dmaModeBasic,
dmaDirectionMemToPeripheral,
channelId,
peripheralSignal,
dst,
src,
NULL,
srcInc,
len,
size,
callback,
cbUserParam);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Unregister status code callback functions only available at boot time from report status code router when exiting boot services. */ | VOID EFIAPI UnregisterSerialBootTimeHandlers(VOID) | /* Unregister status code callback functions only available at boot time from report status code router when exiting boot services. */
VOID EFIAPI UnregisterSerialBootTimeHandlers(VOID) | {
if (PcdGetBool (PcdStatusCodeUseSerial)) {
mRscHandlerProtocol->Unregister (SerialStatusCodeReportWorker);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* mac3_irq: receive queue 2 bits and address detection bits */ | void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l) | /* mac3_irq: receive queue 2 bits and address detection bits */
void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l) | {
UNUSED(code_s3l) ;
if (code_s3u & (FM_SRCVOVR2 |
FM_SRBFL2)) {
smc->hw.mac_ct.mac_r_restart_counter++ ;
smt_stat_counter(smc,1);
}
if (code_s3u & FM_SRPERRQ2) {
SMT_PANIC(smc,SMT_E0115, SMT_E0115_MSG) ;
}
if (code_s3u & FM_SRPERRQ1) {
SMT_PANIC(smc,SMT_E0116, SMT_E0116_MSG) ;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DevicePathNode must be SerialUart type and this will populate the MappingItem. */ | EFI_STATUS DevPathSerialUart(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) | /* DevicePathNode must be SerialUart type and this will populate the MappingItem. */
EFI_STATUS DevPathSerialUart(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath) | {
EFI_STATUS Status;
UART_DEVICE_PATH *Uart;
ASSERT (DevicePathNode != NULL);
ASSERT (MappingItem != NULL);
Uart = (UART_DEVICE_PATH *)DevicePathNode;
Status = AppendCSDNum (MappingItem, Uart->BaudRate);
if (!EFI_ERROR (Status)) {
Status = AppendCSDNum (MappingItem, Uart->DataBits);
}
if (!EFI_ERROR (Status)) {
Status = AppendCSDNum (MappingItem, Uart->Parity);
}
if (!EFI_ERROR (Status)) {
Status = AppendCSDNum (MappingItem, Uart->StopBits);
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Internal Function: To add the offset to given address. */ | static volatile uint32_t* lpddr4_addoffset(volatile uint32_t *addr, uint32_t regoffset) | /* Internal Function: To add the offset to given address. */
static volatile uint32_t* lpddr4_addoffset(volatile uint32_t *addr, uint32_t regoffset) | {
volatile uint32_t *local_addr = addr;
volatile uint32_t *regaddr = &local_addr[regoffset];
return regaddr;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If necessary, first collects the instruction up to and including the ModRM byte. No effect if @insn->x86_64 is 0. */ | int insn_rip_relative(struct insn *insn) | /* If necessary, first collects the instruction up to and including the ModRM byte. No effect if @insn->x86_64 is 0. */
int insn_rip_relative(struct insn *insn) | {
struct insn_field *modrm = &insn->modrm;
if (!insn->x86_64)
return 0;
if (!modrm->got)
insn_get_modrm(insn);
return (modrm->nbytes && (modrm->value & 0xc7) == 0x5);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* PARAMETER erp current erp_head RETURN VALUES erp new erp_head - pointer to new ERP */ | static struct dasd_ccw_req* dasd_3990_erp_inv_format(struct dasd_ccw_req *erp, char *sense) | /* PARAMETER erp current erp_head RETURN VALUES erp new erp_head - pointer to new ERP */
static struct dasd_ccw_req* dasd_3990_erp_inv_format(struct dasd_ccw_req *erp, char *sense) | {
struct dasd_device *device = erp->startdev;
erp->function = dasd_3990_erp_inv_format;
if (sense[2] & SNS2_ENV_DATA_PRESENT) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
"Track format error when destaging or "
"staging data");
dasd_3990_handle_env_data(erp, sense);
erp = dasd_3990_erp_action_4(erp, sense);
} else {
dev_err(&device->cdev->dev,
"An error occurred in the DASD device driver, "
"reason=%s\n", "06");
erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
}
return erp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* On certain platforms, we have to free interrupt as well... */ | void free_dma(unsigned int chan) | /* On certain platforms, we have to free interrupt as well... */
void free_dma(unsigned int chan) | {
dma_t *dma = dma_channel(chan);
if (!dma)
goto bad_dma;
if (dma->active) {
printk(KERN_ERR "dma%d: freeing active DMA\n", chan);
dma->d_ops->disable(chan, dma);
dma->active = 0;
}
if (xchg(&dma->lock, 0) != 0) {
if (dma->d_ops->free)
dma->d_ops->free(chan, dma);
return;
}
printk(KERN_ERR "dma%d: trying to free free DMA\n", chan);
return;
bad_dma:
printk(KERN_ERR "dma: trying to free DMA%d\n", chan);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return the board_info structure with a given index. Out-of-range indices return NULL. */ | const struct board_info* t1_get_board_info(unsigned int board_id) | /* Return the board_info structure with a given index. Out-of-range indices return NULL. */
const struct board_info* t1_get_board_info(unsigned int board_id) | {
return board_id < ARRAY_SIZE(t1_board) ? &t1_board[board_id] : NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* NOTE: This must be executed from our workqueue as it results in udelay being called which may corrupt the keyboard if executed on default workqueue */ | static void ipw_adapter_restart(void *adapter) | /* NOTE: This must be executed from our workqueue as it results in udelay being called which may corrupt the keyboard if executed on default workqueue */
static void ipw_adapter_restart(void *adapter) | {
struct ipw_priv *priv = adapter;
if (priv->status & STATUS_RF_KILL_MASK)
return;
ipw_down(priv);
if (priv->assoc_network &&
(priv->assoc_network->capability & WLAN_CAPABILITY_IBSS))
ipw_remove_current_network(priv);
if (ipw_up(priv)) {
IPW_ERROR("Failed to up device\n");
return;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the specified CRC peripheral Clock. */ | void RCC_CRC_ClockCmd(CRC_TypeDef *peripheral, FunctionalState state) | /* Enables or disables the specified CRC peripheral Clock. */
void RCC_CRC_ClockCmd(CRC_TypeDef *peripheral, FunctionalState state) | {
if(CRC == peripheral) {
(state) ? (RCC->AHBENR |= RCC_AHBENR_CRC) : (RCC->AHBENR &= ~RCC_AHBENR_CRC);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The Timer 2 default IRQ, declared in start up code. */ | void TIMER2IntHandler(void) | /* The Timer 2 default IRQ, declared in start up code. */
void TIMER2IntHandler(void) | {
unsigned long ulBase = TIMER2_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_pfnTimerHandlerCallbacks[2] != 0)
{
g_pfnTimerHandlerCallbacks[2](0, 0, ulTemp0 | ulTemp1, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Set the PWM duty of the PWM module.
The */ | void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty) | /* Set the PWM duty of the PWM module.
The */
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty) | {
unsigned long ulCMRData;
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE) ||
(ulBase == PWMC_BASE));
if(ulBase == PWMA_BASE)
{
xASSERT((ulChannel >= 0) && (ulChannel <= 5));
}
else
{
xASSERT((ulChannel >= 0) && (ulChannel <= 1));
}
xASSERT(((ulDuty > 0) || (ulDuty <= 100)));
ulCMRData = (PWMMODGet(ulBase) * ulDuty) / 100;
if ((PWMMODGet(ulBase) * ulDuty) / 100 == 0)
{
ulCMRData = 0;
}
xHWREG(ulBase + TPM_C0V + ulChannel * 8) = ulCMRData;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This file is part of the Simba project. */ | uint8_t bits_reverse_8(uint8_t value) | /* This file is part of the Simba project. */
uint8_t bits_reverse_8(uint8_t value) | {
value = (((value & 0xaa) >> 1) | ((value & 0x55) << 1));
value = (((value & 0xcc) >> 2) | ((value & 0x33) << 2));
return (((value & 0xf0) >> 4) | ((value & 0x0f) << 4));
} | eerimoq/simba | C++ | Other | 337 |
/* Avoid spamming the console with prints every IBF / IBHF interrupt, if we find ourselves in an unexpected state. */ | static void shi_npcx_log_unexpected_state(const struct device *dev, char *isr_name) | /* Avoid spamming the console with prints every IBF / IBHF interrupt, if we find ourselves in an unexpected state. */
static void shi_npcx_log_unexpected_state(const struct device *dev, char *isr_name) | {
struct shi_npcx_data *data = dev->data;
if (data->state != data->last_error_state) {
LOG_ERR("Unexpected state %d in %s ISR", data->state, isr_name);
}
data->last_error_state = data->state;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Sets the direction and mode of the specified pin.
where */ | void GPIODirModeSet(unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO) | /* Sets the direction and mode of the specified pin.
where */
void GPIODirModeSet(unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO) | {
xASSERT(GPIOBaseValid(ulPort));
xASSERT((ulPinIO == GPIO_DIR_MODE_IN) || (ulPinIO == GPIO_DIR_MODE_OUT));
xHWREG(ulPort + GPIO_PDDR) &= ~(1 << ulBit);
xHWREG(ulPort + GPIO_PDDR) |= (ulPinIO << ulBit);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads data received over the USB CDC ACM Virtual COM Port.
The function reads data from the receive intermediate buffer that was received over the Virtual COM Port. */ | int32_t USBD_CDC_ACM_DataRead(uint8_t *buf, int32_t len) | /* Reads data received over the USB CDC ACM Virtual COM Port.
The function reads data from the receive intermediate buffer that was received over the Virtual COM Port. */
int32_t USBD_CDC_ACM_DataRead(uint8_t *buf, int32_t len) | {
int32_t len_data;
if (ptr_data_received > ptr_data_read) {
len_data = ptr_data_received - ptr_data_read;
if (len > len_data) {
len = len_data;
}
memcpy(buf, ptr_data_read, len);
ptr_data_read += len;
} else {
len = 0;
}
return (len);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Add a buffer to the queue. Caller must hold the appropriate lock if the queue is not local. (Commonly the caller will build up multiple queued buffers on a temporary local list, and then add it to the appropriate list under lock once all the buffers have een successfully allocated.) */ | static int queue_reply(struct list_head *queue, const void *data, size_t len) | /* Add a buffer to the queue. Caller must hold the appropriate lock if the queue is not local. (Commonly the caller will build up multiple queued buffers on a temporary local list, and then add it to the appropriate list under lock once all the buffers have een successfully allocated.) */
static int queue_reply(struct list_head *queue, const void *data, size_t len) | {
struct read_buffer *rb;
if (len == 0)
return 0;
rb = kmalloc(sizeof(*rb) + len, GFP_KERNEL);
if (rb == NULL)
return -ENOMEM;
rb->cons = 0;
rb->len = len;
memcpy(rb->msg, data, len);
list_add_tail(&rb->list, queue);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Attribute read call back for the Value V2 attribute. */ | static ssize_t read_value_v2_3(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | /* Attribute read call back for the Value V2 attribute. */
static ssize_t read_value_v2_3(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | {
const uint8_t *value = attr->user_data;
return bt_gatt_attr_read(conn, attr, buf, len, offset, value,
sizeof(value_v2_3_value));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* @mask: which CPUs @msr_no: which MSR @msrs: array of MSR values */ | void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) | /* @mask: which CPUs @msr_no: which MSR @msrs: array of MSR values */
void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) | {
__rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* note that we can't just leave the line enabled as the baud rate timer */ | static void mn10300_serial_mask_ack(unsigned int irq) | /* note that we can't just leave the line enabled as the baud rate timer */
static void mn10300_serial_mask_ack(unsigned int irq) | {
u16 tmp;
GxICR(irq) = GxICR_LEVEL_6;
tmp = GxICR(irq);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function combines the call to kobject_init() and kobject_add(). The same type of error handling after a call to kobject_add() and kobject lifetime rules are the same here. */ | int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, struct kobject *parent, const char *fmt,...) | /* This function combines the call to kobject_init() and kobject_add(). The same type of error handling after a call to kobject_add() and kobject lifetime rules are the same here. */
int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype, struct kobject *parent, const char *fmt,...) | {
va_list args;
int retval;
kobject_init(kobj, ktype);
va_start(args, fmt);
retval = kobject_add_varg(kobj, parent, fmt, args);
va_end(args);
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: (transfer none): passed-in @string pointer, with all the uppercase characters converted to lowercase in place, with semantics that exactly match g_ascii_tolower(). */ | GString* g_string_ascii_down(GString *string) | /* Returns: (transfer none): passed-in @string pointer, with all the uppercase characters converted to lowercase in place, with semantics that exactly match g_ascii_tolower(). */
GString* g_string_ascii_down(GString *string) | {
gchar *s;
gint n;
g_return_val_if_fail (string != NULL, NULL);
n = string->len;
s = string->str;
while (n)
{
*s = g_ascii_tolower (*s);
s++;
n--;
}
return string;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* CRC Calculate.
Writes a data word to the register, the write operation stalling until the computation is complete. */ | uint32_t crc_calculate(uint32_t data) | /* CRC Calculate.
Writes a data word to the register, the write operation stalling until the computation is complete. */
uint32_t crc_calculate(uint32_t data) | {
CRC_DR = data;
return CRC_DR;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* We queue the work to the CPU on which it was submitted, but if the CPU dies it can be processed by another CPU. */ | int queue_work(struct workqueue_struct *wq, struct work_struct *work) | /* We queue the work to the CPU on which it was submitted, but if the CPU dies it can be processed by another CPU. */
int queue_work(struct workqueue_struct *wq, struct work_struct *work) | {
int ret;
ret = queue_work_on(get_cpu(), wq, work);
put_cpu();
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables tamper after read operation.
This function enables the tamper in previous operating mode after read operation */ | void enable_tamper(void) | /* Enables tamper after read operation.
This function enables the tamper in previous operating mode after read operation */
void enable_tamper(void) | {
if(previous_mode == SET_TO_CAPTURE)
configure_tamper_capture_mode();
if(previous_mode == SET_TO_WAKE)
configure_tamper_wake_mode();
} | memfault/zero-to-main | C++ | null | 200 |
/* This search cannot fail or the migration will fail. */ | static int qemu_rdma_search_ram_block(RDMAContext *rdma, uint64_t block_offset, uint64_t offset, uint64_t length, uint64_t *block_index, uint64_t *chunk_index) | /* This search cannot fail or the migration will fail. */
static int qemu_rdma_search_ram_block(RDMAContext *rdma, uint64_t block_offset, uint64_t offset, uint64_t length, uint64_t *block_index, uint64_t *chunk_index) | {
uint64_t current_addr = block_offset + offset;
RDMALocalBlock *block = g_hash_table_lookup(rdma->blockmap,
(void *) block_offset);
assert(block);
assert(current_addr >= block->offset);
assert((current_addr + length) <= (block->offset + block->length));
*block_index = block->index;
*chunk_index = ram_chunk_index(block->local_host_addr,
block->local_host_addr + (current_addr - block->offset));
return 0;
} | ve3wwg/teensy3_qemu | C | Other | 15 |
/* Set mode register.
Local function declaration. Because they are RAM functions, they need 'extern' declaration. */ | __no_inline RAMFUNC void efc_write_fmr(Efc *p_efc, uint32_t ul_fmr) | /* Set mode register.
Local function declaration. Because they are RAM functions, they need 'extern' declaration. */
__no_inline RAMFUNC void efc_write_fmr(Efc *p_efc, uint32_t ul_fmr) | {
p_efc->EEFC_FMR = ul_fmr;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base ENET peripheral base address. param phyAddr The PHY address. param device The PHY device type. param phyReg The PHY register address. */ | void ENET_QOS_StartExtC45SMIRead(ENET_QOS_Type *base, uint32_t phyAddr, uint32_t device, uint32_t phyReg) | /* param base ENET peripheral base address. param phyAddr The PHY address. param device The PHY device type. param phyReg The PHY register address. */
void ENET_QOS_StartExtC45SMIRead(ENET_QOS_Type *base, uint32_t phyAddr, uint32_t device, uint32_t phyReg) | {
uint32_t reg = base->MAC_MDIO_ADDRESS & ENET_QOS_MAC_MDIO_ADDRESS_CR_MASK;
base->MAC_MDIO_ADDRESS = reg | ENET_QOS_MAC_MDIO_ADDRESS_C45E_MASK | (uint32_t)kENET_QOS_MiiReadFrame |
ENET_QOS_MAC_MDIO_ADDRESS_PA(phyAddr) | ENET_QOS_MAC_MDIO_ADDRESS_RDA(device);
base->MAC_MDIO_DATA = ENET_QOS_MAC_MDIO_DATA_RA(phyReg);
base->MAC_MDIO_ADDRESS |= ENET_QOS_MAC_MDIO_ADDRESS_GB_MASK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
After the master obtained control of the bus, and haven't release it, users can call xI2CMasterWriteS2() to continue transmit data to slave. Users call also can xI2CMasterStop() to terminate this transmition and release the I2C bus. */ | void I2CMasterWriteS1(unsigned long ulBase, unsigned long ulSlaveAddr, unsigned long ulData, xtBoolean bEndTransmition) | /* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
After the master obtained control of the bus, and haven't release it, users can call xI2CMasterWriteS2() to continue transmit data to slave. Users call also can xI2CMasterStop() to terminate this transmition and release the I2C bus. */
void I2CMasterWriteS1(unsigned long ulBase, unsigned long ulSlaveAddr, unsigned long ulData, xtBoolean bEndTransmition) | {
I2CMasterWriteRequestS1(ulBase, ulSlaveAddr, ulData, bEndTransmition);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function will start transmitting any available data, if the port isn't already transmitting data. */ | static void qe_uart_start_tx(struct uart_port *port) | /* This function will start transmitting any available data, if the port isn't already transmitting data. */
static void qe_uart_start_tx(struct uart_port *port) | {
struct uart_qe_port *qe_port =
container_of(port, struct uart_qe_port, port);
if (in_be16(&qe_port->uccp->uccm) & UCC_UART_UCCE_TX)
return;
if (qe_uart_tx_pump(qe_port))
setbits16(&qe_port->uccp->uccm, UCC_UART_UCCE_TX);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified SPI/I2S flag is set or not. */ | FlagStatus SPI_I2S_GetStatus(SPI_Module *SPIx, uint16_t SPI_I2S_FLAG) | /* Checks whether the specified SPI/I2S flag is set or not. */
FlagStatus SPI_I2S_GetStatus(SPI_Module *SPIx, uint16_t SPI_I2S_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_SPI_PERIPH(SPIx));
assert_param(IS_SPI_I2S_GET_FLAG(SPI_I2S_FLAG));
if ((SPIx->STS & SPI_I2S_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* If this becomes a problem for some users who wish to allow that scenario, then cpuset_post_clone() could be changed to grant parent->cpus_allowed-sibling_cpus_exclusive (and likewise for mems) to the new cgroup. Called with cgroup_mutex held. */ | static void cpuset_post_clone(struct cgroup_subsys *ss, struct cgroup *cgroup) | /* If this becomes a problem for some users who wish to allow that scenario, then cpuset_post_clone() could be changed to grant parent->cpus_allowed-sibling_cpus_exclusive (and likewise for mems) to the new cgroup. Called with cgroup_mutex held. */
static void cpuset_post_clone(struct cgroup_subsys *ss, struct cgroup *cgroup) | {
struct cgroup *parent, *child;
struct cpuset *cs, *parent_cs;
parent = cgroup->parent;
list_for_each_entry(child, &parent->children, sibling) {
cs = cgroup_cs(child);
if (is_mem_exclusive(cs) || is_cpu_exclusive(cs))
return;
}
cs = cgroup_cs(cgroup);
parent_cs = cgroup_cs(parent);
cs->mems_allowed = parent_cs->mems_allowed;
cpumask_copy(cs->cpus_allowed, parent_cs->cpus_allowed);
return;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Atomic bitwise NAND primitive.
is atomically bitwise NAND'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */ | atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value) | /* Atomic bitwise NAND primitive.
is atomically bitwise NAND'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value) | {
unsigned int key;
atomic_val_t ret;
key = irq_lock();
ret = *target;
*target = ~(*target & value);
irq_unlock(key);
return ret;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Get the AML_BYTE_ENCODING entry in the AML encoding table by providing an OpCode/SubOpCode couple. */ | CONST AML_BYTE_ENCODING* EFIAPI AmlGetByteEncodingByOpCode(IN UINT8 OpCode, IN UINT8 SubOpCode) | /* Get the AML_BYTE_ENCODING entry in the AML encoding table by providing an OpCode/SubOpCode couple. */
CONST AML_BYTE_ENCODING* EFIAPI AmlGetByteEncodingByOpCode(IN UINT8 OpCode, IN UINT8 SubOpCode) | {
UINT32 Index;
for (Index = 0;
Index < (sizeof (mAmlByteEncoding) / sizeof (mAmlByteEncoding[0]));
Index++)
{
if ((mAmlByteEncoding[Index].OpCode == OpCode) &&
(mAmlByteEncoding[Index].SubOpCode == SubOpCode))
{
return &mAmlByteEncoding[Index];
}
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads or writes a block of data from/to the physical device EEPROM using a block buffer stored in RAM, if the requested block is within the virtual firmware file's sector ranges in the emulated FAT file system. */ | static void ReadWriteEEPROMFileBlock(const uint16_t BlockNumber, uint8_t *BlockBuffer, const bool Read) | /* Reads or writes a block of data from/to the physical device EEPROM using a block buffer stored in RAM, if the requested block is within the virtual firmware file's sector ranges in the emulated FAT file system. */
static void ReadWriteEEPROMFileBlock(const uint16_t BlockNumber, uint8_t *BlockBuffer, const bool Read) | {
uint16_t FileStartBlock = DISK_BLOCK_DataStartBlock + (*EEPROMFileStartCluster - 2) * SECTOR_PER_CLUSTER;
uint16_t FileEndBlock = FileStartBlock + (FILE_SECTORS(EEPROM_FILE_SIZE_BYTES) - 1);
if (!((BlockNumber >= FileStartBlock) && (BlockNumber <= FileEndBlock)))
return;
uint16_t EEPROMAddress = (uint16_t)(BlockNumber - FileStartBlock) * SECTOR_SIZE_BYTES;
if (Read)
{
for (uint16_t i = 0; i < SECTOR_SIZE_BYTES; i++)
BlockBuffer[i] = ReadEEPROMByte((uint8_t*)EEPROMAddress++);
}
else
{
for (uint16_t i = 0; i < SECTOR_SIZE_BYTES; i++)
WriteEEPROMByte((uint8_t*)EEPROMAddress++, BlockBuffer[i]);
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* This function handles the timeout of command sending. It will re-send the same command again. */ | static void command_timer_fn(unsigned long data) | /* This function handles the timeout of command sending. It will re-send the same command again. */
static void command_timer_fn(unsigned long data) | {
struct lbs_private *priv = (struct lbs_private *)data;
unsigned long flags;
lbs_deb_enter(LBS_DEB_CMD);
spin_lock_irqsave(&priv->driver_lock, flags);
if (!priv->cur_cmd)
goto out;
lbs_pr_info("command 0x%04x timed out\n",
le16_to_cpu(priv->cur_cmd->cmdbuf->command));
priv->cmd_timed_out = 1;
wake_up_interruptible(&priv->waitq);
out:
spin_unlock_irqrestore(&priv->driver_lock, flags);
lbs_deb_leave(LBS_DEB_CMD);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Translate binary channel representation in EEPROM to frequency */ | static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode) | /* Translate binary channel representation in EEPROM to frequency */
static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, unsigned int mode) | {
u16 val;
if (bin == AR5K_EEPROM_CHANNEL_DIS)
return bin;
if (mode == AR5K_EEPROM_MODE_11A) {
if (ee->ee_version > AR5K_EEPROM_VERSION_3_2)
val = (5 * bin) + 4800;
else
val = bin > 62 ? (10 * 62) + (5 * (bin - 62)) + 5100 :
(bin * 10) + 5100;
} else {
if (ee->ee_version > AR5K_EEPROM_VERSION_3_2)
val = bin + 2300;
else
val = bin + 2400;
}
return val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will register the station IP address and flush IP instance to start using the new IP address. */ | EFI_STATUS PxeBcSetIp6Address(IN PXEBC_PRIVATE_DATA *Private) | /* This function will register the station IP address and flush IP instance to start using the new IP address. */
EFI_STATUS PxeBcSetIp6Address(IN PXEBC_PRIVATE_DATA *Private) | {
EFI_STATUS Status;
EFI_DHCP6_PROTOCOL *Dhcp6;
Dhcp6 = Private->Dhcp6;
CopyMem (&Private->StationIp.v6, &Private->TmpStationIp.v6, sizeof (EFI_IPv6_ADDRESS));
CopyMem (&Private->PxeBc.Mode->StationIp.v6, &Private->StationIp.v6, sizeof (EFI_IPv6_ADDRESS));
Status = PxeBcRegisterIp6Address (Private, &Private->StationIp.v6);
if (EFI_ERROR (Status)) {
Dhcp6->Stop (Dhcp6);
return Status;
}
Status = PxeBcFlushStationIp (Private, &Private->StationIp, NULL);
if (EFI_ERROR (Status)) {
PxeBcUnregisterIp6Address (Private);
Dhcp6->Stop (Dhcp6);
return Status;
}
AsciiPrint ("\n Station IP address is ");
PxeBcShowIp6Addr (&Private->StationIp.v6);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This file is part of the Simba project. */ | int mock_write_sht3xd_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_sht3xd_module_init(int res) | {
harness_mock_write("sht3xd_module_init()",
NULL,
0);
harness_mock_write("sht3xd_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Enable the interrupt mode for the selected IT source. */ | void stmpe811_EnableITSource(uint16_t DeviceAddr, uint8_t Source) | /* Enable the interrupt mode for the selected IT source. */
void stmpe811_EnableITSource(uint16_t DeviceAddr, uint8_t Source) | {
uint8_t tmp = 0;
tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_EN);
tmp |= Source;
IOE_Write(DeviceAddr, STMPE811_REG_INT_EN, tmp);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Devices are selected using Chip Selects on GPIOs. ADS7846 Routines */ | unsigned long corgi_ssp_ads7846_putget(ulong data) | /* Devices are selected using Chip Selects on GPIOs. ADS7846 Routines */
unsigned long corgi_ssp_ads7846_putget(ulong data) | {
unsigned long flag;
u32 ret = 0;
spin_lock_irqsave(&corgi_ssp_lock, flag);
if (ssp_machinfo->cs_ads7846 >= 0)
GPCR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846);
ssp_write_word(&corgi_ssp_dev,data);
ssp_read_word(&corgi_ssp_dev, &ret);
if (ssp_machinfo->cs_ads7846 >= 0)
GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846);
spin_unlock_irqrestore(&corgi_ssp_lock, flag);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* For now this btree implementation assumes the btree root is always stored in the if_broot field of an inode fork. */ | STATIC struct xfs_btree_block* xfs_btree_get_iroot(struct xfs_btree_cur *cur) | /* For now this btree implementation assumes the btree root is always stored in the if_broot field of an inode fork. */
STATIC struct xfs_btree_block* xfs_btree_get_iroot(struct xfs_btree_cur *cur) | {
struct xfs_ifork *ifp;
ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, cur->bc_private.b.whichfork);
return (struct xfs_btree_block *)ifp->if_broot;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* (A short description of the protocol including links to specifications, detailed documentation, etc.) */ | void proto_reg_handoff_rtls(void) | /* (A short description of the protocol including links to specifications, detailed documentation, etc.) */
void proto_reg_handoff_rtls(void) | {
dissector_handle_t rtls_handle;
rtls_handle = create_dissector_handle(dissect_rtls, proto_rtls);
dissector_add_for_decode_as("udp.port", rtls_handle);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This I2C function resets the I/O buffer of the SHA204 device. */ | uint8_t sha204p_reset_io(void) | /* This I2C function resets the I/O buffer of the SHA204 device. */
uint8_t sha204p_reset_io(void) | {
return sha204p_send(SHA204_I2C_PACKET_FUNCTION_RESET, 0, NULL);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* helper function to move a thread onto the idle list after it has finished some requests. */ | static void check_idle_worker(struct btrfs_worker_thread *worker) | /* helper function to move a thread onto the idle list after it has finished some requests. */
static void check_idle_worker(struct btrfs_worker_thread *worker) | {
if (!worker->idle && atomic_read(&worker->num_pending) <
worker->workers->idle_thresh / 2) {
unsigned long flags;
spin_lock_irqsave(&worker->workers->lock, flags);
worker->idle = 1;
if (!list_empty(&worker->worker_list)) {
list_move(&worker->worker_list,
&worker->workers->idle_list);
}
spin_unlock_irqrestore(&worker->workers->lock, flags);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */ | static int pci1723_detach(struct comedi_device *dev) | /* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */
static int pci1723_detach(struct comedi_device *dev) | {
printk("comedi%d: pci1723: remove\n", dev->minor);
if (dev->private) {
if (devpriv->valid)
pci1723_reset(dev);
if (devpriv->pcidev) {
if (dev->iobase) {
comedi_pci_disable(devpriv->pcidev);
}
pci_dev_put(devpriv->pcidev);
}
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base ENET peripheral base address. param phyAddr The PHY address. param regAddr The PHY register. param data The data written to PHY. */ | void ENET_StartSMIWrite(ENET_Type *base, uint8_t phyAddr, uint8_t regAddr, uint16_t data) | /* param base ENET peripheral base address. param phyAddr The PHY address. param regAddr The PHY register. param data The data written to PHY. */
void ENET_StartSMIWrite(ENET_Type *base, uint8_t phyAddr, uint8_t regAddr, uint16_t data) | {
uint32_t reg = base->MAC_MDIO_ADDRESS & ENET_MAC_MDIO_ADDRESS_CR_MASK;
base->MAC_MDIO_ADDRESS =
reg | ENET_MAC_MDIO_ADDRESS_GOC_0(1) | ENET_MAC_MDIO_ADDRESS_PA(phyAddr) | ENET_MAC_MDIO_ADDRESS_RDA(regAddr);
base->MAC_MDIO_DATA = data;
base->MAC_MDIO_ADDRESS |= ENET_MAC_MDIO_ADDRESS_GB_MASK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* memstick_alloc_host - allocate a memstick_host structure @extra: size of the user private data to allocate @dev: parent device of the host */ | struct memstick_host* memstick_alloc_host(unsigned int extra, struct device *dev) | /* memstick_alloc_host - allocate a memstick_host structure @extra: size of the user private data to allocate @dev: parent device of the host */
struct memstick_host* memstick_alloc_host(unsigned int extra, struct device *dev) | {
struct memstick_host *host;
host = kzalloc(sizeof(struct memstick_host) + extra, GFP_KERNEL);
if (host) {
mutex_init(&host->lock);
INIT_WORK(&host->media_checker, memstick_check);
host->dev.class = &memstick_host_class;
host->dev.parent = dev;
device_initialize(&host->dev);
}
return host;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Command response callback function for ble_l2cap_cid_unregister_req_enc BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for ble_l2cap_cid_unregister_req_enc BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code =
ble_l2cap_cid_unregister_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* where f is the bus clock frequency in MHz, and f is the MDIO clock frequency in MHz to the PHY. Typically, f should not exceed 2.5 MHz. Some PHYs can tolerate faster speeds which means faster access. Here is the table to show values to generate MDC, */ | void XEmacPs_SetMdioDivisor(XEmacPs *InstancePtr, XEmacPs_MdcDiv Divisor) | /* where f is the bus clock frequency in MHz, and f is the MDIO clock frequency in MHz to the PHY. Typically, f should not exceed 2.5 MHz. Some PHYs can tolerate faster speeds which means faster access. Here is the table to show values to generate MDC, */
void XEmacPs_SetMdioDivisor(XEmacPs *InstancePtr, XEmacPs_MdcDiv Divisor) | {
u32 Reg;
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)XIL_COMPONENT_IS_READY);
Xil_AssertVoid(Divisor <= (XEmacPs_MdcDiv)0x7);
Reg = XEmacPs_ReadReg(InstancePtr->Config.BaseAddress,
XEMACPS_NWCFG_OFFSET);
Reg &= (u32)(~XEMACPS_NWCFG_MDCCLKDIV_MASK);
Reg |= ((u32)Divisor << XEMACPS_NWCFG_MDC_SHIFT_MASK);
XEmacPs_WriteReg(InstancePtr->Config.BaseAddress,
XEMACPS_NWCFG_OFFSET, Reg);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* See "mss_ace.h" for details of how to use this function. */ | void ACE_enable_sdd(sdd_id_t sdd_id) | /* See "mss_ace.h" for details of how to use this function. */
void ACE_enable_sdd(sdd_id_t sdd_id) | {
ASSERT( sdd_id < NB_OF_SDD );
if ( sdd_id < NB_OF_SDD )
{
*dac_ctrl_reg_lut[sdd_id] |= SDD_ENABLE_MASK;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Verification Tag: 8.5.1 E) Rules for packet carrying a SHUTDOWN ACK If the receiver is in COOKIE-ECHOED or COOKIE-WAIT state the procedures in section 8.4 SHOULD be followed, in other words it should be treated as an Out Of The Blue packet. [This means that we do NOT check the Verification Tag on these chunks. */ | sctp_disposition_t sctp_sf_do_8_5_1_E_sa(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | /* Verification Tag: 8.5.1 E) Rules for packet carrying a SHUTDOWN ACK If the receiver is in COOKIE-ECHOED or COOKIE-WAIT state the procedures in section 8.4 SHOULD be followed, in other words it should be treated as an Out Of The Blue packet. [This means that we do NOT check the Verification Tag on these chunks. */
sctp_disposition_t sctp_sf_do_8_5_1_E_sa(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | {
struct sctp_chunk *chunk = arg;
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t)))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES);
return sctp_sf_shut_8_4_5(ep, NULL, type, arg, commands);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Our interface with the rest of the world */ | static void alauda_info_destructor(void *extra) | /* Our interface with the rest of the world */
static void alauda_info_destructor(void *extra) | {
struct alauda_info *info = (struct alauda_info *) extra;
int port;
if (!info)
return;
for (port = 0; port < 2; port++) {
struct alauda_media_info *media_info = &info->port[port];
alauda_free_maps(media_info);
kfree(media_info->lba_to_pba);
kfree(media_info->pba_to_lba);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Duration to go in sleep mode. 1 LSb = 512 / ODR. */ | int32_t lsm6dso_act_sleep_dur_set(lsm6dso_ctx_t *ctx, uint8_t val) | /* Duration to go in sleep mode. 1 LSb = 512 / ODR. */
int32_t lsm6dso_act_sleep_dur_set(lsm6dso_ctx_t *ctx, uint8_t val) | {
lsm6dso_wake_up_dur_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)®, 1);
if (ret == 0) {
reg.sleep_dur = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)®, 1);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Also, since RTC_LR is transferred to RTC_CR on next rising edge of the 1Hz clock, we must write the time one second in advance. */ | static int pl030_set_time(struct device *dev, struct rtc_time *tm) | /* Also, since RTC_LR is transferred to RTC_CR on next rising edge of the 1Hz clock, we must write the time one second in advance. */
static int pl030_set_time(struct device *dev, struct rtc_time *tm) | {
struct pl030_rtc *rtc = dev_get_drvdata(dev);
unsigned long time;
int ret;
ret = rtc_tm_to_time(tm, &time);
if (ret == 0)
writel(time + 1, rtc->base + RTC_LR);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disconnects any devices still connected, stops the keep alives and removes the Host Info IE. */ | void wusbhc_devconnect_stop(struct wusbhc *wusbhc) | /* Disconnects any devices still connected, stops the keep alives and removes the Host Info IE. */
void wusbhc_devconnect_stop(struct wusbhc *wusbhc) | {
int i;
mutex_lock(&wusbhc->mutex);
for (i = 0; i < wusbhc->ports_max; i++) {
if (wusbhc->port[i].wusb_dev)
__wusbhc_dev_disconnect(wusbhc, &wusbhc->port[i]);
}
mutex_unlock(&wusbhc->mutex);
cancel_delayed_work_sync(&wusbhc->keep_alive_timer);
wusbhc_mmcie_rm(wusbhc, &wusbhc->wuie_host_info->hdr);
kfree(wusbhc->wuie_host_info);
wusbhc->wuie_host_info = NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* send DMA RX Req when the data byte number in RECV_FIFO reaches RX_TRIG or Read Packet Tansmission completed with RECV_FIFO not empty */ | static void twi_set_rx_trig_level(uint32_t val, const unsigned long base_addr) | /* send DMA RX Req when the data byte number in RECV_FIFO reaches RX_TRIG or Read Packet Tansmission completed with RECV_FIFO not empty */
static void twi_set_rx_trig_level(uint32_t val, const unsigned long base_addr) | {
uint32_t mask = TRIG_MASK;
uint32_t reg_val = readl(base_addr + TWI_DRIVER_DMAC);
val = (val & mask) << 16;
reg_val &= ~(mask << 16);
reg_val |= val;
writel(reg_val, base_addr + TWI_DRIVER_DMAC);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* See mxs_dma_append() for details on how DMA command blocks must be configured to maintain the expected behavior of the semaphore's value. */ | static int mxs_dma_read_semaphore(int channel) | /* See mxs_dma_append() for details on how DMA command blocks must be configured to maintain the expected behavior of the semaphore's value. */
static int mxs_dma_read_semaphore(int channel) | {
struct mxs_apbh_regs *apbh_regs =
(struct mxs_apbh_regs *)MXS_APBH_BASE;
uint32_t tmp;
int ret;
ret = mxs_dma_validate_chan(channel);
if (ret)
return ret;
tmp = readl(&apbh_regs->ch[channel].hw_apbh_ch_sema);
tmp &= APBH_CHn_SEMA_PHORE_MASK;
tmp >>= APBH_CHn_SEMA_PHORE_OFFSET;
return tmp;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* We use this function rather than a BASE_CUSTOM formatter because BASE_CUSTOM doesn't support passing a 64-bit value to the formatting function. */ | static void ouch_tree_add_timestamp(proto_tree *tree, const int hf, tvbuff_t *tvb, gint offset) | /* We use this function rather than a BASE_CUSTOM formatter because BASE_CUSTOM doesn't support passing a 64-bit value to the formatting function. */
static void ouch_tree_add_timestamp(proto_tree *tree, const int hf, tvbuff_t *tvb, gint offset) | {
guint64 ts = tvb_get_ntoh64(tvb, offset);
char *buf = (char *)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH);
guint32 tmp, hours, mins, secs, nsecs;
nsecs = (guint32)(ts % G_GUINT64_CONSTANT(1000000000));
tmp = (guint32)(ts / G_GUINT64_CONSTANT(1000000000));
hours = tmp / 3600;
mins = (tmp % 3600) / 60;
secs = tmp % 60;
g_snprintf(buf, ITEM_LABEL_LENGTH,
"%u:%02u:%02u.%09u",
hours, mins, secs, nsecs);
proto_tree_add_string(tree, hf, tvb, offset, 8, buf);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns the current speed of the USB device connected. */ | uint32_t USBHostSpeedGet(uint32_t ui32Base) | /* Returns the current speed of the USB device connected. */
uint32_t USBHostSpeedGet(uint32_t ui32Base) | {
ASSERT(ui32Base == USB0_BASE);
if(HWREGB(ui32Base + USB_O_POWER) & USB_POWER_HSMODE)
{
return(USB_HIGH_SPEED);
}
if(HWREGB(ui32Base + USB_O_DEVCTL) & USB_DEVCTL_FSDEV)
{
return(USB_FULL_SPEED);
}
if(HWREGB(ui32Base + USB_O_DEVCTL) & USB_DEVCTL_LSDEV)
{
return(USB_LOW_SPEED);
}
return(USB_UNDEF_SPEED);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Rotates the DCM matrix by a given angle. */ | void IMU_dcmRotate(float dcm[3][3], float angle[3]) | /* Rotates the DCM matrix by a given angle. */
void IMU_dcmRotate(float dcm[3][3], float angle[3]) | {
int x, y;
float um[3][3];
float tm[3][3];
um[0][0] = 0.0f;
um[0][1] = -angle[2];
um[0][2] = angle[1];
um[1][0] = angle[2];
um[1][1] = 0.0f;
um[1][2] = -angle[0];
um[2][0] = -angle[1];
um[2][1] = angle[0];
um[2][2] = 0.0f;
IMU_matrixMultiply( tm, dcm, um );
for( y = 0; y < 3; y++ ) {
for( x = 0; x < 3; x++ ) {
dcm[y][x] += tm[y][x];
}
}
return;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* TOMOYO uses \ooo style representation for 0x01 - 0x20 and 0x7F - 0xFF. This function verifies that \ooo is in valid range. */ | static bool tomoyo_is_byte_range(const char *str) | /* TOMOYO uses \ooo style representation for 0x01 - 0x20 and 0x7F - 0xFF. This function verifies that \ooo is in valid range. */
static bool tomoyo_is_byte_range(const char *str) | {
return *str >= '0' && *str++ <= '3' &&
*str >= '0' && *str++ <= '7' &&
*str >= '0' && *str <= '7';
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Rport is being deleted. FC-4s are offline. Awaiting BFA rport offline callback to send LOGO. */ | static void bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport, enum rport_event event) | /* Rport is being deleted. FC-4s are offline. Awaiting BFA rport offline callback to send LOGO. */
static void bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport, enum rport_event event) | {
bfa_trc(rport->fcs, rport->pwwn);
bfa_trc(rport->fcs, rport->pid);
bfa_trc(rport->fcs, event);
switch (event) {
case RPSM_EVENT_HCB_OFFLINE:
bfa_sm_set_state(rport, bfa_fcs_rport_sm_logo_sending);
bfa_fcs_rport_send_logo(rport, NULL);
break;
case RPSM_EVENT_LOGO_RCVD:
case RPSM_EVENT_ADDRESS_CHANGE:
break;
default:
bfa_assert(0);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function to determine if a device path node is Hi or not. */ | BOOLEAN IsHIDevicePathNode(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode) | /* Function to determine if a device path node is Hi or not. */
BOOLEAN IsHIDevicePathNode(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode) | {
ACPI_HID_DEVICE_PATH *Acpi;
ASSERT (DevicePathNode != NULL);
if (DevicePathNode->Type == HARDWARE_DEVICE_PATH) {
return TRUE;
}
if (DevicePathNode->Type == ACPI_DEVICE_PATH) {
Acpi = (ACPI_HID_DEVICE_PATH *)DevicePathNode;
switch (EISA_ID_TO_NUM (Acpi->HID)) {
case 0x0301:
case 0x0401:
case 0x0501:
case 0x0604:
return FALSE;
}
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Count the number of cpus on @node. We can't use nr_cpus_node() yet because acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been called yet. Note that node 0 will also count all non-existent cpus. */ | static int __meminit early_nr_cpus_node(int node) | /* Count the number of cpus on @node. We can't use nr_cpus_node() yet because acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been called yet. Note that node 0 will also count all non-existent cpus. */
static int __meminit early_nr_cpus_node(int node) | {
int cpu, n = 0;
for_each_possible_early_cpu(cpu)
if (node == node_cpuid[cpu].nid)
n++;
return n;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Delete cache entries in all the cache tables. */ | UINTN ArpDeleteCacheEntry(IN ARP_INSTANCE_DATA *Instance, IN BOOLEAN BySwAddress, IN UINT8 *AddressBuffer OPTIONAL, IN BOOLEAN Force) | /* Delete cache entries in all the cache tables. */
UINTN ArpDeleteCacheEntry(IN ARP_INSTANCE_DATA *Instance, IN BOOLEAN BySwAddress, IN UINT8 *AddressBuffer OPTIONAL, IN BOOLEAN Force) | {
ARP_SERVICE_DATA *ArpService;
UINTN Count;
NET_CHECK_SIGNATURE (Instance, ARP_INSTANCE_DATA_SIGNATURE);
ArpService = Instance->ArpService;
Count = ArpDeleteCacheEntryInTable (
&ArpService->DeniedCacheTable,
BySwAddress,
Instance->ConfigData.SwAddressType,
AddressBuffer,
Force
);
Count += ArpDeleteCacheEntryInTable (
&ArpService->ResolvedCacheTable,
BySwAddress,
Instance->ConfigData.SwAddressType,
AddressBuffer,
Force
);
return Count;
} | 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.