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
/* If the major numbers are different, they are incompatible. If the current minor is greater than the request, they are incompatible. If the current minor is less than or equal to the request, they are compatible, and the requester should run at the current minor version. */
static int dlm_protocol_compare(struct dlm_protocol_version *existing, struct dlm_protocol_version *request)
/* If the major numbers are different, they are incompatible. If the current minor is greater than the request, they are incompatible. If the current minor is less than or equal to the request, they are compatible, and the requester should run at the current minor version. */ static int dlm_protocol_compare(struct dlm...
{ if (existing->pv_major != request->pv_major) return 1; if (existing->pv_minor > request->pv_minor) return 1; if (existing->pv_minor < request->pv_minor) request->pv_minor = existing->pv_minor; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the property linux,drconf-usable-memory if it exists (the property exists only in kexec/kdump kernels, added by kexec-tools) */
static const u32* of_get_usable_memory(struct device_node *memory)
/* Returns the property linux,drconf-usable-memory if it exists (the property exists only in kexec/kdump kernels, added by kexec-tools) */ static const u32* of_get_usable_memory(struct device_node *memory)
{ const u32 *prop; u32 len; prop = of_get_property(memory, "linux,drconf-usable-memory", &len); if (!prop || len < sizeof(unsigned int)) return 0; return prop; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the security data for a kernel service. */
static int smack_kernel_act_as(struct cred *new, u32 secid)
/* Set the security data for a kernel service. */ static int smack_kernel_act_as(struct cred *new, u32 secid)
{ char *smack = smack_from_secid(secid); if (smack == NULL) return -EINVAL; new->security = smack; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Since: 2.24 Returns: a pointer to the allocated memory */
gpointer g_malloc0_n(gsize n_blocks, gsize n_block_bytes)
/* Since: 2.24 Returns: a pointer to the allocated memory */ gpointer g_malloc0_n(gsize n_blocks, gsize n_block_bytes)
{ if (SIZE_OVERFLOWS (n_blocks, n_block_bytes)) { g_error ("%s: overflow allocating %"G_GSIZE_FORMAT"*%"G_GSIZE_FORMAT" bytes", G_STRLOC, n_blocks, n_block_bytes); } return g_malloc0 (n_blocks * n_block_bytes); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns: the number of bytes read into @stream's buffer, up to @count, or -1 on error. */
gssize g_buffered_input_stream_fill(GBufferedInputStream *stream, gssize count, GCancellable *cancellable, GError **error)
/* Returns: the number of bytes read into @stream's buffer, up to @count, or -1 on error. */ gssize g_buffered_input_stream_fill(GBufferedInputStream *stream, gssize count, GCancellable *cancellable, GError **error)
{ GBufferedInputStreamClass *class; GInputStream *input_stream; gssize res; g_return_val_if_fail (G_IS_BUFFERED_INPUT_STREAM (stream), -1); input_stream = G_INPUT_STREAM (stream); if (count < -1) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count v...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* note This is an internal used function, upper layer should not use. */
void FLEXIO_MCULCD_ClearSingleBeatReadConfig(FLEXIO_MCULCD_Type *base)
/* note This is an internal used function, upper layer should not use. */ void FLEXIO_MCULCD_ClearSingleBeatReadConfig(FLEXIO_MCULCD_Type *base)
{ base->flexioBase->TIMCTL[base->timerIndex] = 0U; base->flexioBase->TIMCFG[base->timerIndex] = 0U; base->flexioBase->TIMSTAT = (1U << base->timerIndex); base->flexioBase->SHIFTCTL[base->rxShifterEndIndex] = 0U; base->flexioBase->SHIFTCFG[base->rxShifterEndIndex] = 0U; base->flexioBase->SHIFTSTA...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Search a IP6_MLD_GROUP list entry node from a list array. */
IP6_MLD_GROUP* Ip6FindMldEntry(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *MulticastAddr)
/* Search a IP6_MLD_GROUP list entry node from a list array. */ IP6_MLD_GROUP* Ip6FindMldEntry(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *MulticastAddr)
{ LIST_ENTRY *Entry; IP6_MLD_GROUP *Group; NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE); ASSERT (MulticastAddr != NULL && IP6_IS_MULTICAST (MulticastAddr)); NET_LIST_FOR_EACH (Entry, &IpSb->MldCtrl.Groups) { Group = NET_LIST_USER_STRUCT (Entry, IP6_MLD_GROUP, Link); if (EFI_IP6_EQUAL (Multic...
tianocore/edk2
C++
Other
4,240
/* Read HW ID from I2C EEPROM and detect the modue we are running on. Note that we need to use local variable for readout, because global data is not writable yet (and we'll have to redo the readout later on). */
int checkboard(void)
/* Read HW ID from I2C EEPROM and detect the modue we are running on. Note that we need to use local variable for readout, because global data is not writable yet (and we'll have to redo the readout later on). */ int checkboard(void)
{ hw_id_t hw_id_tmp; char module_name_tmp[MODULE_NAME_MAXLEN] = ""; gd->flags |= GD_FLG_SILENT; i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); gd->flags &= ~GD_FLG_SILENT; read_hw_id(hw_id_tmp); identify_module(hw_id_tmp); compose_module_name(hw_id_tmp, module_name_tmp); if (gd->board_type != CM5200_UN...
EmcraftSystems/u-boot
C++
Other
181
/* USART Enable TX pin active level inversion. TX pin signal values are inverted. (VDD =0/mark, Gnd=1/idle). */
void usart_enable_tx_inversion(uint32_t usart)
/* USART Enable TX pin active level inversion. TX pin signal values are inverted. (VDD =0/mark, Gnd=1/idle). */ void usart_enable_tx_inversion(uint32_t usart)
{ USART_CR2(usart) |= USART_CR2_TXINV; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* We assign the SDRAM BARs for the two IXP2800 CPUs by hand, outside of the regular PCI window, because there's only 512M of outbound PCI memory window on each IXP, while we need 1G for each of the BARs. */
static void __devinit ixp2800_pci_fixup(struct pci_dev *dev)
/* We assign the SDRAM BARs for the two IXP2800 CPUs by hand, outside of the regular PCI window, because there's only 512M of outbound PCI memory window on each IXP, while we need 1G for each of the BARs. */ static void __devinit ixp2800_pci_fixup(struct pci_dev *dev)
{ if (machine_is_ixdp2800()) { dev->resource[2].start = 0; dev->resource[2].end = 0; dev->resource[2].flags = 0; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set one or zero to the selected GPIO pin. */
int32_t csi_gpio_pin_write(gpio_pin_handle_t handle, bool value)
/* Set one or zero to the selected GPIO pin. */ int32_t csi_gpio_pin_write(gpio_pin_handle_t handle, bool value)
{ GPIO_NULL_PARAM_CHK(handle); dw_gpio_pin_priv_t *gpio_pin_priv = handle; dw_gpio_priv_t *port_handle = &gpio_handle[gpio_pin_priv->portidx]; uint8_t offset = gpio_pin_priv->idx; uint32_t port_value = value << offset; port_handle->value = port_value; gpio_write(port_handle, (1 << offset)); ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Return the memory type bit mask that's compatible to first type in the Ranges. */
UINT8 MtrrLibGetCompatibleTypes(IN CONST MTRR_MEMORY_RANGE *Ranges, IN UINTN RangeCount)
/* Return the memory type bit mask that's compatible to first type in the Ranges. */ UINT8 MtrrLibGetCompatibleTypes(IN CONST MTRR_MEMORY_RANGE *Ranges, IN UINTN RangeCount)
{ ASSERT (RangeCount != 0); switch (Ranges[0].Type) { case CacheWriteBack: case CacheWriteThrough: return (1 << CacheWriteBack) | (1 << CacheWriteThrough) | (1 << CacheUncacheable); break; case CacheWriteCombining: case CacheWriteProtected: return (1 << Ranges[0].Type) | (1 << Cach...
tianocore/edk2
C++
Other
4,240
/* param base SPC peripheral base address. param config Pointer to spc_system_voltage_detect_config_t structure. */
void SPC_SetSystemVoltageDetectConfig(SPC_Type *base, const spc_system_voltage_detect_config_t *config)
/* param base SPC peripheral base address. param config Pointer to spc_system_voltage_detect_config_t structure. */ void SPC_SetSystemVoltageDetectConfig(SPC_Type *base, const spc_system_voltage_detect_config_t *config)
{ assert(config != NULL); uint32_t reg = 0UL; reg |= (config->option.HVDInterruptEnable) ? SPC_VD_SYS_CFG_HVDIE(1U) : SPC_VD_SYS_CFG_HVDIE(0U); reg |= (config->option.LVDInterruptEnable) ? SPC_VD_SYS_CFG_LVDIE(1U) : SPC_VD_SYS_CFG_LVDIE(0U); reg |= (config->option.HVDResetEnable) ? SPC_VD_SYS_CFG_HV...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the HFRCO startup delay. Please refer to the reference manual for further details. */
uint32_t CMU_HFRCOStartupDelayGet(void)
/* Get the HFRCO startup delay. Please refer to the reference manual for further details. */ uint32_t CMU_HFRCOStartupDelayGet(void)
{ return((CMU->HFRCOCTRL & _CMU_HFRCOCTRL_SUDELAY_MASK) >> _CMU_HFRCOCTRL_SUDELAY_SHIFT); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This is for DLT_NETANALYZER, which has a 4-byte pseudo-header before the Ethernet header. */
u_int netanalyzer_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
/* This is for DLT_NETANALYZER, which has a 4-byte pseudo-header before the Ethernet header. */ u_int netanalyzer_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{ if (h->len < 4 || h->caplen < 4) { ND_PRINT((ndo, "[|netanalyzer]")); return (h->caplen); } return (4 + ether_print(ndo, p + 4, h->len - 4, h->caplen - 4, NULL, NULL)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* So, if we see any bmap calls here on a modified, data-journaled file, take extra steps to flush any blocks which might be in the cache. */
static sector_t ext3_bmap(struct address_space *mapping, sector_t block)
/* So, if we see any bmap calls here on a modified, data-journaled file, take extra steps to flush any blocks which might be in the cache. */ static sector_t ext3_bmap(struct address_space *mapping, sector_t block)
{ struct inode *inode = mapping->host; journal_t *journal; int err; if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) { EXT3_I(inode)->i_state &= ~EXT3_STATE_JDATA; journal = EXT3_JOURNAL(inode); journal_lock_updates(journal); err = journal_flush(journal); journal_unlock_updates(journal); if (err) retur...
robutest/uclinux
C++
GPL-2.0
60
/* Enable the automatic slave select function of the specified SPI port. The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
/* Enable the automatic slave select function of the specified SPI port. The */ void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) |= SPI_AUTOSS; xHWREG(ulB...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified...
UINT16 EFIAPI S3PciSegmentBitFieldOr16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified...
{ return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentBitFieldOr16 (Address, StartBit, EndBit, OrData)); }
tianocore/edk2
C++
Other
4,240
/* attempts to write up to len bytes to the SPI channel */
int spi_Write_CPU(unsigned char *pBuff, int len)
/* attempts to write up to len bytes to the SPI channel */ int spi_Write_CPU(unsigned char *pBuff, int len)
{ unsigned long ulCnt; unsigned long ulStatusReg; unsigned long *ulDataOut; unsigned long ulDataIn; unsigned long ulTxReg; unsigned long ulRxReg; MAP_SPICSEnable(LSPI_BASE); ulDataOut = (unsigned long *)pBuff; ulCnt = (len +3 ) >> 2; ulStatusReg = LSPI_BASE+MCSPI_O_CH0STAT; u...
micropython/micropython
C++
Other
18,334
/* Set the state of the wdt interrupt status bit. This function sets the interrupt bit. */
void am_hal_wdt_int_set(void)
/* Set the state of the wdt interrupt status bit. This function sets the interrupt bit. */ void am_hal_wdt_int_set(void)
{ AM_REG(WDT, INTSET) = AM_REG_WDT_INTSET_WDT_M; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Decreases the use count of a #GTypeModule by one. If the result is zero, the module will be unloaded. (However, the #GTypeModule will not be freed, and types associated with the #GTypeModule are not unregistered. Once a #GTypeModule is initialized, it must exist forever.) */
void g_type_module_unuse(GTypeModule *module)
/* Decreases the use count of a #GTypeModule by one. If the result is zero, the module will be unloaded. (However, the #GTypeModule will not be freed, and types associated with the #GTypeModule are not unregistered. Once a #GTypeModule is initialized, it must exist forever.) */ void g_type_module_unuse(GTypeModule *mo...
{ g_return_if_fail (G_IS_TYPE_MODULE (module)); g_return_if_fail (module->use_count > 0); module->use_count--; if (module->use_count == 0) { GSList *tmp_list; G_TYPE_MODULE_GET_CLASS (module)->unload (module); tmp_list = module->type_infos; while (tmp_list) { ModuleTypeInfo *type...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint64ToIntn(IN UINT64 Operand, OUT INTN *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint64ToIntn(IN UINT64 Operand, OUT INTN *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_INTN) { *Result = (INTN)Operand; Status = RETURN_SUCCESS; } else { *Result = INTN_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Reenables the lower mailboxes for reception of new CAN messages */
static void at91_activate_rx_low(const struct at91_priv *priv)
/* Reenables the lower mailboxes for reception of new CAN messages */ static void at91_activate_rx_low(const struct at91_priv *priv)
{ u32 mask = AT91_MB_RX_LOW_MASK; at91_write(priv, AT91_TCR, mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize a MIO / EMIO GPIO bank sub-device. Initialize a MIO / EMIO GPIO bank sub-device, which is a child of the parent Xilinx PS GPIO controller device driver. This ini- tialization function sets up a defined initial state for each GPIO bank. */
static int gpio_xlnx_ps_bank_init(const struct device *dev)
/* Initialize a MIO / EMIO GPIO bank sub-device. Initialize a MIO / EMIO GPIO bank sub-device, which is a child of the parent Xilinx PS GPIO controller device driver. This ini- tialization function sets up a defined initial state for each GPIO bank. */ static int gpio_xlnx_ps_bank_init(const struct device *dev)
{ const struct gpio_xlnx_ps_bank_dev_cfg *dev_conf = dev->config; sys_write32(~0x0, GPIO_XLNX_PS_BANK_INT_DIS_REG); sys_write32(~0x0, GPIO_XLNX_PS_BANK_INT_STAT_REG); sys_write32(0x0, GPIO_XLNX_PS_BANK_OEN_REG); sys_write32(0x0, GPIO_XLNX_PS_BANK_DIRM_REG); sys_write32(0x0, GPIO_XLNX_PS_BANK_DATA_REG); return 0;...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* SPI2 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI2IntHandler(void)
/* SPI2 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI2IntHandler(void)
{ unsigned long ulEventFlags, ulCR1; ulEventFlags = xHWREG(SPI2_BASE + SPI_SR); if((ulEventFlags & SPI_SR_OVR) != 0) { xHWREG(SPI2_BASE + SPI_DR); xHWREG(SPI2_BASE + SPI_SR); } else if((ulEventFlags & SPI_SR_MODF) != 0) { ulCR1 = xHWREG(SPI2_BASE + SPI_CR1); ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If the file specified by File with an authentication status specified by AuthenticationStatus is not safe for the DXE Core to use right now, but it might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is returned. */
EFI_STATUS EFIAPI SecurityStubAuthenticateState(IN CONST EFI_SECURITY_ARCH_PROTOCOL *This, IN UINT32 AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *File)
/* If the file specified by File with an authentication status specified by AuthenticationStatus is not safe for the DXE Core to use right now, but it might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is returned. */ EFI_STATUS EFIAPI SecurityStubAuthenticateState(IN CONST EFI_SECURITY_ARCH_PROT...
{ EFI_STATUS Status; Status = ExecuteSecurity2Handlers ( EFI_AUTH_OPERATION_AUTHENTICATION_STATE, AuthenticationStatus, File, NULL, 0, FALSE ); if (Status == EFI_SUCCESS) { Status = ExecuteSecurityHandlers (Authenticat...
tianocore/edk2
C++
Other
4,240
/* s3c_hsotg_complete_request_lock - complete a request given to us (locked) @hsotg: The device state. @hs_ep: The endpoint the request was on. @hs_req: The request to complete. */
static void s3c_hsotg_complete_request_lock(struct s3c_hsotg *hsotg, struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_req *hs_req, int result)
/* s3c_hsotg_complete_request_lock - complete a request given to us (locked) @hsotg: The device state. @hs_ep: The endpoint the request was on. @hs_req: The request to complete. */ static void s3c_hsotg_complete_request_lock(struct s3c_hsotg *hsotg, struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_req *hs_req, int result)
{ unsigned long flags; spin_lock_irqsave(&hs_ep->lock, flags); s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, result); spin_unlock_irqrestore(&hs_ep->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the FLASH Read out Protection Status is set or not. */
FlagStatus FLASH_OB_GetRDP(void)
/* Checks whether the FLASH Read out Protection Status is set or not. */ FlagStatus FLASH_OB_GetRDP(void)
{ FlagStatus readstatus = RESET; if ((uint8_t)(FLASH->OBR & (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2)) != RESET) { readstatus = SET; } else { readstatus = RESET; } return readstatus; }
ajhc/demo-cortex-m3
C++
null
38
/* we need these positions to check that the jumps to a different part of the entries is a jump to the beginning of a new chain. */
static int ebt_get_udc_positions(struct ebt_entry *e, struct ebt_table_info *newinfo, unsigned int *n, struct ebt_cl_stack *udc)
/* we need these positions to check that the jumps to a different part of the entries is a jump to the beginning of a new chain. */ static int ebt_get_udc_positions(struct ebt_entry *e, struct ebt_table_info *newinfo, unsigned int *n, struct ebt_cl_stack *udc)
{ int i; if (e->bitmask) return 0; for (i = 0; i < NF_BR_NUMHOOKS; i++) { if (newinfo->hook_entry[i] == (struct ebt_entries *)e) break; } if (i != NF_BR_NUMHOOKS) return 0; udc[*n].cs.chaininfo = (struct ebt_entries *)e; udc[*n].cs.n = 0; udc[*n].hookmask = 0; (*n)++; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* this function is a POSIX compliant version, which will set position of next directory structure in the directory stream. */
void seekdir(DIR *d, long offset)
/* this function is a POSIX compliant version, which will set position of next directory structure in the directory stream. */ void seekdir(DIR *d, long offset)
{ struct dfs_file *file; if (d == NULL) { rt_set_errno(-EBADF); return; } file = fd_get(d->fd); if (file == NULL) { rt_set_errno(-EBADF); return; } if (d && d->fd > 0) { if (file->fpos > offset) { if (dfs_file_lseek(fd_g...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: TRUE if construction of the @vfs was successful and it is now active. */
gboolean g_vfs_is_active(GVfs *vfs)
/* Returns: TRUE if construction of the @vfs was successful and it is now active. */ gboolean g_vfs_is_active(GVfs *vfs)
{ GVfsClass *class; g_return_val_if_fail (G_IS_VFS (vfs), FALSE); class = G_VFS_GET_CLASS (vfs); return (* class->is_active) (vfs); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* returns 0 if @cs and @ct are equal, < 0 if @cs is less than @ct > 0 if @cs is greater than @ct */
int strcmp(const char *cs, const char *ct)
/* returns 0 if @cs and @ct are equal, < 0 if @cs is less than @ct > 0 if @cs is greater than @ct */ int strcmp(const char *cs, const char *ct)
{ register int r0 asm("0") = 0; int ret = 0; asm volatile ("0: clst %2,%3\n" " jo 0b\n" " je 1f\n" " ic %0,0(%2)\n" " ic %1,0(%3)\n" " sr %0,%1\n" "1:" : "+d" (ret), "+d" (r0), "+a" (cs), "+a" (ct) : : "cc" ); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* MMU_init_hw does the chip-specific initialization of the MMU hardware. */
void __init MMU_init_hw(void)
/* MMU_init_hw does the chip-specific initialization of the MMU hardware. */ void __init MMU_init_hw(void)
{ mtspr(SPRN_ZPR, 0x10000000); flush_instruction_cache(); mtspr(SPRN_DCWR, 0x00000000); mtspr(SPRN_DCCR, 0xF0000000); mtspr(SPRN_ICCR, 0xF0000000); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* FreeVmbusChannel - Release the resources used by the vmbus channel object */
void FreeVmbusChannel(struct vmbus_channel *Channel)
/* FreeVmbusChannel - Release the resources used by the vmbus channel object */ void FreeVmbusChannel(struct vmbus_channel *Channel)
{ del_timer_sync(&Channel->poll_timer); osd_schedule_callback(gVmbusConnection.WorkQueue, ReleaseVmbusChannel, Channel); }
robutest/uclinux
C++
GPL-2.0
60
/* 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)) { EDMA_AbortTransfer(handle->tx); } base->MCR |= LPI2C_MCR_RRF_MASK | LPI2C_MCR_RTF_MASK; base->MTDR = kStopCmd; handle->...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI MmioRead32(IN UINTN Address)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */ UINT32 EFIAPI MmioRead32(IN UINTN Address)
{ ASSERT ((Address & 3) == 0); return (UINT32)MmioReadWorker (Address, SMM_IO_UINT32); }
tianocore/edk2
C++
Other
4,240
/* Get the state of one GPIO polarity bit. */
bool am_hal_gpio_int_polarity_bit_get(uint32_t ui32BitNum)
/* Get the state of one GPIO polarity bit. */ bool am_hal_gpio_int_polarity_bit_get(uint32_t ui32BitNum)
{ return (AM_REGVAL(AM_HAL_GPIO_CFG(ui32BitNum)) & AM_HAL_GPIO_POL_M(ui32BitNum)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* enable the oscillator bypass mode, HXTALEN or LXTALEN must be reset before it */
void rcu_osci_bypass_mode_enable(rcu_osci_type_enum osci)
/* enable the oscillator bypass mode, HXTALEN or LXTALEN must be reset before it */ void rcu_osci_bypass_mode_enable(rcu_osci_type_enum osci)
{ uint32_t reg; switch(osci) { case RCU_HXTAL: reg = RCU_CTL; RCU_CTL &= ~RCU_CTL_HXTALEN; RCU_CTL = (reg | RCU_CTL_HXTALBPS); break; case RCU_LXTAL: reg = RCU_BDCTL; RCU_BDCTL &= ~RCU_BDCTL_LXTALEN; RCU_BDCTL = (reg | RCU_BDCTL_LXTALBPS); ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initiates remote wake signaling to request the device to leave LPM suspend mode. */
void USBDevLPMRemoteWake(uint32_t ui32Base)
/* Initiates remote wake signaling to request the device to leave LPM suspend mode. */ void USBDevLPMRemoteWake(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); HWREGB(ui32Base + USB_O_LPMCNTRL) |= USB_LPMCNTRL_RES; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get question id info from the input opcode header. */
EFI_QUESTION_ID GetQuestionIdInfo(IN EFI_IFR_OP_HEADER *OpCode)
/* Get question id info from the input opcode header. */ EFI_QUESTION_ID GetQuestionIdInfo(IN EFI_IFR_OP_HEADER *OpCode)
{ EFI_IFR_QUESTION_HEADER *QuestionHeader; if (OpCode->Length < sizeof (EFI_IFR_OP_HEADER) + sizeof (EFI_IFR_QUESTION_HEADER)) { return 0; } QuestionHeader = (EFI_IFR_QUESTION_HEADER *)((UINT8 *)OpCode + sizeof (EFI_IFR_OP_HEADER)); return QuestionHeader->QuestionId; }
tianocore/edk2
C++
Other
4,240
/* This function updates BIOS Control Register with the given value. */
VOID SetSpiBiosControlRegister(IN UINTN PchSpiBase, IN UINT8 BiosCtlValue)
/* This function updates BIOS Control Register with the given value. */ VOID SetSpiBiosControlRegister(IN UINTN PchSpiBase, IN UINT8 BiosCtlValue)
{ MmioAndThenOr8 (PchSpiBase + R_SPI_BCR, (UINT8) ~B_SPI_BCR_SRC, BiosCtlValue); }
tianocore/edk2
C++
Other
4,240
/* This utility function is needed to prevent corruption of the control bits which are stored along with the aperture size in 460's AGPSIZ register */
static void i460_write_agpsiz(u8 size_value)
/* This utility function is needed to prevent corruption of the control bits which are stored along with the aperture size in 460's AGPSIZ register */ static void i460_write_agpsiz(u8 size_value)
{ u8 temp; pci_read_config_byte(agp_bridge->dev, INTEL_I460_AGPSIZ, &temp); pci_write_config_byte(agp_bridge->dev, INTEL_I460_AGPSIZ, ((temp & ~I460_AGPSIZ_MASK) | size_value)); }
robutest/uclinux
C++
GPL-2.0
60
/* This API is used to get the tap shock form the register 0x2A bit 6. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_tap_shock(u8 *tap_shock_u8)
/* This API is used to get the tap shock form the register 0x2A bit 6. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_tap_shock(u8 *tap_shock_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_TAP_SHOCK_DURN_REG, ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2_3(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_3(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_3_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v2_3_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
/* megasas_read_fw_status_reg_skinny - returns the current FW status value @regs: MFI register set */
static u32 megasas_read_fw_status_reg_skinny(struct megasas_register_set __iomem *regs)
/* megasas_read_fw_status_reg_skinny - returns the current FW status value @regs: MFI register set */ static u32 megasas_read_fw_status_reg_skinny(struct megasas_register_set __iomem *regs)
{ return readl(&(regs)->outbound_scratch_pad); }
robutest/uclinux
C++
GPL-2.0
60
/* Configured to return the measurement of errors in blocks, because no UCBLOCKS value is available, so this value doubles up to satisfy both measurements. */
static int cx24123_read_ber(struct dvb_frontend *fe, u32 *ber)
/* Configured to return the measurement of errors in blocks, because no UCBLOCKS value is available, so this value doubles up to satisfy both measurements. */ static int cx24123_read_ber(struct dvb_frontend *fe, u32 *ber)
{ struct cx24123_state *state = fe->demodulator_priv; *ber = ((cx24123_readreg(state, 0x1c) & 0x3f) << 16) | (cx24123_readreg(state, 0x1d) << 8 | cx24123_readreg(state, 0x1e)); dprintk("BER = %d\n", *ber); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* right after this call apic become NOOP driven so apic->write/read doesn't do anything */
void apic_disable(void)
/* right after this call apic become NOOP driven so apic->write/read doesn't do anything */ void apic_disable(void)
{ pr_info("APIC: switched to apic NOOP\n"); apic = &apic_noop; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the specified I2C dual addressing mode. */
void I2C_EnableDualAddr(I2C_Module *I2Cx, FunctionalState Cmd)
/* Enables or disables the specified I2C dual addressing mode. */ void I2C_EnableDualAddr(I2C_Module *I2Cx, FunctionalState Cmd)
{ assert_param(IS_I2C_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { I2Cx->OADDR2 |= OADDR2_DUALEN_SET; } else { I2Cx->OADDR2 &= OADDR2_DUALEN_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* GPS handling was purged from kernel. For history, this is the way to go : */
static int is_usb_connected(void)
/* GPS handling was purged from kernel. For history, this is the way to go : */ static int is_usb_connected(void)
{ return !gpio_get_value(GPIO13_nUSB_DETECT); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Start after READ command. Function sets pointers for TWIS to transmit data from current address to the end of memory. */
static void ees_readBegin(void)
/* Start after READ command. Function sets pointers for TWIS to transmit data from current address to the end of memory. */ static void ees_readBegin(void)
{ if (m_addr >= sizeof(m_memory)) { m_addr = 0; } (void) nrf_drv_twis_tx_prepare(&m_twis, m_memory + m_addr, sizeof(m_memory) - m_addr); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Clears the link status of the external PHY. */
void EMACLPILinkClear(uint32_t ui32Base)
/* Clears the link status of the external PHY. */ void EMACLPILinkClear(uint32_t ui32Base)
{ ASSERT(ui32Base == EMAC0_BASE); HWREG(ui32Base + EMAC_O_LPICTLSTAT) &= ~(EMAC_LPICTLSTAT_PLS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */
void rt_hw_trap_pabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */ void rt_hw_trap_pabt(struct rt_hw_register *regs)
{ rt_hw_show_register(regs); rt_kprintf("prefetch abort\n"); rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); rt_hw_cpu_shutdown(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Checks the revision. We need to use the DMA register as 3.0 does not have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. */
u8 tusb_get_revision(struct musb *musb)
/* Checks the revision. We need to use the DMA register as 3.0 does not have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. */ u8 tusb_get_revision(struct musb *musb)
{ void __iomem *tbase = musb->ctrl_base; u32 die_id; u8 rev; rev = musb_readl(tbase, TUSB_DMA_CTRL_REV) & 0xff; if (TUSB_REV_MAJOR(rev) == 3) { die_id = TUSB_DIDR1_HI_CHIP_REV(musb_readl(tbase, TUSB_DIDR1_HI)); if (die_id >= TUSB_DIDR1_HI_REV_31) rev |= 1; } return rev; }
robutest/uclinux
C++
GPL-2.0
60
/* imx_dma_setup_handlers - setup i.MX DMA channel end and error notification handlers @channel: i.MX DMA channel number @irq_handler: the pointer to the function called if the transfer ends successfully @err_handler: the pointer to the function called if the premature end caused by error occurs @data: user specified v...
int imx_dma_setup_handlers(int channel, void(*irq_handler)(int, void *), void(*err_handler)(int, void *, int), void *data)
/* imx_dma_setup_handlers - setup i.MX DMA channel end and error notification handlers @channel: i.MX DMA channel number @irq_handler: the pointer to the function called if the transfer ends successfully @err_handler: the pointer to the function called if the premature end caused by error occurs @data: user specified v...
{ struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; unsigned long flags; if (!imxdma->name) { printk(KERN_CRIT "%s: called for not allocated channel %d\n", __func__, channel); return -ENODEV; } local_irq_save(flags); __raw_writel(1 << channel, DMA_BASE + DMA_DISR); imxdma->irq_handler = ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* LSM hook implementation that authorizes deletion of labeled policies. */
int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
/* LSM hook implementation that authorizes deletion of labeled policies. */ int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
{ const struct task_security_struct *tsec = current_security(); int rc = 0; if (ctx) { rc = avc_has_perm(tsec->sid, ctx->ctx_sid, SECCLASS_ASSOCIATION, ASSOCIATION__SETCONTEXT, NULL); if (rc == 0) atomic_dec(&selinux_xfrm_refcount); } return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* On successful return, the caller must not attempt to acquire _hash_lock without first calling dm_table_put, because dm_table_destroy waits for this dm_table_put and could be called under this lock. */
static struct dm_table* dm_get_inactive_table(struct mapped_device *md)
/* On successful return, the caller must not attempt to acquire _hash_lock without first calling dm_table_put, because dm_table_destroy waits for this dm_table_put and could be called under this lock. */ static struct dm_table* dm_get_inactive_table(struct mapped_device *md)
{ struct hash_cell *hc; struct dm_table *table = NULL; down_read(&_hash_lock); hc = dm_get_mdptr(md); if (!hc || hc->md != md) { DMWARN("device has been removed from the dev hash table."); goto out; } table = hc->new_map; if (table) dm_table_get(table); out: up_read(&_hash_lock); return table; }
robutest/uclinux
C++
GPL-2.0
60
/* MACE version of av_clip_int16(). We have to do this to keep binary identical output to the binary decoder. */
static int16_t mace_broken_clip_int16(int n)
/* MACE version of av_clip_int16(). We have to do this to keep binary identical output to the binary decoder. */ static int16_t mace_broken_clip_int16(int n)
{ if (n > 32767) return 32767; else if (n < -32768) return -32767; else return n; }
DC-SWAT/DreamShell
C++
null
404
/* control the bus. This function control the host bus. */
static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType)
/* control the bus. This function control the host bus. */ static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType)
{ usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if (hostHandle == NULL) { return kStatus_USB_InvalidHandle; } status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, ...
labapart/polymcu
C++
null
201
/* Called from the dlm when it's about to evict a node. This is how the classic stack signals node death. */
static void o2dlm_eviction_cb(int node_num, void *data)
/* Called from the dlm when it's about to evict a node. This is how the classic stack signals node death. */ static void o2dlm_eviction_cb(int node_num, void *data)
{ struct ocfs2_cluster_connection *conn = data; mlog(ML_NOTICE, "o2dlm has evicted node %d from group %.*s\n", node_num, conn->cc_namelen, conn->cc_name); conn->cc_recovery_handler(node_num, conn->cc_recovery_data); }
robutest/uclinux
C++
GPL-2.0
60
/* This is only called once at the beginning of all the conversions, all channels as a group. */
static void adc_context_start_sampling(struct adc_context *ctx)
/* This is only called once at the beginning of all the conversions, all channels as a group. */ static void adc_context_start_sampling(struct adc_context *ctx)
{ struct adc_sam_data *data = CONTAINER_OF(ctx, struct adc_sam_data, ctx); const struct adc_sam_config *const cfg = data->dev->config; Adc *const adc = cfg->regs; data->num_active_channels = count_bits(ctx->sequence.channels); adc->ADC_CHDR = 0xffff; adc->ADC_CHER = ctx->sequence.channels; LOG_DBG("Starting conv...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */
static void test_utf8(gconstpointer d)
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */ static void test_utf8(gconstpointer d)
{ gint num_chars; const gchar **p; gint i, j; const gchar *string = d; g_assert (g_utf8_validate (string, -1, NULL)); num_chars = g_utf8_strlen (string, -1); p = (const gchar **) g_malloc (num_chars * sizeof (gchar *)); p[0] = string; for (i = 1; i < num_chars; i++) p[i] = g_utf8_next_char (p[i-1]...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Remove a instance of a timer. If there are no more instances it stops the hardware timer. */
int32_t timer_remove(struct timer_desc *desc)
/* Remove a instance of a timer. If there are no more instances it stops the hardware timer. */ int32_t timer_remove(struct timer_desc *desc)
{ if (!desc) return FAILURE; free(desc->extra); free(desc); nb_instances--; if (nb_instances == 0) { while (ADI_TMR_DEVICE_BUSY == adi_tmr_Enable(timer_id, false)); g_count = 0; nb_enables = 0; } return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* We keep several page tables. This is a simple routine to find the page table (if any) corresponding to this top-level address the Guest has given us. */
static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable)
/* We keep several page tables. This is a simple routine to find the page table (if any) corresponding to this top-level address the Guest has given us. */ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable)
{ unsigned int i; for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) if (lg->pgdirs[i].pgdir && lg->pgdirs[i].gpgdir == pgtable) break; return i; }
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to the device from the USB host before passing along unhandled control requests to the library for processing internally. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to the device from the USB host before passing along unhandled control requests to the library for processing internally. */ void EVENT_USB_Device_ControlRequest(void)
{ PRNT_Device_ProcessControlRequest(&TextOnly_Printer_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Fill in the FPU structure for a core dump. */
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
/* Fill in the FPU structure for a core dump. */ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
{ if (regs == NULL) return 0; memcpy(r, regs->fr, sizeof *r); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ADC Disable The Temperature Sensor. Disabling this will reduce power consumption from the sensor and the reference voltage measurements. */
void adc_disable_temperature_sensor()
/* ADC Disable The Temperature Sensor. Disabling this will reduce power consumption from the sensor and the reference voltage measurements. */ void adc_disable_temperature_sensor()
{ ADC_CR2(ADC1) &= ~ADC_CR2_TSVREFE; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Load the on-disk journal superblock and read the key fields into the journal_t. */
static int load_superblock(journal_t *journal)
/* Load the on-disk journal superblock and read the key fields into the journal_t. */ static int load_superblock(journal_t *journal)
{ int err; journal_superblock_t *sb; err = journal_get_superblock(journal); if (err) return err; sb = journal->j_superblock; journal->j_tail_sequence = be32_to_cpu(sb->s_sequence); journal->j_tail = be32_to_cpu(sb->s_start); journal->j_first = be32_to_cpu(sb->s_first); journal->j_last = be32_to_cpu(sb->s_max...
robutest/uclinux
C++
GPL-2.0
60
/* Put framebuffer to LCD controller. This function will output the complete framebuffer from RAM to the LCD controller. */
void gfx_mono_st7565r_put_framebuffer(void)
/* Put framebuffer to LCD controller. This function will output the complete framebuffer from RAM to the LCD controller. */ void gfx_mono_st7565r_put_framebuffer(void)
{ uint8_t page; for (page = 0; page < GFX_MONO_LCD_PAGES; page++) { st7565r_set_page_address(page); st7565r_set_column_address(0); gfx_mono_st7565r_put_page(framebuffer + (page * GFX_MONO_LCD_WIDTH), page, 0, GFX_MONO_LCD_WIDTH); } }
memfault/zero-to-main
C++
null
200
/* Description: Add the LSM security attributes for the given packet to the underlying NetLabel protocol's label mapping cache. Returns zero on success, negative values on error. */
int netlbl_cache_add(const struct sk_buff *skb, const struct netlbl_lsm_secattr *secattr)
/* Description: Add the LSM security attributes for the given packet to the underlying NetLabel protocol's label mapping cache. Returns zero on success, negative values on error. */ int netlbl_cache_add(const struct sk_buff *skb, const struct netlbl_lsm_secattr *secattr)
{ if ((secattr->flags & NETLBL_SECATTR_CACHE) == 0) return -ENOMSG; if (CIPSO_V4_OPTEXIST(skb)) return cipso_v4_cache_add(skb, secattr); return -ENOMSG; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If this interface is not supported, then return zero. */
UINTN EFIAPI CryptoServiceAesGetContextSize(VOID)
/* If this interface is not supported, then return zero. */ UINTN EFIAPI CryptoServiceAesGetContextSize(VOID)
{ return CALL_BASECRYPTLIB (Aes.Services.GetContextSize, AesGetContextSize, (), 0); }
tianocore/edk2
C++
Other
4,240
/* Reset CEC peripheral registers to their default values. */
void CEC_Reset(void)
/* Reset CEC peripheral registers to their default values. */ void CEC_Reset(void)
{ RCM_EnableAPB1PeriphClock(RCM_APB1_PERIPH_CEC); RCM_DisableAPB1PeriphReset(RCM_APB1_PERIPH_CEC); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function gets schedpolicy attribute. SCHED_OTHER Default Linux time-sharing scheduling. */
int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
/* This function gets schedpolicy attribute. SCHED_OTHER Default Linux time-sharing scheduling. */ int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
{ RT_ASSERT(attr != RT_NULL); *policy = (int)attr->schedpolicy; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for enabling the UART module when the SLIP layer is opened. */
static uint32_t slip_uart_open(void)
/* Function for enabling the UART module when the SLIP layer is opened. */ static uint32_t slip_uart_open(void)
{ uint32_t err_code; app_uart_comm_params_t comm_params = { HCI_SLIP_UART_RX_PIN_NUMBER, HCI_SLIP_UART_TX_PIN_NUMBER, HCI_SLIP_UART_RTS_PIN_NUMBER, HCI_SLIP_UART_CTS_PIN_NUMBER, HCI_SLIP_UART_MODE, false, HCI_SLIP_UART_BAUDRATE }; err_code = ap...
labapart/polymcu
C++
null
201
/* device_complete - Complete a PM transition for given device. @dev: Device to handle. @state: PM transition of the system being carried out. */
static void device_complete(struct device *dev, pm_message_t state)
/* device_complete - Complete a PM transition for given device. @dev: Device to handle. @state: PM transition of the system being carried out. */ static void device_complete(struct device *dev, pm_message_t state)
{ down(&dev->sem); if (dev->class && dev->class->pm && dev->class->pm->complete) { pm_dev_dbg(dev, state, "completing class "); dev->class->pm->complete(dev); } if (dev->type && dev->type->pm && dev->type->pm->complete) { pm_dev_dbg(dev, state, "completing type "); dev->type->pm->complete(dev); } if (dev-...
robutest/uclinux
C++
GPL-2.0
60
/* Check user, group, other permissions for access to ipc resources. return 0 if allowed */
int ipcperms(struct kern_ipc_perm *ipcp, short flag)
/* Check user, group, other permissions for access to ipc resources. return 0 if allowed */ int ipcperms(struct kern_ipc_perm *ipcp, short flag)
{ uid_t euid = current_euid(); int requested_mode, granted_mode; audit_ipc_obj(ipcp); requested_mode = (flag >> 6) | (flag >> 3) | flag; granted_mode = ipcp->mode; if (euid == ipcp->cuid || euid == ipcp->uid) granted_mode >>= 6; else if (in_group_p(ipcp->cgid) || in_group_p(ipcp->gid)) granted_mode >>= ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handle any change of modem status signal since we were last called. */
static void imx_mctrl_check(struct imx_port *sport)
/* Handle any change of modem status signal since we were last called. */ static void imx_mctrl_check(struct imx_port *sport)
{ unsigned int status, changed; status = sport->port.ops->get_mctrl(&sport->port); changed = status ^ sport->old_status; if (changed == 0) return; sport->old_status = status; if (changed & TIOCM_RI) sport->port.icount.rng++; if (changed & TIOCM_DSR) sport->port.icount.dsr++; if (changed & TIOCM_CAR) uar...
robutest/uclinux
C++
GPL-2.0
60
/* Returns number of bytes that could not be cleared. On success, this will be zero. */
unsigned long clear_user(void __user *to, unsigned long n)
/* Returns number of bytes that could not be cleared. On success, this will be zero. */ unsigned long clear_user(void __user *to, unsigned long n)
{ might_fault(); if (access_ok(VERIFY_WRITE, to, n)) __do_clear_user(to, n); return n; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Do I2C/PMU writes to bring up SD card bus power */
void board_sdmmc_voltage_init(void)
/* Do I2C/PMU writes to bring up SD card bus power */ void board_sdmmc_voltage_init(void)
{ pmu_write(PMU_REG_LDO5, PMU_LDO5(HIGH_POWER, 3300)); gpio_request(TEGRA_GPIO(J, 2), "EN_3V3_EMMC"); gpio_direction_output(TEGRA_GPIO(J, 2), 1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* For internal use only. Configure the NVIC to enable, and set the priority of, the interrupt specified by peripheral_irq. */
void configure_interrupt_controller(const enum IRQn peripheral_irq, uint32_t interrupt_priority)
/* For internal use only. Configure the NVIC to enable, and set the priority of, the interrupt specified by peripheral_irq. */ void configure_interrupt_controller(const enum IRQn peripheral_irq, uint32_t interrupt_priority)
{ configASSERT(interrupt_priority <= configLIBRARY_LOWEST_INTERRUPT_PRIORITY); configASSERT(interrupt_priority >= configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY); NVIC_ClearPendingIRQ(peripheral_irq); NVIC_SetPriority(peripheral_irq, interrupt_priority); NVIC_EnableIRQ(peripheral_irq); }
memfault/zero-to-main
C++
null
200
/* Traverse the attached ATA devices list to find out the device with given Port and PortMultiplierPort. */
PEI_AHCI_ATA_DEVICE_DATA* SearchDeviceByPort(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort)
/* Traverse the attached ATA devices list to find out the device with given Port and PortMultiplierPort. */ PEI_AHCI_ATA_DEVICE_DATA* SearchDeviceByPort(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort)
{ PEI_AHCI_ATA_DEVICE_DATA *DeviceData; LIST_ENTRY *Node; Node = GetFirstNode (&Private->DeviceList); while (!IsNull (&Private->DeviceList, Node)) { DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node); if ((DeviceData->Port == Port) && (DeviceData->PortMultiplier == PortMultip...
tianocore/edk2
C++
Other
4,240
/* Initializes the IWDG according to the specified parameters. */
void ald_iwdt_init(uint32_t load, type_func_t interrupt)
/* Initializes the IWDG according to the specified parameters. */ void ald_iwdt_init(uint32_t load, type_func_t interrupt)
{ assert_param(IS_FUNC_STATE(interrupt)); ALD_IWDT_UNLOCK(); WRITE_REG(IWDT->LOAD, load); SET_BIT(IWDT->CON, IWDT_CON_CLKS_MSK); SET_BIT(IWDT->CON, IWDT_CON_RSTEN_MSK); MODIFY_REG(IWDT->CON, IWDT_CON_IE_MSK, interrupt << IWDT_CON_IE_POS); ALD_IWDT_LOCK(); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 16-bit I/O port operations are not supported, then ASSERT(). */
UINT16 EFIAPI S3IoRead16(IN UINTN Port)
/* If 16-bit I/O port operations are not supported, then ASSERT(). */ UINT16 EFIAPI S3IoRead16(IN UINTN Port)
{ return InternalSaveIoWrite16ValueToBootScript (Port, IoRead16 (Port)); }
tianocore/edk2
C++
Other
4,240
/* If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. */
UINTN EFIAPI UnicodeVSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
/* If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. */ UINTN EFIAPI UnicodeVSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
{ UINT64 BaseListMarker[256 / sizeof (UINT64)]; BOOLEAN Converted; ASSERT_UNICODE_BUFFER (StartOfBuffer); ASSERT_UNICODE_BUFFER (FormatString); Converted = DxePrintLibPrint2ProtocolVaListToBaseList ( FALSE, (CHAR8 *)FormatString, Marker, (BASE...
tianocore/edk2
C++
Other
4,240
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US...
static int ath9k_hw_AR9287_get_eeprom_ver(struct ath_hw *ah)
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US...
{ return (ah->eeprom.map9287.baseEepHeader.version >> 12) & 0xF; }
robutest/uclinux
C++
GPL-2.0
60
/* Create a new task for the specified client. */
struct rpc_task* rpc_new_task(const struct rpc_task_setup *setup_data)
/* Create a new task for the specified client. */ struct rpc_task* rpc_new_task(const struct rpc_task_setup *setup_data)
{ struct rpc_task *task = setup_data->task; unsigned short flags = 0; if (task == NULL) { task = rpc_alloc_task(); if (task == NULL) goto out; flags = RPC_TASK_DYNAMIC; } rpc_init_task(task, setup_data); task->tk_flags |= flags; dprintk("RPC: allocated task %p\n", task); out: return task; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function to write to the Phy register. The access to phy register is a slow process as the data is moved accross MDI/MDO interface */
s32 synopGMAC_write_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 data)
/* Function to write to the Phy register. The access to phy register is a slow process as the data is moved accross MDI/MDO interface */ s32 synopGMAC_write_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 data)
{ u32 addr; u32 loop_variable; synopGMACWriteReg(RegBase, GmacGmiiData, data); addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask) | GmiiWrite; addr = addr | GmiiBusy ; synopGMACWriteReg(RegBase, GmacGmiiAddr, addr); for (loop_variable = 0; loop_var...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function convert ioctl flags (@FS_COMPR_FL, etc) to UBIFS inode flags (@UBIFS_COMPR_FL, etc). */
static int ioctl2ubifs(int ioctl_flags)
/* This function convert ioctl flags (@FS_COMPR_FL, etc) to UBIFS inode flags (@UBIFS_COMPR_FL, etc). */ static int ioctl2ubifs(int ioctl_flags)
{ int ubifs_flags = 0; if (ioctl_flags & FS_COMPR_FL) ubifs_flags |= UBIFS_COMPR_FL; if (ioctl_flags & FS_SYNC_FL) ubifs_flags |= UBIFS_SYNC_FL; if (ioctl_flags & FS_APPEND_FL) ubifs_flags |= UBIFS_APPEND_FL; if (ioctl_flags & FS_IMMUTABLE_FL) ubifs_flags |= UBIFS_IMMUTABLE_FL; if (ioctl_flags & FS_DIRSYN...
robutest/uclinux
C++
GPL-2.0
60
/* Added device is not attached to its DMAR domain here yet. That will happen when mapping the device to iova. */
static int device_notifier(struct notifier_block *nb, unsigned long action, void *data)
/* Added device is not attached to its DMAR domain here yet. That will happen when mapping the device to iova. */ static int device_notifier(struct notifier_block *nb, unsigned long action, void *data)
{ struct device *dev = data; struct pci_dev *pdev = to_pci_dev(dev); struct dmar_domain *domain; if (iommu_no_mapping(dev)) return 0; domain = find_domain(pdev); if (!domain) return 0; if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) domain_remove_one_dev_info(domain, pdev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Event notification function for TimerEvent event. If mouse device is connected to system, try to get the mouse packet data. */
VOID EFIAPI PollMouse(IN EFI_EVENT Event, IN VOID *Context)
/* Event notification function for TimerEvent event. If mouse device is connected to system, try to get the mouse packet data. */ VOID EFIAPI PollMouse(IN EFI_EVENT Event, IN VOID *Context)
{ PS2_MOUSE_DEV *MouseDev; MouseDev = (PS2_MOUSE_DEV *)Context; PS2MouseGetPacket (MouseDev); }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if request fully written, 0 if request only partially sent */
static int write_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req)
/* Returns 1 if request fully written, 0 if request only partially sent */ static int write_ep0_fifo(struct pxa_ep *ep, struct pxa27x_request *req)
{ unsigned count; int is_last, is_short; count = write_packet(ep, req, EP0_FIFO_SIZE); inc_ep_stats_bytes(ep, count, USB_DIR_IN); is_short = (count < EP0_FIFO_SIZE); is_last = ((count == 0) || (count < EP0_FIFO_SIZE)); if (unlikely(is_short)) ep_write_UDCCSR(ep, UDCCSR0_IPR); ep_dbg(ep, "in %d bytes%s%s, %d ...
robutest/uclinux
C++
GPL-2.0
60
/* config_item_init - initialize item. @item: item in question. */
void config_item_init(struct config_item *item)
/* config_item_init - initialize item. @item: item in question. */ void config_item_init(struct config_item *item)
{ kref_init(&item->ci_kref); INIT_LIST_HEAD(&item->ci_entry); }
robutest/uclinux
C++
GPL-2.0
60
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ void SAI_TransferTerminateSend(I2S_Type *base, sai_handle_t *handle)
{ assert(handle); SAI_TransferAbortSend(base, handle); memset(handle->saiQueue, 0U, sizeof(handle->saiQueue)); memset(handle->transferSize, 0U, sizeof(handle->transferSize)); handle->queueUser = 0U; handle->queueDriver = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* A bucket that has never been written to disk doesn't need to be read. We just need the buffer_heads. Don't call this for buckets that are already on disk. ocfs2_read_xattr_bucket() initializes them fully. */
static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket, u64 xb_blkno)
/* A bucket that has never been written to disk doesn't need to be read. We just need the buffer_heads. Don't call this for buckets that are already on disk. ocfs2_read_xattr_bucket() initializes them fully. */ static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket, u64 xb_blkno)
{ int i, rc = 0; for (i = 0; i < bucket->bu_blocks; i++) { bucket->bu_bhs[i] = sb_getblk(bucket->bu_inode->i_sb, xb_blkno + i); if (!bucket->bu_bhs[i]) { rc = -EIO; mlog_errno(rc); break; } if (!ocfs2_buffer_uptodate(INODE_CACHE(bucket->bu_inode), bucket->bu_bhs[i])) ocfs2_set_n...
robutest/uclinux
C++
GPL-2.0
60
/* Autosleep. When set to 1, autosleep is enabled, and the device enters wake-up mode automatically upon detection of inactivity. */
int32_t adxl372_set_autosleep(adxl372_dev *dev, bool enable)
/* Autosleep. When set to 1, autosleep is enabled, and the device enters wake-up mode automatically upon detection of inactivity. */ int32_t adxl372_set_autosleep(adxl372_dev *dev, bool enable)
{ int32_t ret; ret = adxl372_spi_write_mask(dev, ADXL372_MEASURE, ADXL372_MEASURE_AUTOSLEEP_MSK, ADXL372_MEASURE_AUTOSLEEP_MODE(enable)); return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Release_io() releases the I/O ranges allocated by a client. This may be invoked some time after a card ejection has already dumped the actual socket configuration, so if the client is "stale", we don't bother checking the port ranges against the current socket values. */
static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
/* Release_io() releases the I/O ranges allocated by a client. This may be invoked some time after a card ejection has already dumped the actual socket configuration, so if the client is "stale", we don't bother checking the port ranges against the current socket values. */ static int pcmcia_release_io(struct pcmcia_d...
{ struct pcmcia_socket *s = p_dev->socket; config_t *c = p_dev->function_config; if (!p_dev->_io) return -EINVAL; p_dev->_io = 0; if ((c->io.BasePort1 != req->BasePort1) || (c->io.NumPorts1 != req->NumPorts1) || (c->io.BasePort2 != req->BasePort2) || (c->io.NumPorts2 != req->NumPorts2)) return -...
robutest/uclinux
C++
GPL-2.0
60
/* @Brief Initialize the per-thread PMP register copy with global values. */
static unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr, unsigned long *pmp_cfg, unsigned int index_limit)
/* @Brief Initialize the per-thread PMP register copy with global values. */ static unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr, unsigned long *pmp_cfg, unsigned int index_limit)
{ ARG_UNUSED(index_limit); pmp_cfg[0] = global_pmp_cfg[0]; pmp_addr[global_pmp_end_index - 1] = global_pmp_last_addr; return global_pmp_end_index; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration of the USB device after enumeration - the device endpoints are configured and the MIDI management task started. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration of the USB device after enumeration - the device endpoints are configured and the MIDI management task started. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1); LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Wake up clock domain of Clock-gated I2C after address matching interrupts. */
void I2C_WakeUp(I2C_TypeDef *I2Cx)
/* Wake up clock domain of Clock-gated I2C after address matching interrupts. */ void I2C_WakeUp(I2C_TypeDef *I2Cx)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); I2C_ClearINT(I2Cx, BIT_IC_INTR_STAT_R_ADDR_2_MATCH); I2C_ClearINT(I2Cx, BIT_IC_INTR_STAT_R_ADDR_1_MATCH); I2C_Sleep_Cmd(I2Cx, DISABLE); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This PDC call reads count bytes from the supplied memaddr address, and copies count bytes to the Stable Storage address staddr. The call will fail if staddr+count > PDC_STABLE size. */
int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count)
/* This PDC call reads count bytes from the supplied memaddr address, and copies count bytes to the Stable Storage address staddr. The call will fail if staddr+count > PDC_STABLE size. */ int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count)
{ int retval; unsigned long flags; spin_lock_irqsave(&pdc_lock, flags); memcpy(pdc_result, memaddr, count); convert_to_wide(pdc_result); retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_WRITE, staddr, __pa(pdc_result), count); spin_unlock_irqrestore(&pdc_lock, flags...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 0 on success, -ETIME when the event is in the past. */
int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, ktime_t now)
/* Returns 0 on success, -ETIME when the event is in the past. */ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, ktime_t now)
{ unsigned long long clc; int64_t delta; if (unlikely(expires.tv64 < 0)) { WARN_ON_ONCE(1); return -ETIME; } delta = ktime_to_ns(ktime_sub(expires, now)); if (delta <= 0 || !dev->set_next_event) return -ETIME; dev->next_event = expires; if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN) return 0; if (delta > de...
EmcraftSystems/linux-emcraft
C++
Other
266