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
/* scsi_sysfs_add_host - add scsi host to subsystem @shost: scsi host struct to add to subsystem */
int scsi_sysfs_add_host(struct Scsi_Host *shost)
/* scsi_sysfs_add_host - add scsi host to subsystem @shost: scsi host struct to add to subsystem */ int scsi_sysfs_add_host(struct Scsi_Host *shost)
{ int error, i; if (shost->hostt->shost_attrs) { for (i = 0; shost->hostt->shost_attrs[i]; i++) { error = device_create_file(&shost->shost_dev, shost->hostt->shost_attrs[i]); if (error) return error; } } transport_register_device(&shost->shost_gendev); transport_configure_device(&shost->shost_gendev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Actions for interface - statemachine. dev_action_start @fi: An instance of an interface statemachine. @event: The event, just happened. */
static void dev_action_start(fsm_instance *fi, int event, void *arg)
/* Actions for interface - statemachine. dev_action_start @fi: An instance of an interface statemachine. @event: The event, just happened. */ static void dev_action_start(fsm_instance *fi, int event, void *arg)
{ struct net_device *dev = arg; struct netiucv_priv *privptr = netdev_priv(dev); IUCV_DBF_TEXT(trace, 3, __func__); fsm_newstate(fi, DEV_STATE_STARTWAIT); fsm_event(privptr->conn->fsm, CONN_EVENT_START, privptr->conn); }
robutest/uclinux
C++
GPL-2.0
60
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */
uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */ uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
{ uint32_t index = 0; for (index = 0; index < BufferLength; index++) { CRC->DR = pBuffer[index]; } return (CRC->DR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get Ethernet driver/device options. The 32-bit value returned is a bit-mask representing the options. A one (1) in the bit-mask means the option is on, and a zero (0) means the option is off. */
u32 XEmac_GetOptions(XEmac *InstancePtr)
/* Get Ethernet driver/device options. The 32-bit value returned is a bit-mask representing the options. A one (1) in the bit-mask means the option is on, and a zero (0) means the option is off. */ u32 XEmac_GetOptions(XEmac *InstancePtr)
{ u32 OptionsFlag = 0; u32 ControlReg; int Index; XASSERT_NONVOID(InstancePtr != NULL); XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); ControlReg = XIo_In32(InstancePtr->BaseAddress + XEM_ECR_OFFSET); for (Index = 0; Index < XEM_NUM_OPTIONS; Index++) { if (ControlReg & OptionsTable[Index].Mask) { OptionsFlag |= OptionsTable[Index].Option; } } if (InstancePtr->IsPolled) { OptionsFlag |= XEM_POLLED_OPTION; } return OptionsFlag; }
EmcraftSystems/u-boot
C++
Other
181
/* This function is used to send a high-priority XON/XOFF character to the device */
static void rs_send_xchar(struct tty_struct *tty, char ch)
/* This function is used to send a high-priority XON/XOFF character to the device */ static void rs_send_xchar(struct tty_struct *tty, char ch)
{ struct async_struct *info = tty->driver_data; unsigned long flags; if (serial_paranoia_check(info, tty->name, "rs_send_char")) return; info->x_char = ch; if (ch) { local_irq_save(flags); if(!(custom.intenar & IF_TBE)) { custom.intena = IF_SETCLR | IF_TBE; mb(); custom.intreq = IF_SETCLR | IF_TBE; mb(); } local_irq_restore(flags); info->IER |= UART_IER_THRI; } }
robutest/uclinux
C++
GPL-2.0
60
/* param handle eDMA handle pointer. param tcdPool A memory pool to store TCDs. It must be 32 bytes aligned. param tcdSize The number of TCD slots. */
void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize)
/* param handle eDMA handle pointer. param tcdPool A memory pool to store TCDs. It must be 32 bytes aligned. param tcdSize The number of TCD slots. */ void EDMA_InstallTCDMemory(edma_handle_t *handle, edma_tcd_t *tcdPool, uint32_t tcdSize)
{ assert(handle != NULL); assert(((uint32_t)tcdPool & 0x1FU) == 0); handle->header = 0; handle->tail = 0; handle->tcdUsed = 0; handle->tcdSize = tcdSize; handle->flags = 0; handle->tcdPool = tcdPool; }
nanoframework/nf-interpreter
C++
MIT License
293
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */
UINT8 EFIAPI PciCf8Read8(IN UINTN Address)
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */ UINT8 EFIAPI PciCf8Read8(IN UINTN Address)
{ BOOLEAN InterruptState; UINT32 AddressPort; UINT8 Result; ASSERT_INVALID_PCI_ADDRESS (Address, 0); InterruptState = SaveAndDisableInterrupts (); AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); Result = IoRead8 (PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3)); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); SetInterruptState (InterruptState); return Result; }
tianocore/edk2
C++
Other
4,240
/* param handle Pointer to EDMA channel transfer handle. param tcdAddr EDMA head descriptor address. param tcdNum EDMA link descriptor address. */
void PDM_TransferInstallEDMATCDMemory(pdm_edma_handle_t *handle, void *tcdAddr, size_t tcdNum)
/* param handle Pointer to EDMA channel transfer handle. param tcdAddr EDMA head descriptor address. param tcdNum EDMA link descriptor address. */ void PDM_TransferInstallEDMATCDMemory(pdm_edma_handle_t *handle, void *tcdAddr, size_t tcdNum)
{ assert(handle != NULL); handle->tcd = (edma_tcd_t *)tcdAddr; handle->tcdNum = tcdNum; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* fc_disc_error() - Handle error on dNS request @disc: The discovery context @fp: The error code encoded as a frame pointer */
static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
/* fc_disc_error() - Handle error on dNS request @disc: The discovery context @fp: The error code encoded as a frame pointer */ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp)
{ struct fc_lport *lport = disc->lport; unsigned long delay = 0; FC_DISC_DBG(disc, "Error %ld, retries %d/%d\n", PTR_ERR(fp), disc->retry_count, FC_DISC_RETRY_LIMIT); if (!fp || PTR_ERR(fp) == -FC_EX_TIMEOUT) { if (disc->retry_count < FC_DISC_RETRY_LIMIT) { if (!fp) delay = msecs_to_jiffies(FC_DISC_RETRY_DELAY); else { delay = msecs_to_jiffies(lport->e_d_tov); if (!disc->retry_count) delay /= 4; } disc->retry_count++; schedule_delayed_work(&disc->disc_work, delay); } else fc_disc_done(disc, DISC_EV_FAILED); } }
robutest/uclinux
C++
GPL-2.0
60
/* Processes a single line (fragment) coming from the mcumgr UART driver. */
static void smp_uart_process_frag(struct uart_mcumgr_rx_buf *rx_buf)
/* Processes a single line (fragment) coming from the mcumgr UART driver. */ static void smp_uart_process_frag(struct uart_mcumgr_rx_buf *rx_buf)
{ struct net_buf *nb; nb = mcumgr_serial_process_frag(&smp_uart_rx_ctxt, rx_buf->data, rx_buf->length); uart_mcumgr_free_rx_buf(rx_buf); if (nb != NULL) { smp_rx_req(&smp_uart_transport, nb); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Return 1 (true) if link training ends up with link up success. Return 0 (false) if link training ends up with link up failure. */
static int pcie_advk_wait_for_link(struct pcie_advk *pcie)
/* Return 1 (true) if link training ends up with link up success. Return 0 (false) if link training ends up with link up failure. */ static int pcie_advk_wait_for_link(struct pcie_advk *pcie)
{ int retries; for (retries = 0; retries < MAX_RETRIES; retries++) { if (pcie_advk_link_up(pcie)) { printf("PCIE-%d: Link up\n", pcie->first_busno); return 0; } udelay(LINK_WAIT_TIMEOUT); } printf("PCIE-%d: Link down\n", pcie->first_busno); return -ETIMEDOUT; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Implement strneql etc Call strncmp after checking if enough chars left, returning 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */
gint tvb_strneql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
/* Implement strneql etc Call strncmp after checking if enough chars left, returning 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */ gint tvb_strneql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
{ const guint8 *ptr; ptr = ensure_contiguous_no_exception(tvb, offset, (gint)size, NULL); if (ptr) { int cmp = strncmp((const char *)ptr, str, size); return (cmp == 0 ? 0 : -1); } else { return -1; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function writes the specified value in to the specified signal of the GPIO device. */
static void xgpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
/* This function writes the specified value in to the specified signal of the GPIO device. */ static void xgpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
{ unsigned long flags; struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct xgpio_instance *chip = container_of(mm_gc, struct xgpio_instance, mmchip); spin_lock_irqsave(&chip->gpio_lock, flags); if (val) chip->gpio_state |= 1 << gpio; else chip->gpio_state &= ~(1 << gpio); out_be32(mm_gc->regs + XGPIO_DATA_OFFSET, chip->gpio_state); spin_unlock_irqrestore(&chip->gpio_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* @priv: Sandbox flash private data @resp: Response to send, or NULL if none @size: Size of response */
static void setup_response(struct sandbox_flash_priv *priv, void *resp, int size)
/* @priv: Sandbox flash private data @resp: Response to send, or NULL if none @size: Size of response */ static void setup_response(struct sandbox_flash_priv *priv, void *resp, int size)
{ struct umass_bbb_csw *csw = &priv->status; csw->dCSWSignature = CSWSIGNATURE; csw->dCSWTag = priv->tag; csw->dCSWDataResidue = 0; csw->bCSWStatus = CSWSTATUS_GOOD; assert(!resp || resp == priv->buff); priv->buff_used = size; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If queue elements contain dynamically-allocated memory, you should either use g_queue_free_full() or free them manually first. */
void g_queue_free(GQueue *queue)
/* If queue elements contain dynamically-allocated memory, you should either use g_queue_free_full() or free them manually first. */ void g_queue_free(GQueue *queue)
{ g_return_if_fail (queue != NULL); g_list_free (queue->head); g_slice_free (GQueue, queue); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* fcoe_clean_pending_queue() - Dequeue a skb and free it @lport: The local port to dequeue a skb on */
void fcoe_clean_pending_queue(struct fc_lport *)
/* fcoe_clean_pending_queue() - Dequeue a skb and free it @lport: The local port to dequeue a skb on */ void fcoe_clean_pending_queue(struct fc_lport *)
{ struct fcoe_port *port = lport_priv(lport); struct sk_buff *skb; spin_lock_bh(&port->fcoe_pending_queue.lock); while ((skb = __skb_dequeue(&port->fcoe_pending_queue)) != NULL) { spin_unlock_bh(&port->fcoe_pending_queue.lock); kfree_skb(skb); spin_lock_bh(&port->fcoe_pending_queue.lock); } spin_unlock_bh(&port->fcoe_pending_queue.lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Wait for a new message to arrive in the mbox */
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
/* Wait for a new message to arrive in the mbox */ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
{ int ret; ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, 0); if(ret == -RT_ETIMEOUT) { return SYS_ARCH_TIMEOUT; } else { if (ret == RT_EOK) ret = 1; } return ret; }
pikasTech/PikaPython
C++
MIT License
1,403
/* bufcopy: copy content of a NOR flash into SDRAM through SRAM buffer */
int do_bufcopy(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* bufcopy: copy content of a NOR flash into SDRAM through SRAM buffer */ int do_bufcopy(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ ulong dst; ulong src; ulong size; int ret = 0; if (argc != 4) { printf("%s: dst src size\n", (char *) argv[0]); goto Done; } dst = simple_strtoul(argv[1], NULL, 16); src = simple_strtoul(argv[2], NULL, 16); size = simple_strtoul(argv[3], NULL, 16); if (dst < CONFIG_SYS_RAM_BASE) { printf("%s: dst is outside SDRAM\n", (char *) argv[0]); goto Done; } if ((ret = nor_sdram_bufcopy(dst, src, size)) < 0) { printf("%s: nor_sdram_bufcopy failed: %d\n", (char *) argv[0], ret); goto Done; } Done: return ret; }
EmcraftSystems/u-boot
C++
Other
181
/* The function consider two load options are equal when the OptionType, Attributes, Description, FilePath and OptionalData are equal. */
INTN PlatformFindLoadOption(IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, IN UINTN Count)
/* The function consider two load options are equal when the OptionType, Attributes, Description, FilePath and OptionalData are equal. */ INTN PlatformFindLoadOption(IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, IN UINTN Count)
{ UINTN Index; for (Index = 0; Index < Count; Index++) { if ((Key->OptionType == Array[Index].OptionType) && (Key->Attributes == Array[Index].Attributes) && (StrCmp (Key->Description, Array[Index].Description) == 0) && (CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSize (Key->FilePath)) == 0) && (Key->OptionalDataSize == Array[Index].OptionalDataSize) && (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0)) { return (INTN)Index; } } return -1; }
tianocore/edk2
C++
Other
4,240
/* Check whether the RX ring buffer is full. */
static bool FLEXIO_UART_TransferIsRxRingBufferFull(flexio_uart_handle_t *handle)
/* Check whether the RX ring buffer is full. */ static bool FLEXIO_UART_TransferIsRxRingBufferFull(flexio_uart_handle_t *handle)
{ bool full; if (FLEXIO_UART_TransferGetRxRingBufferLength(handle) == (handle->rxRingBufferSize - 1U)) { full = true; } else { full = false; } return full; }
eclipse-threadx/getting-started
C++
Other
310
/* Set the callback for the Device Policy Manager policy change notify. */
void usbc_set_policy_cb_wait_notify(const struct device *dev, const policy_cb_wait_notify_t policy_cb_wait_notify)
/* Set the callback for the Device Policy Manager policy change notify. */ void usbc_set_policy_cb_wait_notify(const struct device *dev, const policy_cb_wait_notify_t policy_cb_wait_notify)
{ struct usbc_port_data *data = dev->data; data->policy_cb_wait_notify = policy_cb_wait_notify; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* mark an interrupt to be ACK'd after interrupt handlers have been run rather than before */
void set_intr_postackable(int irq)
/* mark an interrupt to be ACK'd after interrupt handlers have been run rather than before */ void set_intr_postackable(int irq)
{ set_irq_chip_and_handler(irq, &mn10300_cpu_pic_level, handle_level_irq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clears the states of the RTS modem control signals. The */
void UARTModemControlClear(unsigned long ulBase, unsigned long ulControl)
/* Clears the states of the RTS modem control signals. The */ void UARTModemControlClear(unsigned long ulBase, unsigned long ulControl)
{ xASSERT((ulBase == UART0_BASE) ||(ulBase == UART1_BASE) ); xHWREG(ulBase + UART_MCR) &= ~(ulControl & UART_MCR_RTS); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function sets the EC curve to be used for TLS flows. */
EFI_STATUS EFIAPI CryptoServiceTlsSetEcCurve(IN VOID *Tls, IN UINT8 *Data, IN UINTN DataSize)
/* This function sets the EC curve to be used for TLS flows. */ EFI_STATUS EFIAPI CryptoServiceTlsSetEcCurve(IN VOID *Tls, IN UINT8 *Data, IN UINTN DataSize)
{ return CALL_BASECRYPTLIB (TlsSet.Services.EcCurve, TlsSetEcCurve, (Tls, Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* As 'xxx' in hexadecimal represents a number on 12 bits, we have Value < (1 << 12). */
STATIC EFI_STATUS EFIAPI WriteAslName(IN CHAR8 LeadChar, IN UINT32 Value, IN OUT CHAR8 *AslName)
/* As 'xxx' in hexadecimal represents a number on 12 bits, we have Value < (1 << 12). */ STATIC EFI_STATUS EFIAPI WriteAslName(IN CHAR8 LeadChar, IN UINT32 Value, IN OUT CHAR8 *AslName)
{ UINT8 Index; if ((Value >= MAX_NODE_COUNT) || (AslName == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } AslName[0] = LeadChar; AslName[AML_NAME_SEG_SIZE] = '\0'; for (Index = 0; Index < AML_NAME_SEG_SIZE - 1; Index++) { AslName[AML_NAME_SEG_SIZE - Index - 1] = AsciiFromHex (((Value >> (4 * Index)) & 0xF)); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Send command to set or reset WEL bit. The WREN instruction is for setting Write Enable Latch (WEL) bit. The WRDI instruction is to reset Write Enable Latch (WEL) bit. */
static enum status_code _mx25l_send_cmd_write_latch(uint8_t cmd)
/* Send command to set or reset WEL bit. The WREN instruction is for setting Write Enable Latch (WEL) bit. The WRDI instruction is to reset Write Enable Latch (WEL) bit. */ static enum status_code _mx25l_send_cmd_write_latch(uint8_t cmd)
{ enum status_code status; uint8_t tx_buf[1] = {cmd}; _mx25l_chip_select(); status = spi_write_buffer_wait(&_mx25l_spi, tx_buf, 1); if (status != STATUS_OK) { return STATUS_ERR_IO; } _mx25l_chip_deselect(); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Reset the interrupt in the SYSTICK. This function resets the systick timer by clearing out the configuration register. */
void am_hal_systick_reset(void)
/* Reset the interrupt in the SYSTICK. This function resets the systick timer by clearing out the configuration register. */ void am_hal_systick_reset(void)
{ AM_REG(SYSTICK, SYSTCSR) = 0x0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This will enable DMA operation of the I2C block. */
void I2CDMAEnable(unsigned long ulBase, unsigned long ulDMALast)
/* This will enable DMA operation of the I2C block. */ void I2CDMAEnable(unsigned long ulBase, unsigned long ulDMALast)
{ unsigned long ultmpreg = 0; xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE)); ultmpreg = xHWREG(ulBase + I2C_CR2); ultmpreg |= I2C_CR2_DMAEN; ultmpreg &= ~I2C_CR2_LAST; ultmpreg |= ulDMALast; xHWREG(ulBase + I2C_CR2) = ultmpreg; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* GMAC doesnot strips the Pad/FCS field of incoming frames. GMAC will pass all the incoming frames to Host unmodified. */
void synopGMAC_pad_crc_strip_disable(synopGMACdevice *gmacdev)
/* GMAC doesnot strips the Pad/FCS field of incoming frames. GMAC will pass all the incoming frames to Host unmodified. */ void synopGMAC_pad_crc_strip_disable(synopGMACdevice *gmacdev)
{ u32 status; synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacPadCrcStrip); status = synopGMACReadReg(gmacdev->MacBase, GmacConfig); if ((status & GmacPadCrcStrip)) { TR("strips status : %u\n", status & GmacPadCrcStrip); } return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* asynchronously removes a filtering record by posting a REMOVE_FILTERING_RECORD event to the event queue */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBTriggerRemovePortUpdate(IxEthDBMacAddr *macAddr, IxEthDBPortId portID)
/* asynchronously removes a filtering record by posting a REMOVE_FILTERING_RECORD event to the event queue */ IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBTriggerRemovePortUpdate(IxEthDBMacAddr *macAddr, IxEthDBPortId portID)
{ if (ixEthDBPeek(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS) != IX_ETH_DB_NO_SUCH_ADDR) { return ixEthDBTriggerPortUpdate(IX_ETH_DB_REMOVE_FILTERING_RECORD, macAddr, portID, FALSE); } else { return IX_ETH_DB_NO_SUCH_ADDR; } }
EmcraftSystems/u-boot
C++
Other
181
/* DMA Stream Set Peripheral Word Width. Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_set_peripheral_size(uint32_t dma, uint8_t stream, uint32_t peripheral_size)
/* DMA Stream Set Peripheral Word Width. Ensure that the stream is disabled otherwise the setting will not be changed. */ void dma_set_peripheral_size(uint32_t dma, uint8_t stream, uint32_t peripheral_size)
{ DMA_SCR(dma, stream) &= ~(DMA_SxCR_PSIZE_MASK); DMA_SCR(dma, stream) |= peripheral_size; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Write data to a file. The stable flag requests synchronous writes. N.B. After this call fhp needs an fh_put */
__be32 nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, int *stablep)
/* Write data to a file. The stable flag requests synchronous writes. N.B. After this call fhp needs an fh_put */ __be32 nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, int *stablep)
{ __be32 err = 0; if (file) { err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE); if (err) goto out; err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt, stablep); } else { err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_WRITE, &file); if (err) goto out; if (cnt) err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt, stablep); nfsd_close(file); } out: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Triggers a pending transmit for the specified discover-characteristic-by-uuid proc. */
static int ble_gattc_disc_chr_uuid_tx(struct ble_gattc_proc *proc)
/* Triggers a pending transmit for the specified discover-characteristic-by-uuid proc. */ static int ble_gattc_disc_chr_uuid_tx(struct ble_gattc_proc *proc)
{ ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_CHARACTERISTIC); int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); rc = ble_att_clt_tx_read_type(proc->conn_handle, proc->disc_chr_uuid.prev_handle + 1, proc->disc_chr_uuid.end_handle, &uuid.u); if (rc != 0) { return rc; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Enables or disables the SS output for the selected SPI. */
void SPI_SSOutputCmd(SPI_TypeDef *SPIx, FunctionalState NewState)
/* Enables or disables the SS output for the selected SPI. */ void SPI_SSOutputCmd(SPI_TypeDef *SPIx, FunctionalState NewState)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SPIx->CR2 |= SPI_CR2_SSOE; } else { SPIx->CR2 &= (uint16_t)~((uint16_t)SPI_CR2_SSOE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @acb: The adapter device to be updated @dcb: A device that has previously been added to the adapter. */
static void adapter_remove_and_free_device(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb)
/* @acb: The adapter device to be updated @dcb: A device that has previously been added to the adapter. */ static void adapter_remove_and_free_device(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb)
{ if (list_size(&dcb->srb_going_list) > 1) { dprintkdbg(DBG_1, "adapter_remove_and_free_device: <%02i-%i> " "Won't remove because of %i active requests.\n", dcb->target_id, dcb->target_lun, list_size(&dcb->srb_going_list)); return; } adapter_remove_device(acb, dcb); kfree(dcb); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the PWM interrupt flag of the PWM module. The */
xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Get the PWM interrupt flag of the PWM module. The */ xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulChannelTemp; ulChannelTemp = ulChannel; xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5))); if (ulIntType == PWM_INT_PWM) { return ((xHWREG(ulBase + PWM_INTSTS) & (1 << ulChannelTemp)) ? xtrue : xfalse); } else if (ulIntType == PWM_INT_DUTY) { return ((xHWREG(ulBase + PWM_INTSTS) & (0x100 << ulChannelTemp)) ? xtrue : xfalse); } else { return ((xHWREG(ulBase + PWM_INTSTS) & (0x01010000 << ulChannelTemp)) ? xtrue : xfalse); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Perform basic hardware initialization at boot. This needs to be run at the very beginning. So the init priority has to be 0 (zero). */
static int atmel_same70_init(void)
/* Perform basic hardware initialization at boot. This needs to be run at the very beginning. So the init priority has to be 0 (zero). */ static int atmel_same70_init(void)
{ if (CHIPID->CHIPID_CIDR != CHIP_CIDR) { LOG_WRN("CIDR mismatch: chip = 0x%08x vs HAL = 0x%08x", (uint32_t)CHIPID->CHIPID_CIDR, (uint32_t)CHIP_CIDR); } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Compatibility macros for busy handling of network devices. */
static void netiucv_clear_busy(struct net_device *dev)
/* Compatibility macros for busy handling of network devices. */ static void netiucv_clear_busy(struct net_device *dev)
{ struct netiucv_priv *priv = netdev_priv(dev); clear_bit(0, &priv->tbusy); netif_wake_queue(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a text device path node to Vendor Hardware device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenHw(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Vendor Hardware device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenHw(CHAR16 *TextDeviceNode)
{ return ConvertFromTextVendor ( TextDeviceNode, HARDWARE_DEVICE_PATH, HW_VENDOR_DP ); }
tianocore/edk2
C++
Other
4,240
/* Sets the Mac address in to GMAC register. This function sets the MAC address to the MAC register in question. */
s32 synopGMAC_set_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
/* Sets the Mac address in to GMAC register. This function sets the MAC address to the MAC register in question. */ s32 synopGMAC_set_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
{ u32 data; data = (MacAddr[5] << 8) | MacAddr[4]; synopGMACWriteReg(gmacdev->MacBase, MacHigh, data); data = (MacAddr[3] << 24) | (MacAddr[2] << 16) | (MacAddr[1] << 8) | MacAddr[0] ; synopGMACWriteReg(gmacdev->MacBase, MacLow, data); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets value to the selected output port pin. */
void gpio_write(gpio_t *obj, int value)
/* Sets value to the selected output port pin. */ void gpio_write(gpio_t *obj, int value)
{ assert_param(obj->pin != (PinName)NC); GPIO_WriteBit(obj->pin, value); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* The heartbeat timer of MLD module. It sends out a solicited MLD report when DelayTimer expires. */
VOID Ip6MldTimerTicking(IN IP6_SERVICE *IpSb)
/* The heartbeat timer of MLD module. It sends out a solicited MLD report when DelayTimer expires. */ VOID Ip6MldTimerTicking(IN IP6_SERVICE *IpSb)
{ IP6_MLD_GROUP *Group; LIST_ENTRY *Entry; NET_LIST_FOR_EACH (Entry, &IpSb->MldCtrl.Groups) { Group = NET_LIST_USER_STRUCT (Entry, IP6_MLD_GROUP, Link); if ((Group->DelayTimer > 0) && (--Group->DelayTimer == 0)) { Ip6SendMldReport (IpSb, NULL, &Group->Address); } } }
tianocore/edk2
C++
Other
4,240
/* If the connection is idle and we are restarting, then we don't want to do any Vegas calculations until we get fresh RTT samples. So when we restart, we reset our Vegas state to a clean slate. After we get acks for this flight of packets, */
void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
/* If the connection is idle and we are restarting, then we don't want to do any Vegas calculations until we get fresh RTT samples. So when we restart, we reset our Vegas state to a clean slate. After we get acks for this flight of packets, */ void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
{ if (event == CA_EVENT_CWND_RESTART || event == CA_EVENT_TX_START) tcp_vegas_init(sk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* XXX: add support for the rest of enum nl80211_reg_rule_flags, we may want to just have the channel structure use these */
static u32 map_regdom_flags(u32 rd_flags)
/* XXX: add support for the rest of enum nl80211_reg_rule_flags, we may want to just have the channel structure use these */ static u32 map_regdom_flags(u32 rd_flags)
{ u32 channel_flags = 0; if (rd_flags & NL80211_RRF_PASSIVE_SCAN) channel_flags |= IEEE80211_CHAN_PASSIVE_SCAN; if (rd_flags & NL80211_RRF_NO_IBSS) channel_flags |= IEEE80211_CHAN_NO_IBSS; if (rd_flags & NL80211_RRF_DFS) channel_flags |= IEEE80211_CHAN_RADAR; return channel_flags; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read from port 'port' register 'reg', where the registers for the different ports are 'spacing' registers apart. */
static u16 pm3386_port_reg_read(int port, int _reg, int spacing)
/* Read from port 'port' register 'reg', where the registers for the different ports are 'spacing' registers apart. */ static u16 pm3386_port_reg_read(int port, int _reg, int spacing)
{ int reg; reg = _reg; if (port & 1) reg += spacing; return pm3386_reg_read(port >> 1, reg); }
robutest/uclinux
C++
GPL-2.0
60
/* if device has been registered for the given port and unit then return 1 - allows identification of which devices need to be attached or detached */
static int check_maple_device(struct device *device, void *portptr)
/* if device has been registered for the given port and unit then return 1 - allows identification of which devices need to be attached or detached */ static int check_maple_device(struct device *device, void *portptr)
{ struct maple_device_specify *ds; struct maple_device *mdev; ds = portptr; mdev = to_maple_dev(device); if (mdev->port == ds->port && mdev->unit == ds->unit) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciSegmentBitFieldAndThenOr16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData, IN UINT16 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciSegmentBitFieldAndThenOr16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData, IN UINT16 OrData)
{ return PciSegmentWrite16 ( Address, BitFieldAndThenOr16 (PciSegmentRead16 (Address), StartBit, EndBit, AndData, OrData) ); }
tianocore/edk2
C++
Other
4,240
/* This function gets the global errno for the current thread. */
rt_err_t rt_get_errno(void)
/* This function gets the global errno for the current thread. */ rt_err_t rt_get_errno(void)
{ rt_thread_t tid = RT_NULL; if (rt_interrupt_get_nest() != 0) { return __rt_errno; } tid = rt_thread_self(); if (tid == RT_NULL) { return __rt_errno; } return tid->error; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disables the chip select in software controlled mode */
void SPICSDisable(unsigned long ulBase)
/* Disables the chip select in software controlled mode */ void SPICSDisable(unsigned long ulBase)
{ HWREG( ulBase+MCSPI_O_CH0CONF) &= ~MCSPI_CH0CONF_FORCE; }
micropython/micropython
C++
Other
18,334
/* Set a color using the three RGB LEDs. */
static int set_static_color(const struct device *dev, uint8_t r, uint8_t g, uint8_t b)
/* Set a color using the three RGB LEDs. */ static int set_static_color(const struct device *dev, uint8_t r, uint8_t g, uint8_t b)
{ int ret; r = scale_color_to_percent(r); g = scale_color_to_percent(g); b = scale_color_to_percent(b); ret = led_set_brightness(dev, LED_R, r); if (ret) { LOG_ERR("Failed to set color."); return ret; } ret = led_set_brightness(dev, LED_G, g); if (ret) { LOG_ERR("Failed to set color."); return ret; } ret = led_set_brightness(dev, LED_B, b); if (ret) { LOG_ERR("Failed to set color."); return ret; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Count events. This is almost the same as the above mon_bin_fetch, only we do not store offsets into user vector, and we have no limit. */
static int mon_bin_queued(struct mon_reader_bin *rp)
/* Count events. This is almost the same as the above mon_bin_fetch, only we do not store offsets into user vector, and we have no limit. */ static int mon_bin_queued(struct mon_reader_bin *rp)
{ unsigned int cur_out; unsigned int bytes, avail; unsigned int size; unsigned int nevents; struct mon_bin_hdr *ep; unsigned long flags; mutex_lock(&rp->fetch_lock); spin_lock_irqsave(&rp->b_lock, flags); avail = rp->b_cnt; spin_unlock_irqrestore(&rp->b_lock, flags); cur_out = rp->b_out; nevents = 0; bytes = 0; while (bytes < avail) { ep = MON_OFF2HDR(rp, cur_out); nevents++; size = ep->len_cap + PKT_SIZE; size = (size + PKT_ALIGN-1) & ~(PKT_ALIGN-1); if ((cur_out += size) >= rp->b_size) cur_out -= rp->b_size; bytes += size; } mutex_unlock(&rp->fetch_lock); return nevents; }
robutest/uclinux
C++
GPL-2.0
60
/* The VLSI Golden Gate II has only 512K of PCI configuration space, so we limit the bus number to 3 bits */
int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off, int len, u32 *val)
/* The VLSI Golden Gate II has only 512K of PCI configuration space, so we limit the bus number to 3 bits */ int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off, int len, u32 *val)
{ volatile void __iomem *cfg_data; struct pci_controller *hose = pci_bus_to_host(bus); if (bus->number > 7) return PCIBIOS_DEVICE_NOT_FOUND; cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off); switch (len) { case 1: *val = in_8(cfg_data); break; case 2: *val = in_le16(cfg_data); break; default: *val = in_le32(cfg_data); break; } return PCIBIOS_SUCCESSFUL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Checks if a buffer has all its values are equal to zero. */
TestStatus eBuffercmp(uint8_t *pBuffer, uint32_t BufferLength)
/* Checks if a buffer has all its values are equal to zero. */ TestStatus eBuffercmp(uint8_t *pBuffer, uint32_t BufferLength)
{ while (BufferLength--) { if ((*pBuffer != 0xFF) && (*pBuffer != 0x00)) { return FAILED; } pBuffer++; } return PASSED; }
remotemcu/remcu-chip-sdks
C++
null
436
/* We don't have sanity checking for nptcg value. It's the user's responsibility for valid nptcg value on the platform. Otherwise, kernel may hang in some cases. */
static int __init set_nptcg(char *str)
/* We don't have sanity checking for nptcg value. It's the user's responsibility for valid nptcg value on the platform. Otherwise, kernel may hang in some cases. */ static int __init set_nptcg(char *str)
{ int value = 0; get_option(&str, &value); setup_ptcg_sem(value, NPTCG_FROM_KERNEL_PARAMETER); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_num_copy(CRNum *a_dest, CRNum *a_src)
/* Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_num_copy(CRNum *a_dest, CRNum *a_src)
{ g_return_val_if_fail (a_dest && a_src, CR_BAD_PARAM_ERROR); memcpy (a_dest, a_src, sizeof (CRNum)); return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function retrieves the WiFi interface's Gateway address. */
WIFI_Status_t WIFI_GetGateway_Address(uint8_t *Gateway_addr)
/* This function retrieves the WiFi interface's Gateway address. */ WIFI_Status_t WIFI_GetGateway_Address(uint8_t *Gateway_addr)
{ WIFI_Status_t ret = WIFI_STATUS_ERROR; if(EsWifiObj.NetSettings.IsConnected) { memcpy(Gateway_addr, EsWifiObj.NetSettings.Gateway_Addr, 4); ret = WIFI_STATUS_OK; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* param base SPDIF base pointer param handle Pointer to the spdif_handle_t structure which stores the transfer state. */
void SPDIF_TransferAbortReceive(SPDIF_Type *base, spdif_handle_t *handle)
/* param base SPDIF base pointer param handle Pointer to the spdif_handle_t structure which stores the transfer state. */ void SPDIF_TransferAbortReceive(SPDIF_Type *base, spdif_handle_t *handle)
{ assert(handle != NULL); SPDIF_DisableInterrupts(base, (uint32_t)kSPDIF_UChannelReceiveRegisterFull | (uint32_t)kSPDIF_QChannelReceiveRegisterFull | (uint32_t)kSPDIF_RxFIFOFull | (uint32_t)kSPDIF_RxControlChannelChange); handle->state = kSPDIF_Idle; (void)memset(handle->spdifQueue, 0, sizeof(spdif_transfer_t) * SPDIF_XFER_QUEUE_SIZE); handle->queueDriver = 0; handle->queueUser = 0; }
eclipse-threadx/getting-started
C++
Other
310
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
{ if(hpcd->Instance==USB) { __HAL_RCC_USB_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Enable External Secure Interrupt. Enables a secure device-specific interrupt in the NVIC interrupt controller. */
void drv_nvic_enable_sirq(int32_t IRQn)
/* Enable External Secure Interrupt. Enables a secure device-specific interrupt in the NVIC interrupt controller. */ void drv_nvic_enable_sirq(int32_t IRQn)
{ NVIC->ISSR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Return if the PE image section is aligned. */
BOOLEAN IsMemoryProtectionSectionAligned(IN UINT32 SectionAlignment, IN EFI_MEMORY_TYPE MemoryType)
/* Return if the PE image section is aligned. */ BOOLEAN IsMemoryProtectionSectionAligned(IN UINT32 SectionAlignment, IN EFI_MEMORY_TYPE MemoryType)
{ UINT32 PageAlignment; switch (MemoryType) { case EfiRuntimeServicesCode: case EfiACPIMemoryNVS: PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY; break; case EfiRuntimeServicesData: case EfiACPIReclaimMemory: ASSERT (FALSE); PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY; break; case EfiBootServicesCode: case EfiLoaderCode: case EfiReservedMemoryType: PageAlignment = EFI_PAGE_SIZE; break; default: ASSERT (FALSE); PageAlignment = EFI_PAGE_SIZE; break; } if ((SectionAlignment & (PageAlignment - 1)) != 0) { return FALSE; } else { return TRUE; } }
tianocore/edk2
C++
Other
4,240
/* This file is part of the Simba project. */
int mock_write_ds18b20_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_ds18b20_module_init(int res)
{ harness_mock_write("ds18b20_module_init()", NULL, 0); harness_mock_write("ds18b20_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* brief Sets IRQ handler for given LP_FLEXCOMM module. It is used by drivers register IRQ handler according to LP_FLEXCOMM mode */
void LP_FLEXCOMM_SetIRQHandler(uint32_t instance, lpflexcomm_irq_handler_t handler, void *lpflexcommHandle, LP_FLEXCOMM_PERIPH_T periph)
/* brief Sets IRQ handler for given LP_FLEXCOMM module. It is used by drivers register IRQ handler according to LP_FLEXCOMM mode */ void LP_FLEXCOMM_SetIRQHandler(uint32_t instance, lpflexcomm_irq_handler_t handler, void *lpflexcommHandle, LP_FLEXCOMM_PERIPH_T periph)
{ assert(instance < (uint32_t)ARRAY_SIZE(s_lpflexcommBaseAddrs)); s_lpflexcommIrqHandler[periph][instance] = NULL; s_lpflexcommHandle[periph][instance] = lpflexcommHandle; s_lpflexcommIrqHandler[periph][instance] = handler; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Subtract two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI CryptoServiceBigNumSub(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
/* Subtract two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */ BOOLEAN EFIAPI CryptoServiceBigNumSub(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes)
{ return CALL_BASECRYPTLIB (Bn.Services.Sub, BigNumSub, (BnA, BnB, BnRes), FALSE); }
tianocore/edk2
C++
Other
4,240
/* The control element is supposed to have the private_value field set up via HDA_COMPOSE_AMP_VAL*() or related macros. */
int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
/* The control element is supposed to have the private_value field set up via HDA_COMPOSE_AMP_VAL*() or related macros. */ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); hda_nid_t nid = get_amp_nid(kcontrol); int chs = get_amp_channels(kcontrol); int dir = get_amp_direction(kcontrol); int idx = get_amp_index(kcontrol); unsigned int ofs = get_amp_offset(kcontrol); long *valp = ucontrol->value.integer.value; int change = 0; snd_hda_power_up(codec); if (chs & 1) { change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); valp++; } if (chs & 2) change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); snd_hda_power_down(codec); return change; }
robutest/uclinux
C++
GPL-2.0
60
/* We have to reset the PHY immediately before doing a software SoC reset, because otherwise the Ethernet block of the SoC will hang after reset. */
void lpc178x_phy_final_reset(void)
/* We have to reset the PHY immediately before doing a software SoC reset, because otherwise the Ethernet block of the SoC will hang after reset. */ void lpc178x_phy_final_reset(void)
{ lpc178x_periph_enable(LPC178X_SCC_PCONP_PCENET_MSK, 1); __lpc_mii_mngt_reset(lpc178x_pldat); writel(0, LPC_ENET_MAC1(lpc178x_pldat->net_base)); writel(0, LPC_ENET_MAC2(lpc178x_pldat->net_base)); phy_write(lpc178x_pldat->phy_dev, MII_BMCR, BMCR_RESET); lpc178x_periph_enable(LPC178X_SCC_PCONP_PCENET_MSK, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* The function sets the frequency of the ADCCLK by configuring the DCLK to ADCCLK ratio in the Configuration Register #2 */
void XAdcPs_SetAdcClkDivisor(XAdcPs *InstancePtr, u8 Divisor)
/* The function sets the frequency of the ADCCLK by configuring the DCLK to ADCCLK ratio in the Configuration Register #2 */ void XAdcPs_SetAdcClkDivisor(XAdcPs *InstancePtr, u8 Divisor)
{ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); XAdcPs_WriteInternalReg(InstancePtr, XADCPS_CFR2_OFFSET, ((u32)Divisor << XADCPS_CFR2_CD_SHIFT)); }
ua1arn/hftrx
C++
null
69
/* If ValueA is equal ValueB, then TRUE is returned. If ValueA is not equal to ValueB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA, and DescriptionB are recorded and FALSE is returned. */
BOOLEAN EFIAPI UnitTestAssertEqual(IN UINT64 ValueA, IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB)
/* If ValueA is equal ValueB, then TRUE is returned. If ValueA is not equal to ValueB, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, DescriptionA, and DescriptionB are recorded and FALSE is returned. */ BOOLEAN EFIAPI UnitTestAssertEqual(IN UINT64 ValueA, IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *DescriptionA, IN CONST CHAR8 *DescriptionB)
{ CHAR8 TempStr[MAX_STRING_SIZE]; snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_EQUAL(%s:%llx, %s:%llx)", DescriptionA, ValueA, DescriptionB, ValueB); _assert_true ((ValueA == ValueB), TempStr, FileName, (INT32)LineNumber); return (ValueA == ValueB); }
tianocore/edk2
C++
Other
4,240
/* removes the old data from the statistics. All data that is older than TID_MAX_TIME_DIFF, will be deleted. */
static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time)
/* removes the old data from the statistics. All data that is older than TID_MAX_TIME_DIFF, will be deleted. */ static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time)
{ u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; while (tl->queue_count && (tl->time_stamp < oldest_time)) { tl->total -= tl->packet_count[tl->head]; tl->packet_count[tl->head] = 0; tl->time_stamp += TID_QUEUE_CELL_SPACING; tl->queue_count--; tl->head++; if (tl->head >= TID_QUEUE_MAX_SIZE) tl->head = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Send START condition to NVRAM to wake it up. */
static void S24C16_start(struct sym_device *np, u_char *gpreg)
/* Send START condition to NVRAM to wake it up. */ static void S24C16_start(struct sym_device *np, u_char *gpreg)
{ S24C16_set_bit(np, 1, gpreg, SET_BIT); S24C16_set_bit(np, 0, gpreg, SET_CLK); S24C16_set_bit(np, 0, gpreg, CLR_BIT); S24C16_set_bit(np, 0, gpreg, CLR_CLK); }
robutest/uclinux
C++
GPL-2.0
60
/* vpd_get_packet() - returns next VPD packet or NULL. */
static vpd_packet_t* vpd_get_packet(vpd_packet_t *vpd_packet)
/* vpd_get_packet() - returns next VPD packet or NULL. */ static vpd_packet_t* vpd_get_packet(vpd_packet_t *vpd_packet)
{ vpd_packet_t *packet = vpd_packet; if (packet != NULL) { if (packet->identifier == VPD_PID_TERM) return NULL; else packet = (vpd_packet_t *)((char *)packet + packet->size + 2); } return packet; }
EmcraftSystems/u-boot
C++
Other
181
/* Created on: 15 feb. 2019 Author: Daniel Mårtensson Take the absolue values of every element of matrix A, size row x column */
void eabs(double *A, int row, int column)
/* Created on: 15 feb. 2019 Author: Daniel Mårtensson Take the absolue values of every element of matrix A, size row x column */ void eabs(double *A, int row, int column)
{ *A = fabsf(*(A)); A++; } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Internal function to read the current tick counter of ACPI. */
UINT32 InternalAcpiGetTimerTick(VOID)
/* Internal function to read the current tick counter of ACPI. */ UINT32 InternalAcpiGetTimerTick(VOID)
{ if (mPmTimerReg == 0) { AcpiTimerLibConstructor (); } return IoRead32 (mPmTimerReg); }
tianocore/edk2
C++
Other
4,240
/* Start the specified timer in one-shot mode with specified period and interrupt handler. */
void gtimer_start_one_shout(gtimer_t *obj, uint32_t duration_us, void *handler, uint32_t hid)
/* Start the specified timer in one-shot mode with specified period and interrupt handler. */ void gtimer_start_one_shout(gtimer_t *obj, uint32_t duration_us, void *handler, uint32_t hid)
{ assert_param(obj->timer_id < GTIMER_MAX); obj->is_periodcal = _FALSE; obj->handler = handler; obj->hid = hid; gtimer_reload(obj, duration_us); gtimer_start(obj); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This reads the keyboard status port, and does the appropriate action. */
static unsigned char handle_kbd_event(void)
/* This reads the keyboard status port, and does the appropriate action. */ static unsigned char handle_kbd_event(void)
{ unsigned char status = kbd_read_status(); unsigned int work = 10000; while ((--work > 0) && (status & KBD_STAT_OBF)) { unsigned char scancode; scancode = kbd_read_input(); if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) { if (status & KBD_STAT_MOUSE_OBF) ; else handle_scancode(scancode); } status = kbd_read_status(); } if (!work) PRINTF("pc_keyb: controller jammed (0x%02X).\n", status); return status; }
EmcraftSystems/u-boot
C++
Other
181
/* This function converts an input device structure to a Unicode string. */
CHAR16* BmDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
/* This function converts an input device structure to a Unicode string. */ CHAR16* BmDevicePathToStr(IN EFI_DEVICE_PATH_PROTOCOL *DevPath)
{ EFI_STATUS Status; CHAR16 *ToText; EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText; if (DevPath == NULL) { return NULL; } Status = gBS->LocateProtocol ( &gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevPathToText ); ASSERT_EFI_ERROR (Status); ToText = DevPathToText->ConvertDevicePathToText ( DevPath, FALSE, TRUE ); ASSERT (ToText != NULL); return ToText; }
tianocore/edk2
C++
Other
4,240
/* wait for space to appear in the transmit/ACK window */
static int rxrpc_wait_for_tx_window(struct rxrpc_sock *rx, struct rxrpc_call *call, long *timeo)
/* wait for space to appear in the transmit/ACK window */ static int rxrpc_wait_for_tx_window(struct rxrpc_sock *rx, struct rxrpc_call *call, long *timeo)
{ DECLARE_WAITQUEUE(myself, current); int ret; _enter(",{%d},%ld", CIRC_SPACE(call->acks_head, call->acks_tail, call->acks_winsz), *timeo); add_wait_queue(&call->tx_waitq, &myself); for (;;) { set_current_state(TASK_INTERRUPTIBLE); ret = 0; if (CIRC_SPACE(call->acks_head, call->acks_tail, call->acks_winsz) > 0) break; if (signal_pending(current)) { ret = sock_intr_errno(*timeo); break; } release_sock(&rx->sk); *timeo = schedule_timeout(*timeo); lock_sock(&rx->sk); } remove_wait_queue(&call->tx_waitq, &myself); set_current_state(TASK_RUNNING); _leave(" = %d", ret); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sends the currently active setting of the given interface to the USB host. If alternate settings are not supported, this function STALLs the control pipe. */
static void GetInterface(const USBDDriver *pDriver, unsigned char infnum)
/* Sends the currently active setting of the given interface to the USB host. If alternate settings are not supported, this function STALLs the control pipe. */ static void GetInterface(const USBDDriver *pDriver, unsigned char infnum)
{ if (!pDriver->pInterfaces) { USBD_Stall(0); } else { USBD_Write(0, &(pDriver->pInterfaces[infnum]), 1, 0, 0); } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* If OpCodeHandle is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT(). */
UINT8* EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
/* If OpCodeHandle is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT(). */ UINT8* EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
{ EFI_IFR_GUID OpCode; EFI_IFR_GUID *OpCodePointer; ASSERT (Guid != NULL); ASSERT (OpCodeSize >= sizeof (OpCode)); ZeroMem (&OpCode, sizeof (OpCode)); CopyGuid ((EFI_GUID *)(VOID *)&OpCode.Guid, Guid); OpCodePointer = (EFI_IFR_GUID *)InternalHiiCreateOpCodeExtended ( OpCodeHandle, &OpCode, EFI_IFR_GUID_OP, sizeof (OpCode), OpCodeSize - sizeof (OpCode), 0 ); if ((OpCodePointer != NULL) && (GuidOpCode != NULL)) { CopyMem (OpCodePointer + 1, (EFI_IFR_GUID *)GuidOpCode + 1, OpCodeSize - sizeof (OpCode)); } return (UINT8 *)OpCodePointer; }
tianocore/edk2
C++
Other
4,240
/* ubi_calc_fm_size - calculates the fastmap size in bytes for an UBI device. @ubi: UBI device description object */
size_t ubi_calc_fm_size(struct ubi_device *ubi)
/* ubi_calc_fm_size - calculates the fastmap size in bytes for an UBI device. @ubi: UBI device description object */ size_t ubi_calc_fm_size(struct ubi_device *ubi)
{ size_t size; size = sizeof(struct ubi_fm_sb) + sizeof(struct ubi_fm_hdr) + sizeof(struct ubi_fm_scan_pool) + sizeof(struct ubi_fm_scan_pool) + (ubi->peb_count * sizeof(struct ubi_fm_ec)) + (sizeof(struct ubi_fm_eba) + (ubi->peb_count * sizeof(__be32))) + sizeof(struct ubi_fm_volhdr) * UBI_MAX_VOLUMES; return roundup(size, ubi->leb_size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function reads a node defined by @zbr from the flash media. Returns zero in case of success or a negative negative error code in case of failure. */
int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
/* This function reads a node defined by @zbr from the flash media. Returns zero in case of success or a negative negative error code in case of failure. */ int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
{ union ubifs_key key1, *key = &zbr->key; int err, type = key_type(c, key); err = ubifs_read_node(c, node, type, zbr->len, zbr->lnum, zbr->offs); if (err) { dbg_tnc("key %s", DBGKEY(key)); return err; } key_read(c, node + UBIFS_KEY_OFFSET, &key1); if (!keys_eq(c, key, &key1)) { ubifs_err("bad key in node at LEB %d:%d", zbr->lnum, zbr->offs); dbg_tnc("looked for key %s found node's key %s", DBGKEY(key), DBGKEY1(&key1)); dbg_dump_node(c, node); return -EINVAL; } return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Remove all inodes in the system for a device, delete the partitions and make device unusable by setting its size to zero. */
void dasd_destroy_partitions(struct dasd_block *block)
/* Remove all inodes in the system for a device, delete the partitions and make device unusable by setting its size to zero. */ void dasd_destroy_partitions(struct dasd_block *block)
{ struct blkpg_partition bpart; struct blkpg_ioctl_arg barg; struct block_device *bdev; bdev = block->bdev; block->bdev = NULL; memset(&bpart, 0, sizeof(struct blkpg_partition)); memset(&barg, 0, sizeof(struct blkpg_ioctl_arg)); barg.data = (void __force __user *) &bpart; barg.op = BLKPG_DEL_PARTITION; for (bpart.pno = block->gdp->minors - 1; bpart.pno > 0; bpart.pno--) ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg); invalidate_partition(block->gdp, 0); blkdev_put(bdev, FMODE_READ); set_capacity(block->gdp, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Select the specified ADC channel as an analog watchdog channel. */
void ADC_AWD_SelectCh(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint8_t u8Ch)
/* Select the specified ADC channel as an analog watchdog channel. */ void ADC_AWD_SelectCh(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint8_t u8Ch)
{ DDL_ASSERT(IS_ADC_CH(ADCx, u8Ch)); (void)(u8AwdUnit); SET_REG32_BIT(ADCx->AWDCHSR, 1UL << u8Ch); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Selects the clock source to output on MCO pin (PA8). */
void RCC_MCOConfig(uint8_t RCC_MCOSource)
/* Selects the clock source to output on MCO pin (PA8). */ void RCC_MCOConfig(uint8_t RCC_MCOSource)
{ assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource)); *(__IO uint8_t *) CFGR_BYTE3_ADDRESS = RCC_MCOSource; }
ajhc/demo-cortex-m3
C++
null
38
/* Enable/disable specified GIRQ's aggregated output. Aggregated output is the bit-wise or of all the GIRQ's result bits. */
void mchp_xec_ecia_girq_aggr_en(uint8_t girq_num, uint8_t enable)
/* Enable/disable specified GIRQ's aggregated output. Aggregated output is the bit-wise or of all the GIRQ's result bits. */ void mchp_xec_ecia_girq_aggr_en(uint8_t girq_num, uint8_t enable)
{ struct ecia_regs *regs = ECIA_XEC_REG_BASE; if (enable) { regs->BLK_EN_SET = BIT(girq_num); } else { regs->BLK_EN_CLR = BIT(girq_num); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Initialize an input device driver with default values. It is used to surly have known values in the fields ant not memory junk. After it you can set the fields. */
void lv_indev_drv_init(lv_indev_drv_t *driver)
/* Initialize an input device driver with default values. It is used to surly have known values in the fields ant not memory junk. After it you can set the fields. */ void lv_indev_drv_init(lv_indev_drv_t *driver)
{ memset(driver, 0, sizeof(lv_indev_drv_t)); driver->type = LV_INDEV_TYPE_NONE; driver->drag_limit = LV_INDEV_DEF_DRAG_LIMIT; driver->drag_throw = LV_INDEV_DEF_DRAG_THROW; driver->long_press_time = LV_INDEV_DEF_LONG_PRESS_TIME; driver->long_press_rep_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Helper dissector for the SKKE Data commands (SKKE3 and */
static guint dissect_zbee_aps_skke_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
/* Helper dissector for the SKKE Data commands (SKKE3 and */ static guint dissect_zbee_aps_skke_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{ proto_tree_add_item(tree, hf_zbee_aps_cmd_initiator, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; proto_tree_add_item(tree, hf_zbee_aps_cmd_responder, tvb, offset, 8, ENC_LITTLE_ENDIAN); offset += 8; proto_tree_add_item(tree, hf_zbee_aps_cmd_mac, tvb, offset, ZBEE_APS_CMD_SKKE_DATA_LENGTH, ENC_NA); offset += ZBEE_APS_CMD_SKKE_DATA_LENGTH; return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Decrease an entry's reference count and free if necessary when the reference count drops to zero. */
void qed_unref_l2_cache_entry(CachedL2Table *entry)
/* Decrease an entry's reference count and free if necessary when the reference count drops to zero. */ void qed_unref_l2_cache_entry(CachedL2Table *entry)
{ if (!entry) { return; } entry->ref--; trace_qed_unref_l2_cache_entry(entry, entry->ref); if (entry->ref == 0) { qemu_vfree(entry->table); g_free(entry); } }
ve3wwg/teensy3_qemu
C++
Other
15
/* \breif This function is used to generate a falling edge, as the of Timer counting source. */
void EdgeGenerate(void)
/* \breif This function is used to generate a falling edge, as the of Timer counting source. */ void EdgeGenerate(void)
{ int i; xGPIOSPinWrite(PC12, 1); for(i = 0; i < 5; i++); xGPIOSPinWrite(PC12, 0); for(i = 0; i < 5; i++); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Adds a new record to the iir_f_t instances. */
void iir_f_add(iir_f_t *iir, float x)
/* Adds a new record to the iir_f_t instances. */ void iir_f_add(iir_f_t *iir, float x)
{ iir->k++; if (1 == iir->k) { iir->avg = x; } else { iir->avg = iir->alpha * x + (1.0 - iir->alpha) * iir->avg; } }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock. */
static enum xp_retval xp_remote_memcpy_sn2(unsigned long dst_pa, const unsigned long src_pa, size_t len)
/* Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock. */ static enum xp_retval xp_remote_memcpy_sn2(unsigned long dst_pa, const unsigned long src_pa, size_t len)
{ bte_result_t ret; ret = bte_copy(src_pa, dst_pa, len, (BTE_NOTIFY | BTE_WACQUIRE), NULL); if (ret == BTE_SUCCESS) return xpSuccess; if (is_shub2()) { dev_err(xp, "bte_copy() on shub2 failed, error=0x%x dst_pa=" "0x%016lx src_pa=0x%016lx len=%ld\\n", ret, dst_pa, src_pa, len); } else { dev_err(xp, "bte_copy() failed, error=%d dst_pa=0x%016lx " "src_pa=0x%016lx len=%ld\\n", ret, dst_pa, src_pa, len); } return xpBteCopyError; }
robutest/uclinux
C++
GPL-2.0
60
/* This CCB has been skipped by the NCR. Queue it in the corresponding unit queue. */
static void ncr_ccb_skipped(struct ncb *np, struct ccb *cp)
/* This CCB has been skipped by the NCR. Queue it in the corresponding unit queue. */ static void ncr_ccb_skipped(struct ncb *np, struct ccb *cp)
{ struct tcb *tp = &np->target[cp->target]; struct lcb *lp = tp->lp[cp->lun]; if (lp && cp != np->ccb) { cp->host_status &= ~HS_SKIPMASK; cp->start.schedule.l_paddr = cpu_to_scr(NCB_SCRIPT_PHYS (np, select)); list_move_tail(&cp->link_ccbq, &lp->skip_ccbq); if (cp->queued) { --lp->queuedccbs; } } if (cp->queued) { --np->queuedccbs; cp->queued = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Registers an interrupt handler for the quadrature encoder interrupt. */
void QEIIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* Registers an interrupt handler for the quadrature encoder interrupt. */ void QEIIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ uint32_t ui32Int; ASSERT((ui32Base == QEI0_BASE) || (ui32Base == QEI1_BASE)); ui32Int = _QEIIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntRegister(ui32Int, pfnHandler); IntEnable(ui32Int); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* When implicit back refs is used, information about the lowest key and level of the tree block are required. These information are stored in tree block info structure. */
static u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset)
/* When implicit back refs is used, information about the lowest key and level of the tree block are required. These information are stored in tree block info structure. */ static u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset)
{ u32 high_crc = ~(u32)0; u32 low_crc = ~(u32)0; __le64 lenum; lenum = cpu_to_le64(root_objectid); high_crc = crc32c(high_crc, &lenum, sizeof(lenum)); lenum = cpu_to_le64(owner); low_crc = crc32c(low_crc, &lenum, sizeof(lenum)); lenum = cpu_to_le64(offset); low_crc = crc32c(low_crc, &lenum, sizeof(lenum)); return ((u64)high_crc << 31) ^ (u64)low_crc; }
robutest/uclinux
C++
GPL-2.0
60
/* Stores the result of a formatted string into another string. Format arguments are given in a va_list instance. Return the number of characters written. */
signed int vsprintf(char *pString, const char *pFormat, va_list ap)
/* Stores the result of a formatted string into another string. Format arguments are given in a va_list instance. Return the number of characters written. */ signed int vsprintf(char *pString, const char *pFormat, va_list ap)
{ return vsnprintf(pString, CFG_PRINTF_MAXSTRINGSIZE, pFormat, ap); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */
EFI_STATUS EFIAPI XenPvBlkDxeDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */ EFI_STATUS EFIAPI XenPvBlkDxeDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gXenPvBlkDxeDriverBinding, ImageHandle, &gXenPvBlkDxeComponentName, &gXenPvBlkDxeComponentName2 ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* The new UMC device will have a bus ID of the parent with '-n' appended. */
struct umc_dev* umc_device_create(struct device *parent, int n)
/* The new UMC device will have a bus ID of the parent with '-n' appended. */ struct umc_dev* umc_device_create(struct device *parent, int n)
{ struct umc_dev *umc; umc = kzalloc(sizeof(struct umc_dev), GFP_KERNEL); if (umc) { dev_set_name(&umc->dev, "%s-%d", dev_name(parent), n); umc->dev.parent = parent; umc->dev.bus = &umc_bus_type; umc->dev.release = umc_device_release; umc->dev.dma_mask = parent->dma_mask; } return umc; }
robutest/uclinux
C++
GPL-2.0
60
/* we support only one console, the hvc struct is a global var We set the configuration at this point, since we now have a tty */
static int notifier_add_vio(struct hvc_struct *hp, int data)
/* we support only one console, the hvc struct is a global var We set the configuration at this point, since we now have a tty */ static int notifier_add_vio(struct hvc_struct *hp, int data)
{ hp->irq_requested = 1; virtcons_apply_config(vdev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Implementation notes: Special case single element list, unroll/inline the sorting of the first two elements. Some tail recursion is used since we iterate on the bottom-up solution of the problem (we start with a small sorted list and keep merging other lists of the same size to it). */
static struct edge* sort_edges(struct edge *list, unsigned int level, struct edge **head_out)
/* Implementation notes: Special case single element list, unroll/inline the sorting of the first two elements. Some tail recursion is used since we iterate on the bottom-up solution of the problem (we start with a small sorted list and keep merging other lists of the same size to it). */ static struct edge* sort_edges(struct edge *list, unsigned int level, struct edge **head_out)
{ struct edge *head_other, *remaining; unsigned int i; head_other = list->next; if (head_other == NULL) { *head_out = list; return NULL; } remaining = head_other->next; if (list->x.quo <= head_other->x.quo) { *head_out = list; head_other->next = NULL; } else { *head_out = head_other; head_other->prev = list->prev; head_other->next = list; list->prev = head_other; list->next = NULL; } for (i = 0; i < level && remaining; i++) { remaining = sort_edges (remaining, i, &head_other); *head_out = merge_sorted_edges (*head_out, head_other); } return remaining; }
xboot/xboot
C++
MIT License
779
/* QTouch Library measure complete callback function example prototype. This function is called by the library when the touch measurement process for QTouch Library sensors is completed. */
void touch_qt_measure_complete_callback(void)
/* QTouch Library measure complete callback function example prototype. This function is called by the library when the touch measurement process for QTouch Library sensors is completed. */ void touch_qt_measure_complete_callback(void)
{ if(!(p_qt_measure_data->acq_status & TOUCH_BURST_AGAIN)) { touch_qt_time.measurement_done_touch = 1u; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Set up the USART for transmit-only communication at a fixed baud rate. */
static void setup_usart_channel(void)
/* Set up the USART for transmit-only communication at a fixed baud rate. */ static void setup_usart_channel(void)
{ struct usart_config cdc_uart_config; usart_get_config_defaults(&cdc_uart_config); cdc_uart_config.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING; cdc_uart_config.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0; cdc_uart_config.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1; cdc_uart_config.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2; cdc_uart_config.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3; cdc_uart_config.baudrate = 115200; stdio_serial_init(&usart_edbg, EDBG_CDC_MODULE, &cdc_uart_config); usart_enable(&usart_edbg); }
memfault/zero-to-main
C++
null
200