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
/* Returns 0 in case of success, the set of unknown or unimplemented options in case of error. */
int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
/* Returns 0 in case of success, the set of unknown or unimplemented options in case of error. */ int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
{ return(xmlCtxtUseOptionsInternal(ctxt, options, NULL)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* GMAC tries retransmission (Only in Half Duplex mode). If collision occurs on the GMII/MII, GMAC attempt retries based on the back off limit configured. */
void synopGMAC_retry_enable(synopGMACdevice *gmacdev)
/* GMAC tries retransmission (Only in Half Duplex mode). If collision occurs on the GMII/MII, GMAC attempt retries based on the back off limit configured. */ void synopGMAC_retry_enable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev -> MacBase, GmacConfig, GmacRetry); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Arg: video : video bus device pointer bios_flag : 0. The system BIOS should NOT automatically switch(toggle) the active display output. */
static int acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
/* Arg: video : video bus device pointer bios_flag : 0. The system BIOS should NOT automatically switch(toggle) the active display output. */ static int acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
{ acpi_integer status = 0; union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { status = -1; goto Failed; } arg0.integer.value = (lcd_flag << 2) | bios_flag; video->dos_setting = arg0.integer.value; acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL); Failed: return status; }
robutest/uclinux
C++
GPL-2.0
60
/* It sets the VBus monitoring reference voltage as well as the upper and lower tolerance threshold. */
USBPD_StatusTypeDef STUSB16xx_HW_IF_Set_VBus_Monitoring(uint8_t PortNum, uint16_t VBus, uint8_t Hset, uint8_t Lset)
/* It sets the VBus monitoring reference voltage as well as the upper and lower tolerance threshold. */ USBPD_StatusTypeDef STUSB16xx_HW_IF_Set_VBus_Monitoring(uint8_t PortNum, uint16_t VBus, uint8_t Hset, uint8_t Lset)
{ USBPD_StatusTypeDef ret = USBPD_ERROR; if (Hset > 15) Hset = 15; if (Lset > 15) Lset = 15; ret = (USBPD_StatusTypeDef)STUSB1602_VBUS_Select_Status_Set(STUSB1602_I2C_Add(PortNum), VBus); ret = (USBPD_StatusTypeDef)STUSB1602_VBUS_VShift_High_Set(STUSB1602_I2C_Add(PortNum), Hset); ret = (USBPD_StatusTypeDef)STUSB1602_VBUS_VShift_Low_Set(STUSB1602_I2C_Add(PortNum), Lset); return ret; }
st-one/X-CUBE-USB-PD
C++
null
110
/* ALSA callback function, called when attempting to open the MIDI device. */
static int snd_msnd_mpu401_open(struct snd_mpu401 *mpu)
/* ALSA callback function, called when attempting to open the MIDI device. */ static int snd_msnd_mpu401_open(struct snd_mpu401 *mpu)
{ snd_msnd_enable_irq(mpu->private_data); snd_msnd_send_dsp_cmd(mpu->private_data, HDEX_MIDI_IN_START); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* pl08x_terminate_phy_chan() stops the channel, clears the FIFO and clears any pending interrupt status. This should not be used for an on-going transfer, but as a method of shutting down a channel (eg, when it's no longer used) or terminating a transfer. */
static void pl08x_terminate_phy_chan(struct pl08x_driver_data *pl08x, struct pl08x_phy_chan *ch)
/* pl08x_terminate_phy_chan() stops the channel, clears the FIFO and clears any pending interrupt status. This should not be used for an on-going transfer, but as a method of shutting down a channel (eg, when it's no longer used) or terminating a transfer. */ static void pl08x_terminate_phy_chan(struct pl08x_driver_data *pl08x, struct pl08x_phy_chan *ch)
{ u32 val = readl(ch->base + PL080_CH_CONFIG); val &= ~(PL080_CONFIG_ENABLE | PL080_CONFIG_ERR_IRQ_MASK | PL080_CONFIG_TC_IRQ_MASK); writel(val, ch->base + PL080_CH_CONFIG); writel(1 << ch->id, pl08x->base + PL080_ERR_CLEAR); writel(1 << ch->id, pl08x->base + PL080_TC_CLEAR); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets a whole set of temperature data including data, accuracy and timestamp. */
void inv_get_temp_set(long *data, int *accuracy, inv_time_t *timestamp)
/* Gets a whole set of temperature data including data, accuracy and timestamp. */ void inv_get_temp_set(long *data, int *accuracy, inv_time_t *timestamp)
{ data[0] = sensors.temp.calibrated[0]; if (timestamp) *timestamp = sensors.temp.timestamp; if (accuracy) *accuracy = sensors.temp.accuracy; }
Luos-io/luos_engine
C++
MIT License
496
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_get_connection_unix_user_finish(_GFreedesktopDBus *proxy, guint *out_uid, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_get_connection_unix_user_finish(_GFreedesktopDBus *proxy, guint *out_uid, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(u)", out_uid); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The gyro data magnitude squared : (1 degree per second)^2 = 2^6 = 2^GYRO_MAG_SQR_SHIFT. */
unsigned long inv_get_gyro_sum_of_sqr(const long *gyro)
/* The gyro data magnitude squared : (1 degree per second)^2 = 2^6 = 2^GYRO_MAG_SQR_SHIFT. */ unsigned long inv_get_gyro_sum_of_sqr(const long *gyro)
{ unsigned long gmag = 0; long temp; int kk; for (kk = 0; kk < 3; ++kk) { temp = gyro[kk] >> (16 - (GYRO_MAG_SQR_SHIFT / 2)); gmag += temp * temp; } return gmag; }
Luos-io/luos_engine
C++
MIT License
496
/* Initialize SHA Interface. 1. Initializes the resources needed for the SHA interface 2.registers event callback function. */
sha_handle_t csi_sha_initialize(int32_t idx, sha_event_cb_t cb_event)
/* Initialize SHA Interface. 1. Initializes the resources needed for the SHA interface 2.registers event callback function. */ sha_handle_t csi_sha_initialize(int32_t idx, sha_event_cb_t cb_event)
{ if (idx < 0 || idx >= CONFIG_SHA_NUM) { return NULL; } uint32_t base = 0u; uint32_t irq; int32_t real_idx = target_get_sha(idx, &base, &irq); if (real_idx != idx) { return NULL; } ck_sha_priv_t *sha_priv = &sha_handle[idx]; sha_priv->base = base; sha_priv->irq = irq; sha_priv->cb = cb_event; sha_priv->status.busy = 0; drv_nvic_enable_irq(sha_priv->irq); return (sha_handle_t)sha_priv; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */
void PWMA_CAP_IRQHandler(void)
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */ void PWMA_CAP_IRQHandler(void)
{ PWM_Type *pwmBase = g_pwmBase[0]; PWM_HAL_ClearCapFlagCF(pwmBase, 0U, kCfa1); PWM_HAL_ClearCapFlagCF(pwmBase, 1U, kCfa1); PWM_HAL_ClearCapFlagCF(pwmBase, 2U, kCfa1); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Show and set the arp timer interval. There are two tricky bits here. First, if ARP monitoring is activated, then we must disable MII monitoring. Second, if the ARP timer isn't running, we must start it. */
static ssize_t bonding_show_arp_interval(struct device *d, struct device_attribute *attr, char *buf)
/* Show and set the arp timer interval. There are two tricky bits here. First, if ARP monitoring is activated, then we must disable MII monitoring. Second, if the ARP timer isn't running, we must start it. */ static ssize_t bonding_show_arp_interval(struct device *d, struct device_attribute *attr, char *buf)
{ struct bonding *bond = to_bond(d); return sprintf(buf, "%d\n", bond->params.arp_interval); }
robutest/uclinux
C++
GPL-2.0
60
/* Scans a directory for a given file (name points to its formatted name). Returns an error code or zero. */
int fat_scan(struct inode *dir, const unsigned char *name, struct fat_slot_info *sinfo)
/* Scans a directory for a given file (name points to its formatted name). Returns an error code or zero. */ int fat_scan(struct inode *dir, const unsigned char *name, struct fat_slot_info *sinfo)
{ struct super_block *sb = dir->i_sb; sinfo->slot_off = 0; sinfo->bh = NULL; while (fat_get_short_entry(dir, &sinfo->slot_off, &sinfo->bh, &sinfo->de) >= 0) { if (!strncmp(sinfo->de->name, name, MSDOS_NAME)) { sinfo->slot_off -= sizeof(*sinfo->de); sinfo->nr_slots = 1; sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); return 0; } } return -ENOENT; }
robutest/uclinux
C++
GPL-2.0
60
/* This function flushes all modified data associated with a file to a device. */
EFI_STATUS EFIAPI FileHandleFlush(IN EFI_FILE_HANDLE FileHandle)
/* This function flushes all modified data associated with a file to a device. */ EFI_STATUS EFIAPI FileHandleFlush(IN EFI_FILE_HANDLE FileHandle)
{ if (FileHandle == NULL) { return (EFI_INVALID_PARAMETER); } return (FileHandle->Flush (FileHandle)); }
tianocore/edk2
C++
Other
4,240
/* returns: 0 on success Negative error code on failure */
static int overlay_adjust_node_phandles(void *fdto, int node, uint32_t delta)
/* returns: 0 on success Negative error code on failure */ static int overlay_adjust_node_phandles(void *fdto, int node, uint32_t delta)
{ int child; int ret; ret = overlay_phandle_add_offset(fdto, node, "phandle", delta); if (ret && ret != -FDT_ERR_NOTFOUND) return ret; ret = overlay_phandle_add_offset(fdto, node, "linux,phandle", delta); if (ret && ret != -FDT_ERR_NOTFOUND) return ret; fdt_for_each_subnode(child, fdto, node) { ret = overlay_adjust_node_phandles(fdto, child, delta); if (ret) return ret; } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CDC class driver callback function the processing of changes to the virtual control lines sent from the host.. */
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo)
/* CDC class driver callback function the processing of changes to the virtual control lines sent from the host.. */ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo)
{ bool HostReady = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR) != 0; (void)HostReady; if (CDCInterfaceInfo == &VirtualSerial1_CDC_Interface) { } else { } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns a boolean indicating whether QEMU provides the DMA-like access method for fw_cfg. */
BOOLEAN InternalQemuFwCfgDmaIsAvailable(VOID)
/* Returns a boolean indicating whether QEMU provides the DMA-like access method for fw_cfg. */ BOOLEAN InternalQemuFwCfgDmaIsAvailable(VOID)
{ EFI_HOB_PLATFORM_INFO *PlatformInfoHob = QemuFwCfgGetPlatformInfo (); return PlatformInfoHob->QemuFwCfgDmaSupported; }
tianocore/edk2
C++
Other
4,240
/* This routine will update the HBA index of a queue to reflect consumption of a Mailbox Queue Entry by the HBA. When the HBA indicates that it has consumed an entry the host calls this function to update the queue's internal pointers. This routine returns the number of entries that were consumed by the HBA. */
static uint32_t lpfc_sli4_mq_release(struct lpfc_queue *q)
/* This routine will update the HBA index of a queue to reflect consumption of a Mailbox Queue Entry by the HBA. When the HBA indicates that it has consumed an entry the host calls this function to update the queue's internal pointers. This routine returns the number of entries that were consumed by the HBA. */ static uint32_t lpfc_sli4_mq_release(struct lpfc_queue *q)
{ q->phba->mbox = NULL; q->hba_index = ((q->hba_index + 1) % q->entry_count); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Note that the number (virq) is already assigned at upper layer. */
static int beatic_pic_host_map(struct irq_host *h, unsigned int virq, irq_hw_number_t hw)
/* Note that the number (virq) is already assigned at upper layer. */ static int beatic_pic_host_map(struct irq_host *h, unsigned int virq, irq_hw_number_t hw)
{ struct irq_desc *desc = irq_to_desc(virq); int64_t err; err = beat_construct_and_connect_irq_plug(virq, hw); if (err < 0) return -EIO; desc->status |= IRQ_LEVEL; set_irq_chip_and_handler(virq, &beatic_pic, handle_fasteoi_irq); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for store state entry action. Function for store state entry action, which includes writing data to a flash page. */
static void state_store_entry_run(void)
/* Function for store state entry action. Function for store state entry action, which includes writing data to a flash page. */ static void state_store_entry_run(void)
{ store_cmd_flash_write_execute(); }
labapart/polymcu
C++
null
201
/* This function is the entrypoint of USB Mouse Driver. It installs Driver Binding Protocols together with Component Name Protocols. */
EFI_STATUS EFIAPI USBMouseDriverBindingEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This function is the entrypoint of USB Mouse Driver. It installs Driver Binding Protocols together with Component Name Protocols. */ EFI_STATUS EFIAPI USBMouseDriverBindingEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gUsbMouseDriverBinding, ImageHandle, &gUsbMouseComponentName, &gUsbMouseComponentName2 ); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* struct hash_ctx { const struct device *device; this device driver's instance structure void *drv_sessn_state; pointer to driver instance struct session state. Defined by driver hash_op hash_hndlr; pointer to this driver function. App calls via pointer to do operations bool started; true if multipart hash has been started uint16_t flags; app populates this before calling hash_begin_session } */
static int xec_symcr_hash_session_free(const struct device *dev, struct hash_ctx *ctx)
/* struct hash_ctx { const struct device *device; this device driver's instance structure void *drv_sessn_state; pointer to driver instance struct session state. Defined by driver hash_op hash_hndlr; pointer to this driver function. App calls via pointer to do operations bool started; true if multipart hash has been started uint16_t flags; app populates this before calling hash_begin_session } */ static int xec_symcr_hash_session_free(const struct device *dev, struct hash_ctx *ctx)
{ struct xec_symcr_hash_session *hs = NULL; int ret = 0; ret = mchp_xec_rom_ah_dma_init(MCHP_ROM_AH_DMA_INIT_WITH_RESET); if (ret) { ret = -EIO; LOG_ERR("ROM HW reset error %d", ret); } hs = (struct xec_symcr_hash_session *)ctx->drv_sessn_state; memset(hs, 0, sizeof(struct xec_symcr_hash_session)); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Program the PIO/MWDMA timing for this channel according to the current clock. These share the same register so are managed by the DMA start/stop sequence as with the old driver. */
static void it821x_program(struct ata_port *ap, struct ata_device *adev, u16 timing)
/* Program the PIO/MWDMA timing for this channel according to the current clock. These share the same register so are managed by the DMA start/stop sequence as with the old driver. */ static void it821x_program(struct ata_port *ap, struct ata_device *adev, u16 timing)
{ struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct it821x_dev *itdev = ap->private_data; int channel = ap->port_no; u8 conf; if (itdev->clock_mode == ATA_66) conf = timing >> 8; else conf = timing & 0xFF; pci_write_config_byte(pdev, 0x54 + 4 * channel, conf); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Interrupt service routine. Based on the comedi_parport driver. */
static irqreturn_t pc236_interrupt(int irq, void *d)
/* Interrupt service routine. Based on the comedi_parport driver. */ static irqreturn_t pc236_interrupt(int irq, void *d)
{ struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 1; int handled; handled = pc236_intr_check(dev); if (dev->attached && handled) { comedi_buf_put(s->async, 0); s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; comedi_event(dev, s); } return IRQ_RETVAL(handled); }
robutest/uclinux
C++
GPL-2.0
60
/* param base VREF peripheral address. param trimValue Value of the trim register to set the output reference voltage (maximum 0xF (4-bit)). */
void VREF_SetTrim21Val(VREF_Type *base, uint8_t trim21Value)
/* param base VREF peripheral address. param trimValue Value of the trim register to set the output reference voltage (maximum 0xF (4-bit)). */ void VREF_SetTrim21Val(VREF_Type *base, uint8_t trim21Value)
{ uint32_t tmp32 = base->UTRIM; if (VREF_CSR_BUF21EN_MASK == (base->CSR & VREF_CSR_BUF21EN_MASK)) { tmp32 &= (~VREF_UTRIM_TRIM2V1_MASK); tmp32 |= VREF_UTRIM_TRIM2V1(trim21Value); } base->UTRIM = tmp32; if (VREF_CSR_CHOPEN_MASK == (base->CSR & VREF_CSR_CHOPEN_MASK)) { SDK_DelayAtLeastUs(400U, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY); } else { while ((base->CSR & VREF_CSR_VREFST_MASK) == 0U) { } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciExpressBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
{ if (Address >= mSmmPciExpressLibPciExpressBaseSize) { return (UINT16)-1; } return MmioBitFieldOr16 ( GetPciExpressAddress (Address), StartBit, EndBit, OrData ); }
tianocore/edk2
C++
Other
4,240
/* This function configures the system to enter Standby mode for current consumption measurement purpose. */
void StandbyMode_Measure(void)
/* This function configures the system to enter Standby mode for current consumption measurement purpose. */ void StandbyMode_Measure(void)
{ __HAL_RCC_PWR_CLK_ENABLE(); HAL_PWR_EnableBkUpAccess(); __HAL_RCC_BACKUPRESET_FORCE(); __HAL_RCC_BACKUPRESET_RELEASE(); HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN2); __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2); HAL_PWR_EnterSTANDBYMode(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* It discards N bytes that are currently waiting to be read on the current socket. This function will read 'size' bytes from the socket and discard them. It defines an internal buffer in which data will be copied; however, in case this buffer is not large enough, it will cycle in order to read everything as well. */
int sock_discard(SOCKET sock, int size, char *errbuf, int errbuflen)
/* It discards N bytes that are currently waiting to be read on the current socket. This function will read 'size' bytes from the socket and discard them. It defines an internal buffer in which data will be copied; however, in case this buffer is not large enough, it will cycle in order to read everything as well. */ int sock_discard(SOCKET sock, int size, char *errbuf, int errbuflen)
{ #define TEMP_BUF_SIZE 32768 char buffer[TEMP_BUF_SIZE]; while (size > TEMP_BUF_SIZE) { if (sock_recv(sock, buffer, TEMP_BUF_SIZE, SOCK_RECEIVEALL_YES, errbuf, errbuflen) == -1) return -1; size -= TEMP_BUF_SIZE; } if (size) { if (sock_recv(sock, buffer, size, SOCK_RECEIVEALL_YES, errbuf, errbuflen) == -1) return -1; } return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Retrieve memory configuration for a given module. board_type is the index in hw_id_list corresponding to the module we are executing on; we return SDRAM controller settings approprate for this module. */
static mem_conf_t* get_mem_config(int board_type)
/* Retrieve memory configuration for a given module. board_type is the index in hw_id_list corresponding to the module we are executing on; we return SDRAM controller settings approprate for this module. */ static mem_conf_t* get_mem_config(int board_type)
{ switch(board_type){ case CM1_QA: return memory_config[0]; case CM11_QA: case CMU1_QA: return memory_config[1]; default: printf("ERROR: Unknown module, using a default SDRAM " "configuration - things may not work!!!.\n"); return memory_config[0]; } }
EmcraftSystems/u-boot
C++
Other
181
/* This function clears only the FAULT0 interrupt and is retained for backwards compatibility. It is recommended that */
void PWMFaultIntClear(unsigned long ulBase)
/* This function clears only the FAULT0 interrupt and is retained for backwards compatibility. It is recommended that */ void PWMFaultIntClear(unsigned long ulBase)
{ ASSERT(ulBase == PWM_BASE); HWREG(ulBase + PWM_O_ISC) = PWM_ISC_INTFAULT0; }
watterott/WebRadio
C++
null
71
/* Unregisters an interrupt handler for a comparator interrupt. */
void ComparatorIntUnregister(uint32_t ui32Base, uint32_t ui32Comp)
/* Unregisters an interrupt handler for a comparator interrupt. */ void ComparatorIntUnregister(uint32_t ui32Base, uint32_t ui32Comp)
{ ASSERT(ui32Base == COMP_BASE); ASSERT(ui32Comp < 3); HWREG(ui32Base + COMP_O_ACINTEN) &= ~(1 << ui32Comp); IntDisable(INT_COMP0_TM4C123 + ui32Comp); IntUnregister(INT_COMP0_TM4C123 + ui32Comp); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the SPI interrupt of the specified SPI port. */
void SPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
/* Enable the SPI interrupt of the specified SPI port. */ void SPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
{ xASSERT(ulBase == SPI0_BASE); xHWREG(ulBase + SPI_IIER) |= ulIntFlags; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Clear USB Device Endpoint Buffer Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClearEPBuf(U32 EPNum)
/* Clear USB Device Endpoint Buffer Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ClearEPBuf(U32 EPNum)
{ U32 cnt, i; U8 *dataptr; if (EPNum & 0x80) { EPNum &= ~0x80; dataptr = (U8 *)EPBufInfo[EP_IN_IDX(EPNum)].buf_ptr; cnt = EPBufInfo[EP_IN_IDX(EPNum)].buf_len; for (i = 0; i < cnt; i++) { dataptr[i] = 0; } } else { dataptr = (U8 *)EPBufInfo[EP_OUT_IDX(EPNum)].buf_ptr; cnt = EPBufInfo[EP_OUT_IDX(EPNum)].buf_len; for (i = 0; i < cnt; i++) { dataptr[i] = 0; } } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Shifts a 64-bit signed value left by a particular number of bits. */
__declspec(naked)
/* Shifts a 64-bit signed value left by a particular number of bits. */ __declspec(naked)
{ _asm { ; ; Handle shifting of 64 or more bits (return 0) ; cmp cl, 64 jae short ReturnZero ; ; Handle shifting of between 0 and 31 bits ; cmp cl, 32 jae short More32 shld edx, eax, cl shl eax, cl ret ; ; Handle shifting of between 32 and 63 bits ; More32: mov edx, eax xor eax, eax and cl, 31 shl edx, cl ret ReturnZero: xor eax,eax xor edx,edx ret } }
tianocore/edk2
C++
Other
4,240
/* Return codes 0 - success. Any other value - error. */
int lpfc_hba_down_prep(struct lpfc_hba *phba)
/* Return codes 0 - success. Any other value - error. */ int lpfc_hba_down_prep(struct lpfc_hba *phba)
{ struct lpfc_vport **vports; int i; if (phba->sli_rev <= LPFC_SLI_REV3) { writel(0, phba->HCregaddr); readl(phba->HCregaddr); } if (phba->pport->load_flag & FC_UNLOADING) lpfc_cleanup_discovery_resources(phba->pport); else { vports = lpfc_create_vport_work_array(phba); if (vports != NULL) for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) lpfc_cleanup_discovery_resources(vports[i]); lpfc_destroy_vport_work_array(phba, vports); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* OTG_FS_IRQHandler This function handles USB-On-The-Go FS global interrupt request. requests. */
void OTG_FS_IRQHandler(void)
/* OTG_FS_IRQHandler This function handles USB-On-The-Go FS global interrupt request. requests. */ void OTG_FS_IRQHandler(void)
{ USBH_OTG_ISR_Handler(&USB_OTG_Core); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Change Logs: Date Author Notes 勤为本 first version 获取指定SPI模块的基地址 @SPIx SPI模块的编号 */
void* ls1c_spi_get_base(unsigned char SPIx)
/* Change Logs: Date Author Notes 勤为本 first version 获取指定SPI模块的基地址 @SPIx SPI模块的编号 */ void* ls1c_spi_get_base(unsigned char SPIx)
{ void *base = NULL; switch (SPIx) { case LS1C_SPI_0: base = (void *)LS1C_SPI0_BASE; break; case LS1C_SPI_1: base = (void *)LS1C_SPI1_BASE; break; default: base = NULL; break; } return base; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* You really shouldn't be using read() or write() on /dev/mem. This might go away in the future. */
int valid_phys_addr_range(unsigned long addr, size_t count)
/* You really shouldn't be using read() or write() on /dev/mem. This might go away in the future. */ int valid_phys_addr_range(unsigned long addr, size_t count)
{ if (addr < __MEMORY_START) return 0; if (addr + count > __pa(high_memory)) return 0; return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The constructor function caches the pointer of Boot Services Table through System Table. It will ASSERT() if the pointer of System Table is NULL. It will ASSERT() if the pointer of Boot Services Table is NULL. It will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI UefiBootServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer of Boot Services Table through System Table. It will ASSERT() if the pointer of System Table is NULL. It will ASSERT() if the pointer of Boot Services Table is NULL. It will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI UefiBootServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ gImageHandle = ImageHandle; ASSERT (gImageHandle != NULL); gST = SystemTable; ASSERT (gST != NULL); gBS = SystemTable->BootServices; ASSERT (gBS != NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* li_destroy destroys the lithium_t structure and vm mappings. */
static void li_destroy(lithium_t *lith)
/* li_destroy destroys the lithium_t structure and vm mappings. */ static void li_destroy(lithium_t *lith)
{ if (lith->page0) { iounmap(lith->page0); lith->page0 = NULL; } if (lith->page1) { iounmap(lith->page1); lith->page1 = NULL; } if (lith->page2) { iounmap(lith->page2); lith->page2 = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* Called when application releases the fasyn callback handler. */
static int _ctl_release(struct inode *inode, struct file *filep)
/* Called when application releases the fasyn callback handler. */ static int _ctl_release(struct inode *inode, struct file *filep)
{ return fasync_helper(-1, filep, 0, &async_queue); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts PARCOR coefficient k to direct filter coefficient. */
static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
/* Converts PARCOR coefficient k to direct filter coefficient. */ static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
{ int i, j; for (i = 0, j = k - 1; i < j; i++, j--) { int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20); cof[j] += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20); cof[i] += tmp1; } if (i == j) cof[i] += ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20); cof[k] = par[k]; }
DC-SWAT/DreamShell
C++
null
404
/* Configures the voltage threshold detected by the Power Voltage Detector(PVD). */
void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level)
/* Configures the voltage threshold detected by the Power Voltage Detector(PVD). */ void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level)
{ PMU->CTRL_B.PLSEL = 0; PMU->CTRL_B.PLSEL = level; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __vxge_hw_device_is_privilaged This routine checks if the device function is privilaged or not */
enum vxge_hw_status __vxge_hw_device_is_privilaged(u32 host_type, u32 func_id)
/* __vxge_hw_device_is_privilaged This routine checks if the device function is privilaged or not */ enum vxge_hw_status __vxge_hw_device_is_privilaged(u32 host_type, u32 func_id)
{ if (__vxge_hw_device_access_rights_get(host_type, func_id) & VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM) return VXGE_HW_OK; else return VXGE_HW_ERR_PRIVILAGED_OPEARATION; }
robutest/uclinux
C++
GPL-2.0
60
/* %-ENOENT - A block number associated with @vblocknr does not exist. */
int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp)
/* %-ENOENT - A block number associated with @vblocknr does not exist. */ int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp)
{ struct buffer_head *entry_bh; struct nilfs_dat_entry *entry; sector_t blocknr; void *kaddr; int ret; ret = nilfs_palloc_get_entry_block(dat, vblocknr, 0, &entry_bh); if (ret < 0) return ret; kaddr = kmap_atomic(entry_bh->b_page, KM_USER0); entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr); blocknr = le64_to_cpu(entry->de_blocknr); if (blocknr == 0) { ret = -ENOENT; goto out; } if (blocknrp != NULL) *blocknrp = blocknr; out: kunmap_atomic(kaddr, KM_USER0); brelse(entry_bh); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */
static int g364fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
/* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ static int g364fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
{ if (var->xoffset || var->yoffset + var->yres > var->yres_virtual) return -EINVAL; *(unsigned int *) TOP_REG = var->yoffset * var->xres; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Get/set the fan speed in open loop mode using pwm1 sysfs file. Speed is given as a relative value from 0 to 255, where 255 is maximum speed. Note that this is done by writing directly to the chip's DAC, it won't change the closed loop speed set by fan1_target. Also note that due to rounding errors it is possible that you don't read back exactly the value you have set. */
static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr, char *buf)
/* Get/set the fan speed in open loop mode using pwm1 sysfs file. Speed is given as a relative value from 0 to 255, where 255 is maximum speed. Note that this is done by writing directly to the chip's DAC, it won't change the closed loop speed set by fan1_target. Also note that due to rounding errors it is possible that you don't read back exactly the value you have set. */ static ssize_t get_pwm(struct device *dev, struct device_attribute *devattr, char *buf)
{ int pwm; struct max6650_data *data = max6650_update_device(dev); if (data->config & MAX6650_CFG_V12) pwm = 255 - (255 * (int)data->dac)/180; else pwm = 255 - (255 * (int)data->dac)/76; if (pwm < 0) pwm = 0; return sprintf(buf, "%d\n", pwm); }
robutest/uclinux
C++
GPL-2.0
60
/* Compare pbuf contents at specified offset with memory s2, both of length n */
u16_t pbuf_memcmp(const struct pbuf *p, u16_t offset, const void *s2, u16_t n)
/* Compare pbuf contents at specified offset with memory s2, both of length n */ u16_t pbuf_memcmp(const struct pbuf *p, u16_t offset, const void *s2, u16_t n)
{ u16_t start = offset; const struct pbuf *q = p; u16_t i; if (p->tot_len < (offset + n)) { return 0xffff; } while ((q != NULL) && (q->len <= start)) { start = (u16_t)(start - q->len); q = q->next; } for (i = 0; i < n; i++) { u8_t a = pbuf_get_at(q, (u16_t)(start + i)); u8_t b = ((const u8_t *)s2)[i]; if (a != b) { return (u16_t)LWIP_MIN(i + 1, 0xFFFF); } } return 0; }
ua1arn/hftrx
C++
null
69
/* Mark device non-existant. This disables writes, ioctls and prevents new users from opening the device. Already posted blocking reads will stay, however new ones will fail. */
static void joydev_mark_dead(struct joydev *joydev)
/* Mark device non-existant. This disables writes, ioctls and prevents new users from opening the device. Already posted blocking reads will stay, however new ones will fail. */ static void joydev_mark_dead(struct joydev *joydev)
{ mutex_lock(&joydev->mutex); joydev->exist = 0; mutex_unlock(&joydev->mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the GPIO pin used as EXTI Line. */
void GPIO_ConfigEXTILine(uint8_t PortSource, uint8_t PinSource)
/* Selects the GPIO pin used as EXTI Line. */ void GPIO_ConfigEXTILine(uint8_t PortSource, uint8_t PinSource)
{ uint32_t port = (uint32_t)PortSource; assert_param(IS_GPIO_EXTI_PORT_SOURCE(PortSource)); assert_param(IS_GPIO_PIN_SOURCE(PinSource)); AFIO->EXTI_CFG[(PinSource >> 0x02)] &= ~(((uint32_t)0x03) << ((PinSource & (uint8_t)0x03)*4u)); AFIO->EXTI_CFG[(PinSource >> 0x02)] |= (port << ((PinSource & (uint8_t)0x03) *4u)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This API used to set the z repetition in the register 0x52 bit 0 to 7. */
BMM050_RETURN_FUNCTION_TYPE bmm050_set_rep_Z(u8 v_rep_z_u8)
/* This API used to set the z repetition in the register 0x52 bit 0 to 7. */ BMM050_RETURN_FUNCTION_TYPE bmm050_set_rep_Z(u8 v_rep_z_u8)
{ BMM050_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 v_data_u8 = BMM050_INIT_VALUE; if (p_bmm050 == BMM050_NULL) { return E_BMM050_NULL_PTR; } else { v_data_u8 = v_rep_z_u8; com_rslt = p_bmm050->BMM050_BUS_WRITE_FUNC(p_bmm050->dev_addr, BMM050_REP_Z, &v_data_u8, BMM050_GEN_READ_WRITE_DATA_LENGTH); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_statement_at_font_face_rule_add_decl(CRStatement *a_this, CRString *a_prop, CRTerm *a_value)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_statement_at_font_face_rule_add_decl(CRStatement *a_this, CRString *a_prop, CRTerm *a_value)
{ CRDeclaration *decls = NULL; g_return_val_if_fail (a_this && a_this->type == AT_FONT_FACE_RULE_STMT && a_this->kind.font_face_rule, CR_BAD_PARAM_ERROR); decls = cr_declaration_append2 (a_this->kind.font_face_rule->decl_list, a_prop, a_value); g_return_val_if_fail (decls, CR_ERROR); if (a_this->kind.font_face_rule->decl_list == NULL) cr_declaration_ref (decls); a_this->kind.font_face_rule->decl_list = decls; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Transceive single byte of data to and from the SPI. This function will return after single byte of data transceived. */
enum status_code spi_transceive_wait(struct spi_module *const module, uint8_t *tx_data, uint8_t *rx_data)
/* Transceive single byte of data to and from the SPI. This function will return after single byte of data transceived. */ enum status_code spi_transceive_wait(struct spi_module *const module, uint8_t *tx_data, uint8_t *rx_data)
{ return spi_transceive_buffer_wait(module, tx_data, rx_data, 1); }
memfault/zero-to-main
C++
null
200
/* Enables callback. Enables the callback function registered by the */
void spi_enable_callback(struct spi_module *const module, enum spi_callback callback_type)
/* Enables callback. Enables the callback function registered by the */ void spi_enable_callback(struct spi_module *const module, enum spi_callback callback_type)
{ Assert(module); module->enabled_callback |= (1 << callback_type); }
memfault/zero-to-main
C++
null
200
/* nand_block_markbad - Mark block at the given offset as bad @mtd: MTD device structure @ofs: offset relative to mtd start */
static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs)
/* nand_block_markbad - Mark block at the given offset as bad @mtd: MTD device structure @ofs: offset relative to mtd start */ static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs)
{ struct nand_chip *chip = mtd->priv; int ret; if ((ret = nand_block_isbad(mtd, ofs))) { if (ret > 0) return 0; return ret; } return chip->block_markbad(mtd, ofs); }
EmcraftSystems/u-boot
C++
Other
181
/* Configures the slave address to be transmitted after start generation. */
void I2C_SlaveAddressConfig(I2C_TypeDef *I2Cx, uint16_t Address)
/* Configures the slave address to be transmitted after start generation. */ void I2C_SlaveAddressConfig(I2C_TypeDef *I2Cx, uint16_t Address)
{ uint32_t tmpreg = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_SLAVE_ADDRESS(Address)); tmpreg = I2Cx->CR2; tmpreg &= (uint32_t)~((uint32_t)I2C_CR2_SADD); tmpreg |= (uint32_t)((uint32_t)Address & I2C_CR2_SADD); I2Cx->CR2 = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* UART MSP Initialization This function configures the hardware resources used in this example: */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example: */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct; USARTx_TX_GPIO_CLK_ENABLE(); USARTx_RX_GPIO_CLK_ENABLE(); USARTx_CLK_ENABLE(); GPIO_InitStruct.Pin = USARTx_TX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = USARTx_TX_AF; HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = USARTx_RX_PIN; GPIO_InitStruct.Alternate = USARTx_RX_AF; HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct); HAL_NVIC_SetPriority(USARTx_IRQn, 0, 1); HAL_NVIC_EnableIRQ(USARTx_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* config usart default tx value. used in syn mode */
int32_t csi_usart_set_default_tx_value(usart_handle_t handle, uint32_t value)
/* config usart default tx value. used in syn mode */ int32_t csi_usart_set_default_tx_value(usart_handle_t handle, uint32_t value)
{ USART_NULL_PARAM_CHK(handle); return ERR_USART(EDRV_UNSUPPORTED); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Select The Timer counter capture detect edge. The */
void TimerCaptureEdgeSelect(unsigned long ulBase, unsigned long ulEdge)
/* Select The Timer counter capture detect edge. The */ void TimerCaptureEdgeSelect(unsigned long ulBase, unsigned long ulEdge)
{ xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE)); xASSERT((ulEdge == TIMER_CAP_RISING) || (ulEdge == TIMER_CAP_BOTH) || (ulEdge == TIMER_CAP_FALLING)); xHWREG(ulBase + TIMER_O_TEXCON) &= ~TIMER_TEXCON_TEX_EDGE_M; xHWREG(ulBase + TIMER_O_TEXCON) |= ulEdge; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Writes a number of bytes, at most If */
size_t __write(int handle, const uint8_t *buffer, size_t size)
/* Writes a number of bytes, at most If */ size_t __write(int handle, const uint8_t *buffer, size_t size)
{ size_t nChars = 0; if (buffer == 0) { return 0; } if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR) { return _LLIO_ERROR; } for (; size != 0; --size) { if (usart_putchar(stdio_usart_base, *buffer++) < 0) { return _LLIO_ERROR; } ++nChars; } return nChars; }
labapart/polymcu
C++
null
201
/* Returns 0 on success or error on failure. */
int transport_class_register(struct transport_class *tclass)
/* Returns 0 on success or error on failure. */ int transport_class_register(struct transport_class *tclass)
{ return class_register(&tclass->class); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the memory type that has the least precedence. */
MTRR_MEMORY_CACHE_TYPE MtrrLibLowestType(IN UINT8 TypeBits)
/* Return the memory type that has the least precedence. */ MTRR_MEMORY_CACHE_TYPE MtrrLibLowestType(IN UINT8 TypeBits)
{ INT8 Type; ASSERT (TypeBits != 0); for (Type = 7; (INT8)TypeBits > 0; Type--, TypeBits <<= 1) { } return (MTRR_MEMORY_CACHE_TYPE)Type; }
tianocore/edk2
C++
Other
4,240
/* Resolve generic netlink family name to its identifier */
int genl_ctrl_resolve(struct nl_sock *sk, const char *name)
/* Resolve generic netlink family name to its identifier */ int genl_ctrl_resolve(struct nl_sock *sk, const char *name)
{ struct nl_cache *cache; struct genl_family *family; int err; if ((err = genl_ctrl_alloc_cache(sk, &cache)) < 0) return err; family = genl_ctrl_search_by_name(cache, name); if (family == NULL) { err = -NLE_OBJ_NOTFOUND; goto errout; } err = genl_family_get_id(family); genl_family_put(family); errout: nl_cache_free(cache); return err; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* We say we're a CPM-type port because that's mostly true. Once the device is configured, this driver operates almost identically to the CPM serial driver. */
static void qe_uart_config_port(struct uart_port *port, int flags)
/* We say we're a CPM-type port because that's mostly true. Once the device is configured, this driver operates almost identically to the CPM serial driver. */ static void qe_uart_config_port(struct uart_port *port, int flags)
{ if (flags & UART_CONFIG_TYPE) { port->type = PORT_CPM; qe_uart_request_port(port); } }
robutest/uclinux
C++
GPL-2.0
60
/* Given the parent's rate and the required rate for the children, this works out the peripheral clock divider to use, in 7.1 binary format. */
static int clk_get_divider(unsigned divider_bits, unsigned long parent_rate, unsigned long rate)
/* Given the parent's rate and the required rate for the children, this works out the peripheral clock divider to use, in 7.1 binary format. */ static int clk_get_divider(unsigned divider_bits, unsigned long parent_rate, unsigned long rate)
{ u64 divider = parent_rate * 2; unsigned max_divider = 1 << divider_bits; divider += rate - 1; do_div(divider, rate); if ((s64)divider - 2 < 0) return 0; if ((s64)divider - 2 >= max_divider) return -1; return divider - 2; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Initializes a queue. The am_hal_queue_from_array macro is a convenient shorthand for this operation. The code below does the same thing as the code above. */
void am_hal_queue_init(am_hal_queue_t *psQueue, void *pvData, uint32_t ui32ItemSize, uint32_t ui32ArraySize)
/* Initializes a queue. The am_hal_queue_from_array macro is a convenient shorthand for this operation. The code below does the same thing as the code above. */ void am_hal_queue_init(am_hal_queue_t *psQueue, void *pvData, uint32_t ui32ItemSize, uint32_t ui32ArraySize)
{ psQueue->ui32WriteIndex = 0; psQueue->ui32ReadIndex = 0; psQueue->ui32Length = 0; psQueue->ui32Capacity = ui32ArraySize; psQueue->ui32ItemSize = ui32ItemSize; psQueue->pui8Data = (uint8_t *) pvData; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the time stamp contents in to the respective pointers These registers are readonly. This function returns the 48 bit time stamp assuming Version 2 timestamp with higher word is selected. */
void synopGMAC_TS_read_timestamp(synopGMACdevice *gmacdev, u16 *higher_sec_val, u32 *sec_val, u32 *sub_sec_val)
/* Reads the time stamp contents in to the respective pointers These registers are readonly. This function returns the 48 bit time stamp assuming Version 2 timestamp with higher word is selected. */ void synopGMAC_TS_read_timestamp(synopGMACdevice *gmacdev, u16 *higher_sec_val, u32 *sec_val, u32 *sub_sec_val)
{ * higher_sec_val = (u16)(synopGMACReadReg(gmacdev->MacBase, GmacTSHighWord) & GmacTSHighWordMask); * sec_val = synopGMACReadReg(gmacdev->MacBase, GmacTSHigh); * sub_sec_val = synopGMACReadReg(gmacdev->MacBase, GmacTSLow); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the slave address of the specified I2C port. The */
void I2CSlaveOwnAddressSet(unsigned long ulBase, unsigned char ucSlaveNum, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
/* Set the slave address of the specified I2C port. The */ void I2CSlaveOwnAddressSet(unsigned long ulBase, unsigned char ucSlaveNum, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
{ unsigned long ulTemp[4] = {0x04, 0x18, 0x1C, 0x20}; xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xASSERT((ucSlaveNum == 0) || (ucSlaveNum == 1) || (ucSlaveNum == 2) || (ucSlaveNum == 3)); xASSERT((ulGeneralCall == I2C_GENERAL_CALL_EN) || (ulGeneralCall == I2C_GENERAL_CALL_DIS)); xHWREG(ulBase + ulTemp[ucSlaveNum]) |= ((ucSlaveAddr << 1) | ulGeneralCall); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* f is 9.23 fixed point, other differences are 4.28 fixed point. */
static void fd_fixed_fwd(int32_t f[4])
/* f is 9.23 fixed point, other differences are 4.28 fixed point. */ static void fd_fixed_fwd(int32_t f[4])
{ f[0] += (f[1] >> 5) + ((f[1] >> 4) & 1); f[1] += f[2]; f[2] += f[3]; }
xboot/xboot
C++
MIT License
779
/* Set the actual surface resolution of @surface to the given x and y DPI. Mainly used for correctly computing the scale factor when fallback rendering needs to take place in the paginated surface. */
void _cairo_surface_set_resolution(cairo_surface_t *surface, double x_res, double y_res)
/* Set the actual surface resolution of @surface to the given x and y DPI. Mainly used for correctly computing the scale factor when fallback rendering needs to take place in the paginated surface. */ void _cairo_surface_set_resolution(cairo_surface_t *surface, double x_res, double y_res)
{ if (surface->status) return; surface->x_resolution = x_res; surface->y_resolution = y_res; }
xboot/xboot
C++
MIT License
779
/* Get the current 64 bit timer tick count */
unsigned long long get_ticks(void)
/* Get the current 64 bit timer tick count */ unsigned long long get_ticks(void)
{ unsigned long now = readl(&timer->tim34); if (now < gd->arch.tbl) gd->arch.tbu++; gd->arch.tbl = now; return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the current alarm time of specified alarm. Retrieves the current alarm time for the specified alarm. */
enum status_code rtc_calendar_get_alarm(struct rtc_module *const module, struct rtc_calendar_alarm_time *const alarm, const enum rtc_calendar_alarm alarm_index)
/* Get the current alarm time of specified alarm. Retrieves the current alarm time for the specified alarm. */ enum status_code rtc_calendar_get_alarm(struct rtc_module *const module, struct rtc_calendar_alarm_time *const alarm, const enum rtc_calendar_alarm alarm_index)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; if ((uint32_t)alarm_index > RTC_NUM_OF_ALARMS) { return STATUS_ERR_INVALID_ARG; } uint32_t register_value = rtc_module->MODE2.Mode2Alarm[alarm_index].ALARM.reg; rtc_calendar_register_value_to_time(module, register_value, &(alarm->time)); alarm->mask = (enum rtc_calendar_alarm_mask)rtc_module->MODE2.Mode2Alarm[alarm_index].MASK.reg; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Replace the original pci bus ops for write with a new one that will filter the request to insure ASPM cannot be enabled. */
static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
/* Replace the original pci bus ops for write with a new one that will filter the request to insure ASPM cannot be enabled. */ static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
{ u8 offset; offset = quirk_aspm_offset[GET_INDEX(bus->self->device, devfn)]; if ((offset) && (where == offset)) value = value & 0xfffffffc; return raw_pci_write(pci_domain_nr(bus), bus->number, devfn, where, size, value); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Start sending data to UART transmitter,(received data is ignored). The function is non-blocking,UART_EVENT_TRANSFER_COMPLETE is signaled when transfer completes. csi_usart_get_status can indicates if transmission is still in progress or pending. */
int32_t csi_usart_send(usart_handle_t handle, const void *data, uint32_t num)
/* Start sending data to UART transmitter,(received data is ignored). The function is non-blocking,UART_EVENT_TRANSFER_COMPLETE is signaled when transfer completes. csi_usart_get_status can indicates if transmission is still in progress or pending. */ int32_t csi_usart_send(usart_handle_t handle, const void *data, uint32_t num)
{ USART_NULL_PARAM_CHK(handle); USART_NULL_PARAM_CHK(data); if (num == 0) { return ERR_USART(DRV_ERROR_PARAMETER); } ck_usart_priv_t *usart_priv = handle; usart_priv->tx_buf = (uint8_t *)data; usart_priv->tx_total_num = num; usart_priv->tx_cnt = 0; usart_priv->tx_busy = 1; usart_priv->last_tx_num = 0; ck_usart_reg_t *addr = (ck_usart_reg_t *)(usart_priv->base); ck_usart_intr_threshold_empty(usart_priv->idx, usart_priv); addr->IER |= IER_THRE_INT_ENABLE; return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Function to free any resources allocated by the HW models Note that this function needs to be designed so it is possible to call it more than once during cleanup */
void hwm_cleanup(void)
/* Function to free any resources allocated by the HW models Note that this function needs to be designed so it is possible to call it more than once during cleanup */ void hwm_cleanup(void)
{ hwtimer_cleanup(); hw_irq_ctrl_cleanup(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This API sets FIFO watermark interrupt of the sensor.The FIFO watermark interrupt is fired, when the FIFO fill level is above a fifo watermark. */
static int8_t set_fifo_watermark_int(const struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
/* This API sets FIFO watermark interrupt of the sensor.The FIFO watermark interrupt is fired, when the FIFO fill level is above a fifo watermark. */ static int8_t set_fifo_watermark_int(const struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
{ int8_t rslt = BMI160_OK; if ((dev == NULL) || (dev->delay_ms == NULL)) { rslt = BMI160_E_NULL_PTR; } else { rslt = enable_fifo_wtm_int(int_config, dev); if (rslt == BMI160_OK) { rslt = set_intr_pin_config(int_config, dev); if (rslt == BMI160_OK) { rslt = map_hardware_interrupt(int_config, dev); } } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* This function sends a message to a mailbox. It is unusual in that no error return is made. This is because the caller is responsible for ensuring that the mailbox queue will not fail. The caller does this by limiting the number of msg structures which exist for a given mailbox. */
void sys_mbox_post(sys_mbox_t mbox, void *data)
/* This function sends a message to a mailbox. It is unusual in that no error return is made. This is because the caller is responsible for ensuring that the mailbox queue will not fail. The caller does this by limiting the number of msg structures which exist for a given mailbox. */ void sys_mbox_post(sys_mbox_t mbox, void *data)
{ portBASE_TYPE xQueueSent; xQueueSent = xQueueSend( mbox, &data, 0 ); LWIP_ASSERT( "sys_mbox_post: xQueueSent == pdPASS", xQueueSent == pdPASS ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables and registers ADC interrupt handler for specified channel */
void ADCIntRegister(unsigned long ulBase, unsigned long ulChannel, void(*pfnHandler)(void))
/* Enables and registers ADC interrupt handler for specified channel */ void ADCIntRegister(unsigned long ulBase, unsigned long ulChannel, void(*pfnHandler)(void))
{ unsigned long ulIntNo; ulIntNo = (ulChannel == ADC_CH_0)? INT_ADCCH0 : (ulChannel == ADC_CH_1)? INT_ADCCH1 : (ulChannel == ADC_CH_2)? INT_ADCCH2 : INT_ADCCH3; IntRegister(ulIntNo,pfnHandler); IntEnable(ulIntNo); }
micropython/micropython
C++
Other
18,334
/* Returns true if the buffer cross a DMA boundary on a PC. The poor thing can only DMA within a 64K block not across the edges of it. */
static int spans_boundary(struct sk_buff *skb)
/* Returns true if the buffer cross a DMA boundary on a PC. The poor thing can only DMA within a 64K block not across the edges of it. */ static int spans_boundary(struct sk_buff *skb)
{ unsigned long a=(unsigned long)skb->data; a^=(a+skb->len); if(a&0x00010000) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.. */
int32_t iis2mdc_mag_user_offset_get(stmdev_ctx_t *ctx, int16_t *val)
/* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.. */ int32_t iis2mdc_mag_user_offset_get(stmdev_ctx_t *ctx, int16_t *val)
{ uint8_t buff[6]; int32_t ret; ret = iis2mdc_read_reg(ctx, IIS2MDC_OFFSET_X_REG_L, buff, 6); val[0] = (int16_t)buff[1]; val[0] = (val[0] * 256) + (int16_t)buff[0]; val[1] = (int16_t)buff[3]; val[1] = (val[1] * 256) + (int16_t)buff[2]; val[2] = (int16_t)buff[5]; val[2] = (val[2] * 256) + (int16_t)buff[4]; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* This function "closes" SMRAM so that it is not visible while outside of SMM. The function should return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. */
STATIC EFI_STATUS EFIAPI SmmAccessPeiClose(IN EFI_PEI_SERVICES **PeiServices, IN PEI_SMM_ACCESS_PPI *This, IN UINTN DescriptorIndex)
/* This function "closes" SMRAM so that it is not visible while outside of SMM. The function should return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. */ STATIC EFI_STATUS EFIAPI SmmAccessPeiClose(IN EFI_PEI_SERVICES **PeiServices, IN PEI_SMM_ACCESS_PPI *This, IN UINTN DescriptorIndex)
{ if (DescriptorIndex >= DescIdxCount) { return EFI_INVALID_PARAMETER; } return SmramAccessClose (&This->LockState, &This->OpenState); }
tianocore/edk2
C++
Other
4,240
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
{ return SafeUint64Add ((UINT64)Augend, (UINT64)Addend, (UINT64 *)Result); }
tianocore/edk2
C++
Other
4,240
/* Reads the raw red, green, blue and clear channel values. */
int tcs34725GetRawData(lua_State *L)
/* Reads the raw red, green, blue and clear channel values. */ int tcs34725GetRawData(lua_State *L)
{ uint16_t r; uint16_t g; uint16_t b; uint16_t c; if (!_tcs34725Initialised) { return luaL_error(L, "TCS34725 not initialised."); } c = tcs34725Read16(TCS34725_CDATAL); r = tcs34725Read16(TCS34725_RDATAL); g = tcs34725Read16(TCS34725_GDATAL); b = tcs34725Read16(TCS34725_BDATAL); lua_pushinteger(L, c); lua_pushinteger(L, r); lua_pushinteger(L, g); lua_pushinteger(L, b); return 4; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); } else if(hspi->Instance==SPI2) { __HAL_RCC_SPI2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_3); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create a routing entry. We first verify that the record does not already exist. If it does we return -EEXIST */
static int ipddp_create(struct ipddp_route *new_rt)
/* Create a routing entry. We first verify that the record does not already exist. If it does we return -EEXIST */ static int ipddp_create(struct ipddp_route *new_rt)
{ struct ipddp_route *rt = kmalloc(sizeof(*rt), GFP_KERNEL); if (rt == NULL) return -ENOMEM; rt->ip = new_rt->ip; rt->at = new_rt->at; rt->next = NULL; if ((rt->dev = atrtr_get_dev(&rt->at)) == NULL) { kfree(rt); return -ENETUNREACH; } spin_lock_bh(&ipddp_route_lock); if (__ipddp_find_route(rt)) { spin_unlock_bh(&ipddp_route_lock); kfree(rt); return -EEXIST; } rt->next = ipddp_route_list; ipddp_route_list = rt; spin_unlock_bh(&ipddp_route_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the maximum encryption key size. Set the maximum encryption key size supported by the local device. In the case of dynamic encryption key size mode the default value for the device maximum encryption key size is set to 16 */
ADI_BLER_RESULT adi_radio_SetMaxEncryptionKeySize(const uint8_t nKeySize)
/* Set the maximum encryption key size. Set the maximum encryption key size supported by the local device. In the case of dynamic encryption key size mode the default value for the device maximum encryption key size is set to 16 */ ADI_BLER_RESULT adi_radio_SetMaxEncryptionKeySize(const uint8_t nKeySize)
{ ADI_BLER_RESULT bleResult; ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_SET_MAX_ENCRYPT_SIZE); ADI_BLE_RADIO_CMD_START(CMD_BLESMP_SET_MAX_ENCRYPT_SIZE); ASSERT(nKeySize >= 7u); ASSERT(nKeySize <= 16u); memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], &nKeySize, 1u); bleResult = bler_process_cmd(CMD_BLESMP_SET_MAX_ENCRYPT_SIZE, 1u, NULL, 0u); if(bleResult == ADI_BLER_SUCCESS){ bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT); } ADI_BLE_RADIO_CMD_END(); return (bleResult); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* process_cpl_msg_ref: -> host Similar to process_cpl_msg() but takes an extra connection reference around the call to the handler. Should be used if the handler may drop a connection reference. */
static void process_cpl_msg_ref(void(*fn)(struct s3_conn *, struct sk_buff *), struct s3_conn *c3cn, struct sk_buff *skb)
/* process_cpl_msg_ref: -> host Similar to process_cpl_msg() but takes an extra connection reference around the call to the handler. Should be used if the handler may drop a connection reference. */ static void process_cpl_msg_ref(void(*fn)(struct s3_conn *, struct sk_buff *), struct s3_conn *c3cn, struct sk_buff *skb)
{ c3cn_hold(c3cn); process_cpl_msg(fn, c3cn, skb); c3cn_put(c3cn); }
robutest/uclinux
C++
GPL-2.0
60
/* CloseReport is called by a transfer agent to finalize the report and signal transfer is over. */
void CloseReport(ReportHeader *agent, ReportStruct *packet)
/* CloseReport is called by a transfer agent to finalize the report and signal transfer is over. */ void CloseReport(ReportHeader *agent, ReportStruct *packet)
{ currpktid = packet->packetID; packet->packetID = -1; packet->packetLen = 0; ReportPacket( agent, packet ); packet->packetID = currpktid; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This routine pad the string in tail with input character. */
STATIC VOID PadStrInTail(IN CHAR16 *StrBuf, IN UINTN PadLen, IN CHAR16 Character)
/* This routine pad the string in tail with input character. */ STATIC VOID PadStrInTail(IN CHAR16 *StrBuf, IN UINTN PadLen, IN CHAR16 Character)
{ UINTN Index; for (Index = 0; StrBuf[Index] != L'\0'; Index++) { } while (PadLen != 0) { StrBuf[Index] = Character; Index++; PadLen--; } StrBuf[Index] = L'\0'; }
tianocore/edk2
C++
Other
4,240
/* 6.. FMS Event Notification (Unconfirmed Service Id = 2) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_ev_notification_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Event Notification (Unconfirmed Service Id = 2) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_ev_notification_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Event Notification Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_ev_notification_req, NULL, "FMS Event Notification Request"); proto_tree_add_item(sub_tree, hf_ff_fms_ev_notification_req_idx, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; proto_tree_add_item(sub_tree, hf_ff_fms_ev_notification_req_ev_num, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; if (length) { proto_tree_add_item(sub_tree, hf_ff_data, tvb, offset, length, ENC_NA); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Create the appropriate control structures to manage a new EHCI host controller. */
int ehci_hcd_init(void)
/* Create the appropriate control structures to manage a new EHCI host controller. */ int ehci_hcd_init(void)
{ pci_dev_t pdev; uint32_t addr; pdev = pci_find_devices(ehci_pci_ids, CONFIG_PCI_EHCI_DEVICE); if (pdev == -1) { printf("EHCI host controller not found\n"); return -1; } pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &addr); hccr = (struct ehci_hccr *)addr; hcor = (struct ehci_hcor *)((uint32_t) hccr + HC_LENGTH(ehci_readl(&hccr->cr_capbase))); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* 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(LED2); HAL_Delay(40); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Delete WAN logical channel. o verify user address space o copy configuration data to kernel address space */
static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name)
/* Delete WAN logical channel. o verify user address space o copy configuration data to kernel address space */ static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name)
{ char name[WAN_IFNAME_SZ + 1]; int err = 0; if (wandev->state == WAN_UNCONFIGURED) return -ENODEV; memset(name, 0, sizeof(name)); if (copy_from_user(name, u_name, WAN_IFNAME_SZ)) return -EFAULT; err = wanrouter_delete_interface(wandev, name); if (err) return err; if (!wandev->ndev && wandev->shutdown) err = wandev->shutdown(wandev); return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get value of operand 2 (in a LDR instruction) */
static unsigned long ptrace_getldrop2(struct task_struct *child, unsigned long insn)
/* Get value of operand 2 (in a LDR instruction) */ static unsigned long ptrace_getldrop2(struct task_struct *child, unsigned long insn)
{ unsigned long val; int shift; int type; val = get_user_reg(child, insn & 15); shift = (insn >> 7) & 31; type = (insn >> 5) & 3; switch (type) { case 0: val <<= shift; break; case 1: val >>= shift; break; case 2: val = (((signed long)val) >> shift); break; case 3: val = (val >> shift) | (val << (32 - shift)); break; } return val; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxFull(unsigned long ulBase)
/* Check the status of the Rx buffer of the specified SPI port. */ xtBoolean SPIIsRxFull(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_RX_FULL)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* It's require to implement _isatty to have STDIN/STDOUT/STDERR buffered properly. */
int _isatty(int file)
/* It's require to implement _isatty to have STDIN/STDOUT/STDERR buffered properly. */ int _isatty(int file)
{ if (file == STDIN_FILENO || file == STDOUT_FILENO || file == STDERR_FILENO) { return 1; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Table 5, Standard single precision floating-point comparison helper functions */
int __aeabi_fcmpeq(aeabi_float_t a, aeabi_float_t b)
/* Table 5, Standard single precision floating-point comparison helper functions */ int __aeabi_fcmpeq(aeabi_float_t a, aeabi_float_t b)
{ return f32_eq (f32_from_f (a), f32_from_f (b)); }
tianocore/edk2
C++
Other
4,240
/* Return: pointer to handle if successful, else EINVAL if invalid conditions are encountered. */
const struct ti_sci_handle* ti_sci_get_handle(struct udevice *dev)
/* Return: pointer to handle if successful, else EINVAL if invalid conditions are encountered. */ const struct ti_sci_handle* ti_sci_get_handle(struct udevice *dev)
{ if (!dev) return ERR_PTR(-EINVAL); struct udevice *sci_dev = dev_get_parent(dev); return ti_sci_get_handle_from_sysfw(sci_dev); }
4ms/stm32mp1-baremetal
C++
Other
137
/* param handle WM8904 handle structure. param reg register address. param value value to read. return kStatus_Success, else failed. */
status_t WM8904_ReadRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t *value)
/* param handle WM8904 handle structure. param reg register address. param value value to read. return kStatus_Success, else failed. */ status_t WM8904_ReadRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t *value)
{ assert(handle->config != NULL); assert(handle->config->slaveAddress != 0U); uint8_t retval = 0; uint16_t readValue = 0U; retval = CODEC_I2C_Receive(handle->i2cHandle, handle->config->slaveAddress, reg, 1U, (uint8_t *)&readValue, 2U); *value = WM8904_SWAP_UINT16_BYTE_SEQUENCE(readValue); return retval; }
eclipse-threadx/getting-started
C++
Other
310
/* Get the size of the current device path instance. */
EFI_STATUS GetDevicePathInstanceSize(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINTN *InstanceSize, OUT BOOLEAN *EntireDevicePathEnd)
/* Get the size of the current device path instance. */ EFI_STATUS GetDevicePathInstanceSize(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINTN *InstanceSize, OUT BOOLEAN *EntireDevicePathEnd)
{ EFI_DEVICE_PATH_PROTOCOL *Walker; if ((DevicePath == NULL) || (InstanceSize == NULL) || (EntireDevicePathEnd == NULL)) { return EFI_INVALID_PARAMETER; } Walker = DevicePath; while (Walker->Type != END_DEVICE_PATH_TYPE) { Walker = NextDevicePathNode (Walker); } if (Walker->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE) { *EntireDevicePathEnd = TRUE; } else if (Walker->SubType == END_INSTANCE_DEVICE_PATH_SUBTYPE) { *EntireDevicePathEnd = FALSE; } else { return EFI_INVALID_PARAMETER; } *InstanceSize = ((UINTN)Walker - (UINTN)(DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240