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 |
|---|---|---|---|---|---|---|---|
/* configure the ETMx_SYNCONF register including SW and HW Sync selection. */ | void ETM_SyncConfigDeactivate(ETM_Type *pETM, uint32_t u32ConfigValue) | /* configure the ETMx_SYNCONF register including SW and HW Sync selection. */
void ETM_SyncConfigDeactivate(ETM_Type *pETM, uint32_t u32ConfigValue) | {
ASSERT((ETM2 == pETM));
pETM->SYNCONF &= ~u32ConfigValue;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the TIM Capture Compare Channel x. */ | void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx) | /* Enables or disables the TIM Capture Compare Channel x. */
void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx) | {
assert_param(IS_TIM_123458_PERIPH(TIMx));
assert_param(IS_TIM_CHANNEL(TIM_Channel));
assert_param(IS_TIM_CCX(TIM_CCx));
TIMx->CCER &= (uint16_t)(~((uint16_t)(CCER_CCE_Set << TIM_Channel)));
TIMx->CCER |= (uint16_t)(TIM_CCx << TIM_Channel);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The @regs identifier is provided by a successful call to sa1100_request_dma(). */ | dma_addr_t sa1100_get_dma_pos(dma_regs_t *regs) | /* The @regs identifier is provided by a successful call to sa1100_request_dma(). */
dma_addr_t sa1100_get_dma_pos(dma_regs_t *regs) | {
int status;
status = regs->RdDCSR;
if ((!(status & DCSR_BIU) && (status & DCSR_STRTA)) ||
( (status & DCSR_BIU) && !(status & DCSR_STRTB)))
return regs->DBSA;
else
return regs->DBSB;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base Base address of the DMIC peripheral. param vadcb callback Pointer to store callback function. retval None. */ | void DMIC_HwvadEnableIntCallback(DMIC_Type *base, dmic_hwvad_callback_t vadcb) | /* param base Base address of the DMIC peripheral. param vadcb callback Pointer to store callback function. retval None. */
void DMIC_HwvadEnableIntCallback(DMIC_Type *base, dmic_hwvad_callback_t vadcb) | {
uint32_t instance;
instance = DMIC_GetInstance(base);
NVIC_ClearPendingIRQ(s_dmicHwvadIRQ[instance]);
s_dmicHwvadCallback[instance] = vadcb;
(void)EnableIRQ(s_dmicHwvadIRQ[instance]);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Add the request to the request queue, try to start it if the tape is idle. Return without waiting for end of i/o. */ | int tape_do_io_async(struct tape_device *device, struct tape_request *request) | /* Add the request to the request queue, try to start it if the tape is idle. Return without waiting for end of i/o. */
int tape_do_io_async(struct tape_device *device, struct tape_request *request) | {
int rc;
DBF_LH(6, "tape_do_io_async(%p, %p)\n", device, request);
spin_lock_irq(get_ccwdev_lock(device->cdev));
rc = __tape_start_request(device, request);
spin_unlock_irq(get_ccwdev_lock(device->cdev));
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* __check_latch - Check a port latch for a given value. Returns zero if the port contains the given value. Callers must hold hdaps_mtx. */ | static int __check_latch(u16 port, u8 val) | /* __check_latch - Check a port latch for a given value. Returns zero if the port contains the given value. Callers must hold hdaps_mtx. */
static int __check_latch(u16 port, u8 val) | {
if (__get_latch(port) == val)
return 0;
return -EINVAL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 if the super was successfully pinned (or pinning wasn't needed), 1 if we failed. */ | static int pin_sb_for_writeback(struct writeback_control *wbc, struct inode *inode, struct super_block **psb) | /* Returns 0 if the super was successfully pinned (or pinning wasn't needed), 1 if we failed. */
static int pin_sb_for_writeback(struct writeback_control *wbc, struct inode *inode, struct super_block **psb) | {
struct super_block *sb = inode->i_sb;
if (sb == *psb)
return 0;
else if (*psb)
unpin_sb_for_writeback(psb);
if (wbc->sync_mode == WB_SYNC_ALL) {
WARN_ON(!rwsem_is_locked(&sb->s_umount));
return 0;
}
spin_lock(&sb_lock);
sb->s_count++;
if (down_read_trylock(&sb->s_umount)) {
if (sb->s_root) {
spin_unlock(&sb_lock);
goto pinned;
}
up_read(&sb->s_umount);
}
sb->s_count--;
spin_unlock(&sb_lock);
return 1;
pinned:
*psb = sb;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* from == to == 0 is code for "zero the entire cluster region" */ | static void ocfs2_clear_page_regions(struct page *page, struct ocfs2_super *osb, u32 cpos, unsigned from, unsigned to) | /* from == to == 0 is code for "zero the entire cluster region" */
static void ocfs2_clear_page_regions(struct page *page, struct ocfs2_super *osb, u32 cpos, unsigned from, unsigned to) | {
void *kaddr;
unsigned int cluster_start, cluster_end;
ocfs2_figure_cluster_boundaries(osb, cpos, &cluster_start, &cluster_end);
kaddr = kmap_atomic(page, KM_USER0);
if (from || to) {
if (from > cluster_start)
memset(kaddr + cluster_start, 0, from - cluster_start);
if (to < cluster_end)
memset(kaddr + to, 0, cluster_end - to);
} else {
memset(kaddr + cluster_start, 0, cluster_end - cluster_start);
}
kunmap_atomic(kaddr, KM_USER0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clear the I2C time out flag of the specified I2C port.
The */ | void I2CTimeoutFlagClear(unsigned long ulBase) | /* Clear the I2C time out flag of the specified I2C port.
The */
void I2CTimeoutFlagClear(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_O_TOC) |= I2C_TOC_TIF;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ | EFI_STATUS EFIAPI DiskIoComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI DiskIoComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mDiskIoDriverNameTable,
DriverName,
(BOOLEAN)(This == &gDiskIoComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clear the FIFO buffer of the specified SPI port. */ | void SPIFIFOClear(unsigned long ulBase, unsigned long ulRxTx) | /* Clear the FIFO buffer of the specified SPI port. */
void SPIFIFOClear(unsigned long ulBase, unsigned long ulRxTx) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
xHWREG(ulBase + SPI_FIFOCTL) |= ulRxTx;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The current receive FIFO state can be extracted from the returned value by ANDing with */ | uint32_t EMACStatusGet(uint32_t ui32Base) | /* The current receive FIFO state can be extracted from the returned value by ANDing with */
uint32_t EMACStatusGet(uint32_t ui32Base) | {
return (HWREG(ui32Base + EMAC_O_STATUS));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with */ | SPIN_LOCK* EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock) | /* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with */
SPIN_LOCK* EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock) | {
SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
LockValue = *SpinLock;
ASSERT (SPIN_LOCK_ACQUIRED == LockValue || SPIN_LOCK_RELEASED == LockValue);
*SpinLock = SPIN_LOCK_RELEASED;
return SpinLock;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function performs Davinci platform specific deinitialization for usb0. */ | void musb_platform_deinit(void) | /* This function performs Davinci platform specific deinitialization for usb0. */
void musb_platform_deinit(void) | {
phy_off();
writel(DAVINCI_USB_USBINT_MASK | DAVINCI_USB_TXINT_MASK |
DAVINCI_USB_RXINT_MASK , &dregs->intclrr);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Create QemuOpts from a QDict. Use value of key "id" as ID if it exists and is a QString. Only QStrings, QInts, QFloats and QBools are copied. Entries with other types are silently ignored. */ | QemuOpts* qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict, Error **errp) | /* Create QemuOpts from a QDict. Use value of key "id" as ID if it exists and is a QString. Only QStrings, QInts, QFloats and QBools are copied. Entries with other types are silently ignored. */
QemuOpts* qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict, Error **errp) | {
OptsFromQDictState state;
Error *local_err = NULL;
QemuOpts *opts;
opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1,
&local_err);
if (local_err) {
error_propagate(errp, local_err);
return NULL;
}
assert(opts != NULL);
state.errp = &local_err;
state.opts = opts;
qdict_iter(qdict, qemu_opts_from_qdict_1, &state);
if (local_err) {
error_propagate(errp, local_err);
qemu_opts_del(opts);
return NULL;
}
return opts;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* The exception #0 stub header is duplicated in an allocated pool with extra 4-byte/8-byte to store the exception handler data. The new allocated memory layout follows structure */ | EXCEPTION_HANDLER_DATA* GetExceptionHandlerData(VOID) | /* The exception #0 stub header is duplicated in an allocated pool with extra 4-byte/8-byte to store the exception handler data. The new allocated memory layout follows structure */
EXCEPTION_HANDLER_DATA* GetExceptionHandlerData(VOID) | {
IA32_DESCRIPTOR IdtDescriptor;
IA32_IDT_GATE_DESCRIPTOR *IdtTable;
EXCEPTION0_STUB_HEADER *Exception0StubHeader;
AsmReadIdtr (&IdtDescriptor);
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
Exception0StubHeader = (EXCEPTION0_STUB_HEADER *)ArchGetIdtHandler (&IdtTable[0]);
return Exception0StubHeader->ExceptionHandlerData;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the direction and mode of the specified pin.
where */ | void GPIODirModeSet(unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO) | /* Sets the direction and mode of the specified pin.
where */
void GPIODirModeSet(unsigned long ulPort, unsigned long ulBit, unsigned long ulPinIO) | {
xASSERT(GPIOBaseValid(ulPort));
xASSERT((ulPinIO == GPIO_DIR_MODE_IN) || (ulPinIO == GPIO_DIR_MODE_OUT) ||
(ulPinIO == GPIO_DIR_MODE_HW) || (ulPinIO == GPIO_DIR_MODE_OD));
xHWREG(ulPort + GPIO_PMD) = (xHWREG(ulPort + GPIO_PMD) & \
(~(3 << (ulBit * 2))));
xHWREG(ulPort + GPIO_PMD) = (xHWREG(ulPort + GPIO_PMD) | \
((ulPinIO & GPIO_PMD_PMD0_M) << (ulBit * 2)));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base) | /* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(htim_base->Instance==TIM12)
{
__HAL_RCC_TIM12_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_14;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM12;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @event: wait for key event @context: not used */ | static void EFIAPI efi_key_notify(struct efi_event *event, void *context) | /* @event: wait for key event @context: not used */
static void EFIAPI efi_key_notify(struct efi_event *event, void *context) | {
EFI_ENTRY("%p, %p", event, context);
efi_cin_check();
EFI_EXIT(EFI_SUCCESS);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Write the transmitted data with specified peripheral chip select value. */ | spi_status_t spi_write(Spi *p_spi, uint16_t us_data, uint8_t uc_pcs, uint8_t uc_last) | /* Write the transmitted data with specified peripheral chip select value. */
spi_status_t spi_write(Spi *p_spi, uint16_t us_data, uint8_t uc_pcs, uint8_t uc_last) | {
uint32_t timeout = SPI_TIMEOUT;
uint32_t value;
while (!(p_spi->SPI_SR & SPI_SR_TDRE)) {
if (!timeout--) {
return SPI_ERROR_TIMEOUT;
}
}
if (spi_get_peripheral_select_mode(p_spi)) {
value = SPI_TDR_TD(us_data) | SPI_TDR_PCS(uc_pcs);
if (uc_last) {
value |= SPI_TDR_LASTXFER;
}
} else {
value = SPI_TDR_TD(us_data);
}
p_spi->SPI_TDR = value;
return SPI_OK;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Fills each SDIO_DataConfig_T member with its default value. */ | void SDIO_ConfigDataStructInit(SDIO_DataConfig_T *dataConfig) | /* Fills each SDIO_DataConfig_T member with its default value. */
void SDIO_ConfigDataStructInit(SDIO_DataConfig_T *dataConfig) | {
dataConfig->dataTimeOut = 0xFFFFFFFF;
dataConfig->dataLength = 0x00;
dataConfig->dataBlockSize = SDIO_DATA_BLOCKSIZE_1B;
dataConfig->transferDir = SDIO_TRANSFER_DIR_TO_CARD;
dataConfig->transferMode = SDIO_TRANSFER_MODE_BLOCK;
dataConfig->DPSM = SDIO_DPSM_DISABLE;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set chip select @s slave @cs chip select: ->slave, otherwise->deselect all */ | static int spi_m2s_hw_cs_set(struct m2s_spi_dsc *s, int cs) | /* Set chip select @s slave @cs chip select: ->slave, otherwise->deselect all */
static int spi_m2s_hw_cs_set(struct m2s_spi_dsc *s, int cs) | {
unsigned int v = (0 <= cs && cs <= 7) ? (1 << cs) : 0;
M2S_SPI(s)->slave_select = v;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Datasheet specify raw units are 16 LSB/uT and this function converts it to Gauss */ | static void bmm150_convert(struct sensor_value *val, int raw_val) | /* Datasheet specify raw units are 16 LSB/uT and this function converts it to Gauss */
static void bmm150_convert(struct sensor_value *val, int raw_val) | {
val->val1 = raw_val / 1600;
val->val2 = ((int32_t)raw_val * (1000000 / 1600)) % 1000000;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Prepares for the data used by CPU feature detection and initialization. */ | VOID* EFIAPI ClockModulationGetConfigData(IN UINTN NumberOfProcessors) | /* Prepares for the data used by CPU feature detection and initialization. */
VOID* EFIAPI ClockModulationGetConfigData(IN UINTN NumberOfProcessors) | {
UINT32 *ConfigData;
ConfigData = AllocateZeroPool (sizeof (CLOCK_MODULATION_CONFIG_DATA) * NumberOfProcessors);
ASSERT (ConfigData != NULL);
return ConfigData;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* 6.. FMS Request Domain Upload (Confirmed Service Id = 16) 6..1. Request Message Parameters */ | static void dissect_ff_msg_fms_req_dom_upload_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | /* 6.. FMS Request Domain Upload (Confirmed Service Id = 16) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_req_dom_upload_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 Request Domain Upload Request");
if (!tree) {
return;
}
sub_tree = proto_tree_add_subtree(tree, tvb, offset, length,
ett_ff_fms_req_dom_upload_req, NULL, "FMS Request Domain Upload Request");
proto_tree_add_item(sub_tree,
hf_ff_fms_req_dom_upload_req_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
length -= 4;
if (length) {
proto_tree_add_item(sub_tree,
hf_ff_fms_req_dom_upload_req_additional_info,
tvb, offset, length, ENC_ASCII|ENC_NA);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enables the PEC value calculation of the transferred bytes. */ | void I2C_EnablePEC(I2C_T *i2c) | /* Enables the PEC value calculation of the transferred bytes. */
void I2C_EnablePEC(I2C_T *i2c) | {
i2c->CTRL1_B.PECEN = SET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* See mss_uart.h for details of how to use this function. */ | void MSS_UART_enable_half_duplex(mss_uart_instance_t *this_uart) | /* See mss_uart.h for details of how to use this function. */
void MSS_UART_enable_half_duplex(mss_uart_instance_t *this_uart) | {
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));
if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1))
{
set_bit_reg8(&this_uart->hw_reg->MM2,ESWM);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This routine enables a PEIM to register itself for shadow when the PEI Foundation discovers permanent memory. */ | EFI_STATUS EFIAPI PeiRegisterForShadow(IN EFI_PEI_FILE_HANDLE FileHandle) | /* This routine enables a PEIM to register itself for shadow when the PEI Foundation discovers permanent memory. */
EFI_STATUS EFIAPI PeiRegisterForShadow(IN EFI_PEI_FILE_HANDLE FileHandle) | {
PEI_CORE_INSTANCE *Private;
Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
if (Private->CurrentFileHandle != FileHandle) {
return EFI_NOT_FOUND;
}
if (Private->Fv[Private->CurrentPeimFvCount].PeimState[Private->CurrentPeimCount] >= PEIM_STATE_REGISTER_FOR_SHADOW) {
return EFI_ALREADY_STARTED;
}
Private->Fv[Private->CurrentPeimFvCount].PeimState[Private->CurrentPeimCount] = PEIM_STATE_REGISTER_FOR_SHADOW;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable the interrupt from happening again until we've processed the current status by scheduling ks8851_irq_work(). */ | static irqreturn_t ks8851_irq(int irq, void *pw) | /* Disable the interrupt from happening again until we've processed the current status by scheduling ks8851_irq_work(). */
static irqreturn_t ks8851_irq(int irq, void *pw) | {
struct ks8851_net *ks = pw;
disable_irq_nosync(irq);
schedule_work(&ks->irq_work);
return IRQ_HANDLED;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* See chapter "Capture Filter Control Register (CFLCR)" in SH7722 Hardware Manual */ | static unsigned int size_dst(unsigned int src, unsigned int scale) | /* See chapter "Capture Filter Control Register (CFLCR)" in SH7722 Hardware Manual */
static unsigned int size_dst(unsigned int src, unsigned int scale) | {
unsigned int mant_pre = scale >> 12;
if (!src || !scale)
return src;
return ((mant_pre + 2 * (src - 1)) / (2 * mant_pre) - 1) *
mant_pre * 4096 / scale + 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ | VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | /* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | {
VOID *NewBuffer;
NewBuffer = malloc (NewSize);
if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
}
if (OldBuffer != NULL) {
FreePool (OldBuffer);
}
return NewBuffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set WM8731 power mode to play back only. */ | void wm8731_power_mode_dac(void) | /* Set WM8731 power mode to play back only. */
void wm8731_power_mode_dac(void) | {
g_us_wm8731_reg_power_down_control_value = 0x07;
wm8731_write_register(WM8731_REG_POWER_DOWN_CONTROL,
g_us_wm8731_reg_power_down_control_value);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This deletes a driver "instance". The device is de-registered with Card Services. If it has been released, all local data structures are freed. Otherwise, the structures will be freed when the device is released. */ | static void netwave_detach(struct pcmcia_device *p_dev) | /* This deletes a driver "instance". The device is de-registered with Card Services. If it has been released, all local data structures are freed. Otherwise, the structures will be freed when the device is released. */
static void netwave_detach(struct pcmcia_device *p_dev) | {
struct net_device *dev = link->priv;
dev_dbg(&link->dev, "netwave_detach\n");
netwave_release(link);
if (link->dev_node)
unregister_netdev(dev);
free_netdev(dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Stop Console Out ConSplitter on device handle by closing Console Out Devcie GUID. */ | EFI_STATUS EFIAPI ConSplitterConOutDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer) | /* Stop Console Out ConSplitter on device handle by closing Console Out Devcie GUID. */
EFI_STATUS EFIAPI ConSplitterConOutDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer) | {
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
Status = ConSplitterStop (
This,
ControllerHandle,
mConOut.VirtualHandle,
&gEfiConsoleOutDeviceGuid,
&gEfiSimpleTextOutProtocolGuid,
(VOID **)&TextOut
);
if (EFI_ERROR (Status)) {
return Status;
}
return ConSplitterTextOutDeleteDevice (&mConOut, TextOut);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set "auto commit" property of the connection. If 'true', then rollback current transaction. If 'false', then start a new transaction. */ | static int conn_setautocommit(lua_State *L) | /* Set "auto commit" property of the connection. If 'true', then rollback current transaction. If 'false', then start a new transaction. */
static int conn_setautocommit(lua_State *L) | {
conn->auto_commit = 1;
ASSERT (L, OCITransRollback (conn->svchp, conn->errhp,
OCI_DEFAULT), conn->errhp);
}
else {
conn->auto_commit = 0;
}
lua_pushboolean(L, 1);
return 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* This function configures the Cortex-M SysTick source to have 1ms time base. */ | void LL_Init1msTick(uint32_t HCLKFrequency) | /* This function configures the Cortex-M SysTick source to have 1ms time base. */
void LL_Init1msTick(uint32_t HCLKFrequency) | {
LL_InitTick(HCLKFrequency, 1000U);
} | ua1arn/hftrx | C++ | null | 69 |
/* If Node is NULL, then ASSERT(). If NodeLength >= SIZE_64KB, then ASSERT(). If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT(). */ | UINT16 SetDevicePathNodeLength(VOID *Node, UINTN Length) | /* If Node is NULL, then ASSERT(). If NodeLength >= SIZE_64KB, then ASSERT(). If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT(). */
UINT16 SetDevicePathNodeLength(VOID *Node, UINTN Length) | {
ASSERT (Node != NULL);
ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB));
return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* set an interrupt stub to jump to a handler ! NOTE: this does */ | void __init __set_intr_stub(enum exception_code code, void *handler) | /* set an interrupt stub to jump to a handler ! NOTE: this does */
void __init __set_intr_stub(enum exception_code code, void *handler) | {
unsigned long addr;
u8 *vector = (u8 *)(CONFIG_INTERRUPT_VECTOR_BASE + code);
addr = (unsigned long) handler - (unsigned long) vector;
vector[0] = 0xdc;
vector[1] = addr;
vector[2] = addr >> 8;
vector[3] = addr >> 16;
vector[4] = addr >> 24;
vector[5] = 0xcb;
vector[6] = 0xcb;
vector[7] = 0xcb;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector2_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector2_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (2 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* param base TDET peripheral base address param mask Bit mask for the tamper enable bits to be cleared. return kStatus_Fail when Tamper Enable Register writing is not allowed return kStatus_Success when specified bits are cleared in the Tamper Enable Register */ | status_t TDET_DisableTampers(DIGTMP_Type *base, uint32_t mask) | /* param base TDET peripheral base address param mask Bit mask for the tamper enable bits to be cleared. return kStatus_Fail when Tamper Enable Register writing is not allowed return kStatus_Success when specified bits are cleared in the Tamper Enable Register */
status_t TDET_DisableTampers(DIGTMP_Type *base, uint32_t mask) | {
status_t status;
mask = mask & TDET_ALL_TER_MASK;
if (tdet_IsRegisterWriteAllowed(base, DIGTMP_LR_TEL_MASK))
{
base->TER &= ~mask;
status = kStatus_Success;
}
else
{
status = kStatus_Fail;
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Mark all delegations as needing to be reclaimed */ | void nfs_delegation_mark_reclaim(struct nfs_client *clp) | /* Mark all delegations as needing to be reclaimed */
void nfs_delegation_mark_reclaim(struct nfs_client *clp) | {
struct nfs_delegation *delegation;
rcu_read_lock();
list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list)
set_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags);
rcu_read_unlock();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* AK4524 on Delta1010LT to choose the chip address */ | static void delta1010lt_ak4524_lock(struct snd_akm4xxx *ak, int chip) | /* AK4524 on Delta1010LT to choose the chip address */
static void delta1010lt_ak4524_lock(struct snd_akm4xxx *ak, int chip) | {
struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
struct snd_ice1712 *ice = ak->private_data[0];
snd_ice1712_save_gpio_status(ice);
priv->cs_mask = ICE1712_DELTA_1010LT_CS;
priv->cs_addr = chip << 4;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* brief Initialize the SAI MCLK to given frequency. return Nothing */ | void CLOCK_SetupSaiMclk(uint32_t id, uint32_t iFreq) | /* brief Initialize the SAI MCLK to given frequency. return Nothing */
void CLOCK_SetupSaiMclk(uint32_t id, uint32_t iFreq) | {
s_Sai_Mclk_Freq[id] = iFreq;
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* s2io_closer - Cleanup routine for the driver Description: This function is the cleanup routine for the driver. It unregist * ers the driver. */ | static __exit void s2io_closer(void) | /* s2io_closer - Cleanup routine for the driver Description: This function is the cleanup routine for the driver. It unregist * ers the driver. */
static __exit void s2io_closer(void) | {
pci_unregister_driver(&s2io_driver);
DBG_PRINT(INIT_DBG, "cleanup done\n");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check if both transmit buffers are sent out. */ | uint32_t uart_is_tx_buf_empty(Uart *p_uart) | /* Check if both transmit buffers are sent out. */
uint32_t uart_is_tx_buf_empty(Uart *p_uart) | {
return (p_uart->UART_SR & UART_SR_TXEMPTY) > 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* And bear in mind, this is about reading from the target PEB, i.e. the PEB which we have just written. */ | static int is_error_sane(int err) | /* And bear in mind, this is about reading from the target PEB, i.e. the PEB which we have just written. */
static int is_error_sane(int err) | {
if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_HDR ||
err == UBI_IO_BAD_HDR_EBADMSG || err == -ETIMEDOUT)
return 0;
return 1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Move count entries from end of map between two memory locations. Returns pointer to last entry moved. */ | static struct ext4_dir_entry_2 * dx_move_dirents(char *from, char *to, struct dx_map_entry *offsets, int count, unsigned blocksize) | /* Move count entries from end of map between two memory locations. Returns pointer to last entry moved. */
static struct ext4_dir_entry_2 * dx_move_dirents(char *from, char *to, struct dx_map_entry *offsets, int count, unsigned blocksize) | {
unsigned rec_len = 0;
while (count--) {
struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *)
(from + (map->offs<<2));
rec_len = EXT4_DIR_REC_LEN(de->name_len);
memcpy (to, de, rec_len);
((struct ext4_dir_entry_2 *) to)->rec_len =
ext4_rec_len_to_disk(rec_len, blocksize);
de->inode = 0;
map++;
to += rec_len;
}
return (struct ext4_dir_entry_2 *) (to - rec_len);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable or disable the interrupt. In counter mode, when the count has been completed, an interrupt is generated. In PWM mode, on a level change, an interupt is generated. In either capture mode, when a capture is complete, an interrupt is generated. */ | void timer_int_enable(uint32_t timer, bool en) | /* Enable or disable the interrupt. In counter mode, when the count has been completed, an interrupt is generated. In PWM mode, on a level change, an interupt is generated. In either capture mode, when a capture is complete, an interrupt is generated. */
void timer_int_enable(uint32_t timer, bool en) | {
if (en) {
TIMER_INTCTL(timer) |= TIMER_INTCTL_INTEN;
} else {
TIMER_INTCTL(timer) &= ~TIMER_INTCTL_INTEN;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* It is being called in three cases: ext3_release_file(): last writer close the file ext3_clear_inode(): last iput(), when nobody link to this file. ext3_truncate(): when the block indirect map is about to change. */ | void ext3_discard_reservation(struct inode *inode) | /* It is being called in three cases: ext3_release_file(): last writer close the file ext3_clear_inode(): last iput(), when nobody link to this file. ext3_truncate(): when the block indirect map is about to change. */
void ext3_discard_reservation(struct inode *inode) | {
struct ext3_inode_info *ei = EXT3_I(inode);
struct ext3_block_alloc_info *block_i = ei->i_block_alloc_info;
struct ext3_reserve_window_node *rsv;
spinlock_t *rsv_lock = &EXT3_SB(inode->i_sb)->s_rsv_window_lock;
if (!block_i)
return;
rsv = &block_i->rsv_window_node;
if (!rsv_is_empty(&rsv->rsv_window)) {
spin_lock(rsv_lock);
if (!rsv_is_empty(&rsv->rsv_window))
rsv_window_remove(inode->i_sb, rsv);
spin_unlock(rsv_lock);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return values: 0 - no int in string 1 - int found, no subsequent comma 2 - int found including a subsequent comma 3 - hyphen found to denote a range */ | int get_option(char **str, int *pint) | /* Return values: 0 - no int in string 1 - int found, no subsequent comma 2 - int found including a subsequent comma 3 - hyphen found to denote a range */
int get_option(char **str, int *pint) | {
char *cur = *str;
if (!cur || !(*cur))
return 0;
*pint = simple_strtol (cur, str, 0);
if (cur == *str)
return 0;
if (**str == ',') {
(*str)++;
return 2;
}
if (**str == '-')
return 3;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clear the SPI interrupt flag of the specified SPI port. */ | void SPIIntFlagClear(unsigned long ulBase, unsigned long ulIntFlags) | /* Clear the SPI interrupt flag of the specified SPI port. */
void SPIIntFlagClear(unsigned long ulBase, unsigned long ulIntFlags) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_IF;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* In this version we simply downsample each component independently. */ | sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) | /* In this version we simply downsample each component independently. */
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) | {
my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
int ci;
jpeg_component_info * compptr;
JSAMPARRAY in_ptr, out_ptr;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
in_ptr = input_buf[ci] + in_row_index;
out_ptr = output_buf[ci] +
(out_row_group_index * downsample->rowgroup_height[ci]);
(*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Determine number of chunks and total bytes in chunk list. The chunk list has already been verified to fit within the RPCRDMA header. */ | void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *ch, int *ch_count, int *byte_count) | /* Determine number of chunks and total bytes in chunk list. The chunk list has already been verified to fit within the RPCRDMA header. */
void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *ch, int *ch_count, int *byte_count) | {
*byte_count = 0;
*ch_count = 0;
for (; ch->rc_discrim != 0; ch++) {
*byte_count = *byte_count + ch->rc_target.rs_length;
*ch_count = *ch_count + 1;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API configure the source of data(filter & pre-filter) for tap interrupt. */ | static int8_t config_tap_data_src(const struct bmi160_acc_tap_int_cfg *tap_int_cfg, const struct bmi160_dev *dev) | /* This API configure the source of data(filter & pre-filter) for tap interrupt. */
static int8_t config_tap_data_src(const struct bmi160_acc_tap_int_cfg *tap_int_cfg, const struct bmi160_dev *dev) | {
int8_t rslt;
uint8_t data = 0;
uint8_t temp = 0;
rslt = bmi160_get_regs(BMI160_INT_DATA_0_ADDR, &data, 1, dev);
if (rslt == BMI160_OK)
{
temp = data & ~BMI160_TAP_SRC_INT_MASK;
data = temp | ((tap_int_cfg->tap_data_src << 3) & BMI160_TAP_SRC_INT_MASK);
rslt = bmi160_set_regs(BMI160_INT_DATA_0_ADDR, &data, 1, dev);
}
return rslt;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If @str_array is NULL, this function simply returns. */ | void g_strfreev(gchar **str_array) | /* If @str_array is NULL, this function simply returns. */
void g_strfreev(gchar **str_array) | {
if (str_array)
{
int i;
for (i = 0; str_array[i] != NULL; i++)
g_free (str_array[i]);
g_free (str_array);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Export n into unsigned binary data, big endian. */ | int rt_hwcrypto_bignum_export_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len) | /* Export n into unsigned binary data, big endian. */
int rt_hwcrypto_bignum_export_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len) | {
int cp_len, i, j;
if (n == RT_NULL || buf == RT_NULL)
{
return 0;
}
rt_memset(buf, 0, len);
cp_len = (int)n->total > len ? len : (int)n->total;
for(i = cp_len, j = 0; i > 0; i--, j++)
{
buf[i - 1] = n->p[j];
}
return cp_len;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Lock a read-write lock object for writing within specific time.
See IEEE 1003.1 */ | int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abstime) | /* Lock a read-write lock object for writing within specific time.
See IEEE 1003.1 */
int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abstime) | {
int32_t timeout;
uint32_t ret = 0U;
struct posix_rwlock *rwl;
if (abstime->tv_nsec < 0 || abstime->tv_nsec > NSEC_PER_SEC) {
return EINVAL;
}
timeout = (int32_t) timespec_to_timeoutms(abstime);
rwl = get_posix_rwlock(*rwlock);
if (rwl == NULL) {
return EINVAL;
}
if (write_lock_acquire(rwl, timeout) != 0U) {
ret = ETIMEDOUT;
}
return ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Check whether the ConfigRequest string has the request elements. For EFI_HII_VARSTORE_BUFFER type, the request has "&OFFSET=****&WIDTH=****..." format. For EFI_HII_VARSTORE_NAME_VALUE type, the request has "&NAME1**&NAME2..." format. */ | BOOLEAN GetElementsFromRequest(IN EFI_STRING ConfigRequest) | /* Check whether the ConfigRequest string has the request elements. For EFI_HII_VARSTORE_BUFFER type, the request has "&OFFSET=****&WIDTH=****..." format. For EFI_HII_VARSTORE_NAME_VALUE type, the request has "&NAME1**&NAME2..." format. */
BOOLEAN GetElementsFromRequest(IN EFI_STRING ConfigRequest) | {
EFI_STRING TmpRequest;
TmpRequest = StrStr (ConfigRequest, L"PATH=");
ASSERT (TmpRequest != NULL);
if ((StrStr (TmpRequest, L"&OFFSET=") != NULL) || (StrStr (TmpRequest, L"&") != NULL)) {
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Simple algorithm to ramp up the mouse cursor speed to make it easier to use. */ | static void prvControlCursorSpeed(signed char *cVal, unsigned long ulInput, unsigned long ulSwitch1, unsigned long ulSwitch2) | /* Simple algorithm to ramp up the mouse cursor speed to make it easier to use. */
static void prvControlCursorSpeed(signed char *cVal, unsigned long ulInput, unsigned long ulSwitch1, unsigned long ulSwitch2) | {
const char cSpeed = 20;
if( !( ulInput & ulSwitch1 ) )
{
if( *cVal > 0 )
{
*cVal = 0;
}
if( *cVal > -cSpeed )
{
(*cVal)--;
}
}
else if( !( ulInput & ulSwitch2 ) )
{
if( *cVal < 0 )
{
*cVal = 0;
}
if( *cVal < cSpeed )
{
(*cVal)++;
}
}
else
{
*cVal = 0;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* The function is used to Set BOD threshold voltage.
The */ | void SysCtlBODVoltSelect(unsigned char ulVoltage) | /* The function is used to Set BOD threshold voltage.
The */
void SysCtlBODVoltSelect(unsigned char ulVoltage) | {
xASSERT((ulVoltage == SYSCTL_BOD_2_2) ||
(ulVoltage == SYSCTL_BOD_2_6) ||
(ulVoltage == SYSCTL_BOD_3_8) ||
(ulVoltage == SYSCTL_BOD_4_5));
SysCtlKeyAddrUnlock();
xHWREG(GCR_BODCR) &= ~GCR_BODCR_BOD_VL_M;
xHWREG(GCR_BODCR) |= ulVoltage;
SysCtlKeyAddrLock();
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Dissects a generic trailer (contains just the payload type) */ | static gint dissect_generic_trailer(proto_tree *gvsp_tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset) | /* Dissects a generic trailer (contains just the payload type) */
static gint dissect_generic_trailer(proto_tree *gvsp_tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset) | {
proto_tree_add_item(gvsp_tree, hf_gvsp_payloadtype, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
return 4;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Adds a data chunk to a given SPDY conversation/stream. */ | static void spdy_add_data_chunk(spdy_conv_t *conv_data, guint32 stream_id, guint32 frame, guint8 *data, guint32 length) | /* Adds a data chunk to a given SPDY conversation/stream. */
static void spdy_add_data_chunk(spdy_conv_t *conv_data, guint32 stream_id, guint32 frame, guint8 *data, guint32 length) | {
spdy_stream_info_t *si = spdy_get_stream_info(conv_data, stream_id);
if (si != NULL) {
spdy_data_frame_t *df = (spdy_data_frame_t *)wmem_new(wmem_file_scope(), spdy_data_frame_t);
df->data = data;
df->length = length;
df->framenum = frame;
wmem_list_append(si->data_frames, df);
++si->num_data_frames;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* USB_OTG_ReadPacket : Reads a packet from the Rx FIFO. */ | void* USB_OTG_ReadPacket(USB_OTG_CORE_HANDLE *pdev, uint8_t *dest, uint16_t len) | /* USB_OTG_ReadPacket : Reads a packet from the Rx FIFO. */
void* USB_OTG_ReadPacket(USB_OTG_CORE_HANDLE *pdev, uint8_t *dest, uint16_t len) | {
uint32_t i=0;
uint32_t count32b = (len + 3) / 4;
__IO uint32_t *fifo = pdev->regs.DFIFO[0];
for ( i = 0; i < count32b; i++, dest += 4 )
{
*(__packed uint32_t *)dest = USB_OTG_READ_REG32(fifo);
}
return ((void *)dest);
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Returns the events that can trigger a uDMA request. */ | uint32_t TimerDMAEventGet(uint32_t ui32Base) | /* Returns the events that can trigger a uDMA request. */
uint32_t TimerDMAEventGet(uint32_t ui32Base) | {
ASSERT(_TimerBaseValid(ui32Base));
return(HWREG(ui32Base + TIMER_O_DMAEV));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the content of the 'KEK' variable based on 'KEKDefault' variable content. */ | EFI_STATUS EFIAPI EnrollPKFromDefault(VOID) | /* Sets the content of the 'KEK' variable based on 'KEKDefault' variable content. */
EFI_STATUS EFIAPI EnrollPKFromDefault(VOID) | {
EFI_STATUS Status;
Status = EnrollFromDefault (
EFI_PLATFORM_KEY_NAME,
EFI_PK_DEFAULT_VARIABLE_NAME,
&gEfiGlobalVariableGuid
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the next parameter from the gnss phrase. */ | static char* gnss_get_next_param(char *src, const char *delim, char **saveptr) | /* Get the next parameter from the gnss phrase. */
static char* gnss_get_next_param(char *src, const char *delim, char **saveptr) | {
char *start, *del;
if (src) {
start = src;
} else {
start = *saveptr;
}
if (!start) {
return NULL;
}
if (*start == '\0' || *start == '\r') {
return NULL;
}
del = strstr(start, delim);
if (!del) {
return NULL;
}
*del = '\0';
*saveptr = del + 1;
if (del == start) {
return NULL;
}
return start;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Determine if the ADC sample sequence overflow occurred. */ | xtBoolean xADCOverflow(unsigned long ulBase) | /* Determine if the ADC sample sequence overflow occurred. */
xtBoolean xADCOverflow(unsigned long ulBase) | {
unsigned long ulStatus;
xASSERT(ulBase == ADC_BASE);
ulStatus = xHWREG(ulBase + ADC_SR);
return ((ulStatus & ADC_SR_OVERRUN) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* get the leaf class with the minimum vt in the hierarchy */ | static struct hfsc_class* vttree_get_minvt(struct hfsc_class *cl, u64 cur_time) | /* get the leaf class with the minimum vt in the hierarchy */
static struct hfsc_class* vttree_get_minvt(struct hfsc_class *cl, u64 cur_time) | {
if (cl->cl_cfmin > cur_time)
return NULL;
while (cl->level > 0) {
cl = vttree_firstfit(cl, cur_time);
if (cl == NULL)
return NULL;
if (cl->cl_parent->cl_cvtmin < cl->cl_vt)
cl->cl_parent->cl_cvtmin = cl->cl_vt;
}
return cl;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* drbd_bm_read() - Read the whole bitmap from its on disk location. @mdev: DRBD device. */ | int drbd_bm_read(struct drbd_conf *mdev) __must_hold(local) | /* drbd_bm_read() - Read the whole bitmap from its on disk location. @mdev: DRBD device. */
int drbd_bm_read(struct drbd_conf *mdev) __must_hold(local) | {
return bm_rw(mdev, READ);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the simplelink spawn task to call SL callback from a different context. */ | void vSimpleLinkSpawnTask(void *pvParameters) | /* This is the simplelink spawn task to call SL callback from a different context. */
void vSimpleLinkSpawnTask(void *pvParameters) | {
tSimpleLinkSpawnMsg Msg;
portBASE_TYPE ret;
for(;;)
{
ret = xQueueReceive( xSimpleLinkSpawnQueue, &Msg, SL_SPAWN_MAX_WAIT_MS);
if(ret == pdPASS)
{
Msg.pEntry(Msg.pValue);
}
pybwdt_sl_alive();
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Returns the value associated to @data or NULL in case of error */ | void* xmlListSearch(xmlListPtr l, void *data) | /* Returns the value associated to @data or NULL in case of error */
void* xmlListSearch(xmlListPtr l, void *data) | {
xmlLinkPtr lk;
if (l == NULL)
return(NULL);
lk = xmlListLinkSearch(l, data);
if (lk)
return (lk->data);
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Check the blacklist and disable UDMA5 if matched */ | static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned long mask) | /* Check the blacklist and disable UDMA5 if matched */
static unsigned long serverworks_csb_filter(struct ata_device *adev, unsigned long mask) | {
const char *p;
char model_num[ATA_ID_PROD_LEN + 1];
int i;
if (adev->class != ATA_DEV_ATA)
return ata_bmdma_mode_filter(adev, mask);
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
for (i = 0; (p = csb_bad_ata100[i]) != NULL; i++) {
if (!strcmp(p, model_num))
mask &= ~(0xE0 << ATA_SHIFT_UDMA);
}
return ata_bmdma_mode_filter(adev, mask);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will do USB_REQ_CLEAR_FEATURE bRequest for the device instance to clear feature of the hub port. */ | rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port, rt_uint16_t feature) | /* This function will do USB_REQ_CLEAR_FEATURE bRequest for the device instance to clear feature of the hub port. */
rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port, rt_uint16_t feature) | {
struct urequest setup;
int timeout = USB_TIMEOUT_BASIC;
RT_ASSERT(hub != RT_NULL);
if(hub->is_roothub)
{
root_hub_ctrl(hub->hcd, port, RH_CLEAR_PORT_FEATURE,
(void*)(rt_uint32_t)feature);
return RT_EOK;
}
setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS |
USB_REQ_TYPE_OTHER;
setup.bRequest = USB_REQ_CLEAR_FEATURE;
setup.wIndex = port;
setup.wLength = 0;
setup.wValue = feature;
if(rt_usb_hcd_setup_xfer(hub->hcd, hub->self->pipe_ep0_out, &setup, timeout) == 8)
{
return RT_EOK;
}
return -RT_FALSE;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Enables or disables the temperature sensor and Vrefint channel. */ | void ADC_EnableTempSensorVrefint(FunctionalState Cmd) | /* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_EnableTempSensorVrefint(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
ADC1->CTRL2 |= CTRL2_TSVREFE_SET;
_EnVref1p2()
}
else
{
ADC1->CTRL2 &= CTRL2_TSVREFE_RESET;
_DisVref1p2()
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Releases the SWFW semaphore thought the GSSR register for the specified function (CSR, PHY0, PHY1, EEPROM, Flash) */ | void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask) | /* Releases the SWFW semaphore thought the GSSR register for the specified function (CSR, PHY0, PHY1, EEPROM, Flash) */
void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask) | {
u32 gssr;
u32 swmask = mask;
ixgbe_get_eeprom_semaphore(hw);
gssr = IXGBE_READ_REG(hw, IXGBE_GSSR);
gssr &= ~swmask;
IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr);
ixgbe_release_eeprom_semaphore(hw);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Send a XID command PDU to MAC layer in response to a XID REQUEST primitive from the network layer. Verify event is a primitive type event. Verify the primitive is a XID REQUEST. */ | int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) | /* Send a XID command PDU to MAC layer in response to a XID REQUEST primitive from the network layer. Verify event is a primitive type event. Verify the primitive is a XID REQUEST. */
int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) | {
struct llc_sap_state_ev *ev = llc_sap_ev(skb);
int rc;
llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap,
ev->daddr.lsap, LLC_PDU_CMD);
llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0);
rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac);
if (likely(!rc))
rc = dev_queue_xmit(skb);
return rc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Print out a null-terminated filename (or other ascii string). If ep is NULL, assume no truncation check is needed. Return true if truncated. Stop at ep (if given) or before the null char, whichever is first. */ | int fn_print(netdissect_options *ndo, register const u_char *s, register const u_char *ep) | /* Print out a null-terminated filename (or other ascii string). If ep is NULL, assume no truncation check is needed. Return true if truncated. Stop at ep (if given) or before the null char, whichever is first. */
int fn_print(netdissect_options *ndo, register const u_char *s, register const u_char *ep) | {
register int ret;
register u_char c;
ret = 1;
while (ep == NULL || s < ep) {
c = *s++;
if (c == '\0') {
ret = 0;
break;
}
if (!ND_ISASCII(c)) {
c = ND_TOASCII(c);
ND_PRINT((ndo, "M-"));
}
if (!ND_ISPRINT(c)) {
c ^= 0x40;
ND_PRINT((ndo, "^"));
}
ND_PRINT((ndo, "%c", c));
}
return(ret);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Wait until all currently executing or pending works on @worker are finished. */ | void flush_kthread_worker(struct kthread_worker *worker) | /* Wait until all currently executing or pending works on @worker are finished. */
void flush_kthread_worker(struct kthread_worker *worker) | {
struct kthread_flush_work fwork = {
KTHREAD_WORK_INIT(fwork.work, kthread_flush_work_fn),
COMPLETION_INITIALIZER_ONSTACK(fwork.done),
};
queue_kthread_work(worker, &fwork.work);
wait_for_completion(&fwork.done);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Put a released IPC message back to the released chain. */ | static void _ipc_msg_free(rt_ipc_msg_t p_msg) | /* Put a released IPC message back to the released chain. */
static void _ipc_msg_free(rt_ipc_msg_t p_msg) | {
rt_base_t level;
level = rt_spin_lock_irqsave(&_msg_list_lock);
p_msg->msg.sender = (void *)_ipc_msg_free_list;
_ipc_msg_free_list = p_msg;
rt_spin_unlock_irqrestore(&_msg_list_lock, level);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Unpack an integer with 'size' bytes and 'islittle' endianness. If size is smaller than the size of a Lua integer and integer is signed, must do sign extension (propagating the sign to the higher bits); if size is larger than the size of a Lua integer, it must check the unread bytes to see whether they do not cause an overflow. */ | static lua_Integer unpackint(lua_State *L, const char *str, int islittle, int size, int issigned) | /* Unpack an integer with 'size' bytes and 'islittle' endianness. If size is smaller than the size of a Lua integer and integer is signed, must do sign extension (propagating the sign to the higher bits); if size is larger than the size of a Lua integer, it must check the unread bytes to see whether they do not cause an overflow. */
static lua_Integer unpackint(lua_State *L, const char *str, int islittle, int size, int issigned) | {
lua_Unsigned res = 0;
int i;
int limit = (size <= SZINT) ? size : SZINT;
for (i = limit - 1; i >= 0; i--) {
res <<= NB;
res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i];
}
if (size < SZINT) {
if (issigned) {
lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1);
res = ((res ^ mask) - mask);
}
}
else if (size > SZINT) {
int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC;
for (i = limit; i < size; i++) {
if (l_unlikely((unsigned char)str[islittle ? i : size - 1 - i] != mask))
luaL_error(L, "%d-byte integer does not fit into Lua Integer", size);
}
}
return (lua_Integer)res;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Legacy in/out instructions are converted to ld/st instructions on IA64. This routine will convert a port number into a valid SN i/o address. Used by sn_in*() and sn_out*(). */ | void* sn_io_addr(unsigned long port) | /* Legacy in/out instructions are converted to ld/st instructions on IA64. This routine will convert a port number into a valid SN i/o address. Used by sn_in*() and sn_out*(). */
void* sn_io_addr(unsigned long port) | {
if (!IS_RUNNING_ON_SIMULATOR()) {
if (IS_LEGACY_VGA_IOPORT(port))
return (__ia64_mk_io_addr(port));
if (port < (64 * 1024))
return NULL;
if (SN_ACPI_BASE_SUPPORT())
return (__ia64_mk_io_addr(port));
else
return ((void *)(port | __IA64_UNCACHED_OFFSET));
} else {
unsigned long addr;
addr = (is_shub2() ? 0xc00000028c000000UL : 0xc0000087cc000000UL) | ((port >> 2) << 12);
if ((port >= 0x1f0 && port <= 0x1f7) || port == 0x3f6 || port == 0x3f7)
addr |= port;
return (void *)addr;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* writev-intensive code may want this to prefault several iovecs */ | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | /* writev-intensive code may want this to prefault several iovecs */
int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | {
char __user *buf = i->iov->iov_base + i->iov_offset;
bytes = min(bytes, i->iov->iov_len - i->iov_offset);
return fault_in_pages_readable(buf, bytes);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the PLL0 monitor mode.
This function sets the PLL0 monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */ | void CLOCK_SetPll0MonitorMode(scg_pll0_monitor_mode_t mode) | /* Sets the PLL0 monitor mode.
This function sets the PLL0 monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */
void CLOCK_SetPll0MonitorMode(scg_pll0_monitor_mode_t mode) | {
uint32_t reg = SCG0->APLLCSR;
reg &= ~(SCG_APLLCSR_APLLCM_MASK | SCG_APLLCSR_APLLCMRE_MASK);
reg |= (uint32_t)mode;
SCG0->APLLCSR = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write one byte to an SPI device using USART in SPI mode. */ | void usart_spi_write_single(Usart *p_usart, uint8_t data) | /* Write one byte to an SPI device using USART in SPI mode. */
void usart_spi_write_single(Usart *p_usart, uint8_t data) | {
usart_putchar(p_usart, data);
} | memfault/zero-to-main | C++ | null | 200 |
/* Sets or resets the analogue monitoring on VDDA Power source. */ | FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG) | /* Sets or resets the analogue monitoring on VDDA Power source. */
FLASH_Status FLASH_OB_VDDAConfig(uint8_t OB_VDDA_ANALOG) | {
FLASH_Status status = FLASH_COMPLETE;
assert_param(IS_OB_VDDA_ANALOG(OB_VDDA_ANALOG));
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if (status == FLASH_COMPLETE)
{
FLASH->CR |= FLASH_CR_OPTPG;
OB->USER = OB_VDDA_ANALOG | 0xDF;
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if (status != FLASH_TIMEOUT)
{
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* brief Gets the slave transfer status during a non-blocking transfer. param base The LPI2C peripheral base address. param handle Pointer to i2c_slave_handle_t structure. param count Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. retval #kStatus_Success retval #kStatus_NoTransferInProgress */ | status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count) | /* brief Gets the slave transfer status during a non-blocking transfer. param base The LPI2C peripheral base address. param handle Pointer to i2c_slave_handle_t structure. param count Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. retval #kStatus_Success retval #kStatus_NoTransferInProgress */
status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count) | {
assert(handle);
if (!count)
{
return kStatus_InvalidArgument;
}
if (!handle->isBusy)
{
*count = 0;
return kStatus_NoTransferInProgress;
}
*count = handle->transferredCount;
(void) base;
return kStatus_Success;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* return The SEMC clock frequency value in hertz. */ | uint32_t CLOCK_GetSemcFreq(void) | /* return The SEMC clock frequency value in hertz. */
uint32_t CLOCK_GetSemcFreq(void) | {
uint32_t freq;
if ((CCM->CBCDR & CCM_CBCDR_SEMC_CLK_SEL_MASK) != 0U)
{
if ((CCM->CBCDR & CCM_CBCDR_SEMC_ALT_CLK_SEL_MASK) != 0U)
{
freq = CLOCK_GetUsb1PfdFreq(kCLOCK_Pfd1);
}
else
{
freq = CLOCK_GetSysPfdFreq(kCLOCK_Pfd2);
}
}
else
{
freq = CLOCK_GetPeriphClkFreq();
}
freq /= (((CCM->CBCDR & CCM_CBCDR_SEMC_PODF_MASK) >> CCM_CBCDR_SEMC_PODF_SHIFT) + 1U);
return freq;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* e1000_configure - configure the hardware for RX and TX @adapter = private board structure */ | static void e1000_configure(struct e1000_adapter *adapter) | /* e1000_configure - configure the hardware for RX and TX @adapter = private board structure */
static void e1000_configure(struct e1000_adapter *adapter) | {
struct net_device *netdev = adapter->netdev;
int i;
e1000_set_rx_mode(netdev);
e1000_restore_vlan(adapter);
e1000_init_manageability(adapter);
e1000_configure_tx(adapter);
e1000_setup_rctl(adapter);
e1000_configure_rx(adapter);
for (i = 0; i < adapter->num_rx_queues; i++) {
struct e1000_rx_ring *ring = &adapter->rx_ring[i];
adapter->alloc_rx_buf(adapter, ring,
E1000_DESC_UNUSED(ring));
}
adapter->tx_queue_len = netdev->tx_queue_len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to enable LVD function. */ | void SysCtlLVDEnable(xtBoolean bEnable) | /* The function is used to enable LVD function. */
void SysCtlLVDEnable(xtBoolean bEnable) | {
if(bEnable)
{
xHWREG(PWRCU_LVDCSR) |= PWRCU_LVDCSR_LVDEN;
}
else
{
xHWREG(PWRCU_LVDCSR) &= ~PWRCU_LVDCSR_LVDEN;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Function for executing an application timeout handler, either by calling it directly, or by passing an event to the app_scheduler. */ | static void timeout_handler_exec(timer_node_t *p_timer) | /* Function for executing an application timeout handler, either by calling it directly, or by passing an event to the app_scheduler. */
static void timeout_handler_exec(timer_node_t *p_timer) | {
if (m_evt_schedule_func != NULL)
{
uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context);
APP_ERROR_CHECK(err_code);
}
else
{
p_timer->p_timeout_handler(p_timer->p_context);
}
} | labapart/polymcu | C++ | null | 201 |
/* Initializes the touchscreen, ready to detect user input.
Performs and initialization and calibration of the touchscreen, so that it is ready for use. */ | void touch_interface_init(void) | /* Initializes the touchscreen, ready to detect user input.
Performs and initialization and calibration of the touchscreen, so that it is ready for use. */
void touch_interface_init(void) | {
rtouch_init();
rtouch_enable();
touch_interface_calibrate();
rtouch_set_event_handler(touch_event_handler);
} | memfault/zero-to-main | C++ | null | 200 |
/* This reclaims an I/O buffer, letting it be reused. The memory must have been allocated using usb_buffer_alloc(), and the parameters must match those provided in that allocation request. */ | void usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma) | /* This reclaims an I/O buffer, letting it be reused. The memory must have been allocated using usb_buffer_alloc(), and the parameters must match those provided in that allocation request. */
void usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma) | {
if (!dev || !dev->bus)
return;
if (!addr)
return;
hcd_buffer_free(dev->bus, size, addr, dma);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DAC960_ComputeGenericDiskInfo computes the values for the Generic Disk Information Partition Sector Counts and Block Sizes. */ | static void DAC960_ComputeGenericDiskInfo(DAC960_Controller_T *Controller) | /* DAC960_ComputeGenericDiskInfo computes the values for the Generic Disk Information Partition Sector Counts and Block Sizes. */
static void DAC960_ComputeGenericDiskInfo(DAC960_Controller_T *Controller) | {
int disk;
for (disk = 0; disk < DAC960_MaxLogicalDrives; disk++)
set_capacity(Controller->disks[disk], disk_size(Controller, disk));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Batch_start/batch_end is called in unmap_page_range/invlidate/trucate. In that cases, pages are freed continuously and we can expect pages are in the same memcg. All these calls itself limits the number of pages freed at once, then uncharge_start/end() is called properly. This may be called prural(2) times in a context, */ | void mem_cgroup_uncharge_start(void) | /* Batch_start/batch_end is called in unmap_page_range/invlidate/trucate. In that cases, pages are freed continuously and we can expect pages are in the same memcg. All these calls itself limits the number of pages freed at once, then uncharge_start/end() is called properly. This may be called prural(2) times in a context, */
void mem_cgroup_uncharge_start(void) | {
current->memcg_batch.do_batch++;
if (current->memcg_batch.do_batch == 1) {
current->memcg_batch.memcg = NULL;
current->memcg_batch.bytes = 0;
current->memcg_batch.memsw_bytes = 0;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 on success, errno on failure (as defined in errno.h) */ | struct net_device_stats * et131x_stats(struct net_device *netdev) | /* Returns 0 on success, errno on failure (as defined in errno.h) */
struct net_device_stats * et131x_stats(struct net_device *netdev) | {
struct et131x_adapter *adapter = netdev_priv(netdev);
struct net_device_stats *stats = &adapter->net_stats;
CE_STATS_t *devstat = &adapter->Stats;
stats->rx_packets = devstat->ipackets;
stats->tx_packets = devstat->opackets;
stats->rx_errors = devstat->length_err + devstat->alignment_err +
devstat->crc_err + devstat->code_violations + devstat->other_errors;
stats->tx_errors = devstat->max_pkt_error;
stats->multicast = devstat->multircv;
stats->collisions = devstat->collisions;
stats->rx_length_errors = devstat->length_err;
stats->rx_over_errors = devstat->rx_ov_flow;
stats->rx_crc_errors = devstat->crc_err;
return stats;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the main functional clock and interface clock for all of the omap_hwmods associated with the omap_device. Returns 0. */ | int omap_device_enable_clocks(struct omap_device *od) | /* Enable the main functional clock and interface clock for all of the omap_hwmods associated with the omap_device. Returns 0. */
int omap_device_enable_clocks(struct omap_device *od) | {
struct omap_hwmod *oh;
int i;
for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
omap_hwmod_enable_clocks(oh);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Allocates an mbuf suitable for an L2CAP data packet. The resulting packet has sufficient leading space for: o ACL data header o L2CAP B-frame header */ | struct os_mbuf* ble_hs_mbuf_l2cap_pkt(void) | /* Allocates an mbuf suitable for an L2CAP data packet. The resulting packet has sufficient leading space for: o ACL data header o L2CAP B-frame header */
struct os_mbuf* ble_hs_mbuf_l2cap_pkt(void) | {
return ble_hs_mbuf_gen_pkt(BLE_HCI_DATA_HDR_SZ + BLE_L2CAP_HDR_SZ);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Get string by string id from HII Interface. */ | STATIC CHAR16* Tcg2PhysicalPresenceGetStringById(IN EFI_STRING_ID Id) | /* Get string by string id from HII Interface. */
STATIC CHAR16* Tcg2PhysicalPresenceGetStringById(IN EFI_STRING_ID Id) | {
return HiiGetString (mTcg2PpStringPackHandle, Id, NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure the PWM frecqurecy and output duty cycle.
The */ | void AMSDCMotorRun(unsigned long ulMotor, unsigned long ulDir) | /* Configure the PWM frecqurecy and output duty cycle.
The */
void AMSDCMotorRun(unsigned long ulMotor, unsigned long ulDir) | {
xASSERT((ulBase == AMS_MOTOR_A) ||
(ulBase == AMS_MOTOR_B));
xASSERT((ulDir == AAMS_RUN_FORWARD) ||
(ulDir == AMS_RUN_BACKWARD));
if(ulMotor == AMS_MOTOR_A)
{
xGPIOSPinWrite(sD12,ulDir);
xGPIOSPinWrite(sD9,0);
xPWMStart(sPWMB_BASE, xPWM_CHANNEL0);
}
else if(ulMotor == AMS_MOTOR_B)
{
xGPIOSPinWrite(sD13,ulDir);
xGPIOSPinWrite(sD8,0);
xPWMStart(sPWMA_BASE, xPWM_CHANNEL2);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Add a special packet command request to the tail of the request queue, and wait for it to be serviced. */ | int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, struct ide_atapi_pc *pc, void *buf, unsigned int bufflen) | /* Add a special packet command request to the tail of the request queue, and wait for it to be serviced. */
int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, struct ide_atapi_pc *pc, void *buf, unsigned int bufflen) | {
struct request *rq;
int error;
rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq->cmd_type = REQ_TYPE_SPECIAL;
rq->special = (char *)pc;
if (buf && bufflen) {
error = blk_rq_map_kern(drive->queue, rq, buf, bufflen,
GFP_NOIO);
if (error)
goto put_req;
}
memcpy(rq->cmd, pc->c, 12);
if (drive->media == ide_tape)
rq->cmd[13] = REQ_IDETAPE_PC1;
error = blk_execute_rq(drive->queue, disk, rq, 0);
put_req:
blk_put_request(rq);
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.