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 |
|---|---|---|---|---|---|---|---|
/* Erase an area on a Flash logical partition */ | int32_t hal_flash_erase(hal_partition_t in_partition, uint32_t off_set, uint32_t size) | /* Erase an area on a Flash logical partition */
int32_t hal_flash_erase(hal_partition_t in_partition, uint32_t off_set, uint32_t size) | {
uint32_t start_addr;
hal_logic_partition_t info;
hal_partition_t operate_partition_id = 0;
int32_t ret = 0;
watchdog_feeddog();
ENTER_FUNCTION();
if (hal_flash_info_get(in_partition, &info) != 0) {
TRACEME("hal_flash_info_get fail\n");
ret = -1;
goto RETURN;
}
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* These dissectors are used to dissect the setup part and the data for URB_CONTROL_INPUT / GET CONFIGURATION */ | static int dissect_usb_setup_get_configuration_response(packet_info *pinfo _U_, proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset, usb_conv_info_t *usb_conv_info _U_) | /* These dissectors are used to dissect the setup part and the data for URB_CONTROL_INPUT / GET CONFIGURATION */
static int dissect_usb_setup_get_configuration_response(packet_info *pinfo _U_, proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset, usb_conv_info_t *usb_conv_info _U_) | {
proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* configure the system clock to 72M by PLL which selects IRC8M/2 as its clock source */ | static void system_clock_72m_irc8m(void) | /* configure the system clock to 72M by PLL which selects IRC8M/2 as its clock source */
static void system_clock_72m_irc8m(void) | {
RCU_CFG0 |= RCU_AHB_CKSYS_DIV1;
RCU_CFG0 |= RCU_APB2_CKAHB_DIV1;
RCU_CFG0 |= RCU_APB1_CKAHB_DIV1;
RCU_CFG0 &= ~(RCU_CFG0_PLLSEL | RCU_CFG0_PLLMF);
RCU_CFG0 |= (RCU_PLLSRC_IRC8M_DIV2 | RCU_PLL_MUL18);
RCU_CTL0 |= RCU_CTL0_PLLEN;
while(0 == (RCU_CTL0 & RCU_CTL0_PLLSTB));
RCU_CFG0 &= ~RCU... | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* RETURN VALUES erp new erp_head - pointer to new ERP */ | static struct dasd_ccw_req* dasd_3990_erp_no_rec(struct dasd_ccw_req *default_erp, char *sense) | /* RETURN VALUES erp new erp_head - pointer to new ERP */
static struct dasd_ccw_req* dasd_3990_erp_no_rec(struct dasd_ccw_req *default_erp, char *sense) | {
struct dasd_device *device = default_erp->startdev;
dev_err(&device->cdev->dev,
"The specified record was not found\n");
return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function handles USB OTG FS Wakeup IRQ Handler. */ | void OTG_FS_WKUP_IRQHandler(void) | /* This function handles USB OTG FS Wakeup IRQ Handler. */
void OTG_FS_WKUP_IRQHandler(void) | {
if((&hpcd)->Init.low_power_enable)
{
SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
SystemClockConfig_STOP();
__HAL_PCD_UNGATE_PHYCLOCK((&hpcd));
}
__HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* param handle codec handle. return kStatus_Success is success, else de-initial failed. */ | status_t CODEC_Deinit(codec_handle_t *handle) | /* param handle codec handle. return kStatus_Success is success, else de-initial failed. */
status_t CODEC_Deinit(codec_handle_t *handle) | {
assert((handle != NULL) && (handle->codecConfig != NULL));
return HAL_CODEC_Deinit(handle);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* When an inode is allocated it needs to be accounted for, added to the in use list, the owning superblock and the inode hash. This needs to be done under the inode_lock, so export a function to do this rather than the inode lock itself. We calculate the hash list to add to here so it is all internal which requires th... | void inode_add_to_lists(struct super_block *sb, struct inode *inode) | /* When an inode is allocated it needs to be accounted for, added to the in use list, the owning superblock and the inode hash. This needs to be done under the inode_lock, so export a function to do this rather than the inode lock itself. We calculate the hash list to add to here so it is all internal which requires th... | {
struct hlist_head *head = inode_hashtable + hash(sb, inode->i_ino);
spin_lock(&inode_lock);
__inode_add_to_lists(sb, head, inode);
spin_unlock(&inode_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Calculate the divisor for a specified FACC1 field */ | static unsigned int clock_mss_divisor(unsigned int r, unsigned int s) | /* Calculate the divisor for a specified FACC1 field */
static unsigned int clock_mss_divisor(unsigned int r, unsigned int s) | {
unsigned int v, ret;
v = (r & (0x7<<s)) >> s;
switch (v) {
case 0: ret = 1; break;
case 1: ret = 2; break;
case 2: ret = 4; break;
case 4: ret = 8; break;
case 5: ret = 16; break;
case 6: ret = 32; break;
default: ret = 1; break;
}
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clears or safeguards the OCREF2 signal on an external event. */ | void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF2 signal on an external event. */
void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | {
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST6_PERIPH(TIMx));
assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC2CE);
tmpccmr1 |= (uint16_t)(TIM_OCClear << 8);
TIMx->CCMR1 = tmpccmr1;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Reset the EINT peripheral registers to their default reset values. */ | void EINT_Reset(void) | /* Reset the EINT peripheral registers to their default reset values. */
void EINT_Reset(void) | {
EINT->IMASK = 0x00000000;
EINT->EMASK = 0x00000000;
EINT->RTEN = 0x00000000;
EINT->FTEN = 0x00000000;
EINT->IPEND = 0x000FFFFF;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Returns 1 if a byte has been sent, so another one can be stored for transmission; otherwise returns 0. This function clears the status register of the TWI. */ | unsigned char TWI_ByteSent(AT91S_TWI *pTwi) | /* Returns 1 if a byte has been sent, so another one can be stored for transmission; otherwise returns 0. This function clears the status register of the TWI. */
unsigned char TWI_ByteSent(AT91S_TWI *pTwi) | {
return ((pTwi->TWI_SR & AT91C_TWI_TXRDY) == AT91C_TWI_TXRDY);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* 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_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0);
}
else if(hadc->Instance==ADC2)
{
__HAL_RCC_ADC2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0);
}
else if(hadc->Instance==ADC3)
{
__HAL_RCC_ADC3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* 6.. FMS Resume (Confirmed Service Id = 21) 6..1. Request Message Parameters */ | static void dissect_ff_msg_fms_resume_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | /* 6.. FMS Resume (Confirmed Service Id = 21) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_resume_pi_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 Resume Request");
if (!tree) {
return;
}
sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_resume_req, NULL, "FMS Resume Request");
proto_tree_add_item(sub_tree,
hf_ff_fms_resume_req_idx, tvb, ... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get the start address of the specified SMC chip. */ | uint32_t EXMC_SMC_GetChipStartAddr(uint32_t u32Chip) | /* Get the start address of the specified SMC chip. */
uint32_t EXMC_SMC_GetChipStartAddr(uint32_t u32Chip) | {
uint32_t u32Match;
DDL_ASSERT(IS_EXMC_SMC_CHIP(u32Chip));
u32Match = READ_REG32_BIT(CM_SMC->CSCR1, SMC_CSCR1_ADDMATx(u32Chip)) >> SMC_CSCR1_ADDMATx_POS(u32Chip);
return (u32Match << 24U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Start Timer This function is used to start timer module. */ | void TimerStart(unsigned long ulBase) | /* Start Timer This function is used to start timer module. */
void TimerStart(unsigned long ulBase) | {
xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) ||
(ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) );
xHWREG(ulBase + TIMER_TCR) |= TCR_CNT_EN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Writes the supplied 8-bit value to the LM75B config register. */ | lm75bError_e lm75bConfigWrite(uint8_t configValue) | /* Writes the supplied 8-bit value to the LM75B config register. */
lm75bError_e lm75bConfigWrite(uint8_t configValue) | {
if (!_lm75bInitialised) lm75bInit();
return lm75bWrite8 (LM75B_REGISTER_CONFIGURATION, configValue);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* This function must be called with the queue lock held. */ | int uvc_free_buffers(struct uvc_video_queue *queue) | /* This function must be called with the queue lock held. */
int uvc_free_buffers(struct uvc_video_queue *queue) | {
unsigned int i;
for (i = 0; i < queue->count; ++i) {
if (queue->buffer[i].vma_use_count != 0)
return -EBUSY;
}
if (queue->count) {
vfree(queue->mem);
queue->count = 0;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The user Entry Point for the Random Number Generator (RNG) driver. */ | EFI_STATUS EFIAPI RngDriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for the Random Number Generator (RNG) driver. */
EFI_STATUS EFIAPI RngDriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
EFI_HANDLE Handle;
Status = GetAvailableAlgorithms ();
if (EFI_ERROR (Status)) {
return Status;
}
if (mAvailableAlgoArrayCount == 0) {
return EFI_REQUEST_UNLOAD_IMAGE;
}
Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* NOTE: This check is based upon observation, not documentation. */ | static int verify_mpu401(const struct snd_mpu401 *mpu) | /* NOTE: This check is based upon observation, not documentation. */
static int verify_mpu401(const struct snd_mpu401 *mpu) | {
return ((inb(MPU401C(mpu)) & 0xc0) == 0x80);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Assure at least the required amount of empty slots. If this function causes a grow in the block area then all pointers kept to the block area are invalid! */ | static int assure_empty(rh_info_t *info, int slots) | /* Assure at least the required amount of empty slots. If this function causes a grow in the block area then all pointers kept to the block area are invalid! */
static int assure_empty(rh_info_t *info, int slots) | {
int max_blocks;
if (slots >= 4)
return -EINVAL;
if (info->empty_slots >= slots)
return 0;
max_blocks = ((info->max_blocks + slots) + 15) & ~15;
return grow(info, max_blocks);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Color conversion for no colorspace change: just copy the data, converting from separate-planes to interleaved representation. */ | null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) | /* Color conversion for no colorspace change: just copy the data, converting from separate-planes to interleaved representation. */
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) | {
int ci;
register int nc = cinfo->num_components;
register JSAMPROW outptr;
register JSAMPROW inptr;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->output_width;
while (--num_rows >= 0) {
for (ci = 0; ci < nc; ci++) {
inptr = input_buf[ci][input_row];
outptr = output_buf[0] + ci;
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Enables or Disables the TimeStamp on Tamper Detection Event. */ | void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState) | /* Enables or Disables the TimeStamp on Tamper Detection Event. */
void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPTS;
}
else
{
RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPTS;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configures external clock mode of the GPTM. Used ETI as the clock source. */ | void TimerPrescalerConfigure(unsigned long ulBase, unsigned long ulPrescale, unsigned long ulPSCReloadTime) | /* Configures external clock mode of the GPTM. Used ETI as the clock source. */
void TimerPrescalerConfigure(unsigned long ulBase, unsigned long ulPrescale, unsigned long ulPSCReloadTime) | {
xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE));
xASSERT((ulPSCReloadTime == TIMER_PSC_RLD_UPDATE) ||
(ulPSCReloadTime == TIMER_PSC_RLD_IMMEDIATE));
xHWREG(ulBase + TIMER_PSCR) = ulPrescale;
xHWREG(ulBase + TIMER_EVGR) &= ~TIMER_EVGR_UEVG;
xHWREG(ulBase + TIMER_EVGR) |= ul... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* USB_OTG_BSP_uDelay This function provides delay time in micro sec. */ | void USB_OTG_BSP_uDelay(const uint32_t usec) | /* USB_OTG_BSP_uDelay This function provides delay time in micro sec. */
void USB_OTG_BSP_uDelay(const uint32_t usec) | {
uint32_t count = 0;
const uint32_t utime = (120 * usec / 7);
do
{
if ( ++count > utime )
{
return ;
}
}
while (1);
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* This simply forwards the call to kobject_get(), though we do take care to provide for the case that we get a NULL pointer passed in. */ | struct device* get_device(struct device *dev) | /* This simply forwards the call to kobject_get(), though we do take care to provide for the case that we get a NULL pointer passed in. */
struct device* get_device(struct device *dev) | {
return dev ? to_dev(kobject_get(&dev->kobj)) : NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Close a message queue descriptor.
See IEEE 1003.1 */ | int mq_close(mqd_t mqdes) | /* Close a message queue descriptor.
See IEEE 1003.1 */
int mq_close(mqd_t mqdes) | {
mqueue_desc *mqd = (mqueue_desc *)mqdes;
if (mqd == NULL) {
errno = EBADF;
return -1;
}
atomic_dec(&mqd->mqueue->ref_count);
if (mqd->mqueue->name == NULL) {
remove_mq(mqd->mqueue);
}
k_free(mqd->mem_desc);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Retrieves the size, in bytes, of the context buffer required for SM3 hash operations. */ | UINTN EFIAPI Sm3GetContextSize(VOID) | /* Retrieves the size, in bytes, of the context buffer required for SM3 hash operations. */
UINTN EFIAPI Sm3GetContextSize(VOID) | {
return (UINTN)(sizeof (SM3_CTX));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Gets the error status of the I2C Master module. */ | uint32_t I2CMasterErr(uint32_t ui32Base) | /* Gets the error status of the I2C Master module. */
uint32_t I2CMasterErr(uint32_t ui32Base) | {
uint32_t ui32Err;
ASSERT(_I2CBaseValid(ui32Base));
ui32Err = HWREG(ui32Base + I2C_O_MCS);
if(ui32Err & I2C_MCS_BUSY)
{
return(I2C_MASTER_ERR_NONE);
}
if(ui32Err & (I2C_MCS_ERROR | I2C_MCS_ARBLST))
{
return(ui32Err & (I2C_MCS_ARBLST | I2C_MCS_ACK | I2C_MCS_ADRACK));
... | micropython/micropython | C++ | Other | 18,334 |
/* We cannot use I2C in interrupt context, so we just schedule work. */ | static irqreturn_t menelaus_irq(int irq, void *_menelaus) | /* We cannot use I2C in interrupt context, so we just schedule work. */
static irqreturn_t menelaus_irq(int irq, void *_menelaus) | {
struct menelaus_chip *menelaus = _menelaus;
disable_irq_nosync(irq);
(void)schedule_work(&menelaus->work);
return IRQ_HANDLED;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The following code cannot be run from FLASH! */ | static void flash_cmd(int width, volatile unsigned char *addr, int offset, unsigned char cmd) | /* The following code cannot be run from FLASH! */
static void flash_cmd(int width, volatile unsigned char *addr, int offset, unsigned char cmd) | {
if (width == 4) {
unsigned long cmd32 = (cmd << 16) | cmd;
*(volatile unsigned long *) (addr + offset * 2) = cmd32;
} else {
*(volatile unsigned char *) (addr + offset) = cmd;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* virtqueue_kick - Notifies other side that there is buffer available for it. */ | void virtqueue_kick(struct virtqueue *vq) | /* virtqueue_kick - Notifies other side that there is buffer available for it. */
void virtqueue_kick(struct virtqueue *vq) | {
VQUEUE_BUSY(vq);
atomic_thread_fence(memory_order_seq_cst);
if (vq_ring_must_notify_host(vq))
vq_ring_notify_host(vq);
vq->vq_queued_cnt = 0;
VQUEUE_IDLE(vq);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* creates the ADC command for the MAX1271 range is the range value from comedi */ | static int8_t create_adc_command(unsigned int chan, int range) | /* creates the ADC command for the MAX1271 range is the range value from comedi */
static int8_t create_adc_command(unsigned int chan, int range) | {
int8_t p = (range <= 1);
int8_t r = ((range % 2) == 0);
return (chan << 4) | ((p == 1) << 2) | ((r == 1) << 3);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieves the value of period.
Retrieves the value of the period for the 16-bit mode counter. */ | enum status_code rtc_count_get_period(struct rtc_module *const module, uint16_t *const period_value) | /* Retrieves the value of period.
Retrieves the value of the period for the 16-bit mode counter. */
enum status_code rtc_count_get_period(struct rtc_module *const module, uint16_t *const period_value) | {
Assert(module);
Assert(module->hw);
Rtc *const rtc_module = module->hw;
if (module->mode != RTC_COUNT_MODE_16BIT) {
return STATUS_ERR_UNSUPPORTED_DEV;
}
*period_value = rtc_module->MODE1.PER.reg;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* Causes the indication in progress for the specified connection (if any) to fail with a status code of BLE_HS_ENOTCONN; */ | void ble_gatts_indicate_fail_notconn(uint16_t conn_handle) | /* Causes the indication in progress for the specified connection (if any) to fail with a status code of BLE_HS_ENOTCONN; */
void ble_gatts_indicate_fail_notconn(uint16_t conn_handle) | {
ble_gattc_fail_procs(conn_handle, BLE_GATT_OP_INDICATE, BLE_HS_ENOTCONN);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* 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 ReallocateRuntimePool(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 ReallocateRuntimePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | {
return InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert GUID from LE to BE or BE to LE. */ | VOID EFIAPI SwapBytesGuid(IN GUID *Guid, OUT GUID *ConvertedGuid) | /* Convert GUID from LE to BE or BE to LE. */
VOID EFIAPI SwapBytesGuid(IN GUID *Guid, OUT GUID *ConvertedGuid) | {
CopyGuid (ConvertedGuid, Guid);
ConvertedGuid->Data1 = SwapBytes32 (ConvertedGuid->Data1);
ConvertedGuid->Data2 = SwapBytes16 (ConvertedGuid->Data2);
ConvertedGuid->Data3 = SwapBytes16 (ConvertedGuid->Data3);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* early_platform_driver_probe @class_str: string to identify early platform driver class @nr_probe: number of platform devices to successfully probe before exiting @user_only: only probe user specified early platform devices */ | int __init early_platform_driver_probe(char *class_str, int nr_probe, int user_only) | /* early_platform_driver_probe @class_str: string to identify early platform driver class @nr_probe: number of platform devices to successfully probe before exiting @user_only: only probe user specified early platform devices */
int __init early_platform_driver_probe(char *class_str, int nr_probe, int user_only) | {
int k, n, i;
n = 0;
for (i = -2; n < nr_probe; i++) {
k = early_platform_driver_probe_id(class_str, i, nr_probe - n);
if (k < 0)
break;
n += k;
if (user_only)
break;
}
return n;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* push_queue(): push out the unsent messages of a link where congestion has abated. Node is locked */ | void tipc_link_push_queue(struct link *l_ptr) | /* push_queue(): push out the unsent messages of a link where congestion has abated. Node is locked */
void tipc_link_push_queue(struct link *l_ptr) | {
u32 res;
if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr))
return;
do {
res = tipc_link_push_packet(l_ptr);
} while (!res);
if (res == PUSH_FAILED)
tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. param pTxFrame Pointer to CAN message frame to be sent. */ | status_t MCAN_WriteTxBuffer(CAN_Type *base, uint8_t idx, const mcan_tx_buffer_frame_t *pTxFrame) | /* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. param pTxFrame Pointer to CAN message frame to be sent. */
status_t MCAN_WriteTxBuffer(CAN_Type *base, uint8_t idx, const mcan_tx_buffer_frame_t *pTxFrame) | {
assert(NULL != pTxFrame);
status_t status;
uint8_t *elementAddress = NULL;
uint8_t *elementPayloadAddress = NULL;
if (0U == MCAN_IsTransmitRequestPending(base, idx))
{
elementAddress = (uint8_t *)(MCAN_GetMsgRAMBase(base) + MCAN_GetTxBufferElementAddress(base, idx));
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Send a master transmit request when the bus is idle.(Write Step1)
For this function returns immediately, it is always using in the interrupt hander. */ | void xI2CMasterWriteRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | /* Send a master transmit request when the bus is idle.(Write Step1)
For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterWriteRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C0_BASE));
xASSERT(!(ucSlaveAddr & 0x80));
ulStatus = I2CStartSend(ulBase);
if(!(ulStatus == I2C_I2STAT_M_TX_START))
{
I2CStopSend(ulBase);
return;
}
ulStatus = I2CByteSend(ulBase, (ucSlaveAddr << 1));
if(!(ulStatus == I... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Description: This is used to un-register a hardware specific acpi driver that manipulates the attention LED. The pointer to the info struct must be the same as the one used to set it. */ | int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | /* Description: This is used to un-register a hardware specific acpi driver that manipulates the attention LED. The pointer to the info struct must be the same as the one used to set it. */
int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | {
int retval = -EINVAL;
if (info && attention_info == info) {
attention_info = NULL;
retval = 0;
}
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* tioca_init_provider - init SN PCI provider ops for TIO CA */ | int tioca_init_provider(void) | /* tioca_init_provider - init SN PCI provider ops for TIO CA */
int tioca_init_provider(void) | {
sn_pci_provider[PCIIO_ASIC_TYPE_TIOCA] = &tioca_pci_interfaces;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function forces the Hibernation module to initiate a check of the battery voltage immediately rather than waiting for the next check interval to pass. After calling this function, the application should call the () function and wait for the function to return a zero value before calling the */ | void HibernateBatCheckStart(void) | /* This function forces the Hibernation module to initiate a check of the battery voltage immediately rather than waiting for the next check interval to pass. After calling this function, the application should call the () function and wait for the function to return a zero value before calling the */
void HibernateBa... | {
HWREG(HIB_CTL) |= HIB_CTL_BATCHK;
HibernateWriteComplete();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Forces the TIMx output 2 waveform to active or inactive level. */ | void TIM_ForcedOC2Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | /* Forces the TIMx output 2 waveform to active or inactive level. */
void TIM_ForcedOC2Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | {
uint32_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST2_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC2M;
tmpccmr1 |= ((uint32_t)TIM_ForcedAction << 8);
TIMx->CCMR1 = tmpccmr1;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* mkpath - ensure all directories in path exist Algorithm takes the pessimistic view and works top-down to ensure each directory in path exists, rather than optimistically creating the last element and working backwards. */ | static int mkpath(const char *path, mode_t mode) | /* mkpath - ensure all directories in path exist Algorithm takes the pessimistic view and works top-down to ensure each directory in path exists, rather than optimistically creating the last element and working backwards. */
static int mkpath(const char *path, mode_t mode) | {
if (sp != pp) {
*sp = '\0';
status = do_mkdir(copypath, mode);
*sp = '/';
}
pp = sp + 1;
}
if (status == 0) {
status = do_mkdir(path, mode);
}
free(copypath);
return status;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This function is to configure a UDPv6 instance for UdpWrite. */ | EFI_STATUS PxeBcConfigUdp6Write(IN EFI_UDP6_PROTOCOL *Udp6, IN EFI_IPv6_ADDRESS *StationIp, IN OUT UINT16 *SrcPort) | /* This function is to configure a UDPv6 instance for UdpWrite. */
EFI_STATUS PxeBcConfigUdp6Write(IN EFI_UDP6_PROTOCOL *Udp6, IN EFI_IPv6_ADDRESS *StationIp, IN OUT UINT16 *SrcPort) | {
EFI_UDP6_CONFIG_DATA CfgData;
EFI_STATUS Status;
ZeroMem (&CfgData, sizeof (EFI_UDP6_CONFIG_DATA));
CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME;
CfgData.TransmitTimeout = PXEBC_DEFAULT_LIFETIME;
CfgData.HopLimit = PXEBC_DEFAULT_HOPLIMIT;
CfgData.AllowDuplicatePort = TRUE... | tianocore/edk2 | C++ | Other | 4,240 |
/* Initialises AC97 codec resources for use by ad-hoc devices only. */ | int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, struct snd_ac97_bus_ops *ops, int num) | /* Initialises AC97 codec resources for use by ad-hoc devices only. */
int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, struct snd_ac97_bus_ops *ops, int num) | {
mutex_lock(&codec->mutex);
codec->ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
if (codec->ac97 == NULL) {
mutex_unlock(&codec->mutex);
return -ENOMEM;
}
codec->ac97->bus = kzalloc(sizeof(struct snd_ac97_bus), GFP_KERNEL);
if (codec->ac97->bus == NULL) {
kfree(codec->ac97);
codec->ac97 = NULL;
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function returns a physical erase block with a given maximal number and removes it from the wl subsystem. Must be called with wl_lock held! */ | struct ubi_wl_entry* ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor) | /* The function returns a physical erase block with a given maximal number and removes it from the wl subsystem. Must be called with wl_lock held! */
struct ubi_wl_entry* ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor) | {
struct ubi_wl_entry *e = NULL;
if (!ubi->free.rb_node || (ubi->free_count - ubi->beb_rsvd_pebs < 1))
goto out;
if (anchor)
e = find_anchor_wl_entry(&ubi->free);
else
e = find_mean_wl_entry(ubi, &ubi->free);
if (!e)
goto out;
self_check_in_wl_tree(ubi, e, &ubi->free);
rb_erase(&e->u.rb, &ubi->free);
ub... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The code ramps up the readahead size aggressively at first, but slow down as it approaches max_readhead. Count contiguously cached pages from @offset-1 to @offset-@max, this count is a conservative estimation of */ | static pgoff_t count_history_pages(struct address_space *mapping, struct file_ra_state *ra, pgoff_t offset, unsigned long max) | /* The code ramps up the readahead size aggressively at first, but slow down as it approaches max_readhead. Count contiguously cached pages from @offset-1 to @offset-@max, this count is a conservative estimation of */
static pgoff_t count_history_pages(struct address_space *mapping, struct file_ra_state *ra, pgoff_t of... | {
pgoff_t head;
rcu_read_lock();
head = radix_tree_prev_hole(&mapping->page_tree, offset - 1, max);
rcu_read_unlock();
return offset - 1 - head;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Bits are written to the PHY serially using the PIR register, just like a bit banger. */ | static void sh_eth_mii_write_phy_bits(int port, u32 val, int len) | /* Bits are written to the PHY serially using the PIR register, just like a bit banger. */
static void sh_eth_mii_write_phy_bits(int port, u32 val, int len) | {
int i;
u32 pir;
for (i = len - 1; i >= 0; i--) {
pir = 2 | ((val & 1 << i) ? 1 << 2 : 0);
outl(pir, PIR(port));
udelay(1);
pir = 3 | ((val & 1 << i) ? 1 << 2 : 0);
outl(pir, PIR(port));
udelay(1);
pir = 2 | ((val & 1 << i) ? 1 << 2 : 0);
outl(pir, PIR(port));
udelay(1);
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function is called when the write-buffer timer expires. */ | static enum hrtimer_restart wbuf_timer_callback_nolock(struct hrtimer *timer) | /* This function is called when the write-buffer timer expires. */
static enum hrtimer_restart wbuf_timer_callback_nolock(struct hrtimer *timer) | {
struct ubifs_wbuf *wbuf = container_of(timer, struct ubifs_wbuf, timer);
dbg_io("jhead %s", dbg_jhead(wbuf->jhead));
wbuf->need_sync = 1;
wbuf->c->need_wbuf_sync = 1;
ubifs_wake_up_bgt(wbuf->c);
return HRTIMER_NORESTART;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the period of the specified channel in seconds. */ | void pwmout_period(pwmout_t *obj, float seconds) | /* Set the period of the specified channel in seconds. */
void pwmout_period(pwmout_t *obj, float seconds) | {
pwmout_period_us(obj, (int)(seconds * 1000000.0f));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Deinitializes the SPIx peripheral registers to their default reset values. */ | void SPI_I2S_DeInit(SPI_TypeDef *SPIx) | /* Deinitializes the SPIx peripheral registers to their default reset values. */
void SPI_I2S_DeInit(SPI_TypeDef *SPIx) | {
assert_param(IS_SPI_ALL_PERIPH(SPIx));
if (SPIx == SPI1)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
}
else
{
if (SPIx == SPI2)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB... | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* When this is called, pnpbios functions are assumed to work and the pnpbios_dont_use_current_config flag should already have been set to the appropriate value */ | int __init pnpbios_proc_init(void) | /* When this is called, pnpbios functions are assumed to work and the pnpbios_dont_use_current_config flag should already have been set to the appropriate value */
int __init pnpbios_proc_init(void) | {
proc_pnp = proc_mkdir("bus/pnp", NULL);
if (!proc_pnp)
return -EIO;
proc_pnp_boot = proc_mkdir("boot", proc_pnp);
if (!proc_pnp_boot)
return -EIO;
proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops);
proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops);
proc_create("escd_info", 0, p... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciExpressWrite16(IN UINTN Address, IN UINT16 Value) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciExpressWrite16(IN UINTN Address, IN UINT16 Value) | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT16)-1;
}
return MmioWrite16 (GetPciExpressAddress (Address), Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert hexadecimal value to decimal part of temperature. */ | static void mcp980x_hex_to_temperature_dec(uint8_t uc_hex, uint32_t *p_decimal) | /* Convert hexadecimal value to decimal part of temperature. */
static void mcp980x_hex_to_temperature_dec(uint8_t uc_hex, uint32_t *p_decimal) | {
*p_decimal = ((uint32_t) uc_hex >> 4) * MCP980X_DEC_UNIT;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Invalidate the data cache within the specified region. */ | void v7m_dma_inv_range(const void *start, const void *end) | /* Invalidate the data cache within the specified region. */
void v7m_dma_inv_range(const void *start, const void *end) | {
u32 s = (u32)start, e = (u32)end;
asm("dsb");
if (s & (L1_CACHE_BYTES - 1)) {
DCCIMVAC(s);
s = (s + L1_CACHE_BYTES) & ~(L1_CACHE_BYTES - 1);
}
if (e & (L1_CACHE_BYTES - 1)) {
DCCIMVAC(e);
e &= ~(L1_CACHE_BYTES - 1);
}
for ( ; s < e; s += L1_CACHE_BYTES)
DCIMVAC(s);
asm("dsb");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This re-enables EDMA hardware events on the specified channel. */ | void edma_resume(unsigned channel) | /* This re-enables EDMA hardware events on the specified channel. */
void edma_resume(unsigned channel) | {
unsigned ctlr;
ctlr = EDMA_CTLR(channel);
channel = EDMA_CHAN_SLOT(channel);
if (channel < edma_info[ctlr]->num_channels) {
unsigned int mask = (1 << (channel & 0x1f));
edma_shadow0_write_array(ctlr, SH_EESR, channel >> 5, mask);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Select a LPT LEB for LPT garbage collection and call 'lpt_gc_lnum()'. Returns %0 on success and a negative error code on failure. */ | static int lpt_gc(struct ubifs_info *c) | /* Select a LPT LEB for LPT garbage collection and call 'lpt_gc_lnum()'. Returns %0 on success and a negative error code on failure. */
static int lpt_gc(struct ubifs_info *c) | {
int i, lnum = -1, dirty = 0;
mutex_lock(&c->lp_mutex);
for (i = 0; i < c->lpt_lebs; i++) {
ubifs_assert(!c->ltab[i].tgc);
if (i + c->lpt_first == c->nhead_lnum ||
c->ltab[i].free + c->ltab[i].dirty == c->leb_size)
continue;
if (c->ltab[i].dirty > dirty) {
dirty = c->ltab[i].dirty;
lnum = i + c... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USB_OTG_BSP_ConfigVBUS Configures the IO for the Vbus and OverCurrent. */ | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev) | /* USB_OTG_BSP_ConfigVBUS Configures the IO for the Vbus and OverCurrent. */
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev) | {
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(HOST_POWERSW_PORT_RCC, ENABLE);
GPIO_InitStructure.GPIO_Pin = HOST_POWERSW_VBUS;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.G... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base DCDC peripheral base address. param config Pointer to configuration structure. See to "dcdc_internal_regulator_config_t". */ | void DCDC_SetInternalRegulatorConfig(DCDC_Type *base, const dcdc_internal_regulator_config_t *config) | /* param base DCDC peripheral base address. param config Pointer to configuration structure. See to "dcdc_internal_regulator_config_t". */
void DCDC_SetInternalRegulatorConfig(DCDC_Type *base, const dcdc_internal_regulator_config_t *config) | {
assert(NULL != config);
uint32_t tmp32;
tmp32 = base->REG1 & ~(DCDC_REG1_REG_FBK_SEL_MASK | DCDC_REG1_REG_RLOAD_SW_MASK);
tmp32 |= DCDC_REG1_REG_FBK_SEL(config->feedbackPoint);
if (config->enableLoadResistor)
{
tmp32 |= DCDC_REG1_REG_RLOAD_SW_MASK;
}
base->REG1 = tmp32;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Reverse input data.
Controls the reversal of the bit order of the input data */ | void crc_set_reverse_input(uint32_t reverse_in) | /* Reverse input data.
Controls the reversal of the bit order of the input data */
void crc_set_reverse_input(uint32_t reverse_in) | {
uint32_t reg32 = CRC_CR;
reg32 = (reg32 & ~CRC_CR_REV_IN) | reverse_in;
CRC_CR = reg32;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* @event notified event @context pointer to the notification count */ | static void EFIAPI notify(struct efi_event *event, void *context) | /* @event notified event @context pointer to the notification count */
static void EFIAPI notify(struct efi_event *event, void *context) | {
efi_uintn_t *pos = context;
efi_uintn_t dx, sx, width;
if (!pos)
return;
*pos += 5;
if (*pos >= WIDTH + gop->mode->info->width)
*pos = 0;
width = WIDTH;
dx = *pos - WIDTH;
sx = 0;
if (*pos >= gop->mode->info->width) {
width = WIDTH + gop->mode->info->width - *pos;
} else if (*pos < WIDTH) {
dx = 0;... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Wait the operation register's bit as specified by Bit to become set (or clear). */ | EFI_STATUS EhcWaitOpRegBit(IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout) | /* Wait the operation register's bit as specified by Bit to become set (or clear). */
EFI_STATUS EhcWaitOpRegBit(IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout) | {
UINT32 Index;
for (Index = 0; Index < Timeout / EHC_SYNC_POLL_INTERVAL + 1; Index++) {
if (EHC_REG_BIT_IS_SET (Ehc, Offset, Bit) == WaitToSet) {
return EFI_SUCCESS;
}
gBS->Stall (EHC_SYNC_POLL_INTERVAL);
}
return EFI_TIMEOUT;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* device_path device path to be converted display_only true if the shorter text representation shall be used allow_shortcuts true if shortcut forms may be used */ | static uint16_t EFIAPI* efi_convert_device_path_to_text(struct efi_device_path *device_path, bool display_only, bool allow_shortcuts) | /* device_path device path to be converted display_only true if the shorter text representation shall be used allow_shortcuts true if shortcut forms may be used */
static uint16_t EFIAPI* efi_convert_device_path_to_text(struct efi_device_path *device_path, bool display_only, bool allow_shortcuts) | {
uint16_t *text = NULL;
char buffer[MAX_PATH_LEN];
char *str = buffer;
EFI_ENTRY("%p, %d, %d", device_path, display_only, allow_shortcuts);
if (!device_path)
goto out;
while (device_path &&
str + MAX_NODE_LEN < buffer + MAX_PATH_LEN) {
*str++ = '/';
str = efi_convert_single_device_node_to_text(str,... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Check whether the instruction at regs->pc is a store using an update addressing form which will update r1. */ | static int store_updates_sp(struct pt_regs *regs) | /* Check whether the instruction at regs->pc is a store using an update addressing form which will update r1. */
static int store_updates_sp(struct pt_regs *regs) | {
unsigned int inst;
if (get_user(inst, (unsigned int *)regs->pc))
return 0;
if (((inst >> 21) & 0x1f) != 1)
return 0;
if ((inst & 0xd0000000) == 0xd0000000)
return 1;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initialize the queue head for interrupt transfer, that is, initialize the following three fields: */ | VOID EhcInitIntQh(IN USB_ENDPOINT *Ep, IN QH_HW *QhHw) | /* Initialize the queue head for interrupt transfer, that is, initialize the following three fields: */
VOID EhcInitIntQh(IN USB_ENDPOINT *Ep, IN QH_HW *QhHw) | {
if (Ep->DevSpeed == EFI_USB_SPEED_HIGH) {
QhHw->SMask = QH_MICROFRAME_0;
return;
}
QhHw->SMask = QH_MICROFRAME_1;
QhHw->CMask = QH_MICROFRAME_3 | QH_MICROFRAME_4 | QH_MICROFRAME_5;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Remove the head of the list. The list lock is taken so the function may be used safely with other locking list functions. The head item is returned or NULL if the list is empty. */ | struct sk_buff* skb_dequeue(struct sk_buff_head *list) | /* Remove the head of the list. The list lock is taken so the function may be used safely with other locking list functions. The head item is returned or NULL if the list is empty. */
struct sk_buff* skb_dequeue(struct sk_buff_head *list) | {
unsigned long flags;
struct sk_buff *result;
spin_lock_irqsave(&list->lock, flags);
result = __skb_dequeue(list);
spin_unlock_irqrestore(&list->lock, flags);
return result;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set up the sequence range to use for the ipc identifier range (limited below IPCMNI) then initialise the ids idr. */ | void ipc_init_ids(struct ipc_ids *ids) | /* Set up the sequence range to use for the ipc identifier range (limited below IPCMNI) then initialise the ids idr. */
void ipc_init_ids(struct ipc_ids *ids) | {
init_rwsem(&ids->rw_mutex);
ids->in_use = 0;
ids->seq = 0;
{
int seq_limit = INT_MAX/SEQ_MULTIPLIER;
if (seq_limit > USHORT_MAX)
ids->seq_max = USHORT_MAX;
else
ids->seq_max = seq_limit;
}
idr_init(&ids->ipcs_idr);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check if the address reported by the CPU is in a format we can parse. It would be possible to add code for most other cases, but all would be somewhat complicated (e.g. segment offset would require an instruction parser). So only support physical addresses upto page granuality for now. */ | static int mce_usable_address(struct mce *m) | /* Check if the address reported by the CPU is in a format we can parse. It would be possible to add code for most other cases, but all would be somewhat complicated (e.g. segment offset would require an instruction parser). So only support physical addresses upto page granuality for now. */
static int mce_usable_addr... | {
if (!(m->status & MCI_STATUS_MISCV) || !(m->status & MCI_STATUS_ADDRV))
return 0;
if ((m->misc & 0x3f) > PAGE_SHIFT)
return 0;
if (((m->misc >> 6) & 7) != MCM_ADDR_PHYS)
return 0;
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully retur... | status_t FLEXIO_SPI_MasterTransferGetCount(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, size_t *count) | /* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully retur... | {
assert(handle);
if (!count)
{
return kStatus_InvalidArgument;
}
if (handle->rxData)
{
*count = handle->transferSize - handle->rxRemainingBytes;
}
else
{
*count = handle->transferSize - handle->txRemainingBytes;
}
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Switch dynamically (while audio file is played) the output target (speaker or headphone). */ | int32_t CS42L51_SetOutputMode(CS42L51_Object_t *pObj, uint32_t Output) | /* Switch dynamically (while audio file is played) the output target (speaker or headphone). */
int32_t CS42L51_SetOutputMode(CS42L51_Object_t *pObj, uint32_t Output) | {
(void)(pObj);
(void)(Output);
return CS42L51_ERROR;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* NULL JSON value is kept as static value, and no need to do any cleanup work. */ | EDKII_JSON_VALUE EFIAPI JsonValueInitTrue(VOID) | /* NULL JSON value is kept as static value, and no need to do any cleanup work. */
EDKII_JSON_VALUE EFIAPI JsonValueInitTrue(VOID) | {
return (EDKII_JSON_VALUE)json_true ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* read CTC trim counter direction when reference sync pulse occurred */ | FlagStatus ctc_counter_direction_read(void) | /* read CTC trim counter direction when reference sync pulse occurred */
FlagStatus ctc_counter_direction_read(void) | {
if(RESET != (CTC_STAT & CTC_STAT_REFDIR)) {
return SET;
} else {
return RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function gets the u-boot flash sector protection status (flash_info_t.protect) in sync with the sector protection status stored in hardware. */ | static void flash_sync_real_protect(flash_info_t *info) | /* This function gets the u-boot flash sector protection status (flash_info_t.protect) in sync with the sector protection status stored in hardware. */
static void flash_sync_real_protect(flash_info_t *info) | {
int i;
switch (info->flash_id & FLASH_TYPEMASK) {
case FLASH_28F128J3A:
for (i = 0; i < info->sector_count; ++i) {
info->protect[i] = intel_sector_protected(info, i);
}
break;
case FLASH_AM040:
default:
break;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Check for the standard PBS 0xaa55 signature.
In the given buffer "*buf", this function looks at the standard offset to confirm the presence of the standard sector-0 PBS signature, nominally "0xaa55". */ | RtStatus_t FileSystemBootSectorVerify(uint8_t *buf) | /* Check for the standard PBS 0xaa55 signature.
In the given buffer "*buf", this function looks at the standard offset to confirm the presence of the standard sector-0 PBS signature, nominally "0xaa55". */
RtStatus_t FileSystemBootSectorVerify(uint8_t *buf) | {
int32_t signature;
signature = FSGetWord((uint8_t *) buf, BPB_AND_FSI_SIGNATURE_OFFSET_512B_SECTOR);
if (signature == BOOT_SECTOR_SIGNATURE) {
return SUCCESS;
} else {
return ERROR_OS_FILESYSTEM_FILESYSTEM_NOT_FOUND;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write to TC Register A (RA) on the specified channel. */ | void tc_write_ra(Tc *p_tc, uint32_t ul_channel, uint32_t ul_value) | /* Write to TC Register A (RA) on the specified channel. */
void tc_write_ra(Tc *p_tc, uint32_t ul_channel, uint32_t ul_value) | {
Assert(p_tc);
Assert(ul_channel <
(sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0])));
p_tc->TC_CHANNEL[ul_channel].TC_RA = ul_value;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* proc_scsi_show - show contents of /proc/scsi/scsi (attached devices) @s: output goes here */ | static int proc_scsi_show(struct seq_file *s, void *p) | /* proc_scsi_show - show contents of /proc/scsi/scsi (attached devices) @s: output goes here */
static int proc_scsi_show(struct seq_file *s, void *p) | {
seq_printf(s, "Attached devices:\n");
bus_for_each_dev(&scsi_bus_type, NULL, s, proc_print_scsidevice);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ */ | static void restore_ELCR(char *trigger) | /* ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ */
static void restore_ELCR(char *trigger) | {
outb(trigger[0], 0x4d0);
outb(trigger[1], 0x4d1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read a register over the TPI interface (unlocked and locked versions). */ | int __t1_tpi_read(adapter_t *adapter, u32 addr, u32 *valp) | /* Read a register over the TPI interface (unlocked and locked versions). */
int __t1_tpi_read(adapter_t *adapter, u32 addr, u32 *valp) | {
int tpi_busy;
writel(addr, adapter->regs + A_TPI_ADDR);
writel(0, adapter->regs + A_TPI_CSR);
tpi_busy = t1_wait_op_done(adapter, A_TPI_CSR, F_TPIRDY, 1,
TPI_ATTEMPTS, 3);
if (tpi_busy)
CH_ALERT("%s: TPI read from 0x%x failed\n",
adapter->name, addr);
else
*valp = readl(adapter->regs + A_TPI_RD_D... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Cache a reply. nfsd4_check_drc_limit() has bounded the cache size. */ | void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp) | /* Cache a reply. nfsd4_check_drc_limit() has bounded the cache size. */
void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp) | {
struct nfsd4_slot *slot = resp->cstate.slot;
unsigned int base;
dprintk("--> %s slot %p\n", __func__, slot);
slot->sl_opcnt = resp->opcnt;
slot->sl_status = resp->cstate.status;
if (nfsd4_not_cached(resp)) {
slot->sl_datalen = 0;
return;
}
slot->sl_datalen = (char *)resp->p - (char *)resp->cstate.datap;
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */ | uint16_t LCDIDDDataRead(uint32_t ui32Base, uint32_t ui32CS) | /* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */
uint16_t LCDIDDDataRead(uint32_t ui32Base, uint32_t ui32CS) | {
uint32_t ui32Reg;
ASSERT(ui32Base == LCD0_BASE);
ASSERT((ui32CS == 0) || (ui32CS == 1));
ui32Reg = ui32CS ? LCD_O_LIDDCS1DATA : LCD_O_LIDDCS0DATA;
return((uint16_t)HWREG(ui32Base + ui32Reg));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The channel lock MUST be held by the calling function. */ | static void neo_send_immediate_char(struct jsm_channel *ch, unsigned char c) | /* The channel lock MUST be held by the calling function. */
static void neo_send_immediate_char(struct jsm_channel *ch, unsigned char c) | {
if (!ch)
return;
writeb(c, &ch->ch_neo_uart->txrx);
neo_pci_posting_flush(ch->ch_bd);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Creates the list of fields names and pushes it on top of the stack. */ | static void create_colnames(lua_State *L, cur_data *cur) | /* Creates the list of fields names and pushes it on top of the stack. */
static void create_colnames(lua_State *L, cur_data *cur) | {
lua_pushstring (L, PQfname (result, i-1));
lua_rawseti (L, -2, i);
}
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* UART MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_UART_MspInit(UART_HandleTypeDef *huart) | /* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function is called for SCLP suspend and resume events. */ | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) | /* This function is called for SCLP suspend and resume events. */
void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) | {
switch (sclp_pm_event) {
case SCLP_PM_EVENT_FREEZE:
sclp_console_suspend();
break;
case SCLP_PM_EVENT_RESTORE:
case SCLP_PM_EVENT_THAW:
sclp_console_resume();
break;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is called when the caller needs the IpIo to refresh the existing IPv6 neighbor cache entries since the neighbor is considered reachable by the node has recently received a confirmation that packets sent recently to the neighbor were received by its IP layer. */ | EFI_STATUS EFIAPI IpIoRefreshNeighbor(IN IP_IO *IpIo, IN EFI_IP_ADDRESS *Neighbor, IN UINT32 Timeout) | /* This function is called when the caller needs the IpIo to refresh the existing IPv6 neighbor cache entries since the neighbor is considered reachable by the node has recently received a confirmation that packets sent recently to the neighbor were received by its IP layer. */
EFI_STATUS EFIAPI IpIoRefreshNeighbor(IN ... | {
EFI_IP6_PROTOCOL *Ip;
if (!IpIo->IsConfigured) {
return EFI_NOT_STARTED;
}
if (IpIo->IpVersion != IP_VERSION_6) {
return EFI_UNSUPPORTED;
}
Ip = IpIo->Ip.Ip6;
return Ip->Neighbors (Ip, FALSE, &Neighbor->v6, NULL, Timeout, TRUE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t). */ | static rt_size_t _pwm_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) | /* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t). */
static rt_size_t _pwm_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) | {
rt_err_t result = RT_EOK;
struct rt_device_pwm *pwm = (struct rt_device_pwm *)dev;
rt_uint32_t *pulse = (rt_uint32_t *)buffer;
struct rt_pwm_configuration configuration = {0};
configuration.channel = pos;
if (pwm->ops->control)
{
result = pwm->ops->control(pwm, PWM_CMD_GET, &confi... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Get timer capability.
This function returns various capabilities/attributes of a timer */ | uint32_t tmrHw_getTimerCapability(tmrHw_ID_t timerId, tmrHw_CAPABILITY_e capability) | /* Get timer capability.
This function returns various capabilities/attributes of a timer */
uint32_t tmrHw_getTimerCapability(tmrHw_ID_t timerId, tmrHw_CAPABILITY_e capability) | {
switch (capability) {
case tmrHw_CAPABILITY_CLOCK:
return (timerId <=
1) ? tmrHw_LOW_RESOLUTION_CLOCK :
tmrHw_HIGH_RESOLUTION_CLOCK;
case tmrHw_CAPABILITY_RESOLUTION:
return 32;
default:
return 0;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The various system5 IPC resources (semaphores, messages and shared memory) are initialised A callback routine is registered into the memory hotplug notifier chain: since msgmni scales to lowmem this callback routine will be called upon successful memory add / remove to recompute msmgni. */ | static int __init ipc_init(void) | /* The various system5 IPC resources (semaphores, messages and shared memory) are initialised A callback routine is registered into the memory hotplug notifier chain: since msgmni scales to lowmem this callback routine will be called upon successful memory add / remove to recompute msmgni. */
static int __init ipc_ini... | {
sem_init();
msg_init();
shm_init();
hotplug_memory_notifier(ipc_memory_callback, IPC_CALLBACK_PRI);
register_ipcns_notifier(&init_ipc_ns);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Unregisters an asynchronous callback function with the driver.
Unregisters an asynchronous callback with the EXTINT driver, removing it from the internal callback registration table. */ | enum status_code extint_unregister_callback(const extint_callback_t callback, const uint8_t channel, const enum extint_callback_type type) | /* Unregisters an asynchronous callback function with the driver.
Unregisters an asynchronous callback with the EXTINT driver, removing it from the internal callback registration table. */
enum status_code extint_unregister_callback(const extint_callback_t callback, const uint8_t channel, const enum extint_callback_ty... | {
Assert(callback);
if (type != EXTINT_CALLBACK_TYPE_DETECT) {
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
if (_extint_dev.callbacks[channel] == callback) {
_extint_dev.callbacks[channel] = NULL;
return STATUS_OK;
}
return STATUS_ERR_BAD_ADDRESS;
} | memfault/zero-to-main | C++ | null | 200 |
/* brief Return Frequency of I2S MCLK Clock return Frequency of I2S MCLK Clock */ | uint32_t CLOCK_GetI2SMClkFreq(void) | /* brief Return Frequency of I2S MCLK Clock return Frequency of I2S MCLK Clock */
uint32_t CLOCK_GetI2SMClkFreq(void) | {
return s_I2S_Mclk_Freq;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* set all locked nodes in the path to blocking locks. This should be done before scheduling */ | noinline void btrfs_set_path_blocking(struct btrfs_path *p) | /* set all locked nodes in the path to blocking locks. This should be done before scheduling */
noinline void btrfs_set_path_blocking(struct btrfs_path *p) | {
int i;
for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
if (p->nodes[i] && p->locks[i])
btrfs_set_lock_blocking(p->nodes[i]);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* adds or removes a VLAN from a port's VLAN membership table or Transmit Tagging Information table */ | IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBPortVlanMembershipChange(IxEthDBPortId portID, IxEthDBVlanId vlanID, IxEthDBVlanSet table, UINT32 action) | /* adds or removes a VLAN from a port's VLAN membership table or Transmit Tagging Information table */
IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBPortVlanMembershipChange(IxEthDBPortId portID, IxEthDBVlanId vlanID, IxEthDBVlanSet table, UINT32 action) | {
ixEthDBLocalVlanMembershipChange(vlanID, table, action);
return ixEthDBVlanTableEntryUpdate(portID, VLAN_SET_OFFSET(vlanID));
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Sets the direction (input/output) for a specific port pin. */ | void gpioSetDir(uint32_t portNum, uint32_t bitPos, gpioDirection_t dir) | /* Sets the direction (input/output) for a specific port pin. */
void gpioSetDir(uint32_t portNum, uint32_t bitPos, gpioDirection_t dir) | {
if (!_gpioInitialised) gpioInit();
REG32 *gpiodir = &GPIO_GPIO0DIR;
switch (portNum)
{
case 0:
gpiodir = &GPIO_GPIO0DIR;
break;
case 1:
gpiodir = &GPIO_GPIO1DIR;
break;
case 2:
gpiodir = &GPIO_GPIO2DIR;
break;
case 3:
gpiodir = &GPIO_GPIO3DIR;
br... | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* ADDIP Section 4.1 ASCONF Chunk Procedures A4) Start a T-4 RTO timer, using the RTO value of the selected destination address (we use active path instead of primary path just because primary path may be inactive. */ | static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, struct sctp_chunk *chunk) | /* ADDIP Section 4.1 ASCONF Chunk Procedures A4) Start a T-4 RTO timer, using the RTO value of the selected destination address (we use active path instead of primary path just because primary path may be inactive. */
static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds, struct sctp_association *asoc, struct sctp_chunk ... | {
struct sctp_transport *t;
t = sctp_assoc_choose_alter_transport(asoc, chunk->transport);
asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = t->rto;
chunk->transport = t;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Waits until the RTC Time and Date registers are synchronized with RTC APB clock. */ | uint8_t RTC_WaitForSynchro(void) | /* Waits until the RTC Time and Date registers are synchronized with RTC APB clock. */
uint8_t RTC_WaitForSynchro(void) | {
__IO uint32_t timeout = 0;
RTC_DisableWriteProtection();
RTC->STS &= (uint32_t)0xFFFFFF5F;
while ((RTC->STS_B.RSFLG != BIT_SET) && (timeout != RTC_TIMEOUT_SYNCHRO))
{
timeout++;
}
if (RTC->STS_B.RSFLG != BIT_RESET)
{
RTC_EnableWriteProtection();
return SUCCESS;
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2)
This function is always used in thread mode. */ | unsigned long I2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | /* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2)
This function is always used in thread mode. */
unsigned long I2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE));
I2CMasterWriteRequestS2(ulBase, ucData, xfalse);
do
{
ulStatus = I2CStatusGet(ulBase);
if(xHWREG(ulBase + I2C_SR1) & 0x0F00)
break;
}
while(!(ulStatus == I2C_EVENT_MASTER_BYTE_TRANS... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Wrap Write register component function to Bus IO function. */ | static int32_t WriteRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length) | /* Wrap Write register component function to Bus IO function. */
static int32_t WriteRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length) | {
LSM6DSO_Object_t *pObj = (LSM6DSO_Object_t *)Handle;
return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This file is part of mbed TLS ( */ | static void print_hex(const char *title, const unsigned char buf[], size_t len) | /* This file is part of mbed TLS ( */
static void print_hex(const char *title, const unsigned char buf[], size_t len) | {
printf("%s: ", title);
for (size_t i = 0; i < len; i++)
printf("%02x", buf[i]);
printf("\r\n");
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.