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
/* restore_state - Load configuration of current chip @pl022: SSP driver private data structure */
static void restore_state(struct pl022 *pl022)
/* restore_state - Load configuration of current chip @pl022: SSP driver private data structure */ static void restore_state(struct pl022 *pl022)
{ struct chip_data *chip = pl022->cur_chip; if (pl022->vendor->extended_cr) writel(chip->cr0, SSP_CR0(pl022->virtbase)); else writew(chip->cr0, SSP_CR0(pl022->virtbase)); writew(chip->cr1, SSP_CR1(pl022->virtbase)); writew(chip->dmacr, SSP_DMACR(pl022->virtbase)); writew(chip->cpsr, SSP_CPSR(pl022->virtbase))...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Unlike extN we don't have any flags we don't want to inherit currently. */
void btrfs_inherit_iflags(struct inode *inode, struct inode *dir)
/* Unlike extN we don't have any flags we don't want to inherit currently. */ void btrfs_inherit_iflags(struct inode *inode, struct inode *dir)
{ unsigned int flags; if (!dir) return; flags = BTRFS_I(dir)->flags; if (S_ISREG(inode->i_mode)) flags &= ~BTRFS_INODE_DIRSYNC; else if (!S_ISDIR(inode->i_mode)) flags &= (BTRFS_INODE_NODUMP | BTRFS_INODE_NOATIME); BTRFS_I(inode)->flags = flags; btrfs_update_iflags(inode); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the number of device endpoint the periph support (including ep0) */
static uint8_t get_ep_count(usbd_device *dev)
/* Get the number of device endpoint the periph support (including ep0) */ static uint8_t get_ep_count(usbd_device *dev)
{ uint8_t value = dev->config->ep_count; if (!value) { value = DWC_OTG_GHWCFG2_NUMDEVEPS_GET(REBASE(DWC_OTG_GHWCFG2)); value += 1; } return value; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */
SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2)
/* Return 0 when the two name types are equivalent, as in strncmp, but skipping ' '. */ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2)
{ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } return (int)((l1 - f1) - (l2 - f2)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Check if given address is in device FLASH range. */
__STATIC_INLINE bool addr_is_in_FLASH(void const *const ptr)
/* Check if given address is in device FLASH range. */ __STATIC_INLINE bool addr_is_in_FLASH(void const *const ptr)
{ return ((((uintptr_t)ptr) & 0xFF000000u) == 0x00000000u); }
labapart/polymcu
C++
null
201
/* nilfs_btnode_abort_change_key abort the change_key operation prepared by prepare_change_key(). */
void nilfs_btnode_abort_change_key(struct address_space *btnc, struct nilfs_btnode_chkey_ctxt *ctxt)
/* nilfs_btnode_abort_change_key abort the change_key operation prepared by prepare_change_key(). */ void nilfs_btnode_abort_change_key(struct address_space *btnc, struct nilfs_btnode_chkey_ctxt *ctxt)
{ struct buffer_head *nbh = ctxt->newbh; __u64 oldkey = ctxt->oldkey, newkey = ctxt->newkey; if (oldkey == newkey) return; if (nbh == NULL) { spin_lock_irq(&btnc->tree_lock); radix_tree_delete(&btnc->page_tree, newkey); spin_unlock_irq(&btnc->tree_lock); unlock_page(ctxt->bh->b_page); } else brelse(nbh...
robutest/uclinux
C++
GPL-2.0
60
/* This routine returns the current speed of the port */
usbPortSpeed_t usb_get_port_speed(usb_module_t *port)
/* This routine returns the current speed of the port */ usbPortSpeed_t usb_get_port_speed(usb_module_t *port)
{ usbPortSpeed_t speed; uint32_t core = (uint32_t)port->controllerID; switch (BG_USBC_UH1_PORTSC1_PSPD(HW_USBC_PORTSC1_RD(core))) { case usbSpeedFull: speed = usbSpeedFull; printf("Connected at full-speed\n"); break; case usbSpeedLow: speed = usbSpeedLow; pri...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentAndThenOr8(IN UINT64 Address, IN UINT8 AndData, IN UINT8 OrData)
/* If any reserved bits in Address are set, then ASSERT(). */ UINT8 EFIAPI PciSegmentAndThenOr8(IN UINT64 Address, IN UINT8 AndData, IN UINT8 OrData)
{ UINTN Count; PCI_SEGMENT_INFO *SegmentInfo; SegmentInfo = GetPciSegmentInfo (&Count); return MmioAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData); }
tianocore/edk2
C++
Other
4,240
/* Serial port receive idle process. This need add to uart idle ISR. */
static void dma_uart_rx_idle_isr(struct rt_serial_device *serial)
/* Serial port receive idle process. This need add to uart idle ISR. */ static void dma_uart_rx_idle_isr(struct rt_serial_device *serial)
{ struct n32_uart *uart = (struct n32_uart *) serial->parent.user_data; rt_size_t recv_total_index, recv_len; rt_base_t level; level = rt_hw_interrupt_disable(); recv_total_index = uart->dma.setting_recv_len - DMA_GetCurrDataCounter(uart->dma.rx_ch); recv_len = recv_total_index - uart->dma.last_...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calls a function for each element of a #GSList. */
void g_slist_foreach(GSList *list, GFunc func, gpointer user_data)
/* Calls a function for each element of a #GSList. */ void g_slist_foreach(GSList *list, GFunc func, gpointer user_data)
{ while (list) { GSList *next = list->next; (*func) (list->data, user_data); list = next; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base VREF peripheral address. param trimValue Value of the trim register to set the output reference voltage (maximum 0x3F (6-bit)). */
void VREF_SetVrefTrimVal(VREF_Type *base, uint8_t trimValue)
/* param base VREF peripheral address. param trimValue Value of the trim register to set the output reference voltage (maximum 0x3F (6-bit)). */ void VREF_SetVrefTrimVal(VREF_Type *base, uint8_t trimValue)
{ uint32_t tmp32 = base->UTRIM; tmp32 &= (~VREF_UTRIM_VREFTRIM_MASK); tmp32 |= VREF_UTRIM_VREFTRIM(trimValue); base->UTRIM = tmp32; if (VREF_CSR_CHOPEN_MASK == (base->CSR & VREF_CSR_CHOPEN_MASK)) { SDK_DelayAtLeastUs(400U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); } else { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the USB Host Speed from the Low Level Driver. */
USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
/* Returns the USB Host Speed from the Low Level Driver. */ USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
{ USBH_SpeedTypeDef speed = USBH_SPEED_LOW; switch (HAL_HCD_GetCurrentSpeed(phost->pData)) { case 0: speed = USBH_SPEED_HIGH; break; case 1: speed = USBH_SPEED_FULL; break; case 2: speed = USBH_SPEED_LOW; break; default: speed = USBH_SPEED_HIGH; break; } return speed; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Checks whether the FLASH SMPSEL is SMP1 or SMP2. */
FLASH_SMPSEL FLASH_GetSMPSELStatus(void)
/* Checks whether the FLASH SMPSEL is SMP1 or SMP2. */ FLASH_SMPSEL FLASH_GetSMPSELStatus(void)
{ FLASH_SMPSEL bitstatus = FLASH_SMP1; if ((FLASH->CTRL & CTRL_SMPSEL_SMP2) != (uint32_t)FLASH_SMP1) { bitstatus = FLASH_SMP2; } else { bitstatus = FLASH_SMP1; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the most recent received data by the CEC peripheral. */
uint8_t CEC_ReceiveDataByte(void)
/* Returns the most recent received data by the CEC peripheral. */ uint8_t CEC_ReceiveDataByte(void)
{ return (uint8_t)(CEC->RXD); }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Enables asynchronous callback generation for a given type. Enables asynchronous callbacks for a given callback type. This must be called before an external interrupt channel will generate callback events. */
enum status_code wdt_enable_callback(const enum wdt_callback type)
/* Enables asynchronous callback generation for a given type. Enables asynchronous callbacks for a given callback type. This must be called before an external interrupt channel will generate callback events. */ enum status_code wdt_enable_callback(const enum wdt_callback type)
{ Wdt *const WDT_module = WDT; switch (type) { case WDT_CALLBACK_EARLY_WARNING: WDT_module->INTENSET.reg = WDT_INTENSET_EW; system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_WDT); return STATUS_OK; default: Assert(false); return STATUS_ERR_INVALID_ARG; } }
memfault/zero-to-main
C++
null
200
/* Set the clock rate of the specified I2C port. The */
void I2CSlaveInit(unsigned long ulBase, unsigned short usSlaveAddr, unsigned long ulGeneralCall, unsigned long ulAddrBit)
/* Set the clock rate of the specified I2C port. The */ void I2CSlaveInit(unsigned long ulBase, unsigned short usSlaveAddr, unsigned long ulGeneralCall, unsigned long ulAddrBit)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_CON2) &= ~(I2C_CON2_GCAEN | I2C_CON2_ADEXT); xHWREGB(ulBase + I2C_CON2) = ulGeneralCall | ulAddrBit; if(ulAddrBit == I2C_ADDRESS_7BIT) { xHWREGB(ulBase + I2C_A1) = (usSlaveAddr << 1); } else { ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns TRUE if the given device should capture in monitor mode by default */
gboolean prefs_capture_device_monitor_mode(const char *name)
/* Returns TRUE if the given device should capture in monitor mode by default */ gboolean prefs_capture_device_monitor_mode(const char *name)
{ gchar *tok, *devices; size_t len; if (prefs.capture_devices_monitor_mode && name) { devices = g_strdup (prefs.capture_devices_monitor_mode); len = strlen (name); for (tok = strtok (devices, ","); tok; tok = strtok(NULL, ",")) { if (strlen (tok) == len && strcmp (name, t...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reset all the registers to known state. This function clears all registers that requires it to known state. TWIS is left disabled after this function. All events are cleared. */
static void nrf_drv_twis_swreset(NRF_TWIS_Type *const p_reg)
/* Reset all the registers to known state. This function clears all registers that requires it to known state. TWIS is left disabled after this function. All events are cleared. */ static void nrf_drv_twis_swreset(NRF_TWIS_Type *const p_reg)
{ nrf_twis_disable(p_reg); nrf_twis_pins_set(p_reg, ~0U, ~0U); nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_reg)); nrf_twis_int_disable(p_reg, ~0U); }
labapart/polymcu
C++
null
201
/* This is a remove function for ccw devices that are slave devices in a ccw group device. It sets the ccw device offline and also deregisters the embedding ccw group device. */
void ccwgroup_remove_ccwdev(struct ccw_device *cdev)
/* This is a remove function for ccw devices that are slave devices in a ccw group device. It sets the ccw device offline and also deregisters the embedding ccw group device. */ void ccwgroup_remove_ccwdev(struct ccw_device *cdev)
{ struct ccwgroup_device *gdev; ccw_device_set_offline(cdev); gdev = __ccwgroup_get_gdev_by_cdev(cdev); if (gdev) { __ccwgroup_remove_symlinks(gdev); device_unregister(&gdev->dev); mutex_unlock(&gdev->reg_mutex); put_device(&gdev->dev); } }
robutest/uclinux
C++
GPL-2.0
60
/* Send pending packets to the winc under HIF thread context. */
void winc_netif_tx_from_queue(hif_msg_t *msg)
/* Send pending packets to the winc under HIF thread context. */ void winc_netif_tx_from_queue(hif_msg_t *msg)
{ struct pbuf *p = (struct pbuf *)msg->pbuf; void *payload = msg->payload; uint32_t len = msg->payload_size; uint32_t tries = 0; sint8 err; for (;;) { err = m2m_wifi_send_ethernet_pkt(payload, len); if (M2M_SUCCESS == err) { break; } else { if (++tries == 100) { break; } vTaskDelay(1); } }...
remotemcu/remcu-chip-sdks
C++
null
436
/* Description: Configures MII_BMCR to force speed/duplex to the values in phydev. Assumes that the values are valid. Please see phy_sanitize_settings(). */
int genphy_setup_forced(struct phy_device *phydev)
/* Description: Configures MII_BMCR to force speed/duplex to the values in phydev. Assumes that the values are valid. Please see phy_sanitize_settings(). */ int genphy_setup_forced(struct phy_device *phydev)
{ int err; int ctl = 0; phydev->pause = phydev->asym_pause = 0; if (SPEED_1000 == phydev->speed) ctl |= BMCR_SPEED1000; else if (SPEED_100 == phydev->speed) ctl |= BMCR_SPEED100; if (DUPLEX_FULL == phydev->duplex) ctl |= BMCR_FULLDPLX; err = phy_write(phydev, MII_BMCR, ctl); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Reset the PHY. Reset the PHY chip and wait for done */
void phy_reset(uint8_t phy)
/* Reset the PHY. Reset the PHY chip and wait for done */ void phy_reset(uint8_t phy)
{ eth_smi_write(phy, PHY_REG_BCR, PHY_REG_BCR_RESET); while (eth_smi_read(phy, PHY_REG_BCR) & PHY_REG_BCR_RESET); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function gets the Analog input mode for all the channels from the ADC Channel Analog-Input Mode Sequencer Registers. */
u32 XAdcPs_GetSeqInputMode(XAdcPs *InstancePtr)
/* This function gets the Analog input mode for all the channels from the ADC Channel Analog-Input Mode Sequencer Registers. */ u32 XAdcPs_GetSeqInputMode(XAdcPs *InstancePtr)
{ u32 InputMode; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); InputMode = XAdcPs_ReadInternalReg(InstancePtr, XADCPS_SEQ04_OFFSET) & XADCPS_SEQ04_CH_VALID_MASK; InputMode |= (XAdcPs_ReadInternalReg(InstancePtr, XADCPS_SEQ05_OFFSET) & XAD...
ua1arn/hftrx
C++
null
69
/* Enable the SPI interrupt of the specified SPI port. This function is to enable the SPI interrupt of the specified SPI port and install the callback function. */
void SPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
/* Enable the SPI interrupt of the specified SPI port. This function is to enable the SPI interrupt of the specified SPI port and install the callback function. */ void SPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); xHWREG(ulBase + SPI_CR2) |= ulIntFlags; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function registers ciphers and digests used directly and indirectly by SSL/TLS, and initializes the readable error messages. This function must be called before any other action takes places. */
BOOLEAN EFIAPI TlsInitialize(VOID)
/* This function registers ciphers and digests used directly and indirectly by SSL/TLS, and initializes the readable error messages. This function must be called before any other action takes places. */ BOOLEAN EFIAPI TlsInitialize(VOID)
{ CALL_CRYPTO_SERVICE (TlsInitialize, (), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Called by rport to check if the itnim is online. */
bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim)
/* Called by rport to check if the itnim is online. */ bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim)
{ bfa_trc(itnim->fcs, itnim->rport->pid); switch (bfa_sm_to_state(itnim_sm_table, itnim->sm)) { case BFA_ITNIM_ONLINE: case BFA_ITNIM_INITIATIOR: return BFA_STATUS_OK; default: return BFA_STATUS_NO_FCPIM_NEXUS; } }
robutest/uclinux
C++
GPL-2.0
60
/* We want to make sure a ping is in flight. It has timed out. And we are not busy processing a pdu that is making progress but got started before the ping and is taking a while to complete so the ping is just stuck behind it in a queue. */
static int iscsi_has_ping_timed_out(struct iscsi_conn *conn)
/* We want to make sure a ping is in flight. It has timed out. And we are not busy processing a pdu that is making progress but got started before the ping and is taking a while to complete so the ping is just stuck behind it in a queue. */ static int iscsi_has_ping_timed_out(struct iscsi_conn *conn)
{ if (conn->ping_task && time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) + (conn->ping_timeout * HZ), jiffies)) return 1; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Airpcap wrapper, used to save the settings for the selected_if */
gboolean airpcap_if_get_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint *PKeysCollectionSize)
/* Airpcap wrapper, used to save the settings for the selected_if */ gboolean airpcap_if_get_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint *PKeysCollectionSize)
{ if (!AirpcapLoaded) return FALSE; return g_PAirpcapGetDeviceKeys(AdapterHandle,KeysCollection,PKeysCollectionSize); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Writes the supplied 8-bit value to the LM75B config register. */
err_t lm75bConfigWrite(uint8_t configValue)
/* Writes the supplied 8-bit value to the LM75B config register. */ err_t lm75bConfigWrite(uint8_t configValue)
{ if (!_lm75bInitialised) { ASSERT_STATUS(lm75bInit()); } ASSERT_STATUS(lm75bWrite8(LM75B_REGISTER_CONFIGURATION, configValue)); return ERROR_NONE; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Returns the direction of an endpoint given its descriptor. */
unsigned char USBEndpointDescriptor_GetDirection(const USBEndpointDescriptor *endpoint)
/* Returns the direction of an endpoint given its descriptor. */ unsigned char USBEndpointDescriptor_GetDirection(const USBEndpointDescriptor *endpoint)
{ if ((endpoint->bEndpointAddress & 0x80) != 0) { return USBEndpointDescriptor_IN; } else { return USBEndpointDescriptor_OUT; } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* On success, We end up with an outstanding reference count against iloc->bh. This */
int ext4_reserve_inode_write(handle_t *handle, struct inode *inode, struct ext4_iloc *iloc)
/* On success, We end up with an outstanding reference count against iloc->bh. This */ int ext4_reserve_inode_write(handle_t *handle, struct inode *inode, struct ext4_iloc *iloc)
{ int err; err = ext4_get_inode_loc(inode, iloc); if (!err) { BUFFER_TRACE(iloc->bh, "get_write_access"); err = ext4_journal_get_write_access(handle, iloc->bh); if (err) { brelse(iloc->bh); iloc->bh = NULL; } } ext4_std_error(inode->i_sb, err); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Inserts the specified block node into the linked list with block nodes. */
static void TbxMemPoolBlockListInsert(tBlockList *listPtr, tBlockNode *nodePtr)
/* Inserts the specified block node into the linked list with block nodes. */ static void TbxMemPoolBlockListInsert(tBlockList *listPtr, tBlockNode *nodePtr)
{ TBX_ASSERT(listPtr != NULL); TBX_ASSERT(nodePtr != NULL); if ( (listPtr != NULL) && (nodePtr != NULL) ) { if (*listPtr == NULL) { nodePtr->nextNodePtr = NULL; } else { nodePtr->nextNodePtr = *listPtr; } *listPtr = nodePtr; } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* These are bits to program the ssi frequency generator */
static void write_av9110_bit(lmc_softc_t *, int)
/* These are bits to program the ssi frequency generator */ static void write_av9110_bit(lmc_softc_t *, int)
{ sc->lmc_gpio &= ~(LMC_GEP_CLK); if (c & 0x01) sc->lmc_gpio |= LMC_GEP_DATA; else sc->lmc_gpio &= ~(LMC_GEP_DATA); LMC_CSR_WRITE (sc, csr_gp, sc->lmc_gpio); sc->lmc_gpio |= LMC_GEP_CLK; LMC_CSR_WRITE (sc, csr_gp, sc->lmc_gpio); sc->lmc_gpio &= ~(LMC_GEP_CLK); LMC_CSR_WRITE (sc, csr_gp, sc->lmc_...
robutest/uclinux
C++
GPL-2.0
60
/* This function is a veneer that replaces the function originally installed by the NAND Flash MTD code. */
static int mxs_nand_hook_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
/* This function is a veneer that replaces the function originally installed by the NAND Flash MTD code. */ static int mxs_nand_hook_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
{ struct nand_chip *chip = mtd_to_nand(mtd); struct mxs_nand_info *nand_info = nand_get_controller_data(chip); int ret; if (ops->mode == MTD_OPS_RAW) nand_info->raw_oob_mode = 1; else nand_info->raw_oob_mode = 0; ret = nand_info->hooked_write_oob(mtd, to, ops); nand_info->raw_oob_mode = 0; return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Function for handling callbacks from pstorage module. Handles pstorage results for clear and storage operation. For detailed description of the parameters provided with the callback, please refer to pstorage_ntf_cb_t. */
static void pstorage_callback_handler(pstorage_handle_t *p_handle, uint8_t op_code, uint32_t result, uint8_t *p_data, uint32_t data_len)
/* Function for handling callbacks from pstorage module. Handles pstorage results for clear and storage operation. For detailed description of the parameters provided with the callback, please refer to pstorage_ntf_cb_t. */ static void pstorage_callback_handler(pstorage_handle_t *p_handle, uint8_t op_code, uint32_t r...
{ switch (op_code) { case PSTORAGE_STORE_OP_CODE: if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL)) { m_data_pkt_cb(DATA_PACKET, result, p_data); } break; case PSTORAGE_CLEAR_OP_CODE: if (m_dfu_state...
labapart/polymcu
C++
null
201
/* Reads and returns the current value of ES. This function is only available on IA-32 and x64. */
UINT16 EFIAPI AsmReadEs(VOID)
/* Reads and returns the current value of ES. This function is only available on IA-32 and x64. */ UINT16 EFIAPI AsmReadEs(VOID)
{ __asm { xor eax, eax mov ax, es } }
tianocore/edk2
C++
Other
4,240
/* see if a mapped address was really a "safe" buffer and if so, copy the data from the safe buffer back to the unsafe buffer and free up the safe buffer. (basically return things back to the way they should be) */
void dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir)
/* see if a mapped address was really a "safe" buffer and if so, copy the data from the safe buffer back to the unsafe buffer and free up the safe buffer. (basically return things back to the way they should be) */ void dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir)
{ dev_dbg(dev, "%s(ptr=%p,size=%d,dir=%x)\n", __func__, (void *) dma_addr, size, dir); unmap_single(dev, dma_addr, size, dir); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Allocate a private structure used by lookup table. You must call kfree() to free the memory allocated. */
int pwc_dec23_alloc(struct pwc_device *pwc)
/* Allocate a private structure used by lookup table. You must call kfree() to free the memory allocated. */ int pwc_dec23_alloc(struct pwc_device *pwc)
{ pwc->decompress_data = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); if (pwc->decompress_data == NULL) return -ENOMEM; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Unregisters a callback. Unregisters a callback function implemented by the user. */
enum status_code slcd_unregister_callback(const slcd_callback_t callback, const enum slcd_callback_type type)
/* Unregisters a callback. Unregisters a callback function implemented by the user. */ enum status_code slcd_unregister_callback(const slcd_callback_t callback, const enum slcd_callback_type type)
{ if (type >= SLCD_CALLBACK_TYPE_NUM){ return STATUS_ERR_INVALID_ARG; } slcd_callback_pointer[type] = NULL; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask val...
UINT8 EFIAPI S3PciBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask val...
{ return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Following 3 functions taken from gsmdecode-0.7bis, with permission - */
static int hc2b(unsigned char hex)
/* Following 3 functions taken from gsmdecode-0.7bis, with permission - */ static int hc2b(unsigned char hex)
{ hex = g_ascii_tolower(hex); if ((hex >= '0') && (hex <= '9')) return hex - '0'; if ((hex >= 'a') && (hex <= 'f')) return hex - 'a' + 10; return -1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Weight of 1 LSB of wakeup threshold. 0: 1 LSB =FS_XL / 64 1: 1 LSB = FS_XL / 256. */
int32_t lsm6dso_wkup_ths_weight_set(lsm6dso_ctx_t *ctx, lsm6dso_wake_ths_w_t val)
/* Weight of 1 LSB of wakeup threshold. 0: 1 LSB =FS_XL / 64 1: 1 LSB = FS_XL / 256. */ int32_t lsm6dso_wkup_ths_weight_set(lsm6dso_ctx_t *ctx, lsm6dso_wake_ths_w_t val)
{ lsm6dso_wake_up_dur_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&reg, 1); if (ret == 0) { reg.wake_ths_w = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* This functions returns a non-zero value when the tile is on the right edge and does not have full imaged tile width. */
int t2p_tile_is_right_edge(T2P_TILES, ttile_t)
/* This functions returns a non-zero value when the tile is on the right edge and does not have full imaged tile width. */ int t2p_tile_is_right_edge(T2P_TILES, ttile_t)
{ return(1); } else { return(0); } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function puts all devices to sleep. Support and FAQ: visit */
void sha204_sleep_all(void)
/* This function puts all devices to sleep. Support and FAQ: visit */ void sha204_sleep_all(void)
{ uint8_t i; for (i = 1; i < SHA204_DEVICE_COUNT; i++) { sha204p_set_device_id(sha204_i2c_address(i)); sha204p_sleep(); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* System Clock Configuration. This code was created by CubeMX and configures the system clock to match the configuration in the bootloader's configuration (blt_conf.h), specifically the macros: BOOT_CPU_SYSTEM_SPEED_KHZ and BOOT_CPU_XTAL_SPEED_KHZ. Note that the Lower Layer drivers were selected in CubeMX for the RCC ...
static void SystemClock_Config(void)
/* System Clock Configuration. This code was created by CubeMX and configures the system clock to match the configuration in the bootloader's configuration (blt_conf.h), specifically the macros: BOOT_CPU_SYSTEM_SPEED_KHZ and BOOT_CPU_XTAL_SPEED_KHZ. Note that the Lower Layer drivers were selected in CubeMX for the RCC ...
{ LL_FLASH_SetLatency(LL_FLASH_LATENCY_1); LL_RCC_DeInit(); LL_RCC_HSE_Enable(); while(LL_RCC_HSE_IsReady() != 1) { ; } LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE) { ; } ...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Delete a route, we only delete a FULL match. If route does not exist we return -ENOENT. */
static int ipddp_delete(struct ipddp_route *rt)
/* Delete a route, we only delete a FULL match. If route does not exist we return -ENOENT. */ static int ipddp_delete(struct ipddp_route *rt)
{ struct ipddp_route **r = &ipddp_route_list; struct ipddp_route *tmp; spin_lock_bh(&ipddp_route_lock); while((tmp = *r) != NULL) { if(tmp->ip == rt->ip && tmp->at.s_net == rt->at.s_net && tmp->at.s_node == rt->at.s_node) { ...
robutest/uclinux
C++
GPL-2.0
60
/* Submit a USB get configuration request for the USB device specified by UsbIo and place the result in the buffer specified by ConfigurationValue. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If ConfigurationValue is NULL, then ASSERT(). If Status is NULL, then ASSERT(). */
EFI_STATUS EFIAPI UsbGetConfiguration(IN EFI_USB_IO_PROTOCOL *UsbIo, OUT UINT16 *ConfigurationValue, OUT UINT32 *Status)
/* Submit a USB get configuration request for the USB device specified by UsbIo and place the result in the buffer specified by ConfigurationValue. The status of the transfer is returned in Status. If UsbIo is NULL, then ASSERT(). If ConfigurationValue is NULL, then ASSERT(). If Status is NULL, then ASSERT(). */ EFI_ST...
{ EFI_USB_DEVICE_REQUEST DevReq; ASSERT (UsbIo != NULL); ASSERT (ConfigurationValue != NULL); ASSERT (Status != NULL); *ConfigurationValue = 0; ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST)); DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE; DevReq.Request = USB_REQ_GET_CONFIG; DevReq....
tianocore/edk2
C++
Other
4,240
/* Return: 0 if successful, negative error code otherwise */
int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
/* Return: 0 if successful, negative error code otherwise */ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ int status; u32 intr_mask; if (dbg_qh(qh)) dev_vdbg(hsotg->dev, "%s()\n", __func__); if (!list_empty(&qh->qh_list_entry)) return 0; if (dwc2_qh_is_non_per(qh)) { list_add_tail(&qh->qh_list_entry, &hsotg->non_periodic_sched_inactive); return 0; } status = dwc2_schedule_periodic(hsotg, qh); if ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Compute the desired load offset from a compressed program; outputs a small assembly wrapper with the appropriate symbols defined. */
static uint32_t getle32(const void *p)
/* Compute the desired load offset from a compressed program; outputs a small assembly wrapper with the appropriate symbols defined. */ static uint32_t getle32(const void *p)
{ const uint8_t *cp = p; return (uint32_t)cp[0] + ((uint32_t)cp[1] << 8) + ((uint32_t)cp[2] << 16) + ((uint32_t)cp[3] << 24); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the oscillator source to be used by the system clock. USERCC2 must have been set by a call to */
void rcc_set_osc_source(enum osc_src src)
/* Set the oscillator source to be used by the system clock. USERCC2 must have been set by a call to */ void rcc_set_osc_source(enum osc_src src)
{ uint32_t reg32; reg32 = SYSCTL_RCC2; reg32 &= ~SYSCTL_RCC2_OSCSRC2_MASK; reg32 |= (src & SYSCTL_RCC2_OSCSRC2_MASK); SYSCTL_RCC2 = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function finds transition that matches with happened event. Returns the pointer to found transition on success or NULL for failure. */
static struct llc_sap_state_trans* llc_find_sap_trans(struct llc_sap *sap, struct sk_buff *skb)
/* This function finds transition that matches with happened event. Returns the pointer to found transition on success or NULL for failure. */ static struct llc_sap_state_trans* llc_find_sap_trans(struct llc_sap *sap, struct sk_buff *skb)
{ int i = 0; struct llc_sap_state_trans *rc = NULL; struct llc_sap_state_trans **next_trans; struct llc_sap_state *curr_state = &llc_sap_state_table[sap->state - 1]; for (next_trans = curr_state->transitions; next_trans[i]->ev; i++) if (!next_trans[i]->ev(sap, skb)) { rc = next_trans[i]; break; } return...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the EP context from based on the ep_index */
struct xhci_ep_ctx* xhci_get_ep_ctx(struct xhci_ctrl *ctrl, struct xhci_container_ctx *ctx, unsigned int ep_index)
/* Gets the EP context from based on the ep_index */ struct xhci_ep_ctx* xhci_get_ep_ctx(struct xhci_ctrl *ctrl, struct xhci_container_ctx *ctx, unsigned int ep_index)
{ ep_index++; if (ctx->type == XHCI_CTX_TYPE_INPUT) ep_index++; return (struct xhci_ep_ctx *) (ctx->bytes + (ep_index * CTX_SIZE(readl(&ctrl->hccr->cr_hccparams)))); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Gets the value of the Read Status Register (0x05) */
uint8_t w25q16bvGetStatus()
/* Gets the value of the Read Status Register (0x05) */ uint8_t w25q16bvGetStatus()
{ uint8_t status; W25Q16BV_SELECT(); w25q16bv_TransferByte(W25Q16BV_CMD_READSTAT1); status = w25q16bv_TransferByte(0xFF); W25Q16BV_DESELECT(); return status & (W25Q16BV_STAT1_BUSY | W25Q16BV_STAT1_WRTEN); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Gets the next free call_index. For each new call, the call index should be incremented and wrap at 255. However, the index = 0 is reserved for outgoing calls */
static uint8_t next_free_call_index(void)
/* Gets the next free call_index. For each new call, the call index should be incremented and wrap at 255. However, the index = 0 is reserved for outgoing calls */ static uint8_t next_free_call_index(void)
{ for (int i = 0; i < CONFIG_BT_TBS_MAX_CALLS; i++) { static uint8_t next_call_index; const struct bt_tbs_call *call; next_call_index++; if (next_call_index == BT_TBS_FREE_CALL_INDEX) { next_call_index = 1; } call = lookup_call(next_call_index); if (call == NULL) { return next_call_index; } } L...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Actually put a message into a send channel buffer */
static void iop_do_send(struct iop_msg *msg)
/* Actually put a message into a send channel buffer */ static void iop_do_send(struct iop_msg *msg)
{ volatile struct mac_iop *iop = iop_base[msg->iop_num]; int i,offset; offset = IOP_ADDR_SEND_MSG + (msg->channel * IOP_MSG_LEN); for (i = 0 ; i < IOP_MSG_LEN ; i++, offset++) { iop_writeb(iop, offset, msg->message[i]); } iop_writeb(iop, IOP_ADDR_SEND_STATE + msg->channel, IOP_MSG_NEW); iop_interrupt(iop); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Free a previously allocated memory block from the Membag pool. This function frees memory which has been allocated previously via a successful call to */
void membag_free(const void *ptr)
/* Free a previously allocated memory block from the Membag pool. This function frees memory which has been allocated previously via a successful call to */ void membag_free(const void *ptr)
{ uint8_t i; uintptr_t p = (uintptr_t)ptr; uint8_t block_index; for (i = 0; i < ARRAY_LEN(membag_list); i++) { if (p >= membag_list[i].start && p < membag_list[i].end) { block_index = (p - membag_list[i].start) / membag_list[i].block_size; membag_list[i].allocated &= ~((uint32_t)1 << block_index); membag...
memfault/zero-to-main
C++
null
200
/* Set extended wait time out for accessing static memory. */
void EMC_StaticExtendedWait(uint32_t Extended_wait_time_out)
/* Set extended wait time out for accessing static memory. */ void EMC_StaticExtendedWait(uint32_t Extended_wait_time_out)
{ LPC_EMC->StaticExtendedWait = Extended_wait_time_out; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* set the number of remaining data to be transferred by the DMA */
void dma_transfer_number_config(uint32_t dma_periph, dma_channel_enum channelx, uint32_t number)
/* set the number of remaining data to be transferred by the DMA */ void dma_transfer_number_config(uint32_t dma_periph, dma_channel_enum channelx, uint32_t number)
{ if(ERROR == dma_periph_and_channel_check(dma_periph, channelx)){ DMA_WRONG_HANDLE } DMA_CHCNT(dma_periph, channelx) = (number & DMA_CHANNEL_CNT_MASK); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* At what user virtual address is page expected in vma? checking that the page matches the vma. */
unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
/* At what user virtual address is page expected in vma? checking that the page matches the vma. */ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
{ if (PageAnon(page)) { if (vma->anon_vma != page_anon_vma(page)) return -EFAULT; } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) { if (!vma->vm_file || vma->vm_file->f_mapping != page->mapping) return -EFAULT; } else return -EFAULT; return vma_address(page, vma); }
robutest/uclinux
C++
GPL-2.0
60
/* After reading the highest device id from the IOMMU PCI capability header this function looks if there is a higher device id defined in the ACPI table */
static int __init find_last_devid_from_ivhd(struct ivhd_header *h)
/* After reading the highest device id from the IOMMU PCI capability header this function looks if there is a higher device id defined in the ACPI table */ static int __init find_last_devid_from_ivhd(struct ivhd_header *h)
{ u8 *p = (void *)h, *end = (void *)h; struct ivhd_entry *dev; p += sizeof(*h); end += h->length; find_last_devid_on_pci(PCI_BUS(h->devid), PCI_SLOT(h->devid), PCI_FUNC(h->devid), h->cap_ptr); while (p < end) { dev = (struct ivhd_entry *)p; switch (dev->type) { case IVHD_DEV_SELECT: case IVHD_DEV...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the GPIO Peripheral Id from a short Pin. */
unsigned long GPIOPinToPeripheralId(unsigned long ulPort, unsigned long ulPin)
/* Get the GPIO Peripheral Id from a short Pin. */ unsigned long GPIOPinToPeripheralId(unsigned long ulPort, unsigned long ulPin)
{ xASSERT(GPIOBaseValid(ulPort)); return SYSCTL_PERIPH_GPIO; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Receive two 4-8 bit frames, or one 10-16 bit frame. Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */
uint16_t USART_RxDouble(USART_TypeDef *usart)
/* Receive two 4-8 bit frames, or one 10-16 bit frame. Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */ uint16_t USART_RxDouble(USART_TypeDef *usart)
{ while (!(usart->STATUS & USART_STATUS_RXFULL)) ; return (uint16_t)(usart->RXDOUBLE); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Fetch the boot CPU count and the possible CPU count from QEMU, and expose them to UefiCpuPkg modules. Set the MaxCpuCount field in PlatformInfoHob. */
VOID MaxCpuCountInitialization(IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob)
/* Fetch the boot CPU count and the possible CPU count from QEMU, and expose them to UefiCpuPkg modules. Set the MaxCpuCount field in PlatformInfoHob. */ VOID MaxCpuCountInitialization(IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob)
{ RETURN_STATUS PcdStatus; PlatformMaxCpuCountInitialization (PlatformInfoHob); PcdStatus = PcdSet32S (PcdCpuBootLogicalProcessorNumber, PlatformInfoHob->PcdCpuBootLogicalProcessorNumber); ASSERT_RETURN_ERROR (PcdStatus); PcdStatus = PcdSet32S (PcdCpuMaxLogicalProcessorNumber, PlatformInfoHob->PcdCpuMaxLogic...
tianocore/edk2
C++
Other
4,240
/* param base XRDC2 peripheral base address. param mem The memory region to operate. */
void XRDC2_ForceMemExclAccessLockRelease(XRDC2_Type *base, xrdc2_mem_t mem)
/* param base XRDC2 peripheral base address. param mem The memory region to operate. */ void XRDC2_ForceMemExclAccessLockRelease(XRDC2_Type *base, xrdc2_mem_t mem)
{ uint32_t mrc = XRDC2_GET_MRC((uint32_t)mem); uint32_t mrgd = XRDC2_GET_MRGD((uint32_t)mem); base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = XRDC2_EAL_FORCE_RELEASE_MAGIC_0; base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = XRDC2_EAL_FORCE_RELEASE_MAGIC_1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Creates a new mm object and returns a handle to it. */
int i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
/* Creates a new mm object and returns a handle to it. */ int i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ struct drm_i915_gem_create *args = data; struct drm_gem_object *obj; int ret; u32 handle; args->size = roundup(args->size, PAGE_SIZE); obj = drm_gem_object_alloc(dev, args->size); if (obj == NULL) return -ENOMEM; ret = drm_gem_handle_create(file_priv, obj, &handle); mutex_lock(&dev->struct_mutex); drm_gem...
robutest/uclinux
C++
GPL-2.0
60
/* 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 no...
EFI_STATUS EFIAPI UfsPassThruComponentNameGetDriverName(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 no...
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mUfsPassThruDriverNameTable, DriverName, (BOOLEAN)(This == &gUfsPassThruComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Initializes peripherals used by the I2C Pressure Sensor driver. */
uint32_t BSP_PSENSOR_Init(void)
/* Initializes peripherals used by the I2C Pressure Sensor driver. */ uint32_t BSP_PSENSOR_Init(void)
{ uint32_t ret; if(LPS22HB_P_Drv.ReadID(LPS22HB_I2C_ADDRESS) != LPS22HB_WHO_AM_I_VAL) { ret = PSENSOR_ERROR; } else { Psensor_drv = &LPS22HB_P_Drv; Psensor_drv->Init(LPS22HB_I2C_ADDRESS); ret = PSENSOR_OK; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Normally called automaticall from do_ide_pci_setup_device, but is also used directly as a helper function by some controllers where the chipset setup is not the default PCI IDE one. */
void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, struct ide_hw *hw, struct ide_hw **hws)
/* Normally called automaticall from do_ide_pci_setup_device, but is also used directly as a helper function by some controllers where the chipset setup is not the default PCI IDE one. */ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, struct ide_hw *hw, struct ide_hw **hws)
{ int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; u8 tmp; for (port = 0; port < channels; ++port) { const struct ide_pci_enablebit *e = &d->enablebits[port]; if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || (tmp & e->mask) != e->val)) { printk(KERN_INFO "%s %s: IDE port disable...
robutest/uclinux
C++
GPL-2.0
60
/* Set the contents of a G_TYPE_INT #GValue to @v_int. */
void g_value_set_int(GValue *value, gint v_int)
/* Set the contents of a G_TYPE_INT #GValue to @v_int. */ void g_value_set_int(GValue *value, gint v_int)
{ g_return_if_fail (G_VALUE_HOLDS_INT (value)); value->data[0].v_int = v_int; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configure the root GUI window. Configures the root window background to be a tiled version of the Atmel company logo, and sets it as being visible. */
static void setup_gui_root_window(void)
/* Configure the root GUI window. Configures the root window background to be a tiled version of the Atmel company logo, and sets it as being visible. */ static void setup_gui_root_window(void)
{ struct win_attributes root_attr; struct win_window *win_root; win_root = win_get_root(); root_attr = *win_get_attributes(win_root); root_attr.background = &atmel_logo_small; win_set_attributes(win_root, &root_attr, WIN_ATTR_BACKGROUND); win_show(win_root); }
memfault/zero-to-main
C++
null
200
/* We are given a zone id and the MAS bitmap of bits that need to be set in this zone. Note that this zone may already have bits set and this only adds settings - we cannot simply assign the MAS bitmap contents to the zone contents. We iterate over the the bits (MAS) in the zone and set the bits that are set in the giv...
static void uwb_drp_ie_single_zone_to_bm(struct uwb_mas_bm *bm, u8 zone, u16 mas_bm)
/* We are given a zone id and the MAS bitmap of bits that need to be set in this zone. Note that this zone may already have bits set and this only adds settings - we cannot simply assign the MAS bitmap contents to the zone contents. We iterate over the the bits (MAS) in the zone and set the bits that are set in the giv...
{ int mas; u16 mas_mask; for (mas = 0; mas < UWB_MAS_PER_ZONE; mas++) { mas_mask = 1 << mas; if (mas_bm & mas_mask) set_bit(zone * UWB_NUM_ZONES + mas, bm->bm); } }
robutest/uclinux
C++
GPL-2.0
60
/* The function informs that host has received an event. */
__weak void USBH_MTP_EventsCallback(USBH_HandleTypeDef *phost, uint32_t event, uint32_t param)
/* The function informs that host has received an event. */ __weak void USBH_MTP_EventsCallback(USBH_HandleTypeDef *phost, uint32_t event, uint32_t param)
{ UNUSED(phost); UNUSED(event); UNUSED(param); }
ua1arn/hftrx
C++
null
69
/* The return value is the disposition of the chunk. */
sctp_disposition_t sctp_sf_do_5_2_1_siminit(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands)
/* The return value is the disposition of the chunk. */ sctp_disposition_t sctp_sf_do_5_2_1_siminit(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands)
{ return sctp_sf_do_unexpected_init(ep, asoc, type, arg, commands); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for handling the BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice. */
static void on_disconnect(ble_nus_t *p_nus, ble_evt_t *p_ble_evt)
/* Function for handling the BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice. */ static void on_disconnect(ble_nus_t *p_nus, ble_evt_t *p_ble_evt)
{ UNUSED_PARAMETER(p_ble_evt); p_nus->conn_handle = BLE_CONN_HANDLE_INVALID; }
labapart/polymcu
C++
null
201
/* Return Value: TRUE if succeeded; FALSE if failed. */
BOOL CARDbAddBasicRate(PVOID pDeviceHandler, WORD wRateIdx)
/* Return Value: TRUE if succeeded; FALSE if failed. */ BOOL CARDbAddBasicRate(PVOID pDeviceHandler, WORD wRateIdx)
{ PSDevice pDevice = (PSDevice) pDeviceHandler; WORD wRate = (WORD)(1<<wRateIdx); pDevice->wBasicRate |= wRate; CARDvUpdateBasicTopRate(pDevice); return(TRUE); }
robutest/uclinux
C++
GPL-2.0
60
/* Setup function invoked at boot to parse the dtc3181e= command line. */
static int __init do_DTC3181E_setup(char *str)
/* Setup function invoked at boot to parse the dtc3181e= command line. */ static int __init do_DTC3181E_setup(char *str)
{ int ints[10]; get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_DTC3181E, str, ints); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Setup the channel structures that are uv specific. */
static enum xp_retval xpc_setup_ch_structures_uv(struct xpc_partition *part)
/* Setup the channel structures that are uv specific. */ static enum xp_retval xpc_setup_ch_structures_uv(struct xpc_partition *part)
{ struct xpc_channel_uv *ch_uv; int ch_number; for (ch_number = 0; ch_number < part->nchannels; ch_number++) { ch_uv = &part->channels[ch_number].sn.uv; xpc_init_fifo_uv(&ch_uv->msg_slot_free_list); xpc_init_fifo_uv(&ch_uv->recv_msg_list); } return xpSuccess; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified DMAy Channelx flag is set or not. */
FlagStatus DMA_GetFlagStatus(uint32_t DMAyFlag, DMA_Module *DMAy)
/* Checks whether the specified DMAy Channelx flag is set or not. */ FlagStatus DMA_GetFlagStatus(uint32_t DMAyFlag, DMA_Module *DMAy)
{ FlagStatus bitstatus = RESET; uint32_t tmpregister = 0; assert_param(IS_DMA_GET_FLAG(DMAyFlag)); tmpregister = DMAy->INTSTS; if ((tmpregister & DMAyFlag) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables the TIM peripheral Main Outputs. */
void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables the TIM peripheral Main Outputs. */ void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_18_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->BDTR |= BDTR_MOE_Set; } else { TIMx->BDTR &= BDTR_MOE_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* returns 1 if the end block is EXT3_RESERVE_WINDOW_NOT_ALLOCATED. */
static int rsv_is_empty(struct ext3_reserve_window *rsv)
/* returns 1 if the end block is EXT3_RESERVE_WINDOW_NOT_ALLOCATED. */ static int rsv_is_empty(struct ext3_reserve_window *rsv)
{ return rsv->_rsv_end == EXT3_RESERVE_WINDOW_NOT_ALLOCATED; }
robutest/uclinux
C++
GPL-2.0
60
/* If user space is running rpcbind, it should take the v4 UNSET and clear everything for this . If user space is running portmap, it will reject the v4 UNSET, but won't have any "inet6" entries anyway. So a PMAP_UNSET should be sufficient in this case to clear all existing entries for . */
static void __svc_unregister(const u32 program, const u32 version, const char *progname)
/* If user space is running rpcbind, it should take the v4 UNSET and clear everything for this . If user space is running portmap, it will reject the v4 UNSET, but won't have any "inet6" entries anyway. So a PMAP_UNSET should be sufficient in this case to clear all existing entries for . */ static void __svc_unregiste...
{ int error; error = rpcb_v4_register(program, version, NULL, ""); if (error == -EPROTONOSUPPORT) error = rpcb_register(program, version, 0, 0); dprintk("svc: %s(%sv%u), error %d\n", __func__, progname, version, error); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: Remove the specified IP address entry. The caller is responsible for calling the necessary locking functions. */
void netlbl_af4list_remove_entry(struct netlbl_af4list *entry)
/* Description: Remove the specified IP address entry. The caller is responsible for calling the necessary locking functions. */ void netlbl_af4list_remove_entry(struct netlbl_af4list *entry)
{ entry->valid = 0; list_del_rcu(&entry->list); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Work around broken HP Pavilion Notebooks which assign USB to IRQ 9 even though it is actually wired to IRQ 11 */
static int __init fix_broken_hp_bios_irq9(const struct dmi_system_id *d)
/* Work around broken HP Pavilion Notebooks which assign USB to IRQ 9 even though it is actually wired to IRQ 11 */ static int __init fix_broken_hp_bios_irq9(const struct dmi_system_id *d)
{ if (!broken_hp_bios_irq9) { broken_hp_bios_irq9 = 1; printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function to receive the given encapsulated RNDIS response from the device. */
uint8_t RNDIS_GetEncapsulatedResponse(void *const Buffer, const uint16_t Length)
/* Function to receive the given encapsulated RNDIS response from the device. */ uint8_t RNDIS_GetEncapsulatedResponse(void *const Buffer, const uint16_t Length)
{ USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), .bRequest = RNDIS_REQ_GetEncapsulatedResponse, .wValue = 0, .wIndex = 0, .wLength = Length, }; Pipe_SelectPipe(PIPE_CONTROLPIPE); return USB_Host_Send...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* API to assign the event handler function to be executed on occurrence of the selected event. */
XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(const XMC_SCU_INTERRUPT_EVENT_t event, const XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler)
/* API to assign the event handler function to be executed on occurrence of the selected event. */ XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(const XMC_SCU_INTERRUPT_EVENT_t event, const XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler)
{ index++; } if (index == XMC_SCU_INTERRUPT_EVENT_MAX) { status = XMC_SCU_STATUS_ERROR; } else { event_handler_list[index] = handler; status = XMC_SCU_STATUS_OK; } return (status); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This is a wrapper function for consistent dma-able Memory allocation routine. In linux Kernel, it depends on pci dev structure */
void* plat_alloc_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, u32 *addr)
/* This is a wrapper function for consistent dma-able Memory allocation routine. In linux Kernel, it depends on pci dev structure */ void* plat_alloc_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, u32 *addr)
{ void *buf; buf = (void *)rt_malloc((u32)(size + 16)); unsigned long i = (unsigned long)buf; if (i % 16 == 8) { i += 8; } else if (i % 16 == 4) { i += 12; } else if (i % 16 == 12) { i += 4; } flush_cache(i, size); *addr = gmac_dmamap(i, si...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* In this part of the file, we handle the various record types, and communications with the handshake processor. */
void br_ssl_engine_set_suites(br_ssl_engine_context *cc, const uint16_t *suites, size_t suites_num)
/* In this part of the file, we handle the various record types, and communications with the handshake processor. */ void br_ssl_engine_set_suites(br_ssl_engine_context *cc, const uint16_t *suites, size_t suites_num)
{ if ((suites_num * sizeof *suites) > sizeof cc->suites_buf) { br_ssl_engine_fail(cc, BR_ERR_BAD_PARAM); return; } memcpy(cc->suites_buf, suites, suites_num * sizeof *suites); cc->suites_num = suites_num; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Called to process any unsolicted frames from this remote port */
void bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport)
/* Called to process any unsolicted frames from this remote port */ void bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport)
{ bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); }
robutest/uclinux
C++
GPL-2.0
60
/* Determines if there is any space in the transmit FIFO. */
xtBoolean xUARTSpaceAvail(unsigned long ulBase)
/* Determines if there is any space in the transmit FIFO. */ xtBoolean xUARTSpaceAvail(unsigned long ulBase)
{ return UARTFIFOTxIsEmpty(ulBase); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The current device is removed, the USB layer tell us to shut it down... */
static void kingsun_disconnect(struct usb_interface *intf)
/* The current device is removed, the USB layer tell us to shut it down... */ static void kingsun_disconnect(struct usb_interface *intf)
{ struct kingsun_cb *kingsun = usb_get_intfdata(intf); if (!kingsun) return; unregister_netdev(kingsun->netdev); if (kingsun->tx_urb != NULL) { usb_kill_urb(kingsun->tx_urb); usb_free_urb(kingsun->tx_urb); kingsun->tx_urb = NULL; } if (kingsun->rx_urb != NULL) { usb_kill_urb(kingsun->rx_urb); usb_free...
robutest/uclinux
C++
GPL-2.0
60
/* Transmits the L2CAP payload contained in the specified mbuf. The supplied mbuf is consumed, regardless of the outcome of the function call. */
int ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan, struct os_mbuf *txom)
/* Transmits the L2CAP payload contained in the specified mbuf. The supplied mbuf is consumed, regardless of the outcome of the function call. */ int ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan, struct os_mbuf *txom)
{ int rc; txom = ble_l2cap_prepend_hdr(txom, chan->dcid, OS_MBUF_PKTLEN(txom)); if (txom == NULL) { return BLE_HS_ENOMEM; } rc = ble_hs_hci_acl_tx(conn, &txom); switch (rc) { case 0: return 0; case BLE_HS_EAGAIN: STAILQ_INSERT_TAIL(&conn->bhc_tx_q, OS_MBUF_PKTHDR(...
Nicholas3388/LuaNode
C++
Other
1,055
/* Stop the I2C transaction. This closes out the link, sending a bare address packet with the MOT bit turned off */
static void i2c_algo_dp_aux_stop(struct i2c_adapter *adapter, bool reading)
/* Stop the I2C transaction. This closes out the link, sending a bare address packet with the MOT bit turned off */ static void i2c_algo_dp_aux_stop(struct i2c_adapter *adapter, bool reading)
{ struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data; int mode = MODE_I2C_STOP; if (reading) mode |= MODE_I2C_READ; else mode |= MODE_I2C_WRITE; if (algo_data->running) { (void) i2c_algo_dp_aux_transaction(adapter, mode, 0, NULL); algo_data->running = false; } }
robutest/uclinux
C++
GPL-2.0
60
/* Reset Peripheral, hold. Reset particular peripheral, and hold in reset state. */
void rcc_periph_reset_hold(enum rcc_periph_rst rst)
/* Reset Peripheral, hold. Reset particular peripheral, and hold in reset state. */ void rcc_periph_reset_hold(enum rcc_periph_rst rst)
{ _RCC_REG(rst) |= _RCC_BIT(rst); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* TIM_PWM MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim_pwm)
/* TIM_PWM MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim_pwm)
{ if(htim_pwm->Instance==TIM1) { __HAL_RCC_TIM1_CLK_ENABLE(); } else if(htim_pwm->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if(htim_pwm->Instance==TIM4) { __HAL_RCC_TIM4_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* IDL typedef struct { IDL long num_deltas; IDL DELTA_ENUM *delta_enum; IDL } DELTA_ENUM_ARRAY; */
static int netlogon_dissect_DELTA_ENUM_ARRAY(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL typedef struct { IDL long num_deltas; IDL DELTA_ENUM *delta_enum; IDL } DELTA_ENUM_ARRAY; */ static int netlogon_dissect_DELTA_ENUM_ARRAY(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_netlogon_num_deltas, NULL); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, netlogon_dissect_DELTA_ENUM_array, NDR_POINTER_UNIQUE, ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the socket is in CLOSE or CLOSE_WAIT we should not close the connection if there is still some data pending. */
static int iscsi_sw_sk_state_check(struct sock *sk)
/* If the socket is in CLOSE or CLOSE_WAIT we should not close the connection if there is still some data pending. */ static int iscsi_sw_sk_state_check(struct sock *sk)
{ struct iscsi_conn *conn = (struct iscsi_conn*)sk->sk_user_data; if ((sk->sk_state == TCP_CLOSE_WAIT || sk->sk_state == TCP_CLOSE) && !atomic_read(&sk->sk_rmem_alloc)) { ISCSI_SW_TCP_DBG(conn, "TCP_CLOSE|TCP_CLOSE_WAIT\n"); iscsi_conn_failure(conn, ISCSI_ERR_TCP_CONN_CLOSE); return -ECONNRESET; } return...
robutest/uclinux
C++
GPL-2.0
60
/* acpiphp_get_num_slots - count number of slots in a system */
int __init acpiphp_get_num_slots(void)
/* acpiphp_get_num_slots - count number of slots in a system */ int __init acpiphp_get_num_slots(void)
{ struct acpiphp_bridge *bridge; int num_slots = 0; list_for_each_entry(bridge, &bridge_list, list) { dbg("Bus %04x:%02x has %d slot%s\n", pci_domain_nr(bridge->pci_bus), bridge->pci_bus->number, bridge->nr_slots, bridge->nr_slots == 1 ? "" : "s"); num_slots += bridge->nr_slots; } dbg("Total %d slo...
robutest/uclinux
C++
GPL-2.0
60
/* Additionally, a DMA bus error may be signaled using */
uint32_t EMACDMAStateGet(uint32_t ui32Base)
/* Additionally, a DMA bus error may be signaled using */ uint32_t EMACDMAStateGet(uint32_t ui32Base)
{ return(HWREG(ui32Base + EMAC_O_DMARIS) & (EMAC_DMARIS_FBI | EMAC_DMARIS_AE_M | EMAC_DMARIS_RS_M | EMAC_DMARIS_TS_M)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function cleans up an '8254' counter subdevice. */
static void dio200_subdev_8254_cleanup(struct comedi_device *dev, struct comedi_subdevice *s)
/* This function cleans up an '8254' counter subdevice. */ static void dio200_subdev_8254_cleanup(struct comedi_device *dev, struct comedi_subdevice *s)
{ struct dio200_subdev_intr *subpriv = s->private; if (subpriv) { kfree(subpriv); } }
robutest/uclinux
C++
GPL-2.0
60
/* param base CSI peripheral base address. param mask The interrupts to enable, pass in as OR'ed value of ref _csi_interrupt_enable. */
void CSI_EnableInterrupts(CSI_Type *base, uint32_t mask)
/* param base CSI peripheral base address. param mask The interrupts to enable, pass in as OR'ed value of ref _csi_interrupt_enable. */ void CSI_EnableInterrupts(CSI_Type *base, uint32_t mask)
{ CSI_REG_CR1(base) |= (mask & CSI_CR1_INT_EN_MASK); CSI_REG_CR3(base) |= (mask & CSI_CR3_INT_EN_MASK); CSI_REG_CR18(base) |= ((mask & CSI_CR18_INT_EN_MASK) >> 6U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535