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
/* unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename. @inode1: first inode @inode2: second inode @inode3: third inode */
static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, struct inode *inode3)
/* unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename. @inode1: first inode @inode2: second inode @inode3: third inode */ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, struct inode *inode3)
{ if (inode3) mutex_unlock(&ubifs_inode(inode3)->ui_mutex); if (inode1 != inode2) mutex_unlock(&ubifs_inode(inode2)->ui_mutex); mutex_unlock(&ubifs_inode(inode1)->ui_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Called with mm->mmap_sem held for writing. Insert a new vma covering the given region, with the given flags. Its pages are supplied by the given array of struct page *. The array can be shorter than len >> PAGE_SHIFT if it's null-terminated. The region past the last page supplied will always produce SIGBUS. The array pointer and the pages it points to are assumed to stay alive for as long as this mapping might exist. */
int install_special_mapping(struct mm_struct *mm, unsigned long addr, unsigned long len, unsigned long vm_flags, struct page **pages)
/* Called with mm->mmap_sem held for writing. Insert a new vma covering the given region, with the given flags. Its pages are supplied by the given array of struct page *. The array can be shorter than len >> PAGE_SHIFT if it's null-terminated. The region past the last page supplied will always produce SIGBUS. The array pointer and the pages it points to are assumed to stay alive for as long as this mapping might exist. */ int install_special_mapping(struct mm_struct *mm, unsigned long addr, unsigned long len, unsigned long vm_flags, struct page **pages)
{ struct vm_area_struct *vma; vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); if (unlikely(vma == NULL)) return -ENOMEM; vma->vm_mm = mm; vma->vm_start = addr; vma->vm_end = addr + len; vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND; vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); vma->vm_ops = &special_mapping_vmops; vma->vm_private_data = pages; if (unlikely(insert_vm_struct(mm, vma))) { kmem_cache_free(vm_area_cachep, vma); return -ENOMEM; } mm->total_vm += len >> PAGE_SHIFT; perf_event_mmap(vma); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function validates interrupt acknowledge address space for type 4 structure. */
STATIC VOID EFIAPI ValidatePccIntAckGas(IN UINT8 *Ptr, IN VOID *Context)
/* This function validates interrupt acknowledge address space for type 4 structure. */ STATIC VOID EFIAPI ValidatePccIntAckGas(IN UINT8 *Ptr, IN VOID *Context)
{ if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) != EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) || ((*ExtendedPccSubspaceInterruptFlags & EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) == EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) { if (IsZeroBuffer ( Ptr, sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE) )) { return; } } ValidatePccGas (Ptr, Context); }
tianocore/edk2
C++
Other
4,240
/* Returns true if there is a scsi end device */
static int mptsas_is_end_device(struct mptsas_devinfo *attached)
/* Returns true if there is a scsi end device */ static int mptsas_is_end_device(struct mptsas_devinfo *attached)
{ if ((attached->sas_address) && (attached->device_info & MPI_SAS_DEVICE_INFO_END_DEVICE) && ((attached->device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET) | (attached->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET) | (attached->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE))) return 1; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The following functions are needed for DMA bouncing. ITE8152 chip can addrees up to 64MByte, so all the devices connected to ITE8152 (PCI and USB) should have limited DMA window Setup DMA mask to 64MB on devices connected to ITE8152. Ignore all other devices. */
static int it8152_pci_platform_notify(struct device *dev)
/* The following functions are needed for DMA bouncing. ITE8152 chip can addrees up to 64MByte, so all the devices connected to ITE8152 (PCI and USB) should have limited DMA window Setup DMA mask to 64MB on devices connected to ITE8152. Ignore all other devices. */ static int it8152_pci_platform_notify(struct device *dev)
{ if (dev->bus == &pci_bus_type) { if (dev->dma_mask) *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET; dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET; dmabounce_register_dev(dev, 2048, 4096); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Displays a closed relative polyline (between many points). */
void LCD_ClosedPolyLineRelative(pPoint Points, uint16_t PointCount)
/* Displays a closed relative polyline (between many points). */ void LCD_ClosedPolyLineRelative(pPoint Points, uint16_t PointCount)
{ LCD_PolyLineRelativeClosed(Points, PointCount, 1); }
avem-labs/Avem
C++
MIT License
1,752
/* Send a master data receive request with an NACK when the master have For this function returns immediately, it is always using in the interrupt hander. */
void I2CMasterReadLastRequestS2(unsigned long ulBase)
/* Send a master data receive request with an NACK when the master have For this function returns immediately, it is always using in the interrupt hander. */ void I2CMasterReadLastRequestS2(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xHWREG(ulBase + I2C_CR) &= ~I2C_CR_AA; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Create an ethernet address from the system serial number. */
static int __init etherm_addr(char *addr)
/* Create an ethernet address from the system serial number. */ static int __init etherm_addr(char *addr)
{ unsigned int serial; if (system_serial_low == 0 && system_serial_high == 0) return -ENODEV; serial = system_serial_low | system_serial_high; addr[0] = 0; addr[1] = 0; addr[2] = 0xa4; addr[3] = 0x10 + (serial >> 24); addr[4] = serial >> 16; addr[5] = serial >> 8; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* allocate an array of pointers of struct page */
static struct page** relay_alloc_page_array(unsigned int n_pages)
/* allocate an array of pointers of struct page */ static struct page** relay_alloc_page_array(unsigned int n_pages)
{ struct page **array; size_t pa_size = n_pages * sizeof(struct page *); if (pa_size > PAGE_SIZE) { array = vmalloc(pa_size); if (array) memset(array, 0, pa_size); } else { array = kzalloc(pa_size, GFP_KERNEL); } return array; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function acknowledges and causes the deassertion of the SMI activation source. */
STATIC EFI_STATUS EFIAPI SmmControl2DxeClear(IN CONST EFI_SMM_CONTROL2_PROTOCOL *This, IN BOOLEAN Periodic OPTIONAL)
/* This function acknowledges and causes the deassertion of the SMI activation source. */ STATIC EFI_STATUS EFIAPI SmmControl2DxeClear(IN CONST EFI_SMM_CONTROL2_PROTOCOL *This, IN BOOLEAN Periodic OPTIONAL)
{ if (Periodic) { return EFI_INVALID_PARAMETER; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Find out if PHY is in copper or serdes mode by looking at Expansion Reg 0x42 - "Operating Mode Status Register" */
static int bcm5482_is_serdes(struct phy_device *phydev)
/* Find out if PHY is in copper or serdes mode by looking at Expansion Reg 0x42 - "Operating Mode Status Register" */ static int bcm5482_is_serdes(struct phy_device *phydev)
{ u16 val; int serdes = 0; phy_write(phydev, MDIO_DEVAD_NONE, MIIM_BCM54XX_EXP_SEL, MIIM_BCM54XX_EXP_SEL_ER | 0x42); val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_BCM54XX_EXP_DATA); switch (val & 0x1f) { case 0x0d: case 0x0e: case 0x0f: case 0x12: case 0x13: case 0x16: serdes = 1; break; case 0x6: case 0x14: case 0x17: break; default: printf("ERROR, invalid PHY mode (0x%x\n)", val); break; } return serdes; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reports the temperature in degrees Fahrenheit. The API is in farenheit. It was designed by an imperial measurement luddite. */
static int wdtpci_get_temperature(int *temperature)
/* Reports the temperature in degrees Fahrenheit. The API is in farenheit. It was designed by an imperial measurement luddite. */ static int wdtpci_get_temperature(int *temperature)
{ unsigned short c; unsigned long flags; spin_lock_irqsave(&wdtpci_lock, flags); c = inb(WDT_RT); udelay(8); spin_unlock_irqrestore(&wdtpci_lock, flags); *temperature = (c * 11 / 15) + 7; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal wrapper to SDL_GetTicks that ensures a non-zero return value. Andreas Schiffler */
Uint32 _getTicks()
/* Internal wrapper to SDL_GetTicks that ensures a non-zero return value. Andreas Schiffler */ Uint32 _getTicks()
{ Uint32 ticks = SDL_GetTicks(); if (ticks == 0) { return 1; } else { return ticks; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Function for gracefully deactivating a write buffer record. This function will first release any buffers, then invalidate the record. */
static void write_buffer_record_release(pdb_buffer_record_t *p_write_buffer_record)
/* Function for gracefully deactivating a write buffer record. This function will first release any buffers, then invalidate the record. */ static void write_buffer_record_release(pdb_buffer_record_t *p_write_buffer_record)
{ for (uint32_t i = 0; i < p_write_buffer_record->n_bufs; i++) { pm_buffer_release(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id + i); } write_buffer_record_invalidate(p_write_buffer_record); }
labapart/polymcu
C++
null
201
/* GMAC programmed with the back off limit value. */
void synopGMAC_back_off_limit(synopGMACdevice *gmacdev, u32 value)
/* GMAC programmed with the back off limit value. */ void synopGMAC_back_off_limit(synopGMACdevice *gmacdev, u32 value)
{ u32 data; data = synopGMACReadReg(gmacdev->MacBase, GmacConfig); data &= (~GmacBackoffLimit); data |= value; synopGMACWriteReg(gmacdev->MacBase, GmacConfig,data); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a Media protocol device path structure to its string representative. */
VOID DevPathToTextMediaProtocol(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a Media protocol device path structure to its string representative. */ VOID DevPathToTextMediaProtocol(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ MEDIA_PROTOCOL_DEVICE_PATH *MediaProt; MediaProt = DevPath; UefiDevicePathLibCatPrint (Str, L"Media(%g)", &MediaProt->Protocol); }
tianocore/edk2
C++
Other
4,240
/* The process that ioc belongs to has exited, we need to clean up and put the internal structures we have that belongs to that process. */
static void cfq_exit_io_context(struct io_context *ioc)
/* The process that ioc belongs to has exited, we need to clean up and put the internal structures we have that belongs to that process. */ static void cfq_exit_io_context(struct io_context *ioc)
{ call_for_each_cic(ioc, cfq_exit_single_io_context); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Init the ADC Interrupt Callback function. param of pfnCallback */
void xADCIntCallbackInit(unsigned long ulBase, xtEventCallback pfnCallback)
/* Init the ADC Interrupt Callback function. param of pfnCallback */ void xADCIntCallbackInit(unsigned long ulBase, xtEventCallback pfnCallback)
{ xASSERT(ulBase == xADC0_BASE); g_pfnADCHandlerCallbacks[0] = pfnCallback; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This file is released under the GNU GPL v2. */
static int umc_bus_pre_reset_helper(struct device *dev, void *data)
/* This file is released under the GNU GPL v2. */ static int umc_bus_pre_reset_helper(struct device *dev, void *data)
{ int ret = 0; if (dev->driver) { struct umc_dev *umc = to_umc_dev(dev); struct umc_driver *umc_drv = to_umc_driver(dev->driver); if (umc_drv->pre_reset) ret = umc_drv->pre_reset(umc); else device_release_driver(dev); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Set Click Window value. you can use this function to set click Window value. */
Result LIS302DLClickWindowSet(uint8_t Window)
/* Set Click Window value. you can use this function to set click Window value. */ Result LIS302DLClickWindowSet(uint8_t Window)
{ Result retv = SUCCESS; retv = LIS302DLRegWriteByte(CLICK_WINDOW, Window); if(retv != SUCCESS) { return (FAILURE); } return (SUCCESS); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Converts all the characters in a Null-terminated string to lower case characters. */
VOID EFIAPI EngStrLwr(IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN OUT CHAR16 *Str)
/* Converts all the characters in a Null-terminated string to lower case characters. */ VOID EFIAPI EngStrLwr(IN EFI_UNICODE_COLLATION_PROTOCOL *This, IN OUT CHAR16 *Str)
{ while (*Str != 0) { *Str = TO_LOWER (*Str); Str += 1; } }
tianocore/edk2
C++
Other
4,240
/* Selects the TIMx peripheral Capture Compare DMA source. */
void TIM_SelectCCDMA(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Selects the TIMx peripheral Capture Compare DMA source. */ void TIM_SelectCCDMA(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR2 |= TIM_CR2_CCDS; } else { TIMx->CR2 &= (uint16_t)~((uint16_t)TIM_CR2_CCDS); } }
avem-labs/Avem
C++
MIT License
1,752
/* Locates a section within a series of sections with the specified section type. */
EFI_STATUS FindFfsSectionInSections(IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
/* Locates a section within a series of sections with the specified section type. */ EFI_STATUS FindFfsSectionInSections(IN VOID *Sections, IN UINTN SizeOfSections, IN EFI_SECTION_TYPE SectionType, OUT EFI_COMMON_SECTION_HEADER **FoundSection)
{ return FindFfsSectionInstance ( Sections, SizeOfSections, SectionType, 0, FoundSection ); }
tianocore/edk2
C++
Other
4,240
/* Attempt to pre-fault in the user memory, so we can use atomic copies. Returns the number of bytes not faulted in. */
static int iov_fault_in_pages_write(struct iovec *iov, unsigned long len)
/* Attempt to pre-fault in the user memory, so we can use atomic copies. Returns the number of bytes not faulted in. */ static int iov_fault_in_pages_write(struct iovec *iov, unsigned long len)
{ while (!iov->iov_len) iov++; while (len > 0) { unsigned long this_len; this_len = min_t(unsigned long, len, iov->iov_len); if (fault_in_pages_writeable(iov->iov_base, this_len)) break; len -= this_len; iov++; } return len; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal worker function that returns a pointer to the */
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT* LookupPeriodicSmiLibraryHandler(IN EFI_HANDLE DispatchHandle OPTIONAL)
/* Internal worker function that returns a pointer to the */ PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT* LookupPeriodicSmiLibraryHandler(IN EFI_HANDLE DispatchHandle OPTIONAL)
{ LIST_ENTRY *Link; PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler; if (DispatchHandle == NULL) { return GetActivePeriodicSmiLibraryHandler (); } for ( Link = GetFirstNode (&gPeriodicSmiLibraryHandlers) ; !IsNull (&gPeriodicSmiLibraryHandlers, Link) ; Link = GetNextNode (&gPeriodicSmiLibraryHandlers, Link) ) { PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link); if (PeriodicSmiLibraryHandler->DispatchHandle == DispatchHandle) { return PeriodicSmiLibraryHandler; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* 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 teles_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 teles_detach(struct pcmcia_device *p_dev)
{ local_info_t *info = link->priv; dev_dbg(&link->dev, "teles_detach(0x%p)\n", link); info->busy = 1; teles_cs_release(link); kfree(info); }
robutest/uclinux
C++
GPL-2.0
60
/* Handling of System V filesystem fast symlinks extensions. Aug 2001, Christoph Hellwig ( */
static void* sysv_follow_link(struct dentry *dentry, struct nameidata *nd)
/* Handling of System V filesystem fast symlinks extensions. Aug 2001, Christoph Hellwig ( */ static void* sysv_follow_link(struct dentry *dentry, struct nameidata *nd)
{ nd_set_link(nd, (char *)SYSV_I(dentry->d_inode)->i_data); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* The caller is responsible for passing down meta_ac if we'll need it. */
int ocfs2_mark_extent_written(struct inode *inode, struct ocfs2_extent_tree *et, handle_t *handle, u32 cpos, u32 len, u32 phys, struct ocfs2_alloc_context *meta_ac, struct ocfs2_cached_dealloc_ctxt *dealloc)
/* The caller is responsible for passing down meta_ac if we'll need it. */ int ocfs2_mark_extent_written(struct inode *inode, struct ocfs2_extent_tree *et, handle_t *handle, u32 cpos, u32 len, u32 phys, struct ocfs2_alloc_context *meta_ac, struct ocfs2_cached_dealloc_ctxt *dealloc)
{ int ret; mlog(0, "Inode %lu cpos %u, len %u, phys clusters %u\n", inode->i_ino, cpos, len, phys); if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) { ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents " "that are being written to, but the feature bit " "is not set in the super block.", (unsigned long long)OCFS2_I(inode)->ip_blkno); ret = -EROFS; goto out; } ocfs2_et_extent_map_truncate(et, 0); ret = ocfs2_change_extent_flag(handle, et, cpos, len, phys, meta_ac, dealloc, 0, OCFS2_EXT_UNWRITTEN); if (ret) mlog_errno(ret); out: return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Called just before shutdown in order to provide a clean exec environment in case the system is rebooting. No locking because that would cause a pointless shutdown hang if something hadn't released the lock. */
int deactivate_all_fds(void)
/* Called just before shutdown in order to provide a clean exec environment in case the system is rebooting. No locking because that would cause a pointless shutdown hang if something hadn't released the lock. */ int deactivate_all_fds(void)
{ struct irq_fd *irq; int err; for (irq = active_fds; irq != NULL; irq = irq->next) { err = os_clear_fd_async(irq->fd); if (err) return err; } os_set_ioignore(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Changes the value of a PHY register by applying a mask to its current value and ORing the result with a new value. */
int t3_mdio_change_bits(struct cphy *phy, int mmd, int reg, unsigned int clear, unsigned int set)
/* Changes the value of a PHY register by applying a mask to its current value and ORing the result with a new value. */ int t3_mdio_change_bits(struct cphy *phy, int mmd, int reg, unsigned int clear, unsigned int set)
{ int ret; unsigned int val; ret = t3_mdio_read(phy, mmd, reg, &val); if (!ret) { val &= ~clear; ret = t3_mdio_write(phy, mmd, reg, val | set); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Prepare controller for a transaction and call omap_i2c_xfer_msg to do the work during IRQ processing. */
static int omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
/* Prepare controller for a transaction and call omap_i2c_xfer_msg to do the work during IRQ processing. */ static int omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{ struct omap_i2c_dev *dev = i2c_get_adapdata(adap); int i; int r; omap_i2c_unidle(dev); r = omap_i2c_wait_for_bb(dev); if (r < 0) goto out; for (i = 0; i < num; i++) { r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1))); if (r != 0) break; } if (r == 0) r = num; out: omap_i2c_idle(dev); return r; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or Disables the one pulse immediate active function. The */
void TimerCHConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulControl)
/* Enables or Disables the one pulse immediate active function. The */ void TimerCHConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulControl)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulChannel == TIMER_CH_0) || (ulChannel == TIMER_CH_1) || (ulChannel == TIMER_CH_2) || (ulChannel == TIMER_CH_3)); xASSERT((ulControl == TIMER_CHCTL_DISABLE) || (ulControl == TIMER_CHCTL_ENABLE)); xHWREG(ulBase + TIMER_CHCTR) &= ~(1 << (ulChannel * 2)); xHWREG(ulBase + TIMER_CHCTR) |= (ulControl << (ulChannel * 2)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* clk_set_rate - set the clock rate for a clock source */
int clk_set_rate(struct clk *clk, unsigned long rate)
/* clk_set_rate - set the clock rate for a clock source */ int clk_set_rate(struct clk *clk, unsigned long rate)
{ if (clk->clk_set_rate) return clk->clk_set_rate(clk, rate); else return -EINVAL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: TRUE if the @drive is capabable of automatically detecting media changes, FALSE otherwise. */
gboolean g_drive_is_media_check_automatic(GDrive *drive)
/* Returns: TRUE if the @drive is capabable of automatically detecting media changes, FALSE otherwise. */ gboolean g_drive_is_media_check_automatic(GDrive *drive)
{ GDriveIface *iface; g_return_val_if_fail (G_IS_DRIVE (drive), FALSE); iface = G_DRIVE_GET_IFACE (drive); return (* iface->is_media_check_automatic) (drive); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reads a buffer of data from the emulated EEPROM memory space. Reads a buffer of data from a section of emulated EEPROM memory space. The destination buffer may be of any size, and the source may lie outside of an emulated EEPROM page boundary. */
enum status_code eeprom_emulator_read_buffer(const uint16_t offset, uint8_t *const data, const uint16_t length)
/* Reads a buffer of data from the emulated EEPROM memory space. Reads a buffer of data from a section of emulated EEPROM memory space. The destination buffer may be of any size, and the source may lie outside of an emulated EEPROM page boundary. */ enum status_code eeprom_emulator_read_buffer(const uint16_t offset, uint8_t *const data, const uint16_t length)
{ enum status_code error_code; uint8_t buffer[EEPROM_PAGE_SIZE]; uint8_t logical_page = offset / EEPROM_PAGE_SIZE; uint16_t c = offset; error_code = eeprom_emulator_read_page(logical_page, buffer); if (error_code != STATUS_OK) { return error_code; } if ((offset % EEPROM_PAGE_SIZE) == 0) { data[0] = buffer[0]; c=c+1; } for (; c < (length + offset); c++) { if ((c % EEPROM_PAGE_SIZE) == 0) { logical_page++; error_code = eeprom_emulator_read_page(logical_page, buffer); if (error_code != STATUS_OK) { return error_code; } } data[c - offset] = buffer[c % EEPROM_PAGE_SIZE]; } return error_code; }
memfault/zero-to-main
C++
null
200
/* Local function to send a command to the USB protocol engine and read data */
static unsigned char USBHwCmdRead(unsigned char bCmd)
/* Local function to send a command to the USB protocol engine and read data */ static unsigned char USBHwCmdRead(unsigned char bCmd)
{ USBHwCmd(bCmd); USB->USBCmdCode = 0x00000200 | (bCmd << 16); Wait4DevInt(CDFULL); return USB->USBCmdData; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* SRC (8bit) = SRC DST (16bit) = SRC */
void transfer_8to16copy_c(int16_t *const dst, const uint8_t *const src, uint32_t stride)
/* SRC (8bit) = SRC DST (16bit) = SRC */ void transfer_8to16copy_c(int16_t *const dst, const uint8_t *const src, uint32_t stride)
{ int i, j; for (j = 0; j < 8; j++) { for (i = 0; i < 8; i++) { dst[j * 8 + i] = (int16_t) src[j * stride + i]; } } }
DC-SWAT/DreamShell
C++
null
404
/* Set the current coordinates of the cursor position. */
VOID EFIAPI SetCursorPosition(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut, IN UINTN Column, IN INTN Row, IN UINTN LineLength, IN UINTN TotalRow, IN CHAR16 *Str, IN UINTN StrPos, IN UINTN Len)
/* Set the current coordinates of the cursor position. */ VOID EFIAPI SetCursorPosition(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut, IN UINTN Column, IN INTN Row, IN UINTN LineLength, IN UINTN TotalRow, IN CHAR16 *Str, IN UINTN StrPos, IN UINTN Len)
{ CHAR16 Backup; ASSERT (ConOut != NULL); ASSERT (Str != NULL); Backup = 0; if (Row >= 0) { ConOut->SetCursorPosition (ConOut, Column, Row); return; } if (Len - StrPos > Column * Row) { Backup = *(Str + StrPos + Column * Row); *(Str + StrPos + Column * Row) = 0; } EDBPrint (L"%s", Str + StrPos); if (Len - StrPos > Column * Row) { *(Str + StrPos + Column * Row) = Backup; } ConOut->SetCursorPosition (ConOut, 0, 0); }
tianocore/edk2
C++
Other
4,240
/* Sets the attribute to contain the value @obj. The @attr references the GObject internally. */
void _g_file_attribute_value_set_object(GFileAttributeValue *attr, GObject *obj)
/* Sets the attribute to contain the value @obj. The @attr references the GObject internally. */ void _g_file_attribute_value_set_object(GFileAttributeValue *attr, GObject *obj)
{ g_return_if_fail (attr != NULL); g_return_if_fail (obj != NULL); _g_file_attribute_value_clear (attr); attr->type = G_FILE_ATTRIBUTE_TYPE_OBJECT; attr->u.obj = g_object_ref (obj); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Arguments : s - channel number addr - destination IP Address port - destination Port Number Returns : when succeeded : 1, failed : -1 Note : API Function */
char NBconnect(SOCKET s, u_char far *addr, u_int port)
/* Arguments : s - channel number addr - destination IP Address port - destination Port Number Returns : when succeeded : 1, failed : -1 Note : API Function */ char NBconnect(SOCKET s, u_char far *addr, u_int port)
{ if (port != 0) { WRITE_VALUE(DST_PORT_PTR(s), (u_char) ((port & 0xff00) >> 8) ); WRITE_VALUE(DST_PORT_PTR(s) + SA_OFFSET(1), (u_char)(port & 0x00ff)); } else return(-1); WRITE_VALUE(DST_IP_PTR(s), addr[0]); WRITE_VALUE(DST_IP_PTR(s) + SA_OFFSET(1), addr[1]); WRITE_VALUE(DST_IP_PTR(s) + SA_OFFSET(2), addr[2]); WRITE_VALUE(DST_IP_PTR(s) + SA_OFFSET(3), addr[3]); I_STATUS[s] = 0; WRITE_VALUE(COMMAND(s), CCONNECT); return(1); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* When someone calls kthread_stop() on your kthread, it will be woken and this will return true. You should then return, and your return value will be passed through to kthread_stop(). */
int kthread_should_stop(void)
/* When someone calls kthread_stop() on your kthread, it will be woken and this will return true. You should then return, and your return value will be passed through to kthread_stop(). */ int kthread_should_stop(void)
{ return to_kthread(current)->should_stop; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: the element's data, or NULL if the position is off the end of the #GList */
gpointer g_list_nth_data(GList *list, guint n)
/* Returns: the element's data, or NULL if the position is off the end of the #GList */ gpointer g_list_nth_data(GList *list, guint n)
{ while ((n-- > 0) && list) list = list->next; return list ? list->data : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Calculates the checksum of the header of a file. The header is a zero byte checksum, so zero means header is good */
STATIC UINT8 CalculateHeaderChecksum(IN EFI_FFS_FILE_HEADER *FileHeader)
/* Calculates the checksum of the header of a file. The header is a zero byte checksum, so zero means header is good */ STATIC UINT8 CalculateHeaderChecksum(IN EFI_FFS_FILE_HEADER *FileHeader)
{ UINT8 Sum; Sum = CalculateSum8 ((CONST VOID *)FileHeader, sizeof (EFI_FFS_FILE_HEADER)); Sum = (UINT8)(Sum - FileHeader->State); Sum = (UINT8)(Sum - FileHeader->IntegrityCheck.Checksum.File); return Sum; }
tianocore/edk2
C++
Other
4,240
/* Check if RTC compare match has occurred. Checks the compare flag to see if a match has occurred. The compare flag is set when there is a compare match between counter and the compare. */
bool rtc_count_is_compare_match(struct rtc_module *const module, const enum rtc_count_compare comp_index)
/* Check if RTC compare match has occurred. Checks the compare flag to see if a match has occurred. The compare flag is set when there is a compare match between counter and the compare. */ bool rtc_count_is_compare_match(struct rtc_module *const module, const enum rtc_count_compare comp_index)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; switch (module->mode) { case RTC_COUNT_MODE_32BIT: if (comp_index > RTC_NUM_OF_COMP32) { return false; } break; case RTC_COUNT_MODE_16BIT: if (comp_index > RTC_NUM_OF_COMP16) { return false; } break; default: Assert(false); return false; } return (rtc_module->MODE0.INTFLAG.reg & (1 << comp_index)) ? true : false; }
memfault/zero-to-main
C++
null
200
/* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you are in atomic context. */
static int i2400mu_pre_reset(struct usb_interface *iface)
/* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you are in atomic context. */ static int i2400mu_pre_reset(struct usb_interface *iface)
{ struct i2400mu *i2400mu = usb_get_intfdata(iface); return i2400m_pre_reset(&i2400mu->i2400m); }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves the USB Ethernet Bulk transfer data size. */
EFI_STATUS EFIAPI UsbEthEcmBulkSize(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT UINTN *BulkSize)
/* Retrieves the USB Ethernet Bulk transfer data size. */ EFI_STATUS EFIAPI UsbEthEcmBulkSize(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT UINTN *BulkSize)
{ EFI_STATUS Status; USB_ETHERNET_FUN_DESCRIPTOR UsbEthFunDescriptor; Status = This->UsbEthFunDescriptor (This, &UsbEthFunDescriptor); if (EFI_ERROR (Status)) { return Status; } *BulkSize = (UINTN)UsbEthFunDescriptor.MaxSegmentSize; return Status; }
tianocore/edk2
C++
Other
4,240
/* Configure the current time and date and activate Tamper. */
void Configure_RTC_Tamper(void)
/* Configure the current time and date and activate Tamper. */ void Configure_RTC_Tamper(void)
{ LL_RTC_TAMPER_EnableActiveLevel(RTC, LL_RTC_TAMPER_ACTIVELEVEL_TAMP1); LL_RTC_TAMPER_Enable(RTC, LL_RTC_TAMPER_1); LL_RTC_EnableIT_TAMP(RTC); NVIC_SetPriority(TAMP_STAMP_IRQn, 0x0F); NVIC_EnableIRQ(TAMP_STAMP_IRQn); LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_21); LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_21); LL_RTC_ClearFlag_TAMP1(RTC); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Stops the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Stop(USBH_HandleTypeDef *phost)
/* Stops the Low Level portion of the Host driver. */ USBH_StatusTypeDef USBH_LL_Stop(USBH_HandleTypeDef *phost)
{ HAL_HCD_Stop(phost->pData); return USBH_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* The code in this function is based on the code from */
unsigned long lcd_clk_get_rate(struct clk *clk)
/* The code in this function is based on the code from */ unsigned long lcd_clk_get_rate(struct clk *clk)
{ u32 tmp, div, rate; tmp = __raw_readl(LPC178X_LCD_BASE + CLCD_TIM2); rate = lpc178x_clock_get(CLOCK_CCLK); if (!(tmp & TIM2_BCD)) { div = (tmp & 0x1F) | ((tmp & 0xF8) >> 22); rate /= (2 + div); } return rate; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* atl2_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void atl2_tx_timeout(struct net_device *netdev)
/* atl2_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */ static void atl2_tx_timeout(struct net_device *netdev)
{ struct atl2_adapter *adapter = netdev_priv(netdev); schedule_work(&adapter->reset_task); }
robutest/uclinux
C++
GPL-2.0
60
/* Set up the DMA functionality on the ALi 15x3. */
static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, const struct ide_port_info *d)
/* Set up the DMA functionality on the ALi 15x3. */ static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, const struct ide_port_info *d)
{ struct pci_dev *dev = to_pci_dev(hwif->dev); unsigned long base = ide_pci_dma_base(hwif, d); if (base == 0) return -1; hwif->dma_base = base; if (ide_pci_check_simplex(hwif, d) < 0) return -1; if (ide_pci_set_master(dev, d->name) < 0) return -1; if (!hwif->channel) outb(inb(base + 2) & 0x60, base + 2); printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx\n", hwif->name, base, base + 7); if (ide_allocate_dma_engine(hwif)) return -1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* NOTE: Only use this internally. Assumes correctly-sized buffers. */
STATIC VOID PopulateCommonData(OUT VARIABLE_POLICY_ENTRY *EntPtr, IN CONST EFI_GUID *Namespace, IN UINT32 MinSize, IN UINT32 MaxSize, IN UINT32 AttributesMustHave, IN UINT32 AttributesCantHave, IN UINT8 LockPolicyType)
/* NOTE: Only use this internally. Assumes correctly-sized buffers. */ STATIC VOID PopulateCommonData(OUT VARIABLE_POLICY_ENTRY *EntPtr, IN CONST EFI_GUID *Namespace, IN UINT32 MinSize, IN UINT32 MaxSize, IN UINT32 AttributesMustHave, IN UINT32 AttributesCantHave, IN UINT8 LockPolicyType)
{ EntPtr->Version = VARIABLE_POLICY_ENTRY_REVISION; CopyGuid (&EntPtr->Namespace, Namespace); EntPtr->MinSize = MinSize; EntPtr->MaxSize = MaxSize; EntPtr->AttributesMustHave = AttributesMustHave; EntPtr->AttributesCantHave = AttributesCantHave; EntPtr->LockPolicyType = LockPolicyType; if (EntPtr->MaxSize == 0) { EntPtr->MaxSize = VARIABLE_POLICY_NO_MAX_SIZE; } return; }
tianocore/edk2
C++
Other
4,240
/* Description: Reduces the speed/duplex settings by one notch, in this order */
static void phy_force_reduction(struct phy_device *phydev)
/* Description: Reduces the speed/duplex settings by one notch, in this order */ static void phy_force_reduction(struct phy_device *phydev)
{ int idx; idx = phy_find_setting(phydev->speed, phydev->duplex); idx++; idx = phy_find_valid(idx, phydev->supported); phydev->speed = settings[idx].speed; phydev->duplex = settings[idx].duplex; pr_info("Trying %d/%s\n", phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF"); }
robutest/uclinux
C++
GPL-2.0
60
/* @i2400m: device descriptor @roq: Reorder queue @sn: New sequence number */
static void i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq, unsigned sn)
/* @i2400m: device descriptor @roq: Reorder queue @sn: New sequence number */ static void i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq, unsigned sn)
{ struct device *dev = i2400m_dev(i2400m); unsigned old_ws, nsn, len; d_fnstart(2, dev, "(i2400m %p roq %p sn %u)\n", i2400m, roq, sn); old_ws = roq->ws; len = skb_queue_len(&roq->queue); nsn = __i2400m_roq_update_ws(i2400m, roq, sn); i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_WS, old_ws, len, sn, nsn, roq->ws); d_fnstart(2, dev, "(i2400m %p roq %p sn %u) = void\n", i2400m, roq, sn); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Write hexadecimal number on numeric part on Segment LCD display. */
void SegmentLCD_UnsignedHex(uint16_t value)
/* Write hexadecimal number on numeric part on Segment LCD display. */ void SegmentLCD_UnsignedHex(uint16_t value)
{ int num, i, com, bit, digit; uint16_t bitpattern; if (value >= 0xffff) { value = 0xffff; } LCD_SyncBusyDelay(0xFFFFFFFF); LCD_FreezeEnable(true); SegmentLCD_NumberOff(); for (digit = 0; digit < 4; digit++) { num = (value >> (4 * digit)) & 0x0f; bitpattern = EFM_Numbers[num]; for (i = 0; i < 7; i++) { bit = EFM_Display.Number[digit].bit[i]; com = EFM_Display.Number[digit].com[i]; if (bitpattern & (1 << i)) { LCD_SegmentSet(com, bit, true); } } } LCD_FreezeEnable(false); }
remotemcu/remcu-chip-sdks
C++
null
436
/* read data from multiple blocks of nand flash */
uint32_t flash_read_multi_blocks(uint8_t *pBuf, uint32_t read_addr, uint16_t block_size, uint32_t block_num)
/* read data from multiple blocks of nand flash */ uint32_t flash_read_multi_blocks(uint8_t *pBuf, uint32_t read_addr, uint16_t block_size, uint32_t block_num)
{ uint32_t i; uint8_t *pSource = (uint8_t *)(read_addr + NAND_FLASH_BASE_ADDRESS); while (block_num--) { for (i = 0; i < block_size; i++) { *pBuf++ = *pSource++; } } return 0; }
liuxuming/trochili
C++
Apache License 2.0
132
/* fast_sha256_vector - SHA256 hash for data vector @num_elem: Number of elements in the data vector @addr: Pointers to the data areas @len: Lengths of the data blocks @mac: Buffer for the hash Returns: 0 on success, -1 of failure */
int fast_sha256_vector(size_t num_elem, const uint8_t *addr[], const size_t *len, uint8_t *mac)
/* fast_sha256_vector - SHA256 hash for data vector @num_elem: Number of elements in the data vector @addr: Pointers to the data areas @len: Lengths of the data blocks @mac: Buffer for the hash Returns: 0 on success, -1 of failure */ int fast_sha256_vector(size_t num_elem, const uint8_t *addr[], const size_t *len, uint8_t *mac)
{ int ret = 0; mbedtls_sha256_context ctx; mbedtls_sha256_init(&ctx); if (mbedtls_sha256_starts_ret(&ctx, 0) != 0) { ret = -1; goto out; } for(size_t index = 0; index < num_elem; index++) { if (mbedtls_sha256_update_ret(&ctx, addr[index], len[index]) != 0) { ret = -1; goto out; } } if (mbedtls_sha256_finish_ret(&ctx, mac) != 0) { ret = -1; goto out; } out: mbedtls_sha256_free(&ctx); return ret; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Program an 8 bit Byte to FLASH. This performs all operations necessary to program an 8 bit byte to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased. */
void flash_program_byte(uint32_t address, uint8_t data)
/* Program an 8 bit Byte to FLASH. This performs all operations necessary to program an 8 bit byte to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased. */ void flash_program_byte(uint32_t address, uint8_t data)
{ flash_wait_for_last_operation(); flash_set_program_size(FLASH_CR_PROGRAM_X8); FLASH_CR |= FLASH_CR_PG; MMIO8(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PG; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* ADC Read the End-of-Conversion Flag. This flag is set by hardware at the end of each regular conversion of a channel when a new data is available in the ADCx_DR register. */
bool adc_eoc(uint32_t adc)
/* ADC Read the End-of-Conversion Flag. This flag is set by hardware at the end of each regular conversion of a channel when a new data is available in the ADCx_DR register. */ bool adc_eoc(uint32_t adc)
{ return ADC_ISR(adc) & ADC_ISR_EOC; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Set the ITG-3200 sample rate. The internal sampling rate is 1KHz for all filter bandwidths except 256Hz, which uses an 8KHz internal rate. */
static bool itg3200_set_sample_rate(sensor_hal_t *hal, int16_t rate)
/* Set the ITG-3200 sample rate. The internal sampling rate is 1KHz for all filter bandwidths except 256Hz, which uses an 8KHz internal rate. */ static bool itg3200_set_sample_rate(sensor_hal_t *hal, int16_t rate)
{ uint16_t internal_rate; uint8_t divider; if (hal->bandwidth == 256) { internal_rate = 8000; } else { internal_rate = 1000; } divider = (internal_rate / rate) - 1; sensor_bus_put(hal, ITG3200_SMPLRT_DIV, divider); return true; }
memfault/zero-to-main
C++
null
200
/* Tries to drain stocked charges in other cpus. This function is asynchronous and just put a work per cpu for draining localy on each cpu. Caller can expects some charges will be back to res_counter later but cannot wait for it. */
static void drain_all_stock_async(void)
/* Tries to drain stocked charges in other cpus. This function is asynchronous and just put a work per cpu for draining localy on each cpu. Caller can expects some charges will be back to res_counter later but cannot wait for it. */ static void drain_all_stock_async(void)
{ int cpu; if (atomic_read(&memcg_drain_count)) return; atomic_inc(&memcg_drain_count); get_online_cpus(); for_each_online_cpu(cpu) { struct memcg_stock_pcp *stock = &per_cpu(memcg_stock, cpu); schedule_work_on(cpu, &stock->work); } put_online_cpus(); atomic_dec(&memcg_drain_count); }
robutest/uclinux
C++
GPL-2.0
60
/* Return -1 for error and 0 for success. */
int iw_scan(int skfd, char *ifname, int we_version, wireless_scan_head *context)
/* Return -1 for error and 0 for success. */ int iw_scan(int skfd, char *ifname, int we_version, wireless_scan_head *context)
{ int delay; context->result = NULL; context->retry = 0; while(1) { delay = iw_process_scan(skfd, ifname, we_version, context); if(delay <= 0) break; usleep(delay * 1000); } return(delay); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group. When the Boot Manager is about to load and execute a boot option, it reclaims variable storage if free size is below the threshold. */
VOID EFIAPI OnReadyToBoot(EFI_EVENT Event, VOID *Context)
/* This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group. When the Boot Manager is about to load and execute a boot option, it reclaims variable storage if free size is below the threshold. */ VOID EFIAPI OnReadyToBoot(EFI_EVENT Event, VOID *Context)
{ EFI_STATUS Status; if (!mEndOfDxe) { MorLockInitAtEndOfDxe (); Status = LockVariablePolicy (); ASSERT_EFI_ERROR (Status); mEndOfDxe = TRUE; mVarCheckAddressPointer = VarCheckLibInitializeAtEndOfDxe (&mVarCheckAddressPointerCount); InitializeVariableQuota (); } ReclaimForOS (); if (FeaturePcdGet (PcdVariableCollectStatistics)) { if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { gBS->InstallConfigurationTable (&gEfiAuthenticatedVariableGuid, gVariableInfo); } else { gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo); } } gBS->CloseEvent (Event); }
tianocore/edk2
C++
Other
4,240
/* This routine is invoked to stop an SLI3 device port, it stops the device from generating interrupts and stops the device driver's timers for the device. */
static void lpfc_stop_port_s3(struct lpfc_hba *phba)
/* This routine is invoked to stop an SLI3 device port, it stops the device from generating interrupts and stops the device driver's timers for the device. */ static void lpfc_stop_port_s3(struct lpfc_hba *phba)
{ writel(0, phba->HCregaddr); readl(phba->HCregaddr); writel(0xffffffff, phba->HAregaddr); readl(phba->HAregaddr); lpfc_stop_hba_timers(phba); phba->pport->work_port_events = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Cycles a rainbow over the entire string of LEDs. */
static int ws2812_effects_mode_rainbow_cycle(int repeat_count)
/* Cycles a rainbow over the entire string of LEDs. */ static int ws2812_effects_mode_rainbow_cycle(int repeat_count)
{ uint16_t wheel_index = (i * 360 / buffer->npix * repeat_count) % 360; uint32_t color = color_wheel(wheel_index); uint8_t r = ((color & 0x00FF0000) >> 16) * state->brightness / BRIGHTNESS_MAX; uint8_t g = ((color & 0x0000FF00) >> 8) * state->brightness / BRIGHTNESS_MAX; uint8_t b = ((color & 0x000000FF) >> 0) * state->brightness / BRIGHTNESS_MAX; *p++ = g; *p++ = r; *p++ = b; for (j = 3; j < pixbuf_channels(buffer); j++) { *p++ = 0; } } return 0; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Find a file from its absolute path on an UDF volume. */
EFI_STATUS GetFileSize(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_FILE_INFO *File, OUT UINT64 *Size)
/* Find a file from its absolute path on an UDF volume. */ EFI_STATUS GetFileSize(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_FILE_INFO *File, OUT UINT64 *Size)
{ EFI_STATUS Status; UDF_READ_FILE_INFO ReadFileInfo; ReadFileInfo.Flags = ReadFileGetFileSize; Status = ReadFile ( BlockIo, DiskIo, Volume, &File->FileIdentifierDesc->Icb, File->FileEntry, &ReadFileInfo ); if (EFI_ERROR (Status)) { return Status; } *Size = ReadFileInfo.ReadLength; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Set the vector field in the specified RTE. This associates an IRQ with the desired vector in the IDT. */
__boot_func void z_loapic_int_vec_set(unsigned int irq, unsigned int vector)
/* Set the vector field in the specified RTE. This associates an IRQ with the desired vector in the IDT. */ __boot_func void z_loapic_int_vec_set(unsigned int irq, unsigned int vector)
{ unsigned int oldLevel; oldLevel = irq_lock(); x86_write_loapic(LOAPIC_TIMER + (irq * 0x10), (x86_read_loapic(LOAPIC_TIMER + (irq * 0x10)) & ~LOAPIC_VECTOR) | vector); irq_unlock(oldLevel); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* When the WIZnet device asserts an interrupt we send an (empty) message to the TCP task. This wakes the task so the interrupt can be processed. The source of the interrupt has to be ascertained by the TCP task as this requires an I2C transaction which cannot be performed from this ISR. Note this code predates the introduction of semaphores, a semaphore should be used in place of the empty queue message. */
void vEINT0_ISR_Wrapper(void vEINT0_ISR_Handler void)
/* When the WIZnet device asserts an interrupt we send an (empty) message to the TCP task. This wakes the task so the interrupt can be processed. The source of the interrupt has to be ascertained by the TCP task as this requires an I2C transaction which cannot be performed from this ISR. Note this code predates the introduction of semaphores, a semaphore should be used in place of the empty queue message. */ void vEINT0_ISR_Wrapper(void vEINT0_ISR_Handler void)
{ extern xQueueHandle xTCPISRQueue; portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR( xTCPISRQueue, ( void * ) &lDummyVariable, &xHigherPriorityTaskWoken ); VICIntEnClear |= tcpEINT0_VIC_CHANNEL_BIT; VICVectAddr = tcpCLEAR_VIC_INTERRUPT; if( xHigherPriorityTaskWoken ) { portYIELD_FROM_ISR(); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Starts playing audio stream from a data buffer for a determined size. */
uint32_t EVAL_AUDIO_Play(uint16_t *pBuffer, uint32_t Size)
/* Starts playing audio stream from a data buffer for a determined size. */ uint32_t EVAL_AUDIO_Play(uint16_t *pBuffer, uint32_t Size)
{ AudioTotalSize = Size; Codec_Play(); Audio_MAL_Play((uint32_t)pBuffer, (uint32_t)(DMA_MAX(Size/4))); AudioRemSize = (Size/2) - DMA_MAX(AudioTotalSize); CurrentPos = pBuffer + DMA_MAX(AudioTotalSize); return 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* ibmvfc_get_ae_desc - Get text description for async event @ae: async event */
static const char* ibmvfc_get_ae_desc(u64 ae)
/* ibmvfc_get_ae_desc - Get text description for async event @ae: async event */ static const char* ibmvfc_get_ae_desc(u64 ae)
{ int i; for (i = 0; i < ARRAY_SIZE(ae_desc); i++) if (ae_desc[i].ae == ae) return ae_desc[i].desc; return unknown_ae; }
robutest/uclinux
C++
GPL-2.0
60
/* Compute first and last byte offsets for the fields given. Interprets the offsets table, which contains struct field offsets. */
void xfs_btree_offsets(__int64_t fields, const short *offsets, int nbits, int *first, int *last)
/* Compute first and last byte offsets for the fields given. Interprets the offsets table, which contains struct field offsets. */ void xfs_btree_offsets(__int64_t fields, const short *offsets, int nbits, int *first, int *last)
{ int i; __int64_t imask; ASSERT(fields != 0); for (i = 0, imask = 1LL; ; i++, imask <<= 1) { if (imask & fields) { *first = offsets[i]; break; } } for (i = nbits - 1, imask = 1LL << i; ; i--, imask >>= 1) { if (imask & fields) { *last = offsets[i + 1] - 1; break; } } }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the I2C Bus Timeout B (SCL cumulative Timeout). */
void I2C_TimeoutBConfig(I2C_TypeDef *I2Cx, uint16_t Timeout)
/* Configures the I2C Bus Timeout B (SCL cumulative Timeout). */ void I2C_TimeoutBConfig(I2C_TypeDef *I2Cx, uint16_t Timeout)
{ uint32_t tmpreg = 0; assert_param(IS_I2C_1_PERIPH(I2Cx)); assert_param(IS_I2C_TIMEOUT(Timeout)); tmpreg = I2Cx->TIMEOUTR; tmpreg &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TIMEOUTB); tmpreg |= (uint32_t)(((uint32_t)Timeout << 16) & I2C_TIMEOUTR_TIMEOUTB) ; I2Cx->TIMEOUTR = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the current framecount. Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called. */
int SDL_getFramecount(FPSmanager *manager)
/* Return the current framecount. Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called. */ int SDL_getFramecount(FPSmanager *manager)
{ if (manager == NULL) { return (-1); } else { return ((int)manager->framecount); } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Flip into 24bit mode for an instant - flushes the L2 cache card. We have to disable interrupts for this. Our IRQ handlers will crap themselves if they take an IRQ in 24bit mode! */
static void mac_cache_card_flush(int writeback)
/* Flip into 24bit mode for an instant - flushes the L2 cache card. We have to disable interrupts for this. Our IRQ handlers will crap themselves if they take an IRQ in 24bit mode! */ static void mac_cache_card_flush(int writeback)
{ unsigned long flags; local_irq_save(flags); via_flush_cache(); local_irq_restore(flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* f* bus_vcxk/vcxk_draw_mono FUNCTION copies a monochrom bitmap (BMP-Format) from given memory PARAMETER dataptr pointer to bitmap x output bitmap @ columne y output bitmap @ row */
void vcxk_draw_mono(unsigned char *dataptr, unsigned long linewidth, unsigned long cp_width, unsigned long cp_height)
/* f* bus_vcxk/vcxk_draw_mono FUNCTION copies a monochrom bitmap (BMP-Format) from given memory PARAMETER dataptr pointer to bitmap x output bitmap @ columne y output bitmap @ row */ void vcxk_draw_mono(unsigned char *dataptr, unsigned long linewidth, unsigned long cp_width, unsigned long cp_height)
{ unsigned char *lineptr; unsigned long xcnt, ycnt; for (ycnt = cp_height; ycnt > 0; ycnt--) { lineptr = dataptr; for (xcnt = 0; xcnt < cp_width; xcnt++) { if ((*lineptr << (xcnt % 8)) & 0x80) vcxk_setpixel(xcnt, ycnt - 1, 0xFFFFFF); else vcxk_setpixel(xcnt, ycnt-1, 0); if ((xcnt % 8) == 7) lineptr++; } dataptr = dataptr + linewidth; } }
EmcraftSystems/u-boot
C++
Other
181
/* This the extra space needed in the VRFB physical area for VRFB to safely wrap any memory accesses to the invisible part of the virtual view to the physical area. */
static u32 get_extra_physical_size(u16 image_width_roundup, u8 bytespp)
/* This the extra space needed in the VRFB physical area for VRFB to safely wrap any memory accesses to the invisible part of the virtual view to the physical area. */ static u32 get_extra_physical_size(u16 image_width_roundup, u8 bytespp)
{ return (OMAP_VRFB_LINE_LEN - image_width_roundup) * VRFB_PAGE_HEIGHT * bytespp; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified FMC flag is set or not. */
FlagStatus FMC_GetFlagStatus(uint32_t FMC_Bank, uint32_t FMC_FLAG)
/* Checks whether the specified FMC flag is set or not. */ FlagStatus FMC_GetFlagStatus(uint32_t FMC_Bank, uint32_t FMC_FLAG)
{ FlagStatus bitstatus = RESET; uint32_t tmpsr = 0x00000000; assert_param(IS_FMC_GETFLAG_BANK(FMC_Bank)); assert_param(IS_FMC_GET_FLAG(FMC_FLAG)); if(FMC_Bank == FMC_Bank2_NAND) { tmpsr = FMC_Bank2->SR2; } else if(FMC_Bank == FMC_Bank3_NAND) { tmpsr = FMC_Bank3->SR3; } else { tmpsr = FMC_Bank4->SR4; } if ((tmpsr & FMC_FLAG) != FMC_FLAG ) { bitstatus = RESET; } else { bitstatus = SET; } return bitstatus; }
remotemcu/remcu-chip-sdks
C++
null
436
/* LOGO needs to be sent to rport. Awaiting FC-4 offline completion callback. */
static void bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport, enum rport_event event)
/* LOGO needs to be sent to rport. Awaiting FC-4 offline completion callback. */ static void bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport, enum rport_event event)
{ bfa_trc(rport->fcs, rport->pwwn); bfa_trc(rport->fcs, rport->pid); bfa_trc(rport->fcs, event); switch (event) { case RPSM_EVENT_FC4_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); bfa_rport_offline(rport->bfa_rport); break; default: bfa_assert(0); } }
robutest/uclinux
C++
GPL-2.0
60
/* Callback to return the maximum clock rate acheivable by the controller. */
static unsigned int sdhci_s3c_get_max_clk(struct sdhci_host *host)
/* Callback to return the maximum clock rate acheivable by the controller. */ static unsigned int sdhci_s3c_get_max_clk(struct sdhci_host *host)
{ struct sdhci_s3c *ourhost = to_s3c(host); struct clk *busclk; unsigned int rate, max; int clk; sdhci_s3c_check_sclk(host); for (max = 0, clk = 0; clk < MAX_BUS_CLK; clk++) { busclk = ourhost->clk_bus[clk]; if (!busclk) continue; rate = clk_get_rate(busclk); if (rate > max) max = rate; } return max; }
robutest/uclinux
C++
GPL-2.0
60
/* cinfo.err = jpeg_std_error(&err); after which the application may override some of the methods. */
jpeg_std_error(struct jpeg_error_mgr *err)
/* cinfo.err = jpeg_std_error(&err); after which the application may override some of the methods. */ jpeg_std_error(struct jpeg_error_mgr *err)
{ err->error_exit = error_exit; err->emit_message = emit_message; err->output_message = output_message; err->format_message = format_message; err->reset_error_mgr = reset_error_mgr; err->trace_level = 0; err->num_warnings = 0; err->msg_code = 0; err->jpeg_message_table = jpeg_std_message_table; err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1; err->addon_message_table = NULL; err->first_addon_message = 0; err->last_addon_message = 0; return err; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Make sure the single step bit is not set. */
void ptrace_disable(struct task_struct *child)
/* Make sure the single step bit is not set. */ void ptrace_disable(struct task_struct *child)
{ unsigned long tmp; tmp = get_reg(child, PT_CCS) & ~SBIT_USER; put_reg(child, PT_CCS, tmp); put_reg(child, PT_SPC, 0); deconfigure_bp(child->pid); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reset the 8390 (hard reset). Note that we can't actually do this. */
static void etherh_reset(struct net_device *dev)
/* Reset the 8390 (hard reset). Note that we can't actually do this. */ static void etherh_reset(struct net_device *dev)
{ struct ei_device *ei_local = netdev_priv(dev); void __iomem *addr = (void __iomem *)dev->base_addr; writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr); if (dev->flags & IFF_AUTOMEDIA && ei_local->interface_num) { ei_local->interface_num = 0; if (dev->if_port == IF_PORT_10BASET) dev->if_port = IF_PORT_10BASE2; else dev->if_port = IF_PORT_10BASET; etherh_setif(dev); } }
robutest/uclinux
C++
GPL-2.0
60
/* If no initialization is required, then return RETURN_SUCCESS. If the serial device was successfully initialized, then return RETURN_SUCCESS. If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. */
RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
/* If no initialization is required, then return RETURN_SUCCESS. If the serial device was successfully initialized, then return RETURN_SUCCESS. If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. */ RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
{ UINTN Divisor; UINT8 OutputData; UINT8 Data; Data = (UINT8)(gData - (UINT8)5); Divisor = 115200 / gBps; OutputData = (UINT8)((DLAB << 7) | (gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data); IoWrite8 (gUartBase + LCR_OFFSET, OutputData); IoWrite8 (gUartBase + BAUD_HIGH_OFFSET, (UINT8)(Divisor >> 8)); IoWrite8 (gUartBase + BAUD_LOW_OFFSET, (UINT8)(Divisor & 0xff)); OutputData = (UINT8)((gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data); IoWrite8 (gUartBase + LCR_OFFSET, OutputData); return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Writes and returns a new value to DR3. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr3(UINTN Dr3)
/* Writes and returns a new value to DR3. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */ UINTN EFIAPI AsmWriteDr3(UINTN Dr3)
{ __asm__ __volatile__ ( "mov %0, %%dr3" : : "r" (Dr3) ); return Dr3; }
tianocore/edk2
C++
Other
4,240
/* VmbusOnCleanup - Perform any cleanup when the driver is removed */
static void VmbusOnCleanup(struct hv_driver *drv)
/* VmbusOnCleanup - Perform any cleanup when the driver is removed */ static void VmbusOnCleanup(struct hv_driver *drv)
{ DPRINT_ENTER(VMBUS); HvCleanup(); DPRINT_EXIT(VMBUS); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a device node to its string representation. */
CHAR16* EFIAPI UefiDevicePathLibConvertDeviceNodeToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a device node to its string representation. */ CHAR16* EFIAPI UefiDevicePathLibConvertDeviceNodeToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ POOL_PRINT Str; UINTN Index; DEVICE_PATH_TO_TEXT ToText; if (DeviceNode == NULL) { return NULL; } ZeroMem (&Str, sizeof (Str)); ToText = DevPathToTextNodeGeneric; for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) { if ((DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type) && (DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType) ) { ToText = mUefiDevicePathLibToTextTable[Index].Function; break; } } ToText (&Str, (VOID *)DeviceNode, DisplayOnly, AllowShortcuts); ASSERT (Str.Str != NULL); return Str.Str; }
tianocore/edk2
C++
Other
4,240
/* Get interrupt status for the specified GPIO port. */
unsigned long xGPIOPinIntStatus(unsigned long ulPort)
/* Get interrupt status for the specified GPIO port. */ unsigned long xGPIOPinIntStatus(unsigned long ulPort)
{ return GPIOPinIntStatus(ulPort); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Change Logs: Date Author Notes henryhuang first version */
void led_init(void)
/* Change Logs: Date Author Notes henryhuang first version */ void led_init(void)
{ GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call to resume any I/O requests waiting for room in request queue. */
static void bfa_itnim_qresume(void *cbarg)
/* Call to resume any I/O requests waiting for room in request queue. */ static void bfa_itnim_qresume(void *cbarg)
{ struct bfa_itnim_s *itnim = cbarg; bfa_sm_send_event(itnim, BFA_ITNIM_SM_QRESUME); }
robutest/uclinux
C++
GPL-2.0
60
/* send SMT frame set source address set station ID send frame */
void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local)
/* send SMT frame set source address set station ID send frame */ void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local)
{ struct smt_header *sm ; if (!smc->r.sm_ma_avail && !local) { smt_free_mbuf(smc,mb) ; return ; } sm = smtod(mb,struct smt_header *) ; sm->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ; sm->smt_sid = smc->mib.fddiSMTStationId ; smt_swap_para(sm,(int) mb->sm_len,0) ; hwm_conv_can(smc,(char *)sm,12) ; smc->mib.m[MAC0].fddiMACSMTTransmit_Ct++ ; smt_send_mbuf(smc,mb,local ? FC_SMT_LOC : fc) ; }
robutest/uclinux
C++
GPL-2.0
60
/* remove the block from linked-list and free resource (without mutex) */
void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
/* remove the block from linked-list and free resource (without mutex) */ void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
{ list_del(&blk->list); hdr->nblocks--; hdr->used -= blk->size; kfree(blk); }
robutest/uclinux
C++
GPL-2.0
60
/* Unregisters an interrupt handler for the USB controller. */
void USBIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for the USB controller. */ void USBIntUnregister(unsigned long ulBase)
{ ASSERT(ulBase == USB0_BASE); IntDisable(INT_USB0); IntUnregister(INT_USB0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* pm8001_queue_command - register for upper layer used, all IO commands sent to HBA are from this interface. @task: the task to be execute. @num: if can_queue great than 1, the task can be queued up. for SMP task, we always execute one one time @gfp_flags: gfp_flags */
int pm8001_queue_command(struct sas_task *task, const int num, gfp_t gfp_flags)
/* pm8001_queue_command - register for upper layer used, all IO commands sent to HBA are from this interface. @task: the task to be execute. @num: if can_queue great than 1, the task can be queued up. for SMP task, we always execute one one time @gfp_flags: gfp_flags */ int pm8001_queue_command(struct sas_task *task, const int num, gfp_t gfp_flags)
{ return pm8001_task_exec(task, num, gfp_flags, 0, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* This function disables the Cortex-M3 memory protection unit. When the MPU is disabled, the default memory map is used and memory management faults are not generated. */
void MPUDisable(void)
/* This function disables the Cortex-M3 memory protection unit. When the MPU is disabled, the default memory map is used and memory management faults are not generated. */ void MPUDisable(void)
{ HWREG(NVIC_MPU_CTRL) &= ~NVIC_MPU_CTRL_ENABLE; }
watterott/WebRadio
C++
null
71
/* Uses kmalloc if possible. Otherwise falls back to vmalloc. */
static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
/* Uses kmalloc if possible. Otherwise falls back to vmalloc. */ static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
{ unsigned long size = ttm->num_pages * sizeof(*ttm->pages); ttm->pages = NULL; if (size <= PAGE_SIZE) ttm->pages = kzalloc(size, GFP_KERNEL); if (!ttm->pages) { ttm->pages = vmalloc_user(size); if (ttm->pages) ttm->page_flags |= TTM_PAGE_FLAG_VMALLOC; } }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the output mode. Only used in counter mode. When done counting, the pin can be set to no output, to invert the current pin level, to set the pin high, or to set the pin low. */
void timer_output_mode(uint32_t timer, enum timer_output_modes mode)
/* Selects the output mode. Only used in counter mode. When done counting, the pin can be set to no output, to invert the current pin level, to set the pin high, or to set the pin low. */ void timer_output_mode(uint32_t timer, enum timer_output_modes mode)
{ uint32_t reg = TIMER_CTRL(timer) & ~(TIMER_CTRL_WMOD_MASK << TIMER_CTRL_WMOD_SHIFT); TIMER_CTRL(timer) = reg | (mode << TIMER_CTRL_WMOD_SHIFT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Gets the state of the watchdog timer lock mechanism. */
bool WatchdogLockState(uint32_t ui32Base)
/* Gets the state of the watchdog timer lock mechanism. */ bool WatchdogLockState(uint32_t ui32Base)
{ ASSERT((ui32Base == WATCHDOG0_BASE) || (ui32Base == WATCHDOG1_BASE)); return ((HWREG(ui32Base + WDT_O_LOCK) == WDT_LOCK_LOCKED) ? true : false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each EXTI_InitStruct member with its reset value. */
void EXTI_StructInit(EXTI_InitTypeDef *EXTI_InitStruct)
/* Fills each EXTI_InitStruct member with its reset value. */ void EXTI_StructInit(EXTI_InitTypeDef *EXTI_InitStruct)
{ EXTI_InitStruct->EXTI_Line = EXTI_LINENONE; EXTI_InitStruct->EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStruct->EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStruct->EXTI_LineCmd = DISABLE; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_WM8960_Init(void *handle, void *config)
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ status_t HAL_CODEC_WM8960_Init(void *handle, void *config)
{ assert((config != NULL) && (handle != NULL)); codec_config_t *codecConfig = (codec_config_t *)config; wm8960_config_t *wm8960Config = (wm8960_config_t *)(codecConfig->codecDevConfig); wm8960_handle_t *wm8960Handle = (wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)); ((codec_handle_t *)handle)->codecCapability = &s_wm8960_capability; return WM8960_Init(wm8960Handle, wm8960Config); }
eclipse-threadx/getting-started
C++
Other
310
/* Config the DMA peripheral according to the specified parameters in the dmaConfig. */
void DMA_Config(DMA_CHANNEL_T *channel, DMA_Config_T *dmaConfig)
/* Config the DMA peripheral according to the specified parameters in the dmaConfig. */ void DMA_Config(DMA_CHANNEL_T *channel, DMA_Config_T *dmaConfig)
{ channel->CHCFG_B.DIRCFG = dmaConfig->direction; channel->CHCFG_B.CIRMODE = dmaConfig->circular; channel->CHCFG_B.M2MMODE = dmaConfig->memoryTomemory; channel->CHCFG_B.CHPL = dmaConfig->priority; channel->CHCFG_B.MIMODE = dmaConfig->memoryInc; channel->CHCFG_B.PERIMODE = dmaConfig->peripheralInc; channel->CHCFG_B.MSIZE = dmaConfig->memoryDataSize; channel->CHCFG_B.PERSIZE = dmaConfig->peripheralDataSize; channel->CHNDATA = dmaConfig->bufferSize; channel->CHMADDR = dmaConfig->memoryAddress; channel->CHPADDR = dmaConfig->peripheralAddress; }
pikasTech/PikaPython
C++
MIT License
1,403