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
/* Status bytes (from index 1) contain 1's complement page indirection So for N writes: N=1: ff ff ff ff ff ff ff 00 N=2: ff fe ff ff ff ff ff 00 N=3: ff fe fd ff ff ff ff 00 N=4: ff fe fd fc ff ff ff 00 */
static int ds2502_indirect_page(struct udevice *dev, u8 *status, int page)
/* Status bytes (from index 1) contain 1's complement page indirection So for N writes: N=1: ff ff ff ff ff ff ff 00 N=2: ff fe ff ff ff ff ff 00 N=3: ff fe fd ff ff ff ff 00 N=4: ff fe fd fc ff ff ff 00 */ static int ds2502_indirect_page(struct udevice *dev, u8 *status, int page)
{ int page_seen = 0; do { u8 sb = status[page + 1]; if (sb == 0xff) break; page = ~sb & 0xff; if (page >= DS2502_PAGE_COUNT) { dev_err(dev, "Illegal page redirection status byte %02x\n", sb); return -EINVAL; } if (page_seen & (1 << page)) { dev_err(dev, "Infinite loop in page redirection\n"); return -EINVAL; } page_seen |= (1 << page); } while (1); return page; }
4ms/stm32mp1-baremetal
C++
Other
137
/* WMI can have EmbeddedControl access regions. In which case, we just want to hand these off to the EC driver. */
static acpi_status acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, u32 bits, acpi_integer *value, void *handler_context, void *region_context)
/* WMI can have EmbeddedControl access regions. In which case, we just want to hand these off to the EC driver. */ static acpi_status acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, u32 bits, acpi_integer *value, void *handler_context, void *region_context)
{ int result = 0, i = 0; u8 temp = 0; if ((address > 0xFF) || !value) return AE_BAD_PARAMETER; if (function != ACPI_READ && function != ACPI_WRITE) return AE_BAD_PARAMETER; if (bits != 8) return AE_BAD_PARAMETER; if (function == ACPI_READ) { result = ec_read(address, &temp); (*value) |= ((acpi_integer)temp) << i; } else { temp = 0xff & ((*value) >> i); result = ec_write(address, temp); } switch (result) { case -EINVAL: return AE_BAD_PARAMETER; break; case -ENODEV: return AE_NOT_FOUND; break; case -ETIME: return AE_TIME; break; default: return AE_OK; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* XXX - should this have a "Help" button that pops up the display filter help? */
void bad_dfilter_alert_box(GtkWidget *parent, const char *dftext, gchar *err_msg)
/* XXX - should this have a "Help" button that pops up the display filter help? */ void bad_dfilter_alert_box(GtkWidget *parent, const char *dftext, gchar *err_msg)
{ GtkWidget *msg_dialog; msg_dialog = gtk_message_dialog_new(GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "The filter expression \"%s\" isn't a valid display filter. (%s)", dftext, err_msg); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(msg_dialog), "See the help for a description of the display filter syntax."); gtk_dialog_run(GTK_DIALOG(msg_dialog)); gtk_widget_destroy(msg_dialog); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clears or safeguards the OCREF1 signal on an external event. */
void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF1 signal on an external event. */ void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint32_t tmpccmr1 = 0; assert_param(IS_TIM_LIST1_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC1CE; tmpccmr1 |= TIM_OCClear; TIMx->CCMR1 = tmpccmr1; }
ajhc/demo-cortex-m3
C++
null
38
/* Returns 0 (no space) on failed expansion, or available space if successful. */
static int audit_expand(struct audit_buffer *ab, int extra)
/* Returns 0 (no space) on failed expansion, or available space if successful. */ static int audit_expand(struct audit_buffer *ab, int extra)
{ struct sk_buff *skb = ab->skb; int oldtail = skb_tailroom(skb); int ret = pskb_expand_head(skb, 0, extra, ab->gfp_mask); int newtail = skb_tailroom(skb); if (ret < 0) { audit_log_lost("out of memory in audit_expand"); return 0; } skb->truesize += newtail - oldtail; return newtail; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Stub to make POST code happy. Can't self-poweroff, so just hang. */
void board_poweroff(void)
/* Stub to make POST code happy. Can't self-poweroff, so just hang. */ void board_poweroff(void)
{ puts ("### Please power off the board ###\n"); while (1); }
EmcraftSystems/u-boot
C++
Other
181
/* Submit a USB set descriptor request for the USB device specified by UsbIo, Value, and Index, and set the descriptor using the buffer specified by DesriptorLength and Descriptor. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If Descriptor is NULL, then ASSERT(). If Status is NULL, then ASSERT(). */
EFI_STATUS EFIAPI UsbSetDescriptor(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Value, IN UINT16 Index, IN UINT16 DescriptorLength, IN VOID *Descriptor, OUT UINT32 *Status)
/* Submit a USB set descriptor request for the USB device specified by UsbIo, Value, and Index, and set the descriptor using the buffer specified by DesriptorLength and Descriptor. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If Descriptor is NULL, then ASSERT(). If Status is NULL, then ASSERT(). */ EFI_STATUS EFIAPI UsbSetDescriptor(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT16 Value, IN UINT16 Index, IN UINT16 DescriptorLength, IN VOID *Descriptor, OUT UINT32 *Status)
{ EFI_USB_DEVICE_REQUEST DevReq; ASSERT (UsbIo != NULL); ASSERT (Descriptor != NULL); ASSERT (Status != NULL); ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE; DevReq.Request = USB_REQ_SET_DESCRIPTOR; DevReq.Value = Value; DevReq.Index = Index; DevReq.Length = DescriptorLength; return UsbIo->UsbControlTransfer ( UsbIo, &DevReq, EfiUsbDataOut, PcdGet32 (PcdUsbTransferTimeoutValue), Descriptor, DescriptorLength, Status ); }
tianocore/edk2
C++
Other
4,240
/* Checks whether the specified RST flag is set or not. */
FlagStatus RST_GetFlagStatus(RST_FLAG_TypeDef RST_Flag)
/* Checks whether the specified RST flag is set or not. */ FlagStatus RST_GetFlagStatus(RST_FLAG_TypeDef RST_Flag)
{ assert_param(IS_RST_FLAG(RST_Flag)); return ((FlagStatus)((uint8_t)RST->SR & (uint8_t)RST_Flag)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* the POSIX lock management core VFS code copies the lock record and adds the copy into its own list, so we need to add that copy to the vnode's lock queue in the same place as the original (which will be deleted shortly after) */
static void afs_fl_copy_lock(struct file_lock *new, struct file_lock *fl)
/* the POSIX lock management core VFS code copies the lock record and adds the copy into its own list, so we need to add that copy to the vnode's lock queue in the same place as the original (which will be deleted shortly after) */ static void afs_fl_copy_lock(struct file_lock *new, struct file_lock *fl)
{ _enter(""); list_add(&new->fl_u.afs.link, &fl->fl_u.afs.link); }
robutest/uclinux
C++
GPL-2.0
60
/* Resume I2C transaction. This function is unusual, but required to implement i2c exchange with this peripheral. */
void i2c_resume(uint32_t i2c)
/* Resume I2C transaction. This function is unusual, but required to implement i2c exchange with this peripheral. */ void i2c_resume(uint32_t i2c)
{ periph_trigger_task(I2C_TASK_RESUME(i2c)); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Enables a Generic Clock Generator that was previously configured. Starts the clock generation of a Generic Clock Generator that was previously configured via a call to */
void system_gclk_gen_enable(const uint8_t generator)
/* Enables a Generic Clock Generator that was previously configured. Starts the clock generation of a Generic Clock Generator that was previously configured via a call to */ void system_gclk_gen_enable(const uint8_t generator)
{ while (system_gclk_is_syncing()) { }; system_interrupt_enter_critical_section(); *((uint8_t*)&GCLK->GENCTRL.reg) = generator; while (system_gclk_is_syncing()) { }; GCLK->GENCTRL.reg |= GCLK_GENCTRL_GENEN; system_interrupt_leave_critical_section(); }
memfault/zero-to-main
C++
null
200
/* Not like A380, in Armada3700, there are two layers of decode windows for GBE: First layer is: GbE Address window that resides inside the GBE unit, Second layer is: Fabric address window which is located in the NIC400 (South Fabric). To simplify the address decode configuration for Armada3700, we bypass the first layer of GBE decode window by setting the first window to 4GB. */
static void mvneta_bypass_mbus_windows(struct mvneta_port *pp)
/* Not like A380, in Armada3700, there are two layers of decode windows for GBE: First layer is: GbE Address window that resides inside the GBE unit, Second layer is: Fabric address window which is located in the NIC400 (South Fabric). To simplify the address decode configuration for Armada3700, we bypass the first layer of GBE decode window by setting the first window to 4GB. */ static void mvneta_bypass_mbus_windows(struct mvneta_port *pp)
{ mvreg_write(pp, MVNETA_WIN_SIZE(0), MVNETA_WIN_SIZE_MASK); clrbits_le32(pp->base + MVNETA_BASE_ADDR_ENABLE, MVNETA_BASE_ADDR_ENABLE_BIT); setbits_le32(pp->base + MVNETA_PORT_ACCESS_PROTECT, MVNETA_PORT_ACCESS_PROTECT_WIN0_RW); }
4ms/stm32mp1-baremetal
C++
Other
137
/* p is at least 6 bytes before the end of page */
static struct ext4_dir_entry_2* ext4_next_entry(struct ext4_dir_entry_2 *p, unsigned long blocksize)
/* p is at least 6 bytes before the end of page */ static struct ext4_dir_entry_2* ext4_next_entry(struct ext4_dir_entry_2 *p, unsigned long blocksize)
{ return (struct ext4_dir_entry_2 *)((char *)p + ext4_rec_len_from_disk(p->rec_len, blocksize)); }
robutest/uclinux
C++
GPL-2.0
60
/* Read the CMOS clock through the BIOS, and return the seconds in BCD. */
static u8 gettime(void)
/* Read the CMOS clock through the BIOS, and return the seconds in BCD. */ static u8 gettime(void)
{ struct biosregs ireg, oreg; initregs(&ireg); ireg.ah = 0x02; intcall(0x1a, &ireg, &oreg); return oreg.dh; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server. */
EFI_STATUS EFIAPI AddDns6ServerIp(IN LIST_ENTRY *Dns6ServerList, IN EFI_IPv6_ADDRESS ServerIp)
/* Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server. */ EFI_STATUS EFIAPI AddDns6ServerIp(IN LIST_ENTRY *Dns6ServerList, IN EFI_IPv6_ADDRESS ServerIp)
{ DNS6_SERVER_IP *NewServerIp; DNS6_SERVER_IP *Item; LIST_ENTRY *Entry; LIST_ENTRY *Next; NewServerIp = NULL; Item = NULL; NET_LIST_FOR_EACH_SAFE (Entry, Next, Dns6ServerList) { Item = NET_LIST_USER_STRUCT (Entry, DNS6_SERVER_IP, AllServerLink); if (CompareMem (&Item->Dns6ServerIp, &ServerIp, sizeof (EFI_IPv6_ADDRESS)) == 0) { return EFI_SUCCESS; } } NewServerIp = AllocatePool (sizeof (DNS6_SERVER_IP)); if (NewServerIp == NULL) { return EFI_OUT_OF_RESOURCES; } InitializeListHead (&NewServerIp->AllServerLink); CopyMem (&NewServerIp->Dns6ServerIp, &ServerIp, sizeof (EFI_IPv6_ADDRESS)); InsertTailList (Dns6ServerList, &NewServerIp->AllServerLink); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* send signal info to all the members of a group */
int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
/* send signal info to all the members of a group */ int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
{ int ret = check_kill_permission(sig, info, p); if (!ret && sig) ret = do_send_sig_info(sig, info, p, true); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remove all addresses that were added to the destination device by dev_mc_sync(). This function is intended to be called from the dev->stop function of layered software devices. */
void dev_mc_unsync(struct net_device *to, struct net_device *from)
/* Remove all addresses that were added to the destination device by dev_mc_sync(). This function is intended to be called from the dev->stop function of layered software devices. */ void dev_mc_unsync(struct net_device *to, struct net_device *from)
{ netif_addr_lock_bh(from); netif_addr_lock(to); __dev_addr_unsync(&to->mc_list, &to->mc_count, &from->mc_list, &from->mc_count); __dev_set_rx_mode(to); netif_addr_unlock(to); netif_addr_unlock_bh(from); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write (both set and clear) bits of an 8-bit register on the LIS3DH. */
static int lis3dh_write_bits(const lis3dh_t *dev, const lis3dh_reg_t reg, const uint8_t mask, const uint8_t values)
/* Write (both set and clear) bits of an 8-bit register on the LIS3DH. */ static int lis3dh_write_bits(const lis3dh_t *dev, const lis3dh_reg_t reg, const uint8_t mask, const uint8_t values)
{ uint8_t tmp; if (lis3dh_read_regs(dev, reg, 1, &tmp) < 0) { return -1; } tmp &= ~mask; tmp |= (values & mask); if (lis3dh_write_reg(dev, reg, tmp) < 0) { return -1; } return 0; }
labapart/polymcu
C++
null
201
/* Enable the voltage comparator. This function powers up the voltage comparator. */
void am_hal_vcomp_enable(void)
/* Enable the voltage comparator. This function powers up the voltage comparator. */ void am_hal_vcomp_enable(void)
{ AM_REG(VCOMP, PWDKEY) = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable MII mode for EMAC, called once after autonegotiate. */
void EMAC_EnableMII(void)
/* Enable MII mode for EMAC, called once after autonegotiate. */ void EMAC_EnableMII(void)
{ AT91C_BASE_EMAC->EMAC_USRIO = AT91C_EMAC_CLKEN; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Clear the slave select pins of the specified SPI port. */
void SPISSClear(unsigned long ulBase)
/* Clear the slave select pins of the specified SPI port. */ void SPISSClear(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xHWREG(ulBase + SPI_CNTRL0) &= ~SPI_CNTRL0_SSELC; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Init interrupts callback for the specified SPI Port. */
void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
/* Init interrupts callback for the specified SPI Port. */ void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); switch(ulBase) { case SPI0_BASE: { g_pfnSPIHandlerCallbacks[0] = xtSPICallback; break; } case SPI1_BASE: { g_pfnSPIHandlerCallbacks[1] = xtSPICallback; break; } case SPI2_BASE: { g_pfnSPIHandlerCallbacks[2] = xtSPICallback; break; } default: break; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This API configure the interrupt PIN setting for significant motion interrupt. */
static int8_t config_sig_motion_int_settg(const struct bmi160_int_settg *int_config, const struct bmi160_acc_sig_mot_int_cfg *sig_mot_int_cfg, const struct bmi160_dev *dev)
/* This API configure the interrupt PIN setting for significant motion interrupt. */ static int8_t config_sig_motion_int_settg(const struct bmi160_int_settg *int_config, const struct bmi160_acc_sig_mot_int_cfg *sig_mot_int_cfg, const struct bmi160_dev *dev)
{ int8_t rslt; rslt = set_intr_pin_config(int_config, dev); if (rslt == BMI160_OK) { rslt = map_feature_interrupt(int_config, dev); if (rslt == BMI160_OK) { rslt = config_sig_motion_data_src(sig_mot_int_cfg, dev); if (rslt == BMI160_OK) { rslt = config_sig_dur_threshold(sig_mot_int_cfg, dev); } } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Function to start the first task executing - written in asm code as direct access to registers is required. */
static void prvStartFirstTask(void)
/* Function to start the first task executing - written in asm code as direct access to registers is required. */ static void prvStartFirstTask(void)
{ SETPSW U MOV.L #_pxCurrentTCB, R15 MOV.L [R15], R15 MOV.L [R15], R0 POP R15 MVTACLO R15 POP R15 MVTACHI R15 POP R15 MVTC R15,FPSW POPM R1-R15 RTE NOP NOP }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).. */
int32_t lsm6dso_act_pin_notification_set(stmdev_ctx_t *ctx, lsm6dso_sleep_status_on_int_t val)
/* Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).. */ int32_t lsm6dso_act_pin_notification_set(stmdev_ctx_t *ctx, lsm6dso_sleep_status_on_int_t val)
{ lsm6dso_tap_cfg0_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_TAP_CFG0, (uint8_t *)&reg, 1); if (ret == 0) { reg.sleep_status_on_int = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_TAP_CFG0, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Stop the TC clock on the specified channel. */
void tc_stop(Tc *p_tc, uint32_t ul_channel)
/* Stop the TC clock on the specified channel. */ void tc_stop(Tc *p_tc, uint32_t ul_channel)
{ Assert(p_tc); Assert(ul_channel < (sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0]))); p_tc->TC_CHANNEL[ul_channel].TC_CCR = TC_CCR_CLKDIS; }
remotemcu/remcu-chip-sdks
C++
null
436
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==UART4) { __HAL_RCC_UART4_CLK_DISABLE(); HAL_GPIO_DeInit(STLINK_RX_GPIO_Port, STLINK_RX_Pin); HAL_GPIO_DeInit(STLINK_TX_GPIO_Port, STLINK_TX_Pin); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_12); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called by the router when device is being unregistered or when it handles ROUTER_DOWN IOCTL. */
static int cycx_wan_shutdown(struct wan_device *wandev)
/* This function is called by the router when device is being unregistered or when it handles ROUTER_DOWN IOCTL. */ static int cycx_wan_shutdown(struct wan_device *wandev)
{ int ret = -EFAULT; struct cycx_device *card; if (!wandev || !wandev->private) goto out; ret = 0; if (wandev->state == WAN_UNCONFIGURED) goto out; card = wandev->private; wandev->state = WAN_UNCONFIGURED; cycx_down(&card->hw); printk(KERN_INFO "%s: irq %d being freed!\n", wandev->name, wandev->irq); free_irq(wandev->irq, card); out: return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Get number of available slots for messages in a Message Queue. */
uint32_t osMessageQueueGetSpace(osMessageQueueId_t msgq_id)
/* Get number of available slots for messages in a Message Queue. */ uint32_t osMessageQueueGetSpace(osMessageQueueId_t msgq_id)
{ struct cv2_msgq *msgq = (struct cv2_msgq *)msgq_id; if (msgq == NULL) { return 0; } else { return k_msgq_num_free_get(&msgq->z_msgq); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Frees a subscription object and all its associated memory. */
void _kh_sub_free(kqueue_sub *sub)
/* Frees a subscription object and all its associated memory. */ void _kh_sub_free(kqueue_sub *sub)
{ if (sub->deps) { dl_free (sub->deps); sub->deps = NULL; } g_free (sub->filename); g_slice_free (kqueue_sub, sub); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* To use txn_XXX() interfaces, get a Virtual IRQ first. Then use that to get the Transaction address and data. */
int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)
/* To use txn_XXX() interfaces, get a Virtual IRQ first. Then use that to get the Transaction address and data. */ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)
{ if (irq_desc[irq].action) return -EBUSY; if (irq_desc[irq].chip != &cpu_interrupt_type) return -EBUSY; if (type) { irq_desc[irq].chip = type; irq_desc[irq].chip_data = data; cpu_interrupt_type.enable(irq); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if filesystem has at least 1 free block available for allocation. */
static int ext2_has_free_blocks(struct ext2_sb_info *sbi)
/* Check if filesystem has at least 1 free block available for allocation. */ static int ext2_has_free_blocks(struct ext2_sb_info *sbi)
{ ext2_fsblk_t free_blocks, root_blocks; free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count); if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) && sbi->s_resuid != current_fsuid() && (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) { return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a text device path node to Wi-Fi device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextWiFi(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to Wi-Fi device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextWiFi(IN CHAR16 *TextDeviceNode)
{ CHAR16 *SSIdStr; CHAR8 AsciiStr[33]; UINTN DataLen; WIFI_DEVICE_PATH *WiFiDp; SSIdStr = GetNextParamStr (&TextDeviceNode); WiFiDp = (WIFI_DEVICE_PATH *)CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_WIFI_DP, (UINT16)sizeof (WIFI_DEVICE_PATH) ); if (NULL != SSIdStr) { DataLen = StrLen (SSIdStr); if (StrLen (SSIdStr) > 32) { SSIdStr[32] = L'\0'; DataLen = 32; } UnicodeStrToAsciiStrS (SSIdStr, AsciiStr, sizeof (AsciiStr)); CopyMem (WiFiDp->SSId, AsciiStr, DataLen); } return (EFI_DEVICE_PATH_PROTOCOL *)WiFiDp; }
tianocore/edk2
C++
Other
4,240
/* Flash support routines qla2x00_flash_enable() - Setup flash for reading and writing. @ha: HA context */
static void qla2x00_flash_enable(struct qla_hw_data *ha)
/* Flash support routines qla2x00_flash_enable() - Setup flash for reading and writing. @ha: HA context */ static void qla2x00_flash_enable(struct qla_hw_data *ha)
{ uint16_t data; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; data = RD_REG_WORD(&reg->ctrl_status); data |= CSR_FLASH_ENABLE; WRT_REG_WORD(&reg->ctrl_status, data); RD_REG_WORD(&reg->ctrl_status); }
robutest/uclinux
C++
GPL-2.0
60
/* NOTE: This function does NOT do any cache flushing. The caller is responsible for calling flush_cache_vunmap() on to-be-mapped areas before calling this function and flush_tlb_kernel_range() after. */
void unmap_kernel_range_noflush(unsigned long addr, unsigned long size)
/* NOTE: This function does NOT do any cache flushing. The caller is responsible for calling flush_cache_vunmap() on to-be-mapped areas before calling this function and flush_tlb_kernel_range() after. */ void unmap_kernel_range_noflush(unsigned long addr, unsigned long size)
{ vunmap_page_range(addr, addr + size); }
robutest/uclinux
C++
GPL-2.0
60
/* Called when removing the device driver. We disable clock usage and release the resources taken up by the driver and unregister network device */
static int __devexit davinci_emac_remove(struct platform_device *pdev)
/* Called when removing the device driver. We disable clock usage and release the resources taken up by the driver and unregister network device */ static int __devexit davinci_emac_remove(struct platform_device *pdev)
{ struct resource *res; struct net_device *ndev = platform_get_drvdata(pdev); struct emac_priv *priv = netdev_priv(ndev); dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n"); platform_set_drvdata(pdev, NULL); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mdiobus_unregister(priv->mii_bus); mdiobus_free(priv->mii_bus); release_mem_region(res->start, res->end - res->start + 1); unregister_netdev(ndev); free_netdev(ndev); iounmap(priv->remap_addr); clk_disable(emac_clk); clk_put(emac_clk); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8904_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_WM8904_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
{ assert(handle != NULL); return WM8904_SetAudioFormat((wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), mclk, HAL_WM8904_MAP_SAMPLERATE(sampleRate), bitWidth); }
eclipse-threadx/getting-started
C++
Other
310
/* Enable the DMA of the specified SPI port. The */
void SPIPDMAEnable(unsigned long ulBase, unsigned long ulDmaMode)
/* Enable the DMA of the specified SPI port. The */ void SPIPDMAEnable(unsigned long ulBase, unsigned long ulDmaMode)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); xHWREG(ulBase + SPI_DMACTL) |= ulDmaMode; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Currently we are limited to power of two sized DDR since we only use a single bat. If a non-power of two size is used that is less than CONFIG_MAX_MEM_MAPPED u-boot will crash. */
void setup_ddr_bat(phys_addr_t dram_size)
/* Currently we are limited to power of two sized DDR since we only use a single bat. If a non-power of two size is used that is less than CONFIG_MAX_MEM_MAPPED u-boot will crash. */ void setup_ddr_bat(phys_addr_t dram_size)
{ unsigned long batu, bl; bl = TO_BATU_BL(min(dram_size, CONFIG_MAX_MEM_MAPPED)); if (BATU_SIZE(bl) != dram_size) { u64 sz = (u64)dram_size - BATU_SIZE(bl); print_size(sz, " left unmapped\n"); } batu = bl | BATU_VS | BATU_VP; write_bat(DBAT0, batu, CONFIG_SYS_DBAT0L); write_bat(IBAT0, batu, CONFIG_SYS_IBAT0L); }
EmcraftSystems/u-boot
C++
Other
181
/* Returns: the translation of @str to the current locale */
const gchar* glib_pgettext(const gchar *msgctxtid, gsize msgidoffset)
/* Returns: the translation of @str to the current locale */ const gchar* glib_pgettext(const gchar *msgctxtid, gsize msgidoffset)
{ ensure_gettext_initialized (); return g_dpgettext (GETTEXT_PACKAGE, msgctxtid, msgidoffset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* After the caller of journal_get_descriptor_buffer() has finished modifying the buffer's contents they really should run flush_dcache_page(bh->b_page). But we don't bother doing that, so there will be coherency problems with mmaps of blockdevs which hold live JBD-controlled filesystems. */
struct journal_head* journal_get_descriptor_buffer(journal_t *journal)
/* After the caller of journal_get_descriptor_buffer() has finished modifying the buffer's contents they really should run flush_dcache_page(bh->b_page). But we don't bother doing that, so there will be coherency problems with mmaps of blockdevs which hold live JBD-controlled filesystems. */ struct journal_head* journal_get_descriptor_buffer(journal_t *journal)
{ struct buffer_head *bh; unsigned int blocknr; int err; err = journal_next_log_block(journal, &blocknr); if (err) return NULL; bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); if (!bh) return NULL; lock_buffer(bh); memset(bh->b_data, 0, journal->j_blocksize); set_buffer_uptodate(bh); unlock_buffer(bh); BUFFER_TRACE(bh, "return this buffer"); return journal_add_journal_head(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used to attempt to recover the external oscillator after a */
void HibernateTamperExtOscRecover(void)
/* This function is used to attempt to recover the external oscillator after a */ void HibernateTamperExtOscRecover(void)
{ HWREG(HIB_LOCK) = HIB_LOCK_HIBLOCK_KEY; _HibernateWriteComplete(); HWREG(HIB_TPSTAT) |= HIB_TPSTAT_XOSCFAIL; _HibernateWriteComplete(); HWREG(HIB_LOCK) = 0; _HibernateWriteComplete(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return data element in an Array by its Index. */
UINT64 GetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index)
/* Return data element in an Array by its Index. */ UINT64 GetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index)
{ UINT64 Data; ASSERT (Array != NULL); Data = 0; switch (Type) { case EFI_IFR_TYPE_NUM_SIZE_8: Data = (UINT64)*(((UINT8 *)Array) + Index); break; case EFI_IFR_TYPE_NUM_SIZE_16: Data = (UINT64)*(((UINT16 *)Array) + Index); break; case EFI_IFR_TYPE_NUM_SIZE_32: Data = (UINT64)*(((UINT32 *)Array) + Index); break; case EFI_IFR_TYPE_NUM_SIZE_64: Data = (UINT64)*(((UINT64 *)Array) + Index); break; default: break; } return Data; }
tianocore/edk2
C++
Other
4,240
/* Reconfigures the main PLL for a HSE source. Any reserved bits are kept at their reset values. */
void rcc_set_main_pll_hse(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
/* Reconfigures the main PLL for a HSE source. Any reserved bits are kept at their reset values. */ void rcc_set_main_pll_hse(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
{ if (pllr < 2) { pllr = 2; } RCC_PLLCFGR = RCC_PLLCFGR_PLLSRC | ((pllm & RCC_PLLCFGR_PLLM_MASK) << RCC_PLLCFGR_PLLM_SHIFT) | ((plln & RCC_PLLCFGR_PLLN_MASK) << RCC_PLLCFGR_PLLN_SHIFT) | ((((pllp >> 1) - 1) & RCC_PLLCFGR_PLLP_MASK) << RCC_PLLCFGR_PLLP_SHIFT) | ((pllq & RCC_PLLCFGR_PLLQ_MASK) << RCC_PLLCFGR_PLLQ_SHIFT) | ((pllr & RCC_PLLCFGR_PLLR_MASK) << RCC_PLLCFGR_PLLR_SHIFT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Read the EEPROM for the current default LED configuration. If the LED configuration is not valid, set to a valid LED configuration. */
static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
/* Read the EEPROM for the current default LED configuration. If the LED configuration is not valid, set to a valid LED configuration. */ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
{ s32 ret_val; ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); if (ret_val) { e_dbg("NVM Read Error\n"); return ret_val; } switch (hw->mac.type) { case e1000_82573: case e1000_82574: case e1000_82583: if (*data == ID_LED_RESERVED_F746) *data = ID_LED_DEFAULT_82573; break; default: if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) *data = ID_LED_DEFAULT; break; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Once all references to platform device are down to 0, release all allocated structures. */
void tpm_dev_release(struct device *dev)
/* Once all references to platform device are down to 0, release all allocated structures. */ void tpm_dev_release(struct device *dev)
{ struct tpm_chip *chip = dev_get_drvdata(dev); tpm_dev_vendor_release(chip); chip->release(dev); kfree(chip); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the size of one sample (in bytes) on the given channel. */
static unsigned char GetSampleSize(unsigned char channel)
/* Returns the size of one sample (in bytes) on the given channel. */ static unsigned char GetSampleSize(unsigned char channel)
{ unsigned int size = 0; SANITY_CHECK((channel == AC97C_CHANNEL_A) || (channel == AC97C_CHANNEL_B) || (channel == AC97C_CHANNEL_CODEC)); switch (channel) { case AC97C_CHANNEL_CODEC: return 2; case AC97C_CHANNEL_A: size = (AT91C_BASE_AC97C->AC97C_CAMR & AT91C_AC97C_SIZE) >> 16; break; case AC97C_CHANNEL_B: size = (AT91C_BASE_AC97C->AC97C_CBMR & AT91C_AC97C_SIZE) >> 16; break; } if ((size & 2) != 0) { return 2; } else { return 4; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Writes bits at positions specified by mask to an OV51x reg. Bits that are in the same position as 1's in "mask" are cleared and set to "value". Bits that are in the same position as 0's in "mask" are preserved, regardless of their respective state in "value". */
static int reg_w_mask(struct usb_ov511 *ov, unsigned char reg, unsigned char value, unsigned char mask)
/* Writes bits at positions specified by mask to an OV51x reg. Bits that are in the same position as 1's in "mask" are cleared and set to "value". Bits that are in the same position as 0's in "mask" are preserved, regardless of their respective state in "value". */ static int reg_w_mask(struct usb_ov511 *ov, unsigned char reg, unsigned char value, unsigned char mask)
{ int ret; unsigned char oldval, newval; ret = reg_r(ov, reg); if (ret < 0) return ret; oldval = (unsigned char) ret; oldval &= (~mask); value &= mask; newval = oldval | value; return (reg_w(ov, reg, newval)); }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the echo mode of finsh shell. */
rt_uint32_t finsh_get_echo()
/* This function gets the echo mode of finsh shell. */ rt_uint32_t finsh_get_echo()
{ RT_ASSERT(shell != RT_NULL); return shell->echo_mode; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
int serial_init(void)
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ int serial_init(void)
{ __REG(UART_PHYS + UCR1) = 0x0; __REG(UART_PHYS + UCR2) = 0x0; while (!(__REG(UART_PHYS + UCR2) & UCR2_SRST)); __REG(UART_PHYS + UCR3) = 0x0704; __REG(UART_PHYS + UCR4) = 0x8000; __REG(UART_PHYS + UESC) = 0x002b; __REG(UART_PHYS + UTIM) = 0x0; __REG(UART_PHYS + UTS) = 0x0; serial_setbrg(); __REG(UART_PHYS + UCR2) = UCR2_WS | UCR2_IRTS | UCR2_RXEN | UCR2_TXEN | UCR2_SRST; __REG(UART_PHYS + UCR1) = UCR1_UARTEN; return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* config the pmc register to the default mode. */
void PMC_DeInit(PMC_Type *pPMC)
/* config the pmc register to the default mode. */ void PMC_DeInit(PMC_Type *pPMC)
{ pPMC->SPMSC1 = 0x1C; pPMC->SPMSC2 = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function: const char *arxescsi_info(struct Scsi_Host * host) Purpose : returns a descriptive string about this interface, Params : host - driver host structure to return info for. Returns : pointer to a static buffer containing null terminated string. */
static const char* arxescsi_info(struct Scsi_Host *host)
/* Function: const char *arxescsi_info(struct Scsi_Host * host) Purpose : returns a descriptive string about this interface, Params : host - driver host structure to return info for. Returns : pointer to a static buffer containing null terminated string. */ static const char* arxescsi_info(struct Scsi_Host *host)
{ struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata; static char string[150]; sprintf(string, "%s (%s) in slot %d v%s", host->hostt->name, info->info.scsi.type, info->ec->slot_no, VERSION); return string; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine sets up an entry in the non-embedded mailbox command at the sge index location. */
void lpfc_sli4_mbx_sge_set(struct lpfcMboxq *mbox, uint32_t sgentry, dma_addr_t phyaddr, uint32_t length)
/* This routine sets up an entry in the non-embedded mailbox command at the sge index location. */ void lpfc_sli4_mbx_sge_set(struct lpfcMboxq *mbox, uint32_t sgentry, dma_addr_t phyaddr, uint32_t length)
{ struct lpfc_mbx_nembed_cmd *nembed_sge; nembed_sge = (struct lpfc_mbx_nembed_cmd *) &mbox->u.mqe.un.nembed_cmd; nembed_sge->sge[sgentry].pa_lo = putPaddrLow(phyaddr); nembed_sge->sge[sgentry].pa_hi = putPaddrHigh(phyaddr); nembed_sge->sge[sgentry].length = length; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the current statistics. This may be called with the card open or closed. */
static struct net_device_stats * tms380tr_get_stats(struct net_device *dev)
/* Get the current statistics. This may be called with the card open or closed. */ static struct net_device_stats * tms380tr_get_stats(struct net_device *dev)
{ struct net_local *tp = netdev_priv(dev); return ((struct net_device_stats *)&tp->MacStat); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate offset of the n-th record in a btree block. */
STATIC size_t xfs_btree_rec_offset(struct xfs_btree_cur *cur, int n)
/* Calculate offset of the n-th record in a btree block. */ STATIC size_t xfs_btree_rec_offset(struct xfs_btree_cur *cur, int n)
{ return xfs_btree_block_len(cur) + (n - 1) * cur->bc_ops->rec_len; }
robutest/uclinux
C++
GPL-2.0
60
/* Backend ready function for ble logger. After initialization of the logger, this function avoids the logger subys to enable it. The logger is enabled automatically via the notification changed callback. */
static int backend_ready(const struct log_backend *const backend)
/* Backend ready function for ble logger. After initialization of the logger, this function avoids the logger subys to enable it. The logger is enabled automatically via the notification changed callback. */ static int backend_ready(const struct log_backend *const backend)
{ ARG_UNUSED(backend); return -EACCES; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Disable all TWL RTC module interrupts. Sets status flag to free. */
static int __devexit twl_rtc_remove(struct platform_device *pdev)
/* Disable all TWL RTC module interrupts. Sets status flag to free. */ static int __devexit twl_rtc_remove(struct platform_device *pdev)
{ struct rtc_device *rtc = platform_get_drvdata(pdev); int irq = platform_get_irq(pdev, 0); mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M); if (twl_class_is_6030()) { twl6030_interrupt_mask(TWL6030_RTC_INT_MASK, REG_INT_MSK_LINE_A); twl6030_interrupt_mask(TWL6030_RTC_INT_MASK, REG_INT_MSK_STS_A); } free_irq(irq, rtc); rtc_device_unregister(rtc); platform_set_drvdata(pdev, NULL); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the port data with the receive buffer sizes so this can be done while the master port is locked. Otherwise, there is a race with a slave opening the port and seeing these fields uninitialized. */
static void init_user_egr_sizes(struct ipath_portdata *pd)
/* Initialize the port data with the receive buffer sizes so this can be done while the master port is locked. Otherwise, there is a race with a slave opening the port and seeing these fields uninitialized. */ static void init_user_egr_sizes(struct ipath_portdata *pd)
{ struct ipath_devdata *dd = pd->port_dd; unsigned egrperchunk, egrcnt, size; size = 0x8000; egrperchunk = size / dd->ipath_rcvegrbufsize; egrcnt = dd->ipath_rcvegrcnt; pd->port_rcvegrbuf_chunks = (egrcnt + egrperchunk - 1) / egrperchunk; pd->port_rcvegrbufs_perchunk = egrperchunk; pd->port_rcvegrbuf_size = size; }
robutest/uclinux
C++
GPL-2.0
60
/* Flush FPU content and disable access. This is called locally and also from flush_fpu_ipi_handler(). */
void arch_flush_local_fpu(void)
/* Flush FPU content and disable access. This is called locally and also from flush_fpu_ipi_handler(). */ void arch_flush_local_fpu(void)
{ __ASSERT(read_daif() & DAIF_IRQ_BIT, "must be called with IRQs disabled"); struct k_thread *owner = atomic_ptr_get(&_current_cpu->arch.fpu_owner); if (owner != NULL) { uint64_t cpacr = read_cpacr_el1(); write_cpacr_el1(cpacr | CPACR_EL1_FPEN_NOTRAP); barrier_isync_fence_full(); z_arm64_fpu_save(&owner->arch.saved_fp_context); barrier_dsync_fence_full(); atomic_ptr_clear(&_current_cpu->arch.fpu_owner); DBG("disable", owner); write_cpacr_el1(cpacr & ~CPACR_EL1_FPEN_NOTRAP); barrier_isync_fence_full(); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V2 attribute. */ static ssize_t write_value_v2_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ char *value = attr->user_data; if (offset >= sizeof(value_v2_2_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v2_2_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); } else if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TIM_PWM MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim_pwm)
/* TIM_PWM MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim_pwm)
{ if(htim_pwm->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* These functions flushes out all traces of the currently running executable so that a new one can be started */
static void flush_old_files(struct files_struct *files)
/* These functions flushes out all traces of the currently running executable so that a new one can be started */ static void flush_old_files(struct files_struct *files)
{ long j = -1; struct fdtable *fdt; spin_lock(&files->file_lock); for (;;) { unsigned long set, i; j++; i = j * __NFDBITS; fdt = files_fdtable(files); if (i >= fdt->max_fds) break; set = fdt->close_on_exec->fds_bits[j]; if (!set) continue; fdt->close_on_exec->fds_bits[j] = 0; spin_unlock(&files->file_lock); for ( ; set ; i++,set >>= 1) { if (set & 1) { sys_close(i); } } spin_lock(&files->file_lock); } spin_unlock(&files->file_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is to locate GET_PCD_INFO_PPI PPI via PeiService. If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR(). */
GET_PCD_INFO_PPI* GetPcdInfoPpiPointer(VOID)
/* This function is to locate GET_PCD_INFO_PPI PPI via PeiService. If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR(). */ GET_PCD_INFO_PPI* GetPcdInfoPpiPointer(VOID)
{ EFI_STATUS Status; GET_PCD_INFO_PPI *PcdInfoPpi; Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi); ASSERT_EFI_ERROR (Status); return PcdInfoPpi; }
tianocore/edk2
C++
Other
4,240
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */
CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */ CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
{ CONST EFI_PEI_SERVICES **PeiServices; PeiServices = (CONST EFI_PEI_SERVICES **)(CsrRead (LOONGARCH_CSR_KS0)); ASSERT (PeiServices != NULL); return PeiServices; }
tianocore/edk2
C++
Other
4,240
/* Returns: (transfer none): the user data pointer set, or NULL */
gpointer g_param_spec_steal_qdata(GParamSpec *pspec, GQuark quark)
/* Returns: (transfer none): the user data pointer set, or NULL */ gpointer g_param_spec_steal_qdata(GParamSpec *pspec, GQuark quark)
{ g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL); g_return_val_if_fail (quark > 0, NULL); return g_datalist_id_remove_no_notify (&pspec->qdata, quark); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_SetStallEP(U32 EPNum)
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_SetStallEP(U32 EPNum)
{ EP_Status(EPNum, EP_TX_STALL | EP_RX_STALL); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Dot product with log arithmetic. Vectors are containing the log of the samples */
float32_t arm_logsumexp_dot_prod_f32(const float32_t *pSrcA, const float32_t *pSrcB, uint32_t blockSize, float32_t *pTmpBuffer)
/* Dot product with log arithmetic. Vectors are containing the log of the samples */ float32_t arm_logsumexp_dot_prod_f32(const float32_t *pSrcA, const float32_t *pSrcB, uint32_t blockSize, float32_t *pTmpBuffer)
{ float32_t result; arm_add_f32((float32_t*)pSrcA, (float32_t*)pSrcB, pTmpBuffer, blockSize); result = arm_logsumexp_f32(pTmpBuffer, blockSize); return(result); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Will return -EAGAIN, and a reason if a restart is needed. If passed in, *reason will always be set, even in error. */
int ocfs2_add_inode_data(struct ocfs2_super *osb, struct inode *inode, u32 *logical_offset, u32 clusters_to_add, int mark_unwritten, struct buffer_head *fe_bh, handle_t *handle, struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *meta_ac, enum ocfs2_alloc_restarted *reason_ret)
/* Will return -EAGAIN, and a reason if a restart is needed. If passed in, *reason will always be set, even in error. */ int ocfs2_add_inode_data(struct ocfs2_super *osb, struct inode *inode, u32 *logical_offset, u32 clusters_to_add, int mark_unwritten, struct buffer_head *fe_bh, handle_t *handle, struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *meta_ac, enum ocfs2_alloc_restarted *reason_ret)
{ int ret; struct ocfs2_extent_tree et; ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh); ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset, clusters_to_add, mark_unwritten, data_ac, meta_ac, reason_ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the number of bytes to be transmitted/received. */
void I2C_NumberOfBytesConfig(I2C_TypeDef *I2Cx, uint8_t Number_Bytes)
/* Configures the number of bytes to be transmitted/received. */ void I2C_NumberOfBytesConfig(I2C_TypeDef *I2Cx, uint8_t Number_Bytes)
{ uint32_t tmpreg = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); tmpreg = I2Cx->CR2; tmpreg &= (uint32_t)~((uint32_t)I2C_CR2_NBYTES); tmpreg |= (uint32_t)(((uint32_t)Number_Bytes << 16 ) & I2C_CR2_NBYTES); I2Cx->CR2 = tmpreg; }
ajhc/demo-cortex-m3
C++
null
38
/* Sets the designated bits in a 16/32-bit data word at the remote CPU system address */
uint16_t IPCLiteLtoRClearBits(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint32_t ulStatusFlag)
/* Sets the designated bits in a 16/32-bit data word at the remote CPU system address */ uint16_t IPCLiteLtoRClearBits(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint32_t ulStatusFlag)
{ uint16_t returnStatus; if (IpcRegs.IPCFLG.all & (ulFlag | ulStatusFlag)) { returnStatus = STATUS_FAIL; } else { if (usLength == IPC_LENGTH_16_BITS) { IpcRegs.IPCSENDCOM = IPC_CLEAR_BITS_16; IpcRegs.IPCSENDADDR = ulAddress; IpcRegs.IPCSENDDATA = ulMask & (0x0000FFFF); } else if (usLength == IPC_LENGTH_32_BITS) { IpcRegs.IPCSENDCOM = IPC_CLEAR_BITS_32; IpcRegs.IPCSENDADDR = ulAddress; IpcRegs.IPCSENDDATA = ulMask; } IpcRegs.IPCSET.all |= (ulFlag | ulStatusFlag); returnStatus = STATUS_PASS; } return returnStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Used to find an entry with matching Frame Number FN in the complete_request_list list. */
static comp_req_list_entry_t* find_fn_in_list(guint32 fn)
/* Used to find an entry with matching Frame Number FN in the complete_request_list list. */ static comp_req_list_entry_t* find_fn_in_list(guint32 fn)
{ entry_ptr = (comp_req_list_entry_t *)element->data; if (entry_ptr->fn == fn) { return entry_ptr; } element = g_list_previous(element); } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This temporarily disables EDMA hardware events on the specified channel, preventing them from triggering new transfers on its behalf */
void edma_pause(unsigned channel)
/* This temporarily disables EDMA hardware events on the specified channel, preventing them from triggering new transfers on its behalf */ void edma_pause(unsigned channel)
{ unsigned ctlr; ctlr = EDMA_CTLR(channel); channel = EDMA_CHAN_SLOT(channel); if (channel < edma_cc[ctlr]->num_channels) { unsigned int mask = BIT(channel & 0x1f); edma_shadow0_write_array(ctlr, SH_EECR, channel >> 5, mask); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disables interrupts for the specified PWM generator block. */
void PWMGenIntTrigDisable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig)
/* Disables interrupts for the specified PWM generator block. */ void PWMGenIntTrigDisable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig)
{ ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE)); ASSERT(_PWMGenValid(ui32Gen)); ASSERT((ui32IntTrig & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD | PWM_INT_CNT_AU | PWM_INT_CNT_AD | PWM_INT_CNT_BU | PWM_INT_CNT_BD | PWM_TR_CNT_ZERO | PWM_TR_CNT_LOAD | PWM_TR_CNT_AU | PWM_TR_CNT_AD | PWM_TR_CNT_BU | PWM_TR_CNT_BD)) == 0); HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_INTEN) &= ~(ui32IntTrig); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns: (transfer none): the value contents as pointer */
gpointer g_value_peek_pointer(const GValue *value)
/* Returns: (transfer none): the value contents as pointer */ gpointer g_value_peek_pointer(const GValue *value)
{ GTypeValueTable *value_table; g_return_val_if_fail (G_IS_VALUE (value), NULL); value_table = g_type_value_table_peek (G_VALUE_TYPE (value)); if (!value_table->value_peek_pointer) { g_return_val_if_fail (g_value_fits_pointer (value) == TRUE, NULL); return NULL; } return value_table->value_peek_pointer (value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables the High Speed APB (APB2) peripheral clock. */
void RCC_EnableAPB2PeriphClk(uint32_t RCC_APB2Periph, FunctionalState Cmd)
/* Enables or disables the High Speed APB (APB2) peripheral clock. */ void RCC_EnableAPB2PeriphClk(uint32_t RCC_APB2Periph, FunctionalState Cmd)
{ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RCC->APB2PCLKEN |= RCC_APB2Periph; } else { RCC->APB2PCLKEN &= ~RCC_APB2Periph; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Register hooks to call when sqlite3BeginBenignMalloc() and sqlite3EndBenignMalloc() are called, respectively. */
SQLITE_PRIVATE void sqlite3BenignMallocHooks(void(*)(void), void(*)(void))
/* Register hooks to call when sqlite3BeginBenignMalloc() and sqlite3EndBenignMalloc() are called, respectively. */ SQLITE_PRIVATE void sqlite3BenignMallocHooks(void(*)(void), void(*)(void))
{ wsdHooksInit; wsdHooks.xBenignBegin = xBenignBegin; wsdHooks.xBenignEnd = xBenignEnd; }
DC-SWAT/DreamShell
C++
null
404
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
int32_t lsm6dso_tap_quiet_set(stmdev_ctx_t *ctx, uint8_t val)
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */ int32_t lsm6dso_tap_quiet_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dso_int_dur2_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)&reg, 1); if (ret == 0) { reg.quiet = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() is used to enable AES interrupts on the interrupt controller. */
void AESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() is used to enable AES interrupts on the interrupt controller. */ void AESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ ASSERT(ui32Base == AES_BASE); IntRegister(INT_AES, pfnHandler); IntEnable(INT_AES); }
micropython/micropython
C++
Other
18,334
/* i810_hires - enables high resolution mode @mmio: address of register space */
static void i810_hires(u8 __iomem *mmio)
/* i810_hires - enables high resolution mode @mmio: address of register space */ static void i810_hires(u8 __iomem *mmio)
{ u8 val; i810_writeb(CR_INDEX_CGA, mmio, CR80); val = i810_readb(CR_DATA_CGA, mmio); i810_writeb(CR_INDEX_CGA, mmio, CR80); i810_writeb(CR_DATA_CGA, mmio, val | 1); i810_writel(MEM_MODE, mmio, i810_readl(MEM_MODE, mmio) | 4); }
robutest/uclinux
C++
GPL-2.0
60
/* Parse the pin default config value and returns the string of the jack connectivity, i.e. external or internal connection. */
const char* snd_hda_get_jack_connectivity(u32 cfg)
/* Parse the pin default config value and returns the string of the jack connectivity, i.e. external or internal connection. */ const char* snd_hda_get_jack_connectivity(u32 cfg)
{ static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" }; return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; }
robutest/uclinux
C++
GPL-2.0
60
/* Update internal data when incremental mode is using T3. */
IFX_STATIC void IfxGpt12_IncrEnc_updateFromT3(IfxGpt12_IncrEnc *driver)
/* Update internal data when incremental mode is using T3. */ IFX_STATIC void IfxGpt12_IncrEnc_updateFromT3(IfxGpt12_IncrEnc *driver)
{ Ifx_GPT12 *gpt12 = driver->module; sint32 newPosition; driver->direction = gpt12->T3CON.B.T3RDIR ? IfxStdIf_Pos_Dir_backward : IfxStdIf_Pos_Dir_forward; newPosition = gpt12->T3.U; newPosition = (newPosition + driver->offset); if (newPosition >= driver->resolution) { newPosition %= driver->resolution; } else if (newPosition < 0) { newPosition = (newPosition + driver->resolution); } IfxGpt12_IncrEnc_updateSpeedFromT3(driver, newPosition); driver->rawPosition = newPosition; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Reports the temperature in degrees Fahrenheit. The API is in farenheit. It was designed by an imperial measurement luddite. */
static int wdt_get_temperature(void)
/* Reports the temperature in degrees Fahrenheit. The API is in farenheit. It was designed by an imperial measurement luddite. */ static int wdt_get_temperature(void)
{ unsigned short c; unsigned long flags; spin_lock_irqsave(&wdt_lock, flags); c = inb_p(WDT_RT); spin_unlock_irqrestore(&wdt_lock, flags); return (c * 11 / 15) + 7; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable I2C SCL low level timeout function. */
void I2C_SCLLowTimeoutCmd(CM_I2C_TypeDef *I2Cx, en_functional_state_t enNewState)
/* Enable or disable I2C SCL low level timeout function. */ void I2C_SCLLowTimeoutCmd(CM_I2C_TypeDef *I2Cx, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_I2C_UNIT(I2Cx)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); if (ENABLE == enNewState) { SET_REG32_BIT(I2Cx->CR3, I2C_CR3_LTMOUT); } else { CLR_REG32_BIT(I2Cx->CR3, I2C_CR3_LTMOUT); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function does not check for the existence of the file. */
CHAR8* OsPathPeerFilePath(IN CHAR8 *OldPath, IN CHAR8 *Peer)
/* This function does not check for the existence of the file. */ CHAR8* OsPathPeerFilePath(IN CHAR8 *OldPath, IN CHAR8 *Peer)
{ CHAR8 *Result; INTN Offset; Result = (CHAR8 *) malloc (strlen (OldPath) + strlen (Peer) + 1); if (Result == NULL) { return NULL; } strcpy (Result, OldPath); for (Offset = strlen (Result); Offset >= 0; Offset--) { if ((Result[Offset] == '/') || (Result[Offset] == '\\')) { Result[Offset + 1] = '\0'; strcat (Result, Peer); return Result; } } strcpy (Result, Peer); return Result; }
tianocore/edk2
C++
Other
4,240
/* This file is part of the Simba project. */
static int mock_write_clock_low(void)
/* This file is part of the Simba project. */ static int mock_write_clock_low(void)
{ mock_write_pin_write(0, 0); return (0); }
eerimoq/simba
C++
Other
337
/* Check if SLCD module is enabled or not. Check if SLCD module is enabled or not. */
bool slcd_is_enabled(void)
/* Check if SLCD module is enabled or not. Check if SLCD module is enabled or not. */ bool slcd_is_enabled(void)
{ return ((SLCD->CTRLA.reg & SLCD_CTRLA_ENABLE) == SLCD_CTRLA_ENABLE); }
memfault/zero-to-main
C++
null
200
/* Disables the Deferral check in GMAC (Only in Half Duplex mode). GMAC defers until the CRS signal goes inactive. */
void synopGMAC_deferral_check_disable(synopGMACdevice *gmacdev)
/* Disables the Deferral check in GMAC (Only in Half Duplex mode). GMAC defers until the CRS signal goes inactive. */ void synopGMAC_deferral_check_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacDeferralCheck); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* sa1111_disable_device - disable an on-chip SA1111 function block @sadev: SA1111 function block device to disable */
void sa1111_disable_device(struct sa1111_dev *sadev)
/* sa1111_disable_device - disable an on-chip SA1111 function block @sadev: SA1111 function block device to disable */ void sa1111_disable_device(struct sa1111_dev *sadev)
{ struct sa1111 *sachip = sa1111_chip_driver(sadev); unsigned long flags; unsigned int val; spin_lock_irqsave(&sachip->lock, flags); val = sa1111_readl(sachip->base + SA1111_SKPCR); sa1111_writel(val & ~sadev->skpcr_mask, sachip->base + SA1111_SKPCR); spin_unlock_irqrestore(&sachip->lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Build the GuidHob for tdx measurements which were done in SEC phase. The measurement values are stored in WorkArea. */
EFI_STATUS EFIAPI TdxHelperBuildGuidHobForTdxMeasurement(VOID)
/* Build the GuidHob for tdx measurements which were done in SEC phase. The measurement values are stored in WorkArea. */ EFI_STATUS EFIAPI TdxHelperBuildGuidHobForTdxMeasurement(VOID)
{ return InternalBuildGuidHobForTdxMeasurement (); }
tianocore/edk2
C++
Other
4,240
/* Currently, for range flushing, we just do a full mm flush. This should be optimized based on a threshold on the size of the range, since some implementation can stack multiple tlbivax before a tlbsync but for now, we keep it that way */
void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
/* Currently, for range flushing, we just do a full mm flush. This should be optimized based on a threshold on the size of the range, since some implementation can stack multiple tlbivax before a tlbsync but for now, we keep it that way */ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{ flush_tlb_mm(vma->vm_mm); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the error status of the I2C Master module. */
uint32_t I2CMasterErr(uint32_t ui32Base)
/* Gets the error status of the I2C Master module. */ uint32_t I2CMasterErr(uint32_t ui32Base)
{ uint32_t ui32Err; ASSERT(_I2CBaseValid(ui32Base)); ui32Err = HWREG(ui32Base + I2C_O_MCS); if(ui32Err & I2C_MCS_BUSY) { return(I2C_MASTER_ERR_NONE); } if(ui32Err & (I2C_MCS_ERROR | I2C_MCS_ARBLST)) { return(ui32Err & (I2C_MCS_ARBLST | I2C_MCS_DATACK | I2C_MCS_ADRACK)); } else { return(I2C_MASTER_ERR_NONE); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Function to send the PIMA command container to the attached still image device. */
void SImage_SendBlockHeader(void)
/* Function to send the PIMA command container to the attached still image device. */ void SImage_SendBlockHeader(void)
{ Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE); Pipe_Unfreeze(); Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0), NULL); if (PIMA_SendBlock.Type == PIMA_CONTAINER_CommandBlock) { uint8_t ParamBytes = (PIMA_SendBlock.DataLength - PIMA_COMMAND_SIZE(0)); if (ParamBytes) { Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes, NULL); } Pipe_ClearOUT(); } Pipe_Freeze(); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Called when a device mapping is created by a means other than mmap (via fork, munmap, etc.). Increments the reference count on the underlying mspec data so it is not freed prematurely. */
static void mspec_open(struct vm_area_struct *vma)
/* Called when a device mapping is created by a means other than mmap (via fork, munmap, etc.). Increments the reference count on the underlying mspec data so it is not freed prematurely. */ static void mspec_open(struct vm_area_struct *vma)
{ struct vma_data *vdata; vdata = vma->vm_private_data; atomic_inc(&vdata->refcnt); }
robutest/uclinux
C++
GPL-2.0
60
/* enable internal loopback TxCLK and RxCLK are generated from BRG and TxD is looped back to RxD internally. */
static void enable_loopback(struct slgt_info *info)
/* enable internal loopback TxCLK and RxCLK are generated from BRG and TxD is looped back to RxD internally. */ static void enable_loopback(struct slgt_info *info)
{ wr_reg16(info, SCR, (unsigned short)(rd_reg16(info, SCR) | BIT2)); if (info->params.mode != MGSL_MODE_ASYNC) { wr_reg8(info, CCR, 0x49); if (info->params.clock_speed) set_rate(info, info->params.clock_speed); else set_rate(info, 3686400); } }
robutest/uclinux
C++
GPL-2.0
60
/* Create a TCP segment usable for passing to tcp_input */
struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb *pcb, void *data, size_t data_len, u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd)
/* Create a TCP segment usable for passing to tcp_input */ struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb *pcb, void *data, size_t data_len, u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd)
{ return tcp_create_segment_wnd(&pcb->remote_ip, &pcb->local_ip, pcb->remote_port, pcb->local_port, data, data_len, pcb->rcv_nxt + seqno_offset, pcb->lastack + ackno_offset, headerflags, wnd); }
ua1arn/hftrx
C++
null
69
/* Configure power supply for each peripheral according to NewState. */
void CLKPWR_ConfigPPWR(uint32_t PPType, FunctionalState NewState)
/* Configure power supply for each peripheral according to NewState. */ void CLKPWR_ConfigPPWR(uint32_t PPType, FunctionalState NewState)
{ if (NewState == ENABLE) { LPC_SC->PCONP |= PPType; } else if (NewState == DISABLE) { LPC_SC->PCONP &= ~PPType; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USBH_LL_ResetPort Reset the Host Port of the Low Level Driver. */
USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef *phost)
/* USBH_LL_ResetPort Reset the Host Port of the Low Level Driver. */ USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef *phost)
{ UNUSED(phost); return USBH_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented. */
EFI_STATUS EFIAPI HddPasswordFormRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
/* This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented. */ EFI_STATUS EFIAPI HddPasswordFormRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
{ if ((Configuration == NULL) || (Progress == NULL)) { return EFI_INVALID_PARAMETER; } if (!HiiIsConfigHdrMatch (Configuration, &mHddPasswordVendorGuid, mHddPasswordVendorStorageName)) { *Progress = Configuration; return EFI_NOT_FOUND; } *Progress = Configuration + StrLen (Configuration); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns the most recent received data by the SPIx/I2Sx peripheral. */
uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx)
/* Returns the most recent received data by the SPIx/I2Sx peripheral. */ uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx)
{ uint32_t spixbase = 0x00; spixbase = (uint32_t)SPIx; spixbase += 0x0C; return *(__IO uint8_t *) spixbase; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535