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 |
|---|---|---|---|---|---|---|---|
/* brief Returns instance number for LP_FLEXCOMM module with given base address. */ | uint32_t LP_FLEXCOMM_GetInstance(void *base) | /* brief Returns instance number for LP_FLEXCOMM module with given base address. */
uint32_t LP_FLEXCOMM_GetInstance(void *base) | {
uint32_t i;
pvoid_to_u32_t BaseAddr;
BaseAddr.pvoid = base;
for (i = 0U; i < (uint32_t)ARRAY_SIZE(s_lpflexcommBaseAddrs); i++)
{
if (BaseAddr.u32 == s_lpflexcommBaseAddrs[i])
{
break;
}
}
assert(i < (uint32_t)ARRAY_SIZE(s_lpflexcommBaseAddrs));
return i;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* mux the pin to the "A" internal peripheral role. */ | int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup) | /* mux the pin to the "A" internal peripheral role. */
int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup) | {
void __iomem *pio = pin_to_controller(pin);
unsigned mask = pin_to_mask(pin);
if (!pio)
return -EINVAL;
__raw_writel(mask, pio + PIO_IDR);
__raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
__raw_writel(mask, pio + PIO_ASR);
__raw_writel(mask, pio + PIO_PDR);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables the selected ADC software start conversion of the regular channels. */ | void ADC_SoftwareStartConv(ADC_T *adc) | /* Enables the selected ADC software start conversion of the regular channels. */
void ADC_SoftwareStartConv(ADC_T *adc) | {
adc->CTRL2_B.REGCHSC = BIT_SET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This routine will put a word on the process kernel stack. */ | static int put_stack_long(struct task_struct *task, int offset, unsigned long data) | /* This routine will put a word on the process kernel stack. */
static int put_stack_long(struct task_struct *task, int offset, unsigned long data) | {
unsigned char *stack;
stack = (unsigned char *)task_pt_regs(task);
stack += offset;
*(unsigned long *) stack = data;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */ | void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload) | /* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */
void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload) | {
SysCtlIpClockSourceSet(SYSCTL_PERIPH_WDG, ulConfig);
WDTimerInit(ulReload);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns: Number of bytes skipped, or -1 on error */ | gssize g_input_stream_skip(GInputStream *stream, gsize count, GCancellable *cancellable, GError **error) | /* Returns: Number of bytes skipped, or -1 on error */
gssize g_input_stream_skip(GInputStream *stream, gsize count, GCancellable *cancellable, GError **error) | {
GInputStreamClass *class;
gssize res;
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), -1);
if (count == 0)
return 0;
if (((gssize) count) < 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), G_STRFUNC);
return -1;
}
class = G_INPUT_STREAM_GET_CLASS (stream);
if (!g_input_stream_set_pending (stream, error))
return -1;
if (cancellable)
g_cancellable_push_current (cancellable);
res = class->skip (stream, count, cancellable, error);
if (cancellable)
g_cancellable_pop_current (cancellable);
g_input_stream_clear_pending (stream);
return res;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Check if HDMI vendor specific data block is present in CEA block */ | static bool cea_is_hdmi_vsdb_present(struct edid_cea861_info *info) | /* Check if HDMI vendor specific data block is present in CEA block */
static bool cea_is_hdmi_vsdb_present(struct edid_cea861_info *info) | {
u8 end, i = 0;
end = info->dtd_offset;
if (end == 0)
end = sizeof(info->data);
if (end < 4 || end > sizeof(info->data))
return false;
end -= 4;
while (i < end) {
if ((EDID_CEA861_DB_TYPE(*info, i) == EDID_CEA861_DB_VENDOR) &&
(EDID_CEA861_DB_LEN(*info, i) >= 5)) {
u8 *db = &info->data[i + 1];
u32 oui = db[0] | (db[1] << 8) | (db[2] << 16);
if (oui == HDMI_IEEE_OUI)
return true;
}
i += EDID_CEA861_DB_LEN(*info, i) + 1;
}
return false;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This is the rename() entry in the inode_operations structure for regular HFS directories. The purpose is to rename an existing file or directory, given the inode for the current directory and the name (and its length) of the existing file/directory and the inode for the new directory and the name (and its length) of the new file/directory. XXX: how do you handle must_be dir? */ | static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) | /* This is the rename() entry in the inode_operations structure for regular HFS directories. The purpose is to rename an existing file or directory, given the inode for the current directory and the name (and its length) of the existing file/directory and the inode for the new directory and the name (and its length) of the new file/directory. XXX: how do you handle must_be dir? */
static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) | {
int res;
if (new_dentry->d_inode) {
res = hfs_unlink(new_dir, new_dentry);
if (res)
return res;
}
res = hfs_cat_move(old_dentry->d_inode->i_ino,
old_dir, &old_dentry->d_name,
new_dir, &new_dentry->d_name);
if (!res)
hfs_cat_build_key(old_dir->i_sb,
(btree_key *)&HFS_I(old_dentry->d_inode)->cat_key,
new_dir->i_ino, &new_dentry->d_name);
return res;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function parses the ACPI SSDT table. When trace is enabled this function parses the SSDT table and traces the ACPI table fields. For the SSDT table only the ACPI header fields are parsed and traced. */ | VOID EFIAPI ParseAcpiSsdt(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision) | /* This function parses the ACPI SSDT table. When trace is enabled this function parses the SSDT table and traces the ACPI table fields. For the SSDT table only the ACPI header fields are parsed and traced. */
VOID EFIAPI ParseAcpiSsdt(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision) | {
if (!Trace) {
return;
}
DumpAcpiHeader (Ptr);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* tipc_disc_stop_link_req - stop sending periodic link setup requests @req: ptr to link request structure */ | void tipc_disc_stop_link_req(struct link_req *req) | /* tipc_disc_stop_link_req - stop sending periodic link setup requests @req: ptr to link request structure */
void tipc_disc_stop_link_req(struct link_req *req) | {
if (!req)
return;
k_cancel_timer(&req->timer);
k_term_timer(&req->timer);
buf_discard(req->buf);
kfree(req);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* initialize the structure of IPA foreground parameter struct with the default values, it is suggested that call this function after an ipa_foreground_parameter_struct structure is defined */ | void ipa_foreground_struct_para_init(ipa_foreground_parameter_struct *foreground_struct) | /* initialize the structure of IPA foreground parameter struct with the default values, it is suggested that call this function after an ipa_foreground_parameter_struct structure is defined */
void ipa_foreground_struct_para_init(ipa_foreground_parameter_struct *foreground_struct) | {
foreground_struct->foreground_memaddr = IPA_DEFAULT_VALUE;
foreground_struct->foreground_lineoff = IPA_DEFAULT_VALUE;
foreground_struct->foreground_prealpha = IPA_DEFAULT_VALUE;
foreground_struct->foreground_alpha_algorithm = IPA_FG_ALPHA_MODE_0;
foreground_struct->foreground_pf = FOREGROUND_PPF_ARGB8888;
foreground_struct->foreground_prered = IPA_DEFAULT_VALUE;
foreground_struct->foreground_pregreen = IPA_DEFAULT_VALUE;
foreground_struct->foreground_preblue = IPA_DEFAULT_VALUE;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ | VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer) | /* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer) | {
VOID *NewBuffer;
NewBuffer = InternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);
if (NewBuffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_COPY_POOL,
EfiBootServicesData,
NewBuffer,
AllocationSize,
NULL
);
}
return NewBuffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Write a value to an 8 bit register in the LIS3DH. */ | static int lis3dh_write_reg(const lis3dh_t *dev, const lis3dh_reg_t reg, const uint8_t value) | /* Write a value to an 8 bit register in the LIS3DH. */
static int lis3dh_write_reg(const lis3dh_t *dev, const lis3dh_reg_t reg, const uint8_t value) | {
uint8_t addr = (reg & LIS3DH_SPI_ADDRESS_MASK) | LIS3DH_SPI_WRITE_MASK | LIS3DH_SPI_SINGLE_MASK;
spi_acquire(dev->spi);
gpio_clear(dev->cs);
if (spi_transfer_reg(dev->spi, addr, value, NULL) < 0) {
gpio_set(dev->cs);
spi_release(dev->spi);
return -1;
}
gpio_set(dev->cs);
spi_release(dev->spi);
return 0;
} | labapart/polymcu | C++ | null | 201 |
/* The return value is a combination of the values described in the */ | uint32_t HibernateLowBatGet(void) | /* The return value is a combination of the values described in the */
uint32_t HibernateLowBatGet(void) | {
return(HWREG(HIB_CTL) & (HIB_CTL_VBATSEL_M | HIBERNATE_LOW_BAT_ABORT));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This is the generic lockd callback for async RPC calls */ | static void nlm4svc_callback_exit(struct rpc_task *task, void *data) | /* This is the generic lockd callback for async RPC calls */
static void nlm4svc_callback_exit(struct rpc_task *task, void *data) | {
dprintk("lockd: %5u callback returned %d\n", task->tk_pid,
-task->tk_status);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This upgrades the mode on an already open dm_dev, being careful to leave things as they were if we fail to reopen the device and not to touch the existing bdev field in case it is accessed concurrently inside dm_table_any_congested(). */ | static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, struct mapped_device *md) | /* This upgrades the mode on an already open dm_dev, being careful to leave things as they were if we fail to reopen the device and not to touch the existing bdev field in case it is accessed concurrently inside dm_table_any_congested(). */
static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, struct mapped_device *md) | {
int r;
struct dm_dev_internal dd_new, dd_old;
dd_new = dd_old = *dd;
dd_new.dm_dev.mode |= new_mode;
dd_new.dm_dev.bdev = NULL;
r = open_dev(&dd_new, dd->dm_dev.bdev->bd_dev, md);
if (r)
return r;
dd->dm_dev.mode |= new_mode;
close_dev(&dd_old, md);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* To find CTL index(0~23) return 24(AR5416_NUM_CTLS)=>no desired index found */ | u8_t zfFindCtlEdgesIndex(zdev_t *dev, u8_t desired_CtlIndex) | /* To find CTL index(0~23) return 24(AR5416_NUM_CTLS)=>no desired index found */
u8_t zfFindCtlEdgesIndex(zdev_t *dev, u8_t desired_CtlIndex) | {
u8_t i;
struct zsHpPriv* hpPriv;
struct ar5416Eeprom* eepromImage;
zmw_get_wlan_dev(dev);
hpPriv = wd->hpPrivate;
eepromImage = (struct ar5416Eeprom*)&(hpPriv->eepromImage[(1024+512)/4]);
for (i = 0; i < AR5416_NUM_CTLS; i++)
{
if(desired_CtlIndex == eepromImage->ctlIndex[i])
break;
}
return i;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configue RGB swap mode and RGB pattern when RGB_MODE is set to 1. */ | void isi_rgb_configue(Isi *p_isi, uint8_t patten, uint8_t swap) | /* Configue RGB swap mode and RGB pattern when RGB_MODE is set to 1. */
void isi_rgb_configue(Isi *p_isi, uint8_t patten, uint8_t swap) | {
p_isi->ISI_CFG2 = _isi_get_CFG2_workaround() | ISI_CFG2_RGB_CFG(patten);
if(swap) {
p_isi->ISI_CFG2 = _isi_get_CFG2_workaround() | (ISI_CFG2_RGB_SWAP);
} else {
p_isi->ISI_CFG2 = _isi_get_CFG2_workaround() & (~ISI_CFG2_RGB_SWAP);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Read available data from the read FIFO, as 16-bit data items. */ | uint32_t EPINonBlockingReadGet16(uint32_t ui32Base, uint32_t ui32Count, uint16_t *pui16Buf) | /* Read available data from the read FIFO, as 16-bit data items. */
uint32_t EPINonBlockingReadGet16(uint32_t ui32Base, uint32_t ui32Count, uint16_t *pui16Buf) | {
uint32_t ui32CountRead = 0;
ASSERT(ui32Base == EPI0_BASE);
ASSERT(ui32Count < 4096);
ASSERT(pui16Buf);
while (HWREG(ui32Base + EPI_O_RFIFOCNT) && ui32Count--)
{
*pui16Buf = (uint16_t)HWREG(ui32Base + EPI_O_READFIFO0);
pui16Buf++;
ui32CountRead++;
}
return (ui32CountRead);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deallocate the memory used by an attribute definition */ | static void xmlFreeAttribute(xmlAttributePtr attr) | /* Deallocate the memory used by an attribute definition */
static void xmlFreeAttribute(xmlAttributePtr attr) | {
if ((attr->elem != NULL) && (!xmlDictOwns(dict, attr->elem)))
xmlFree((xmlChar *) attr->elem);
if ((attr->name != NULL) && (!xmlDictOwns(dict, attr->name)))
xmlFree((xmlChar *) attr->name);
if ((attr->prefix != NULL) && (!xmlDictOwns(dict, attr->prefix)))
xmlFree((xmlChar *) attr->prefix);
if ((attr->defaultValue != NULL) &&
(!xmlDictOwns(dict, attr->defaultValue)))
xmlFree((xmlChar *) attr->defaultValue);
} else {
if (attr->elem != NULL)
xmlFree((xmlChar *) attr->elem);
if (attr->name != NULL)
xmlFree((xmlChar *) attr->name);
if (attr->defaultValue != NULL)
xmlFree((xmlChar *) attr->defaultValue);
if (attr->prefix != NULL)
xmlFree((xmlChar *) attr->prefix);
}
xmlFree(attr);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Trigger possible interrupt events after an input pin has changed.
The caller must ensure that */ | static void gpio_emul_pend_interrupt(const struct device *port, gpio_port_pins_t mask, gpio_port_value_t prev_values, gpio_port_value_t values) | /* Trigger possible interrupt events after an input pin has changed.
The caller must ensure that */
static void gpio_emul_pend_interrupt(const struct device *port, gpio_port_pins_t mask, gpio_port_value_t prev_values, gpio_port_value_t values) | {
gpio_port_pins_t interrupts;
struct gpio_emul_data *drv_data =
(struct gpio_emul_data *)port->data;
k_spinlock_key_t key;
key = k_spin_lock(&drv_data->lock);
gpio_emul_gen_interrupt_bits(port, mask, prev_values, values,
&interrupts, true);
while (interrupts != 0) {
k_spin_unlock(&drv_data->lock, key);
gpio_fire_callbacks(&drv_data->callbacks, port, interrupts);
key = k_spin_lock(&drv_data->lock);
drv_data->interrupts &= ~interrupts;
gpio_emul_gen_interrupt_bits(port, mask, prev_values, values,
&interrupts, false);
}
k_spin_unlock(&drv_data->lock, key);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* The user Entry Point for module CpuIo2Dxe. The user code starts with this function. */ | EFI_STATUS EFIAPI CpuIo2Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module CpuIo2Dxe. The user code starts with this function. */
EFI_STATUS EFIAPI CpuIo2Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiCpuIo2ProtocolGuid);
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEfiCpuIo2ProtocolGuid,
&mCpuIo2,
NULL
);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function initializes a CRC algorithm, i.e. fills the psCrcContext_t structure pointed to by ctx with necessary data. */ | int tls_crypto_crc_init(psCrcContext_t *ctx, u32 key, CRYPTO_CRC_TYPE crc_type, u8 mode) | /* This function initializes a CRC algorithm, i.e. fills the psCrcContext_t structure pointed to by ctx with necessary data. */
int tls_crypto_crc_init(psCrcContext_t *ctx, u32 key, CRYPTO_CRC_TYPE crc_type, u8 mode) | {
ctx->state = key;
ctx->type = crc_type;
ctx->mode = mode;
return ERR_CRY_OK;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Drop the i-th range from the early reservation map, by copying any higher ranges down one over it, and clearing what had been the last slot. */ | static void __init drop_range(int i) | /* Drop the i-th range from the early reservation map, by copying any higher ranges down one over it, and clearing what had been the last slot. */
static void __init drop_range(int i) | {
int j;
for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
;
memmove(&early_res[i], &early_res[i + 1],
(j - 1 - i) * sizeof(struct early_res));
early_res[j - 1].end = 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Add a protocol handler to the hash tables */ | int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) | /* Add a protocol handler to the hash tables */
int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) | {
int hash, ret;
hash = protocol & (MAX_INET_PROTOS - 1);
spin_lock_bh(&inet_proto_lock);
if (inet_protos[hash]) {
ret = -1;
} else {
inet_protos[hash] = prot;
ret = 0;
}
spin_unlock_bh(&inet_proto_lock);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes the Low Level portion of the Host driver. */ | USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | /* Initializes the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | {
hhcd.Instance = USB_OTG_FS;
hhcd.Init.Host_channels = 11;
hhcd.Init.dma_enable = 0;
hhcd.Init.low_power_enable = 0;
hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd.Init.Sof_enable = 0;
hhcd.Init.speed = HCD_SPEED_FULL;
hhcd.pData = phost;
phost->pData = &hhcd;
HAL_HCD_Init(&hhcd);
USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd));
return USBH_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* USB hub control transfer to set the hub depth. */ | EFI_STATUS PeiUsbHubCtrlSetHubDepth(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi) | /* USB hub control transfer to set the hub depth. */
EFI_STATUS PeiUsbHubCtrlSetHubDepth(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi) | {
EFI_USB_DEVICE_REQUEST DevReq;
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
DevReq.RequestType = USB_RT_HUB;
DevReq.Request = USB_HUB_REQ_SET_DEPTH;
DevReq.Value = PeiUsbDevice->Tier;
DevReq.Length = 0;
return UsbIoPpi->UsbControlTransfer (
PeiServices,
UsbIoPpi,
&DevReq,
EfiUsbNoData,
PcdGet32 (PcdUsbTransferTimeoutValue),
NULL,
0
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Add multicast single-source filter to the interface list */ | static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, __be32 *psfsrc, int delta) | /* Add multicast single-source filter to the interface list */
static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, __be32 *psfsrc, int delta) | {
struct ip_sf_list *psf, *psf_prev;
psf_prev = NULL;
for (psf=pmc->sources; psf; psf=psf->sf_next) {
if (psf->sf_inaddr == *psfsrc)
break;
psf_prev = psf;
}
if (!psf) {
psf = kzalloc(sizeof(*psf), GFP_ATOMIC);
if (!psf)
return -ENOBUFS;
psf->sf_inaddr = *psfsrc;
if (psf_prev) {
psf_prev->sf_next = psf;
} else
pmc->sources = psf;
}
psf->sf_count[sfmode]++;
if (psf->sf_count[sfmode] == 1) {
ip_rt_multicast_event(pmc->interface);
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Device is about to be destroyed: clean up. */ | void ip_mc_destroy_dev(struct in_device *in_dev) | /* Device is about to be destroyed: clean up. */
void ip_mc_destroy_dev(struct in_device *in_dev) | {
struct ip_mc_list *i;
ASSERT_RTNL();
ip_mc_down(in_dev);
write_lock_bh(&in_dev->mc_list_lock);
while ((i = in_dev->mc_list) != NULL) {
in_dev->mc_list = i->next;
in_dev->mc_count--;
write_unlock_bh(&in_dev->mc_list_lock);
igmp_group_dropped(i);
ip_ma_put(i);
write_lock_bh(&in_dev->mc_list_lock);
}
write_unlock_bh(&in_dev->mc_list_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Waits to send a character from the specified port. */ | void UARTCharPut(uint32_t ui32Base, unsigned char ucData) | /* Waits to send a character from the specified port. */
void UARTCharPut(uint32_t ui32Base, unsigned char ucData) | {
ASSERT(_UARTBaseValid(ui32Base));
while (HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF)
{
}
HWREG(ui32Base + UART_O_DR) = ucData;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is executed in case of error occurrence. */ | static void Error_Handler(void) | /* This function is executed in case of error occurrence. */
static void Error_Handler(void) | {
while(1)
{
BSP_LED_Toggle(LED4);
HAL_Delay(1000);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Called on a write from the origin driver. */ | static int do_origin(struct dm_dev *origin, struct bio *bio) | /* Called on a write from the origin driver. */
static int do_origin(struct dm_dev *origin, struct bio *bio) | {
struct origin *o;
int r = DM_MAPIO_REMAPPED;
down_read(&_origins_lock);
o = __lookup_origin(origin->bdev);
if (o)
r = __origin_write(&o->snapshots, bio->bi_sector, bio);
up_read(&_origins_lock);
return r;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Transparency for palette pixel formats is not supported at the moment. */ | static uint32_t pxafb_var_to_lccr3(struct fb_var_screeninfo *var) | /* Transparency for palette pixel formats is not supported at the moment. */
static uint32_t pxafb_var_to_lccr3(struct fb_var_screeninfo *var) | {
int bpp = pxafb_var_to_bpp(var);
uint32_t lccr3;
if (bpp < 0)
return 0;
lccr3 = LCCR3_BPP(bpp);
switch (var_to_depth(var)) {
case 16: lccr3 |= var->transp.length ? LCCR3_PDFOR_3 : 0; break;
case 18: lccr3 |= LCCR3_PDFOR_3; break;
case 24: lccr3 |= var->transp.length ? LCCR3_PDFOR_2 : LCCR3_PDFOR_3;
break;
case 19:
case 25: lccr3 |= LCCR3_PDFOR_0; break;
}
return lccr3;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Release the backing device of a uwb_dev that has been dynamically allocated. */ | static void uwb_dev_sys_release(struct device *dev) | /* Release the backing device of a uwb_dev that has been dynamically allocated. */
static void uwb_dev_sys_release(struct device *dev) | {
struct uwb_dev *uwb_dev = to_uwb_dev(dev);
uwb_bce_put(uwb_dev->bce);
memset(uwb_dev, 0x69, sizeof(*uwb_dev));
kfree(uwb_dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Power down the PHY so no link is implied when interface is down. The PHY cannot be powered down if management or WoL is active. */ | static void e1000_power_down_phy(struct e1000_adapter *adapter) | /* Power down the PHY so no link is implied when interface is down. The PHY cannot be powered down if management or WoL is active. */
static void e1000_power_down_phy(struct e1000_adapter *adapter) | {
if (adapter->wol)
return;
if (adapter->hw.phy.ops.power_down)
adapter->hw.phy.ops.power_down(&adapter->hw);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* AllocVmbusChannel - Allocate and initialize a vmbus channel object */ | struct vmbus_channel* AllocVmbusChannel(void) | /* AllocVmbusChannel - Allocate and initialize a vmbus channel object */
struct vmbus_channel* AllocVmbusChannel(void) | {
struct vmbus_channel *channel;
channel = kzalloc(sizeof(*channel), GFP_ATOMIC);
if (!channel)
return NULL;
spin_lock_init(&channel->inbound_lock);
init_timer(&channel->poll_timer);
channel->poll_timer.data = (unsigned long)channel;
channel->poll_timer.function = VmbusChannelOnTimer;
channel->ControlWQ = create_workqueue("hv_vmbus_ctl");
if (!channel->ControlWQ) {
kfree(channel);
return NULL;
}
return channel;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* host send ctrl request to set line coding to config Baud rate/Stop bits/Parity/Data bits */ | HOST_STATUS usb_host_cdc_setlinecoding(usb_core_instance *pdev, USBH_HOST *phost) | /* host send ctrl request to set line coding to config Baud rate/Stop bits/Parity/Data bits */
HOST_STATUS usb_host_cdc_setlinecoding(usb_core_instance *pdev, USBH_HOST *phost) | {
phost->ctrlparam.setup.b.bmRequestType = USB_H2D | USB_REQ_TYPE_CLASS | \
USB_REQ_RECIPIENT_INTERFACE;
phost->ctrlparam.setup.b.bRequest = CDC_SET_LINE_CODING;
phost->ctrlparam.setup.b.wValue.w = 0;
phost->ctrlparam.setup.b.wIndex.w = CDC_Desc.CDC_UnionFuncDesc.bControlInterface;
phost->ctrlparam.setup.b.wLength.w = LINE_CODING_STRUCTURE_SIZE;
return usb_host_ctrlreq(pdev, phost, CDC_SetLineCode.Array, LINE_CODING_STRUCTURE_SIZE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* gfs2_rlist_free - free a resource group list @list: the list of resource groups */ | void gfs2_rlist_free(struct gfs2_rgrp_list *rlist) | /* gfs2_rlist_free - free a resource group list @list: the list of resource groups */
void gfs2_rlist_free(struct gfs2_rgrp_list *rlist) | {
unsigned int x;
kfree(rlist->rl_rgd);
if (rlist->rl_ghs) {
for (x = 0; x < rlist->rl_rgrps; x++)
gfs2_holder_uninit(&rlist->rl_ghs[x]);
kfree(rlist->rl_ghs);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This API is used to get the interrupt fifo watermark enable interrupt status in the register 0x17 bit 6. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr_fifo_wm(u8 *fifo_wm_u8) | /* This API is used to get the interrupt fifo watermark enable interrupt status in the register 0x17 bit 6. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr_fifo_wm(u8 *fifo_wm_u8) | {
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr,
BMA2x2_INTR_FIFO_WM_ENABLE_INTR_REG,
&data_u8, BMA2x2_GEN_READ_WRITE_LENGTH);
*fifo_wm_u8 = BMA2x2_GET_BITSLICE
(data_u8, BMA2x2_INTR_FIFO_WM_ENABLE_INTR);
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Worker function. Determine if the input stream:child matches the input type. */ | BOOLEAN ChildIsType(IN CORE_SECTION_STREAM_NODE *Stream, IN CORE_SECTION_CHILD_NODE *Child, IN EFI_SECTION_TYPE SearchType, IN EFI_GUID *SectionDefinitionGuid) | /* Worker function. Determine if the input stream:child matches the input type. */
BOOLEAN ChildIsType(IN CORE_SECTION_STREAM_NODE *Stream, IN CORE_SECTION_CHILD_NODE *Child, IN EFI_SECTION_TYPE SearchType, IN EFI_GUID *SectionDefinitionGuid) | {
EFI_GUID_DEFINED_SECTION *GuidedSection;
if (SearchType == EFI_SECTION_ALL) {
return TRUE;
}
if (Child->Type != SearchType) {
return FALSE;
}
if ((SearchType != EFI_SECTION_GUID_DEFINED) || (SectionDefinitionGuid == NULL)) {
return TRUE;
}
GuidedSection = (EFI_GUID_DEFINED_SECTION *)(Stream->StreamBuffer + Child->OffsetInStream);
if (IS_SECTION2 (GuidedSection)) {
return CompareGuid (&(((EFI_GUID_DEFINED_SECTION2 *)GuidedSection)->SectionDefinitionGuid), SectionDefinitionGuid);
} else {
return CompareGuid (&GuidedSection->SectionDefinitionGuid, SectionDefinitionGuid);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* @dev: pin controller device @pin: the pin name to look up */ | static int pinctrl_pin_name_to_selector(struct udevice *dev, const char *pin) | /* @dev: pin controller device @pin: the pin name to look up */
static int pinctrl_pin_name_to_selector(struct udevice *dev, const char *pin) | {
const struct pinctrl_ops *ops = pinctrl_get_ops(dev);
unsigned npins, selector;
if (!ops->get_pins_count || !ops->get_pin_name) {
dev_dbg(dev, "get_pins_count or get_pin_name missing\n");
return -ENOSYS;
}
npins = ops->get_pins_count(dev);
for (selector = 0; selector < npins; selector++) {
const char *pname = ops->get_pin_name(dev, selector);
if (!strcmp(pin, pname))
return selector;
}
return -ENOSYS;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Apply all entries in the replay list to the TNC. Returns zero in case of success and a negative error code in case of failure. */ | static int apply_replay_list(struct ubifs_info *c) | /* Apply all entries in the replay list to the TNC. Returns zero in case of success and a negative error code in case of failure. */
static int apply_replay_list(struct ubifs_info *c) | {
struct replay_entry *r;
int err;
list_sort(c, &c->replay_list, &replay_entries_cmp);
list_for_each_entry(r, &c->replay_list, list) {
cond_resched();
err = apply_replay_entry(c, r);
if (err)
return err;
}
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns: 1 on success (it fits), 0 on failure (it doesn't fit) */ | static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al) | /* Returns: 1 on success (it fits), 0 on failure (it doesn't fit) */
static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al) | {
struct gfs2_sbd *sdp = rgd->rd_sbd;
int ret = 0;
if (rgd->rd_flags & (GFS2_RGF_NOALLOC | GFS2_RDF_ERROR))
return 0;
spin_lock(&sdp->sd_rindex_spin);
if (rgd->rd_free_clone >= al->al_requested) {
al->al_rgd = rgd;
ret = 1;
}
spin_unlock(&sdp->sd_rindex_spin);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Waits for a character from the specified port. */ | unsigned char UARTCharGet(unsigned long ulBase) | /* Waits for a character from the specified port. */
unsigned char UARTCharGet(unsigned long ulBase) | {
unsigned long ulChar = 0;
volatile unsigned char ulStatus = 0;
xASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) ||
(ulBase == UART2_BASE) );
do
{
ulStatus = xHWREGB(ulBase + UART_012_S1) &
((unsigned char ) UART_012_S1_RDRF_MASK);
}while(0 == ulStatus);
ulChar = xHWREGB(ulBase + UART_012_D);
return (ulChar);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* select the HS1 or HS2 for DCO Freq return : CLKCTRL */ | static u32 pll_dco_freq_sel(u32 clkout_dco) | /* select the HS1 or HS2 for DCO Freq return : CLKCTRL */
static u32 pll_dco_freq_sel(u32 clkout_dco) | {
if (clkout_dco >= DCO_HS2_MIN && clkout_dco < DCO_HS2_MAX)
return SELFREQDCO_HS2;
else if (clkout_dco >= DCO_HS1_MIN && clkout_dco < DCO_HS1_MAX)
return SELFREQDCO_HS1;
else
return -1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @hsotg: The device state: @periodic: True if this is a periodic FIFO interrupt */ | static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic) | /* s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @hsotg: The device state: @periodic: True if this is a periodic FIFO interrupt */
static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic) | {
struct s3c_hsotg_ep *ep;
int epno, ret;
for (epno = 0; epno < S3C_HSOTG_EPS; epno++) {
ep = &hsotg->eps[epno];
if (!ep->dir_in)
continue;
if ((periodic && !ep->periodic) ||
(!periodic && ep->periodic))
continue;
ret = s3c_hsotg_trytx(hsotg, ep);
if (ret < 0)
break;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable I2C Range Address Matching of the specified I2C port.
The */ | void I2CRangeAddrEnable(unsigned long ulBase, unsigned long ulRangeAddress) | /* Enable I2C Range Address Matching of the specified I2C port.
The */
void I2CRangeAddrEnable(unsigned long ulBase, unsigned long ulRangeAddress) | {
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xHWREGB(ulBase + I2C_CON2) |= I2C_CON2_RMEN;
xHWREGB(ulBase + I2C_RA) = ulRangeAddress << 1;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Set write enable latch with Write Enable command. Returns negative if error occurred. */ | static int write_enable(struct m25p *flash) | /* Set write enable latch with Write Enable command. Returns negative if error occurred. */
static int write_enable(struct m25p *flash) | {
u8 code = OPCODE_WREN;
return spi_write_then_read(flash->spi, &code, 1, NULL, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Send a piece of data for SPI.
This function computes the number of data to be written into D register or Tx FIFO, and write the data into it. At the same time, this function updates the values in master handle structure. */ | static void FLEXIO_SPI_TransferSendTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle) | /* Send a piece of data for SPI.
This function computes the number of data to be written into D register or Tx FIFO, and write the data into it. At the same time, this function updates the values in master handle structure. */
static void FLEXIO_SPI_TransferSendTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle) | {
uint16_t tmpData = FLEXIO_SPI_DUMMYDATA;
if (handle->txData != NULL)
{
if (handle->bytePerFrame == 1U)
{
tmpData = *(handle->txData);
handle->txData++;
}
else
{
tmpData = (uint32_t)(handle->txData[0]) << 8U;
tmpData += handle->txData[1];
handle->txData += 2U;
}
}
else
{
tmpData = FLEXIO_SPI_DUMMYDATA;
}
handle->txRemainingBytes -= handle->bytePerFrame;
FLEXIO_SPI_WriteData(base, handle->direction, tmpData);
if (!handle->txRemainingBytes)
{
FLEXIO_SPI_DisableInterrupts(base, kFLEXIO_SPI_TxEmptyInterruptEnable);
}
} | labapart/polymcu | C++ | null | 201 |
/* Initializes the HASH peripheral according to the specified parameters in the HASH_InitStruct structure. */ | void HASH_Init(HASH_InitTypeDef *HASH_InitStruct) | /* Initializes the HASH peripheral according to the specified parameters in the HASH_InitStruct structure. */
void HASH_Init(HASH_InitTypeDef *HASH_InitStruct) | {
assert_param(IS_HASH_ALGOSELECTION(HASH_InitStruct->HASH_AlgoSelection));
assert_param(IS_HASH_DATATYPE(HASH_InitStruct->HASH_DataType));
assert_param(IS_HASH_ALGOMODE(HASH_InitStruct->HASH_AlgoMode));
HASH->CR &= ~ (HASH_CR_ALGO | HASH_CR_DATATYPE | HASH_CR_MODE);
HASH->CR |= (HASH_InitStruct->HASH_AlgoSelection | \
HASH_InitStruct->HASH_DataType | \
HASH_InitStruct->HASH_AlgoMode);
if(HASH_InitStruct->HASH_AlgoMode == HASH_AlgoMode_HMAC)
{
assert_param(IS_HASH_HMAC_KEYTYPE(HASH_InitStruct->HASH_HMACKeyType));
HASH->CR &= ~HASH_CR_LKEY;
HASH->CR |= HASH_InitStruct->HASH_HMACKeyType;
}
HASH->CR |= HASH_CR_INIT;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Configures EXTI Line15 (connected to PG15 pin) in interrupt mode. */ | static void EXTILine15_10_Config(void) | /* Configures EXTI Line15 (connected to PG15 pin) in interrupt mode. */
static void EXTILine15_10_Config(void) | {
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOG_CLK_ENABLE();
GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_15;
HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Make a lv_task ready. It will not wait its period. */ | void lv_task_ready(lv_task_t *task) | /* Make a lv_task ready. It will not wait its period. */
void lv_task_ready(lv_task_t *task) | {
task->last_run = lv_tick_get() - task->period - 1;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Main application function.
All the processing for the calculator is done by the calculator widget's event handler function app_calc_handler(). This function is called by the window system when it maps a user input event to an interaction with the calculator, i.e., a button press. */ | int main(void) | /* Main application function.
All the processing for the calculator is done by the calculator widget's event handler function app_calc_handler(). This function is called by the window system when it maps a user input event to an interaction with the calculator, i.e., a button press. */
int main(void) | {
static struct mxt_device device;
board_init();
sysclk_init();
membag_init();
gfx_init();
mxt_init(&device);
win_init();
setup_gui_root_window();
win_reset_root_geometry();
if (app_widget_launch() == false) {
show_out_of_memory_error();
for (;;);
}
while (true) {
struct win_pointer_event win_touch_event;
while (read_touch_event(&device, &win_touch_event)) {
win_queue_pointer_event(&win_touch_event);
}
win_process_events();
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Reads an Unicode character from the input device. */ | u16 efi_st_get_key(void) | /* Reads an Unicode character from the input device. */
u16 efi_st_get_key(void) | {
struct efi_input_key input_key;
efi_status_t ret;
do {
ret = con_in->read_key_stroke(con_in, &input_key);
} while (ret == EFI_NOT_READY);
return input_key.unicode_char;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ | int serial_init_dev(const int dev_index) | /* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
int serial_init_dev(const int dev_index) | {
struct s5pc1xx_uart *const uart = s5pc1xx_get_base_uart(dev_index);
writel(0, &uart->ufcon);
writel(0, &uart->umcon);
writel(0x3, &uart->ulcon);
writel(0x245, &uart->ucon);
serial_setbrg_dev(dev_index);
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* dbg_is_lsave_dirty - determine if a lsave node is dirty. */ | static int dbg_is_lsave_dirty(struct ubifs_info *c, int lnum, int offs) | /* dbg_is_lsave_dirty - determine if a lsave node is dirty. */
static int dbg_is_lsave_dirty(struct ubifs_info *c, int lnum, int offs) | {
if (lnum != c->lsave_lnum || offs != c->lsave_offs)
return 1;
return (c->lpt_drty_flgs & LSAVE_DIRTY) != 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* sa1111_set_audio_rate - set the audio sample rate @sadev: SA1111 SAC function block @rate: sample rate to select */ | int sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate) | /* sa1111_set_audio_rate - set the audio sample rate @sadev: SA1111 SAC function block @rate: sample rate to select */
int sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate) | {
struct sa1111 *sachip = sa1111_chip_driver(sadev);
unsigned int div;
if (sadev->devid != SA1111_DEVID_SAC)
return -EINVAL;
div = (__sa1111_pll_clock(sachip) / 256 + rate / 2) / rate;
if (div == 0)
div = 1;
if (div > 128)
div = 128;
sa1111_writel(div - 1, sachip->base + SA1111_SKAUD);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The function is to Enable Low-Voltage Detect Reset or not. */ | void SysCtlLVDResetEnable(xtBoolean bEnable) | /* The function is to Enable Low-Voltage Detect Reset or not. */
void SysCtlLVDResetEnable(xtBoolean bEnable) | {
if(bEnable)
{
xHWREGB(PMC_LVDSC1) |= PMC_LVDSC1_LVDRE;
}
else
{
xHWREGB(PMC_LVDSC1) &= ~PMC_LVDSC1_LVDRE;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns the current SPIx Reception FIFO filled level. */ | uint16_t SPI_GetReceptionFIFOStatus(SPI_TypeDef *SPIx) | /* Returns the current SPIx Reception FIFO filled level. */
uint16_t SPI_GetReceptionFIFOStatus(SPI_TypeDef *SPIx) | {
return (uint16_t)((SPIx->SR & SPI_SR_FRLVL));
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Send the adapter TERM message to the amso1100 */ | static void c2_adapter_term(struct c2_dev *c2dev) | /* Send the adapter TERM message to the amso1100 */
static void c2_adapter_term(struct c2_dev *c2dev) | {
struct c2wr_init_req wr;
memset(&wr, 0, sizeof(wr));
c2_wr_set_id(&wr, CCWR_TERM);
wr.hdr.context = 0;
vq_send_wr(c2dev, (union c2wr *) & wr);
c2dev->init = 0;
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Routine to read len bytes from the i82593's ring buffer, starting at chip address addr. The results read from the chip are stored in buf. The return value is the address to use for next the call. */ | static int read_ringbuf(struct net_device *dev, int addr, char *buf, int len) | /* Routine to read len bytes from the i82593's ring buffer, starting at chip address addr. The results read from the chip are stored in buf. The return value is the address to use for next the call. */
static int read_ringbuf(struct net_device *dev, int addr, char *buf, int len) | {
unsigned int base = dev->base_addr;
int ring_ptr = addr;
int chunk_len;
char * buf_ptr = buf;
while(len > 0)
{
outb(ring_ptr & 0xff, PIORL(base));
outb(((ring_ptr >> 8) & PIORH_MASK), PIORH(base));
if((addr + len) < (RX_BASE + RX_SIZE))
chunk_len = len;
else
chunk_len = RX_BASE + RX_SIZE - addr;
insb(PIOP(base), buf_ptr, chunk_len);
buf_ptr += chunk_len;
len -= chunk_len;
ring_ptr = (ring_ptr - RX_BASE + chunk_len) % RX_SIZE + RX_BASE;
}
return(ring_ptr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 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 GPIOPinLockConfig(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 GPIOPinLockConfig(unsigned long ulPort, unsigned long ulPins) | {
unsigned long ulTemp = GPIO_LCKR_KEY;
xASSERT(GPIOBaseValid(ulPort));
xHWREG(ulPort + GPIO_LCKR) &= ulTemp;
xHWREG(ulPort + GPIO_LCKR) = ulPins;
xHWREG(ulPort + GPIO_LCKR) = (ulPins | ulTemp);
xHWREG(ulPort + GPIO_LCKR) = ulPins;
xHWREG(ulPort + GPIO_LCKR) = (ulPins | ulTemp);;
ulTemp = xHWREG(ulPort + GPIO_LCKR);
ulTemp = xHWREG(ulPort + GPIO_LCKR);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If (flags & BF_ATOF_EXPONENT) and if the radix is not a power of two, the parsed number is equal to r * (*pexponent)^radix. Otherwise *pexponent = 0. */ | int bf_atof2(bf_t *r, slimb_t *pexponent, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags) | /* If (flags & BF_ATOF_EXPONENT) and if the radix is not a power of two, the parsed number is equal to r * (*pexponent)^radix. Otherwise *pexponent = 0. */
int bf_atof2(bf_t *r, slimb_t *pexponent, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags) | {
return bf_atof_internal(r, pexponent, str, pnext, radix, prec, flags,
FALSE);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* NOTE: the output value can be set by other drivers, boot loader or may be hardwired in the regulator. */ | int regulator_enable(struct regulator *regulator) | /* NOTE: the output value can be set by other drivers, boot loader or may be hardwired in the regulator. */
int regulator_enable(struct regulator *regulator) | {
struct regulator_dev *rdev = regulator->rdev;
int ret = 0;
mutex_lock(&rdev->mutex);
ret = _regulator_enable(rdev);
mutex_unlock(&rdev->mutex);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Prints all options of a list that have a value to stdout */ | void print_option_parameters(QEMUOptionParameter *list) | /* Prints all options of a list that have a value to stdout */
void print_option_parameters(QEMUOptionParameter *list) | {
while (list && list->name) {
switch (list->type) {
case OPT_STRING:
if (list->value.s != NULL) {
printf("%s='%s' ", list->name, list->value.s);
}
break;
case OPT_FLAG:
printf("%s=%s ", list->name, list->value.n ? "on" : "off");
break;
case OPT_SIZE:
case OPT_NUMBER:
printf("%s=%" PRId64 " ", list->name, list->value.n);
break;
default:
printf("%s=(unknown type) ", list->name);
break;
}
list++;
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* This function is executed in case of error occurrence. */ | static void Error_Handler(void) | /* This function is executed in case of error occurrence. */
static void Error_Handler(void) | {
while(1)
{
BSP_LED_Toggle(LED2);
HAL_Delay(1000);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Handle HID interface enable.
Called by the USB stack when the host enables the mouse interface. */ | bool main_mouse_enable(void) | /* Handle HID interface enable.
Called by the USB stack when the host enables the mouse interface. */
bool main_mouse_enable(void) | {
main_b_mouse_enable = true;
return true;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* USART pinmux initialization function.
Set each required pin to USART functionality */ | void TARGET_IO_PORT_init() | /* USART pinmux initialization function.
Set each required pin to USART functionality */
void TARGET_IO_PORT_init() | {
gpio_set_pin_function(EDBG_COM_TX, PINMUX_PA24D_SERCOM2_PAD2);
gpio_set_pin_function(EDBG_COM_RX, PINMUX_PA25D_SERCOM2_PAD3);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the UART hardware flow control mode to be used. */ | void UARTFlowControlSet(unsigned long ulBase, unsigned long ulMode) | /* Sets the UART hardware flow control mode to be used. */
void UARTFlowControlSet(unsigned long ulBase, unsigned long ulMode) | {
ASSERT(UARTBaseValid(ulBase));
ASSERT((ulMode & ~(UART_FLOWCONTROL_TX | UART_FLOWCONTROL_RX)) == 0);
HWREG(ulBase + UART_O_CTL) = ((HWREG(ulBase + UART_O_CTL) &
~(UART_FLOWCONTROL_TX |
UART_FLOWCONTROL_RX)) | ulMode);
} | micropython/micropython | C++ | Other | 18,334 |
/* Use the bootrom to implement a spin loop.
The FLASH_CYCLES_US(n) macro can be used with */ | void am_hal_flash_delay(uint32_t ui32Iterations) | /* Use the bootrom to implement a spin loop.
The FLASH_CYCLES_US(n) macro can be used with */
void am_hal_flash_delay(uint32_t ui32Iterations) | {
g_am_hal_flash.delay_cycles(ui32Iterations);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, ARD_D1_TX_Pin|ARD_D0_RX_Pin);
}
else if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, T_VCP_RX_Pin|T_VCP_TX_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* kick_iocb: Called typically from a wait queue callback context to trigger a retry of the iocb. The retry is usually executed by aio workqueue threads (See aio_kick_handler). */ | void kick_iocb(struct kiocb *iocb) | /* kick_iocb: Called typically from a wait queue callback context to trigger a retry of the iocb. The retry is usually executed by aio workqueue threads (See aio_kick_handler). */
void kick_iocb(struct kiocb *iocb) | {
if (is_sync_kiocb(iocb)) {
kiocbSetKicked(iocb);
wake_up_process(iocb->ki_obj.tsk);
return;
}
try_queue_kicked_iocb(iocb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* NOTE: Channel lock MUST be held before calling this function! */ | static void neo_flush_uart_read(struct jsm_channel *ch) | /* NOTE: Channel lock MUST be held before calling this function! */
static void neo_flush_uart_read(struct jsm_channel *ch) | {
u8 tmp = 0;
int i = 0;
if (!ch)
return;
writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR), &ch->ch_neo_uart->isr_fcr);
for (i = 0; i < 10; i++) {
tmp = readb(&ch->ch_neo_uart->isr_fcr);
if (tmp & 2) {
jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev,
"Still flushing RX UART... i: %d\n", i);
udelay(10);
}
else
break;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Convert the FFS File Attributes to FV File Attributes */ | EFI_FV_FILE_ATTRIBUTES FfsAttributes2FvFileAttributes(IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes) | /* Convert the FFS File Attributes to FV File Attributes */
EFI_FV_FILE_ATTRIBUTES FfsAttributes2FvFileAttributes(IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes) | {
UINT8 DataAlignment;
EFI_FV_FILE_ATTRIBUTES FileAttribute;
DataAlignment = (UINT8)((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);
ASSERT (DataAlignment < 8);
if ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT_2) != 0) {
FileAttribute = (EFI_FV_FILE_ATTRIBUTES)mFvAttributes2[DataAlignment];
} else {
FileAttribute = (EFI_FV_FILE_ATTRIBUTES)mFvAttributes[DataAlignment];
}
if ((FfsAttributes & FFS_ATTRIB_FIXED) == FFS_ATTRIB_FIXED) {
FileAttribute |= EFI_FV_FILE_ATTRIB_FIXED;
}
return FileAttribute;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Caller must hold down_read on the vma->vm_mm if vma is not NULL. */ | struct page* swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr) | /* Caller must hold down_read on the vma->vm_mm if vma is not NULL. */
struct page* swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr) | {
int nr_pages;
struct page *page;
unsigned long offset;
unsigned long end_offset;
nr_pages = valid_swaphandles(entry, &offset);
for (end_offset = offset + nr_pages; offset < end_offset; offset++) {
page = read_swap_cache_async(swp_entry(swp_type(entry), offset),
gfp_mask, vma, addr);
if (!page)
break;
page_cache_release(page);
}
lru_add_drain();
return read_swap_cache_async(entry, gfp_mask, vma, addr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clear the slave select pins of the specified SPI port.
The */ | void SPISSClear(unsigned long ulBase, unsigned long ulSlaveSel) | /* Clear the slave select pins of the specified SPI port.
The */
void SPISSClear(unsigned long ulBase, unsigned long ulSlaveSel) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) ||
(ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1));
xHWREG(ulBase + SPI_SSR) &= ~ulSlaveSel;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This call is similar to hwconfig_arg_cmp, except that it takes an additional argument @subopt, and so works with sub-options. */ | int hwconfig_subarg_cmp(const char *opt, const char *subopt, const char *subarg) | /* This call is similar to hwconfig_arg_cmp, except that it takes an additional argument @subopt, and so works with sub-options. */
int hwconfig_subarg_cmp(const char *opt, const char *subopt, const char *subarg) | {
const char *argstr;
size_t arglen;
argstr = hwconfig_subarg(opt, subopt, &arglen);
if (!argstr || arglen != strlen(subarg))
return 0;
return !strncmp(argstr, subarg, arglen);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* param base ADC_ETC peripheral base address. param triggerGroup Trigger group index. param config Pointer to "adc_etc_trigger_config_t" structure. */ | void ADC_ETC_SetTriggerConfig(ADC_ETC_Type *base, uint32_t triggerGroup, const adc_etc_trigger_config_t *config) | /* param base ADC_ETC peripheral base address. param triggerGroup Trigger group index. param config Pointer to "adc_etc_trigger_config_t" structure. */
void ADC_ETC_SetTriggerConfig(ADC_ETC_Type *base, uint32_t triggerGroup, const adc_etc_trigger_config_t *config) | {
assert(triggerGroup < ADC_ETC_TRIGn_CTRL_COUNT);
assert(ADC_ETC_TRIGn_COUNTER_COUNT > triggerGroup);
uint32_t tmp32 = 0U;
tmp32 = ADC_ETC_TRIGn_CTRL_TRIG_CHAIN(config->triggerChainLength) |
ADC_ETC_TRIGn_CTRL_TRIG_PRIORITY(config->triggerPriority);
if (config->enableSyncMode)
{
tmp32 |= ADC_ETC_TRIGn_CTRL_SYNC_MODE_MASK;
}
if (config->enableSWTriggerMode)
{
tmp32 |= ADC_ETC_TRIGn_CTRL_TRIG_MODE_MASK;
}
base->TRIG[triggerGroup].TRIGn_CTRL = tmp32;
tmp32 = ADC_ETC_TRIGn_COUNTER_INIT_DELAY(config->initialDelay) |
ADC_ETC_TRIGn_COUNTER_SAMPLE_INTERVAL(config->sampleIntervalDelay);
base->TRIG[triggerGroup].TRIGn_COUNTER = tmp32;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get available stack space of a thread based on stack watermark recording during execution. */ | uint32_t osThreadGetStackSpace(osThreadId_t thread_id) | /* Get available stack space of a thread based on stack watermark recording during execution. */
uint32_t osThreadGetStackSpace(osThreadId_t thread_id) | {
struct cv2_thread *tid = (struct cv2_thread *)thread_id;
size_t unused;
int ret;
__ASSERT(tid, "");
__ASSERT(is_cmsis_rtos_v2_thread(tid), "");
__ASSERT(!k_is_in_isr(), "");
ret = k_thread_stack_space_get(&tid->z_thread, &unused);
if (ret != 0) {
unused = 0;
}
return (uint32_t)unused;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Use this function to allocate socket buffers to store iucv message data. */ | static size_t iucv_msg_length(struct iucv_message *msg) | /* Use this function to allocate socket buffers to store iucv message data. */
static size_t iucv_msg_length(struct iucv_message *msg) | {
size_t datalen;
if (msg->flags & IUCV_IPRMDATA) {
datalen = 0xff - msg->rmmsg[7];
return (datalen < 8) ? datalen : 8;
}
return msg->length;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* One two-line function is worth a 20% hypercall speed boost! */ | static void rewrite_hypercall(struct lg_cpu *cpu) | /* One two-line function is worth a 20% hypercall speed boost! */
static void rewrite_hypercall(struct lg_cpu *cpu) | {
u8 insn[3] = {0xcd, 0x1f, 0x90};
__lgwrite(cpu, guest_pa(cpu, cpu->regs->eip), insn, sizeof(insn));
guest_pagetable_clear_all(cpu);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks if a bus off or bus heavy situation occurred. */ | static bool IxxatVciIsBusError(void) | /* Checks if a bus off or bus heavy situation occurred. */
static bool IxxatVciIsBusError(void) | {
bool result = false;
CANCHANSTATUS sChanStatus;
if (IxxatVciLibFuncCanChannelGetStatus(ixxatCanChannelHandle, &sChanStatus) == VCI_OK)
{
if ((sChanStatus.sLineStatus.dwStatus & (CAN_STATUS_BUSOFF | CAN_STATUS_ERRLIM)) != 0)
{
result = true;
}
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* vx_conf_pipe - tell the pipe to stand by and wait for IRQA. @pipe: the pipe to be configured */ | static int vx_conf_pipe(struct vx_core *chip, struct vx_pipe *pipe) | /* vx_conf_pipe - tell the pipe to stand by and wait for IRQA. @pipe: the pipe to be configured */
static int vx_conf_pipe(struct vx_core *chip, struct vx_pipe *pipe) | {
struct vx_rmh rmh;
vx_init_rmh(&rmh, CMD_CONF_PIPE);
if (pipe->is_capture)
rmh.Cmd[0] |= COMMAND_RECORD_MASK;
rmh.Cmd[1] = 1 << pipe->number;
return vx_send_msg_nolock(chip, &rmh);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks to see if the haptic device is valid */ | static int ValidHaptic(SDL_Haptic *haptic) | /* Checks to see if the haptic device is valid */
static int ValidHaptic(SDL_Haptic *haptic) | {
int valid;
SDL_Haptic *hapticlist;
valid = 0;
if (haptic != NULL) {
hapticlist = SDL_haptics;
while ( hapticlist )
{
if (hapticlist == haptic) {
valid = 1;
break;
}
hapticlist = hapticlist->next;
}
}
if (valid == 0) {
SDL_SetError("Haptic: Invalid haptic device identifier");
}
return valid;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Initializes the ISO7816 peripheral registers to their default reset values. */ | void ISO7816_DeInit(ISO7816_TypeDef *ISO7816x) | /* Initializes the ISO7816 peripheral registers to their default reset values. */
void ISO7816_DeInit(ISO7816_TypeDef *ISO7816x) | {
assert_parameters(IS_ISO7816_ALL_INSTANCE(ISO7816x));
ISO7816x->CFG &= ~ISO7816_CFG_EN;
ISO7816x->INFO = ISO7816_INFO_RC_MASK;
ISO7816x->BAUDDIVH = ISO7816_BAUDDIVH_RSTValue;
ISO7816x->BAUDDIVL = ISO7816_BAUDDIVL_RSTValue;
ISO7816x->CFG = ISO7816_CFG_RSTValue;
ISO7816x->CLK = ISO7816_CLK_RSTValue;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable the time tick or alarm interrupt of RTC.
The */ | void xRTCIntEnable(unsigned long ulIntType) | /* Enable the time tick or alarm interrupt of RTC.
The */
void xRTCIntEnable(unsigned long ulIntType) | {
xASSERT(((ulIntType & RTC_INT_TIME_TICK) == RTC_INT_TIME_TICK) ||
((ulIntType & RTC_INT_ALARM) == RTC_INT_ALARM));
xHWREG(RTC_RIER) |= ulIntType;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Update the ValueChanged status for questions in this form. */ | VOID UpdateStatementStatusForForm(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form) | /* Update the ValueChanged status for questions in this form. */
VOID UpdateStatementStatusForForm(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form) | {
LIST_ENTRY *Link;
FORM_BROWSER_STATEMENT *Question;
Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Form->StatementListHead, Link)) {
Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
Link = GetNextNode (&Form->StatementListHead, Link);
if (Question->Operand == EFI_IFR_PASSWORD_OP) {
continue;
}
IsQuestionValueChanged (FormSet, Form, Question, GetSetValueWithBuffer);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. */ | EFI_STATUS EFIAPI EmuGopQuerytMode(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, IN UINT32 ModeNumber, OUT UINTN *SizeOfInfo, OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info) | /* Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. */
EFI_STATUS EFIAPI EmuGopQuerytMode(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, IN UINT32 ModeNumber, OUT UINTN *SizeOfInfo, OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info) | {
GOP_PRIVATE_DATA *Private;
Private = GOP_PRIVATE_DATA_FROM_THIS (This);
if ((Info == NULL) || (SizeOfInfo == NULL) || ((UINTN)ModeNumber >= This->Mode->MaxMode)) {
return EFI_INVALID_PARAMETER;
}
*Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
if (*Info == NULL) {
return EFI_OUT_OF_RESOURCES;
}
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
(*Info)->Version = 0;
(*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution;
(*Info)->VerticalResolution = Private->ModeData[ModeNumber].VerticalResolution;
(*Info)->PixelFormat = PixelBltOnly;
(*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Please refer to the official documentation for function purpose and expected parameters. */ | int ph7_value_is_numeric(ph7_value *pVal) | /* Please refer to the official documentation for function purpose and expected parameters. */
int ph7_value_is_numeric(ph7_value *pVal) | {
return (pVal->iFlags & MEMOBJ_NULL) ? TRUE : FALSE;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Updated the PTP block for fine correction with the Time Stamp Addend register value. */ | void ETH_UpdatePtpTimeStampAddend(void) | /* Updated the PTP block for fine correction with the Time Stamp Addend register value. */
void ETH_UpdatePtpTimeStampAddend(void) | {
ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSADDREG;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Put a pending event onto the available queue, so it can get reused. Attention! You must have the pending_event_spinlock before calling! */ | static void free_pending_event(struct pending_event *ev) | /* Put a pending event onto the available queue, so it can get reused. Attention! You must have the pending_event_spinlock before calling! */
static void free_pending_event(struct pending_event *ev) | {
if (ev != NULL) {
ev->next = pending_event_avail;
pending_event_avail = ev;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* message queue handling Function: struct msgqueue_entry *mqe_alloc(MsgQueue_t *msgq) Purpose : Allocate a message queue entry Params : msgq - message queue to claim entry for Returns : message queue entry or NULL. */ | static struct msgqueue_entry* mqe_alloc(MsgQueue_t *msgq) | /* message queue handling Function: struct msgqueue_entry *mqe_alloc(MsgQueue_t *msgq) Purpose : Allocate a message queue entry Params : msgq - message queue to claim entry for Returns : message queue entry or NULL. */
static struct msgqueue_entry* mqe_alloc(MsgQueue_t *msgq) | {
struct msgqueue_entry *mq;
if ((mq = msgq->free) != NULL)
msgq->free = mq->next;
return mq;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Free search structure (except the results)
MDNS Search */ | static void _mdns_search_free(mdns_search_once_t *search) | /* Free search structure (except the results)
MDNS Search */
static void _mdns_search_free(mdns_search_once_t *search) | {
free(search->instance);
free(search->service);
free(search->proto);
vSemaphoreDelete(search->lock);
free(search);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Register a handler for events sent to the ACPI-WMI mapper device. */ | acpi_status wmi_install_notify_handler(const char *guid, wmi_notify_handler handler, void *data) | /* Register a handler for events sent to the ACPI-WMI mapper device. */
acpi_status wmi_install_notify_handler(const char *guid, wmi_notify_handler handler, void *data) | {
struct wmi_block *block;
acpi_status status;
if (!guid || !handler)
return AE_BAD_PARAMETER;
if (!find_guid(guid, &block))
return AE_NOT_EXIST;
if (block->handler)
return AE_ALREADY_ACQUIRED;
block->handler = handler;
block->handler_data = data;
status = wmi_method_enable(block, 1);
return status;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns IRQ_HANDLED if any SCBs were processed, IRQ_NONE otherwise */ | static irqreturn_t orc_interrupt(struct orc_host *host) | /* Returns IRQ_HANDLED if any SCBs were processed, IRQ_NONE otherwise */
static irqreturn_t orc_interrupt(struct orc_host *host) | {
u8 scb_index;
struct orc_scb *scb;
if (inb(host->base + ORC_RQUEUECNT) == 0)
return IRQ_NONE;
do {
scb_index = inb(host->base + ORC_RQUEUE);
scb = (struct orc_scb *) ((unsigned long) host->scb_virt + (unsigned long) (sizeof(struct orc_scb) * scb_index));
scb->status = 0x0;
inia100_scb_handler(host, scb);
} while (inb(host->base + ORC_RQUEUECNT));
return IRQ_HANDLED;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function calculates the CRC8 of the input data. */ | static uint8_t _eval_crc_8(const uint8_t *puc_buf_ptr, uint32_t ul_len, uint32_t ul_crc_init) | /* This function calculates the CRC8 of the input data. */
static uint8_t _eval_crc_8(const uint8_t *puc_buf_ptr, uint32_t ul_len, uint32_t ul_crc_init) | {
uint8_t uc_crc;
uc_crc = ul_crc_init;
while (ul_len--) {
uc_crc = puc_crc8_table [uc_crc ^ *puc_buf_ptr++];
}
return uc_crc;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Check if Transmit complete interrupt is enabled @rmtoll IER TCIE LL_SWPMI_IsEnabledIT_TC. */ | uint32_t LL_SWPMI_IsEnabledIT_TC(SWPMI_TypeDef *SWPMIx) | /* Check if Transmit complete interrupt is enabled @rmtoll IER TCIE LL_SWPMI_IsEnabledIT_TC. */
uint32_t LL_SWPMI_IsEnabledIT_TC(SWPMI_TypeDef *SWPMIx) | {
return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TCIE) == (SWPMI_IER_TCIE)) ? 1UL : 0UL);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This will stop a running acquisition operation Is called from within this driver from both the interrupt context and from comedi */ | static int usbdux_ai_stop(struct usbduxsub *this_usbduxsub, int do_unlink) | /* This will stop a running acquisition operation Is called from within this driver from both the interrupt context and from comedi */
static int usbdux_ai_stop(struct usbduxsub *this_usbduxsub, int do_unlink) | {
int ret = 0;
if (!this_usbduxsub) {
dev_err(&this_usbduxsub->interface->dev,
"comedi?: usbdux_ai_stop: this_usbduxsub=NULL!\n");
return -EFAULT;
}
dev_dbg(&this_usbduxsub->interface->dev, "comedi: usbdux_ai_stop\n");
if (do_unlink) {
ret = usbduxsub_unlink_InURBs(this_usbduxsub);
}
this_usbduxsub->ai_cmd_running = 0;
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* and look at the resulting assemble code in serial.s. */ | static void rs_sched_event(struct async_struct *info, int event) | /* and look at the resulting assemble code in serial.s. */
static void rs_sched_event(struct async_struct *info, int event) | {
info->event |= 1 << event;
tasklet_schedule(&info->tlet);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Here come the less common (and hence less performance-critical) APIs: mutex_lock_interruptible() and mutex_trylock(). */ | static noinline int __sched __mutex_lock_killable_slowpath(atomic_t *lock_count) | /* Here come the less common (and hence less performance-critical) APIs: mutex_lock_interruptible() and mutex_trylock(). */
static noinline int __sched __mutex_lock_killable_slowpath(atomic_t *lock_count) | {
struct mutex *lock = container_of(lock_count, struct mutex, count);
return __mutex_lock_common(lock, TASK_KILLABLE, 0, _RET_IP_);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.