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
/* Get the current position and state of the touchpad */
bool FT81x_read(lv_indev_drv_t *drv, lv_indev_data_t *data)
/* Get the current position and state of the touchpad */ bool FT81x_read(lv_indev_drv_t *drv, lv_indev_data_t *data)
{ static int16_t last_x = 0; static int16_t last_y = 0; bool touched = true; uint32_t XY = EVE_memRead32(REG_TOUCH_SCREEN_XY); uint16_t Y = XY & 0xffff; uint16_t X = XY >> 16; if(X == 0x8000 || Y == 0x8000 || X > LV_HOR_RES_MAX || Y > LV_VER_RES_MAX) { touched = false; X = last_x; Y = last_y; } else { last_x = X; last_y = Y; } data->point.x = X; data->point.y = Y; data->state = (touched == false ? LV_INDEV_STATE_REL : LV_INDEV_STATE_PR); return false; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Access to hardware control lines: ALE, CLE, secondary chipselect. */
static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
/* Access to hardware control lines: ALE, CLE, secondary chipselect. */ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ struct davinci_nand_info *info = to_davinci_nand(mtd); uint32_t addr = info->current_cs; struct nand_chip *nand = mtd->priv; if (ctrl & NAND_CTRL_CHANGE) { if ((ctrl & NAND_CTRL_CLE) == NAND_CTRL_CLE) addr |= info->mask_cle; else if ((ctrl & NAND_CTRL_ALE) == NAND_CTRL_ALE) addr |= info->mask_ale; nand->IO_ADDR_W = (void __iomem __force *)addr; } if (cmd != NAND_CMD_NONE) iowrite8(cmd, nand->IO_ADDR_W); }
robutest/uclinux
C++
GPL-2.0
60
/* i5400_clear_error Retrieve any error from the hardware but do NOT process that error. Used for 'clearing' out of previous errors Called by the Core module. */
static void i5400_clear_error(struct mem_ctl_info *mci)
/* i5400_clear_error Retrieve any error from the hardware but do NOT process that error. Used for 'clearing' out of previous errors Called by the Core module. */ static void i5400_clear_error(struct mem_ctl_info *mci)
{ struct i5400_error_info info; i5400_get_error_info(mci, &info); }
robutest/uclinux
C++
GPL-2.0
60
/* Restart the card from scratch, as if from a cold-boot. Implementation resembles the first-half of the e1000_resume routine. */
static pci_ers_result_t atl1c_io_slot_reset(struct pci_dev *pdev)
/* Restart the card from scratch, as if from a cold-boot. Implementation resembles the first-half of the e1000_resume routine. */ static pci_ers_result_t atl1c_io_slot_reset(struct pci_dev *pdev)
{ struct net_device *netdev = pci_get_drvdata(pdev); struct atl1c_adapter *adapter = netdev_priv(netdev); if (pci_enable_device(pdev)) { if (netif_msg_hw(adapter)) dev_err(&pdev->dev, "Cannot re-enable PCI device after reset\n"); return PCI_ERS_RESULT_DISCONNECT; } pci_set_master(pdev); pci_enable_wake(pdev, PCI_D3hot, 0); pci_enable_wake(pdev, PCI_D3cold, 0); atl1c_reset_mac(&adapter->hw); return PCI_ERS_RESULT_RECOVERED; }
robutest/uclinux
C++
GPL-2.0
60
/* Fills each SDIO_DataInitStruct member with its default value. */
void SDIO_InitDataStruct(SDIO_DataInitType *SDIO_DataInitStruct)
/* Fills each SDIO_DataInitStruct member with its default value. */ void SDIO_InitDataStruct(SDIO_DataInitType *SDIO_DataInitStruct)
{ SDIO_DataInitStruct->DatTimeout = 0xFFFFFFFF; SDIO_DataInitStruct->DatLen = 0x00; SDIO_DataInitStruct->DatBlkSize = SDIO_DATBLK_SIZE_1B; SDIO_DataInitStruct->TransferDirection = SDIO_TRANSDIR_TOCARD; SDIO_DataInitStruct->TransferMode = SDIO_TRANSMODE_BLOCK; SDIO_DataInitStruct->DPSMConfig = SDIO_DPSM_DISABLE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Adds a Microsoft OS extended property to this vendor class instance Abort read bulk transfer. */
sl_status_t sl_usbd_vendor_abort_read_bulk(uint8_t class_nbr)
/* Adds a Microsoft OS extended property to this vendor class instance Abort read bulk transfer. */ sl_status_t sl_usbd_vendor_abort_read_bulk(uint8_t class_nbr)
{ sli_usbd_vendor_ctrl_t *p_ctrl; bool conn; sl_status_t status; sl_usbd_vendor_is_enabled(class_nbr, &conn); if (conn != true) { return SL_STATUS_INVALID_STATE; } p_ctrl = &usbd_vendor.ctrl_table[class_nbr]; status = sl_usbd_core_abort_endpoint(p_ctrl->comm_ptr->data_bulk_out_endpoint_address); if (status != SL_STATUS_OK) { return status; } return SL_STATUS_OK; }
nanoframework/nf-interpreter
C++
MIT License
293
/* If the type of record given in the pseudo header indicate the presence of an extension header then, read all the extension headers */
static gboolean pcap_read_erf_exheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info, guint *psize)
/* If the type of record given in the pseudo header indicate the presence of an extension header then, read all the extension headers */ static gboolean pcap_read_erf_exheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info, guint *psize)
{ guint8 erf_exhdr[8]; guint64 erf_exhdr_sw; int i = 0, max = sizeof(pseudo_header->erf.ehdr_list)/sizeof(struct erf_ehdr); guint8 type; *psize = 0; if (pseudo_header->erf.phdr.type & 0x80){ do{ if (!wtap_read_bytes(fh, erf_exhdr, 8, err, err_info)) return FALSE; type = erf_exhdr[0]; erf_exhdr_sw = pntoh64(erf_exhdr); if (i < max) memcpy(&pseudo_header->erf.ehdr_list[i].ehdr, &erf_exhdr_sw, sizeof(erf_exhdr_sw)); *psize += 8; i++; } while (type & 0x80); } return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* set the percentage of blocks at which to stop culling */
static int cachefiles_daemon_brun(struct cachefiles_cache *, char *)
/* set the percentage of blocks at which to stop culling */ static int cachefiles_daemon_brun(struct cachefiles_cache *, char *)
{ unsigned long brun; _enter(",%s", args); if (!*args) return -EINVAL; brun = simple_strtoul(args, &args, 10); if (args[0] != '%' || args[1] != '\0') return -EINVAL; if (brun <= cache->bcull_percent || brun >= 100) return cachefiles_daemon_range_error(cache, args); cache->brun_percent = brun; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Gadget drivers could use this when constructing a config descriptor in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. */
int usb_gadget_config_buf(const struct usb_config_descriptor *config, void *buf, unsigned length, const struct usb_descriptor_header **desc)
/* Gadget drivers could use this when constructing a config descriptor in response to USB_REQ_GET_DESCRIPTOR. They will need to patch the resulting bDescriptorType value if USB_DT_OTHER_SPEED_CONFIG is needed. */ int usb_gadget_config_buf(const struct usb_config_descriptor *config, void *buf, unsigned length, const struct usb_descriptor_header **desc)
{ struct usb_config_descriptor *cp = buf; int len; if (length < USB_DT_CONFIG_SIZE || !desc) return -EINVAL; memcpy(cp, config, sizeof(*cp)); len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf, length - USB_DT_CONFIG_SIZE, desc); if (len < 0) return len; len += USB_DT_CONFIG_SIZE; if (len > 0xffff) return -EINVAL; cp->bLength = USB_DT_CONFIG_SIZE; cp->bDescriptorType = USB_DT_CONFIG; put_unaligned_le16(len, &cp->wTotalLength); cp->bmAttributes |= USB_CONFIG_ATT_ONE; return len; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check if the given NAND Flash model uses the "small blocks/pages". */
uint32_t nand_flash_model_small_block(const struct nand_flash_model *model)
/* Check if the given NAND Flash model uses the "small blocks/pages". */ uint32_t nand_flash_model_small_block(const struct nand_flash_model *model)
{ return (model->page_size_in_bytes <= 512) ? 1 : 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Restarts PHY auto-negotiation and wait until it's over. */
void PHY_auto_negotiate(void)
/* Restarts PHY auto-negotiation and wait until it's over. */ void PHY_auto_negotiate(void)
{ uint16_t reg; reg = MDIO_read( PHYREG_MIIMCR ); MDIO_write( PHYREG_MIIMCR, (uint16_t)( MIIMCR_ENABLE_AUTONEGOTIATION | MIIMCR_RESTART_AUTONEGOTIATION | reg) ); for( ;; ) { reg = MDIO_read( PHYREG_MIIMSR ); if( (reg & MIIMSR_ANC) != 0 ) { break; } else { vTaskDelay( 200 ); } } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). */
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
/* If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). */ INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
{ ASSERT (AsciiStrSize (FirstString)); ASSERT (AsciiStrSize (SecondString)); while ((*FirstString != '\0') && (*FirstString == *SecondString)) { FirstString++; SecondString++; } return *FirstString - *SecondString; }
tianocore/edk2
C++
Other
4,240
/* Dissect a Transit delay selection and indication information element. */
static void dissect_q931_td_selection_and_int_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, int len, proto_tree *tree, proto_item *item)
/* Dissect a Transit delay selection and indication information element. */ static void dissect_q931_td_selection_and_int_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, int len, proto_tree *tree, proto_item *item)
{ if (len == 0) return; dissect_q931_guint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_transit_delay); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get I2C status of the specified I2C port. The */
unsigned long I2CStatusGet(unsigned long ulBase)
/* Get I2C status of the specified I2C port. The */ unsigned long I2CStatusGet(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) || (ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) || (ulBase == I2C4_BASE)); return (xHWREG(ulBase + I2C_STATUS) & I2C_STATUS_M); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* All string identifier should be allocated using this, @usb_string_id() or @usb_string_ids_n() routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. */
int usb_string_ids_n(struct usb_composite_dev *c, unsigned n)
/* All string identifier should be allocated using this, @usb_string_id() or @usb_string_ids_n() routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. */ int usb_string_ids_n(struct usb_composite_dev *c, unsigned n)
{ u8 next = c->next_string_id; if (n > 254 || next + n > 254) return -ENODEV; c->next_string_id += n; return next + 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If PrevNode is not NULL, return the previous node. */
STATIC EFI_STATUS EFIAPI AmlIteratorGetPreviousLinear(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **PrevNode)
/* If PrevNode is not NULL, return the previous node. */ STATIC EFI_STATUS EFIAPI AmlIteratorGetPreviousLinear(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **PrevNode)
{ AML_TREE_ITERATOR_INTERNAL *InternalIterator; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator; if ((InternalIterator == NULL) || (InternalIterator->Mode != EAmlIteratorLinear) || !IS_AML_NODE_VALID (InternalIterator->InitialNode) || !IS_AML_NODE_VALID (InternalIterator->CurrentNode)) { ASSERT (0); return EFI_INVALID_PARAMETER; } InternalIterator->CurrentNode = AmlGetPreviousNode ( InternalIterator->CurrentNode ); if (PrevNode != NULL) { *PrevNode = (AML_NODE_HEADER *)InternalIterator->CurrentNode; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Transmits a character. It silently fails if the TX fifo is not ready after a number of retries. */
static void ug_putc(char ch)
/* Transmits a character. It silently fails if the TX fifo is not ready after a number of retries. */ static void ug_putc(char ch)
{ int count = UG_WRITE_ATTEMPTS; if (!ug_io_base) return; if (ch == '\n') ug_putc('\r'); while (!ug_is_txfifo_ready() && count--) barrier(); if (count >= 0) ug_raw_putc(ch); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* GATT services between start_handle and end_handle were removed */
void btgattc_services_removed_callback(int conn_id, uint16_t start_handle, uint16_t end_handle)
/* GATT services between start_handle and end_handle were removed */ void btgattc_services_removed_callback(int conn_id, uint16_t start_handle, uint16_t end_handle)
{ int index = -1; TLS_BT_APPL_TRACE_VERBOSE("%s, conn_id=%d,start_handle=%d,end_handle=%d\r\n", __FUNCTION__, conn_id,start_handle,end_handle); index = get_app_env_index_by_conn_id(conn_id); if(index<0) { TLS_BT_APPL_TRACE_ERROR("%s, conn_id=%d,start_handle=%d,end_handle=%d\r\n", __FUNCTION__, conn_id,start_handle,end_handle); return; } TLS_HAL_CBACK(app_env[index].ps_callbak, services_removed_cb, conn_id, start_handle, end_handle); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Invalidate all TBs which intersect with the target physical address range [start;end[. NOTE: start and end may refer to */
void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end, int is_cpu_write_access)
/* Invalidate all TBs which intersect with the target physical address range [start;end[. NOTE: start and end may refer to */ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end, int is_cpu_write_access)
{ while (start < end) { tb_invalidate_phys_page_range(start, end, is_cpu_write_access); start &= TARGET_PAGE_MASK; start += TARGET_PAGE_SIZE; } }
ve3wwg/teensy3_qemu
C
Other
15
/* unregister_parisc_driver - Unregister this driver from the list of drivers @driver: the PA-RISC driver to unregister */
int unregister_parisc_driver(struct parisc_driver *driver)
/* unregister_parisc_driver - Unregister this driver from the list of drivers @driver: the PA-RISC driver to unregister */ int unregister_parisc_driver(struct parisc_driver *driver)
{ driver_unregister(&driver->drv); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeEthernetMII(unsigned long ulPort, unsigned char ucPins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeEthernetMII(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read the state of the selected IO pin(s). */
uint32_t stmpe1600_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Read the state of the selected IO pin(s). */ uint32_t stmpe1600_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
{ uint8_t tmpData[2] = {0 , 0}; IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPMR, tmpData, 2); tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8)); return(tmp & IO_Pin); }
eclipse-threadx/getting-started
C++
Other
310
/* Check device number to be within valid range for given device type. */
static int mtd_device_validate(u8 type, u8 num, u64 *size)
/* Check device number to be within valid range for given device type. */ static int mtd_device_validate(u8 type, u8 num, u64 *size)
{ struct mtd_info *mtd = NULL; if (get_mtd_info(type, num, &mtd)) return 1; *size = mtd->size; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reading certain registers when the pipe is disabled can hang the chip. Use this routine to make sure the PLL is running and the pipe is active before reading such registers if unsure. */
static int i915_pipe_enabled(struct drm_device *dev, int pipe)
/* Reading certain registers when the pipe is disabled can hang the chip. Use this routine to make sure the PLL is running and the pipe is active before reading such registers if unsure. */ static int i915_pipe_enabled(struct drm_device *dev, int pipe)
{ drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; unsigned long pipeconf = pipe ? PIPEBCONF : PIPEACONF; if (I915_READ(pipeconf) & PIPEACONF_ENABLE) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the IRTIM device is enabled or not. */
FunctionalState IRTIM_GetStatus(void)
/* Checks whether the IRTIM device is enabled or not. */ FunctionalState IRTIM_GetStatus(void)
{ return ((FunctionalState) (IRTIM->CR & IRTIM_CR_EN)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */
void LedBlinkExit(void)
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */ void LedBlinkExit(void)
{ LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_3); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routine is called whenever a 3215 tty is opened. */
static int tty3215_open(struct tty_struct *tty, struct file *filp)
/* This routine is called whenever a 3215 tty is opened. */ static int tty3215_open(struct tty_struct *tty, struct file *filp)
{ struct raw3215_info *raw; int retval, line; line = tty->index; if ((line < 0) || (line >= NR_3215)) return -ENODEV; raw = raw3215[line]; if (raw == NULL) return -ENODEV; tty->driver_data = raw; raw->tty = tty; tty->low_latency = 0; retval = raw3215_startup(raw); if (retval) return retval; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Create a fragment key for permanent use; it must point to persistent data, so that it can be used to add entries. */
static gpointer fragment_addresses_ports_persistent_key(const packet_info *pinfo, const guint32 id, const void *data _U_)
/* Create a fragment key for permanent use; it must point to persistent data, so that it can be used to add entries. */ static gpointer fragment_addresses_ports_persistent_key(const packet_info *pinfo, const guint32 id, const void *data _U_)
{ fragment_addresses_ports_key *key = g_slice_new(fragment_addresses_ports_key); copy_address(&key->src_addr, &pinfo->src); copy_address(&key->dst_addr, &pinfo->dst); key->src_port = pinfo->srcport; key->dst_port = pinfo->destport; key->id = id; return (gpointer)key; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ADC Differential mode. This function configures the ADC as differential mode and converts the differential voltage applied on positive input and negative input. Prints the differential voltage on serial console and disable the ADC. */
void adc_differential(void)
/* ADC Differential mode. This function configures the ADC as differential mode and converts the differential voltage applied on positive input and negative input. Prints the differential voltage on serial console and disable the ADC. */ void adc_differential(void)
{ int16_t raw_result_signed; configure_adc_differential(); raw_result = adc_start_read_result(); raw_result_signed = (int16_t)raw_result; result = ((float)raw_result_signed * (float)ADC_REFERENCE_INTVCC1_VALUE)/(float)ADC_11BIT_FULL_SCALE_VALUE; printf("\nDifferential Voltage on ADC Input = %fV", result); adc_disable(&adc_instance); }
memfault/zero-to-main
C++
null
200
/* This function tries to read BufferSize bytes data from the specified TLS connection into the Buffer. */
INTN EFIAPI TlsRead(IN VOID *Tls, IN OUT VOID *Buffer, IN UINTN BufferSize)
/* This function tries to read BufferSize bytes data from the specified TLS connection into the Buffer. */ INTN EFIAPI TlsRead(IN VOID *Tls, IN OUT VOID *Buffer, IN UINTN BufferSize)
{ TLS_CONNECTION *TlsConn; TlsConn = (TLS_CONNECTION *)Tls; if ((TlsConn == NULL) || (TlsConn->Ssl == NULL)) { return -1; } return SSL_read (TlsConn->Ssl, Buffer, (UINT32)BufferSize); }
tianocore/edk2
C++
Other
4,240
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3MmioBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI S3MmioBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
{ return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldAnd32 (Address, StartBit, EndBit, AndData)); }
tianocore/edk2
C++
Other
4,240
/* Initialize the state structure for the DIMM temp control loop */
static int init_dimms_state(struct dimm_pid_state *state)
/* Initialize the state structure for the DIMM temp control loop */ static int init_dimms_state(struct dimm_pid_state *state)
{ state->ticks = 1; state->first = 1; state->output = 4000; state->monitor = attach_i2c_chip(XSERVE_DIMMS_LM87, "dimms_temp"); if (state->monitor == NULL) return -ENODEV; if (device_create_file(&of_dev->dev, &dev_attr_dimms_temperature)) printk(KERN_WARNING "Failed to create attribute file" " for DIMM temperature\n"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param handle The RTOS LPUART handle. param rx_timeout_constant_ms RX timeout applied per receive. param rx_timeout_multiplier_ms RX timeout added for each byte of the receive. */
int LPUART_RTOS_SetRxTimeout(lpuart_rtos_handle_t *handle, uint32_t rx_timeout_constant_ms, uint32_t rx_timeout_multiplier_ms)
/* param handle The RTOS LPUART handle. param rx_timeout_constant_ms RX timeout applied per receive. param rx_timeout_multiplier_ms RX timeout added for each byte of the receive. */ int LPUART_RTOS_SetRxTimeout(lpuart_rtos_handle_t *handle, uint32_t rx_timeout_constant_ms, uint32_t rx_timeout_multiplier_ms)
{ if (NULL == handle) { return kStatus_InvalidArgument; } handle->rx_timeout_constant_ms = rx_timeout_constant_ms; handle->rx_timeout_multiplier_ms = rx_timeout_multiplier_ms; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the SDL_Joystick associated with a player index. */
SDL_Joystick* SDL_JoystickFromPlayerIndex(int player_index)
/* Return the SDL_Joystick associated with a player index. */ SDL_Joystick* SDL_JoystickFromPlayerIndex(int player_index)
{ SDL_JoystickID instance_id; SDL_Joystick *joystick; SDL_LockJoysticks(); instance_id = SDL_GetJoystickIDForPlayerIndex(player_index); for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->instance_id == instance_id) { break; } } SDL_UnlockJoysticks(); return joystick; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Configures the Digital noise filter of I2C peripheral. */
void I2C_DigitalFilterConfig(I2C_TypeDef *I2Cx, uint16_t I2C_DigitalFilter)
/* Configures the Digital noise filter of I2C peripheral. */ void I2C_DigitalFilterConfig(I2C_TypeDef *I2Cx, uint16_t I2C_DigitalFilter)
{ uint16_t tmpreg = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_DIGITAL_FILTER(I2C_DigitalFilter)); tmpreg = I2Cx->FLTR; tmpreg &= (uint16_t)~((uint16_t)I2C_FLTR_DNF); tmpreg |= (uint16_t)((uint16_t)I2C_DigitalFilter & I2C_FLTR_DNF); I2Cx->FLTR = tmpreg; }
MaJerle/stm32f429
C++
null
2,036
/* early_platform_left @epdrv: early platform driver structure @id: return true if id or above exists */
static __init int early_platform_left(struct early_platform_driver *epdrv, int id)
/* early_platform_left @epdrv: early platform driver structure @id: return true if id or above exists */ static __init int early_platform_left(struct early_platform_driver *epdrv, int id)
{ struct platform_device *pd; list_for_each_entry(pd, &early_platform_device_list, dev.devres_head) if (platform_match(&pd->dev, &epdrv->pdrv->driver)) if (pd->id >= id) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* We can't use the cfb generic routines, as we have to limit ourselves to 16-bit or 8-bit loads and stores to this 16-bit chip. */
static void epson1355fb_fb_writel(unsigned long v, unsigned long *a)
/* We can't use the cfb generic routines, as we have to limit ourselves to 16-bit or 8-bit loads and stores to this 16-bit chip. */ static void epson1355fb_fb_writel(unsigned long v, unsigned long *a)
{ u16 *p = (u16 *) a; u16 l = v & 0xffff; u16 h = v >> 16; fb_writew(l, p); fb_writew(h, p + 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Use SystemTable Conout to turn on video based Simple Text Out consoles. The Simple Text Out screens will now be synced up with all non video output devices */
EFI_STATUS EFIAPI BootLogoDisableLogo(VOID)
/* Use SystemTable Conout to turn on video based Simple Text Out consoles. The Simple Text Out screens will now be synced up with all non video output devices */ EFI_STATUS EFIAPI BootLogoDisableLogo(VOID)
{ gST->ConOut->EnableCursor (gST->ConOut, TRUE); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* StorVscOnCleanup - Perform any cleanup when the driver is removed */
static void StorVscOnCleanup(struct hv_driver *Driver)
/* StorVscOnCleanup - Perform any cleanup when the driver is removed */ static void StorVscOnCleanup(struct hv_driver *Driver)
{ DPRINT_ENTER(STORVSC); DPRINT_EXIT(STORVSC); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (transfer full): a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed. */
GFile* g_mount_get_root(GMount *mount)
/* Returns: (transfer full): a #GFile. The returned object should be unreffed with g_object_unref() when no longer needed. */ GFile* g_mount_get_root(GMount *mount)
{ GMountIface *iface; g_return_val_if_fail (G_IS_MOUNT (mount), NULL); iface = G_MOUNT_GET_IFACE (mount); return (* iface->get_root) (mount); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clear the SPI interrupt flag of the specified SPI port. */
void SPIIntFlagClear(unsigned long ulBase, unsigned long ulIntFlags)
/* Clear the SPI interrupt flag of the specified SPI port. */ void SPIIntFlagClear(unsigned long ulBase, unsigned long ulIntFlags)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); xHWREG(ulBase + SPI_STATUS) |= ulIntFlags; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function get the next bus range of given address space descriptors. It also moves the pointer backward a node, to get prepared to be called again. */
EFI_STATUS PciGetNextBusRange(IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, OUT UINT16 *MinBus, OUT UINT16 *MaxBus, OUT BOOLEAN *IsEnd)
/* This function get the next bus range of given address space descriptors. It also moves the pointer backward a node, to get prepared to be called again. */ EFI_STATUS PciGetNextBusRange(IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, OUT UINT16 *MinBus, OUT UINT16 *MaxBus, OUT BOOLEAN *IsEnd)
{ *IsEnd = FALSE; if ((*Descriptors) == NULL) { *MinBus = 0; *MaxBus = PCI_MAX_BUS; return EFI_SUCCESS; } while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) { if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) { *MinBus = (UINT16)(*Descriptors)->AddrRangeMin; *MaxBus = (UINT16)(*Descriptors)->AddrRangeMax; (*Descriptors)++; return (EFI_SUCCESS); } (*Descriptors)++; } if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) { *IsEnd = TRUE; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Locking Note: The lport lock is expected to be held before calling this function. */
static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport)
/* Locking Note: The lport lock is expected to be held before calling this function. */ static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport)
{ FC_LPORT_DBG(lport, "Received RLIR request while in state %s\n", fc_lport_state(lport)); lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); fc_frame_free(fp); }
robutest/uclinux
C++
GPL-2.0
60
/* get_urb_status_from_qtd - get the completed urb status from qTD status @urb: completed urb @status: qTD status */
static int get_urb_status_from_qtd(struct urb *urb, u32 status)
/* get_urb_status_from_qtd - get the completed urb status from qTD status @urb: completed urb @status: qTD status */ static int get_urb_status_from_qtd(struct urb *urb, u32 status)
{ if (status & QTD_STS_HALTED) { if (status & QTD_STS_DBE) return usb_pipein(urb->pipe) ? -ENOSR : -ECOMM; else if (status & QTD_STS_BABBLE) return -EOVERFLOW; else if (status & QTD_STS_RCE) return -ETIME; return -EPIPE; } if (usb_pipein(urb->pipe) && (urb->transfer_flags & URB_SHORT_NOT_OK) && urb->actual_length < urb->transfer_buffer_length) return -EREMOTEIO; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Poll the SATA phy and see whether it has come back from the dead yet. */
static int sil_sata_reset_poll(ide_drive_t *drive)
/* Poll the SATA phy and see whether it has come back from the dead yet. */ static int sil_sata_reset_poll(ide_drive_t *drive)
{ ide_hwif_t *hwif = drive->hwif; void __iomem *sata_status_addr = (void __iomem *)hwif->sata_scr[SATA_STATUS_OFFSET]; if (sata_status_addr) { u32 sata_stat = readl(sata_status_addr); if ((sata_stat & 0x03) != 0x03) { printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n", hwif->name, sata_stat); return -ENXIO; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* ecryptfs_to_hex @dst: Buffer to take hex character representation of contents of src; must be at least of size (src_size * 2) @src: Buffer to be converted to a hex string respresentation @src_size: number of bytes to convert */
void ecryptfs_to_hex(char *dst, char *src, size_t src_size)
/* ecryptfs_to_hex @dst: Buffer to take hex character representation of contents of src; must be at least of size (src_size * 2) @src: Buffer to be converted to a hex string respresentation @src_size: number of bytes to convert */ void ecryptfs_to_hex(char *dst, char *src, size_t src_size)
{ int x; for (x = 0; x < src_size; x++) sprintf(&dst[x * 2], "%.2x", (unsigned char)src[x]); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the output level (high or low) of the selected comparator. */
uint32_t COMP_GetOutputLevel(uint32_t COMP_Selection)
/* Return the output level (high or low) of the selected comparator. */ uint32_t COMP_GetOutputLevel(uint32_t COMP_Selection)
{ uint32_t compout = 0x0; assert_param(IS_COMP_ALL_PERIPH(COMP_Selection)); if ((COMP->CSR & (COMP_CSR_COMP1OUT<<COMP_Selection)) != 0) { compout = COMP_OutputLevel_High; } else { compout = COMP_OutputLevel_Low; } return (uint32_t)(compout); }
ajhc/demo-cortex-m3
C++
null
38
/* Set the specified data holding register value for dual channel DAC. */
void DAC_SetDualChannelData(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
/* Set the specified data holding register value for dual channel DAC. */ void DAC_SetDualChannelData(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
{ uint32_t data = 0, tmp = 0; assert_param(IS_DAC_LIST1_PERIPH(DACx)); assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data1)); assert_param(IS_DAC_DATA(Data2)); if (DAC_Align == DAC_Align_8b_R) { data = ((uint32_t)Data2 << 8) | Data1; } else { data = ((uint32_t)Data2 << 16) | Data1; } tmp = (uint32_t)DACx; tmp += DHR12RD_OFFSET + DAC_Align; *(__IO uint32_t *)tmp = data; }
avem-labs/Avem
C++
MIT License
1,752
/* Perform DAC activation procedure to make it ready to generate a voltage (DAC instance: DAC1). */
void Activate_DAC(void)
/* Perform DAC activation procedure to make it ready to generate a voltage (DAC instance: DAC1). */ void Activate_DAC(void)
{ __IO uint32_t wait_loop_index = 0; LL_DAC_Enable(DAC1, LL_DAC_CHANNEL_1); wait_loop_index = ((LL_DAC_DELAY_STARTUP_VOLTAGE_SETTLING_US * (SystemCoreClock / (100000 * 2))) / 10); while(wait_loop_index != 0) { wait_loop_index--; } LL_DAC_EnableTrigger(DAC1, LL_DAC_CHANNEL_1); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* All interrupts go via intc at some point. */
asmlinkage void do_IRQ(int level, struct pt_regs *regs)
/* All interrupts go via intc at some point. */ asmlinkage void do_IRQ(int level, struct pt_regs *regs)
{ struct irq_desc *desc; struct pt_regs *old_regs; unsigned int irq; unsigned long status_reg; local_irq_disable(); old_regs = set_irq_regs(regs); irq_enter(); irq = intc_readl(&intc0, INTCAUSE0 - 4 * level); desc = irq_desc + irq; desc->handle_irq(irq, desc); status_reg = sysreg_read(SR); status_reg &= ~(SYSREG_BIT(I0M) | SYSREG_BIT(I1M) | SYSREG_BIT(I2M) | SYSREG_BIT(I3M)); sysreg_write(SR, status_reg); irq_exit(); set_irq_regs(old_regs); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: The CIPSO tag hashing function. Returns a 32-bit hash value. */
static u32 cipso_v4_map_cache_hash(const unsigned char *key, u32 key_len)
/* Description: The CIPSO tag hashing function. Returns a 32-bit hash value. */ static u32 cipso_v4_map_cache_hash(const unsigned char *key, u32 key_len)
{ return jhash(key, key_len, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the SDL_GameController associated with an instance id. */
SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
/* Return the SDL_GameController associated with an instance id. */ SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
{ SDL_GameController *gamecontroller; SDL_LockJoysticks(); gamecontroller = SDL_gamecontrollers; while (gamecontroller) { if (gamecontroller->joystick->instance_id == joyid) { SDL_UnlockJoysticks(); return gamecontroller; } gamecontroller = gamecontroller->next; } SDL_UnlockJoysticks(); return NULL; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Reset the SLCD module. Reset the SLCD module. */
void slcd_reset(void)
/* Reset the SLCD module. Reset the SLCD module. */ void slcd_reset(void)
{ slcd_disable(); SLCD->CTRLA.reg |= SLCD_CTRLA_SWRST; while (slcd_is_syncing()) { } }
memfault/zero-to-main
C++
null
200
/* (This works on UP too - do_raw_spin_trylock will never return false in that case) */
int __lockfunc __reacquire_kernel_lock(void)
/* (This works on UP too - do_raw_spin_trylock will never return false in that case) */ int __lockfunc __reacquire_kernel_lock(void)
{ while (!do_raw_spin_trylock(&kernel_flag)) { if (need_resched()) return -EAGAIN; cpu_relax(); } preempt_disable(); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Send data as a master on the IIC bus. This function sends the data using polled I/O and blocks until the data has been sent. It only supports 7 bit addressing and non-repeated start modes of operation. The user is responsible for ensuring the bus is not busy if multiple masters are present on the bus. */
unsigned XIic_Send(u32 BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount)
/* Send data as a master on the IIC bus. This function sends the data using polled I/O and blocks until the data has been sent. It only supports 7 bit addressing and non-repeated start modes of operation. The user is responsible for ensuring the bus is not busy if multiple masters are present on the bus. */ unsigned XIic_Send(u32 BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount)
{ unsigned RemainingByteCount; XIic_mSend7BitAddress (BaseAddress, Address, XIIC_WRITE_OPERATION); XIic_mClearIisr (BaseAddress, XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_ERROR_MASK | XIIC_INTR_ARB_LOST_MASK); XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, XIIC_CR_MSMS_MASK | XIIC_CR_DIR_IS_TX_MASK | XIIC_CR_ENABLE_DEVICE_MASK); XIic_mClearIisr (BaseAddress, XIIC_INTR_BNB_MASK); RemainingByteCount = SendData (BaseAddress, BufferPtr, ByteCount); XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, 0); return ByteCount - RemainingByteCount; }
EmcraftSystems/u-boot
C++
Other
181
/* Initializes the state machine and enters the Disabled state. */
void tc_subsys_init(const struct device *dev)
/* Initializes the state machine and enters the Disabled state. */ void tc_subsys_init(const struct device *dev)
{ struct usbc_port_data *data = dev->data; struct tc_sm_t *tc = data->tc; tc->dev = dev; smf_set_initial(SMF_CTX(tc), &tc_states[TC_DISABLED_STATE]); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Reverse the stack segment from 'from' to 'to' (auxiliary to 'lua_rotate') Note that we move(copy) only the value inside the stack. (We do not move additional fields that may exist.) */
l_sinline void reverse(lua_State *L, StkId from, StkId to)
/* Reverse the stack segment from 'from' to 'to' (auxiliary to 'lua_rotate') Note that we move(copy) only the value inside the stack. (We do not move additional fields that may exist.) */ l_sinline void reverse(lua_State *L, StkId from, StkId to)
{ TValue temp; setobj(L, &temp, s2v(from)); setobjs2s(L, from, to); setobj2s(L, to, &temp); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_statement_get_parent_sheet(CRStatement *a_this, CRStyleSheet **a_sheet)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_get_parent_sheet(CRStatement *a_this, CRStyleSheet **a_sheet)
{ g_return_val_if_fail (a_this && a_sheet, CR_BAD_PARAM_ERROR); *a_sheet = a_this->parent_sheet; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Measure and log an action string, and extend the measurement result into RTMR. */
EFI_STATUS TdMeasureAction(IN UINT32 MrIndex, IN CHAR8 *String)
/* Measure and log an action string, and extend the measurement result into RTMR. */ EFI_STATUS TdMeasureAction(IN UINT32 MrIndex, IN CHAR8 *String)
{ CC_EVENT_HDR CcEvent; CcEvent.MrIndex = MrIndex; CcEvent.EventType = EV_EFI_ACTION; CcEvent.EventSize = (UINT32)AsciiStrLen (String); return TdxDxeHashLogExtendEvent ( 0, (UINT8 *)String, CcEvent.EventSize, &CcEvent, (UINT8 *)String ); }
tianocore/edk2
C++
Other
4,240
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
void MX_GPIO_Init(void)
/* Configure pins as Analog Input Output EVENT_OUT EXTI */ void MX_GPIO_Init(void)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; __HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_5, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_RESET); GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR registers disabled). */
void IWDG_ReloadCounter(void)
/* Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR registers disabled). */ void IWDG_ReloadCounter(void)
{ IWDG->KR = KR_KEY_RELOAD; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Draws an array of consecutive RGB565 pixels (much faster than addressing each pixel individually) */
void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len)
/* Draws an array of consecutive RGB565 pixels (much faster than addressing each pixel individually) */ void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len)
{ uint32_t i = 0; st7783SetCursor(x, y); st7783WriteCmd(0x0022); do { st7783WriteData(data[i]); i++; } while (i<len); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Used to get rid of pages on hardware memory corruption. */
int generic_error_remove_page(struct address_space *mapping, struct page *page)
/* Used to get rid of pages on hardware memory corruption. */ int generic_error_remove_page(struct address_space *mapping, struct page *page)
{ if (!mapping) return -EINVAL; if (!S_ISREG(mapping->host->i_mode)) return -EIO; return truncate_inode_page(mapping, page); }
robutest/uclinux
C++
GPL-2.0
60
/* The IO vectors must have the same structure (same length of all parts). A typical usage is to compare vectors created with qemu_iovec_clone(). */
ssize_t qemu_iovec_compare(QEMUIOVector *a, QEMUIOVector *b)
/* The IO vectors must have the same structure (same length of all parts). A typical usage is to compare vectors created with qemu_iovec_clone(). */ ssize_t qemu_iovec_compare(QEMUIOVector *a, QEMUIOVector *b)
{ int i; ssize_t offset = 0; assert(a->niov == b->niov); for (i = 0; i < a->niov; i++) { size_t len = 0; uint8_t *p = (uint8_t *)a->iov[i].iov_base; uint8_t *q = (uint8_t *)b->iov[i].iov_base; assert(a->iov[i].iov_len == b->iov[i].iov_len); while (len < a->iov[i].iov_len && *p++ == *q++) { len++; } offset += len; if (len != a->iov[i].iov_len) { return offset; } } return -1; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Set the PWM frequency of the PWM module. This function is to set the PWM frequency of the PWM module. */
unsigned long xPWMFrequencySet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulFrequency)
/* Set the PWM frequency of the PWM module. This function is to set the PWM frequency of the PWM module. */ unsigned long xPWMFrequencySet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulFrequency)
{ unsigned long ulPwmFre = 0; (void) ulChannel; xASSERT(ulBase == xPWM1_BASE); xASSERT( (ulChannel == xPWM_CHANNEL0) || (ulChannel == xPWM_CHANNEL1) || (ulChannel == xPWM_CHANNEL2) || (ulChannel == xPWM_CHANNEL3) || (ulChannel == xPWM_CHANNEL4) || (ulChannel == xPWM_CHANNEL5) || (ulChannel == xPWM_CHANNEL6) ); ulPwmFre = SysCtlPeripheralClockGet(PCLKSEL_PWM1); if(ulPwmFre < ulFrequency) { while(1); } _PWMFrequency = ulFrequency; xHWREG(ulBase + PWM_PR) = ((ulPwmFre/ulFrequency) - 1); return (ulFrequency); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Waits for auto-negotiation to complete or for the auto-negotiation time limit to expire, which ever happens first. */
static s32 igb_wait_autoneg(struct e1000_hw *hw)
/* Waits for auto-negotiation to complete or for the auto-negotiation time limit to expire, which ever happens first. */ static s32 igb_wait_autoneg(struct e1000_hw *hw)
{ s32 ret_val = 0; u16 i, phy_status; for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); if (ret_val) break; ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); if (ret_val) break; if (phy_status & MII_SR_AUTONEG_COMPLETE) break; msleep(100); } return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Locate and return the protocol instance identified by the ProtocolGuid. */
VOID* UefiDevicePathLibLocateProtocol(EFI_GUID *ProtocolGuid)
/* Locate and return the protocol instance identified by the ProtocolGuid. */ VOID* UefiDevicePathLibLocateProtocol(EFI_GUID *ProtocolGuid)
{ EFI_STATUS Status; VOID *Protocol; Status = gBS->LocateProtocol ( ProtocolGuid, NULL, (VOID **)&Protocol ); if (EFI_ERROR (Status)) { return NULL; } else { return Protocol; } }
tianocore/edk2
C++
Other
4,240
/* The callback function called when the packet is transmitted. */
VOID EFIAPI Mtftp6OnPacketSent(IN NET_BUF *Packet, IN UDP_END_POINT *UdpEpt, IN EFI_STATUS IoStatus, IN VOID *Context)
/* The callback function called when the packet is transmitted. */ VOID EFIAPI Mtftp6OnPacketSent(IN NET_BUF *Packet, IN UDP_END_POINT *UdpEpt, IN EFI_STATUS IoStatus, IN VOID *Context)
{ NetbufFree (Packet); *(BOOLEAN *)Context = TRUE; }
tianocore/edk2
C++
Other
4,240
/* Stops the counter at current value. On the next call to hw_counter_start, the counter will start from the value at which it was stopped. */
void hw_counter_stop(void)
/* Stops the counter at current value. On the next call to hw_counter_start, the counter will start from the value at which it was stopped. */ void hw_counter_stop(void)
{ counter_running = false; hw_counter_timer = NEVER; hwm_find_next_timer(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferStopRingBuffer(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(NULL != handle); if (handle->rxState == (uint8_t)kLPUART_RxIdle) { uint32_t irqMask = DisableGlobalIRQ(); base->CTRL &= ~(uint32_t)(LPUART_CTRL_RIE_MASK | LPUART_CTRL_ORIE_MASK); EnableGlobalIRQ(irqMask); } handle->rxRingBuffer = NULL; handle->rxRingBufferSize = 0U; handle->rxRingBufferHead = 0U; handle->rxRingBufferTail = 0U; }
eclipse-threadx/getting-started
C++
Other
310
/* Gets the stylesheet contained by the @import rule statement. Returns CR_OK upon sucessfull completion, an error code otherwise. */
enum CRStatus cr_statement_at_import_rule_get_imported_sheet(CRStatement *a_this, CRStyleSheet **a_sheet)
/* Gets the stylesheet contained by the @import rule statement. Returns CR_OK upon sucessfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_import_rule_get_imported_sheet(CRStatement *a_this, CRStyleSheet **a_sheet)
{ g_return_val_if_fail (a_this && a_this->type == AT_IMPORT_RULE_STMT && a_this->kind.import_rule, CR_BAD_PARAM_ERROR); *a_sheet = a_this->kind.import_rule->sheet; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* check validity of event type and data length. return non-zero if invalid. */
static int check_event_type_and_length(struct snd_seq_event *ev)
/* check validity of event type and data length. return non-zero if invalid. */ static int check_event_type_and_length(struct snd_seq_event *ev)
{ switch (snd_seq_ev_length_type(ev)) { case SNDRV_SEQ_EVENT_LENGTH_FIXED: if (snd_seq_ev_is_variable_type(ev)) return -EINVAL; break; case SNDRV_SEQ_EVENT_LENGTH_VARIABLE: if (! snd_seq_ev_is_variable_type(ev) || (ev->data.ext.len & ~SNDRV_SEQ_EXT_MASK) >= SNDRV_SEQ_MAX_EVENT_LEN) return -EINVAL; break; case SNDRV_SEQ_EVENT_LENGTH_VARUSR: if (! snd_seq_ev_is_direct(ev)) return -EINVAL; break; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Needed because CRCs are transmitted in bit-reversed order compared to the rest of the BTLE packet. See BT spec, Vol 6, Part B, Section 1.2. */
static guint32 reverse_bits_per_byte(const guint32 val)
/* Needed because CRCs are transmitted in bit-reversed order compared to the rest of the BTLE packet. See BT spec, Vol 6, Part B, Section 1.2. */ static guint32 reverse_bits_per_byte(const guint32 val)
{ const guint8 nibble_rev[16] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf }; guint32 retval = 0; unsigned byte_index; for (byte_index=0; byte_index<4; byte_index++) { guint shiftA = byte_index*8; guint shiftB = shiftA+4; retval |= (nibble_rev[((val >> shiftA) & 0xf)] << shiftB); retval |= (nibble_rev[((val >> shiftB) & 0xf)] << shiftA); } return retval; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables the RGB LED power supply line. */
void BOARD_rgbledEnable(bool enable, uint8_t mask)
/* Enables or disables the RGB LED power supply line. */ void BOARD_rgbledEnable(bool enable, uint8_t mask)
{ if( ( ( mask != 0 ) && ( enable == true ) ) || ( ( ( mask & 0xf ) == 0xf ) && ( enable == false ) ) ) { BOARD_rgbledPowerEnable( enable ); rgbledEnable = enable; } mask = (mask << BOARD_PIC_REG_LED_CTRL_LED_SHIFT) & BOARD_PIC_REG_LED_CTRL_LED_MASK; BOARD_picRegBitsSet( BOARD_PIC_REG_LED_CTRL, enable, mask ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the list of Configure Language from platform configuration by the given Schema and Pattern. */
EFI_STATUS RedfishPlatformConfigGetConfigureLang(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING Pattern, OUT EFI_STRING **ConfigureLangList, OUT UINTN *Count)
/* Get the list of Configure Language from platform configuration by the given Schema and Pattern. */ EFI_STATUS RedfishPlatformConfigGetConfigureLang(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING Pattern, OUT EFI_STRING **ConfigureLangList, OUT UINTN *Count)
{ if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) { return EFI_NOT_READY; } return mRedfishPlatformConfigLibPrivate.Protocol->GetConfigureLang ( mRedfishPlatformConfigLibPrivate.Protocol, Schema, Version, Pattern, ConfigureLangList, Count ); }
tianocore/edk2
C++
Other
4,240
/* We don't register the master, or expect the caller to have done so, for reasons of data integrity. */
int add_mtd_partitions(struct mtd_info *master, const struct mtd_partition *parts, int nbparts)
/* We don't register the master, or expect the caller to have done so, for reasons of data integrity. */ int add_mtd_partitions(struct mtd_info *master, const struct mtd_partition *parts, int nbparts)
{ struct mtd_part *slave; uint64_t cur_offset = 0; int i; printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); for (i = 0; i < nbparts; i++) { slave = add_one_partition(master, parts + i, i, cur_offset); if (!slave) return -ENOMEM; cur_offset = slave->offset + slave->mtd.size; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Program a command to do nothing for the given time. */
static int lp5562_program_wait(const struct device *dev, enum lp5562_led_sources engine, uint8_t command_index, uint32_t time)
/* Program a command to do nothing for the given time. */ static int lp5562_program_wait(const struct device *dev, enum lp5562_led_sources engine, uint8_t command_index, uint32_t time)
{ return lp5562_program_ramp(dev, engine, command_index, time, 0, LP5562_FADE_UP); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Associate a message type to a set of cache operations */
struct nl_cache_ops* nl_cache_ops_associate(int protocol, int msgtype)
/* Associate a message type to a set of cache operations */ struct nl_cache_ops* nl_cache_ops_associate(int protocol, int msgtype)
{ int i; struct nl_cache_ops *ops; for (ops = cache_ops; ops; ops = ops->co_next) { if (ops->co_protocol != protocol) continue; for (i = 0; ops->co_msgtypes[i].mt_id >= 0; i++) if (ops->co_msgtypes[i].mt_id == msgtype) return ops; } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get actual encoder mode. @rmtoll CFG CKPOL LPTIM_GetEncoderMode. */
uint32_t LPTIM_GetEncoderMode(LPTIM_Module *LPTIMx)
/* Get actual encoder mode. @rmtoll CFG CKPOL LPTIM_GetEncoderMode. */ uint32_t LPTIM_GetEncoderMode(LPTIM_Module *LPTIMx)
{ return (uint32_t)(READ_BIT(LPTIMx->CFG, LPTIM_CFG_CLKPOL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Future: use high four bits of block for coalesce-on-delete flags Mask them off for now. */
static unsigned dx_get_block(struct dx_entry *entry)
/* Future: use high four bits of block for coalesce-on-delete flags Mask them off for now. */ static unsigned dx_get_block(struct dx_entry *entry)
{ return le32_to_cpu(entry->block) & 0x00ffffff; }
robutest/uclinux
C++
GPL-2.0
60
/* Cancel execution of a thread. See IEEE 1003.1 */
int pthread_cancel(pthread_t pthread)
/* Cancel execution of a thread. See IEEE 1003.1 */ int pthread_cancel(pthread_t pthread)
{ int ret = 0; bool cancel_state = PTHREAD_CANCEL_ENABLE; bool cancel_type = PTHREAD_CANCEL_DEFERRED; struct posix_thread *t = NULL; K_SPINLOCK(&pthread_pool_lock) { t = to_posix_thread(pthread); if (t == NULL) { ret = ESRCH; K_SPINLOCK_BREAK; } if (!__attr_is_initialized(&t->attr)) { ret = ESRCH; K_SPINLOCK_BREAK; } t->attr.cancelpending = true; cancel_state = t->attr.cancelstate; cancel_type = t->attr.canceltype; } if (ret == 0 && cancel_state == PTHREAD_CANCEL_ENABLE && cancel_type == PTHREAD_CANCEL_ASYNCHRONOUS) { posix_thread_finalize(t, PTHREAD_CANCELED); } return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ADC Offset and Gain mode configuration. This function disable the ADC correction for offset calibration and gain calibration. */
void adc_correction_stop(void)
/* ADC Offset and Gain mode configuration. This function disable the ADC correction for offset calibration and gain calibration. */ void adc_correction_stop(void)
{ struct adc_config conf_adc; adc_get_config_defaults(&conf_adc); conf_adc.correction.correction_enable = false; correction_measures_done = false; adc_init(&adc_instance, ADC, &conf_adc); adc_enable(&adc_instance); }
memfault/zero-to-main
C++
null
200
/* Returns: (transfer full): a #GMount or NULL if no such mount is available. Free the returned object with g_object_unref(). */
GMount* g_volume_monitor_get_mount_for_uuid(GVolumeMonitor *volume_monitor, const char *uuid)
/* Returns: (transfer full): a #GMount or NULL if no such mount is available. Free the returned object with g_object_unref(). */ GMount* g_volume_monitor_get_mount_for_uuid(GVolumeMonitor *volume_monitor, const char *uuid)
{ GVolumeMonitorClass *class; g_return_val_if_fail (G_IS_VOLUME_MONITOR (volume_monitor), NULL); g_return_val_if_fail (uuid != NULL, NULL); class = G_VOLUME_MONITOR_GET_CLASS (volume_monitor); return class->get_mount_for_uuid (volume_monitor, uuid); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the specified data holding register value for DAC channel2. */
void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
/* Set the specified data holding register value for DAC channel2. */ void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
{ assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data)); *((__IO uint32_t *)(DAC_BASE + DHR12R2_Offset + DAC_Align)) = (uint32_t)Data; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Reads data in current address from the 24LC64. */
void _24LC64_CurrentAddrRead(unsigned char *pucBuffer)
/* Reads data in current address from the 24LC64. */ void _24LC64_CurrentAddrRead(unsigned char *pucBuffer)
{ tI2CMasterTransferCfg Cfg; Cfg.ulSlave = _24LC64_ADDRESS; Cfg.pvWBuf = 0; Cfg.ulWLen = 0; Cfg.ulWCount = 0; Cfg.pvRBuf = pucBuffer; Cfg.ulRLen = 1; Cfg.ulRCount = 0; I2CMasterTransfer(_24LC64_I2C_PORT, &Cfg, I2C_TRANSFER_POLLING); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Called by a driver the first time it's needed, must be attached to desired connectors. */
int drm_mode_create_dithering_property(struct drm_device *dev)
/* Called by a driver the first time it's needed, must be attached to desired connectors. */ int drm_mode_create_dithering_property(struct drm_device *dev)
{ struct drm_property *dithering_mode; int i; if (dev->mode_config.dithering_mode_property) return 0; dithering_mode = drm_property_create(dev, DRM_MODE_PROP_ENUM, "dithering", ARRAY_SIZE(drm_dithering_mode_enum_list)); for (i = 0; i < ARRAY_SIZE(drm_dithering_mode_enum_list); i++) drm_property_add_enum(dithering_mode, i, drm_dithering_mode_enum_list[i].type, drm_dithering_mode_enum_list[i].name); dev->mode_config.dithering_mode_property = dithering_mode; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* DXE Core will disable interrupts and turn off the timer and disable interrupts after all the event handlers have run. */
VOID EFIAPI GicV3ExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context)
/* DXE Core will disable interrupts and turn off the timer and disable interrupts after all the event handlers have run. */ VOID EFIAPI GicV3ExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context)
{ UINTN Index; for (Index = 0; Index < mGicNumInterrupts; Index++) { GicV3DisableInterruptSource (&gHardwareInterruptV3Protocol, Index); } ArmGicV3DisableInterruptInterface (); ArmGicDisableDistributor (mGicDistributorBase); }
tianocore/edk2
C++
Other
4,240
/* This routine will get the first valid Event Queue Entry from @q, update the queue's internal hba index, and return the EQE. If no valid EQEs are in the Queue (no more work to do), or the Queue is full of EQEs that have been processed, but not popped back to the HBA then this routine will return NULL. */
static struct lpfc_eqe* lpfc_sli4_eq_get(struct lpfc_queue *q)
/* This routine will get the first valid Event Queue Entry from @q, update the queue's internal hba index, and return the EQE. If no valid EQEs are in the Queue (no more work to do), or the Queue is full of EQEs that have been processed, but not popped back to the HBA then this routine will return NULL. */ static struct lpfc_eqe* lpfc_sli4_eq_get(struct lpfc_queue *q)
{ struct lpfc_eqe *eqe = q->qe[q->hba_index].eqe; if (!bf_get(lpfc_eqe_valid, eqe)) return NULL; if (((q->hba_index + 1) % q->entry_count) == q->host_index) return NULL; q->hba_index = ((q->hba_index + 1) % q->entry_count); return eqe; }
robutest/uclinux
C++
GPL-2.0
60
/* Fills each alarmConfig member with its default value. */
void RTC_ConfigAlarmStructInit(RTC_AlarmConfig_T *alarmConfig)
/* Fills each alarmConfig member with its default value. */ void RTC_ConfigAlarmStructInit(RTC_AlarmConfig_T *alarmConfig)
{ alarmConfig->time.hours = 0; alarmConfig->time.minutes = 0; alarmConfig->time.seconds = 0; alarmConfig->time.h12 = RTC_H12_AM; alarmConfig->alarmDateWeekDay = 1; alarmConfig->alarmDateWeekDaySel = RTC_WEEKDAY_SEL_DATE; alarmConfig->alarmMask = RTC_MASK_NONE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables the specified BKP peripheral Clock. */
void RCC_BKP_ClockCmd(BKP_TypeDef *peripheral, FunctionalState state)
/* Enables or disables the specified BKP peripheral Clock. */ void RCC_BKP_ClockCmd(BKP_TypeDef *peripheral, FunctionalState state)
{ if(BKP == peripheral) { (state) ? (RCC->APB1ENR |= RCC_APB1ENR_BKP) : (RCC->APB1ENR &= ~RCC_APB1ENR_BKP); (state) ? (RCC->APB1ENR |= RCC_APB1ENR_PWR) : (RCC->APB1ENR &= ~RCC_APB1ENR_PWR); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: TRUE if the date is a valid one */
gboolean g_date_valid_dmy(GDateDay d, GDateMonth m, GDateYear y)
/* Returns: TRUE if the date is a valid one */ gboolean g_date_valid_dmy(GDateDay d, GDateMonth m, GDateYear y)
{ return ( (m > G_DATE_BAD_MONTH) && (m < 13) && (d > G_DATE_BAD_DAY) && (y > G_DATE_BAD_YEAR) && (d <= (g_date_is_leap_year (y) ? days_in_months[1][m] : days_in_months[0][m])) ); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read BMA250 device ID and revision numbers. This function reads the accelerometer hardware identification registers and returns these values in the specified data structure. */
static bool bma250_device_id(sensor_hal_t *hal, sensor_data_t *data)
/* Read BMA250 device ID and revision numbers. This function reads the accelerometer hardware identification registers and returns these values in the specified data structure. */ static bool bma250_device_id(sensor_hal_t *hal, sensor_data_t *data)
{ data->device.id = sensor_bus_get(hal, BMA250_CHIP_ID); data->device.version = 0; return (STATUS_OK == hal->bus.status); }
memfault/zero-to-main
C++
null
200
/* Compensation code taken from BME280 datasheet, Section 4.2.3 "Compensation formula". */
static void bme280_compensate_temp(struct bme280_data *data, int32_t adc_temp)
/* Compensation code taken from BME280 datasheet, Section 4.2.3 "Compensation formula". */ static void bme280_compensate_temp(struct bme280_data *data, int32_t adc_temp)
{ int32_t var1, var2; var1 = (((adc_temp >> 3) - ((int32_t)data->dig_t1 << 1)) * ((int32_t)data->dig_t2)) >> 11; var2 = (((((adc_temp >> 4) - ((int32_t)data->dig_t1)) * ((adc_temp >> 4) - ((int32_t)data->dig_t1))) >> 12) * ((int32_t)data->dig_t3)) >> 14; data->t_fine = var1 + var2; data->comp_temp = (data->t_fine * 5 + 128) >> 8; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Enables or disables the TIMx peripheral Preload register on CCR2. */
void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR2. */ void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_LIST6_PERIPH(TIMx)); assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC2PE); tmpccmr1 |= (uint16_t)(TIM_OCPreload << 8); TIMx->CCMR1 = tmpccmr1; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Configures the TIMx Output Compare 1 Fast feature. */
void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 1 Fast feature. */ void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC1FE); tmpccmr1 |= TIM_OCFast; TIMx->CCMR1 = tmpccmr1; }
ajhc/demo-cortex-m3
C++
null
38
/* Utility function to free root bridge instances array from */
VOID EFIAPI PciHostBridgeUtilityFreeRootBridges(IN PCI_ROOT_BRIDGE *Bridges, IN UINTN Count)
/* Utility function to free root bridge instances array from */ VOID EFIAPI PciHostBridgeUtilityFreeRootBridges(IN PCI_ROOT_BRIDGE *Bridges, IN UINTN Count)
{ if ((Bridges == NULL) && (Count == 0)) { return; } ASSERT (Bridges != NULL && Count > 0); do { --Count; PciHostBridgeUtilityUninitRootBridge (&Bridges[Count]); } while (Count > 0); FreePool (Bridges); }
tianocore/edk2
C++
Other
4,240
/* param config Configuration for the selected IEE region. */
void IEE_GetDefaultConfig(iee_config_t *config)
/* param config Configuration for the selected IEE region. */ void IEE_GetDefaultConfig(iee_config_t *config)
{ (void)memset(config, 0, sizeof(*config)); config->bypass = kIEE_AesUseMdField; config->mode = kIEE_ModeNone; config->keySize = kIEE_AesCTR128XTS256; config->pageOffset = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for comparing two addresses to determine if they are identical. */
bool addr_compare(ble_gap_addr_t const *p_addr1, ble_gap_addr_t const *p_addr2)
/* Function for comparing two addresses to determine if they are identical. */ bool addr_compare(ble_gap_addr_t const *p_addr1, ble_gap_addr_t const *p_addr2)
{ if ((p_addr1 == NULL) || (p_addr2 == NULL)) { return false; } if (p_addr1->addr_type != p_addr2->addr_type) { return false; } return (memcmp(p_addr1->addr, p_addr2->addr, BLE_GAP_ADDR_LEN) == 0); }
labapart/polymcu
C++
null
201
/* Utility function to link a node when returning from a CodeGen function. */
STATIC EFI_STATUS EFIAPI LinkNode(IN AML_OBJECT_NODE *Node, IN AML_NODE_HEADER *ParentNode, OUT AML_OBJECT_NODE **NewObjectNode)
/* Utility function to link a node when returning from a CodeGen function. */ STATIC EFI_STATUS EFIAPI LinkNode(IN AML_OBJECT_NODE *Node, IN AML_NODE_HEADER *ParentNode, OUT AML_OBJECT_NODE **NewObjectNode)
{ EFI_STATUS Status; if (NewObjectNode != NULL) { *NewObjectNode = NULL; } if (ParentNode != NULL) { Status = AmlVarListAddTail (ParentNode, (AML_NODE_HEADER *)Node); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } } if (NewObjectNode != NULL) { *NewObjectNode = Node; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Stops the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
/* Stops the Low Level portion of the Device driver. */ USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
{ HAL_PCD_Stop((PCD_HandleTypeDef*) pdev->pData); return USBD_OK; }
st-one/X-CUBE-USB-PD
C++
null
110