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
/* Per IrLMP 1.1, 4.3.3.2, octet-sequence are up to 1024 bytes - Jean II */
struct ias_value* irias_new_octseq_value(__u8 *octseq, int len)
/* Per IrLMP 1.1, 4.3.3.2, octet-sequence are up to 1024 bytes - Jean II */ struct ias_value* irias_new_octseq_value(__u8 *octseq, int len)
{ struct ias_value *value; value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC); if (value == NULL) { IRDA_WARNING("%s: Unable to kmalloc!\n", __func__); return NULL; } value->type = IAS_OCT_SEQ; if(len > IAS_MAX_OCTET_STRING) len = IAS_MAX_OCTET_STRING; value->len = len; value->t.oct_seq = kmemdup(octseq, len, GFP_ATOMIC); if (value->t.oct_seq == NULL){ IRDA_WARNING("%s: Unable to kmalloc!\n", __func__); kfree(value); return NULL; } return value; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Fills each I2S_InitStruct member with its default value. */
void I2S_StructInit(I2S_InitTypeDef *I2S_InitStruct)
/* Fills each I2S_InitStruct member with its default value. */ void I2S_StructInit(I2S_InitTypeDef *I2S_InitStruct)
{ I2S_InitStruct->I2S_Mode = I2S_Mode_SlaveTx; I2S_InitStruct->I2S_Standard = I2S_Standard_Phillips; I2S_InitStruct->I2S_DataFormat = I2S_DataFormat_16b; I2S_InitStruct->I2S_MCLKOutput = I2S_MCLKOutput_Disable; I2S_InitStruct->I2S_AudioFreq = I2S_AudioFreq_Default; I2S_InitStruct->I2S_CPOL = I2S_CPOL_Low; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness */
void hmac_sha_begin(hmac_ctx cx[1])
/* This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness */ void hmac_sha_begin(hmac_ctx cx[1])
{ memset(cx, 0, sizeof(hmac_ctx)); }
DC-SWAT/DreamShell
C++
null
404
/* WUSB has an extra bExplicit field - we assume always explicit negotiation so this field is set. The command expected by the device is thus larger than the one prepared by the driver so we need to reallocate memory to accommodate this. We trust the driver to send us the correct data so no checking is done on incoming data - evn though it is variable length. */
static int hwarc_filter_cmd_set_drp_ie_WUSB_0100(struct uwb_rc *rc, struct uwb_rccb **header, size_t *size)
/* WUSB has an extra bExplicit field - we assume always explicit negotiation so this field is set. The command expected by the device is thus larger than the one prepared by the driver so we need to reallocate memory to accommodate this. We trust the driver to send us the correct data so no checking is done on incoming data - evn though it is variable length. */ static int hwarc_filter_cmd_set_drp_ie_WUSB_0100(struct uwb_rc *rc, struct uwb_rccb **header, size_t *size)
{ struct uwb_rc_cmd_set_drp_ie *orgcmd; struct uwb_rc_cmd_set_drp_ie_WUSB_0100 *cmd; size_t ielength; orgcmd = container_of(*header, struct uwb_rc_cmd_set_drp_ie, rccb); ielength = le16_to_cpu(orgcmd->wIELength); cmd = kzalloc(sizeof(*cmd) + ielength, GFP_KERNEL); if (cmd == NULL) return -ENOMEM; cmd->rccb = orgcmd->rccb; cmd->bExplicit = 0; cmd->wIELength = orgcmd->wIELength; memcpy(cmd->IEData, orgcmd->IEData, ielength); *header = &cmd->rccb; *size = sizeof(*cmd) + ielength; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* hw - Struct containing variables accessed by shared code */
int atl1e_read_mac_addr(struct atl1e_hw *hw)
/* hw - Struct containing variables accessed by shared code */ int atl1e_read_mac_addr(struct atl1e_hw *hw)
{ int err = 0; err = atl1e_get_permanent_address(hw); if (err) return AT_ERR_EEPROM; memcpy(hw->mac_addr, hw->perm_mac_addr, sizeof(hw->perm_mac_addr)); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* NOTE : the dentry must have been dget()'ed */
static void cgroup_d_remove_dir(struct dentry *dentry)
/* NOTE : the dentry must have been dget()'ed */ static void cgroup_d_remove_dir(struct dentry *dentry)
{ cgroup_clear_directory(dentry); spin_lock(&dcache_lock); list_del_init(&dentry->d_u.d_child); spin_unlock(&dcache_lock); remove_dir(dentry); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting input from a file. */
EFI_STATUS CloseSimpleTextInOnFile(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn)
/* Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting input from a file. */ EFI_STATUS CloseSimpleTextInOnFile(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn)
{ EFI_STATUS Status; EFI_STATUS Status1; if (SimpleTextIn == NULL) { return (EFI_INVALID_PARAMETER); } Status = gBS->CloseEvent (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey); Status1 = gBS->UninstallProtocolInterface ( ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->TheHandle, &gEfiSimpleTextInProtocolGuid, &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn) ); FreePool (SimpleTextIn); if (!EFI_ERROR (Status)) { return (Status1); } else { return (Status); } }
tianocore/edk2
C++
Other
4,240
/* Obtains a 16-bit value from a byte buffer taking into account Intel or Motorola byte ordering. */
static uint16_t XcpLoaderGetOrderedWord(uint8_t const *data)
/* Obtains a 16-bit value from a byte buffer taking into account Intel or Motorola byte ordering. */ static uint16_t XcpLoaderGetOrderedWord(uint8_t const *data)
{ uint16_t result = 0; assert(data != NULL); if (data != NULL) { if (xcpSlaveIsIntel) { result |= (uint16_t)data[0]; result |= (uint16_t)(data[1] << 8); } else { result |= (uint16_t)data[1]; result |= (uint16_t)(data[0] << 8); } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* offset and len must be aligned on write-block-size for write, positive and not beyond end of flash */
bool flash_stm32_valid_range(const struct device *dev, off_t offset, uint32_t len, bool write)
/* offset and len must be aligned on write-block-size for write, positive and not beyond end of flash */ bool flash_stm32_valid_range(const struct device *dev, off_t offset, uint32_t len, bool write)
{ if (stm32_flash_has_2_banks(dev) && (CONFIG_FLASH_SIZE < STM32_SERIES_MAX_FLASH)) { if ((offset < BANK2_OFFSET) && (offset + len > FLASH_SIZE / 2)) { return 0; } } if (write && !flash_stm32_valid_write(offset, len)) { return false; } return flash_stm32_range_exists(dev, offset, len); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Convert an s-floating point value in memory format to the corresponding value in register format. The exponent needs to be remapped to preserve non-finite values (infinities, not-a-numbers, denormals). */
static unsigned long s_mem_to_reg(unsigned long s_mem)
/* Convert an s-floating point value in memory format to the corresponding value in register format. The exponent needs to be remapped to preserve non-finite values (infinities, not-a-numbers, denormals). */ static unsigned long s_mem_to_reg(unsigned long s_mem)
{ unsigned long frac = (s_mem >> 0) & 0x7fffff; unsigned long sign = (s_mem >> 31) & 0x1; unsigned long exp_msb = (s_mem >> 30) & 0x1; unsigned long exp_low = (s_mem >> 23) & 0x7f; unsigned long exp; exp = (exp_msb << 10) | exp_low; if (exp_msb) { if (exp_low == 0x7f) { exp = 0x7ff; } } else { if (exp_low == 0x00) { exp = 0x000; } else { exp |= (0x7 << 7); } } return (sign << 63) | (exp << 52) | (frac << 29); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* In theory, we can also make this work by prepending a struct that looks similar to the block link struct used by the heap allocator itself, which will allow inspection tools relying on any block returned from any sort of malloc to have such a block in front of it, work. We may do this later, if/when there is demand for it. For now, a simple pointer is used. */
static IRAM_ATTR void* dram_alloc_to_iram_addr(void *addr, size_t len)
/* In theory, we can also make this work by prepending a struct that looks similar to the block link struct used by the heap allocator itself, which will allow inspection tools relying on any block returned from any sort of malloc to have such a block in front of it, work. We may do this later, if/when there is demand for it. For now, a simple pointer is used. */ static IRAM_ATTR void* dram_alloc_to_iram_addr(void *addr, size_t len)
{ uint32_t dstart = (int)addr; uint32_t dend = ((int)addr) + len - 4; assert(dstart >= SOC_DIRAM_DRAM_LOW); assert(dend <= SOC_DIRAM_DRAM_HIGH); assert((dstart & 3) == 0); assert((dend & 3) == 0); uint32_t istart = SOC_DIRAM_IRAM_LOW + (SOC_DIRAM_DRAM_HIGH - dend); uint32_t *iptr = (uint32_t *)istart; *iptr = dstart; return (void *)(iptr + 1); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* These variants are significantly slower, but allows control over the entire 32-bit GPR set. */
static void __rdmsr_safe_regs_on_cpu(void *info)
/* These variants are significantly slower, but allows control over the entire 32-bit GPR set. */ static void __rdmsr_safe_regs_on_cpu(void *info)
{ struct msr_regs_info *rv = info; rv->err = rdmsr_safe_regs(rv->regs); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reset a SNI machine. This routine reboots the machine by asking the keyboard controller to pulse the reset-line low. We try that for a while, and if it doesn't work, we do some other stupid things. */
static void kb_wait(void)
/* Reset a SNI machine. This routine reboots the machine by asking the keyboard controller to pulse the reset-line low. We try that for a while, and if it doesn't work, we do some other stupid things. */ static void kb_wait(void)
{ int i; for (i = 0; i < 0x10000; i++) if ((inb_p(0x64) & 0x02) == 0) break; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function called from I2C IRQ Handler when TXE flag is set Function is in charge of transmit a byte on I2C lines. */
void Slave_Ready_To_Transmit_Callback(void)
/* Function called from I2C IRQ Handler when TXE flag is set Function is in charge of transmit a byte on I2C lines. */ void Slave_Ready_To_Transmit_Callback(void)
{ ubNbDataToTransmit--; if(ubNbDataToTransmit == 0) { LL_I2C_DisableIT_BUF(I2C1); } LL_I2C_TransmitData8(I2C1, SLAVE_BYTE_TO_SEND); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Configures the high and low thresholds of the analog watchdog. */
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
/* Configures the high and low thresholds of the analog watchdog. */ void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
{ uint32_t tempThreshold; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_THRESHOLD(HighThreshold)); assert_param(IS_ADC_THRESHOLD(LowThreshold)); tempThreshold = HighThreshold; ADCx->ADCMPR = (tempThreshold<<16) | LowThreshold; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* index - The alias index (also DM seq number) disable - If non-zero, ignore sent packets and don't send mock response */
void sandbox_eth_disable_response(int index, bool disable)
/* index - The alias index (also DM seq number) disable - If non-zero, ignore sent packets and don't send mock response */ void sandbox_eth_disable_response(int index, bool disable)
{ struct udevice *dev; struct eth_sandbox_priv *priv; int ret; ret = uclass_get_device(UCLASS_ETH, index, &dev); if (ret) return; priv = dev_get_priv(dev); priv->disabled = disable; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Free resources claimed by sym_iomap_device(). Note that sym_free_resources() should be used instead of this function after calling sym_attach(). */
static void __devinit sym_iounmap_device(struct sym_device *device)
/* Free resources claimed by sym_iomap_device(). Note that sym_free_resources() should be used instead of this function after calling sym_attach(). */ static void __devinit sym_iounmap_device(struct sym_device *device)
{ if (device->s.ioaddr) pci_iounmap(device->pdev, device->s.ioaddr); if (device->s.ramaddr) pci_iounmap(device->pdev, device->s.ramaddr); }
robutest/uclinux
C++
GPL-2.0
60
/* Turns off the LCD controller and LCD host controller. */
static int tmiofb_hw_stop(struct platform_device *dev)
/* Turns off the LCD controller and LCD host controller. */ static int tmiofb_hw_stop(struct platform_device *dev)
{ struct mfd_cell *cell = dev->dev.platform_data; struct tmio_fb_data *data = cell->driver_data; struct fb_info *info = platform_get_drvdata(dev); struct tmiofb_par *par = info->par; tmio_iowrite16(0, par->ccr + CCR_UGCC); tmio_iowrite16(0, par->lcr + LCR_GM); data->lcd_set_power(dev, 0); tmio_iowrite16(0x0010, par->lcr + LCR_LCDCCRC); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the FLASH PC Read/Write Protection Option Bytes value. */
uint16_t FLASH_OB_GetPCROP1(void)
/* Returns the FLASH PC Read/Write Protection Option Bytes value. */ uint16_t FLASH_OB_GetPCROP1(void)
{ return (*(__IO uint16_t *)(OPTCR1_BYTE2_ADDRESS)); }
MaJerle/stm32f429
C++
null
2,036
/* Schedules a request for an IN transaction on an endpoint in host mode. */
void USBHostRequestIN(uint32_t ui32Base, uint32_t ui32Endpoint)
/* Schedules a request for an IN transaction on an endpoint in host mode. */ void USBHostRequestIN(uint32_t ui32Base, uint32_t ui32Endpoint)
{ uint32_t ui32Register; ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7)); if(ui32Endpoint == USB_EP_0) { ui32Register = USB_O_CSRL0; } else { ui32Register = USB_O_RXCSRL1 + EP_OFFSET(ui32Endpoint); } HWREGB(ui32Base + ui32Register) = USB_RXCSRL1_REQPKT; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Checks whether FCB sector contains data or not. Returns <0 in error. Returns 0 if sector is unused; Returns 1 if sector has data. */
int fcb_sector_hdr_read(struct fcb *fcb, struct flash_sector *sector, struct fcb_disk_area *fdap)
/* Checks whether FCB sector contains data or not. Returns <0 in error. Returns 0 if sector is unused; Returns 1 if sector has data. */ int fcb_sector_hdr_read(struct fcb *fcb, struct flash_sector *sector, struct fcb_disk_area *fdap)
{ struct fcb_disk_area fda; int rc; if (!fdap) { fdap = &fda; } rc = fcb_flash_read(fcb, sector, 0, fdap, sizeof(*fdap)); if (rc) { return -EIO; } if (fdap->fd_magic == MK32(fcb->f_erase_value)) { return 0; } if (fdap->fd_magic != fcb_flash_magic(fcb)) { return -ENOMSG; } return 1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Sets the @attribute to contain the given @attr_value, if possible. */
void g_file_info_set_attribute_int32(GFileInfo *info, const char *attribute, gint32 attr_value)
/* Sets the @attribute to contain the given @attr_value, if possible. */ void g_file_info_set_attribute_int32(GFileInfo *info, const char *attribute, gint32 attr_value)
{ g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); _g_file_info_set_attribute_int32_by_id (info, lookup_attribute (attribute), attr_value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* BusLogic_InitializeHostStructure initializes the fields in the SCSI Host structure. The base, io_port, n_io_ports, irq, and dma_channel fields in the SCSI Host structure are intentionally left uninitialized, as this driver handles acquisition and release of these resources explicitly, as well as ensuring exclusive access to the Host Adapter hardware and data structures through explicit acquisition and release of the Host Adapter's Lock. */
static void __init BusLogic_InitializeHostStructure(struct BusLogic_HostAdapter *HostAdapter, struct Scsi_Host *Host)
/* BusLogic_InitializeHostStructure initializes the fields in the SCSI Host structure. The base, io_port, n_io_ports, irq, and dma_channel fields in the SCSI Host structure are intentionally left uninitialized, as this driver handles acquisition and release of these resources explicitly, as well as ensuring exclusive access to the Host Adapter hardware and data structures through explicit acquisition and release of the Host Adapter's Lock. */ static void __init BusLogic_InitializeHostStructure(struct BusLogic_HostAdapter *HostAdapter, struct Scsi_Host *Host)
{ Host->max_id = HostAdapter->MaxTargetDevices; Host->max_lun = HostAdapter->MaxLogicalUnits; Host->max_channel = 0; Host->unique_id = HostAdapter->IO_Address; Host->this_id = HostAdapter->SCSI_ID; Host->can_queue = HostAdapter->DriverQueueDepth; Host->sg_tablesize = HostAdapter->DriverScatterGatherLimit; Host->unchecked_isa_dma = HostAdapter->BounceBuffersRequired; Host->cmd_per_lun = HostAdapter->UntaggedQueueDepth; }
robutest/uclinux
C++
GPL-2.0
60
/* Resume channel program if the channel is suspended. */
static int __lcs_resume_channel(struct lcs_channel *channel)
/* Resume channel program if the channel is suspended. */ static int __lcs_resume_channel(struct lcs_channel *channel)
{ int rc; if (channel->state != LCS_CH_STATE_SUSPENDED) return 0; if (channel->ccws[channel->io_idx].flags & CCW_FLAG_SUSPEND) return 0; LCS_DBF_TEXT_(5, trace, "rsch%s", dev_name(&channel->ccwdev->dev)); rc = ccw_device_resume(channel->ccwdev); if (rc) { LCS_DBF_TEXT_(4, trace, "ersc%s", dev_name(&channel->ccwdev->dev)); dev_err(&channel->ccwdev->dev, "Sending data from the LCS device to the LAN failed" " with rc=%d\n",rc); } else channel->state = LCS_CH_STATE_RUNNING; return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Disables the timer/counter for a PWM generator block. */
void PWMGenDisable(uint32_t ui32Base, uint32_t ui32Gen)
/* Disables the timer/counter for a PWM generator block. */ void PWMGenDisable(uint32_t ui32Base, uint32_t ui32Gen)
{ ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE)); ASSERT(_PWMGenValid(ui32Gen)); HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_CTL) &= ~(PWM_X_CTL_ENABLE); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */
FLASH_Status FLASH_UserOptionByteConfig(OB_IWDG_TypeDef ob_iwdg, OB_STOP_TypeDef ob_stop, OB_STDBY_TypeDef standby)
/* Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */ FLASH_Status FLASH_UserOptionByteConfig(OB_IWDG_TypeDef ob_iwdg, OB_STOP_TypeDef ob_stop, OB_STDBY_TypeDef standby)
{ FLASH_OPTB_Enable(); FLASH->CR |= FLASH_CR_OPTPG; OB->USER = ob_iwdg; OB->USER |= ob_stop; OB->USER |= standby; OB->USER |= 0xF8; return FLASH_WaitForLastOperation(ProgramTimeout); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SYSCTRL HRPWM Bus&Function Clock Disable and Reset Assert. */
void LL_SYSCTRL_HRPWM_ClkDisRstAssert(void)
/* SYSCTRL HRPWM Bus&Function Clock Disable and Reset Assert. */ void LL_SYSCTRL_HRPWM_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_HRPWMBusClk_Dis(SYSCTRL); __LL_SYSCTRL_HRPWMFunClk_Dis(SYSCTRL); __LL_SYSCTRL_HRPWMSoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Compute power spectrum of a half-complex (packed) vector and accumulate */
static void power_spectrum_accum(const spx_word16_t *X, spx_word32_t *ps, int N)
/* Compute power spectrum of a half-complex (packed) vector and accumulate */ static void power_spectrum_accum(const spx_word16_t *X, spx_word32_t *ps, int N)
{ int i, j; ps[0]+=MULT16_16(X[0],X[0]); for (i=1,j=1;i<N-1;i+=2,j++) { ps[j] += MULT16_16(X[i],X[i]) + MULT16_16(X[i+1],X[i+1]); } ps[j]+=MULT16_16(X[i],X[i]); }
ua1arn/hftrx
C++
null
69
/* Toggles bits in the data register of the GPIO pin bank. Toggles bits in the data register of the current GPIO pin bank as a read-modify-write operation. All bits set in the bit mask provided by the caller are XOR'ed into the current data word of the bank. This operation has no effect on the values associated with pins configured as inputs. */
static int gpio_xlnx_ps_bank_toggle_bits(const struct device *dev, gpio_port_pins_t pins)
/* Toggles bits in the data register of the GPIO pin bank. Toggles bits in the data register of the current GPIO pin bank as a read-modify-write operation. All bits set in the bit mask provided by the caller are XOR'ed into the current data word of the bank. This operation has no effect on the values associated with pins configured as inputs. */ static int gpio_xlnx_ps_bank_toggle_bits(const struct device *dev, gpio_port_pins_t pins)
{ const struct gpio_xlnx_ps_bank_dev_cfg *dev_conf = dev->config; uint32_t bank_data; bank_data = sys_read32(GPIO_XLNX_PS_BANK_DATA_REG); bank_data ^= pins; sys_write32(bank_data, GPIO_XLNX_PS_BANK_DATA_REG); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port 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(). */
UINT16 EFIAPI IoBitFieldRead16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port 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(). */ UINT16 EFIAPI IoBitFieldRead16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
{ return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit); }
tianocore/edk2
C++
Other
4,240
/* If it's our own child, there is no notification to do. But if our normal children self-reap, then this child was prevented by ptrace and we must reap it now, in that case we must also wake up sub-threads sleeping in do_wait(). */
static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
/* If it's our own child, there is no notification to do. But if our normal children self-reap, then this child was prevented by ptrace and we must reap it now, in that case we must also wake up sub-threads sleeping in do_wait(). */ static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
{ __ptrace_unlink(p); if (p->exit_state == EXIT_ZOMBIE) { if (!task_detached(p) && thread_group_empty(p)) { if (!same_thread_group(p->real_parent, tracer)) do_notify_parent(p, p->exit_signal); else if (ignoring_children(tracer->sighand)) { __wake_up_parent(p, tracer); p->exit_signal = -1; } } if (task_detached(p)) { p->exit_state = EXIT_DEAD; return true; } } return false; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ql_is_neg_pause() returns 1 if pause was negotiated to be on */
static int ql_is_neg_pause(struct ql3_adapter *qdev)
/* ql_is_neg_pause() returns 1 if pause was negotiated to be on */ static int ql_is_neg_pause(struct ql3_adapter *qdev)
{ if (ql_is_fiber(qdev)) return ql_is_petbi_neg_pause(qdev); else return ql_is_phy_neg_pause(qdev); }
robutest/uclinux
C++
GPL-2.0
60
/* Write a value to a register in an TCM825X sensor device. Returns zero if successful, or non-zero otherwise. */
static int tcm825x_write_reg(struct i2c_client *client, u8 reg, u8 val)
/* Write a value to a register in an TCM825X sensor device. Returns zero if successful, or non-zero otherwise. */ static int tcm825x_write_reg(struct i2c_client *client, u8 reg, u8 val)
{ int err; struct i2c_msg msg[1]; unsigned char data[2]; if (!client->adapter) return -ENODEV; msg->addr = client->addr; msg->flags = 0; msg->len = 2; msg->buf = data; data[0] = reg; data[1] = val; err = i2c_transfer(client->adapter, msg, 1); if (err >= 0) return 0; return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the ADC peripheral registers to their default reset values. */
void ADC_Reset(void)
/* Set the ADC peripheral registers to their default reset values. */ void ADC_Reset(void)
{ RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC1); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC1); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Check if the port can be used for TOD synchronization. For PPS mode the port has to receive OTEs. For ETR mode the port has to receive OTEs, the ETR stepping bit has to be zero and the validity bits for data frame 1, 2, and 3 have to be 1. */
static int etr_port_valid(struct etr_aib *aib, int port)
/* Check if the port can be used for TOD synchronization. For PPS mode the port has to receive OTEs. For ETR mode the port has to receive OTEs, the ETR stepping bit has to be zero and the validity bits for data frame 1, 2, and 3 have to be 1. */ static int etr_port_valid(struct etr_aib *aib, int port)
{ unsigned int psc; if (aib->tsp == 0) return 0; psc = port ? aib->esw.psc1 : aib->esw.psc0; if (psc == etr_lpsc_pps_mode) return 1; if (psc == etr_lpsc_operational_step) return !aib->esw.y && aib->slsw.v1 && aib->slsw.v2 && aib->slsw.v3; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Switch high speed to high performance, set the drive ability. */
int32_t PWC_HighSpeedToHighPerformance(void)
/* Switch high speed to high performance, set the drive ability. */ int32_t PWC_HighSpeedToHighPerformance(void)
{ DDL_ASSERT(IS_PWC_UNLOCKED()); MODIFY_REG8(CM_PWC->PWRC2, PWC_PWRC2_DDAS | PWC_PWRC2_DVS, PWC_PWRC2_DDAS); WRITE_REG8(CM_PWC->MDSWCR, PWC_MD_SWITCH_CMD); DDL_DelayUS(PWC_MD_SWITCH_TIMEOUT); return LL_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Command response callback function for sd_ble_gap_rssi_start BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_rssi_start_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_rssi_start BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_rssi_start_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_rssi_start_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* param base TDET peripheral base address param mask Bit mask for the flag bits to be cleared. Use tdet_status_flag_t to encode flags. return kStatus_Fail when Status Register writing is not allowed return kStatus_Success when mask is written to the Status Register */
status_t TDET_ClearStatusFlags(DIGTMP_Type *base, uint32_t mask)
/* param base TDET peripheral base address param mask Bit mask for the flag bits to be cleared. Use tdet_status_flag_t to encode flags. return kStatus_Fail when Status Register writing is not allowed return kStatus_Success when mask is written to the Status Register */ status_t TDET_ClearStatusFlags(DIGTMP_Type *base, uint32_t mask)
{ status_t status; if (tdet_IsRegisterWriteAllowed(base, DIGTMP_LR_SRL_MASK)) { base->SR = mask; status = kStatus_Success; } else { status = kStatus_Fail; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initiates a reads packet operation. The I2C_SLAVE_CALLBACK_WRITE_REQUEST callback can be used to call this function. */
enum status_code i2c_slave_read_packet_job(struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
/* Initiates a reads packet operation. The I2C_SLAVE_CALLBACK_WRITE_REQUEST callback can be used to call this function. */ enum status_code i2c_slave_read_packet_job(struct i2c_slave_module *const module, struct i2c_slave_packet *const packet)
{ Assert(module); Assert(module->hw); Assert(packet); I2c *const i2c_module = module->hw; if (module->buffer_remaining > 0) { return STATUS_BUSY; } module->buffer = packet->data; module->buffer_remaining = packet->data_length; module->buffer_length = packet->data_length; module->status = STATUS_BUSY; i2c_slave_rx_interrupt(i2c_module, true); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Returns a new xmlChar *, the original @cur is reallocated if needed and should not be freed */
xmlChar* xmlStrncat(xmlChar *cur, const xmlChar *add, int len)
/* Returns a new xmlChar *, the original @cur is reallocated if needed and should not be freed */ xmlChar* xmlStrncat(xmlChar *cur, const xmlChar *add, int len)
{ xmlErrMemory(NULL, NULL); return(cur); } memcpy(&ret[size], add, len * sizeof(xmlChar)); ret[size + len] = 0; return(ret); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentBitFieldRead32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT32 EFIAPI S3PciSegmentBitFieldRead32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit)
{ return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldRead32 (Address, StartBit, EndBit)); }
tianocore/edk2
C++
Other
4,240
/* RETURN VALUES erp 'new' erp_head - pointer to new ERP */
static struct dasd_ccw_req* dasd_3990_erp_com_rej(struct dasd_ccw_req *erp, char *sense)
/* RETURN VALUES erp 'new' erp_head - pointer to new ERP */ static struct dasd_ccw_req* dasd_3990_erp_com_rej(struct dasd_ccw_req *erp, char *sense)
{ struct dasd_device *device = erp->startdev; erp->function = dasd_3990_erp_com_rej; if (sense[2] & SNS2_ENV_DATA_PRESENT) { DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Command Reject - environmental data present"); dasd_3990_handle_env_data(erp, sense); erp->retries = 5; } else { dev_err(&device->cdev->dev, "An error occurred in the DASD " "device driver, reason=%s\n", "09"); erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); } return erp; }
robutest/uclinux
C++
GPL-2.0
60
/* qla2x00_flash_disable() - Disable flash and allow RISC to run. @ha: HA context */
static void qla2x00_flash_disable(struct qla_hw_data *ha)
/* qla2x00_flash_disable() - Disable flash and allow RISC to run. @ha: HA context */ static void qla2x00_flash_disable(struct qla_hw_data *ha)
{ uint16_t data; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; data = RD_REG_WORD(&reg->ctrl_status); data &= ~(CSR_FLASH_ENABLE); WRT_REG_WORD(&reg->ctrl_status, data); RD_REG_WORD(&reg->ctrl_status); }
robutest/uclinux
C++
GPL-2.0
60
/* We do not want to reinitialize - the internal kobj should not change as it still points to the parent received during setup. The mutex should remain also. We thus just reset values individually. The virutal address assigned to WSS will remain the same for the lifetime of the WSS. We only reset the fields that can change during its lifetime. */
void wlp_wss_reset(struct wlp_wss *wss)
/* We do not want to reinitialize - the internal kobj should not change as it still points to the parent received during setup. The mutex should remain also. We thus just reset values individually. The virutal address assigned to WSS will remain the same for the lifetime of the WSS. We only reset the fields that can change during its lifetime. */ void wlp_wss_reset(struct wlp_wss *wss)
{ memset(&wss->wssid, 0, sizeof(wss->wssid)); wss->hash = 0; memset(&wss->name[0], 0, sizeof(wss->name)); memset(&wss->bcast, 0, sizeof(wss->bcast)); wss->secure_status = WLP_WSS_UNSECURE; memset(&wss->master_key[0], 0, sizeof(wss->master_key)); wss->tag = 0; wss->state = WLP_WSS_STATE_NONE; }
robutest/uclinux
C++
GPL-2.0
60
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean xSPIIsTxEmpty(unsigned long ulBase)
/* Check the status of the Tx buffer of the specified SPI port. */ xtBoolean xSPIIsTxEmpty(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); return ((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_TX_EMPTY)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Note: this function unregisters this driver from the scsi mid-level. */
static void __exit exit_sd(void)
/* Note: this function unregisters this driver from the scsi mid-level. */ static void __exit exit_sd(void)
{ int i; SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n")); mempool_destroy(sd_cdb_pool); kmem_cache_destroy(sd_cdb_cache); scsi_unregister_driver(&sd_template.gendrv); class_unregister(&sd_disk_class); for (i = 0; i < SD_MAJORS; i++) unregister_blkdev(sd_major(i), "sd"); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the IBASE/IMASK registers for LBA (Elroy). Only called from sba_iommu.c in order to route ranges (MMIO vs DMA). sba_iommu is responsible for locking (none needed at init time). */
void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
/* Initialize the IBASE/IMASK registers for LBA (Elroy). Only called from sba_iommu.c in order to route ranges (MMIO vs DMA). sba_iommu is responsible for locking (none needed at init time). */ void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
{ lba_next_bus = lba_bus->subordinate + 1; pci_bus_add_devices(lba_bus); } return 0; } static struct parisc_device_id lba_tbl[] = { { HPHW_BRIDGE, HVERSION_REV_ANY_ID, ELROY_HVERS, 0xa }, { HPHW_BRIDGE, HVERSION_REV_ANY_ID, MERCURY_HVERS, 0xa }, { HPHW_BRIDGE, HVERSION_REV_ANY_ID, QUICKSILVER_HVERS, 0xa }, { 0, } }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART eDMA transfer structure. See #lpuart_transfer_t. retval kStatus_Success if succeed, others failed. retval kStatus_LPUART_TxBusy Previous transfer on going. retval kStatus_InvalidArgument Invalid argument. */
status_t LPUART_SendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART eDMA transfer structure. See #lpuart_transfer_t. retval kStatus_Success if succeed, others failed. retval kStatus_LPUART_TxBusy Previous transfer on going. retval kStatus_InvalidArgument Invalid argument. */ status_t LPUART_SendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
{ assert(handle); assert(handle->txEdmaHandle); assert(xfer); assert(xfer->data); assert(xfer->dataSize); edma_transfer_config_t xferConfig; status_t status; if (kLPUART_TxBusy == handle->txState) { status = kStatus_LPUART_TxBusy; } else { handle->txState = kLPUART_TxBusy; handle->txDataSizeAll = xfer->dataSize; EDMA_PrepareTransfer(&xferConfig, xfer->data, sizeof(uint8_t), (void *)LPUART_GetDataRegisterAddress(base), sizeof(uint8_t), sizeof(uint8_t), xfer->dataSize, kEDMA_MemoryToPeripheral); handle->nbytes = sizeof(uint8_t); EDMA_SubmitTransfer(handle->txEdmaHandle, &xferConfig); EDMA_StartTransfer(handle->txEdmaHandle); LPUART_EnableTxDMA(base, true); status = kStatus_Success; } return status; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Returns the clock source for the specified timer module. */
uint32_t TimerClockSourceGet(uint32_t ui32Base)
/* Returns the clock source for the specified timer module. */ uint32_t TimerClockSourceGet(uint32_t ui32Base)
{ ASSERT(_TimerBaseValid(ui32Base)); return (HWREG(ui32Base + TIMER_O_CC)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get elapsed time since last user activity on a display (e.g. click) */
uint32_t lv_disp_get_inactive_time(const lv_disp_t *disp)
/* Get elapsed time since last user activity on a display (e.g. click) */ uint32_t lv_disp_get_inactive_time(const lv_disp_t *disp)
{ if(disp) return lv_tick_elaps(disp->last_activity_time); lv_disp_t * d; uint32_t t = UINT32_MAX; d = lv_disp_get_next(NULL); while(d) { uint32_t elaps = lv_tick_elaps(d->last_activity_time); t = LV_MIN(t, elaps); d = lv_disp_get_next(d); } return t; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function sets up the pixel skip setting of the Generator in the VTC core. */
void XVtc_SetSkipPixel(XVtc *InstancePtr, int GeneratorChromaSkip)
/* This function sets up the pixel skip setting of the Generator in the VTC core. */ void XVtc_SetSkipPixel(XVtc *InstancePtr, int GeneratorChromaSkip)
{ u32 FrameEncodeRegValue; Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == (u32)(XIL_COMPONENT_IS_READY)); FrameEncodeRegValue = XVtc_ReadReg(InstancePtr->Config.BaseAddress, (XVTC_GFENC_OFFSET)); FrameEncodeRegValue &= (u32)(~(XVTC_ENC_GACPS_MASK)); if (GeneratorChromaSkip) FrameEncodeRegValue |= XVTC_ENC_GACPS_MASK; XVtc_WriteReg(InstancePtr->Config.BaseAddress, (XVTC_GFENC_OFFSET), FrameEncodeRegValue); }
ua1arn/hftrx
C++
null
69
/* iterate over the dependent device list for this dock. If the dependent device matches the handle, return. */
static struct dock_dependent_device* find_dock_dependent_device(struct dock_station *ds, acpi_handle handle)
/* iterate over the dependent device list for this dock. If the dependent device matches the handle, return. */ static struct dock_dependent_device* find_dock_dependent_device(struct dock_station *ds, acpi_handle handle)
{ struct dock_dependent_device *dd; spin_lock(&ds->dd_lock); list_for_each_entry(dd, &ds->dependent_devices, list) { if (handle == dd->handle) { spin_unlock(&ds->dd_lock); return dd; } } spin_unlock(&ds->dd_lock); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* cpuidle_register_driver - registers a driver @drv: the driver */
int cpuidle_register_driver(struct cpuidle_driver *drv)
/* cpuidle_register_driver - registers a driver @drv: the driver */ int cpuidle_register_driver(struct cpuidle_driver *drv)
{ if (!drv) return -EINVAL; spin_lock(&cpuidle_driver_lock); if (cpuidle_curr_driver) { spin_unlock(&cpuidle_driver_lock); return -EBUSY; } cpuidle_curr_driver = drv; spin_unlock(&cpuidle_driver_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Music player callback to get the current song path. */
static const char* get_current_song_path(void *arg_p)
/* Music player callback to get the current song path. */ static const char* get_current_song_path(void *arg_p)
{ struct song_t *song_p; sem_take(&sem, NULL); song_p = hash_map_get(&song_map, current_song); sem_give(&sem, 1); return (song_p->name); }
eerimoq/simba
C++
Other
337
/* If there is no data in the receive FIFO, then this function will return immediately without reading any data from the FIFO. */
long I2SRxDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
/* If there is no data in the receive FIFO, then this function will return immediately without reading any data from the FIFO. */ long I2SRxDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
{ ASSERT(ulBase == I2S0_BASE); if(HWREG(ulBase + I2S_O_RXLEV) != 0) { *pulData = HWREG(ulBase + I2S_O_RXFIFO); return(1); } else { return(0); } }
watterott/WebRadio
C++
null
71
/* Note : the ISR execute entironment : CPU disable interrupt response. */
s32 install_isr(u32 intno, __pISR_hdle_t pisr, void *parg)
/* Note : the ISR execute entironment : CPU disable interrupt response. */ s32 install_isr(u32 intno, __pISR_hdle_t pisr, void *parg)
{ isr_table[intno].pisr = pisr; isr_table[intno].parg = parg; return OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the number of bytes of data available in the circular buffer. */
static unsigned int cypress_buf_data_avail(struct cypress_buf *cb)
/* Return the number of bytes of data available in the circular buffer. */ static unsigned int cypress_buf_data_avail(struct cypress_buf *cb)
{ if (cb != NULL) return (cb->buf_size + cb->buf_put - cb->buf_get) % cb->buf_size; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function accumulates the status into the private devstat and starts a basic sense if one is needed. */
int ccw_device_accumulate_and_sense(struct ccw_device *cdev, struct irb *irb)
/* This function accumulates the status into the private devstat and starts a basic sense if one is needed. */ int ccw_device_accumulate_and_sense(struct ccw_device *cdev, struct irb *irb)
{ ccw_device_accumulate_irb(cdev, irb); if ((irb->scsw.cmd.actl & (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) != 0) return -EBUSY; if (cdev->private->flags.dosense && !(irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK)) { cdev->private->irb.esw.esw0.erw.cons = 1; cdev->private->flags.dosense = 0; return 0; } if (cdev->private->flags.dosense) { ccw_device_do_sense(cdev, irb); return -EBUSY; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This is called with the whole mon_bus locked, so no additional lock. */
static char mon_text_get_setup(struct mon_event_text *ep, struct urb *urb, char ev_type, struct mon_bus *mbus)
/* This is called with the whole mon_bus locked, so no additional lock. */ static char mon_text_get_setup(struct mon_event_text *ep, struct urb *urb, char ev_type, struct mon_bus *mbus)
{ if (ep->xfertype != USB_ENDPOINT_XFER_CONTROL || ev_type != 'S') return '-'; if (urb->setup_packet == NULL) return 'Z'; memcpy(ep->setup, urb->setup_packet, SETUP_MAX); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Write USB Device Endpoint Data Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
/* Write USB Device Endpoint Data Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
{ uint32_t idx, n; EPNum &= 0x0F; idx = IDX(EPNum, TX, 0); BD[idx].bc = cnt; for (n = 0; n < cnt; n++) { EPBuf[idx][n] = pData[n]; } if ((Data1 >> (idx / 2)) & 1) { BD[idx].stat = BD_OWN_MASK | BD_DTS_MASK; } else { BD[idx].stat = BD_OWN_MASK | BD_DTS_MASK | BD_DATA01_MASK; } protected_xor(&Data1, (1 << (idx / 2))); return (cnt); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Set the dimension and the bitmap of the pointer. */
void POINTER_SetCurrentPointer(u8 width, u8 height, u8 *bmp)
/* Set the dimension and the bitmap of the pointer. */ void POINTER_SetCurrentPointer(u8 width, u8 height, u8 *bmp)
{ if( !bmp ) { bmp = BallPointerBmp; } CurrentPointerWidth = width; CurrentPointerHeight = height; CurrentPointerBmp = bmp; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Checks whether the Early Wakeup interrupt flag is set or not. */
FlagStatus WWDG_GetFlagStatus(void)
/* Checks whether the Early Wakeup interrupt flag is set or not. */ FlagStatus WWDG_GetFlagStatus(void)
{ FlagStatus bitstatus = RESET; if ((WWDG->SR) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Schedules the transmission of all queued ACL data packets to the controller. */
void ble_hs_wakeup_tx(void)
/* Schedules the transmission of all queued ACL data packets to the controller. */ void ble_hs_wakeup_tx(void)
{ struct ble_hs_conn *conn; int rc; ble_hs_lock(); for (conn = ble_hs_conn_first(); conn != NULL; conn = SLIST_NEXT(conn, bhc_next)) { if (conn->bhc_flags & BLE_HS_CONN_F_TX_FRAG) { rc = ble_hs_wakeup_tx_conn(conn); if (rc != 0) { goto done; } break; } } for (conn = ble_hs_conn_first(); conn != NULL; conn = SLIST_NEXT(conn, bhc_next)) { rc = ble_hs_wakeup_tx_conn(conn); if (rc != 0) { goto done; } } done: ble_hs_unlock(); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Get counter value of the specified TMR2 channel. */
uint32_t TMR2_GetCountValue(const CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch)
/* Get counter value of the specified TMR2 channel. */ uint32_t TMR2_GetCountValue(const CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch)
{ __IO uint32_t *reg32CNTR; DDL_ASSERT(IS_TMR2_UNIT(TMR2x)); DDL_ASSERT(IS_TMR2_CH(u32Ch)); reg32CNTR = (__IO uint32_t *)((uint32_t)&TMR2x->CNTAR); return reg32CNTR[u32Ch]; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_set_board_config_security(const struct ti_sci_handle *handle, u64 addr, u32 size)
/* Return: 0 if all went well, else returns appropriate error value. */ static int ti_sci_cmd_set_board_config_security(const struct ti_sci_handle *handle, u64 addr, u32 size)
{ return cmd_set_board_config_using_msg(handle, TI_SCI_MSG_BOARD_CONFIG_SECURITY, addr, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* ixgbe_release_eeprom - Release EEPROM, release semaphores @hw: pointer to hardware structure */
static void ixgbe_release_eeprom(struct ixgbe_hw *hw)
/* ixgbe_release_eeprom - Release EEPROM, release semaphores @hw: pointer to hardware structure */ static void ixgbe_release_eeprom(struct ixgbe_hw *hw)
{ u32 eec; eec = IXGBE_READ_REG(hw, IXGBE_EEC); eec |= IXGBE_EEC_CS; eec &= ~IXGBE_EEC_SK; IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); IXGBE_WRITE_FLUSH(hw); udelay(1); eec &= ~IXGBE_EEC_REQ; IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); ixgbe_release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); }
robutest/uclinux
C++
GPL-2.0
60
/* Validate the correctness of k_is_preempt_thread() Create a preemptive thread, lock the scheduler and call k_is_preempt_thread(). Unlock the scheduler and call k_is_preempt_thread() again. Create a cooperative thread and lock the scheduler k_is_preempt_thread() and unlock the scheduler and call k_is_preempt_thread(). */
ZTEST(threads_scheduling, test_sched_is_preempt_thread)
/* Validate the correctness of k_is_preempt_thread() Create a preemptive thread, lock the scheduler and call k_is_preempt_thread(). Unlock the scheduler and call k_is_preempt_thread() again. Create a cooperative thread and lock the scheduler k_is_preempt_thread() and unlock the scheduler and call k_is_preempt_thread(). */ ZTEST(threads_scheduling, test_sched_is_preempt_thread)
{ k_sem_init(&end_sema, 0, 1); k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE, tpreempt_ctx, NULL, NULL, NULL, K_PRIO_PREEMPT(1), 0, K_NO_WAIT); k_sem_take(&end_sema, K_FOREVER); k_thread_abort(tid); tid = k_thread_create(&tdata, tstack, STACK_SIZE, tcoop_ctx, NULL, NULL, NULL, K_PRIO_COOP(1), 0, K_NO_WAIT); k_sem_take(&end_sema, K_FOREVER); k_thread_abort(tid); irq_offload(tIsr, NULL); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* insb/w/l all read a series of bytes/words/longs from a fixed port address. However as the port address doesn't change we only need to convert the port address to real address once. */
void generic_insb(unsigned long port, void *dst, unsigned long count)
/* insb/w/l all read a series of bytes/words/longs from a fixed port address. However as the port address doesn't change we only need to convert the port address to real address once. */ void generic_insb(unsigned long port, void *dst, unsigned long count)
{ __raw_readsb(__ioport_map(port, 1), dst, count); dummy_read(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Deinitializes the USARTx peripheral registers to their default reset values. */
void USART_DeInit(USART_TypeDef *USARTx)
/* Deinitializes the USARTx peripheral registers to their default reset values. */ void USART_DeInit(USART_TypeDef *USARTx)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); if (USARTx == USART1) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE); } else { if (USARTx == USART2) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the pin mode and configures the pin for use by Timer peripheral */
void PinTypeTimer(unsigned long ulPin, unsigned long ulPinMode)
/* Sets the pin mode and configures the pin for use by Timer peripheral */ void PinTypeTimer(unsigned long ulPin, unsigned long ulPinMode)
{ PinModeSet(ulPin,ulPinMode); PinConfigSet(ulPin,PIN_STRENGTH_2MA|PIN_STRENGTH_4MA,PIN_TYPE_STD); }
micropython/micropython
C++
Other
18,334
/* Encode a short (16bits) to its 5B representation (output 20 bit) */
__STATIC_INLINE uint32_t PHY_Encode5b_Short(uint16_t val)
/* Encode a short (16bits) to its 5B representation (output 20 bit) */ __STATIC_INLINE uint32_t PHY_Encode5b_Short(uint16_t val)
{ return PHY_Encode5b_Byte(val & 0x00FF) | (PHY_Encode5b_Byte((val >> 8) & 0x00FF) << 10); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Get to know the Rx FIFO length from the specified port. */
long UARTFIFORxLength(unsigned long ulBase)
/* Get to know the Rx FIFO length from the specified port. */ long UARTFIFORxLength(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); return((xHWREG(ulBase + UART_FSR) & UART_FSR_RXP_M) >> UART_FSR_RXP_S); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If 16-bit I/O port operations are not supported, 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 S3IoBitFieldOr16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If 16-bit I/O port operations are not supported, 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 S3IoBitFieldOr16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
{ return InternalSaveIoWrite16ValueToBootScript (Port, IoBitFieldOr16 (Port, StartBit, EndBit, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Puts a byte on usart line The type int is used to support printf redirection from compiler LIB. */
int usart_putc(int value)
/* Puts a byte on usart line The type int is used to support printf redirection from compiler LIB. */ int usart_putc(int value)
{ usart_write_wait(&usart_sam_ba, (uint16_t)value); return 1; }
memfault/zero-to-main
C++
null
200
/* This function starts atomic LEB change operation. Returns zero in case of success and a negative error code in case of failure. */
int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, const struct ubi_leb_change_req *req)
/* This function starts atomic LEB change operation. Returns zero in case of success and a negative error code in case of failure. */ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, const struct ubi_leb_change_req *req)
{ ubi_assert(!vol->updating && !vol->changing_leb); dbg_msg("start changing LEB %d:%d, %u bytes", vol->vol_id, req->lnum, req->bytes); if (req->bytes == 0) return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0, req->dtype); vol->upd_bytes = req->bytes; vol->upd_received = 0; vol->changing_leb = 1; vol->ch_lnum = req->lnum; vol->ch_dtype = req->dtype; vol->upd_buf = vmalloc(req->bytes); if (!vol->upd_buf) return -ENOMEM; return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Set features in the Cadence NAND controller using PIO operations. */
static int cdns_nand_pio_set_features(uintptr_t base_address, uint8_t feat_addr, uint8_t feat_val, uint8_t thread, uint8_t vol_id)
/* Set features in the Cadence NAND controller using PIO operations. */ static int cdns_nand_pio_set_features(uintptr_t base_address, uint8_t feat_addr, uint8_t feat_val, uint8_t thread, uint8_t vol_id)
{ uint32_t status = 0; int ret = 0; ret = cdns_wait_for_thread(base_address, thread); if (ret != 0) { return ret; } sys_write32(SET_FEAT_ADDR(feat_addr), (base_address + CDNS_CMD_REG1)); sys_write32(feat_val, (base_address + CDNS_CMD_REG2)); status = CMD_0_THREAD_POS_SET(thread); status |= CMD_0_C_MODE_SET(CT_PIO_MODE); status |= PIO_CMD0_CT_SET(PIO_SET_FEA_MODE); status |= CMD_0_VOL_ID_SET(vol_id); sys_write32(status, (base_address + CDNS_CMD_REG0)); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void)
/* Resets the RCC clock configuration to the default reset state. */ void RCC_DeInit(void)
{ RCC->CR |= (uint32_t)0x00000001; RCC->CFGR &= (uint32_t)0xF8FF0000; RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CFGR &= (uint32_t)0xFF80FFFF; RCC->CIR = 0x00000000; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CRC Calculate of a Block of Data. Writes data words consecutively to the register, the write operation stalling until the computation of each word is complete. */
uint32_t crc_calculate_block(uint32_t *datap, int size)
/* CRC Calculate of a Block of Data. Writes data words consecutively to the register, the write operation stalling until the computation of each word is complete. */ uint32_t crc_calculate_block(uint32_t *datap, int size)
{ int i; for (i = 0; i < size; i++) { CRC_DR = datap[i]; } return CRC_DR; } /**@}
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnSub(IN INTN Minuend, IN INTN Subtrahend, OUT INTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnSub(IN INTN Minuend, IN INTN Subtrahend, OUT INTN *Result)
{ if (sizeof (UINTN) == sizeof (UINT32)) { return SafeInt64ToIntn (((INT64)Minuend) - ((INT64)Subtrahend), Result); } return SafeInt64Sub ((INT64)Minuend, (INT64)Subtrahend, (INT64 *)Result); }
tianocore/edk2
C++
Other
4,240
/* @ai: UBI attach info object @pnum: The PEB to be unmapped */
static void unmap_peb(struct ubi_attach_info *ai, int pnum)
/* @ai: UBI attach info object @pnum: The PEB to be unmapped */ static void unmap_peb(struct ubi_attach_info *ai, int pnum)
{ struct ubi_ainf_volume *av; struct rb_node *node, *node2; struct ubi_ainf_peb *aeb; for (node = rb_first(&ai->volumes); node; node = rb_next(node)) { av = rb_entry(node, struct ubi_ainf_volume, rb); for (node2 = rb_first(&av->root); node2; node2 = rb_next(node2)) { aeb = rb_entry(node2, struct ubi_ainf_peb, u.rb); if (aeb->pnum == pnum) { rb_erase(&aeb->u.rb, &av->root); av->leb_count--; kmem_cache_free(ai->aeb_slab_cache, aeb); return; } } } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Conversion function from the burst size to the bit encoding of the CCR */
static INLINE unsigned XDmaPs_ToBurstSizeBits(unsigned BurstSize)
/* Conversion function from the burst size to the bit encoding of the CCR */ static INLINE unsigned XDmaPs_ToBurstSizeBits(unsigned BurstSize)
{ switch (BurstSize) { case 1: return 0; case 2: return 1; case 4: return 2; case 8: return 3; case 16: return 4; case 32: return 5; case 64: return 6; case 128: return 7; default: return 0; } }
ua1arn/hftrx
C++
null
69
/* Returns whether a next tracepoint has been found (1) or not (0). Will return the first tracepoint in the range if the input tracepoint is NULL. */
int tracepoint_get_iter_range(struct tracepoint **tracepoint, struct tracepoint *begin, struct tracepoint *end)
/* Returns whether a next tracepoint has been found (1) or not (0). Will return the first tracepoint in the range if the input tracepoint is NULL. */ int tracepoint_get_iter_range(struct tracepoint **tracepoint, struct tracepoint *begin, struct tracepoint *end)
{ if (!*tracepoint && begin != end) { *tracepoint = begin; return 1; } if (*tracepoint >= begin && *tracepoint < end) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Extern function prototypes. Static function prototypes. Function definition: ixNpeMhUnsolicitedCbMgrInitialize */
void ixNpeMhUnsolicitedCbMgrInitialize(void)
/* Extern function prototypes. Static function prototypes. Function definition: ixNpeMhUnsolicitedCbMgrInitialize */ void ixNpeMhUnsolicitedCbMgrInitialize(void)
{ IxNpeMhNpeId npeId = 0; IxNpeMhUnsolicitedCallbackTable *table = NULL; IxNpeMhMessageId messageId = 0; IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Entering " "ixNpeMhUnsolicitedCbMgrInitialize\n"); for (npeId = 0; npeId < IX_NPEMH_NUM_NPES; npeId++) { table = &ixNpeMhUnsolicitedCallbackTables[npeId]; for (messageId = IX_NPEMH_MIN_MESSAGE_ID; messageId <= IX_NPEMH_MAX_MESSAGE_ID; messageId++) { table->entries[messageId] = NULL; } } IX_NPEMH_TRACE0 (IX_NPEMH_FN_ENTRY_EXIT, "Exiting " "ixNpeMhUnsolicitedCbMgrInitialize\n"); }
EmcraftSystems/u-boot
C++
Other
181
/* Link an Isochronous QH into its skeleton's list */
static void link_iso(struct uhci_hcd *uhci, struct uhci_qh *qh)
/* Link an Isochronous QH into its skeleton's list */ static void link_iso(struct uhci_hcd *uhci, struct uhci_qh *qh)
{ list_add_tail(&qh->node, &uhci->skel_iso_qh->node); }
robutest/uclinux
C++
GPL-2.0
60
/* Search the driver list for a driver that is willing to manage this device. */
int register_parisc_device(struct parisc_device *dev)
/* Search the driver list for a driver that is willing to manage this device. */ int register_parisc_device(struct parisc_device *dev)
{ if (!dev) return 0; if (dev->driver) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */
VOID* EFIAPI WriteBackInvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */ VOID* EFIAPI WriteBackInvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
{ if (RiscVIsCMOEnabled ()) { CacheOpCacheRange (Address, Length, CacheOpFlush); } else { ASSERT (FALSE); } return Address; }
tianocore/edk2
C++
Other
4,240
/* USART DMA IRQ handle function. This function handles the USART transmit idle interrupt and invoke call back. */
void USART_TransferDMAHandleIRQ(USART_Type *base, usart_dma_handle_t *handle)
/* USART DMA IRQ handle function. This function handles the USART transmit idle interrupt and invoke call back. */ void USART_TransferDMAHandleIRQ(USART_Type *base, usart_dma_handle_t *handle)
{ assert((NULL != base) && (NULL != handle)); handle->txState = (uint8_t)kUSART_TxIdle; base->INTENCLR = USART_INTENCLR_TXIDLECLR_MASK; if (handle->callback != NULL) { handle->callback(base, handle, kStatus_USART_TxIdle, handle->userData); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Free up our state ready to be removed. */
static int __devexit s3c2410ts_remove(struct platform_device *pdev)
/* Free up our state ready to be removed. */ static int __devexit s3c2410ts_remove(struct platform_device *pdev)
{ free_irq(ts.irq_tc, ts.input); del_timer_sync(&touch_timer); clk_disable(ts.clock); clk_put(ts.clock); input_unregister_device(ts.input); iounmap(ts.io); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Called from parser to finish any searches that have reached maximum results. */
static void _mdns_search_finish_done()
/* Called from parser to finish any searches that have reached maximum results. */ static void _mdns_search_finish_done()
{ mdns_search_once_t * search = _mdns_server->search_once; mdns_search_once_t * s = NULL; while (search) { s = search; search = search->next; if (s->max_results && s->num_results >= s->max_results) { _mdns_search_finish(s); } } }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This returned IO context doesn't have a specifically elevated refcount, but since the current task itself holds a reference, the context can be used in general code, so long as it stays within */
struct io_context* current_io_context(gfp_t gfp_flags, int node)
/* This returned IO context doesn't have a specifically elevated refcount, but since the current task itself holds a reference, the context can be used in general code, so long as it stays within */ struct io_context* current_io_context(gfp_t gfp_flags, int node)
{ struct task_struct *tsk = current; struct io_context *ret; ret = tsk->io_context; if (likely(ret)) return ret; ret = alloc_io_context(gfp_flags, node); if (ret) { smp_wmb(); tsk->io_context = ret; } return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retrieves the size, in bytes, of the context buffer required for AES operations. */
UINTN EFIAPI AesGetContextSize(VOID)
/* Retrieves the size, in bytes, of the context buffer required for AES operations. */ UINTN EFIAPI AesGetContextSize(VOID)
{ return (UINTN)(2 * sizeof (mbedtls_aes_context)); }
tianocore/edk2
C++
Other
4,240
/* Enable a module clock derived from the PBA clock. */
void sysclk_enable_pba_module(uint32_t module_index)
/* Enable a module clock derived from the PBA clock. */ void sysclk_enable_pba_module(uint32_t module_index)
{ irqflags_t flags; flags = cpu_irq_save(); if (PM->PM_PBAMASK == 0) { sysclk_enable_hsb_module(SYSCLK_PBA_BRIDGE); } cpu_irq_restore(flags); sysclk_priv_enable_module(PM_CLK_GRP_PBA, module_index); }
memfault/zero-to-main
C++
null
200
/* Returns: the found #GSList element, or NULL if it is not found */
GSList* g_slist_find(GSList *list, gconstpointer data)
/* Returns: the found #GSList element, or NULL if it is not found */ GSList* g_slist_find(GSList *list, gconstpointer data)
{ while (list) { if (list->data == data) break; list = list->next; } return list; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Event function to signal the reception of new data to this module. */
void TbxMbUartDataReceived(tTbxMbUartPort port, uint8_t const *data, uint8_t len)
/* Event function to signal the reception of new data to this module. */ void TbxMbUartDataReceived(tTbxMbUartPort port, uint8_t const *data, uint8_t len)
{ TBX_ASSERT((port < TBX_MB_UART_NUM_PORT) && (data != NULL) && (len > 0U)); if ((port < TBX_MB_UART_NUM_PORT) && (data != NULL) && (len > 0U)) { if (uartInfo[port].dataReceivedFcn != NULL) { uartInfo[port].dataReceivedFcn(port, data, len); } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routines are called before setting or resetting tty->stopped. */
static void rs_360_stop(struct tty_struct *tty)
/* This routines are called before setting or resetting tty->stopped. */ static void rs_360_stop(struct tty_struct *tty)
{ ser_info_t *info = (ser_info_t *)tty->driver_data; int idx; unsigned long flags; volatile struct scc_regs *sccp; volatile struct smc_regs *smcp; if (serial_paranoia_check(info, tty->name, "rs_stop")) return; local_irq_save(flags); idx = PORT_NUM(info->state->smc_scc_num); if (info->state->smc_scc_num & NUM_IS_SCC) { sccp = &pquicc->scc_regs[idx]; sccp->scc_sccm &= ~UART_SCCM_TX; } else { smcp = &pquicc->smc_regs[idx]; smcp->smc_smcm &= ~SMCM_TX; } local_irq_restore(flags); }
robutest/uclinux
C++
GPL-2.0
60
/* DMA2D MSP Initialization This function configures the hardware resources used in this example. */
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
/* DMA2D MSP Initialization This function configures the hardware resources used in this example. */ void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
{ if(hdma2d->Instance==DMA2D) { __HAL_RCC_DMA2D_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will initialize the data queue. Calling this function will initialize the data queue control block and set the notification callback function. */
rt_err_t rt_data_queue_init(struct rt_data_queue *queue, rt_uint16_t size, rt_uint16_t lwm, void(*evt_notify)(struct rt_data_queue *queue, rt_uint32_t event))
/* This function will initialize the data queue. Calling this function will initialize the data queue control block and set the notification callback function. */ rt_err_t rt_data_queue_init(struct rt_data_queue *queue, rt_uint16_t size, rt_uint16_t lwm, void(*evt_notify)(struct rt_data_queue *queue, rt_uint32_t event))
{ RT_ASSERT(queue != RT_NULL); RT_ASSERT(size > 0); queue->evt_notify = evt_notify; queue->magic = DATAQUEUE_MAGIC; queue->size = size; queue->lwm = lwm; queue->get_index = 0; queue->put_index = 0; queue->is_empty = 1; queue->is_full = 0; rt_spin_lock_init(&(queue->spinlock)); rt_list_init(&(queue->suspended_push_list)); rt_list_init(&(queue->suspended_pop_list)); queue->queue = (struct rt_data_item *)rt_malloc(sizeof(struct rt_data_item) * size); if (queue->queue == RT_NULL) { return -RT_ENOMEM; } return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Keil: suppress ellipsis warning in va_arg usage below. Scanline function which ignores white spaces. */
static uint32_t ScanIgnoreWhiteSpace(const char **s)
/* Keil: suppress ellipsis warning in va_arg usage below. Scanline function which ignores white spaces. */ static uint32_t ScanIgnoreWhiteSpace(const char **s)
{ uint8_t count = 0; uint8_t c; c = **s; while ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') || (c == '\v') || (c == '\f')) { count++; (*s)++; c = **s; } return count; }
nanoframework/nf-interpreter
C++
MIT License
293
/* it's best to have buff aligned on a 64-bit boundary */
__wsum csum_partial(const void *buff, int len, __wsum sum)
/* it's best to have buff aligned on a 64-bit boundary */ __wsum csum_partial(const void *buff, int len, __wsum sum)
{ return (__force __wsum)add32_with_carry(do_csum(buff, len), (__force u32)sum); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Ensures that current Rx processing on any of the queues associated with the given port completes before returning. We do this by acquiring and releasing the locks of the response queues associated with the port. */
static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
/* Ensures that current Rx processing on any of the queues associated with the given port completes before returning. We do this by acquiring and releasing the locks of the response queues associated with the port. */ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
{ int i; for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { struct sge_rspq *q = &adap->sge.qs[i].rspq; spin_lock_irq(&q->lock); spin_unlock_irq(&q->lock); } }
robutest/uclinux
C++
GPL-2.0
60