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
/* do_bad_irq handles the impossible case in the Irq vector. */
void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
/* do_bad_irq handles the impossible case in the Irq vector. */ void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
{ efi_restore_gd(); printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr); show_regs(pt_regs); show_efi_loaded_images(pt_regs); panic("Resetting CPU ...\n"); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will control network interface device DHCP capability enable or disable. */
int netdev_dhcp_enabled(struct netdev *netdev, bool is_enabled)
/* This function will control network interface device DHCP capability enable or disable. */ int netdev_dhcp_enabled(struct netdev *netdev, bool is_enabled)
{ ASSERT(netdev); if (!netdev->ops || !netdev->ops->set_dhcp) { LOGE(TAG, "The network interface device(%s) not support to set DHCP status.", netdev->name); return -1; } if (netdev_is_dhcp_enabled(netdev) == is_enabled) { return 0; } return netdev->ops->set_dhcp(netdev, is_enabled); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function handles USART3, USART4 and LPUART1 interrupts / LPUART1 wake-up interrupt through EXTI line 28. */
void USART3_4_LPUART1_IRQHandler(void)
/* This function handles USART3, USART4 and LPUART1 interrupts / LPUART1 wake-up interrupt through EXTI line 28. */ void USART3_4_LPUART1_IRQHandler(void)
{ HAL_UART_IRQHandler(&huart3); HAL_UART_IRQHandler(&hlpuart1); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ccw_device_halt() calls hsch on @cdev's subchannel. Returns: %0 on success, -ENODEV on device not operational, -EINVAL on invalid device state, -EBUSY on device busy or interrupt pending. Context: Interrupts disabled, ccw device lock held */
int ccw_device_halt(struct ccw_device *cdev, unsigned long intparm)
/* ccw_device_halt() calls hsch on @cdev's subchannel. Returns: %0 on success, -ENODEV on device not operational, -EINVAL on invalid device state, -EBUSY on device busy or interrupt pending. Context: Interrupts disabled, ccw device lock held */ int ccw_device_halt(struct ccw_device *cdev, unsigned long intparm)
{ struct subchannel *sch; int ret; if (!cdev || !cdev->dev.parent) return -ENODEV; sch = to_subchannel(cdev->dev.parent); if (!sch->schib.pmcw.ena) return -EINVAL; if (cdev->private->state == DEV_STATE_NOT_OPER) return -ENODEV; if (cdev->private->state != DEV_STATE_ONLINE && cdev->private->state != DEV_STATE_W4SENSE) return -EINVAL; ret = cio_halt(sch); if (ret == 0) cdev->private->intparm = intparm; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Start capturing data with the specified capture register. */
void am_hal_stimer_capture_stop(uint32_t ui32CaptureNum)
/* Start capturing data with the specified capture register. */ void am_hal_stimer_capture_stop(uint32_t ui32CaptureNum)
{ AM_REG(CTIMER, CAPTURE_CONTROL) &= ~(AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_M << ((AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_S - AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_S) * ui32CaptureNum)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* LPUART EDMA send finished callback function. This function is called when LPUART EDMA send finished. It disables the LPUART TX EDMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */
static void LPUART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* LPUART EDMA send finished callback function. This function is called when LPUART EDMA send finished. It disables the LPUART TX EDMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */ static void LPUART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{ assert(NULL != param); lpuart_edma_private_handle_t *lpuartPrivateHandle = (lpuart_edma_private_handle_t *)param; handle = handle; tcds = tcds; if (transferDone) { LPUART_TransferAbortSendEDMA(lpuartPrivateHandle->base, lpuartPrivateHandle->handle); if (NULL != lpuartPrivateHandle->handle->callback) { lpuartPrivateHandle->handle->callback(lpuartPrivateHandle->base, lpuartPrivateHandle->handle, kStatus_LPUART_TxIdle, lpuartPrivateHandle->handle->userData); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ZigBee Device Profile dissector for the parent announce */
void dissect_zbee_zdp_parent_annce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the parent announce */ void dissect_zbee_zdp_parent_annce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint n_children; guint i; guint64 ext_addr; n_children = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)1, NULL); zbee_append_info(tree, pinfo, ", # children %d :", n_children); for (i = 0 ; i < n_children ; ++i) { ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); if (i == 0) { zbee_append_info(tree, pinfo, n_children == 1 ? " %s" : " %s ...", eui64_to_display(wmem_packet_scope(), ext_addr)); } } zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Handler for SD card detect rising edge interrupt. */
static void SD_Detect_Handler(uint32_t id, uint32_t mask)
/* Handler for SD card detect rising edge interrupt. */ static void SD_Detect_Handler(uint32_t id, uint32_t mask)
{ if ((SD_MMC_0_CD_ID == id) && (SD_MMC_0_CD_MASK == mask)) { sd_listing_pos = 0; sd_num_files = 0; sd_fs_found = 0; sd_update = 1; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Gets the status of a job. Gets the status of an ongoing or the last job. */
enum status_code adc_get_job_status(struct adc_module *module_inst, enum adc_job_type type)
/* Gets the status of a job. Gets the status of an ongoing or the last job. */ enum status_code adc_get_job_status(struct adc_module *module_inst, enum adc_job_type type)
{ Assert(module_inst); if (type == ADC_JOB_READ_BUFFER ) { return module_inst->job_status; } else { return STATUS_ERR_INVALID_ARG; } }
memfault/zero-to-main
C++
null
200
/* Note: this function is invoked from the scsi mid-level. This function potentially frees up a device name (e.g. /dev/sdc) that could be re-used by a subsequent sd_probe(). This function is not called when the built-in sd driver is "exit-ed". */
static int sd_remove(struct device *)
/* Note: this function is invoked from the scsi mid-level. This function potentially frees up a device name (e.g. /dev/sdc) that could be re-used by a subsequent sd_probe(). This function is not called when the built-in sd driver is "exit-ed". */ static int sd_remove(struct device *)
{ struct scsi_disk *sdkp; async_synchronize_full(); sdkp = dev_get_drvdata(dev); blk_queue_prep_rq(sdkp->device->request_queue, scsi_prep_fn); device_del(&sdkp->dev); del_gendisk(sdkp->disk); sd_shutdown(dev); mutex_lock(&sd_ref_mutex); dev_set_drvdata(dev, NULL); put_device(&sdkp->dev); mutex_unlock(&sd_ref_mutex); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This API checks the invalid settings for ODR & Bw for Accel and Gyro. */
static int8_t check_invalid_settg(const struct bmi160_dev *dev)
/* This API checks the invalid settings for ODR & Bw for Accel and Gyro. */ static int8_t check_invalid_settg(const struct bmi160_dev *dev)
{ int8_t rslt; uint8_t data = 0; rslt = bmi160_get_regs(BMI160_ERROR_REG_ADDR, &data, 1, dev); data = data >> 1; data = data & BMI160_ERR_REG_MASK; if (data == 1) { rslt = BMI160_E_ACCEL_ODR_BW_INVALID; } else if (data == 2) { rslt = BMI160_E_GYRO_ODR_BW_INVALID; } else if (data == 3) { rslt = BMI160_E_LWP_PRE_FLTR_INT_INVALID; } else if (data == 7) { rslt = BMI160_E_LWP_PRE_FLTR_INVALID; } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Checks whether the specified adc's interrupt has occurred or not. */
ITStatus ADC_GetITStatus(ADC_TypeDef *adc, ADCFLAG_TypeDef adc_interrupt)
/* Checks whether the specified adc's interrupt has occurred or not. */ ITStatus ADC_GetITStatus(ADC_TypeDef *adc, ADCFLAG_TypeDef adc_interrupt)
{ return (adc_interrupt == ADC_IT_EOC) ? ((adc->ADSTA & ADC_SR_ADIF) ? SET : RESET) : ((adc->ADSTA & ADC_SR_ADWIF) ? SET : RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Build a wide negotiateion message in our message buffer based on the input parameters. */
static void ahd_construct_wdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, u_int bus_width)
/* Build a wide negotiateion message in our message buffer based on the input parameters. */ static void ahd_construct_wdtr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, u_int bus_width)
{ ahd->msgout_index += spi_populate_width_msg( ahd->msgout_buf + ahd->msgout_index, bus_width); ahd->msgout_len += 4; if (bootverbose) { printf("(%s:%c:%d:%d): Sending WDTR %x\n", ahd_name(ahd), devinfo->channel, devinfo->target, devinfo->lun, bus_width); } }
robutest/uclinux
C++
GPL-2.0
60
/* param bypassXtalOsc Pass in true to bypass the external crystal oscillator. note This device does not support bypass external crystal oscillator, so the input parameter should always be false. */
void CLOCK_InitExternalClk(bool bypassXtalOsc)
/* param bypassXtalOsc Pass in true to bypass the external crystal oscillator. note This device does not support bypass external crystal oscillator, so the input parameter should always be false. */ void CLOCK_InitExternalClk(bool bypassXtalOsc)
{ (void)bypassXtalOsc; assert(!bypassXtalOsc); CCM_ANALOG->MISC0_CLR = CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK; while ((XTALOSC24M->LOWPWR_CTRL & XTALOSC24M_LOWPWR_CTRL_XTALOSC_PWRUP_STAT_MASK) == 0) { } CCM_ANALOG->MISC0_SET = CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK; while ((CCM_ANALOG->MISC0 & CCM_ANALOG_MISC0_OSC_XTALOK_MASK) == 0) { } CCM_ANALOG->MISC0_CLR = CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Get the global comment string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. return the number of byte copied or an error code <0 */
int ZEXPORT unzGetGlobalComment(unzFile file, char *szComment, uLong uSizeBuf)
/* Get the global comment string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. return the number of byte copied or an error code <0 */ int ZEXPORT unzGetGlobalComment(unzFile file, char *szComment, uLong uSizeBuf)
{ unz_s* s; ZIPFILE *pzf; uLong uReadThis ; if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; pzf = s->zfile; uReadThis = uSizeBuf; if (uReadThis>s->gi.size_comment) uReadThis = s->gi.size_comment; (*pzf->pfnSeek)(pzf, (int32_t)(s->central_pos+22),SEEK_SET); if (uReadThis>0) { *szComment='\0'; if ((*pzf->pfnRead)(pzf, (uint8_t *)szComment,(uint32_t)uReadThis)!=uReadThis) return UNZ_ERRNO; } if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) *(szComment+s->gi.size_comment)='\0'; return (int)uReadThis; }
ua1arn/hftrx
C++
null
69
/* Checks to see if the target joins onto the end of the table. */
static int adjoin(struct dm_table *table, struct dm_target *ti)
/* Checks to see if the target joins onto the end of the table. */ static int adjoin(struct dm_table *table, struct dm_target *ti)
{ struct dm_target *prev; if (!table->num_targets) return !ti->begin; prev = &table->targets[table->num_targets - 1]; return (ti->begin == (prev->begin + prev->len)); }
robutest/uclinux
C++
GPL-2.0
60
/* Dissects the Opcode Open Session as defined by 10.5.2 */
void dissect_ptp_opCode_openSession(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
/* Dissects the Opcode Open Session as defined by 10.5.2 */ void dissect_ptp_opCode_openSession(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
{ col_set_str( pinfo->cinfo, COL_INFO, "OpenSession"); proto_tree_add_item(tree, hf_ptp_opCode_param_sessionID, tvb, *offset, 4 , ENC_LITTLE_ENDIAN); *offset += 4; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ADC3 Interrupt Handler. If users want to user the ADC3 Callback feature, Users should promise that the ADC3 Handle in the vector table is ADCIntHandler. */
void ADC3IntHandler(void)
/* ADC3 Interrupt Handler. If users want to user the ADC3 Callback feature, Users should promise that the ADC3 Handle in the vector table is ADCIntHandler. */ void ADC3IntHandler(void)
{ unsigned long ulBase = ADC2_BASE; unsigned long ulIntFlags; unsigned long ulEventFlags = 0; ulIntFlags = xHWREG(ulBase + ADC_SR); xHWREG(ulBase + ADC_SR) = ~ulIntFlags; if(ulIntFlags & ADC_INT_END_CONVERSION) { ulEventFlags |= ADC_INT_END_CONVERSION; } if(ulIntFlags & ADC_INT_AWD) { ulEventFlags |= ADC_INT_AWD; } if(ulIntFlags & ADC_INT_END_JEOC) { ulEventFlags |= ADC_INT_END_JEOC; } if(ulEventFlags && g_pfnADCHandlerCallbacks[0]) { g_pfnADCHandlerCallbacks[0](0, ulEventFlags, 0, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* DevicePathNode must be SCSI type and this will populate the MappingItem. */
EFI_STATUS DevPathSerialScsi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* DevicePathNode must be SCSI type and this will populate the MappingItem. */ EFI_STATUS DevPathSerialScsi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_STATUS Status; SCSI_DEVICE_PATH *Scsi; ASSERT (DevicePathNode != NULL); ASSERT (MappingItem != NULL); Scsi = (SCSI_DEVICE_PATH *)DevicePathNode; Status = AppendCSDNum (MappingItem, Scsi->Pun); if (!EFI_ERROR (Status)) { Status = AppendCSDNum (MappingItem, Scsi->Lun); } return Status; }
tianocore/edk2
C++
Other
4,240
/* ZigBee Device Profile dissector for the discovery store */
void dissect_zbee_zdp_rsp_discovery_store(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the discovery store */ void dissect_zbee_zdp_rsp_discovery_store(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint8 status; status = zdp_parse_status(tree, tvb, &offset); zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Wait for last operation to complete. This code has to spin since there is no other notification from the PCI hardware. Since the VPD is often implemented by serial attachment to an EEPROM, it may take many milliseconds to complete. */
static int pci_vpd_pci22_wait(struct pci_dev *dev)
/* Wait for last operation to complete. This code has to spin since there is no other notification from the PCI hardware. Since the VPD is often implemented by serial attachment to an EEPROM, it may take many milliseconds to complete. */ static int pci_vpd_pci22_wait(struct pci_dev *dev)
{ struct pci_vpd_pci22 *vpd = container_of(dev->vpd, struct pci_vpd_pci22, base); unsigned long timeout = jiffies + HZ/20 + 2; u16 status; int ret; if (!vpd->busy) return 0; for (;;) { ret = pci_user_read_config_word(dev, vpd->cap + PCI_VPD_ADDR, &status); if (ret) return ret; if ((status & PCI_VPD_ADDR_F) == vpd->flag) { vpd->busy = false; return 0; } if (time_after(jiffies, timeout)) return -ETIMEDOUT; if (fatal_signal_pending(current)) return -EINTR; if (!cond_resched()) udelay(10); } }
robutest/uclinux
C++
GPL-2.0
60
/* SysTick Read the Counter Flag. The count flag is set when the timer count becomes zero, and is cleared when the flag is read. */
uint8_t systick_get_countflag(void)
/* SysTick Read the Counter Flag. The count flag is set when the timer count becomes zero, and is cleared when the flag is read. */ uint8_t systick_get_countflag(void)
{ return (STK_CSR & STK_CSR_COUNTFLAG) ? 1 : 0; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* After the check passes, just call generic_file_open() to do its work. */
static int ntfs_file_open(struct inode *vi, struct file *filp)
/* After the check passes, just call generic_file_open() to do its work. */ static int ntfs_file_open(struct inode *vi, struct file *filp)
{ if (sizeof(unsigned long) < 8) { if (i_size_read(vi) > MAX_LFS_FILESIZE) return -EOVERFLOW; } return generic_file_open(vi, filp); }
robutest/uclinux
C++
GPL-2.0
60
/* Helper functions to find the end of a string */
static char* __strend(const char *s)
/* Helper functions to find the end of a string */ static char* __strend(const char *s)
{ register unsigned long r0 asm("0") = 0; asm volatile ("0: srst %0,%1\n" " jo 0b" : "+d" (r0), "+a" (s) : : "cc" ); return (char *) r0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* They are only callable by the VirtioNetInitialize() and the VirtioNetShutdown() SNP methods. See the state diagram in "VirtioNet.h". */
VOID EFIAPI VirtioNetShutdownRx(IN OUT VNET_DEV *Dev)
/* They are only callable by the VirtioNetInitialize() and the VirtioNetShutdown() SNP methods. See the state diagram in "VirtioNet.h". */ VOID EFIAPI VirtioNetShutdownRx(IN OUT VNET_DEV *Dev)
{ Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxBufMap); Dev->VirtIo->FreeSharedPages ( Dev->VirtIo, Dev->RxBufNrPages, Dev->RxBuf ); }
tianocore/edk2
C++
Other
4,240
/* Create memory range resource HOB using memory base address and top address of the memory range. */
STATIC VOID AddMemoryRangeHob(IN EFI_PHYSICAL_ADDRESS MemoryBase, IN EFI_PHYSICAL_ADDRESS MemoryLimit)
/* Create memory range resource HOB using memory base address and top address of the memory range. */ STATIC VOID AddMemoryRangeHob(IN EFI_PHYSICAL_ADDRESS MemoryBase, IN EFI_PHYSICAL_ADDRESS MemoryLimit)
{ AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase)); }
tianocore/edk2
C++
Other
4,240
/* Sweep a list of objects to enter generational mode. Deletes dead objects and turns the non dead to old. All non-dead threads */
static void sweep2old(lua_State *L, GCObject **p)
/* Sweep a list of objects to enter generational mode. Deletes dead objects and turns the non dead to old. All non-dead threads */ static void sweep2old(lua_State *L, GCObject **p)
{ if (iswhite(curr)) { lua_assert(isdead(g, curr)); *p = curr->next; freeobj(L, curr); } else { setage(curr, G_OLD); if (curr->tt == LUA_VTHREAD) { lua_State *th = gco2th(curr); linkgclist(th, g->grayagain); } else if (curr->tt == LUA_VUPVAL && upisopen(gco2upv(curr))) set2gray(curr); else nw2black(curr); p = &curr->next; } } }
Nicholas3388/LuaNode
C++
Other
1,055
/* param base DCDC peripheral base address. param VDDRun Target value in run mode. 25 mV each step from 0x00 to 0x1F. 00 is for 0.8V, 0x1F is for 1.575V. */
void DCDC_AdjustRunTargetVoltage(DCDC_Type *base, uint32_t VDDRun)
/* param base DCDC peripheral base address. param VDDRun Target value in run mode. 25 mV each step from 0x00 to 0x1F. 00 is for 0.8V, 0x1F is for 1.575V. */ void DCDC_AdjustRunTargetVoltage(DCDC_Type *base, uint32_t VDDRun)
{ uint32_t tmp32; base->REG3 &= ~DCDC_REG3_DISABLE_STEP_MASK; tmp32 = base->REG3 & ~DCDC_REG3_TRG_MASK; tmp32 |= DCDC_REG3_TRG(VDDRun); base->REG3 = tmp32; while (DCDC_REG0_STS_DC_OK_MASK != (DCDC_REG0_STS_DC_OK_MASK & base->REG0)) { } }
eclipse-threadx/getting-started
C++
Other
310
/* This is the mkdir() entry in the inode_operations structure for regular HFS directories. The purpose is to create a new directory in a directory, given the inode for the parent directory and the name (and its length) of the new directory. */
static int hfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
/* This is the mkdir() entry in the inode_operations structure for regular HFS directories. The purpose is to create a new directory in a directory, given the inode for the parent directory and the name (and its length) of the new directory. */ static int hfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{ struct inode *inode; int res; inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode); if (!inode) return -ENOSPC; res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode); if (res) { inode->i_nlink = 0; hfs_delete_inode(inode); iput(inode); return res; } d_instantiate(dentry, inode); mark_inode_dirty(inode); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Register selection is normally done via three contiguous bits. However, some boards (such as the MC16/32) use only two bits, plus a separate bit in the glue chip. This sets the SRSX bit (the top bit). See page 4-17 in the Yellow Book for which registers are affected. */
static void madgemc_setregpage(struct net_device *dev, int page)
/* Register selection is normally done via three contiguous bits. However, some boards (such as the MC16/32) use only two bits, plus a separate bit in the glue chip. This sets the SRSX bit (the top bit). See page 4-17 in the Yellow Book for which registers are affected. */ static void madgemc_setregpage(struct net_device *dev, int page)
{ static int reg1; reg1 = inb(dev->base_addr + MC_CONTROL_REG1); if ((page == 0) && (reg1 & MC_CONTROL_REG1_SRSX)) { outb(reg1 ^ MC_CONTROL_REG1_SRSX, dev->base_addr + MC_CONTROL_REG1); } else if (page == 1) { outb(reg1 | MC_CONTROL_REG1_SRSX, dev->base_addr + MC_CONTROL_REG1); } reg1 = inb(dev->base_addr + MC_CONTROL_REG1); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClrStallEP(uint32_t EPNum)
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ClrStallEP(uint32_t EPNum)
{ USB0->ENDPOINT[EPNum & 0x0F].ENDPT &= ~USB_ENDPT_EPSTALL_MASK; USBD_ResetEP(EPNum); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Return value: 0 on success / other on failure */
static int __init ibmvfc_module_init(void)
/* Return value: 0 on success / other on failure */ static int __init ibmvfc_module_init(void)
{ int rc; if (!firmware_has_feature(FW_FEATURE_VIO)) return -ENODEV; printk(KERN_INFO IBMVFC_NAME": IBM Virtual Fibre Channel Driver version: %s %s\n", IBMVFC_DRIVER_VERSION, IBMVFC_DRIVER_DATE); ibmvfc_transport_template = fc_attach_transport(&ibmvfc_transport_functions); if (!ibmvfc_transport_template) return -ENOMEM; rc = vio_register_driver(&ibmvfc_driver); if (rc) fc_release_transport(ibmvfc_transport_template); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Maximum duration is the maximum time of an over threshold signal detection to be recognized as a tap event. The default value of these bits is 00b which corresponds to 4*ODR_XL time. If the SHOCK bits are set to a different value, 1LSB corresponds to 8*ODR_XL time.. */
int32_t lsm6dso_tap_shock_set(stmdev_ctx_t *ctx, uint8_t val)
/* Maximum duration is the maximum time of an over threshold signal detection to be recognized as a tap event. The default value of these bits is 00b which corresponds to 4*ODR_XL time. If the SHOCK bits are set to a different value, 1LSB corresponds to 8*ODR_XL time.. */ int32_t lsm6dso_tap_shock_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dso_int_dur2_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)&reg, 1); if (ret == 0) { reg.shock = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Draws a string using the supplied anti-aliased font. */
void aafontsDrawString(uint16_t x, uint16_t y, const uint16_t *colorTable, const aafontsFont_t *font, char *str)
/* Draws a string using the supplied anti-aliased font. */ void aafontsDrawString(uint16_t x, uint16_t y, const uint16_t *colorTable, const aafontsFont_t *font, char *str)
{ uint16_t currentX, charWidth, characterToOutput; const aafontsCharInfo_t *charInfo; currentX = x; while (*str != '\0') { characterToOutput = *str; if ((characterToOutput > font->lastChar) || (characterToOutput < font->firstChar)) { charWidth = font->unknownCharWidth; } else { charInfo = &(font->charTable[characterToOutput - font->firstChar]); charWidth = charInfo->width; switch (font->fontType) { case AAFONTS_FONTTYPE_AA2: aafontsDrawCharAA2(currentX, y, font->fontHeight, *charInfo, &colorTable[0]); break; case AAFONTS_FONTTYPE_AA4: aafontsDrawCharAA4(currentX, y, font->fontHeight, *charInfo, &colorTable[0]); break; } } currentX += charWidth; str++; } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* To cut down on reading costs we update only the octet counters at each tick and do a full update at major ticks, which can be every 30 minutes or more. */
static const struct cmac_statistics* mac_update_statistics(struct cmac *mac, int flag)
/* To cut down on reading costs we update only the octet counters at each tick and do a full update at major ticks, which can be every 30 minutes or more. */ static const struct cmac_statistics* mac_update_statistics(struct cmac *mac, int flag)
{ if (flag == MAC_STATS_UPDATE_FULL || mac->instance->ticks >= MAJOR_UPDATE_TICKS) { port_stats_update(mac); mac->instance->ticks = 0; } else { int port = mac->instance->index; rmon_update(mac, REG_RX_OK_BYTES(port), &mac->stats.RxOctetsOK); rmon_update(mac, REG_RX_BAD_BYTES(port), &mac->stats.RxOctetsBad); rmon_update(mac, REG_TX_OK_BYTES(port), &mac->stats.TxOctetsOK); mac->instance->ticks++; } return &mac->stats; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the mPhysMemAddressWidth variable, based on CPUID data. */
VOID AddressWidthInitialization(VOID)
/* Initialize the mPhysMemAddressWidth variable, based on CPUID data. */ VOID AddressWidthInitialization(VOID)
{ UINT32 RegEax; AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); if (RegEax >= 0x80000008) { AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); mPhysMemAddressWidth = (UINT8)RegEax; } else { mPhysMemAddressWidth = 36; } ASSERT (mPhysMemAddressWidth <= 52); if (mPhysMemAddressWidth > 48) { mPhysMemAddressWidth = 48; } }
tianocore/edk2
C++
Other
4,240
/* Valid offset of SHI output buffer to write. */
static uint32_t shi_npcx_valid_obuf_offset(struct shi_reg *const inst)
/* Valid offset of SHI output buffer to write. */ static uint32_t shi_npcx_valid_obuf_offset(struct shi_reg *const inst)
{ if (IS_ENABLED(CONFIG_EC_HOST_CMD_BACKEND_SHI_NPCX_ENHANCED_BUF_MODE)) { return shi_npcx_write_buf_pointer(inst) % SHI_OBUF_FULL_SIZE; } else { return (shi_npcx_read_buf_pointer(inst) + EC_SHI_OUT_PREAMBLE_LENGTH) % SHI_OBUF_FULL_SIZE; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Receive and parse an I (Information) frame, no harm in making it inline since it's called only from one single place (irlap_driver_rcv). */
static void irlap_recv_i_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command)
/* Receive and parse an I (Information) frame, no harm in making it inline since it's called only from one single place (irlap_driver_rcv). */ static void irlap_recv_i_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info, int command)
{ info->nr = skb->data[1] >> 5; info->pf = skb->data[1] & PF_BIT; info->ns = (skb->data[1] >> 1) & 0x07; if (command) irlap_do_event(self, RECV_I_CMD, skb, info); else irlap_do_event(self, RECV_I_RSP, skb, info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Find out the actual device address according to the requested device address from UsbBus. */
UINT8 EFIAPI XhcBusDevAddrToSlotId(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusDevAddr)
/* Find out the actual device address according to the requested device address from UsbBus. */ UINT8 EFIAPI XhcBusDevAddrToSlotId(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 BusDevAddr)
{ UINT8 Index; for (Index = 0; Index < 255; Index++) { if (Xhc->UsbDevContext[Index + 1].Enabled && (Xhc->UsbDevContext[Index + 1].SlotId != 0) && (Xhc->UsbDevContext[Index + 1].BusDevAddr == BusDevAddr)) { break; } } if (Index == 255) { return 0; } return Xhc->UsbDevContext[Index + 1].SlotId; }
tianocore/edk2
C++
Other
4,240
/* This function is called whenever we need to ensure that the IOMMU has completed execution of all commands we sent. It sends a COMPLETION_WAIT command and waits for it to finish. The IOMMU informs us about that by writing a value to a physical address we pass with the command. */
static int iommu_completion_wait(struct amd_iommu *iommu)
/* This function is called whenever we need to ensure that the IOMMU has completed execution of all commands we sent. It sends a COMPLETION_WAIT command and waits for it to finish. The IOMMU informs us about that by writing a value to a physical address we pass with the command. */ static int iommu_completion_wait(struct amd_iommu *iommu)
{ int ret = 0; unsigned long flags; spin_lock_irqsave(&iommu->lock, flags); if (!iommu->need_sync) goto out; ret = __iommu_completion_wait(iommu); iommu->need_sync = false; if (ret) goto out; __iommu_wait_for_completion(iommu); out: spin_unlock_irqrestore(&iommu->lock, flags); if (iommu->reset_in_progress) reset_iommu_command_buffer(iommu); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */
EFI_STATUS EFIAPI TlsDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */ EFI_STATUS EFIAPI TlsDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; TLS_SERVICE *TlsService; Status = TlsCreateService (ImageHandle, &TlsService); if (EFI_ERROR (Status)) { return Status; } ASSERT (TlsService != NULL); TlsInitialize (); TlsService->TlsCtx = TlsCtxNew (TLS10_PROTOCOL_VERSION_MAJOR, TLS10_PROTOCOL_VERSION_MINOR); if (TlsService->TlsCtx == NULL) { FreePool (TlsService); return EFI_ABORTED; } Status = gBS->InstallMultipleProtocolInterfaces ( &TlsService->Handle, &gEfiTlsServiceBindingProtocolGuid, &TlsService->ServiceBinding, NULL ); if (EFI_ERROR (Status)) { goto ON_CLEAN_SERVICE; } return Status; ON_CLEAN_SERVICE: TlsCleanService (TlsService); return Status; }
tianocore/edk2
C++
Other
4,240
/* Gets the device path of a specific storage security device. */
EFI_STATUS EFIAPI AhciStorageSecurityGetDevicePath(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
/* Gets the device path of a specific storage security device. */ EFI_STATUS EFIAPI AhciStorageSecurityGetDevicePath(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
{ PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private; PEI_AHCI_ATA_DEVICE_DATA *DeviceData; EFI_STATUS Status; if ((This == NULL) || (DevicePathLength == NULL) || (DevicePath == NULL)) { return EFI_INVALID_PARAMETER; } Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This); if ((DeviceIndex == 0) || (DeviceIndex > Private->TrustComputingDevices)) { return EFI_INVALID_PARAMETER; } DeviceData = SearchTrustComputingDeviceByIndex (Private, DeviceIndex); if (DeviceData == NULL) { return EFI_NOT_FOUND; } Status = AhciBuildDevicePath ( Private, DeviceData->Port, DeviceData->PortMultiplier, DevicePathLength, DevicePath ); if (EFI_ERROR (Status)) { return Status; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Checks whether the supplied address is within the valid range. */
bool eepromCheckAddress(uint16_t addr)
/* Checks whether the supplied address is within the valid range. */ bool eepromCheckAddress(uint16_t addr)
{ return addr <= MCP24AA_MAXADDR ? FALSE : TRUE; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Iterator to store a backtrace into a latency record entry */
static void store_stacktrace(struct task_struct *tsk, struct latency_record *lat)
/* Iterator to store a backtrace into a latency record entry */ static void store_stacktrace(struct task_struct *tsk, struct latency_record *lat)
{ struct stack_trace trace; memset(&trace, 0, sizeof(trace)); trace.max_entries = LT_BACKTRACEDEPTH; trace.entries = &lat->backtrace[0]; save_stack_trace_tsk(tsk, &trace); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads the response data into the TRB buffer. This function assumes that caller made sure that command has completed. */
EFI_STATUS SdMmcGetResponse(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
/* Reads the response data into the TRB buffer. This function assumes that caller made sure that command has completed. */ EFI_STATUS SdMmcGetResponse(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
{ EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet; UINT8 Index; UINT32 Response[4]; EFI_STATUS Status; Packet = Trb->Packet; if (Packet->SdMmcCmdBlk->CommandType == SdMmcCommandTypeBc) { return EFI_SUCCESS; } for (Index = 0; Index < 4; Index++) { Status = SdMmcHcRwMmio ( Private->PciIo, Trb->Slot, SD_MMC_HC_RESPONSE + Index * 4, TRUE, sizeof (UINT32), &Response[Index] ); if (EFI_ERROR (Status)) { return Status; } } CopyMem (Packet->SdMmcStatusBlk, Response, sizeof (Response)); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Fills each SAI_SlotInitStruct member with its default value. */
void SAI_SlotStructInit(SAI_SlotInitTypeDef *SAI_SlotInitStruct)
/* Fills each SAI_SlotInitStruct member with its default value. */ void SAI_SlotStructInit(SAI_SlotInitTypeDef *SAI_SlotInitStruct)
{ SAI_SlotInitStruct->SAI_FirstBitOffset = 0; SAI_SlotInitStruct->SAI_SlotSize = SAI_SlotSize_DataSize; SAI_SlotInitStruct->SAI_SlotNumber = 1; SAI_SlotInitStruct->SAI_SlotActive = SAI_Slot_NotActive; }
MaJerle/stm32f429
C++
null
2,036
/* Set System Memory Planar Y, U and V Base Address Registers. */
void CAP_SetPlanarBuf(CAP_T *VCAP, uint32_t u32YAddr, uint32_t u32UAddr, uint32_t u32VAddr)
/* Set System Memory Planar Y, U and V Base Address Registers. */ void CAP_SetPlanarBuf(CAP_T *VCAP, uint32_t u32YAddr, uint32_t u32UAddr, uint32_t u32VAddr)
{ VCAP->YBA = u32YAddr; VCAP->UBA = u32UAddr; VCAP->VBA = u32VAddr; VCAP->CTL |= CAP_CTL_UPDATE_Msk; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function disables the specified interrupts in the device. */
void XAdcPs_IntrDisable(XAdcPs *InstancePtr, u32 Mask)
/* This function disables the specified interrupts in the device. */ void XAdcPs_IntrDisable(XAdcPs *InstancePtr, u32 Mask)
{ u32 RegValue; Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); RegValue = XAdcPs_ReadReg(InstancePtr->Config.BaseAddress, XADCPS_INT_MASK_OFFSET); RegValue |= (Mask & XADCPS_INTX_ALL_MASK); XAdcPs_WriteReg(InstancePtr->Config.BaseAddress, XADCPS_INT_MASK_OFFSET, RegValue); }
ua1arn/hftrx
C++
null
69
/* Is all threads of the target process nodes overlap ours? */
static int has_intersects_mems_allowed(struct task_struct *tsk)
/* Is all threads of the target process nodes overlap ours? */ static int has_intersects_mems_allowed(struct task_struct *tsk)
{ struct task_struct *t; t = tsk; do { if (cpuset_mems_allowed_intersects(current, t)) return 1; t = next_thread(t); } while (t != tsk); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Dispatches an incoming ATT exchange-mtu-response to the appropriate active GATT procedure. */
void ble_gattc_rx_mtu(uint16_t conn_handle, int status, uint16_t chan_mtu)
/* Dispatches an incoming ATT exchange-mtu-response to the appropriate active GATT procedure. */ void ble_gattc_rx_mtu(uint16_t conn_handle, int status, uint16_t chan_mtu)
{ struct ble_gattc_proc *proc; proc = ble_gattc_extract_first_by_conn_op(conn_handle, BLE_GATT_OP_MTU); if (proc != NULL) { ble_gattc_mtu_cb(proc, status, 0, chan_mtu); ble_gattc_process_status(proc, BLE_HS_EDONE); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Disable an SGE free-buffer list. The caller is responsible for ensuring only one context operation occurs at a time. */
int t3_sge_disable_fl(struct adapter *adapter, unsigned int id)
/* Disable an SGE free-buffer list. The caller is responsible for ensuring only one context operation occurs at a time. */ int t3_sge_disable_fl(struct adapter *adapter, unsigned int id)
{ if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY) return -EBUSY; t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0); t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0); t3_write_reg(adapter, A_SG_CONTEXT_MASK2, V_FL_SIZE(M_FL_SIZE)); t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0); t3_write_reg(adapter, A_SG_CONTEXT_DATA2, 0); t3_write_reg(adapter, A_SG_CONTEXT_CMD, V_CONTEXT_CMD_OPCODE(1) | F_FREELIST | V_CONTEXT(id)); return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0, SG_CONTEXT_CMD_ATTEMPTS, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Read a single color from the graphical memory. Limits have to be set prior to calling this function, e.g.: */
uint16_t ili9488_read_gram(void)
/* Read a single color from the graphical memory. Limits have to be set prior to calling this function, e.g.: */ uint16_t ili9488_read_gram(void)
{ ili9488_set_cursor_position(limit_start_x, limit_start_y); return ili9488_read_ram(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* If OldArgv or OldArgc is NULL then that value is not returned. */
EFI_STATUS UpdateArgcArgv(IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CONST CHAR16 *NewCommandLine, IN SHELL_OPERATION_TYPES Type, OUT CHAR16 ***OldArgv OPTIONAL, OUT UINTN *OldArgc OPTIONAL)
/* If OldArgv or OldArgc is NULL then that value is not returned. */ EFI_STATUS UpdateArgcArgv(IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CONST CHAR16 *NewCommandLine, IN SHELL_OPERATION_TYPES Type, OUT CHAR16 ***OldArgv OPTIONAL, OUT UINTN *OldArgc OPTIONAL)
{ BOOLEAN StripParamQuotation; ASSERT (ShellParameters != NULL); StripParamQuotation = TRUE; if (OldArgc != NULL) { *OldArgc = ShellParameters->Argc; } if (OldArgc != NULL) { *OldArgv = ShellParameters->Argv; } if (Type == Script_File_Name) { StripParamQuotation = FALSE; } return ParseCommandLineToArgs ( NewCommandLine, StripParamQuotation, &(ShellParameters->Argv), &(ShellParameters->Argc) ); }
tianocore/edk2
C++
Other
4,240
/* Gets the current transfer size for a uDMA channel control structure. */
uint32_t uDMAChannelSizeGet(uint32_t ui32ChannelStructIndex)
/* Gets the current transfer size for a uDMA channel control structure. */ uint32_t uDMAChannelSizeGet(uint32_t ui32ChannelStructIndex)
{ tDMAControlTable *psControlTable; uint32_t ui32Control; ASSERT((ui32ChannelStructIndex & 0xffff) < 64); ASSERT(HWREG(UDMA_CTLBASE) != 0); ui32ChannelStructIndex &= 0x3f; psControlTable = (tDMAControlTable *)HWREG(UDMA_CTLBASE); ui32Control = (psControlTable[ui32ChannelStructIndex].ui32Control & (UDMA_CHCTL_XFERSIZE_M | UDMA_CHCTL_XFERMODE_M)); if(ui32Control == 0) { return(0); } else { return((ui32Control >> 4) + 1); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The flash memory in stm32f2 series has bank 1 only with 12 sectors, they are split as 4 sectors of 16 Kbytes, 1 sector of 64 Kbytes, and 7 sectors of 128 Kbytes. */
void flash_stm32_page_layout(const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size)
/* The flash memory in stm32f2 series has bank 1 only with 12 sectors, they are split as 4 sectors of 16 Kbytes, 1 sector of 64 Kbytes, and 7 sectors of 128 Kbytes. */ void flash_stm32_page_layout(const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size)
{ ARG_UNUSED(dev); *layout = stm32f2_flash_layout; *layout_size = ARRAY_SIZE(stm32f2_flash_layout); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Write to card's Host Adapter Command Register. Include a delay for those times when it is needed. */
static void hacr_write_slow(u_long base, u_char hacr)
/* Write to card's Host Adapter Command Register. Include a delay for those times when it is needed. */ static void hacr_write_slow(u_long base, u_char hacr)
{ hacr_write(base, hacr); mdelay(1); }
robutest/uclinux
C++
GPL-2.0
60
/* Locking: must be called within a read rcu section. */
struct mesh_path* mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata)
/* Locking: must be called within a read rcu section. */ struct mesh_path* mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata)
{ struct mesh_path *mpath; struct hlist_node *n; struct hlist_head *bucket; struct mesh_table *tbl; struct mpath_node *node; tbl = rcu_dereference(mesh_paths); bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)]; hlist_for_each_entry_rcu(node, n, bucket, list) { mpath = node->mpath; if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) { if (MPATH_EXPIRED(mpath)) { spin_lock_bh(&mpath->state_lock); if (MPATH_EXPIRED(mpath)) mpath->flags &= ~MESH_PATH_ACTIVE; spin_unlock_bh(&mpath->state_lock); } return mpath; } } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the adapter_info structure with a given index. Out-of-range indices return NULL. */
const struct adapter_info* t3_get_adapter_info(unsigned int id)
/* Return the adapter_info structure with a given index. Out-of-range indices return NULL. */ const struct adapter_info* t3_get_adapter_info(unsigned int id)
{ return id < ARRAY_SIZE(t3_adap_info) ? &t3_adap_info[id] : NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* The return value is a combination of the values described in the */
uint32_t HibernateLowBatGet(void)
/* The return value is a combination of the values described in the */ uint32_t HibernateLowBatGet(void)
{ return (HWREG(HIB_CTL) & (HIB_CTL_VBATSEL_M | HIBERNATE_LOW_BAT_ABORT)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is used to Free the DMA channel when not use. */
void tls_dma_free(unsigned char ch)
/* This function is used to Free the DMA channel when not use. */ void tls_dma_free(unsigned char ch)
{ if(ch < 8) { tls_dma_stop(ch); DMA_SRCADDR_REG(ch) = 0; DMA_DESTADDR_REG(ch) = 0; DMA_MODE_REG(ch) = 0; DMA_CTRL_REG(ch) = 0; DMA_INTSRC_REG |= 0x03<<(ch*2); channels.channels[ch] = 0x00; dma_used_bit &= ~(1<<ch); if (dma_used_bit == 0) { tls_close_peripheral_clock(TLS_PERIPHERAL_TYPE_DMA); } } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Full key name (excluding the pre-defined ancestor's name) can't exceed 255 UTF-16 characters, give or take. Value name can't exceed 16383 UTF-16 characters. Tree depth is limited to 512 levels. */
G_DEFINE_BOXED_TYPE(GWin32RegistryValueIter, g_win32_registry_value_iter, g_win32_registry_value_iter_copy, g_win32_registry_value_iter_free)
/* Full key name (excluding the pre-defined ancestor's name) can't exceed 255 UTF-16 characters, give or take. Value name can't exceed 16383 UTF-16 characters. Tree depth is limited to 512 levels. */ G_DEFINE_BOXED_TYPE(GWin32RegistryValueIter, g_win32_registry_value_iter, g_win32_registry_value_iter_copy, g_win32_registry_value_iter_free)
{ GWin32RegistryKey *ancestor; HKEY handle; gunichar2 *absolute_path_w; gchar *absolute_path; gboolean predefined; gint watch_indicator; gint change_indicator; GWin32RegistryKeyUpdateFlag update_flags; GWin32RegistryKeyWatchCallbackFunc callback; gpointer user_data; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This API sets the burst data length (1,2,6,8 byte) of auxiliary Mag sensor. */
uint16_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev)
/* This API sets the burst data length (1,2,6,8 byte) of auxiliary Mag sensor. */ uint16_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_AUX_IF_CONF_ADDR, &data, 1, dev); if (rslt == BMA4_OK) { data = BMA4_SET_BITS_POS_0(data, BMA4_MAG_BURST, mag_burst); rslt |= bma4_write_regs(BMA4_AUX_IF_CONF_ADDR, &data, 1, dev); } } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* This dissector is handed a DPP packet of any version. It is responsible for decoding the common header fields and then passing off to the specific DPP dissector */
static int dissect_app_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* This dissector is handed a DPP packet of any version. It is responsible for decoding the common header fields and then passing off to the specific DPP dissector */ static int dissect_app_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{ col_clear(pinfo->cinfo, COL_INFO); { guint16 app; gint app_len; read_c2(tvb, 0, &app, &app_len); col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "APP(%u)", app); if (dissector_try_uint_new(app_dissectors, app, tvb, pinfo, tree, TRUE, data)) { col_set_fence(pinfo->cinfo, COL_PROTOCOL); col_set_fence(pinfo->cinfo, COL_INFO); return tvb_reported_length(tvb); } else { proto_tree_add_protocol_format(tree, proto_2008_1_app, tvb, 0, app_len, DOF_APPLICATION_PROTOCOL ", Version: %u", app); } } return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Deallocate a memory block from a memory block previously declared with MEMB(). */
char memb_free(struct memb_blocks *m, char *ptr)
/* Deallocate a memory block from a memory block previously declared with MEMB(). */ char memb_free(struct memb_blocks *m, char *ptr)
{ int i; char *ptr2; ptr2 = m->mem; for(i = 0; i < m->num; ++i) { if(ptr2 == ptr - 1) { return --*ptr2; } ptr2 += m->size + 1; } return -1; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Deinitializes the PWR peripheral registers to their default reset values. */
void PWR_DeInit(void)
/* Deinitializes the PWR peripheral registers to their default reset values. */ void PWR_DeInit(void)
{ RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_PWR, ENABLE); RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_PWR, DISABLE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns either the enabled or raw timer interrupt status. This function will return the timer interrupt status. */
uint32_t am_hal_ctimer_int_status_get(bool bEnabledOnly)
/* Returns either the enabled or raw timer interrupt status. This function will return the timer interrupt status. */ uint32_t am_hal_ctimer_int_status_get(bool bEnabledOnly)
{ if ( bEnabledOnly ) { uint32_t u32RetVal; AM_CRITICAL_BEGIN_ASM u32RetVal = AM_REGn(CTIMER, 0, INTSTAT); u32RetVal &= AM_REGn(CTIMER, 0, INTEN); AM_CRITICAL_END_ASM return u32RetVal; } else { return AM_REGn(CTIMER, 0, INTSTAT); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called during kernel startup to initialize the bvme6000 IRQ handling routines. */
static void __init bvme6000_init_IRQ(void)
/* This function is called during kernel startup to initialize the bvme6000 IRQ handling routines. */ static void __init bvme6000_init_IRQ(void)
{ m68k_setup_user_interrupt(VEC_USER, 192, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return VA for a given PA or 0 if not mapped */
unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
/* Return VA for a given PA or 0 if not mapped */ unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
{ int b; for (b = 0; b < tlbcam_index; ++b) if (pa >= tlbcam_addrs[b].phys && pa < (tlbcam_addrs[b].limit-tlbcam_addrs[b].start) +tlbcam_addrs[b].phys) return tlbcam_addrs[b].start+(pa-tlbcam_addrs[b].phys); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Routine: misc_init_r Description: Configure zoom board specific configurations */
int misc_init_r(void)
/* Routine: misc_init_r Description: Configure zoom board specific configurations */ int misc_init_r(void)
{ twl4030_power_init(); twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); dieid_num_r(); twl4030_power_reset_init(); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* I2C Set Standard Mode. Set the clock frequency to the standard clock rate mode (up to 100kHz). The actual clock frequency must be set with */
void i2c_set_standard_mode(uint32_t i2c)
/* I2C Set Standard Mode. Set the clock frequency to the standard clock rate mode (up to 100kHz). The actual clock frequency must be set with */ void i2c_set_standard_mode(uint32_t i2c)
{ I2C_CCR(i2c) &= ~I2C_CCR_FS; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Fills each LTDC_Pos_InitStruct member with its default value. */
void LTDC_PosStructInit(LTDC_PosTypeDef *LTDC_Pos_InitStruct)
/* Fills each LTDC_Pos_InitStruct member with its default value. */ void LTDC_PosStructInit(LTDC_PosTypeDef *LTDC_Pos_InitStruct)
{ LTDC_Pos_InitStruct->LTDC_POSX = 0x00; LTDC_Pos_InitStruct->LTDC_POSY = 0x00; }
MaJerle/stm32f429
C++
null
2,036
/* If 8-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
{ IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); }
tianocore/edk2
C++
Other
4,240
/* reset TSI peripheral , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void tsi_deinit(void)
/* reset TSI peripheral , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void tsi_deinit(void)
{ rcu_periph_reset_enable(RCU_TSIRST); rcu_periph_reset_disable(RCU_TSIRST); }
liuxuming/trochili
C++
Apache License 2.0
132
/* The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed. */
mxml_node_t* mxmlNewXML(const char *version)
/* The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed. */ mxml_node_t* mxmlNewXML(const char *version)
{ char element[1024]; snprintf(element, sizeof(element), "?xml version=\"%s\" encoding=\"utf-8\"?", version ? version : "1.0"); return (mxmlNewElement(NULL, element)); }
DC-SWAT/DreamShell
C++
null
404
/* Return the number of parameters that follow the command name. */
static int8_t prvGetNumberOfParameters(const char *pcCommandString)
/* Return the number of parameters that follow the command name. */ static int8_t prvGetNumberOfParameters(const char *pcCommandString)
{ int8_t cParameters = 0; BaseType_t xLastCharacterWasSpace = pdFALSE; while( *pcCommandString != 0x00 ) { if( ( *pcCommandString ) == ' ' ) { if( xLastCharacterWasSpace != pdTRUE ) { cParameters++; xLastCharacterWasSpace = pdTRUE; } } else { xLastCharacterWasSpace = pdFALSE; } pcCommandString++; } if( xLastCharacterWasSpace == pdTRUE ) { cParameters--; } return cParameters; }
st-one/X-CUBE-USB-PD
C++
null
110
/* The initial step is 1; this means that each step increases t by 1 (so fd_init () immediately followed by fd_fwd (f) n times makes f be the value of the curve for t==n). */
static void fd_init(double x, double y, double z, double w, double f[4])
/* The initial step is 1; this means that each step increases t by 1 (so fd_init () immediately followed by fd_fwd (f) n times makes f be the value of the curve for t==n). */ static void fd_init(double x, double y, double z, double w, double f[4])
{ f[0] = x; f[1] = w - x; f[2] = 6. * (w - 2. * z + y); f[3] = 6. * (w - 3. * z + 3. * y - x); }
xboot/xboot
C++
MIT License
779
/* In fine update mode, the subsecond increment value must be set according to the desired accuracy of the recovered IEEE 1588 clock which must be lower than the system clock rate. Fine update mode is typically used when synchronizing the local clock to the IEEE 1588 master clock. The subsecond counter is incremented by */
void EMACTimestampConfigSet(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32SubSecondInc)
/* In fine update mode, the subsecond increment value must be set according to the desired accuracy of the recovered IEEE 1588 clock which must be lower than the system clock rate. Fine update mode is typically used when synchronizing the local clock to the IEEE 1588 master clock. The subsecond counter is incremented by */ void EMACTimestampConfigSet(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32SubSecondInc)
{ ASSERT(ui32Base == EMAC0_BASE); HWREG(ui32Base + EMAC_O_CC) |= EMAC_CC_PTPCEN; HWREG(ui32Base + EMAC_O_SUBSECINC) = ((ui32SubSecondInc << EMAC_SUBSECINC_SSINC_S) & EMAC_SUBSECINC_SSINC_M); HWREG(ui32Base + EMAC_O_TIMSTCTRL) = ui32Config; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Limit the number of available kernel image capture buffers based on the number requested, the currently selected image size, and the maximum amount of memory permitted for kernel capture buffers. */
static int omap24xxcam_vbq_setup(struct videobuf_queue *vbq, unsigned int *cnt, unsigned int *size)
/* Limit the number of available kernel image capture buffers based on the number requested, the currently selected image size, and the maximum amount of memory permitted for kernel capture buffers. */ static int omap24xxcam_vbq_setup(struct videobuf_queue *vbq, unsigned int *cnt, unsigned int *size)
{ struct omap24xxcam_fh *fh = vbq->priv_data; if (*cnt <= 0) *cnt = VIDEO_MAX_FRAME; if (*cnt > VIDEO_MAX_FRAME) *cnt = VIDEO_MAX_FRAME; *size = fh->pix.sizeimage; while (*size * *cnt > fh->cam->capture_mem) (*cnt)--; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the TIMx Internal Trigger as External Clock. */
void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
/* Configures the TIMx Internal Trigger as External Clock. */ void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
{ assert_param(IS_TIM_LIST6_PERIPH(TIMx)); assert_param(IS_TIM_INTERNAL_TRIGGER_SELECTION(TIM_InputTriggerSource)); TIM_SelectInputTrigger(TIMx, TIM_InputTriggerSource); TIMx->SMCR |= TIM_SlaveMode_External1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note that this will only take effect when the link state changes. */
static int set_phyerrthreshold(struct ipath_devdata *dd, unsigned n)
/* Note that this will only take effect when the link state changes. */ static int set_phyerrthreshold(struct ipath_devdata *dd, unsigned n)
{ unsigned v; v = (dd->ipath_ibcctrl >> INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT) & INFINIPATH_IBCC_PHYERRTHRESHOLD_MASK; if (v != n) { dd->ipath_ibcctrl &= ~(INFINIPATH_IBCC_PHYERRTHRESHOLD_MASK << INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT); dd->ipath_ibcctrl |= (u64) n << INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT; ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, dd->ipath_ibcctrl); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* SPI and I2S reset. , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void spi_i2s_deinit(uint32_t spi_periph)
/* SPI and I2S reset. , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void spi_i2s_deinit(uint32_t spi_periph)
{ switch(spi_periph){ case SPI0: rcu_periph_reset_enable(RCU_SPI0RST); rcu_periph_reset_disable(RCU_SPI0RST); break; case SPI1: rcu_periph_reset_enable(RCU_SPI1RST); rcu_periph_reset_disable(RCU_SPI1RST); break; case SPI2: rcu_periph_reset_enable(RCU_SPI2RST); rcu_periph_reset_disable(RCU_SPI2RST); break; default : break; } }
liuxuming/trochili
C++
Apache License 2.0
132
/* Writes the current value of MM6. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm6(IN UINT64 Value)
/* Writes the current value of MM6. This function is only available on IA32 and X64. */ VOID EFIAPI AsmWriteMm6(IN UINT64 Value)
{ __asm__ __volatile__ ( "movq %0, %%mm6" : : "m" (Value) ); }
tianocore/edk2
C++
Other
4,240
/* Since we are just checking candidates, don't use any fields other than res->start. */
void pcibios_align_resource(void *data, struct resource *res, resource_size_t size, resource_size_t alignment)
/* Since we are just checking candidates, don't use any fields other than res->start. */ void pcibios_align_resource(void *data, struct resource *res, resource_size_t size, resource_size_t alignment)
{ resource_size_t mask, align; DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n", pci_name(((struct pci_dev *) data)), res->parent, res->start, res->end, (int) res->flags, size, alignment); align = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; mask = max(alignment, align) - 1; res->start += mask; res->start &= ~mask; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This call will fail, if the cap is out of range compared to pre-defined values within the BFA library */
void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev)
/* This call will fail, if the cap is out of range compared to pre-defined values within the BFA library */ void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev)
{ int i; struct bfa_mem_elem_s *melem; bfa->fcs = BFA_FALSE; bfa_assert((cfg != NULL) && (meminfo != NULL)); for (i = 0; i < BFA_MEM_TYPE_MAX; i++) { melem = meminfo->meminfo + i; melem->kva_curp = melem->kva; melem->dma_curp = melem->dma; } bfa_iocfc_attach(bfa, bfad, cfg, meminfo, pcidev); for (i = 0; hal_mods[i]; i++) hal_mods[i]->attach(bfa, bfad, cfg, meminfo, pcidev); }
robutest/uclinux
C++
GPL-2.0
60
/* Function compares a device path data structure to that of all the nodes of a second device path instance. */
BOOLEAN MatchDevicePaths(IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
/* Function compares a device path data structure to that of all the nodes of a second device path instance. */ BOOLEAN MatchDevicePaths(IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
{ EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePathInst; UINTN Size; if ((Multi == NULL) || (Single == NULL)) { return FALSE; } DevicePath = Multi; DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size); while (DevicePathInst != NULL) { if (CompareMem (Single, DevicePathInst, Size) == 0) { FreePool (DevicePathInst); return TRUE; } FreePool (DevicePathInst); DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size); } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Check, if the device can be utilized as broadcast device: */
int tick_check_broadcast_device(struct clock_event_device *dev)
/* Check, if the device can be utilized as broadcast device: */ int tick_check_broadcast_device(struct clock_event_device *dev)
{ if ((tick_broadcast_device.evtdev && tick_broadcast_device.evtdev->rating >= dev->rating) || (dev->features & CLOCK_EVT_FEAT_C3STOP)) return 0; clockevents_exchange_device(NULL, dev); tick_broadcast_device.evtdev = dev; if (!cpumask_empty(tick_get_broadcast_mask())) tick_broadcast_start_periodic(dev); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Fills each InitStruct member with its default value. */
void ISO7816_StructInit(ISO7816_InitType *InitStruct)
/* Fills each InitStruct member with its default value. */ void ISO7816_StructInit(ISO7816_InitType *InitStruct)
{ InitStruct->FirstBit = ISO7816_FIRSTBIT_MSB; InitStruct->Parity = ISO7816_PARITY_EVEN; InitStruct->Baudrate = 9600; InitStruct->TXRetry = ISO7816_TXRTY_0; InitStruct->RXACKLength = ISO7816_RXACKLEN_2; InitStruct->TXNACKLength = ISO7816_TXNACKLEN_0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This has the same sideeffects and return value as iov_iter_copy_from_user_atomic(). The difference is that it attempts to resolve faults. Page must not be locked. */
size_t iov_iter_copy_from_user(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes)
/* This has the same sideeffects and return value as iov_iter_copy_from_user_atomic(). The difference is that it attempts to resolve faults. Page must not be locked. */ size_t iov_iter_copy_from_user(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes)
{ char *kaddr; size_t copied; kaddr = kmap(page); if (likely(i->nr_segs == 1)) { int left; char __user *buf = i->iov->iov_base + i->iov_offset; left = __copy_from_user(kaddr + offset, buf, bytes); copied = bytes - left; } else { copied = __iovec_copy_from_user_inatomic(kaddr + offset, i->iov, i->iov_offset, bytes); } kunmap(page); return copied; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable RMII mode for EMAC, called once after autonegotiate. */
void EMAC_EnableRMII(void)
/* Enable RMII mode for EMAC, called once after autonegotiate. */ void EMAC_EnableRMII(void)
{ AT91C_BASE_EMAC->EMAC_USRIO = AT91C_EMAC_CLKEN | AT91C_EMAC_RMII; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Convert one or more ASCII characters into a single unicode character. Returns the number of ASCII characters corresponding to the unicode char. */
static int asc2unichar(struct super_block *sb, const char *astr, int len, wchar_t *uc)
/* Convert one or more ASCII characters into a single unicode character. Returns the number of ASCII characters corresponding to the unicode char. */ static int asc2unichar(struct super_block *sb, const char *astr, int len, wchar_t *uc)
{ int size = HFSPLUS_SB(sb).nls->char2uni(astr, len, uc); if (size <= 0) { *uc = '?'; size = 1; } switch (*uc) { case 0x2400: *uc = 0; break; case ':': *uc = '/'; break; } return size; }
robutest/uclinux
C++
GPL-2.0
60
/* When the ip_vs_control_clearup is activated by ipvs module exit, the service tables must have been flushed and all the connections are expired, and the refcnt of each destination in the trash must be 1, so we simply release them here. */
static void ip_vs_trash_cleanup(void)
/* When the ip_vs_control_clearup is activated by ipvs module exit, the service tables must have been flushed and all the connections are expired, and the refcnt of each destination in the trash must be 1, so we simply release them here. */ static void ip_vs_trash_cleanup(void)
{ struct ip_vs_dest *dest, *nxt; list_for_each_entry_safe(dest, nxt, &ip_vs_dest_trash, n_list) { list_del(&dest->n_list); ip_vs_dst_reset(dest); __ip_vs_unbind_svc(dest); kfree(dest); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* computes the checksum of the TCP/UDP pseudo-header returns a 16-bit checksum, already complemented. */
__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, unsigned short proto, __wsum sum)
/* computes the checksum of the TCP/UDP pseudo-header returns a 16-bit checksum, already complemented. */ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, unsigned short proto, __wsum sum)
{ return (__force __sum16)~from64to16( (__force u64)saddr + (__force u64)daddr + (__force u64)sum + ((len + proto) << 8)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads and returns the current value of DR1. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadDr1(VOID)
/* Reads and returns the current value of DR1. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ UINTN EFIAPI AsmReadDr1(VOID)
{ UINTN Data; __asm__ __volatile__ ( "movl %%dr1, %0" : "=r" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */
static u8 _scsih_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */ static u8 _scsih_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
{ MPI2DefaultReply_t *mpi_reply; mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); if (ioc->scsih_cmds.status == MPT2_CMD_NOT_USED) return 1; if (ioc->scsih_cmds.smid != smid) return 1; ioc->scsih_cmds.status |= MPT2_CMD_COMPLETE; if (mpi_reply) { memcpy(ioc->scsih_cmds.reply, mpi_reply, mpi_reply->MsgLength*4); ioc->scsih_cmds.status |= MPT2_CMD_REPLY_VALID; } ioc->scsih_cmds.status &= ~MPT2_CMD_PENDING; complete(&ioc->scsih_cmds.done); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the RGB LED power supply line. */
void BOARD_rgbledPowerEnable(bool enable)
/* Enables or disables the RGB LED power supply line. */ void BOARD_rgbledPowerEnable(bool enable)
{ BOARD_picRegBitsSet( BOARD_PIC_REG_LED_CTRL, enable, BOARD_PIC_REG_LED_CTRL_PWR_EN ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* mtd: MTD block structure dat: raw data (unused) ecc_code: buffer for ECC */
static int atmel_nand_calculate(struct mtd_info *mtd, const u_char *dat, unsigned char *ecc_code)
/* mtd: MTD block structure dat: raw data (unused) ecc_code: buffer for ECC */ static int atmel_nand_calculate(struct mtd_info *mtd, const u_char *dat, unsigned char *ecc_code)
{ struct nand_chip *nand_chip = mtd->priv; struct atmel_nand_host *host = nand_chip->priv; unsigned int ecc_value; ecc_value = ecc_readl(host->ecc, PR); ecc_code[0] = ecc_value & 0xFF; ecc_code[1] = (ecc_value >> 8) & 0xFF; ecc_value = ecc_readl(host->ecc, NPR) & ATMEL_ECC_NPARITY; ecc_code[2] = ecc_value & 0xFF; ecc_code[3] = (ecc_value >> 8) & 0xFF; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is called by the upper-layer tty layer to signal that */
static void rs_throttle(struct tty_struct *tty)
/* This routine is called by the upper-layer tty layer to signal that */ static void rs_throttle(struct tty_struct *tty)
{ struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; if (serial_paranoia_check(info, tty->name, "rs_throttle")) return; if (I_IXOFF(tty)) info->x_char = STOP_CHAR(tty); }
robutest/uclinux
C++
GPL-2.0
60
/* Removes I2O controllers from PCI subsystem and shut down OSMs. */
static void __exit i2o_iop_exit(void)
/* Removes I2O controllers from PCI subsystem and shut down OSMs. */ static void __exit i2o_iop_exit(void)
{ i2o_pci_exit(); i2o_exec_exit(); i2o_driver_exit(); }
robutest/uclinux
C++
GPL-2.0
60
/* Get number of items in FIFO. As this function only reads the read and write pointers once, this function is reentrant and thus thread and ISR save without any mutexes. In case an overflow occurred, this function return f.depth at maximum. Overflows are checked and corrected for in the read functions! */
uint16_t tu_fifo_count(tu_fifo_t *f)
/* Get number of items in FIFO. As this function only reads the read and write pointers once, this function is reentrant and thus thread and ISR save without any mutexes. In case an overflow occurred, this function return f.depth at maximum. Overflows are checked and corrected for in the read functions! */ uint16_t tu_fifo_count(tu_fifo_t *f)
{ return tu_min16(_ff_count(f->depth, f->wr_idx, f->rd_idx), f->depth); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Looks for SPDY frame at tvb start. If not enough data for either, requests more via desegment struct. */
static gboolean dissect_spdy_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* Looks for SPDY frame at tvb start. If not enough data for either, requests more via desegment struct. */ static gboolean dissect_spdy_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ guint8 first_byte = tvb_get_guint8(tvb, 0); if (first_byte != 0x80 && first_byte != 0x0) { return FALSE; } if (dissect_spdy(tvb, pinfo, tree, NULL) != 0) { return TRUE; } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330