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
/* Enables or disables the Address filter module uses the specified ETHERNET MAC address for perfect filtering. */
void ETH_EnableMacAddrPerfectFilter(uint32_t MacAddr, FunctionalState Cmd)
/* Enables or disables the Address filter module uses the specified ETHERNET MAC address for perfect filtering. */ void ETH_EnableMacAddrPerfectFilter(uint32_t MacAddr, FunctionalState Cmd)
{ assert_param(IS_ETH_MAC_ADDR123(MacAddr)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { (*(__IO uint32_t*)(ETH_MAC_ADDR_HBASE + MacAddr)) |= ETH_MACADDR1HI_AE; } else { (*(__IO uint32_t*)(ETH_MAC_ADDR_HBASE + MacAddr)) &= (~(uint32_t)ETH_MACADDR1HI_AE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the message associated to this instance of #CRError. */
static void cr_parser_error_set_msg(CRParserError *a_this, const guchar *a_msg)
/* Sets the message associated to this instance of #CRError. */ static void cr_parser_error_set_msg(CRParserError *a_this, const guchar *a_msg)
{ g_return_if_fail (a_this); if (a_this->msg) { g_free (a_this->msg); } a_this->msg = g_strdup (a_msg); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Fills each init_struct member with its default value. */
void DMA_StructInit(DMA_InitTypeDef *init_struct)
/* Fills each init_struct member with its default value. */ void DMA_StructInit(DMA_InitTypeDef *init_struct)
{ init_struct->DMA_PeripheralBaseAddr = 0; init_struct->DMA_MemoryBaseAddr = 0; init_struct->DMA_DIR = DMA_DIR_PeripheralSRC; init_struct->DMA_BufferSize = 0; init_struct->DMA_PeripheralInc = DMA_PeripheralInc_Disable; init_struct->DMA_MemoryInc = DMA_MemoryInc_Disable; init_struct->DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; init_struct->DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; init_struct->DMA_Mode = DMA_Mode_Normal; init_struct->DMA_Priority = DMA_Priority_Low; init_struct->DMA_M2M = DMA_M2M_Disable; init_struct->DMA_Auto_reload = DMA_Auto_Reload_Disable; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets a data element from the SPI interface with block. */
void xSPIDataGet(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SPI interface with block. */ void xSPIDataGet(unsigned long ulBase, unsigned long *pulData)
{ unsigned char ucBitLength = SPIBitLengthGet(ulBase); xASSERT(ulBase == SPI0_BASE); while(!((xHWREG(ulBase + SPI_SR) & SPI_SR_RXBNE))) { } if (ucBitLength <= 8 && ucBitLength != 0 ) { *pulData = xHWREG(ulBase + SPI_DR) & 0xFF; } else { *pulData = xHWREG(ulBase + SPI_DR) & 0xFFFF; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* raw3270_wait/raw3270_wait_interruptible/__raw3270_wakeup Wait for end of request. The request must have been started with raw3270_start, rc = 0. The device lock may NOT have been released between calling raw3270_start and raw3270_wait. */
static void raw3270_wake_init(struct raw3270_request *rq, void *data)
/* raw3270_wait/raw3270_wait_interruptible/__raw3270_wakeup Wait for end of request. The request must have been started with raw3270_start, rc = 0. The device lock may NOT have been released between calling raw3270_start and raw3270_wait. */ static void raw3270_wake_init(struct raw3270_request *rq, void *data)
{ wake_up((wait_queue_head_t *) data); }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the clock prescaler of an QSPI device. */
u8 XQspiPs_GetClkPrescaler(XQspiPs *InstancePtr)
/* This function gets the clock prescaler of an QSPI device. */ u8 XQspiPs_GetClkPrescaler(XQspiPs *InstancePtr)
{ u32 ConfigReg; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress, XQSPIPS_CR_OFFSET); ConfigReg &= XQSPIPS_CR_PRESC_MASK; return (u8)(ConfigReg >> XQSPIPS_CR_PRESC_SHIFT); }
ua1arn/hftrx
C++
null
69
/* Device open function to count number of users. */
static int zcrypt_open(struct inode *inode, struct file *filp)
/* Device open function to count number of users. */ static int zcrypt_open(struct inode *inode, struct file *filp)
{ atomic_inc(&zcrypt_open_count); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function calculates the UINT8 sum for the requested region. */
STATIC UINT8 FvBufCalculateSum8(IN UINT8 *Buffer, IN UINTN Size)
/* This function calculates the UINT8 sum for the requested region. */ STATIC UINT8 FvBufCalculateSum8(IN UINT8 *Buffer, IN UINTN Size)
{ UINTN Index; UINT8 Sum; Sum = 0; for (Index = 0; Index < Size; Index++) { Sum = (UINT8) (Sum + Buffer[Index]); } return Sum; }
tianocore/edk2
C++
Other
4,240
/* Enable the PWM interrupt of the PWM module. //! The */
void xPWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Enable the PWM interrupt of the PWM module. //! The */ void xPWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xASSERT((ulIntType == PWM_INT_CAP_BOTH) || (ulIntType == PWM_INT_CAP_FALL) || (ulIntType == PWM_INT_CAP_RISE) || (ulIntType == PWM_INT_PWM)); if (ulIntType == PWM_INT_PWM) { xHWREG(ulBase + PWM_PIER) |= (PWM_PIER_PWMIE0 << ulChannelTemp); } else { xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp >> 1)*4) |= (ulIntType << ((ulChannel % 2) ? 16 : 0)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read Flash IDs. Vendor ID, Device ID, Device Density. */
int32_t APS6408_ReadID(OSPI_HandleTypeDef *Ctx, uint8_t *ID, uint32_t LatencyCode)
/* Read Flash IDs. Vendor ID, Device ID, Device Density. */ int32_t APS6408_ReadID(OSPI_HandleTypeDef *Ctx, uint8_t *ID, uint32_t LatencyCode)
{ if (APS6408_ReadReg(Ctx, APS6408_MR1_ADDRESS, ID, LatencyCode) != APS6408_OK) { return APS6408_ERROR; } *ID &= (APS6408_MR1_VENDOR_ID); *(ID + 1) &= (APS6408_MR2_DEVICE_ID | APS6408_MR2_DENSITY); return APS6408_OK; }
eclipse-threadx/getting-started
C++
Other
310
/* Free all network profiles in a profile list. */
VOID WifiMgrFreeProfileList(IN LIST_ENTRY *ProfileList)
/* Free all network profiles in a profile list. */ VOID WifiMgrFreeProfileList(IN LIST_ENTRY *ProfileList)
{ WIFI_MGR_NETWORK_PROFILE *Profile; LIST_ENTRY *Entry; LIST_ENTRY *NextEntry; if (ProfileList == NULL) { return; } NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, ProfileList) { Profile = NET_LIST_USER_STRUCT_S ( Entry, WIFI_MGR_NETWORK_PROFILE, Link, WIFI_MGR_PROFILE_SIGNATURE ); WifiMgrCleanProfileSecrets (Profile); if (Profile->Network.AKMSuite != NULL) { FreePool (Profile->Network.AKMSuite); } if (Profile->Network.CipherSuite != NULL) { FreePool (Profile->Network.CipherSuite); } FreePool (Profile); } }
tianocore/edk2
C++
Other
4,240
/* This function traces Bit Flags fields. If no format string is specified the Format must be NULL. */
VOID EFIAPI DumpLocalApicBitFlags(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr)
/* This function traces Bit Flags fields. If no format string is specified the Format must be NULL. */ VOID EFIAPI DumpLocalApicBitFlags(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr)
{ if (Format != NULL) { Print (Format, *(UINT32 *)Ptr); return; } Print (L"0x%X\n", *(UINT32 *)Ptr); ParseAcpiBitFields ( TRUE, 2, NULL, Ptr, 4, PARSER_PARAMS (LocalApicFlags) ); }
tianocore/edk2
C++
Other
4,240
/* ixgbe_atr_set_src_ipv4_82599 - Sets the source IPv4 address @input: input stream to modify @src_addr: the IP address to load */
s32 ixgbe_atr_set_src_ipv4_82599(struct ixgbe_atr_input *input, u32 src_addr)
/* ixgbe_atr_set_src_ipv4_82599 - Sets the source IPv4 address @input: input stream to modify @src_addr: the IP address to load */ s32 ixgbe_atr_set_src_ipv4_82599(struct ixgbe_atr_input *input, u32 src_addr)
{ input->byte_stream[IXGBE_ATR_SRC_IPV4_OFFSET + 3] = src_addr >> 24; input->byte_stream[IXGBE_ATR_SRC_IPV4_OFFSET + 2] = (src_addr >> 16) & 0xff; input->byte_stream[IXGBE_ATR_SRC_IPV4_OFFSET + 1] = (src_addr >> 8) & 0xff; input->byte_stream[IXGBE_ATR_SRC_IPV4_OFFSET] = src_addr & 0xff; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */
UINTN EFIAPI StrDecimalToUintn(IN CONST CHAR16 *String)
/* If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */ UINTN EFIAPI StrDecimalToUintn(IN CONST CHAR16 *String)
{ UINTN Result; if (RETURN_ERROR (StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result))) { return MAX_UINTN; } return Result; }
tianocore/edk2
C++
Other
4,240
/* Enable the clock via the Power Control for Peripherals register */
static void local_clk_enable(struct clk *clk)
/* Enable the clock via the Power Control for Peripherals register */ static void local_clk_enable(struct clk *clk)
{ lpc178x_periph_enable(clk->pconp_mask, 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Open a file and copy its content to a buffer. */
uint32_t Storage_CheckBitmapFile(const char *BmpName, uint32_t *FileLen)
/* Open a file and copy its content to a buffer. */ uint32_t Storage_CheckBitmapFile(const char *BmpName, uint32_t *FileLen)
{ if(f_mount(&fs, (TCHAR const*)"",0)) { return 1; } if(f_open (&F, (TCHAR const*)BmpName, FA_READ)) { return 2; } f_read(&F, sector, 6, (UINT *)&BytesRead); if(Buffercmp((uint8_t *)SlidesCheck, (uint8_t *) sector, 2) != 0) { return 3; } return 0; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Given a tvbuff, and a length from a packet header, adjust the length of the tvbuff to reflect the specified length. */
void set_actual_length(tvbuff_t *tvb, const guint specified_len)
/* Given a tvbuff, and a length from a packet header, adjust the length of the tvbuff to reflect the specified length. */ void set_actual_length(tvbuff_t *tvb, const guint specified_len)
{ if (specified_len < tvb_reported_length(tvb)) { tvb_set_reported_length(tvb, specified_len); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clear out all data in the circular buffer. */
static void oti6858_buf_clear(struct oti6858_buf *pb)
/* Clear out all data in the circular buffer. */ static void oti6858_buf_clear(struct oti6858_buf *pb)
{ if (pb != NULL) { pb->buf_get = pb->buf_put; } }
robutest/uclinux
C++
GPL-2.0
60
/* If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINTN EFIAPI InternalBaseLibBitFieldAndUint(IN UINTN Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINTN AndData)
/* If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINTN EFIAPI InternalBaseLibBitFieldAndUint(IN UINTN Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINTN AndData)
{ ASSERT ((AndData >> (EndBit - StartBit)) == ((AndData >> (EndBit - StartBit)) & 1)); return Operand & ~((~AndData << StartBit) & ~((UINTN)-2 << EndBit)); }
tianocore/edk2
C++
Other
4,240
/* Disable error interrupt of the specified dma channel. */
en_result_t Dma_DisableChannelErrIrq(en_dma_channel_t enCh)
/* Disable error interrupt of the specified dma channel. */ en_result_t Dma_DisableChannelErrIrq(en_dma_channel_t enCh)
{ ASSERT(IS_VALID_CH(enCh)); if(!IS_VALID_CH(enCh)) { return ErrorInvalidParameter; } if(enCh == DmaCh0) { M0P_DMAC->CONFB0_f.ERR_IE = 0; } else{ M0P_DMAC->CONFB1_f.ERR_IE = 0; } return Ok; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks whether the specified SDIO flag is set or not. */
FlagStatus SDIO_GetFlagStatus(uint32_t SDIO_FLAG)
/* Checks whether the specified SDIO flag is set or not. */ FlagStatus SDIO_GetFlagStatus(uint32_t SDIO_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_SDIO_FLAG(SDIO_FLAG)); if ((SDIO->STA & SDIO_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Default synchronous end-of-IO handler.. Just mark it up-to-date and unlock the buffer. This is what ll_rw_block uses too. */
void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
/* Default synchronous end-of-IO handler.. Just mark it up-to-date and unlock the buffer. This is what ll_rw_block uses too. */ void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
{ __end_buffer_read_notouch(bh, uptodate); put_bh(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* Task to retrieve the HID device information from an attached device, and output the relevant data to the serial port for analysis. */
void RetrieveDeviceData(void)
/* Task to retrieve the HID device information from an attached device, and output the relevant data to the serial port for analysis. */ void RetrieveDeviceData(void)
{ if (USB_HostState != HOST_STATE_Configured) return; LEDs_SetAllLEDs(LEDMASK_USB_BUSY); OutputReportSizes(); OutputParsedReportItems(); LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_Host_SetDeviceConfiguration(0); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Setup the systick timer to generate the tick interrupts at the required frequency. */
static void prvSetupTimerInterrupt(void)
/* Setup the systick timer to generate the tick interrupts at the required frequency. */ static void prvSetupTimerInterrupt(void)
{ *(portNVIC_SYSTICK_LOAD) = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL; *(portNVIC_SYSTICK_CTRL) = portNVIC_SYSTICK_CLK | portNVIC_SYSTICK_INT | portNVIC_SYSTICK_ENABLE; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* host msd ufi command callback. This function is used as callback function for ufi command . */
static void USB_HostMsdUfiCallback(void *param, uint8_t *data, uint32_t dataLength, usb_status_t status)
/* host msd ufi command callback. This function is used as callback function for ufi command . */ static void USB_HostMsdUfiCallback(void *param, uint8_t *data, uint32_t dataLength, usb_status_t status)
{ xSemaphoreGive(s_CommandSemaphore); ufiStatus = status; }
labapart/polymcu
C++
null
201
/* Called by scsi_cmd_to_srp_cmd() when converting scsi cmds to srp cmds Returns 1 on success. */
static int map_data_for_srp_cmd(struct scsi_cmnd *cmd, struct srp_event_struct *evt_struct, struct srp_cmd *srp_cmd, struct device *dev)
/* Called by scsi_cmd_to_srp_cmd() when converting scsi cmds to srp cmds Returns 1 on success. */ static int map_data_for_srp_cmd(struct scsi_cmnd *cmd, struct srp_event_struct *evt_struct, struct srp_cmd *srp_cmd, struct device *dev)
{ switch (cmd->sc_data_direction) { case DMA_FROM_DEVICE: case DMA_TO_DEVICE: break; case DMA_NONE: return 1; case DMA_BIDIRECTIONAL: sdev_printk(KERN_ERR, cmd->device, "Can't map DMA_BIDIRECTIONAL to read/write\n"); return 0; default: sdev_printk(KERN_ERR, cmd->device, "Unknown data direction 0x%02x; can't map!\n", cmd->sc_data_direction); return 0; } return map_sg_data(cmd, evt_struct, srp_cmd, dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Clear SPI interrupt status flag. This function can be used to clear special SPI interrupt status flag. */
void SPIIntFlagClear(unsigned long ulBase, unsigned long ulFlags)
/* Clear SPI interrupt status flag. This function can be used to clear special SPI interrupt status flag. */ void SPIIntFlagClear(unsigned long ulBase, unsigned long ulFlags)
{ xASSERT(ulBase == SPI0_BASE); xASSERT(ulFlags == SPI_INT_SPIF); xHWREG(ulBase + S0SPINT) |= S0SPINT_SPIF; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function is used to install gd25qxx driver. */
int tls_spifls_drv_install(void)
/* This function is used to install gd25qxx driver. */ int tls_spifls_drv_install(void)
{ int err; extern int tls_spifls_probe(void); extern int tls_spifls_drv_register(struct tls_fls_drv *fls_drv); err = tls_spifls_drv_register((struct tls_fls_drv *) &exspi_fls); if (err == TLS_FLS_STATUS_EEXIST) { return err; } TLS_DBGPRT_INFO("register the spi flash driver - %d.\n", err); err = tls_spifls_probe(); TLS_DBGPRT_INFO("probe spi flash - %d.\n", err); return err; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Source register rounding function on WAKE_UP_SRC (1Bh), TAP_SRC (1Ch), D6D_SRC (1Dh), STATUS_REG (1Eh) and FUNC_SRC1 (53h) registers in the primary interface.. */
int32_t lsm6dsl_rounding_on_status_set(stmdev_ctx_t *ctx, lsm6dsl_rounding_status_t val)
/* Source register rounding function on WAKE_UP_SRC (1Bh), TAP_SRC (1Ch), D6D_SRC (1Dh), STATUS_REG (1Eh) and FUNC_SRC1 (53h) registers in the primary interface.. */ int32_t lsm6dsl_rounding_on_status_set(stmdev_ctx_t *ctx, lsm6dsl_rounding_status_t val)
{ lsm6dsl_ctrl7_g_t ctrl7_g; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_CTRL7_G, (uint8_t*)&ctrl7_g, 1); if(ret == 0){ ctrl7_g.rounding_status = (uint8_t) val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_CTRL7_G, (uint8_t*)&ctrl7_g, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Description: Enables a low level driver to set an upper limit on the number of hw data segments in a request. This would be the largest number of address/length pairs the host adapter can actually give at once to the device. */
void blk_queue_max_hw_segments(struct request_queue *q, unsigned short max_segments)
/* Description: Enables a low level driver to set an upper limit on the number of hw data segments in a request. This would be the largest number of address/length pairs the host adapter can actually give at once to the device. */ void blk_queue_max_hw_segments(struct request_queue *q, unsigned short max_segments)
{ if (!max_segments) { max_segments = 1; printk(KERN_INFO "%s: set to minimum %d\n", __func__, max_segments); } q->limits.max_hw_segments = max_segments; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will fill a formatted string to buffer. */
int rt_snprintf(char *buf, rt_size_t size, const char *fmt,...)
/* This function will fill a formatted string to buffer. */ int rt_snprintf(char *buf, rt_size_t size, const char *fmt,...)
{ rt_int32_t n = 0; va_list args; va_start(args, fmt); n = rt_vsnprintf(buf, size, fmt, args); va_end(args); return n; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Look at global flags, the device itself, and its parent busses to determine if MSI/-X are supported for the device. If MSI/-X is supported return 0, else return an error code. */
static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type)
/* Look at global flags, the device itself, and its parent busses to determine if MSI/-X are supported for the device. If MSI/-X is supported return 0, else return an error code. */ static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type)
{ struct pci_bus *bus; int ret; if (!pci_msi_enable || !dev || dev->no_msi) return -EINVAL; if (nvec < 1) return -ERANGE; for (bus = dev->bus; bus; bus = bus->parent) if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) return -EINVAL; ret = arch_msi_check_device(dev, nvec, type); if (ret) return ret; if (!pci_find_capability(dev, type)) return -EINVAL; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* iwl4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue */
static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, u16 txq_id)
/* iwl4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue */ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, u16 txq_id)
{ u32 tbl_dw_addr; u32 tbl_dw; u16 scd_q2ratid; scd_q2ratid = ra_tid & IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; tbl_dw_addr = priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); if (txq_id & 0x1) tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); else tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); iwl_write_targ_mem(priv, tbl_dw_addr, tbl_dw); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* vxge_hw_mgmt_device_config - Retrieve device configuration. Get device configuration. Permits to retrieve at run-time configuration values that were used to initialize and configure the device. */
enum vxge_hw_status vxge_hw_mgmt_device_config(struct __vxge_hw_device *hldev, struct vxge_hw_device_config *dev_config, int size)
/* vxge_hw_mgmt_device_config - Retrieve device configuration. Get device configuration. Permits to retrieve at run-time configuration values that were used to initialize and configure the device. */ enum vxge_hw_status vxge_hw_mgmt_device_config(struct __vxge_hw_device *hldev, struct vxge_hw_device_config *dev_config, int size)
{ if ((hldev == NULL) || (hldev->magic != VXGE_HW_DEVICE_MAGIC)) return VXGE_HW_ERR_INVALID_DEVICE; if (size != sizeof(struct vxge_hw_device_config)) return VXGE_HW_ERR_VERSION_CONFLICT; memcpy(dev_config, &hldev->config, sizeof(struct vxge_hw_device_config)); return VXGE_HW_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* Takes a clocksource= boot argument and uses it as the clocksource override name. */
static int __init boot_override_clocksource(char *str)
/* Takes a clocksource= boot argument and uses it as the clocksource override name. */ static int __init boot_override_clocksource(char *str)
{ mutex_lock(&clocksource_mutex); if (str) strlcpy(override_name, str, sizeof(override_name)); mutex_unlock(&clocksource_mutex); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: calculated prescale - 1 for easy programming into SPI registers or negative error number if valid prescalar cannot be updated. */
static int davinci_spi_get_prescale(struct davinci_spi *dspi, u32 max_speed_hz)
/* Returns: calculated prescale - 1 for easy programming into SPI registers or negative error number if valid prescalar cannot be updated. */ static int davinci_spi_get_prescale(struct davinci_spi *dspi, u32 max_speed_hz)
{ int ret; ret = DIV_ROUND_UP(clk_get_rate(dspi->clk), max_speed_hz); if (ret < 3) { rt_kprintf("spi clock freq too high\n"); ret = 3; } if (ret > 256) { rt_kprintf("spi clock freq too litter\n"); ret = 256; } return ret - 1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is called when the USB stack does a usb_{bus,device}_{add,remove}() so we can do WUSB specific handling. It is called with [for the case of USB_DEVICE_{ADD,REMOVE} with the usb_dev locked. */
int wusb_usb_ncb(struct notifier_block *nb, unsigned long val, void *priv)
/* This is called when the USB stack does a usb_{bus,device}_{add,remove}() so we can do WUSB specific handling. It is called with [for the case of USB_DEVICE_{ADD,REMOVE} with the usb_dev locked. */ int wusb_usb_ncb(struct notifier_block *nb, unsigned long val, void *priv)
{ int result = NOTIFY_OK; switch (val) { case USB_DEVICE_ADD: wusb_dev_add_ncb(priv); break; case USB_DEVICE_REMOVE: wusb_dev_rm_ncb(priv); break; case USB_BUS_ADD: case USB_BUS_REMOVE: break; default: WARN_ON(1); result = NOTIFY_BAD; }; return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Set all interrupt status bits in Normal and Error Interrupt Status Enable register. */
EFI_STATUS SdPeimHcEnableInterrupt(IN UINTN Bar)
/* Set all interrupt status bits in Normal and Error Interrupt Status Enable register. */ EFI_STATUS SdPeimHcEnableInterrupt(IN UINTN Bar)
{ EFI_STATUS Status; UINT16 IntStatus; IntStatus = 0xFFFF; Status = SdPeimHcRwMmio (Bar + SD_HC_ERR_INT_STS_EN, FALSE, sizeof (IntStatus), &IntStatus); if (EFI_ERROR (Status)) { return Status; } IntStatus = 0xFFFF; Status = SdPeimHcRwMmio (Bar + SD_HC_NOR_INT_STS_EN, FALSE, sizeof (IntStatus), &IntStatus); return Status; }
tianocore/edk2
C++
Other
4,240
/* This function starts the event counters in L2 Cache controller. */
void XL2cc_EventCtrStart(void)
/* This function starts the event counters in L2 Cache controller. */ void XL2cc_EventCtrStart(void)
{ u32 *LocalPtr; LocalPtr = (u32 *)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNTRL_OFFSET); XL2cc_EventCtrReset(); *LocalPtr = (u32)1; }
ua1arn/hftrx
C++
null
69
/* offset is updated for use by the caller. */
static void mcpe_dissect_detail_payload_0x00(tvbuff_t *tvb, proto_tree *mcpe_tree, gint *offset)
/* offset is updated for use by the caller. */ static void mcpe_dissect_detail_payload_0x00(tvbuff_t *tvb, proto_tree *mcpe_tree, gint *offset)
{ gint item_size; item_size = 2; proto_tree_add_item(mcpe_tree, hf_mcpe_general_packet_payload_length, tvb, *offset, item_size, ENC_BIG_ENDIAN); *offset += item_size; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* this function will return the file system mounted on specified path. */
struct dfs_filesystem* dfs_filesystem_lookup(const char *path)
/* this function will return the file system mounted on specified path. */ struct dfs_filesystem* dfs_filesystem_lookup(const char *path)
{ struct dfs_filesystem *iter; struct dfs_filesystem *fs = NULL; uint32_t fspath, prefixlen; prefixlen = 0; RT_ASSERT(path); dfs_lock(); for (iter = &filesystem_table[0]; iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++) { if ((iter->path == NULL) || (iter->ops == NULL)) continue; fspath = strlen(iter->path); if ((fspath < prefixlen) || (strncmp(iter->path, path, fspath) != 0)) continue; if (fspath > 1 && (strlen(path) > fspath) && (path[fspath] != '/')) continue; fs = iter; prefixlen = fspath; } dfs_unlock(); return fs; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Determine if a microcode patch matchs the specific processor signature and flag. */
BOOLEAN IsProcessorMatchedMicrocode(IN UINT32 ProcessorSignature, IN UINT32 ProcessorFlags, IN EDKII_PEI_MICROCODE_CPU_ID *MicrocodeCpuId, IN UINTN MicrocodeCpuIdCount)
/* Determine if a microcode patch matchs the specific processor signature and flag. */ BOOLEAN IsProcessorMatchedMicrocode(IN UINT32 ProcessorSignature, IN UINT32 ProcessorFlags, IN EDKII_PEI_MICROCODE_CPU_ID *MicrocodeCpuId, IN UINTN MicrocodeCpuIdCount)
{ UINTN Index; if (MicrocodeCpuIdCount == 0) { return TRUE; } for (Index = 0; Index < MicrocodeCpuIdCount; Index++) { if ((ProcessorSignature == MicrocodeCpuId[Index].ProcessorSignature) && ((ProcessorFlags & (1 << MicrocodeCpuId[Index].PlatformId)) != 0)) { return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* We can also actually read and write in b/w/l sizes! Thankfully this part was at least done right, and we don't have to do the stupid masking and shifting that we do on the 7751! Small wonders never cease to amaze. */
static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
/* We can also actually read and write in b/w/l sizes! Thankfully this part was at least done right, and we don't have to do the stupid masking and shifting that we do on the 7751! Small wonders never cease to amaze. */ static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
{ *val = 0xffffffff; if (!gapspci_config_access(bus->number, devfn)) return PCIBIOS_DEVICE_NOT_FOUND; switch (size) { case 1: *val = inb(GAPSPCI_BBA_CONFIG+where); break; case 2: *val = inw(GAPSPCI_BBA_CONFIG+where); break; case 4: *val = inl(GAPSPCI_BBA_CONFIG+where); break; } return PCIBIOS_SUCCESSFUL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Play the effect with PID id n times */
static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)
/* Play the effect with PID id n times */ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)
{ pidff->effect_operation[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id; if (n == 0) { pidff->effect_operation_status->value[0] = pidff->operation_id[PID_EFFECT_STOP]; } else { pidff->effect_operation_status->value[0] = pidff->operation_id[PID_EFFECT_START]; pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; } usbhid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], USB_DIR_OUT); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the most recent received data by the I2Cx peripheral. */
uint8_t I2C_ReceiveData(I2C_TypeDef *I2Cx)
/* Returns the most recent received data by the I2Cx peripheral. */ uint8_t I2C_ReceiveData(I2C_TypeDef *I2Cx)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); return (uint8_t)I2Cx->RXDR; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disable the UART clock. This function disables the clock to the UART. */
void am_hal_uart_clock_disable(uint32_t ui32Module)
/* Disable the UART clock. This function disables the clock to the UART. */ void am_hal_uart_clock_disable(uint32_t ui32Module)
{ AM_REGn(UART, ui32Module, CR) &= ~AM_REG_UART_CR_CLKEN_M; am_hal_clkgen_uarten_set(ui32Module, AM_HAL_CLKGEN_UARTEN_DIS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Registers an interrupt handler for a fault condition detected in a PWM module. */
void PWMFaultIntRegister(uint32_t ui32Base, void(*pfnIntHandler)(void))
/* Registers an interrupt handler for a fault condition detected in a PWM module. */ void PWMFaultIntRegister(uint32_t ui32Base, void(*pfnIntHandler)(void))
{ uint32_t ui32Int; ASSERT(ui32Base == PWM0_BASE); ui32Int = _PWMFaultIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntRegister(ui32Int, pfnIntHandler); IntEnable(ui32Int); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* note: MOUNT record is at aggregate level, not at fileset level, since log records of previous mounts of a fileset (e.g., AFTER record of extent allocation) have to be processed to update block allocation map at aggregate level. */
static int logMOUNT(struct super_block *sb)
/* note: MOUNT record is at aggregate level, not at fileset level, since log records of previous mounts of a fileset (e.g., AFTER record of extent allocation) have to be processed to update block allocation map at aggregate level. */ static int logMOUNT(struct super_block *sb)
{ struct jfs_log *log = JFS_SBI(sb)->log; struct lrd lrd; lrd.logtid = 0; lrd.backchain = 0; lrd.type = cpu_to_le16(LOG_MOUNT); lrd.length = 0; lrd.aggregate = cpu_to_le32(new_encode_dev(sb->s_bdev->bd_dev)); lmLog(log, NULL, &lrd, NULL); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Update the free cluster info of FatInfoSector of the volume. */
VOID FatComputeFreeInfo(IN FAT_VOLUME *Volume)
/* Update the free cluster info of FatInfoSector of the volume. */ VOID FatComputeFreeInfo(IN FAT_VOLUME *Volume)
{ UINTN Index; if (!Volume->FreeInfoValid) { Volume->FreeInfoValid = TRUE; Volume->FatInfoSector.FreeInfo.ClusterCount = 0; for (Index = Volume->MaxCluster + 1; Index >= FAT_MIN_CLUSTER; Index--) { if (Volume->DiskError) { break; } if (FatGetFatEntry (Volume, Index) == FAT_CLUSTER_FREE) { Volume->FatInfoSector.FreeInfo.ClusterCount += 1; Volume->FatInfoSector.FreeInfo.NextCluster = (UINT32)Index; } } Volume->FatInfoSector.Signature = FAT_INFO_SIGNATURE; Volume->FatInfoSector.InfoBeginSignature = FAT_INFO_BEGIN_SIGNATURE; Volume->FatInfoSector.InfoEndSignature = FAT_INFO_END_SIGNATURE; } }
tianocore/edk2
C++
Other
4,240
/* dccp_feat_finalise_settings - Finalise settings before starting negotiation @dp: client or listening socket (settings will be inherited) This is called after all registrations (socket initialisation, sysctls, and sockopt calls), and before sending the first packet containing Change options (ie. client-Request or server-Response), to ensure internal consistency. */
int dccp_feat_finalise_settings(struct dccp_sock *dp)
/* dccp_feat_finalise_settings - Finalise settings before starting negotiation @dp: client or listening socket (settings will be inherited) This is called after all registrations (socket initialisation, sysctls, and sockopt calls), and before sending the first packet containing Change options (ie. client-Request or server-Response), to ensure internal consistency. */ int dccp_feat_finalise_settings(struct dccp_sock *dp)
{ struct list_head *fn = &dp->dccps_featneg; struct dccp_feat_entry *entry; int i = 2, ccids[2] = { -1, -1 }; list_for_each_entry(entry, fn, node) if (entry->feat_num == DCCPF_CCID && entry->val.sp.len == 1) ccids[entry->is_local] = entry->val.sp.vec[0]; while (i--) if (ccids[i] > 0 && dccp_feat_propagate_ccid(fn, ccids[i], i)) return -1; dccp_feat_print_fnlist(fn); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* pcmcia_loop_config() loops over all configuration options, and calls the driver-specific conf_check() for each one, checking whether it is a valid one. Returns 0 on success or errorcode otherwise. */
int pcmcia_loop_config(struct pcmcia_device *p_dev, int(*conf_check)(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, unsigned int vcc, void *priv_data), void *priv_data)
/* pcmcia_loop_config() loops over all configuration options, and calls the driver-specific conf_check() for each one, checking whether it is a valid one. Returns 0 on success or errorcode otherwise. */ int pcmcia_loop_config(struct pcmcia_device *p_dev, int(*conf_check)(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, unsigned int vcc, void *priv_data), void *priv_data)
{ struct pcmcia_cfg_mem *cfg_mem; int ret; cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); if (cfg_mem == NULL) return -ENOMEM; cfg_mem->p_dev = p_dev; cfg_mem->conf_check = conf_check; cfg_mem->priv_data = priv_data; ret = pccard_loop_tuple(p_dev->socket, p_dev->func, CISTPL_CFTABLE_ENTRY, &cfg_mem->parse, cfg_mem, pcmcia_do_loop_config); kfree(cfg_mem); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* allocate a block in the cache in which to store a page */
int cachefiles_allocate_page(struct fscache_retrieval *op, struct page *page, gfp_t gfp)
/* allocate a block in the cache in which to store a page */ int cachefiles_allocate_page(struct fscache_retrieval *op, struct page *page, gfp_t gfp)
{ struct cachefiles_object *object; struct cachefiles_cache *cache; struct pagevec pagevec; int ret; object = container_of(op->op.object, struct cachefiles_object, fscache); cache = container_of(object->fscache.cache, struct cachefiles_cache, cache); _enter("%p,{%lx},", object, page->index); ret = cachefiles_has_space(cache, 0, 1); if (ret == 0) { pagevec_init(&pagevec, 0); pagevec_add(&pagevec, page); fscache_mark_pages_cached(op, &pagevec); } else { ret = -ENOBUFS; } _leave(" = %d", ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* The RM7000 variant has to handle erratum 38. The workaround is to not have any pending stores when the WAIT instruction is executed. */
static void rm7k_wait_irqoff(void)
/* The RM7000 variant has to handle erratum 38. The workaround is to not have any pending stores when the WAIT instruction is executed. */ static void rm7k_wait_irqoff(void)
{ local_irq_disable(); if (!need_resched()) __asm__( " .set push \n" " .set mips3 \n" " .set noat \n" " mfc0 $1, $12 \n" " sync \n" " mtc0 $1, $12 # stalls until W stage \n" " wait \n" " mtc0 $1, $12 # stalls until W stage \n" " .set pop \n"); local_irq_enable(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disables multicast hash filtering. When disabled GMAC performs perfect destination address filtering for unicast frames, it compares DA field with the value programmed in DA register. */
void synopGMAC_unicast_hash_filter_disable(synopGMACdevice *gmacdev)
/* Disables multicast hash filtering. When disabled GMAC performs perfect destination address filtering for unicast frames, it compares DA field with the value programmed in DA register. */ void synopGMAC_unicast_hash_filter_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev -> MacBase, GmacFrameFilter, GmacUcastHashFilter); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* return kStatus_Success: success in setting the SNVS SRTC alarm kStatus_InvalidArgument: Error because the alarm datetime format is incorrect kStatus_Fail: Error because the alarm time has already passed or is beyond resolution */
status_t SNVS_LP_SRTC_SetAlarm(SNVS_Type *base, const snvs_lp_srtc_datetime_t *alarmTime)
/* return kStatus_Success: success in setting the SNVS SRTC alarm kStatus_InvalidArgument: Error because the alarm datetime format is incorrect kStatus_Fail: Error because the alarm time has already passed or is beyond resolution */ status_t SNVS_LP_SRTC_SetAlarm(SNVS_Type *base, const snvs_lp_srtc_datetime_t *alarmTime)
{ assert(alarmTime); uint32_t alarmSeconds = 0U; uint32_t currSeconds = 0U; uint32_t tmp = base->LPCR; if (!(SNVS_LP_CheckDatetimeFormat(alarmTime))) { return kStatus_InvalidArgument; } alarmSeconds = SNVS_LP_ConvertDatetimeToSeconds(alarmTime); currSeconds = SNVS_LP_SRTC_GetSeconds(base); if (alarmSeconds <= currSeconds) { return kStatus_Fail; } base->LPCR &= ~SNVS_LPCR_LPTA_EN_MASK; while (base->LPCR & SNVS_LPCR_LPTA_EN_MASK) { } base->LPTAR = alarmSeconds; base->LPCR = tmp; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Empty queue by removing and destroying all BD's. Free all buffers. */
static void ipw_queue_tx_free(struct ipw_priv *priv, struct clx2_tx_queue *txq)
/* Empty queue by removing and destroying all BD's. Free all buffers. */ static void ipw_queue_tx_free(struct ipw_priv *priv, struct clx2_tx_queue *txq)
{ struct clx2_queue *q = &txq->q; struct pci_dev *dev = priv->pci_dev; if (q->n_bd == 0) return; for (; q->first_empty != q->last_used; q->last_used = ipw_queue_inc_wrap(q->last_used, q->n_bd)) { ipw_queue_tx_free_tfd(priv, txq); } pci_free_consistent(dev, sizeof(txq->bd[0]) * q->n_bd, txq->bd, q->dma_addr); kfree(txq->txb); memset(txq, 0, sizeof(*txq)); }
robutest/uclinux
C++
GPL-2.0
60
/* On some machines, PMC5 and PMC6 can't be written, don't respect the freeze conditions, and don't generate interrupts. This tells us if */
static int is_limited_pmc(int pmcnum)
/* On some machines, PMC5 and PMC6 can't be written, don't respect the freeze conditions, and don't generate interrupts. This tells us if */ static int is_limited_pmc(int pmcnum)
{ return (ppmu->flags & PPMU_LIMITED_PMC5_6) && (pmcnum == 5 || pmcnum == 6); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Places the CPU in a sleep state until an interrupt is received. If interrupts are disabled prior to calling this function, then the CPU will be placed in a sleep state indefinitely. */
VOID EFIAPI CpuSleep(VOID)
/* Places the CPU in a sleep state until an interrupt is received. If interrupts are disabled prior to calling this function, then the CPU will be placed in a sleep state indefinitely. */ VOID EFIAPI CpuSleep(VOID)
{ __asm__ __volatile__ ("hlt"::: "memory"); }
tianocore/edk2
C++
Other
4,240
/* Final part of subpacket decoding: Apply modulated lapped transform, gain compensation, clip and convert to integer. */
static void mlt_compensate_output(COOKContext *q, float *decode_buffer, cook_gains *gains, float *previous_buffer, int16_t *out, int chan)
/* Final part of subpacket decoding: Apply modulated lapped transform, gain compensation, clip and convert to integer. */ static void mlt_compensate_output(COOKContext *q, float *decode_buffer, cook_gains *gains, float *previous_buffer, int16_t *out, int chan)
{ imlt_gain(q, decode_buffer, gains, previous_buffer); q->saturate_output (q, chan, out); }
DC-SWAT/DreamShell
C++
null
404
/* The rfcomm tty device will possibly retain even when conn is down, and sysfs doesn't support move zombie device, so we should move the device before conn device is destroyed. */
static int __match_tty(struct device *dev, void *data)
/* The rfcomm tty device will possibly retain even when conn is down, and sysfs doesn't support move zombie device, so we should move the device before conn device is destroyed. */ static int __match_tty(struct device *dev, void *data)
{ return !strncmp(dev_name(dev), "rfcomm", 6); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Atmel Software Framework Common Sensor API version. This routine Gets the Sensor API version number and release date. */
const char* sensor_api_version(void)
/* Atmel Software Framework Common Sensor API version. This routine Gets the Sensor API version number and release date. */ const char* sensor_api_version(void)
{ static const char sensors_xplained_version [] = "$Id: ATML ASF Sensor Service 1.7 $ $Revision: 29685 $ " "$Date: 2012-03-09 15:53:00 -0800 (Fri, 09 Mar 2012) $"; return sensors_xplained_version; }
memfault/zero-to-main
C++
null
200
/* Used to free the superblock along various error paths. */
void xfs_freesb(xfs_mount_t *mp)
/* Used to free the superblock along various error paths. */ void xfs_freesb(xfs_mount_t *mp)
{ xfs_buf_t *bp; bp = xfs_getsb(mp, 0); XFS_BUF_UNMANAGE(bp); xfs_buf_relse(bp); mp->m_sb_bp = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* iwl3945_hw_reg_adjust_power_by_temp return index delta into power gain settings table */
static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
/* iwl3945_hw_reg_adjust_power_by_temp return index delta into power gain settings table */ static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
{ return (new_reading - old_reading) * (-11) / 100; }
robutest/uclinux
C++
GPL-2.0
60
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
{ sys_table = systable; boottime = systable->boottime; return EFI_ST_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Flush FIFO Perform a complete flush of RX and TX */
static void flush_fifo(usbd_device *dev)
/* Flush FIFO Perform a complete flush of RX and TX */ static void flush_fifo(usbd_device *dev)
{ REBASE(DWC_OTG_GRSTCTL) = DWC_OTG_GRSTCTL_RXFFLSH | (DWC_OTG_GRSTCTL_TXFFLSH | DWC_OTG_GRSTCTL_TXFNUM_ALL); while (REBASE(DWC_OTG_GRSTCTL) & (DWC_OTG_GRSTCTL_RXFFLSH | DWC_OTG_GRSTCTL_TXFFLSH)); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Shift an (unsigned) quad value right (logical shift right). */
quad_t __lshrdi3(quad_t a, qshift_t shift)
/* Shift an (unsigned) quad value right (logical shift right). */ quad_t __lshrdi3(quad_t a, qshift_t shift)
{ union uu aa; if (shift == 0) { return a; } aa.q = a; if (shift >= INT_BITS) { aa.ul[L] = aa.ul[H] >> (shift - INT_BITS); aa.ul[H] = 0; } else { aa.ul[L] = (aa.ul[L] >> shift) | (aa.ul[H] << (INT_BITS - shift)); aa.ul[H] >>= shift; } return aa.q; }
labapart/polymcu
C++
null
201
/* Convert the GUID representation of terminal type to enum type. */
TERMINAL_TYPE TerminalTypeFromGuid(IN EFI_GUID *Guid)
/* Convert the GUID representation of terminal type to enum type. */ TERMINAL_TYPE TerminalTypeFromGuid(IN EFI_GUID *Guid)
{ TERMINAL_TYPE Type; for (Type = 0; Type < ARRAY_SIZE (mTerminalType); Type++) { if (CompareGuid (Guid, mTerminalType[Type])) { break; } } return Type; }
tianocore/edk2
C++
Other
4,240
/* PIXIS_LBMAP_ALTBANK - The value to program into SWx to tell the ngPIXIS to boot from the alternate bank. */
static u8 __pixis_read(unsigned int reg)
/* PIXIS_LBMAP_ALTBANK - The value to program into SWx to tell the ngPIXIS to boot from the alternate bank. */ static u8 __pixis_read(unsigned int reg)
{ void *p = (void *)PIXIS_BASE; return in_8(p + reg); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns unsigned register value on success, -errno on failure. */
static int li_read_ad1843_reg(lithium_t *lith, int reg)
/* Returns unsigned register value on success, -errno on failure. */ static int li_read_ad1843_reg(lithium_t *lith, int reg)
{ int val; ASSERT(!in_interrupt()); spin_lock(&lith->lock); { val = li_ad1843_wait(lith); if (val == 0) { li_writel(lith, LI_CODEC_COMMAND, LI_CC_DIR_RD | reg); val = li_ad1843_wait(lith); } if (val == 0) val = li_readl(lith, LI_CODEC_DATA); } spin_unlock(&lith->lock); DBGXV("li_read_ad1843_reg(lith=0x%p, reg=%d) returns 0x%04x\n", lith, reg, val); return val; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns whether or not the specified cache level has separate I/D caches. */
BOOLEAN SmbiosProcessorHasSeparateCaches(UINT8 CacheLevel)
/* Returns whether or not the specified cache level has separate I/D caches. */ BOOLEAN SmbiosProcessorHasSeparateCaches(UINT8 CacheLevel)
{ CLIDR_CACHE_TYPE CacheType; CLIDR_DATA Clidr; BOOLEAN SeparateCaches; SeparateCaches = FALSE; Clidr.Data = ReadCLIDR (); CacheType = CLIDR_GET_CACHE_TYPE (Clidr.Data, CacheLevel - 1); if (CacheType == ClidrCacheTypeSeparate) { SeparateCaches = TRUE; } return SeparateCaches; }
tianocore/edk2
C++
Other
4,240
/* port_build_proto_msg(): build a port level protocol or a connection abortion message. Called with tipc_port lock on. */
static struct sk_buff* port_build_proto_msg(u32 destport, u32 destnode, u32 origport, u32 orignode, u32 usr, u32 type, u32 err, u32 seqno, u32 ack)
/* port_build_proto_msg(): build a port level protocol or a connection abortion message. Called with tipc_port lock on. */ static struct sk_buff* port_build_proto_msg(u32 destport, u32 destnode, u32 origport, u32 orignode, u32 usr, u32 type, u32 err, u32 seqno, u32 ack)
{ struct sk_buff *buf; struct tipc_msg *msg; buf = buf_acquire(LONG_H_SIZE); if (buf) { msg = buf_msg(buf); msg_init(msg, usr, type, LONG_H_SIZE, destnode); msg_set_errcode(msg, err); msg_set_destport(msg, destport); msg_set_origport(msg, origport); msg_set_orignode(msg, orignode); msg_set_transp_seqno(msg, seqno); msg_set_msgcnt(msg, ack); msg_dbg(msg, "PORT>SEND>:"); } return buf; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF2_TIM4; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); } else if(htim_base->Instance==TIM12) { __HAL_RCC_TIM12_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The ->payload, ->tot_len and ->len fields are adjusted. */
u8_t pbuf_header(struct pbuf *p, s16_t header_size_increment)
/* The ->payload, ->tot_len and ->len fields are adjusted. */ u8_t pbuf_header(struct pbuf *p, s16_t header_size_increment)
{ return pbuf_header_impl(p, header_size_increment, 0); }
ua1arn/hftrx
C++
null
69
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_reload_config_finish(_GFreedesktopDBus *proxy, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_reload_config_finish(_GFreedesktopDBus *proxy, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns: the index of the element containing the data, or -1 if the data is not found */
gint g_list_index(GList *list, gconstpointer data)
/* Returns: the index of the element containing the data, or -1 if the data is not found */ gint g_list_index(GList *list, gconstpointer data)
{ gint i; i = 0; while (list) { if (list->data == data) return i; i++; list = list->next; } return -1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* I2C 2 interrupt handler. This function is the I2C interrupt handler, it simple execute the callback function if there be one. */
void I2C2IntHandler(void)
/* I2C 2 interrupt handler. This function is the I2C interrupt handler, it simple execute the callback function if there be one. */ void I2C2IntHandler(void)
{ if(g_pfnI2CHandlerCallbacks[2] != 0) { g_pfnI2CHandlerCallbacks[2](0, 0, 0, 0); } else { while(1); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* GetChannelFromRelId - Get the channel object given its child relative id (ie channel id) */
struct vmbus_channel* GetChannelFromRelId(u32 relId)
/* GetChannelFromRelId - Get the channel object given its child relative id (ie channel id) */ struct vmbus_channel* GetChannelFromRelId(u32 relId)
{ struct vmbus_channel *channel; struct vmbus_channel *foundChannel = NULL; unsigned long flags; spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { if (channel->OfferMsg.ChildRelId == relId) { foundChannel = channel; break; } } spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); return foundChannel; }
robutest/uclinux
C++
GPL-2.0
60
/* Search function for integers. If integer is inside 'alimit', get it directly from the array part. Otherwise, if 'alimit' is not equal to the real size of the array, key still can be in the array part. In this case, try to avoid a call to 'luaH_realasize' when key is just one more than the limit (so that it can be incremented without changing the real size of the array). */
const TValue* luaH_getint(Table *t, lua_Integer key)
/* Search function for integers. If integer is inside 'alimit', get it directly from the array part. Otherwise, if 'alimit' is not equal to the real size of the array, key still can be in the array part. In this case, try to avoid a call to 'luaH_realasize' when key is just one more than the limit (so that it can be incremented without changing the real size of the array). */ const TValue* luaH_getint(Table *t, lua_Integer key)
{ t->alimit = cast_uint(key); return &t->array[key - 1]; } else { Node *n = hashint(t, key); for (;;) { if (keyisinteger(n) && keyival(n) == key) return gval(n); else { int nx = gnext(n); if (nx == 0) break; n += nx; } } return &absentkey; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Sends a control line command on the port. */
static bool uhi_cdc_set_ctrl_line(uint8_t port, le16_t wValue)
/* Sends a control line command on the port. */ static bool uhi_cdc_set_ctrl_line(uint8_t port, le16_t wValue)
{ uhi_cdc_port_t *ptr_port; usb_setup_req_t req; ptr_port = uhi_cdc_get_port(port); if (ptr_port == NULL) { return false; } req.bmRequestType = USB_REQ_RECIP_INTERFACE | USB_REQ_TYPE_CLASS | USB_REQ_DIR_OUT; req.bRequest = USB_REQ_CDC_SET_CONTROL_LINE_STATE; req.wValue = wValue; req.wIndex = ptr_port->iface_comm; req.wLength = 0; if (!uhd_setup_request(uhi_cdc_dev.dev->address, &req, NULL, 0, NULL, NULL)) { return false; } return true; }
remotemcu/remcu-chip-sdks
C++
null
436
/* The constructor function pre-allocates space for runtime cryptographic operation. */
EFI_STATUS EFIAPI RuntimeCryptLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function pre-allocates space for runtime cryptographic operation. */ EFI_STATUS EFIAPI RuntimeCryptLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; VOID *Buffer; Buffer = AllocateRuntimePool (MIN_REQUIRED_BLOCKS * 1024); Status = InitializeScratchMemory (Buffer, MIN_REQUIRED_BLOCKS * 1024); if (EFI_ERROR (Status)) { return Status; } Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RuntimeCryptLibAddressChangeEvent, NULL, &gEfiEventVirtualAddressChangeGuid, &mVirtualAddressChangeEvent ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* HRPWM function enable or disable for specified channel. */
void HRPWM_ChCmd(uint32_t u32Ch, en_functional_state_t enNewState)
/* HRPWM function enable or disable for specified channel. */ void HRPWM_ChCmd(uint32_t u32Ch, en_functional_state_t enNewState)
{ __IO uint32_t *CRx; DDL_ASSERT(IS_VALID_HRPWM_CH(u32Ch)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); CRx = (__IO uint32_t *)(((uint32_t)&CM_HRPWM->CR1) + 4UL * (u32Ch - 1UL)); if (ENABLE == enNewState) { SET_REG32_BIT(*CRx, HRPWM_CR_EN); } else { CLR_REG32_BIT(*CRx, HRPWM_CR_EN); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI SimpleNetworkComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI SimpleNetworkComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mSimpleNetworkDriverNameTable, DriverName, (BOOLEAN)(This == &gSimpleNetworkComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* We always take the 'filp->f_lock', in since fasync_lock needs to be irq-safe. */
static int fasync_remove_entry(struct file *filp, struct fasync_struct **fapp)
/* We always take the 'filp->f_lock', in since fasync_lock needs to be irq-safe. */ static int fasync_remove_entry(struct file *filp, struct fasync_struct **fapp)
{ struct fasync_struct *fa, **fp; int result = 0; spin_lock(&filp->f_lock); write_lock_irq(&fasync_lock); for (fp = fapp; (fa = *fp) != NULL; fp = &fa->fa_next) { if (fa->fa_file != filp) continue; *fp = fa->fa_next; kmem_cache_free(fasync_cache, fa); filp->f_flags &= ~FASYNC; result = 1; break; } write_unlock_irq(&fasync_lock); spin_unlock(&filp->f_lock); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* BSD-style ARCNET headers - they don't have the offset field from the ARCNET hardware packet, but we might get an exception frame header. */
static int dissect_arcnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* BSD-style ARCNET headers - they don't have the offset field from the ARCNET hardware packet, but we might get an exception frame header. */ static int dissect_arcnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ dissect_arcnet_common (tvb, pinfo, tree, FALSE, TRUE); return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Deinitializes the ADCx peripheral registers to their default reset values. */
void ADC_DeInit(ADC_TypeDef *ADCx)
/* Deinitializes the ADCx peripheral registers to their default reset values. */ void ADC_DeInit(ADC_TypeDef *ADCx)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, DISABLE); }
avem-labs/Avem
C++
MIT License
1,752
/* Wrapper to call a standard Wireless Extension handler. We do various checks and also take care of moving data between user space and kernel space. */
static int ioctl_standard_call(struct net_device *dev, struct iwreq *iwr, unsigned int cmd, struct iw_request_info *info, iw_handler handler)
/* Wrapper to call a standard Wireless Extension handler. We do various checks and also take care of moving data between user space and kernel space. */ static int ioctl_standard_call(struct net_device *dev, struct iwreq *iwr, unsigned int cmd, struct iw_request_info *info, iw_handler handler)
{ const struct iw_ioctl_description * descr; int ret = -EINVAL; if ((cmd - SIOCIWFIRST) >= standard_ioctl_num) return -EOPNOTSUPP; descr = &(standard_ioctl[cmd - SIOCIWFIRST]); if (descr->header_type != IW_HEADER_TYPE_POINT) { ret = handler(dev, info, &(iwr->u), NULL); if ((descr->flags & IW_DESCR_FLAG_EVENT) && ((ret == 0) || (ret == -EIWCOMMIT))) wireless_send_event(dev, cmd, &(iwr->u), NULL); } else { ret = ioctl_standard_iw_point(&iwr->u.data, cmd, descr, handler, dev, info); } if (ret == -EIWCOMMIT) ret = call_commit_handler(dev); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check to see if an SMM register is supported by a specified CPU. */
BOOLEAN EFIAPI SmmCpuFeaturesIsSmmRegisterSupported(IN UINTN CpuIndex, IN SMM_REG_NAME RegName)
/* Check to see if an SMM register is supported by a specified CPU. */ BOOLEAN EFIAPI SmmCpuFeaturesIsSmmRegisterSupported(IN UINTN CpuIndex, IN SMM_REG_NAME RegName)
{ if (FeaturePcdGet (PcdSmmFeatureControlEnable) && (RegName == SmmRegFeatureControl)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Determines if the specified EKU represented in ASN1 form is present in a given certificate. */
EFI_STATUS IsEkuInCertificate(IN CONST VOID *Cert, IN VOID *Asn1ToFind)
/* Determines if the specified EKU represented in ASN1 form is present in a given certificate. */ EFI_STATUS IsEkuInCertificate(IN CONST VOID *Cert, IN VOID *Asn1ToFind)
{ ASSERT (FALSE); return EFI_NOT_READY; }
tianocore/edk2
C++
Other
4,240
/* Lock a read-write lock object for writing. See IEEE 1003.1 */
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
/* Lock a read-write lock object for writing. See IEEE 1003.1 */ int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
{ struct posix_rwlock *rwl; rwl = get_posix_rwlock(*rwlock); if (rwl == NULL) { return EINVAL; } return write_lock_acquire(rwl, SYS_FOREVER_MS); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns true if s is the last free block in its page. */
static int slob_last(slob_t *s)
/* Returns true if s is the last free block in its page. */ static int slob_last(slob_t *s)
{ return !((unsigned long)slob_next(s) & ~PAGE_MASK); }
robutest/uclinux
C++
GPL-2.0
60
/* Hardware initialisation to generate the RTOS tick. This uses timer 0 but could alternatively use the watchdog timer or timer 1. */
static void prvSetupTimerInterrupt(void)
/* Hardware initialisation to generate the RTOS tick. This uses timer 0 but could alternatively use the watchdog timer or timer 1. */ static void prvSetupTimerInterrupt(void)
{ TACTL = 0; TACTL = TASSEL_1; TACTL |= TACLR; TACCR0 = portACLK_FREQUENCY_HZ / configTICK_RATE_HZ; TACCTL0 = CCIE; TACTL |= TACLR; TACTL |= MC_1; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations. */
UINTN EFIAPI CryptoServiceSha384GetContextSize(VOID)
/* Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations. */ UINTN EFIAPI CryptoServiceSha384GetContextSize(VOID)
{ return CALL_BASECRYPTLIB (Sha384.Services.GetContextSize, Sha384GetContextSize, (), 0); }
tianocore/edk2
C++
Other
4,240
/* Return the number of bytes of space available in the circular buffer. */
static int ti_buf_space_avail(struct circ_buf *cb)
/* Return the number of bytes of space available in the circular buffer. */ static int ti_buf_space_avail(struct circ_buf *cb)
{ return CIRC_SPACE(cb->head, cb->tail, TI_WRITE_BUF_SIZE); }
robutest/uclinux
C++
GPL-2.0
60
/* This internal API fills the temperature oversampling settings provided by the user in the data buffer so as to write in the sensor. */
static void fill_osr_temp_settings(uint8_t *reg_data, const struct bme280_settings *settings)
/* This internal API fills the temperature oversampling settings provided by the user in the data buffer so as to write in the sensor. */ static void fill_osr_temp_settings(uint8_t *reg_data, const struct bme280_settings *settings)
{ *reg_data = BME280_SET_BITS(*reg_data, BME280_CTRL_TEMP, settings->osr_t); }
eclipse-threadx/getting-started
C++
Other
310
/* Do the work for 'lua_resume' in protected mode. Most of the work depends on the status of the coroutine: initial state, suspended inside a hook, or regularly suspended (optionally with a continuation function), plus erroneous cases: non-suspended coroutine or dead coroutine. */
static void resume(lua_State *L, void *ud)
/* Do the work for 'lua_resume' in protected mode. Most of the work depends on the status of the coroutine: initial state, suspended inside a hook, or regularly suspended (optionally with a continuation function), plus erroneous cases: non-suspended coroutine or dead coroutine. */ static void resume(lua_State *L, void *ud)
{ if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) luaV_execute(L); } else { lua_assert(L->status == LUA_YIELD); L->status = LUA_OK; ci->func = restorestack(L, ci->extra); if (isLua(ci)) luaV_execute(L); else { if (ci->u.c.k != NULL) { lua_unlock(L); n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); lua_lock(L); api_checknelems(L, n); firstArg = L->top - n; } luaD_poscall(L, ci, firstArg, n); } unroll(L, NULL); } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Returns: (transfer full): a #GSocketAddress (owned by the caller), or NULL on error (in which case *@error will be set) or if there are no more addresses. */
GSocketAddress* g_socket_address_enumerator_next(GSocketAddressEnumerator *enumerator, GCancellable *cancellable, GError **error)
/* Returns: (transfer full): a #GSocketAddress (owned by the caller), or NULL on error (in which case *@error will be set) or if there are no more addresses. */ GSocketAddress* g_socket_address_enumerator_next(GSocketAddressEnumerator *enumerator, GCancellable *cancellable, GError **error)
{ GSocketAddressEnumeratorClass *klass; g_return_val_if_fail (G_IS_SOCKET_ADDRESS_ENUMERATOR (enumerator), NULL); klass = G_SOCKET_ADDRESS_ENUMERATOR_GET_CLASS (enumerator); return (* klass->next) (enumerator, cancellable, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clears the output device(s) display to the currently selected background color. */
EFI_STATUS EFIAPI ConSplitterTextOutClearScreen(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This)
/* Clears the output device(s) display to the currently selected background color. */ EFI_STATUS EFIAPI ConSplitterTextOutClearScreen(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This)
{ EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; UINTN Index; EFI_STATUS ReturnStatus; Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { Status = Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut); if (EFI_ERROR (Status)) { ReturnStatus = Status; } } Private->TextOutMode.CursorColumn = 0; Private->TextOutMode.CursorRow = 0; Private->TextOutMode.CursorVisible = TRUE; return ReturnStatus; }
tianocore/edk2
C++
Other
4,240
/* USBD_CDC_ECM_USRStringDescriptor Manages the transfer of user string descriptors. */
uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length)
/* USBD_CDC_ECM_USRStringDescriptor Manages the transfer of user string descriptors. */ uint8_t USBD_CDC_ECM_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length)
{ USBD_CDC_ECM_HandleTypeDef *hcdc = (USBD_CDC_ECM_HandleTypeDef *)pdev->pClassData; if (hcdc == NULL) { return (uint8_t)USBD_FAIL; } hcdc->TxBuffer = pbuff; hcdc->TxLength = length; return (uint8_t)USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Performs an atomic compare exchange operation on the 32-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. */
UINT32 EFIAPI InternalSyncCompareExchange32(IN volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
/* Performs an atomic compare exchange operation on the 32-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. */ UINT32 EFIAPI InternalSyncCompareExchange32(IN volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
{ UINT32 RetValue; RetValue = AsmInternalSyncCompareExchange32 ( Value, CompareValue, ExchangeValue ); return RetValue; }
tianocore/edk2
C++
Other
4,240
/* Select GPIO pins to be used by this peripheral. This needs to be configured while UART peripheral is disabled. */
void uart_set_pins(uint32_t uart, uint32_t rx, uint32_t tx, uint32_t cts, uint32_t rts)
/* Select GPIO pins to be used by this peripheral. This needs to be configured while UART peripheral is disabled. */ void uart_set_pins(uint32_t uart, uint32_t rx, uint32_t tx, uint32_t cts, uint32_t rts)
{ if (rx != GPIO_UNCONNECTED) { UART_PSELRXD(uart) = __GPIO2PIN(rx); } else { UART_PSELRXD(uart) = rx; } if (tx != GPIO_UNCONNECTED) { UART_PSELTXD(uart) = __GPIO2PIN(tx); } else { UART_PSELTXD(uart) = tx; } if (cts != GPIO_UNCONNECTED) { UART_PSELCTS(uart) = __GPIO2PIN(cts); } else { UART_PSELCTS(uart) = cts; } if (rts != GPIO_UNCONNECTED) { UART_PSELRTS(uart) = __GPIO2PIN(rts); } else { UART_PSELRTS(uart) = rts; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931