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
/* Give up exclusive access to the hash bucket */
static void put_hash_bucket(struct hash_bucket *bucket, unsigned long *flags)
/* Give up exclusive access to the hash bucket */ static void put_hash_bucket(struct hash_bucket *bucket, unsigned long *flags)
{ unsigned long __flags = *flags; spin_unlock_irqrestore(&bucket->lock, __flags); }
robutest/uclinux
C++
GPL-2.0
60
/* This ignores the intensely annoying "mapping symbols" found in ARM ELF files: $a, $t and $d. */
static int is_arm_mapping_symbol(const char *str)
/* This ignores the intensely annoying "mapping symbols" found in ARM ELF files: $a, $t and $d. */ static int is_arm_mapping_symbol(const char *str)
{ return str[0] == '$' && strchr("atd", str[1]) && (str[2] == '\0' || str[2] == '.'); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* inc_ep_stats_reqs - Update ep stats counts @ep: physical endpoint @req: usb request @is_in: ep direction (USB_DIR_IN or 0) */
static void inc_ep_stats_reqs(struct pxa_ep *ep, int is_in)
/* inc_ep_stats_reqs - Update ep stats counts @ep: physical endpoint @req: usb request @is_in: ep direction (USB_DIR_IN or 0) */ static void inc_ep_stats_reqs(struct pxa_ep *ep, int is_in)
{ if (is_in) ep->stats.in_ops++; else ep->stats.out_ops++; }
robutest/uclinux
C++
GPL-2.0
60
/* i810_load_regs - loads all registers for the mode */
static void i810_load_regs(struct i810fb_par *par)
/* i810_load_regs - loads all registers for the mode */ static void i810_load_regs(struct i810fb_par *par)
{ u8 __iomem *mmio = par->mmio_start_virtual; i810_screen_off(mmio, OFF); i810_protect_regs(mmio, OFF); i810_dram_off(mmio, OFF); i810_load_pll(par); i810_load_vga(par); i810_load_vgax(par); i810_dram_off(mmio, ON); i810_load_2d(par); i810_hires(mmio); i810_screen_off(mmio, ON); i810_protect_regs(mmio, ON); ...
robutest/uclinux
C++
GPL-2.0
60
/* These functions are used early on before PCI scanning is done and all of the pci_dev and pci_bus structures have been created. */
static struct pci_bus* fake_pci_bus(struct pci_controller *hose, int busnr)
/* These functions are used early on before PCI scanning is done and all of the pci_dev and pci_bus structures have been created. */ static struct pci_bus* fake_pci_bus(struct pci_controller *hose, int busnr)
{ static struct pci_bus bus; if (hose == 0) { printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr); } bus.number = busnr; bus.sysdata = hose; bus.ops = hose? hose->ops: &null_pci_ops; return &bus; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the edit name for the current file. See G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. */
void g_file_info_set_edit_name(GFileInfo *info, const char *edit_name)
/* Sets the edit name for the current file. See G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. */ void g_file_info_set_edit_name(GFileInfo *info, const char *edit_name)
{ static guint32 attr = 0; GFileAttributeValue *value; g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (edit_name != NULL); if (attr == 0) attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME); value = g_file_info_create_value (info, attr); if (value) _g_file_attribute_value_set...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */
void USBD_Connect(BOOL con)
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */ void USBD_Connect(BOOL con)
{ UDPHS->UDPHS_CTRL &= ~UDPHS_CTRL_DETACH; UDPHS->UDPHS_CTRL |= UDPHS_CTRL_PULLD_DIS; } else { UDPHS->UDPHS_CTRL |= UDPHS_CTRL_DETACH; UDPHS->UDPHS_CTRL &= ~UDPHS_CTRL_PULLD_DIS; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Convert a character index (in an UTF-8 text) to byte index. E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long */
static uint32_t lv_text_utf8_get_byte_id(const char *txt, uint32_t utf8_id)
/* Convert a character index (in an UTF-8 text) to byte index. E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long */ static uint32_t lv_text_utf8_get_byte_id(const char *txt, uint32_t utf8_id)
{ uint32_t i; uint32_t byte_cnt = 0; for(i = 0; i < utf8_id && txt[byte_cnt] != '\0'; i++) { uint8_t c_size = _lv_text_encoded_size(&txt[byte_cnt]); byte_cnt += c_size ? c_size : 1; } return byte_cnt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry, and initialize any state variables. Read the Depex from the FV and store it in DriverEntry. Pre-process the Depex to set the Before and After state. The Discovered list is never free'ed and contains booleans that represent the other possi...
EFI_STATUS SmmAddToDriverList(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName)
/* Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry, and initialize any state variables. Read the Depex from the FV and store it in DriverEntry. Pre-process the Depex to set the Before and After state. The Discovered list is never free'ed and contains booleans that represent the other possi...
{ EFI_SMM_DRIVER_ENTRY *DriverEntry; DriverEntry = AllocateZeroPool (sizeof (EFI_SMM_DRIVER_ENTRY)); ASSERT (DriverEntry != NULL); DriverEntry->Signature = EFI_SMM_DRIVER_ENTRY_SIGNATURE; CopyGuid (&DriverEntry->FileName, DriverName); DriverEntry->FvHandle = FvHandle; DriverEntry->Fv ...
tianocore/edk2
C++
Other
4,240
/* Configures system clock after wakeup from STOP mode. */
static void SystemClockConfig_STOP(void)
/* Configures system clock after wakeup from STOP mode. */ static void SystemClockConfig_STOP(void)
{ __HAL_RCC_HSE_CONFIG(RCC_HSE_ON); while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) { } __HAL_RCC_PLL_ENABLE(); while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) { } MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_SYSCLKSOURCE_PLLCLK); while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) { }...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function will disable FDCAN configuration effectively allowing FDCAN to sync up with the bus. After calling this function it is not possible to reconfigure amount of filter rules, yet it is possible to configure rules themselves. FDCAN block operation state can be checked using fdcan_get_init_state. */
int fdcan_start(uint32_t canport, uint32_t timeout)
/* This function will disable FDCAN configuration effectively allowing FDCAN to sync up with the bus. After calling this function it is not possible to reconfigure amount of filter rules, yet it is possible to configure rules themselves. FDCAN block operation state can be checked using fdcan_get_init_state. */ int fdca...
{ if (fdcan_cccr_init_cfg(canport, false, timeout) != 0) { return FDCAN_E_TIMEOUT; } return FDCAN_E_OK; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */
unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */ unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); return (xHWREG(ulBase + SPI_CNTRL2) & SPI_CNTRL2_SLV_START_INTSTS); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enables or Disables the TimeStamp on Tamper Detection Event. */
void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState)
/* Enables or Disables the TimeStamp on Tamper Detection Event. */ void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPTS; } else { RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPTS; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Removes inode from all trees, drops local name cache and removes all queued requests for object removal. */
void pohmelfs_inode_del_inode(struct pohmelfs_sb *psb, struct pohmelfs_inode *pi)
/* Removes inode from all trees, drops local name cache and removes all queued requests for object removal. */ void pohmelfs_inode_del_inode(struct pohmelfs_sb *psb, struct pohmelfs_inode *pi)
{ mutex_lock(&pi->offset_lock); pohmelfs_free_names(pi); mutex_unlock(&pi->offset_lock); dprintk("%s: deleted stuff in ino: %llu.\n", __func__, pi->ino); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the current link status. Retrieve the link speed and duplex status of the link. */
enum phy_status phy_link_status(uint8_t phy)
/* Get the current link status. Retrieve the link speed and duplex status of the link. */ enum phy_status phy_link_status(uint8_t phy)
{ return eth_smi_read(phy, KSZ80X1_CR1) & 0x07; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* The values returned from this function can be passed to the */
uint32_t SysCtlVoltageEventStatus(void)
/* The values returned from this function can be passed to the */ uint32_t SysCtlVoltageEventStatus(void)
{ return(HWREG(SYSCTL_PWRTC)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the Master Mode. This sets the Trigger Output TRGO for synchronizing with slave timers or passing as an internal trigger to the ADC or DAC. */
void timer_set_master_mode(uint32_t timer_peripheral, uint32_t mode)
/* Set the Master Mode. This sets the Trigger Output TRGO for synchronizing with slave timers or passing as an internal trigger to the ADC or DAC. */ void timer_set_master_mode(uint32_t timer_peripheral, uint32_t mode)
{ TIM_CR2(timer_peripheral) &= ~TIM_CR2_MMS_MASK; TIM_CR2(timer_peripheral) |= mode; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* For Td guest TDVMCALL_MMIO is invoked to write MMIO registers. */
UINT16 EFIAPI MmioWrite16(IN UINTN Address, IN UINT16 Value)
/* For Td guest TDVMCALL_MMIO is invoked to write MMIO registers. */ UINT16 EFIAPI MmioWrite16(IN UINTN Address, IN UINT16 Value)
{ BOOLEAN Flag; ASSERT ((Address & 1) == 0); Flag = FilterBeforeMmIoWrite (FilterWidth16, Address, &Value); if (Flag) { MemoryFence (); if (IsTdxGuest ()) { TdMmioWrite16 (Address, Value); } else { *(volatile UINT16 *)Address = Value; } MemoryFence (); } FilterAfterMmIoWrite...
tianocore/edk2
C++
Other
4,240
/* Lookup one of the Gwin values, by index. This is constant-time. */
static void lookup_Gwin(p256_jacobian *T, uint32_t idx)
/* Lookup one of the Gwin values, by index. This is constant-time. */ static void lookup_Gwin(p256_jacobian *T, uint32_t idx)
{ uint32_t xy[18]; uint32_t k; size_t u; memset(xy, 0, sizeof xy); for (k = 0; k < 15; k ++) { uint32_t m; m = -EQ(idx, k + 1); for (u = 0; u < 18; u ++) { xy[u] |= m & Gwin[k][u]; } } memcpy(T->x, &xy[0], sizeof T->x); memcpy(T->y, &xy[9], sizeof T->y); memset(T->z, 0, sizeof T->z); T->z[0] = 1; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Stops the event thread. It sets the termination request and then waits for the termination handshake. */
static void SocketCanStopEventThread(void)
/* Stops the event thread. It sets the termination request and then waits for the termination handshake. */ static void SocketCanStopEventThread(void)
{ bool terminatedCpy = false; UtilCriticalSectionEnter(); eventThreadCtrl.terminate = true; UtilCriticalSectionExit(); while (!terminatedCpy) { UtilCriticalSectionEnter(); terminatedCpy = eventThreadCtrl.terminated; UtilCriticalSectionExit(); UtilTimeDelayMs(10); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Clocks in one byte data via I2C data/clock */
static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
/* Clocks in one byte data via I2C data/clock */ static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
{ s32 status = 0; s32 i; bool bit = 0; for (i = 7; i >= 0; i--) { status = ixgbe_clock_in_i2c_bit(hw, &bit); *data |= bit << i; if (status != 0) break; } return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute read call back for the Long descriptor V2D3 attribute. */
static ssize_t read_long_des_v2d3_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Long descriptor V2D3 attribute. */ static ssize_t read_long_des_v2d3_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(long_des_v2d3_1_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Register the Service A and all its Characteristics... */
void service_a_2_init(void)
/* Register the Service A and all its Characteristics... */ void service_a_2_init(void)
{ bt_gatt_service_register(&service_a_2_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* dissect a bencoded string from tvb, start at offset. it's like "5:abcde" *result will be the decoded value */
static int dissect_bencoded_string(tvbuff_t *tvb, packet_info _U_ *pinfo, proto_tree *tree, guint offset, const char **result, gboolean tohex, const char *label)
/* dissect a bencoded string from tvb, start at offset. it's like "5:abcde" *result will be the decoded value */ static int dissect_bencoded_string(tvbuff_t *tvb, packet_info _U_ *pinfo, proto_tree *tree, guint offset, const char **result, gboolean tohex, const char *label)
{ guint string_len; string_len = bencoded_string_length(tvb, &offset); if( tohex ) *result = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, string_len ); else *result = tvb_get_string_enc( wmem_packet_scope(), tvb, offset, string_len , ENC_ASCII); proto_tree_add_string_format( tree, hf_bencoded_st...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disables SIR (IrDA) mode on the specified UART. */
void xUARTIrDADisable(unsigned long ulBase)
/* Disables SIR (IrDA) mode on the specified UART. */ void xUARTIrDADisable(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + UART_FUN_SEL) &= ~(UART_FUN_SEL_IRDA_EN); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The function is used to return if the provided JSON value contains a FALSE value. */
BOOLEAN EFIAPI JsonValueIsFalse(IN EDKII_JSON_VALUE Json)
/* The function is used to return if the provided JSON value contains a FALSE value. */ BOOLEAN EFIAPI JsonValueIsFalse(IN EDKII_JSON_VALUE Json)
{ if (json_is_false ((json_t *)Json)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Sets the window manager icon for the display window. */
void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask)
/* Sets the window manager icon for the display window. */ void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask)
{ SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; if ( icon && video->SetIcon ) { if ( mask == NULL ) { int mask_len = icon->h*(icon->w+7)/8; int flags = 0; mask = (Uint8 *)SDL_malloc(mask_len); if ( mask == NULL ) { return; } SDL_memset(mask, ~0, mask_len); ...
DC-SWAT/DreamShell
C++
null
404
/* Check if USART is ready to send next byte. */
bool _usart_async_is_byte_sent(const struct _usart_async_device *const device)
/* Check if USART is ready to send next byte. */ bool _usart_async_is_byte_sent(const struct _usart_async_device *const device)
{ ASSERT(device); return hri_usart_get_US_CSR_TXRDY_bit(device->hw); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* DMA - Mapping and unmapping for the "type1" IOMMU interface used on x86 */
static int vfio_dma_unmap(VFIOContainer *container, hwaddr iova, ram_addr_t size)
/* DMA - Mapping and unmapping for the "type1" IOMMU interface used on x86 */ static int vfio_dma_unmap(VFIOContainer *container, hwaddr iova, ram_addr_t size)
{ struct vfio_iommu_type1_dma_unmap unmap = { .argsz = sizeof(unmap), .flags = 0, .iova = iova, .size = size, }; if (ioctl(container->fd, VFIO_IOMMU_UNMAP_DMA, &unmap)) { DPRINTF("VFIO_UNMAP_DMA: %d\n", -errno); return -errno; } return 0; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Checks to see if an effect is valid. */
static int ValidEffect(SDL_Haptic *haptic, int effect)
/* Checks to see if an effect is valid. */ static int ValidEffect(SDL_Haptic *haptic, int effect)
{ if ((effect < 0) || (effect >= haptic->neffects)) { SDL_SetError("Haptic: Invalid effect identifier."); return 0; } return 1; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Need to reference count these triggers and only enable gpio interrupts as appropriate. */
static irqreturn_t iio_gpio_trigger_poll(int irq, void *private)
/* Need to reference count these triggers and only enable gpio interrupts as appropriate. */ static irqreturn_t iio_gpio_trigger_poll(int irq, void *private)
{ iio_trigger_poll(private); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Called by hardware driver to unregister itself from the CAPI subsystem. */
void unregister_capi_driver(struct capi_driver *driver)
/* Called by hardware driver to unregister itself from the CAPI subsystem. */ void unregister_capi_driver(struct capi_driver *driver)
{ unsigned long flags; write_lock_irqsave(&capi_drivers_list_lock, flags); list_del(&driver->list); write_unlock_irqrestore(&capi_drivers_list_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to Unlock protected registers. */
xtBoolean SysCtlKeyAddrUnlock(void)
/* The function is used to Unlock protected registers. */ xtBoolean SysCtlKeyAddrUnlock(void)
{ while(xHWREG(GCR_REGLOCK) != 0x01){ xHWREG(GCR_REGLOCK) = 0x59; xHWREG(GCR_REGLOCK) = 0x16; xHWREG(GCR_REGLOCK) = 0x88; } return 1; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get the packet wait bound timer for this driver/device. The packet wait bound is used during interrupt coalescing to trigger an interrupt when not enough packets have been received to reach the packet count threshold. A packet is a generic term used by the scatter-gather DMA engine, and is equivalent to an Ethernet ...
XStatus XEmac_GetPktWaitBound(XEmac *InstancePtr, u32 Direction, u32 *WaitPtr)
/* Get the packet wait bound timer for this driver/device. The packet wait bound is used during interrupt coalescing to trigger an interrupt when not enough packets have been received to reach the packet count threshold. A packet is a generic term used by the scatter-gather DMA engine, and is equivalent to an Ethernet ...
{ XASSERT_NONVOID(InstancePtr != NULL); XASSERT_NONVOID(Direction == XEM_SEND || Direction == XEM_RECV); XASSERT_NONVOID(WaitPtr != NULL); XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); if (!XEmac_mIsSgDma(InstancePtr)) { return XST_NOT_SGDMA; } switch (Direction) { case XEM_SEND: *WaitPtr = ...
EmcraftSystems/u-boot
C++
Other
181
/* Normally, this would free the DRM device associated with @dev, along with cleaning up any other stuff. But we do that in the DRM core, so this function can just return and hope that the core does its job. */
static void drm_sysfs_device_release(struct device *dev)
/* Normally, this would free the DRM device associated with @dev, along with cleaning up any other stuff. But we do that in the DRM core, so this function can just return and hope that the core does its job. */ static void drm_sysfs_device_release(struct device *dev)
{ memset(dev, 0, sizeof(struct device)); return; }
robutest/uclinux
C++
GPL-2.0
60
/* If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSha1HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
/* If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceSha1HashAll(IN CONST VOID *Data, IN UINTN DataSize, OUT UINT8 *HashValue)
{ return CALL_BASECRYPTLIB (Sha1.Services.HashAll, Sha1HashAll, (Data, DataSize, HashValue), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Note, multiple disables will need the same number of enables to truely enable the writing (much like preempt_disable). */
void ring_buffer_record_enable(struct ring_buffer *buffer)
/* Note, multiple disables will need the same number of enables to truely enable the writing (much like preempt_disable). */ void ring_buffer_record_enable(struct ring_buffer *buffer)
{ atomic_dec(&buffer->record_disabled); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* 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 GPIOPinTypeLPC(uint32_t ui32Port, uint8_t ui8Pins)
/* 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 GPIOPinTypeLPC(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* AT&T GIS (nee NCR) WaveLAN card: An Ethernet-like radio transceiver controlled by an Intel 82586 coprocessor. Subroutines which won't fit in one of the following category (WaveLAN modem or i82586) Translate irq number to PSA irq parameter */
static u8 wv_irq_to_psa(int irq)
/* AT&T GIS (nee NCR) WaveLAN card: An Ethernet-like radio transceiver controlled by an Intel 82586 coprocessor. Subroutines which won't fit in one of the following category (WaveLAN modem or i82586) Translate irq number to PSA irq parameter */ static u8 wv_irq_to_psa(int irq)
{ if (irq < 0 || irq >= ARRAY_SIZE(irqvals)) return 0; return irqvals[irq]; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns %0 on success and a negative error code on failure. */
static int free_idx_lebs(struct ubifs_info *c)
/* This function returns %0 on success and a negative error code on failure. */ static int free_idx_lebs(struct ubifs_info *c)
{ int err; err = free_unused_idx_lebs(c); kfree(c->ilebs); c->ilebs = NULL; return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Used by a driver to check whether a VIO device present in the system is in its list of supported devices. Returns the matching vio_device_id structure or NULL if there is no match. */
static const struct vio_device_id* vio_match_device(const struct vio_device_id *ids, const struct vio_dev *dev)
/* Used by a driver to check whether a VIO device present in the system is in its list of supported devices. Returns the matching vio_device_id structure or NULL if there is no match. */ static const struct vio_device_id* vio_match_device(const struct vio_device_id *ids, const struct vio_dev *dev)
{ while (ids->type[0] != '\0') { if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) && of_device_is_compatible(dev->dev.archdata.of_node, ids->compat)) return ids; ids++; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configure the TIMER commutation event sequence with interrupt. */
void ald_timer_com_event_config_it(ald_timer_handle_t *hperh, ald_timer_ts_t ts, type_func_t trgi)
/* Configure the TIMER commutation event sequence with interrupt. */ void ald_timer_com_event_config_it(ald_timer_handle_t *hperh, ald_timer_ts_t ts, type_func_t trgi)
{ ald_timer_com_event_config(hperh, ts, trgi); ald_timer_interrupt_config(hperh, ALD_TIMER_IT_COM, ENABLE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read sensor data. This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
static bool sfh5712_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data)
/* Read sensor data. This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */ static bool sfh5712_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data)
{ sensor_hal_t *const hal = sensor->hal; switch (type) { case SENSOR_READ_LIGHT: return sfh5712_get_light(hal, data); case SENSOR_READ_ID: return sfh5712_device_id(hal, data); default: sensor->err = SENSOR_ERR_FUNCTION; return false; } }
memfault/zero-to-main
C++
null
200
/* ep0_idle - Put control endpoint into idle state @dev: udc device */
static void ep0_idle(struct pxa_udc *dev)
/* ep0_idle - Put control endpoint into idle state @dev: udc device */ static void ep0_idle(struct pxa_udc *dev)
{ set_ep0state(dev, WAIT_FOR_SETUP); }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves the clock frequency of a Generic Clock channel. Determines the clock frequency (in Hz) of a specified Generic Clock channel, used as a source to a device peripheral module. */
uint32_t system_gclk_chan_get_hz(const uint8_t channel)
/* Retrieves the clock frequency of a Generic Clock channel. Determines the clock frequency (in Hz) of a specified Generic Clock channel, used as a source to a device peripheral module. */ uint32_t system_gclk_chan_get_hz(const uint8_t channel)
{ uint8_t gen_id; system_interrupt_enter_critical_section(); gen_id = GCLK->PCHCTRL[channel].bit.GEN; system_interrupt_leave_critical_section(); return system_gclk_gen_get_hz(gen_id); }
memfault/zero-to-main
C++
null
200
/* This function releases all the resources allocated for the I2C device. */
VOID ReleaseI2cDeviceContext(IN I2C_DEVICE_CONTEXT *I2cDeviceContext)
/* This function releases all the resources allocated for the I2C device. */ VOID ReleaseI2cDeviceContext(IN I2C_DEVICE_CONTEXT *I2cDeviceContext)
{ if (I2cDeviceContext == NULL) { return; } if (I2cDeviceContext->DevicePath != NULL) { FreePool (I2cDeviceContext->DevicePath); } FreePool (I2cDeviceContext); }
tianocore/edk2
C++
Other
4,240
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_filter_length(mss_uart_instance_t *this_uart, mss_uart_filter_length_t length)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_set_filter_length(mss_uart_instance_t *this_uart, mss_uart_filter_length_t length)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); ASSERT(MSS_UART_INVALID_FILTER_LENGTH > length); if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && (MSS_UART_INVALID_FILTER_LENGTH > length)) { this_uart->hw_reg->GFR = (uint8_t)length; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write a script into a given PWM engine, concluding with PWM_END. If 'kill' is nonzero, the engine will be shut down at the end of the script, producing a zero output. Otherwise the engine will be kept running at the final PWM level indefinitely. */
static void lm8323_write_pwm(struct lm8323_pwm *pwm, int kill, int len, const u16 *cmds)
/* Write a script into a given PWM engine, concluding with PWM_END. If 'kill' is nonzero, the engine will be shut down at the end of the script, producing a zero output. Otherwise the engine will be kept running at the final PWM level indefinitely. */ static void lm8323_write_pwm(struct lm8323_pwm *pwm, int kill, int ...
{ int i; for (i = 0; i < len; i++) lm8323_write_pwm_one(pwm, i, cmds[i]); lm8323_write_pwm_one(pwm, i++, PWM_END(kill)); lm8323_write(pwm->chip, 2, LM8323_CMD_START_PWM, pwm->id); pwm->running = true; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 1 if the given MCI transfer is complete; otherwise returns 0. */
unsigned char MCI_IsTxComplete(MciCmd *pCommand)
/* Returns 1 if the given MCI transfer is complete; otherwise returns 0. */ unsigned char MCI_IsTxComplete(MciCmd *pCommand)
{ if (pCommand->status != MCI_STATUS_PENDING) { if (pCommand->status != 0) printf("MCI_IsTxComplete %d\n\r", pCommand->status); return 1; } else { return 0; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables forwarding of control frames. When set forwards all the control frames (incl. unicast and multicast PAUSE frames). */
void synopGMAC_set_pass_control(synopGMACdevice *gmacdev, u32 passcontrol)
/* Enables forwarding of control frames. When set forwards all the control frames (incl. unicast and multicast PAUSE frames). */ void synopGMAC_set_pass_control(synopGMACdevice *gmacdev, u32 passcontrol)
{ u32 data; data = synopGMACReadReg(gmacdev -> MacBase, GmacFrameFilter); data &= (~GmacPassControl); data |= passcontrol; synopGMACWriteReg(gmacdev -> MacBase, GmacFrameFilter, data); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Specifically, this function calculates the number of bytes that may be written to a given */
static size_t spair_write_avail(struct spair *spair)
/* Specifically, this function calculates the number of bytes that may be written to a given */ static size_t spair_write_avail(struct spair *spair)
{ struct spair *const remote = z_get_fd_obj(spair->remote, (const struct fd_op_vtable *)&spair_fd_op_vtable, 0); if (remote == NULL) { return 0; } return k_pipe_write_avail(&remote->recv_q); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* @regs: HDA registers @nid: Parent node ID to check @num_sub_nodesp: Returns number of subnodes @start_sub_node_nidp: Returns start subnode number */
static int get_subnode_info(struct hda_regs *regs, uint nid, uint *num_sub_nodesp, uint *start_sub_node_nidp)
/* @regs: HDA registers @nid: Parent node ID to check @num_sub_nodesp: Returns number of subnodes @start_sub_node_nidp: Returns start subnode number */ static int get_subnode_info(struct hda_regs *regs, uint nid, uint *num_sub_nodesp, uint *start_sub_node_nidp)
{ uint response; int ret; ret = exec_verb(regs, hda_verb(nid, HDA_VERB_GET_PARAMS, GET_PARAMS_NODE_COUNT), &response); if (ret < 0) { printf("Audio: Error reading sub-node info %d\n", nid); return ret; } *num_sub_nodesp = (response & NUM_SUB_NODES_M) >> NUM_SUB_NODES_S; *start_sub_node_nidp = (...
4ms/stm32mp1-baremetal
C++
Other
137
/* Log block pointer fields from a btree block (nonleaf). */
STATIC void xfs_btree_log_ptrs(struct xfs_btree_cur *cur, struct xfs_buf *bp, int first, int last)
/* Log block pointer fields from a btree block (nonleaf). */ STATIC void xfs_btree_log_ptrs(struct xfs_btree_cur *cur, struct xfs_buf *bp, int first, int last)
{ XFS_BTREE_TRACE_CURSOR(cur, XBT_ENTRY); XFS_BTREE_TRACE_ARGBII(cur, bp, first, last); if (bp) { struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); int level = xfs_btree_get_level(block); xfs_trans_log_buf(cur->bc_tp, bp, xfs_btree_ptr_offset(cur, first, level), xfs_btree_ptr_offset(cur, last + 1...
robutest/uclinux
C++
GPL-2.0
60
/* This object's fields are read-from when used by */
CaptureInfoConst* push_CaptureInfoConst(lua_State *L, wtap_dumper *wdh)
/* This object's fields are read-from when used by */ CaptureInfoConst* push_CaptureInfoConst(lua_State *L, wtap_dumper *wdh)
{ luaL_error(L, "Internal error: wdh is NULL!"); return NULL; } f = (CaptureInfoConst) g_malloc0(sizeof(struct _wslua_captureinfo)); f->wth = NULL; f->wdh = wdh; f->expired = FALSE; return pushCaptureInfoConst(L,f); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reads the value of the an area end address. */
int32_t ST25DV_ReadEndZonex(ST25DV_Object_t *pObj, const ST25DV_END_ZONE EndZone, uint8_t *pEndZ)
/* Reads the value of the an area end address. */ int32_t ST25DV_ReadEndZonex(ST25DV_Object_t *pObj, const ST25DV_END_ZONE EndZone, uint8_t *pEndZ)
{ int32_t status; switch( EndZone ) { case ST25DV_ZONE_END1: status = st25dv_get_enda1(&(pObj->Ctx),pEndZ); break; case ST25DV_ZONE_END2: status = st25dv_get_enda2(&(pObj->Ctx),pEndZ); break; case ST25DV_ZONE_END3: status = st25dv_get_enda3(&(pObj->Ctx),pEndZ); bre...
eclipse-threadx/getting-started
C++
Other
310
/* This function is called when an aborted FCP iocb completes. This function is called by the ring event handler with no lock held. This function frees the iocb. */
void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb)
/* This function is called when an aborted FCP iocb completes. This function is called by the ring event handler with no lock held. This function frees the iocb. */ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb)
{ lpfc_sli_release_iocbq(phba, cmdiocb); return; }
robutest/uclinux
C++
GPL-2.0
60
/* FSM start address register (r/w). First available address is 0x033C.. */
int32_t lsm6dso_fsm_start_address_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
/* FSM start address register (r/w). First available address is 0x033C.. */ int32_t lsm6dso_fsm_start_address_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; uint8_t index; index = 0x00U; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_FSM_START_ADD_L, buff); if (ret == 0) { index++; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_FSM_START_ADD_H, buff); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* CME protocol: like the standard protocol, but SysEx commands are sent as a single USB packet preceded by a 0x0F byte. */
static void snd_usbmidi_cme_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length)
/* CME protocol: like the standard protocol, but SysEx commands are sent as a single USB packet preceded by a 0x0F byte. */ static void snd_usbmidi_cme_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length)
{ if (buffer_length < 2 || (buffer[0] & 0x0f) != 0x0f) snd_usbmidi_standard_input(ep, buffer, buffer_length); else snd_usbmidi_input_data(ep, buffer[0] >> 4, &buffer[1], buffer_length - 1); }
robutest/uclinux
C++
GPL-2.0
60
/* This function writes buttons that can be disabled to @buf. If @only_disabled is true, then @buf contains only those buttons that are currently disabled. Returns 0 on success or negative errno on failure. */
static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata, char *buf, unsigned int type, bool only_disabled)
/* This function writes buttons that can be disabled to @buf. If @only_disabled is true, then @buf contains only those buttons that are currently disabled. Returns 0 on success or negative errno on failure. */ static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata, char *buf, unsigned int type, bool...
{ int n_events = get_n_events_by_type(type); unsigned long *bits; ssize_t ret; int i; bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL); if (!bits) return -ENOMEM; for (i = 0; i < ddata->n_buttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->type != type) ...
robutest/uclinux
C++
GPL-2.0
60
/* param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz. */
uint32_t SPDIF_GetRxSampleRate(SPDIF_Type *base, uint32_t clockSourceFreq_Hz)
/* param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz. */ uint32_t SPDIF_GetRxSampleRate(SPDIF_Type *base, uint32_t clockSourceFreq_Hz)
{ uint32_t gain = s_spdif_gain[((base->SRPC & SPDIF_SRPC_GAINSEL_MASK) >> SPDIF_SRPC_GAINSEL_SHIFT)]; uint32_t measure = 0, sampleRate = 0; uint64_t temp = 0; while ((base->SRPC & SPDIF_SRPC_LOCK_MASK) == 0U) { } measure = base->SRFM; temp = (uint64_t)measure * (uint64_t)clockSourceFreq_...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Release reference to lock_state, and free it if we see that it is no longer in use */
void nfs4_put_lock_state(struct nfs4_lock_state *lsp)
/* Release reference to lock_state, and free it if we see that it is no longer in use */ void nfs4_put_lock_state(struct nfs4_lock_state *lsp)
{ struct nfs4_state *state; if (lsp == NULL) return; state = lsp->ls_state; if (!atomic_dec_and_lock(&lsp->ls_count, &state->state_lock)) return; list_del(&lsp->ls_locks); if (list_empty(&state->lock_states)) clear_bit(LK_STATE_IN_USE, &state->flags); spin_unlock(&state->state_lock); nfs4_free_lock_state(...
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciSegmentRead16(IN UINT64 Address)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciSegmentRead16(IN UINT64 Address)
{ ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); return (UINT16)PeiPciSegmentLibPciCfg2ReadWorker (Address, EfiPeiPciCfgWidthUint16); }
tianocore/edk2
C++
Other
4,240
/* nilfs_flush_segment - trigger a segment construction for resource control @sb: super block @ino: inode number of the file to be flushed out. */
void nilfs_flush_segment(struct super_block *sb, ino_t ino)
/* nilfs_flush_segment - trigger a segment construction for resource control @sb: super block @ino: inode number of the file to be flushed out. */ void nilfs_flush_segment(struct super_block *sb, ino_t ino)
{ struct nilfs_sb_info *sbi = NILFS_SB(sb); struct nilfs_sc_info *sci = NILFS_SC(sbi); if (!sci || nilfs_doing_construction()) return; nilfs_segctor_do_flush(sci, NILFS_MDT_INODE(sb, ino) ? ino : 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Device selection hook. If necessary perform clock switching */
static void it821x_passthru_dev_select(struct ata_port *ap, unsigned int device)
/* Device selection hook. If necessary perform clock switching */ static void it821x_passthru_dev_select(struct ata_port *ap, unsigned int device)
{ struct it821x_dev *itdev = ap->private_data; if (itdev && device != itdev->last_device) { struct ata_device *adev = &ap->link.device[device]; it821x_program(ap, adev, itdev->pio[adev->devno]); itdev->last_device = device; } ata_sff_dev_select(ap, device); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Unregisters callback for the specified callback type. When called, the currently registered callback for the given callback type will be removed. */
enum status_code rtc_count_unregister_callback(struct rtc_module *const module, enum rtc_count_callback callback_type)
/* Unregisters callback for the specified callback type. When called, the currently registered callback for the given callback type will be removed. */ enum status_code rtc_count_unregister_callback(struct rtc_module *const module, enum rtc_count_callback callback_type)
{ enum status_code status = STATUS_OK; if (callback_type == RTC_COUNT_CALLBACK_OVERFLOW) { status = STATUS_OK; } else { switch (module->mode) { case RTC_COUNT_MODE_32BIT: if (callback_type > RTC_NUM_OF_COMP32) { status = STATUS_ERR_INVALID_ARG; } break; case RTC_COUNT_MODE_16BIT: if (callback...
memfault/zero-to-main
C++
null
200
/* Returns true if seq1 is later than seq2. */
bool i915_seqno_passed(uint32_t seq1, uint32_t seq2)
/* Returns true if seq1 is later than seq2. */ bool i915_seqno_passed(uint32_t seq1, uint32_t seq2)
{ return (int32_t)(seq1 - seq2) >= 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets or clears the selected data port bit. */
void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
/* Sets or clears the selected data port bit. */ void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
{ assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); assert_param(IS_GPIO_BIT_ACTION(BitVal)); if (BitVal != Bit_RESET) { GPIOx->BSRR = GPIO_Pin; } else { GPIOx->BRR = GPIO_Pin; } }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* dram_init - sets uboots idea of sdram size */
int dram_init(void)
/* dram_init - sets uboots idea of sdram size */ int dram_init(void)
{ gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Return the thread ID of the current running thread. */
osThreadId svcThreadGetId(void)
/* Return the thread ID of the current running thread. */ osThreadId svcThreadGetId(void)
{ return NULL; } return (P_TCB)os_active_TCB[tsk - 1U]; }
labapart/polymcu
C++
null
201
/* Setup buffers and pointers that address the CDB. */
static int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)
/* Setup buffers and pointers that address the CDB. */ static int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)
{ memcpy(cp->cdb_buf, cmd->cmnd, cmd->cmd_len); cp->phys.cmd.addr = CCB_BA(cp, cdb_buf[0]); cp->phys.cmd.size = cpu_to_scr(cmd->cmd_len); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Receive interrupt vectors for a Z8530 that is in 'parked' mode. For machines with PCI Z85x30 cards, or level triggered interrupts (eg the MacII) we must clear the interrupt cause or die. */
static void z8530_rx_clear(struct z8530_channel *c)
/* Receive interrupt vectors for a Z8530 that is in 'parked' mode. For machines with PCI Z85x30 cards, or level triggered interrupts (eg the MacII) we must clear the interrupt cause or die. */ static void z8530_rx_clear(struct z8530_channel *c)
{ u8 stat; read_zsdata(c); stat=read_zsreg(c, R1); if(stat&END_FR) write_zsctrl(c, RES_Rx_CRC); write_zsctrl(c, ERR_RES); write_zsctrl(c, RES_H_IUS); }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns current cipher suite used by the specified TLS connection. */
EFI_STATUS EFIAPI TlsGetCurrentCipher(IN VOID *Tls, IN OUT UINT16 *CipherId)
/* This function returns current cipher suite used by the specified TLS connection. */ EFI_STATUS EFIAPI TlsGetCurrentCipher(IN VOID *Tls, IN OUT UINT16 *CipherId)
{ CALL_CRYPTO_SERVICE (TlsGetCurrentCipher, (Tls, CipherId), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */
void PWMA_CMP2_IRQHandler(void)
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */ void PWMA_CMP2_IRQHandler(void)
{ PWM_HAL_ClearCmpFlags(g_pwmBase[0];, 2U, 0x3fU); }
remotemcu/remcu-chip-sdks
C++
null
436
/* vpif_get_default_field() - Get default field type based on interface @vpif_params - ptr to vpif params */
static enum v4l2_field vpif_get_default_field(struct vpif_interface *iface)
/* vpif_get_default_field() - Get default field type based on interface @vpif_params - ptr to vpif params */ static enum v4l2_field vpif_get_default_field(struct vpif_interface *iface)
{ return (iface->if_type == VPIF_IF_RAW_BAYER) ? V4L2_FIELD_NONE : V4L2_FIELD_INTERLACED; }
robutest/uclinux
C++
GPL-2.0
60
/* Write 8 bytes to Trace Hub MMIO addr + 0x18. */
VOID EFIAPI MipiSystWriteD64Mts(IN VOID *MipiSystHandle, IN UINT64 Data)
/* Write 8 bytes to Trace Hub MMIO addr + 0x18. */ VOID EFIAPI MipiSystWriteD64Mts(IN VOID *MipiSystHandle, IN UINT64 Data)
{ MIPI_SYST_HANDLE *MipiSystH; MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle; MmioWrite64 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x18), Data); }
tianocore/edk2
C++
Other
4,240
/* Reads the current settings for the CAN controller bit timing. */
void CANBitTimingGet(uint32_t ui32Base, tCANBitClkParms *psClkParms)
/* Reads the current settings for the CAN controller bit timing. */ void CANBitTimingGet(uint32_t ui32Base, tCANBitClkParms *psClkParms)
{ uint32_t ui32BitReg; ASSERT(_CANBaseValid(ui32Base)); ASSERT(psClkParms); ui32BitReg = HWREG(ui32Base + CAN_O_BIT); psClkParms->ui32Phase2Seg = ((ui32BitReg & CAN_BIT_TSEG2_M) >> CAN_BIT_TSEG2_S) + 1; psClkParms->ui32SyncPropPhase1Seg = ((ui32BitReg & CAN_BIT_TSEG1_M) >> CAN_BI...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Reads the NVM Initialization Control Word 2 and returns true (>0) if any manageability is enabled, else false (0). */
static bool e1000_check_mng_mode_82574(struct e1000_hw *hw)
/* Reads the NVM Initialization Control Word 2 and returns true (>0) if any manageability is enabled, else false (0). */ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw)
{ u16 data; e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Register the Service B.1 and all its Characteristics... */
void service_b_1_3_init(void)
/* Register the Service B.1 and all its Characteristics... */ void service_b_1_3_init(void)
{ bt_gatt_service_register(&service_b_1_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Init the DMA channel Interrupt Callback function. param of pfnCallback */
void DMAChannelIntCallbackInit(unsigned long ulChannelID, xtEventCallback pfnCallback)
/* Init the DMA channel Interrupt Callback function. param of pfnCallback */ void DMAChannelIntCallbackInit(unsigned long ulChannelID, xtEventCallback pfnCallback)
{ int i = 0; xASSERT(xDMAChannelIDValid(ulChannelID)); for(i = 0; g_psDMAChannelAssignTable[i].ulChannelID != xDMA_CHANNEL_NOT_EXIST; i++) { if(g_psDMAChannelAssignTable[i].ulChannelID == ulChannelID) { g_psDMAChannelAssignTable[i].pfnDMAChannelHandlerCallback = pfnCallback; ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get a character on default the stream (match standard API). */
int sl_getchar_std_wrapper(void)
/* Get a character on default the stream (match standard API). */ int sl_getchar_std_wrapper(void)
{ char c; sl_status_t status = sl_getchar(&c); if (status == SL_STATUS_OK) { return (int)c; } else { return -1; } }
eclipse-threadx/getting-started
C++
Other
310
/* Enables SIR (IrDA) mode on the specified UART. */
void UARTEnableIrDA(unsigned long ulBase)
/* Enables SIR (IrDA) mode on the specified UART. */ void UARTEnableIrDA(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + UART_FUN_SEL) |= (UART_FUN_SEL_IRDA_EN); xHWREG(ulBase + UART_FUN_SEL) &= ~(UART_FUN_SEL_LIN_EN); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* First base on the user input language to search, second base on the current platform used language to search, third get the first language from the support language list. The caller need to free the buffer of the best language. */
CHAR8* EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CHAR8 *InputLanguage, IN BOOLEAN Iso639Language)
/* First base on the user input language to search, second base on the current platform used language to search, third get the first language from the support language list. The caller need to free the buffer of the best language. */ CHAR8* EFIAPI GetBestLanguageForDriver(IN CONST CHAR8 *SupportedLanguages, IN CONST CH...
{ CHAR8 *LanguageVariable; CHAR8 *BestLanguage; GetVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid, (VOID **)&LanguageVariable, NULL); BestLanguage = GetBestLanguage ( SupportedLanguages, Iso639Language, (InputLanguage != ...
tianocore/edk2
C++
Other
4,240
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM5) { __HAL_RCC_TIM5_CLK_ENABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_ENABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_ENABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* A partial UnAlloc must include the last BD in the list that was Alloc'd. */
LONG XEmacPs_BdRingUnAlloc(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd *BdSetPtr)
/* A partial UnAlloc must include the last BD in the list that was Alloc'd. */ LONG XEmacPs_BdRingUnAlloc(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd *BdSetPtr)
{ LONG Status; (void) BdSetPtr; Xil_AssertNonvoid(RingPtr != NULL); Xil_AssertNonvoid(BdSetPtr != NULL); if (RingPtr->PreCnt < NumBd) { Status = (LONG)(XST_FAILURE); } else { XEMACPS_RING_SEEKBACK(RingPtr, (RingPtr->FreeHead), NumBd); RingPtr->FreeCnt += NumBd; RingPtr->PreCnt -= NumBd; Status = (LONG)(XS...
ua1arn/hftrx
C++
null
69
/* Ascii internet address interpretation routine. The value returned is in network order. */
in_addr_t netdev_ipaddr_addr(const char *cp)
/* Ascii internet address interpretation routine. The value returned is in network order. */ in_addr_t netdev_ipaddr_addr(const char *cp)
{ ip4_addr_t val; if (netdev_ip4addr_aton(cp, &val)) { return ip4_addr_get_u32(&val); } return (IPADDR_NONE); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Sets the correct weekday. If the time is never set then the device defaults to 1st January 1970 but with the wrong weekday set. This function ensures the weekday is correct in this case. */
static int set_day_of_week(const struct device *dev, time_t *unix_time)
/* Sets the correct weekday. If the time is never set then the device defaults to 1st January 1970 but with the wrong weekday set. This function ensures the weekday is correct in this case. */ static int set_day_of_week(const struct device *dev, time_t *unix_time)
{ struct mcp7940n_data *data = dev->data; struct tm time_buffer = { 0 }; int rc = 0; if (gmtime_r(unix_time, &time_buffer) != NULL) { data->registers.rtc_weekday.weekday = time_buffer.tm_wday; rc = write_register(dev, REG_RTC_WDAY, *((uint8_t *)(&data->registers.rtc_weekday))); } else { rc = -EINVAL; } ...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* INTERFACE: PRT COMP function used to register with MAINT adapter or log in compatibility mode in case older driver version is connected too */
void diva_maint_prtComp(char *format,...)
/* INTERFACE: PRT COMP function used to register with MAINT adapter or log in compatibility mode in case older driver version is connected too */ void diva_maint_prtComp(char *format,...)
{ hDbg = va_arg(ap, void *); DI_register (hDbg); } va_end (ap); }
robutest/uclinux
C++
GPL-2.0
60
/* Extracts MAC and product information from the VPD. */
static int vpd_callback(struct vpd_cache *vpd, u8 id, u8 version, u8 type, size_t size, u8 const *data)
/* Extracts MAC and product information from the VPD. */ static int vpd_callback(struct vpd_cache *vpd, u8 id, u8 version, u8 type, size_t size, u8 const *data)
{ if (id == VPD_BLOCK_HWID && version == 1 && type != VPD_TYPE_INVALID && size >= 1) { vpd->product_id = data[0]; } else if (id == VPD_BLOCK_NETWORK && version == 1 && type != VPD_TYPE_INVALID) { if (size >= 6) { vpd->has |= VPD_HAS_MAC1; memcpy(vpd->mac1, data, VPD_MAC_ADDRESS_LENGTH); } if (...
4ms/stm32mp1-baremetal
C++
Other
137
/* Encode post-operation attributes. The inode may be NULL if the call failed because of a stale file handle. In this case, no attributes are returned. */
static __be32* encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
/* Encode post-operation attributes. The inode may be NULL if the call failed because of a stale file handle. In this case, no attributes are returned. */ static __be32* encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
{ struct dentry *dentry = fhp->fh_dentry; if (dentry && dentry->d_inode) { int err; struct kstat stat; err = vfs_getattr(fhp->fh_export->ex_path.mnt, dentry, &stat); if (!err) { *p++ = xdr_one; lease_get_mtime(dentry->d_inode, &stat.mtime); return encode_fattr3(rqstp, p, fhp, &stat); } } *...
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to the device. param mask status flag The parameter can be any combination of the following values: arg kFLEXIO_CAMERA_RxDataRegFullFlag arg kFLEXIO_CAMERA_RxErrorFlag */
void FLEXIO_CAMERA_ClearStatusFlags(FLEXIO_CAMERA_Type *base, uint32_t mask)
/* param base Pointer to the device. param mask status flag The parameter can be any combination of the following values: arg kFLEXIO_CAMERA_RxDataRegFullFlag arg kFLEXIO_CAMERA_RxErrorFlag */ void FLEXIO_CAMERA_ClearStatusFlags(FLEXIO_CAMERA_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_CAMERA_RxDataRegFullFlag) { FLEXIO_ClearShifterStatusFlags(base->flexioBase, ((1U << (base->shifterCount)) - 1U) << (base->shifterStartIdx)); } if (mask & kFLEXIO_CAMERA_RxErrorFlag) { FLEXIO_ClearShift...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This service switches the requested AP to be the BSP since the next SMI. */
EFI_STATUS EFIAPI SmmSwitchBsp(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber)
/* This service switches the requested AP to be the BSP since the next SMI. */ EFI_STATUS EFIAPI SmmSwitchBsp(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber)
{ if (ProcessorNumber >= mMaxNumberOfCpus) { return EFI_INVALID_PARAMETER; } if (gSmmCpuPrivate->ProcessorInfo[ProcessorNumber].ProcessorId == INVALID_APIC_ID) { return EFI_NOT_FOUND; } if ((gSmmCpuPrivate->Operation[ProcessorNumber] != SmmCpuNone) || (gSmst->CurrentlyExecutingCpu == ProcessorNu...
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciRead16(IN UINTN Address)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciRead16(IN UINTN Address)
{ return mRunningOnQ35 ? PciExpressRead16 (Address) : PciCf8Read16 (Address); }
tianocore/edk2
C++
Other
4,240
/* There is actual brightness control in the hardware, but it is via smbus commands and not implemented in this driver. */
static void nasgpio_led_set_brightness(struct led_classdev *led_cdev, enum led_brightness brightness)
/* There is actual brightness control in the hardware, but it is via smbus commands and not implemented in this driver. */ static void nasgpio_led_set_brightness(struct led_classdev *led_cdev, enum led_brightness brightness)
{ u32 setting = 0; if (brightness >= LED_HALF) setting = 1; spin_lock(&nasgpio_gpio_lock); if (brightness == 0) __nasgpio_led_set_attr(led_cdev, GPO_BLINK, 0); __nasgpio_led_set_attr(led_cdev, GP_LVL, setting); spin_unlock(&nasgpio_gpio_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: FALSE if the plugin needed to be loaded and loading the plugin failed. */
gboolean g_type_module_use(GTypeModule *module)
/* Returns: FALSE if the plugin needed to be loaded and loading the plugin failed. */ gboolean g_type_module_use(GTypeModule *module)
{ g_return_val_if_fail (G_IS_TYPE_MODULE (module), FALSE); module->use_count++; if (module->use_count == 1) { GSList *tmp_list; if (!G_TYPE_MODULE_GET_CLASS (module)->load (module)) { module->use_count--; return FALSE; } tmp_list = module->type_infos; while (tmp_list) { Mod...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If Cert is NULL, then return FALSE. If SubjectSize is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI X509GetSubjectName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *CertSubject, IN OUT UINTN *SubjectSize)
/* If Cert is NULL, then return FALSE. If SubjectSize is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI X509GetSubjectName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *CertSubject, IN OUT UINTN *SubjectSize)
{ CALL_CRYPTO_SERVICE (X509GetSubjectName, (Cert, CertSize, CertSubject, SubjectSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Informs the window manager that the window needs to be updated. */
static int updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
/* Informs the window manager that the window needs to be updated. */ static int updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
{ window_impl_t *impl = (window_impl_t *)window->driverdata; screen_buffer_t buffer; if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, (void **)&buffer) < 0) { return -1; } screen_post_window(impl->window, buffer, numrects, (int ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Gets the device out of firmware upload mode. */
static int mac_fw_upload_disable(struct i1480 *i1480)
/* Gets the device out of firmware upload mode. */ static int mac_fw_upload_disable(struct i1480 *i1480)
{ int result; u32 reg = 0x800000c0; u32 *buffer = (u32 *)i1480->cmd_buf; if (i1480->hw_rev > 1) reg = 0x8000d0d4; result = i1480->read(i1480, reg, sizeof(u32)); if (result < 0) goto error_cmd; *buffer |= i1480_FW_UPLOAD_MODE_MASK; result = i1480->write(i1480, reg, buffer, sizeof(u32)); if (result < 0) go...
robutest/uclinux
C++
GPL-2.0
60
/* Call PnP BIOS with function 0x00, "get number of system device nodes" */
static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
/* Call PnP BIOS with function 0x00, "get number of system device nodes" */ static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
{ u16 status; if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; status = call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, PNP_TS1, PNP_DS, 0, 0, data, sizeof(struct pnp_dev_node_info), NULL, 0); data->no_nodes &= 0xff; return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads data from a SPI peripheral until the provided buffer is filled. This method does NOT need to be called after SPI_Write or SPI_WriteBuffer. */
unsigned char SPI_ReadBuffer(AT91S_SPI *spi, void *buffer, unsigned int length)
/* Reads data from a SPI peripheral until the provided buffer is filled. This method does NOT need to be called after SPI_Write or SPI_WriteBuffer. */ unsigned char SPI_ReadBuffer(AT91S_SPI *spi, void *buffer, unsigned int length)
{ if (spi->SPI_RCR == 0) { spi->SPI_RPR = (unsigned int) buffer; spi->SPI_RCR = length; spi->SPI_PTCR = AT91C_PDC_RXTEN; return 1; } else if (spi->SPI_RNCR == 0) { spi->SPI_RNPR = (unsigned int) buffer; spi->SPI_RNCR = length; return 1; } retur...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Routine used to find the iSCSI Boot Format Table. The logical kernel address is set in the ibft_addr global variable. */
void __init reserve_ibft_region(void)
/* Routine used to find the iSCSI Boot Format Table. The logical kernel address is set in the ibft_addr global variable. */ void __init reserve_ibft_region(void)
{ unsigned long pos; unsigned int len = 0; void *virt; ibft_addr = NULL; for (pos = IBFT_START; pos < IBFT_END; pos += 16) { if (pos == VGA_MEM) pos += VGA_SIZE; virt = isa_bus_to_virt(pos); if (memcmp(virt, IBFT_SIGN, IBFT_SIGN_LEN) == 0) { unsigned long *addr = (unsigned long *)isa_bus_to_virt...
robutest/uclinux
C++
GPL-2.0
60