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
/* BACnetTimeStamp ::= CHOICE { time Time, sequenceNumber Unsigned (0..65535), dateTime BACnetDateTime } */
static guint fTimeStamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const gchar *label)
/* BACnetTimeStamp ::= CHOICE { time Time, sequenceNumber Unsigned (0..65535), dateTime BACnetDateTime } */ static guint fTimeStamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const gchar *label)
{ guint8 tag_no = 0, tag_info = 0; guint32 lvt = 0; if (tvb_reported_length_remaining(tvb, offset) > 0) { switch (fTagNo(tvb, offset)) { case 0: offset = fTime(tvb, pinfo, tree, offset, label?label:"time: "); break; case 1: offset = fUnsignedTag(tvb, pinfo, tree, offset, label?label:"sequence number: "); break; case 2: offset += fTagHeaderTree(tvb, pinfo, tree, offset, &tag_no, &tag_info, &lvt); offset = fDateTime(tvb, pinfo, tree, offset, label?label:"date time: "); offset += fTagHeaderTree(tvb, pinfo, tree, offset, &tag_no, &tag_info, &lvt); break; default: return offset; } } return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* pm8001_tag_clear - clear the tags bitmap @pm8001_ha: our hba struct @tag: the found tag associated with the task */
static void pm8001_tag_clear(struct pm8001_hba_info *pm8001_ha, u32 tag)
/* pm8001_tag_clear - clear the tags bitmap @pm8001_ha: our hba struct @tag: the found tag associated with the task */ static void pm8001_tag_clear(struct pm8001_hba_info *pm8001_ha, u32 tag)
{ void *bitmap = pm8001_ha->tags; clear_bit(tag, bitmap); }
robutest/uclinux
C++
GPL-2.0
60
/* clean up after reading from the cells list */
static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
/* clean up after reading from the cells list */ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
{ struct afs_cell *cell = p->private; up_read(&cell->vl_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* Set Wake-up pin trigger type at Deep Power down mode. */
void CLK_EnableDPDWKPin(uint32_t u32TriggerType)
/* Set Wake-up pin trigger type at Deep Power down mode. */ void CLK_EnableDPDWKPin(uint32_t u32TriggerType)
{ CLK->PMUCTL = (CLK->PMUCTL & ~(CLK_PMUCTL_WKPINEN_Msk)) | u32TriggerType; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* See _g_freedesktop_dbus_call_request_name_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_request_name(_GFreedesktopDBus *proxy, const gchar *arg_name, guint arg_flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* See _g_freedesktop_dbus_call_request_name_sync() for the synchronous, blocking version of this method. */ void _g_freedesktop_dbus_call_request_name(_GFreedesktopDBus *proxy, const gchar *arg_name, guint arg_flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ g_dbus_proxy_call (G_DBUS_PROXY (proxy), "RequestName", g_variant_new ("(su)", arg_name, arg_flags), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 0 on failure or 1 on success. */
static int i2o_block_sglist_alloc(struct i2o_controller *c, struct i2o_block_request *ireq, u32 **mptr)
/* Returns 0 on failure or 1 on success. */ static int i2o_block_sglist_alloc(struct i2o_controller *c, struct i2o_block_request *ireq, u32 **mptr)
{ int nents; enum dma_data_direction direction; ireq->dev = &c->pdev->dev; nents = blk_rq_map_sg(ireq->req->q, ireq->req, ireq->sg_table); if (rq_data_dir(ireq->req) == READ) direction = PCI_DMA_FROMDEVICE; else direction = PCI_DMA_TODEVICE; ireq->sg_nents = nents; return i2o_dma_map_sg(c, ireq->sg_table, nents, direction, mptr); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the SDIO Dataaccording to the specified parameters in the dataConfig. */
void SDIO_ConfigData(SDIO_DataConfig_T *dataConfig)
/* Configures the SDIO Dataaccording to the specified parameters in the dataConfig. */ void SDIO_ConfigData(SDIO_DataConfig_T *dataConfig)
{ uint32_t tmpreg = 0; SDIO->DATATIME = dataConfig->dataTimeOut; SDIO->DATALEN = dataConfig->dataLength; tmpreg = SDIO->DCTRL; tmpreg &= 0xFFFFFF08; tmpreg |= (uint32_t)dataConfig->dataBlockSize | dataConfig->transferDir | dataConfig->transferMode | dataConfig->DPSM; SDIO->DCTRL = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* free device informations - private_free callback of port */
static void free_devinfo(void *private)
/* free device informations - private_free callback of port */ static void free_devinfo(void *private)
{ struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private; if (dp->timer) snd_seq_oss_timer_delete(dp->timer); if (dp->writeq) snd_seq_oss_writeq_delete(dp->writeq); if (dp->readq) snd_seq_oss_readq_delete(dp->readq); kfree(dp); }
robutest/uclinux
C++
GPL-2.0
60
/* Pickup a netlink dump response and put it into a cache. */
int nl_cache_pickup(struct nl_sock *sk, struct nl_cache *cache)
/* Pickup a netlink dump response and put it into a cache. */ int nl_cache_pickup(struct nl_sock *sk, struct nl_cache *cache)
{ struct nl_parser_param p = { .pp_cb = pickup_cb, .pp_arg = cache, }; return __cache_pickup(sk, cache, &p); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Parse a hexadecimal encoded character starting at index i in string s. The resulting character will be returned and the index i will be updated to point at the character directly after the end of the encoding, this may be the '\0' terminator of the string. */
static char get_hex_char(const char *s, int *i)
/* Parse a hexadecimal encoded character starting at index i in string s. The resulting character will be returned and the index i will be updated to point at the character directly after the end of the encoding, this may be the '\0' terminator of the string. */ static char get_hex_char(const char *s, int *i)
{ char x[3]; char *endx; long val; x[2] = '\0'; strncpy(x, s + *i, 2); val = strtol(x, &endx, 16); if (!(endx > x)) die("\\x used with no following hex digits\n"); (*i) += endx - x; return val; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function registers and enables the handler specified by InterruptHandler for a processor interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. */
EFI_STATUS RegisterInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
/* This function registers and enables the handler specified by InterruptHandler for a processor interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the handler for the processor interrupt or exception type specified by InterruptType is uninstalled. The installed handler is called once for each processor interrupt or exception. */ EFI_STATUS RegisterInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
{ return (EFI_STATUS)RegisterCpuInterruptHandler (InterruptType, InterruptHandler); }
tianocore/edk2
C++
Other
4,240
/* CLI command to read and display data from the ADC. */
int32_t ad7124_8pmdz_data_read(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
/* CLI command to read and display data from the ADC. */ int32_t ad7124_8pmdz_data_read(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
{ uint32_t sample_no; float odr; if ((arg == NULL) || (*arg == 0)) sample_no = 0; else sample_no = atoi((char *)arg); ad7124_8pmdz_odr_logic_get(dev, &odr); if (odr <= 3200) return ad7124_8pmdz_data_read_nomem(dev, sample_no); else return ad7124_8pmdz_data_read_mem(dev, sample_no); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Configures the output of a timer operating in waveform mode. */
void HRTIM_WaveformOutputConfig(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t Output, HRTIM_OutputCfgTypeDef *pOutputCfg)
/* Configures the output of a timer operating in waveform mode. */ void HRTIM_WaveformOutputConfig(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t Output, HRTIM_OutputCfgTypeDef *pOutputCfg)
{ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, Output)); assert_param(IS_HRTIM_OUTPUTPOLARITY(pOutputCfg->Polarity)); assert_param(IS_HRTIM_OUTPUTIDLESTATE(pOutputCfg->IdleState)); assert_param(IS_HRTIM_OUTPUTIDLEMODE(pOutputCfg->IdleMode)); assert_param(IS_HRTIM_OUTPUTFAULTSTATE(pOutputCfg->FaultState)); assert_param(IS_HRTIM_OUTPUTCHOPPERMODE(pOutputCfg->ChopperModeEnable)); assert_param(IS_HRTIM_OUTPUTBURSTMODEENTRY(pOutputCfg->BurstModeEntryDelayed)); HRTIM_OutputConfig(HRTIMx, TimerIdx, Output, pOutputCfg); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Function for evaluating if a data page swap is required for the tail section on the current page. */
static bool is_tail_data_page_swap_required(void)
/* Function for evaluating if a data page swap is required for the tail section on the current page. */ static bool is_tail_data_page_swap_required(void)
{ bool ret_value; const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; const uint32_t last_page_id = (cmd_block_id + p_cmd->size + p_cmd->offset - 1u) / PSTORAGE_FLASH_PAGE_SIZE; if ((m_tail_word_size != 0) && (m_current_page_id == last_page_id)) { ret_value = true; } else { ret_value = false; } return ret_value; }
labapart/polymcu
C++
null
201
/* Reset the board. Like pixis_reset(), but it honors the ENx registers. */
void pixis_reset(void)
/* Reset the board. Like pixis_reset(), but it honors the ENx registers. */ void pixis_reset(void)
{ PIXIS_WRITE(vctl, 0); PIXIS_WRITE(vctl, 1); while (1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Disables interrupts for the specified PWM generator block. */
void PWMGenIntTrigDisable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig)
/* Disables interrupts for the specified PWM generator block. */ void PWMGenIntTrigDisable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(_PWMGenValid(ui32Gen)); ASSERT((ui32IntTrig & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD | PWM_INT_CNT_AU | PWM_INT_CNT_AD | PWM_INT_CNT_BU | PWM_INT_CNT_BD | PWM_TR_CNT_ZERO | PWM_TR_CNT_LOAD | PWM_TR_CNT_AU | PWM_TR_CNT_AD | PWM_TR_CNT_BU | PWM_TR_CNT_BD)) == 0); HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_INTEN) &= ~(ui32IntTrig); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Attribute read call back for the Descriptor V8D2 attribute. */
static ssize_t read_des_v8d2(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Descriptor V8D2 attribute. */ static ssize_t read_des_v8d2(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; if (!bAuthorized) return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION); return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(des_v8d2_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Initiates a write packet operation. The I2C_SLAVE_CALLBACK_READ_REQUEST callback can be used to call this function. */
enum status_code i2c_slave_write_packet_job(struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
/* Initiates a write packet operation. The I2C_SLAVE_CALLBACK_READ_REQUEST callback can be used to call this function. */ enum status_code i2c_slave_write_packet_job(struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
{ Assert(module); Assert(module->hw); Assert(packet); if (module->buffer_remaining > 0) { return STATUS_BUSY; } module->buffer = packet->data; module->buffer_remaining = packet->data_length; module->buffer_length = packet->data_length; module->status = STATUS_BUSY; SercomI2cs *const i2c_hw = &(module->hw->I2CS); i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH | SERCOM_I2CS_INTFLAG_DRDY | SERCOM_I2CS_INTFLAG_PREC; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Returns -ENOENT if no matching ematch was found. */
void tcf_em_unregister(struct tcf_ematch_ops *ops)
/* Returns -ENOENT if no matching ematch was found. */ void tcf_em_unregister(struct tcf_ematch_ops *ops)
{ write_lock(&ematch_mod_lock); list_del(&ops->link); write_unlock(&ematch_mod_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Frees a command block that was previously allocated with cmd_alloc(). */
static void cmd_free(ctlr_info_t *h, CommandList_struct *c, int got_from_pool)
/* Frees a command block that was previously allocated with cmd_alloc(). */ static void cmd_free(ctlr_info_t *h, CommandList_struct *c, int got_from_pool)
{ int i; u64bit temp64; if (!got_from_pool) { temp64.val32.lower = c->ErrDesc.Addr.lower; temp64.val32.upper = c->ErrDesc.Addr.upper; pci_free_consistent(h->pdev, sizeof(ErrorInfo_struct), c->err_info, (dma_addr_t) temp64.val); pci_free_consistent(h->pdev, sizeof(CommandList_struct), c, (dma_addr_t) c->busaddr); } else { i = c - h->cmd_pool; clear_bit(i & (BITS_PER_LONG - 1), h->cmd_pool_bits + (i / BITS_PER_LONG)); h->nr_frees++; } }
robutest/uclinux
C++
GPL-2.0
60
/* param base VBAT peripheral base address. param config Pointer to vbat_fro16k_config_t structure. */
void VBAT_ConfigFRO16k(VBAT_Type *base, const vbat_fro16k_config_t *config)
/* param base VBAT peripheral base address. param config Pointer to vbat_fro16k_config_t structure. */ void VBAT_ConfigFRO16k(VBAT_Type *base, const vbat_fro16k_config_t *config)
{ assert(config != NULL); VBAT_EnableFRO16k(base, config->enableFRO16k); VBAT_UngateFRO16k(base, config->enabledConnectionsMask); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ib_unregister_mad_agent - Unregisters a client from using MAD services */
int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent)
/* ib_unregister_mad_agent - Unregisters a client from using MAD services */ int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent)
{ struct ib_mad_agent_private *mad_agent_priv; struct ib_mad_snoop_private *mad_snoop_priv; if (mad_agent->hi_tid) { mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private, agent); unregister_mad_agent(mad_agent_priv); } else { mad_snoop_priv = container_of(mad_agent, struct ib_mad_snoop_private, agent); unregister_mad_snoop(mad_snoop_priv); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Hangup this port. This is pretty much like closing the port, only a little more brutal. No waiting for data to drain. Shutdown the port and maybe drop signals. This is rather tricky really. We want to close the port as well. */
static void stli_hangup(struct tty_struct *tty)
/* Hangup this port. This is pretty much like closing the port, only a little more brutal. No waiting for data to drain. Shutdown the port and maybe drop signals. This is rather tricky really. We want to close the port as well. */ static void stli_hangup(struct tty_struct *tty)
{ struct stliport *portp = tty->driver_data; tty_port_hangup(&portp->port); }
robutest/uclinux
C++
GPL-2.0
60
/* This callback is called when the error recovery driver tells us that its OK to resume normal operation. */
static void ixgbe_io_resume(struct pci_dev *pdev)
/* This callback is called when the error recovery driver tells us that its OK to resume normal operation. */ static void ixgbe_io_resume(struct pci_dev *pdev)
{ struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = netdev_priv(netdev); if (netif_running(netdev)) { if (ixgbe_up(adapter)) { DPRINTK(PROBE, INFO, "ixgbe_up failed after reset\n"); return; } } netif_device_attach(netdev); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes Bernard the first version */
int pthread_condattr_destroy(pthread_condattr_t *attr)
/* Change Logs: Date Author Notes Bernard the first version */ int pthread_condattr_destroy(pthread_condattr_t *attr)
{ if (!attr) return EINVAL; return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns the current setting of the frequency multiplier. Core clock speed is frequency of the Front-Side Bus multiplied with this value. */
static int powernow_k6_get_cpu_multiplier(void)
/* Returns the current setting of the frequency multiplier. Core clock speed is frequency of the Front-Side Bus multiplied with this value. */ static int powernow_k6_get_cpu_multiplier(void)
{ u64 invalue = 0; u32 msrval; msrval = POWERNOW_IOPORT + 0x1; wrmsr(MSR_K6_EPMR, msrval, 0); invalue = inl(POWERNOW_IOPORT + 0x8); msrval = POWERNOW_IOPORT + 0x0; wrmsr(MSR_K6_EPMR, msrval, 0); return clock_ratio[(invalue >> 5)&7].index; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function won't work with non-blocking fd's. Any of the possibilities with non-bloking fd's is bad: */
ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
/* This function won't work with non-blocking fd's. Any of the possibilities with non-bloking fd's is bad: */ ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
{ ssize_t ret = 0; ssize_t total = 0; while (count) { ret = send(fd, buf, count, flags); if (ret < 0) { if (errno == EINTR) { continue; } break; } count -= ret; buf += ret; total += ret; } return total; }
ve3wwg/teensy3_qemu
C++
Other
15
/* This handler is only enabled if the user passes in a valid IRQ number in Pointer to a configuration structure. structure. */
void sci_spi_eri_isr(void)
/* This handler is only enabled if the user passes in a valid IRQ number in Pointer to a configuration structure. structure. */ void sci_spi_eri_isr(void)
{ FSP_CONTEXT_SAVE; IRQn_Type irq = R_FSP_CurrentIrqGet(); sci_spi_instance_ctrl_t * p_ctrl = (sci_spi_instance_ctrl_t *) R_FSP_IsrContextGet(irq); p_ctrl->p_reg->SCR &= (uint8_t) R_SCI0_SCR_CKE_Msk; p_ctrl->p_reg->SSR; p_ctrl->p_reg->SSR = (uint8_t) (R_SCI0_SSR_TDRE_Msk | R_SCI0_SSR_TEND_Msk); r_sci_spi_call_callback(p_ctrl, SPI_EVENT_ERR_READ_OVERFLOW); R_BSP_IrqStatusClear(irq); FSP_CONTEXT_RESTORE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Each EDID block contains a bitmap of the supported "established modes" list (defined above). Tease them out and add them to the global modes list. */
static int add_established_modes(struct drm_connector *connector, struct edid *edid)
/* Each EDID block contains a bitmap of the supported "established modes" list (defined above). Tease them out and add them to the global modes list. */ static int add_established_modes(struct drm_connector *connector, struct edid *edid)
{ struct drm_device *dev = connector->dev; unsigned long est_bits = edid->established_timings.t1 | (edid->established_timings.t2 << 8) | ((edid->established_timings.mfg_rsvd & 0x80) << 9); int i, modes = 0; for (i = 0; i <= EDID_EST_TIMINGS; i++) if (est_bits & (1<<i)) { struct drm_display_mode *newmode; newmode = drm_mode_duplicate(dev, &edid_est_modes[i]); if (newmode) { drm_mode_probed_add(connector, newmode); modes++; } } return modes; }
robutest/uclinux
C++
GPL-2.0
60
/* note Don't use this function with DMA APIs. */
uint32_t FLEXIO_MCULCD_GetStatusFlags(FLEXIO_MCULCD_Type *base)
/* note Don't use this function with DMA APIs. */ uint32_t FLEXIO_MCULCD_GetStatusFlags(FLEXIO_MCULCD_Type *base)
{ uint32_t ret = 0U; uint32_t flags; flags = FLEXIO_GetShifterStatusFlags(base->flexioBase); if (flags & (1U << base->rxShifterEndIndex)) { ret |= kFLEXIO_MCULCD_RxFullFlag; } if (flags & (1U << base->txShifterStartIndex)) { ret |= kFLEXIO_MCULCD_TxEmptyFlag; } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Work around broken Acer TravelMate 360 Notebooks which assign Cardbus to IRQ 11 even though it is actually wired to IRQ 10 */
static int __init fix_acer_tm360_irqrouting(const struct dmi_system_id *d)
/* Work around broken Acer TravelMate 360 Notebooks which assign Cardbus to IRQ 11 even though it is actually wired to IRQ 10 */ static int __init fix_acer_tm360_irqrouting(const struct dmi_system_id *d)
{ if (!acer_tm360_irqrouting) { acer_tm360_irqrouting = 1; printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes and returns a new value to DR0. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmWriteDr0(IN UINTN Value)
/* Writes and returns a new value to DR0. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmWriteDr0(IN UINTN Value)
{ _asm { mov eax, Value mov dr0, eax } }
tianocore/edk2
C++
Other
4,240
/* Return: 0 if successful, negative error code otherwise */
static int dwc2_check_max_xfer_size(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
/* Return: 0 if successful, negative error code otherwise */ static int dwc2_check_max_xfer_size(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ u32 max_xfer_size; u32 max_channel_xfer_size; int status = 0; max_xfer_size = dwc2_max_packet(qh->maxp) * dwc2_hb_mult(qh->maxp); max_channel_xfer_size = hsotg->core_params->max_transfer_size; if (max_xfer_size > max_channel_xfer_size) { dev_err(hsotg->dev, "%s: Periodic xfer length %d > max xfer length for channel %d\n", __func__, max_xfer_size, max_channel_xfer_size); status = -ENOSPC; } return status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ZigBee Device Profile dissector for the store active endpoints */
void dissect_zbee_zdp_rsp_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the store active endpoints */ void dissect_zbee_zdp_rsp_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint8 status; status = zdp_parse_status(tree, tvb, &offset); zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* : Deinitialinzes the CAN registers to their default reset values */
void CAN_DeInit(CAN_TypeDef *CANx)
/* : Deinitialinzes the CAN registers to their default reset values */ void CAN_DeInit(CAN_TypeDef *CANx)
{ assert_param(IS_CAN_ALL_PERIPH(CANx)); switch (*(uint32_t*)&CANx) { case CAN1_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN1, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN1, DISABLE); break; case CAN2_BASE: RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN2, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN2, DISABLE); break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clear an IOS Access Interrupt. This function may be used to clear an interrupt to the NVIC. */
void am_hal_ios_access_int_clear(uint32_t ui32Interrupt)
/* Clear an IOS Access Interrupt. This function may be used to clear an interrupt to the NVIC. */ void am_hal_ios_access_int_clear(uint32_t ui32Interrupt)
{ AM_REG(IOSLAVE, REGACCINTCLR) = ui32Interrupt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Callers are responsible for freeing the returned payload by */
REDFISH_PAYLOAD EFIAPI RedfishCreatePayload(IN EDKII_JSON_VALUE Value, IN REDFISH_SERVICE RedfishService)
/* Callers are responsible for freeing the returned payload by */ REDFISH_PAYLOAD EFIAPI RedfishCreatePayload(IN EDKII_JSON_VALUE Value, IN REDFISH_SERVICE RedfishService)
{ EDKII_JSON_VALUE CopyValue; CopyValue = JsonValueClone (Value); return createRedfishPayload (CopyValue, RedfishService); }
tianocore/edk2
C++
Other
4,240
/* Get the PMK used to connect to the current secure network. */
sl_status_t sl_wfx_get_pmk(uint8_t *password, uint32_t *password_length, sl_wfx_interface_t interface)
/* Get the PMK used to connect to the current secure network. */ sl_status_t sl_wfx_get_pmk(uint8_t *password, uint32_t *password_length, sl_wfx_interface_t interface)
{ sl_status_t result; sl_wfx_get_pmk_cnf_t *reply = NULL; result = sl_wfx_send_command(SL_WFX_GET_PMK_REQ_ID, NULL, 0, interface, (sl_wfx_generic_confirmation_t **)&reply); if (result == SL_STATUS_OK) { result = sl_wfx_get_status_code(sl_wfx_htole32(reply->body.status), SL_WFX_GET_PMK_REQ_ID); memcpy(password, reply->body.password, sl_wfx_htole32(reply->body.password_length)); *password_length = sl_wfx_htole32(reply->body.password_length); } return result; }
eclipse-threadx/getting-started
C++
Other
310
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciExpressAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT32)-1; } return MmioAndThenOr32 ( (UINTN)GetPciExpressBaseAddress () + Address, AndData, OrData ); }
tianocore/edk2
C++
Other
4,240
/* Handle a fatal parser error, i.e. violating Well-Formedness constraints */
static void xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, int val)
/* Handle a fatal parser error, i.e. violating Well-Formedness constraints */ static void xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, int val)
{ if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, val, 0, msg, val); if (ctxt != NULL) { ctxt->wellFormed = 0; if (ctxt->recovery == 0) ctxt->disableSAX = 1; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the interface is not supported, then ASSERT(). */
VOID EFIAPI X509StackFree(IN VOID *X509Stack)
/* If the interface is not supported, then ASSERT(). */ VOID EFIAPI X509StackFree(IN VOID *X509Stack)
{ CALL_VOID_CRYPTO_SERVICE (X509StackFree, (X509Stack)); }
tianocore/edk2
C++
Other
4,240
/* atl1c_irq_reset - reset interrupt confiure on the NIC @adapter: board private structure */
static void atl1c_irq_reset(struct atl1c_adapter *adapter)
/* atl1c_irq_reset - reset interrupt confiure on the NIC @adapter: board private structure */ static void atl1c_irq_reset(struct atl1c_adapter *adapter)
{ atomic_set(&adapter->irq_sem, 1); atl1c_irq_enable(adapter); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */
EFI_STATUS EFIAPI SdBlockIoPeimGetDeviceNo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */ EFI_STATUS EFIAPI SdBlockIoPeimGetDeviceNo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
{ SD_PEIM_HC_PRIVATE_DATA *Private; Private = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This); *NumberBlockDevices = Private->TotalBlkIoDevices; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Write one byte to an SPI device using USART in SPI mode. */
void usart_spi_write_single(volatile avr32_usart_t *p_usart, uint8_t data)
/* Write one byte to an SPI device using USART in SPI mode. */ void usart_spi_write_single(volatile avr32_usart_t *p_usart, uint8_t data)
{ usart_putchar(p_usart, data); }
memfault/zero-to-main
C++
null
200
/* Configure the SPI peripheral according to the specified parameters in the spiConfig. */
void SPI_Config(SPI_T *spi, SPI_Config_T *spiConfig)
/* Configure the SPI peripheral according to the specified parameters in the spiConfig. */ void SPI_Config(SPI_T *spi, SPI_Config_T *spiConfig)
{ spi->CTRL1 &= 0x3040; spi->CTRL1 |= (uint16_t)((uint32_t)spiConfig->direction | spiConfig->mode | spiConfig->length | spiConfig->polarity | spiConfig->phase | spiConfig->nss | spiConfig->baudrateDiv | spiConfig->firstBit); spi->CRCPOLY = spiConfig->crcPolynomial; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This file is part of the Simba project. */
int mock_write_inet_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_inet_module_init(int res)
{ harness_mock_write("inet_module_init()", NULL, 0); harness_mock_write("inet_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Not all interfaces are DLPI interfaces, and thus not all interfaces can be opened with DLPI (for example, the loopback interface is not a DLPI interface on Solaris prior to Solaris 11), so try to open the specified interface; return 0 if we fail with PCAP_ERROR_NO_SUCH_DEVICE and 1 otherwise. */
static int is_dlpi_interface(const char *name)
/* Not all interfaces are DLPI interfaces, and thus not all interfaces can be opened with DLPI (for example, the loopback interface is not a DLPI interface on Solaris prior to Solaris 11), so try to open the specified interface; return 0 if we fail with PCAP_ERROR_NO_SUCH_DEVICE and 1 otherwise. */ static int is_dlpi_interface(const char *name)
{ int fd; u_int ppa; char errbuf[PCAP_ERRBUF_SIZE]; fd = open_dlpi_device(name, &ppa, errbuf); if (fd < 0) { if (fd == PCAP_ERROR_NO_SUCH_DEVICE) { return (0); } return (1); } close(fd); return (1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function called from I2C IRQ Handler when STOP flag is set Function is in charge of checking data received, LED2 is On if data are correct. */
void Slave_Complete_Callback(void)
/* Function called from I2C IRQ Handler when STOP flag is set Function is in charge of checking data received, LED2 is On if data are correct. */ void Slave_Complete_Callback(void)
{ ubSlaveReceiveIndex = 0; ubSlaveReceiveComplete = 0; FlushBuffer8(aSlaveReceiveBuffer); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Enables callback. Enables the callback function registered by the usart_register_callback. The callback function will be called from the interrupt handler when the conditions for the callback type are met. */
void wdt_enable_callback(struct wdt_module *const module, enum wdt_callback callback_type)
/* Enables callback. Enables the callback function registered by the usart_register_callback. The callback function will be called from the interrupt handler when the conditions for the callback type are met. */ void wdt_enable_callback(struct wdt_module *const module, enum wdt_callback callback_type)
{ Assert(module); module->callback_enable_mask |= (1 << callback_type); }
memfault/zero-to-main
C++
null
200
/* basic flash read, only used with offset aligned to flash write block size */
static int eeprom_emu_flash_read(const struct device *dev, off_t offset, uint8_t *blk, size_t len)
/* basic flash read, only used with offset aligned to flash write block size */ static int eeprom_emu_flash_read(const struct device *dev, off_t offset, uint8_t *blk, size_t len)
{ const struct eeprom_emu_config *dev_config = dev->config; return flash_read(dev_config->flash_dev, dev_config->flash_offset + offset, blk, len); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function will write a character to serial without interrupt enable mode */
void rt_serial_putc(const char c)
/* This function will write a character to serial without interrupt enable mode */ void rt_serial_putc(const char c)
{ if (c=='\n')rt_serial_putc('\r'); while(!(UTRSTAT0 & USTAT_TXB_EMPTY)); UTXH0 = (rt_uint8_t)c; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Add two ktime values and do a safety check for overflow: */
ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs)
/* Add two ktime values and do a safety check for overflow: */ ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs)
{ ktime_t res = ktime_add(lhs, rhs); if (res.tv64 < 0 || res.tv64 < lhs.tv64 || res.tv64 < rhs.tv64) res = ktime_set(KTIME_SEC_MAX, 0); return res; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* put_iova_domain - destroys the iova doamin @iovad: - iova domain in question. All the iova's in that domain are destroyed. */
void put_iova_domain(struct iova_domain *iovad)
/* put_iova_domain - destroys the iova doamin @iovad: - iova domain in question. All the iova's in that domain are destroyed. */ void put_iova_domain(struct iova_domain *iovad)
{ struct rb_node *node; unsigned long flags; spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); node = rb_first(&iovad->rbroot); while (node) { struct iova *iova = container_of(node, struct iova, node); rb_erase(node, &iovad->rbroot); free_iova_mem(iova); node = rb_first(&iovad->rbroot); } spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* CF2_ArrStack uses an error pointer, to enable shared errors. Shared errors are necessary when multiple objects allow the program to continue after detecting errors. Only the first error should be recorded. */
cf2_arrstack_init(CF2_ArrStack arrstack, FT_Memory memory, FT_Error *error, size_t sizeItem)
/* CF2_ArrStack uses an error pointer, to enable shared errors. Shared errors are necessary when multiple objects allow the program to continue after detecting errors. Only the first error should be recorded. */ cf2_arrstack_init(CF2_ArrStack arrstack, FT_Memory memory, FT_Error *error, size_t sizeItem)
{ FT_ASSERT( arrstack != NULL ); arrstack->memory = memory; arrstack->error = error; arrstack->sizeItem = sizeItem; arrstack->allocated = 0; arrstack->chunk = 10; arrstack->count = 0; arrstack->totalSize = 0; arrstack->ptr = NULL; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param name The name of the selected ldo. Please see the enumeration pmu_ldo_name_t for details. param setpointMap The map of setpoints should be the OR'ed Value of _pmu_setpoint_map. param mode The operating mode of the selected ldo. Please refer to the enumeration pmu_ldo_operate_mode_t for details. */
void PMU_GPCSetLdoOperateMode(pmu_ldo_name_t name, uint32_t setpointMap, pmu_ldo_operate_mode_t mode)
/* param name The name of the selected ldo. Please see the enumeration pmu_ldo_name_t for details. param setpointMap The map of setpoints should be the OR'ed Value of _pmu_setpoint_map. param mode The operating mode of the selected ldo. Please refer to the enumeration pmu_ldo_operate_mode_t for details. */ void PMU_GPCSetLdoOperateMode(pmu_ldo_name_t name, uint32_t setpointMap, pmu_ldo_operate_mode_t mode)
{ assert(name > kPMU_PllLdo); assert(name < kPMU_SnvsDigLdo); uint32_t ldoLpModeRegArray[] = PMU_LDO_LP_MODE_EN_SETPOINT_REGISTERS; if (mode == kPMU_LowPowerMode) { (*(volatile uint32_t *)ldoLpModeRegArray[(uint8_t)name]) &= ~setpointMap; } else { (*(volatile uint32_t *)ldoLpModeRegArray[(uint8_t)name]) |= setpointMap; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Computes the XOR checksum for a data buffer. */
uint8_t AD717X_ComputeXOR8(uint8_t *pBuf, uint8_t bufSize)
/* Computes the XOR checksum for a data buffer. */ uint8_t AD717X_ComputeXOR8(uint8_t *pBuf, uint8_t bufSize)
{ uint8_t xor = 0; while(bufSize) { xor ^= *pBuf; pBuf++; bufSize--; } return xor; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function is used by the IDE bus driver to get identify data. Data format of Identify data is defined by the Interface GUID. */
EFI_STATUS EFIAPI ScsiDiskInfoIdentify(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *IdentifyData, IN OUT UINT32 *IdentifyDataSize)
/* This function is used by the IDE bus driver to get identify data. Data format of Identify data is defined by the Interface GUID. */ EFI_STATUS EFIAPI ScsiDiskInfoIdentify(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *IdentifyData, IN OUT UINT32 *IdentifyDataSize)
{ EFI_STATUS Status; SCSI_DISK_DEV *ScsiDiskDevice; if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) { return EFI_NOT_FOUND; } ScsiDiskDevice = SCSI_DISK_DEV_FROM_DISKINFO (This); Status = EFI_BUFFER_TOO_SMALL; if (*IdentifyDataSize >= sizeof (ScsiDiskDevice->IdentifyData)) { Status = EFI_SUCCESS; CopyMem (IdentifyData, &ScsiDiskDevice->IdentifyData, sizeof (ScsiDiskDevice->IdentifyData)); } *IdentifyDataSize = sizeof (ScsiDiskDevice->IdentifyData); return Status; }
tianocore/edk2
C++
Other
4,240
/* Configures external clock mode of the GPTM . Used CHx as the clock source. The */
void TimerCHExtClkConfigure(unsigned long ulBase, unsigned long ulSelect, unsigned long ulPolarity, unsigned char ucFilter)
/* Configures external clock mode of the GPTM . Used CHx as the clock source. The */ void TimerCHExtClkConfigure(unsigned long ulBase, unsigned long ulSelect, unsigned long ulPolarity, unsigned char ucFilter)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulSelect == TIMER_TRSEL_TI0BED) || (ulSelect == TIMER_TRSEL_TI0S0) || (ulSelect == TIMER_TRSEL_TI1S1)); xASSERT((ulPolarity == TIMER_CHP_NONINVERTED) || (ulPolarity == TIMER_CHP_INVERTED)); if(ulSelect == TIMER_TRSEL_TI1S1) { TimerChannelConfigure(ulBase, TIMER_CH_1, ulPolarity, TIMER_CHCCS_DIRECT, ucFilter); } else { TimerChannelConfigure(ulBase, TIMER_CH_0, ulPolarity, TIMER_CHCCS_DIRECT, ucFilter); } TimerSTIConfigure(ulBase, ulSelect); xHWREG(ulBase + TIMER_MDCFR) |= TIMER_MDCFR_SMSEL_STIED; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Gets the number of bits transferred per frame. */
unsigned char xSPIBitLengthGet(unsigned long ulBase)
/* Gets the number of bits transferred per frame. */ unsigned char xSPIBitLengthGet(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_BIT_LEN_M) >> SPI_CNTRL_TX_BIT_LEN_S); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Assumes that COL_INFO will be set to the command name, command name will already be appended to the command subtree and protocol root. In addition, assumes that the command ID has already been parsed. */
static void dissect_ieee802154_gtsreq(tvbuff_t *, packet_info *, proto_tree *, ieee802154_packet *)
/* Assumes that COL_INFO will be set to the command name, command name will already be appended to the command subtree and protocol root. In addition, assumes that the command ID has already been parsed. */ static void dissect_ieee802154_gtsreq(tvbuff_t *, packet_info *, proto_tree *, ieee802154_packet *)
{ proto_tree *subtree; static const int * characteristics[] = { &hf_ieee802154_gtsreq_len, &hf_ieee802154_gtsreq_dir, &hf_ieee802154_gtsreq_type, NULL }; subtree = proto_tree_add_subtree(tree, tvb, 0, 1, ett_ieee802154_cmd, NULL, val_to_str_const(packet->command_id, ieee802154_cmd_names, "Unknown Command")); proto_tree_add_bitmask_list(subtree, tvb, 0, 1, characteristics, ENC_NA); if (tvb_reported_length(tvb) > 1) { call_data_dissector(tvb_new_subset_remaining(tvb, 1), pinfo, tree); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disable External Interrupt. Disables a device-specific interrupt in the NVIC interrupt controller. */
void drv_nvic_disable_irq(int32_t IRQn)
/* Disable External Interrupt. Disables a device-specific interrupt in the NVIC interrupt controller. */ void drv_nvic_disable_irq(int32_t IRQn)
{ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector8_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector8_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (8 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* 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); SPDIF_DisableInterrupts(base, kSPDIF_UChannelReceiveRegisterFull | kSPDIF_QChannelReceiveRegisterFull | kSPDIF_RxFIFOFull | kSPDIF_RxControlChannelChange); handle->state = kSPDIF_Idle; memset(handle->spdifQueue, 0, sizeof(spdif_transfer_t) * SPDIF_XFER_QUEUE_SIZE); handle->queueDriver = 0; handle->queueUser = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function may sleep, and has the same return conditions as blocking_notifier_chain_unregister. */
int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
/* This function may sleep, and has the same return conditions as blocking_notifier_chain_unregister. */ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
{ int ret; switch (list) { case CPUFREQ_TRANSITION_NOTIFIER: ret = srcu_notifier_chain_unregister( &cpufreq_transition_notifier_list, nb); break; case CPUFREQ_POLICY_NOTIFIER: ret = blocking_notifier_chain_unregister( &cpufreq_policy_notifier_list, nb); break; default: ret = -EINVAL; } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Covert the external timing nanosecond to internal clock cycle. */
static uint8_t SEMC_ConvertTiming(uint32_t time_ns, uint32_t clkSrc_Hz)
/* Covert the external timing nanosecond to internal clock cycle. */ static uint8_t SEMC_ConvertTiming(uint32_t time_ns, uint32_t clkSrc_Hz)
{ assert(clkSrc_Hz); uint8_t clockCycles = 0; uint32_t tClk_us; clkSrc_Hz /= 1000000; tClk_us = 1000000 / clkSrc_Hz; while (tClk_us * clockCycles < (time_ns * 1000)) { clockCycles++; } return clockCycles; }
nanoframework/nf-interpreter
C++
MIT License
293
/* This deallocates the parameter RAM slots allocated by edma_alloc_cont_slots. Callers/applications need to keep track of sets of contiguous parameter RAM slots that have been allocated using the edma_alloc_cont_slots API. Callers are responsible for ensuring the slots are inactive, and will not be activated. */
int edma_free_cont_slots(unsigned slot, int count)
/* This deallocates the parameter RAM slots allocated by edma_alloc_cont_slots. Callers/applications need to keep track of sets of contiguous parameter RAM slots that have been allocated using the edma_alloc_cont_slots API. Callers are responsible for ensuring the slots are inactive, and will not be activated. */ int edma_free_cont_slots(unsigned slot, int count)
{ unsigned ctlr, slot_to_free; int i; ctlr = EDMA_CTLR(slot); slot = EDMA_CHAN_SLOT(slot); if (slot < edma_cc[ctlr]->num_channels || slot >= edma_cc[ctlr]->num_slots || count < 1) return -RT_ERROR; for (i = slot; i < slot + count; ++i) { ctlr = EDMA_CTLR(i); slot_to_free = EDMA_CHAN_SLOT(i); rt_memcpy((void *)(edmacc_regs_base[ctlr] + PARM_OFFSET(slot_to_free)), &dummy_paramset, PARM_SIZE); clear_bit(slot_to_free, edma_cc[ctlr]->edma_inuse); } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base FLEXSPI peripheral base address param handle Pointer to flexspi_dma_handle_t structure param callback FLEXSPI callback, NULL means no callback. param userData User callback function data. param txDmaHandle User requested DMA handle for TX DMA transfer. param rxDmaHandle User requested DMA handle for RX DMA transfer. */
void FLEXSPI_TransferCreateHandleDMA(FLEXSPI_Type *base, flexspi_dma_handle_t *handle, flexspi_dma_callback_t callback, void *userData, dma_handle_t *txDmaHandle, dma_handle_t *rxDmaHandle)
/* param base FLEXSPI peripheral base address param handle Pointer to flexspi_dma_handle_t structure param callback FLEXSPI callback, NULL means no callback. param userData User callback function data. param txDmaHandle User requested DMA handle for TX DMA transfer. param rxDmaHandle User requested DMA handle for RX DMA transfer. */ void FLEXSPI_TransferCreateHandleDMA(FLEXSPI_Type *base, flexspi_dma_handle_t *handle, flexspi_dma_callback_t callback, void *userData, dma_handle_t *txDmaHandle, dma_handle_t *rxDmaHandle)
{ assert(handle); uint32_t instance = FLEXSPI_GetInstance(base); s_dmaPrivateHandle[instance].base = base; s_dmaPrivateHandle[instance].handle = handle; (void)memset(handle, 0, sizeof(*handle)); handle->state = kFLEXSPI_Idle; handle->txDmaHandle = txDmaHandle; handle->rxDmaHandle = rxDmaHandle; handle->nsize = kFLEXPSI_DMAnSize4Bytes; handle->completionCallback = callback; handle->userData = userData; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create a new upvalue at the given level, and link it to the list of open upvalues of 'L' after entry 'prev'. */
static UpVal* newupval(lua_State *L, int tbc, StkId level, UpVal **prev)
/* Create a new upvalue at the given level, and link it to the list of open upvalues of 'L' after entry 'prev'. */ static UpVal* newupval(lua_State *L, int tbc, StkId level, UpVal **prev)
{ L->twups = G(L)->twups; G(L)->twups = L; } return uv; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Description: Call out to the NetLabel components so they can register their families and commands with the Generic NETLINK mechanism. Returns zero on success and non-zero on failure. */
int __init netlbl_netlink_init(void)
/* Description: Call out to the NetLabel components so they can register their families and commands with the Generic NETLINK mechanism. Returns zero on success and non-zero on failure. */ int __init netlbl_netlink_init(void)
{ int ret_val; ret_val = netlbl_mgmt_genl_init(); if (ret_val != 0) return ret_val; ret_val = netlbl_cipsov4_genl_init(); if (ret_val != 0) return ret_val; ret_val = netlbl_unlabel_genl_init(); if (ret_val != 0) return ret_val; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */
void SAI_TransferRxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */ void SAI_TransferRxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
{ assert(handle && dmaHandle); uint32_t instance = SAI_GetInstance(base); memset(handle, 0, sizeof(*handle)); handle->dmaHandle = dmaHandle; handle->callback = callback; handle->userData = userData; handle->state = kSAI_Idle; s_edmaPrivateHandle[instance][1].base = base; s_edmaPrivateHandle[instance][1].handle = handle; EDMA_InstallTCDMemory(dmaHandle, STCD_ADDR(handle->tcd), SAI_XFER_QUEUE_SIZE); EDMA_SetCallback(dmaHandle, SAI_RxEDMACallback, &s_edmaPrivateHandle[instance][1]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_On(LED3); while(1) { HAL_Delay(100); BSP_LED_Toggle(LED3); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* ipu_enable_channel() - enable an IPU channel. @channel: channel ID. */
static int ipu_enable_channel(enum ipu_channel channel)
/* ipu_enable_channel() - enable an IPU channel. @channel: channel ID. */ static int ipu_enable_channel(enum ipu_channel channel)
{ uint32_t reg; writel(1UL << channel, IPU_CHA_CUR_BUF); switch (channel) { case IDMAC_SDC_0: ipu_channel_set_priority(channel, 1); break; default: break; } reg = readl(IDMAC_CHA_EN); writel(reg | (1UL << channel), IDMAC_CHA_EN); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This is the callback that is used to add our wait queue to the target file wakeup lists. */
static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, poll_table *pt)
/* This is the callback that is used to add our wait queue to the target file wakeup lists. */ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, poll_table *pt)
{ struct epitem *epi = ep_item_from_epqueue(pt); struct eppoll_entry *pwq; if (epi->nwait >= 0 && (pwq = kmem_cache_alloc(pwq_cache, GFP_KERNEL))) { init_waitqueue_func_entry(&pwq->wait, ep_poll_callback); pwq->whead = whead; pwq->base = epi; add_wait_queue(whead, &pwq->wait); list_add_tail(&pwq->llink, &epi->pwqlist); epi->nwait++; } else { epi->nwait = -1; } }
robutest/uclinux
C++
GPL-2.0
60
/* Calls all of the #GHook functions in a #GHookList. */
void g_hook_list_invoke(GHookList *hook_list, gboolean may_recurse)
/* Calls all of the #GHook functions in a #GHookList. */ void g_hook_list_invoke(GHookList *hook_list, gboolean may_recurse)
{ GHook *hook; g_return_if_fail (hook_list != NULL); g_return_if_fail (hook_list->is_setup); hook = g_hook_first_valid (hook_list, may_recurse); while (hook) { GHookFunc func; gboolean was_in_call; func = (GHookFunc) hook->func; was_in_call = G_HOOK_IN_CALL (hook); hook->flags |= G_HOOK_FLAG_IN_CALL; func (hook->data); if (!was_in_call) hook->flags &= ~G_HOOK_FLAG_IN_CALL; hook = g_hook_next_valid (hook_list, hook, may_recurse); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* brief Return Frequency of SCTimer Clock return Frequency of SCTimer Clock. */
uint32_t CLOCK_GetSctClkFreq(void)
/* brief Return Frequency of SCTimer Clock return Frequency of SCTimer Clock. */ uint32_t CLOCK_GetSctClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->SCTCLKSEL) { case 0U: freq = CLOCK_GetCoreSysClkFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 2U: freq = CLOCK_GetExtClkFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 5U: freq = CLOCK_GetI2SMClkFreq(); break; case 7U: freq = 0U; break; default: freq = 0U; break; } return freq / ((SYSCON->SCTCLKDIV & 0xffU) + 1U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* It returns information for an available text mode that the terminal supports. */
EFI_STATUS EFIAPI TerminalConOutQueryMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows)
/* It returns information for an available text mode that the terminal supports. */ EFI_STATUS EFIAPI TerminalConOutQueryMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows)
{ TERMINAL_DEV *TerminalDevice; if (ModeNumber >= (UINTN)This->Mode->MaxMode) { return EFI_UNSUPPORTED; } TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); *Columns = TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns; *Rows = TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* when receiving completed, set RS bit in ENET_DMA_STAT register will is set after a configurable delay time */
void enet_rx_desc_delay_receive_complete_interrupt(enet_descriptors_struct *desc, uint32_t delay_time)
/* when receiving completed, set RS bit in ENET_DMA_STAT register will is set after a configurable delay time */ void enet_rx_desc_delay_receive_complete_interrupt(enet_descriptors_struct *desc, uint32_t delay_time)
{ desc->control_buffer_size |= ENET_RDES1_DINTC; ENET_DMA_RSWDC = DMA_RSWDC_WDCFRS(delay_time); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read any number of bytes from EEPROM memory. The read can be any number of bytes. Before the read is done the memory index must be placed at the desired location using a write with a repead start then a read. */
int32_t memory_read(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size)
/* Read any number of bytes from EEPROM memory. The read can be any number of bytes. Before the read is done the memory index must be placed at the desired location using a write with a repead start then a read. */ int32_t memory_read(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size)
{ int32_t ret; uint8_t *transmit_array; uint16_t shifted_address; shifted_address = MEMORY_PROTECTED_SIZE + address; if((shifted_address + size) > MEMORY_SIZE_BYTES) size = MEMORY_SIZE_BYTES - shifted_address; transmit_array = calloc(2, sizeof(uint8_t)); if (!transmit_array) return -1; transmit_array[0] = (shifted_address & 0xff00) >> 8; transmit_array[1] = (shifted_address & 0x00ff) >> 0; ret = i2c_write(dev->i2c_dev, transmit_array, 2, false); if(ret != MEMORY_SUCCESS) goto finish; ret = i2c_read(dev->i2c_dev, data, size, true); finish: free(transmit_array); return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state param count Bytes sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count)
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state param count Bytes sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */ status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count)
{ assert(handle != NULL); status_t status = kStatus_Success; uint8_t queueDriver = handle->queueDriver; if (handle->state != (uint32_t)kFLEXIO_I2S_Busy) { status = kStatus_NoTransferInProgress; } else { *count = (handle->transferSize[queueDriver] - handle->queue[queueDriver].dataSize); } return status; }
eclipse-threadx/getting-started
C++
Other
310
/* Warning on the terminology - Linux calls an uncached area coherent; MIPS terminology calls memory areas with hardware maintained coherency coherent. */
static int cpu_is_noncoherent_r10000(struct device *dev)
/* Warning on the terminology - Linux calls an uncached area coherent; MIPS terminology calls memory areas with hardware maintained coherency coherent. */ static int cpu_is_noncoherent_r10000(struct device *dev)
{ return !plat_device_is_coherent(dev) && (current_cpu_type() == CPU_R10000 || current_cpu_type() == CPU_R12000); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Shut down the mace and its interrupt channel */
static int mace_close(struct net_device *dev)
/* Shut down the mace and its interrupt channel */ static int mace_close(struct net_device *dev)
{ struct mace_data *mp = netdev_priv(dev); volatile struct mace *mb = mp->mace; mb->maccc = 0; mb->imr = 0xFF; mace_dma_off(dev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function refreshes the GCD Memory Space attributes according to MTRRs and page tables. */
VOID RefreshGcdMemoryAttributes(VOID)
/* This function refreshes the GCD Memory Space attributes according to MTRRs and page tables. */ VOID RefreshGcdMemoryAttributes(VOID)
{ mIsFlushingGCD = TRUE; if (IsMtrrSupported ()) { RefreshMemoryAttributesFromMtrr (); } if (IsPagingAndPageAddressExtensionsEnabled ()) { RefreshGcdMemoryAttributesFromPaging (); } mIsFlushingGCD = FALSE; }
tianocore/edk2
C++
Other
4,240
/* Clear the I2C interrupt flag of the specified I2C port. The */
void I2CIntFlagClear(unsigned long ulBase)
/* Clear the I2C interrupt flag of the specified I2C port. The */ void I2CIntFlagClear(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xHWREG(ulBase + I2C_O_CON) |= I2C_CON_SI; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Checks how many clusters in a given L2 table are contiguous in the image file. As soon as one of the flags in the bitmask stop_flags changes compared to the first cluster, the search is stopped and the cluster is not counted as contiguous. (This allows it, for example, to stop at the first compressed cluster which may require a different handling) */
static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags)
/* Checks how many clusters in a given L2 table are contiguous in the image file. As soon as one of the flags in the bitmask stop_flags changes compared to the first cluster, the search is stopped and the cluster is not counted as contiguous. (This allows it, for example, to stop at the first compressed cluster which may require a different handling) */ static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags)
{ int i; uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW_OFLAG_COMPRESSED; uint64_t first_entry = be64_to_cpu(l2_table[0]); uint64_t offset = first_entry & mask; if (!offset) return 0; assert(qcow2_get_cluster_type(first_entry) != QCOW2_CLUSTER_COMPRESSED); for (i = 0; i < nb_clusters; i++) { uint64_t l2_entry = be64_to_cpu(l2_table[i]) & mask; if (offset + (uint64_t) i * cluster_size != l2_entry) { break; } } return i; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Disable Time Stamp for All frames When reset the timestamp snap shot is not enabled for all frames received by the core. Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_all_frames_disable(synopGMACdevice *gmacdev)
/* Disable Time Stamp for All frames When reset the timestamp snap shot is not enabled for all frames received by the core. Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_all_frames_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSENALL); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Applications are responsible for initializing all descriptor fields appropriately before passing the descriptor list to the hardware. */
void EMACTxDMADescriptorListSet(uint32_t ui32Base, tEMACDMADescriptor *pDescriptor)
/* Applications are responsible for initializing all descriptor fields appropriately before passing the descriptor list to the hardware. */ void EMACTxDMADescriptorListSet(uint32_t ui32Base, tEMACDMADescriptor *pDescriptor)
{ ASSERT(pDescriptor); ASSERT(((uint32_t)pDescriptor & 3) == 0); HWREG(ui32Base + EMAC_O_TXDLADDR) = (uint32_t)pDescriptor; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is a wrapper function for freeing consistent dma-able Memory. In linux Kernel, it depends on pci dev structure */
void plat_free_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, void *addr, u64 dma_addr)
/* This is a wrapper function for freeing consistent dma-able Memory. In linux Kernel, it depends on pci dev structure */ void plat_free_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, void *addr, u64 dma_addr)
{ rt_free((void *)PHYS_TO_CACHED(UNCACHED_TO_PHYS(addr))); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Truncate blocks that were not used by write. We have to truncate the pagecache as well so that corresponding buffers get properly unmapped. */
static void ext3_truncate_failed_write(struct inode *inode)
/* Truncate blocks that were not used by write. We have to truncate the pagecache as well so that corresponding buffers get properly unmapped. */ static void ext3_truncate_failed_write(struct inode *inode)
{ truncate_inode_pages(inode->i_mapping, inode->i_size); ext3_truncate(inode); }
robutest/uclinux
C++
GPL-2.0
60
/* Skip a number of bytes at the start of a pbuf */
struct pbuf* pbuf_skip(struct pbuf *in, u16_t in_offset, u16_t *out_offset)
/* Skip a number of bytes at the start of a pbuf */ struct pbuf* pbuf_skip(struct pbuf *in, u16_t in_offset, u16_t *out_offset)
{ const struct pbuf *out = pbuf_skip_const(in, in_offset, out_offset); return LWIP_CONST_CAST(struct pbuf *, out); }
ua1arn/hftrx
C++
null
69
/* Get the current value on a specified port. */
int16_t HW_IF_PWR_GetCurrent(uint8_t PortNum)
/* Get the current value on a specified port. */ int16_t HW_IF_PWR_GetCurrent(uint8_t PortNum)
{ int16_t signed_current; signed_current = (int16_t)(MAMP(ADCxConvertedValues[IBUS_INDEX(PortNum)]) +23); if (signed_current < 0) return (- signed_current); else return signed_current; }
st-one/X-CUBE-USB-PD
C++
null
110
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2). For this function returns immediately, it is always using in the interrupt hander. */
void I2CMasterReadLastRequestS2(unsigned long ulBase)
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2). For this function returns immediately, it is always using in the interrupt hander. */ void I2CMasterReadLastRequestS2(unsigned long ulBase)
{ xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE)); xHWREG(ulBase + I2C_CR1) &= ~I2C_CR1_ACK; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Convert TRNG status codes to RETURN status codes. */
STATIC RETURN_STATUS TrngStatusToReturnStatus(IN INT32 TrngStatus)
/* Convert TRNG status codes to RETURN status codes. */ STATIC RETURN_STATUS TrngStatusToReturnStatus(IN INT32 TrngStatus)
{ switch (TrngStatus) { case TRNG_STATUS_NOT_SUPPORTED: return RETURN_UNSUPPORTED; case TRNG_STATUS_INVALID_PARAMETER: return RETURN_INVALID_PARAMETER; case TRNG_STATUS_NO_ENTROPY: return RETURN_NOT_READY; case TRNG_STATUS_SUCCESS: return RETURN_SUCCESS; default: if (TrngStatus < 0) { return RETURN_UNSUPPORTED; } return RETURN_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* Allocate a new ACL with the specified number of entries. */
struct posix_acl* posix_acl_alloc(int count, gfp_t flags)
/* Allocate a new ACL with the specified number of entries. */ struct posix_acl* posix_acl_alloc(int count, gfp_t flags)
{ const size_t size = sizeof(struct posix_acl) + count * sizeof(struct posix_acl_entry); struct posix_acl *acl = kmalloc(size, flags); if (acl) { atomic_set(&acl->a_refcount, 1); acl->a_count = count; } return acl; }
robutest/uclinux
C++
GPL-2.0
60
/* Add 8 bit integer attribute to netlink message. */
int nla_put_u8(struct nl_msg *msg, int attrtype, uint8_t value)
/* Add 8 bit integer attribute to netlink message. */ int nla_put_u8(struct nl_msg *msg, int attrtype, uint8_t value)
{ return nla_put(msg, attrtype, sizeof(uint8_t), &value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Endpoint must be selected before call to this function */
static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep)
/* Endpoint must be selected before call to this function */ static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep)
{ struct cdns3_device *priv_dev = priv_ep->cdns3_dev; int val; trace_cdns3_halt(priv_ep, 1, 1); writel(EP_CMD_DFLUSH | EP_CMD_ERDY | EP_CMD_SSTALL, &priv_dev->regs->ep_cmd); readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val, !(val & EP_CMD_DFLUSH), 1000); priv_ep->flags |= EP_STALLED; priv_ep->flags &= ~EP_STALL_PENDING; }
4ms/stm32mp1-baremetal
C++
Other
137
/* ADC group regular end of unitary conversion interruption callback. */
void AdcGrpRegularUnitaryConvComplete_Callback()
/* ADC group regular end of unitary conversion interruption callback. */ void AdcGrpRegularUnitaryConvComplete_Callback()
{ uhADCxConvertedData = LL_ADC_REG_ReadConversionData12(ADCx); uhADCxConvertedData_Voltage_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(VDDA_APPLI, uhADCxConvertedData, LL_ADC_RESOLUTION_12B); ubAdcGrpRegularUnitaryConvStatus = 1; BSP_LED_On(LED1); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Gets the status. This function returns the current status. */
uint32_t am_hal_uart_status_get(uint32_t ui32Module)
/* Gets the status. This function returns the current status. */ uint32_t am_hal_uart_status_get(uint32_t ui32Module)
{ return AM_REGn(UART, ui32Module, RSR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup a timer for a regular tick. This function uses the RTOS timer. The function is declared weak so an application writer can use a different timer by redefining this implementation. If a different timer is used then configTICK_INTERRUPT_VECTOR must also be defined in FreeRTOSConfig.h to ensure the RTOS provided tick interrupt handler is installed on the correct vector number. */
__attribute__((weak))
/* Setup a timer for a regular tick. This function uses the RTOS timer. The function is declared weak so an application writer can use a different timer by redefining this implementation. If a different timer is used then configTICK_INTERRUPT_VECTOR must also be defined in FreeRTOSConfig.h to ensure the RTOS provided tick interrupt handler is installed on the correct vector number. */ __attribute__((weak))
{ const uint32_t ulPreload = ( 32768ul / ( configTICK_RATE_HZ ) ); configASSERT( ulPreload != 0UL ); portMMCR_RTMR_CONTROL = 0ul; portMMCR_RTMR_PRELOAD = ulPreload; portMMCR_JTVIC_GIRQ23_SRC = ( portGIRQ23_RTOS_TIMER_MASK ); portMMCR_JTVIC_GIRQ23_PRIA &= ~( 0x0Ful << 16 ); portMMCR_JTVIC_GIRQ23_PRIA |= ( ( portIPL_TO_CODE( configKERNEL_INTERRUPT_PRIORITY ) ) << 16 ); portMMCR_JTVIC_GIRQ23_SETEN = ( portGIRQ23_RTOS_TIMER_MASK ); portMMCR_RTMR_CONTROL = 0x0Fu; }
labapart/polymcu
C++
null
201
/* Is a received DRP IE for this reservation? */
static bool uwb_rsv_match(struct uwb_rsv *rsv, struct uwb_dev *src, struct uwb_ie_drp *drp_ie)
/* Is a received DRP IE for this reservation? */ static bool uwb_rsv_match(struct uwb_rsv *rsv, struct uwb_dev *src, struct uwb_ie_drp *drp_ie)
{ struct uwb_dev_addr *rsv_src; int stream; stream = uwb_ie_drp_stream_index(drp_ie); if (rsv->stream != stream) return false; switch (rsv->target.type) { case UWB_RSV_TARGET_DEVADDR: return rsv->stream == stream; case UWB_RSV_TARGET_DEV: if (uwb_ie_drp_owner(drp_ie)) rsv_src = &rsv->owner->dev_addr; else rsv_src = &rsv->target.dev->dev_addr; return uwb_dev_addr_cmp(&src->dev_addr, rsv_src) == 0; } return false; }
robutest/uclinux
C++
GPL-2.0
60
/* Copy useful information when duplicating a server record */
static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
/* Copy useful information when duplicating a server record */ static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
{ target->flags = source->flags; target->rsize = source->rsize; target->wsize = source->wsize; target->acregmin = source->acregmin; target->acregmax = source->acregmax; target->acdirmin = source->acdirmin; target->acdirmax = source->acdirmax; target->caps = source->caps; target->options = source->options; }
EmcraftSystems/linux-emcraft
C++
Other
266