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
/* Extracts MAC and product information from the VPD. */
static int vpd_callback(struct vpd_cache *userdata, u8 id, u8 version, u8 type, size_t size, u8 const *data)
/* Extracts MAC and product information from the VPD. */ static int vpd_callback(struct vpd_cache *userdata, u8 id, u8 version, u8 type, size_t size, u8 const *data)
{ struct vpd_cache *vpd = userdata; if (id == VPD_BLOCK_HWID && version == 1 && type != VPD_TYPE_INVALID && size >= 1) { vpd->product_id = data[0]; } else if (id == VPD_BLOCK_NETWORK && version == 1 && type != VPD_TYPE_INVALID) { if (size >= 6) { vpd->has |= VPD_HAS_MAC1; memcpy(vpd->mac1, data, VPD_MAC_ADDRESS_LENGTH); } } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is configured as an input. Otherwise, due to the way the controller registers work, this function will change the value output on the pin. */
void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull)
/* NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is configured as an input. Otherwise, due to the way the controller registers work, this function will change the value output on the pin. */ void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull)
{ void __iomem *addr = get_gpio_addr(gpio); unsigned offset = get_gpio_offset(gpio); u32 bit = 1 << offset; u32 pdis; pdis = readl(addr + DB8500_GPIO_PDIS); if (pull == DB8500_GPIO_PULL_NONE) pdis |= bit; else pdis &= ~bit; writel(pdis, addr + DB8500_GPIO_PDIS); if (pull == DB8500_GPIO_PULL_UP) writel(bit, addr + DB8500_GPIO_DATS); else if (pull == DB8500_GPIO_PULL_DOWN) writel(bit, addr + DB8500_GPIO_DATC); }
4ms/stm32mp1-baremetal
C++
Other
137
/* OOB message channel enable asserted flag. A 0-to-1 or 1-to-0 transition on "OOB Message Channel Enable" bit. */
static void espi_it8xxx2_oob_ch_en_isr(const struct device *dev, bool enable)
/* OOB message channel enable asserted flag. A 0-to-1 or 1-to-0 transition on "OOB Message Channel Enable" bit. */ static void espi_it8xxx2_oob_ch_en_isr(const struct device *dev, bool enable)
{ espi_it8xxx2_ch_notify_system_state(dev, ESPI_CHANNEL_OOB, enable); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Init interrupts callback for the specified SPI Port. */
void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
/* Init interrupts callback for the specified SPI Port. */ void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
{ xASSERT(ulBase == SPI0_BASE); g_pfnSPIHandlerCallbacks[0] = xtSPICallback; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Produce the DynamicCommand protocol to handle "tftp" command. */
EFI_STATUS EFIAPI DpCommandInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Produce the DynamicCommand protocol to handle "tftp" command. */ EFI_STATUS EFIAPI DpCommandInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; mDpHiiHandle = InitializeHiiPackage (ImageHandle); if (mDpHiiHandle == NULL) { return EFI_ABORTED; } Status = gBS->InstallProtocolInterface ( &ImageHandle, &gEfiShellDynamicCommandProtocolGuid, EFI_NATIVE_INTERFACE, &mDpDynamicCommand ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Processes a single controller using the EFI Driver Health Protocol associated with that controller. */
VOID DriverHealthManagerProcessSingleControllerHealth(IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth, IN EFI_HANDLE ControllerHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_DRIVER_HEALTH_STATUS HealthStatus, IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList OPTIONAL, IN EFI_HII_HANDLE FormHiiHandle)
/* Processes a single controller using the EFI Driver Health Protocol associated with that controller. */ VOID DriverHealthManagerProcessSingleControllerHealth(IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth, IN EFI_HANDLE ControllerHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_DRIVER_HEALTH_STATUS HealthStatus, IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList OPTIONAL, IN EFI_HII_HANDLE FormHiiHandle)
{ EFI_STATUS Status; ASSERT (HealthStatus != EfiDriverHealthStatusConfigurationRequired); switch (HealthStatus) { case EfiDriverHealthStatusRepairRequired: Status = DriverHealth->Repair ( DriverHealth, ControllerHandle, ChildHandle, DriverHealthManagerRepairNotify ); break; case EfiDriverHealthStatusRebootRequired: gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); break; case EfiDriverHealthStatusReconnectRequired: Status = gBS->DisconnectController (ControllerHandle, NULL, NULL); if (EFI_ERROR (Status)) { gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); } else { gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE); } break; default: break; } }
tianocore/edk2
C++
Other
4,240
/* get the subjective security ID of the current task */
static u32 current_sid(void)
/* get the subjective security ID of the current task */ static u32 current_sid(void)
{ const struct task_security_struct *tsec = current_cred()->security; return tsec->sid; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sends one request for this server. (smbiod) Must be called with the server lock held. Returns: <0 on error 0 if no request could be completely sent 1 if all data for one request was sent */
int smb_request_send_server(struct smb_sb_info *server)
/* Sends one request for this server. (smbiod) Must be called with the server lock held. Returns: <0 on error 0 if no request could be completely sent 1 if all data for one request was sent */ int smb_request_send_server(struct smb_sb_info *server)
{ struct list_head *head; struct smb_request *req; int result; if (server->state != CONN_VALID) return 0; req = NULL; head = server->xmitq.next; if (head != &server->xmitq) { req = list_entry(head, struct smb_request, rq_queue); } if (!req) return 0; result = smb_request_send_req(req); if (result < 0) { server->conn_error = result; list_move(&req->rq_queue, &server->xmitq); result = -EIO; goto out; } out: return result; }
robutest/uclinux
C++
GPL-2.0
60
/* This function looks up the appropriate tool to use for extracting a GUID defined FV section. */
CHAR8* LookupGuidedSectionToolPath(IN EFI_HANDLE ParsedGuidedSectionToolsHandle, IN EFI_GUID *SectionGuid)
/* This function looks up the appropriate tool to use for extracting a GUID defined FV section. */ CHAR8* LookupGuidedSectionToolPath(IN EFI_HANDLE ParsedGuidedSectionToolsHandle, IN EFI_GUID *SectionGuid)
{ GUID_SEC_TOOL_ENTRY *GuidTool; GuidTool = (GUID_SEC_TOOL_ENTRY*)ParsedGuidedSectionToolsHandle; if (GuidTool == NULL) { return NULL; } for ( ; GuidTool != NULL; GuidTool = GuidTool->Next) { if (CompareGuid (&(GuidTool->Guid), SectionGuid) == 0) { return CloneString (GuidTool->Path); } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Get the full / physical horizontal resolution of a display */
lv_coord_t lv_disp_get_physical_hor_res(lv_disp_t *disp)
/* Get the full / physical horizontal resolution of a display */ lv_coord_t lv_disp_get_physical_hor_res(lv_disp_t *disp)
{ if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) { return 0; } else { switch(disp->driver->rotated) { case LV_DISP_ROT_90: case LV_DISP_ROT_270: return disp->driver->physical_ver_res > 0 ? disp->driver->physical_ver_res : disp->driver->ver_res; default: return disp->driver->physical_hor_res > 0 ? disp->driver->physical_hor_res : disp->driver->hor_res; } } }
pikasTech/PikaPython
C++
MIT License
1,403
/* If Attributes includes some memory resource's settings, it should include the corresponding capabilites also. */
VOID CoreValidateResourceDescriptorHobAttributes(IN UINT64 Attributes)
/* If Attributes includes some memory resource's settings, it should include the corresponding capabilites also. */ VOID CoreValidateResourceDescriptorHobAttributes(IN UINT64 Attributes)
{ ASSERT ( ((Attributes & EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED) == 0) || ((Attributes & EFI_RESOURCE_ATTRIBUTE_READ_PROTECTABLE) != 0) ); ASSERT ( ((Attributes & EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED) == 0) || ((Attributes & EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTABLE) != 0) ); ASSERT ( ((Attributes & EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED) == 0) || ((Attributes & EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTABLE) != 0) ); ASSERT ( ((Attributes & EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTED) == 0) || ((Attributes & EFI_RESOURCE_ATTRIBUTE_READ_ONLY_PROTECTABLE) != 0) ); ASSERT ( ((Attributes & EFI_RESOURCE_ATTRIBUTE_PERSISTENT) == 0) || ((Attributes & EFI_RESOURCE_ATTRIBUTE_PERSISTABLE) != 0) ); }
tianocore/edk2
C++
Other
4,240
/* Use global flush state to avoid races with multiple flushers. */
static void flush_gart(void)
/* Use global flush state to avoid races with multiple flushers. */ static void flush_gart(void)
{ unsigned long flags; spin_lock_irqsave(&iommu_bitmap_lock, flags); if (need_flush) { k8_flush_garts(); need_flush = false; } spin_unlock_irqrestore(&iommu_bitmap_lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Add a FLOCK style lock to a file. */
int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
/* Add a FLOCK style lock to a file. */ int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
{ int error; might_sleep(); for (;;) { error = flock_lock_file(filp, fl); if (error != FILE_LOCK_DEFERRED) break; error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); if (!error) continue; locks_delete_block(fl); break; } return error; }
robutest/uclinux
C++
GPL-2.0
60
/* Write data element to the SPI interface with Noblock. */
long xSPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
/* Write data element to the SPI interface with Noblock. */ long xSPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); if(!((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_BUSY))) { xHWREG(ulBase + SPI_TX) = ulData; return(1); } else { return(0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Complete setting up the reset field of DCD of V2 such as DCD tag, version, length, etc. */
static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len, char *name, int lineno)
/* Complete setting up the reset field of DCD of V2 such as DCD tag, version, length, etc. */ static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len, char *name, int lineno)
{ if (!imxhdr->header.hdr_v2.boot_data.plugin) { dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.data.dcd_table; struct dcd_v2_cmd *d = gd_last_cmd; int len; if (!d) d = &dcd_v2->dcd_cmd; len = be16_to_cpu(d->write_dcd_command.length); if (len > 4) d = (struct dcd_v2_cmd *)(((char *)d) + len); len = (char *)d - (char *)&dcd_v2->header; dcd_v2->header.tag = DCD_HEADER_TAG; dcd_v2->header.length = cpu_to_be16(len); dcd_v2->header.version = DCD_VERSION; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* param slaveConfig User provided configuration structure that is set to default values. Refer to #i2c_slave_config_t. */
void I2C_SlaveGetDefaultConfig(i2c_slave_config_t *slaveConfig)
/* param slaveConfig User provided configuration structure that is set to default values. Refer to #i2c_slave_config_t. */ void I2C_SlaveGetDefaultConfig(i2c_slave_config_t *slaveConfig)
{ assert(slaveConfig != NULL); i2c_slave_config_t mySlaveConfig = {0}; mySlaveConfig.enableSlave = true; mySlaveConfig.address1.addressDisable = true; mySlaveConfig.address2.addressDisable = true; mySlaveConfig.address3.addressDisable = true; *slaveConfig = mySlaveConfig; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Perform port level tty hangup flag and count changes. Drop the tty reference. */
void tty_port_hangup(struct tty_port *port)
/* Perform port level tty hangup flag and count changes. Drop the tty reference. */ void tty_port_hangup(struct tty_port *port)
{ unsigned long flags; spin_lock_irqsave(&port->lock, flags); port->count = 0; port->flags &= ~ASYNC_NORMAL_ACTIVE; if (port->tty) { set_bit(TTY_IO_ERROR, &port->tty->flags); tty_kref_put(port->tty); } port->tty = NULL; spin_unlock_irqrestore(&port->lock, flags); wake_up_interruptible(&port->open_wait); wake_up_interruptible(&port->delta_msr_wait); tty_port_shutdown(port); }
robutest/uclinux
C++
GPL-2.0
60
/* For non-synchronous ipi calls the csd can still be in use by the previous function call. For multi-cpu calls its even more interesting as we'll have to ensure no other cpu is observing our csd. */
static void csd_lock_wait(struct call_single_data *data)
/* For non-synchronous ipi calls the csd can still be in use by the previous function call. For multi-cpu calls its even more interesting as we'll have to ensure no other cpu is observing our csd. */ static void csd_lock_wait(struct call_single_data *data)
{ while (data->flags & CSD_FLAG_LOCK) cpu_relax(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If we run out of usable paths, should we queue I/O or error it? */
static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path, unsigned save_old_value)
/* If we run out of usable paths, should we queue I/O or error it? */ static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path, unsigned save_old_value)
{ unsigned long flags; spin_lock_irqsave(&m->lock, flags); if (save_old_value) m->saved_queue_if_no_path = m->queue_if_no_path; else m->saved_queue_if_no_path = queue_if_no_path; m->queue_if_no_path = queue_if_no_path; if (!m->queue_if_no_path && m->queue_size) queue_work(kmultipathd, &m->process_queued_ios); spin_unlock_irqrestore(&m->lock, flags); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Basic board specific setup. Pinmux has been handled already. */
int board_init(void)
/* Basic board specific setup. Pinmux has been handled already. */ int board_init(void)
{ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; gpmc_init(); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Use the configuration feature register to determine the maximum number of banks that the hardware supports. */
static void denali_detect_max_banks(struct denali_nand_info *denali)
/* Use the configuration feature register to determine the maximum number of banks that the hardware supports. */ static void denali_detect_max_banks(struct denali_nand_info *denali)
{ uint32_t features = ioread32(denali->reg + FEATURES); denali->max_banks = 1 << FIELD_GET(FEATURES__N_BANKS, features); if (denali->revision < 0x0501) denali->max_banks <<= 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* VW handlers must have signature typedef void (*mchp_xec_ecia_callback_t) (int girq_id, int src, void *user) where parameter user is a pointer to const struct device These handlers are registered to their respective GIRQ child device of the ECIA driver. */
static void vw_slp3_handler(int girq_id, int src, void *user)
/* VW handlers must have signature typedef void (*mchp_xec_ecia_callback_t) (int girq_id, int src, void *user) where parameter user is a pointer to const struct device These handlers are registered to their respective GIRQ child device of the ECIA driver. */ static void vw_slp3_handler(int girq_id, int src, void *user)
{ const struct device *dev = (const struct device *)user; notify_system_state(dev, ESPI_VWIRE_SIGNAL_SLP_S3); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Perform a "short reduction" in field F256 (field for curve P-256). The source value should be less than 262 bits; on output, it will be at most 257 bits, and less than twice the modulus. */
static void reduce_f256(uint32_t *d)
/* Perform a "short reduction" in field F256 (field for curve P-256). The source value should be less than 262 bits; on output, it will be at most 257 bits, and less than twice the modulus. */ static void reduce_f256(uint32_t *d)
{ uint32_t x; x = d[19] >> 9; d[19] &= 0x01FF; d[17] += x << 3; d[14] -= x << 10; d[7] -= x << 5; d[0] += x; norm13(d, d, 20); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* That function parses "simple" (old) crashkernel command lines like */
static int __init parse_crashkernel_simple(char *cmdline, unsigned long long *crash_size, unsigned long long *crash_base)
/* That function parses "simple" (old) crashkernel command lines like */ static int __init parse_crashkernel_simple(char *cmdline, unsigned long long *crash_size, unsigned long long *crash_base)
{ char *cur = cmdline; *crash_size = memparse(cmdline, &cur); if (cmdline == cur) { pr_warning("crashkernel: memory value expected\n"); return -EINVAL; } if (*cur == '@') *crash_base = memparse(cur+1, &cur); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for updating the VBATT field of TLM. */
static void update_vbatt(void)
/* Function for updating the VBATT field of TLM. */ static void update_vbatt(void)
{ uint16_t vbatt; es_battery_voltage_get(&vbatt); m_tlm.vbatt[0] = (uint8_t)(vbatt >> 8); m_tlm.vbatt[1] = (uint8_t)vbatt; }
remotemcu/remcu-chip-sdks
C++
null
436
/* ad_initialize_agg - initialize a given aggregator's parameters @aggregator: the aggregator we're looking at */
static void ad_initialize_agg(struct aggregator *aggregator)
/* ad_initialize_agg - initialize a given aggregator's parameters @aggregator: the aggregator we're looking at */ static void ad_initialize_agg(struct aggregator *aggregator)
{ if (aggregator) { ad_clear_agg(aggregator); aggregator->aggregator_mac_address = null_mac_addr; aggregator->aggregator_identifier = 0; aggregator->slave = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* A dryice write error is similar to a bus fault and should not occur in normal operation. Clearing the flag requires another write, so the root cause of the problem may need to be fixed before the flag can be cleared. */
static void clear_write_error(void)
/* A dryice write error is similar to a bus fault and should not occur in normal operation. Clearing the flag requires another write, so the root cause of the problem may need to be fixed before the flag can be cleared. */ static void clear_write_error(void)
{ int cnt; puts("### Warning: RTC - Register write error!\n"); __raw_writel(DSR_WEF, &data.regs->dsr); for (cnt = 0; cnt < 1000; cnt++) { if ((__raw_readl(&data.regs->dsr) & DSR_WEF) == 0) return; udelay(10); } puts("### Error: RTC - Cannot clear write-error flag!\n"); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Perform one write transaction. This writes all data in */
static int mcux_i3c_do_one_xfer_write(I3C_Type *base, uint8_t *buf, uint8_t buf_sz, bool no_ending)
/* Perform one write transaction. This writes all data in */ static int mcux_i3c_do_one_xfer_write(I3C_Type *base, uint8_t *buf, uint8_t buf_sz, bool no_ending)
{ int offset = 0; int remaining = buf_sz; int ret = 0; while (remaining > 0) { ret = reg32_poll_timeout(&base->MDATACTRL, I3C_MDATACTRL_TXFULL_MASK, 0, 0, 10, 1000); if (ret == -ETIMEDOUT) { goto one_xfer_write_out; } if ((remaining > 1) || no_ending) { base->MWDATAB = (uint32_t)buf[offset]; } else { base->MWDATABE = (uint32_t)buf[offset]; } offset += 1; remaining -= 1; } ret = offset; one_xfer_write_out: return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Check whether header field called FieldName is in DeleteList. */
BOOLEAN EFIAPI HttpIsValidHttpHeader(IN CHAR8 *DeleteList[], IN UINTN DeleteCount, IN CHAR8 *FieldName)
/* Check whether header field called FieldName is in DeleteList. */ BOOLEAN EFIAPI HttpIsValidHttpHeader(IN CHAR8 *DeleteList[], IN UINTN DeleteCount, IN CHAR8 *FieldName)
{ UINTN Index; if (FieldName == NULL) { return FALSE; } for (Index = 0; Index < DeleteCount; Index++) { if (DeleteList[Index] == NULL) { continue; } if (AsciiStrCmp (FieldName, DeleteList[Index]) == 0) { return FALSE; } } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Before you start, select your target, on the right of the "Load" button */
int main(void)
/* Before you start, select your target, on the right of the "Load" button */ int main(void)
{ sprintf(str, "----------------------------\nVbat voltage: %d mV\n", TM_ADC_ReadVbat(ADC1)); TM_USART_Puts(USART1, str); Delayms(1000); } }
MaJerle/stm32f429
C++
null
2,036
/* This function is called by APs to accept memory. */
STATIC EFI_STATUS EFIAPI ApAcceptMemoryResourceRange(UINT32 CpuIndex, EFI_PHYSICAL_ADDRESS PhysicalStart, EFI_PHYSICAL_ADDRESS PhysicalEnd)
/* This function is called by APs to accept memory. */ STATIC EFI_STATUS EFIAPI ApAcceptMemoryResourceRange(UINT32 CpuIndex, EFI_PHYSICAL_ADDRESS PhysicalStart, EFI_PHYSICAL_ADDRESS PhysicalEnd)
{ UINT64 Status; TD_RETURN_DATA TdReturnData; Status = TdCall (TDCALL_TDINFO, 0, 0, 0, &TdReturnData); if (Status != TDX_EXIT_REASON_SUCCESS) { ASSERT (FALSE); return EFI_ABORTED; } if ((CpuIndex == 0) || (CpuIndex >= TdReturnData.TdInfo.NumVcpus)) { ASSERT (FALSE); return EFI_ABORTED; } return BspApAcceptMemoryResourceRange (CpuIndex, TdReturnData.TdInfo.NumVcpus, PhysicalStart, PhysicalEnd); }
tianocore/edk2
C++
Other
4,240
/* Downsample pixel values of a single component. This version handles the special case of a full-size component, without smoothing. */
fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
/* Downsample pixel values of a single component. This version handles the special case of a full-size component, without smoothing. */ fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
{ jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor, cinfo->image_width); expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width, compptr->width_in_blocks * compptr->DCT_h_scaled_size); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Enable the SERCOM SPI module. This function must be called after */
void spi_master_vec_enable(const struct spi_master_vec_module *const module)
/* Enable the SERCOM SPI module. This function must be called after */ void spi_master_vec_enable(const struct spi_master_vec_module *const module)
{ Assert(module); Assert(module->sercom); SercomSpi *const spi_hw = &(module->sercom->SPI); spi_hw->INTENCLR.reg = SERCOM_SPI_INTFLAG_DRE | SERCOM_SPI_INTFLAG_RXC | SERCOM_SPI_INTFLAG_TXC; _spi_master_vec_wait_for_sync(spi_hw); spi_hw->CTRLA.reg |= SERCOM_SPI_CTRLA_ENABLE; system_interrupt_enable(_sercom_get_interrupt_vector(module->sercom)); }
memfault/zero-to-main
C++
null
200
/* Message: ClearPriNotifyMessage Opcode: 0x0121 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_ClearPriNotifyMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: ClearPriNotifyMessage Opcode: 0x0121 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ static void handle_ClearPriNotifyMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_priority, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The WatchDog Timer(WDT) default IRQ, declared in start up code. */
void WDTIntHandler(void)
/* The WatchDog Timer(WDT) default IRQ, declared in start up code. */ void WDTIntHandler(void)
{ if (g_pfnWATCHDOGHandlerCallbacks[0] != 0) { g_pfnWATCHDOGHandlerCallbacks[0](0, 0, 0, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* A simple wrapper function that allows you to free heap memory from interrupt context. */
err_t mem_free_callback(void *m)
/* A simple wrapper function that allows you to free heap memory from interrupt context. */ err_t mem_free_callback(void *m)
{ return tcpip_callback_with_block(mem_free, m, 0); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Set the LPS22HH pressure sensor output data rate. */
int32_t LPS22HH_PRESS_SetOutputDataRate(LPS22HH_Object_t *pObj, float Odr)
/* Set the LPS22HH pressure sensor output data rate. */ int32_t LPS22HH_PRESS_SetOutputDataRate(LPS22HH_Object_t *pObj, float Odr)
{ if (pObj->press_is_enabled == 1U) { return LPS22HH_SetOutputDataRate_When_Enabled(pObj, Odr); } else { return LPS22HH_SetOutputDataRate_When_Disabled(pObj, Odr); } }
eclipse-threadx/getting-started
C++
Other
310
/* Write a data buffer to internal Flash. Note that we need for this function to reside in RAM since it will be used to self-upgrade U-boot in internal Flash. */
u32 __attribute__((section(".ramcode")))
/* Write a data buffer to internal Flash. Note that we need for this function to reside in RAM since it will be used to self-upgrade U-boot in internal Flash. */ u32 __attribute__((section(".ramcode")))
{ iap_commands[0] = IAP_CMD_PREP_SECTORS; iap_commands[1] = start; iap_commands[2] = end; iap_commands[3] = bank; lpc43xn_iap_entry(iap_commands, iap_results); return iap_results[0]; }
EmcraftSystems/u-boot
C++
Other
181
/* Work out how many blocks we need to proceed with the next chunk of a truncate transaction. */
static unsigned long blocks_for_truncate(struct inode *inode)
/* Work out how many blocks we need to proceed with the next chunk of a truncate transaction. */ static unsigned long blocks_for_truncate(struct inode *inode)
{ ext4_lblk_t needed; needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9); if (needed < 2) needed = 2; if (needed > EXT4_MAX_TRANS_DATA) needed = EXT4_MAX_TRANS_DATA; return EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + needed; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: the value corresponding to the key, or NULL if the key was not found */
gpointer g_tree_lookup(GTree *tree, gconstpointer key)
/* Returns: the value corresponding to the key, or NULL if the key was not found */ gpointer g_tree_lookup(GTree *tree, gconstpointer key)
{ GTreeNode *node; g_return_val_if_fail (tree != NULL, NULL); node = g_tree_find_node (tree, key); return node ? node->value : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ks_wrreg16 - write 16bit register value to chip @ks: The chip information @offset: The register address @value: The value to write */
static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
/* ks_wrreg16 - write 16bit register value to chip @ks: The chip information @offset: The register address @value: The value to write */ static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
{ ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); iowrite16(value, ks->hw_addr); }
robutest/uclinux
C++
GPL-2.0
60
/* @master: the MTD device to unregister. This will unregister both the master and any partitions if registered. */
int mtd_device_unregister(struct mtd_info *master)
/* @master: the MTD device to unregister. This will unregister both the master and any partitions if registered. */ int mtd_device_unregister(struct mtd_info *master)
{ int err; err = del_mtd_partitions(master); if (err) return err; if (!device_is_registered(&master->dev)) return 0; return del_mtd_device(master); }
4ms/stm32mp1-baremetal
C++
Other
137
/* brief Return Frequency of DAC Clock return Frequency of DAC. */
uint32_t CLOCK_GetDacClkFreq(uint32_t id)
/* brief Return Frequency of DAC Clock return Frequency of DAC. */ uint32_t CLOCK_GetDacClkFreq(uint32_t id)
{ uint32_t freq = 0U; switch (SYSCON->DAC[id].CLKSEL) { case 0U: freq = CLOCK_GetCoreSysClkFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 4U: freq = CLOCK_GetFro12MFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq(); break; case 6U: freq = CLOCK_GetFro1MFreq(); break; default: freq = 0U; break; } return freq / ((SYSCON->DAC[id].CLKDIV & SYSCON_DAC_CLKDIV_DIV_MASK) + 1U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables the specified USART peripheral in STOP Mode. */
void USART_STOPModeCmd(USART_TypeDef *USARTx, FunctionalState NewState)
/* Enables or disables the specified USART peripheral in STOP Mode. */ void USART_STOPModeCmd(USART_TypeDef *USARTx, FunctionalState NewState)
{ assert_param(IS_USART_1_PERIPH(USARTx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR1 |= USART_CR1_UESM; } else { USARTx->CR1 &= (uint32_t)~((uint32_t)USART_CR1_UESM); } }
ajhc/demo-cortex-m3
C++
null
38
/* Set high 32 bits of Redirection Table entry. This routine writes the high-order 32 bits of a Redirection Table entry. */
static __pinned_func void ioApicRedSetHi(unsigned int irq, uint32_t upper32)
/* Set high 32 bits of Redirection Table entry. This routine writes the high-order 32 bits of a Redirection Table entry. */ static __pinned_func void ioApicRedSetHi(unsigned int irq, uint32_t upper32)
{ int32_t offset = IOAPIC_REDTBL + (irq << 1) + 1; __IoApicSet(offset, upper32); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the slave select pins of the specified SPI port. The */
void SPISSSet(unsigned long ulBase, unsigned long ulSlaveSel)
/* Set the slave select pins of the specified SPI port. The */ void SPISSSet(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function must be called by the USB function driver to continue with the control transfer's data/status stage in case it had requested to delay the data/status stages. A USB function's setup handler (e.g. set_alt()) can request the composite framework to delay the setup request's data/status stages by returning USB_GADGET_DELAYED_STATUS. */
void usb_composite_setup_continue(struct usb_composite_dev *cdev)
/* This function must be called by the USB function driver to continue with the control transfer's data/status stage in case it had requested to delay the data/status stages. A USB function's setup handler (e.g. set_alt()) can request the composite framework to delay the setup request's data/status stages by returning USB_GADGET_DELAYED_STATUS. */ void usb_composite_setup_continue(struct usb_composite_dev *cdev)
{ int value; struct usb_request *req = cdev->req; unsigned long flags; DBG(cdev, "%s\n", __func__); spin_lock_irqsave(&cdev->lock, flags); if (cdev->delayed_status == 0) { WARN(cdev, "%s: Unexpected call\n", __func__); } else if (--cdev->delayed_status == 0) { DBG(cdev, "%s: Completing delayed status\n", __func__); req->length = 0; value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC); if (value < 0) { DBG(cdev, "ep_queue --> %d\n", value); req->status = 0; composite_setup_complete(cdev->gadget->ep0, req); } } spin_unlock_irqrestore(&cdev->lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reset the Data Cache The data cache must be disabled for this to have effect. */
void flash_dcache_reset(void)
/* Reset the Data Cache The data cache must be disabled for this to have effect. */ void flash_dcache_reset(void)
{ FLASH_ACR |= FLASH_ACR_DCRST; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* 3. LSA Identifier The octets 3-5 are coded as specified in 3GPP TS 23.003, 'Identification of Localised Service Area'. Bit 8 of octet 3 is the MSB. */
static guint16 be_lsa_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3. LSA Identifier The octets 3-5 are coded as specified in 3GPP TS 23.003, 'Identification of Localised Service Area'. Bit 8 of octet 3 is the MSB. */ static guint16 be_lsa_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_item(tree, hf_gsm_a_bssmap_lsa_id, tvb, curr_offset, 3, ENC_BIG_ENDIAN); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Description: vxfs_fake_inode gets a fake inode (not in the inode hash) for a superblock, vxfs_inode pair. Returns the filled VFS inode. */
struct inode* vxfs_get_fake_inode(struct super_block *sbp, struct vxfs_inode_info *vip)
/* Description: vxfs_fake_inode gets a fake inode (not in the inode hash) for a superblock, vxfs_inode pair. Returns the filled VFS inode. */ struct inode* vxfs_get_fake_inode(struct super_block *sbp, struct vxfs_inode_info *vip)
{ struct inode *ip = NULL; if ((ip = new_inode(sbp))) { vxfs_iinit(ip, vip); ip->i_mapping->a_ops = &vxfs_aops; } return (ip); }
robutest/uclinux
C++
GPL-2.0
60
/* HID class driver callback function for the creation of HID reports to the host. */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize)
/* HID class driver callback function for the creation of HID reports to the host. */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize)
{ USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData; uint8_t JoyStatus_LCL = Joystick_GetStatus(); uint8_t ButtonStatus_LCL = Buttons_GetStatus(); if (JoyStatus_LCL & JOY_UP) MouseReport->Y = -1; else if (JoyStatus_LCL & JOY_DOWN) MouseReport->Y = 1; if (JoyStatus_LCL & JOY_LEFT) MouseReport->X = -1; else if (JoyStatus_LCL & JOY_RIGHT) MouseReport->X = 1; if (JoyStatus_LCL & JOY_PRESS) MouseReport->Button |= (1 << 0); if (ButtonStatus_LCL & BUTTONS_BUTTON1) MouseReport->Button |= (1 << 1); *ReportSize = sizeof(USB_MouseReport_Data_t); return true; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* returns 0 if the nand is busy, 1 if it is ready */
static int bf5xx_nand_devready(struct mtd_info *mtd)
/* returns 0 if the nand is busy, 1 if it is ready */ static int bf5xx_nand_devready(struct mtd_info *mtd)
{ unsigned short val = bfin_read_NFC_IRQSTAT(); if ((val & NBUSYIRQ) == NBUSYIRQ) return 1; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Store a full block of planar data after c2p conversion */
static void store_planar(void *dst, u32 dst_inc, u32 bpp, u32 d[8])
/* Store a full block of planar data after c2p conversion */ static void store_planar(void *dst, u32 dst_inc, u32 bpp, u32 d[8])
{ int i; for (i = 0; i < bpp; i++, dst += dst_inc) put_unaligned_be32(d[perm_c2p_32x8[i]], dst); }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the SYNC setting of a frame sync used by the VTC core. */
void XVtc_GetFSync(XVtc *InstancePtr, u16 FrameSyncIndex, u16 *VertStartPtr, u16 *HoriStartPtr)
/* This function gets the SYNC setting of a frame sync used by the VTC core. */ void XVtc_GetFSync(XVtc *InstancePtr, u16 FrameSyncIndex, u16 *VertStartPtr, u16 *HoriStartPtr)
{ u32 RegValue; u32 RegAddress; Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); Xil_AssertVoid(FrameSyncIndex <= 15); Xil_AssertVoid(VertStartPtr != NULL); Xil_AssertVoid(VertStartPtr != NULL); RegAddress = XVTC_FS00_OFFSET + FrameSyncIndex * XVTC_REG_ADDRGAP; RegValue = XVtc_ReadReg(InstancePtr->Config.BaseAddress, RegAddress); *HoriStartPtr = RegValue & XVTC_FSXX_HSTART_MASK; *VertStartPtr = (RegValue & XVTC_FSXX_VSTART_MASK) >> XVTC_FSXX_VSTART_SHIFT; }
ua1arn/hftrx
C++
null
69
/* Initialize kobj because nobody using md yet, no need to call explicit dm_get/put */
int dm_sysfs_init(struct mapped_device *md)
/* Initialize kobj because nobody using md yet, no need to call explicit dm_get/put */ int dm_sysfs_init(struct mapped_device *md)
{ return kobject_init_and_add(dm_kobject(md), &dm_ktype, &disk_to_dev(dm_disk(md))->kobj, "%s", "dm"); }
robutest/uclinux
C++
GPL-2.0
60
/* See "mss_ace.h" for details of how to use this function. */
ace_channel_handle_t ACE_get_channel_handle(const uint8_t *p_sz_channel_name)
/* See "mss_ace.h" for details of how to use this function. */ ace_channel_handle_t ACE_get_channel_handle(const uint8_t *p_sz_channel_name)
{ uint16_t channel_idx; ace_channel_handle_t channel_handle = INVALID_CHANNEL_HANDLE; for ( channel_idx = 0u; channel_idx < (uint16_t)ACE_NB_OF_INPUT_CHANNELS; ++channel_idx ) { if ( g_ace_channel_desc_table[channel_idx].p_sz_channel_name != 0 ) { int32_t diff; diff = strncmp( (const char*)p_sz_channel_name, (const char*)g_ace_channel_desc_table[channel_idx].p_sz_channel_name, MAX_CHANNEL_NAME_LENGTH ); if ( 0 == diff ) { channel_handle = (ace_channel_handle_t)channel_idx; break; } } } return channel_handle; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Schedule Class C session if valid timing is found */
static int32_t multicast_schedule_class_c_session(uint8_t id, uint32_t session_time, uint32_t session_timeout)
/* Schedule Class C session if valid timing is found */ static int32_t multicast_schedule_class_c_session(uint8_t id, uint32_t session_time, uint32_t session_timeout)
{ uint32_t current_time; int32_t time_to_start; int err; err = lorawan_clock_sync_get(&current_time); time_to_start = session_time - current_time; if (err != 0 || time_to_start > 0xFFFFFF) { LOG_ERR("Clocks not synchronized, cannot schedule class C session"); time_to_start = 0xFFFFFF; } else if (time_to_start >= 0) { LOG_DBG("Starting class C session in %d s", time_to_start); lorawan_services_reschedule_work(&ctx[id].session_start_work, K_SECONDS(time_to_start)); lorawan_services_reschedule_work(&ctx[id].session_stop_work, K_SECONDS(time_to_start + session_timeout)); } return time_to_start; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Audio Input Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { Audio_Host_USBTask(&Microphone_Audio_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Note: we need to make the determination of whether or not to use the sw I/O TLB based purely on the device structure. Anything else would be unreliable or would be too intrusive. */
static int use_swiotlb(struct device *dev)
/* Note: we need to make the determination of whether or not to use the sw I/O TLB based purely on the device structure. Anything else would be unreliable or would be too intrusive. */ static int use_swiotlb(struct device *dev)
{ return dev && dev->dma_mask && !sba_dma_ops.dma_supported(dev, *dev->dma_mask); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize the hardware interface to the controller. This will initialize the module used for communication with the controller. Currently supported interface by this driver is the TWI module in master mode. */
static uint32_t mcp980x_interface_init(void)
/* Initialize the hardware interface to the controller. This will initialize the module used for communication with the controller. Currently supported interface by this driver is the TWI module in master mode. */ static uint32_t mcp980x_interface_init(void)
{ twi_master_options_t opt = { .speed = TWI_SPEED, .chip = BOARD_MCP980X_ADDR }; return twi_master_setup(BOARD_MCP980X_TWI_INSTANCE, &opt); }
remotemcu/remcu-chip-sdks
C++
null
436
/* basically do an itoa using as little ram as possible */
void UnityPrintNumber(const _U_SINT number_to_print)
/* basically do an itoa using as little ram as possible */ void UnityPrintNumber(const _U_SINT number_to_print)
{ _U_SINT divisor = 1; _U_SINT next_divisor; _U_SINT number = number_to_print; if (number < 0) { UNITY_OUTPUT_CHAR('-'); number = -number; } while (number / divisor > 9) { next_divisor = divisor * 10; if (next_divisor > divisor) divisor = next_divisor; else break; } do { UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10))); divisor /= 10; } while (divisor > 0); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Disables pull-ups for the pins in WINC which are used for communication with host MCU. */
static void disable_pullups(void)
/* Disables pull-ups for the pins in WINC which are used for communication with host MCU. */ static void disable_pullups(void)
{ uint32 pinmask; pinmask = ( M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP| M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK| M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD); m2m_periph_pullup_ctrl(pinmask, 0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This API is used to parse the gyro data from the FIFO data and store it in the instance of the structure bmi160_sensor_data. */
static void unpack_gyro_data(struct bmi160_sensor_data *gyro_data, uint16_t data_start_index, const struct bmi160_dev *dev)
/* This API is used to parse the gyro data from the FIFO data and store it in the instance of the structure bmi160_sensor_data. */ static void unpack_gyro_data(struct bmi160_sensor_data *gyro_data, uint16_t data_start_index, const struct bmi160_dev *dev)
{ uint16_t data_lsb; uint16_t data_msb; data_lsb = dev->fifo->data[data_start_index++]; data_msb = dev->fifo->data[data_start_index++]; gyro_data->x = (int16_t)((data_msb << 8) | data_lsb); data_lsb = dev->fifo->data[data_start_index++]; data_msb = dev->fifo->data[data_start_index++]; gyro_data->y = (int16_t)((data_msb << 8) | data_lsb); data_lsb = dev->fifo->data[data_start_index++]; data_msb = dev->fifo->data[data_start_index++]; gyro_data->z = (int16_t)((data_msb << 8) | data_lsb); }
eclipse-threadx/getting-started
C++
Other
310
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_DISABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_DISABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_DISABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disable interrupts for a specified integrated USB DMA channel. */
void USBDMAChannelIntDisable(uint32_t ui32Base, uint32_t ui32Channel)
/* Disable interrupts for a specified integrated USB DMA channel. */ void USBDMAChannelIntDisable(uint32_t ui32Base, uint32_t ui32Channel)
{ ASSERT(ui32Base == USB0_BASE); ASSERT(ui32Channel < 8); HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) &= ~USB_DMACTL0_IE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write the initialization vector (for the CBC, CFB, OFB, CTR & GCM cipher modes). */
void aes_write_initvector(Aes *const p_aes, const uint32_t *p_vector)
/* Write the initialization vector (for the CBC, CFB, OFB, CTR & GCM cipher modes). */ void aes_write_initvector(Aes *const p_aes, const uint32_t *p_vector)
{ uint32_t i; Assert(p_aes); for (i = 0; i < 4; i++) { p_aes->AES_IVR[i] = *p_vector; p_vector++; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base SAI base pointer param order Data order MSB or LSB */
void SAI_RxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
/* param base SAI base pointer param order Data order MSB or LSB */ void SAI_RxSetBitClockPolarity(I2S_Type *base, sai_clock_polarity_t polarity)
{ uint32_t val = (base->RCR2) & (~I2S_RCR2_BCP_MASK); val |= I2S_RCR2_BCP(polarity); base->RCR2 = val; }
eclipse-threadx/getting-started
C++
Other
310
/* This function is the exported kernel interface. It returns some number of good random numbers, suitable for seeding TCP sequence numbers, etc. */
void get_random_bytes(void *buf, int nbytes)
/* This function is the exported kernel interface. It returns some number of good random numbers, suitable for seeding TCP sequence numbers, etc. */ void get_random_bytes(void *buf, int nbytes)
{ extract_entropy(&nonblocking_pool, buf, nbytes, 0, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified ADC DMA request. */
void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the specified ADC DMA request. */ void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_DMA_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CR2 |= CR2_DMA_Set; } else { ADCx->CR2 &= CR2_DMA_Reset; } }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* load the image to the center of the screen. */
void load_centralized_image(uint32_t addr, ips_dev_panel_t *panel)
/* load the image to the center of the screen. */ void load_centralized_image(uint32_t addr, ips_dev_panel_t *panel)
{ int screenwidth = panel->width; int screenheight = panel->height; int width = 313, height = 117; int left_offset = (screenwidth - width) / 2; int top_offset = (screenheight - height) / 2; int i = 0; memset((void *)addr, 0x1F, 2 * screenheight * screenwidth); for (i = 0; i < height; i++) { memcpy((void *)(addr + screenwidth * (top_offset + i) * 2 + left_offset * 2), &gImage_fsl[width * i * 2], width * 2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calls gadget with disconnect event and resets the UDC and makes initial bringup to be ready for ep0 events */
static void usb_disconnect(struct udc *dev)
/* Calls gadget with disconnect event and resets the UDC and makes initial bringup to be ready for ep0 events */ static void usb_disconnect(struct udc *dev)
{ dev_info(&dev->pdev->dev, "USB Disconnect\n"); dev->connected = 0; udc_mask_unused_interrupts(dev); tasklet_schedule(&disconnect_tasklet); }
robutest/uclinux
C++
GPL-2.0
60
/* Send ADS7052 Offset calibration request. On power-up, the host must provide 24 SCLKs in the first serial transfer to enter the OFFCAL state. During normal operation, the host must provide 64 SCLKs in the serial transfer frame to enter the OFFCAL state. */
static int ads7052_send_calibration(const struct device *dev, bool power_up)
/* Send ADS7052 Offset calibration request. On power-up, the host must provide 24 SCLKs in the first serial transfer to enter the OFFCAL state. During normal operation, the host must provide 64 SCLKs in the serial transfer frame to enter the OFFCAL state. */ static int ads7052_send_calibration(const struct device *dev, bool power_up)
{ const struct ads7052_config *config = dev->config; int err; uint8_t sclks_needed = power_up ? 24 : 64; uint8_t num_bytes = sclks_needed / 8; uint8_t tx_bytes[8] = {0}; const struct spi_buf tx_buf = {.buf = tx_bytes, .len = num_bytes}; const struct spi_buf_set tx = {.buffers = &tx_buf, .count = 1}; err = spi_write_dt(&config->bus, &tx); return err; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function sets the vertical front porch stretch mechanism in VTC core to support Adaptive-Sync feature. VTC core supports two types of stretch mechanisms. 1.Fixed stretch mode 2. Auto adjust mode */
void XVtc_SetAdaptiveSyncMode(XVtc *InstancePtr, XVtc_AdaptiveSyncMode Mode)
/* This function sets the vertical front porch stretch mechanism in VTC core to support Adaptive-Sync feature. VTC core supports two types of stretch mechanisms. 1.Fixed stretch mode 2. Auto adjust mode */ void XVtc_SetAdaptiveSyncMode(XVtc *InstancePtr, XVtc_AdaptiveSyncMode Mode)
{ u32 RegValue; Xil_AssertVoid(InstancePtr); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); RegValue = XVtc_ReadReg(InstancePtr->Config.BaseAddress, XVTC_ADAPTIVE_CTL_OFFSET); if (Mode > XVTC_FIXED_MODE) RegValue |= XVTC_ADAPTIVE_MODE_MASK; else RegValue &= ~XVTC_ADAPTIVE_MODE_MASK; XVtc_WriteReg(InstancePtr->Config.BaseAddress, XVTC_ADAPTIVE_CTL_OFFSET, RegValue | XVTC_ADAPTIVE_ENABLE_MASK); }
ua1arn/hftrx
C++
null
69
/* DMA Stream Channel Select. Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_channel_select(uint32_t dma, uint8_t stream, uint32_t channel)
/* DMA Stream Channel Select. Ensure that the stream is disabled otherwise the setting will not be changed. */ void dma_channel_select(uint32_t dma, uint8_t stream, uint32_t channel)
{ DMA_SCR(dma, stream) |= channel; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{ if(hrtc->Instance==RTC) { __HAL_RCC_RTC_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Whenever a lookup succeeds, we know the parent directories are all valid, so we want to update the dentry timestamps. N.B. Move this to dcache? */
void smb_renew_times(struct dentry *dentry)
/* Whenever a lookup succeeds, we know the parent directories are all valid, so we want to update the dentry timestamps. N.B. Move this to dcache? */ void smb_renew_times(struct dentry *dentry)
{ dget(dentry); spin_lock(&dentry->d_lock); for (;;) { struct dentry *parent; dentry->d_time = jiffies; if (IS_ROOT(dentry)) break; parent = dentry->d_parent; dget(parent); spin_unlock(&dentry->d_lock); dput(dentry); dentry = parent; spin_lock(&dentry->d_lock); } spin_unlock(&dentry->d_lock); dput(dentry); }
robutest/uclinux
C++
GPL-2.0
60
/* Print the hexical QWORD immediate data to instruction content. */
UINTN EdbPrintImmData64(IN UINT64 Data)
/* Print the hexical QWORD immediate data to instruction content. */ UINTN EdbPrintImmData64(IN UINT64 Data)
{ EDBSPrintWithOffset ( mInstructionString.Content, EDB_INSTRUCTION_CONTENT_MAX_SIZE, mInstructionContentOffset, L"(0x%016lx)", Data ); mInstructionContentOffset += 20; return mInstructionContentOffset; }
tianocore/edk2
C++
Other
4,240
/* Simple example: on your card you have have two BSSes you have created with BSSID-01 and BSSID-02. Lets assume BSSID-01 will not use the MAC address. There is another BSSID-03 but you are not part of it. For simplicity's sake, assuming only 4 bits for a mac address and for BSSIDs you can then have: */
void ath_hw_setbssidmask(struct ath_common *common)
/* Simple example: on your card you have have two BSSes you have created with BSSID-01 and BSSID-02. Lets assume BSSID-01 will not use the MAC address. There is another BSSID-03 but you are not part of it. For simplicity's sake, assuming only 4 bits for a mac address and for BSSIDs you can then have: */ void ath_hw_setbssidmask(struct ath_common *common)
{ void *ah = common->ah; REG_WRITE(ah, get_unaligned_le32(common->bssidmask), AR_BSSMSKL); REG_WRITE(ah, get_unaligned_le16(common->bssidmask + 4), AR_BSSMSKU); }
robutest/uclinux
C++
GPL-2.0
60
/* This function disables the retention of the GPIO pin state during hibernation and allows the GPIO pins to be controlled by the system. If the */
void HibernateGPIORetentionDisable(void)
/* This function disables the retention of the GPIO pin state during hibernation and allows the GPIO pins to be controlled by the system. If the */ void HibernateGPIORetentionDisable(void)
{ HWREG(HIB_CTL) &= ~(HIB_CTL_RETCLR | HIB_CTL_VDD3ON); _HibernateWriteComplete(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* De-initializes OTS peripheral. Reset the registers of OTS. */
int32_t OTS_DeInit(void)
/* De-initializes OTS peripheral. Reset the registers of OTS. */ int32_t OTS_DeInit(void)
{ OTS_Stop(); WRITE_REG16(CM_OTS->CTL, 0U); WRITE_REG16(CM_OTS->DR1, 0U); WRITE_REG16(CM_OTS->DR2, 0U); WRITE_REG16(CM_OTS->ECR, 0U); return LL_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: HeadsetStatusMessage Opcode: 0x002b Type: CallControl Direction: dev2pbx VarLength: no */
static void handle_HeadsetStatusMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: HeadsetStatusMessage Opcode: 0x002b Type: CallControl Direction: dev2pbx VarLength: no */ static void handle_HeadsetStatusMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_headsetStatus, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function provides accurate delay (in milliseconds) based on SysTick counter flag. */
void LL_mDelay(uint32_t Delay)
/* This function provides accurate delay (in milliseconds) based on SysTick counter flag. */ void LL_mDelay(uint32_t Delay)
{ __IO uint32_t tmp = SysTick->CTRL; uint32_t tmpDelay = Delay; ((void)tmp); if(tmpDelay < LL_MAX_DELAY) { tmpDelay++; } while (tmpDelay != 0U) { if((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U) { tmpDelay--; } } }
eclipse-threadx/getting-started
C++
Other
310
/* Register user interrupt callback ISR for the I2C module. */
void xI2CIntCallbackInit(unsigned long ulBase, xtEventCallback xtI2CCallback)
/* Register user interrupt callback ISR for the I2C module. */ void xI2CIntCallbackInit(unsigned long ulBase, xtEventCallback xtI2CCallback)
{ I2CIntCallbackInit(ulBase, xtI2CCallback); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The pin is specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypePECITx(unsigned long ulPort, unsigned char ucPins)
/* The pin is specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypePECITx(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns: %-ENODEV if the SSP port is unavailable %-EBUSY if the resources are already in use %0 on success */
int ssp_init(void)
/* Returns: %-ENODEV if the SSP port is unavailable %-EBUSY if the resources are already in use %0 on success */ int ssp_init(void)
{ int ret; if (!(PPAR & PPAR_SPR) && (Ser4MCCR0 & MCCR0_MCE)) return -ENODEV; if (!request_mem_region(__PREG(Ser4SSCR0), 0x18, "SSP")) { return -EBUSY; } Ser4SSSR = SSSR_ROR; ret = request_irq(IRQ_Ser4SSP, ssp_interrupt, 0, "SSP", NULL); if (ret) goto out_region; return 0; out_region: release_mem_region(__PREG(Ser4SSCR0), 0x18); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Power-up and configure camera sensor. It's ready for capturing now. */
static int omap24xxcam_sensor_enable(struct omap24xxcam_device *cam)
/* Power-up and configure camera sensor. It's ready for capturing now. */ static int omap24xxcam_sensor_enable(struct omap24xxcam_device *cam)
{ int rval; omap24xxcam_clock_on(cam); omap24xxcam_sensor_if_enable(cam); rval = vidioc_int_s_power(cam->sdev, 1); if (rval) goto out; rval = vidioc_int_init(cam->sdev); if (rval) goto out; return 0; out: omap24xxcam_sensor_disable(cam); return rval; }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. */
void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle)
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. */ void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle)
{ assert(handle); LPSPI_DisableDMA(base, (uint32_t)kLPSPI_RxDmaEnable | (uint32_t)kLPSPI_TxDmaEnable); EDMA_AbortTransfer(handle->edmaRxRegToRxDataHandle); EDMA_AbortTransfer(handle->edmaTxDataToTxRegHandle); handle->state = (uint8_t)kLPSPI_Idle; }
eclipse-threadx/getting-started
C++
Other
310
/* Command response callback function for sd_ble_gap_sec_info_reply BLE command. Callback for decoding the command response return code. */
static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_sec_info_reply BLE command. Callback for decoding the command response return code. */ static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_gap_sec_info_reply_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* 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 Vector37_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 Vector37_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (37 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Gets the instance from the base address to be used to gate or ungate the module clock. */
static uint32_t QTMR_GetInstance(TMR_Type *base)
/* Gets the instance from the base address to be used to gate or ungate the module clock. */ static uint32_t QTMR_GetInstance(TMR_Type *base)
{ uint32_t instance; for (instance = 0; instance < ARRAY_SIZE(s_qtmrBases); instance++) { if (s_qtmrBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_qtmrBases)); return instance; }
eclipse-threadx/getting-started
C++
Other
310
/* Enables or disables the RTC clock. This function must be used only after the RTC clock was selected using the RCC_RTCCLKConfig function. */
void RCC_RTCCLKCmd(FunctionalState NewState)
/* Enables or disables the RTC clock. This function must be used only after the RTC clock was selected using the RCC_RTCCLKConfig function. */ void RCC_RTCCLKCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->BDCR |= 0x00008000; } else { RCC->BDCR &= 0xffff7fff; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* this API is used to get the fifo frame counter in the register 0x0E bit 0 to 6 */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_frame_count(u8 *v_fifo_frame_count_u8)
/* this API is used to get the fifo frame counter in the register 0x0E bit 0 to 6 */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_frame_count(u8 *v_fifo_frame_count_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_FIFO_STAT_FRAME_COUNTER__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_fifo_frame_count_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_FIFO_STAT_FRAME_COUNTER); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the EEPROM enabled WDTR for the device and the device supports wide bus (16 bit) transfers, then turn on the device's 'wdtr_able' bit and write the new value to the microcode. */
static void advansys_wide_enable_wdtr(AdvPortAddr iop_base, unsigned short tidmask)
/* If the EEPROM enabled WDTR for the device and the device supports wide bus (16 bit) transfers, then turn on the device's 'wdtr_able' bit and write the new value to the microcode. */ static void advansys_wide_enable_wdtr(AdvPortAddr iop_base, unsigned short tidmask)
{ unsigned short cfg_word; AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word); if ((cfg_word & tidmask) != 0) return; cfg_word |= tidmask; AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word); AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word); cfg_word &= ~tidmask; AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word); AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, cfg_word); cfg_word &= ~tidmask; AdvWriteWordLram(iop_base, ASC_MC_WDTR_DONE, cfg_word); }
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface); ConfigSuccess &= MS_Device_ConfigureEndpoints(&Disk_MS_Interface); USB_Device_EnableSOFEvents(); LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function is to arbitrate the real attribute of the memory when there are 2 MTRRs covers the same memory range. For further details, please refer the IA32 Software Developer's Manual, Volume 3, Section "MTRR Precedences". */
MTRR_MEMORY_CACHE_TYPE MtrrLibPrecedence(IN MTRR_MEMORY_CACHE_TYPE MtrrType1, IN MTRR_MEMORY_CACHE_TYPE MtrrType2)
/* This function is to arbitrate the real attribute of the memory when there are 2 MTRRs covers the same memory range. For further details, please refer the IA32 Software Developer's Manual, Volume 3, Section "MTRR Precedences". */ MTRR_MEMORY_CACHE_TYPE MtrrLibPrecedence(IN MTRR_MEMORY_CACHE_TYPE MtrrType1, IN MTRR_MEMORY_CACHE_TYPE MtrrType2)
{ if (MtrrType1 == MtrrType2) { return MtrrType1; } ASSERT ( MtrrLibTypeLeftPrecedeRight (MtrrType1, MtrrType2) || MtrrLibTypeLeftPrecedeRight (MtrrType2, MtrrType1) ); if (MtrrLibTypeLeftPrecedeRight (MtrrType1, MtrrType2)) { return MtrrType1; } else { return MtrrType2; } }
tianocore/edk2
C++
Other
4,240
/* g_menu_item_new_section: @label: (allow-none): the section label, or NULL */
GMenuItem* g_menu_item_new_section(const gchar *label, GMenuModel *section)
/* g_menu_item_new_section: @label: (allow-none): the section label, or NULL */ GMenuItem* g_menu_item_new_section(const gchar *label, GMenuModel *section)
{ GMenuItem *menu_item; menu_item = g_object_new (G_TYPE_MENU_ITEM, NULL); if (label != NULL) g_menu_item_set_label (menu_item, label); g_menu_item_set_section (menu_item, section); return menu_item; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If sgmii is enabled, then use the pcs register to determine link, otherwise use the generic interface for determining link. */
static s32 igb_check_for_link_82575(struct e1000_hw *)
/* If sgmii is enabled, then use the pcs register to determine link, otherwise use the generic interface for determining link. */ static s32 igb_check_for_link_82575(struct e1000_hw *)
{ s32 ret_val; u16 speed, duplex; if (hw->phy.media_type != e1000_media_type_copper) { ret_val = igb_get_pcs_speed_and_duplex_82575(hw, &speed, &duplex); hw->mac.get_link_status = !hw->mac.serdes_has_link; } else { ret_val = igb_check_for_copper_link(hw); } return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Reset the Adaptive Interframe Spacing throttle to default values. */
void igb_reset_adaptive(struct e1000_hw *hw)
/* Reset the Adaptive Interframe Spacing throttle to default values. */ void igb_reset_adaptive(struct e1000_hw *hw)
{ struct e1000_mac_info *mac = &hw->mac; if (!mac->adaptive_ifs) { hw_dbg("Not in Adaptive IFS mode!\n"); goto out; } if (!mac->ifs_params_forced) { mac->current_ifs_val = 0; mac->ifs_min_val = IFS_MIN; mac->ifs_max_val = IFS_MAX; mac->ifs_step_size = IFS_STEP; mac->ifs_ratio = IFS_RATIO; } mac->in_ifs_mode = false; wr32(E1000_AIT, 0); out: return; }
robutest/uclinux
C++
GPL-2.0
60
/* This function resets the event counters in L2 Cache controller. */
void XL2cc_EventCtrReset(void)
/* This function resets the event counters in L2 Cache controller. */ void XL2cc_EventCtrReset(void)
{ *((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNTRL_OFFSET)) = 0x6U; }
ua1arn/hftrx
C++
null
69
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration of the USB device after enumeration - the device endpoints are configured and the CDC management task started. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration of the USB device after enumeration - the device endpoints are configured and the CDC management task started. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, TMC_IO_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_IN_EPADDR, EP_TYPE_BULK, TMC_IO_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_OUT_EPADDR, EP_TYPE_BULK, TMC_IO_EPSIZE, 1); LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019