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
/* Get the Rising Latched PWM counter of the PWM module. The */
unsigned long PWMCAPRisingCounterGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the Rising Latched PWM counter of the PWM module. The */ unsigned long PWMCAPRisingCounterGet(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); return xHWREG(ulBase + PWM_CRLR0 + ulChannelTemp * 8); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Converts a text device path node to Hardware Vendor device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmuThunk(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to Hardware Vendor device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmuThunk(IN CHAR16 *TextDeviceNode)
{ CHAR16 *Str; VENDOR_DEVICE_PATH *Vendor; Str = GetNextParamStr (&TextDeviceNode); Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode ( HARDWARE_DEVICE_PATH, HW_VENDOR_DP, (UINT16)sizeof (VENDOR_DEVICE_PATH) ); CopyGuid (&Vendor->Guid, &gEmuThunkProtocolGuid); return (EFI_DEVICE_PATH_PROTOCOL *)Vendor; }
tianocore/edk2
C++
Other
4,240
/* Throw away all pending data on the socket. */
void ip_flush_pending_frames(struct sock *sk)
/* Throw away all pending data on the socket. */ void ip_flush_pending_frames(struct sock *sk)
{ struct sk_buff *skb; while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) kfree_skb(skb); ip_cork_release(inet_sk(sk)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handler to get access to the driver specific slave data structure */
static struct m2s_spi_slave* to_m2s_spi(struct spi_slave *slave)
/* Handler to get access to the driver specific slave data structure */ static struct m2s_spi_slave* to_m2s_spi(struct spi_slave *slave)
{ return container_of(slave, struct m2s_spi_slave, slave); }
EmcraftSystems/u-boot
C++
Other
181
/* SPI MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
/* SPI MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ SPIx_FORCE_RESET(); SPIx_RELEASE_RESET(); HAL_GPIO_DeInit(SPIx_SCK_GPIO_PORT, SPIx_SCK_PIN); HAL_GPIO_DeInit(SPIx_MISO_GPIO_PORT, SPIx_MISO_PIN); HAL_GPIO_DeInit(SPIx_MOSI_GPIO_PORT, SPIx_MOSI_PIN); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* CPL (Chelsio Protocol Language) defines a message passing interface between the host driver and T3 asic. The section below implments CPLs that related to iscsi tcp connection open/close/abort and data send/receive. CPL connection active open request: host -> */
static unsigned int find_best_mtu(const struct t3c_data *d, unsigned short mtu)
/* CPL (Chelsio Protocol Language) defines a message passing interface between the host driver and T3 asic. The section below implments CPLs that related to iscsi tcp connection open/close/abort and data send/receive. CPL connection active open request: host -> */ static unsigned int find_best_mtu(const struct t3c_data *d, unsigned short mtu)
{ int i = 0; while (i < d->nmtus - 1 && d->mtus[i + 1] <= mtu) ++i; return i; }
robutest/uclinux
C++
GPL-2.0
60
/* Get and set a new active queue for service. */
static struct cfq_queue* cfq_set_active_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
/* Get and set a new active queue for service. */ static struct cfq_queue* cfq_set_active_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
{ if (!cfqq) cfqq = cfq_get_next_queue(cfqd); __cfq_set_active_queue(cfqd, cfqq); return cfqq; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* NULL is returned if there is no free memory. */
struct sk_buff* __netdev_alloc_skb(struct net_device *dev, unsigned int length, gfp_t gfp_mask)
/* NULL is returned if there is no free memory. */ struct sk_buff* __netdev_alloc_skb(struct net_device *dev, unsigned int length, gfp_t gfp_mask)
{ int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; struct sk_buff *skb; skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); if (likely(skb)) { skb_reserve(skb, NET_SKB_PAD); skb->dev = dev; } return skb; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
{ VOID *Buffer; Buffer = InternalAllocatePool (EfiRuntimeServicesData, AllocationSize); if (Buffer != NULL) { MemoryProfileLibRecord ( (PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0), MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL, EfiRuntimeServicesData, Buffer, AllocationSize, NULL ); } return Buffer; }
tianocore/edk2
C++
Other
4,240
/* First we have a helper routine which tells is if from this file descriptor (ie. the /dev/net/tun device) will block: */
static bool will_block(int fd)
/* First we have a helper routine which tells is if from this file descriptor (ie. the /dev/net/tun device) will block: */ static bool will_block(int fd)
{ fd_set fdset; struct timeval zero = { 0, 0 }; FD_ZERO(&fdset); FD_SET(fd, &fdset); return select(fd+1, &fdset, NULL, NULL, &zero) != 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* According to UEFI Spec 2.10 Section 38.4.1: The following table shows the TPM PCR index mapping and CC event log measurement register index interpretation for Intel TDX, where MRTD means Trust Domain Measurement Register and RTMR means Runtime Measurement Register */
UINT32 EFIAPI MapPcrToMrIndex(IN UINT32 PCRIndex)
/* According to UEFI Spec 2.10 Section 38.4.1: The following table shows the TPM PCR index mapping and CC event log measurement register index interpretation for Intel TDX, where MRTD means Trust Domain Measurement Register and RTMR means Runtime Measurement Register */ UINT32 EFIAPI MapPcrToMrIndex(IN UINT32 PCRIndex)
{ UINT32 MrIndex; if (PCRIndex > 15) { ASSERT (FALSE); return CC_MR_INDEX_INVALID; } MrIndex = 0; if (PCRIndex == 0) { MrIndex = CC_MR_INDEX_0_MRTD; } else if ((PCRIndex == 1) || (PCRIndex == 7)) { MrIndex = CC_MR_INDEX_1_RTMR0; } else if ((PCRIndex >= 2) && (PCRIndex <= 6)) { MrIndex = CC_MR_INDEX_2_RTMR1; } else if ((PCRIndex >= 8) && (PCRIndex <= 15)) { MrIndex = CC_MR_INDEX_3_RTMR2; } return MrIndex; }
tianocore/edk2
C++
Other
4,240
/* In this function, the hardware should be initialized. Called from ethernetif_init(). */
static void prvLowLevelInit(struct netif *pxNetIf)
/* In this function, the hardware should be initialized. Called from ethernetif_init(). */ static void prvLowLevelInit(struct netif *pxNetIf)
{ pcap_if_t *pxAllNetworkInterfaces; pxNetIf->hwaddr_len = ETHARP_HWADDR_LEN; pxNetIf->hwaddr[ 0 ] = configMAC_ADDR0; pxNetIf->hwaddr[ 1 ] = configMAC_ADDR1; pxNetIf->hwaddr[ 2 ] = configMAC_ADDR2; pxNetIf->hwaddr[ 3 ] = configMAC_ADDR3; pxNetIf->hwaddr[ 4 ] = configMAC_ADDR4; pxNetIf->hwaddr[ 5 ] = configMAC_ADDR5; pxNetIf->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; pxAllNetworkInterfaces = prvPrintAvailableNetworkInterfaces(); if( pxAllNetworkInterfaces != NULL ) { prvOpenSelectedNetworkInterface( pxAllNetworkInterfaces ); } pxlwIPNetIf = pxNetIf; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables or disables the selected ADC start of the injected channels conversion. */
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the selected ADC start of the injected channels conversion. */ void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CR2 |= CR2_JEXTTRIG_JSWSTART_Set; } else { ADCx->CR2 &= CR2_JEXTTRIG_JSWSTART_Reset; } }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* This drops destination transaction entry from appropriate network state tree and drops related reference counter. It is possible that transaction will be freed here if its reference counter hits zero. Destination transaction entry will be freed. */
void netfs_trans_drop_last(struct netfs_trans *t, struct netfs_state *st)
/* This drops destination transaction entry from appropriate network state tree and drops related reference counter. It is possible that transaction will be freed here if its reference counter hits zero. Destination transaction entry will be freed. */ void netfs_trans_drop_last(struct netfs_trans *t, struct netfs_state *st)
{ struct netfs_trans_dst *dst, *tmp, *ret; spin_lock(&t->dst_lock); ret = list_entry(t->dst_list.prev, struct netfs_trans_dst, trans_entry); if (ret->state != st) { ret = NULL; list_for_each_entry_safe(dst, tmp, &t->dst_list, trans_entry) { if (dst->state == st) { ret = dst; list_del_init(&dst->trans_entry); break; } } } else { list_del(&ret->trans_entry); } spin_unlock(&t->dst_lock); if (ret) netfs_trans_remove_dst(ret); }
robutest/uclinux
C++
GPL-2.0
60
/* Add a new entry for CmArmPccSubspace at Index. */
STATIC EFI_STATUS EFIAPI MappingTableAdd(IN MAPPING_TABLE *MappingTable, IN VOID *CmArmPccSubspace, IN UINT32 Index)
/* Add a new entry for CmArmPccSubspace at Index. */ STATIC EFI_STATUS EFIAPI MappingTableAdd(IN MAPPING_TABLE *MappingTable, IN VOID *CmArmPccSubspace, IN UINT32 Index)
{ if ((MappingTable == NULL) || (MappingTable->Table == NULL) || (CmArmPccSubspace == NULL)) { ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER); return EFI_INVALID_PARAMETER; } if ((Index >= MappingTable->MaxIndex) || (MappingTable->Table[Index] != 0)) { ASSERT_EFI_ERROR (EFI_BUFFER_TOO_SMALL); return EFI_BUFFER_TOO_SMALL; } MappingTable->Table[Index] = CmArmPccSubspace; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Operating systems may expect to run in non-secure mode. Here we check if we are running in secure mode and switch to non-secure mode if necessary. */
void switch_to_non_secure_mode(void)
/* Operating systems may expect to run in non-secure mode. Here we check if we are running in secure mode and switch to non-secure mode if necessary. */ void switch_to_non_secure_mode(void)
{ static bool is_nonsec; struct jmp_buf_data non_secure_jmp; if (armv7_boot_nonsec() && !is_nonsec) { if (setjmp(&non_secure_jmp)) return; dcache_disable(); armv7_init_nonsec(); is_nonsec = true; secure_ram_addr(_do_nonsec_entry)(entry_non_secure, (uintptr_t)&non_secure_jmp, 0, 0); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* add_pnode_dirt - add dirty space to LPT LEB properties. */
static void add_pnode_dirt(struct ubifs_info *c, struct ubifs_pnode *pnode)
/* add_pnode_dirt - add dirty space to LPT LEB properties. */ static void add_pnode_dirt(struct ubifs_info *c, struct ubifs_pnode *pnode)
{ ubifs_add_lpt_dirt(c, pnode->parent->nbranch[pnode->iip].lnum, c->pnode_sz); }
EmcraftSystems/u-boot
C++
Other
181
/* Uninitialization of the USB CDC class (ACM) The function calls USBD_CDC_ACM_PortUninitialize function which uninitializes Virtual COM Port. */
__WEAK int32_t USBD_CDC_ACM_Uninitialization(void)
/* Uninitialization of the USB CDC class (ACM) The function calls USBD_CDC_ACM_PortUninitialize function which uninitializes Virtual COM Port. */ __WEAK int32_t USBD_CDC_ACM_Uninitialization(void)
{ return (USBD_CDC_ACM_PortUninitialize()); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Sets the RTC BCD time minute value. Requires unlocking the RTC write-protection (RTC_WPR) */
void rtc_time_set_minute(uint8_t minute)
/* Sets the RTC BCD time minute value. Requires unlocking the RTC write-protection (RTC_WPR) */ void rtc_time_set_minute(uint8_t minute)
{ uint8_t bcd_minute = _rtc_dec_to_bcd(minute); RTC_TR &= ~(RTC_TR_MNT_MASK << RTC_TR_MNT_SHIFT | RTC_TR_MNU_MASK << RTC_TR_MNU_SHIFT); RTC_TR |= (((bcd_minute >> 4) & RTC_TR_MNT_MASK) << RTC_TR_MNT_SHIFT) | ((bcd_minute & RTC_TR_MNU_MASK) << RTC_TR_MNU_SHIFT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Writes the received value from a characteristic write to the given destination. */
static int ble_svc_ans_chr_write(struct os_mbuf *om, uint16_t min_len, uint16_t max_len, void *dst, uint16_t *len)
/* Writes the received value from a characteristic write to the given destination. */ static int ble_svc_ans_chr_write(struct os_mbuf *om, uint16_t min_len, uint16_t max_len, void *dst, uint16_t *len)
{ uint16_t om_len; int rc; om_len = OS_MBUF_PKTLEN(om); if (om_len < min_len || om_len > max_len) { return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; } rc = ble_hs_mbuf_to_flat(om, dst, max_len, len); if (rc != 0) { return BLE_ATT_ERR_UNLIKELY; } return 0; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* lookup_mnt increments the ref count before returning the vfsmount struct. */
struct vfsmount* lookup_mnt(struct path *path)
/* lookup_mnt increments the ref count before returning the vfsmount struct. */ struct vfsmount* lookup_mnt(struct path *path)
{ struct vfsmount *child_mnt; spin_lock(&vfsmount_lock); if ((child_mnt = __lookup_mnt(path->mnt, path->dentry, 1))) mntget(child_mnt); spin_unlock(&vfsmount_lock); return child_mnt; }
robutest/uclinux
C++
GPL-2.0
60
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeFan(unsigned long ulPort, unsigned char ucPins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeFan(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Clear selected GPIO Interrupts. ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines. */
void am_hal_gpio_int_clear(uint64_t ui64InterruptMask)
/* Clear selected GPIO Interrupts. ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines. */ void am_hal_gpio_int_clear(uint64_t ui64InterruptMask)
{ AM_CRITICAL_BEGIN_ASM AM_REG(GPIO, INT1CLR) = (ui64InterruptMask >> 32); AM_REG(GPIO, INT0CLR) = (ui64InterruptMask & 0xFFFFFFFF); AM_CRITICAL_END_ASM }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* XDR long integers same as xdr_u_long - open coded to save a proc call! */
bool_t xdr_long(XDR *xdrs, long *lp)
/* XDR long integers same as xdr_u_long - open coded to save a proc call! */ bool_t xdr_long(XDR *xdrs, long *lp)
{ if (xdrs->x_op == XDR_ENCODE && (sizeof(int32_t) == sizeof(long) || (int32_t) *lp == *lp)) return (XDR_PUTLONG(xdrs, lp)); if (xdrs->x_op == XDR_DECODE) return (XDR_GETLONG(xdrs, lp)); if (xdrs->x_op == XDR_FREE) return (TRUE); return (FALSE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns: The position in tvb of the first non-whitespace character following offset or offset + maxlength -1 whichever is smaller. */
gint tvb_skip_wsp(tvbuff_t *tvb, const gint offset, const gint maxlength)
/* Returns: The position in tvb of the first non-whitespace character following offset or offset + maxlength -1 whichever is smaller. */ gint tvb_skip_wsp(tvbuff_t *tvb, const gint offset, const gint maxlength)
{ gint counter = offset; gint end, tvb_len; guint8 tempchar; DISSECTOR_ASSERT(tvb && tvb->initialized); tvb_len = tvb->length; end = offset + maxlength; if (end >= tvb_len) { end = tvb_len; } for (counter = offset; counter < end && ((tempchar = tvb_get_guint8(tvb,counter)) == ' ' || tempchar == '\t' || tempchar == '\r' || tempchar == '\n'); counter++); return (counter); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* STP island condition machine check. This is called when an attached server attempts to communicate over an STP link and the servers have matching CTN ids and have a valid stratum-1 configuration but the configurations do not match. */
void stp_island_check(void)
/* STP island condition machine check. This is called when an attached server attempts to communicate over an STP link and the servers have matching CTN ids and have a valid stratum-1 configuration but the configurations do not match. */ void stp_island_check(void)
{ disable_sync_clock(NULL); queue_work(time_sync_wq, &stp_work); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* As invalidate_dcache_all() is not used in generic U-Boot code and as we don't need it in arch/arc code alone (invalidate without flush) we implement flush_n_invalidate_dcache_all (flush and invalidate in 1 operation) because it's much safer. See for more details. */
void flush_n_invalidate_dcache_all(void)
/* As invalidate_dcache_all() is not used in generic U-Boot code and as we don't need it in arch/arc code alone (invalidate without flush) we implement flush_n_invalidate_dcache_all (flush and invalidate in 1 operation) because it's much safer. See for more details. */ void flush_n_invalidate_dcache_all(void)
{ __dc_entire_op(OP_FLUSH_N_INV); if (is_isa_arcv2() && !slc_data_bypass()) __slc_entire_op(OP_FLUSH_N_INV); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the GUID file name from the file path. */
EFI_GUID* GetFileNameFromFilePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
/* Get the GUID file name from the file path. */ EFI_GUID* GetFileNameFromFilePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
{ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *ThisFilePath; EFI_GUID *FileName; FileName = NULL; if (FilePath != NULL) { ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)FilePath; while (!IsDevicePathEnd (ThisFilePath)) { FileName = EfiGetNameGuidFromFwVolDevicePathNode (ThisFilePath); if (FileName != NULL) { break; } ThisFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)NextDevicePathNode (ThisFilePath); } } return FileName; }
tianocore/edk2
C++
Other
4,240
/* This API is used to get the status of fifo water mark in the register 0x1E bit 7. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_wm_enable(u8 *v_fifo_wm_enable_u8)
/* This API is used to get the status of fifo water mark in the register 0x1E bit 7. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_wm_enable(u8 *v_fifo_wm_enable_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_INTR_4_FIFO_WM_ENABLE__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_fifo_wm_enable_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_INTR_4_FIFO_WM_ENABLE); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetHeight(void)
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */ uint16_t lcdGetHeight(void)
{ return ssd1331Properties.height; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* TI TLK105 & DP83822 PHY link speed polling function Link speed polling function for the TI TLK105 & DP83822 PHYs. */
static enum eth_xlnx_link_speed phy_xlnx_gem_ti_dp83822_poll_lspd(const struct device *dev)
/* TI TLK105 & DP83822 PHY link speed polling function Link speed polling function for the TI TLK105 & DP83822 PHYs. */ static enum eth_xlnx_link_speed phy_xlnx_gem_ti_dp83822_poll_lspd(const struct device *dev)
{ const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config; struct eth_xlnx_gem_dev_data *dev_data = dev->data; enum eth_xlnx_link_speed link_speed; uint16_t phy_data; phy_data = phy_xlnx_gem_mdio_read(dev_conf->base_addr, dev_data->phy_addr, PHY_TI_PHY_STATUS_REGISTER); if ((phy_data & PHY_TI_PHY_STATUS_LINK_BIT) != 0) { if ((phy_data & PHY_TI_PHY_STATUS_SPEED_BIT) != 0) { link_speed = LINK_10MBIT; } else { link_speed = LINK_100MBIT; } } else { link_speed = LINK_DOWN; } return link_speed; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function is used to read a timer's current value. */
u32 tls_timer_read(u8 timer_id)
/* This function is used to read a timer's current value. */ u32 tls_timer_read(u8 timer_id)
{ u32 value; if (!(wm_timer_bitmap & BIT(timer_id))) { return 0; } value = tls_reg_read32(HR_TIMER0_CNT + 0x04 * timer_id); return value; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Reset the text output device hardware and optionally run diagnostics */
EFI_STATUS EFIAPI ConSplitterTextOutReset(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* Reset the text output device hardware and optionally run diagnostics */ EFI_STATUS EFIAPI ConSplitterTextOutReset(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; UINTN Index; EFI_STATUS ReturnStatus; Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { Status = Private->TextOutList[Index].TextOut->Reset ( Private->TextOutList[Index].TextOut, ExtendedVerification ); if (EFI_ERROR (Status)) { ReturnStatus = Status; } } This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BLACK)); TextOutSetMode (Private, 0); return ReturnStatus; }
tianocore/edk2
C++
Other
4,240
/* Check whether the journaling code supports the use of all of a given set of features on this journal. Return true (non-zero) if it can. */
int jbd2_journal_check_available_features(journal_t *journal, unsigned long compat, unsigned long ro, unsigned long incompat)
/* Check whether the journaling code supports the use of all of a given set of features on this journal. Return true (non-zero) if it can. */ int jbd2_journal_check_available_features(journal_t *journal, unsigned long compat, unsigned long ro, unsigned long incompat)
{ journal_superblock_t *sb; if (!compat && !ro && !incompat) return 1; sb = journal->j_superblock; if (journal->j_format_version != 2) return 0; if ((compat & JBD2_KNOWN_COMPAT_FEATURES) == compat && (ro & JBD2_KNOWN_ROCOMPAT_FEATURES) == ro && (incompat & JBD2_KNOWN_INCOMPAT_FEATURES) == incompat) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the type of parity currently being used. */
uint32_t UARTParityModeGet(uint32_t ui32Base)
/* Gets the type of parity currently being used. */ uint32_t UARTParityModeGet(uint32_t ui32Base)
{ ASSERT(_UARTBaseValid(ui32Base)); return(HWREG(ui32Base + UART_O_LCRH) & (UART_LCRH_SPS | UART_LCRH_EPS | UART_LCRH_PEN)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Find the top of screen menu base on the current menu. */
LIST_ENTRY* FindTopOfScreenMenu(IN LIST_ENTRY *CurPos, IN UINTN Rows, OUT UINTN *SkipValue)
/* Find the top of screen menu base on the current menu. */ LIST_ENTRY* FindTopOfScreenMenu(IN LIST_ENTRY *CurPos, IN UINTN Rows, OUT UINTN *SkipValue)
{ LIST_ENTRY *Link; LIST_ENTRY *TopOfScreen; UI_MENU_OPTION *PreviousMenuOption; Link = CurPos; PreviousMenuOption = NULL; while (Link->BackLink != &gMenuOption) { Link = Link->BackLink; PreviousMenuOption = MENU_OPTION_FROM_LINK (Link); if (PreviousMenuOption->Row == 0) { UpdateOptionSkipLines (PreviousMenuOption); } if (Rows <= PreviousMenuOption->Skip) { break; } Rows = Rows - PreviousMenuOption->Skip; } if (Link->BackLink == &gMenuOption) { TopOfScreen = gMenuOption.ForwardLink; if ((PreviousMenuOption != NULL) && (Rows < PreviousMenuOption->Skip)) { *SkipValue = PreviousMenuOption->Skip - Rows; } else { *SkipValue = 0; } } else { TopOfScreen = Link; *SkipValue = PreviousMenuOption->Skip - Rows; } return TopOfScreen; }
tianocore/edk2
C++
Other
4,240
/* USART Set receiver timeout value. Sets the receive timeout value in terms of number of bit duration. The RTOF usart_isr_rtof is set if, after the last received character, no new start bit is detected for more than the receive timeout value. */
void usart_set_rx_timeout_value(uint32_t usart, uint32_t value)
/* USART Set receiver timeout value. Sets the receive timeout value in terms of number of bit duration. The RTOF usart_isr_rtof is set if, after the last received character, no new start bit is detected for more than the receive timeout value. */ void usart_set_rx_timeout_value(uint32_t usart, uint32_t value)
{ uint32_t reg; reg = USART_RTOR(usart) & ~USART_RTOR_RTO_MASK; reg |= (USART_RTOR_RTO_VAL(value) & USART_RTOR_RTO_MASK); USART_RTOR(usart) = reg; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Check if busid has been added to the list of dasd ranges. */
int dasd_busid_known(const char *bus_id)
/* Check if busid has been added to the list of dasd ranges. */ int dasd_busid_known(const char *bus_id)
{ return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Determine if we're in capsule update boot mode. */
EFI_STATUS EFIAPI CheckCapsuleUpdate(IN EFI_PEI_SERVICES **PeiServices)
/* Determine if we're in capsule update boot mode. */ EFI_STATUS EFIAPI CheckCapsuleUpdate(IN EFI_PEI_SERVICES **PeiServices)
{ if (AreCapsulesStaged ()) { return EFI_SUCCESS; } else { return EFI_NOT_FOUND; } }
tianocore/edk2
C++
Other
4,240
/* Enumerate the video device list of the video bus, bind the ids with the corresponding video devices under the video bus. */
static void acpi_video_device_rebind(struct acpi_video_bus *video)
/* Enumerate the video device list of the video bus, bind the ids with the corresponding video devices under the video bus. */ static void acpi_video_device_rebind(struct acpi_video_bus *video)
{ struct acpi_video_device *dev; mutex_lock(&video->device_list_lock); list_for_each_entry(dev, &video->video_device_list, entry) acpi_video_device_bind(video, dev); mutex_unlock(&video->device_list_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* The callback is invoked by the driver within interrupt context, so it needs to do its job quickly. Sending the received frame up the protocol stack should be done at task-level. If there are other potentially slow operations within the callback, these too should be done at task-level. */
void XEmac_SetSgRecvHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_SgHandler FuncPtr)
/* The callback is invoked by the driver within interrupt context, so it needs to do its job quickly. Sending the received frame up the protocol stack should be done at task-level. If there are other potentially slow operations within the callback, these too should be done at task-level. */ void XEmac_SetSgRecvHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_SgHandler FuncPtr)
{ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(FuncPtr != NULL); XASSERT_VOID(XEmac_mIsSgDma(InstancePtr)); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); InstancePtr->SgRecvHandler = FuncPtr; InstancePtr->SgRecvRef = CallBackRef; }
EmcraftSystems/u-boot
C++
Other
181
/* Calls a discover-all-descriptors proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_disc_all_dscs_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_dsc *dsc)
/* Calls a discover-all-descriptors proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */ static int ble_gattc_disc_all_dscs_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_dsc *dsc)
{ int rc; BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task()); BLE_HS_DBG_ASSERT(dsc != NULL || status != 0); ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0 && status != BLE_HS_EDONE) { STATS_INC(ble_gattc_stats, disc_all_dscs_fail); } if (proc->disc_all_dscs.cb == NULL) { rc = 0; } else { rc = proc->disc_all_dscs.cb(proc->conn_handle, ble_gattc_error(status, att_handle), proc->disc_all_dscs.chr_val_handle, dsc, proc->disc_all_dscs.cb_arg); } return rc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point. */
EFI_STATUS EFIAPI RedfishDiscoverUnload(IN EFI_HANDLE ImageHandle)
/* Disconnect the driver specified by ImageHandle from all the devices in the handle database. Uninstall all the protocols installed in the driver entry point. */ EFI_STATUS EFIAPI RedfishDiscoverUnload(IN EFI_HANDLE ImageHandle)
{ EFI_STATUS Status; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *ThisNetworkInterface; Status = EFI_SUCCESS; while (!IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) { ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface); StopServiceOnNetworkInterface (&gRedfishDiscoverDriverBinding, ThisNetworkInterface->NetworkInterfaceProtocolInfo.ProtocolControllerHandle); } return Status; }
tianocore/edk2
C++
Other
4,240
/* Determines if there are any characters in the receive FIFO. */
xtBoolean xUARTCharsAvail(unsigned long ulBase)
/* Determines if there are any characters in the receive FIFO. */ xtBoolean xUARTCharsAvail(unsigned long ulBase)
{ return UARTFIFORxIsEmpty(ulBase); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Forces the TIMx output 3 waveform to active or inactive level. */
void TIM_ForcedOC3Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
/* Forces the TIMx output 3 waveform to active or inactive level. */ void TIM_ForcedOC3Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC3M; tmpccmr2 |= TIM_ForcedAction; TIMx->CCMR2 = tmpccmr2; }
MaJerle/stm32f429
C++
null
2,036
/* If the BSP cannot be switched prior to the return from this service, then EFI_UNSUPPORTED must be returned. */
EFI_STATUS EFIAPI PeiSwitchBSP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
/* If the BSP cannot be switched prior to the return from this service, then EFI_UNSUPPORTED must be returned. */ EFI_STATUS EFIAPI PeiSwitchBSP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
{ return MpInitLibSwitchBSP (ProcessorNumber, EnableOldBSP); }
tianocore/edk2
C++
Other
4,240
/* Cycles all LEDs at once through a rainbow. */
static int ws2812_effects_mode_rainbow()
/* Cycles all LEDs at once through a rainbow. */ static int ws2812_effects_mode_rainbow()
{ *p++ = g * state->brightness / BRIGHTNESS_MAX; *p++ = r * state->brightness / BRIGHTNESS_MAX; *p++ = b * state->brightness / BRIGHTNESS_MAX; for (j = 3; j < pixbuf_channels(buffer); j++) { *p++ = 0; } } state->counter_mode_step = (state->counter_mode_step + 1) % 360; return 0; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Registers a function to be called from the processor interrupt handler. */
EFI_STATUS RegisterCpuInterruptHandlerWorker(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
/* Registers a function to be called from the processor interrupt handler. */ EFI_STATUS RegisterCpuInterruptHandlerWorker(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler, IN EXCEPTION_HANDLER_DATA *ExceptionHandlerData)
{ UINTN EnabledInterruptNum; RESERVED_VECTORS_DATA *ReservedVectors; EFI_CPU_INTERRUPT_HANDLER *ExternalInterruptHandler; EnabledInterruptNum = ExceptionHandlerData->IdtEntryCount; ReservedVectors = ExceptionHandlerData->ReservedVectors; ExternalInterruptHandler = ExceptionHandlerData->ExternalInterruptHandler; if ((InterruptType < 0) || (InterruptType >= (EFI_EXCEPTION_TYPE)EnabledInterruptNum) || (ReservedVectors[InterruptType].Attribute == EFI_VECTOR_HANDOFF_DO_NOT_HOOK)) { return EFI_UNSUPPORTED; } if ((InterruptHandler == NULL) && (ExternalInterruptHandler[InterruptType] == NULL)) { return EFI_INVALID_PARAMETER; } if ((InterruptHandler != NULL) && (ExternalInterruptHandler[InterruptType] != NULL)) { return EFI_ALREADY_STARTED; } ExternalInterruptHandler[InterruptType] = InterruptHandler; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns: a string containing @drive's name. The returned string should be freed when no longer needed. */
char* g_drive_get_name(GDrive *drive)
/* Returns: a string containing @drive's name. The returned string should be freed when no longer needed. */ char* g_drive_get_name(GDrive *drive)
{ GDriveIface *iface; g_return_val_if_fail (G_IS_DRIVE (drive), NULL); iface = G_DRIVE_GET_IFACE (drive); return (* iface->get_name) (drive); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* get next usable tpd Note: should call atl1c_tdp_avail to make sure there is enough tpd to use */
static struct atl1c_tpd_desc* atl1c_get_tpd(struct atl1c_adapter *adapter, enum atl1c_trans_queue type)
/* get next usable tpd Note: should call atl1c_tdp_avail to make sure there is enough tpd to use */ static struct atl1c_tpd_desc* atl1c_get_tpd(struct atl1c_adapter *adapter, enum atl1c_trans_queue type)
{ struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type]; struct atl1c_tpd_desc *tpd_desc; u16 next_to_use = 0; next_to_use = tpd_ring->next_to_use; if (++tpd_ring->next_to_use == tpd_ring->count) tpd_ring->next_to_use = 0; tpd_desc = ATL1C_TPD_DESC(tpd_ring, next_to_use); memset(tpd_desc, 0, sizeof(struct atl1c_tpd_desc)); return tpd_desc; }
robutest/uclinux
C++
GPL-2.0
60
/* If 8-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI S3MmioBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If 8-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT8 EFIAPI S3MmioBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
{ return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldRead8 (Address, StartBit, EndBit)); }
tianocore/edk2
C++
Other
4,240
/* This function disables the Cortex A9 event counters. */
void Xpm_DisableEventCounters(void)
/* This function disables the Cortex A9 event counters. */ void Xpm_DisableEventCounters(void)
{ mtcp(XREG_CP15_COUNT_ENABLE_CLR, 0x3f); }
ua1arn/hftrx
C++
null
69
/* Disable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_DisableEP(uint32_t EPNum)
/* Disable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_DisableEP(uint32_t EPNum)
{ return; } if (ep_dir != 0U) { NRF_USBD->INTENCLR = USBD_INTEN_ENDEPIN0_Msk << ep_num; NRF_USBD->EPINEN &= ~(USBD_EPINEN_IN0_Msk << ep_num); } else { NRF_USBD->INTENCLR = USBD_INTEN_ENDEPIN0_Msk << ep_num; NRF_USBD->EPINEN &= ~(USBD_EPOUTEN_OUT0_Msk << ep_num); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This routine is invoked to release an rpi to the pool of available rpis maintained by the driver. */
void lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi)
/* This routine is invoked to release an rpi to the pool of available rpis maintained by the driver. */ void lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi)
{ spin_lock_irq(&phba->hbalock); clear_bit(rpi, phba->sli4_hba.rpi_bmask); phba->sli4_hba.rpi_count--; phba->sli4_hba.max_cfg_param.rpi_used--; spin_unlock_irq(&phba->hbalock); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the pixel value at x,y in framebuffer. */
uint8_t gfx_mono_framebuffer_get_pixel(gfx_coord_t x, gfx_coord_t y)
/* Get the pixel value at x,y in framebuffer. */ uint8_t gfx_mono_framebuffer_get_pixel(gfx_coord_t x, gfx_coord_t y)
{ uint8_t page; uint8_t pixel_mask; if ((x > GFX_MONO_LCD_WIDTH - 1) || (y > GFX_MONO_LCD_HEIGHT - 1)) { return 0; } page = y / GFX_MONO_LCD_PIXELS_PER_BYTE; pixel_mask = (1 << (y - (page * 8))); return gfx_mono_framebuffer_get_byte(page, x) & pixel_mask; }
memfault/zero-to-main
C++
null
200
/* Step 2 of the initialization of a USB MSC device Decode the setup request GET_MAX_LUN and allocs LUN structures. */
static void uhi_msc_enable_step2(usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans)
/* Step 2 of the initialization of a USB MSC device Decode the setup request GET_MAX_LUN and allocs LUN structures. */ static void uhi_msc_enable_step2(usb_add_t add, uhd_trans_status_t status, uint16_t payload_trans)
{ UNUSED(add); if (status == UHD_TRANS_NOERROR) { if (payload_trans) { uhi_msc_dev_sel->nb_lun++; } else { uhi_msc_dev_sel->nb_lun = 1; } } else if (status == UHD_TRANS_STALL) { uhi_msc_dev_sel->nb_lun = 1; } else { b_uhi_msc_free = true; return; } uhi_msc_dev_sel->lun = malloc(uhi_msc_dev_sel->nb_lun*sizeof(uhi_msc_lun_t)); if (uhi_msc_dev_sel->lun == NULL) { Assert(false); b_uhi_msc_free = true; return; } uhi_msc_lun_num_sel = (uint8_t) - 1; uhi_msc_enable_step3(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* send a string to the modem, processing for \336 (sleep 1 sec) and \335 (break signal) */
void zsend_break(char *cmd)
/* send a string to the modem, processing for \336 (sleep 1 sec) and \335 (break signal) */ void zsend_break(char *cmd)
{ while (*cmd++) { switch (*cmd) { case '\336': continue; case '\335': rt_thread_delay(RT_TICK_PER_SECOND); continue; default: zsend_line(*cmd); break; } } }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* During SenseID, command information words (CIWs) describing special commands available to the device may have been stored in the extended sense data. This function searches for CIWs of a specified command type in the extended sense data. Returns: NULL if no extended sense data has been stored or if no CIW of the specified command type could be found, else a pointer to the CIW of the specified command type. */
struct ciw* ccw_device_get_ciw(struct ccw_device *cdev, __u32 ct)
/* During SenseID, command information words (CIWs) describing special commands available to the device may have been stored in the extended sense data. This function searches for CIWs of a specified command type in the extended sense data. Returns: NULL if no extended sense data has been stored or if no CIW of the specified command type could be found, else a pointer to the CIW of the specified command type. */ struct ciw* ccw_device_get_ciw(struct ccw_device *cdev, __u32 ct)
{ int ciw_cnt; if (cdev->private->flags.esid == 0) return NULL; for (ciw_cnt = 0; ciw_cnt < MAX_CIWS; ciw_cnt++) if (cdev->private->senseid.ciw[ciw_cnt].ct == ct) return cdev->private->senseid.ciw + ciw_cnt; return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute read call back for the Value V7 attribute. */
static ssize_t read_value_v7(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Value V7 attribute. */ static ssize_t read_value_v7(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint32_t *value = attr->user_data; uint32_t value_v7_conv = sys_cpu_to_le32(*value); return bt_gatt_attr_read(conn, attr, buf, len, offset, &value_v7_conv, sizeof(value_v7_conv)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This routine should not be called by a driver after its disconnect method has returned. */
void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
/* This routine should not be called by a driver after its disconnect method has returned. */ void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
{ struct urb *victim; unsigned long flags; spin_lock_irqsave(&anchor->lock, flags); while (!list_empty(&anchor->urb_list)) { victim = list_entry(anchor->urb_list.prev, struct urb, anchor_list); usb_get_urb(victim); spin_unlock_irqrestore(&anchor->lock, flags); usb_unlink_urb(victim); usb_put_urb(victim); spin_lock_irqsave(&anchor->lock, flags); } spin_unlock_irqrestore(&anchor->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the jitter when the ADC is clocked by PCLK div2 or div4. */
void ADC_JitterCmd(ADC_TypeDef *ADCx, uint32_t ADC_JitterOff, FunctionalState NewState)
/* Enables or disables the jitter when the ADC is clocked by PCLK div2 or div4. */ void ADC_JitterCmd(ADC_TypeDef *ADCx, uint32_t ADC_JitterOff, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_JITTEROFF(ADC_JitterOff)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CFGR2 |= (uint32_t)ADC_JitterOff; } else { ADCx->CFGR2 &= (uint32_t)(~ADC_JitterOff); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a device path to its text representation. */
CHAR16* EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a device path to its text representation. */ CHAR16* EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ if (mDevicePathLibDevicePathToText == NULL) { mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid); } if (mDevicePathLibDevicePathToText != NULL) { return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts); } return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts); }
tianocore/edk2
C++
Other
4,240
/* Resets endpoint specific parameter values, in current version used to reset the data toggle (as a WA). This function can be called from usb_clear_halt routine. */
static void _dwc2_hcd_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep)
/* Resets endpoint specific parameter values, in current version used to reset the data toggle (as a WA). This function can be called from usb_clear_halt routine. */ static void _dwc2_hcd_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep)
{ struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); unsigned long flags; dev_dbg(hsotg->dev, "DWC OTG HCD EP RESET: bEndpointAddress=0x%02x\n", ep->desc.bEndpointAddress); spin_lock_irqsave(&hsotg->lock, flags); dwc2_hcd_endpoint_reset(hsotg, ep); spin_unlock_irqrestore(&hsotg->lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the states of the RI, DCD, DSR and CTS modem status signals. */
unsigned long xUARTModemStatusGet(unsigned long ulBase)
/* Gets the states of the RI, DCD, DSR and CTS modem status signals. */ unsigned long xUARTModemStatusGet(unsigned long ulBase)
{ return UARTModemStatusGet(ulBase); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Terminates the critical section module. Should be called once critical sections are no longer needed. Typically called from another module's termination function that also initialized it. It is okay to call this termination multiple times from different modules. */
void UtilCriticalSectionTerminate(void)
/* Terminates the critical section module. Should be called once critical sections are no longer needed. Typically called from another module's termination function that also initialized it. It is okay to call this termination multiple times from different modules. */ void UtilCriticalSectionTerminate(void)
{ if (criticalSectionInitialized) { criticalSectionInitialized = false; (void)pthread_mutex_destroy((pthread_mutex_t *)&mtxCritSect); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Routines to transition ARMv7 processors from secure into non-secure state and from non-secure SVC into HYP mode needed to enable ARMv7 virtualization for current hypervisors */
static unsigned int read_id_pfr1(void)
/* Routines to transition ARMv7 processors from secure into non-secure state and from non-secure SVC into HYP mode needed to enable ARMv7 virtualization for current hypervisors */ static unsigned int read_id_pfr1(void)
{ unsigned int reg; asm("mrc p15, 0, %0, c0, c1, 1\n" : "=r"(reg)); return reg; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This routine is a stub for the asynchronous error interrupt callback. The stub is here in case the upper layer forgot to set the handler. On initialization, Error interrupt handler is set to this callback. It is considered an error for this handler to be invoked. */
static void StubErrCallBack(void *CallBackRef, u32 ErrorMask)
/* This routine is a stub for the asynchronous error interrupt callback. The stub is here in case the upper layer forgot to set the handler. On initialization, Error interrupt handler is set to this callback. It is considered an error for this handler to be invoked. */ static void StubErrCallBack(void *CallBackRef, u32 ErrorMask)
{ (void)CallBackRef; (void)ErrorMask; Xil_AssertVoidAlways(); } /** @}
ua1arn/hftrx
C++
null
69
/* Get Active Interrupt. Reads the active register in the NVIC and returns the active bit for the device specific interrupt. */
uint32_t drv_nvic_get_active(int32_t IRQn)
/* Get Active Interrupt. Reads the active register in the NVIC and returns the active bit for the device specific interrupt. */ uint32_t drv_nvic_get_active(int32_t IRQn)
{ return ((uint32_t)(((NVIC->IABR[0] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Write out and wait upon all dirty data associated with this device. Filesystem data as well as the underlying block device. Takes the superblock lock. */
int fsync_bdev(struct block_device *bdev)
/* Write out and wait upon all dirty data associated with this device. Filesystem data as well as the underlying block device. Takes the superblock lock. */ int fsync_bdev(struct block_device *bdev)
{ struct super_block *sb = get_super(bdev); if (sb) { int res = sync_filesystem(sb); drop_super(sb); return res; } return sync_blockdev(bdev); }
robutest/uclinux
C++
GPL-2.0
60
/* done - retire a request; caller blocked irqs */
static void done(struct khci_ep *ep, struct khci_request *req, int status)
/* done - retire a request; caller blocked irqs */ static void done(struct khci_ep *ep, struct khci_request *req, int status)
{ unsigned stopped = ep->stopped; list_del_init(&req->queue); if (likely(req->req.status == -EINPROGRESS)) req->req.status = status; else status = req->req.status; ep->stopped = 1; req->req.complete(&ep->ep, &req->req); ep->stopped = stopped; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the SDADC power down mode when idle. */
void SDADC_PowerDownCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState)
/* Enables or disables the SDADC power down mode when idle. */ void SDADC_PowerDownCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState)
{ assert_param(IS_SDADC_ALL_PERIPH(SDADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SDADCx->CR1 |= SDADC_CR1_PDI; } else { SDADCx->CR1 &= (uint32_t)~SDADC_CR1_PDI; } }
avem-labs/Avem
C++
MIT License
1,752
/* This is different than the linux version. Switching between chips is done via board_nand_select_device(). The Linux select_chip function used here in U-Boot has only 2 valid chip numbers: 0 select -1 deselect Implement it as a weak default, so that boards with a specific chip-select routine can use their own function. */
void __mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip)
/* This is different than the linux version. Switching between chips is done via board_nand_select_device(). The Linux select_chip function used here in U-Boot has only 2 valid chip numbers: 0 select -1 deselect Implement it as a weak default, so that boards with a specific chip-select routine can use their own function. */ void __mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip)
{ if (chip < 0) { nfc_clear(mtd, NFC_CONFIG1, NFC_CE); return; } nfc_clear(mtd, NFC_BUF_ADDR, NFC_ACTIVE_CS_MASK); nfc_set(mtd, NFC_BUF_ADDR, (chip << NFC_ACTIVE_CS_SHIFT) & NFC_ACTIVE_CS_MASK); nfc_set(mtd, NFC_CONFIG1, NFC_CE); }
EmcraftSystems/u-boot
C++
Other
181
/* Disable device's sytem wake-up capability and put it into D0. */
int pci_back_from_sleep(struct pci_dev *dev)
/* Disable device's sytem wake-up capability and put it into D0. */ int pci_back_from_sleep(struct pci_dev *dev)
{ pci_enable_wake(dev, PCI_D0, false); return pci_set_power_state(dev, PCI_D0); }
robutest/uclinux
C++
GPL-2.0
60
/* Releases the memory which was previously allocated for a descriptor ring. */
void dma_free_descriptor_ring(DMA_DescriptorRing_t *ring)
/* Releases the memory which was previously allocated for a descriptor ring. */ void dma_free_descriptor_ring(DMA_DescriptorRing_t *ring)
{ if (ring->virtAddr != NULL) { dma_free_writecombine(NULL, ring->bytesAllocated, ring->virtAddr, ring->physAddr); } ring->bytesAllocated = 0; ring->descriptorsAllocated = 0; ring->virtAddr = NULL; ring->physAddr = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Don't forget that the stack pointer must be aligned on a 8 bytes boundary for 32-bits ABI and 16 bytes for 64-bits ABI. */
unsigned long arch_align_stack(unsigned long sp)
/* Don't forget that the stack pointer must be aligned on a 8 bytes boundary for 32-bits ABI and 16 bytes for 64-bits ABI. */ unsigned long arch_align_stack(unsigned long sp)
{ if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) sp -= get_random_int() & ~PAGE_MASK; return sp & ALMASK; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This hands the URB from HCD to its USB device driver, using its completion function. The HCD has freed all per-urb resources (and is done using urb->hcpriv). It also released all HCD locks; the device driver won't cause problems if it frees, modifies, or resubmits this URB. */
void usb_hcd_giveback_urb(struct hc_gen_dev *hcd, struct urb *urb)
/* This hands the URB from HCD to its USB device driver, using its completion function. The HCD has freed all per-urb resources (and is done using urb->hcpriv). It also released all HCD locks; the device driver won't cause problems if it frees, modifies, or resubmits this URB. */ void usb_hcd_giveback_urb(struct hc_gen_dev *hcd, struct urb *urb)
{ if (likely(!urb->unlinked)) urb->unlinked = urb->status; urb_unlink(urb); urb->complete(urb); usb_dec32((&urb->use_count)); if (urb->reject) { hal_log_err("PANIC : usb_hcd_giveback_urb: submissions will fail"); } return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize a descriptor ring. Calxeda XGMAC is configured to use advanced descriptors. */
static void init_rx_desc(struct calxeda_eth_dev *priv)
/* Initialize a descriptor ring. Calxeda XGMAC is configured to use advanced descriptors. */ static void init_rx_desc(struct calxeda_eth_dev *priv)
{ struct xgmac_dma_desc *rxdesc = priv->rx_chain; struct xgmac_regs *regs = (struct xgmac_regs *)priv->dev->iobase; void *rxbuffer = priv->rxbuffer; int i; desc_init_rx_desc(rxdesc, RX_NUM_DESC, ETH_BUF_SZ); writel((ulong)rxdesc, &regs->rxdesclist); for (i = 0; i < RX_NUM_DESC; i++) { desc_set_buf_addr(rxdesc + i, rxbuffer + (i * ETH_BUF_SZ), ETH_BUF_SZ); desc_set_rx_owner(rxdesc + i); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* CLI command to get and display the output data rate. */
int32_t cn0503_odr_get(struct cn0503_dev *dev, uint8_t *arg)
/* CLI command to get and display the output data rate. */ int32_t cn0503_odr_get(struct cn0503_dev *dev, uint8_t *arg)
{ uint8_t buff[20]; sprintf((char *)buff, "%.5f", dev->odr); cli_write_string(dev->cli_handler, (uint8_t *)"RESP: ODR"); cli_write_string(dev->cli_handler, (uint8_t *)"?="); cli_write_string(dev->cli_handler, buff); cli_write_string(dev->cli_handler, (uint8_t *)"\n"); return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* fc_scsi_scan_rport - called to perform a scsi scan on a remote port. @work: remote port to be scanned. */
static void fc_scsi_scan_rport(struct work_struct *work)
/* fc_scsi_scan_rport - called to perform a scsi scan on a remote port. @work: remote port to be scanned. */ static void fc_scsi_scan_rport(struct work_struct *work)
{ struct fc_rport *rport = container_of(work, struct fc_rport, scan_work); struct Scsi_Host *shost = rport_to_shost(rport); struct fc_internal *i = to_fc_internal(shost->transportt); unsigned long flags; if ((rport->port_state == FC_PORTSTATE_ONLINE) && (rport->roles & FC_PORT_ROLE_FCP_TARGET) && !(i->f->disable_target_scan)) { scsi_scan_target(&rport->dev, rport->channel, rport->scsi_target_id, SCAN_WILD_CARD, 1); } spin_lock_irqsave(shost->host_lock, flags); rport->flags &= ~FC_RPORT_SCAN_PENDING; spin_unlock_irqrestore(shost->host_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* DAC960_ProcessRequest attempts to remove one I/O Request from Controller's I/O Request Queue and queues it to the Controller. WaitForCommand is true if this function should wait for a Command to become available if necessary. This function returns true if an I/O Request was queued and false otherwise. */
static void DAC960_ProcessRequest(DAC960_Controller_T *controller)
/* DAC960_ProcessRequest attempts to remove one I/O Request from Controller's I/O Request Queue and queues it to the Controller. WaitForCommand is true if this function should wait for a Command to become available if necessary. This function returns true if an I/O Request was queued and false otherwise. */ static void DAC960_ProcessRequest(DAC960_Controller_T *controller)
{ int i; if (!controller->ControllerInitialized) return; for (i = controller->req_q_index; i < DAC960_MaxLogicalDrives; i++) { struct request_queue *req_q = controller->RequestQueue[i]; if (req_q == NULL) continue; if (!DAC960_process_queue(controller, req_q)) { controller->req_q_index = i; return; } } if (controller->req_q_index == 0) return; for (i = 0; i < controller->req_q_index; i++) { struct request_queue *req_q = controller->RequestQueue[i]; if (req_q == NULL) continue; if (!DAC960_process_queue(controller, req_q)) { controller->req_q_index = i; return; } } }
robutest/uclinux
C++
GPL-2.0
60
/* Return codes pointer to @phba - successful NULL - error */
static struct lpfc_hba* lpfc_hba_alloc(struct pci_dev *pdev)
/* Return codes pointer to @phba - successful NULL - error */ static struct lpfc_hba* lpfc_hba_alloc(struct pci_dev *pdev)
{ struct lpfc_hba *phba; phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); if (!phba) { dev_err(&pdev->dev, "failed to allocate hba struct\n"); return NULL; } phba->pcidev = pdev; phba->brd_no = lpfc_get_instance(); if (phba->brd_no < 0) { kfree(phba); return NULL; } mutex_init(&phba->ct_event_mutex); INIT_LIST_HEAD(&phba->ct_ev_waiters); return phba; }
robutest/uclinux
C++
GPL-2.0
60
/* Find a statistics structure by name, this is not thread-safe. (assumption: all statistics are registered prior ot OS start.) */
struct stats_hdr* stats_group_find(const char *name)
/* Find a statistics structure by name, this is not thread-safe. (assumption: all statistics are registered prior ot OS start.) */ struct stats_hdr* stats_group_find(const char *name)
{ struct stats_hdr *hdr; for (hdr = stats_list; hdr != NULL; hdr = hdr->s_next) { if (strcmp(hdr->s_name, name) == 0) { return hdr; } } return NULL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* In dumpcap itself, however, we obviously can't run dumpcap to ask for the list. Therefore, our capture_interface_list() should just call get_interface_list(). */
GList* capture_interface_list(int *err, char **err_str, void(*update_cb)(void) _U_)
/* In dumpcap itself, however, we obviously can't run dumpcap to ask for the list. Therefore, our capture_interface_list() should just call get_interface_list(). */ GList* capture_interface_list(int *err, char **err_str, void(*update_cb)(void) _U_)
{ return get_interface_list(err, err_str); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This returns a data pointer of memory map info from the guid hob. */
static struct sbl_memory_map_info* get_memory_map_info(void)
/* This returns a data pointer of memory map info from the guid hob. */ static struct sbl_memory_map_info* get_memory_map_info(void)
{ struct sbl_memory_map_info *data; const efi_guid_t guid = SBL_MEMORY_MAP_INFO_GUID; if (!gd->arch.hob_list) return NULL; data = hob_get_guid_hob_data(gd->arch.hob_list, NULL, &guid); if (!data) panic("memory map info hob not found\n"); if (!data->count) panic("invalid number of memory map entries\n"); return data; }
4ms/stm32mp1-baremetal
C++
Other
137
/* For Td guest TDVMCALL_IO is invoked to write I/O port. */
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
/* For Td guest TDVMCALL_IO is invoked to write I/O port. */ UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
{ BOOLEAN Flag; Flag = FilterBeforeIoWrite (FilterWidth8, Port, &Value); if (Flag) { if (IsTdxGuest ()) { TdIoWrite8 (Port, Value); } else { _ReadWriteBarrier (); (UINT8)_outp ((UINT16)Port, Value); _ReadWriteBarrier (); } } FilterAfterIoWrite (FilterWidth8, Port, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* Fixes: Many : Split from ip.c , see ip_input.c for history. Dave Gregorich : NULL ip_rt_put fix for multicast routing. Jos Vos : Add call_out_firewall before sending, use output device for accounting. Jos Vos : Call forward firewall after routing (always use output device). Mike McLagan : Routing by source */
static int ip_forward_finish(struct sk_buff *skb)
/* Fixes: Many : Split from ip.c , see ip_input.c for history. Dave Gregorich : NULL ip_rt_put fix for multicast routing. Jos Vos : Add call_out_firewall before sending, use output device for accounting. Jos Vos : Call forward firewall after routing (always use output device). Mike McLagan : Routing by source */ static int ip_forward_finish(struct sk_buff *skb)
{ struct ip_options * opt = &(IPCB(skb)->opt); IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); if (unlikely(opt->optlen)) ip_forward_options(skb); return dst_output(skb); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for finding out if a characteristic discovery should be performed after the last discovered characteristic. This function is used during the time of database discovery to find out if there is a need to do more characteristic discoveries. The value handles of the last discovered characteristic is compared with the end handle of the service. If the service handle is greater than one of the former characteristic handles, it means that a characteristic discovery is required. */
static bool is_char_discovery_reqd(ble_db_discovery_t *const p_db_discovery, ble_gattc_char_t *p_after_char)
/* Function for finding out if a characteristic discovery should be performed after the last discovered characteristic. This function is used during the time of database discovery to find out if there is a need to do more characteristic discoveries. The value handles of the last discovered characteristic is compared with the end handle of the service. If the service handle is greater than one of the former characteristic handles, it means that a characteristic discovery is required. */ static bool is_char_discovery_reqd(ble_db_discovery_t *const p_db_discovery, ble_gattc_char_t *p_after_char)
{ if ( p_after_char->handle_value < p_db_discovery->services[p_db_discovery->curr_srv_ind].handle_range.end_handle ) { return true; } return false; }
labapart/polymcu
C++
null
201
/* We need a helper to "push" a value onto the Guest's stack, since that's a big part of what delivering an interrupt does. */
static void push_guest_stack(struct lg_cpu *cpu, unsigned long *gstack, u32 val)
/* We need a helper to "push" a value onto the Guest's stack, since that's a big part of what delivering an interrupt does. */ static void push_guest_stack(struct lg_cpu *cpu, unsigned long *gstack, u32 val)
{ *gstack -= 4; lgwrite(cpu, *gstack, u32, val); }
robutest/uclinux
C++
GPL-2.0
60
/* kset_init - initialize a kset for use @k: kset */
void kset_init(struct kset *k)
/* kset_init - initialize a kset for use @k: kset */ void kset_init(struct kset *k)
{ kobject_init_internal(&k->kobj); INIT_LIST_HEAD(&k->list); spin_lock_init(&k->list_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* ixgbe_atr_get_vlan_id_82599 - Gets the VLAN id from the ATR input stream @input: input stream to search @vlan: the VLAN id to load */
static s32 ixgbe_atr_get_vlan_id_82599(struct ixgbe_atr_input *input, u16 *vlan)
/* ixgbe_atr_get_vlan_id_82599 - Gets the VLAN id from the ATR input stream @input: input stream to search @vlan: the VLAN id to load */ static s32 ixgbe_atr_get_vlan_id_82599(struct ixgbe_atr_input *input, u16 *vlan)
{ *vlan = input->byte_stream[IXGBE_ATR_VLAN_OFFSET]; *vlan |= input->byte_stream[IXGBE_ATR_VLAN_OFFSET + 1] << 8; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Stops the TIMER One Pulse signal generation in interrupt mode. */
void ald_timer_one_pulse_stop_by_it(ald_timer_handle_t *hperh, ald_timer_op_output_channel_t ch)
/* Stops the TIMER One Pulse signal generation in interrupt mode. */ void ald_timer_one_pulse_stop_by_it(ald_timer_handle_t *hperh, ald_timer_op_output_channel_t ch)
{ ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC1, DISABLE); ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC2, DISABLE); timer_ccx_channel_cmd(hperh->perh, ALD_TIMER_CHANNEL_1, DISABLE); timer_ccx_channel_cmd(hperh->perh, ALD_TIMER_CHANNEL_2, DISABLE); if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) ALD_TIMER_MOE_DISABLE(hperh); ALD_TIMER_DISABLE(hperh); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Search for an interface by index. Returns NULL if the device is not found or a pointer to the device. The device has not had its reference counter increased so the caller must be careful about locking. The caller must hold RCU lock. */
struct net_device* dev_get_by_index_rcu(struct net *net, int ifindex)
/* Search for an interface by index. Returns NULL if the device is not found or a pointer to the device. The device has not had its reference counter increased so the caller must be careful about locking. The caller must hold RCU lock. */ struct net_device* dev_get_by_index_rcu(struct net *net, int ifindex)
{ struct hlist_node *p; struct net_device *dev; struct hlist_head *head = dev_index_hash(net, ifindex); hlist_for_each_entry_rcu(dev, p, head, index_hlist) if (dev->ifindex == ifindex) return dev; return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert string input module parms. Accept either the number of the mode or its string name. A bit complicated because some mode names are substrings of other names, and calls from sysfs may have whitespace in the name (trailing newlines, for example). */
int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
/* Convert string input module parms. Accept either the number of the mode or its string name. A bit complicated because some mode names are substrings of other names, and calls from sysfs may have whitespace in the name (trailing newlines, for example). */ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
{ int modeint = -1, i, rv; char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; for (p = (char *)buf; *p; p++) if (!(isdigit(*p) || isspace(*p))) break; if (*p) rv = sscanf(buf, "%20s", modestr); else rv = sscanf(buf, "%d", &modeint); if (!rv) return -1; for (i = 0; tbl[i].modename; i++) { if (modeint == tbl[i].mode) return tbl[i].mode; if (strcmp(modestr, tbl[i].modename) == 0) return tbl[i].mode; } return -1; }
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. */
void 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. */ void main(void)
{ Init(); BootInit(); while (1) { BootTask(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* scsi_eh_done - Completion function for error handling. @scmd: Cmd that is done. */
static void scsi_eh_done(struct scsi_cmnd *scmd)
/* scsi_eh_done - Completion function for error handling. @scmd: Cmd that is done. */ static void scsi_eh_done(struct scsi_cmnd *scmd)
{ struct completion *eh_action; SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n", __func__, scmd, scmd->result)); eh_action = scmd->device->host->eh_action; if (eh_action) complete(eh_action); }
robutest/uclinux
C++
GPL-2.0
60
/* Write a byte to the given SERCOM USART instance. */
void _usart_async_write_byte(struct _usart_async_device *const device, uint8_t data)
/* Write a byte to the given SERCOM USART instance. */ void _usart_async_write_byte(struct _usart_async_device *const device, uint8_t data)
{ hri_sercomusart_write_DATA_reg(device->hw, data); }
eclipse-threadx/getting-started
C++
Other
310
/* Return PA for this VA if it is mapped by a BAT, or 0 */
phys_addr_t v_mapped_by_bats(unsigned long va)
/* Return PA for this VA if it is mapped by a BAT, or 0 */ phys_addr_t v_mapped_by_bats(unsigned long va)
{ int b; for (b = 0; b < 4; ++b) if (va >= bat_addrs[b].start && va < bat_addrs[b].limit) return bat_addrs[b].phys + (va - bat_addrs[b].start); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remove all samples The soundcard should be silet before calling this function. */
int snd_soundfont_remove_samples(struct snd_sf_list *sflist)
/* Remove all samples The soundcard should be silet before calling this function. */ int snd_soundfont_remove_samples(struct snd_sf_list *sflist)
{ lock_preset(sflist); if (sflist->callback.sample_reset) sflist->callback.sample_reset(sflist->callback.private_data); snd_sf_clear(sflist); unlock_preset(sflist); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* adds to driver model, name database, fixups, interface, etc. */
int pnp_add_device(struct pnp_dev *dev)
/* adds to driver model, name database, fixups, interface, etc. */ int pnp_add_device(struct pnp_dev *dev)
{ int ret; char buf[128]; int len = 0; struct pnp_id *id; if (dev->card) return -EINVAL; ret = __pnp_add_device(dev); if (ret) return ret; buf[0] = '\0'; for (id = dev->id; id; id = id->next) len += scnprintf(buf + len, sizeof(buf) - len, " %s", id->id); pnp_dbg(&dev->dev, "%s device, IDs%s (%s)\n", dev->protocol->name, buf, dev->active ? "active" : "disabled"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable address filters module uses the MAC address for perfect filtering. */
void ETH_EnableMACAddressPerfectFilter(ETH_MAC_ADDRESS_T macAddr)
/* Enable address filters module uses the MAC address for perfect filtering. */ void ETH_EnableMACAddressPerfectFilter(ETH_MAC_ADDRESS_T macAddr)
{ __IO uint32_t temp = 0; (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr)) |= BIT31; ETH_Delay(ETH_REG_WRITE_DELAY); (*(__IO uint32_t *) (ETH_MAC_ADDR_HBASE + macAddr)) = temp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535