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
/* create intel hda controller with codec attached to it, so '-soundhw hda' works. */
static int intel_hda_and_codec_init(PCIBus *bus)
/* create intel hda controller with codec attached to it, so '-soundhw hda' works. */ static int intel_hda_and_codec_init(PCIBus *bus)
{ DeviceState *controller; BusState *hdabus; DeviceState *codec; controller = DEVICE(pci_create_simple(bus, -1, "intel-hda")); hdabus = QLIST_FIRST(&controller->child_bus); codec = qdev_create(hdabus, "hda-duplex"); qdev_init_nofail(codec); return 0; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Airpcap wrapper, used to save the driver's set of keys */
gboolean airpcap_if_set_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
/* Airpcap wrapper, used to save the driver's set of keys */ gboolean airpcap_if_set_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
{ if (!AirpcapLoaded || (g_PAirpcapSetDriverKeys==NULL)) return FALSE; return g_PAirpcapSetDriverKeys(AdapterHandle,KeysCollection); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the audio divisor on the MCP interface. */
void mcp_set_audio_divisor(struct mcp *mcp, unsigned int div)
/* Set the audio divisor on the MCP interface. */ void mcp_set_audio_divisor(struct mcp *mcp, unsigned int div)
{ spin_lock_irq(&mcp->lock); mcp->ops->set_audio_divisor(mcp, div); spin_unlock_irq(&mcp->lock); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used to register the pwm interrupt callback function. */
void tls_pwm_isr_register(void(*callback)(void))
/* This function is used to register the pwm interrupt callback function. */ void tls_pwm_isr_register(void(*callback)(void))
{ pwm_callback = callback; tls_irq_enable(PWM_IRQn); }
Nicholas3388/LuaNode
C++
Other
1,055
/* XXX - does this mean we should fetch the Ethernet and 802.11 FCS with "tvb_get_letohl()" rather than "tvb_get_ntohl()", or is fetching it big-endian and byte-swapping the CRC done to cope with 802.x sending stuff out in reverse bit order? */
guint32 crc32_802_tvb(tvbuff_t *tvb, guint len)
/* XXX - does this mean we should fetch the Ethernet and 802.11 FCS with "tvb_get_letohl()" rather than "tvb_get_ntohl()", or is fetching it big-endian and byte-swapping the CRC done to cope with 802.x sending stuff out in reverse bit order? */ guint32 crc32_802_tvb(tvbuff_t *tvb, guint len)
{ guint32 c_crc; c_crc = crc32_ccitt_tvb(tvb, len); c_crc = GUINT32_SWAP_LE_BE(c_crc); return ( c_crc ); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Acquire the device lock and process queues for the device. */
static void dasd_device_tasklet(struct dasd_device *)
/* Acquire the device lock and process queues for the device. */ static void dasd_device_tasklet(struct dasd_device *)
{ struct list_head final_queue; atomic_set (&device->tasklet_scheduled, 0); INIT_LIST_HEAD(&final_queue); spin_lock_irq(get_ccwdev_lock(device->cdev)); __dasd_device_check_expire(device); __dasd_device_process_ccw_queue(device, &final_queue); spin_unlock_irq(get_ccwdev_lock(device->cdev)); __dasd_device_process...
robutest/uclinux
C++
GPL-2.0
60
/* This function enables time-out function and configures timeout counter. */
void UI2C_EnableTimeout(UI2C_T *ui2c, uint32_t u32TimeoutCnt)
/* This function enables time-out function and configures timeout counter. */ void UI2C_EnableTimeout(UI2C_T *ui2c, uint32_t u32TimeoutCnt)
{ ui2c->PROTCTL = (ui2c->PROTCTL & ~UI2C_PROTCTL_TOCNT_Msk) | (u32TimeoutCnt << UI2C_PROTCTL_TOCNT_Pos); ui2c->BRGEN = (ui2c->BRGEN & ~UI2C_BRGEN_TMCNTSRC_Msk) | UI2C_BRGEN_TMCNTEN_Msk; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* LEB properties are categorized to enable fast find operations. When the LEB properties change they must be recategorized. */
static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops)
/* LEB properties are categorized to enable fast find operations. When the LEB properties change they must be recategorized. */ static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops)
{ int old_cat = lprops->flags & LPROPS_CAT_MASK; int new_cat = ubifs_categorize_lprops(c, lprops); if (old_cat == new_cat) { struct ubifs_lpt_heap *heap = &c->lpt_heap[new_cat - 1]; if (new_cat < 1 || new_cat > LPROPS_HEAP_CNT) return; heap = &c->lpt_heap[new_cat - 1]; adjust_lpt_heap(c, heap, lprops, lpr...
EmcraftSystems/u-boot
C++
Other
181
/* Returns: the #GValue structure that has been passed in */
GValue* g_value_reset(GValue *value)
/* Returns: the #GValue structure that has been passed in */ GValue* g_value_reset(GValue *value)
{ GTypeValueTable *value_table; GType g_type; g_return_val_if_fail (G_IS_VALUE (value), NULL); g_type = G_VALUE_TYPE (value); value_table = g_type_value_table_peek (g_type); if (value_table->value_free) value_table->value_free (value); value_meminit (value, g_type); value_table->value_init (value); ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get ESRT entry from ESRT Cache by FwClass Guid */
EFI_STATUS EFIAPI EsrtDxeGetEsrtEntry(IN EFI_GUID *FwClass, IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry)
/* Get ESRT entry from ESRT Cache by FwClass Guid */ EFI_STATUS EFIAPI EsrtDxeGetEsrtEntry(IN EFI_GUID *FwClass, IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry)
{ EFI_STATUS Status; if ((FwClass == NULL) || (Entry == NULL)) { return EFI_INVALID_PARAMETER; } Status = EfiAcquireLockOrFail (&mPrivate.NonFmpLock); if (EFI_ERROR (Status)) { return Status; } Status = GetEsrtEntry ( FwClass, ESRT_FROM_NONFMP, Entry ...
tianocore/edk2
C++
Other
4,240
/* Registers an interrupt handler for the EPI module. */
void EPIIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* Registers an interrupt handler for the EPI module. */ void EPIIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ uint32_t ui32Int; ASSERT(ui32Base == EPI0_BASE); ASSERT(pfnHandler); ui32Int = _EPIIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntRegister(ui32Int, pfnHandler); IntEnable(ui32Int); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function changes the attributes of a memory range to allow writes. */
EFI_STATUS EFIAPI LegacyRegion2Unlock(IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
/* This function changes the attributes of a memory range to allow writes. */ EFI_STATUS EFIAPI LegacyRegion2Unlock(IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
{ if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) { return EFI_INVALID_PARAMETER; } ASSERT (Granularity != NULL); *Granularity = 0; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* It is random distribution in the interval (1/2)*base...(3/2)*base. It corresponds to default IPv6 settings and is not overridable, because it is really reasonable choice. */
unsigned long neigh_rand_reach_time(unsigned long base)
/* It is random distribution in the interval (1/2)*base...(3/2)*base. It corresponds to default IPv6 settings and is not overridable, because it is really reasonable choice. */ unsigned long neigh_rand_reach_time(unsigned long base)
{ return (base ? (net_random() % base) + (base >> 1) : 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Please refer to the official documentation for function purpose and expected parameters. */
int ph7_result_int64(ph7_context *pCtx, ph7_int64 iValue)
/* Please refer to the official documentation for function purpose and expected parameters. */ int ph7_result_int64(ph7_context *pCtx, ph7_int64 iValue)
{ return ph7_value_int(pCtx->pRet,iValue); }
pikasTech/PikaPython
C++
MIT License
1,403
/* multiply by 2 in the galois field galois_mul2 */
UINT8 galois_mul2(UINT8 value)
/* multiply by 2 in the galois field galois_mul2 */ UINT8 galois_mul2(UINT8 value)
{ if (value>>7) { value = value << 1; return (value^0x1b); } else return value<<1; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This deallocates the parameter RAM slot allocated by edma_alloc_slot(). Callers are responsible for ensuring the slot is inactive, and will not be activated. */
void edma_free_slot(unsigned slot)
/* This deallocates the parameter RAM slot allocated by edma_alloc_slot(). Callers are responsible for ensuring the slot is inactive, and will not be activated. */ void edma_free_slot(unsigned slot)
{ unsigned ctlr; ctlr = EDMA_CTLR(slot); slot = EDMA_CHAN_SLOT(slot); if (slot < edma_info[ctlr]->num_channels || slot >= edma_info[ctlr]->num_slots) return; memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(slot), &dummy_paramset, PARM_SIZE); clear_bit(slot, edma_info[ctlr]->edma_inuse); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the MSB on basic rates as the firmware requires. Scan through an array and set the MSB for basic data rates. */
static void lbs_set_basic_rate_flags(u8 *rates, size_t len)
/* Sets the MSB on basic rates as the firmware requires. Scan through an array and set the MSB for basic data rates. */ static void lbs_set_basic_rate_flags(u8 *rates, size_t len)
{ int i; for (i = 0; i < len; i++) { if (rates[i] == 0x02 || rates[i] == 0x04 || rates[i] == 0x0b || rates[i] == 0x16) rates[i] |= 0x80; } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 0 in case of error, or length of printed string */
static int env_print(char *name, int flag)
/* Returns 0 in case of error, or length of printed string */ static int env_print(char *name, int flag)
{ char *res = NULL; ssize_t len; if (name) { struct env_entry e, *ep; e.key = name; e.data = NULL; hsearch_r(e, ENV_FIND, &ep, &env_htab, flag); if (ep == NULL) return 0; len = printf("%s=%s\n", ep->key, ep->data); return len; } len = hexport_r(&env_htab, '\n', flag, &res, 0, 0, NULL); if (len > ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Change Logs: Date Author Notes Bernard the first version */
static void os_clock_irq_handle(int irqno, void *param)
/* Change Logs: Date Author Notes Bernard the first version */ static void os_clock_irq_handle(int irqno, void *param)
{ volatile rt_uint32_t *temp_addr = (rt_uint32_t *)(0x01C20C00 + 0x04); *temp_addr |= 0x01; rt_tick_increase(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert text to the binary representation of a device path. */
EFI_DEVICE_PATH_PROTOCOL* EFIAPI ConvertTextToDevicePath(IN CONST CHAR16 *TextDevicePath)
/* Convert text to the binary representation of a device path. */ EFI_DEVICE_PATH_PROTOCOL* EFIAPI ConvertTextToDevicePath(IN CONST CHAR16 *TextDevicePath)
{ return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath); }
tianocore/edk2
C++
Other
4,240
/* install a session keyring, discarding the old one */
static int install_session_keyring(struct key *keyring)
/* install a session keyring, discarding the old one */ static int install_session_keyring(struct key *keyring)
{ struct cred *new; int ret; new = prepare_creds(); if (!new) return -ENOMEM; ret = install_session_keyring_to_cred(new, NULL); if (ret < 0) { abort_creds(new); return ret; } return commit_creds(new); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check a string doesn't overrun the chunk of memory we copied from user land. */
static int invalid_str(char *str, size_t size)
/* Check a string doesn't overrun the chunk of memory we copied from user land. */ static int invalid_str(char *str, size_t size)
{ if (memchr(str, 0, size)) return 0; return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* This service enables PEIMs to discover a given instance of an interface. */
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL, IN OUT VOID **Ppi)
/* This service enables PEIMs to discover a given instance of an interface. */ EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL, IN OUT VOID **Ppi)
{ CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi); }
tianocore/edk2
C++
Other
4,240
/* This function will fill a formatted string to buffer */
rt_int32_t rt_sprintf(char *buf, const char *format,...)
/* This function will fill a formatted string to buffer */ rt_int32_t rt_sprintf(char *buf, const char *format,...)
{ rt_int32_t n; va_list arg_ptr; va_start(arg_ptr, format); n = rt_vsprintf(buf, format, arg_ptr); va_end(arg_ptr); return n; }
pikasTech/PikaPython
C++
MIT License
1,403
/* retrieve the contents of MN10300 userspace general registers */
static int genregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
/* retrieve the contents of MN10300 userspace general registers */ static int genregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
{ const struct pt_regs *regs = task_pt_regs(target); int ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs, 0, PT_ORIG_D0 * sizeof(long)); if (ret < 0) return ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &regs->orig_d0, PT_ORIG_D0 * sizeof(long), NR_PTREGS * sizeof(l...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the TIMx peripheral Preload register on CCR3. */
void TIM_OC3PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR3. */ void TIM_OC3PreloadConfig(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)~((uint16_t)TIM_CCMR2_OC3PE); tmpccmr2 |= TIM_OCPreload; TIMx->CCMR2 = tmpccmr2; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SPI Disable Slave Management by Hardware. In slave mode the NSS hardware input is used as a select enable for the slave. */
void spi_disable_software_slave_management(uint32_t spi)
/* SPI Disable Slave Management by Hardware. In slave mode the NSS hardware input is used as a select enable for the slave. */ void spi_disable_software_slave_management(uint32_t spi)
{ SPI_CR1(spi) &= ~SPI_CR1_SSM; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Standard deviation of the elements of a floating-point vector. */
void arm_std_f32(const float32_t *pSrc, uint32_t blockSize, float32_t *pResult)
/* Standard deviation of the elements of a floating-point vector. */ void arm_std_f32(const float32_t *pSrc, uint32_t blockSize, float32_t *pResult)
{ float32_t var; arm_var_f32(pSrc,blockSize,&var); arm_sqrt_f32(var, pResult); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Get the element's address when read receive fifo 0. */
static uint32_t MCAN_GetRxFifo0ElementAddress(CAN_Type *base)
/* Get the element's address when read receive fifo 0. */ static uint32_t MCAN_GetRxFifo0ElementAddress(CAN_Type *base)
{ uint32_t eSize; uint32_t eAddress; eSize = (base->RXESC & CAN_RXESC_F0DS_MASK) >> CAN_RXESC_F0DS_SHIFT; if (eSize < 5U) { eSize += 4U; } else { eSize = eSize * 4U - 10U; } eAddress = base->RXF0C & CAN_RXF0C_F0SA_MASK; eAddress += ((base->RXF0S & CAN_RXF0S_F0...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* show_flags - read method for flags file in sysfs */
static ssize_t show_flags(struct device *dev, struct device_attribute *attr, char *buf)
/* show_flags - read method for flags file in sysfs */ static ssize_t show_flags(struct device *dev, struct device_attribute *attr, char *buf)
{ struct dock_station *dock_station = dev->platform_data; return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Description: Deal with a LSM problem when handling the packet in @skb, typically this is a permission denied problem (-EACCES). The correct action is determined according to the packet's labeling protocol. */
void netlbl_skbuff_err(struct sk_buff *skb, int error, int gateway)
/* Description: Deal with a LSM problem when handling the packet in @skb, typically this is a permission denied problem (-EACCES). The correct action is determined according to the packet's labeling protocol. */ void netlbl_skbuff_err(struct sk_buff *skb, int error, int gateway)
{ if (CIPSO_V4_OPTEXIST(skb)) cipso_v4_error(skb, error, gateway); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* configure other chipselect parameter (data bus size, ...) */
int bcm63xx_set_cs_param(unsigned int cs, u32 params)
/* configure other chipselect parameter (data bus size, ...) */ int bcm63xx_set_cs_param(unsigned int cs, u32 params)
{ unsigned long flags; u32 val; if (!is_valid_cs(cs)) return -EINVAL; if (cs == MPI_CS_PCMCIA_COMMON || cs == MPI_CS_PCMCIA_ATTR || cs == MPI_CS_PCMCIA_IO) return -EINVAL; spin_lock_irqsave(&bcm63xx_cs_lock, flags); val = bcm_mpi_readl(MPI_CSCTL_REG(cs)); val &= ~(MPI_CSCTL_DATA16_MASK); val &= ~(...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ while (1) { BSP_LED_Toggle(LED3); HAL_Delay(1000); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Retrieve the Key Usage from one X.509 certificate. */
BOOLEAN EFIAPI CryptoServiceX509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
/* Retrieve the Key Usage from one X.509 certificate. */ BOOLEAN EFIAPI CryptoServiceX509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
{ return CALL_BASECRYPTLIB (X509.Services.GetKeyUsage, X509GetKeyUsage, (Cert, CertSize, Usage), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Returns: 1 if step will be retried / 0 if not */
static int ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt, void(*job_step)(struct ibmvfc_target *))
/* Returns: 1 if step will be retried / 0 if not */ static int ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt, void(*job_step)(struct ibmvfc_target *))
{ if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) { ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); wake_up(&tgt->vhost->work_wait_q); return 0; } else ibmvfc_init_tgt(tgt, job_step); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* DMA Channel Enable Variable Sized Peripheral Increment after Transfer. Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_enable_peripheral_increment_mode(uint32_t dma, uint8_t stream)
/* DMA Channel Enable Variable Sized Peripheral Increment after Transfer. Ensure that the stream is disabled otherwise the setting will not be changed. */ void dma_enable_peripheral_increment_mode(uint32_t dma, uint8_t stream)
{ uint32_t reg32 = (DMA_SCR(dma, stream) | DMA_SxCR_PINC); DMA_SCR(dma, stream) = (reg32 & ~DMA_SxCR_PINCOS); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* An I/O port list is used to keep ordering stable and sane, as we don't have any good way to talk about ordering otherwise */
static int legacy_probe_add(unsigned long port, unsigned int irq, enum controller type, unsigned long private)
/* An I/O port list is used to keep ordering stable and sane, as we don't have any good way to talk about ordering otherwise */ static int legacy_probe_add(unsigned long port, unsigned int irq, enum controller type, unsigned long private)
{ struct legacy_probe *lp = &probe_list[0]; int i; struct legacy_probe *free = NULL; for (i = 0; i < NR_HOST; i++) { if (lp->port == 0 && free == NULL) free = lp; if (lp->port == port || legacy_port[i] == port) { free = lp; break; } lp++; } if (free == NULL) { printk(KERN_ERR "pata_legacy: Too ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* cx_device_probe - Look for matching device. Call driver probe routine if found. @cx_driver: driver table (cx_drv struct) from driver @cx_device: part/mfg id for the device */
static int cx_device_probe(struct device *dev)
/* cx_device_probe - Look for matching device. Call driver probe routine if found. @cx_driver: driver table (cx_drv struct) from driver @cx_device: part/mfg id for the device */ static int cx_device_probe(struct device *dev)
{ const struct cx_device_id *id; struct cx_drv *cx_drv = to_cx_driver(dev->driver); struct cx_dev *cx_dev = to_cx_dev(dev); int error = 0; if (!cx_dev->driver && cx_drv->probe) { id = cx_device_match(cx_drv->id_table, cx_dev); if (id) { if ((error = cx_drv->probe(cx_dev, id)) < 0) return error; else ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for putting the chip into sleep mode. */
static void sleep_mode_enter(void)
/* Function for putting the chip into sleep mode. */ static void sleep_mode_enter(void)
{ uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE); APP_ERROR_CHECK(err_code); err_code = bsp_btn_ble_sleep_mode_prepare(); APP_ERROR_CHECK(err_code); err_code = sd_power_system_off(); APP_ERROR_CHECK(err_code); }
labapart/polymcu
C++
null
201
/* Receives an amount of data in non blocking mode. */
static ald_status_t __uart_recv_by_it(ald_uart_handle_t *hperh)
/* Receives an amount of data in non blocking mode. */ static ald_status_t __uart_recv_by_it(ald_uart_handle_t *hperh)
{ if ((hperh->state & ALD_UART_STATE_RX_MASK) == 0x0) return ALD_BUSY; *hperh->rx_buf++ = (uint8_t)(hperh->perh->RXBUF & 0xFF); hperh->rx_count++; if (hperh->rx_count >= hperh->rx_size) { ald_uart_interrupt_config(hperh, ALD_UART_IT_RFNEMPTY, DISABLE); CLEAR_BIT(hperh->state,...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Stop the channel selected. In this function just clear the HE. */
int32_t sdma_channel_stop(uint32_t channel)
/* Stop the channel selected. In this function just clear the HE. */ int32_t sdma_channel_stop(uint32_t channel)
{ if (channel >= SDMA_NUM_CHANNELS) { return SDMA_RETV_FAIL; } HW_SDMAARM_STOP_STAT_SET(1 << channel); return SDMA_RETV_SUCCESS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* sched_setscheduler_nocheck - change the scheduling policy and/or RT priority of a thread from kernelspace. */
int sched_setscheduler_nocheck(struct task_struct *p, int policy, struct sched_param *param)
/* sched_setscheduler_nocheck - change the scheduling policy and/or RT priority of a thread from kernelspace. */ int sched_setscheduler_nocheck(struct task_struct *p, int policy, struct sched_param *param)
{ return __sched_setscheduler(p, policy, param, false); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns a bit mask of error flags, which can be the logical OR of any of the following: */
unsigned long EPIIntErrorStatus(unsigned long ulBase)
/* This function returns a bit mask of error flags, which can be the logical OR of any of the following: */ unsigned long EPIIntErrorStatus(unsigned long ulBase)
{ ASSERT(ulBase == EPI0_BASE); return(HWREG(ulBase + EPI_O_EISC)); }
watterott/WebRadio
C++
null
71
/* (Clearly, a task raising the refcount on its own ipc_ns needn't take mq_lock since it can't race with the last task in the ipcns exiting). */
void put_ipc_ns(struct ipc_namespace *ns)
/* (Clearly, a task raising the refcount on its own ipc_ns needn't take mq_lock since it can't race with the last task in the ipcns exiting). */ void put_ipc_ns(struct ipc_namespace *ns)
{ if (atomic_dec_and_lock(&ns->count, &mq_lock)) { mq_clear_sbinfo(ns); spin_unlock(&mq_lock); mq_put_mnt(ns); free_ipc_ns(ns); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* In DMA mode, this is the interrupt that occurs when the core has finished processing a transfer on a channel. Other host channel interrupts (except ahberr) are disabled in DMA mode. */
static void dwc2_hc_chhltd_intr(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, int chnum, struct dwc2_qtd *qtd)
/* In DMA mode, this is the interrupt that occurs when the core has finished processing a transfer on a channel. Other host channel interrupts (except ahberr) are disabled in DMA mode. */ static void dwc2_hc_chhltd_intr(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, int chnum, struct dwc2_qtd *qtd)
{ if (dbg_hc(chan)) dev_vdbg(hsotg->dev, "--Host Channel %d Interrupt: Channel Halted--\n", chnum); if (hsotg->core_params->dma_enable > 0) { dwc2_hc_chhltd_intr_dma(hsotg, chan, chnum, qtd); } else { if (!dwc2_halt_status_ok(hsotg, chan, chnum, qtd)) return; dwc2_release_channel(hsotg, chan, qtd, cha...
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base MCAN peripheral base address. param config The receive fifo 0 configuration structure. */
void MCAN_SetRxFifo0Config(CAN_Type *base, const mcan_rx_fifo_config_t *config)
/* param base MCAN peripheral base address. param config The receive fifo 0 configuration structure. */ void MCAN_SetRxFifo0Config(CAN_Type *base, const mcan_rx_fifo_config_t *config)
{ base->RXF0C |= CAN_RXF0C_F0SA(config->address >> CAN_RXF0C_F0SA_SHIFT) | CAN_RXF0C_F0S(config->elementSize) | CAN_RXF0C_F0WM(config->watermark) | CAN_RXF0C_F0OM(config->opmode); base->RXESC |= CAN_RXESC_F0DS(config->datafieldSize); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Here we get a special value_string, that return another value_string pointer instead of string value. This let us use the try_val_to_str to get val_to_str value from the value of a parameter on a more easier way than using switch cases */
static const guint8* dissect_mqpcf_parm_getintval(guint uPrm, guint uVal)
/* Here we get a special value_string, that return another value_string pointer instead of string value. This let us use the try_val_to_str to get val_to_str value from the value of a parameter on a more easier way than using switch cases */ static const guint8* dissect_mqpcf_parm_getintval(guint uPrm, guint uVal)
{ const value_string *pVs; pVs = (const value_string *)try_val_to_str_ext(uPrm, GET_VALS_EXTP(MQCFINT_Parse)); if (pVs) { return (const guint8 *)try_val_to_str(uVal, pVs); } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Upload unicast and multicast address lists to device and configure RX filtering. When the device doesn't support unicast filtering it is put in promiscuous mode while unicast addresses are present. */
void __dev_set_rx_mode(struct net_device *dev)
/* Upload unicast and multicast address lists to device and configure RX filtering. When the device doesn't support unicast filtering it is put in promiscuous mode while unicast addresses are present. */ void __dev_set_rx_mode(struct net_device *dev)
{ const struct net_device_ops *ops = dev->netdev_ops; if (!(dev->flags&IFF_UP)) return; if (!netif_device_present(dev)) return; if (ops->ndo_set_rx_mode) ops->ndo_set_rx_mode(dev); else { if (dev->uc.count > 0 && !dev->uc_promisc) { __dev_set_promiscuity(dev, 1); dev->uc_promisc = 1; } else if (dev...
EmcraftSystems/linux-emcraft
C++
Other
266
/* e1000_raise_ee_clk - Raises the EEPROM's clock input. @hw: Struct containing variables accessed by shared code @eecd: EECD's current value */
static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd)
/* e1000_raise_ee_clk - Raises the EEPROM's clock input. @hw: Struct containing variables accessed by shared code @eecd: EECD's current value */ static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd)
{ *eecd = *eecd | E1000_EECD_SK; ew32(EECD, *eecd); E1000_WRITE_FLUSH(); udelay(hw->eeprom.delay_usec); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the first probe delay time of a neighbour table to the specified value */
void rtnl_neightbl_set_delay_probe_time(struct rtnl_neightbl *ntbl, uint64_t ms)
/* Set the first probe delay time of a neighbour table to the specified value */ void rtnl_neightbl_set_delay_probe_time(struct rtnl_neightbl *ntbl, uint64_t ms)
{ ntbl->nt_parms.ntp_probe_delay = ms; ntbl->nt_parms.ntp_mask |= NEIGHTBLPARM_ATTR_DELAY_PROBE_TIME; ntbl->ce_mask |= NEIGHTBL_ATTR_PARMS; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Change Logs: Date Author Notes quanzhao the first version lizhirui porting to ls2k */
rt_inline rt_uint64_t rt_cpu_icache_line_size(void)
/* Change Logs: Date Author Notes quanzhao the first version lizhirui porting to ls2k */ rt_inline rt_uint64_t rt_cpu_icache_line_size(void)
{ rt_uint64_t ctr; return 4 << (ctr & 0xF); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function is used to get identify data. Data format of Identify data is defined by the Interface GUID. */
EFI_STATUS EFIAPI NvmExpressDiskInfoIdentify(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *IdentifyData, IN OUT UINT32 *IdentifyDataSize)
/* This function is used to get identify data. Data format of Identify data is defined by the Interface GUID. */ EFI_STATUS EFIAPI NvmExpressDiskInfoIdentify(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *IdentifyData, IN OUT UINT32 *IdentifyDataSize)
{ EFI_STATUS Status; NVME_DEVICE_PRIVATE_DATA *Device; Device = NVME_DEVICE_PRIVATE_DATA_FROM_DISK_INFO (This); Status = EFI_BUFFER_TOO_SMALL; if (*IdentifyDataSize >= sizeof (Device->NamespaceData)) { Status = EFI_SUCCESS; CopyMem (IdentifyData, &Device->NamespaceData, sizeof (Device-...
tianocore/edk2
C++
Other
4,240
/* Sets the DAC output in one of the three states. */
int32_t ad5791_dac_ouput_state(struct ad5791_dev *dev, uint8_t state)
/* Sets the DAC output in one of the three states. */ int32_t ad5791_dac_ouput_state(struct ad5791_dev *dev, uint8_t state)
{ uint32_t old_ctrl = 0; uint32_t new_ctrl = 0; int32_t status = 0; status = ad5791_get_register_value(dev, AD5791_REG_CTRL); if(status < 0) { return status; } old_ctrl = status; old_ctrl = old_ctrl & ~(AD5791_CTRL_DACTRI | AD5791_CTRL_OPGND); new_ctrl = old_ctrl | ((state << 2) & (AD5791_CTRL_D...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* ADC set multi mode. The various modes possible are described in the reference manual. */
void adc_set_multi_mode(uint32_t adc, uint32_t mode)
/* ADC set multi mode. The various modes possible are described in the reference manual. */ void adc_set_multi_mode(uint32_t adc, uint32_t mode)
{ ADC_CCR(adc) &= ~(ADC_CCR_DUAL_MASK << ADC_CCR_DUAL_SHIFT); ADC_CCR(adc) |= (mode << ADC_CCR_DUAL_SHIFT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Sets the vertical timings of the LCD controller. Only meaningful when using a TFT display. */
void LCD_SetVerticalTimings(unsigned int vfp, unsigned int vbp, unsigned int vpw, unsigned int vhdly)
/* Sets the vertical timings of the LCD controller. Only meaningful when using a TFT display. */ void LCD_SetVerticalTimings(unsigned int vfp, unsigned int vbp, unsigned int vpw, unsigned int vhdly)
{ ASSERT((vfp & 0xFFFFFF00) == 0, "LCD_SetVerticalTimings: Wrong vfp value.\n\r"); ASSERT((vbp & 0xFFFFFF00) == 0, "LCD_SetVerticalTimings: Wrong vbp value.\n\r"); ASSERT(((vpw-1) & 0xFFFFFFC0) == 0, "LCD_SetVerticalTimings: Wrong vpw value.\n\r"); ASSERT(((vhdly-1) & 0x...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base MCAN peripheral base pointer. param idx The MCAN buffer index. param pTxFrame Pointer to CAN message frame to be sent. retval kStatus_Success - Write Tx Message Buffer Successfully. retval kStatus_Fail - Tx Message Buffer is currently in use. */
status_t MCAN_TransferSendBlocking(CAN_Type *base, uint8_t idx, mcan_tx_buffer_frame_t *pTxFrame)
/* param base MCAN peripheral base pointer. param idx The MCAN buffer index. param pTxFrame Pointer to CAN message frame to be sent. retval kStatus_Success - Write Tx Message Buffer Successfully. retval kStatus_Fail - Tx Message Buffer is currently in use. */ status_t MCAN_TransferSendBlocking(CAN_Type *base, uint8_t ...
{ status_t status; if (kStatus_Success == MCAN_WriteTxBuffer(base, idx, pTxFrame)) { MCAN_TransmitAddRequest(base, idx); while (0U == MCAN_IsTransmitOccurred(base, idx)) { } status = kStatus_Success; } else { status = kStatus_Fail; } return...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write the input data (four consecutive 32-bit words). */
void aes_write_input_data(Aes *const p_aes, const uint32_t *p_input_data_buffer)
/* Write the input data (four consecutive 32-bit words). */ void aes_write_input_data(Aes *const p_aes, const uint32_t *p_input_data_buffer)
{ uint32_t i; Assert(p_aes); Assert(p_input_data_buffer); for (i = 0; i < 4; i++) { p_aes->AES_IDATAR[i] = *p_input_data_buffer; p_input_data_buffer++; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Got data from LAP layer so pass it up to upper layer */
void irlmp_data_indication(struct lsap_cb *self, struct sk_buff *skb)
/* Got data from LAP layer so pass it up to upper layer */ void irlmp_data_indication(struct lsap_cb *self, struct sk_buff *skb)
{ skb_pull(skb, LMP_HEADER); if (self->notify.data_indication) { skb_get(skb); self->notify.data_indication(self->notify.instance, self, skb); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This internal functions retrieves PCI Express Base Address via a PCD entry PcdPciExpressBaseAddress. */
VOID* GetPciExpressBaseAddress(VOID)
/* This internal functions retrieves PCI Express Base Address via a PCD entry PcdPciExpressBaseAddress. */ VOID* GetPciExpressBaseAddress(VOID)
{ return (VOID *)(UINTN)PcdGet64 (PcdPciExpressBaseAddress); }
tianocore/edk2
C++
Other
4,240
/* DMA Enable FIFO Mode. Data is transferred via a FIFO. */
void dma_enable_fifo_mode(uint32_t dma, uint8_t stream)
/* DMA Enable FIFO Mode. Data is transferred via a FIFO. */ void dma_enable_fifo_mode(uint32_t dma, uint8_t stream)
{ DMA_SFCR(dma, stream) |= DMA_SxFCR_DMDIS; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Check if the Rx fifo is empty or not. @method UART_IsRXFIFONotEmpty */
Boolean UART_IsRXFIFONotEmpty(UART_TypeDef *UARTx)
/* Check if the Rx fifo is empty or not. @method UART_IsRXFIFONotEmpty */ Boolean UART_IsRXFIFONotEmpty(UART_TypeDef *UARTx)
{ _ASSERT(IS_UART(UARTx)); return (Boolean)(!(UARTx->STATUS.bit.RX_EMPTY)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* wait until RTC_TIME and RTC_DATE registers are synchronized with APB clock, and the shadow registers are updated */
ErrStatus rtc_register_sync_wait(void)
/* wait until RTC_TIME and RTC_DATE registers are synchronized with APB clock, and the shadow registers are updated */ ErrStatus rtc_register_sync_wait(void)
{ volatile uint32_t time_index = RTC_RSYNF_TIMEOUT; uint32_t flag_status = RESET; ErrStatus error_status = ERROR; if ((uint32_t)RESET == (RTC_CTL & RTC_CTL_BPSHAD)){ RTC_WPK = RTC_UNLOCK_KEY1; RTC_WPK = RTC_UNLOCK_KEY2; RTC_STAT &= (uint32_t)(~RTC_STAT_RSYNF); do{ ...
liuxuming/trochili
C++
Apache License 2.0
132
/* Return link and relative domain id based on absolute domain id. */
static const struct log_link* get_link_domain(uint8_t domain_id, uint8_t *rel_domain_id)
/* Return link and relative domain id based on absolute domain id. */ static const struct log_link* get_link_domain(uint8_t domain_id, uint8_t *rel_domain_id)
{ uint8_t domain_max; STRUCT_SECTION_FOREACH(log_link, link) { domain_max = link->ctrl_blk->domain_offset + link->ctrl_blk->domain_cnt; if (domain_id < domain_max) { *rel_domain_id = domain_id - link->ctrl_blk->domain_offset; return link; } } *rel_domain_id = 0; return NULL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* End DMA mode and switch the controller back into PIO mode */
static void ns87415_bmdma_stop(struct ata_queued_cmd *qc)
/* End DMA mode and switch the controller back into PIO mode */ static void ns87415_bmdma_stop(struct ata_queued_cmd *qc)
{ ata_bmdma_stop(qc); ns87415_set_mode(qc->ap, qc->dev, qc->dev->pio_mode); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ring_buffer_reset - reset a ring buffer @buffer: The ring buffer to reset all cpu buffers */
void ring_buffer_reset(struct ring_buffer *buffer)
/* ring_buffer_reset - reset a ring buffer @buffer: The ring buffer to reset all cpu buffers */ void ring_buffer_reset(struct ring_buffer *buffer)
{ int cpu; for_each_buffer_cpu(buffer, cpu) ring_buffer_reset_cpu(buffer, cpu); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @read a character from the modem line with timeout. @eat parity, XON and XOFF characters. */
rt_int16_t zxor_read(void)
/* @read a character from the modem line with timeout. @eat parity, XON and XOFF characters. */ rt_int16_t zxor_read(void)
{ rt_int16_t res; for (;;) { if ((res = zread_line(100)) < 0) return res; switch (res &= 0177) { case XON: case XOFF: continue; case '\r': case '\n': case ZDLE: default: return res; } } }
pikasTech/PikaPython
C++
MIT License
1,403
/* returns 0 if write is successful, -1 else. */
static int write_acpi_int(acpi_handle handle, const char *method, int val, struct acpi_buffer *output)
/* returns 0 if write is successful, -1 else. */ static int write_acpi_int(acpi_handle handle, const char *method, int val, struct acpi_buffer *output)
{ struct acpi_object_list params; union acpi_object in_obj; acpi_status status; if (!handle) return 0; params.count = 1; params.pointer = &in_obj; in_obj.type = ACPI_TYPE_INTEGER; in_obj.integer.value = val; status = acpi_evaluate_object(handle, (char *)method, &params, output); if (status == AE_OK) retur...
EmcraftSystems/linux-emcraft
C++
Other
266
/* edac_workqueue_setup initialize the edac work queue for polling operations */
static int edac_workqueue_setup(void)
/* edac_workqueue_setup initialize the edac work queue for polling operations */ static int edac_workqueue_setup(void)
{ edac_workqueue = create_singlethread_workqueue("edac-poller"); if (edac_workqueue == NULL) return -ENODEV; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */
void rt_hw_trap_dabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */ void rt_hw_trap_dabt(struct rt_hw_register *regs)
{ rt_hw_show_register(regs); rt_kprintf("data abort\n"); rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); rt_hw_cpu_shutdown(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function reads the baro data and reports the data */
static int drv_baro_bosch_bmp380_read_baro(i2c_dev_t *drv, barometer_data_t *pdata)
/* This function reads the baro data and reports the data */ static int drv_baro_bosch_bmp380_read_baro(i2c_dev_t *drv, barometer_data_t *pdata)
{ int ret = 0; ret = drv_baro_bosch_bmp380_read_uncomp_baro(drv, pdata); if (unlikely(ret) != 0) { return ret; } ret = drv_baro_bosch_bmp380_compensate_baro(pdata); if (unlikely(ret) != 0) { return ret; } return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function allows the file system to proceed by unlocking the exclusively held transaction lock. Other GFS2 nodes are now free to acquire the lock shared and go on with their lives. */
void gfs2_unfreeze_fs(struct gfs2_sbd *sdp)
/* This function allows the file system to proceed by unlocking the exclusively held transaction lock. Other GFS2 nodes are now free to acquire the lock shared and go on with their lives. */ void gfs2_unfreeze_fs(struct gfs2_sbd *sdp)
{ mutex_lock(&sdp->sd_freeze_lock); if (sdp->sd_freeze_count && !--sdp->sd_freeze_count) gfs2_glock_dq_uninit(&sdp->sd_freeze_gh); mutex_unlock(&sdp->sd_freeze_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the type of an endpoint given its descriptor. */
unsigned char USBEndpointDescriptor_GetType(const USBEndpointDescriptor *endpoint)
/* Returns the type of an endpoint given its descriptor. */ unsigned char USBEndpointDescriptor_GetType(const USBEndpointDescriptor *endpoint)
{ return endpoint->bmAttributes & 0x3; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Stop Broadcasting. This API is used to stop the broadcast procedure. */
ADI_BLER_RESULT adi_radio_StopBroadcastProc(void)
/* Stop Broadcasting. This API is used to stop the broadcast procedure. */ ADI_BLER_RESULT adi_radio_StopBroadcastProc(void)
{ ADI_BLER_RESULT bleResult; ADI_BLE_LOGEVENT(LOGID_CMD_BLEGAP_STOP_BROADCAST); ADI_BLE_RADIO_CMD_START(CMD_BLEGAP_STOP_BROADCAST); bleResult = bler_process_cmd(CMD_BLEGAP_STOP_BROADCAST, 0u, NULL, 0u); if(bleResult == ADI_BLER_SUCCESS){ bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_EV...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* param base Ctimer peripheral base address param matchChannel Match pin to be used to output the PWM signal param dutyCyclePercent New PWM pulse width; the value should be between 0 to 100 */
void CTIMER_UpdatePwmDutycycle(CTIMER_Type *base, ctimer_match_t matchChannel, uint8_t dutyCyclePercent)
/* param base Ctimer peripheral base address param matchChannel Match pin to be used to output the PWM signal param dutyCyclePercent New PWM pulse width; the value should be between 0 to 100 */ void CTIMER_UpdatePwmDutycycle(CTIMER_Type *base, ctimer_match_t matchChannel, uint8_t dutyCyclePercent)
{ uint32_t pulsePeriod = 0, period; period = base->MR[kCTIMER_Match_3]; if (dutyCyclePercent == 0U) { pulsePeriod = period + 1U; } else { pulsePeriod = (period * (100U - (uint32_t)dutyCyclePercent)) / 100U; } base->MR[matchChannel] = pulsePeriod; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Fills each EINT_Config_T member with its default value. */
void EINT_ConfigStructInit(EINT_Config_T *eintConfig)
/* Fills each EINT_Config_T member with its default value. */ void EINT_ConfigStructInit(EINT_Config_T *eintConfig)
{ eintConfig->line = EINT_LINENONE; eintConfig->mode = EINT_MODE_INTERRUPT; eintConfig->trigger = EINT_TRIGGER_FALLING; eintConfig->lineCmd = DISABLE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function gets the calibration coefficient data for the specified parameter. */
u16 XAdcPs_GetCalibCoefficient(XAdcPs *InstancePtr, u8 CoeffType)
/* This function gets the calibration coefficient data for the specified parameter. */ u16 XAdcPs_GetCalibCoefficient(XAdcPs *InstancePtr, u8 CoeffType)
{ u32 RegData; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); Xil_AssertNonvoid(CoeffType <= XADCPS_CALIB_GAIN_ERROR_COEFF); RegData = XAdcPs_ReadInternalReg(InstancePtr, (XADCPS_ADC_A_SUPPLY_CALIB_OFFSET + (u32)CoeffType)); return (u16) RegDat...
ua1arn/hftrx
C++
null
69
/* This function stop all receive and transmit activity and disable MAC interface. */
void EMAC_Close(EMAC_T *EMAC)
/* This function stop all receive and transmit activity and disable MAC interface. */ void EMAC_Close(EMAC_T *EMAC)
{ EMAC->CTL |= EMAC_CTL_RST_Msk; while (EMAC->CTL & EMAC_CTL_RST_Msk) {} }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This API is used to validate the device structure pointer for null conditions. This internal API is used to validate the device structure pointer for null conditions. */
static int8_t null_ptr_check(const struct bmi160_dev *dev)
/* This API is used to validate the device structure pointer for null conditions. This internal API is used to validate the device structure pointer for null conditions. */ static int8_t null_ptr_check(const struct bmi160_dev *dev)
{ int8_t rslt; if ((dev == NULL) || (dev->read == NULL) || (dev->write == NULL) || (dev->delay_ms == NULL)) { rslt = BMI160_E_NULL_PTR; } else { rslt = BMI160_OK; } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Ethernet MAC clocks: only revelant on 6358, silently enable misc clocks */
static void enetx_set(struct clk *clk, int enable)
/* Ethernet MAC clocks: only revelant on 6358, silently enable misc clocks */ static void enetx_set(struct clk *clk, int enable)
{ if (enable) clk_enable_unlocked(&clk_enet_misc); else clk_disable_unlocked(&clk_enet_misc); if (BCMCPU_IS_6358()) { u32 mask; if (clk->id == 0) mask = CKCTL_6358_ENET0_EN; else mask = CKCTL_6358_ENET1_EN; bcm_hwclock_set(mask, enable); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read data with special length in slave mode through the USIx peripheral. */
void USI_I2C_SlaveRead(USI_TypeDef *USIx, u8 *pBuf, u8 len)
/* Read data with special length in slave mode through the USIx peripheral. */ void USI_I2C_SlaveRead(USI_TypeDef *USIx, u8 *pBuf, u8 len)
{ u8 cnt = 0; assert_param(IS_USI_I2C_ALL_PERIPH(USIx)); for(cnt = 0; cnt < len; cnt++) { while((USI_I2C_CheckRXFIFOState(USIx, USI_RXFIFO_EMPTY)) == 1); *pBuf++ = (u8)USIx->RX_FIFO_READ; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Close INIT_FS phase with a (good) watchdog refresh. */
static int fs26_exit_init_fs_state(const struct device *dev)
/* Close INIT_FS phase with a (good) watchdog refresh. */ static int fs26_exit_init_fs_state(const struct device *dev)
{ return fs26_wd_refresh(dev); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ixgbe_configure_msi_and_legacy - Initialize PIN (INTA...) and MSI interrupts */
static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
/* ixgbe_configure_msi_and_legacy - Initialize PIN (INTA...) and MSI interrupts */ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
{ struct ixgbe_hw *hw = &adapter->hw; IXGBE_WRITE_REG(hw, IXGBE_EITR(0), EITR_INTS_PER_SEC_TO_REG(adapter->rx_eitr_param)); ixgbe_set_ivar(adapter, 0, 0, 0); ixgbe_set_ivar(adapter, 1, 0, 0); map_vector_to_rxq(adapter, 0, 0); map_vector_to_txq(adapter, 0, 0); DPRINTK(HW, INFO, "Legacy interrupt ...
robutest/uclinux
C++
GPL-2.0
60
/* Configure channel enable or disable. It will unbind descriptor with channel, when channel has been disable. */
void ald_dma_channel_config(uint8_t channel, type_func_t state)
/* Configure channel enable or disable. It will unbind descriptor with channel, when channel has been disable. */ void ald_dma_channel_config(uint8_t channel, type_func_t state)
{ assert_param(IS_DMA_CHANNEL(channel)); assert_param(IS_FUNC_STATE(state)); if (state) { SET_BIT(DMA->CHANNEL[channel].CON, DMA_CON_CHEN_MSK); } else { CLEAR_BIT(DMA->CHANNEL[channel].CON, DMA_CON_CHEN_MSK); WRITE_REG(DMA->CHANNEL[channel].CON, 0x0); WRITE_RE...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called by port to notify transition to online state. */
void bfa_fcs_port_fab_online(struct bfa_fcs_port_s *port)
/* Called by port to notify transition to online state. */ void bfa_fcs_port_fab_online(struct bfa_fcs_port_s *port)
{ bfa_fcs_port_ns_online(port); bfa_fcs_port_scn_online(port); }
robutest/uclinux
C++
GPL-2.0
60
/* LPT trivial garbage collection is where a LPT LEB contains only dirty and free space and so may be reused as soon as the next commit is completed. This function is called during start commit to mark LPT LEBs for trivial GC. */
static void lpt_tgc_start(struct ubifs_info *c)
/* LPT trivial garbage collection is where a LPT LEB contains only dirty and free space and so may be reused as soon as the next commit is completed. This function is called during start commit to mark LPT LEBs for trivial GC. */ static void lpt_tgc_start(struct ubifs_info *c)
{ int i; for (i = 0; i < c->lpt_lebs; i++) { if (i + c->lpt_first == c->nhead_lnum) continue; if (c->ltab[i].dirty > 0 && c->ltab[i].free + c->ltab[i].dirty == c->leb_size) { c->ltab[i].tgc = 1; c->ltab[i].free = c->leb_size; c->ltab[i].dirty = 0; dbg_lp("LEB %d", i + c->lpt_first); } } }
robutest/uclinux
C++
GPL-2.0
60
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. */
int32_t FMC_Erase(uint32_t u32PageAddr)
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. */ int32_t FMC_Erase(uint32_t u32PageAddr)
{ int32_t ret = 0; if (u32PageAddr == FMC_SPROM_BASE) { ret = FMC_Erase_SPROM(); } if (ret == 0) { FMC->ISPCMD = FMC_ISPCMD_PAGE_ERASE; FMC->ISPADDR = u32PageAddr; FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk; while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { } if (FMC-...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Unlink the memory block from the pool's list. */
VOID UsbHcUnlinkMemBlock(IN USBHC_MEM_BLOCK *Head, IN USBHC_MEM_BLOCK *BlockToUnlink)
/* Unlink the memory block from the pool's list. */ VOID UsbHcUnlinkMemBlock(IN USBHC_MEM_BLOCK *Head, IN USBHC_MEM_BLOCK *BlockToUnlink)
{ USBHC_MEM_BLOCK *Block; ASSERT ((Head != NULL) && (BlockToUnlink != NULL)); for (Block = Head; Block != NULL; Block = Block->Next) { if (Block->Next == BlockToUnlink) { Block->Next = BlockToUnlink->Next; BlockToUnlink->Next = NULL; break; } } }
tianocore/edk2
C++
Other
4,240
/* @guid: GUID to search @hob_list: A pointer to the HOB list */
const struct hob_header* hob_get_next_guid_hob(const efi_guid_t *guid, const void *hob_list)
/* @guid: GUID to search @hob_list: A pointer to the HOB list */ const struct hob_header* hob_get_next_guid_hob(const efi_guid_t *guid, const void *hob_list)
{ const struct hob_header *hdr; struct hob_guid *guid_hob; hdr = hob_list; while ((hdr = hob_get_next_hob(HOB_TYPE_GUID_EXT, hdr))) { guid_hob = (struct hob_guid *)hdr; if (!guidcmp(guid, &guid_hob->name)) break; hdr = get_next_hob(hdr); } return hdr; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Function to determine if a given filename exists. */
EFI_STATUS EFIAPI ShellFileExists(IN CONST CHAR16 *Name)
/* Function to determine if a given filename exists. */ EFI_STATUS EFIAPI ShellFileExists(IN CONST CHAR16 *Name)
{ EFI_STATUS Status; EFI_SHELL_FILE_INFO *List; ASSERT (Name != NULL); List = NULL; Status = ShellOpenFileMetaArg ((CHAR16 *)Name, EFI_FILE_MODE_READ, &List); if (EFI_ERROR (Status)) { return (Status); } ShellCloseFileMetaArg (&List); return (EFI_SUCCESS); }
tianocore/edk2
C++
Other
4,240
/* This function gets the current sample rate of the ADC. */
uint32_t SysCtlADCSpeedGet(void)
/* This function gets the current sample rate of the ADC. */ uint32_t SysCtlADCSpeedGet(void)
{ return(HWREG(SYSCTL_RCGC0) & (SYSCTL_RCGC0_ADC1SPD_M | SYSCTL_RCGC0_ADC0SPD_M)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Deserializes the supplied (wire) buffer into an ack */
int MQTTDeserialize_ack(unsigned char *packettype, unsigned char *dup, unsigned short *packetid, unsigned char *buf, int buflen)
/* Deserializes the supplied (wire) buffer into an ack */ int MQTTDeserialize_ack(unsigned char *packettype, unsigned char *dup, unsigned short *packetid, unsigned char *buf, int buflen)
{ MQTTHeader header = {0}; unsigned char* curdata = buf; unsigned char* enddata = NULL; int rc = 0; int mylen; FUNC_ENTRY; header.byte = readChar(&curdata); *dup = header.bits.dup; *packettype = header.bits.type; curdata += (rc = MQTTPacket_decodeBuf(curdata, ...
pikasTech/PikaPython
C++
MIT License
1,403
/* Removes data from the segments that are currently present in the firmware data module. The size of a segment is automatically adjusted or removed, if necessary. */
LIBOPENBLT_EXPORT uint32_t BltFirmwareRemoveData(uint32_t address, uint32_t len)
/* Removes data from the segments that are currently present in the firmware data module. The size of a segment is automatically adjusted or removed, if necessary. */ LIBOPENBLT_EXPORT uint32_t BltFirmwareRemoveData(uint32_t address, uint32_t len)
{ uint32_t result = BLT_RESULT_ERROR_GENERIC; assert(len > 0); if (len > 0) { if (FirmwareRemoveData(address, len)) { result = BLT_RESULT_OK; } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Airpcap wrapper, used to turn off the led of an airpcap adapter */
gboolean airpcap_if_turn_led_off(PAirpcapHandle AdapterHandle, guint LedNumber)
/* Airpcap wrapper, used to turn off the led of an airpcap adapter */ gboolean airpcap_if_turn_led_off(PAirpcapHandle AdapterHandle, guint LedNumber)
{ if (!AirpcapLoaded) return FALSE; return g_PAirpcapTurnLedOff(AdapterHandle,LedNumber); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the callback for sending the Sink Caps to the DPM. */
void usbc_set_policy_cb_set_port_partner_snk_cap(const struct device *dev, const policy_cb_set_port_partner_snk_cap_t cb)
/* Set the callback for sending the Sink Caps to the DPM. */ void usbc_set_policy_cb_set_port_partner_snk_cap(const struct device *dev, const policy_cb_set_port_partner_snk_cap_t cb)
{ struct usbc_port_data *data = dev->data; data->policy_cb_set_port_partner_snk_cap = cb; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns a suitable unique value for a new device interface number. The caller must hold the rtnl semaphore or the dev_base_lock to be sure it remains unique. */
static int dev_new_index(struct net *net)
/* Returns a suitable unique value for a new device interface number. The caller must hold the rtnl semaphore or the dev_base_lock to be sure it remains unique. */ static int dev_new_index(struct net *net)
{ static int ifindex; for (;;) { if (++ifindex <= 0) ifindex = 1; if (!__dev_get_by_index(net, ifindex)) return ifindex; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Using the fb_var_screeninfo in fb_info we set the aoi of this particular framebuffer. It is a light version of fsl_diu_set_par. */
static int fsl_diu_set_aoi(struct fb_info *info)
/* Using the fb_var_screeninfo in fb_info we set the aoi of this particular framebuffer. It is a light version of fsl_diu_set_par. */ static int fsl_diu_set_aoi(struct fb_info *info)
{ struct fb_var_screeninfo *var = &info->var; struct mfb_info *mfbi = info->par; struct diu_ad *ad = mfbi->ad; ad->offset_xyi = cpu_to_le32((var->yoffset << 16) | var->xoffset); ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Routine implementing u-boot fsinfo command. This routine prints out miscellaneous filesystem informations/statistics. */
int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* Routine implementing u-boot fsinfo command. This routine prints out miscellaneous filesystem informations/statistics. */ int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{ struct part_info *part; char *fsname; int ret; if (mtdparts_init() !=0) return 1; if ((part = jffs2_part_info(current_mtd_dev, current_mtd_partnum))){ fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); printf("### filesystem type is %s\n", fsname); if (cramfs_check(part)) { ret = cramfs_info (part); ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Print the hexical UINTN index data to instruction content. */
UINTN EdbPrintIndexData(IN BOOLEAN Sign, IN UINTN NaturalUnits, IN UINTN ConstantUnits)
/* Print the hexical UINTN index data to instruction content. */ UINTN EdbPrintIndexData(IN BOOLEAN Sign, IN UINTN NaturalUnits, IN UINTN ConstantUnits)
{ EDBSPrintWithOffset ( mInstructionString.Content, EDB_INSTRUCTION_CONTENT_MAX_SIZE, mInstructionContentOffset, L"(%s%d,%s%d)", Sign ? L"-" : L"+", NaturalUnits, Sign ? L"-" : L"+", ConstantUnits ); mInstructionContentOffset = mInstructionContentOffset + 5 + EdbGetBitWidth (Natu...
tianocore/edk2
C++
Other
4,240
/* Return value: number of bytes printed to buffer */
static ssize_t ipr_store_log_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
/* Return value: number of bytes printed to buffer */ static ssize_t ipr_store_log_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ struct Scsi_Host *shost = class_to_shost(dev); struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; unsigned long lock_flags = 0; spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); ioa_cfg->log_level = simple_strtoul(buf, NULL, 10); spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_fla...
robutest/uclinux
C++
GPL-2.0
60
/* Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. The 8-bit value specified by Value is written. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. Value is returned. If Status is not NULL, then the status of the executed command is returned in ...
UINT8 EFIAPI SmBusWriteDataByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
/* Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. The 8-bit value specified by Value is written. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. Value is returned. If Status is not NULL, then the status of the executed command is returned in ...
{ UINT8 Byte; ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0); ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0); Byte = Value; InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status); return Value; }
tianocore/edk2
C++
Other
4,240