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 |
|---|---|---|---|---|---|---|---|
/* Returns: the (possibly changed) start of the #GList */ | GList* g_list_remove_link(GList *list, GList *llink) | /* Returns: the (possibly changed) start of the #GList */
GList* g_list_remove_link(GList *list, GList *llink) | {
return _g_list_remove_link (list, llink);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns the regulator object for the requested regulator. */ | Regulator & pmu_get_regulator(pmu_regulators_t regulator) | /* Returns the regulator object for the requested regulator. */
Regulator & pmu_get_regulator(pmu_regulators_t regulator) | {
switch (regulator)
{
case kPMURegulator_1p1:
return s_pmu.ldo1p1;
case kPMURegulator_2p5:
return s_pmu.ldo2p5;
case kPMURegulator_3p0:
return s_pmu.ldo3p0;
case kPMURegulator_ArmCore:
return s_pmu.ldoArm;
case kPMURegulator_Graphics:
return s_pmu.ldoGraphics;
case kPMURegulator_SoC:
return s_pmu.ldoSoC;
default:
return s_pmu.ldo1p1;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* uea_exit - Destroy module Deregister with USB subsystem */ | static void __exit uea_exit(void) | /* uea_exit - Destroy module Deregister with USB subsystem */
static void __exit uea_exit(void) | {
usb_deregister(&uea_driver);
printk(KERN_INFO "[ueagle-atm] driver unloaded\n");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Traverse a list and invoke a callback for each item. */ | static void dl_emit_single_cb_on(dep_list *list, single_entry_cb cb, void *udata) | /* Traverse a list and invoke a callback for each item. */
static void dl_emit_single_cb_on(dep_list *list, single_entry_cb cb, void *udata) | {
while (cb && list != NULL) {
(cb) (udata, list->path, list->inode);
list = list->next;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Stop ConSplitter on device handle by closing Console Device Guid on device handle and the console virtual handle. */ | EFI_STATUS ConSplitterStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ConSplitterVirtualHandle, IN EFI_GUID *DeviceGuid, IN EFI_GUID *InterfaceGuid, IN VOID **Interface) | /* Stop ConSplitter on device handle by closing Console Device Guid on device handle and the console virtual handle. */
EFI_STATUS ConSplitterStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ConSplitterVirtualHandle, IN EFI_GUID *DeviceGuid, IN EFI_GUID *InterfaceGuid, IN VOID **Interface) | {
EFI_STATUS Status;
Status = gBS->OpenProtocol (
ControllerHandle,
InterfaceGuid,
Interface,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
gBS->CloseProtocol (
ControllerHandle,
DeviceGuid,
This->DriverBindingHandle,
ConSplitterVirtualHandle
);
gBS->CloseProtocol (
ControllerHandle,
DeviceGuid,
This->DriverBindingHandle,
ControllerHandle
);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Called from unshare. Unshare all the namespaces part of nsproxy. On success, returns the new nsproxy. */ | int unshare_nsproxy_namespaces(unsigned long unshare_flags, struct nsproxy **new_nsp, struct fs_struct *new_fs) | /* Called from unshare. Unshare all the namespaces part of nsproxy. On success, returns the new nsproxy. */
int unshare_nsproxy_namespaces(unsigned long unshare_flags, struct nsproxy **new_nsp, struct fs_struct *new_fs) | {
int err = 0;
if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
CLONE_NEWNET)))
return 0;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
*new_nsp = create_new_namespaces(unshare_flags, current,
new_fs ? new_fs : current->fs);
if (IS_ERR(*new_nsp)) {
err = PTR_ERR(*new_nsp);
goto out;
}
err = ns_cgroup_clone(current, task_pid(current));
if (err)
put_nsproxy(*new_nsp);
out:
return err;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Create a blob of memory that we'll get rid of once the handshake is complete. */ | void ICACHE_FLASH_ATTR disposable_new(SSL *ssl) | /* Create a blob of memory that we'll get rid of once the handshake is complete. */
void ICACHE_FLASH_ATTR disposable_new(SSL *ssl) | {
if (ssl->dc == NULL)
{
ssl->dc = (DISPOSABLE_CTX *)zalloc(sizeof(DISPOSABLE_CTX));
MD5_Init(&ssl->dc->md5_ctx);
SHA1_Init(&ssl->dc->sha1_ctx);
}
} | eerimoq/simba | C++ | Other | 337 |
/* Load DQS settings for Write Group, do not trigger SCC update. */ | static void scc_mgr_load_dqs_for_write_group(struct socfpga_sdrseq *seq, const u32 write_group) | /* Load DQS settings for Write Group, do not trigger SCC update. */
static void scc_mgr_load_dqs_for_write_group(struct socfpga_sdrseq *seq, const u32 write_group) | {
const int ratio = seq->rwcfg->mem_if_read_dqs_width /
seq->rwcfg->mem_if_write_dqs_width;
const int base = write_group * ratio;
int i;
for (i = 0; i < ratio; i++)
writel(base + i, &sdr_scc_mgr->dqs_ena);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Check whether the specified channel flag is set or reset. */ | flag_status_t ald_dma_get_flag_status(uint8_t channel, ald_dma_it_flag_t it) | /* Check whether the specified channel flag is set or reset. */
flag_status_t ald_dma_get_flag_status(uint8_t channel, ald_dma_it_flag_t it) | {
assert_param(IS_DMA_CHANNEL(channel));
assert_param(IS_DMA_IT_TYPE(it));
if (READ_BIT(DMA->IFM, 1 << (channel * 2U + it)))
return SET;
return RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the value (1 or 0) of the specified pixel from the buffer. */ | uint8_t sharpmemGetPixel(uint16_t x, uint16_t y) | /* Gets the value (1 or 0) of the specified pixel from the buffer. */
uint8_t sharpmemGetPixel(uint16_t x, uint16_t y) | {
if ((x >=SHARPMEM_LCDWIDTH) || (y >=SHARPMEM_LCDHEIGHT)) return 0;
return _sharpmembuffer[(y*SHARPMEM_LCDWIDTH + x) /8] & (1 << x % 8) ? 1 : 0;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* ADC Differential mode configuration. This function configures ADC as differential mode with below Settings.
GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> PA04 */ | void configure_adc_differential(void) | /* ADC Differential mode configuration. This function configures ADC as differential mode with below Settings.
GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> PA04 */
void configure_adc_differential(void) | {
struct adc_config conf_adc;
adc_get_config_defaults(&conf_adc);
conf_adc.clock_source = GCLK_GENERATOR_1;
conf_adc.reference = ADC_REFERENCE_INTVCC1;
conf_adc.clock_prescaler = ADC_CLOCK_PRESCALER_DIV16;
conf_adc.differential_mode = true;
conf_adc.positive_input = ADC_POSITIVE_INPUT_PIN0;
conf_adc.negative_input = ADC_NEGATIVE_INPUT_PIN4;
adc_init(&adc_instance, ADC, &conf_adc);
adc_enable(&adc_instance);
} | memfault/zero-to-main | C++ | null | 200 |
/* Enables decryption for Wireshark if on_off is TRUE, disables it otherwise. */ | void set_wireshark_decryption(gboolean on_off) | /* Enables decryption for Wireshark if on_off is TRUE, disables it otherwise. */
void set_wireshark_decryption(gboolean on_off) | {
gboolean is_on;
is_on = on_off;
wlan_prefs = prefs_find_module("wlan");
prefs_pref_foreach(wlan_prefs, set_on_off, (gpointer)&is_on);
wlan_prefs->prefs_changed = TRUE;
prefs_apply(wlan_prefs);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If any reserved bits in Address are set, then ASSERT(). */ | UINT8 EFIAPI PciSegmentOr8(IN UINT64 Address, IN UINT8 OrData) | /* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentOr8(IN UINT64 Address, IN UINT8 OrData) | {
return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) | OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable or disable the specified interrupts of TTCAN. */ | void CAN_TTC_IntCmd(CM_CAN_TypeDef *CANx, uint8_t u8IntType, en_functional_state_t enNewState) | /* Enable or disable the specified interrupts of TTCAN. */
void CAN_TTC_IntCmd(CM_CAN_TypeDef *CANx, uint8_t u8IntType, en_functional_state_t enNewState) | {
DDL_ASSERT(IS_CAN_UNIT(CANx));
DDL_ASSERT(IS_TTCAN_INT(u8IntType));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
if (enNewState == ENABLE) {
SET_REG8_BIT(CANx->TTCFG, u8IntType);
} else {
CLR_REG8_BIT(CANx->TTCFG, u8IntType);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Handle set current configuration request.
This function is used to handle set current configuration request. */ | static usb_status_t USB_DeviceCh9SetConfiguration(usb_device_handle handle, usb_setup_struct_t *setup, uint8_t **buffer, uint32_t *length) | /* Handle set current configuration request.
This function is used to handle set current configuration request. */
static usb_status_t USB_DeviceCh9SetConfiguration(usb_device_handle handle, usb_setup_struct_t *setup, uint8_t **buffer, uint32_t *length) | {
uint8_t state;
USB_DeviceGetStatus(handle, kUSB_DeviceStatusDeviceState, &state);
if ((kUSB_DeviceStateAddress != state) && (kUSB_DeviceStateConfigured != state))
{
return kStatus_USB_InvalidRequest;
}
state = kUSB_DeviceStateConfigured;
USB_DeviceSetStatus(handle, kUSB_DeviceStatusDeviceState, &state);
if (!setup->wValue)
{
state = kUSB_DeviceStateAddress;
USB_DeviceSetStatus(handle, kUSB_DeviceStatusDeviceState, &state);
}
return USB_DeviceSetConfigure(handle, setup->wValue);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns a pointer to the start of the DMA receive descriptor list. */ | tEMACDMADescriptor* EMACRxDMADescriptorListGet(uint32_t ui32Base) | /* Returns a pointer to the start of the DMA receive descriptor list. */
tEMACDMADescriptor* EMACRxDMADescriptorListGet(uint32_t ui32Base) | {
return ((tEMACDMADescriptor *)HWREG(ui32Base + EMAC_O_RXDLADDR));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure the hardware trigger condition and enable hardware trigger. */ | void ADC_EnableHWTrigger(ADC_T *adc, uint32_t u32Source, uint32_t u32Param) | /* Configure the hardware trigger condition and enable hardware trigger. */
void ADC_EnableHWTrigger(ADC_T *adc, uint32_t u32Source, uint32_t u32Param) | {
if(u32Source == ADC_ADCR_TRGS_STADC)
{
adc->ADCR = (adc->ADCR & ~(ADC_ADCR_TRGS_Msk | ADC_ADCR_TRGCOND_Msk | ADC_ADCR_TRGEN_Msk)) |
((u32Source) | (u32Param) | ADC_ADCR_TRGEN_Msk);
}
else if(u32Source == ADC_ADCR_TRGS_TIMER)
{
adc->ADCR = (adc->ADCR & ~(ADC_ADCR_TRGS_Msk | ADC_ADCR_TRGCOND_Msk | ADC_ADCR_TRGEN_Msk)) |
((u32Source) | ADC_ADCR_TRGEN_Msk);
}
else
{
adc->ADCR = (adc->ADCR & ~(ADC_ADCR_TRGS_Msk | ADC_ADCR_TRGCOND_Msk | ADC_ADCR_TRGEN_Msk)) |
((u32Source) | ADC_ADCR_TRGEN_Msk);
}
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USB is a special case since USB may be compiled as modules, so the appropriate CONFIG_STM_USB_OTG_xS will be undefined */ | void stm32_iomux_usb_fs_init(void) | /* USB is a special case since USB may be compiled as modules, so the appropriate CONFIG_STM_USB_OTG_xS will be undefined */
void stm32_iomux_usb_fs_init(void) | {
static struct stm32f2_gpio_dsc otg_gpio[] = {
{0, 11}, {0, 12}, {0, 9}
};
int i;
for (i = 0; i < ARRAY_SIZE(otg_gpio); i++) {
stm32f2_gpio_config(&otg_gpio[i],
STM32F2_GPIO_ROLE_USB_OTG);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 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) | {
uint16_t Bytes = 0;
USB_Init();
while (1)
{
Bytes = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface);
if(Bytes)
{
CDC_Device_SendByte(&VirtualSerial_CDC_Interface, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
}
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Create a memory pool. Allocates freelist, bitmaps and other per-pool metadata. */ | struct xv_pool* xv_create_pool(void) | /* Create a memory pool. Allocates freelist, bitmaps and other per-pool metadata. */
struct xv_pool* xv_create_pool(void) | {
u32 ovhd_size;
struct xv_pool *pool;
ovhd_size = roundup(sizeof(*pool), PAGE_SIZE);
pool = kzalloc(ovhd_size, GFP_KERNEL);
if (!pool)
return NULL;
spin_lock_init(&pool->lock);
return pool;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* edma3_set_dest_addr - set destination address for slot only */ | void edma3_set_dest_addr(u32 base, int slot, u32 dst) | /* edma3_set_dest_addr - set destination address for slot only */
void edma3_set_dest_addr(u32 base, int slot, u32 dst) | {
struct edma3_slot_layout *rg;
rg = (struct edma3_slot_layout *)(base + EDMA3_SL_BASE(slot));
__raw_writel(dst, &rg->dst);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function calculates the length of a given IVHD entry */ | static int ivhd_entry_length(u8 *ivhd) | /* This function calculates the length of a given IVHD entry */
static int ivhd_entry_length(u8 *ivhd) | {
return 0x04 << (*ivhd >> 6);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */ | void SPI3WireStartIntEnable(unsigned long ulBase) | /* Enable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntEnable(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SSTA_INTEN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Configure the send and receive FIFO components with their base addresses and interrupt masks. Currently the base addresses are defined constants. */ | static XStatus ConfigureFifo(XEmac *InstancePtr) | /* Configure the send and receive FIFO components with their base addresses and interrupt masks. Currently the base addresses are defined constants. */
static XStatus ConfigureFifo(XEmac *InstancePtr) | {
XStatus Result;
Result = XPacketFifoV100b_Initialize(&InstancePtr->RecvFifo,
InstancePtr->BaseAddress +
XEM_PFIFO_RXREG_OFFSET,
InstancePtr->BaseAddress +
XEM_PFIFO_RXDATA_OFFSET);
if (Result != XST_SUCCESS) {
return Result;
}
Result = XPacketFifoV100b_Initialize(&InstancePtr->SendFifo,
InstancePtr->BaseAddress +
XEM_PFIFO_TXREG_OFFSET,
InstancePtr->BaseAddress +
XEM_PFIFO_TXDATA_OFFSET);
return Result;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Return code 0 - driver suspended the device Error otherwise */ | static int lpfc_pci_suspend_one_s3(struct pci_dev *pdev, pm_message_t msg) | /* Return code 0 - driver suspended the device Error otherwise */
static int lpfc_pci_suspend_one_s3(struct pci_dev *pdev, pm_message_t msg) | {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"0473 PCI device Power Management suspend.\n");
lpfc_offline_prep(phba);
lpfc_offline(phba);
kthread_stop(phba->worker_thread);
lpfc_sli_disable_intr(phba);
pci_save_state(pdev);
pci_set_power_state(pdev, PCI_D3hot);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If any reserved bits in Address are set, then ASSERT(). */ | UINT8 EFIAPI PciSegmentAndThenOr8(IN UINT64 Address, IN UINT8 AndData, IN UINT8 OrData) | /* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentAndThenOr8(IN UINT64 Address, IN UINT8 AndData, IN UINT8 OrData) | {
return PciSegmentWrite8 (Address, (UINT8)((PciSegmentRead8 (Address) & AndData) | OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Local CPU Sets Local to Remote IPC Flag */ | void IPCLtoRFlagSet(uint32_t ulFlags) | /* Local CPU Sets Local to Remote IPC Flag */
void IPCLtoRFlagSet(uint32_t ulFlags) | {
IpcRegs.IPCSET.all |= ulFlags;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the Internal High Speed oscillator request from ADC. */ | void RCC_HSI14ADCRequestCmd(FunctionalState NewState) | /* Enables or disables the Internal High Speed oscillator request from ADC. */
void RCC_HSI14ADCRequestCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->CR2 &= ~RCC_CR2_HSI14DIS;
}
else
{
RCC->CR2 |= RCC_CR2_HSI14DIS;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Tx FIFO sizes: CS4237B - 16 bytes AudioDrive ES1688 - 12 bytes S3 SonicVibes - 8 bytes SoundBlaster AWE 64 - 2 bytes (ugly hardware) write output pending bytes call with output_lock spinlock held */ | static void snd_mpu401_uart_output_write(struct snd_mpu401 *mpu) | /* Tx FIFO sizes: CS4237B - 16 bytes AudioDrive ES1688 - 12 bytes S3 SonicVibes - 8 bytes SoundBlaster AWE 64 - 2 bytes (ugly hardware) write output pending bytes call with output_lock spinlock held */
static void snd_mpu401_uart_output_write(struct snd_mpu401 *mpu) | {
unsigned char byte;
int max = 256;
do {
if (snd_rawmidi_transmit_peek(mpu->substream_output,
&byte, 1) == 1) {
if (!snd_mpu401_output_ready(mpu) &&
!snd_mpu401_output_ready(mpu))
break;
mpu->write(mpu, byte, MPU401D(mpu));
snd_rawmidi_transmit_ack(mpu->substream_output, 1);
} else {
snd_mpu401_uart_remove_timer (mpu, 0);
break;
}
} while (--max > 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* we see if any fixup is available for our current hardware. if there is a fixup, we call it and we expect to never return from it. if we do return, we keep looking and then eventually fall back to the standard mach_reboot on return. */ | void mach_reboot_fixups(void) | /* we see if any fixup is available for our current hardware. if there is a fixup, we call it and we expect to never return from it. if we do return, we keep looking and then eventually fall back to the standard mach_reboot on return. */
void mach_reboot_fixups(void) | {
const struct device_fixup *cur;
struct pci_dev *dev;
int i;
if (in_interrupt())
return;
for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
cur = &(fixups_table[i]);
dev = pci_get_device(cur->vendor, cur->device, NULL);
if (!dev)
continue;
cur->reboot_fixup(dev);
pci_dev_put(dev);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base to FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. */ | status_t FLEXIO_UART_TransferCreateHandle(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_callback_t callback, void *userData) | /* param base to FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. */
status_t FLEXIO_UART_TransferCreateHandle(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_callback_t callback, void *userData) | {
assert(handle != NULL);
IRQn_Type flexio_irqs[] = FLEXIO_IRQS;
(void)memset(handle, 0, sizeof(*handle));
handle->rxState = (uint8_t)kFLEXIO_UART_RxIdle;
handle->txState = (uint8_t)kFLEXIO_UART_TxIdle;
handle->callback = callback;
handle->userData = userData;
NVIC_ClearPendingIRQ(flexio_irqs[FLEXIO_UART_GetInstance(base)]);
(void)EnableIRQ(flexio_irqs[FLEXIO_UART_GetInstance(base)]);
return FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_UART_TransferHandleIRQ);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Clears out all files from the Fv buffer in memory */ | EFI_STATUS FvBufGetSize(IN VOID *Fv, OUT UINTN *Size) | /* Clears out all files from the Fv buffer in memory */
EFI_STATUS FvBufGetSize(IN VOID *Fv, OUT UINTN *Size) | {
EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
*Size = 0;
while (blk->Length != 0 || blk->NumBlocks != 0) {
*Size = *Size + (blk->Length * blk->NumBlocks);
if (*Size >= 0x40000000) {
return EFI_VOLUME_CORRUPTED;
}
blk++;
}
if (*Size == 0) {
return EFI_VOLUME_CORRUPTED;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC12_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_1);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: (transfer full): a duplicate #GFileInfo of @other. */ | GFileInfo* g_file_info_dup(GFileInfo *other) | /* Returns: (transfer full): a duplicate #GFileInfo of @other. */
GFileInfo* g_file_info_dup(GFileInfo *other) | {
GFileInfo *new;
g_return_val_if_fail (G_IS_FILE_INFO (other), NULL);
new = g_file_info_new ();
g_file_info_copy_into (other, new);
return new;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This will start the SysTick counter. If an interrupt handler has been registered, it will be called when the SysTick counter rolls over. */ | void SysTickEnable(void) | /* This will start the SysTick counter. If an interrupt handler has been registered, it will be called when the SysTick counter rolls over. */
void SysTickEnable(void) | {
HWREG(NVIC_ST_CTRL) |= NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_ENABLE;
} | watterott/WebRadio | C++ | null | 71 |
/* get_new_inode_fast is the fast path version of get_new_inode, see the comment at iget_locked for details. */ | static struct inode* get_new_inode_fast(struct super_block *sb, struct hlist_head *head, unsigned long ino) | /* get_new_inode_fast is the fast path version of get_new_inode, see the comment at iget_locked for details. */
static struct inode* get_new_inode_fast(struct super_block *sb, struct hlist_head *head, unsigned long ino) | {
struct inode *inode;
inode = alloc_inode(sb);
if (inode) {
struct inode *old;
spin_lock(&inode_lock);
old = find_inode_fast(sb, head, ino);
if (!old) {
inode->i_ino = ino;
__inode_add_to_lists(sb, head, inode);
inode->i_state = I_NEW;
spin_unlock(&inode_lock);
return inode;
}
__iget(old);
spin_unlock(&inode_lock);
destroy_inode(inode);
inode = old;
wait_on_inode(inode);
}
return inode;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add or remove a route entry in the IP route table associated with this TCP instance. */ | EFI_STATUS Tcp4Route(IN TCP_CB *Tcb, IN TCP4_ROUTE_INFO *RouteInfo) | /* Add or remove a route entry in the IP route table associated with this TCP instance. */
EFI_STATUS Tcp4Route(IN TCP_CB *Tcb, IN TCP4_ROUTE_INFO *RouteInfo) | {
IP_IO_IP_PROTOCOL Ip;
Ip = Tcb->IpInfo->Ip;
ASSERT (Ip.Ip4 != NULL);
return Ip.Ip4->Routes (
Ip.Ip4,
RouteInfo->DeleteRoute,
RouteInfo->SubnetAddress,
RouteInfo->SubnetMask,
RouteInfo->GatewayAddress
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Switch off the voltage regulator to put the device in backup mode. */ | void supc_enable_backup_mode(Supc *p_supc) | /* Switch off the voltage regulator to put the device in backup mode. */
void supc_enable_backup_mode(Supc *p_supc) | {
p_supc->SUPC_CR = SUPC_CR_KEY_PASSWD | SUPC_CR_VROFF;
uint32_t ul_dummy = p_supc->SUPC_MR;
__DSB();
__WFE();
__WFI();
UNUSED(ul_dummy);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function closes the network interface and updates the statistics so that most recent statistics will be available after the interface is down. */ | static int amd8111e_close(struct net_device *dev) | /* This function closes the network interface and updates the statistics so that most recent statistics will be available after the interface is down. */
static int amd8111e_close(struct net_device *dev) | {
struct amd8111e_priv *lp = netdev_priv(dev);
netif_stop_queue(dev);
napi_disable(&lp->napi);
spin_lock_irq(&lp->lock);
amd8111e_disable_interrupt(lp);
amd8111e_stop_chip(lp);
amd8111e_free_skbs(lp->amd8111e_net_dev);
netif_carrier_off(lp->amd8111e_net_dev);
if(lp->options & OPTION_DYN_IPG_ENABLE)
del_timer_sync(&lp->ipg_data.ipg_timer);
spin_unlock_irq(&lp->lock);
free_irq(dev->irq, dev);
amd8111e_free_ring(lp);
amd8111e_get_stats(dev);
lp->opened = 0;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* cpm_muram_free - free a chunk of multi-user ram @offset: The beginning of the chunk as returned by cpm_muram_alloc(). */ | int cpm_muram_free(unsigned long offset) | /* cpm_muram_free - free a chunk of multi-user ram @offset: The beginning of the chunk as returned by cpm_muram_alloc(). */
int cpm_muram_free(unsigned long offset) | {
int ret;
unsigned long flags;
spin_lock_irqsave(&cpm_muram_lock, flags);
ret = rh_free(&cpm_muram_info, offset);
spin_unlock_irqrestore(&cpm_muram_lock, flags);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Drop destination transaction entry when we know it. */ | void netfs_trans_drop_dst(struct netfs_trans_dst *dst) | /* Drop destination transaction entry when we know it. */
void netfs_trans_drop_dst(struct netfs_trans_dst *dst) | {
struct netfs_trans *t = dst->trans;
spin_lock(&t->dst_lock);
list_del_init(&dst->trans_entry);
spin_unlock(&t->dst_lock);
netfs_trans_remove_dst(dst);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This Function return if data are received or not received. */ | uart_rx_data_ready_t uart_rx_data_ready(uart_num_t uart_num) | /* This Function return if data are received or not received. */
uart_rx_data_ready_t uart_rx_data_ready(uart_num_t uart_num) | {
uint32_t uart_port;
uint8_t uart_status;
uart_rx_data_ready_t data_ready;
uart_port = uart_num;
uart_status = UART_LSR(uart_port) & 0xFF;
if ((uart_status & UART_LSR_ERROR_MASK) == 0) {
if ((uart_status & UART_LSR_RDR) == 0) {
data_ready = UART_RX_NO_DATA;
} else {
data_ready = UART_RX_DATA_READY;
}
} else {
data_ready = UART_RX_DATA_ERROR;
}
return data_ready;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Return adapter handle if found in the list. Return 0 if adapter could not be located, should never happen though. */ | uint32_t mraid_mm_adapter_app_handle(uint32_t unique_id) | /* Return adapter handle if found in the list. Return 0 if adapter could not be located, should never happen though. */
uint32_t mraid_mm_adapter_app_handle(uint32_t unique_id) | {
mraid_mmadp_t *adapter;
mraid_mmadp_t *tmp;
int index = 0;
list_for_each_entry_safe(adapter, tmp, &adapters_list_g, list) {
if (adapter->unique_id == unique_id) {
return MKADAP(index);
}
index++;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check to see if there is any immediate RCU-related work to be done by the current CPU, returning 1 if so. This function is part of the RCU implementation; it is -not- an exported member of the RCU API. */ | static int rcu_pending(int cpu) | /* Check to see if there is any immediate RCU-related work to be done by the current CPU, returning 1 if so. This function is part of the RCU implementation; it is -not- an exported member of the RCU API. */
static int rcu_pending(int cpu) | {
return __rcu_pending(&rcu_sched_state, &per_cpu(rcu_sched_data, cpu)) ||
__rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)) ||
rcu_preempt_pending(cpu);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns 1 if the PATA port may be active. We know how to check this for the 6145 but not the other devices */ | static int marvell_pata_active(struct pci_dev *pdev) | /* Returns 1 if the PATA port may be active. We know how to check this for the 6145 but not the other devices */
static int marvell_pata_active(struct pci_dev *pdev) | {
int i;
u32 devices;
void __iomem *barp;
if (pdev->device != 0x6145)
return 1;
barp = pci_iomap(pdev, 5, 0x10);
if (barp == NULL)
return -ENOMEM;
printk("BAR5:");
for(i = 0; i <= 0x0F; i++)
printk("%02X:%02X ", i, ioread8(barp + i));
printk("\n");
devices = ioread32(barp + 0x0C);
pci_iounmap(pdev, barp);
if (devices & 0x10)
return 1;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the slave select pins of the specified SPI port.
The */ | void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel) | /* Set the slave select pins of the specified SPI port.
The */
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0));
xHWREG(ulBase + SPI_SSR) &= ~SPI_AUTOSS;
xHWREG(ulBase + SPI_SSR) |= ulSSMode;
xHWREG(ulBase + SPI_SSR) &= ~0x00000001;
xHWREG(ulBase + SPI_SSR) |= ulSlaveSel;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This routine could be implemented by taking the addresses written to the GATT, and flushing them individually. However currently it just flushes the whole table. Which is probably more efficent, since agp_memory blocks can be a large number of entries. */ | static void amd_irongate_tlbflush(struct agp_memory *temp) | /* This routine could be implemented by taking the addresses written to the GATT, and flushing them individually. However currently it just flushes the whole table. Which is probably more efficent, since agp_memory blocks can be a large number of entries. */
static void amd_irongate_tlbflush(struct agp_memory *temp) | {
writel(1, amd_irongate_private.registers+AMD_TLBFLUSH);
readl(amd_irongate_private.registers+AMD_TLBFLUSH);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ps3_repository_read_be_node_id - Read the physical BE processor node id. @be_index: Zero based index. @node_id: The BE processor node id. */ | int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id) | /* ps3_repository_read_be_node_id - Read the physical BE processor node id. @be_index: Zero based index. @node_id: The BE processor node id. */
int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id) | {
return read_node(PS3_LPAR_ID_PME,
make_first_field("be", be_index),
0,
0,
0,
node_id, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 6.. FMS Information Report (Unconfirmed Service Id = 0) 6..1. Request Message Parameters */ | static void dissect_ff_msg_fms_info_report_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | /* 6.. FMS Information Report (Unconfirmed Service Id = 0) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_info_report_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | {
proto_tree *sub_tree;
col_set_str(pinfo->cinfo, COL_INFO, "FMS Information Report Request");
if (!tree) {
return;
}
sub_tree = proto_tree_add_subtree(tree, tvb, offset, length,
ett_ff_fms_info_report_req, NULL, "FMS Information Report Request");
proto_tree_add_item(sub_tree,
hf_ff_fms_info_report_req_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
length -= 4;
if (length) {
proto_tree_add_item(sub_tree, hf_ff_data, tvb, offset, length, ENC_NA);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enter Deep Sleep mode with co-operated instruction by the Cortex-M3. */ | void CLKPWR_DeepSleep(void) | /* Enter Deep Sleep mode with co-operated instruction by the Cortex-M3. */
void CLKPWR_DeepSleep(void) | {
SCB->SCR = 0x4;
LPC_SC->PCON = 0x8;
__WFI();
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* This turns the IRDA power on or off on the Compaq H3600 */ | static int h3600_irda_set_power(struct device *dev, unsigned int state) | /* This turns the IRDA power on or off on the Compaq H3600 */
static int h3600_irda_set_power(struct device *dev, unsigned int state) | {
gpio_set_value(H3600_EGPIO_IR_ON, state);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Flush all the entries of the specified table. */ | static void ip_vs_lblc_flush(struct ip_vs_lblc_table *tbl) | /* Flush all the entries of the specified table. */
static void ip_vs_lblc_flush(struct ip_vs_lblc_table *tbl) | {
struct ip_vs_lblc_entry *en, *nxt;
int i;
for (i=0; i<IP_VS_LBLC_TAB_SIZE; i++) {
list_for_each_entry_safe(en, nxt, &tbl->bucket[i], list) {
ip_vs_lblc_free(en);
atomic_dec(&tbl->entries);
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Does this link TRB point to the first segment in a ring, or was the previous TRB the last TRB on the last segment in the ERST? */ | static bool last_trb_on_last_seg(struct xhci_ctrl *ctrl, struct xhci_ring *ring, struct xhci_segment *seg, union xhci_trb *trb) | /* Does this link TRB point to the first segment in a ring, or was the previous TRB the last TRB on the last segment in the ERST? */
static bool last_trb_on_last_seg(struct xhci_ctrl *ctrl, struct xhci_ring *ring, struct xhci_segment *seg, union xhci_trb *trb) | {
if (ring == ctrl->event_ring)
return ((trb == &seg->trbs[TRBS_PER_SEGMENT]) &&
(seg->next == ring->first_seg));
else
return le32_to_cpu(trb->link.control) & LINK_TOGGLE;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Return: 0 if all went well, else returns appropriate error value. */ | static int ti_sci_cmd_clk_is_off(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id, bool *req_state, bool *curr_state) | /* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_clk_is_off(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id, bool *req_state, bool *curr_state) | {
u8 c_state = 0, r_state = 0;
int ret;
if (!req_state && !curr_state)
return -EINVAL;
ret = ti_sci_cmd_get_clock_state(handle, dev_id, clk_id,
&r_state, &c_state);
if (ret)
return ret;
if (req_state)
*req_state = (r_state == MSG_CLOCK_SW_STATE_UNREQ);
if (curr_state)
*curr_state = (c_state == MSG_CLOCK_HW_STATE_NOT_READY);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Traverse a Lua closure, marking its prototype and its upvalues. (Both can be NULL while closure is being created.) */ | static int traverseLclosure(global_State *g, LClosure *cl) | /* Traverse a Lua closure, marking its prototype and its upvalues. (Both can be NULL while closure is being created.) */
static int traverseLclosure(global_State *g, LClosure *cl) | {
UpVal *uv = cl->upvals[i];
markobjectN(g, uv);
}
return 1 + cl->nupvalues;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* STUSB1602 sets the Power Role SWAP status (bit2 0x18 */ | STUSB1602_StatusTypeDef STUSB1602_Power_Role_Swap_Status_Set(uint8_t Addr, Power_Role_Swap_TypeDef st) | /* STUSB1602 sets the Power Role SWAP status (bit2 0x18 */
STUSB1602_StatusTypeDef STUSB1602_Power_Role_Swap_Status_Set(uint8_t Addr, Power_Role_Swap_TypeDef st) | {
STUSB1602_StatusTypeDef status = STUSB1602_OK;
STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
reg.b.PR_SWAP_EN = st;
status = STUSB1602_WriteReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
return status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* CDC_RNDIS_Itf_Receive Data received over USB OUT endpoint are sent over CDC_RNDIS interface through this function. */ | static int8_t CDC_RNDIS_Itf_Receive(uint8_t *Buf, uint32_t *Len) | /* CDC_RNDIS_Itf_Receive Data received over USB OUT endpoint are sent over CDC_RNDIS interface through this function. */
static int8_t CDC_RNDIS_Itf_Receive(uint8_t *Buf, uint32_t *Len) | {
USBD_CDC_RNDIS_HandleTypeDef *hcdc_cdc_rndis = (USBD_CDC_RNDIS_HandleTypeDef *)(USBD_Device.pClassData);
hcdc_cdc_rndis->RxState = 1U;
UNUSED(Buf);
UNUSED(Len);
return (0);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* fc_fcp_abort_io() - Abort all FCP-SCSI exchanges on a local port @lport: The local port whose exchanges are to be aborted */ | static void fc_fcp_abort_io(struct fc_lport *lport) | /* fc_fcp_abort_io() - Abort all FCP-SCSI exchanges on a local port @lport: The local port whose exchanges are to be aborted */
static void fc_fcp_abort_io(struct fc_lport *lport) | {
fc_fcp_cleanup_each_cmd(lport, -1, -1, FC_HRD_ERROR);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Perform cable detection for the EFAR ATA interface. This is different to the PIIX arrangement */ | static int efar_cable_detect(struct ata_port *ap) | /* Perform cable detection for the EFAR ATA interface. This is different to the PIIX arrangement */
static int efar_cable_detect(struct ata_port *ap) | {
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u8 tmp;
pci_read_config_byte(pdev, 0x47, &tmp);
if (tmp & (2 >> ap->port_no))
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* unregister_asymmetric_key_parser - Unregister a asymmetric key blob parser @parser: The parser to unregister */ | void unregister_asymmetric_key_parser(struct asymmetric_key_parser *parser) | /* unregister_asymmetric_key_parser - Unregister a asymmetric key blob parser @parser: The parser to unregister */
void unregister_asymmetric_key_parser(struct asymmetric_key_parser *parser) | {
down_write(&asymmetric_key_parsers_sem);
list_del(&parser->link);
up_write(&asymmetric_key_parsers_sem);
pr_notice("Asymmetric key parser '%s' unregistered\n", parser->name);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function rotates the 64-bit value Operand to the left by Count bits. The low Count bits are fill with the high Count bits of Operand. The rotated value is returned. */ | UINT64 EFIAPI InternalMathLRotU64(IN UINT64 Operand, IN UINTN Count) | /* This function rotates the 64-bit value Operand to the left by Count bits. The low Count bits are fill with the high Count bits of Operand. The rotated value is returned. */
UINT64 EFIAPI InternalMathLRotU64(IN UINT64 Operand, IN UINTN Count) | {
return (Operand << Count) | (Operand >> (64 - Count));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Add a device attribute to view/control the delay between eeprom operations. */ | static ssize_t show_eeprom_delay(struct device *d, struct device_attribute *attr, char *buf) | /* Add a device attribute to view/control the delay between eeprom operations. */
static ssize_t show_eeprom_delay(struct device *d, struct device_attribute *attr, char *buf) | {
struct ipw_priv *p = dev_get_drvdata(d);
int n = p->eeprom_delay;
return sprintf(buf, "%i\n", n);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Worker function to retrieve the number of logical processor in the platform. */ | VOID GetNumberOfProcessor(OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors) | /* Worker function to retrieve the number of logical processor in the platform. */
VOID GetNumberOfProcessor(OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors) | {
EFI_STATUS Status;
EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi;
CPU_FEATURES_DATA *CpuFeaturesData;
CpuFeaturesData = GetCpuFeaturesData ();
CpuMp2Ppi = CpuFeaturesData->MpService.Ppi;
Status = CpuMp2Ppi->GetNumberOfProcessors (
CpuMp2Ppi,
NumberOfCpus,
NumberOfEnabledProcessors
);
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Put one byte to the specified position in a pbuf WARNING: silently ignores offset >= p->tot_len */ | void pbuf_put_at(struct pbuf *p, u16_t offset, u8_t data) | /* Put one byte to the specified position in a pbuf WARNING: silently ignores offset >= p->tot_len */
void pbuf_put_at(struct pbuf *p, u16_t offset, u8_t data) | {
u16_t q_idx;
struct pbuf* q = pbuf_skip(p, offset, &q_idx);
if ((q != NULL) && (q->len > q_idx)) {
((u8_t*)q->payload)[q_idx] = data;
}
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* The X509_CRL_INFO structure needs a bit of customisation. Since we cache the original encoding the signature wont be affected by reordering of the revoked field. */ | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | /* The X509_CRL_INFO structure needs a bit of customisation. Since we cache the original encoding the signature wont be affected by reordering of the revoked field. */
static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | {
X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
if (!a || !a->revoked)
return 1;
switch (operation) {
case ASN1_OP_D2I_POST:
(void)sk_X509_REVOKED_set_cmp_func(a->revoked, X509_REVOKED_cmp);
break;
}
return 1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Performs byte read operation to SFP module's EEPROM over I2C interface. */ | s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data) | /* Performs byte read operation to SFP module's EEPROM over I2C interface. */
s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data) | {
return hw->phy.ops.read_i2c_byte(hw, byte_offset,
IXGBE_I2C_EEPROM_DEV_ADDR,
eeprom_data);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In the tree reconstruction algorithm, Code = Code + Increment only if BitLength(i) is not zero. (Pretty obvious.) */ | void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLongf *c) | /* In the tree reconstruction algorithm, Code = Code + Increment only if BitLength(i) is not zero. (Pretty obvious.) */
void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLongf *c) | {
if (c != Z_NULL)
*c = s->check;
if (s->mode == BTREE || s->mode == DTREE)
ZFREE(z, s->sub.trees.blens);
if (s->mode == CODES)
inflate_codes_free(s->sub.decode.codes, z);
s->mode = TYPE;
s->bitk = 0;
s->bitb = 0;
s->read = s->write = s->window;
if (s->checkfn != Z_NULL)
z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
Tracev((stderr, "inflate: blocks reset\n"));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Print the decimal unsigned UINTN to instruction content. */ | UINTN EdbPrintDatan(IN UINTN Data) | /* Print the decimal unsigned UINTN to instruction content. */
UINTN EdbPrintDatan(IN UINTN Data) | {
EDBSPrintWithOffset (
mInstructionString.Content,
EDB_INSTRUCTION_CONTENT_MAX_SIZE,
mInstructionContentOffset,
L"%d",
(UINTN)Data
);
mInstructionContentOffset = mInstructionContentOffset + EdbGetBitWidth (Data);
return mInstructionContentOffset;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Call a function for each registered cache operation */ | void nl_cache_ops_foreach(void(*cb)(struct nl_cache_ops *, void *), void *arg) | /* Call a function for each registered cache operation */
void nl_cache_ops_foreach(void(*cb)(struct nl_cache_ops *, void *), void *arg) | {
struct nl_cache_ops *ops;
for (ops = cache_ops; ops; ops = ops->co_next)
cb(ops, arg);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* interpret a 32 bit dos packed date/time to some parameters */ | static void interpret_dos_date(uint32_t date, struct tm *tp) | /* interpret a 32 bit dos packed date/time to some parameters */
static void interpret_dos_date(uint32_t date, struct tm *tp) | {
uint32_t p0, p1, p2, p3;
p0 = date & 0xFF;
p1 = ((date & 0xFF00) >> 8) & 0xFF;
p2 = ((date & 0xFF0000) >> 16) & 0xFF;
p3 = ((date & 0xFF000000) >> 24) & 0xFF;
tp->tm_sec = 2 * (p0 & 0x1F);
tp->tm_min = ((p0 >> 5) & 0xFF) + ((p1 & 0x7) << 3);
tp->tm_hour = (p1 >> 3) & 0xFF;
tp->tm_mday = (p2 & 0x1F);
tp->tm_mon = ((p2 >> 5) & 0xFF) + ((p3 & 0x1) << 3) - 1;
tp->tm_year = ((p3 >> 1) & 0xFF) + 80;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* USBH_MSC_BOT_Abort The function handle the BOT Abort process. */ | static USBH_StatusTypeDef USBH_MSC_BOT_Abort(USBH_HandleTypeDef *phost, uint8_t lun, uint8_t dir) | /* USBH_MSC_BOT_Abort The function handle the BOT Abort process. */
static USBH_StatusTypeDef USBH_MSC_BOT_Abort(USBH_HandleTypeDef *phost, uint8_t lun, uint8_t dir) | {
UNUSED(lun);
USBH_StatusTypeDef status = USBH_FAIL;
MSC_HandleTypeDef *MSC_Handle = (MSC_HandleTypeDef *) phost->pActiveClass->pData;
switch (dir)
{
case BOT_DIR_IN :
status = USBH_ClrFeature(phost, MSC_Handle->InEp);
break;
case BOT_DIR_OUT :
status = USBH_ClrFeature(phost, MSC_Handle->OutEp);
break;
default:
break;
}
return status;
} | ua1arn/hftrx | C++ | null | 69 |
/* qla2x00_nv_write() - Prepare for NVRAM read/write operation. @ha: HA context @data: Serial interface selector */ | static void qla2x00_nv_write(struct qla_hw_data *ha, uint16_t data) | /* qla2x00_nv_write() - Prepare for NVRAM read/write operation. @ha: HA context @data: Serial interface selector */
static void qla2x00_nv_write(struct qla_hw_data *ha, uint16_t data) | {
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
WRT_REG_WORD(®->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
RD_REG_WORD(®->nvram);
NVRAM_DELAY();
WRT_REG_WORD(®->nvram, data | NVR_SELECT | NVR_CLOCK |
NVR_WRT_ENABLE);
RD_REG_WORD(®->nvram);
NVRAM_DELAY();
WRT_REG_WORD(®->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
RD_REG_WORD(®->nvram);
NVRAM_DELAY();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This needs to be a tasklet otherwise we will end up recursively calling this function. */ | static void hso_unthrottle_tasklet(struct hso_serial *serial) | /* This needs to be a tasklet otherwise we will end up recursively calling this function. */
static void hso_unthrottle_tasklet(struct hso_serial *serial) | {
unsigned long flags;
spin_lock_irqsave(&serial->serial_lock, flags);
if ((serial->parent->port_spec & HSO_INTF_MUX))
put_rxbuf_data_and_resubmit_ctrl_urb(serial);
else
put_rxbuf_data_and_resubmit_bulk_urb(serial);
spin_unlock_irqrestore(&serial->serial_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to enable BOD function. */ | void SysCtlBODEnable(xtBoolean bEnable) | /* The function is used to enable BOD function. */
void SysCtlBODEnable(xtBoolean bEnable) | {
SysCtlKeyAddrUnlock();
if(bEnable)
{
xHWREG(GCR_BODCR) |= GCR_BODCR_BOD_EN;
}
else
{
xHWREG(GCR_BODCR) &= ~GCR_BODCR_BOD_EN;
}
SysCtlKeyAddrLock();
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Adds data to the segments that are currently present in the firmware data module. If the data overlaps with already existing data, the existing data gets overwritten. The size of a segment is automatically adjusted or a new segment gets created, if necessary. */ | LIBOPENBLT_EXPORT uint32_t BltFirmwareAddData(uint32_t address, uint32_t len, uint8_t const *data) | /* Adds data to the segments that are currently present in the firmware data module. If the data overlaps with already existing data, the existing data gets overwritten. The size of a segment is automatically adjusted or a new segment gets created, if necessary. */
LIBOPENBLT_EXPORT uint32_t BltFirmwareAddData(uint32_t address, uint32_t len, uint8_t const *data) | {
uint32_t result = BLT_RESULT_ERROR_GENERIC;
assert(len > 0);
assert(data != NULL);
if ( (len > 0) && (data != NULL) )
{
if (FirmwareAddData(address, len, data))
{
result = BLT_RESULT_OK;
}
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Return a pointer to, and the length of, the contiguous free region available for output in a ring buffer. */ | STATIC VOID* XenStoreGetOutputChunk(IN XENSTORE_RING_IDX Cons, IN XENSTORE_RING_IDX Prod, IN CHAR8 *Buffer, OUT UINT32 *LenPtr) | /* Return a pointer to, and the length of, the contiguous free region available for output in a ring buffer. */
STATIC VOID* XenStoreGetOutputChunk(IN XENSTORE_RING_IDX Cons, IN XENSTORE_RING_IDX Prod, IN CHAR8 *Buffer, OUT UINT32 *LenPtr) | {
UINT32 Len;
Len = XENSTORE_RING_SIZE - MASK_XENSTORE_IDX (Prod);
if ((XENSTORE_RING_SIZE - (Prod - Cons)) < Len) {
Len = XENSTORE_RING_SIZE - (Prod - Cons);
}
*LenPtr = Len;
return (Buffer + MASK_XENSTORE_IDX (Prod));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Called when the PCI registration layer (or the IDE initialization) finds a device matching our IDE device tables. */ | static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | /* Called when the PCI registration layer (or the IDE initialization) finds a device matching our IDE device tables. */
static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | {
const struct ide_port_info *d;
u8 idx = id->driver_data;
d = &pdc202xx_chipsets[idx];
if (idx < 2)
pdc202ata4_fixup_irq(dev, d->name);
if (dev->vendor == PCI_DEVICE_ID_PROMISE_20265) {
struct pci_dev *bridge = dev->bus->self;
if (bridge &&
bridge->vendor == PCI_VENDOR_ID_INTEL &&
(bridge->device == PCI_DEVICE_ID_INTEL_I960 ||
bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) {
printk(KERN_INFO DRV_NAME " %s: skipping Promise "
"PDC20265 attached to I2O RAID controller\n",
pci_name(dev));
return -ENODEV;
}
}
return ide_pci_init_one(dev, d, NULL);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* brief Setup rtc 1hz clock divider. param divided_by_value: Value to be divided return Nothing */ | void CLOCK_SetRtc1hzClkDiv(uint32_t divided_by_value) | /* brief Setup rtc 1hz clock divider. param divided_by_value: Value to be divided return Nothing */
void CLOCK_SetRtc1hzClkDiv(uint32_t divided_by_value) | {
if (divided_by_value == 0U)
{
PMC->RTCOSC32K |= (1UL << PMC_RTCOSC32K_CLK1HZDIVHALT_SHIFT);
}
else
{
PMC->RTCOSC32K =
(PMC->RTCOSC32K & ~PMC_RTCOSC32K_CLK1HZDIV_MASK) | PMC_RTCOSC32K_CLK1HZDIV(divided_by_value - 31744U);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is used to derive PSK for WPA-PSK. For this protocol, iterations is set to 4096 and buflen to 32. This function is described in IEEE Std 802.11-2004, Clause H.4. The main construction is from PKCS#5 v2.0. */ | int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, int iterations, u8 *buf, size_t buflen) | /* This function is used to derive PSK for WPA-PSK. For this protocol, iterations is set to 4096 and buflen to 32. This function is described in IEEE Std 802.11-2004, Clause H.4. The main construction is from PKCS#5 v2.0. */
int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, int iterations, u8 *buf, size_t buflen) | {
unsigned int count = 0;
unsigned char *pos = buf;
size_t left = buflen, plen;
unsigned char digest[SHA1_MAC_LEN];
while (left > 0) {
count++;
if (pbkdf2_sha1_f(passphrase, ssid, ssid_len, iterations,
count, digest))
return -1;
plen = left > SHA1_MAC_LEN ? SHA1_MAC_LEN : left;
os_memcpy(pos, digest, plen);
pos += plen;
left -= plen;
}
return 0;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Cancel the previous buffer hold request made on this buffer for this transaction. */ | void xfs_trans_bhold_release(xfs_trans_t *tp, xfs_buf_t *bp) | /* Cancel the previous buffer hold request made on this buffer for this transaction. */
void xfs_trans_bhold_release(xfs_trans_t *tp, xfs_buf_t *bp) | {
xfs_buf_log_item_t *bip;
ASSERT(XFS_BUF_ISBUSY(bp));
ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp);
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
ASSERT(!(bip->bli_format.blf_flags & XFS_BLI_CANCEL));
ASSERT(atomic_read(&bip->bli_refcount) > 0);
ASSERT(bip->bli_flags & XFS_BLI_HOLD);
bip->bli_flags &= ~XFS_BLI_HOLD;
trace_xfs_trans_bhold_release(bip);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Free a data structure using XDR Not a filter, but a convenient utility nonetheless */ | void xdr_free(xdrproc_t proc, char *objp) | /* Free a data structure using XDR Not a filter, but a convenient utility nonetheless */
void xdr_free(xdrproc_t proc, char *objp) | {
XDR x;
x.x_op = XDR_FREE;
(*proc) (&x, objp);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* get_node_active_region - Return active region containing start_pfn Active range returned is empty if none found. @start_pfn: The page to return the region for. @node_ar: Returned set to the active region containing start_pfn */ | static void __init get_node_active_region(unsigned long start_pfn, struct node_active_region *node_ar) | /* get_node_active_region - Return active region containing start_pfn Active range returned is empty if none found. @start_pfn: The page to return the region for. @node_ar: Returned set to the active region containing start_pfn */
static void __init get_node_active_region(unsigned long start_pfn, struct node_active_region *node_ar) | {
int nid = early_pfn_to_nid(start_pfn);
node_ar->nid = nid;
node_ar->start_pfn = start_pfn;
node_ar->end_pfn = start_pfn;
work_with_active_regions(nid, get_active_region_work_fn, node_ar);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function is called when new websocket is open and creates a new websocket_task if requested URI equals '/stream'. */ | void websocket_open_cb(struct tcp_pcb *pcb, const char *uri) | /* This function is called when new websocket is open and creates a new websocket_task if requested URI equals '/stream'. */
void websocket_open_cb(struct tcp_pcb *pcb, const char *uri) | {
printf("WS URI: %s\n", uri);
if (!strcmp(uri, "/stream")) {
printf("request for streaming\n");
xTaskCreate(&websocket_task, "websocket_task", 256, (void *) pcb, 2, NULL);
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Set Timer Output Idle States High.
This determines the value of the timer output compare when it enters idle state. */ | void timer_set_output_idle_state(uint32_t timer_peripheral, uint32_t outputs) | /* Set Timer Output Idle States High.
This determines the value of the timer output compare when it enters idle state. */
void timer_set_output_idle_state(uint32_t timer_peripheral, uint32_t outputs) | {
TIM_CR2(timer_peripheral) |= outputs & TIM_CR2_OIS_MASK;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Distribute and use freely; there are no restrictions on further dissemination and usage except those imposed by the laws of your country of residence. */ | static void sha1_sum_init(Sha1sum *sha1) | /* Distribute and use freely; there are no restrictions on further dissemination and usage except those imposed by the laws of your country of residence. */
static void sha1_sum_init(Sha1sum *sha1) | {
sha1->buf[0] = 0x67452301L;
sha1->buf[1] = 0xEFCDAB89L;
sha1->buf[2] = 0x98BADCFEL;
sha1->buf[3] = 0x10325476L;
sha1->buf[4] = 0xC3D2E1F0L;
sha1->bits[0] = sha1->bits[1] = 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* @src: memory region to duplicate @len: memory region length @gfp: GFP mask to use */ | void* kmemdup(const void *src, size_t len, gfp_t gfp) | /* @src: memory region to duplicate @len: memory region length @gfp: GFP mask to use */
void* kmemdup(const void *src, size_t len, gfp_t gfp) | {
void *p;
p = kmalloc_track_caller(len, gfp);
if (p)
memcpy(p, src, len);
return p;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initialization function for the Q15 Biquad cascade filter. */ | void arm_biquad_cascade_df1_init_q15(arm_biquad_casd_df1_inst_q15 *S, uint8_t numStages, const q15_t *pCoeffs, q15_t *pState, int8_t postShift) | /* Initialization function for the Q15 Biquad cascade filter. */
void arm_biquad_cascade_df1_init_q15(arm_biquad_casd_df1_inst_q15 *S, uint8_t numStages, const q15_t *pCoeffs, q15_t *pState, int8_t postShift) | {
S->numStages = numStages;
S->postShift = postShift;
S->pCoeffs = pCoeffs;
memset(pState, 0, (4U * (uint32_t) numStages) * sizeof(q15_t));
S->pState = pState;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. */ | int32_t FMC_Erase(uint32_t u32PageAddr) | /* Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. */
int32_t FMC_Erase(uint32_t u32PageAddr) | {
int32_t ret = 0;
if (u32PageAddr == FMC_SPROM_BASE)
{
ret = FMC_Erase_SPROM();
}
else
{
FMC->ISPCMD = FMC_ISPCMD_PAGE_ERASE;
FMC->ISPADDR = u32PageAddr;
FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk;
while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { }
if (FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk)
{
FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk;
ret = -1;
}
}
return ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reads and returns the current value of MM7. This function is only available on IA-32 and X64. */ | UINT64 EFIAPI AsmReadMm7(VOID) | /* Reads and returns the current value of MM7. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm7(VOID) | {
UINT64 Data;
__asm__ __volatile__ (
"movd %%mm7, %0 \n\t"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get bit field value from the buffer and then set the value for the question. Note: Data type UINT32 can cover all the bit field value. */ | VOID GetBitsQuestionValue(IN FORM_BROWSER_STATEMENT *Question, IN UINT8 *Buffer) | /* Get bit field value from the buffer and then set the value for the question. Note: Data type UINT32 can cover all the bit field value. */
VOID GetBitsQuestionValue(IN FORM_BROWSER_STATEMENT *Question, IN UINT8 *Buffer) | {
UINTN StartBit;
UINTN EndBit;
UINT32 RetVal;
UINT32 BufferValue;
StartBit = Question->BitVarOffset % 8;
EndBit = StartBit + Question->BitStorageWidth - 1;
CopyMem ((UINT8 *)&BufferValue, Buffer, Question->StorageWidth);
RetVal = BitFieldRead32 (BufferValue, StartBit, EndBit);
CopyMem ((UINT8 *)&Question->HiiValue.Value, (UINT8 *)&RetVal, Question->StorageWidth);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* prepare a host channel and start a transfer */ | uint32_t host_driver_submitrequest(usb_core_instance *pdev, uint8_t hc_num) | /* prepare a host channel and start a transfer */
uint32_t host_driver_submitrequest(usb_core_instance *pdev, uint8_t hc_num) | {
pdev->host.URB_State[hc_num] = HOST_CH_XFER_IDLE;
pdev->host.hc[hc_num].xfer_count = 0U ;
return usb_hchtransbegin(&pdev->regs, hc_num, &pdev->host.hc[hc_num], pdev->basic_cfgs.dmaen);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Task function for blinking the LED as a fixed timer interval. */ | void LedBlinkTask(void) | /* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void) | {
static blt_bool ledOn = BLT_FALSE;
static blt_int32u nextBlinkEvent = 0;
if (TimerGet() >= nextBlinkEvent)
{
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
PTE->PSOR |= GPIO_PSOR_PTSO(1 << 8U);
}
else
{
ledOn = BLT_FALSE;
PTE->PCOR |= GPIO_PSOR_PTSO(1 << 8U);
}
nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This makes a copy of a vector of USB descriptors. Its primary use is to support usb_function objects which can have multiple copies, each needing different descriptors. Functions may have static tables of descriptors, which are used as templates and customized with identifiers (for interfaces, strings, endpoints, and more) as needed by a given function instance. */ | struct usb_descriptor_header** usb_copy_descriptors(struct usb_descriptor_header **src) | /* This makes a copy of a vector of USB descriptors. Its primary use is to support usb_function objects which can have multiple copies, each needing different descriptors. Functions may have static tables of descriptors, which are used as templates and customized with identifiers (for interfaces, strings, endpoints, and more) as needed by a given function instance. */
struct usb_descriptor_header** usb_copy_descriptors(struct usb_descriptor_header **src) | {
struct usb_descriptor_header **tmp;
unsigned bytes;
unsigned n_desc;
void *mem;
struct usb_descriptor_header **ret;
for (bytes = 0, n_desc = 0, tmp = src; *tmp; tmp++, n_desc++)
bytes += (*tmp)->bLength;
bytes += (n_desc + 1) * sizeof(*tmp);
mem = memalign(CONFIG_SYS_CACHELINE_SIZE, bytes);
if (!mem)
return NULL;
tmp = mem;
ret = mem;
mem += (n_desc + 1) * sizeof(*tmp);
while (*src) {
memcpy(mem, *src, (*src)->bLength);
*tmp = mem;
tmp++;
mem += (*src)->bLength;
src++;
}
*tmp = NULL;
return ret;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Internal function. Schedule delayed work in the MMC work queue. */ | static int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay) | /* Internal function. Schedule delayed work in the MMC work queue. */
static int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay) | {
return queue_delayed_work(workqueue, work, delay);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SDRAM is already configured by the bootstrap code, only return the auto-detected size here */ | phys_size_t initdram(int board_type) | /* SDRAM is already configured by the bootstrap code, only return the auto-detected size here */
phys_size_t initdram(int board_type) | {
return get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
CONFIG_SYS_MBYTES_SDRAM << 20);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* parport_ip32_write_data - set new contents for the DATA register */ | static void parport_ip32_write_data(struct parport *p, unsigned char d) | /* parport_ip32_write_data - set new contents for the DATA register */
static void parport_ip32_write_data(struct parport *p, unsigned char d) | {
struct parport_ip32_private * const priv = p->physport->private_data;
writeb(d, priv->regs.data);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the entire driver ports structure to a user app. */ | static int stli_getportstruct(struct stliport __user *arg) | /* Return the entire driver ports structure to a user app. */
static int stli_getportstruct(struct stliport __user *arg) | {
struct stliport stli_dummyport;
struct stliport *portp;
if (copy_from_user(&stli_dummyport, arg, sizeof(struct stliport)))
return -EFAULT;
portp = stli_getport(stli_dummyport.brdnr, stli_dummyport.panelnr,
stli_dummyport.portnr);
if (!portp)
return -ENODEV;
if (copy_to_user(arg, portp, sizeof(struct stliport)))
return -EFAULT;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit. */ | static void decode_channel_map(enum ChannelPosition *cpe_map, enum ChannelPosition *sce_map, enum ChannelPosition type, GetBitContext *gb, int n) | /* Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit. */
static void decode_channel_map(enum ChannelPosition *cpe_map, enum ChannelPosition *sce_map, enum ChannelPosition type, GetBitContext *gb, int n) | {
while (n--) {
enum ChannelPosition *map = cpe_map && get_bits1(gb) ? cpe_map : sce_map;
map[get_bits(gb, 4)] = type;
}
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* This is used to reset the ugid back with the saved values There is nothing much we can do checking error values here. */ | static void resetugid(int suid, int sgid) | /* This is used to reset the ugid back with the saved values There is nothing much we can do checking error values here. */
static void resetugid(int suid, int sgid) | {
if (setresgid(-1, sgid, sgid) == -1) {
abort();
}
if (setresuid(-1, suid, suid) == -1) {
abort();
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Reads the number of empty slots in the write transaction FIFO. */ | uint32_t EPIWriteFIFOCountGet(uint32_t ui32Base) | /* Reads the number of empty slots in the write transaction FIFO. */
uint32_t EPIWriteFIFOCountGet(uint32_t ui32Base) | {
ASSERT(ui32Base == EPI0_BASE);
return (HWREG(ui32Base + EPI_O_WFIFOCNT));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.