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
/* USBD_DFU_GetUsrStringDesc Manages the transfer of memory interfaces string descriptors. */
uint8_t USBD_DFU_RegisterMedia(USBD_HandleTypeDef *pdev, USBD_DFU_MediaTypeDef *fops)
/* USBD_DFU_GetUsrStringDesc Manages the transfer of memory interfaces string descriptors. */ uint8_t USBD_DFU_RegisterMedia(USBD_HandleTypeDef *pdev, USBD_DFU_MediaTypeDef *fops)
{ if (fops == NULL) { return (uint8_t)USBD_FAIL; } pdev->pUserData = fops; return (uint8_t)USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Mark a cpu as no longer interested in a lock. Restores previous lock of interest (NULL for none). */
static void unspinning_lock(struct xen_spinlock *xl, struct xen_spinlock *prev)
/* Mark a cpu as no longer interested in a lock. Restores previous lock of interest (NULL for none). */ static void unspinning_lock(struct xen_spinlock *xl, struct xen_spinlock *prev)
{ asm(LOCK_PREFIX " decw %0" : "+m" (xl->spinners) : : "memory"); wmb(); __get_cpu_var(lock_spinners) = prev; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* returns negative if input image format does not match with any of supported image types */
static int dumpimage_extract_subimage(struct image_type_params *tparams, void *ptr, struct stat *sbuf)
/* returns negative if input image format does not match with any of supported image types */ static int dumpimage_extract_subimage(struct image_type_params *tparams, void *ptr, struct stat *sbuf)
{ int retval = -1; if (tparams->verify_header) { retval = tparams->verify_header((unsigned char *)ptr, sbuf->st_size, &params); if (retval != 0) return -1; if (tparams->extract_subimage) { retval = tparams->extract_subimage(ptr, &params); } else { fprintf(stderr, "%s: extract_subimage undefined for %s\n", params.cmdname, tparams->name); return -2; } } return retval; }
4ms/stm32mp1-baremetal
C++
Other
137
/* 6M band edge can be optionally overwritten for certain RF's Vendor driver says: for FCC regulation, enabled per HWFeature 6M band edge bit (for AL2230, AL2230S) */
static int patch_6m_band_edge(struct zd_chip *chip, u8 channel)
/* 6M band edge can be optionally overwritten for certain RF's Vendor driver says: for FCC regulation, enabled per HWFeature 6M band edge bit (for AL2230, AL2230S) */ static int patch_6m_band_edge(struct zd_chip *chip, u8 channel)
{ ZD_ASSERT(mutex_is_locked(&chip->mutex)); if (!chip->patch_6m_band_edge) return 0; return zd_rf_patch_6m_band_edge(&chip->rf, channel); }
robutest/uclinux
C++
GPL-2.0
60
/* This function does an erase of all user flash area. */
uint32_t FLASH_If_Erase(uint32_t StartSector)
/* This function does an erase of all user flash area. */ uint32_t FLASH_If_Erase(uint32_t StartSector)
{ uint32_t UserStartSector; uint32_t SectorError; FLASH_EraseInitTypeDef pEraseInit; FLASH_If_Init(); UserStartSector = GetSector(APPLICATION_ADDRESS); pEraseInit.TypeErase = TYPEERASE_SECTORS; pEraseInit.Sector = UserStartSector; pEraseInit.NbSectors = 10; pEraseInit.VoltageRange = VOLTAGE_RANGE_3; if (HAL_FLASHEx_Erase(&pEraseInit, &SectorError) != HAL_OK) { return (1); } return (0); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Sets the cursor to the specified X/Y position. */
void ssd1351SetCursor(uint8_t x, uint8_t y)
/* Sets the cursor to the specified X/Y position. */ void ssd1351SetCursor(uint8_t x, uint8_t y)
{ if ((x >= ssd1351Properties.width) || (y >= ssd1351Properties.height)) return; CMD(SSD1351_CMD_SETCOLUMNADDRESS); DATA(x); DATA(ssd1351Properties.width-1); CMD(SSD1351_CMD_SETROWADDRESS); DATA(y); DATA(ssd1351Properties.height-1); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Change Logs: Date Author Notes Bernard add file header export bsd socket symbol for RT-Thread Application Module Bernard add lock for init_done callback. Initialize the network interface device */
static err_t netif_device_init(struct netif *netif)
/* Change Logs: Date Author Notes Bernard add file header export bsd socket symbol for RT-Thread Application Module Bernard add lock for init_done callback. Initialize the network interface device */ static err_t netif_device_init(struct netif *netif)
{ struct eth_device *ethif; ethif = (struct eth_device *)netif->state; if (ethif != RT_NULL) { rt_device_t device; device = (rt_device_t) ethif; if (rt_device_init(device) != RT_EOK) { return ERR_IF; } netif->flags = ethif->flags; return ERR_OK; } return ERR_IF; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Change Logs: Date Author Notes flyingcys first version flyingcys add wifi driver */
int main(void)
/* Change Logs: Date Author Notes flyingcys first version flyingcys add wifi driver */ int main(void)
{ rt_kprintf("Hello, RISC-V!\n"); rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION); rt_wlan_set_mode(RT_WLAN_DEVICE_AP_NAME, RT_WLAN_AP); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). */
UINTN EFIAPI AsciiStrHexToUintn(IN CONST CHAR8 *String)
/* If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). */ UINTN EFIAPI AsciiStrHexToUintn(IN CONST CHAR8 *String)
{ UINTN Result; if (RETURN_ERROR (AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result))) { return MAX_UINTN; } return Result; }
tianocore/edk2
C++
Other
4,240
/* @cmd: command to be used as cancelling command @type: HCAM type @cmd_done: op done function for the cancelling command */
static void pmcraid_cancel_hcam(struct pmcraid_cmd *cmd, u8 type, void(*cmd_done)(struct pmcraid_cmd *))
/* @cmd: command to be used as cancelling command @type: HCAM type @cmd_done: op done function for the cancelling command */ static void pmcraid_cancel_hcam(struct pmcraid_cmd *cmd, u8 type, void(*cmd_done)(struct pmcraid_cmd *))
{ struct pmcraid_instance *pinstance; struct pmcraid_hostrcb *hcam; pinstance = cmd->drv_inst; hcam = (type == PMCRAID_HCAM_CODE_LOG_DATA) ? &pinstance->ldn : &pinstance->ccn; if (hcam->cmd == NULL) return; pmcraid_prepare_cancel_cmd(cmd, hcam->cmd); pmcraid_send_cmd(cmd, cmd_done, PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler); }
robutest/uclinux
C++
GPL-2.0
60
/* RTC set Prescaler value. The clock needs to be stopped for this to have any effect. */
void rtc_set_prescaler(uint32_t rtc, uint16_t presc)
/* RTC set Prescaler value. The clock needs to be stopped for this to have any effect. */ void rtc_set_prescaler(uint32_t rtc, uint16_t presc)
{ RTC_PRESCALER(rtc) = presc & 0xfff; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Internal function to retrieve the architecture specific spin lock alignment requirements for optimal spin lock performance. */
UINTN InternalGetSpinLockProperties(VOID)
/* Internal function to retrieve the architecture specific spin lock alignment requirements for optimal spin lock performance. */ UINTN InternalGetSpinLockProperties(VOID)
{ UINT32 RegEax; UINT32 RegEbx; UINTN FamilyId; UINTN ModelId; UINTN CacheLineSize; AsmCpuid (0x01, &RegEax, &RegEbx, NULL, NULL); CacheLineSize = ((RegEbx >> 8) & 0xff) * 8; FamilyId = (RegEax >> 8) & 0xf; ModelId = (RegEax >> 4) & 0xf; if (FamilyId == 0x0f) { ModelId = ModelId | ((RegEax >> 12) & 0xf0); if ((ModelId <= 0x04) || (ModelId == 0x06)) { CacheLineSize *= 2; } } if (CacheLineSize < 32) { CacheLineSize = 32; } return CacheLineSize; }
tianocore/edk2
C++
Other
4,240
/* Get the oscillator frequency, from the corresponding hardware configuration field. Note that T30 supports 3 new higher freqs, but we map back to the old T20 freqs. Support for the higher oscillators is TBD. */
enum clock_osc_freq clock_get_osc_freq(void)
/* Get the oscillator frequency, from the corresponding hardware configuration field. Note that T30 supports 3 new higher freqs, but we map back to the old T20 freqs. Support for the higher oscillators is TBD. */ enum clock_osc_freq clock_get_osc_freq(void)
{ struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; u32 reg; reg = readl(&clkrst->crc_osc_ctrl); reg = (reg & OSC_FREQ_MASK) >> OSC_FREQ_SHIFT; if (reg & 1) printf("Warning: OSC_FREQ is unsupported! (%d)\n", reg); return reg >> 2; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enable I2C high driver of the specified I2C port. The */
void I2CHighDriverEnable(unsigned long ulBase)
/* Enable I2C high driver of the specified I2C port. The */ void I2CHighDriverEnable(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_CON2) |= I2C_CON2_HDRS; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* param config Pointer to configuration structure. See to "dcdc_detection_config_t" */
void DCDC_GetDefaultDetectionConfig(dcdc_detection_config_t *config)
/* param config Pointer to configuration structure. See to "dcdc_detection_config_t" */ void DCDC_GetDefaultDetectionConfig(dcdc_detection_config_t *config)
{ assert(NULL != config); memset(config, 0, sizeof(*config)); config->enableXtalokDetection = false; config->powerDownOverVoltageDetection = true; config->powerDownLowVlotageDetection = false; config->powerDownOverCurrentDetection = true; config->powerDownPeakCurrentDetection = true; config->powerDownZeroCrossDetection = true; config->OverCurrentThreshold = kDCDC_OverCurrentThresholdAlt0; config->PeakCurrentThreshold = kDCDC_PeakCurrentThresholdAlt0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* gpio_request_one - request a single GPIO with initial configuration @gpio: the GPIO number @flags: GPIO configuration as specified by GPIOF_* @label: a literal description string of this GPIO */
int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
/* gpio_request_one - request a single GPIO with initial configuration @gpio: the GPIO number @flags: GPIO configuration as specified by GPIOF_* @label: a literal description string of this GPIO */ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
{ int err; err = gpio_request(gpio, label); if (err) return err; if (flags & GPIOF_DIR_IN) err = gpio_direction_input(gpio); else err = gpio_direction_output(gpio, (flags & GPIOF_INIT_HIGH) ? 1 : 0); if (err) gpio_free(gpio); return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* REVISIT This supports CPU and DMA access to/from SRAM, but it doesn't (yet?) support some other notable uses of SRAM: as TCM for data and/or instructions; and holding code needed to enter and exit suspend states (while DRAM can't be used). */
static int __init sram_init(void)
/* REVISIT This supports CPU and DMA access to/from SRAM, but it doesn't (yet?) support some other notable uses of SRAM: as TCM for data and/or instructions; and holding code needed to enter and exit suspend states (while DRAM can't be used). */ static int __init sram_init(void)
{ unsigned len = davinci_soc_info.sram_len; int status = 0; if (len) { len = min_t(unsigned, len, SRAM_SIZE); sram_pool = gen_pool_create(ilog2(SRAM_GRANULARITY), -1); if (!sram_pool) status = -ENOMEM; } if (sram_pool) status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1); WARN_ON(status < 0); return status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static void sedlbauer_detach(struct pcmcia_device *p_dev)
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ static void sedlbauer_detach(struct pcmcia_device *p_dev)
{ dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); ((local_info_t *)link->priv)->stop = 1; sedlbauer_release(link); kfree(link->priv); }
robutest/uclinux
C++
GPL-2.0
60
/* Get timer capture value. This function is used to get capture time value. */
unsigned long TimerCapValueGet(unsigned long ulBase, unsigned long ulChs)
/* Get timer capture value. This function is used to get capture time value. */ unsigned long TimerCapValueGet(unsigned long ulBase, unsigned long ulChs)
{ xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) ); xASSERT( (ulChs & ~( TIMER_CAP_CH_0 | TIMER_CAP_CH_1 )) == 0 ); switch(ulChs) { case TIMER_CAP_CH_0: { return xHWREG(ulBase + TIMER_CR0); } case TIMER_CAP_CH_1: { return xHWREG(ulBase + TIMER_CR1); } default: { while(1); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set the LSM security ID in a set of credentials so that the subjective security is overridden when an alternative set of credentials is used. The security ID is specified in string form as a security context to be interpreted by the LSM. */
int set_security_override_from_ctx(struct cred *new, const char *secctx)
/* Set the LSM security ID in a set of credentials so that the subjective security is overridden when an alternative set of credentials is used. The security ID is specified in string form as a security context to be interpreted by the LSM. */ int set_security_override_from_ctx(struct cred *new, const char *secctx)
{ u32 secid; int ret; ret = security_secctx_to_secid(secctx, strlen(secctx), &secid); if (ret < 0) return ret; return set_security_override(new, secid); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called by both boot and secondaries to move global data into per-processor storage. */
static void __init smp_store_cpu_info(int cpuid)
/* Called by both boot and secondaries to move global data into per-processor storage. */ static void __init smp_store_cpu_info(int cpuid)
{ cpu_data[cpuid].loops_per_jiffy = loops_per_jiffy; cpu_data[cpuid].last_asn = ASN_FIRST_VERSION; cpu_data[cpuid].need_new_asn = 0; cpu_data[cpuid].asn_lock = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine prepares the mailbox command for unregistering a virtual N_Port. */
void lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb)
/* This routine prepares the mailbox command for unregistering a virtual N_Port. */ void lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb)
{ MAILBOX_t *mb = &pmb->u.mb; memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); if (phba->sli_rev < LPFC_SLI_REV4) mb->un.varUnregVpi.vpi = vpi + phba->vpi_base; else mb->un.varUnregVpi.sli4_vpi = vpi + phba->vpi_base; mb->mbxCommand = MBX_UNREG_VPI; mb->mbxOwner = OWN_HOST; return; }
robutest/uclinux
C++
GPL-2.0
60
/* Switch a file from ASCII to UNICODE or vise-versa. */
EFI_STATUS MainCommandSwitchFileType(VOID)
/* Switch a file from ASCII to UNICODE or vise-versa. */ EFI_STATUS MainCommandSwitchFileType(VOID)
{ if (MainEditor.FileBuffer->ReadOnly) { StatusBarSetStatusString (L"Read Only File Can Not Be Modified"); return EFI_SUCCESS; } if (MainEditor.FileBuffer->FileType == FileTypeUnicode) { MainEditor.FileBuffer->FileType = FileTypeAscii; } else { MainEditor.FileBuffer->FileType = FileTypeUnicode; } MainEditor.FileBuffer->FileModified = TRUE; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* param handle The RTOS LPSPI handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the LPSPI instance to initialize. param masterConfig Configuration structure to set-up LPSPI in master mode. param srcClock_Hz Frequency of input clock of the LPSPI module. return status of the operation. */
status_t LPSPI_RTOS_Init(lpspi_rtos_handle_t *handle, LPSPI_Type *base, const lpspi_master_config_t *masterConfig, uint32_t srcClock_Hz)
/* param handle The RTOS LPSPI handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the LPSPI instance to initialize. param masterConfig Configuration structure to set-up LPSPI in master mode. param srcClock_Hz Frequency of input clock of the LPSPI module. return status of the operation. */ status_t LPSPI_RTOS_Init(lpspi_rtos_handle_t *handle, LPSPI_Type *base, const lpspi_master_config_t *masterConfig, uint32_t srcClock_Hz)
{ if (handle == NULL) { return kStatus_InvalidArgument; } if (base == NULL) { return kStatus_InvalidArgument; } (void)memset(handle, 0, sizeof(lpspi_rtos_handle_t)); handle->mutex = xSemaphoreCreateMutex(); if (handle->mutex == NULL) { return kStatus_Fail; } handle->event = xSemaphoreCreateBinary(); if (handle->event == NULL) { vSemaphoreDelete(handle->mutex); return kStatus_Fail; } handle->base = base; (void)LPSPI_MasterInit(handle->base, masterConfig, srcClock_Hz); LPSPI_MasterTransferCreateHandle(handle->base, &handle->drv_handle, LPSPI_RTOS_Callback, (void *)handle); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes the 64-bit value specified by Value to the MSR specified by Index. The 64-bit value written to the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
/* Writes the 64-bit value specified by Value to the MSR specified by Index. The 64-bit value written to the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
{ BOOLEAN Flag; Flag = FilterBeforeMsrWrite (Index, &Value); if (Flag) { __asm__ __volatile__ ( "wrmsr" : : "c" (Index), "A" (Value) ); } FilterAfterMsrWrite (Index, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* Sometimes while docking, false dock events can be sent to the driver because good connections aren't made or some other reason. Ignore these if we are in the middle of doing something. */
static int dock_in_progress(struct dock_station *ds)
/* Sometimes while docking, false dock events can be sent to the driver because good connections aren't made or some other reason. Ignore these if we are in the middle of doing something. */ static int dock_in_progress(struct dock_station *ds)
{ if ((ds->flags & DOCK_DOCKING) || time_before(jiffies, (ds->last_dock_time + HZ))) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the Gather list for a list of capsule images. */
VOID CleanGatherList(IN EFI_CAPSULE_BLOCK_DESCRIPTOR *BlockDescriptors, IN UINTN CapsuleNum)
/* Clear the Gather list for a list of capsule images. */ VOID CleanGatherList(IN EFI_CAPSULE_BLOCK_DESCRIPTOR *BlockDescriptors, IN UINTN CapsuleNum)
{ EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr; EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr1; EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockPtr2; UINTN Index; if (BlockDescriptors != NULL) { TempBlockPtr1 = BlockDescriptors; while (1) { TempBlockPtr = TempBlockPtr1; for (Index = 0; Index < CapsuleNum; Index++) { if (TempBlockPtr[Index].Length == 0) { break; } } if (TempBlockPtr[Index].Union.ContinuationPointer == (UINTN)NULL) { break; } TempBlockPtr2 = (VOID *)((UINTN)TempBlockPtr[Index].Union.ContinuationPointer); FreePool (TempBlockPtr1); TempBlockPtr1 = TempBlockPtr2; } } }
tianocore/edk2
C++
Other
4,240
/* This function is called after return from SMI handlers. */
VOID SmmCpuUpdate(VOID)
/* This function is called after return from SMI handlers. */ VOID SmmCpuUpdate(VOID)
{ UINTN Index; for (Index = 0; Index < mMaxNumberOfCpus; Index++) { if (gSmmCpuPrivate->Operation[Index] == SmmCpuSwitchBsp) { gSmmCpuPrivate->Operation[Index] = SmmCpuNone; mSmmMpSyncData->SwitchBsp = TRUE; mSmmMpSyncData->CandidateBsp[Index] = TRUE; } } for (Index = 0; Index < mMaxNumberOfCpus; Index++) { if (gSmmCpuPrivate->Operation[Index] == SmmCpuAdd) { gSmmCpuPrivate->Operation[Index] = SmmCpuNone; mNumberOfCpus++; } } for (Index = 0; Index < mMaxNumberOfCpus; Index++) { if (gSmmCpuPrivate->Operation[Index] == SmmCpuRemove) { gSmmCpuPrivate->Operation[Index] = SmmCpuNone; mNumberOfCpus--; } } }
tianocore/edk2
C++
Other
4,240
/* @node: &struct plist_node pointer @head: &struct plist_head pointer */
void plist_add(struct plist_node *node, struct plist_head *head)
/* @node: &struct plist_node pointer @head: &struct plist_head pointer */ void plist_add(struct plist_node *node, struct plist_head *head)
{ struct plist_node *iter; plist_check_head(head); WARN_ON(!plist_node_empty(node)); list_for_each_entry(iter, &head->prio_list, plist.prio_list) { if (node->prio < iter->prio) goto lt_prio; else if (node->prio == iter->prio) { iter = list_entry(iter->plist.prio_list.next, struct plist_node, plist.prio_list); goto eq_prio; } } lt_prio: list_add_tail(&node->plist.prio_list, &iter->plist.prio_list); eq_prio: list_add_tail(&node->plist.node_list, &iter->plist.node_list); plist_check_head(head); }
robutest/uclinux
C++
GPL-2.0
60
/* param base UART peripheral base address. param handle Pointer to the uart_edma_handle_t structure. */
void UART_TransferAbortReceiveEDMA(UART_Type *base, uart_edma_handle_t *handle)
/* param base UART peripheral base address. param handle Pointer to the uart_edma_handle_t structure. */ void UART_TransferAbortReceiveEDMA(UART_Type *base, uart_edma_handle_t *handle)
{ assert(handle); assert(handle->rxEdmaHandle); UART_EnableRxDMA(base, false); EDMA_AbortTransfer(handle->rxEdmaHandle); handle->rxState = kUART_RxIdle; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Set the contents of a pointer #GValue to @v_pointer. */
void g_value_set_pointer(GValue *value, gpointer v_pointer)
/* Set the contents of a pointer #GValue to @v_pointer. */ void g_value_set_pointer(GValue *value, gpointer v_pointer)
{ g_return_if_fail (G_VALUE_HOLDS_POINTER (value)); value->data[0].v_pointer = v_pointer; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Write the global header to wireshark. This is only done once at the beginning of the capture. */
static void write_global_hdr()
/* Write the global header to wireshark. This is only done once at the beginning of the capture. */ static void write_global_hdr()
{ uint32_t magic_number = 0xa1b2c3d4; uint16_t version_major = 2; uint16_t version_minor = 4; int32_t thiszone = 0; uint32_t sigfigs = 0; uint32_t snaplen = 65535; uint32_t network = 195; data_write(&magic_number, sizeof(magic_number)); data_write(&version_major, sizeof(version_major)); data_write(&version_minor, sizeof(version_minor)); data_write(&thiszone, sizeof(thiszone)); data_write(&sigfigs, sizeof(sigfigs)); data_write(&snaplen, sizeof(snaplen)); data_write(&network, sizeof(network)); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Color conversion for grayscale: just copy the data. This also works for YCC -> grayscale conversion, in which we just copy the Y (luminance) component and ignore chrominance. */
grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
/* Color conversion for grayscale: just copy the data. This also works for YCC -> grayscale conversion, in which we just copy the Y (luminance) component and ignore chrominance. */ grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{ jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, num_rows, cinfo->output_width); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Returns: (nullable) (array zero-terminated=1) (transfer full): a null-terminated array of strings of all of the possible attribute types for the given @name_space, or NULL on error. */
char** g_file_info_list_attributes(GFileInfo *info, const char *name_space)
/* Returns: (nullable) (array zero-terminated=1) (transfer full): a null-terminated array of strings of all of the possible attribute types for the given @name_space, or NULL on error. */ char** g_file_info_list_attributes(GFileInfo *info, const char *name_space)
{ GPtrArray *names; GFileAttribute *attrs; guint32 attribute; guint32 ns_id = (name_space) ? lookup_namespace (name_space) : 0; int i; g_return_val_if_fail (G_IS_FILE_INFO (info), NULL); names = g_ptr_array_new (); attrs = (GFileAttribute *)info->attributes->data; for (i = 0; i < info->attributes->len; i++) { attribute = attrs[i].attribute; if (ns_id == 0 || GET_NS (attribute) == ns_id) g_ptr_array_add (names, g_strdup (get_attribute_for_id (attribute))); } g_ptr_array_add (names, NULL); return (char **)g_ptr_array_free (names, FALSE); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configures one or more pin(s) of a PIO controller as outputs, with the given default value. Optionally, the multi-drive feature can be enabled on the pin(s). */
static void PIO_SetOutput(AT91S_PIO *pio, unsigned int mask, unsigned char defaultValue, unsigned char enableMultiDrive, unsigned char enablePullUp)
/* Configures one or more pin(s) of a PIO controller as outputs, with the given default value. Optionally, the multi-drive feature can be enabled on the pin(s). */ static void PIO_SetOutput(AT91S_PIO *pio, unsigned int mask, unsigned char defaultValue, unsigned char enableMultiDrive, unsigned char enablePullUp)
{ WRITE(pio, PIO_IDR, mask); if (enablePullUp) { WRITE(pio, PIO_PPUER, mask); } else { WRITE(pio, PIO_PPUDR, mask); } if (enableMultiDrive) { WRITE(pio, PIO_MDER, mask); } else { WRITE(pio, PIO_MDDR, mask); } if (defaultValue) { WRITE(pio, PIO_SODR, mask); } else { WRITE(pio, PIO_CODR, mask); } WRITE(pio, PIO_OER, mask); WRITE(pio, PIO_PER, mask); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* PCM section pointer callback simplly reads XXX_DMA_DT_CUR register as the current position. when SG-buffer is implemented, the offset must be calculated correctly... */
static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream)
/* PCM section pointer callback simplly reads XXX_DMA_DT_CUR register as the current position. when SG-buffer is implemented, the offset must be calculated correctly... */ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream)
{ struct atiixp_modem *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct atiixp_dma *dma = runtime->private_data; unsigned int curptr; int timeout = 1000; while (timeout--) { curptr = readl(chip->remap_addr + dma->ops->dt_cur); if (curptr < dma->buf_addr) continue; curptr -= dma->buf_addr; if (curptr >= dma->buf_bytes) continue; return bytes_to_frames(runtime, curptr); } snd_printd("atiixp-modem: invalid DMA pointer read 0x%x (buf=%x)\n", readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Register Nat Consumption Fault @ Nat Consumption Vector Refer to SDM Vol2 Table 5-6 & 8-1 */
void rnat_consumption(struct kvm_vcpu *vcpu)
/* Register Nat Consumption Fault @ Nat Consumption Vector Refer to SDM Vol2 Table 5-6 & 8-1 */ void rnat_consumption(struct kvm_vcpu *vcpu)
{ _nat_consumption_fault(vcpu, 0, REGISTER); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If List is NULL, then ASSERT(). If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
LIST_ENTRY* EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
/* If List is NULL, then ASSERT(). If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */ LIST_ENTRY* EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
{ ASSERT_VERIFY_NODE_IN_VALID_LIST (List, Node, TRUE); return Node->ForwardLink; }
tianocore/edk2
C++
Other
4,240
/* Created on: 10 feb. 2019 Author: Daniel Mårtensson Solve A=QR where A is a matrix of size row x column and Q is size of row x row and R is size of row x column */
void qr(double *A, double *Q, double *R, int row, int column)
/* Created on: 10 feb. 2019 Author: Daniel Mårtensson Solve A=QR where A is a matrix of size row x column and Q is size of row x row and R is size of row x column */ void qr(double *A, double *Q, double *R, int row, int column)
{ memset(v, 0, row*sizeof(double)); v[i] = 1; for(int j = i+1; j < row; j++) *(v+j) = *(A_ + j*(column) + i); mul(v, v, false, C, row, 1, row); scale(C, TAU[i], row, row); sub(I, C, C, row, row, row); mul(Q, C, false, E, row, row, row); memcpy(Q, E, row*row*sizeof(double)); } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* param base SAI base pointer param order Data order MSB or LSB */
void SAI_RxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
/* param base SAI base pointer param order Data order MSB or LSB */ void SAI_RxSetFrameSyncPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
{ uint32_t val = (base->RCR4) & (~I2S_RCR4_FSP_MASK); val |= I2S_RCR4_FSP(polarity); base->RCR4 = val; }
eclipse-threadx/getting-started
C++
Other
310
/* A single target host/port that a network service is running on. */
G_DEFINE_BOXED_TYPE(GSrvTarget, g_srv_target, g_srv_target_copy, g_srv_target_free)
/* A single target host/port that a network service is running on. */ G_DEFINE_BOXED_TYPE(GSrvTarget, g_srv_target, g_srv_target_copy, g_srv_target_free)
{ GSrvTarget *target = g_slice_new0 (GSrvTarget); target->hostname = g_strdup (hostname); target->port = port; target->priority = priority; target->weight = weight; return target; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Calculates new state of logical switches for mixerCurrentFlightMode. */
void evalLogicalSwitches(bool isCurrentFlightmode)
/* Calculates new state of logical switches for mixerCurrentFlightMode. */ void evalLogicalSwitches(bool isCurrentFlightmode)
{ for (unsigned int idx=0; idx<MAX_LOGICAL_SWITCHES; idx++) { LogicalSwitchContext & context = lswFm[mixerCurrentFlightMode].lsw[idx]; bool result = getLogicalSwitch(idx); if (isCurrentFlightmode) { if (result) { if (!context.state) PLAY_LOGICAL_SWITCH_ON(idx); } else { if (context.state) PLAY_LOGICAL_SWITCH_OFF(idx); } } context.state = result; } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Indicates that a communication error has occurred with the attached Mass Storage Device, printing error codes to the serial port and waiting until the device is removed before continuing. */
void ShowDiskReadError(const char *CommandString, const uint8_t ErrorCode)
/* Indicates that a communication error has occurred with the attached Mass Storage Device, printing error codes to the serial port and waiting until the device is removed before continuing. */ void ShowDiskReadError(const char *CommandString, const uint8_t ErrorCode)
{ if (ErrorCode == MASS_STORE_SCSI_COMMAND_FAILED) { printf_P(PSTR(ESC_FG_RED "SCSI command error (%S).\r\n"), CommandString); } else { printf_P(PSTR(ESC_FG_RED "Command error (%S).\r\n"), CommandString); printf_P(PSTR(" -- Error Code: %d" ESC_FG_WHITE), ErrorCode); } Pipe_Freeze(); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Following read/write/reset functions are registered with legacy MII code. These are called for PHY operations by upper layers and we further call the DM MDIO driver functions. */
static int mdio_read(struct mii_dev *mii_bus, int addr, int devad, int reg)
/* Following read/write/reset functions are registered with legacy MII code. These are called for PHY operations by upper layers and we further call the DM MDIO driver functions. */ static int mdio_read(struct mii_dev *mii_bus, int addr, int devad, int reg)
{ struct udevice *dev = mii_bus->priv; return mdio_get_ops(dev)->read(dev, addr, devad, reg); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Stop the interface. The interface is stopped when it is brought. */
static void dm9000_halt(struct eth_device *netdev)
/* Stop the interface. The interface is stopped when it is brought. */ static void dm9000_halt(struct eth_device *netdev)
{ DM9000_DBG("%s\n", __func__); dm9000_phy_write(0, 0x8000); DM9000_iow(DM9000_GPR, 0x01); DM9000_iow(DM9000_IMR, 0x80); DM9000_iow(DM9000_RCR, 0x00); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function sets the platform specific data pointer. */
VOID EFIAPI SetFspPlatformDataPointer(IN VOID *PlatformData)
/* This function sets the platform specific data pointer. */ VOID EFIAPI SetFspPlatformDataPointer(IN VOID *PlatformData)
{ FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); FspData->PlatformData.DataPtr = PlatformData; }
tianocore/edk2
C++
Other
4,240
/* Query number of entries in the interrupt queue. */
s16 Si114xIrqQueueNumentries(HANDLE si114x_handle)
/* Query number of entries in the interrupt queue. */ s16 Si114xIrqQueueNumentries(HANDLE si114x_handle)
{ (void) si114x_handle; u16 runnerIndex = irqQueueGetIndex; s16 count=0; while (runnerIndex != irqQueuePutIndex) { runnerIndex++; count++; if(runnerIndex == IRQ_QUEUE_SIZE) runnerIndex = 0; } return (count/sizeof(SI114X_IRQ_SAMPLE)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), distances + offset, maxLen) - (distances)); MOVE_POS_RET } */
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
/* offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), distances + offset, maxLen) - (distances)); MOVE_POS_RET } */ UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
{ unsigned offset; GET_MATCHES_HEADER (3) HASH_ZIP_CALC; curMatch = p->hash[hv]; p->hash[hv] = p->pos; offset = (unsigned)(Hc_GetMatchesSpec ( lenLimit, curMatch, MF_PARAMS (p), distances, 2 ) - (distances)); MOVE_POS_RET }
tianocore/edk2
C++
Other
4,240
/* Returns zero on success; a negative errno value is returned if any error occurs. */
static int __svc_rpcb_register4(const u32 program, const u32 version, const unsigned short protocol, const unsigned short port)
/* Returns zero on success; a negative errno value is returned if any error occurs. */ static int __svc_rpcb_register4(const u32 program, const u32 version, const unsigned short protocol, const unsigned short port)
{ const struct sockaddr_in sin = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_ANY), .sin_port = htons(port), }; const char *netid; int error; switch (protocol) { case IPPROTO_UDP: netid = RPCBIND_NETID_UDP; break; case IPPROTO_TCP: netid = RPCBIND_NETID_TCP; break; default: return -ENOPROTOOPT; } error = rpcb_v4_register(program, version, (const struct sockaddr *)&sin, netid); if (error == -EPROTONOSUPPORT) error = rpcb_register(program, version, protocol, port); return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable the PWM interrupt of the PWM module. The */
void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Disable the PWM interrupt of the PWM module. The */ void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); if (ulIntType == PWM_INT_PWM) { xHWREG(ulBase + PWM_PIER) &= ~(PWM_PIER_PWMIE0 << ulChannelTemp); } if(ulIntType & PWM_INT_DUTY) { xHWREG(ulBase + PWM_PIER) &= ~(PWM_PIER_PWMDIE0 << ulChannelTemp); } if(ulIntType & PWM_INT_CAP_BOTH) { xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp >> 1)*4) &= ~(ulIntType << ((ulChannel % 2) ? 16 : 0)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* match_int: - scan a decimal representation of an integer from a substring_t @s: substring_t to be scanned */
int match_int(substring_t *s, int *result)
/* match_int: - scan a decimal representation of an integer from a substring_t @s: substring_t to be scanned */ int match_int(substring_t *s, int *result)
{ return match_number(s, result, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the triggering mode and distribution mode for the specified common interrupt */
void z_arc_connect_idu_set_mode(uint32_t irq_num, uint16_t trigger_mode, uint16_t distri_mode)
/* Set the triggering mode and distribution mode for the specified common interrupt */ void z_arc_connect_idu_set_mode(uint32_t irq_num, uint16_t trigger_mode, uint16_t distri_mode)
{ K_SPINLOCK(&arc_connect_spinlock) { z_arc_connect_cmd_data(ARC_CONNECT_CMD_IDU_SET_MODE, irq_num, (distri_mode | (trigger_mode << 4))); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Once we get every callchains from the stream, we can now sort them by hit */
static void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node, u64 min_hit, struct callchain_param *param __used)
/* Once we get every callchains from the stream, we can now sort them by hit */ static void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node, u64 min_hit, struct callchain_param *param __used)
{ __sort_chain_flat(rb_root, node, min_hit); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Restore the background of the pointer with data saved in the current store area. */
void POINTER_Restore(u8 x, u8 y, u8 width, u8 height)
/* Restore the background of the pointer with data saved in the current store area. */ void POINTER_Restore(u8 x, u8 y, u8 width, u8 height)
{ int i; char* ptr = ptrAreaStore; int bytesize = ( width * height ) * 2; LCD_SetRect_For_Cmd( x, y, width, height ); LCD_SendLCDCmd( ST7637_RAMWR ); for( i = 0; i < bytesize; i++ ) { if ( Pointer_Mode == POINTER_RESTORE_LESS ) { LCD_SendLCDData( DRAW_GetBGndColor() ); } else { LCD_SendLCDData( *ptr++ ); } } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* pdc2027x_init - Called after this module is loaded into the kernel. */
static int __init pdc2027x_init(void)
/* pdc2027x_init - Called after this module is loaded into the kernel. */ static int __init pdc2027x_init(void)
{ return pci_register_driver(&pdc2027x_pci_driver); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disables interrupts for the specified PWM generator block. */
void PWMGenIntTrigDisable(unsigned long ulBase, unsigned long ulGen, unsigned long ulIntTrig)
/* Disables interrupts for the specified PWM generator block. */ void PWMGenIntTrigDisable(unsigned long ulBase, unsigned long ulGen, unsigned long ulIntTrig)
{ ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE)); ASSERT(PWMGenValid(ulGen)); ASSERT((ulIntTrig & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD | PWM_INT_CNT_AU | PWM_INT_CNT_AD | PWM_INT_CNT_BU | PWM_INT_CNT_BD | PWM_TR_CNT_ZERO | PWM_TR_CNT_LOAD | PWM_TR_CNT_AU | PWM_TR_CNT_AD | PWM_TR_CNT_BU | PWM_TR_CNT_BD)) == 0); HWREG(PWM_GEN_BADDR(ulBase, ulGen) + PWM_O_X_INTEN) &= ~(ulIntTrig); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note: The tv_nsec part is always in the range of 0 <= tv_nsec < NSEC_PER_SEC For negative values only the tv_sec field is negative ! */
void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec)
/* Note: The tv_nsec part is always in the range of 0 <= tv_nsec < NSEC_PER_SEC For negative values only the tv_sec field is negative ! */ void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec)
{ while (nsec >= NSEC_PER_SEC) { asm("" : "+rm"(nsec)); nsec -= NSEC_PER_SEC; ++sec; } while (nsec < 0) { asm("" : "+rm"(nsec)); nsec += NSEC_PER_SEC; --sec; } ts->tv_sec = sec; ts->tv_nsec = nsec; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Submit to an iodev a submission to work on. Should be called by the executor when it wishes to submit work to an iodev. */
static void rtio_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
/* Submit to an iodev a submission to work on. Should be called by the executor when it wishes to submit work to an iodev. */ static void rtio_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
{ if (FIELD_GET(RTIO_SQE_CANCELED, iodev_sqe->sqe.flags)) { rtio_iodev_sqe_err(iodev_sqe, -ECANCELED); return; } iodev_sqe->sqe.iodev->api->submit(iodev_sqe); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Print the information for /proc/toshiba Determine which port to use for the Fn key status */
static void tosh_set_fn_port(void)
/* Print the information for /proc/toshiba Determine which port to use for the Fn key status */ static void tosh_set_fn_port(void)
{ switch (tosh_id) { case 0xfc02: case 0xfc04: case 0xfc09: case 0xfc0a: case 0xfc10: case 0xfc11: case 0xfc13: case 0xfc15: case 0xfc1a: case 0xfc1b: case 0xfc5a: tosh_fn = 0x62; break; case 0xfc08: case 0xfc17: case 0xfc1d: case 0xfcd1: case 0xfce0: case 0xfce2: tosh_fn = 0x68; break; default: tosh_fn = 0x00; break; } return; }
robutest/uclinux
C++
GPL-2.0
60
/* This request allows the host to find out the currently configured line coding. */
static USBH_StatusTypeDef GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecoding)
/* This request allows the host to find out the currently configured line coding. */ static USBH_StatusTypeDef GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecoding)
{ phost->Control.setup.b.bmRequestType = USB_D2H | USB_REQ_TYPE_CLASS | \ USB_REQ_RECIPIENT_INTERFACE; phost->Control.setup.b.bRequest = CDC_GET_LINE_CODING; phost->Control.setup.b.wValue.w = 0; phost->Control.setup.b.wIndex.w = 0; phost->Control.setup.b.wLength.w = LINE_CODING_STRUCTURE_SIZE; return USBH_CtlReq(phost, linecoding->Array, LINE_CODING_STRUCTURE_SIZE); }
labapart/polymcu
C++
null
201
/* Configures one or more pin(s) of a PIO controller as being controlled by peripheral A. Optionally, the corresponding internal pull-up(s) can be enabled. */
static void PIO_SetPeripheralA(AT91S_PIO *pio, unsigned int mask, unsigned char enablePullUp)
/* Configures one or more pin(s) of a PIO controller as being controlled by peripheral A. Optionally, the corresponding internal pull-up(s) can be enabled. */ static void PIO_SetPeripheralA(AT91S_PIO *pio, unsigned int mask, unsigned char enablePullUp)
{ WRITE(pio, PIO_IDR, mask); if (enablePullUp) { WRITE(pio, PIO_PPUER, mask); } else { WRITE(pio, PIO_PPUDR, mask); } WRITE(pio, PIO_ASR, mask); WRITE(pio, PIO_PDR, mask); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
{ VOID *Memory; ASSERT (Buffer != NULL); ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN)Buffer + 1)); Memory = AllocatePool (AllocationSize); if (Memory != NULL) { Memory = CopyMem (Memory, Buffer, AllocationSize); } return Memory; }
tianocore/edk2
C++
Other
4,240
/* Similar to ARM's NVIC_ClearPendingIRQ clear a pending irq from SW */
void posix_sw_clear_pending_IRQ(unsigned int IRQn)
/* Similar to ARM's NVIC_ClearPendingIRQ clear a pending irq from SW */ void posix_sw_clear_pending_IRQ(unsigned int IRQn)
{ hw_irq_ctrl_clear_irq(CONFIG_NATIVE_SIMULATOR_MCU_N, IRQn); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Poll-in implementation for byte mode config, read byte from URBUF if available. */
static int uart_npcx_poll_in(const struct device *dev, unsigned char *c)
/* Poll-in implementation for byte mode config, read byte from URBUF if available. */ static int uart_npcx_poll_in(const struct device *dev, unsigned char *c)
{ const struct uart_npcx_config *const config = dev->config; struct uart_reg *const inst = config->inst; if (!IS_BIT_SET(inst->UICTRL, NPCX_UICTRL_RBF)) return -1; *c = inst->URBUF; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This routine is called by frontend after an ENOSP on write */
void tape_std_process_eov(struct tape_device *device)
/* This routine is called by frontend after an ENOSP on write */ void tape_std_process_eov(struct tape_device *device)
{ if (tape_mtop(device, MTBSR, 1) == 0 && tape_mtop(device, MTWEOF, 1) == 0) { tape_mtop(device, MTBSR, 1); } }
robutest/uclinux
C++
GPL-2.0
60
/* Take ownership of this Descriptor. The function is same for both the ring mode and the chain mode DMA structures. */
void synopGMAC_take_desc_ownership(DmaDesc *desc)
/* Take ownership of this Descriptor. The function is same for both the ring mode and the chain mode DMA structures. */ void synopGMAC_take_desc_ownership(DmaDesc *desc)
{ if (desc) { desc->status &= ~DescOwnByDma; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* either insert or lock state struct between start and end use mask to tell us if waiting is desired. */
int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int bits, struct extent_state **cached_state, gfp_t mask)
/* either insert or lock state struct between start and end use mask to tell us if waiting is desired. */ int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int bits, struct extent_state **cached_state, gfp_t mask)
{ int err; u64 failed_start; while (1) { err = set_extent_bit(tree, start, end, EXTENT_LOCKED | bits, EXTENT_LOCKED, &failed_start, cached_state, mask); if (err == -EEXIST && (mask & __GFP_WAIT)) { wait_extent_bit(tree, failed_start, end, EXTENT_LOCKED); start = failed_start; } else { break; } WARN_ON(start > end); } return err; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is invoked towards the end of the scheduler's initialization process. Before this is called, the idle task might contain RCU read-side critical sections (during which time, this idle task is booting the system). After this function is called, the idle tasks are prohibited from containing RCU read-side critical sections. */
void rcu_scheduler_starting(void)
/* This function is invoked towards the end of the scheduler's initialization process. Before this is called, the idle task might contain RCU read-side critical sections (during which time, this idle task is booting the system). After this function is called, the idle tasks are prohibited from containing RCU read-side critical sections. */ void rcu_scheduler_starting(void)
{ WARN_ON(num_online_cpus() != 1); WARN_ON(nr_context_switches() > 0); rcu_scheduler_active = 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* That skb would better have come from process_responses() where we abuse ->priority and ->csum to carry our data. NB: if we get to per-arch ->csum, the things might get really interesting here. */
static u32 get_hwtid(struct sk_buff *skb)
/* That skb would better have come from process_responses() where we abuse ->priority and ->csum to carry our data. NB: if we get to per-arch ->csum, the things might get really interesting here. */ static u32 get_hwtid(struct sk_buff *skb)
{ return ntohl((__force __be32)skb->priority) >> 8 & 0xfffff; }
robutest/uclinux
C++
GPL-2.0
60
/* xprt_put - release a reference to an RPC transport. @xprt: pointer to the transport */
void xprt_put(struct rpc_xprt *xprt)
/* xprt_put - release a reference to an RPC transport. @xprt: pointer to the transport */ void xprt_put(struct rpc_xprt *xprt)
{ kref_put(&xprt->kref, xprt_destroy); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable the specified ADC temperature sensor and Vrefint channel. */
void ADC_DisableTempSensorVrefint(ADC_T *adc)
/* Disable the specified ADC temperature sensor and Vrefint channel. */ void ADC_DisableTempSensorVrefint(ADC_T *adc)
{ adc->CTRL2_B.TSVREFEN = BIT_RESET; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Deinitializes the Alternate Functions (remap, event control and EXTI configuration) registers to their default reset values. */
void GPIO_AFIODeInit(void)
/* Deinitializes the Alternate Functions (remap, event control and EXTI configuration) registers to their default reset values. */ void GPIO_AFIODeInit(void)
{ RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Display command prompt for the user on the CLI at the beginning of the program. */
int32_t cli_cmd_prompt(struct cli_desc *dev, uint8_t *app_name)
/* Display command prompt for the user on the CLI at the beginning of the program. */ int32_t cli_cmd_prompt(struct cli_desc *dev, uint8_t *app_name)
{ int32_t ret; static uint8_t count = 0; ret = cli_write_string(dev, (uint8_t*)"\n"); if(count == 0) { cli_write_string(dev, (uint8_t*) "INFO: Program start. Version 1.0.1: Device is connected. 0x"); cli_write_string(dev, app_name); cli_write_string(dev, (uint8_t*)"\n"); count++; } if(ret == 0) uart_write(dev->uart_device, (uint8_t *)">", 1); uart_line_index = 0; return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Erases the flash memory. Note that this function also checks that no data is erased outside the flash memory region, so the bootloader can never be erased. */
blt_bool FlashErase(blt_addr addr, blt_int32u len)
/* Erases the flash memory. Note that this function also checks that no data is erased outside the flash memory region, so the bootloader can never be erased. */ blt_bool FlashErase(blt_addr addr, blt_int32u len)
{ blt_bool result = BLT_TRUE; blt_int8u first_sector_idx; blt_int8u last_sector_idx; if ((len - 1) > (FLASH_END_ADDRESS - addr)) { result = BLT_FALSE; } if (result == BLT_TRUE) { first_sector_idx = FlashGetSectorIdx(addr); last_sector_idx = FlashGetSectorIdx(addr+len-1); if ((first_sector_idx == FLASH_INVALID_SECTOR_IDX) || (last_sector_idx == FLASH_INVALID_SECTOR_IDX)) { result = BLT_FALSE; } } if (result == BLT_TRUE) { result = FlashEraseSectors(first_sector_idx, last_sector_idx); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* size_t hash_map_num_buckets(const hash_map_t *hash_map) { assert(hash_map != NULL); return hash_map->num_bucket; } */
bool hash_map_has_key(const hash_map_t *hash_map, const void *key)
/* size_t hash_map_num_buckets(const hash_map_t *hash_map) { assert(hash_map != NULL); return hash_map->num_bucket; } */ bool hash_map_has_key(const hash_map_t *hash_map, const void *key)
{ assert(hash_map != NULL); hash_index_t hash_key = hash_map->hash_fn(key) % hash_map->num_bucket; list_t *hash_bucket_list = hash_map->bucket[hash_key].list; hash_map_entry_t *hash_map_entry = find_bucket_entry_(hash_bucket_list, key); return (hash_map_entry != NULL); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Fills each SDADC_InitStruct member with its default value. */
void SDADC_StructInit(SDADC_InitTypeDef *SDADC_InitStruct)
/* Fills each SDADC_InitStruct member with its default value. */ void SDADC_StructInit(SDADC_InitTypeDef *SDADC_InitStruct)
{ SDADC_InitStruct->SDADC_Channel = SDADC_Channel_0; SDADC_InitStruct->SDADC_ContinuousConvMode = DISABLE; SDADC_InitStruct->SDADC_FastConversionMode = DISABLE; }
avem-labs/Avem
C++
MIT License
1,752
/* The constructor function installs variable arch protocol and variable write arch protocol to StandaloneMM runtime variable service */
EFI_STATUS EFIAPI VariableMmDependencyLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function installs variable arch protocol and variable write arch protocol to StandaloneMM runtime variable service */ EFI_STATUS EFIAPI VariableMmDependencyLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_HANDLE Handle; Handle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, &gEfiSmmVariableProtocolGuid, NULL, &gSmmVariableWriteGuid, NULL, NULL ); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* 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 Mtftp6ComponentNameGetDriverName(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 Mtftp6ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mMtftp6DriverNameTable, DriverName, (BOOLEAN)(This == &gMtftp6ComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* This function traces the APIC Proximity Domain field. */
STATIC VOID EFIAPI DumpSratApicProximity(IN CONST CHAR16 *Format, IN UINT8 *Ptr)
/* This function traces the APIC Proximity Domain field. */ STATIC VOID EFIAPI DumpSratApicProximity(IN CONST CHAR16 *Format, IN UINT8 *Ptr)
{ UINT32 ProximityDomain; ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); Print (Format, ProximityDomain); }
tianocore/edk2
C++
Other
4,240
/* Set the source repeat size of the specified dma channel. */
en_result_t Dma_EnableBcTcReload(en_dma_channel_t enCh)
/* Set the source repeat size of the specified dma channel. */ en_result_t Dma_EnableBcTcReload(en_dma_channel_t enCh)
{ ASSERT(IS_VALID_CH(enCh)); if((!IS_VALID_CH(enCh))) { return ErrorInvalidParameter; } if(enCh == DmaCh0) { M0P_DMAC ->CONFB0_f.RC = 1; } else{ M0P_DMAC ->CONFB1_f.RC = 1; } return Ok; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __parport_ip32_read_control - return cached contents of the DCR register */
static unsigned int __parport_ip32_read_control(struct parport *p)
/* __parport_ip32_read_control - return cached contents of the DCR register */ static unsigned int __parport_ip32_read_control(struct parport *p)
{ struct parport_ip32_private * const priv = p->physport->private_data; return priv->dcr_cache; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified SPI/I2S flag is set or not. */
uint8_t SPI_I2S_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag)
/* Checks whether the specified SPI/I2S flag is set or not. */ uint8_t SPI_I2S_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag)
{ if((spi->STS & flag) != RESET) { return SET; } else { return RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
{ return PciWrite8 ( Address, BitFieldOr8 (PciRead8 (Address), StartBit, EndBit, OrData) ); }
tianocore/edk2
C++
Other
4,240
/* Insert a new entry between two known consecutive entries. This is only for internal list manipulation where we know the prev&next entries already @New : New element to be added @Prev: previous element in the list @Next: Next element in the list */
void ListAdd(PRT_LIST_ENTRY New, PRT_LIST_ENTRY Prev, PRT_LIST_ENTRY Next)
/* Insert a new entry between two known consecutive entries. This is only for internal list manipulation where we know the prev&next entries already @New : New element to be added @Prev: previous element in the list @Next: Next element in the list */ void ListAdd(PRT_LIST_ENTRY New, PRT_LIST_ENTRY Prev, PRT_LIST_ENTRY Next)
{ Next->Prev = New; New->Next = Next; New->Prev = Prev; Prev->Next = New; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* The following attributes must be set in the template: */
int rtnl_neigh_add(struct nl_sock *sk, struct rtnl_neigh *tmpl, int flags)
/* The following attributes must be set in the template: */ int rtnl_neigh_add(struct nl_sock *sk, struct rtnl_neigh *tmpl, int flags)
{ int err; struct nl_msg *msg; if ((err = rtnl_neigh_build_add_request(tmpl, flags, &msg)) < 0) return err; err = nl_send_auto_complete(sk, msg); nlmsg_free(msg); if (err < 0) return err; return wait_for_ack(sk); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This service returns the currently active PCR banks. */
EFI_STATUS EFIAPI Tcg2GetActivePCRBanks(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *ActivePcrBanks)
/* This service returns the currently active PCR banks. */ EFI_STATUS EFIAPI Tcg2GetActivePCRBanks(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *ActivePcrBanks)
{ if (ActivePcrBanks == NULL) { return EFI_INVALID_PARAMETER; } *ActivePcrBanks = mTcgDxeData.BsCap.ActivePcrBanks; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Apply Broadcast Values. Apply the broadcast data configured in the other broadcast SET APIs: */
ADI_BLER_RESULT adi_radio_ApplyBroadcastValue(void)
/* Apply Broadcast Values. Apply the broadcast data configured in the other broadcast SET APIs: */ ADI_BLER_RESULT adi_radio_ApplyBroadcastValue(void)
{ ADI_BLER_RESULT bleResult; ADI_BLE_LOGEVENT(LOGID_CMD_BLEGAP_APPLY_BROADCAST_VALUE); ADI_BLE_RADIO_CMD_START(CMD_BLEGAP_APPLY_BROADCAST_VALUE); bleResult = bler_process_cmd(CMD_BLEGAP_APPLY_BROADCAST_VALUE, 0u, NULL, 0u); if(bleResult == ADI_BLER_SUCCESS){ bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_EVENT_COMPLETE,ADI_BLER_CMD_TIMEOUT); } ADI_BLE_RADIO_CMD_END(); return (bleResult); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Writes the current value of MM4. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm4(IN UINT64 Value)
/* Writes the current value of MM4. This function is only available on IA32 and X64. */ VOID EFIAPI AsmWriteMm4(IN UINT64 Value)
{ __asm__ __volatile__ ( "movd %0, %%mm4" : : "m" (Value) ); }
tianocore/edk2
C++
Other
4,240
/* Remove the lock to the list of currently held locks - this gets called on mutex_unlock()/spin_unlock*() (or on a failed mutex_lock_interruptible()). This is done for unlocks that nest perfectly. (i.e. the current top of the lock-stack is unlocked) */
static void __lock_release(struct lockdep_map *lock, int nested, unsigned long ip)
/* Remove the lock to the list of currently held locks - this gets called on mutex_unlock()/spin_unlock*() (or on a failed mutex_lock_interruptible()). This is done for unlocks that nest perfectly. (i.e. the current top of the lock-stack is unlocked) */ static void __lock_release(struct lockdep_map *lock, int nested, unsigned long ip)
{ struct task_struct *curr = current; if (!check_unlock(curr, lock, ip)) return; if (nested) { if (!lock_release_nested(curr, lock, ip)) return; } else { if (!lock_release_non_nested(curr, lock, ip)) return; } check_chain_key(curr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine can be used from both task and interrupt context. */
atomic_val_t rhino_atomic_sub(atomic_t *target, atomic_val_t value)
/* This routine can be used from both task and interrupt context. */ atomic_val_t rhino_atomic_sub(atomic_t *target, atomic_val_t value)
{ CPSR_ALLOC(); atomic_val_t old_value; RHINO_CPU_INTRPT_DISABLE(); old_value = *target; *target -= value; RHINO_CPU_INTRPT_ENABLE(); return old_value; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask interrupt source. The parameter can be any combination of the following values: arg kFLEXIO_SPI_RxFullInterruptEnable arg kFLEXIO_SPI_TxEmptyInterruptEnable */
void FLEXIO_SPI_EnableInterrupts(FLEXIO_SPI_Type *base, uint32_t mask)
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask interrupt source. The parameter can be any combination of the following values: arg kFLEXIO_SPI_RxFullInterruptEnable arg kFLEXIO_SPI_TxEmptyInterruptEnable */ void FLEXIO_SPI_EnableInterrupts(FLEXIO_SPI_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_SPI_TxEmptyInterruptEnable) { FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1 << base->shifterIndex[0]); } if (mask & kFLEXIO_SPI_RxFullInterruptEnable) { FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1 << base->shifterIndex[1]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */
static int adq12b_detach(struct comedi_device *dev)
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */ static int adq12b_detach(struct comedi_device *dev)
{ if (dev->iobase) release_region(dev->iobase, ADQ12B_SIZE); kfree(devpriv); printk("comedi%d: adq12b: removed\n", dev->minor); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Force a proper event-channel callback from Xen after clearing the callback mask. We do this in a very simple manner, by making a call down into Xen. The pending flag will be checked by Xen on return. */
void xen_force_evtchn_callback(void)
/* Force a proper event-channel callback from Xen after clearing the callback mask. We do this in a very simple manner, by making a call down into Xen. The pending flag will be checked by Xen on return. */ void xen_force_evtchn_callback(void)
{ (void)HYPERVISOR_xen_version(0, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* I2C MSP Initialization This function configures the hardware resources used in this example: */
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP Initialization This function configures the hardware resources used in this example: */ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
{ GPIO_InitTypeDef GPIO_InitStruct; I2Cx_SCL_GPIO_CLK_ENABLE(); I2Cx_SDA_GPIO_CLK_ENABLE(); I2Cx_CLK_ENABLE(); GPIO_InitStruct.Pin = I2Cx_SCL_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = I2Cx_SCL_SDA_AF; HAL_GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = I2Cx_SDA_PIN; GPIO_InitStruct.Alternate = I2Cx_SCL_SDA_AF; HAL_GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStruct); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Returns: Pointer to the indicator to be used on success ERR_PTR() if registration failed */
void* s390_register_adapter_interrupt(adapter_int_handler_t handler, void *drv_data, u8 isc)
/* Returns: Pointer to the indicator to be used on success ERR_PTR() if registration failed */ void* s390_register_adapter_interrupt(adapter_int_handler_t handler, void *drv_data, u8 isc)
{ struct airq_t *airq; char dbf_txt[16]; int ret; if (isc > MAX_ISC) return ERR_PTR(-EINVAL); airq = kmalloc(sizeof(struct airq_t), GFP_KERNEL); if (!airq) { ret = -ENOMEM; goto out; } airq->handler = handler; airq->drv_data = drv_data; ret = register_airq(airq, isc); out: snprintf(dbf_txt, sizeof(dbf_txt), "rairq:%d", ret); CIO_TRACE_EVENT(4, dbf_txt); if (ret < 0) { kfree(airq); return ERR_PTR(ret); } else return &indicators[isc].byte[ret]; }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles RX_TIM global interrupt for Port 0. */
void USBPD_RX_PORT0_Interrupt_IRQHandler(void)
/* This function handles RX_TIM global interrupt for Port 0. */ void USBPD_RX_PORT0_Interrupt_IRQHandler(void)
{ RX_TIM_Interrupt_IRQHandler(0); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Seek to an entry previously returned by telldir. We rewind the directory and call readdir repeatedly until either dd_stat is the position number or -1 (off the end). This is not perfect, in that the directory may have changed while we weren't looking. But that is probably the case with any such system. */
void _tseekdir(_TDIR *dirp, long lPos)
/* Seek to an entry previously returned by telldir. We rewind the directory and call readdir repeatedly until either dd_stat is the position number or -1 (off the end). This is not perfect, in that the directory may have changed while we weren't looking. But that is probably the case with any such system. */ void _tseekdir(_TDIR *dirp, long lPos)
{ errno = 0; if (!dirp) { errno = EFAULT; return; } if (lPos < -1) { errno = EINVAL; return; } else if (lPos == -1) { if (dirp->dd_handle != -1) { _findclose (dirp->dd_handle); } dirp->dd_handle = -1; dirp->dd_stat = -1; } else { _trewinddir (dirp); while ((dirp->dd_stat < lPos) && _treaddir (dirp)) ; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return: 0 on success, -1 on failure or timeout. */
int psc_disable_module(u32 mod_num)
/* Return: 0 on success, -1 on failure or timeout. */ int psc_disable_module(u32 mod_num)
{ u32 mdctl; mdctl = __raw_readl(KS2_PSC_BASE + PSC_REG_MDCTL(mod_num)); if ((mdctl & 0x3f) == 0) return 0; mdctl = PSC_REG_MDCTL_SET_LRSTZ(mdctl, 0); __raw_writel(mdctl, KS2_PSC_BASE + PSC_REG_MDCTL(mod_num)); return psc_set_state(mod_num, PSC_REG_VAL_MDCTL_NEXT_SWRSTDISABLE); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Adjust path mask to use next path and reset retry count. Return resulting path mask. */
static u16 ccwreq_next_path(struct ccw_device *cdev)
/* Adjust path mask to use next path and reset retry count. Return resulting path mask. */ static u16 ccwreq_next_path(struct ccw_device *cdev)
{ struct ccw_request *req = &cdev->private->req; req->retries = req->maxretries; req->mask = lpm_adjust(req->mask >>= 1, req->lpm); return req->mask; }
robutest/uclinux
C++
GPL-2.0
60
/* Uninitialize the internals of a virtio-blk device that has been successfully set up with */
STATIC VOID EFIAPI VirtioBlkUninit(IN OUT VBLK_DEV *Dev)
/* Uninitialize the internals of a virtio-blk device that has been successfully set up with */ STATIC VOID EFIAPI VirtioBlkUninit(IN OUT VBLK_DEV *Dev)
{ Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap); VirtioRingUninit (Dev->VirtIo, &Dev->Ring); SetMem (&Dev->BlockIo, sizeof Dev->BlockIo, 0x00); SetMem (&Dev->BlockIoMedia, sizeof Dev->BlockIoMedia, 0x00); }
tianocore/edk2
C++
Other
4,240