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
/* Sets the direction and mode of the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void xGPIODirModeSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulPinIO)
/* Sets the direction and mode of the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void xGPIODirModeSet(unsigned long ulPort, unsi...
{ unsigned long ulBit; xASSERT(GPIOBaseValid(ulPort)); xASSERT((ulPinIO == xGPIO_DIR_MODE_IN) || (ulPinIO == xGPIO_DIR_MODE_OUT) || (ulPinIO == xGPIO_DIR_MODE_HW)); for(ulBit=0; ulBit<32; ulBit++) { if(ulPins & (1 << ulBit)) { GPIODirModeSet(ulPort, ulBit, ulP...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* led_classdev_resume - resume an led_classdev. @led_cdev: the led_classdev to resume. */
void led_classdev_resume(struct led_classdev *led_cdev)
/* led_classdev_resume - resume an led_classdev. @led_cdev: the led_classdev to resume. */ void led_classdev_resume(struct led_classdev *led_cdev)
{ led_cdev->brightness_set(led_cdev, led_cdev->brightness); led_cdev->flags &= ~LED_SUSPENDED; }
robutest/uclinux
C++
GPL-2.0
60
/* It also takes messages from the locking layer, formats them into packets and sends them to the comms layer. */
static void copy_from_cb(void *dst, const void *base, unsigned offset, unsigned len, unsigned limit)
/* It also takes messages from the locking layer, formats them into packets and sends them to the comms layer. */ static void copy_from_cb(void *dst, const void *base, unsigned offset, unsigned len, unsigned limit)
{ unsigned copy = len; if ((copy + offset) > limit) copy = limit - offset; memcpy(dst, base + offset, copy); len -= copy; if (len) memcpy(dst + copy, base, len); }
robutest/uclinux
C++
GPL-2.0
60
/* Send GET_RCA command to get card relative address. */
static status_t SD_SendRca(sd_card_t *card)
/* Send GET_RCA command to get card relative address. */ static status_t SD_SendRca(sd_card_t *card)
{ assert(card); HOST_TRANSFER content = {0}; HOST_COMMAND command = {0}; command.index = kSD_SendRelativeAddress; command.argument = 0U; command.responseType = kCARD_ResponseTypeR6; content.command = &command; content.data = NULL; if (kStatus_Success == card->host.transfer(card->host...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* See if the device with a specific minor # is free. */
static int specific_minor(int minor)
/* See if the device with a specific minor # is free. */ static int specific_minor(int minor)
{ int r, m; if (minor >= (1 << MINORBITS)) return -EINVAL; r = idr_pre_get(&_minor_idr, GFP_KERNEL); if (!r) return -ENOMEM; spin_lock(&_minor_lock); if (idr_find(&_minor_idr, minor)) { r = -EBUSY; goto out; } r = idr_get_new_above(&_minor_idr, MINOR_ALLOCED, minor, &m); if (r) goto out; if (m != mi...
robutest/uclinux
C++
GPL-2.0
60
/* Sets the Smart Card number of retries in transmit and receive. */
void USART_SetAutoRetryCount(USART_TypeDef *USARTx, uint8_t USART_AutoCount)
/* Sets the Smart Card number of retries in transmit and receive. */ void USART_SetAutoRetryCount(USART_TypeDef *USARTx, uint8_t USART_AutoCount)
{ assert_param(IS_USART_123_PERIPH(USARTx)); assert_param(IS_USART_AUTO_RETRY_COUNTER(USART_AutoCount)); USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_SCARCNT); USARTx->CR3 |= (uint32_t)((uint32_t)USART_AutoCount << 0x11); }
ajhc/demo-cortex-m3
C++
null
38
/* Read available data from the read FIFO, as 32-bit data items. */
unsigned long EPINonBlockingReadGet32(unsigned long ulBase, unsigned long ulCount, unsigned long *pulBuf)
/* Read available data from the read FIFO, as 32-bit data items. */ unsigned long EPINonBlockingReadGet32(unsigned long ulBase, unsigned long ulCount, unsigned long *pulBuf)
{ unsigned long ulCountRead = 0; ASSERT(ulBase == EPI0_BASE); ASSERT(ulCount < 4096); ASSERT(pulBuf); while(HWREG(ulBase + EPI_O_RFIFOCNT) && ulCount--) { *pulBuf = HWREG(ulBase + EPI_O_READFIFO); pulBuf++; ulCountRead++; } return(ulCountRead); }
watterott/WebRadio
C++
null
71
/* This function is called when this module is loaded. */
static int __init mpc8610_hpcd_init(void)
/* This function is called when this module is loaded. */ static int __init mpc8610_hpcd_init(void)
{ int ret; printk(KERN_INFO "Freescale MPC8610 HPCD ALSA SoC fabric driver\n"); ret = of_register_platform_driver(&mpc8610_hpcd_of_driver); if (ret) printk(KERN_ERR "mpc8610-hpcd: failed to register platform driver\n"); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* IDL typedef struct { IDL long is_locked, IDL char *lock_owner, IDL long lock_duration, IDL }; */
static int svcctl_dissect_QUERY_SERVICE_LOCK_STATUS(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL typedef struct { IDL long is_locked, IDL char *lock_owner, IDL long lock_duration, IDL }; */ static int svcctl_dissect_QUERY_SERVICE_LOCK_STATUS(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_svcctl_is_locked, NULL); offset = dissect_ndr_pointer( tvb, offset, pinfo, tree, di, drep, dissect_ndr_char_cvstring, NDR_POINTER_UNIQUE, "Owner", hf_svcctl_lock_owner); offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Schedule writeback for all backing devices. This does WB_SYNC_NONE writeback, for integrity writeback see bdi_sync_writeback(). */
static void bdi_writeback_all(struct super_block *sb, long nr_pages)
/* Schedule writeback for all backing devices. This does WB_SYNC_NONE writeback, for integrity writeback see bdi_sync_writeback(). */ static void bdi_writeback_all(struct super_block *sb, long nr_pages)
{ struct wb_writeback_args args = { .sb = sb, .nr_pages = nr_pages, .sync_mode = WB_SYNC_NONE, }; struct backing_dev_info *bdi; rcu_read_lock(); list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) { if (!bdi_has_dirty_io(bdi)) continue; bdi_alloc_queue_work(bdi, &args); } rcu_read_unlock(); }
robutest/uclinux
C++
GPL-2.0
60
/* omap_nand_wp - This function enable or disable the Write Protect feature @mtd: MTD device structure @mode: WP ON/OFF */
static void omap_nand_wp(struct mtd_info *mtd, int mode)
/* omap_nand_wp - This function enable or disable the Write Protect feature @mtd: MTD device structure @mode: WP ON/OFF */ static void omap_nand_wp(struct mtd_info *mtd, int mode)
{ struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, mtd); unsigned long config = __raw_readl(info->gpmc_baseaddr + GPMC_CONFIG); if (mode) config &= ~(NAND_WP_BIT); else config |= (NAND_WP_BIT); __raw_writel(config, (info->gpmc_baseaddr + GPMC_CONFIG)); }
robutest/uclinux
C++
GPL-2.0
60
/* Called after a notify add to make devices available which were released from the notifier call. */
static void clockevents_notify_released(void)
/* Called after a notify add to make devices available which were released from the notifier call. */ static void clockevents_notify_released(void)
{ struct clock_event_device *dev; while (!list_empty(&clockevents_released)) { dev = list_entry(clockevents_released.next, struct clock_event_device, list); list_del(&dev->list); list_add(&dev->list, &clockevent_devices); clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Controls the automatic channel switch enabled or disabled. */
void ADC_AutoCSwCmd(u32 NewState)
/* Controls the automatic channel switch enabled or disabled. */ void ADC_AutoCSwCmd(u32 NewState)
{ ADC_TypeDef *adc = ADC; u8 div = adc->ADC_CLK_DIV; u8 sync_time[4] = {12, 16, 32, 64}; if(NewState != DISABLE) adc->ADC_AUTO_CSW_CTRL = BIT_ADC_AUTO_CSW_EN; else adc->ADC_AUTO_CSW_CTRL = 0; DelayUs(sync_time[div]); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* getsock_tcp_mss - Returns the MSS size for TCP */
int setnonblocking(int sock)
/* getsock_tcp_mss - Returns the MSS size for TCP */ int setnonblocking(int sock)
{ int opts = 0; opts = (opts | O_NONBLOCK); if (fcntl(sock, F_SETFL, opts) < 0) { printf("fcntl(F_SETFL)"); return -1; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* permit a R/O mapping to be made directly through onto an MTD device if possible */
static int romfs_mmap(struct file *file, struct vm_area_struct *vma)
/* permit a R/O mapping to be made directly through onto an MTD device if possible */ static int romfs_mmap(struct file *file, struct vm_area_struct *vma)
{ return vma->vm_flags & (VM_SHARED | VM_MAYSHARE) ? 0 : -ENOSYS; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_statement_at_font_face_rule_set_decls(CRStatement *a_this, CRDeclaration *a_decls)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_font_face_rule_set_decls(CRStatement *a_this, CRDeclaration *a_decls)
{ g_return_val_if_fail (a_this && a_this->type == AT_FONT_FACE_RULE_STMT && a_this->kind.font_face_rule, CR_BAD_PARAM_ERROR); if (a_this->kind.font_face_rule->decl_list) { cr_declaration_unref (a_th...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Create and start a thread. This function starts a new thread. The new thread starts execution by invoking entry(). The argument arg is passed as the sole argument of entry(). */
OS_Status OS_ThreadCreate(OS_Thread_t *thread, const char *name, OS_ThreadEntry_t entry, void *arg, OS_Priority priority, uint32_t stackSize)
/* Create and start a thread. This function starts a new thread. The new thread starts execution by invoking entry(). The argument arg is passed as the sole argument of entry(). */ OS_Status OS_ThreadCreate(OS_Thread_t *thread, const char *name, OS_ThreadEntry_t entry, void *arg, OS_Priority priority, uint32_t stackSi...
{ OS_HANDLE_ASSERT(!OS_ThreadIsValid(thread), thread->handle); thread->handle = rt_thread_create(name, entry, arg, stackSize, priority, 20); OS_DBG("%s(), name \"%s\", priority %d, stackSize %u, handle %p\n", __func__, name, priority, (unsigned int)stackSize,...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* main function , 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) */
int main(void)
/* main function , 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) */ int main(void)
{ systick_config(); gd_eval_ledinit(LED1); gd_eval_keyinit(KEY_TAMPER,KEY_MODE_GPIO); while(1){ if(RESET == gd_eval_keygetstate(KEY_TAMPER)){ delay_1ms(100); if(RESET == gd_eval_keygetstate(KEY_TAMPER)){ gd_eval_ledtoggle(LED1); } } ...
liuxuming/trochili
C++
Apache License 2.0
132
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint32Add(IN UINT32 Augend, IN UINT32 Addend, OUT UINT32 *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint32Add(IN UINT32 Augend, IN UINT32 Addend, OUT UINT32 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if ((Augend + Addend) >= Augend) { *Result = (Augend + Addend); Status = RETURN_SUCCESS; } else { *Result = UINT32_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Sets up the TX descriptor ring buffers. This function sets up the descriptor list used for transmit packets. */
static err_t lpc_tx_setup(struct lpc_enetdata *lpc_enetif)
/* Sets up the TX descriptor ring buffers. This function sets up the descriptor list used for transmit packets. */ static err_t lpc_tx_setup(struct lpc_enetdata *lpc_enetif)
{ s32_t idx; for (idx = 0; idx < LPC_NUM_BUFF_TXDESCS; idx++) { lpc_enetif->ptxd[idx].control = 0; lpc_enetif->ptxs[idx].statusinfo = 0xFFFFFFFF; } LPC_EMAC->TxDescriptor = (u32_t) &lpc_enetif->ptxd[0]; LPC_EMAC->TxStatus = (u32_t) &lpc_enetif->ptxs[0]; LPC_EMAC->TxDescriptorNumb...
ajhc/demo-cortex-m3
C++
null
38
/* Copy the inode data to a smb_fattr structure. */
void smb_get_inode_attr(struct inode *inode, struct smb_fattr *fattr)
/* Copy the inode data to a smb_fattr structure. */ void smb_get_inode_attr(struct inode *inode, struct smb_fattr *fattr)
{ memset(fattr, 0, sizeof(struct smb_fattr)); fattr->f_mode = inode->i_mode; fattr->f_nlink = inode->i_nlink; fattr->f_ino = inode->i_ino; fattr->f_uid = inode->i_uid; fattr->f_gid = inode->i_gid; fattr->f_size = inode->i_size; fattr->f_mtime = inode->i_mtime; fattr->f_ctime = inode->i_ctime; fattr->f_atime =...
robutest/uclinux
C++
GPL-2.0
60
/* zero_dent_node_unused - zero out unused fields of an on-flash directory entry node. @dent: the directory entry to zero out */
static void zero_dent_node_unused(struct ubifs_dent_node *dent)
/* zero_dent_node_unused - zero out unused fields of an on-flash directory entry node. @dent: the directory entry to zero out */ static void zero_dent_node_unused(struct ubifs_dent_node *dent)
{ dent->padding1 = 0; memset(dent->padding2, 0, 4); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the port stats structure to user app. A NULL port struct pointer passed in means that we need to find out from the app what port to get stats for (used through board control device). */
static int stli_getportstats(struct tty_struct *tty, struct stliport *portp, comstats_t __user *cp)
/* Return the port stats structure to user app. A NULL port struct pointer passed in means that we need to find out from the app what port to get stats for (used through board control device). */ static int stli_getportstats(struct tty_struct *tty, struct stliport *portp, comstats_t __user *cp)
{ struct stlibrd *brdp; int rc; if (!portp) { if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) return -EFAULT; portp = stli_getport(stli_comstats.brd, stli_comstats.panel, stli_comstats.port); if (!portp) return -ENODEV; } brdp = stli_brds[portp->brdnr]; if (!brdp) return -ENODEV; if ...
robutest/uclinux
C++
GPL-2.0
60
/* Return if this FMP is a system FMP or a device FMP, based upon CapsuleHeader. */
BOOLEAN IsFmpCapsule(IN EFI_CAPSULE_HEADER *CapsuleHeader)
/* Return if this FMP is a system FMP or a device FMP, based upon CapsuleHeader. */ BOOLEAN IsFmpCapsule(IN EFI_CAPSULE_HEADER *CapsuleHeader)
{ if (IsFmpCapsuleGuid (&CapsuleHeader->CapsuleGuid)) { return TRUE; } if (IsNestedFmpCapsule (CapsuleHeader)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Force an update of controller timing values for a given drive */
static void pmac_ide_do_update_timings(ide_drive_t *drive)
/* Force an update of controller timing values for a given drive */ static void pmac_ide_do_update_timings(ide_drive_t *drive)
{ ide_hwif_t *hwif = drive->hwif; pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); if (pmif->kind == controller_sh_ata6 || pmif->kind == controller_un_ata6 || pmif->kind == controller_k2_ata6) pmac_ide_kauai_apply_timings(drive); else pmac_ide_apply_timings(drive); }
robutest/uclinux
C++
GPL-2.0
60
/* Read PCIe configuration space, and get the MSI-X vector count from the capabilities table. */
static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw)
/* Read PCIe configuration space, and get the MSI-X vector count from the capabilities table. */ static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw)
{ struct ixgbe_adapter *adapter = hw->back; u16 msix_count; pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82598_CAPS, &msix_count); msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK; msix_count++; return msix_count; }
robutest/uclinux
C++
GPL-2.0
60
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI IoBitFieldRead32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT32 EFIAPI IoBitFieldRead32(IN UINTN Port, IN U...
{ return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit); }
tianocore/edk2
C++
Other
4,240
/* vpif_mmap: It is used to map kernel space buffers into user spaces */
static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
/* vpif_mmap: It is used to map kernel space buffers into user spaces */ static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
{ struct vpif_fh *fh = filep->private_data; struct common_obj *common = &fh->channel->common[VPIF_VIDEO_INDEX]; return videobuf_mmap_mapper(&common->buffer_queue, vma); }
robutest/uclinux
C++
GPL-2.0
60
/* Return: -1 Error, the calculated offset exceeded the size of the buffer n OK, a range-checked offset into buffer */
static int ldm_relative(const u8 *buffer, int buflen, int base, int offset)
/* Return: -1 Error, the calculated offset exceeded the size of the buffer n OK, a range-checked offset into buffer */ static int ldm_relative(const u8 *buffer, int buflen, int base, int offset)
{ base += offset; if (!buffer || offset < 0 || base > buflen) { if (!buffer) ldm_error("!buffer"); if (offset < 0) ldm_error("offset (%d) < 0", offset); if (base > buflen) ldm_error("base (%d) > buflen (%d)", base, buflen); return -1; } if (base + buffer[base] >= buflen) { ldm_error("base (%d) + ...
robutest/uclinux
C++
GPL-2.0
60
/* Computes the 32-bit CRC of a given data word(32-bit). */
uint32_t CRC_CalcCRC(uint32_t CRC_Data)
/* Computes the 32-bit CRC of a given data word(32-bit). */ uint32_t CRC_CalcCRC(uint32_t CRC_Data)
{ CRC->DR = CRC_Data; return (CRC->DR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base PMU peripheral base address. param mode The control mode of the LPSR ANA LDO. Please refer to pmu_control_mode_t. */
void PMU_SetLpsrAnaLdoControlMode(ANADIG_LDO_SNVS_Type *base, pmu_control_mode_t mode)
/* param base PMU peripheral base address. param mode The control mode of the LPSR ANA LDO. Please refer to pmu_control_mode_t. */ void PMU_SetLpsrAnaLdoControlMode(ANADIG_LDO_SNVS_Type *base, pmu_control_mode_t mode)
{ if (mode == kPMU_StaticMode) { base->PMU_LDO_LPSR_ANA &= ~ANADIG_LDO_SNVS_PMU_LDO_LPSR_ANA_LPSR_ANA_CONTROL_MODE_MASK; } else { base->PMU_LDO_LPSR_ANA |= ANADIG_LDO_SNVS_PMU_LDO_LPSR_ANA_LPSR_ANA_CONTROL_MODE_MASK; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will set network interface device DNS server address. @NOTE it can only be called in the network interface device driver. */
void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server)
/* This function will set network interface device DNS server address. @NOTE it can only be called in the network interface device driver. */ void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server)
{ int index; ASSERT(dns_server); for (index = 0; index < NETDEV_DNS_SERVERS_NUM; index++) { if (ip_addr_cmp(&(netdev->dns_servers[index]), dns_server)) { return; } } if (netdev && dns_num < NETDEV_DNS_SERVERS_NUM) { ip_addr_copy(netdev->dns_servers...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function exports device path package to a buffer. This is a internal function. */
EFI_STATUS ExportDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList, IN UINTN UsedSize, IN UINTN BufferSize, IN OUT VOID *Buffer, IN OUT UINTN *ResultSize)
/* This function exports device path package to a buffer. This is a internal function. */ EFI_STATUS ExportDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList, IN UINTN UsedSize, IN UINTN BufferSize, IN OUT VOID *Buffer, IN OUT UINTN *Res...
{ EFI_STATUS Status; UINT8 *Package; EFI_HII_PACKAGE_HEADER Header; if ((Private == NULL) || (PackageList == NULL) || (ResultSize == NULL)) { return EFI_INVALID_PARAMETER; } if ((BufferSize > 0) && (Buffer == NULL)) { return EFI_INVALID_PARAMETER; } Package = Pack...
tianocore/edk2
C++
Other
4,240
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a DMA transaction currently in progress. */
status_t LPI2C_MasterTransferAbortEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a DMA transaction currently in progress. */ status_t LPI2C_MasterTransferAbortEDMA(LPI2C_Type *base, lpi2c_mas...
{ if (!handle->isBusy) { return kStatus_LPI2C_Idle; } EDMA_AbortTransfer(handle->rx); if (FSL_FEATURE_LPI2C_HAS_SEPARATE_DMA_RX_TX_REQn(base) != 0) { EDMA_AbortTransfer(handle->tx); } base->MCR |= LPI2C_MCR_RRF_MASK | LPI2C_MCR_RTF_MASK; base->MTDR = (uint32_t)kStopCm...
eclipse-threadx/getting-started
C++
Other
310
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ResetEP(uint32_t EPNum)
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ResetEP(uint32_t EPNum)
{ EPNum &= 0x0F; UDPHS->UDPHS_EPT[EPNum].UDPHS_EPTCLRSTA = (0x1 << 6) | (0x1 << 5); UDPHS->UDPHS_EPTRST |= (1 << EPNum); UDPHS->UDPHS_EPTRST &= ~(1 << EPNum); eptsta_copy[EPNum] = UDPHS->UDPHS_EPT[EPNum].UDPHS_EPTSETSTA; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This function will return if this variable is SecureAuthority Variable. */
BOOLEAN IsSecureAuthorityVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
/* This function will return if this variable is SecureAuthority Variable. */ BOOLEAN IsSecureAuthorityVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
{ UINTN Index; for (Index = 0; Index < sizeof (mVariableType)/sizeof (mVariableType[0]); Index++) { if ((StrCmp (VariableName, mVariableType[Index].VariableName) == 0) && (CompareGuid (VendorGuid, mVariableType[Index].VendorGuid))) { return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the TIMx peripheral Preload register on CCR1. */
void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR1. */ void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
{ uint32_t tmpccmr1 = 0; assert_param(IS_TIM_LIST1_PERIPH(TIMx)); assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint32_t)(~TIM_CCMR1_OC1PE); tmpccmr1 |= TIM_OCPreload; TIMx->CCMR1 = tmpccmr1; }
ajhc/demo-cortex-m3
C++
null
38
/* The SPI payload needs to make space for odd half-sector layout used in flash (i.e. only the first 2K of each 4K sector is used). */
static int rkspi_vrec_header(struct image_tool_params *params, struct image_type_params *tparams)
/* The SPI payload needs to make space for odd half-sector layout used in flash (i.e. only the first 2K of each 4K sector is used). */ static int rkspi_vrec_header(struct image_tool_params *params, struct image_type_params *tparams)
{ rkcommon_vrec_header(params, tparams); params->file_size = ROUND(params->file_size, RKSPI_SECT_LEN) << 1; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check the appropriate indication the MAC has finished configuring the PHY after a software reset. */
static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
/* Check the appropriate indication the MAC has finished configuring the PHY after a software reset. */ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
{ u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT; do { data = er32(STATUS); data &= E1000_STATUS_LAN_INIT_DONE; udelay(100); } while ((!data) && --loop); if (loop == 0) e_dbg("LAN_INIT_DONE not set, increase timeout\n"); data = er32(STATUS); data &= ~E1000_STATUS_LAN_INIT_DONE; ew32(STATUS, data); }
robutest/uclinux
C++
GPL-2.0
60
/* Performs read and write operations on the NVRAM device attached to a network interface. */
EFI_STATUS WinNtSnpNvData(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN ReadWrite, IN UINTN Offset, IN UINTN BufferSize, IN OUT VOID *Buffer)
/* Performs read and write operations on the NVRAM device attached to a network interface. */ EFI_STATUS WinNtSnpNvData(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN ReadWrite, IN UINTN Offset, IN UINTN BufferSize, IN OUT VOID *Buffer)
{ WIN_NT_SNP_PRIVATE *Private; Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This); return EFI_UNSUPPORTED; }
tianocore/edk2
C++
Other
4,240
/* Returns: the byte string contained within the attribute or NULL. */
const char* _g_file_attribute_value_get_byte_string(const GFileAttributeValue *attr)
/* Returns: the byte string contained within the attribute or NULL. */ const char* _g_file_attribute_value_get_byte_string(const GFileAttributeValue *attr)
{ if (attr == NULL) return NULL; g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, NULL); return attr->u.string; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Config iomux for M4 JTAG. Change Logs: Date Author Notes Steven Liu first implementation */
rt_weak void m4_jtag_iomux_config(void)
/* Config iomux for M4 JTAG. Change Logs: Date Author Notes Steven Liu first implementation */ rt_weak void m4_jtag_iomux_config(void)
{ HAL_PINCTRL_SetIOMUX(GPIO_BANK0, GPIO_PIN_C7 | GPIO_PIN_D0, PIN_CONFIG_MUX_FUNC2); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Examples: 01 0102 010203 01020304 0102030405 010203040506 010203...050607 010203...060708 etc. */
static void iso_print_data(uint8_t *data, size_t data_len)
/* Examples: 01 0102 010203 01020304 0102030405 010203040506 010203...050607 010203...060708 etc. */ static void iso_print_data(uint8_t *data, size_t data_len)
{ const uint8_t max_octets = 3; char data_str[35]; size_t str_len; str_len = bin2hex(data, MIN(max_octets, data_len), data_str, sizeof(data_str)); if (data_len > max_octets) { if (data_len > (max_octets * 2)) { static const char dots[] = "..."; strcat(&data_str[str_len], dots); str_len += strlen(dots); ...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ‘G XX...’ Writes the new values received into the input buffer to the general registers */
VOID EFIAPI WriteGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
/* ‘G XX...’ Writes the new values received into the input buffer to the general registers */ VOID EFIAPI WriteGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
{ UINTN i; CHAR8 *InBufPtr; if (AsciiStrLen (InBuffer) != 129) { SendError (GDB_EBADBUFSIZE); return; } InBufPtr = &InBuffer[1]; for (i = 0; i < MaxRegisterCount (); i++) { InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr); } SendSuccess (); }
tianocore/edk2
C++
Other
4,240
/* This function is called at various points during the startup process. This function is declared as a weak symbol higher up in this file because it is meant to be overridden by a user implemented version. One of the main uses for this function is to call functional safety code during the startup process. To use this ...
void R_BSP_WarmStart(bsp_warm_start_event_t event)
/* This function is called at various points during the startup process. This function is declared as a weak symbol higher up in this file because it is meant to be overridden by a user implemented version. One of the main uses for this function is to call functional safety code during the startup process. To use this ...
{ if (BSP_WARM_START_RESET == event) { } if (BSP_WARM_START_POST_CLOCK == event) { } else if (BSP_WARM_START_POST_C == event) { } else { } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Process a received packet with an unknown/unexpected CPL opcode. */
static int do_bad_cpl(struct t3cdev *dev, struct sk_buff *skb)
/* Process a received packet with an unknown/unexpected CPL opcode. */ static int do_bad_cpl(struct t3cdev *dev, struct sk_buff *skb)
{ printk(KERN_ERR "%s: received bad CPL command 0x%x\n", dev->name, *skb->data); return CPL_RET_BUF_DONE | CPL_RET_BAD_MSG; }
robutest/uclinux
C++
GPL-2.0
60
/* Called very early, MMU is off, device-tree isn't unflattened */
static int __init mpc834x_mds_probe(void)
/* Called very early, MMU is off, device-tree isn't unflattened */ static int __init mpc834x_mds_probe(void)
{ unsigned long root = of_get_flat_dt_root(); return of_flat_dt_is_compatible(root, "MPC834xMDS"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Process an incoming ICMP as an ABORT. (COOKIE-WAIT state) */
sctp_disposition_t sctp_sf_cookie_wait_icmp_abort(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands)
/* Process an incoming ICMP as an ABORT. (COOKIE-WAIT state) */ sctp_disposition_t sctp_sf_cookie_wait_icmp_abort(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands)
{ return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR, ENOPROTOOPT, asoc, (struct sctp_transport *)arg); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ixgbe_get_phy_id - Get the phy type @hw: pointer to hardware structure */
static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw)
/* ixgbe_get_phy_id - Get the phy type @hw: pointer to hardware structure */ static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw)
{ u32 status; u16 phy_id_high = 0; u16 phy_id_low = 0; status = hw->phy.ops.read_reg(hw, MDIO_DEVID1, MDIO_MMD_PMAPMD, &phy_id_high); if (status == 0) { hw->phy.id = (u32)(phy_id_high << 16); status = hw->phy.ops.read_reg(hw, MDIO_DEVID2, MDIO_MMD_PMAPMD, ...
robutest/uclinux
C++
GPL-2.0
60
/* There's also "register" data, which is memory mapped. No memory seen by this driver (or any HCD) may be paged out. */
static void ohci_hcd_init(struct ohci_hcd *ohci)
/* There's also "register" data, which is memory mapped. No memory seen by this driver (or any HCD) may be paged out. */ static void ohci_hcd_init(struct ohci_hcd *ohci)
{ ohci->next_statechange = jiffies; spin_lock_init (&ohci->lock); INIT_LIST_HEAD (&ohci->pending); }
robutest/uclinux
C++
GPL-2.0
60
/* A specific case is applied to ep0 : the ACM bit is always set to 1, for SET_INTERFACE and SET_CONFIGURATION. */
static void ep_write_UDCCSR(struct pxa_ep *ep, int mask)
/* A specific case is applied to ep0 : the ACM bit is always set to 1, for SET_INTERFACE and SET_CONFIGURATION. */ static void ep_write_UDCCSR(struct pxa_ep *ep, int mask)
{ if (is_ep0(ep)) mask |= UDCCSR0_ACM; udc_ep_writel(ep, UDCCSR, mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_remove_match_finish(_GFreedesktopDBus *proxy, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_remove_match_finish(_GFreedesktopDBus *proxy, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Convert the formatted IP address into the binary IP address. */
EFI_STATUS IScsiAsciiStrToIp(IN CHAR8 *Str, IN UINT8 IpMode, OUT EFI_IP_ADDRESS *Ip)
/* Convert the formatted IP address into the binary IP address. */ EFI_STATUS IScsiAsciiStrToIp(IN CHAR8 *Str, IN UINT8 IpMode, OUT EFI_IP_ADDRESS *Ip)
{ EFI_STATUS Status; if ((IpMode == IP_MODE_IP4) || (IpMode == IP_MODE_AUTOCONFIG_IP4)) { return NetLibAsciiStrToIp4 (Str, &Ip->v4); } else if ((IpMode == IP_MODE_IP6) || (IpMode == IP_MODE_AUTOCONFIG_IP6)) { return NetLibAsciiStrToIp6 (Str, &Ip->v6); } else if (IpMode == IP_MODE_AUTOCONFIG) { Stat...
tianocore/edk2
C++
Other
4,240
/* Create a child for the service identified by its service binding protocol GUID and get from the child the interface of the protocol identified by its GUID. */
STATIC EFI_STATUS CreateServiceChildAndOpenProtocol(IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ServiceBindingProtocolGuid, IN EFI_GUID *ProtocolGuid, OUT EFI_HANDLE *ChildHandle, OUT VOID **Interface)
/* Create a child for the service identified by its service binding protocol GUID and get from the child the interface of the protocol identified by its GUID. */ STATIC EFI_STATUS CreateServiceChildAndOpenProtocol(IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ServiceBindingProtocolGuid, IN EFI_GUID *ProtocolGuid, OUT EF...
{ EFI_STATUS Status; *ChildHandle = NULL; Status = NetLibCreateServiceChild ( ControllerHandle, gImageHandle, ServiceBindingProtocolGuid, ChildHandle ); if (!EFI_ERROR (Status)) { Status = gBS->OpenProtocol...
tianocore/edk2
C++
Other
4,240
/* Trademarks are the property of their respective owners. Device IO: read, write and toggle bit */
static int trackpoint_read(struct ps2dev *ps2dev, unsigned char loc, unsigned char *results)
/* Trademarks are the property of their respective owners. Device IO: read, write and toggle bit */ static int trackpoint_read(struct ps2dev *ps2dev, unsigned char loc, unsigned char *results)
{ if (ps2_command(ps2dev, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND)) || ps2_command(ps2dev, results, MAKE_PS2_CMD(0, 1, loc))) { return -1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* @discussion This function sets the image pattern for filling an evo. The image pattern is a loaded ebo. The ebo's transformation is applied when drawing the evo. */
BOOL ElmSetPatternMode(ElmVecObj evo, ELM_PATTERN_MODE mode, uint32_t color)
/* @discussion This function sets the image pattern for filling an evo. The image pattern is a loaded ebo. The ebo's transformation is applied when drawing the evo. */ BOOL ElmSetPatternMode(ElmVecObj evo, ELM_PATTERN_MODE mode, uint32_t color)
{ return _set_pattern_mode(evo, mode, color); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: SpeedDialStatReqMessage Opcode: 0x000a Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */
static void handle_SpeedDialStatReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: SpeedDialStatReqMessage Opcode: 0x000a Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */ static void handle_SpeedDialStatReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_speedDialNumber, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Acquires semaphore, if necessary, then writes the data to PHY register at the offset. Release any acquired semaphores before exiting. */
s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
/* Acquires semaphore, if necessary, then writes the data to PHY register at the offset. Release any acquired semaphores before exiting. */ s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
{ s32 ret_val; ret_val = hw->phy.ops.acquire(hw); if (ret_val) return ret_val; ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); hw->phy.ops.release(hw); return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* x509_certificate_free - Free an X.509 certificate chain @cert: Pointer to the first certificate in the chain */
void x509_certificate_chain_free(struct x509_certificate *cert)
/* x509_certificate_free - Free an X.509 certificate chain @cert: Pointer to the first certificate in the chain */ void x509_certificate_chain_free(struct x509_certificate *cert)
{ struct x509_certificate *next; while (cert) { next = cert->next; cert->next = NULL; x509_certificate_free(cert); cert = next; } }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Therefore, we probe by looking for the vhdxfile signature "vhdxfile" */
static int vhdx_probe(const uint8_t *buf, int buf_size, const char *filename)
/* Therefore, we probe by looking for the vhdxfile signature "vhdxfile" */ static int vhdx_probe(const uint8_t *buf, int buf_size, const char *filename)
{ if (buf_size >= 8 && !memcmp(buf, "vhdxfile", 8)) { return 100; } return 0; }
ve3wwg/teensy3_qemu
C++
Other
15
/* According to UEFI spec, hardware error record variable should use the EFI_HARDWARE_ERROR_VARIABLE VendorGuid and have the L"HwErrRec####" name convention, #### is a printed hex value and no 0x or h is included in the hex value. */
BOOLEAN EFIAPI IsHwErrRecVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
/* According to UEFI spec, hardware error record variable should use the EFI_HARDWARE_ERROR_VARIABLE VendorGuid and have the L"HwErrRec####" name convention, #### is a printed hex value and no 0x or h is included in the hex value. */ BOOLEAN EFIAPI IsHwErrRecVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
{ if (!CompareGuid (VendorGuid, &gEfiHardwareErrorVariableGuid) || (StrLen (VariableName) != StrLen (L"HwErrRec####")) || (StrnCmp (VariableName, L"HwErrRec", StrLen (L"HwErrRec")) != 0) || !VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[0x8]) || !VarCheckUefiIsHexaDecimalDigitCharacter...
tianocore/edk2
C++
Other
4,240
/* Set fixed default master of the specified slave. */
void matrix_set_slave_fixed_default_master(uint32_t ul_id, uint32_t ul_fixed_id)
/* Set fixed default master of the specified slave. */ void matrix_set_slave_fixed_default_master(uint32_t ul_id, uint32_t ul_fixed_id)
{ Matrix *p_matrix = MATRIX; volatile uint32_t ul_reg; ul_reg = p_matrix->MATRIX_SCFG[ul_id] & (~MATRIX_SCFG_FIXED_DEFMSTR_Msk); p_matrix->MATRIX_SCFG[ul_id] = ul_reg | MATRIX_SCFG_FIXED_DEFMSTR(ul_fixed_id); }
remotemcu/remcu-chip-sdks
C++
null
436
/* wait RTC last write operation finished flag set */
void rtc_lwoff_wait(void)
/* wait RTC last write operation finished flag set */ void rtc_lwoff_wait(void)
{ while (RESET == (RTC_CTL & RTC_CTL_LWOFF)){ } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* dispose of the data dangling from the corpse of a keyring */
static void keyring_destroy(struct key *keyring)
/* dispose of the data dangling from the corpse of a keyring */ static void keyring_destroy(struct key *keyring)
{ struct keyring_list *klist; int loop; if (keyring->description) { write_lock(&keyring_name_lock); if (keyring->type_data.link.next != NULL && !list_empty(&keyring->type_data.link)) list_del(&keyring->type_data.link); write_unlock(&keyring_name_lock); } klist = rcu_dereference(keyring->payload.subs...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: If auto-negotiation is enabled, we configure the advertising, and then restart auto-negotiation. If it is not enabled, then we write the BMCR. */
int genphy_config_aneg(struct phy_device *phydev)
/* Description: If auto-negotiation is enabled, we configure the advertising, and then restart auto-negotiation. If it is not enabled, then we write the BMCR. */ int genphy_config_aneg(struct phy_device *phydev)
{ int result; if (AUTONEG_ENABLE != phydev->autoneg) return genphy_setup_forced(phydev); result = genphy_config_advert(phydev); if (result < 0) return result; if (result == 0) { int ctl = phy_read(phydev, MII_BMCR); if (ctl < 0) return ctl; if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE)) result...
robutest/uclinux
C++
GPL-2.0
60
/* Parse the F reply packet and extract the return value and an ErrNo if it exists. */
INTN GdbParseFReplyPacket(IN CHAR8 *Packet, OUT UINTN *ErrNo)
/* Parse the F reply packet and extract the return value and an ErrNo if it exists. */ INTN GdbParseFReplyPacket(IN CHAR8 *Packet, OUT UINTN *ErrNo)
{ INTN RetCode; if (Packet[0] != 'F') { return -1; } RetCode = AsciiStrHexToUintn (&Packet[1]); for ( ; *Packet != '\0' && *Packet != ','; Packet++) { } if (*Packet == '\0') { *ErrNo = 0; return RetCode; } *ErrNo = AsciiStrHexToUintn (++Packet); for ( ; *Packet != '\0' && *Packet != ','...
tianocore/edk2
C++
Other
4,240
/* note: all filemap functions return negative error codes. These need to be inverted before returning to the xfs core functions. */
void xfs_tosspages(xfs_inode_t *ip, xfs_off_t first, xfs_off_t last, int fiopt)
/* note: all filemap functions return negative error codes. These need to be inverted before returning to the xfs core functions. */ void xfs_tosspages(xfs_inode_t *ip, xfs_off_t first, xfs_off_t last, int fiopt)
{ struct address_space *mapping = VFS_I(ip)->i_mapping; if (mapping->nrpages) truncate_inode_pages(mapping, first); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified CRYP interrupt has occurred or not. */
ITStatus CRYP_GetITStatus(uint8_t CRYP_IT)
/* Checks whether the specified CRYP interrupt has occurred or not. */ ITStatus CRYP_GetITStatus(uint8_t CRYP_IT)
{ ITStatus bitstatus = RESET; assert_param(IS_CRYP_GET_IT(CRYP_IT)); if ((CRYP->MISR & CRYP_IT) != (uint8_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
MaJerle/stm32f429
C++
null
2,036
/* Perform cable detection for ATA66 capable cable. Return a libata cable type. */
static int cs5535_cable_detect(struct ata_port *ap)
/* Perform cable detection for ATA66 capable cable. Return a libata cable type. */ static int cs5535_cable_detect(struct ata_port *ap)
{ u8 cable; struct pci_dev *pdev = to_pci_dev(ap->host->dev); pci_read_config_byte(pdev, CS5535_CABLE_DETECT, &cable); if (cable & 1) return ATA_CBL_PATA80; else return ATA_CBL_PATA40; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* z_comp_free - free the memory used by a compressor */
static void z_comp_free(void *state)
/* z_comp_free - free the memory used by a compressor */ static void z_comp_free(void *state)
{ struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; if (state) { zlib_deflateEnd(&state->strm); vfree(state->strm.workspace); kfree(state); } }
robutest/uclinux
C++
GPL-2.0
60
/* Set the interrupt type and Enable interrupt for the specified pin(s). This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. */
void xGPIOPinIntEnable(unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType)
/* Set the interrupt type and Enable interrupt for the specified pin(s). This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. */ void xGPIOPinIntEnable(unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType)
{ xASSERT(GPIOBaseValid(ulPort)); GPIOPinIntEnable(ulPort, ulPins, ulIntType); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function get the Mac Address, Ethernet statistics, maximum segment size, number of multicast filters, and number of pattern filters from Ethernet functional Descriptor. */
EFI_STATUS EFIAPI GetUsbEthFunDescriptor(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT USB_ETHERNET_FUN_DESCRIPTOR *UsbEthFunDescriptor)
/* This function get the Mac Address, Ethernet statistics, maximum segment size, number of multicast filters, and number of pattern filters from Ethernet functional Descriptor. */ EFI_STATUS EFIAPI GetUsbEthFunDescriptor(IN EDKII_USB_ETHERNET_PROTOCOL *This, OUT USB_ETHERNET_FUN_DESCRIPTOR *UsbEthFunDescriptor)
{ EFI_STATUS Status; USB_ETHERNET_DRIVER *UsbEthDriver; UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (This); if (UsbEthFunDescriptor == NULL) { return EFI_INVALID_PARAMETER; } Status = GetFunctionalDescriptor (UsbEthDriver->Config, ETHERNET_FUN_DESCRIPTOR, UsbEthFunDescriptor); return Status; ...
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT8 EFIAPI PciExpressBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT8)-1; } return MmioBitFieldRead8 ( (UINTN)GetPciExpressBaseAddress () + Address, StartBit, EndBit ); }
tianocore/edk2
C++
Other
4,240
/* This differs from __parport_ip32_frob_control() in that it only allows to change the value of DCR_STROBE, DCR_AUTOFD, DCR_nINIT, and DCR_SELECT. */
static unsigned char parport_ip32_frob_control(struct parport *p, unsigned char mask, unsigned char val)
/* This differs from __parport_ip32_frob_control() in that it only allows to change the value of DCR_STROBE, DCR_AUTOFD, DCR_nINIT, and DCR_SELECT. */ static unsigned char parport_ip32_frob_control(struct parport *p, unsigned char mask, unsigned char val)
{ const unsigned int wm = DCR_STROBE | DCR_AUTOFD | DCR_nINIT | DCR_SELECT; CHECK_EXTRA_BITS(p, mask, wm); CHECK_EXTRA_BITS(p, val, wm); __parport_ip32_frob_control(p, mask & wm, val & wm); return parport_ip32_read_control(p); }
robutest/uclinux
C++
GPL-2.0
60
/* Function called from USART IRQ Handler when RXNE flag is set Function is in charge of reading character received on USART RX line. */
void USART_CharReception_Callback(void)
/* Function called from USART IRQ Handler when RXNE flag is set Function is in charge of reading character received on USART RX line. */ void USART_CharReception_Callback(void)
{ __IO uint32_t received_char; received_char = LL_USART_ReceiveData8(USART1); if ((received_char == 'S') || (received_char == 's')) { ubFinalCharReceived = 1; LL_USART_DisableIT_RXNE(USART1); } LL_USART_TransmitData8(USART1, received_char); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Get The Timer counter current up timer or up event counter value. */
unsigned long TimerValueGet(unsigned long ulBase)
/* Get The Timer counter current up timer or up event counter value. */ unsigned long TimerValueGet(unsigned long ulBase)
{ xASSERT((ulBase == TIMER3_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); return (xHWREG(ulBase + TIMER_O_TDR) & TIMER_TDR_DATA_M); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* routine to create an XML buffer. returns the new structure. */
xmlBufPtr xmlBufCreate(void)
/* routine to create an XML buffer. returns the new structure. */ xmlBufPtr xmlBufCreate(void)
{ xmlBufMemoryError(NULL, "creating buffer"); return(NULL); } ret->compat_use = 0; ret->use = 0; ret->error = 0; ret->buffer = NULL; ret->size = xmlDefaultBufferSize; ret->compat_size = xmlDefaultBufferSize; ret->alloc = xmlBufferAllocScheme; ret->content = (xmlChar *) xmlMa...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns %1 if @offs was in the last write to the LEB whose data is in @buf, otherwise %0 is returned. The determination is made by checking for subsequent empty space starting from the next */
static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
/* This function returns %1 if @offs was in the last write to the LEB whose data is in @buf, otherwise %0 is returned. The determination is made by checking for subsequent empty space starting from the next */ static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
{ int empty_offs, check_len; uint8_t *p; empty_offs = ALIGN(offs + 1, c->min_io_size); check_len = c->leb_size - empty_offs; p = buf + empty_offs - offs; return is_empty(p, check_len); }
robutest/uclinux
C++
GPL-2.0
60
/* klist_remove - Decrement the refcount of node and wait for it to go away. */
void klist_remove(struct klist_node *n)
/* klist_remove - Decrement the refcount of node and wait for it to go away. */ void klist_remove(struct klist_node *n)
{ struct klist_waiter waiter; waiter.node = n; waiter.process = current; waiter.woken = 0; spin_lock(&klist_remove_lock); list_add(&waiter.list, &klist_remove_waiters); spin_unlock(&klist_remove_lock); klist_del(n); for (;;) { set_current_state(TASK_UNINTERRUPTIBLE); if (waiter.woken) break; schedule(...
robutest/uclinux
C++
GPL-2.0
60
/* xprt_prepare_transmit - reserve the transport before sending a request @task: RPC task about to send a request */
int xprt_prepare_transmit(struct rpc_task *task)
/* xprt_prepare_transmit - reserve the transport before sending a request @task: RPC task about to send a request */ int xprt_prepare_transmit(struct rpc_task *task)
{ struct rpc_rqst *req = task->tk_rqstp; struct rpc_xprt *xprt = req->rq_xprt; int err = 0; dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid); spin_lock_bh(&xprt->transport_lock); if (req->rq_reply_bytes_recvd && !req->rq_bytes_sent) { err = req->rq_reply_bytes_recvd; goto out_unlock; } if (!xprt->o...
EmcraftSystems/linux-emcraft
C++
Other
266
/* try getting data on lifo with special timeout value, return result in lifo */
static void test_thread_timeout_reply_values(void *p1, void *p2, void *p3)
/* try getting data on lifo with special timeout value, return result in lifo */ static void test_thread_timeout_reply_values(void *p1, void *p2, void *p3)
{ struct reply_packet *reply_packet = (struct reply_packet *)p1; reply_packet->reply = !!k_lifo_get(&lifo_timeout[0], K_NO_WAIT); k_lifo_put(&timeout_order_lifo, reply_packet); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Divide two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumDiv(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
/* Divide two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */ BOOLEAN EFIAPI BigNumDiv(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
{ BOOLEAN RetVal; BN_CTX *Ctx; Ctx = BN_CTX_new (); if (Ctx == NULL) { return FALSE; } RetVal = (BOOLEAN)BN_div (BnRes, NULL, BnA, BnB, Ctx); BN_CTX_free (Ctx); return RetVal; }
tianocore/edk2
C++
Other
4,240
/* Gets the error status of the I2C Master module. */
unsigned long I2CMasterErr(unsigned long ulBase)
/* Gets the error status of the I2C Master module. */ unsigned long I2CMasterErr(unsigned long ulBase)
{ unsigned long ulErr; ASSERT(I2CMasterBaseValid(ulBase)); ulErr = HWREG(ulBase + I2C_O_MCS); if(ulErr & I2C_MCS_BUSY) { return(I2C_MASTER_ERR_NONE); } if(ulErr & (I2C_MCS_ERROR | I2C_MCS_ARBLST)) { return(ulErr & (I2C_MCS_ARBLST | I2C_MCS_DATACK | I2C_MCS_ADRACK)); }...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is for making the file buffer refresh as few as possible. */
EFI_STATUS FileBufferBackup(VOID)
/* This is for making the file buffer refresh as few as possible. */ EFI_STATUS FileBufferBackup(VOID)
{ FileBufferBackupVar.MousePosition = FileBuffer.MousePosition; SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName); FileBufferBackupVar.FileName = NULL; FileBufferBackupVar.FileName = StrnCatGrow (&FileBufferBackupVar.FileName, NULL, FileBuffer.FileName, 0); FileBufferBackupVar.ModeInsert = FileBuffer.ModeIns...
tianocore/edk2
C++
Other
4,240
/* Determine if an interface is actually active based on HW config we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NONE if the interface is not active based on HW cfg of the SoC */
void fman_enet_init(void)
/* Determine if an interface is actually active based on HW config we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NONE if the interface is not active based on HW cfg of the SoC */ void fman_enet_init(void)
{ int i; for (i = 0; i < ARRAY_SIZE(fm_info); i++) { phy_interface_t enet_if; enet_if = fman_port_enet_if(fm_info[i].port); if (enet_if != PHY_INTERFACE_MODE_NONE) { fm_info[i].enabled = 1; fm_info[i].enet_if = enet_if; } else { fm_info[i].enabled = 0; } } return ; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Prepare the controller for transfers. This is simply a wrapper to clear out status bits, and error bits. Also this tells the controller to flush both TX and RX FIFOs. */
static void mcux_i3c_xfer_reset(I3C_Type *base)
/* Prepare the controller for transfers. This is simply a wrapper to clear out status bits, and error bits. Also this tells the controller to flush both TX and RX FIFOs. */ static void mcux_i3c_xfer_reset(I3C_Type *base)
{ mcux_i3c_status_clear_all(base); mcux_i3c_errwarn_clear_all_nowait(base); mcux_i3c_fifo_flush(base); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Called without lock held. This is invoked from user context and may be parallel to just about everything else. Its also fairly quick and not called too often. Must protect against both bh and irq users */
static void set_multicast_list(struct net_device *dev)
/* Called without lock held. This is invoked from user context and may be parallel to just about everything else. Its also fairly quick and not called too often. Must protect against both bh and irq users */ static void set_multicast_list(struct net_device *dev)
{ unsigned long flags; spin_lock_irqsave(&dev_lock(dev), flags); do_set_multicast_list(dev); spin_unlock_irqrestore(&dev_lock(dev), flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Return number of touches detected if there are any. Try to detect new touches and forget the old ones (reset internal global variables). */
static int32_t SX8651_DetectTouch(SX8651_Object_t *pObj)
/* Return number of touches detected if there are any. Try to detect new touches and forget the old ones (reset internal global variables). */ static int32_t SX8651_DetectTouch(SX8651_Object_t *pObj)
{ int32_t ret; uint8_t nb_touch = 0; sx8651_read_reg(&pObj->Ctx, SX8651_READ_ADDR | SX8651_REG_STAT, &nb_touch, 1); nb_touch = ((nb_touch & REG_STAT_CONVIRQ) == REG_STAT_CONVIRQ); if ((nb_touch & REG_STAT_CONVIRQ) == REG_STAT_CONVIRQ) { nb_touch = 1; } ret = (int32_t)nb_touch; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Fills each TIM_TimeBaseInitStruct member with its default value. */
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
/* Fills each TIM_TimeBaseInitStruct member with its default value. */ void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
{ TIM_TimeBaseInitStruct->TIM_Period = 0xFFFFFFFF; TIM_TimeBaseInitStruct->TIM_Prescaler = 0x0000; TIM_TimeBaseInitStruct->TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseInitStruct->TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInitStruct->TIM_RepetitionCounter = 0x0000; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ks_outblk - write data to QMU. This is called after sudo DMA mode enabled. @ks: The chip information @wptr: buffer address @len: length in byte to write */
static void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
/* ks_outblk - write data to QMU. This is called after sudo DMA mode enabled. @ks: The chip information @wptr: buffer address @len: length in byte to write */ static void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
{ len >>= 1; while (len--) iowrite16(*wptr++, ks->hw_addr); }
robutest/uclinux
C++
GPL-2.0
60
/* Set up a new emulator and add it to the list */
static int spi_emul_init(const struct device *dev)
/* Set up a new emulator and add it to the list */ static int spi_emul_init(const struct device *dev)
{ struct spi_emul_data *data = dev->data; sys_slist_init(&data->emuls); return emul_init_for_bus(dev); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Then, we read the 'next' pointers from the on-card tx ring into our tx_ring array to reduce slow shared-mem reads. Finally, we intitalise the tx house keeping variables. */
static void mc32_load_tx_ring(struct net_device *dev)
/* Then, we read the 'next' pointers from the on-card tx ring into our tx_ring array to reduce slow shared-mem reads. Finally, we intitalise the tx house keeping variables. */ static void mc32_load_tx_ring(struct net_device *dev)
{ struct mc32_local *lp = netdev_priv(dev); volatile struct skb_header *p; int i; u16 tx_base; tx_base=lp->tx_box->data[0]; for(i=0 ; i<TX_RING_LEN ; i++) { p=isa_bus_to_virt(lp->base+tx_base); lp->tx_ring[i].p=p; lp->tx_ring[i].skb=NULL; tx_base=p->next; } atomic_set(&lp->tx_count, TX_RING_LEN-1); at...
robutest/uclinux
C++
GPL-2.0
60
/* Put @count bytes starting at @off into @buf from the ROM in the PCI device corresponding to @kobj. */
static ssize_t pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
/* Put @count bytes starting at @off into @buf from the ROM in the PCI device corresponding to @kobj. */ static ssize_t pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
{ struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); void __iomem *rom; size_t size; if (!pdev->rom_attr_enabled) return -EINVAL; rom = pci_map_rom(pdev, &size); if (!rom || !size) return -EIO; if (off >= size) count = 0; else { if (off + count > size) count = size - off; m...
robutest/uclinux
C++
GPL-2.0
60
/* This function is called to determine whether the BSP is compatible with the supplied device-tree, which is assumed to be the correct one for the actual board. It is expected thati, in the future, a kernel may support multiple boards. */
static int __init gef_sbc610_probe(void)
/* This function is called to determine whether the BSP is compatible with the supplied device-tree, which is assumed to be the correct one for the actual board. It is expected thati, in the future, a kernel may support multiple boards. */ static int __init gef_sbc610_probe(void)
{ unsigned long root = of_get_flat_dt_root(); if (of_flat_dt_is_compatible(root, "gef,sbc610")) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable fault detect mask function of selected channel. */
void EPWM_DisableFaultDetectMask(EPWM_T *epwm, uint32_t u32ChannelNum)
/* Disable fault detect mask function of selected channel. */ void EPWM_DisableFaultDetectMask(EPWM_T *epwm, uint32_t u32ChannelNum)
{ (epwm)->FDCTL[(u32ChannelNum)] &= ~EPWM_FDCTL0_FDMSKEN_Msk; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_list_queued_owners_finish(_GFreedesktopDBus *proxy, gchar ***out_queued_owners, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_list_queued_owners_finish(_GFreedesktopDBus *proxy, gchar ***out_queued_owners, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(^as)", out_queued_owners); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Description: Returns ptes on success, NULL on error. Allocates space for PTEs based on information found in @gpt. Notes: remember to free pte when you're done! */
static gpt_entry* alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
/* Description: Returns ptes on success, NULL on error. Allocates space for PTEs based on information found in @gpt. Notes: remember to free pte when you're done! */ static gpt_entry* alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
{ size_t count; gpt_entry *pte; if (!bdev || !gpt) return NULL; count = le32_to_cpu(gpt->num_partition_entries) * le32_to_cpu(gpt->sizeof_partition_entry); if (!count) return NULL; pte = kzalloc(count, GFP_KERNEL); if (!pte) return NULL; if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_...
robutest/uclinux
C++
GPL-2.0
60
/* This deletes a driver "instance". The device is de-registered with Card Services. If it has been released, all local data structures are freed. Otherwise, the structures will be freed when the device is released. */
static void if_cs_detach(struct pcmcia_device *p_dev)
/* This deletes a driver "instance". The device is de-registered with Card Services. If it has been released, all local data structures are freed. Otherwise, the structures will be freed when the device is released. */ static void if_cs_detach(struct pcmcia_device *p_dev)
{ struct if_cs_card *card = p_dev->priv; lbs_deb_enter(LBS_DEB_CS); lbs_stop_card(card->priv); lbs_remove_card(card->priv); if_cs_disable_ints(card); if_cs_release(p_dev); kfree(card); lbs_deb_leave(LBS_DEB_CS); }
robutest/uclinux
C++
GPL-2.0
60
/* Display Sub-Leaf 1 Enumeration of Intel SGX Capabilities. */
VOID CpuidEnumerationOfIntelSgxCapabilities1SubLeaf(VOID)
/* Display Sub-Leaf 1 Enumeration of Intel SGX Capabilities. */ VOID CpuidEnumerationOfIntelSgxCapabilities1SubLeaf(VOID)
{ UINT32 Eax; UINT32 Ebx; UINT32 Ecx; UINT32 Edx; AsmCpuidEx ( CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_1_SUB_LEAF, &Eax, &Ebx, &Ecx, &Edx ); Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_1_SUB_LEAF); Print (L" E...
tianocore/edk2
C++
Other
4,240
/* See "mss_ace.h" for details of how to use this function. */
void ACE_set_sdd_value(sdd_id_t sdd_id, uint32_t sdd_value)
/* See "mss_ace.h" for details of how to use this function. */ void ACE_set_sdd_value(sdd_id_t sdd_id, uint32_t sdd_value)
{ ASSERT( sdd_id < NB_OF_SDD ); if ( sdd_id < NB_OF_SDD ) { *dac_byte2_reg_lut[sdd_id] = sdd_value >> 16; *dac_byte01_reg_lut[sdd_id] = sdd_value; } }
apopple/Pandaboard-FreeRTOS
C++
null
25