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 |
|---|---|---|---|---|---|---|---|
/* Disable the Capture input of the PWM module.
The */ | void PWMCAPInputDisable(unsigned long ulBase, unsigned long ulChannel) | /* Disable the Capture input of the PWM module.
The */
void PWMCAPInputDisable(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
xHWREG(ulBase + PWM_CAPINEN) &= ~(1 << (ulChannelTemp));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Sets the attribute value to a given UTF-8 string. */ | void _g_file_attribute_value_set_string(GFileAttributeValue *attr, const char *string) | /* Sets the attribute value to a given UTF-8 string. */
void _g_file_attribute_value_set_string(GFileAttributeValue *attr, const char *string) | {
g_return_if_fail (attr != NULL);
g_return_if_fail (string != NULL);
_g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_STRING;
attr->u.string = g_strdup (string);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Allow user programs to claim ports on a hub. When a device is attached to one of these "claimed" ports, the program will "own" the device. */ | static int find_port_owner(struct usb_device *hdev, unsigned port1, void ***ppowner) | /* Allow user programs to claim ports on a hub. When a device is attached to one of these "claimed" ports, the program will "own" the device. */
static int find_port_owner(struct usb_device *hdev, unsigned port1, void ***ppowner) | {
if (hdev->state == USB_STATE_NOTATTACHED)
return -ENODEV;
if (port1 == 0 || port1 > hdev->maxchild)
return -EINVAL;
*ppowner = &(hdev_to_hub(hdev)->port_owners[port1 - 1]);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Removes a device from a protection domain (with devtable_lock held) */ | static void detach_device(struct device *dev) | /* Removes a device from a protection domain (with devtable_lock held) */
static void detach_device(struct device *dev) | {
unsigned long flags;
write_lock_irqsave(&amd_iommu_devtable_lock, flags);
__detach_device(dev);
write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* iwm_stop() (Called at netdev interface bringdown time) -> iwm_down() -> iwm_bus_disable() -> if_sdio_disable() (In case of an SDIO bus) -> sdio_disable_func() */ | static int iwm_open(struct net_device *ndev) | /* iwm_stop() (Called at netdev interface bringdown time) -> iwm_down() -> iwm_bus_disable() -> if_sdio_disable() (In case of an SDIO bus) -> sdio_disable_func() */
static int iwm_open(struct net_device *ndev) | {
struct iwm_priv *iwm = ndev_to_iwm(ndev);
return iwm_up(iwm);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check communication is ready and able to read Chip ID. */ | enum status_code qt_get_comm_ready(void) | /* Check communication is ready and able to read Chip ID. */
enum status_code qt_get_comm_ready(void) | {
enum status_code ret;
uint8_t chip_id = 0;
volatile uint32_t timeout = QT_COMM_TIMEOUT;
do {
ret = qt_read_regs(QT_REG_CHIP_ID, &chip_id, sizeof(uint8_t));
timeout--;
if (timeout == 0) {
return ERR_IO_ERROR;
}
} while (ret != STATUS_OK);
if (chip_id != QT_DEVICE_ID) {
return ERR_UNSUPPORTED_DEV;
} else {
return STATUS_OK;
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This is a copy from fs/namei.c:vfs_readlink(), except for removing it's unused first argument. */ | STATIC int do_readlink(char __user *buffer, int buflen, const char *link) | /* This is a copy from fs/namei.c:vfs_readlink(), except for removing it's unused first argument. */
STATIC int do_readlink(char __user *buffer, int buflen, const char *link) | {
int len;
len = PTR_ERR(link);
if (IS_ERR(link))
goto out;
len = strlen(link);
if (len > (unsigned) buflen)
len = buflen;
if (copy_to_user(buffer, link, len))
len = -EFAULT;
out:
return len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes the set and clear values on a pin of the port when an ELC event occurs. This allows accurate timing of pin output level. */ | static void r_ioport_hw_pin_event_output_data_write(bsp_io_port_t port, ioport_size_t set_value, ioport_size_t reset_value, bsp_io_level_t pin_level) | /* Writes the set and clear values on a pin of the port when an ELC event occurs. This allows accurate timing of pin output level. */
static void r_ioport_hw_pin_event_output_data_write(bsp_io_port_t port, ioport_size_t set_value, ioport_size_t reset_value, bsp_io_level_t pin_level) | {
uint32_t port_value = 0;
R_PORT0_Type * p_ioport_regs = IOPORT_PRV_PORT_ADDRESS((port >> IOPORT_PRV_PORT_OFFSET) & IOPORT_PRV_8BIT_MASK);
port_value = p_ioport_regs->PCNTR4;
if (BSP_IO_LEVEL_HIGH == pin_level)
{
port_value |= (uint32_t) (set_value);
port_value &= (((uint32_t) reset_value << 16) | IOPORT_PRV_16BIT_MASK);
}
else
{
port_value |= (uint32_t) reset_value << 16;
port_value &= (uint32_t) ((set_value | IOPORT_PRV_UPPER_16BIT_MASK));
}
p_ioport_regs->PCNTR4 = port_value;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time. */ | EFI_STATUS EFIAPI TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg) | /* Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time. */
EFI_STATUS EFIAPI TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg) | {
EFI_STATUS Status;
if (TisReg == NULL) {
return EFI_INVALID_PARAMETER;
}
MmioWrite8 ((UINTN)&TisReg->Status, TIS_PC_STS_READY);
Status = TisPcWaitRegisterBits (
&TisReg->Status,
TIS_PC_STS_READY,
0,
TIS_TIMEOUT_B
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT32 EFIAPI IoBitFieldWrite32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value) | /* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI IoBitFieldWrite32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value) | {
return IoWrite32 (
Port,
BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Locking: Caller must hold i_mutex on the index inode. */ | ntfs_index_context* ntfs_index_ctx_get(ntfs_inode *idx_ni) | /* Locking: Caller must hold i_mutex on the index inode. */
ntfs_index_context* ntfs_index_ctx_get(ntfs_inode *idx_ni) | {
ntfs_index_context *ictx;
ictx = kmem_cache_alloc(ntfs_index_ctx_cache, GFP_NOFS);
if (ictx)
*ictx = (ntfs_index_context){ .idx_ni = idx_ni };
return ictx;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The only "gotcha" is that when there are 24 sectors, they are split across 2 "banks" of 12 sectors each, with another set of small sectors (16 KB) in the second bank occurring after the large ones (128 KB) in the first. We could consider supporting this as two devices to make the layout cleaner, but this will do for now. */ | void flash_stm32_page_layout(const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size) | /* The only "gotcha" is that when there are 24 sectors, they are split across 2 "banks" of 12 sectors each, with another set of small sectors (16 KB) in the second bank occurring after the large ones (128 KB) in the first. We could consider supporting this as two devices to make the layout cleaner, but this will do for now. */
void flash_stm32_page_layout(const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size) | {
ARG_UNUSED(dev);
*layout = stm32f4_flash_layout;
*layout_size = ARRAY_SIZE(stm32f4_flash_layout);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Wrappers for agp_free_memory & agp_allocate_memory These make sure that internal lists are kept updated. */ | void agp_free_memory_wrap(struct agp_memory *memory) | /* Wrappers for agp_free_memory & agp_allocate_memory These make sure that internal lists are kept updated. */
void agp_free_memory_wrap(struct agp_memory *memory) | {
agp_remove_from_pool(memory);
agp_free_memory(memory);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the elapsed milliseconds since a previous time stamp */ | uint32_t lv_tick_elaps(uint32_t prev_tick) | /* Get the elapsed milliseconds since a previous time stamp */
uint32_t lv_tick_elaps(uint32_t prev_tick) | {
uint32_t act_time = lv_tick_get();
if(act_time >= prev_tick) {
prev_tick = act_time - prev_tick;
}
else {
prev_tick = UINT32_MAX - prev_tick + 1;
prev_tick += act_time;
}
return prev_tick;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Wait end of transfer and check if received Data are well. */ | void WaitAndCheckEndOfTransfer(void) | /* Wait end of transfer and check if received Data are well. */
void WaitAndCheckEndOfTransfer(void) | {
while (ubTransmitIndex != ubNbDataToTransmit)
{
}
LL_SPI_DisableIT_TXE(SPI1);
while (ubNbDataToReceive > ubReceiveIndex)
{
}
LL_SPI_DisableIT_RXNE(SPI1);
if(Buffercmp8((uint8_t*)aTxBuffer, (uint8_t*)aRxBuffer, ubNbDataToTransmit))
{
LED_Blinking(LED_BLINK_ERROR);
}
else
{
LED_On();
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Note that this function expects to be passed the complement of the original code word. This is in keeping with ISDN conventions. */ | int ulaw2linear(unsigned char u_val) | /* Note that this function expects to be passed the complement of the original code word. This is in keeping with ISDN conventions. */
int ulaw2linear(unsigned char u_val) | {
int t;
u_val = ~u_val;
t = ((u_val & QUANT_MASK) << 3) + BIAS;
t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param pfd PFD control name. return PFD bypass status. */ | bool CLOCK_IsUsb1PfdEnabled(clock_pfd_t pfd) | /* param pfd PFD control name. return PFD bypass status. */
bool CLOCK_IsUsb1PfdEnabled(clock_pfd_t pfd) | {
return ((CCM_ANALOG->PFD_480 & (uint32_t)CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK << (8UL * (uint8_t)pfd)) == 0U);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Description: Remove all entries from the network interface table. */ | static void sel_netif_flush(void) | /* Description: Remove all entries from the network interface table. */
static void sel_netif_flush(void) | {
int idx;
struct sel_netif *netif;
spin_lock_bh(&sel_netif_lock);
for (idx = 0; idx < SEL_NETIF_HASH_SIZE; idx++)
list_for_each_entry(netif, &sel_netif_hash[idx], list)
sel_netif_destroy(netif);
spin_unlock_bh(&sel_netif_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* e1000_clean_tx_ring - Free Tx Buffers @adapter: board private structure */ | static void e1000_clean_tx_ring(struct e1000_adapter *adapter) | /* e1000_clean_tx_ring - Free Tx Buffers @adapter: board private structure */
static void e1000_clean_tx_ring(struct e1000_adapter *adapter) | {
struct e1000_ring *tx_ring = adapter->tx_ring;
struct e1000_buffer *buffer_info;
unsigned long size;
unsigned int i;
for (i = 0; i < tx_ring->count; i++) {
buffer_info = &tx_ring->buffer_info[i];
e1000_put_txbuf(adapter, buffer_info);
}
size = sizeof(struct e1000_buffer) * tx_ring->count;
memset(tx_ring->buffer_info, 0, size);
memset(tx_ring->desc, 0, tx_ring->size);
tx_ring->next_to_use = 0;
tx_ring->next_to_clean = 0;
writel(0, adapter->hw.hw_addr + tx_ring->head);
writel(0, adapter->hw.hw_addr + tx_ring->tail);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is used to register i2c transfer done callback function. */ | void wm_i2c_transfer_done_register(void(*done)(void)) | /* This function is used to register i2c transfer done callback function. */
void wm_i2c_transfer_done_register(void(*done)(void)) | {
i2c_transfer.transfer_done = done;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* MSS_SPI_configure_master_mode() See "mss_spi.h" for details of how to use this function. */ | void MSS_SPI_configure_master_mode(volatile mss_spi_instance_t *this_spi, mss_spi_slave_t slave, mss_spi_protocol_mode_t protocol_mode, mss_spi_pclk_div_t clk_rate, uint8_t frame_bit_length) | /* MSS_SPI_configure_master_mode() See "mss_spi.h" for details of how to use this function. */
void MSS_SPI_configure_master_mode(volatile mss_spi_instance_t *this_spi, mss_spi_slave_t slave, mss_spi_protocol_mode_t protocol_mode, mss_spi_pclk_div_t clk_rate, uint8_t frame_bit_length) | {
ASSERT((this_spi == &g_mss_spi0) || (this_spi == &g_mss_spi1));
ASSERT(slave < MSS_SPI_MAX_NB_OF_SLAVES);
ASSERT(frame_bit_length <= 32);
this_spi->hw_reg->CONTROL &= ~CTRL_ENABLE_MASK;
this_spi->hw_reg->CONTROL |= CTRL_MASTER_MASK;
this_spi->hw_reg->CONTROL |= CTRL_ENABLE_MASK;
if(slave < MSS_SPI_MAX_NB_OF_SLAVES)
{
this_spi->slaves_cfg[slave].ctrl_reg = MASTER_MODE_MASK |
BIGFIFO_MASK |
(uint32_t)protocol_mode |
((uint32_t)1 << TXRXDFCOUNT_SHIFT);
this_spi->slaves_cfg[slave].txrxdf_size_reg = frame_bit_length;
this_spi->slaves_cfg[slave].clk_gen = (uint8_t)clk_rate;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* We need a wrapper for zunzip() because the parameters are incompatible with the lzo decompressor. */ | static int gzip_decompress(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len) | /* We need a wrapper for zunzip() because the parameters are incompatible with the lzo decompressor. */
static int gzip_decompress(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len) | {
unsigned long len = in_len;
return zunzip(out, *out_len, (unsigned char *)in, &len, 0, 0);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function will query if the command is supported. */ | EFI_STATUS EFIAPI Tpm2GetCapabilityIsCommandImplemented(IN TPM_CC Command, OUT BOOLEAN *IsCmdImpl) | /* This function will query if the command is supported. */
EFI_STATUS EFIAPI Tpm2GetCapabilityIsCommandImplemented(IN TPM_CC Command, OUT BOOLEAN *IsCmdImpl) | {
TPMS_CAPABILITY_DATA TpmCap;
TPMI_YES_NO MoreData;
EFI_STATUS Status;
UINT32 Attribute;
Status = Tpm2GetCapability (
TPM_CAP_COMMANDS,
Command,
1,
&MoreData,
&TpmCap
);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0], sizeof (UINT32));
*IsCmdImpl = (Command == (SwapBytes32 (Attribute) & TPMA_CC_COMMANDINDEX_MASK));
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The current receive FIFO state can be extracted from the returned value by ANDing with */ | uint32_t EMACStatusGet(uint32_t ui32Base) | /* The current receive FIFO state can be extracted from the returned value by ANDing with */
uint32_t EMACStatusGet(uint32_t ui32Base) | {
return(HWREG(ui32Base + EMAC_O_STATUS));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USB Device Remote Wakeup Configuration Function Parameters: cfg: Device Enable/Disable Return Value: None */ | void USBD_WakeUpCfg(BOOL cfg) | /* USB Device Remote Wakeup Configuration Function Parameters: cfg: Device Enable/Disable Return Value: None */
void USBD_WakeUpCfg(BOOL cfg) | {
if (cfg == __TRUE) {
LPC_USB->DEVCMDSTAT &= ~(1UL << 9);
} else {
LPC_USB->DEVCMDSTAT |= (1UL << 9);
LPC_SYSCON->USBCLKCTRL = 0;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Read the EFI variable (VendorGuid/Name) and return a dynamically allocated buffer, and the size of the buffer. If failure, return NULL. */ | VOID* IScsiGetVariableAndSize(IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize) | /* Read the EFI variable (VendorGuid/Name) and return a dynamically allocated buffer, and the size of the buffer. If failure, return NULL. */
VOID* IScsiGetVariableAndSize(IN CHAR16 *Name, IN EFI_GUID *VendorGuid, OUT UINTN *VariableSize) | {
EFI_STATUS Status;
UINTN BufferSize;
VOID *Buffer;
Buffer = NULL;
BufferSize = 0;
Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
Buffer = AllocateZeroPool (BufferSize);
if (Buffer == NULL) {
return NULL;
}
Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
if (EFI_ERROR (Status)) {
BufferSize = 0;
}
}
*VariableSize = BufferSize;
return Buffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Delete a Mutex that was created by osMutexCreate. */ | osStatus osMutexDelete(osMutexId mutex_id) | /* Delete a Mutex that was created by osMutexCreate. */
osStatus osMutexDelete(osMutexId mutex_id) | {
vSemaphoreDelete(mutex->mutex);
mutex->mutex = NULL;
return osOK;
} else {
return osErrorParameter;
}
} | labapart/polymcu | C++ | null | 201 |
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ | int main(void) | /* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void) | {
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "RNDIS Host Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
RNDISHost_Task();
RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);
USB_USBTask();
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Set up a timer for the current task. */ | static void __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task) | /* Set up a timer for the current task. */
static void __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task) | {
if (!task->tk_timeout)
return;
dprintk("RPC: %5u setting alarm for %lu ms\n",
task->tk_pid, task->tk_timeout * 1000 / HZ);
task->u.tk_wait.expires = jiffies + task->tk_timeout;
if (list_empty(&queue->timer_list.list) || time_before(task->u.tk_wait.expires, queue->timer_list.expires))
rpc_set_queue_timer(queue, task->u.tk_wait.expires);
list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initialize RSA Interface. 1. Initializes the resources needed for the RSA interface 2.registers event callback function. */ | rsa_handle_t csi_rsa_initialize(int32_t idx, rsa_event_cb_t cb_event) | /* Initialize RSA Interface. 1. Initializes the resources needed for the RSA interface 2.registers event callback function. */
rsa_handle_t csi_rsa_initialize(int32_t idx, rsa_event_cb_t cb_event) | {
if (idx < 0 || idx >= CONFIG_RSA_NUM) {
return NULL;
}
uint32_t base = 0u;
uint32_t irq;
int32_t real_idx = target_get_rsa(idx, &base, &irq);
if (real_idx != idx) {
return NULL;
}
ck_rsa_priv_t *rsa_priv = &rsa_handle[idx];
rsa_priv->base = base;
rsa_priv->irq = irq;
rsa_priv->cb = cb_event;
rsa_priv->data_bit = RSA_DATA_BITS_1024;
rsa_priv->endian = RSA_ENDIAN_MODE_LITTLE;
rsa_priv->padding.padding_type = RSA_PADDING_MODE_PKCS1;
rsa_priv->padding.hash_type = RSA_HASH_TYPE_SHA1;
rsa_priv->status.busy = 0;
return (rsa_handle_t)rsa_priv;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reads and returns the current value of MM4. This function is only available on IA-32 and X64. */ | UINT64 EFIAPI AsmReadMm4(VOID) | /* Reads and returns the current value of MM4. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm4(VOID) | {
UINT64 Data;
__asm__ __volatile__ (
"push %%eax \n\t"
"push %%eax \n\t"
"movq %%mm4, (%%esp)\n\t"
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the Link Pointer pointing to a QH or TD. */ | VOID SetTDLinkPtrQHorTDSelect(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsQH) | /* Set the Link Pointer pointing to a QH or TD. */
VOID SetTDLinkPtrQHorTDSelect(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsQH) | {
PtrTDStruct->TDData.TDLinkPtrQSelect = (IsQH ? 1 : 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Instantiate a platform device for the Kinetis on-chip RTC */ | void __init kinetis_rtc_init(void) | /* Instantiate a platform device for the Kinetis on-chip RTC */
void __init kinetis_rtc_init(void) | {
if (platform_device_register(&rtc_device)) {
pr_err("%s: Failed to register RTC device\n", __func__);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initialize the conversion factor and the min/max deltas of the clock event structure and register the clock event source with the framework. */ | void __init setup_pit_timer(void) | /* Initialize the conversion factor and the min/max deltas of the clock event structure and register the clock event source with the framework. */
void __init setup_pit_timer(void) | {
struct clock_event_device *cd = &pit_clockevent;
unsigned int cpu = smp_processor_id();
cd->cpumask = cpumask_of(cpu);
clockevent_set_clock(cd, CLOCK_TICK_RATE);
cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd);
cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
clockevents_register_device(cd);
setup_irq(0, &irq0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Runs through the given path (or query) segment and checks if percent-encodings are correct. This function returns */ | int check_segment(const unsigned char *s, size_t length) | /* Runs through the given path (or query) segment and checks if percent-encodings are correct. This function returns */
int check_segment(const unsigned char *s, size_t length) | {
if (*s == '%') {
if (length < 2 || !(isxdigit(s[1]) && isxdigit(s[2])))
return -1;
s += 2;
length -= 2;
}
++s; ++n; --length;
}
return n;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Determin the memory cache type for the Range. */ | VOID DetermineMemoryCacheType(IN MTRR_MEMORY_CACHE_TYPE DefaultType, IN OUT MTRR_MEMORY_RANGE *Range, IN MTRR_MEMORY_RANGE *Ranges, IN UINT32 RangeCount) | /* Determin the memory cache type for the Range. */
VOID DetermineMemoryCacheType(IN MTRR_MEMORY_CACHE_TYPE DefaultType, IN OUT MTRR_MEMORY_RANGE *Range, IN MTRR_MEMORY_RANGE *Ranges, IN UINT32 RangeCount) | {
UINT32 Index;
Range->Type = CacheInvalid;
for (Index = 0; Index < RangeCount; Index++) {
if (RangesOverlap (Range, &Ranges[Index], 1)) {
if (Ranges[Index].Type < Range->Type) {
Range->Type = Ranges[Index].Type;
}
}
}
if (Range->Type == CacheInvalid) {
Range->Type = DefaultType;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This returns the I2C device descriptor of the I2C device matching the device address */ | static struct i3c_i2c_device_desc* cdns_i3c_i2c_device_find(const struct device *dev, uint16_t addr) | /* This returns the I2C device descriptor of the I2C device matching the device address */
static struct i3c_i2c_device_desc* cdns_i3c_i2c_device_find(const struct device *dev, uint16_t addr) | {
struct cdns_i3c_data *data = dev->data;
return i3c_dev_list_i2c_addr_find(&data->common.attached_dev, addr);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Sets the output voltage of the LDO when the device enters sleep mode. */ | void SysCtlLDOSleepSet(uint32_t ui32Voltage) | /* Sets the output voltage of the LDO when the device enters sleep mode. */
void SysCtlLDOSleepSet(uint32_t ui32Voltage) | {
ASSERT((ui32Voltage == SYSCTL_LDO_0_90V) ||
(ui32Voltage == SYSCTL_LDO_0_95V) ||
(ui32Voltage == SYSCTL_LDO_1_00V) ||
(ui32Voltage == SYSCTL_LDO_1_05V) ||
(ui32Voltage == SYSCTL_LDO_1_10V) ||
(ui32Voltage == SYSCTL_LDO_1_15V) ||
(ui32Voltage == SYSCTL_LDO_1_20V));
HWREG(SYSCTL_LDOSPCTL) = ui32Voltage;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl value greater than or equal to the current TPL are invoked in the order that they were queued. DPCs with higher DpcTpl values are invoked before DPCs with lower DpcTpl values. */ | EFI_STATUS EFIAPI DispatchDpc(VOID) | /* Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl value greater than or equal to the current TPL are invoked in the order that they were queued. DPCs with higher DpcTpl values are invoked before DPCs with lower DpcTpl values. */
EFI_STATUS EFIAPI DispatchDpc(VOID) | {
return mDpc->DispatchDpc (mDpc);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Limit must be within this model's frequency range at least one border included. */ | static int centrino_verify(struct cpufreq_policy *policy) | /* Limit must be within this model's frequency range at least one border included. */
static int centrino_verify(struct cpufreq_policy *policy) | {
return cpufreq_frequency_table_verify(policy,
per_cpu(centrino_model, policy->cpu)->op_points);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Shift the entire display n unit to the left. */ | void HD44780DisplayLeftShift(unsigned char n) | /* Shift the entire display n unit to the left. */
void HD44780DisplayLeftShift(unsigned char n) | {
int i = n;
while(i--)
{
while(HD44780Busy());
HD44780WriteCmd(HD44780_CMD_CURSOR_DISPLAY_SHIFT(
HD44780_CURSOR_DISPLAY_SHIFT_SC_S |
HD44780_CURSOR_DISPLAY_SHIFT_RL_L));
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads and returns the current value of ES. This function is only available on IA-32 and X64. */ | UINT16 EFIAPI AsmReadEs(VOID) | /* Reads and returns the current value of ES. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadEs(VOID) | {
UINT16 Data;
__asm__ __volatile__ (
"mov %%es, %0"
:"=a" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function unregisters a function which will be called whenever a new ACPI table is installed. */ | EFI_STATUS SdtUnregisterNotify(IN EFI_ACPI_NOTIFICATION_FN Notification) | /* This function unregisters a function which will be called whenever a new ACPI table is installed. */
EFI_STATUS SdtUnregisterNotify(IN EFI_ACPI_NOTIFICATION_FN Notification) | {
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
AcpiTableInstance = SdtGetAcpiTableInstance ();
StartLink = &AcpiTableInstance->NotifyList;
CurrentLink = StartLink->ForwardLink;
while (CurrentLink != StartLink) {
CurrentNotifyList = EFI_ACPI_NOTIFY_LIST_FROM_LINK (CurrentLink);
if (CurrentNotifyList->Notification == Notification) {
RemoveEntryList (&(CurrentNotifyList->Link));
FreePool (CurrentNotifyList);
return EFI_SUCCESS;
}
CurrentLink = CurrentLink->ForwardLink;
}
return EFI_INVALID_PARAMETER;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If SecurityHandler is NULL, then ASSERT(). If no enough resources available to register new handler, then ASSERT(). If AuthenticationOperation is not recongnized, then ASSERT(). If the previous register handler can't be executed before the later register handler, then ASSERT(). */ | EFI_STATUS EFIAPI RegisterSecurityHandler(IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler, IN UINT32 AuthenticationOperation) | /* If SecurityHandler is NULL, then ASSERT(). If no enough resources available to register new handler, then ASSERT(). If AuthenticationOperation is not recongnized, then ASSERT(). If the previous register handler can't be executed before the later register handler, then ASSERT(). */
EFI_STATUS EFIAPI RegisterSecurityHandler(IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler, IN UINT32 AuthenticationOperation) | {
EFI_STATUS Status;
ASSERT (SecurityHandler != NULL);
ASSERT (CheckAuthenticationOperation (mCurrentAuthOperation, AuthenticationOperation));
mCurrentAuthOperation = mCurrentAuthOperation | AuthenticationOperation;
if (mNumberOfSecurityHandler == mMaxNumberOfSecurityHandler) {
Status = ReallocateSecurityHandlerTable ();
ASSERT_EFI_ERROR (Status);
}
mSecurityTable[mNumberOfSecurityHandler].SecurityOperation = AuthenticationOperation;
mSecurityTable[mNumberOfSecurityHandler].SecurityHandler = SecurityHandler;
mNumberOfSecurityHandler++;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Stalls the CPU for at least the given number of ticks. It's invoked by */ | VOID InternalAcpiDelay(IN UINT32 Delay) | /* Stalls the CPU for at least the given number of ticks. It's invoked by */
VOID InternalAcpiDelay(IN UINT32 Delay) | {
UINT16 Port;
UINT32 Ticks;
UINT32 Times;
Port = InternalAcpiGetAcpiTimerIoPort ();
Times = Delay >> 22;
Delay &= BIT22 - 1;
do {
Ticks = IoBitFieldRead32 (Port, 0, 23) + Delay;
Delay = BIT22;
while (((Ticks - IoBitFieldRead32 (Port, 0, 23)) & BIT23) == 0) {
CpuPause ();
}
} while (Times-- > 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Stop the responder on all services without instance. */ | static void _mdns_send_bye_all_pcbs_no_instance() | /* Stop the responder on all services without instance. */
static void _mdns_send_bye_all_pcbs_no_instance() | {
size_t srv_count = 0;
mdns_srv_item_t * a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
srv_count++;
}
a = a->next;
}
if (!srv_count) {
return;
}
mdns_srv_item_t * services[srv_count];
size_t i = 0;
a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
services[i++] = a;
}
a = a->next;
}
_mdns_send_bye(services, srv_count, false);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* brief DMA instance 0, channel 3 IRQ handler. */ | void EDMA_0_CH3_DriverIRQHandler(void) | /* brief DMA instance 0, channel 3 IRQ handler. */
void EDMA_0_CH3_DriverIRQHandler(void) | {
EDMA_DriverIRQHandler(0U, 3U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Take two samples from the ADC and determine if the input is floating. */ | int32_t cn0414_open_wire_detect(struct cn0414_dev *dev, uint32_t voltage_chan1, uint32_t voltage_chan2, uint8_t *floating) | /* Take two samples from the ADC and determine if the input is floating. */
int32_t cn0414_open_wire_detect(struct cn0414_dev *dev, uint32_t voltage_chan1, uint32_t voltage_chan2, uint8_t *floating) | {
int32_t ret;
float fdata1, fdata2;
ret = cn0414_compute_adc_value(dev, voltage_chan1, ADC_VOLTAGE_CHANNEL,
&fdata1);
if(ret < 0)
return ret;
ret = cn0414_compute_adc_value(dev, voltage_chan2, ADC_VOLTAGE_CHANNEL,
&fdata2);
if(ret < 0)
return ret;
if(((fdata1 - fdata2) < -0.3) || ((fdata1 - fdata2) > 0.3))
*floating = 1;
else
*floating = 0;
return ret;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This function is the timeout function for thread, normally which is invoked when thread is timeout to wait some resource. */ | void rt_thread_timeout(void *parameter) | /* This function is the timeout function for thread, normally which is invoked when thread is timeout to wait some resource. */
void rt_thread_timeout(void *parameter) | {
struct rt_thread *thread;
register rt_base_t temp;
thread = (struct rt_thread *)parameter;
RT_ASSERT(thread != RT_NULL);
RT_ASSERT((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_SUSPEND);
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
temp = rt_hw_interrupt_disable();
thread->error = -RT_ETIMEOUT;
rt_list_remove(&(thread->tlist));
rt_schedule_insert_thread(thread);
rt_hw_interrupt_enable(temp);
rt_schedule();
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Acknowledge that data was read from the given endpoint's FIFO in host mode. */ | void USBHostEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint) | /* Acknowledge that data was read from the given endpoint's FIFO in host mode. */
void USBHostEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint) | {
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) ||
(ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) ||
(ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) ||
(ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7));
if(ui32Endpoint == USB_EP_0)
{
HWREGB(ui32Base + USB_O_CSRL0) &= ~USB_CSRL0_RXRDY;
}
else
{
HWREGB(ui32Base + USB_O_RXCSRL1 + EP_OFFSET(ui32Endpoint)) &=
~(USB_RXCSRL1_RXRDY);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Reads the current interrupt status and recycled transmit buffer status from a network interface. */ | EFI_STATUS EFIAPI EmuSnpGetStatus(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, OUT UINT32 *InterruptStatus, OUT VOID **TxBuffer) | /* Reads the current interrupt status and recycled transmit buffer status from a network interface. */
EFI_STATUS EFIAPI EmuSnpGetStatus(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, OUT UINT32 *InterruptStatus, OUT VOID **TxBuffer) | {
EFI_STATUS Status;
EMU_SNP_PRIVATE_DATA *Private;
Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This);
Status = Private->Io->GetStatus (Private->Io, InterruptStatus, TxBuffer);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* USART enable receive timeout interrupt.
An interrupt is generated when the RTOF Flag is set in the ISR usart_isr register. */ | void usart_enable_rx_timeout_interrupt(uint32_t usart) | /* USART enable receive timeout interrupt.
An interrupt is generated when the RTOF Flag is set in the ISR usart_isr register. */
void usart_enable_rx_timeout_interrupt(uint32_t usart) | {
USART_CR1(usart) |= USART_CR1_RTOIE;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* 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 GPIOPinTypeHibernateRTCCLK(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 GPIOPinTypeHibernateRTCCLK(uint32_t ui32Port, uint8_t ui8Pins) | {
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base PXP peripheral base address. param inputWidth Input image width. param inputHeight Input image height. param outputWidth Output image width. param outputHeight Output image height. */ | void PXP_SetProcessSurfaceScaler(PXP_Type *base, uint16_t inputWidth, uint16_t inputHeight, uint16_t outputWidth, uint16_t outputHeight) | /* param base PXP peripheral base address. param inputWidth Input image width. param inputHeight Input image height. param outputWidth Output image width. param outputHeight Output image height. */
void PXP_SetProcessSurfaceScaler(PXP_Type *base, uint16_t inputWidth, uint16_t inputHeight, uint16_t outputWidth, uint16_t outputHeight) | {
uint8_t decX, decY;
uint32_t scaleX, scaleY;
PXP_GetScalerParam(inputWidth, outputWidth, &decX, &scaleX);
PXP_GetScalerParam(inputHeight, outputHeight, &decY, &scaleY);
base->PS_CTRL = (base->PS_CTRL & ~(PXP_PS_CTRL_DECX_MASK | PXP_PS_CTRL_DECY_MASK)) | PXP_PS_CTRL_DECX(decX) |
PXP_PS_CTRL_DECY(decY);
base->PS_SCALE = PXP_PS_SCALE_XSCALE(scaleX) | PXP_PS_SCALE_YSCALE(scaleY);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Disable the specified ADC discontinuous mode for injected group. */ | void ADC_DisableInjectedDiscMode(ADC_T *adc) | /* Disable the specified ADC discontinuous mode for injected group. */
void ADC_DisableInjectedDiscMode(ADC_T *adc) | {
adc->CTRL1_B.INJDISCEN = BIT_RESET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Checks whether the specified ADC flag is set or not. */ | FlagStatus ADC_GetFlagStatus(ADC_TypeDef *ADCx, uint16_t ADC_FLAG) | /* Checks whether the specified ADC flag is set or not. */
FlagStatus ADC_GetFlagStatus(ADC_TypeDef *ADCx, uint16_t ADC_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_GET_FLAG(ADC_FLAG));
if ((ADCx->SR & ADC_FLAG) != (uint8_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Read any number of bytes from EEPROM memory. The read can be any number of bytes. Before the read is done the memory index must be placed at the desired location using a write with a repead start then a read. */ | int32_t memory_read(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size) | /* Read any number of bytes from EEPROM memory. The read can be any number of bytes. Before the read is done the memory index must be placed at the desired location using a write with a repead start then a read. */
int32_t memory_read(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size) | {
int32_t ret = 0;
uint8_t *transmit_array;
uint16_t shifted_address;
shifted_address = MEMORY_PROTECTED_SIZE + address;
if((shifted_address + size) > MEMORY_SIZE_BYTES)
size = MEMORY_SIZE_BYTES - shifted_address;
transmit_array = calloc(2, sizeof *transmit_array);
if (!transmit_array)
return -1;
transmit_array[0] = (shifted_address & 0xff00) >> 8;
transmit_array[1] = (shifted_address & 0x00ff) >> 0;
ret = i2c_write(dev->i2c_dev, transmit_array, 2, false);
if(ret < 0)
goto finish;
ret = i2c_read(dev->i2c_dev, data, size, true);
finish:
free(transmit_array);
return ret;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* If InputSection is NULL, then ASSERT(). If OutputBufferSize is NULL, then ASSERT(). If ScratchBufferSize is NULL, then ASSERT(). If SectionAttribute is NULL, then ASSERT(). */ | RETURN_STATUS EFIAPI ExtractGuidedSectionGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UINT16 *SectionAttribute) | /* If InputSection is NULL, then ASSERT(). If OutputBufferSize is NULL, then ASSERT(). If ScratchBufferSize is NULL, then ASSERT(). If SectionAttribute is NULL, then ASSERT(). */
RETURN_STATUS EFIAPI ExtractGuidedSectionGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UINT16 *SectionAttribute) | {
UINT32 Index;
EFI_GUID *SectionDefinitionGuid;
ASSERT (InputSection != NULL);
ASSERT (OutputBufferSize != NULL);
ASSERT (ScratchBufferSize != NULL);
ASSERT (SectionAttribute != NULL);
if (IS_SECTION2 (InputSection)) {
SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid);
} else {
SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid);
}
for (Index = 0; Index < mNumberOfExtractHandler; Index++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {
return mExtractGetInfoHandlerTable[Index](
InputSection,
OutputBufferSize,
ScratchBufferSize,
SectionAttribute
);
}
}
return RETURN_UNSUPPORTED;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If delay is small (10% of max) then beta = 1/8 If delay is up to 80% of max then beta = 1/2 In between is a linear function */ | static u32 beta(u32 da, u32 dm) | /* If delay is small (10% of max) then beta = 1/8 If delay is up to 80% of max then beta = 1/2 In between is a linear function */
static u32 beta(u32 da, u32 dm) | {
u32 d2, d3;
d2 = dm / 10;
if (da <= d2)
return BETA_MIN;
d3 = (8 * dm) / 10;
if (da >= d3 || d3 <= d2)
return BETA_MAX;
return (BETA_MIN * d3 - BETA_MAX * d2 + (BETA_MAX - BETA_MIN) * da)
/ (d3 - d2);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Converts a text device path node to USB wireless device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbWireless(CHAR16 *TextDeviceNode) | /* Converts a text device path node to USB wireless device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbWireless(CHAR16 *TextDeviceNode) | {
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_WIRELESS;
UsbClassText.SubClassExist = TRUE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* idle_cpu - is a given cpu idle currently? @cpu: the processor in question. */ | int idle_cpu(int cpu) | /* idle_cpu - is a given cpu idle currently? @cpu: the processor in question. */
int idle_cpu(int cpu) | {
return cpu_curr(cpu) == cpu_rq(cpu)->idle;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Try to fallback to bootstrap. Return true if we did. */ | static bool fallback_to_bootstrap(void) | /* Try to fallback to bootstrap. Return true if we did. */
static bool fallback_to_bootstrap(void) | {
if (IS_ENABLED(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)) {
bool fallback = true;
(void)lwm2m_get_bool(&LWM2M_OBJ(LWM2M_OBJECT_SERVER_ID, client.ctx->srv_obj_inst,
SERVER_BOOTSTRAP_ON_REGISTRATION_FAILURE_ID),
&fallback);
if (fallback) {
client.use_bootstrap = true;
set_sm_state(ENGINE_INIT);
return true;
}
}
return false;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns 0 if all field numbers and values are in the correct range, else returns -1. */ | int davinci_configure_pin_mux(const struct pinmux_config *pins, const int n_pins) | /* Returns 0 if all field numbers and values are in the correct range, else returns -1. */
int davinci_configure_pin_mux(const struct pinmux_config *pins, const int n_pins) | {
int i;
for (i = 0; i < n_pins; i++) {
if (pins[i].field >= PIN_MUX_NUM_FIELDS ||
(pins[i].value & ~PIN_MUX_FIELD_MASK) != 0)
return -1;
}
for (i = 0; i < n_pins; i++) {
const int offset = pins[i].field * PIN_MUX_FIELD_SIZE;
const unsigned int value = pins[i].value << offset;
const unsigned int mask = PIN_MUX_FIELD_MASK << offset;
const dv_reg *mux = pins[i].mux;
writel(value | (readl(mux) & (~mask)), mux);
}
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* sk_stream_closing - Return 1 if we still have things to send in our buffers. @sk: socket to verify */ | static int sk_stream_closing(struct sock *sk) | /* sk_stream_closing - Return 1 if we still have things to send in our buffers. @sk: socket to verify */
static int sk_stream_closing(struct sock *sk) | {
return (1 << sk->sk_state) &
(TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reclaims n TX descriptors and frees the buffers associated with them. */ | static void free_cmdQ_buffers(struct sge *sge, struct cmdQ *q, unsigned int n) | /* Reclaims n TX descriptors and frees the buffers associated with them. */
static void free_cmdQ_buffers(struct sge *sge, struct cmdQ *q, unsigned int n) | {
struct cmdQ_ce *ce;
struct pci_dev *pdev = sge->adapter->pdev;
unsigned int cidx = q->cidx;
q->in_use -= n;
ce = &q->centries[cidx];
while (n--) {
if (likely(pci_unmap_len(ce, dma_len))) {
pci_unmap_single(pdev, pci_unmap_addr(ce, dma_addr),
pci_unmap_len(ce, dma_len),
PCI_DMA_TODEVICE);
if (q->sop)
q->sop = 0;
}
if (ce->skb) {
dev_kfree_skb_any(ce->skb);
q->sop = 1;
}
ce++;
if (++cidx == q->size) {
cidx = 0;
ce = q->centries;
}
}
q->cidx = cidx;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Unlock the control register block for this adapter. Registers must not be unlocked in a situation where libata might look at them. */ | static void optidma_unlock(struct ata_port *ap) | /* Unlock the control register block for this adapter. Registers must not be unlocked in a situation where libata might look at them. */
static void optidma_unlock(struct ata_port *ap) | {
void __iomem *regio = ap->ioaddr.cmd_addr;
ioread16(regio + 1);
ioread16(regio + 1);
iowrite8(3, regio + 2);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT16 EFIAPI PciBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData) | {
return PciCf8BitFieldOr16 (Address, StartBit, EndBit, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initial version only to support LAN access; some placeholder code from io_se.c left in with the expectation of later SuperIO and PCMCIA access. */ | static volatile u16* port2adr(unsigned int port) | /* Initial version only to support LAN access; some placeholder code from io_se.c left in with the expectation of later SuperIO and PCMCIA access. */
static volatile u16* port2adr(unsigned int port) | {
if (port >= 0x2000)
return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
maybebadio((unsigned long)port);
return (volatile __u16*)port;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function is used to stop pmu rtc timer. */ | void tls_rtc_timer_stop(void) | /* This function is used to stop pmu rtc timer. */
void tls_rtc_timer_stop(void) | {
tls_reg_write32(HR_PMU_RTC_CTRL1, tls_reg_read32(HR_PMU_RTC_CTRL1) & (~BIT(31)));
return;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* param config Pointer to the OSC0 configuration structure. */ | void CLOCK_InitOsc0(osc_config_t const *config) | /* param config Pointer to the OSC0 configuration structure. */
void CLOCK_InitOsc0(osc_config_t const *config) | {
uint8_t range = CLOCK_GetOscRangeFromFreq(config->freq);
OSC_SetCapLoad(OSC0, config->capLoad);
OSC_SetExtRefClkConfig(OSC0, &config->oscerConfig);
MCG->C2 = ((MCG->C2 & MCG_C2_IRCS_MASK) | MCG_C2_RANGE0(range) | (uint8_t)config->workMode);
if ((kOSC_ModeExt != config->workMode) && (OSC0->CR & OSC_CR_ERCLKEN_MASK))
{
while (!(MCG->S & MCG_S_OSCINIT0_MASK))
{
}
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* grab the security keyring for a server socket */ | int rxrpc_server_keyring(struct rxrpc_sock *rx, char __user *optval, int optlen) | /* grab the security keyring for a server socket */
int rxrpc_server_keyring(struct rxrpc_sock *rx, char __user *optval, int optlen) | {
struct key *key;
char *description;
_enter("");
if (optlen <= 0 || optlen > PAGE_SIZE - 1)
return -EINVAL;
description = kmalloc(optlen + 1, GFP_KERNEL);
if (!description)
return -ENOMEM;
if (copy_from_user(description, optval, optlen)) {
kfree(description);
return -EFAULT;
}
description[optlen] = 0;
key = request_key(&key_type_keyring, description, NULL);
if (IS_ERR(key)) {
kfree(description);
_leave(" = %ld", PTR_ERR(key));
return PTR_ERR(key);
}
rx->securities = key;
kfree(description);
_leave(" = 0 [key %x]", key->serial);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will do USB_REQ_GET_STATUS request for the device instance to get hub port status. */ | rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint16_t port, rt_uint8_t *buffer) | /* This function will do USB_REQ_GET_STATUS request for the device instance to get hub port status. */
rt_err_t rt_usb_hub_get_port_status(uhubinst_t uhub, rt_uint16_t port, rt_uint8_t *buffer) | {
struct ureqest setup;
int timeout = 100;
int length = 4;
RT_ASSERT(uhub != RT_NULL);
if(uhub->is_roothub)
{
rt_usb_hcd_hub_control(uhub->hcd, port, RH_GET_PORT_STATUS,
(void*)buffer);
return RT_EOK;
}
setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS |
USB_REQ_TYPE_OTHER;
setup.request = USB_REQ_GET_STATUS;
setup.index = port;
setup.length = 4;
setup.value = 0;
if(rt_usb_hcd_control_xfer(uhub->hcd, uhub->self, &setup, buffer,
length, timeout) == timeout) return RT_EOK;
else return -RT_FALSE;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* USART Wait for Received Data Available.
Blocks until the receive data buffer holds a valid received data word. */ | void usart_wait_recv_ready(uint32_t usart) | /* USART Wait for Received Data Available.
Blocks until the receive data buffer holds a valid received data word. */
void usart_wait_recv_ready(uint32_t usart) | {
while ((USART_ISR(usart) & USART_ISR_RXNE) == 0);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Called on boot to increment a count stored in the EEPROM. This is used to ensure the CPU does not reset unexpectedly. */ | static void prvIncrementResetCount(void) | /* Called on boot to increment a count stored in the EEPROM. This is used to ensure the CPU does not reset unexpectedly. */
static void prvIncrementResetCount(void) | {
unsigned char ucCount;
const unsigned char ucReadBit = ( unsigned char ) 0x01;
const unsigned char ucWrite1 = ( unsigned char ) 0x04;
const unsigned char ucWrite2 = ( unsigned char ) 0x02;
EEARH = 0x00;
EEARL = 0x00;
EECR |= ucReadBit;
while( EECR & ucReadBit );
ucCount = EEDR;
ucCount++;
EEDR = ucCount;
EECR = ucWrite1;
EECR = ( ucWrite1 | ucWrite2 );
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* param base TSI peripheral base address. return TSI instance. */ | uint32_t TSI_GetInstance(TSI_Type *base) | /* param base TSI peripheral base address. return TSI instance. */
uint32_t TSI_GetInstance(TSI_Type *base) | {
uint32_t instance;
for (instance = 0U; instance < ARRAY_SIZE(s_tsiBases); instance++)
{
if (s_tsiBases[instance] == base)
{
break;
}
}
assert(instance < ARRAY_SIZE(s_tsiBases));
return instance;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get i2s audio sampling rate handled by device. */ | static uint32_t i2s_get_audio_freq(uintptr_t reg) | /* Get i2s audio sampling rate handled by device. */
static uint32_t i2s_get_audio_freq(uintptr_t reg) | {
uint32_t reg_data = litex_read32(reg + I2S_CONFIG_OFFSET);
reg_data &= I2S_CONF_LRCK_MASK;
return reg_data >> I2S_CONF_LRCK_FREQ_OFFSET;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Note that IRQs are guaranteed to be disabled. */ | static void __init get_assabet_scr(void) | /* Note that IRQs are guaranteed to be disabled. */
static void __init get_assabet_scr(void) | {
unsigned long scr, i;
GPDR |= 0x3fc;
GPSR = 0x3fc;
GPDR &= ~(0x3fc);
for(i = 100; i--; )
scr = GPLR;
GPDR |= 0x3fc;
scr &= 0x3fc;
SCR_value = scr;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* MTFSR: Forward space over 'count' tape blocks (blocksize is set via MTSETBLK. */ | int tape_std_mtfsr(struct tape_device *device, int mt_count) | /* MTFSR: Forward space over 'count' tape blocks (blocksize is set via MTSETBLK. */
int tape_std_mtfsr(struct tape_device *device, int mt_count) | {
struct tape_request *request;
struct ccw1 *ccw;
int rc;
request = tape_alloc_request(mt_count + 2, 0);
if (IS_ERR(request))
return PTR_ERR(request);
request->op = TO_FSB;
ccw = tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1,
device->modeset_byte);
ccw = tape_ccw_repeat(ccw, FORSPACEBLOCK, mt_count);
ccw = tape_ccw_end(ccw, NOP, 0, NULL);
rc = tape_do_io(device, request);
if (rc == 0 && request->rescnt > 0) {
DBF_LH(3, "FSR over tapemark\n");
rc = 1;
}
tape_free_request(request);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets all the alias' that were registered with the ShellCommandLib library. */ | EFI_STATUS SetBuiltInAlias(VOID) | /* Sets all the alias' that were registered with the ShellCommandLib library. */
EFI_STATUS SetBuiltInAlias(VOID) | {
EFI_STATUS Status;
CONST ALIAS_LIST *List;
ALIAS_LIST *Node;
List = ShellCommandGetInitAliasList ();
for ( Node = (ALIAS_LIST *)GetFirstNode (&List->Link)
; !IsNull (&List->Link, &Node->Link)
; Node = (ALIAS_LIST *)GetNextNode (&List->Link, &Node->Link)
)
{
Status = InternalSetAlias (Node->CommandString, Node->Alias, TRUE);
ASSERT_EFI_ERROR (Status);
}
return (EFI_SUCCESS);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Try to send data out on a channel. */ | static void ppp_channel_push(struct channel *pch) | /* Try to send data out on a channel. */
static void ppp_channel_push(struct channel *pch) | {
struct sk_buff *skb;
struct ppp *ppp;
spin_lock_bh(&pch->downl);
if (pch->chan) {
while (!skb_queue_empty(&pch->file.xq)) {
skb = skb_dequeue(&pch->file.xq);
if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
skb_queue_head(&pch->file.xq, skb);
break;
}
}
} else {
skb_queue_purge(&pch->file.xq);
}
spin_unlock_bh(&pch->downl);
if (skb_queue_empty(&pch->file.xq)) {
read_lock_bh(&pch->upl);
ppp = pch->ppp;
if (ppp)
ppp_xmit_process(ppp);
read_unlock_bh(&pch->upl);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Reads the ID registers of the PHY at @addr on the @bus, then allocates and returns the phy_device to represent it. */ | static struct phy_device* get_phy_device(struct mii_dev *bus, int addr, phy_interface_t interface) | /* Description: Reads the ID registers of the PHY at @addr on the @bus, then allocates and returns the phy_device to represent it. */
static struct phy_device* get_phy_device(struct mii_dev *bus, int addr, phy_interface_t interface) | {
return get_phy_device_by_mask(bus, 1 << addr, interface);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* To do O_SYNC writes, just queue the buffer writes with ll_rw_block as you dirty the buffers, and then use osync_inode_buffers to wait for completion. Any other dirty buffers which are not yet queued for write will not be flushed to disk by the osync. */ | static int osync_buffers_list(spinlock_t *lock, struct list_head *list) | /* To do O_SYNC writes, just queue the buffer writes with ll_rw_block as you dirty the buffers, and then use osync_inode_buffers to wait for completion. Any other dirty buffers which are not yet queued for write will not be flushed to disk by the osync. */
static int osync_buffers_list(spinlock_t *lock, struct list_head *list) | {
struct buffer_head *bh;
struct list_head *p;
int err = 0;
spin_lock(lock);
repeat:
list_for_each_prev(p, list) {
bh = BH_ENTRY(p);
if (buffer_locked(bh)) {
get_bh(bh);
spin_unlock(lock);
wait_on_buffer(bh);
if (!buffer_uptodate(bh))
err = -EIO;
brelse(bh);
spin_lock(lock);
goto repeat;
}
}
spin_unlock(lock);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the peripheral Preload register on CCM4. */ | void TMR_ConfigOC4Preload(TMR_T *tmr, TMR_OC_PRELOAD_T OCPreload) | /* Enables or disables the peripheral Preload register on CCM4. */
void TMR_ConfigOC4Preload(TMR_T *tmr, TMR_OC_PRELOAD_T OCPreload) | {
tmr->CCM2_COMPARE_B.OC4PEN = OCPreload;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Launches a request to start the calibration sequence. */ | void SDADC_StartCalibration(SDADC_TypeDef *SDADCx) | /* Launches a request to start the calibration sequence. */
void SDADC_StartCalibration(SDADC_TypeDef *SDADCx) | {
assert_param(IS_SDADC_ALL_PERIPH(SDADCx));
SDADCx->CR2 |= (uint32_t)SDADC_CR2_STARTCALIB;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* A zero BufferSize doesn't seem to be prohibited, so do nothing in that case, successfully. */ | EFI_STATUS EFIAPI VirtioBlkWriteBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer) | /* A zero BufferSize doesn't seem to be prohibited, so do nothing in that case, successfully. */
EFI_STATUS EFIAPI VirtioBlkWriteBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer) | {
VBLK_DEV *Dev;
EFI_STATUS Status;
if (BufferSize == 0) {
return EFI_SUCCESS;
}
Dev = VIRTIO_BLK_FROM_BLOCK_IO (This);
Status = VerifyReadWriteRequest (
&Dev->BlockIoMedia,
Lba,
BufferSize,
TRUE
);
if (EFI_ERROR (Status)) {
return Status;
}
return SynchronousRequest (
Dev,
Lba,
BufferSize,
Buffer,
TRUE
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* For Td guest TDVMCALL_MMIO is invoked to read MMIO registers. */ | UINT64 EFIAPI MmioRead64(IN UINTN Address) | /* For Td guest TDVMCALL_MMIO is invoked to read MMIO registers. */
UINT64 EFIAPI MmioRead64(IN UINTN Address) | {
UINT64 Value;
BOOLEAN Flag;
ASSERT ((Address & 7) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value);
if (Flag) {
MemoryFence ();
if (IsTdxGuest ()) {
Value = TdMmioRead64 (Address);
} else {
Value = *(volatile UINT64 *)Address;
}
MemoryFence ();
}
FilterAfterMmIoRead (FilterWidth64, Address, &Value);
return Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Switch programmable clock source selection to slow clock. */ | uint32_t pmc_switch_pck_to_sclk(uint32_t ul_id, uint32_t ul_pres) | /* Switch programmable clock source selection to slow clock. */
uint32_t pmc_switch_pck_to_sclk(uint32_t ul_id, uint32_t ul_pres) | {
uint32_t ul_timeout;
PMC->PMC_PCK[ul_id] = PMC_PCK_CSS_SLOW_CLK | ul_pres;
for (ul_timeout = PMC_TIMEOUT;
!(PMC->PMC_SR & (PMC_SR_PCKRDY0 << ul_id)); --ul_timeout) {
if (ul_timeout == 0) {
return 1;
}
}
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Install printk/stdout hook for Xtensa Simulator console output. */ | static void xt_sim_console_hook_install(void) | /* Install printk/stdout hook for Xtensa Simulator console output. */
static void xt_sim_console_hook_install(void) | {
__stdout_hook_install(arch_printk_char_out);
__printk_hook_install(arch_printk_char_out);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Check that C-style designated initializers are valid in C++ file. */ | static void test_initializers() __attribute__((unused)) | /* Check that C-style designated initializers are valid in C++ file. */
static void test_initializers() __attribute__((unused)) | {
sdmmc_host_t sdmmc_host = SDMMC_HOST_DEFAULT();
(void) sdmmc_host;
sdmmc_slot_config_t sdmmc_slot = SDMMC_SLOT_CONFIG_DEFAULT();
(void) sdmmc_slot;
sdmmc_host_t sdspi_host = SDSPI_HOST_DEFAULT();
(void) sdspi_host;
sdspi_slot_config_t sdspi_slot = SDSPI_SLOT_CONFIG_DEFAULT();
(void) sdspi_slot;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Fills each LPUART_InitStruct member with its default value. */ | void LPUART_StructInit(LPUART_InitType *LPUART_InitStruct) | /* Fills each LPUART_InitStruct member with its default value. */
void LPUART_StructInit(LPUART_InitType *LPUART_InitStruct) | {
LPUART_InitStruct->BaudRate = 9600;
LPUART_InitStruct->Parity = LPUART_PE_NO;
LPUART_InitStruct->Mode = LPUART_MODE_RX | LPUART_MODE_TX;
LPUART_InitStruct->RtsThreshold = LPUART_RTSTH_FIFOFU;
LPUART_InitStruct->HardwareFlowControl = LPUART_HFCTRL_NONE;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Calculate the last (inclusive) address of a range. */ | STATIC UINT64 GetRangeEnd(IN UINT64 Start, IN UINT64 Size, IN UINT64 MaxValue) | /* Calculate the last (inclusive) address of a range. */
STATIC UINT64 GetRangeEnd(IN UINT64 Start, IN UINT64 Size, IN UINT64 MaxValue) | {
if (IS_RANGE_INVALID (Start, Size, MaxValue)) {
return 0;
}
return Start + Size - 1;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Worker function. Search stream database for requested stream handle. */ | EFI_STATUS FindStreamNode(IN UINTN SearchHandle, OUT CORE_SECTION_STREAM_NODE **FoundStream) | /* Worker function. Search stream database for requested stream handle. */
EFI_STATUS FindStreamNode(IN UINTN SearchHandle, OUT CORE_SECTION_STREAM_NODE **FoundStream) | {
CORE_SECTION_STREAM_NODE *StreamNode;
if (!IsListEmpty (&mStreamRoot)) {
StreamNode = STREAM_NODE_FROM_LINK (GetFirstNode (&mStreamRoot));
for ( ; ;) {
if (StreamNode->StreamHandle == SearchHandle) {
*FoundStream = StreamNode;
return EFI_SUCCESS;
} else if (IsNodeAtEnd (&mStreamRoot, &StreamNode->Link)) {
break;
} else {
StreamNode = STREAM_NODE_FROM_LINK (GetNextNode (&mStreamRoot, &StreamNode->Link));
}
}
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sleep until data has arrive. But check for races.. */ | static long unix_stream_data_wait(struct sock *sk, long timeo) | /* Sleep until data has arrive. But check for races.. */
static long unix_stream_data_wait(struct sock *sk, long timeo) | {
DEFINE_WAIT(wait);
unix_state_lock(sk);
for (;;) {
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
if (!skb_queue_empty(&sk->sk_receive_queue) ||
sk->sk_err ||
(sk->sk_shutdown & RCV_SHUTDOWN) ||
signal_pending(current) ||
!timeo)
break;
set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
unix_state_unlock(sk);
timeo = schedule_timeout(timeo);
unix_state_lock(sk);
clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
}
finish_wait(sk->sk_sleep, &wait);
unix_state_unlock(sk);
return timeo;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set GPIO port mask register of the specified GPIO pin(s).
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 GPIOPinMaskSet(unsigned long ulPort, unsigned long ulPins) | /* Set GPIO port mask register of the specified GPIO pin(s).
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 GPIOPinMaskSet(unsigned long ulPort, unsigned long ulPins) | {
xHWREG(ulPort + GPIO_DMASK) |= ulPins;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Called to do the PIO mode setup. Our timing registers are shared but we want to set the PIO timing by default. */ | static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev) | /* Called to do the PIO mode setup. Our timing registers are shared but we want to set the PIO timing by default. */
static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev) | {
sl82c105_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Fills each compConfig member with initial value value. */ | void COMP_ConfigStructInit(COMP_Config_T *compConfig) | /* Fills each compConfig member with initial value value. */
void COMP_ConfigStructInit(COMP_Config_T *compConfig) | {
compConfig->invertingInput = COMP_INVERTING_INPUT_1_4VREFINT;
compConfig->output = COMP_OUTPUT_NONE;
compConfig->outputPol = COMP_OUTPUTPOL_NONINVERTED;
compConfig->hysterrsis = COMP_HYSTERRSIS_NO;
compConfig->mode = COMP_MODE_HIGHSPEED;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Build a route cache holding all routes currently configured in the kernel */ | int rtnl_route_alloc_cache(struct nl_sock *sk, int family, int flags, struct nl_cache **result) | /* Build a route cache holding all routes currently configured in the kernel */
int rtnl_route_alloc_cache(struct nl_sock *sk, int family, int flags, struct nl_cache **result) | {
struct nl_cache *cache;
int err;
if (!(cache = nl_cache_alloc(&rtnl_route_ops)))
return -NLE_NOMEM;
cache->c_iarg1 = family;
cache->c_iarg2 = flags;
if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
free(cache);
return err;
}
*result = cache;
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Encodes the message length according to the MQTT algorithm */ | int MQTTPacket_encode(unsigned char *buf, int length) | /* Encodes the message length according to the MQTT algorithm */
int MQTTPacket_encode(unsigned char *buf, int length) | {
char d = length % 128;
length /= 128;
if (length > 0)
d |= 0x80;
buf[rc++] = d;
} while (length > 0);
FUNC_EXIT_RC(rc);
return rc;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Function for dispatching the correct state action for data erase with a swap composite state upon a flash operation success event. */ | static void swap_sub_state_sm_run(void) | /* Function for dispatching the correct state action for data erase with a swap composite state upon a flash operation success event. */
static void swap_sub_state_sm_run(void) | {
static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) =
{
swap_erase_state_run,
data_to_swap_write_state_run,
data_page_erase_state_run,
tail_restore_state_run,
head_restore_state_run
};
swap_sub_state_sm_lut[m_swap_sub_state]();
} | labapart/polymcu | C++ | null | 201 |
/* Can be called by a LLD or iscsi_transport. There must not be any running connections. */ | int iscsi_destroy_session(struct iscsi_cls_session *session) | /* Can be called by a LLD or iscsi_transport. There must not be any running connections. */
int iscsi_destroy_session(struct iscsi_cls_session *session) | {
iscsi_remove_session(session);
ISCSI_DBG_TRANS_SESSION(session, "Completing session destruction\n");
iscsi_free_session(session);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.