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
/* The current device is removed, the USB layer tell us to shut it down... */
static void stir_disconnect(struct usb_interface *intf)
/* The current device is removed, the USB layer tell us to shut it down... */ static void stir_disconnect(struct usb_interface *intf)
{ struct stir_cb *stir = usb_get_intfdata(intf); if (!stir) return; unregister_netdev(stir->netdev); free_netdev(stir->netdev); usb_set_intfdata(intf, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* The functions for inserting/removing us as a module. */
static int __init magellan_init(void)
/* The functions for inserting/removing us as a module. */ static int __init magellan_init(void)
{ return serio_register_driver(&magellan_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Wakeup Pin. The wakeup pin is used for waking the processor from standby mode. */
void pwr_enable_wakeup_pin(void)
/* Enable Wakeup Pin. The wakeup pin is used for waking the processor from standby mode. */ void pwr_enable_wakeup_pin(void)
{ PWR_CSR |= PWR_CSR_EWUP; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Message: StartMultiMediaTransmissionAckMessage Opcode: 0x0155 Type: MediaControl Direction: pbx2dev VarLength: no */
static void handle_StartMultiMediaTransmissionAckMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: StartMultiMediaTransmissionAckMessage Opcode: 0x0155 Type: MediaControl Direction: pbx2dev VarLength: no */ static void handle_StartMultiMediaTransmissionAckMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_passThruPartyID, 4, ENC_LITTLE_ENDIAN); si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN); dissect_skinny_ipv4or6(cursor, hf_skinny_transmitIpAddr_ipv4, hf_skinny_transmitIpAddr_ipv6, pinfo); ptvcursor_add(cursor, hf_skinny_transmitPort, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_resultCode, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Selects the Output Data Rate of the device. */
int adxl367_set_output_rate(const struct device *dev, enum adxl367_odr odr)
/* Selects the Output Data Rate of the device. */ int adxl367_set_output_rate(const struct device *dev, enum adxl367_odr odr)
{ struct adxl367_data *data = dev->data; return data->hw_tf->write_reg_mask(dev, ADXL367_FILTER_CTL, ADXL367_FILTER_CTL_ODR_MSK, FIELD_PREP(ADXL367_FILTER_CTL_ODR_MSK, odr)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Enables the specified DAC channel DMA request. When enabled DMA1 is generated when an external trigger (EINT Line9, TMR2, TMR3, TMR6 or TMR15 but not a software trigger) occurs. */
void DAC_EnableDMA(DAC_CHANNEL_T channel)
/* Enables the specified DAC channel DMA request. When enabled DMA1 is generated when an external trigger (EINT Line9, TMR2, TMR3, TMR6 or TMR15 but not a software trigger) occurs. */ void DAC_EnableDMA(DAC_CHANNEL_T channel)
{ if(channel == DAC_CHANNEL_1) { DAC->CTRL_B.DMAENCH1 = SET; } else { DAC->CTRL_B.DMAENCH2 = SET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Lock the Flash Program and Erase Controller, upper Bank. Used to prevent spurious writes to FLASH. */
void flash_lock_upper(void)
/* Lock the Flash Program and Erase Controller, upper Bank. Used to prevent spurious writes to FLASH. */ void flash_lock_upper(void)
{ FLASH_CR2 |= FLASH_CR_LOCK; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* ppc440spe_adma_err_handler - DMA error interrupt handler; do the same things as a eot handler */
static irqreturn_t ppc440spe_adma_err_handler(int irq, void *data)
/* ppc440spe_adma_err_handler - DMA error interrupt handler; do the same things as a eot handler */ static irqreturn_t ppc440spe_adma_err_handler(int irq, void *data)
{ struct ppc440spe_adma_chan *chan = data; dev_dbg(chan->device->common.dev, "ppc440spe adma%d: %s\n", chan->device->id, __func__); tasklet_schedule(&chan->irq_tasklet); ppc440spe_adma_device_clear_eot_status(chan); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Use xfs_imap() to determine the size and location of the buffer to read from disk. */
int xfs_inotobp(xfs_mount_t *mp, xfs_trans_t *tp, xfs_ino_t ino, xfs_dinode_t **dipp, xfs_buf_t **bpp, int *offset, uint imap_flags)
/* Use xfs_imap() to determine the size and location of the buffer to read from disk. */ int xfs_inotobp(xfs_mount_t *mp, xfs_trans_t *tp, xfs_ino_t ino, xfs_dinode_t **dipp, xfs_buf_t **bpp, int *offset, uint imap_flags)
{ struct xfs_imap imap; xfs_buf_t *bp; int error; imap.im_blkno = 0; error = xfs_imap(mp, tp, ino, &imap, imap_flags); if (error) return error; error = xfs_imap_to_bp(mp, tp, &imap, &bp, XFS_BUF_LOCK, imap_flags); if (error) return error; *dipp = (xfs_dinode_t *)xfs_buf_offset(bp, imap.im_boffset); *bpp = bp; *offset = imap.im_boffset; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function stops the operation of the davinci usb module. */
int usb_lowlevel_stop(void)
/* This function stops the operation of the davinci usb module. */ int usb_lowlevel_stop(void)
{ musb_platform_deinit(); writeb(0, &musbr->devctl); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Called to indicate a device has changed state. This function calls the notifier chains for netdev_chain and sends a NEWLINK message to the routing socket. */
void netdev_state_change(struct net_device *dev)
/* Called to indicate a device has changed state. This function calls the notifier chains for netdev_chain and sends a NEWLINK message to the routing socket. */ void netdev_state_change(struct net_device *dev)
{ if (dev->flags & IFF_UP) { call_netdevice_notifiers(NETDEV_CHANGE, dev); rtmsg_ifinfo(RTM_NEWLINK, dev, 0); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called when initializing the board. Sets up the name and hooks up the callbacks */
static int snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device)
/* Called when initializing the board. Sets up the name and hooks up the callbacks */ static int snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device)
{ struct snd_pcm *pcm; int err; if ((err = snd_pcm_new(saa7134->card, "SAA7134 PCM", device, 0, 1, &pcm)) < 0) return err; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_saa7134_capture_ops); pcm->private_data = saa7134; pcm->info_flags = 0; strcpy(pcm->name, "SAA7134 PCM"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Create a new special memory pool that can be used to manage special purpose memory not managed by the regular kmalloc/kfree interface. */
struct gen_pool* gen_pool_create(int min_alloc_order, int nid)
/* Create a new special memory pool that can be used to manage special purpose memory not managed by the regular kmalloc/kfree interface. */ struct gen_pool* gen_pool_create(int min_alloc_order, int nid)
{ struct gen_pool *pool; pool = kmalloc_node(sizeof(struct gen_pool), GFP_KERNEL, nid); if (pool != NULL) { rwlock_init(&pool->lock); INIT_LIST_HEAD(&pool->chunks); pool->min_alloc_order = min_alloc_order; } return pool; }
robutest/uclinux
C++
GPL-2.0
60
/* Populates the given context buffer so it can be passed to a PRM handler. */
EFI_STATUS PopulateContextBuffer(IN PRM_DATA_BUFFER *StaticDataBuffer OPTIONAL, IN EFI_GUID *HandlerGuid, IN PRM_CONTEXT_BUFFER *ContextBuffer)
/* Populates the given context buffer so it can be passed to a PRM handler. */ EFI_STATUS PopulateContextBuffer(IN PRM_DATA_BUFFER *StaticDataBuffer OPTIONAL, IN EFI_GUID *HandlerGuid, IN PRM_CONTEXT_BUFFER *ContextBuffer)
{ if ((HandlerGuid == NULL) || (ContextBuffer == NULL)) { return EFI_INVALID_PARAMETER; } ZeroMem (ContextBuffer, sizeof (*ContextBuffer)); ContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE; ContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION; CopyGuid (&ContextBuffer->HandlerGuid, HandlerGuid); if (StaticDataBuffer != NULL) { ContextBuffer->StaticDataBuffer = StaticDataBuffer; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This is the timer function used to defer reader waking. */
static void wakeup_readers(unsigned long data)
/* This is the timer function used to defer reader waking. */ static void wakeup_readers(unsigned long data)
{ struct rchan_buf *buf = (struct rchan_buf *)data; wake_up_interruptible(&buf->read_wait); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write to the SoundScape's control registers, and do the necessary locking ... */
static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char val)
/* Write to the SoundScape's control registers, and do the necessary locking ... */ static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char val)
{ unsigned long flags; spin_lock_irqsave(&s->lock, flags); sscape_write_unsafe(s->io_base, reg, val); spin_unlock_irqrestore(&s->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* This function works exactly like ubi_leb_read_sg(). But instead of storing the read data into a buffer it writes to an UBI scatter gather list. */
int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, int offset, int len, int check)
/* This function works exactly like ubi_leb_read_sg(). But instead of storing the read data into a buffer it writes to an UBI scatter gather list. */ int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, int offset, int len, int check)
{ struct ubi_volume *vol = desc->vol; struct ubi_device *ubi = vol->ubi; int err, vol_id = vol->vol_id; dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); err = leb_read_sanity_check(desc, lnum, offset, len); if (err < 0) return err; if (len == 0) return 0; err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { ubi_warn(ubi, "mark volume %d as corrupted", vol_id); vol->corrupted = 1; } return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: -EINVAL if the buffer does not contain lpfc_soft_wwn_key length of buf indicates success */
static ssize_t lpfc_soft_wwn_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
/* Returns: -EINVAL if the buffer does not contain lpfc_soft_wwn_key length of buf indicates success */ static ssize_t lpfc_soft_wwn_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ struct Scsi_Host *shost = class_to_shost(dev); struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; struct lpfc_hba *phba = vport->phba; unsigned int cnt = count; if (buf[cnt-1] == '\n') cnt--; if ((cnt != strlen(lpfc_soft_wwn_key)) || (strncmp(buf, lpfc_soft_wwn_key, strlen(lpfc_soft_wwn_key)) != 0)) return -EINVAL; phba->soft_wwn_enable = 1; return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Determines if the specified EKUs are present in a signing certificate. */
EFI_STATUS CheckEKUs(IN CONST VOID *SignerCert, IN CONST CHAR8 *RequiredEKUs[], IN CONST UINT32 RequiredEKUsSize, IN BOOLEAN RequireAllPresent)
/* Determines if the specified EKUs are present in a signing certificate. */ EFI_STATUS CheckEKUs(IN CONST VOID *SignerCert, IN CONST CHAR8 *RequiredEKUs[], IN CONST UINT32 RequiredEKUsSize, IN BOOLEAN RequireAllPresent)
{ ASSERT (FALSE); return EFI_NOT_READY; }
tianocore/edk2
C++
Other
4,240
/* Set the PHY speed and duplex. This also disables auto-negotiation, except for 1Gb/s, where auto-negotiation is mandatory. */
static int mv88e1xxx_set_speed_duplex(struct cphy *phy, int speed, int duplex)
/* Set the PHY speed and duplex. This also disables auto-negotiation, except for 1Gb/s, where auto-negotiation is mandatory. */ static int mv88e1xxx_set_speed_duplex(struct cphy *phy, int speed, int duplex)
{ u32 ctl; (void) simple_mdio_read(phy, MII_BMCR, &ctl); if (speed >= 0) { ctl &= ~(BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE); if (speed == SPEED_100) ctl |= BMCR_SPEED100; else if (speed == SPEED_1000) ctl |= BMCR_SPEED1000; } if (duplex >= 0) { ctl &= ~(BMCR_FULLDPLX | BMCR_ANENABLE); if (duplex == DUPLEX_FULL) ctl |= BMCR_FULLDPLX; } if (ctl & BMCR_SPEED1000) ctl |= BMCR_ANENABLE; (void) simple_mdio_write(phy, MII_BMCR, ctl); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear transmit underrun error flag @rmtoll ICR CTXUNRF LL_SWPMI_ClearFlag_TXUNR. */
void LL_SWPMI_ClearFlag_TXUNR(SWPMI_TypeDef *SWPMIx)
/* Clear transmit underrun error flag @rmtoll ICR CTXUNRF LL_SWPMI_ClearFlag_TXUNR. */ void LL_SWPMI_ClearFlag_TXUNR(SWPMI_TypeDef *SWPMIx)
{ WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTXUNRF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Checks whether the specified ETHERNET DMA overflow flag is set or not. */
FlagStatus ETH_GetDmaOverflowStatus(uint32_t ETH_DMA_Overflow)
/* Checks whether the specified ETHERNET DMA overflow flag is set or not. */ FlagStatus ETH_GetDmaOverflowStatus(uint32_t ETH_DMA_Overflow)
{ FlagStatus bitstatus = RESET; assert_param(IS_ETH_DMA_GET_OVERFLOW(ETH_DMA_Overflow)); if ((ETH->DMAMFBOCNT & ETH_DMA_Overflow) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unregisters an interrupt handler for the USB controller. */
void USBIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for the USB controller. */ void USBIntUnregister(unsigned long ulBase)
{ ASSERT(ulBase == USB0_BASE); IntUnregister(INT_USB0); IntDisable(INT_USB0); }
watterott/WebRadio
C++
null
71
/* Given the PCI bus a device resides on, the size, minimum address, alignment and type, try to find an acceptable resource allocation for a specific device resource. */
int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, resource_size_t size, resource_size_t align, resource_size_t min, unsigned int type_mask, void(*alignf)(void *, struct resource *, resource_size_t, resource_size_t), void *alignf_data)
/* Given the PCI bus a device resides on, the size, minimum address, alignment and type, try to find an acceptable resource allocation for a specific device resource. */ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, resource_size_t size, resource_size_t align, resource_size_t min, unsigned int type_mask, void(*alignf)(void *, struct resource *, resource_size_t, resource_size_t), void *alignf_data)
{ int i, ret = -ENOMEM; resource_size_t max = -1; type_mask |= IORESOURCE_IO | IORESOURCE_MEM; if (!(res->flags & IORESOURCE_MEM_64)) max = PCIBIOS_MAX_MEM_32; for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { struct resource *r = bus->resource[i]; if (!r) continue; if ((res->flags ^ r->flags) & type_mask) continue; if ((r->flags & IORESOURCE_PREFETCH) && !(res->flags & IORESOURCE_PREFETCH)) continue; ret = allocate_resource(r, res, size, r->start ? : min, max, align, alignf, alignf_data); if (ret == 0) break; } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Destroys the current instance of #CRAttrSel. Frees all the fields if they are non null. */
void cr_attr_sel_destroy(CRAttrSel *a_this)
/* Destroys the current instance of #CRAttrSel. Frees all the fields if they are non null. */ void cr_attr_sel_destroy(CRAttrSel *a_this)
{ g_return_if_fail (a_this); if (a_this->name) { cr_string_destroy (a_this->name); a_this->name = NULL; } if (a_this->value) { cr_string_destroy (a_this->value); a_this->value = NULL; } if (a_this->next) { cr_attr_sel_destroy (a_this->next); a_this->next = NULL; } if (a_this) { g_free (a_this); a_this = NULL; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initialize master decompression control and select active modules. This is performed at the start of jpeg_start_decompress. */
jinit_master_decompress(j_decompress_ptr cinfo)
/* Initialize master decompression control and select active modules. This is performed at the start of jpeg_start_decompress. */ jinit_master_decompress(j_decompress_ptr cinfo)
{ my_master_ptr master; master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_decomp_master)); cinfo->master = &master->pub; master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.finish_output_pass = finish_output_pass; master->pub.is_dummy_pass = FALSE; master_selection(cinfo); }
xboot/xboot
C++
MIT License
779
/* Enables or disables the TIM Capture Compare Channel xN. */
void TIM_CCxNCmd(TIM_TypeDef *tim, TIMCHx_Typedef channel, TIMCCxNE_Typedef ccxn_en)
/* Enables or disables the TIM Capture Compare Channel xN. */ void TIM_CCxNCmd(TIM_TypeDef *tim, TIMCHx_Typedef channel, TIMCCxNE_Typedef ccxn_en)
{ if (channel != TIM_Channel_4) MODIFY_REG(tim->CCER, TIM_CCER_CC1NEN << channel, ccxn_en << channel); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function searches the @phba for a vport that matches the content of the @fc_hdr passed in and the @fcfi. This function uses the @fc_hdr to fetch the VFI, if the Virtual Fabric Tagging Header exists, and the DID. This function returns the matching vport pointer or NULL if unable to match frame to a vport. */
static struct lpfc_vport* lpfc_fc_frame_to_vport(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr, uint16_t fcfi)
/* This function searches the @phba for a vport that matches the content of the @fc_hdr passed in and the @fcfi. This function uses the @fc_hdr to fetch the VFI, if the Virtual Fabric Tagging Header exists, and the DID. This function returns the matching vport pointer or NULL if unable to match frame to a vport. */ static struct lpfc_vport* lpfc_fc_frame_to_vport(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr, uint16_t fcfi)
{ struct lpfc_vport **vports; struct lpfc_vport *vport = NULL; int i; uint32_t did = (fc_hdr->fh_d_id[0] << 16 | fc_hdr->fh_d_id[1] << 8 | fc_hdr->fh_d_id[2]); vports = lpfc_create_vport_work_array(phba); if (vports != NULL) for (i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) { if (phba->fcf.fcfi == fcfi && vports[i]->vfi == lpfc_fc_hdr_get_vfi(fc_hdr) && vports[i]->fc_myDID == did) { vport = vports[i]; break; } } lpfc_destroy_vport_work_array(phba, vports); return vport; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the Programmable Voltage Detector (PVD) levels . */
void PWR_PVDLevelConfig(PWR_PVDLevel_TypeDef PWR_PVDLevel)
/* Configures the Programmable Voltage Detector (PVD) levels . */ void PWR_PVDLevelConfig(PWR_PVDLevel_TypeDef PWR_PVDLevel)
{ assert_param(IS_PWR_PVD_LEVEL(PWR_PVDLevel)); PWR->CSR1 &= (uint8_t)(~PWR_CSR1_PLS); PWR->CSR1 |= PWR_PVDLevel; }
remotemcu/remcu-chip-sdks
C++
null
436
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ if(hspi->Instance==SPI3) { __HAL_RCC_SPI3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param handle The RTOS I2C handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the I2C instance to initialize. param masterConfig Configuration structure to set-up I2C in master mode. param srcClock_Hz Frequency of input clock of the I2C module. return status of the operation. */
status_t I2C_RTOS_Init(i2c_rtos_handle_t *handle, I2C_Type *base, const i2c_master_config_t *masterConfig, uint32_t srcClock_Hz)
/* param handle The RTOS I2C handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the I2C instance to initialize. param masterConfig Configuration structure to set-up I2C in master mode. param srcClock_Hz Frequency of input clock of the I2C module. return status of the operation. */ status_t I2C_RTOS_Init(i2c_rtos_handle_t *handle, I2C_Type *base, const i2c_master_config_t *masterConfig, uint32_t srcClock_Hz)
{ if (handle == NULL) { return kStatus_InvalidArgument; } if (base == NULL) { return kStatus_InvalidArgument; } (void)memset(handle, 0, sizeof(i2c_rtos_handle_t)); handle->mutex = xSemaphoreCreateMutex(); if (handle->mutex == NULL) { return kStatus_Fail; } handle->semaphore = xSemaphoreCreateBinary(); if (handle->semaphore == NULL) { vSemaphoreDelete(handle->mutex); return kStatus_Fail; } handle->base = base; I2C_MasterInit(handle->base, masterConfig, srcClock_Hz); I2C_MasterTransferCreateHandle(base, &handle->drv_handle, I2C_RTOS_Callback, (void *)handle); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USBD_CtlContinueRx continue receive data on the ctl pipe. */
USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
/* USBD_CtlContinueRx continue receive data on the ctl pipe. */ USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
{ USBD_LL_PrepareReceive (pdev, 0, pbuf, len); return USBD_OK; }
micropython/micropython
C++
Other
18,334
/* A missing specifier is not considered an error. */
static int parseTimezone(const char *zDate, DateTime *p)
/* A missing specifier is not considered an error. */ static int parseTimezone(const char *zDate, DateTime *p)
{ int sgn = 0; int nHr, nMn; int c; while( sqlite3Isspace(*zDate) ){ zDate++; } p->tz = 0; c = *zDate; if( c=='-' ){ sgn = -1; }else if( c=='+' ){ sgn = +1; }else if( c=='Z' || c=='z' ){ zDate++; goto zulu_time; }else{ return c!=0; } zDate++; if( getDigits(zDate, 2, 0, 14, ':', &nHr, 2, 0, 59, 0, &nMn)!=2 ){ return 1; } zDate += 5; p->tz = sgn*(nMn + nHr*60); zulu_time: while( sqlite3Isspace(*zDate) ){ zDate++; } return *zDate!=0; }
DC-SWAT/DreamShell
C++
null
404
/* Delay loop to delay at least n number of milliseconds. */
void delay_cycles_ms(uint32_t n)
/* Delay loop to delay at least n number of milliseconds. */ void delay_cycles_ms(uint32_t n)
{ while (n--) { delay_cycles(cycles_per_ms); } }
memfault/zero-to-main
C++
null
200
/* Disables a GPIO port as a trigger to start a DMA transaction. */
void GPIODMATriggerDisable(unsigned long ulPort)
/* Disables a GPIO port as a trigger to start a DMA transaction. */ void GPIODMATriggerDisable(unsigned long ulPort)
{ ASSERT(GPIOBaseValid(ulPort)); if(ulPort == GPIOA0_BASE) { HWREG(COMMON_REG_BASE + COMMON_REG_O_APPS_GPIO_TRIG_EN) &= ~0x1; } else if(ulPort == GPIOA1_BASE) { HWREG(COMMON_REG_BASE + COMMON_REG_O_APPS_GPIO_TRIG_EN) &= ~0x2; } else if(ulPort == GPIOA2_BASE) { HWREG(COMMON_REG_BASE + COMMON_REG_O_APPS_GPIO_TRIG_EN) &= ~0x4; } else if(ulPort == GPIOA3_BASE) { HWREG(COMMON_REG_BASE + COMMON_REG_O_APPS_GPIO_TRIG_EN) &= ~0x8; } }
micropython/micropython
C++
Other
18,334
/* Ensure that mmap has a recent RPC credential for use when writing out shared pages */
static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
/* Ensure that mmap has a recent RPC credential for use when writing out shared pages */ static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
{ struct inode *inode = filp->f_path.dentry->d_inode; struct nfs_inode *nfsi = NFS_I(inode); filp->private_data = get_nfs_open_context(ctx); spin_lock(&inode->i_lock); list_add(&ctx->list, &nfsi->open_files); spin_unlock(&inode->i_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* This is a helper function for 'tnc_insert()'. When the key of the leftmost zbranch changes, keys of parent znodes have to be corrected. This helper function is called in such situations and corrects the keys if needed. */
static void correct_parent_keys(const struct ubifs_info *c, struct ubifs_znode *znode)
/* This is a helper function for 'tnc_insert()'. When the key of the leftmost zbranch changes, keys of parent znodes have to be corrected. This helper function is called in such situations and corrects the keys if needed. */ static void correct_parent_keys(const struct ubifs_info *c, struct ubifs_znode *znode)
{ union ubifs_key *key, *key1; ubifs_assert(znode->parent); ubifs_assert(znode->iip == 0); key = &znode->zbranch[0].key; key1 = &znode->parent->zbranch[0].key; while (keys_cmp(c, key, key1) < 0) { key_copy(c, key, key1); znode = znode->parent; znode->alt = 1; if (!znode->parent || znode->iip) break; key1 = &znode->parent->zbranch[0].key; } }
EmcraftSystems/u-boot
C++
Other
181
/* It is not legal to sleep in the idle task - print a warning message if some code attempts to do it: */
static void dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep)
/* It is not legal to sleep in the idle task - print a warning message if some code attempts to do it: */ static void dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep)
{ raw_spin_unlock_irq(&rq->lock); printk(KERN_ERR "bad: scheduling from the idle thread!\n"); dump_stack(); raw_spin_lock_irq(&rq->lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* yenta PCI irq probing. currently only used in the TI/EnE initialization code Set static data that doesn't need re-initializing.. */
static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
/* yenta PCI irq probing. currently only used in the TI/EnE initialization code Set static data that doesn't need re-initializing.. */ static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
{ socket->socket.pci_irq = socket->cb_irq; if (isa_probe) socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask); else socket->socket.irq_mask = 0; dev_printk(KERN_INFO, &socket->dev->dev, "ISA IRQ mask 0x%04x, PCI irq %d\n", socket->socket.irq_mask, socket->cb_irq); }
robutest/uclinux
C++
GPL-2.0
60
/* Set a default value for the PWM initialization structure. */
int32_t TMRA_PWM_StructInit(stc_tmra_pwm_init_t *pstcPwmInit)
/* Set a default value for the PWM initialization structure. */ int32_t TMRA_PWM_StructInit(stc_tmra_pwm_init_t *pstcPwmInit)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (pstcPwmInit != NULL) { pstcPwmInit->u32CompareValue = TMRA_REG_VALUE_MAX; pstcPwmInit->u16StartPolarity = TMRA_PWM_HIGH; pstcPwmInit->u16StopPolarity = TMRA_PWM_LOW; pstcPwmInit->u16CompareMatchPolarity = TMRA_PWM_INVT; pstcPwmInit->u16PeriodMatchPolarity = TMRA_PWM_INVT; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(huart->Instance==USART2) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2; PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } __HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* When comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
/* When comes across an instruction which it cannot handle, it takes the undefined instruction trap. */ void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
{ rt_kprintf("undefined instruction\n"); rt_hw_show_register(regs); if (rt_thread_self() != RT_NULL) rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns: (transfer full): A #GFileInfo for the finished query. */
GFileInfo* g_file_output_stream_query_info_finish(GFileOutputStream *stream, GAsyncResult *result, GError **error)
/* Returns: (transfer full): A #GFileInfo for the finished query. */ GFileInfo* g_file_output_stream_query_info_finish(GFileOutputStream *stream, GAsyncResult *result, GError **error)
{ GFileOutputStreamClass *class; g_return_val_if_fail (G_IS_FILE_OUTPUT_STREAM (stream), NULL); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL); if (g_async_result_legacy_propagate_error (result, error)) return NULL; else if (g_async_result_is_tagged (result, g_file_output_stream_query_info_async)) return g_task_propagate_pointer (G_TASK (result), error); class = G_FILE_OUTPUT_STREAM_GET_CLASS (stream); return class->query_info_finish (stream, result, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clears the SPIx CRC Error (CRCERR) interrupt pending bit. */
void SPI_I2S_ClearITPendingBit(SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT)
/* Clears the SPIx CRC Error (CRCERR) interrupt pending bit. */ void SPI_I2S_ClearITPendingBit(SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT)
{ uint16_t itpos = 0; assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_I2S_CLEAR_IT(SPI_I2S_IT)); itpos = (uint16_t)((uint16_t)0x01 << (SPI_I2S_IT & (uint8_t)0x0F)); SPIx->SR = (uint16_t)~itpos; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Set the threshold for activity detection for a single axis */
static int adxl372_set_activity_threshold(const struct device *dev, uint8_t axis_reg_h, const struct adxl372_activity_threshold *act)
/* Set the threshold for activity detection for a single axis */ static int adxl372_set_activity_threshold(const struct device *dev, uint8_t axis_reg_h, const struct adxl372_activity_threshold *act)
{ int ret; uint8_t val; struct adxl372_data *data = dev->data; ret = data->hw_tf->write_reg(dev, axis_reg_h++, act->thresh >> 3); if (ret) { return ret; } switch (axis_reg_h) { case ADXL372_X_THRESH_ACT_L: case ADXL372_X_THRESH_INACT_L: case ADXL372_X_THRESH_ACT2_L: val = (act->thresh << 5) | (act->referenced << 1) | act->enable; break; default: val = (act->thresh << 5) | act->enable; } return data->hw_tf->write_reg(dev, axis_reg_h, val); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the LPS22HH temperature sensor output data rate. */
int32_t LPS22HH_TEMP_SetOutputDataRate(LPS22HH_Object_t *pObj, float Odr)
/* Set the LPS22HH temperature sensor output data rate. */ int32_t LPS22HH_TEMP_SetOutputDataRate(LPS22HH_Object_t *pObj, float Odr)
{ if (pObj->temp_is_enabled == 1U) { return LPS22HH_SetOutputDataRate_When_Enabled(pObj, Odr); } else { return LPS22HH_SetOutputDataRate_When_Disabled(pObj, Odr); } }
eclipse-threadx/getting-started
C++
Other
310
/* return ret; } This function assumes to be called rarely. Switching between 8259A registers is slow. */
int i8259A_irq_real(unsigned int irq)
/* return ret; } This function assumes to be called rarely. Switching between 8259A registers is slow. */ int i8259A_irq_real(unsigned int irq)
{ int value; int irqmask = 1<<irq; if (irq < 8) { out8(ISR_1,0x0B); value = in8(ISR_1) & irqmask; out8(ISR_1,0x0A); return value; } out8(ISR_2,0x0B); value = in8(ISR_2) & (irqmask >> 8); out8(ISR_2,0x0A); return value; }
EmcraftSystems/u-boot
C++
Other
181
/* This function returns the reason(s) for a reset. The reset reason are:- - */
unsigned long PRCMSysResetCauseGet(void)
/* This function returns the reason(s) for a reset. The reset reason are:- - */ unsigned long PRCMSysResetCauseGet(void)
{ unsigned long ulWakeupStatus; ulWakeupStatus = (HWREG(GPRCM_BASE+ GPRCM_O_APPS_RESET_CAUSE) & 0xFF); if(ulWakeupStatus == PRCM_POWER_ON) { if(MAP_PRCMHIBRegRead(HIB3P3_BASE + HIB3P3_O_MEM_HIB_WAKE_STATUS) & 0x1) { ulWakeupStatus = PRCM_HIB_EXIT; } } return ulWakeupStatus; }
micropython/micropython
C++
Other
18,334
/* This routine is used to check whether the pci device is present. */
EFI_STATUS PciDevicePresent(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
/* This routine is used to check whether the pci device is present. */ EFI_STATUS PciDevicePresent(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
{ UINT64 Address; EFI_STATUS Status; Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0); Status = PciRootBridgeIo->Pci.Read ( PciRootBridgeIo, EfiPciWidthUint32, Address, 1, Pci ); if (!EFI_ERROR (Status) && ((Pci->Hdr).VendorId != 0xffff)) { Status = PciRootBridgeIo->Pci.Read ( PciRootBridgeIo, EfiPciWidthUint32, Address, sizeof (PCI_TYPE00) / sizeof (UINT32), Pci ); return EFI_SUCCESS; } return EFI_NOT_FOUND; }
tianocore/edk2
C++
Other
4,240
/* Construct node list according to the AML handle. */
EFI_STATUS AmlConstructNodeList(IN EFI_AML_HANDLE *AmlHandle, IN EFI_AML_NODE_LIST *AmlRootNodeList, IN EFI_AML_NODE_LIST *AmlParentNodeList)
/* Construct node list according to the AML handle. */ EFI_STATUS AmlConstructNodeList(IN EFI_AML_HANDLE *AmlHandle, IN EFI_AML_NODE_LIST *AmlRootNodeList, IN EFI_AML_NODE_LIST *AmlParentNodeList)
{ VOID *NameString; EFI_AML_NODE_LIST *AmlNodeList; if ((AmlHandle->AmlByteEncoding->Attribute & AML_IN_NAMESPACE) == 0) { return EFI_SUCCESS; } NameString = AmlGetObjectName (AmlHandle); if (NameString == NULL) { return EFI_INVALID_PARAMETER; } AmlNodeList = AmlInsertNodeToTree (NameString, AmlHandle->Buffer, AmlHandle->Size, AmlRootNodeList, AmlParentNodeList); ASSERT (AmlNodeList != NULL); return AmlConstructNodeListForChild (AmlHandle, AmlRootNodeList, AmlNodeList); }
tianocore/edk2
C++
Other
4,240
/* Get a temperature sensor sample. If scaled data format is selected for the device, this routine gets a compensated "true temperature" sample. Otherwise, a raw uncompensated temperature reading is returned in "data". */
static bool bmp_get_temperature(sensor_hal_t *hal, sensor_data_t *data)
/* Get a temperature sensor sample. If scaled data format is selected for the device, this routine gets a compensated "true temperature" sample. Otherwise, a raw uncompensated temperature reading is returned in "data". */ static bool bmp_get_temperature(sensor_hal_t *hal, sensor_data_t *data)
{ int32_t const UT = bmp_get_ut(hal); if (false == data->scaled) { data->temperature.value = UT; } else { int32_t const x1 = ((UT - AC6) * AC5) >> 15; int32_t const x2 = ((int32_t)Mc << 11) / (x1 + Md); data->temperature.value = ((x1 + x2) + 8) >> 4; } return true; }
memfault/zero-to-main
C++
null
200
/* If Cert is NULL, then return FALSE. If CertSize is 0, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI X509GetSerialNumber(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *SerialNumber, OPTIONAL IN OUT UINTN *SerialNumberSize)
/* If Cert is NULL, then return FALSE. If CertSize is 0, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI X509GetSerialNumber(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *SerialNumber, OPTIONAL IN OUT UINTN *SerialNumberSize)
{ CALL_CRYPTO_SERVICE (X509GetSerialNumber, (Cert, CertSize, SerialNumber, SerialNumberSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Return the first word of the unique device identifier (UID based on 96 bits) */
uint32_t HAL_GetUIDw0(void)
/* Return the first word of the unique device identifier (UID based on 96 bits) */ uint32_t HAL_GetUIDw0(void)
{ return(READ_REG(*((uint32_t *)UID_BASE))); }
ua1arn/hftrx
C++
null
69
/* Detect whether specific FIFO is full or not. */
BOOLEAN SerialFifoFull(IN SERIAL_DEV_FIFO *Fifo)
/* Detect whether specific FIFO is full or not. */ BOOLEAN SerialFifoFull(IN SERIAL_DEV_FIFO *Fifo)
{ return (BOOLEAN)(((Fifo->Tail + 1) % SERIAL_MAX_FIFO_SIZE) == Fifo->Head); }
tianocore/edk2
C++
Other
4,240
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_7); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_4); } else if(hspi->Instance==SPI4) { __HAL_RCC_SPI4_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOE, GPIO_PIN_12|GPIO_PIN_14); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Given a PCI bus number and domain number, the desired PCI bus is located in the global list of PCI buses. If the bus is found, a pointer to its data structure is returned. If no bus is found, NULL is returned. */
struct pci_bus* pci_find_bus(int domain, int busnr)
/* Given a PCI bus number and domain number, the desired PCI bus is located in the global list of PCI buses. If the bus is found, a pointer to its data structure is returned. If no bus is found, NULL is returned. */ struct pci_bus* pci_find_bus(int domain, int busnr)
{ struct pci_bus *bus = NULL; struct pci_bus *tmp_bus; while ((bus = pci_find_next_bus(bus)) != NULL) { if (pci_domain_nr(bus) != domain) continue; tmp_bus = pci_do_find_bus(bus, busnr); if (tmp_bus) return tmp_bus; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* The vCPU has executed a HLT instruction with in-kernel mode enabled. */
void kvm_vcpu_block(struct kvm_vcpu *vcpu)
/* The vCPU has executed a HLT instruction with in-kernel mode enabled. */ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
{ DEFINE_WAIT(wait); for (;;) { prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE); if (kvm_arch_vcpu_runnable(vcpu)) { set_bit(KVM_REQ_UNHALT, &vcpu->requests); break; } if (kvm_cpu_has_pending_timer(vcpu)) break; if (signal_pending(current)) break; schedule(); } finish_wait(&vcpu->wq, &wait); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handles a notification that a read-by-type response has been fully processed for the specified discover-characteristics-by-uuid proc. */
static int ble_gattc_disc_chr_uuid_rx_complete(struct ble_gattc_proc *proc, int status)
/* Handles a notification that a read-by-type response has been fully processed for the specified discover-characteristics-by-uuid proc. */ static int ble_gattc_disc_chr_uuid_rx_complete(struct ble_gattc_proc *proc, int status)
{ int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0) { ble_gattc_disc_chr_uuid_cb(proc, status, 0, NULL); return BLE_HS_EDONE; } if (proc->disc_chr_uuid.prev_handle == proc->disc_chr_uuid.end_handle) { ble_gattc_disc_chr_uuid_cb(proc, BLE_HS_EDONE, 0, NULL); return BLE_HS_EDONE; } rc = ble_gattc_disc_chr_uuid_resume(proc); if (rc != 0) { return BLE_HS_EDONE; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Configures the high and low thresholds of the analog watchdog. */
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
/* Configures the high and low thresholds of the analog watchdog. */ void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_THRESHOLD(HighThreshold)); assert_param(IS_ADC_THRESHOLD(LowThreshold)); ADCx->HTR = HighThreshold; ADCx->LTR = LowThreshold; }
avem-labs/Avem
C++
MIT License
1,752
/* Get PCD database from GUID HOB in PEI phase. */
PEI_PCD_DATABASE* GetPcdDatabase(VOID)
/* Get PCD database from GUID HOB in PEI phase. */ PEI_PCD_DATABASE* GetPcdDatabase(VOID)
{ EFI_HOB_GUID_TYPE *GuidHob; GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid); ASSERT (GuidHob != NULL); return (PEI_PCD_DATABASE *)GET_GUID_HOB_DATA (GuidHob); }
tianocore/edk2
C++
Other
4,240
/* ecryptfs_from_hex @dst: Buffer to take the bytes from src hex; must be at least of size (src_size / 2) @src: Buffer to be converted from a hex string respresentation to raw value @dst_size: size of dst buffer, or number of hex characters pairs to convert */
void ecryptfs_from_hex(char *dst, char *src, int dst_size)
/* ecryptfs_from_hex @dst: Buffer to take the bytes from src hex; must be at least of size (src_size / 2) @src: Buffer to be converted from a hex string respresentation to raw value @dst_size: size of dst buffer, or number of hex characters pairs to convert */ void ecryptfs_from_hex(char *dst, char *src, int dst_size)
{ int x; char tmp[3] = { 0, }; for (x = 0; x < dst_size; x++) { tmp[0] = src[x * 2]; tmp[1] = src[x * 2 + 1]; dst[x] = (unsigned char)simple_strtol(tmp, NULL, 16); } }
robutest/uclinux
C++
GPL-2.0
60
/* The Nuvoton NCT6102D starts per default after reset with both, the internal watchdog and the internal legacy UART enabled. This code provides a function to disable the watchdog. */
int nct6102d_wdt_disable(void)
/* The Nuvoton NCT6102D starts per default after reset with both, the internal watchdog and the internal legacy UART enabled. This code provides a function to disable the watchdog. */ int nct6102d_wdt_disable(void)
{ superio_enter(); superio_select(NCT6102D_LD_WDT); superio_outb(NCT6102D_WDT_TIMEOUT, 0x00); superio_exit(); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: TRUE if the @drive can be polled for media changes, FALSE otherwise. */
gboolean g_drive_can_poll_for_media(GDrive *drive)
/* Returns: TRUE if the @drive can be polled for media changes, FALSE otherwise. */ gboolean g_drive_can_poll_for_media(GDrive *drive)
{ GDriveIface *iface; g_return_val_if_fail (G_IS_DRIVE (drive), FALSE); iface = G_DRIVE_GET_IFACE (drive); if (iface->poll_for_media == NULL) return FALSE; return (* iface->can_poll_for_media) (drive); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* retval BFA_STATUS_OK VF creation is successful retval BFA_STATUS_FAILED VF creation failed retval BFA_STATUS_EEXIST A VF exists with the given vf_id */
bfa_status_t bfa_fcs_vf_create(bfa_fcs_vf_t *vf, struct bfa_fcs_s *fcs, u16 vf_id, struct bfa_port_cfg_s *port_cfg, struct bfad_vf_s *vf_drv)
/* retval BFA_STATUS_OK VF creation is successful retval BFA_STATUS_FAILED VF creation failed retval BFA_STATUS_EEXIST A VF exists with the given vf_id */ bfa_status_t bfa_fcs_vf_create(bfa_fcs_vf_t *vf, struct bfa_fcs_s *fcs, u16 vf_id, struct bfa_port_cfg_s *port_cfg, struct bfad_vf_s *vf_drv)
{ bfa_trc(fcs, vf_id); return BFA_STATUS_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_buy_sell_indicator(gchar *buf, guint32 value)
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ static void format_buy_sell_indicator(gchar *buf, guint32 value)
{ g_snprintf(buf, ITEM_LABEL_LENGTH, "%s (%c)", val_to_str_const(value, ouch_buy_sell_indicator_val, "Unknown"), value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initializes the DAC peripheral according to the specified parameters in the dacConfig. */
void DAC_Config(uint32_t channel, DAC_Config_T *dacConfig)
/* Initializes the DAC peripheral according to the specified parameters in the dacConfig. */ void DAC_Config(uint32_t channel, DAC_Config_T *dacConfig)
{ uint32_t tmp1 = 0, tmp2 = 0; tmp1 = DAC->CTRL; tmp1 &= ~(((uint32_t)0x00000FFE) << channel); tmp2 = ((uint32_t)dacConfig->trigger | \ (uint32_t)dacConfig->waveGeneration | \ (uint32_t)dacConfig->maskAmplitudeSelect | \ (uint32_t)dacConfig->outputBuff); tmp1 |= tmp2 << channel; DAC->CTRL = tmp1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* serial interface for ak4396 - only writing supported, no readback */
static void ak4396_send_word(struct snd_ice1712 *ice, unsigned int data)
/* serial interface for ak4396 - only writing supported, no readback */ static void ak4396_send_word(struct snd_ice1712 *ice, unsigned int data)
{ int i; for (i = 0; i < 16; i++) { set_gpio_bit(ice, AK4396_CCLK, 0); udelay(1); set_gpio_bit(ice, AK4396_CDTI, data & 0x8000); udelay(1); set_gpio_bit(ice, AK4396_CCLK, 1); udelay(1); data <<= 1; } }
robutest/uclinux
C++
GPL-2.0
60
/* We use this instead of udelay directly, so we can make sure that previous register writes have been flushed all the way to the chip. Since we are delaying anyway, the cost doesn't hurt, and makes the bit twiddling more regular */
static void i2c_wait_for_writes(struct ipath_devdata *dd)
/* We use this instead of udelay directly, so we can make sure that previous register writes have been flushed all the way to the chip. Since we are delaying anyway, the cost doesn't hurt, and makes the bit twiddling more regular */ static void i2c_wait_for_writes(struct ipath_devdata *dd)
{ (void)ipath_read_kreg32(dd, dd->ipath_kregs->kr_scratch); rmb(); }
robutest/uclinux
C++
GPL-2.0
60
/* APIs to access CFPA pages This routine will erase CFPA and program the CFPA page with passed data. */
status_t FFR_InfieldPageWrite(flash_config_t *config, uint8_t *page_data, uint32_t valid_len)
/* APIs to access CFPA pages This routine will erase CFPA and program the CFPA page with passed data. */ status_t FFR_InfieldPageWrite(flash_config_t *config, uint8_t *page_data, uint32_t valid_len)
{ if (get_rom_api_version() == 0u) { assert(VERSION0_FLASH_API_TREE); return VERSION0_FLASH_API_TREE->ffr_infield_page_write(config, page_data, valid_len); } else { assert(VERSION1_FLASH_API_TREE); return VERSION1_FLASH_API_TREE->ffr_infield_page_write(config, page_data, valid_len); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This API sets tap interrupts.Interrupt is fired when tap movements happen. */
static int8_t set_accel_tap_int(struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
/* This API sets tap interrupts.Interrupt is fired when tap movements happen. */ static int8_t set_accel_tap_int(struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
{ int8_t rslt; rslt = null_ptr_check(dev); if ((rslt != BMI160_OK) || (int_config == NULL)) { rslt = BMI160_E_NULL_PTR; } else { struct bmi160_acc_tap_int_cfg *tap_int_cfg = &(int_config->int_type_cfg.acc_tap_int); rslt = enable_tap_int(int_config, tap_int_cfg, dev); if (rslt == BMI160_OK) { rslt = set_intr_pin_config(int_config, dev); if (rslt == BMI160_OK) { rslt = config_tap_int_settg(int_config, tap_int_cfg, dev); } } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Add abstract address as unspecific attribute to netlink message. */
int nla_put_addr(struct nl_msg *msg, int attrtype, struct nl_addr *addr)
/* Add abstract address as unspecific attribute to netlink message. */ int nla_put_addr(struct nl_msg *msg, int attrtype, struct nl_addr *addr)
{ return nla_put(msg, attrtype, nl_addr_get_len(addr), nl_addr_get_binary_addr(addr)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_DISABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the specified I2C register and returns its value. */
uint32_t I2C_ReadRegister(I2C_TypeDef *I2Cx, uint8_t I2C_Register)
/* Reads the specified I2C register and returns its value. */ uint32_t I2C_ReadRegister(I2C_TypeDef *I2Cx, uint8_t I2C_Register)
{ __IO uint32_t tmp = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_REGISTER(I2C_Register)); tmp = (uint32_t)I2Cx; tmp += I2C_Register; return (*(__IO uint32_t *) tmp); }
ajhc/demo-cortex-m3
C++
null
38
/* this function is used to set the resizing parameters */
int32_t ipu_ic_config_resize_rate(int32_t ipu_index, char *task_type, uint32_t res_vert, uint32_t down_vert, uint32_t res_horiz, uint32_t down_horiz)
/* this function is used to set the resizing parameters */ int32_t ipu_ic_config_resize_rate(int32_t ipu_index, char *task_type, uint32_t res_vert, uint32_t down_vert, uint32_t res_horiz, uint32_t down_horiz)
{ uint32_t val; uint32_t ipu_base_addr = REGS_IPU_BASE(ipu_index); val = (down_vert << 30) | (res_vert << 16) | (down_horiz << 14) | (res_horiz); if (!strcmp(task_type, "PPTASK")) { writel(val, ipu_base_addr + IPU_IC_PP_RSC__ADDR); } else if (!strcmp(task_type, "VFTASK")) { writel(val, ipu_base_addr + IPU_IC_PRP_VF_RSC__ADDR); } else if (!strcmp(task_type, "PrPTASK")) { writel(val, ipu_base_addr + IPU_IC_PRP_ENC_RSC__ADDR); } else { printf("Task type is not defined!\n"); return -1; } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Our first setup routine is the console. It's a fairly simple device, but UNIX tty handling makes it uglier than it could be. */
static void setup_console(void)
/* Our first setup routine is the console. It's a fairly simple device, but UNIX tty handling makes it uglier than it could be. */ static void setup_console(void)
{ struct device *dev; if (tcgetattr(STDIN_FILENO, &orig_term) == 0) { struct termios term = orig_term; term.c_lflag &= ~(ISIG|ICANON|ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &term); } dev = new_device("console", VIRTIO_ID_CONSOLE); dev->priv = malloc(sizeof(struct console_abort)); ((struct console_abort *)dev->priv)->count = 0; add_virtqueue(dev, VIRTQUEUE_NUM, console_input); add_virtqueue(dev, VIRTQUEUE_NUM, console_output); verbose("device %u: console\n", ++devices.device_num); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Unregister handler for events sent to the ACPI-WMI mapper device. */
acpi_status wmi_remove_notify_handler(const char *guid)
/* Unregister handler for events sent to the ACPI-WMI mapper device. */ acpi_status wmi_remove_notify_handler(const char *guid)
{ struct wmi_block *block; acpi_status status; if (!guid) return AE_BAD_PARAMETER; if (!find_guid(guid, &block)) return AE_NOT_EXIST; if (!block->handler) return AE_NULL_ENTRY; status = wmi_method_enable(block, 0); block->handler = NULL; block->handler_data = NULL; return status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Given the specified pixel clock, work out the necessary divider to get close to the output frequency. */
static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk)
/* Given the specified pixel clock, work out the necessary divider to get close to the output frequency. */ static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk)
{ unsigned long clk = clk_get_rate(sfb->bus_clk); unsigned long long tmp; unsigned int result; tmp = (unsigned long long)clk; tmp *= pixclk; do_div(tmp, 1000000000UL); result = (unsigned int)tmp / 1000; dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", pixclk, clk, result, clk / result); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve IRQ number for the given hardware instance. */
static uint8_t _sercom_get_irq_num(const void *const hw)
/* Retrieve IRQ number for the given hardware instance. */ static uint8_t _sercom_get_irq_num(const void *const hw)
{ return SERCOM0_IRQn + _sercom_get_hardware_index(hw); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the file size bounds and adjusts count as needed. This would not be needed if the file size didn't reset to 0 after a write. */
static size_t w1_f2d_fix_count(loff_t off, size_t count, size_t size)
/* Check the file size bounds and adjusts count as needed. This would not be needed if the file size didn't reset to 0 after a write. */ static size_t w1_f2d_fix_count(loff_t off, size_t count, size_t size)
{ if (off > size) return 0; if ((off + count) > size) return size - off; return count; }
robutest/uclinux
C++
GPL-2.0
60
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM16) { __HAL_RCC_TIM16_CLK_ENABLE(); } else if(htim_base->Instance==TIM17) { __HAL_RCC_TIM17_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer. param callback FlexIO I2S eDMA callback function called while finished a block. param userData User parameter for callback. param dmaHandle eDMA handle for FlexIO I2S. This handle is a static value allocated by users. */
void FLEXIO_I2S_TransferTxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer. param callback FlexIO I2S eDMA callback function called while finished a block. param userData User parameter for callback. param dmaHandle eDMA handle for FlexIO I2S. This handle is a static value allocated by users. */ void FLEXIO_I2S_TransferTxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
{ assert(handle && dmaHandle); memset(handle, 0, sizeof(*handle)); handle->dmaHandle = dmaHandle; handle->callback = callback; handle->userData = userData; handle->state = kFLEXIO_I2S_Idle; s_edmaPrivateHandle[0].base = base; s_edmaPrivateHandle[0].handle = handle; EDMA_InstallTCDMemory(dmaHandle, STCD_ADDR(handle->tcd), FLEXIO_I2S_XFER_QUEUE_SIZE); EDMA_SetCallback(dmaHandle, FLEXIO_I2S_TxEDMACallback, &s_edmaPrivateHandle[0]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wait for RTC registers to be synchronised with the APB1 bus. Time and Date are accessed through shadow registers which must be synchronized */
void rtc_wait_for_synchro(void)
/* Wait for RTC registers to be synchronised with the APB1 bus. Time and Date are accessed through shadow registers which must be synchronized */ void rtc_wait_for_synchro(void)
{ RTC_WPR = 0xca; RTC_WPR = 0x53; RTC_ISR &= ~(RTC_ISR_RSF); while (!(RTC_ISR & RTC_ISR_RSF)); RTC_WPR = 0xff; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* After receiving and processing a FORWARD TSN, the data receiver MUST take cautions in updating its re-assembly queue. The receiver MUST remove any partially reassembled message, which is still missing one or more TSNs earlier than or equal to the new cumulative TSN point. In the event that the receiver has invoked the partial delivery API, a notification SHOULD also be generated to inform the upper layer API that the message being partially delivered will NOT be completed. */
void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 fwd_tsn)
/* After receiving and processing a FORWARD TSN, the data receiver MUST take cautions in updating its re-assembly queue. The receiver MUST remove any partially reassembled message, which is still missing one or more TSNs earlier than or equal to the new cumulative TSN point. In the event that the receiver has invoked the partial delivery API, a notification SHOULD also be generated to inform the upper layer API that the message being partially delivered will NOT be completed. */ void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 fwd_tsn)
{ struct sk_buff *pos, *tmp; struct sctp_ulpevent *event; __u32 tsn; if (skb_queue_empty(&ulpq->reasm)) return; skb_queue_walk_safe(&ulpq->reasm, pos, tmp) { event = sctp_skb2event(pos); tsn = event->tsn; if (TSN_lte(tsn, fwd_tsn)) { __skb_unlink(pos, &ulpq->reasm); sctp_ulpevent_free(event); } else break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* wrap the access to the data in an rcu_read_lock() section; this is used to track the active references. */
static struct prop_global* prop_get_global(struct prop_descriptor *pd) __acquires(RCU)
/* wrap the access to the data in an rcu_read_lock() section; this is used to track the active references. */ static struct prop_global* prop_get_global(struct prop_descriptor *pd) __acquires(RCU)
{ int index; rcu_read_lock(); index = pd->index; smp_rmb(); return &pd->pg[index]; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialises the heap structures before their first use. */
static void prvHeapInit(void)
/* Initialises the heap structures before their first use. */ static void prvHeapInit(void)
{ BlockLink_t * pxFirstFreeBlock; uint8_t * pucAlignedHeap; pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) & ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); xStart.pxNextFreeBlock = ( void * ) pucAlignedHeap; xStart.xBlockSize = ( size_t ) 0; xEnd.xBlockSize = configADJUSTED_HEAP_SIZE; xEnd.pxNextFreeBlock = NULL; pxFirstFreeBlock = ( void * ) pucAlignedHeap; pxFirstFreeBlock->xBlockSize = configADJUSTED_HEAP_SIZE; pxFirstFreeBlock->pxNextFreeBlock = &xEnd; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Set LED1 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */
void LED_Blinking(uint32_t Period)
/* Set LED1 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */ void LED_Blinking(uint32_t Period)
{ while (1) { LL_GPIO_TogglePin(LED1_GPIO_PORT, LED1_PIN); LL_mDelay(Period); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This is the ia64 generic version of this routine. Other platforms are free to override it with a machine vector. */
char* ia64_pci_get_legacy_mem(struct pci_bus *bus)
/* This is the ia64 generic version of this routine. Other platforms are free to override it with a machine vector. */ char* ia64_pci_get_legacy_mem(struct pci_bus *bus)
{ return (char *)__IA64_UNCACHED_OFFSET; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Public call interface for looking up machine creds. */
struct rpc_cred* rpc_lookup_machine_cred(void)
/* Public call interface for looking up machine creds. */ struct rpc_cred* rpc_lookup_machine_cred(void)
{ struct auth_cred acred = { .uid = RPC_MACHINE_CRED_USERID, .gid = RPC_MACHINE_CRED_GROUPID, .machine_cred = 1, }; dprintk("RPC: looking up machine cred\n"); return generic_auth.au_ops->lookup_cred(&generic_auth, &acred, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configure the priority grouping: pre-emption priority and subpriority. */
void NVIC_ConfigPriorityGroup(NVIC_PRIORITY_GROUP_T priorityGroup)
/* Configure the priority grouping: pre-emption priority and subpriority. */ void NVIC_ConfigPriorityGroup(NVIC_PRIORITY_GROUP_T priorityGroup)
{ SCB->AIRCR = AIRCR_VECTKEY_MASK | priorityGroup; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call the "apply" callback function for each module if any of its preferences have changed, and then clear the flag saying its preferences have changed, as the module has been notified of that fact. */
void prefs_apply_all(void)
/* Call the "apply" callback function for each module if any of its preferences have changed, and then clear the flag saying its preferences have changed, as the module has been notified of that fact. */ void prefs_apply_all(void)
{ wmem_tree_foreach(prefs_modules, call_apply_cb, NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This is here so that we can dynamically add viodasd devices without exposing all the above infrastructure. */
struct vio_dev* vio_create_viodasd(u32 unit)
/* This is here so that we can dynamically add viodasd devices without exposing all the above infrastructure. */ struct vio_dev* vio_create_viodasd(u32 unit)
{ struct device_node *vio_root; struct device_node *np; struct vio_dev *vdev = NULL; vio_root = of_find_node_by_path("/vdevice"); if (!vio_root) return NULL; np = do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit, "block", "IBM,iSeries-viodasd", NULL); of_node_put(vio_root); if (np) { vdev = vio_register_device_node(np); if (!vdev) free_node(np); } return vdev; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* return the highest priority found in mask (highest = smallest number). Return 8 if no irq */
static int get_priority(struct kvm_kpic_state *s, int mask)
/* return the highest priority found in mask (highest = smallest number). Return 8 if no irq */ static int get_priority(struct kvm_kpic_state *s, int mask)
{ int priority; if (mask == 0) return 8; priority = 0; while ((mask & (1 << ((priority + s->priority_add) & 7))) == 0) priority++; return priority; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handle the ioctls that control the routing functions. */
int x25_route_ioctl(unsigned int cmd, void __user *arg)
/* Handle the ioctls that control the routing functions. */ int x25_route_ioctl(unsigned int cmd, void __user *arg)
{ struct x25_route_struct rt; struct net_device *dev; int rc = -EINVAL; if (cmd != SIOCADDRT && cmd != SIOCDELRT) goto out; rc = -EFAULT; if (copy_from_user(&rt, arg, sizeof(rt))) goto out; rc = -EINVAL; if (rt.sigdigits > 15) goto out; dev = x25_dev_get(rt.device); if (!dev) goto out; if (cmd == SIOCADDRT) rc = x25_add_route(&rt.address, rt.sigdigits, dev); else rc = x25_del_route(&rt.address, rt.sigdigits, dev); dev_put(dev); out: return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Message: FeatureStatReqMessage Opcode: 0x0034 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */
static void handle_FeatureStatReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: FeatureStatReqMessage Opcode: 0x0034 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */ static void handle_FeatureStatReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0); ptvcursor_add(cursor, hf_skinny_featureIndex, 4, ENC_LITTLE_ENDIAN); if (hdr_data_length > 16) { ptvcursor_add(cursor, hf_skinny_featureCapabilities, 4, ENC_LITTLE_ENDIAN); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioRead8(IN UINTN Address)
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ UINT8 EFIAPI MmioRead8(IN UINTN Address)
{ return (UINT8)MmioReadWorker (Address, EfiCpuIoWidthUint8); }
tianocore/edk2
C++
Other
4,240
/* Simple callback function used with tcpip_callback to free a pbuf (pbuf_free has a wrong signature for tcpip_callback) */
static void pbuf_free_int(void *p)
/* Simple callback function used with tcpip_callback to free a pbuf (pbuf_free has a wrong signature for tcpip_callback) */ static void pbuf_free_int(void *p)
{ struct pbuf *q = p; pbuf_free(q); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Returns: NULL if no quirk found, struct hid_blacklist * if found. */
static struct hid_blacklist* usbhid_exists_dquirk(const u16 idVendor, const u16 idProduct)
/* Returns: NULL if no quirk found, struct hid_blacklist * if found. */ static struct hid_blacklist* usbhid_exists_dquirk(const u16 idVendor, const u16 idProduct)
{ struct quirks_list_struct *q; struct hid_blacklist *bl_entry = NULL; list_for_each_entry(q, &dquirks_list, node) { if (q->hid_bl_item.idVendor == idVendor && q->hid_bl_item.idProduct == idProduct) { bl_entry = &q->hid_bl_item; break; } } if (bl_entry != NULL) dbg_hid("Found dynamic quirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", bl_entry->quirks, bl_entry->idVendor, bl_entry->idProduct); return bl_entry; }
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentRead32(IN UINT64 Address)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI S3PciSegmentRead32(IN UINT64 Address)
{ return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentRead32 (Address)); }
tianocore/edk2
C++
Other
4,240
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_parser_parse_buf(CRParser *a_this, const guchar *a_buf, gulong a_len, enum CREncoding a_enc)
/* Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_parser_parse_buf(CRParser *a_this, const guchar *a_buf, gulong a_len, enum CREncoding a_enc)
{ enum CRStatus status = CR_ERROR; CRTknzr *tknzr = NULL; g_return_val_if_fail (a_this && PRIVATE (a_this) && a_buf, CR_BAD_PARAM_ERROR); tknzr = cr_tknzr_new_from_buf ((guchar*)a_buf, a_len, a_enc, FALSE); g_return_val_if_fail (tknzr != NULL, CR_ERROR); status = cr_parser_set_tknzr (a_this, tknzr); g_return_val_if_fail (status == CR_OK, CR_ERROR); status = cr_parser_parse (a_this); return status; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToUint32(IN UINTN Operand, OUT UINT32 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnToUint32(IN UINTN Operand, OUT UINT32 *Result)
{ return SafeUint64ToUint32 ((UINT64)Operand, Result); }
tianocore/edk2
C++
Other
4,240