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
/* Supporting over 60 cpus on NUMA-Q requires a locality-dependent cpu to APIC ID relation to properly interact with the intelligent mode of the cluster controller. */
static int numaq_cpu_present_to_apicid(int mps_cpu)
/* Supporting over 60 cpus on NUMA-Q requires a locality-dependent cpu to APIC ID relation to properly interact with the intelligent mode of the cluster controller. */ static int numaq_cpu_present_to_apicid(int mps_cpu)
{ if (mps_cpu < 60) return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3)); else return BAD_APICID; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Arguments: node_data : input. list_header_input : input. Return value: 0 : success !0 : fail note: */
s32 list_node_exist(void *data, struct usb_list_head *list_head)
/* Arguments: node_data : input. list_header_input : input. Return value: 0 : success !0 : fail note: */ s32 list_node_exist(void *data, struct usb_list_head *list_head)
{ struct usb_list_head *list_start = NULL; struct usb_list_head *list_now = NULL; __u32 cup_sr = 0; if (data == NULL || list_head == NULL) { hal_log_err("ERR : list_node_exist: input == NULL"); return -1; } hal_spin_lock(&list_lock); list_start = list_head; list_now = list_start->next; while (list_now != list_start) { if (list_now->data == data) { hal_spin_unlock(&list_lock); return 0; } list_now = list_now->next; } hal_spin_unlock(&list_lock); return -1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function propagates the mount-wide flags to individual inode flags. */
static void ecryptfs_copy_mount_wide_flags_to_inode_flags(struct ecryptfs_crypt_stat *crypt_stat, struct ecryptfs_mount_crypt_stat *mount_crypt_stat)
/* This function propagates the mount-wide flags to individual inode flags. */ static void ecryptfs_copy_mount_wide_flags_to_inode_flags(struct ecryptfs_crypt_stat *crypt_stat, struct ecryptfs_mount_crypt_stat *mount_crypt_stat)
{ if (mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED) crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) crypt_stat->flags |= ECRYPTFS_VIEW_AS_ENCRYPTED; if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { crypt_stat->flags |= ECRYPTFS_ENCRYPT_FILENAMES; if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK) crypt_stat->flags |= ECRYPTFS_ENCFN_USE_MOUNT_FNEK; else if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCFN_USE_FEK) crypt_stat->flags |= ECRYPTFS_ENCFN_USE_FEK; } }
robutest/uclinux
C++
GPL-2.0
60
/* decode input event and put to read buffer of each opened file */
static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, struct snd_seq_event *ev)
/* decode input event and put to read buffer of each opened file */ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, struct snd_seq_event *ev)
{ struct snd_virmidi *vmidi; unsigned char msg[4]; int len; read_lock(&rdev->filelist_lock); list_for_each_entry(vmidi, &rdev->filelist, list) { if (!vmidi->trigger) continue; if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) continue; snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream); } else { len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); if (len > 0) snd_rawmidi_receive(vmidi->substream, msg, len); } } read_unlock(&rdev->filelist_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param config Pointer to a user-defined configuration structure. */
void DSI_GetDefaultConfig(dsi_config_t *config)
/* param config Pointer to a user-defined configuration structure. */ void DSI_GetDefaultConfig(dsi_config_t *config)
{ assert(config); (void)memset(config, 0, sizeof(*config)); config->numLanes = 4; config->enableNonContinuousHsClk = false; config->enableTxUlps = false; config->autoInsertEoTp = true; config->numExtraEoTp = 0; config->htxTo_ByteClk = 0; config->lrxHostTo_ByteClk = 0; config->btaTo_ByteClk = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __initialize_port_locks - initialize a port's RX machine spinlock @port: the port we're looking at */
static void __initialize_port_locks(struct port *port)
/* __initialize_port_locks - initialize a port's RX machine spinlock @port: the port we're looking at */ static void __initialize_port_locks(struct port *port)
{ spin_lock_init(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the GPIO pin used as EXTI Line. */
void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex)
/* Selects the GPIO pin used as EXTI Line. */ void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex)
{ uint32_t tmp = 0x00; assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx)); assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex)); tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)); SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03))); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base The I3C peripheral base address. param data IBI data param dataSize IBI data length */
void I3C_SlaveRequestIBIWithSingleData(I3C_Type *base, uint8_t data, size_t dataSize)
/* param base The I3C peripheral base address. param data IBI data param dataSize IBI data length */ void I3C_SlaveRequestIBIWithSingleData(I3C_Type *base, uint8_t data, size_t dataSize)
{ uint32_t ctrlValue = base->SCTRL; ctrlValue &= ~(I3C_SCTRL_EVENT_MASK | I3C_SCTRL_IBIDATA_MASK); ctrlValue |= I3C_SCTRL_EVENT(1U) | I3C_SCTRL_IBIDATA(data); base->SCTRL = ctrlValue; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call backs all registered clients once a offload device is deactivated */
void cxgb3_remove_clients(struct t3cdev *tdev)
/* Call backs all registered clients once a offload device is deactivated */ void cxgb3_remove_clients(struct t3cdev *tdev)
{ struct cxgb3_client *client; mutex_lock(&cxgb3_db_lock); list_for_each_entry(client, &client_list, client_list) { if (client->remove) client->remove(tdev); } mutex_unlock(&cxgb3_db_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate number of records in a bmap btree block. */
int xfs_bmbt_maxrecs(struct xfs_mount *mp, int blocklen, int leaf)
/* Calculate number of records in a bmap btree block. */ int xfs_bmbt_maxrecs(struct xfs_mount *mp, int blocklen, int leaf)
{ blocklen -= XFS_BMBT_BLOCK_LEN(mp); if (leaf) return blocklen / sizeof(xfs_bmbt_rec_t); return blocklen / (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)); }
robutest/uclinux
C++
GPL-2.0
60
/* Check the selected Global interrupt source pending bit. */
uint8_t stmpe811_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source)
/* Check the selected Global interrupt source pending bit. */ uint8_t stmpe811_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source)
{ return((IOE_Read(DeviceAddr, STMPE811_REG_INT_STA) & Source) == Source); }
eclipse-threadx/getting-started
C++
Other
310
/* Enable the input direction of the specified GPIO. */
int32_t gpio_direction_input(gpio_desc *desc)
/* Enable the input direction of the specified GPIO. */ int32_t gpio_direction_input(gpio_desc *desc)
{ uint16_t pin; uint8_t port; gpio_get_portpin(desc, &port, &pin); return adi_gpio_InputEnable(port, pin, true); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Ascii internet address interpretation routine. The value returned is in network order. */
u32_t ipaddr_addr(const char *cp)
/* Ascii internet address interpretation routine. The value returned is in network order. */ u32_t ipaddr_addr(const char *cp)
{ ip_addr_t val; if (ipaddr_aton(cp, &val)) { return ip4_addr_get_u32(&val); } return (IPADDR_NONE); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Return buffer_head of bitmap on success or NULL. */
static struct buffer_head* read_inode_bitmap(struct super_block *sb, unsigned long block_group)
/* Return buffer_head of bitmap on success or NULL. */ static struct buffer_head* read_inode_bitmap(struct super_block *sb, unsigned long block_group)
{ struct ext2_group_desc *desc; struct buffer_head *bh = NULL; desc = ext2_get_group_desc(sb, block_group, NULL); if (!desc) goto error_out; bh = sb_bread(sb, le32_to_cpu(desc->bg_inode_bitmap)); if (!bh) ext2_error(sb, "read_inode_bitmap", "Cannot read inode bitmap - " "block_group = %lu, inode_bitmap = %u", block_group, le32_to_cpu(desc->bg_inode_bitmap)); error_out: return bh; }
robutest/uclinux
C++
GPL-2.0
60
/* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France */
__isl_give isl_reordering* isl_reordering_alloc(isl_ctx *ctx, int len)
/* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France */ __isl_give isl_reordering* isl_reordering_alloc(isl_ctx *ctx, int len)
{ isl_reordering *exp; exp = isl_alloc(ctx, struct isl_reordering, sizeof(struct isl_reordering) + (len - 1) * sizeof(int)); if (!exp) return NULL; exp->ref = 1; exp->len = len; exp->dim = NULL; return exp; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* return kStatus_Success: success in setting the SNVS RTC alarm kStatus_InvalidArgument: Error because the alarm datetime format is incorrect kStatus_Fail: Error because the alarm time has already passed */
status_t SNVS_HP_RTC_SetAlarm(SNVS_Type *base, const snvs_hp_rtc_datetime_t *alarmTime)
/* return kStatus_Success: success in setting the SNVS RTC alarm kStatus_InvalidArgument: Error because the alarm datetime format is incorrect kStatus_Fail: Error because the alarm time has already passed */ status_t SNVS_HP_RTC_SetAlarm(SNVS_Type *base, const snvs_hp_rtc_datetime_t *alarmTime)
{ assert(alarmTime); uint32_t alarmSeconds = 0U; uint32_t currSeconds = 0U; uint32_t tmp = base->HPCR; if (!(SNVS_HP_CheckDatetimeFormat(alarmTime))) { return kStatus_InvalidArgument; } alarmSeconds = SNVS_HP_ConvertDatetimeToSeconds(alarmTime); currSeconds = SNVS_HP_RTC_GetSeconds(base); if (alarmSeconds < currSeconds) { return kStatus_Fail; } base->HPCR &= ~SNVS_HPCR_HPTA_EN_MASK; while (base->HPCR & SNVS_HPCR_HPTA_EN_MASK) { } base->HPTAMR = (uint32_t)(alarmSeconds >> 17U); base->HPTALR = (uint32_t)(alarmSeconds << 15U); base->HPCR = tmp; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wrap Write register component function to Bus IO function. */
static int32_t WriteMagRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
/* Wrap Write register component function to Bus IO function. */ static int32_t WriteMagRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
{ IIS2MDC_Object_t *pObj = (IIS2MDC_Object_t *)Handle; if (pObj->IO.BusType == IIS2MDC_I2C_BUS) { return pObj->IO.WriteReg(pObj->IO.Address, (Reg | 0x80U), pData, Length); } else { return pObj->IO.WriteReg(pObj->IO.Address, (Reg | 0x40U), pData, Length); } }
eclipse-threadx/getting-started
C++
Other
310
/* RETURNS: Pointer to removed devres on success, NULL if not found. */
void* devres_remove(struct device *dev, dr_release_t release, dr_match_t match, void *match_data)
/* RETURNS: Pointer to removed devres on success, NULL if not found. */ void* devres_remove(struct device *dev, dr_release_t release, dr_match_t match, void *match_data)
{ struct devres *dr; unsigned long flags; spin_lock_irqsave(&dev->devres_lock, flags); dr = find_dr(dev, release, match, match_data); if (dr) { list_del_init(&dr->node.entry); devres_log(dev, &dr->node, "REM"); } spin_unlock_irqrestore(&dev->devres_lock, flags); if (dr) return dr->data; return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* ixgbe_irq_disable - Mask off interrupt generation on the NIC @adapter: board private structure */
static void ixgbe_irq_disable(struct ixgbe_adapter *adapter)
/* ixgbe_irq_disable - Mask off interrupt generation on the NIC @adapter: board private structure */ static void ixgbe_irq_disable(struct ixgbe_adapter *adapter)
{ if (adapter->hw.mac.type == ixgbe_mac_82598EB) { IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0); } else { IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFF0000); IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(0), ~0); IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(1), ~0); } IXGBE_WRITE_FLUSH(&adapter->hw); if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { int i; for (i = 0; i < adapter->num_msix_vectors; i++) synchronize_irq(adapter->msix_entries[i].vector); } else { synchronize_irq(adapter->pdev->irq); } }
robutest/uclinux
C++
GPL-2.0
60
/* This initialises a KS8695's WAN phy to sensible values for autonegotiation etc. */
static void __devinit ks8695_init_wan_phy(struct ks8695_priv *ksp)
/* This initialises a KS8695's WAN phy to sensible values for autonegotiation etc. */ static void __devinit ks8695_init_wan_phy(struct ks8695_priv *ksp)
{ u32 ctrl; ctrl = (WMC_WANAP | WMC_WANA100F | WMC_WANA100H | WMC_WANA10F | WMC_WANA10H); ctrl |= (WLED0S_ACTIVITY | WLED1S_LINK); ctrl |= WMC_WANR; writel(ctrl, ksp->phyiface_regs + KS8695_WMC); writel(0, ksp->phyiface_regs + KS8695_WPPM); writel(0, ksp->phyiface_regs + KS8695_PPS); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable clock of given device. This disables (ungates) the clock for the given device. */
void ccm_clock_gate_disable(enum ccm_clock_gate gr)
/* Disable clock of given device. This disables (ungates) the clock for the given device. */ void ccm_clock_gate_disable(enum ccm_clock_gate gr)
{ uint32_t offset = (uint32_t)gr / 16; uint32_t gr_mask = 0x3 << ((gr % 16) * 2); CCM_CCGR(offset * 4) &= ~gr_mask; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Check whether the received OACK is valid. The OACK is valid only if: */
BOOLEAN Mtftp6WrqOackValid(IN MTFTP6_EXT_OPTION_INFO *ReplyInfo, IN MTFTP6_EXT_OPTION_INFO *RequestInfo)
/* Check whether the received OACK is valid. The OACK is valid only if: */ BOOLEAN Mtftp6WrqOackValid(IN MTFTP6_EXT_OPTION_INFO *ReplyInfo, IN MTFTP6_EXT_OPTION_INFO *RequestInfo)
{ if ((ReplyInfo->BitMap & ~RequestInfo->BitMap) != 0) { return FALSE; } if ((((ReplyInfo->BitMap & MTFTP6_OPT_BLKSIZE_BIT) != 0) && (ReplyInfo->BlkSize > RequestInfo->BlkSize)) || (((ReplyInfo->BitMap & MTFTP6_OPT_TIMEOUT_BIT) != 0) && (ReplyInfo->Timeout != RequestInfo->Timeout)) ) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* This function returns the local private key data which was currently set in the specified TLS object. */
EFI_STATUS EFIAPI CryptoServiceTlsGetHostPrivateKey(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
/* This function returns the local private key data which was currently set in the specified TLS object. */ EFI_STATUS EFIAPI CryptoServiceTlsGetHostPrivateKey(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
{ return CALL_BASECRYPTLIB (TlsGet.Services.HostPrivateKey, TlsGetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* si4713_checkrev - Checks if we are treating a device with the correct rev. @sdev: si4713_device structure for the device we are communicating */
static int si4713_checkrev(struct si4713_device *sdev)
/* si4713_checkrev - Checks if we are treating a device with the correct rev. @sdev: si4713_device structure for the device we are communicating */ static int si4713_checkrev(struct si4713_device *sdev)
{ struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); int rval; u8 resp[SI4713_GETREV_NRESP]; mutex_lock(&sdev->mutex); rval = si4713_send_command(sdev, SI4713_CMD_GET_REV, NULL, 0, resp, ARRAY_SIZE(resp), DEFAULT_TIMEOUT); if (rval < 0) goto unlock; if (resp[1] == SI4713_PRODUCT_NUMBER) { v4l2_info(&sdev->sd, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); } else { v4l2_err(&sdev->sd, "Invalid product number\n"); rval = -EINVAL; } unlock: mutex_unlock(&sdev->mutex); return rval; }
robutest/uclinux
C++
GPL-2.0
60
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */
EFI_STATUS EFIAPI EmmcBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */ EFI_STATUS EFIAPI EmmcBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
{ EFI_STATUS Status; EMMC_PEIM_HC_PRIVATE_DATA *Private; Status = EFI_SUCCESS; Private = GET_EMMC_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This); Status = EmmcBlockIoPeimReadBlocks ( PeiServices, &Private->BlkIoPpi, DeviceIndex, StartLBA, BufferSize, Buffer ); return Status; }
tianocore/edk2
C++
Other
4,240
/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. */
uint32_t MCAN_IsTransmitRequestPending(CAN_Type *base, uint8_t idx)
/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. */ uint32_t MCAN_IsTransmitRequestPending(CAN_Type *base, uint8_t idx)
{ return (base->TXBRP & ((uint32_t)1U << idx)) >> (uint32_t)idx; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes a 24-bit value to the descriptor buffer */
sl_status_t sl_usbd_core_write_24b_to_descriptor_buf(uint32_t val)
/* Writes a 24-bit value to the descriptor buffer */ sl_status_t sl_usbd_core_write_24b_to_descriptor_buf(uint32_t val)
{ sli_usbd_device_t *p_dev; sl_status_t status; p_dev = &usbd_ptr->device; status = *(p_dev->desc_buf_status_ptr); if (status == SL_STATUS_OK) { uint8_t buf[3u]; buf[0u] = (uint8_t)(val & 0xFFu); buf[1u] = (uint8_t)((val >> 8u) & 0xFFu); buf[2u] = (uint8_t)((val >> 16u) & 0xFFu); usbd_core_write_to_descriptor_buf(p_dev, &buf[0u], 3u); } return status; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Note: 'tipc_net_lock' is write_locked, bearer is locked. This routine must not grab the node lock until after link timer cancellation to avoid a potential deadlock situation. */
void tipc_link_delete(struct link *l_ptr)
/* Note: 'tipc_net_lock' is write_locked, bearer is locked. This routine must not grab the node lock until after link timer cancellation to avoid a potential deadlock situation. */ void tipc_link_delete(struct link *l_ptr)
{ if (!l_ptr) { err("Attempt to delete non-existent link\n"); return; } dbg("tipc_link_delete()\n"); k_cancel_timer(&l_ptr->timer); tipc_node_lock(l_ptr->owner); tipc_link_reset(l_ptr); tipc_node_detach_link(l_ptr->owner, l_ptr); tipc_link_stop(l_ptr); list_del_init(&l_ptr->link_list); if (LINK_LOG_BUF_SIZE) kfree(l_ptr->print_buf.buf); tipc_node_unlock(l_ptr->owner); k_term_timer(&l_ptr->timer); kfree(l_ptr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Make sure the bus isn't already busy. A busy bus is allowed if we are the one driving it. */
status_t I3C_CheckForBusyBus(I3C_Type *base)
/* Make sure the bus isn't already busy. A busy bus is allowed if we are the one driving it. */ status_t I3C_CheckForBusyBus(I3C_Type *base)
{ return (I3C_MasterGetBusIdleState(base) == true) ? kStatus_Success : kStatus_I3C_Busy; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handle 802.11 with a variable-length link-layer header and data padding. */
gboolean capture_ieee80211_datapad(const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
/* Handle 802.11 with a variable-length link-layer header and data padding. */ gboolean capture_ieee80211_datapad(const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{ return capture_ieee80211_common (pd, offset, len, cpinfo, pseudo_header, TRUE); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Most of this source has been derived from the Linux USB project. */
static char* usb_get_class_desc(unsigned char dclass)
/* Most of this source has been derived from the Linux USB project. */ static char* usb_get_class_desc(unsigned char dclass)
{ switch (dclass) { case USB_CLASS_PER_INTERFACE: return "See Interface"; case USB_CLASS_AUDIO: return "Audio"; case USB_CLASS_COMM: return "Communication"; case USB_CLASS_HID: return "Human Interface"; case USB_CLASS_PRINTER: return "Printer"; case USB_CLASS_MASS_STORAGE: return "Mass Storage"; case USB_CLASS_HUB: return "Hub"; case USB_CLASS_DATA: return "CDC Data"; case USB_CLASS_VENDOR_SPEC: return "Vendor specific"; default: return ""; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
/* Toggles the LED at a fixed time interval. */ void LedToggle(void)
{ static unsigned char led_toggle_state = 0; static unsigned long timer_counter_last = 0; unsigned long timer_counter_now; timer_counter_now = TimerGet(); if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) { return; } if (led_toggle_state == 0) { led_toggle_state = 1; PTP_PTP6 = 0; } else { led_toggle_state = 0; PTP_PTP6 = 1; } timer_counter_last = timer_counter_now; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Checks if RF Field is present in front of the ST25DV. */
int32_t BSP_NFCTAG_GetRFField_Dyn(uint32_t Instance, ST25DV_FIELD_STATUS *const pRF_Field)
/* Checks if RF Field is present in front of the ST25DV. */ int32_t BSP_NFCTAG_GetRFField_Dyn(uint32_t Instance, ST25DV_FIELD_STATUS *const pRF_Field)
{ UNUSED(Instance); return ST25DV_GetRFField_Dyn(&NfcTagObj, pRF_Field); }
eclipse-threadx/getting-started
C++
Other
310
/* Resumes a coroutine. Returns the number of results for non-error cases or -1 for errors. */
static int auxresume(lua_State *L, lua_State *co, int narg)
/* Resumes a coroutine. Returns the number of results for non-error cases or -1 for errors. */ static int auxresume(lua_State *L, lua_State *co, int narg)
{ lua_pushliteral(L, "too many arguments to resume"); return -1; } lua_xmove(L, co, narg); status = lua_resume(co, L, narg, &nres); if (l_likely(status == LUA_OK || status == LUA_YIELD)) { if (l_unlikely(!lua_checkstack(L, nres + 1))) { lua_pop(co, nres); lua_pushliteral(L, "too many results to resume"); return -1; } lua_xmove(co, L, nres); return nres; } else { lua_xmove(co, L, 1); return -1; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Print out a counted filename (or other ascii string). If ep is NULL, assume no truncation check is needed. Return true if truncated. Stop at ep (if given) or after n bytes, whichever is first. */
int fn_printn(netdissect_options *ndo, register const u_char *s, register u_int n, register const u_char *ep)
/* Print out a counted filename (or other ascii string). If ep is NULL, assume no truncation check is needed. Return true if truncated. Stop at ep (if given) or after n bytes, whichever is first. */ int fn_printn(netdissect_options *ndo, register const u_char *s, register u_int n, register const u_char *ep)
{ register u_char c; while (n > 0 && (ep == NULL || s < ep)) { n--; c = *s++; if (!ND_ISASCII(c)) { c = ND_TOASCII(c); ND_PRINT((ndo, "M-")); } if (!ND_ISPRINT(c)) { c ^= 0x40; ND_PRINT((ndo, "^")); } ND_PRINT((ndo, "%c", c)); } return (n == 0) ? 0 : 1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Many programs get TIFF colormaps wrong. They use 8-bit colormaps instead of 16-bit colormaps. This function is a heuristic to detect and correct this. */
void CheckAndCorrectColormap()
/* Many programs get TIFF colormaps wrong. They use 8-bit colormaps instead of 16-bit colormaps. This function is a heuristic to detect and correct this. */ void CheckAndCorrectColormap()
{ register int i; for (i = 0; i < colormapSize; i++) if ((redMap[i] > 255) || (greenMap[i] > 255) || (blueMap[i] > 255)) return; for (i = 0; i < colormapSize; i++) { redMap[i] = SCALE(redMap[i], 255); greenMap[i] = SCALE(greenMap[i], 255); blueMap[i] = SCALE(blueMap[i], 255); } TIFFWarning(fileName, "Assuming 8-bit colormap"); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Called when we need the filehandle for the root of the pseudofs, for a given NFSv4 client. The root is defined to be the export point with fsid==0 */
__be32 exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
/* Called when we need the filehandle for the root of the pseudofs, for a given NFSv4 client. The root is defined to be the export point with fsid==0 */ __be32 exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
{ struct svc_export *exp; __be32 rv; exp = find_fsidzero_export(rqstp); if (IS_ERR(exp)) return nfserrno(PTR_ERR(exp)); rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL); if (rv) goto out; rv = check_nfsd_access(exp, rqstp); if (rv) fh_put(fhp); out: exp_put(exp); return rv; }
robutest/uclinux
C++
GPL-2.0
60
/* kick off io on the underlying address space */
static void loop_unplug(struct request_queue *q)
/* kick off io on the underlying address space */ static void loop_unplug(struct request_queue *q)
{ struct loop_device *lo = q->queuedata; queue_flag_clear_unlocked(QUEUE_FLAG_PLUGGED, q); blk_run_address_space(lo->lo_backing_file->f_mapping); }
robutest/uclinux
C++
GPL-2.0
60
/* 6.5.4.3. LAN Redundancy Get Statistics (Confirmed Service Id = 3) 6.5.4.3.1. Request Message Parameters */
static void dissect_ff_msg_lr_get_statistics_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.5.4.3. LAN Redundancy Get Statistics (Confirmed Service Id = 3) 6.5.4.3.1. Request Message Parameters */ static void dissect_ff_msg_lr_get_statistics_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "LAN Redundancy Get Statistics Request"); if (!tree) { return; } if (length) { sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_lr_get_statistics_req, NULL, "LAN Redundancy Get Statistics Request"); proto_tree_add_item(sub_tree, hf_ff_unknown_data, tvb, offset, length, ENC_NA); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* In order for this to function properly, as it uses waitqueue_active() internally, some kind of memory barrier must be done prior to calling this. Typically, this will be smp_mb__after_clear_bit(), but in some cases where bitflags are manipulated non-atomically under a lock, one may need to use a less regular barrier, such fs/inode.c's smp_mb(), because spin_unlock() does not guarantee a memory barrier. */
void wake_up_bit(void *word, int bit)
/* In order for this to function properly, as it uses waitqueue_active() internally, some kind of memory barrier must be done prior to calling this. Typically, this will be smp_mb__after_clear_bit(), but in some cases where bitflags are manipulated non-atomically under a lock, one may need to use a less regular barrier, such fs/inode.c's smp_mb(), because spin_unlock() does not guarantee a memory barrier. */ void wake_up_bit(void *word, int bit)
{ __wake_up_bit(bit_waitqueue(word, bit), word, bit); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Intended to be called by the omap_device code. */
int omap_hwmod_enable_clocks(struct omap_hwmod *oh)
/* Intended to be called by the omap_device code. */ int omap_hwmod_enable_clocks(struct omap_hwmod *oh)
{ mutex_lock(&omap_hwmod_mutex); _enable_clocks(oh); mutex_unlock(&omap_hwmod_mutex); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Free an allocated URB. It is possible for it to be partially inited. */
VOID EhcFreeUrb(IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb)
/* Free an allocated URB. It is possible for it to be partially inited. */ VOID EhcFreeUrb(IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb)
{ if (Urb->RequestPhy != NULL) { IoMmuUnmap (Ehc->IoMmu, Urb->RequestMap); } if (Urb->DataMap != NULL) { IoMmuUnmap (Ehc->IoMmu, Urb->DataMap); } if (Urb->Qh != NULL) { EhcFreeQtds (Ehc, &Urb->Qh->Qtds); UsbHcFreeMem (Ehc, Ehc->MemPool, Urb->Qh, sizeof (PEI_EHC_QH)); } }
tianocore/edk2
C++
Other
4,240
/* SYSCTRL DMA Bus Clock Disable and Reset Assert. */
void LL_SYSCTRL_DMA_ClkDisRstAssert(void)
/* SYSCTRL DMA Bus Clock Disable and Reset Assert. */ void LL_SYSCTRL_DMA_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_DMABusClk_Dis(SYSCTRL); __LL_SYSCTRL_DMASoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Quiet time is the time after the first detected tap in which there must not be any overthreshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
int32_t lsm6dsl_tap_quiet_set(stmdev_ctx_t *ctx, uint8_t val)
/* Quiet time is the time after the first detected tap in which there must not be any overthreshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */ int32_t lsm6dsl_tap_quiet_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dsl_int_dur2_t int_dur2; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_INT_DUR2, (uint8_t*)&int_dur2, 1); if(ret == 0){ int_dur2.quiet = val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_INT_DUR2, (uint8_t*)&int_dur2, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* For simplicity, we use "brightness" as if it were a linear function of PWM duty cycle. However, a logarithmic function of duty cycle is probably a better match for perceived brightness: two is half as bright as four, four is half as bright as eight, etc */
static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
/* For simplicity, we use "brightness" as if it were a linear function of PWM duty cycle. However, a logarithmic function of duty cycle is probably a better match for perceived brightness: two is half as bright as four, four is half as bright as eight, etc */ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
{ struct pwmled *led; led = container_of(cdev, struct pwmled, cdev); pwm_channel_writel(&led->pwmc, PWM_CUPD, led->mult * (unsigned) b); }
robutest/uclinux
C++
GPL-2.0
60
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI S3MmioWrite8(IN UINTN Address, IN UINT8 Value)
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ UINT8 EFIAPI S3MmioWrite8(IN UINTN Address, IN UINT8 Value)
{ return InternalSaveMmioWrite8ValueToBootScript (Address, MmioWrite8 (Address, Value)); }
tianocore/edk2
C++
Other
4,240
/* Checks whether this rx descriptor is in chain mode. This returns true if it is this descriptor is in chain mode. */
bool synopGMAC_is_rx_desc_chained(DmaDesc *desc)
/* Checks whether this rx descriptor is in chain mode. This returns true if it is this descriptor is in chain mode. */ bool synopGMAC_is_rx_desc_chained(DmaDesc *desc)
{ return((desc->length & RxDescChain) == RxDescChain); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Erases a percentage trailer from the standard ouput by means of writing backspace characters. */
static void ErasePercentageTrailer(void)
/* Erases a percentage trailer from the standard ouput by means of writing backspace characters. */ static void ErasePercentageTrailer(void)
{ uint32_t backspaceCnt; uint32_t trailerLen; trailerLen = strlen("[100%]"); for (backspaceCnt = 0; backspaceCnt < trailerLen; backspaceCnt++) { (void)putchar('\b'); (void)putchar(' '); (void)putchar('\b'); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Initializes the specified ADC peripheral according to the specified parameters in the structure pstcAdcInit. */
int32_t ADC_Init(CM_ADC_TypeDef *ADCx, const stc_adc_init_t *pstcAdcInit)
/* Initializes the specified ADC peripheral according to the specified parameters in the structure pstcAdcInit. */ int32_t ADC_Init(CM_ADC_TypeDef *ADCx, const stc_adc_init_t *pstcAdcInit)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; DDL_ASSERT(IS_ADC_UNIT(ADCx)); if (pstcAdcInit != NULL) { DDL_ASSERT(IS_ADC_SCAN_MD(pstcAdcInit->u16ScanMode)); DDL_ASSERT(IS_ADC_RESOLUTION(pstcAdcInit->u16Resolution)); DDL_ASSERT(IS_ADC_DATAALIGN(pstcAdcInit->u16DataAlign)); WRITE_REG16(ADCx->CR0, pstcAdcInit->u16ScanMode | pstcAdcInit->u16Resolution | pstcAdcInit->u16DataAlign); i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Register the Service B.1 and all its Characteristics... */
void service_b_1_2_init(void)
/* Register the Service B.1 and all its Characteristics... */ void service_b_1_2_init(void)
{ bt_gatt_service_register(&service_b_1_2_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* when page break mode is enabled the screen will stop scrolling and wait for operator input before scrolling a subsequent screen. */
VOID EFIAPI ShellSetPageBreakMode(IN BOOLEAN CurrentState)
/* when page break mode is enabled the screen will stop scrolling and wait for operator input before scrolling a subsequent screen. */ VOID EFIAPI ShellSetPageBreakMode(IN BOOLEAN CurrentState)
{ if (CurrentState != 0x00) { if (gEfiShellProtocol != NULL) { gEfiShellProtocol->EnablePageBreak (); return; } else { if (mEfiShellEnvironment2 != NULL) { mEfiShellEnvironment2->EnablePageBreak (DEFAULT_INIT_ROW, DEFAULT_AUTO_LF); return; } } } else { if (gEfiShellProtocol != NULL) { gEfiShellProtocol->DisablePageBreak (); return; } else { if (mEfiShellEnvironment2 != NULL) { mEfiShellEnvironment2->DisablePageBreak (); return; } } } }
tianocore/edk2
C++
Other
4,240
/* Returns 0 if it gets a blob, -ENOMEM otherwise */
static int smack_inode_alloc_security(struct inode *inode)
/* Returns 0 if it gets a blob, -ENOMEM otherwise */ static int smack_inode_alloc_security(struct inode *inode)
{ inode->i_security = new_inode_smack(current_security()); if (inode->i_security == NULL) return -ENOMEM; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* a r e B o u n d s C o n s i s t e n t */
returnValue QProblemB_areBoundsConsistent(QProblemB *_THIS, const real_t *const lb_new, const real_t *const ub_new)
/* a r e B o u n d s C o n s i s t e n t */ returnValue QProblemB_areBoundsConsistent(QProblemB *_THIS, const real_t *const lb_new, const real_t *const ub_new)
{ int i; if (lb_new && ub_new) { for (i = 0; i < QProblemB_getNV(_THIS); ++i) { if (lb_new[i] > ub_new[i]+QPOASES_EPS) { return RET_QP_INFEASIBLE; } } } return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* clear the permit cache on a directory vnode */
void afs_clear_permits(struct afs_vnode *vnode)
/* clear the permit cache on a directory vnode */ void afs_clear_permits(struct afs_vnode *vnode)
{ struct afs_permits *permits; _enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode); mutex_lock(&vnode->permits_lock); permits = vnode->permits; rcu_assign_pointer(vnode->permits, NULL); mutex_unlock(&vnode->permits_lock); if (permits) call_rcu(&permits->rcu, afs_zap_permits); _leave(""); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 0 on success, -errno on invalid input strings. Error values: %-EINVAL: second number in range smaller than first %-EINVAL: invalid character in string %-ERANGE: bit number specified too large for mask */
int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits)
/* Returns 0 on success, -errno on invalid input strings. Error values: %-EINVAL: second number in range smaller than first %-EINVAL: invalid character in string %-ERANGE: bit number specified too large for mask */ int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits)
{ unsigned a, b; bitmap_zero(maskp, nmaskbits); do { if (!isdigit(*bp)) return -EINVAL; b = a = simple_strtoul(bp, (char **)&bp, BASEDEC); if (*bp == '-') { bp++; if (!isdigit(*bp)) return -EINVAL; b = simple_strtoul(bp, (char **)&bp, BASEDEC); } if (!(a <= b)) return -EINVAL; if (b >= nmaskbits) return -ERANGE; while (a <= b) { set_bit(a, maskp); a++; } if (*bp == ',') bp++; } while (*bp != '\0' && *bp != '\n'); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal function. Inserts a new descriptor into a sorted list */
EFI_STATUS CoreInsertGcdMapEntry(IN LIST_ENTRY *Link, IN EFI_GCD_MAP_ENTRY *Entry, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_GCD_MAP_ENTRY *TopEntry, IN EFI_GCD_MAP_ENTRY *BottomEntry)
/* Internal function. Inserts a new descriptor into a sorted list */ EFI_STATUS CoreInsertGcdMapEntry(IN LIST_ENTRY *Link, IN EFI_GCD_MAP_ENTRY *Entry, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_GCD_MAP_ENTRY *TopEntry, IN EFI_GCD_MAP_ENTRY *BottomEntry)
{ ASSERT (Length != 0); if (BaseAddress > Entry->BaseAddress) { ASSERT (BottomEntry->Signature == 0); CopyMem (BottomEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY)); Entry->BaseAddress = BaseAddress; BottomEntry->EndAddress = BaseAddress - 1; InsertTailList (Link, &BottomEntry->Link); } if ((BaseAddress + Length - 1) < Entry->EndAddress) { ASSERT (TopEntry->Signature == 0); CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY)); TopEntry->BaseAddress = BaseAddress + Length; Entry->EndAddress = BaseAddress + Length - 1; InsertHeadList (Link, &TopEntry->Link); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* ibmvfc_get_prli_rsp - Find PRLI response index @flags: PRLI response flags */
static int ibmvfc_get_prli_rsp(u16 flags)
/* ibmvfc_get_prli_rsp - Find PRLI response index @flags: PRLI response flags */ static int ibmvfc_get_prli_rsp(u16 flags)
{ int i; int code = (flags & 0x0f00) >> 8; for (i = 0; i < ARRAY_SIZE(prli_rsp); i++) if (prli_rsp[i].code == code) return i; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* snapshot_additional_pages - estimate the number of additional pages be needed for setting up the suspend image data structures for given zone (usually the returned value is greater than the exact number) */
unsigned int snapshot_additional_pages(struct zone *zone)
/* snapshot_additional_pages - estimate the number of additional pages be needed for setting up the suspend image data structures for given zone (usually the returned value is greater than the exact number) */ unsigned int snapshot_additional_pages(struct zone *zone)
{ unsigned int res; res = DIV_ROUND_UP(zone->spanned_pages, BM_BITS_PER_BLOCK); res += DIV_ROUND_UP(res * sizeof(struct bm_block), PAGE_SIZE); return 2 * res; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Parse a certain dhcp4 option by OptTag in Buffer, and return with start pointer. */
EFI_DHCP4_PACKET_OPTION* HttpBootParseDhcp4Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
/* Parse a certain dhcp4 option by OptTag in Buffer, and return with start pointer. */ EFI_DHCP4_PACKET_OPTION* HttpBootParseDhcp4Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
{ EFI_DHCP4_PACKET_OPTION *Option; UINT32 Offset; Option = (EFI_DHCP4_PACKET_OPTION *)Buffer; Offset = 0; while (Offset < Length && Option->OpCode != DHCP4_TAG_EOP) { if (Option->OpCode == OptTag) { return Option; } if (Option->OpCode == DHCP4_TAG_PAD) { Offset++; } else { Offset += Option->Length + 2; } Option = (EFI_DHCP4_PACKET_OPTION *)(Buffer + Offset); } return NULL; }
tianocore/edk2
C++
Other
4,240
/* The purpose of this API is to get the default ENET configure structure for ENET_QOS_Init(). User may use the initialized structure unchanged in ENET_QOS_Init(), or modify some fields of the structure before calling ENET_QOS_Init(). Example: code enet_qos_config_t config; ENET_QOS_GetDefaultConfig(&config); endcode param config The ENET mac controller configuration structure pointer. */
void ENET_QOS_GetDefaultConfig(enet_qos_config_t *config)
/* The purpose of this API is to get the default ENET configure structure for ENET_QOS_Init(). User may use the initialized structure unchanged in ENET_QOS_Init(), or modify some fields of the structure before calling ENET_QOS_Init(). Example: code enet_qos_config_t config; ENET_QOS_GetDefaultConfig(&config); endcode param config The ENET mac controller configuration structure pointer. */ void ENET_QOS_GetDefaultConfig(enet_qos_config_t *config)
{ assert(config != NULL); (void)memset(config, 0, sizeof(*config)); config->miiMode = kENET_QOS_RgmiiMode; config->miiSpeed = kENET_QOS_MiiSpeed1000M; config->miiDuplex = kENET_QOS_MiiFullDuplex; config->specialControl = 0; config->multiqueueCfg = NULL; config->pauseDuration = 0; config->ptpConfig = NULL; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Resets or collects the statistics on a network interface. */
EFI_STATUS EFIAPI EmuSnpStatistics(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
/* Resets or collects the statistics on a network interface. */ EFI_STATUS EFIAPI EmuSnpStatistics(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
{ EFI_STATUS Status; EMU_SNP_PRIVATE_DATA *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This); Status = Private->Io->Statistics (Private->Io, Reset, StatisticsSize, StatisticsTable); return Status; }
tianocore/edk2
C++
Other
4,240
/* Variable EC point multiplication. EcPointResult = EcPoint * BnPScalar. */
BOOLEAN EFIAPI CryptoServiceEcPointMul(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPoint, IN CONST VOID *BnPScalar, IN VOID *BnCtx)
/* Variable EC point multiplication. EcPointResult = EcPoint * BnPScalar. */ BOOLEAN EFIAPI CryptoServiceEcPointMul(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPoint, IN CONST VOID *BnPScalar, IN VOID *BnCtx)
{ return CALL_BASECRYPTLIB (Ec.Services.PointMul, EcPointMul, (EcGroup, EcPointResult, EcPoint, BnPScalar, BnCtx), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0. */
unsigned char PIO_Get(const Pin *pin)
/* Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0. */ unsigned char PIO_Get(const Pin *pin)
{ unsigned int reg; if ((pin->type == PIO_OUTPUT_0) || (pin->type == PIO_OUTPUT_1)) { reg = READ(pin->pio, PIO_ODSR); } else { reg = READ(pin->pio, PIO_PDSR); } if ((reg & pin->mask) == 0) { return 0; } else { return 1; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base TSI peripheral base address. param mask The status flags to clear. */
void TSI_ClearStatusFlags(TSI_Type *base, uint32_t mask)
/* param base TSI peripheral base address. param mask The status flags to clear. */ void TSI_ClearStatusFlags(TSI_Type *base, uint32_t mask)
{ uint32_t regValue = base->DATA & (~ALL_FLAGS_MASK); if ((bool)(mask & (uint32_t)kTSI_EndOfScanFlag)) { regValue |= TSI_DATA_EOSF_MASK; } if ((bool)(mask & (uint32_t)kTSI_OutOfRangeFlag)) { regValue |= TSI_DATA_OUTRGF_MASK; } base->DATA = regValue; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base LPSPI peripheral address. param dummyData Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated. */
void LPSPI_SetDummyData(LPSPI_Type *base, uint8_t dummyData)
/* param base LPSPI peripheral address. param dummyData Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated. */ void LPSPI_SetDummyData(LPSPI_Type *base, uint8_t dummyData)
{ uint32_t instance = LPSPI_GetInstance(base); g_lpspiDummyData[instance] = dummyData; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TLV-ID SSID 00 00 length 06 00 ssid 4d 4e 54 45 53 54 */
static int lbs_scan_add_ssid_tlv(struct lbs_private *priv, u8 *tlv)
/* TLV-ID SSID 00 00 length 06 00 ssid 4d 4e 54 45 53 54 */ static int lbs_scan_add_ssid_tlv(struct lbs_private *priv, u8 *tlv)
{ struct mrvl_ie_ssid_param_set *ssid_tlv = (void *)tlv; ssid_tlv->header.type = cpu_to_le16(TLV_TYPE_SSID); ssid_tlv->header.len = cpu_to_le16(priv->scan_ssid_len); memcpy(ssid_tlv->ssid, priv->scan_ssid, priv->scan_ssid_len); return sizeof(ssid_tlv->header) + priv->scan_ssid_len; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculates the CRC-16 of an array of words. */
uint16_t Crc16Array(uint32_t ui32WordLen, const uint32_t *pui32Data)
/* Calculates the CRC-16 of an array of words. */ uint16_t Crc16Array(uint32_t ui32WordLen, const uint32_t *pui32Data)
{ return(Crc16(0, (const uint8_t *)pui32Data, ui32WordLen * 4)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Ticks elapsed since last sys_clock_announce() call. Queries the clock driver for the current time elapsed since the last call to sys_clock_announce() was made. The kernel will call this with appropriate locking, the driver needs only provide an instantaneous answer. */
uint32_t sys_clock_elapsed(void)
/* Ticks elapsed since last sys_clock_announce() call. Queries the clock driver for the current time elapsed since the last call to sys_clock_announce() was made. The kernel will call this with appropriate locking, the driver needs only provide an instantaneous answer. */ uint32_t sys_clock_elapsed(void)
{ return (hwm_get_time() - last_tick_time)/tick_period; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! */
u16_t pbuf_strstr(struct pbuf *p, const char *substr)
/* Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! */ u16_t pbuf_strstr(struct pbuf *p, const char *substr)
{ size_t substr_len; if ((substr == NULL) || (substr[0] == 0) || (p->tot_len == 0xFFFF)) { return 0xFFFF; } substr_len = os_strlen(substr); if (substr_len >= 0xFFFF) { return 0xFFFF; } return pbuf_memfind(p, substr, (u16_t)substr_len, 0); }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Gets the width in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetWidth(void)
/* Gets the width in pixels of the LCD screen (varies depending on the current screen orientation) */ uint16_t lcdGetWidth(void)
{ return hx8347gProperties.width; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Set the boot bank to the alternate bank */
void cpld_set_altbank(void)
/* Set the boot bank to the alternate bank */ void cpld_set_altbank(void)
{ u8 reg = CPLD_READ(flash_csr); reg = (reg & ~CPLD_BANK_SEL_MASK) | CPLD_LBMAP_ALTBANK; CPLD_WRITE(flash_csr, reg); CPLD_WRITE(reset_ctl1, CPLD_LBMAP_RESET); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get stack attributes in thread attributes object. See IEEE 1003.1 */
int pthread_attr_getstack(const pthread_attr_t *_attr, void **stackaddr, size_t *stacksize)
/* Get stack attributes in thread attributes object. See IEEE 1003.1 */ int pthread_attr_getstack(const pthread_attr_t *_attr, void **stackaddr, size_t *stacksize)
{ const struct posix_thread_attr *attr = (const struct posix_thread_attr *)_attr; if (!__attr_is_initialized(attr) || (stackaddr == NULL) || (stacksize == NULL)) { return EINVAL; } *stackaddr = attr->stack; *stacksize = __get_attr_stacksize(attr); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Return value 0 on success, non-zero error code on failure */
static void pmcraid_release_passthrough_ioadls(struct pmcraid_cmd *cmd, int buflen, int direction)
/* Return value 0 on success, non-zero error code on failure */ static void pmcraid_release_passthrough_ioadls(struct pmcraid_cmd *cmd, int buflen, int direction)
{ struct pmcraid_sglist *sglist = cmd->sglist; if (buflen > 0) { pci_unmap_sg(cmd->drv_inst->pdev, sglist->scatterlist, sglist->num_sg, direction); pmcraid_free_sglist(sglist); cmd->sglist = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* Check whether ObjectNode has the input OpCode/SubOpcode couple. */
BOOLEAN EFIAPI AmlNodeHasOpCode(IN AML_OBJECT_NODE_HANDLE ObjectNode, IN UINT8 OpCode, IN UINT8 SubOpCode)
/* Check whether ObjectNode has the input OpCode/SubOpcode couple. */ BOOLEAN EFIAPI AmlNodeHasOpCode(IN AML_OBJECT_NODE_HANDLE ObjectNode, IN UINT8 OpCode, IN UINT8 SubOpCode)
{ EFI_STATUS Status; UINT8 NodeOpCode; UINT8 NodeSubOpCode; Status = AmlGetObjectNodeInfo ( ObjectNode, &NodeOpCode, &NodeSubOpCode, NULL, NULL ); if (EFI_ERROR (Status)) { ASSERT (0); return FALSE; } if ((OpCode != NodeOpCode) || (SubOpCode != NodeSubOpCode)) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Check at least one bit of a given protect bitfield is set */
bool lv_obj_is_protected(const lv_obj_t *obj, uint8_t prot)
/* Check at least one bit of a given protect bitfield is set */ bool lv_obj_is_protected(const lv_obj_t *obj, uint8_t prot)
{ return (obj->protect & prot) == 0 ? false : true; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Write the fir coefficients in the PDMs' RAM. */
static void dai_dmic_write_coeff(const struct dai_intel_dmic *dmic, uint32_t base, const uint32_t *coeff, int length, const bool packed)
/* Write the fir coefficients in the PDMs' RAM. */ static void dai_dmic_write_coeff(const struct dai_intel_dmic *dmic, uint32_t base, const uint32_t *coeff, int length, const bool packed)
{ const uint8_t *coeff_in_bytes; uint32_t coeff_val; if (!packed) { while (length--) { dai_dmic_write(dmic, base, *coeff++); base += sizeof(uint32_t); } } else { coeff_in_bytes = (const uint8_t *)coeff; while (length--) { coeff_val = coeff_in_bytes[0] + (coeff_in_bytes[1] << 8) + (coeff_in_bytes[2] << 16); dai_dmic_write(dmic, base, coeff_val); base += sizeof(uint32_t); coeff_in_bytes += 3; } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources. */
EFI_STATUS Ip4Config2DestroyDhcp4(IN OUT IP4_CONFIG2_INSTANCE *Instance)
/* Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources. */ EFI_STATUS Ip4Config2DestroyDhcp4(IN OUT IP4_CONFIG2_INSTANCE *Instance)
{ IP4_SERVICE *IpSb; EFI_STATUS Status; EFI_DHCP4_PROTOCOL *Dhcp4; Dhcp4 = Instance->Dhcp4; ASSERT (Dhcp4 != NULL); Dhcp4->Stop (Dhcp4); Dhcp4->Configure (Dhcp4, NULL); Instance->Dhcp4 = NULL; IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance); Status = gBS->CloseProtocol ( Instance->Dhcp4Handle, &gEfiDhcp4ProtocolGuid, IpSb->Image, IpSb->Controller ); if (EFI_ERROR (Status)) { return Status; } Status = NetLibDestroyServiceChild ( IpSb->Controller, IpSb->Image, &gEfiDhcp4ServiceBindingProtocolGuid, Instance->Dhcp4Handle ); Instance->Dhcp4Handle = NULL; return Status; }
tianocore/edk2
C++
Other
4,240
/* Release the memory region(s) being used by 'port'. */
static void atmel_release_port(struct uart_port *port)
/* Release the memory region(s) being used by 'port'. */ static void atmel_release_port(struct uart_port *port)
{ struct platform_device *pdev = to_platform_device(port->dev); int size = pdev->resource[0].end - pdev->resource[0].start + 1; release_mem_region(port->mapbase, size); if (port->flags & UPF_IOREMAP) { iounmap(port->membase); port->membase = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* pm8001_tag_alloc - allocate a empty tag for task used. @pm8001_ha: our hba struct @tag_out: the found empty tag . */
int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out)
/* pm8001_tag_alloc - allocate a empty tag for task used. @pm8001_ha: our hba struct @tag_out: the found empty tag . */ int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out)
{ unsigned int index, tag; void *bitmap = pm8001_ha->tags; index = find_first_zero_bit(bitmap, pm8001_ha->tags_num); tag = index; if (tag >= pm8001_ha->tags_num) return -SAS_QUEUE_FULL; pm8001_tag_set(pm8001_ha, tag); *tag_out = tag; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve the amount of cycles to delay for the given amount of ms. */
static uint32_t _get_cycles_for_ms_internal(const uint16_t ms, const uint32_t freq, const uint8_t power)
/* Retrieve the amount of cycles to delay for the given amount of ms. */ static uint32_t _get_cycles_for_ms_internal(const uint16_t ms, const uint32_t freq, const uint8_t power)
{ switch (power) { case 9: return (ms * (freq / 1000000) * 1000); case 8: return (ms * (freq / 100000) * 100); case 7: return (ms * (freq / 10000) * 10); case 6: return (ms * (freq / 1000)); case 5: return (ms * (freq / 100) + 9) / 10; default: return (ms * (freq / 1) + 999) / 1000; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* sunxi_lcd_dsi_dcs_write_1para - write command and para to mipi panel. @screen_id: The index of screen. @command: Command to be transfer. @paran: Para to be transfer. */
s32 sunxi_lcd_dsi_dcs_write_1para(u32 screen_id, u8 command, u8 para1)
/* sunxi_lcd_dsi_dcs_write_1para - write command and para to mipi panel. @screen_id: The index of screen. @command: Command to be transfer. @paran: Para to be transfer. */ s32 sunxi_lcd_dsi_dcs_write_1para(u32 screen_id, u8 command, u8 para1)
{ u8 tmp[5]; tmp[0] = para1; sunxi_lcd_dsi_dcs_write(screen_id, command, tmp, 1); return -1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine runs when the memory allocator sees that the total memory allocation is about to exceed the soft heap limit. */
static void softHeapLimitEnforcer(void *NotUsed, sqlite3_int64 NotUsed2, int allocSize)
/* This routine runs when the memory allocator sees that the total memory allocation is about to exceed the soft heap limit. */ static void softHeapLimitEnforcer(void *NotUsed, sqlite3_int64 NotUsed2, int allocSize)
{ UNUSED_PARAMETER2(NotUsed, NotUsed2); sqlite3_release_memory(allocSize); }
DC-SWAT/DreamShell
C++
null
404
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static int dio24_cs_attach(struct pcmcia_device *)
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ static int dio24_cs_attach(struct pcmcia_device *)
{ struct local_info_t *local; printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); dev_dbg(&link->dev, "dio24_cs_attach()\n"); local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); if (!local) return -ENOMEM; local->link = link; link->priv = local; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; link->irq.Handler = NULL; link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; pcmcia_cur_dev = link; dio24_config(link); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Called by the poll handlers this function reads the status from the controller and checks for errors. */
static void amd76x_check(struct mem_ctl_info *mci)
/* Called by the poll handlers this function reads the status from the controller and checks for errors. */ static void amd76x_check(struct mem_ctl_info *mci)
{ row = (info->ecc_mode_status >> 4) & 0xf; edac_mc_handle_ue(mci, mci->csrows[row].first_page, 0, row, mci->ctl_name); } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: a string containing the password within @op. */
const char* g_mount_operation_get_password(GMountOperation *op)
/* Returns: a string containing the password within @op. */ const char* g_mount_operation_get_password(GMountOperation *op)
{ g_return_val_if_fail (G_IS_MOUNT_OPERATION (op), NULL); return op->priv->password; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The entry point for IP4 driver which install the driver binding and component name protocol on its image. */
EFI_STATUS EFIAPI Ip4DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The entry point for IP4 driver which install the driver binding and component name protocol on its image. */ EFI_STATUS EFIAPI Ip4DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ VOID *Registration; EfiCreateProtocolNotifyEvent ( &gEfiIpSec2ProtocolGuid, TPL_CALLBACK, IpSec2InstalledCallback, NULL, &Registration ); return EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gIp4DriverBinding, ImageHandle, &gIp4ComponentName, &gIp4ComponentName2 ); }
tianocore/edk2
C++
Other
4,240
/* Like GPIO0 to 10, GPIO11-27 IRQs need to be handled specially. In addition, the IRQs are all collected up into one bit in the interrupt controller registers. */
static void sa1100_high_gpio_ack(unsigned int irq)
/* Like GPIO0 to 10, GPIO11-27 IRQs need to be handled specially. In addition, the IRQs are all collected up into one bit in the interrupt controller registers. */ static void sa1100_high_gpio_ack(unsigned int irq)
{ unsigned int mask = GPIO11_27_MASK(irq); GEDR = mask; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ZigBee Device Profile dissector for the backup source binding */
void dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the backup source binding */ void dissect_zbee_zdp_rsp_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint8 status; status = zdp_parse_status(tree, tvb, &offset); zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* \method names() Returns the cpu and board names for this pin. */
STATIC mp_obj_t pin_names(mp_obj_t self_in)
/* \method names() Returns the cpu and board names for this pin. */ STATIC mp_obj_t pin_names(mp_obj_t self_in)
{ if (elem->value == self) { mp_obj_list_append(result, elem->key); } } return result; }
labapart/polymcu
C++
null
201
/* Create a new entry with 'fn' file name. */
static ramfs_entry_t* ramfs_entry_new(const char *fn)
/* Create a new entry with 'fn' file name. */ static ramfs_entry_t* ramfs_entry_new(const char *fn)
{ ramfs_entry_t *new_entry = NULL; size_t fn_len; int ret = -1; ret = ramfs_entry_dir_new(fn); if (ret != RAMFS_OK) { return NULL; } new_entry = ramfs_ll_ins_head(&g_file_ll); if (new_entry == NULL) { return NULL; } fn_len = strlen(fn); new_entry->fn = ramfs_mm_alloc(fn_len + 1); strncpy(new_entry->fn, fn, fn_len); new_entry->fn[fn_len] = '\0'; new_entry->data = NULL; new_entry->size = 0; new_entry->refs = 0; new_entry->const_data = 0; new_entry->is_dir = 0; new_entry->link = NULL; new_entry->link_count = 0; return new_entry; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Read device ID to idenfity the device ILI9325 device ID locates in Device Code Read (R00h) register. ILI9341 device ID locates in Read ID4 (RD3h) register. */
uint8_t ili93xx_device_type_identify(void)
/* Read device ID to idenfity the device ILI9325 device ID locates in Device Code Read (R00h) register. ILI9341 device ID locates in Read ID4 (RD3h) register. */ uint8_t ili93xx_device_type_identify(void)
{ uint8_t paratable[6]; uint16_t chipid; ili93xx_read_register(ILI9341_CMD_READ_ID4, paratable, 4); chipid = ((uint16_t)paratable[2] << 8) + paratable[3]; if (chipid == ILI9341_DEVICE_CODE) { g_uc_device_type = DEVICE_TYPE_ILI9341; return 0; } ili93xx_read_register(ILI9325_DEVICE_CODE_REG, paratable, 2); chipid = ((uint16_t)paratable[0] << 8) + paratable[1]; if (chipid == ILI9325_DEVICE_CODE) { g_uc_device_type = DEVICE_TYPE_ILI9325; return 0; } return 1; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Removes the specified SAS remote PHY and frees it. */
void sas_rphy_delete(struct sas_rphy *rphy)
/* Removes the specified SAS remote PHY and frees it. */ void sas_rphy_delete(struct sas_rphy *rphy)
{ sas_rphy_remove(rphy); sas_rphy_free(rphy); }
robutest/uclinux
C++
GPL-2.0
60
/* Either the GPU or display (or both) went idle. Check the busy status here and adjust the CRTC and GPU clocks as necessary. */
static void intel_idle_update(struct work_struct *work)
/* Either the GPU or display (or both) went idle. Check the busy status here and adjust the CRTC and GPU clocks as necessary. */ static void intel_idle_update(struct work_struct *work)
{ drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t, idle_work); struct drm_device *dev = dev_priv->dev; struct drm_crtc *crtc; struct intel_crtc *intel_crtc; if (!i915_powersave) return; mutex_lock(&dev->struct_mutex); list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { if (!crtc->fb) continue; intel_crtc = to_intel_crtc(crtc); if (!intel_crtc->busy) intel_decrease_pllclock(crtc); } mutex_unlock(&dev->struct_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
int main(void)
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */ int main(void)
{ Init(); while (1) { LedToggle(); } return 0; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Attempting to write to the region where the EC is currently running from will result in an error. */
static int cros_ec_flash_write_block(struct udevice *dev, const uint8_t *data, uint32_t offset, uint32_t size)
/* Attempting to write to the region where the EC is currently running from will result in an error. */ static int cros_ec_flash_write_block(struct udevice *dev, const uint8_t *data, uint32_t offset, uint32_t size)
{ struct ec_params_flash_write *p; int ret; p = malloc(sizeof(*p) + size); if (!p) return -ENOMEM; p->offset = offset; p->size = size; assert(data && p->size <= EC_FLASH_WRITE_VER0_SIZE); memcpy(p + 1, data, p->size); ret = ec_command_inptr(dev, EC_CMD_FLASH_WRITE, 0, p, sizeof(*p) + size, NULL, 0) >= 0 ? 0 : -1; free(p); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Register the security handler to provide TPM measure boot service. */
EFI_STATUS EFIAPI DxeTpm2MeasureBootLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Register the security handler to provide TPM measure boot service. */ EFI_STATUS EFIAPI DxeTpm2MeasureBootLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_HOB_GUID_TYPE *GuidHob; GuidHob = NULL; GuidHob = GetFirstGuidHob (&gMeasuredFvHobGuid); if (GuidHob != NULL) { mTcg2MeasuredHobData = GET_GUID_HOB_DATA (GuidHob); } return RegisterSecurity2Handler ( DxeTpm2MeasureBootHandler, EFI_AUTH_OPERATION_MEASURE_IMAGE | EFI_AUTH_OPERATION_IMAGE_REQUIRED ); }
tianocore/edk2
C++
Other
4,240
/* Get the min, max, and current TX power. */
int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, s16 *maxlevel)
/* Get the min, max, and current TX power. */ int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, s16 *maxlevel)
{ struct cmd_ds_802_11_rf_tx_power cmd; int ret; lbs_deb_enter(LBS_DEB_CMD); memset(&cmd, 0, sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.action = cpu_to_le16(CMD_ACT_GET); ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); if (ret == 0) { *curlevel = le16_to_cpu(cmd.curlevel); if (minlevel) *minlevel = cmd.minlevel; if (maxlevel) *maxlevel = cmd.maxlevel; } lbs_deb_leave(LBS_DEB_CMD); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Provides the UFS controller-specific addresses needed to access system memory. */
EFI_STATUS EFIAPI UfsHcMap(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
/* Provides the UFS controller-specific addresses needed to access system memory. */ EFI_STATUS EFIAPI UfsHcMap(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
{ UFS_HOST_CONTROLLER_PRIVATE_DATA *Private; EFI_PCI_IO_PROTOCOL *PciIo; EFI_STATUS Status; if ((This == NULL) || (HostAddress == NULL) || (NumberOfBytes == NULL) || (DeviceAddress == NULL) || (Mapping == NULL)) { return EFI_INVALID_PARAMETER; } Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This); PciIo = Private->PciIo; Status = PciIo->Map (PciIo, (EFI_PCI_IO_PROTOCOL_OPERATION)Operation, HostAddress, NumberOfBytes, DeviceAddress, Mapping); return Status; }
tianocore/edk2
C++
Other
4,240
/* Enable Transmit complete interrupt @rmtoll IER TCIE LL_SWPMI_EnableIT_TC. */
void LL_SWPMI_EnableIT_TC(SWPMI_TypeDef *SWPMIx)
/* Enable Transmit complete interrupt @rmtoll IER TCIE LL_SWPMI_EnableIT_TC. */ void LL_SWPMI_EnableIT_TC(SWPMI_TypeDef *SWPMIx)
{ SET_BIT(SWPMIx->IER, SWPMI_IER_TCIE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* RCU torture fake writer kthread. Repeatedly calls sync, with a random delay between calls. */
static int rcu_torture_fakewriter(void *arg)
/* RCU torture fake writer kthread. Repeatedly calls sync, with a random delay between calls. */ static int rcu_torture_fakewriter(void *arg)
{ DEFINE_RCU_RANDOM(rand); VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task started"); set_user_nice(current, 19); do { schedule_timeout_uninterruptible(1 + rcu_random(&rand)%10); udelay(rcu_random(&rand) & 0x3ff); cur_ops->sync(); rcu_stutter_wait("rcu_torture_fakewriter"); } while (!kthread_should_stop() && fullstop == FULLSTOP_DONTSTOP); VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task stopping"); rcutorture_shutdown_absorb("rcu_torture_fakewriter"); while (!kthread_should_stop()) schedule_timeout_uninterruptible(1); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266