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
/* Disables the voltage regulator, which makes the device enter backup mode. */
void SUPC_DisableVoltageRegulator(void)
/* Disables the voltage regulator, which makes the device enter backup mode. */ void SUPC_DisableVoltageRegulator(void)
{ AT91C_BASE_SUPC->SUPC_CR = SUPC_KEY | AT91C_SUPC_VROFF; while (1); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Read value stored in a PHY register. Note: MDI interface is assumed to already have been enabled. */
static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int *value)
/* Read value stored in a PHY register. Note: MDI interface is assumed to already have been enabled. */ static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int *value)
{ at91_emac_write(AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_R | ((phy_addr & 0x1f) << 23) | (address << 18)); at91_phy_wait(); *value = at91_emac_read(AT91_EMAC_MAN) & AT91_EMAC_DATA; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads N bytes from Registers, starting at the specified I2C address. */
int32_t ST25DV_ReadRegister(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
/* Reads N bytes from Registers, starting at the specified I2C address. */ int32_t ST25DV_ReadRegister(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
{ return pObj->IO.Read( ST25DV_ADDR_SYST_I2C, TarAddr, pData, NbByte ); }
eclipse-threadx/getting-started
C++
Other
310
/* Returns zero if successful or a negative error code. */
int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, unsigned int caps)
/* Returns zero if successful or a negative error code. */ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, unsigned int caps)
{ struct hda_amp_info *info; info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0)); if (!info) return -EINVAL; info->amp_caps = caps; info->head.val |= INFO_AMP_CAPS; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If 8-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoReadFifo8(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ VOID EFIAPI IoReadFifo8(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
{ IoReadFifoWorker (Port, EfiPeiCpuIoWidthFifoUint8, Count, Buffer); }
tianocore/edk2
C++
Other
4,240
/* The function is used to enable DMOS function. */
void SysCtlDMOSEnable(xtBoolean bEnable)
/* The function is used to enable DMOS function. */ void SysCtlDMOSEnable(xtBoolean bEnable)
{ if(bEnable) { xHWREG(PWRCU_BAKCR) |= PWRCU_BAKCR_DMOSON; } else { xHWREG(PWRCU_BAKCR) &= ~PWRCU_BAKCR_DMOSON; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* ASCII case-insensitive (ie. A-Z) support for directories that was used in IRIX. */
STATIC xfs_dahash_t xfs_ascii_ci_hashname(struct xfs_name *name)
/* ASCII case-insensitive (ie. A-Z) support for directories that was used in IRIX. */ STATIC xfs_dahash_t xfs_ascii_ci_hashname(struct xfs_name *name)
{ xfs_dahash_t hash; int i; for (i = 0, hash = 0; i < name->len; i++) hash = tolower(name->name[i]) ^ rol32(hash, 7); return hash; }
robutest/uclinux
C++
GPL-2.0
60
/* task_rq_lock - lock the runqueue a given task resides on and disable interrupts. Note the ordering: we can safely lookup the task_rq without explicitly disabling preemption. */
static struct rq* task_rq_lock(struct task_struct *p, unsigned long *flags) __acquires(rq -> lock)
/* task_rq_lock - lock the runqueue a given task resides on and disable interrupts. Note the ordering: we can safely lookup the task_rq without explicitly disabling preemption. */ static struct rq* task_rq_lock(struct task_struct *p, unsigned long *flags) __acquires(rq -> lock)
{ struct rq *rq; for (;;) { local_irq_save(*flags); rq = task_rq(p); raw_spin_lock(&rq->lock); if (likely(rq == task_rq(p))) return rq; raw_spin_unlock_irqrestore(&rq->lock, *flags); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the element's address when read receive fifo 1. */
static uint32_t MCAN_GetRxFifo1ElementAddress(CAN_Type *base)
/* Get the element's address when read receive fifo 1. */ static uint32_t MCAN_GetRxFifo1ElementAddress(CAN_Type *base)
{ uint32_t eSize; uint32_t eAddress; eSize = (base->RXESC & CAN_RXESC_F1DS_MASK) >> CAN_RXESC_F1DS_SHIFT; if (eSize < 5U) { eSize += 4U; } else { eSize = eSize * 4U - 10U; } eAddress = base->RXF1C & CAN_RXF1C_F1SA_MASK; eAddress += ((base->RXF1S & CAN_RXF1S_F1GI_MASK) >> CAN_RXF1S_F1GI_SHIFT) * eSize * 4U; return eAddress; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf. */
static struct pbuf* low_level_input(struct netif *netif)
/* Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf. */ static struct pbuf* low_level_input(struct netif *netif)
{ struct pbuf *p = NULL; if(RxAllocStatus == RX_ALLOC_OK) { HAL_ETH_ReadData(&EthHandle, (void **)&p); } return p; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Reads the selected ADC Software start injected conversion Status. */
uint8_t ADC_ReadSoftwareStartInjectedConvStatus(ADC_T *adc)
/* Reads the selected ADC Software start injected conversion Status. */ uint8_t ADC_ReadSoftwareStartInjectedConvStatus(ADC_T *adc)
{ return (uint8_t)(adc->CTRL2_B.INJCHSC); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read a data from a slave when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Read Step2) This function is usually used in thread mode. */
unsigned long I2CMasterReadS2(unsigned long ulBase, unsigned char *pucData, xtBoolean bEndTransmition)
/* Read a data from a slave when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Read Step2) This function is usually used in thread mode. */ unsigned long I2CMasterReadS2(unsigned long ulBase, unsigned char *pucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); I2CMasterReadRequestS2(ulBase, xfalse); if(bEndTransmition) { xHWREG(ulBase + I2C_CR) &= ~I2C_CR_AA; } do { ulStatus = I2CStatusGet(ulBase); if(xHWREG(ulBase + I2C_CSR) & 0x0700) break; } while(!(ulStatus == I2C_MASTER_RX_NOT_EMPTY)); ulStatus &= (I2C_CSR_ARBLOS | I2C_CSR_RXNACK); if(!ulStatus) { *pucData = xHWREG(ulBase + I2C_DR); } if(bEndTransmition) { I2CStopSend(ulBase); } return ulStatus; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns: a unsigned 64-bit integer from the attribute. */
guint64 g_file_info_get_attribute_uint64(GFileInfo *info, const char *attribute)
/* Returns: a unsigned 64-bit integer from the attribute. */ guint64 g_file_info_get_attribute_uint64(GFileInfo *info, const char *attribute)
{ GFileAttributeValue *value; g_return_val_if_fail (G_IS_FILE_INFO (info), 0); g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0); value = g_file_info_find_value_by_name (info, attribute); return _g_file_attribute_value_get_uint64 (value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function traces the ACPI header as described by the AcpiHeaderParser. */
UINT32 EFIAPI DumpAcpiHeader(IN UINT8 *Ptr)
/* This function traces the ACPI header as described by the AcpiHeaderParser. */ UINT32 EFIAPI DumpAcpiHeader(IN UINT8 *Ptr)
{ return ParseAcpi ( TRUE, 0, "ACPI Table Header", Ptr, sizeof (EFI_ACPI_DESCRIPTION_HEADER), PARSER_PARAMS (AcpiHeaderParser) ); }
tianocore/edk2
C++
Other
4,240
/* This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. */
EFI_STATUS EFIAPI PeiServicesFfsGetVolumeInfo(IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo)
/* This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. */ EFI_STATUS EFIAPI PeiServicesFfsGetVolumeInfo(IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo)
{ ASSERT (FALSE); return EFI_OUT_OF_RESOURCES; }
tianocore/edk2
C++
Other
4,240
/* store 16 bit error injection vector which enables injecting errors to the corresponding bit within the error injection word above. When used during a DRAM ECC read, it holds the contents of the of the DRAM ECC bits. */
static ssize_t amd64_inject_ecc_vector_store(struct mem_ctl_info *mci, const char *data, size_t count)
/* store 16 bit error injection vector which enables injecting errors to the corresponding bit within the error injection word above. When used during a DRAM ECC read, it holds the contents of the of the DRAM ECC bits. */ static ssize_t amd64_inject_ecc_vector_store(struct mem_ctl_info *mci, const char *data, size_t count)
{ struct amd64_pvt *pvt = mci->pvt_info; unsigned long value; int ret = 0; ret = strict_strtoul(data, 16, &value); if (ret != -EINVAL) { if (value & 0xFFFF0000) { amd64_printk(KERN_WARNING, "%s: invalid EccVector: 0x%lx\n", __func__, value); return -EINVAL; } pvt->injection.bit_map = (u32) value; return count; } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks if a uDMA channel is enabled for operation. */
tBoolean uDMAChannelIsEnabled(unsigned long ulChannelNum)
/* Checks if a uDMA channel is enabled for operation. */ tBoolean uDMAChannelIsEnabled(unsigned long ulChannelNum)
{ ASSERT(ulChannelNum < 32); return((HWREG(UDMA_ENASET) & (1 << ulChannelNum)) ? true : false); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* param base PDM base pointer param config Voice activity detector zero cross detector configure structure pointer . */
void PDM_SetHwvadZeroCrossDetectorConfig(PDM_Type *base, const pdm_hwvad_zero_cross_detector_t *config)
/* param base PDM base pointer param config Voice activity detector zero cross detector configure structure pointer . */ void PDM_SetHwvadZeroCrossDetectorConfig(PDM_Type *base, const pdm_hwvad_zero_cross_detector_t *config)
{ assert(config != NULL); uint32_t zcd = (base->VAD0_ZCD & (~(PDM_VAD0_ZCD_VADZCDTH_MASK | PDM_VAD0_ZCD_VADZCDADJ_MASK | PDM_VAD0_ZCD_VADZCDAUTO_MASK | PDM_VAD0_ZCD_VADZCDAND_MASK))); zcd |= (PDM_VAD0_ZCD_VADZCDTH(config->threshold) | PDM_VAD0_ZCD_VADZCDADJ(config->adjustmentThreshold) | PDM_VAD0_ZCD_VADZCDAUTO(config->enableAutoThreshold) | PDM_VAD0_ZCD_VADZCDAND(config->zcdAnd)) | PDM_VAD0_ZCD_VADZCDEN_MASK; base->VAD0_ZCD = zcd; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is the same as 'ubi_get_device_info()', but it assumes the UBI device is locked and cannot disappear. */
void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di)
/* This function is the same as 'ubi_get_device_info()', but it assumes the UBI device is locked and cannot disappear. */ void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di)
{ di->ubi_num = ubi->ubi_num; di->leb_size = ubi->leb_size; di->min_io_size = ubi->min_io_size; di->ro_mode = ubi->ro_mode; di->cdev = ubi->cdev.dev; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the state of the SDA and SCL pins. */
unsigned long I2CMasterLineStateGet(unsigned long ulBase)
/* Reads the state of the SDA and SCL pins. */ unsigned long I2CMasterLineStateGet(unsigned long ulBase)
{ ASSERT(I2CMasterBaseValid(ulBase)); return(HWREG(ulBase + I2C_O_MBMON)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns a pointer to the continuation type 1 IOCB packet. */
static cont_a64_entry_t* qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha)
/* Returns a pointer to the continuation type 1 IOCB packet. */ static cont_a64_entry_t* qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha)
{ cont_a64_entry_t *cont_pkt; struct req_que *req = vha->req; req->ring_index++; if (req->ring_index == req->length) { req->ring_index = 0; req->ring_ptr = req->ring; } else { req->ring_ptr++; } cont_pkt = (cont_a64_entry_t *)req->ring_ptr; *((uint32_t *)(&cont_pkt->entry_type)) = __constant_cpu_to_le32(CONTINUE_A64_TYPE); return (cont_pkt); }
robutest/uclinux
C++
GPL-2.0
60
/* The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.DrawImage(). This protocol invokes EFI_HII_IMAGE_PROTOCOL.DrawImage() implicitly. */
EFI_STATUS EFIAPI HiiDrawImageEx(IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This, IN EFI_HII_DRAW_FLAGS Flags, IN CONST EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_OUTPUT **Blt, IN UINTN BltX, IN UINTN BltY)
/* The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.DrawImage(). This protocol invokes EFI_HII_IMAGE_PROTOCOL.DrawImage() implicitly. */ EFI_STATUS EFIAPI HiiDrawImageEx(IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This, IN EFI_HII_DRAW_FLAGS Flags, IN CONST EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_OUTPUT **Blt, IN UINTN BltX, IN UINTN BltY)
{ HII_DATABASE_PRIVATE_DATA *Private; Private = HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS (This); return HiiDrawImage (&Private->HiiImage, Flags, Image, Blt, BltX, BltY); }
tianocore/edk2
C++
Other
4,240
/* Close a ZipFile opened with unzipOpen. If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), these files MUST be closed with unzipCloseCurrentFile before call unzipClose. return UNZ_OK if there is no problem. */
int ZEXPORT unzClose(unzFile file)
/* Close a ZipFile opened with unzipOpen. If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), these files MUST be closed with unzipCloseCurrentFile before call unzipClose. return UNZ_OK if there is no problem. */ int ZEXPORT unzClose(unzFile file)
{ unz_s* s; if (file == NULL) return UNZ_PARAMERROR; s = (unz_s*)file; if (s->pfile_in_zip_read != NULL) unzCloseCurrentFile(file); ZCLOSE(s->z_filefunc, s->filestream); TRYFREE(s); return UNZ_OK; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2_8(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V2 attribute. */ static ssize_t write_value_v2_8(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ char *value = attr->user_data; if (offset >= sizeof(value_v2_8_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v2_8_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This returns an error on a short read, even if the short read hit the EOF immediately. (The assumption is that each packet has a header followed by raw packet data, and that we've already read the header, so if we get an EOF trying to read the packet data, the file has been cut short, even if the read didn't read any data at all.) */
gboolean wtap_read_packet_bytes(FILE_T fh, Buffer *buf, guint length, int *err, gchar **err_info)
/* This returns an error on a short read, even if the short read hit the EOF immediately. (The assumption is that each packet has a header followed by raw packet data, and that we've already read the header, so if we get an EOF trying to read the packet data, the file has been cut short, even if the read didn't read any data at all.) */ gboolean wtap_read_packet_bytes(FILE_T fh, Buffer *buf, guint length, int *err, gchar **err_info)
{ ws_buffer_assure_space(buf, length); return wtap_read_bytes(fh, ws_buffer_start_ptr(buf), length, err, err_info); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The function is used to Select Reset Pin Filter in Run and Wait Modes. The */
void SysCtlResetPinFilterRunModeSelect(unsigned long ulFilter)
/* The function is used to Select Reset Pin Filter in Run and Wait Modes. The */ void SysCtlResetPinFilterRunModeSelect(unsigned long ulFilter)
{ xASSERT((ulFilter == SYSCTL_RESET_PIN_FILTER_RUN_DIS) || (ulFilter == SYSCTL_RESET_PIN_FILTER_RUN_BUS) || (ulFilter == SYSCTL_RESET_PIN_FILTER_RUN_LPO)); xHWREGB(RCM_RPFC) &= ~RCM_RPFC_RSTFLTSRW_M; xHWREGB(RCM_RPFC) |= ulFilter; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* De-initialize SHA Interface. stops operation and releases the software resources used by the interface. */
int32_t csi_sha_uninitialize(sha_handle_t handle)
/* De-initialize SHA Interface. stops operation and releases the software resources used by the interface. */ int32_t csi_sha_uninitialize(sha_handle_t handle)
{ SHA_NULL_PARAM_CHK(handle); ck_sha_priv_t *sha_priv = handle; sha_priv->cb = NULL; sha_disable_interrupt(); drv_nvic_disable_irq(sha_priv->irq); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note that this means that we may have to do a hardware "local_op" to a different interrupt than we report to the rest of the world. */
static unsigned int jensen_local_startup(unsigned int irq)
/* Note that this means that we may have to do a hardware "local_op" to a different interrupt than we report to the rest of the world. */ static unsigned int jensen_local_startup(unsigned int irq)
{ if (irq == 7) i8259a_startup_irq(1); else if (irq_desc[irq].action) irq_desc[irq].action->flags |= IRQF_DISABLED; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set read polarity of IO pins in 'reg_bit' to corresponding value in 'data' 0 = read pin value, 1 = read inverted pin value */
int tca642x_set_pol(uchar chip, uint8_t gpio_bank, uint8_t reg_bit, uint8_t data)
/* Set read polarity of IO pins in 'reg_bit' to corresponding value in 'data' 0 = read pin value, 1 = read inverted pin value */ int tca642x_set_pol(uchar chip, uint8_t gpio_bank, uint8_t reg_bit, uint8_t data)
{ uint8_t pol_reg = tca642x_regs[gpio_bank].polarity_reg; return tca642x_reg_write(chip, pol_reg, reg_bit, data); }
4ms/stm32mp1-baremetal
C++
Other
137
/* nforce2_verify - verifies a new CPUFreq policy @policy: new policy */
static int nforce2_verify(struct cpufreq_policy *policy)
/* nforce2_verify - verifies a new CPUFreq policy @policy: new policy */ static int nforce2_verify(struct cpufreq_policy *policy)
{ unsigned int fsb_pol_max; fsb_pol_max = policy->max / (fid * 100); if (policy->min < (fsb_pol_max * fid * 100)) policy->max = (fsb_pol_max + 1) * fid * 100; cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Calculates the address that should be accessed to perform a PCIe configuration space access for a given device identified by the PCIe controller device @pcie and the bus, device & function numbers in @bdf. If access to the device is not valid then the function will return an error code. Otherwise the address to access will be written to the pointer pointed to by @paddress. */
static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf, uint offset, void **paddress)
/* Calculates the address that should be accessed to perform a PCIe configuration space access for a given device identified by the PCIe controller device @pcie and the bus, device & function numbers in @bdf. If access to the device is not valid then the function will return an error code. Otherwise the address to access will be written to the pointer pointed to by @paddress. */ static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf, uint offset, void **paddress)
{ struct generic_ecam_pcie *pcie = dev_get_priv(bus); void *addr; addr = pcie->cfg_base; addr += PCI_BUS(bdf) << 20; addr += PCI_DEV(bdf) << 15; addr += PCI_FUNC(bdf) << 12; addr += offset; *paddress = addr; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Initializes the tim Channel4 according to the specified parameters in the init_struct. */
void TIM_OC4Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct)
/* Initializes the tim Channel4 according to the specified parameters in the init_struct. */ void TIM_OC4Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct)
{ MODIFY_REG(tim->CCMR2, TIM_CCMR2_OC4M, (init_struct->TIM_OCMode) << 8); MODIFY_REG(tim->CCER, TIM_CCER_CC4EN | TIM_CCER_CC4P, \ (init_struct->TIM_OCPolarity << 12) | (init_struct->TIM_OutputState << 12)); WRITE_REG(tim->CCR4, init_struct->TIM_Pulse); if ((tim == TIM1) || (tim == TIM8)) MODIFY_REG(tim->CR2, TIM_CR2_OIS4, init_struct->TIM_OCIdleState << 6); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Indicates if the device is self-powered when in a given configuration. */
unsigned char USBConfigurationDescriptor_IsSelfPowered(const USBConfigurationDescriptor *configuration)
/* Indicates if the device is self-powered when in a given configuration. */ unsigned char USBConfigurationDescriptor_IsSelfPowered(const USBConfigurationDescriptor *configuration)
{ if ((configuration->bmAttributes & (1 << 6)) != 0) { return 1; } else { return 0; } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */
UINTN EFIAPI UefiDevicePathLibGetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */ UINTN EFIAPI UefiDevicePathLibGetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ CONST EFI_DEVICE_PATH_PROTOCOL *Start; if (DevicePath == NULL) { return 0; } if (!IsDevicePathValid (DevicePath, 0)) { return 0; } Start = DevicePath; while (!IsDevicePathEnd (DevicePath)) { DevicePath = NextDevicePathNode (DevicePath); } return ((UINTN)DevicePath - (UINTN)Start) + DevicePathNodeLength (DevicePath); }
tianocore/edk2
C++
Other
4,240
/* Receives a character. If a character is not available, returns -1. */
static int ug_udbg_getc_poll(void)
/* Receives a character. If a character is not available, returns -1. */ static int ug_udbg_getc_poll(void)
{ if (!ug_is_rxfifo_ready()) return -1; return ug_getc(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SYSCTRL Uart0 Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_UART0_ClkEnRstRelease(void)
/* SYSCTRL Uart0 Bus Clock Enable and Reset Release. */ void LL_SYSCTRL_UART0_ClkEnRstRelease(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_UART0BusClk_En(SYSCTRL); __LL_SYSCTRL_UART0SoftRst_Release(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize the boards on-board LEDs. The LEDs are connected to the following pin: */
static void leds_init(void)
/* Initialize the boards on-board LEDs. The LEDs are connected to the following pin: */ static void leds_init(void)
{ RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; LED_GREEN_PORT->CR[0] = (0x3 << (LED_GREEN_PIN*4)); RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; LED_ORANGE_PORT->CR[1] = (0x3 << ((LED_ORANGE_PIN-8)*4)); RCC->APB2ENR |= RCC_APB2ENR_IOPDEN; LED_RED_PORT->CR[0] = (0x3 << (LED_RED_PIN*4)); }
labapart/polymcu
C++
null
201
/* Calculates the appropriate ethernet checksum, consisting of the addition of the one's compliment of each word, complimented. */
uint16_t Ethernet_Checksum16(void *Data, uint16_t Bytes)
/* Calculates the appropriate ethernet checksum, consisting of the addition of the one's compliment of each word, complimented. */ uint16_t Ethernet_Checksum16(void *Data, uint16_t Bytes)
{ uint16_t* Words = (uint16_t*)Data; uint32_t Checksum = 0; for (uint16_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++) Checksum += Words[CurrWord]; while (Checksum & 0xFFFF0000) Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16)); return ~Checksum; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Check whether a channel can be used by an application. */
__STATIC_INLINE bool is_app_channel(nrf_ppi_channel_t channel)
/* Check whether a channel can be used by an application. */ __STATIC_INLINE bool is_app_channel(nrf_ppi_channel_t channel)
{ return are_app_channels(nrf_drv_ppi_channel_to_mask(channel)); }
labapart/polymcu
C++
null
201
/* The SMM Monarch is supposed to call this function from the root MMI handler. */
VOID SmbaseReinstallPostSmmPen(IN UINT32 PenAddress)
/* The SMM Monarch is supposed to call this function from the root MMI handler. */ VOID SmbaseReinstallPostSmmPen(IN UINT32 PenAddress)
{ CopyMem ((VOID *)(UINTN)PenAddress, mPostSmmPen, mPostSmmPenSize); }
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciExpressBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT16)-1; } return MmioBitFieldWrite16 ( (UINTN)GetPciExpressBaseAddress () + Address, StartBit, EndBit, Value ); }
tianocore/edk2
C++
Other
4,240
/* Update the SDMA address on the SDMA buffer boundary interrupt. */
EFI_STATUS SdMmcUpdateSdmaAddress(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
/* Update the SDMA address on the SDMA buffer boundary interrupt. */ EFI_STATUS SdMmcUpdateSdmaAddress(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
{ UINT64 SdmaAddr; EFI_STATUS Status; SdmaAddr = SD_MMC_SDMA_ROUND_UP ((UINTN)Trb->DataPhy, SD_MMC_SDMA_BOUNDARY); if (Private->ControllerVersion[Trb->Slot] >= SD_MMC_HC_CTRL_VER_400) { Status = SdMmcHcRwMmio ( Private->PciIo, Trb->Slot, SD_MMC_HC_ADMA_SYS_ADDR, FALSE, sizeof (UINT64), &SdmaAddr ); } else { Status = SdMmcHcRwMmio ( Private->PciIo, Trb->Slot, SD_MMC_HC_SDMA_ADDR, FALSE, sizeof (UINT32), &SdmaAddr ); } if (EFI_ERROR (Status)) { return Status; } Trb->DataPhy = (UINT64)(UINTN)SdmaAddr; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Outputs a formatted string on the DBGU stream. Format arguments are given in a va_list instance. */
signed int vprintf(const char *pFormat, va_list ap)
/* Outputs a formatted string on the DBGU stream. Format arguments are given in a va_list instance. */ signed int vprintf(const char *pFormat, va_list ap)
{ char pStr[CFG_PRINTF_MAXSTRINGSIZE]; char pError[] = "stdio.c: increase CFG_PRINTF_MAXSTRINGSIZE\r\n"; if (vsprintf(pStr, pFormat, ap) >= CFG_PRINTF_MAXSTRINGSIZE) { puts(pError); while (1); } return puts(pStr); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* 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)
{ while(1) { BSP_LED_Toggle(LED1); HAL_Delay(40); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Reset the input device and optionally run diagnostics */
EFI_STATUS EFIAPI ConSplitterTextInReset(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* Reset the input device and optionally run diagnostics */ EFI_STATUS EFIAPI ConSplitterTextInReset(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ EFI_STATUS Status; EFI_STATUS ReturnStatus; TEXT_IN_SPLITTER_PRIVATE_DATA *Private; UINTN Index; Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS (This); Private->KeyEventSignalState = FALSE; for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { Status = Private->TextInList[Index]->Reset ( Private->TextInList[Index], ExtendedVerification ); if (EFI_ERROR (Status)) { ReturnStatus = Status; } } if (!EFI_ERROR (ReturnStatus)) { ToggleStateSyncReInitialization (Private); Private->CurrentNumberOfKeys = 0; } return ReturnStatus; }
tianocore/edk2
C++
Other
4,240
/* Get timebase clock frequency (like cpu_clk in Hz) */
unsigned long get_tbclk(void)
/* Get timebase clock frequency (like cpu_clk in Hz) */ unsigned long get_tbclk(void)
{ ulong tbclk; tbclk = (gd->bus_clk + 3L) / 4L; return tbclk; }
EmcraftSystems/u-boot
C++
Other
181
/* Description: Iterate over the DOI definition list, skipping the first @skip_cnt entries. For each entry call @callback, if @callback returns a negative value stop 'walking' through the list and return. Updates the value in @skip_cnt upon return. Returns zero on success, negative values on failure. */
int cipso_v4_doi_walk(u32 *skip_cnt, int(*callback)(struct cipso_v4_doi *doi_def, void *arg), void *cb_arg)
/* Description: Iterate over the DOI definition list, skipping the first @skip_cnt entries. For each entry call @callback, if @callback returns a negative value stop 'walking' through the list and return. Updates the value in @skip_cnt upon return. Returns zero on success, negative values on failure. */ int cipso_v4_doi_walk(u32 *skip_cnt, int(*callback)(struct cipso_v4_doi *doi_def, void *arg), void *cb_arg)
{ int ret_val = -ENOENT; u32 doi_cnt = 0; struct cipso_v4_doi *iter_doi; rcu_read_lock(); list_for_each_entry_rcu(iter_doi, &cipso_v4_doi_list, list) if (atomic_read(&iter_doi->refcount) > 0) { if (doi_cnt++ < *skip_cnt) continue; ret_val = callback(iter_doi, cb_arg); if (ret_val < 0) { doi_cnt--; goto doi_walk_return; } } doi_walk_return: rcu_read_unlock(); *skip_cnt = doi_cnt; return ret_val; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Init the device table to not allow DMA access for devices and suppress all page faults */
static void init_device_table(void)
/* Init the device table to not allow DMA access for devices and suppress all page faults */ static void init_device_table(void)
{ u16 devid; for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { set_dev_entry_bit(devid, DEV_ENTRY_VALID); set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets current pin mux configuration of specified pin. */
unsigned long PinModeGet(unsigned long ulPin)
/* Gets current pin mux configuration of specified pin. */ unsigned long PinModeGet(unsigned long ulPin)
{ unsigned long ulPad; ulPad = g_ulPinToPadMap[ulPin & 0x3F]; ulPad = ((ulPad << 2) + PAD_CONFIG_BASE) ; return (HWREG(ulPad) & PAD_MODE_MASK); }
micropython/micropython
C++
Other
18,334
/* Returns a list organized in an intermediate format suited to chaining of merge() calls: null-terminated, no reserved or sentinel head node, "prev" links not maintained. */
static struct list_head* merge(void *priv, int(*cmp)(void *priv, struct list_head *a, struct list_head *b), struct list_head *a, struct list_head *b)
/* Returns a list organized in an intermediate format suited to chaining of merge() calls: null-terminated, no reserved or sentinel head node, "prev" links not maintained. */ static struct list_head* merge(void *priv, int(*cmp)(void *priv, struct list_head *a, struct list_head *b), struct list_head *a, struct list_head *b)
{ struct list_head head, *tail = &head; while (a && b) { if ((*cmp)(priv, a, b) <= 0) { tail->next = a; a = a->next; } else { tail->next = b; b = b->next; } tail = tail->next; } tail->next = a?:b; return head.next; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get op's name (4-byte name segment) or 0 if unnamed Set op's name */
void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
/* Get op's name (4-byte name segment) or 0 if unnamed Set op's name */ void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
{ if (op->common.flags & ACPI_PARSEOP_GENERIC) { return; } op->named.name = name; }
robutest/uclinux
C++
GPL-2.0
60
/* USB Device MSC SCSI Start Stop Unit Callback Parameters: None Return Value: None */
void USBD_MSC_StartStopUnit(void)
/* USB Device MSC SCSI Start Stop Unit Callback Parameters: None Return Value: None */ void USBD_MSC_StartStopUnit(void)
{ if (!USBD_MSC_CBW.CB[3]) { USBD_MSC_MediaReady = USBD_MSC_CBW.CB[4] & 0x01; usbd_msc_start_stop(USBD_MSC_MediaReady); USBD_MSC_CSW.bStatus = CSW_CMD_PASSED; USBD_MSC_SetCSW(); return; } USBD_MSC_CSW.bStatus = CSW_CMD_FAILED; USBD_MSC_SetCSW(); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Computes and returns a 32-bit CRC for a data buffer. */
EFI_STATUS EFIAPI UnitTestCalculateCrc32(IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32)
/* Computes and returns a 32-bit CRC for a data buffer. */ EFI_STATUS EFIAPI UnitTestCalculateCrc32(IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32)
{ if ((Data == NULL) || (Crc32 == NULL) || (DataSize == 0)) { return EFI_INVALID_PARAMETER; } *Crc32 = CalculateCrc32 (Data, DataSize); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* class_compat_remove_link - remove a compatibility class device link to a bus device @cls: the compatibility class @dev: the target bus device @device_link: an optional device to which a "device" link was previously created */
void class_compat_remove_link(struct class_compat *cls, struct device *dev, struct device *device_link)
/* class_compat_remove_link - remove a compatibility class device link to a bus device @cls: the compatibility class @dev: the target bus device @device_link: an optional device to which a "device" link was previously created */ void class_compat_remove_link(struct class_compat *cls, struct device *dev, struct device *device_link)
{ if (device_link) sysfs_remove_link(&dev->kobj, "device"); sysfs_remove_link(cls->kobj, dev_name(dev)); }
robutest/uclinux
C++
GPL-2.0
60
/* Gcc is smart enough to notice that "(addr >> 28) & 0xf0" is always zero on 32-bit architectures, so no need to make this conditional. */
static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr, int type)
/* Gcc is smart enough to notice that "(addr >> 28) & 0xf0" is always zero on 32-bit architectures, so no need to make this conditional. */ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr, int type)
{ addr |= (addr >> 28) & 0xf0; return addr | bridge->driver->masks[type].mask; }
robutest/uclinux
C++
GPL-2.0
60
/* An ORDERED_COLLECTION_USER_COMPARE function that compares root bridge protocol device paths based on UID. */
STATIC INTN EFIAPI RootBridgePathCompare(IN CONST VOID *UserStruct1, IN CONST VOID *UserStruct2)
/* An ORDERED_COLLECTION_USER_COMPARE function that compares root bridge protocol device paths based on UID. */ STATIC INTN EFIAPI RootBridgePathCompare(IN CONST VOID *UserStruct1, IN CONST VOID *UserStruct2)
{ CONST ACPI_HID_DEVICE_PATH *Acpi1; CONST ACPI_HID_DEVICE_PATH *Acpi2; Acpi1 = UserStruct1; Acpi2 = UserStruct2; return Acpi1->UID < Acpi2->UID ? -1 : Acpi1->UID > Acpi2->UID ? 1 : 0; }
tianocore/edk2
C++
Other
4,240
/* Returns the transmit or the receive CRC register value for the specified SPI. */
uint16_t SPI_GetCRC(SPI_TypeDef *SPIx, uint8_t SPI_CRC)
/* Returns the transmit or the receive CRC register value for the specified SPI. */ uint16_t SPI_GetCRC(SPI_TypeDef *SPIx, uint8_t SPI_CRC)
{ uint16_t crcreg = 0; assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_CRC(SPI_CRC)); if (SPI_CRC != SPI_CRC_Rx) { crcreg = SPIx->TXCRCR; } else { crcreg = SPIx->RXCRCR; } return crcreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocates a STRING_LIST structure that can store StringCount strings. */
STRING_LIST* AllocateStringListStruct(IN UINTN StringCount)
/* Allocates a STRING_LIST structure that can store StringCount strings. */ STRING_LIST* AllocateStringListStruct(IN UINTN StringCount)
{ return malloc (OFFSET_OF(STRING_LIST, Strings[StringCount + 1])); }
tianocore/edk2
C++
Other
4,240
/* Used to register your mechanism to load and store non-volative data. This should typical be called during the enable function for your feature. */
inv_error_t inv_register_load_store(inv_error_t(*load_func)(const unsigned char *data), inv_error_t(*save_func)(unsigned char *data), size_t size, unsigned int key)
/* Used to register your mechanism to load and store non-volative data. This should typical be called during the enable function for your feature. */ inv_error_t inv_register_load_store(inv_error_t(*load_func)(const unsigned char *data), inv_error_t(*save_func)(unsigned char *data), size_t size, unsigned int key)
{ int kk; for (kk=0; kk<ds.num; ++kk) { if (key == ds.hd[kk].key) { return INV_ERROR_INVALID_PARAMETER; } } if (ds.num >= NUM_STORAGE_BOXES) { return INV_ERROR_INVALID_PARAMETER; } ds.hd[ds.num].key = key; ds.hd[ds.num].size = size; ds.load[ds.num] = load_func; ds.save[ds.num] = save_func; ds.total_size += size + sizeof(struct data_header_t); ds.num++; return INV_SUCCESS; }
Luos-io/luos_engine
C++
MIT License
496
/* Fill each CMP_CountTypeDef member with its default value. */
void CMP_CountStructInit(CMP_CountTypeDef *InitStruct)
/* Fill each CMP_CountTypeDef member with its default value. */ void CMP_CountStructInit(CMP_CountTypeDef *InitStruct)
{ InitStruct->ModeSel = CMP_MODE_OFF; InitStruct->CheckPeriod = CMP_PERIOD_30US; InitStruct->CheckNum = CMP_CHKNUM_1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @dev: the OSD device whose control register to set @value: the 16-bit value to write to the control register Return: 0 */
static int set_control(struct udevice *dev, u16 value)
/* @dev: the OSD device whose control register to set @value: the 16-bit value to write to the control register Return: 0 */ static int set_control(struct udevice *dev, u16 value)
{ struct ihs_video_out_priv *priv = dev_get_priv(dev); if (priv->sync_src) value |= ((priv->sync_src & 0x7) << 8); ihs_video_out_set(priv->map, control, value); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Software MMI handler that is called when a ExitBoot Service event is signaled. */
EFI_STATUS EFIAPI MmReadyToBootHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
/* Software MMI handler that is called when a ExitBoot Service event is signaled. */ EFI_STATUS EFIAPI MmReadyToBootHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
{ EFI_HANDLE MmHandle; EFI_STATUS Status; STATIC BOOLEAN mInReadyToBoot = FALSE; Status = EFI_SUCCESS; if (!mInReadyToBoot) { MmHandle = NULL; Status = MmInstallProtocolInterface ( &MmHandle, &gEfiEventReadyToBootGuid, EFI_NATIVE_INTERFACE, NULL ); } mInReadyToBoot = TRUE; return Status; }
tianocore/edk2
C++
Other
4,240
/* Decimation of read operation on Slave 3 starting from the sensor hub trigger.. */
int32_t lsm6dsl_sh_slave_3_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave3_rate_t val)
/* Decimation of read operation on Slave 3 starting from the sensor hub trigger.. */ int32_t lsm6dsl_sh_slave_3_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave3_rate_t val)
{ lsm6dsl_slave3_config_t slave3_config; int32_t ret; ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A); if(ret == 0){ ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE3_CONFIG, (uint8_t*)&slave3_config, 1); slave3_config.slave3_rate = (uint8_t)val; if(ret == 0){ ret = lsm6dsl_write_reg(ctx, LSM6DSL_SLAVE3_CONFIG, (uint8_t*)&slave3_config, 1); if(ret == 0){ ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK); } } } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Enable or disable the power down mode during RUN mode. */
__RAM_FUNC FLASH_RUNPowerDownCmd(FunctionalState NewState)
/* Enable or disable the power down mode during RUN mode. */ __RAM_FUNC FLASH_RUNPowerDownCmd(FunctionalState NewState)
{ FLASH_Status status = FLASH_COMPLETE; if (NewState != DISABLE) { FLASH->PDKEYR = FLASH_PDKEY1; FLASH->PDKEYR = FLASH_PDKEY2; FLASH->ACR |= (uint32_t)FLASH_ACR_RUN_PD; if((FLASH->ACR & FLASH_ACR_RUN_PD) != FLASH_ACR_RUN_PD) { status = FLASH_ERROR_PROGRAM; } } else { FLASH->ACR &= (uint32_t)(~(uint32_t)FLASH_ACR_RUN_PD); } return status; }
avem-labs/Avem
C++
MIT License
1,752
/* Retrieve the Key Usage from one X.509 certificate. */
BOOLEAN EFIAPI X509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
/* Retrieve the Key Usage from one X.509 certificate. */ BOOLEAN EFIAPI X509GetKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINTN *Usage)
{ CALL_CRYPTO_SERVICE (X509GetKeyUsage, (Cert, CertSize, Usage), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Writes a number of bytes to memory provided the data does not exceed page boundaries. At the start of the buffer is placed the address at which the write will take place. The write size cannot exceed remaining page size. Maximum page size is 32 bytes. If the size of the write would exceed the remaining size of the page, the function exits with negative error code. */
int32_t memory_write_within_page(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size)
/* Writes a number of bytes to memory provided the data does not exceed page boundaries. At the start of the buffer is placed the address at which the write will take place. The write size cannot exceed remaining page size. Maximum page size is 32 bytes. If the size of the write would exceed the remaining size of the page, the function exits with negative error code. */ int32_t memory_write_within_page(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size)
{ int32_t ret; uint8_t *transmit_array; uint32_t page_remainder; uint8_t i; page_remainder = address % WRITE_SIZE_LIMIT; page_remainder = WRITE_SIZE_LIMIT - page_remainder; if(page_remainder < size) return WRITE_SIZE_ERROR; transmit_array = calloc(size + 2, sizeof *transmit_array); if (!transmit_array) return -1; transmit_array[0] = (address & 0xff00) >> 8; transmit_array[1] = (address & 0x00ff) >> 0; for(i = 0; i < size; i++) transmit_array[i + 2] = data[i]; ret = i2c_write(dev->i2c_dev, transmit_array, size + 2, true); free(transmit_array); mdelay(5); return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Unmaps the DMAs of a command and moves the command to the completed ORB list. Must be called with lu->cmd_orb_lock held. */
static void sbp2util_mark_command_completed(struct sbp2_lu *lu, struct sbp2_command_info *cmd)
/* Unmaps the DMAs of a command and moves the command to the completed ORB list. Must be called with lu->cmd_orb_lock held. */ static void sbp2util_mark_command_completed(struct sbp2_lu *lu, struct sbp2_command_info *cmd)
{ if (scsi_sg_count(cmd->Current_SCpnt)) dma_unmap_sg(lu->ud->ne->host->device.parent, scsi_sglist(cmd->Current_SCpnt), scsi_sg_count(cmd->Current_SCpnt), cmd->Current_SCpnt->sc_data_direction); list_move_tail(&cmd->list, &lu->cmd_orb_completed); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns zero on success, CMD_RET_USAGE in case of misuse and negative on error. */
static int do_i2c_mm(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* Returns zero on success, CMD_RET_USAGE in case of misuse and negative on error. */ static int do_i2c_mm(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{ return mod_i2c_mem (cmdtp, 1, flag, argc, argv); }
4ms/stm32mp1-baremetal
C++
Other
137
/* When this routine is called from the timer then we flush the temporary write buffer. */
static void sclp_tty_timeout(unsigned long data)
/* When this routine is called from the timer then we flush the temporary write buffer. */ static void sclp_tty_timeout(unsigned long data)
{ unsigned long flags; struct sclp_buffer *buf; spin_lock_irqsave(&sclp_tty_lock, flags); buf = sclp_ttybuf; sclp_ttybuf = NULL; spin_unlock_irqrestore(&sclp_tty_lock, flags); if (buf != NULL) { __sclp_ttybuf_emit(buf); } }
robutest/uclinux
C++
GPL-2.0
60
/* The HibernateCalendar functions can only be called when either */
void HibernateCounterMode(uint32_t ui32Config)
/* The HibernateCalendar functions can only be called when either */ void HibernateCounterMode(uint32_t ui32Config)
{ HWREG(HIB_CALCTL) = ui32Config; _HibernateWriteComplete(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 on success, errno on failure (as defined in errno.h) */
int et131x_close(struct net_device *netdev)
/* Returns 0 on success, errno on failure (as defined in errno.h) */ int et131x_close(struct net_device *netdev)
{ struct et131x_adapter *adapter = netdev_priv(netdev); netif_stop_queue(netdev); et131x_rx_dma_disable(adapter); et131x_tx_dma_disable(adapter); et131x_disable_interrupts(adapter); adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE; free_irq(netdev->irq, netdev); del_timer_sync(&adapter->ErrorTimer); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Find the reserved window which includes the goal, or the previous one if the goal is not in any window. Returns NULL if there are no windows or if all windows start after the goal. */
static struct ext3_reserve_window_node* search_reserve_window(struct rb_root *root, ext3_fsblk_t goal)
/* Find the reserved window which includes the goal, or the previous one if the goal is not in any window. Returns NULL if there are no windows or if all windows start after the goal. */ static struct ext3_reserve_window_node* search_reserve_window(struct rb_root *root, ext3_fsblk_t goal)
{ struct rb_node *n = root->rb_node; struct ext3_reserve_window_node *rsv; if (!n) return NULL; do { rsv = rb_entry(n, struct ext3_reserve_window_node, rsv_node); if (goal < rsv->rsv_start) n = n->rb_left; else if (goal > rsv->rsv_end) n = n->rb_right; else return rsv; } while (n); if (rsv->rsv_start > goal) { n = rb_prev(&rsv->rsv_node); rsv = rb_entry(n, struct ext3_reserve_window_node, rsv_node); } return rsv; }
robutest/uclinux
C++
GPL-2.0
60
/* Dequeues and wakes up all threads from the queue. */
void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg)
/* Dequeues and wakes up all threads from the queue. */ void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg)
{ osalDbgCheck(tqp != NULL); while (!ThreadsQueueIsEmpty(tqp)) { osalThreadDequeueNextI(tqp, msg); } }
nanoframework/nf-interpreter
C++
MIT License
293
/* resize buffer read bytes and encode to sequencer event if finished return the size of encoded bytes */
long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count, struct snd_seq_event *ev)
/* resize buffer read bytes and encode to sequencer event if finished return the size of encoded bytes */ long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count, struct snd_seq_event *ev)
{ long result = 0; int rc; ev->type = SNDRV_SEQ_EVENT_NONE; while (count-- > 0) { rc = snd_midi_event_encode_byte(dev, *buf++, ev); result++; if (rc < 0) return rc; else if (rc > 0) return result; } return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Find out SRC PDO pointed out by a position provided in a Request DO (from Sink). */
USBPD_StatusTypeDef USBPD_PWR_IF_SearchRequestedPDO(uint8_t PortNum, uint32_t RdoPosition, uint32_t *Pdo)
/* Find out SRC PDO pointed out by a position provided in a Request DO (from Sink). */ USBPD_StatusTypeDef USBPD_PWR_IF_SearchRequestedPDO(uint8_t PortNum, uint32_t RdoPosition, uint32_t *Pdo)
{ if((RdoPosition == 0) || (RdoPosition > PWR_Port_PDO_Storage[PortNum].SourcePDO.NumberOfPDO)) { return USBPD_FAIL; } *Pdo = PWR_Port_PDO_Storage[PortNum].SourcePDO.ListOfPDO[RdoPosition - 1]; return USBPD_OK; }
st-one/X-CUBE-USB-PD
C++
null
110
/* This routine calculates the working hash array referred by @HashWorking from the challenge random numbers associated with the host, referred by @RandomChallenge. The result is put into the entry of the working hash array and returned by reference through @HashWorking. */
static void lpfc_challenge_key(uint32_t *RandomChallenge, uint32_t *HashWorking)
/* This routine calculates the working hash array referred by @HashWorking from the challenge random numbers associated with the host, referred by @RandomChallenge. The result is put into the entry of the working hash array and returned by reference through @HashWorking. */ static void lpfc_challenge_key(uint32_t *RandomChallenge, uint32_t *HashWorking)
{ *HashWorking = (*RandomChallenge ^ *HashWorking); }
robutest/uclinux
C++
GPL-2.0
60
/* Set up a callback function to be invoked when an assert occurs. If a callback is already installed, then it will be replaced. */
void Xil_AssertSetCallback(Xil_AssertCallback Routine)
/* Set up a callback function to be invoked when an assert occurs. If a callback is already installed, then it will be replaced. */ void Xil_AssertSetCallback(Xil_AssertCallback Routine)
{ Xil_AssertCallbackRoutine = Routine; }
ua1arn/hftrx
C++
null
69
/* If Char is printable then return it, otherwise return a question mark. */
CHAR16 MakePrintable(IN CONST CHAR16 Char)
/* If Char is printable then return it, otherwise return a question mark. */ CHAR16 MakePrintable(IN CONST CHAR16 Char)
{ if (((Char < 0x20) && (Char > 0)) || (Char > 126)) { return (L'?'); } return (Char); }
tianocore/edk2
C++
Other
4,240
/* Configures EXTI Line0 (connected to PA0 pin) in interrupt mode. */
static void EXTILine0_Config(void)
/* Configures EXTI Line0 (connected to PA0 pin) in interrupt mode. */ static void EXTILine0_Config(void)
{ GPIO_InitTypeDef GPIO_InitStructure; __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pin = GPIO_PIN_0; HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); HAL_NVIC_SetPriority(EXTI0_IRQn, 2, 0); HAL_NVIC_EnableIRQ(EXTI0_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_event_code(char *buf, guint32 value)
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ static void format_event_code(char *buf, guint32 value)
{ g_snprintf(buf, ITEM_LABEL_LENGTH, "%s (%c)", val_to_str_const(value, ouch_event_code_val, "Unknown"), value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The task that controls access to the LCD. */
static void vPrintTask(void *pvParameter)
/* The task that controls access to the LCD. */ static void vPrintTask(void *pvParameter)
{ portCHAR *pcMessage; unsigned portBASE_TYPE uxLine = 0, uxRow = 0; for( ;; ) { xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); uxRow++; uxLine++; OSRAMClear(); OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* return indication of whether the hardware transmit buffer is empty */
static unsigned int mn10300_serial_tx_empty(struct uart_port *)
/* return indication of whether the hardware transmit buffer is empty */ static unsigned int mn10300_serial_tx_empty(struct uart_port *)
{ struct mn10300_serial_port *port = container_of(_port, struct mn10300_serial_port, uart); _enter("%s", port->name); return (*port->_status & (SC01STR_TXF | SC01STR_TBF)) ? 0 : TIOCSER_TEMT; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
{ EFI_STATUS Status; ASSERT (Pages != 0); Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
void zfScanMgrInit(zdev_t *dev)
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ void zfScanMgrInit(zdev_t *dev)
{ zmw_get_wlan_dev(dev); wd->sta.scanMgr.scanReqs[0] = 0; wd->sta.scanMgr.scanReqs[1] = 0; wd->sta.scanMgr.currScanType = ZM_SCAN_MGR_SCAN_NONE; wd->sta.scanMgr.scanStartDelay = 3; }
robutest/uclinux
C++
GPL-2.0
60
/* param base RDC peripheral base address. param config Pointer to the policy configuration. */
void RDC_SetPeriphAccessConfig(RDC_Type *base, const rdc_periph_access_config_t *config)
/* param base RDC peripheral base address. param config Pointer to the policy configuration. */ void RDC_SetPeriphAccessConfig(RDC_Type *base, const rdc_periph_access_config_t *config)
{ assert((uint32_t)config->periph < RDC_PDAP_COUNT); uint32_t periph = (uint32_t)config->periph; uint32_t regPDAP = config->policy; if (config->lock) { regPDAP |= RDC_PDAP_LCK_MASK; } if (config->enableSema) { regPDAP |= RDC_PDAP_SREQ_MASK; } base->PDAP[periph] = regPDAP; __DSB(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size. */
void g_file_info_set_size(GFileInfo *info, goffset size)
/* Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size. */ void g_file_info_set_size(GFileInfo *info, goffset size)
{ static guint32 attr = 0; GFileAttributeValue *value; g_return_if_fail (G_IS_FILE_INFO (info)); if (attr == 0) attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_SIZE); value = g_file_info_create_value (info, attr); if (value) _g_file_attribute_value_set_uint64 (value, size); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Wait for insert group conversion to be completed. */
ald_status_t ald_adc_insert_poll_for_conversion(ald_adc_handle_t *hperh, uint32_t timeout)
/* Wait for insert group conversion to be completed. */ ald_status_t ald_adc_insert_poll_for_conversion(ald_adc_handle_t *hperh, uint32_t timeout)
{ uint32_t _tick; assert_param(IS_ADC_TYPE(hperh->perh)); _tick = ald_get_tick(); while (!(READ_BIT(hperh->perh->STAT, ADC_STAT_ICHE_MSK))) { if (timeout != ALD_MAX_DELAY) { if ((timeout == 0) || ((ald_get_tick() - _tick) > timeout)) { hperh->state |= ALD_ADC_STATE_TIMEOUT; return ALD_TIMEOUT; } } } WRITE_REG(hperh->perh->CLR, ALD_ADC_FLAG_ICHS | ALD_ADC_FLAG_ICH); return ALD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets a data element from the SSI receive FIFO. */
void SSIDataGet(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SSI receive FIFO. */ void SSIDataGet(unsigned long ulBase, unsigned long *pulData)
{ ASSERT((ulBase == SSI0_BASE) || (ulBase == SSI1_BASE)); while(!(HWREG(ulBase + SSI_O_SR) & SSI_SR_RNE)) { } *pulData = HWREG(ulBase + SSI_O_DR); }
watterott/WebRadio
C++
null
71
/* It is up to the caller to serialize access to the runlist @base. */
static void ntfs_rl_mm(runlist_element *base, int dst, int src, int size)
/* It is up to the caller to serialize access to the runlist @base. */ static void ntfs_rl_mm(runlist_element *base, int dst, int src, int size)
{ if (likely((dst != src) && (size > 0))) memmove(base + dst, base + src, size * sizeof(*base)); }
robutest/uclinux
C++
GPL-2.0
60
/* Check Board Identity: right now, assume borad type. (there is just one...after all) */
int checkboard(void)
/* Check Board Identity: right now, assume borad type. (there is just one...after all) */ int checkboard(void)
{ char *s = getenv("serial#"); printf("Board: %s", CONFIG_SYS_BOARD_NAME); if (s != NULL) { puts(", serial# "); puts(s); } putc('\n'); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* Last sock_put should drop referrence to sk->sk_net. It has already been dropped in sk_change_net. Taking referrence to stopping namespace is not an option. Take referrence to a socket to remove it from hash */
void sk_release_kernel(struct sock *sk)
/* Last sock_put should drop referrence to sk->sk_net. It has already been dropped in sk_change_net. Taking referrence to stopping namespace is not an option. Take referrence to a socket to remove it from hash */ void sk_release_kernel(struct sock *sk)
{ if (sk == NULL || sk->sk_socket == NULL) return; sock_hold(sk); sock_release(sk->sk_socket); release_net(sock_net(sk)); sock_net_set(sk, get_net(&init_net)); sock_put(sk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Hard Reset: end of procedure. It notifies to the STUSB16xx device that PRS transaction is ending */
USBPD_StatusTypeDef USBPD_HW_IF_HR_End(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole)
/* Hard Reset: end of procedure. It notifies to the STUSB16xx device that PRS transaction is ending */ USBPD_StatusTypeDef USBPD_HW_IF_HR_End(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole)
{ USBPD_StatusTypeDef ret = USBPD_OK; ret = HW_IF_COMM_WAIT(PortNum, COMM_TO_DEFAULT); if (ret != USBPD_OK) { return ret; } ret = (USBPD_StatusTypeDef)STUSB1602_Type_C_Command(STUSB1602_I2C_Add(PortNum), PD_HARD_RESET_COMPLETE_REQ); ret = (USBPD_StatusTypeDef)STUSB1602_VBUS_Select_Status_Set(STUSB1602_I2C_Add(PortNum), 5000); STUSB1602_CC_Detect_Alrt_Int_Mask_Set(STUSB1602_I2C_Add(PortNum), CC_Detect_Int_UNMASKED); HW_IF_COMM_RELEASE(PortNum); return ret; }
st-one/X-CUBE-USB-PD
C++
null
110
/* Deinitializes the RI registers to their default reset values. */
void SYSCFG_RIDeInit(void)
/* Deinitializes the RI registers to their default reset values. */ void SYSCFG_RIDeInit(void)
{ RI->ICR1 = RI_ICR1_RESET_VALUE; RI->ICR2 = RI_ICR2_RESET_VALUE; RI->IOSR1 = RI_IOSR1_RESET_VALUE; RI->IOSR2 = RI_IOSR2_RESET_VALUE; RI->IOSR3 = RI_IOSR3_RESET_VALUE; RI->ASCR1 = RI_ASCR1_RESET_VALUE; RI->ASCR2 = RI_ASCR2_RESET_VALUE; RI->RCR = RI_RCR_RESET_VALUE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the RtkBuffer which is the head of a RtkQueue */
RTK_BUFFER* RtbTopQueue(IN RTB_QUEUE_HEAD *RtkQueueHead)
/* Get the RtkBuffer which is the head of a RtkQueue */ RTK_BUFFER* RtbTopQueue(IN RTB_QUEUE_HEAD *RtkQueueHead)
{ RTK_BUFFER* Rtb = NULL; aos_mutex_lock(&RtkQueueHead->Lock, AOS_WAIT_FOREVER); if (RtbQueueIsEmpty(RtkQueueHead)) { aos_mutex_unlock(&RtkQueueHead->Lock); return NULL; } Rtb = (RTK_BUFFER*)RtkQueueHead->List.Next; aos_mutex_unlock(&RtkQueueHead->Lock); return Rtb; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Get the next prio_tree_node that overlaps with the input interval in iter */
struct prio_tree_node* prio_tree_next(struct prio_tree_iter *iter)
/* Get the next prio_tree_node that overlaps with the input interval in iter */ struct prio_tree_node* prio_tree_next(struct prio_tree_iter *iter)
{ unsigned long r_index, h_index; if (iter->cur == NULL) return prio_tree_first(iter); repeat: while (prio_tree_left(iter, &r_index, &h_index)) if (overlap(iter, r_index, h_index)) return iter->cur; while (!prio_tree_right(iter, &r_index, &h_index)) { while (!prio_tree_root(iter->cur) && iter->cur->parent->right == iter->cur) prio_tree_parent(iter); if (prio_tree_root(iter->cur)) return NULL; prio_tree_parent(iter); } if (overlap(iter, r_index, h_index)) return iter->cur; goto repeat; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the selected DAC channel wave generation. */
void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
/* Enables or disables the selected DAC channel wave generation. */ void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
{ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_DAC_WAVE(DAC_Wave)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DAC->CR |= DAC_Wave << DAC_Channel; } else { DAC->CR &= ~(DAC_Wave << DAC_Channel); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return @modes's hsync rate in kHz, rounded to the nearest int. */
int drm_mode_hsync(struct drm_display_mode *mode)
/* Return @modes's hsync rate in kHz, rounded to the nearest int. */ int drm_mode_hsync(struct drm_display_mode *mode)
{ unsigned int calc_val; if (mode->hsync) return mode->hsync; if (mode->htotal < 0) return 0; calc_val = (mode->clock * 1000) / mode->htotal; calc_val += 500; calc_val /= 1000; return calc_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Destroys all keys and values in the #GHashTable and decrements its reference count by 1. If keys and/or values are dynamically allocated, you should either free them first or create the #GHashTable with destroy notifiers using g_hash_table_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values during the destruction phase. */
void g_hash_table_destroy(GHashTable *hash_table)
/* Destroys all keys and values in the #GHashTable and decrements its reference count by 1. If keys and/or values are dynamically allocated, you should either free them first or create the #GHashTable with destroy notifiers using g_hash_table_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values during the destruction phase. */ void g_hash_table_destroy(GHashTable *hash_table)
{ g_return_if_fail (hash_table != NULL); g_hash_table_remove_all (hash_table); g_hash_table_unref (hash_table); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configures the FIFO reception threshold for the selected SPI. */
void SPI_RxFIFOThresholdConfig(SPI_TypeDef *SPIx, uint16_t SPI_RxFIFOThreshold)
/* Configures the FIFO reception threshold for the selected SPI. */ void SPI_RxFIFOThresholdConfig(SPI_TypeDef *SPIx, uint16_t SPI_RxFIFOThreshold)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_RX_FIFO_THRESHOLD(SPI_RxFIFOThreshold)); SPIx->CR2 &= (uint16_t)~((uint16_t)SPI_CR2_FRXTH); SPIx->CR2 |= SPI_RxFIFOThreshold; }
ajhc/demo-cortex-m3
C++
null
38
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_slave_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */
void LPSPI_SlaveTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_slave_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */ void LPSPI_SlaveTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
{ assert(handle); assert(edmaRxRegToRxDataHandle); assert(edmaTxDataToTxRegHandle); memset(handle, 0, sizeof(*handle)); uint32_t instance = LPSPI_GetInstance(base); s_lpspiSlaveEdmaPrivateHandle[instance].base = base; s_lpspiSlaveEdmaPrivateHandle[instance].handle = handle; handle->callback = callback; handle->userData = userData; handle->edmaRxRegToRxDataHandle = edmaRxRegToRxDataHandle; handle->edmaTxDataToTxRegHandle = edmaTxDataToTxRegHandle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535