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
/* Renders the contents of the pixel buffer on the LCD. */
void sharpmemRefresh(void)
/* Renders the contents of the pixel buffer on the LCD. */ void sharpmemRefresh(void)
{ uint16_t i, totalbytes, currentline, oldline; totalbytes = (SHARPMEM_LCDWIDTH * SHARPMEM_LCDHEIGHT) / 8; SET_CS; sharpmemSendByte(SHARPMEM_BIT_WRITECMD | _sharpmem_vcom); TOGGLE_VCOM; oldline = currentline = 1; sharpmemSendByte(sharpmemSwap(currentline)); for (i=0; i<totalbytes; i++) { sharpmemSendByte(sharpmemSwap(_sharpmembuffer[i])); currentline = ((i+1)/(SHARPMEM_LCDWIDTH/8)) + 1; if(currentline != oldline) { sharpmemSendByte(0x00); if (currentline <= SHARPMEM_LCDHEIGHT) { sharpmemSendByte(sharpmemSwap(currentline)); } oldline = currentline; } } sharpmemSendByte(0x00); CLR_CS; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* param handle The RTOS SPI handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the SPI instance to initialize. param masterConfig Configuration structure to set-up SPI in master mode. param srcClock_Hz Frequency of input clock of the SPI module. return status of the operation. */
status_t SPI_RTOS_Init(spi_rtos_handle_t *handle, SPI_Type *base, const spi_master_config_t *masterConfig, uint32_t srcClock_Hz)
/* param handle The RTOS SPI handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the SPI instance to initialize. param masterConfig Configuration structure to set-up SPI in master mode. param srcClock_Hz Frequency of input clock of the SPI module. return status of the operation. */ status_t SPI_RTOS_Init(spi_rtos_handle_t *handle, SPI_Type *base, const spi_master_config_t *masterConfig, uint32_t srcClock_Hz)
{ status_t status; if (handle == NULL) { return kStatus_InvalidArgument; } if (base == NULL) { return kStatus_InvalidArgument; } (void)memset(handle, 0, sizeof(spi_rtos_handle_t)); handle->mutex = xSemaphoreCreateMutex(); if (handle->mutex == NULL) { return kStatus_Fail; } handle->event = xSemaphoreCreateBinary(); if (handle->event == NULL) { vSemaphoreDelete(handle->mutex); return kStatus_Fail; } handle->base = base; (void)SPI_MasterInit(handle->base, masterConfig, srcClock_Hz); status = SPI_MasterTransferCreateHandle(handle->base, &handle->drv_handle, SPI_RTOS_Callback, (void *)handle); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* A generic routine that writes GEP control, data and reset information to the GEP register (21140) or csr15 GEP portion (2114). */
static void srom_exec(struct net_device *dev, u_char *p)
/* A generic routine that writes GEP control, data and reset information to the GEP register (21140) or csr15 GEP portion (2114). */ static void srom_exec(struct net_device *dev, u_char *p)
{ struct de4x5_private *lp = netdev_priv(dev); u_long iobase = dev->base_addr; u_char count = (p ? *p++ : 0); u_short *w = (u_short *)p; if (((lp->ibn != 1) && (lp->ibn != 3) && (lp->ibn != 5)) || !count) return; if (lp->chipset != DC21140) RESET_SIA; while (count--) { gep_wr(((lp->chipset==DC21140) && (lp->ibn!=5) ? *p++ : get_unaligned_le16(w++)), dev); mdelay(2); } if (lp->chipset != DC21140) { outl(lp->cache.csr14, DE4X5_STRR); outl(lp->cache.csr13, DE4X5_SICR); } return; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the specified ADC injected channel conversion value offset. */
void ADC_ConfigInjectedOffset(ADC_T *adc, ADC_INJEC_CHANNEL_T channel, uint16_t offSet)
/* Configures the specified ADC injected channel conversion value offset. */ void ADC_ConfigInjectedOffset(ADC_T *adc, ADC_INJEC_CHANNEL_T channel, uint16_t offSet)
{ __IOM uint32_t tmp = 0; tmp = (uint32_t)adc; tmp += channel; *(__IOM uint32_t*) tmp = (uint32_t)offSet; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the peripheral clock speed for the I2C device at base specified. */
uint32_t rcc_get_i2c_clk_freq(uint32_t i2c)
/* Get the peripheral clock speed for the I2C device at base specified. */ uint32_t rcc_get_i2c_clk_freq(uint32_t i2c)
{ if (i2c == I2C1_BASE) { return rcc_get_clksel_freq(RCC_CCIPR_I2C1SEL_SHIFT); } else if (i2c == I2C2_BASE) { return rcc_get_clksel_freq(RCC_CCIPR_I2C2SEL_SHIFT); } cm3_assert_not_reached(); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* increment ring buffer pointer. NOTE: caller must hold write spinlock */
static void snd_ps3_bump_buffer(struct snd_ps3_card_info *card, enum snd_ps3_ch ch, size_t byte_count, int stage)
/* increment ring buffer pointer. NOTE: caller must hold write spinlock */ static void snd_ps3_bump_buffer(struct snd_ps3_card_info *card, enum snd_ps3_ch ch, size_t byte_count, int stage)
{ if (!stage) card->dma_last_transfer_vaddr[ch] = card->dma_next_transfer_vaddr[ch]; card->dma_next_transfer_vaddr[ch] += byte_count; if ((card->dma_start_vaddr[ch] + (card->dma_buffer_size / 2)) <= card->dma_next_transfer_vaddr[ch]) { card->dma_next_transfer_vaddr[ch] = card->dma_start_vaddr[ch]; } }
robutest/uclinux
C++
GPL-2.0
60
/* Convert an iucv userId to its printable form (strip whitespace at end). */
static char* netiucv_printname(char *name)
/* Convert an iucv userId to its printable form (strip whitespace at end). */ static char* netiucv_printname(char *name)
{ static char tmp[9]; char *p = tmp; memcpy(tmp, name, 8); tmp[8] = '\0'; while (*p && (!isspace(*p))) p++; *p = '\0'; return tmp; }
robutest/uclinux
C++
GPL-2.0
60
/* This function configures the USB device stack based on USB descriptor and usb_cfg_data. */
static int usb_device_init(void)
/* This function configures the USB device stack based on USB descriptor and usb_cfg_data. */ static int usb_device_init(void)
{ uint8_t *device_descriptor; if (usb_dev.enabled == true) { return -EALREADY; } device_descriptor = usb_get_device_descriptor(); if (!device_descriptor) { LOG_ERR("Failed to configure USB device stack"); return -1; } usb_set_config(device_descriptor); if (IS_ENABLED(CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT)) { return usb_enable(NULL); } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector48_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector48_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (48 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Dump the samples in the serial terminal CLI in code value and actual volts or amperes values separated by a comma to be compatible with the .csv format. */
static void cn0414_ags_deactivate_channels(struct cn0414_dev *dev)
/* Dump the samples in the serial terminal CLI in code value and actual volts or amperes values separated by a comma to be compatible with the .csv format. */ static void cn0414_ags_deactivate_channels(struct cn0414_dev *dev)
{ ad717x_st_reg *reg; reg = AD717X_GetReg(dev->ad4111_device, channels_registers[dev->channel_index]); if((reg->value & 0x8000) != 0) cn0414_adc_activate_channel(dev, dev->channel_index, false); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* USB Device Configured Function Called by the User to check id USB Device is configured Parameters: Return Value: Configurated state (FALSE = unconfigured, TRUE = configured) */
BOOL usbd_configured(void)
/* USB Device Configured Function Called by the User to check id USB Device is configured Parameters: Return Value: Configurated state (FALSE = unconfigured, TRUE = configured) */ BOOL usbd_configured(void)
{ if (USBD_Configuration) { return (__TRUE); } return (__FALSE); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This function save boot script SMM private data to LockBox with BackFromS3 = TRUE at runtime. S3 resume will help restore it to tell the Library the system is back from S3. */
VOID SaveSmmPriviateDataToLockBoxAtRuntime(VOID)
/* This function save boot script SMM private data to LockBox with BackFromS3 = TRUE at runtime. S3 resume will help restore it to tell the Library the system is back from S3. */ VOID SaveSmmPriviateDataToLockBoxAtRuntime(VOID)
{ EFI_STATUS Status; mS3BootScriptTablePtr->BackFromS3 = TRUE; Status = SaveLockBox ( &mBootScriptSmmPrivateDataGuid, (VOID *)mS3BootScriptTablePtr, sizeof (SCRIPT_TABLE_PRIVATE_DATA) ); ASSERT_EFI_ERROR (Status); Status = SetLockBoxAttributes (&mBootScriptSmmPrivateDataGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE); ASSERT_EFI_ERROR (Status); mS3BootScriptTablePtr->BackFromS3 = FALSE; }
tianocore/edk2
C++
Other
4,240
/* Ref chapter 6.3. ExpiryTime and chapter 6.3.9.2.2 DeliveryTime */
static gint32 dmp_dec_exp_del_time(guint8 timev, gboolean expiry_time)
/* Ref chapter 6.3. ExpiryTime and chapter 6.3.9.2.2 DeliveryTime */ static gint32 dmp_dec_exp_del_time(guint8 timev, gboolean expiry_time)
{ gint32 time_value = 0; if (expiry_time && (timev == 0x00)) { time_value = DMP_TIME_NOT_PRESENT; } else if (timev <= 0x1D) { time_value = timev * 2; } else if (timev <= 0x91) { time_value = (timev - 0x1D + 3) * 15; } else if (timev <= 0xBB) { time_value = (timev - 0x91 + 5) * 5*60; } else if (timev <= 0xE3) { time_value = (timev - 0xBB + 7) * 30*60; } else if (timev < 0xFF) { time_value = (timev - 0xE3 + 11) * 2*3600; } else { time_value = DMP_TIME_RESERVED; } return time_value; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* You must not call this function with disabled interrupts or from a hardware interrupt handler or from a bottom half handler. */
int smp_call_function(void(*func)(void *info), void *info, int wait)
/* You must not call this function with disabled interrupts or from a hardware interrupt handler or from a bottom half handler. */ int smp_call_function(void(*func)(void *info), void *info, int wait)
{ cpumask_t cpu_mask = CPU_MASK_ALL; struct call_data_struct data; int ret; cpu_clear(smp_processor_id(), cpu_mask); WARN_ON(irqs_disabled()); data.func = func; data.info = info; data.wait = wait; spin_lock(&call_lock); call_data = &data; ret = send_ipi(IPI_CALL, wait, cpu_mask); spin_unlock(&call_lock); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* wusbhc_pal_register - unregister the WUSB HC as a UWB PAL @wusbhc: the WUSB HC */
void wusbhc_pal_unregister(struct wusbhc *wusbhc)
/* wusbhc_pal_register - unregister the WUSB HC as a UWB PAL @wusbhc: the WUSB HC */ void wusbhc_pal_unregister(struct wusbhc *wusbhc)
{ uwb_pal_unregister(&wusbhc->pal); }
robutest/uclinux
C++
GPL-2.0
60
/* Clear a specific icon on the LCD glass. This function will clear a specific icon. */
void xpro_lcd_clear_icon(uint8_t icon_com, uint8_t icon_seg)
/* Clear a specific icon on the LCD glass. This function will clear a specific icon. */ void xpro_lcd_clear_icon(uint8_t icon_com, uint8_t icon_seg)
{ slcd_clear_pixel(icon_com, icon_seg); }
memfault/zero-to-main
C++
null
200
/* Configure the RS485 mode according to the specified parameters in the uart_rs485_config_t. */
void ald_uart_rs485_config(ald_uart_handle_t *hperh, ald_uart_rs485_config_t *config)
/* Configure the RS485 mode according to the specified parameters in the uart_rs485_config_t. */ void ald_uart_rs485_config(ald_uart_handle_t *hperh, ald_uart_rs485_config_t *config)
{ assert_param(IS_UART_ALL(hperh->perh)); assert_param(IS_FUNC_STATE(config->normal)); assert_param(IS_FUNC_STATE(config->dir)); assert_param(IS_FUNC_STATE(config->invert)); MODIFY_REG(hperh->perh->RS485, UART_RS485_AADNEN_MSK, config->normal << UART_RS485_AADNEN_POS); MODIFY_REG(hperh->perh->RS485, UART_RS485_AADACEN_MSK, config->dir << UART_RS485_AADACEN_POS); MODIFY_REG(hperh->perh->RS485, UART_RS485_AADINV_MSK, config->invert << UART_RS485_AADINV_POS); MODIFY_REG(hperh->perh->RS485, UART_RS485_ADDR_MSK, config->addr << UART_RS485_ADDR_POSS); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate USBD event. This function should be called prior to usbd_evt_put(). */
static struct usbd_event* usbd_evt_alloc(void)
/* Allocate USBD event. This function should be called prior to usbd_evt_put(). */ static struct usbd_event* usbd_evt_alloc(void)
{ struct usbd_event *ev; struct usbd_mem_block block; if (k_mem_slab_alloc(&fifo_elem_slab, (void **)&block.data, K_NO_WAIT)) { LOG_ERR("USBD event allocation failed!"); usbd_evt_flush(); if (k_mem_slab_alloc(&fifo_elem_slab, (void **)&block.data, K_NO_WAIT)) { LOG_ERR("USBD event memory corrupted"); __ASSERT_NO_MSG(0); return NULL; } ev = (struct usbd_event *)block.data; ev->block = block; ev->evt_type = USBD_EVT_REINIT; usbd_evt_put(ev); usbd_work_schedule(); return NULL; } ev = (struct usbd_event *)block.data; ev->block = block; return ev; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function is called only from the atmel_lcdfb_probe() so no locking by fb_info->mm_lock around smem_len setting is needed. */
static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
/* This function is called only from the atmel_lcdfb_probe() so no locking by fb_info->mm_lock around smem_len setting is needed. */ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
{ struct fb_info *info = sinfo->info; struct fb_var_screeninfo *var = &info->var; unsigned int smem_len; smem_len = (var->xres_virtual * var->yres_virtual * ((var->bits_per_pixel + 7) / 8)); info->fix.smem_len = max(smem_len, sinfo->smem_len); info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len, (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL); if (!info->screen_base) { return -ENOMEM; } memset(info->screen_base, 0, info->fix.smem_len); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This bit survives EDMA resets, and must be set for basic DMA to function, and should be cleared when EDMA is active. */
static void mv_bmdma_enable_iie(struct ata_port *ap, int enable_bmdma)
/* This bit survives EDMA resets, and must be set for basic DMA to function, and should be cleared when EDMA is active. */ static void mv_bmdma_enable_iie(struct ata_port *ap, int enable_bmdma)
{ struct mv_port_priv *pp = ap->private_data; u32 new, *old = &pp->cached.unknown_rsvd; if (enable_bmdma) new = *old | 1; else new = *old & ~1; mv_write_cached_reg(mv_ap_base(ap) + EDMA_UNKNOWN_RSVD, old, new); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* prepare a new set of credentials for modification */
static int selinux_cred_prepare(struct cred *new, const struct cred *old, gfp_t gfp)
/* prepare a new set of credentials for modification */ static int selinux_cred_prepare(struct cred *new, const struct cred *old, gfp_t gfp)
{ const struct task_security_struct *old_tsec; struct task_security_struct *tsec; old_tsec = old->security; tsec = kmemdup(old_tsec, sizeof(struct task_security_struct), gfp); if (!tsec) return -ENOMEM; new->security = tsec; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Queue a bio for processing by the low-level CD device. Must be called from process context. */
static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio)
/* Queue a bio for processing by the low-level CD device. Must be called from process context. */ static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio)
{ spin_lock(&pd->iosched.lock); if (bio_data_dir(bio) == READ) { pkt_add_list_last(bio, &pd->iosched.read_queue, &pd->iosched.read_queue_tail); } else { pkt_add_list_last(bio, &pd->iosched.write_queue, &pd->iosched.write_queue_tail); } spin_unlock(&pd->iosched.lock); atomic_set(&pd->iosched.attention, 1); wake_up(&pd->wqueue); }
robutest/uclinux
C++
GPL-2.0
60
/* This function looks for a wear leveling entry with erase counter closest to min + @diff, where min is the smallest erase counter. */
static struct ubi_wl_entry* find_wl_entry(struct ubi_device *ubi, struct rb_root *root, int diff)
/* This function looks for a wear leveling entry with erase counter closest to min + @diff, where min is the smallest erase counter. */ static struct ubi_wl_entry* find_wl_entry(struct ubi_device *ubi, struct rb_root *root, int diff)
{ struct rb_node *p; struct ubi_wl_entry *e, *prev_e = NULL; int max; e = rb_entry(rb_first(root), struct ubi_wl_entry, u.rb); max = e->ec + diff; p = root->rb_node; while (p) { struct ubi_wl_entry *e1; e1 = rb_entry(p, struct ubi_wl_entry, u.rb); if (e1->ec >= max) p = p->rb_left; else { p = p->rb_right; prev_e = e; e = e1; } } if (prev_e && !ubi->fm_disabled && !ubi->fm && e->pnum < UBI_FM_MAX_START) return prev_e; return e; }
4ms/stm32mp1-baremetal
C++
Other
137
/* ADC Enable an External Trigger for Regular Channels. This enables an external trigger for set of defined regular channels, and sets the polarity of the trigger event: rising or falling edge or both. Note that if the trigger polarity is zero, triggering is disabled. */
void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger, uint32_t polarity)
/* ADC Enable an External Trigger for Regular Channels. This enables an external trigger for set of defined regular channels, and sets the polarity of the trigger event: rising or falling edge or both. Note that if the trigger polarity is zero, triggering is disabled. */ void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger, uint32_t polarity)
{ uint32_t reg = ADC_CFGR1(adc); reg &= ~(ADC_CFGR1_EXTSEL_MASK << ADC_CFGR1_EXTSEL_SHIFT); reg &= ~(ADC_CFGR1_EXTEN_MASK); reg |= polarity | (trigger << ADC_CFGR1_EXTSEL_SHIFT); ADC_CFGR1(adc) = reg; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* This function registers an event that is to be signaled whenever a configuration process on the specified configuration data is performed. An event can be registered for a different DataType simultaneously. The caller is responsible for determining which type of configuration data causes the signaling of the event in such an event. */
EFI_STATUS EFIAPI EfiIp4Config2RegisterDataNotify(IN EFI_IP4_CONFIG2_PROTOCOL *This, IN EFI_IP4_CONFIG2_DATA_TYPE DataType, IN EFI_EVENT Event)
/* This function registers an event that is to be signaled whenever a configuration process on the specified configuration data is performed. An event can be registered for a different DataType simultaneously. The caller is responsible for determining which type of configuration data causes the signaling of the event in such an event. */ EFI_STATUS EFIAPI EfiIp4Config2RegisterDataNotify(IN EFI_IP4_CONFIG2_PROTOCOL *This, IN EFI_IP4_CONFIG2_DATA_TYPE DataType, IN EFI_EVENT Event)
{ EFI_TPL OldTpl; EFI_STATUS Status; IP4_CONFIG2_INSTANCE *Instance; NET_MAP *EventMap; NET_MAP_ITEM *Item; if ((This == NULL) || (Event == NULL)) { return EFI_INVALID_PARAMETER; } if (DataType >= Ip4Config2DataTypeMaximum) { return EFI_UNSUPPORTED; } OldTpl = gBS->RaiseTPL (TPL_CALLBACK); Instance = IP4_CONFIG2_INSTANCE_FROM_PROTOCOL (This); EventMap = &Instance->DataItem[DataType].EventMap; Item = NetMapFindKey (EventMap, Event); if (Item == NULL) { Status = NetMapInsertTail (EventMap, Event, NULL); if (EFI_ERROR (Status)) { Status = EFI_OUT_OF_RESOURCES; } } else { Status = EFI_ACCESS_DENIED; } gBS->RestoreTPL (OldTpl); return Status; }
tianocore/edk2
C++
Other
4,240
/* The default state of the channel is buffered. */
void g_io_channel_set_buffered(GIOChannel *channel, gboolean buffered)
/* The default state of the channel is buffered. */ void g_io_channel_set_buffered(GIOChannel *channel, gboolean buffered)
{ g_return_if_fail (channel != NULL); if (channel->encoding != NULL) { g_warning ("Need to have NULL encoding to set the buffering state of the " "channel.\n"); return; } g_return_if_fail (!channel->read_buf || channel->read_buf->len == 0); g_return_if_fail (!channel->write_buf || channel->write_buf->len == 0); channel->use_buffer = buffered; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This internal function checks if a ASCII character is a decimal character. The valid hexadecimal character is L'0' to L'9', L'a' to L'f', or L'A' to L'F'. */
BOOLEAN EFIAPI InternalAsciiIsHexaDecimalDigitCharacter(IN CHAR8 Char)
/* This internal function checks if a ASCII character is a decimal character. The valid hexadecimal character is L'0' to L'9', L'a' to L'f', or L'A' to L'F'. */ BOOLEAN EFIAPI InternalAsciiIsHexaDecimalDigitCharacter(IN CHAR8 Char)
{ return (BOOLEAN)(InternalAsciiIsDecimalDigitCharacter (Char) || (Char >= 'A' && Char <= 'F') || (Char >= 'a' && Char <= 'f')); }
tianocore/edk2
C++
Other
4,240
/* fcoe_ctlr_init() - Initialize the FCoE Controller instance @fip: The FCoE controller to initialize */
void fcoe_ctlr_init(struct fcoe_ctlr *fip)
/* fcoe_ctlr_init() - Initialize the FCoE Controller instance @fip: The FCoE controller to initialize */ void fcoe_ctlr_init(struct fcoe_ctlr *fip)
{ fip->state = FIP_ST_LINK_WAIT; fip->mode = FIP_ST_AUTO; INIT_LIST_HEAD(&fip->fcfs); spin_lock_init(&fip->lock); fip->flogi_oxid = FC_XID_UNKNOWN; setup_timer(&fip->timer, fcoe_ctlr_timeout, (unsigned long)fip); INIT_WORK(&fip->link_work, fcoe_ctlr_link_work); INIT_WORK(&fip->recv_work, fcoe_ctlr_recv_work); skb_queue_head_init(&fip->fip_recv_list); }
robutest/uclinux
C++
GPL-2.0
60
/* Return: 0-255 Success, the byte was parsed correctly -1 Error, an invalid character was supplied */
static int ldm_parse_hexbyte(const u8 *src)
/* Return: 0-255 Success, the byte was parsed correctly -1 Error, an invalid character was supplied */ static int ldm_parse_hexbyte(const u8 *src)
{ unsigned int x; int h; if ((x = src[0] - '0') <= '9'-'0') h = x; else if ((x = src[0] - 'a') <= 'f'-'a') h = x+10; else if ((x = src[0] - 'A') <= 'F'-'A') h = x+10; else return -1; h <<= 4; if ((x = src[1] - '0') <= '9'-'0') return h | x; if ((x = src[1] - 'a') <= 'f'-'a') return h | (x+10); if ((x = src[1] - 'A') <= 'F'-'A') return h | (x+10); return -1; }
robutest/uclinux
C++
GPL-2.0
60
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==UART4) { __HAL_RCC_UART4_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOI, GPIO_PIN_9); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_11|GPIO_PIN_12); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handle dead key. Note that we now may have several dead keys modifying the same character. Very useful for Vietnamese. */
static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
/* Handle dead key. Note that we now may have several dead keys modifying the same character. Very useful for Vietnamese. */ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
{ if (up_flag) return; diacr = (diacr ? handle_diacr(vc, value) : value); }
robutest/uclinux
C++
GPL-2.0
60
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI5) { __HAL_RCC_SPI5_CLK_ENABLE(); __HAL_RCC_GPIOF_CLK_ENABLE(); GPIO_InitStruct.Pin = SPI5_SCK_Pin|SPI5_MISO_Pin|SPI5_MOSI_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF5_SPI5; HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Endpoint TX buffer allocation callback for nocopy sending. */
static int get_tx_buffer(const struct device *instance, void *token, void **data, uint32_t *user_len, k_timeout_t wait)
/* Endpoint TX buffer allocation callback for nocopy sending. */ static int get_tx_buffer(const struct device *instance, void *token, void **data, uint32_t *user_len, k_timeout_t wait)
{ struct backend_data *dev_data = instance->data; int r; r = alloc_tx_buffer(dev_data, user_len, (uint8_t **)data, wait); if (r < 0) { return r; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This is the top level routine of the printer. 'p' points to the 802.11 header of the packet, 'h->ts' is the timestamp, 'h->len' is the length of the packet off the wire, and 'h->caplen' is the number of bytes actually captured. */
u_int ieee802_11_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
/* This is the top level routine of the printer. 'p' points to the 802.11 header of the packet, 'h->ts' is the timestamp, 'h->len' is the length of the packet off the wire, and 'h->caplen' is the number of bytes actually captured. */ u_int ieee802_11_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{ return ieee802_11_print(ndo, p, h->len, h->caplen, 0, 0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initialize the cy8c4014lqi communication bus from MCU to CY8C4014LQI : ie I2C channel initialization (if required). */
void cy8c4014lqi_Init(uint16_t DeviceAddr)
/* Initialize the cy8c4014lqi communication bus from MCU to CY8C4014LQI : ie I2C channel initialization (if required). */ void cy8c4014lqi_Init(uint16_t DeviceAddr)
{ cy8c4014lqi_I2C_InitializeIfRequired(); }
eclipse-threadx/getting-started
C++
Other
310
/* This function returns zero if the volume attaching information is consistent to the data read from the volume tabla, and %-EINVAL if not. */
static int check_av(const struct ubi_volume *vol, const struct ubi_ainf_volume *av)
/* This function returns zero if the volume attaching information is consistent to the data read from the volume tabla, and %-EINVAL if not. */ static int check_av(const struct ubi_volume *vol, const struct ubi_ainf_volume *av)
{ int err; if (av->highest_lnum >= vol->reserved_pebs) { err = 1; goto bad; } if (av->leb_count > vol->reserved_pebs) { err = 2; goto bad; } if (av->vol_type != vol->vol_type) { err = 3; goto bad; } if (av->used_ebs > vol->reserved_pebs) { err = 4; goto bad; } if (av->data_pad != vol->data_pad) { err = 5; goto bad; } return 0; bad: ubi_err(vol->ubi, "bad attaching information, error %d", err); ubi_dump_av(av); ubi_dump_vol_info(vol); return -EINVAL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Entry point of the incompatible pci device support code. Setup an incompatible device list template and install EFI Incompatible PCI Device Support protocol. */
EFI_STATUS EFIAPI IncompatiblePciDeviceSupportEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Entry point of the incompatible pci device support code. Setup an incompatible device list template and install EFI Incompatible PCI Device Support protocol. */ EFI_STATUS EFIAPI IncompatiblePciDeviceSupportEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gBS->InstallProtocolInterface ( &mIncompatiblePciDeviceSupportHandle, &gEfiIncompatiblePciDeviceSupportProtocolGuid, EFI_NATIVE_INTERFACE, &mIncompatiblePciDeviceSupport ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Return 1 (true) if PIO access is accomplished. Return 0 (false) if PIO access is timed out. */
static int pcie_advk_wait_pio(struct pcie_advk *pcie)
/* Return 1 (true) if PIO access is accomplished. Return 0 (false) if PIO access is timed out. */ static int pcie_advk_wait_pio(struct pcie_advk *pcie)
{ uint start, isr; uint count; for (count = 0; count < MAX_RETRIES; count++) { start = advk_readl(pcie, PIO_START); isr = advk_readl(pcie, PIO_ISR); if (!start && isr) return 1; udelay(PIO_WAIT_TIMEOUT); } dev_err(pcie->dev, "config read/write timed out\n"); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Given a string <path> representing a file path of format: path/to/file.gcda construct and return a new string: <dir>path/to/file.<ext> */
static char* link_target(const char *dir, const char *path, const char *ext)
/* Given a string <path> representing a file path of format: path/to/file.gcda construct and return a new string: <dir>path/to/file.<ext> */ static char* link_target(const char *dir, const char *path, const char *ext)
{ char *target; char *old_ext; char *copy; copy = kstrdup(path, GFP_KERNEL); if (!copy) return NULL; old_ext = strrchr(copy, '.'); if (old_ext) *old_ext = '\0'; if (dir) target = kasprintf(GFP_KERNEL, "%s/%s.%s", dir, copy, ext); else target = kasprintf(GFP_KERNEL, "%s.%s", copy, ext); kfree(copy); return target; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
/* Initializes the Low Level portion of the Device driver. */ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{ hpcd.Instance = USB_OTG_FS; hpcd.Init.dev_endpoints = 4; hpcd.Init.use_dedicated_ep1 = 0; hpcd.Init.low_power_enable = 1; hpcd.Init.phy_itface = PCD_PHY_EMBEDDED; hpcd.Init.Sof_enable = 0; hpcd.Init.speed = PCD_SPEED_FULL; hpcd.Init.vbus_sensing_enable = 1; hpcd.Init.lpm_enable = 0; hpcd.pData = pdev; pdev->pData = &hpcd; HAL_PCD_Init(&hpcd); HAL_PCDEx_SetRxFiFo(&hpcd, 0x80); HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x40); HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x80); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* nfs_pageio_init - initialise a page io descriptor @desc: pointer to descriptor @inode: pointer to inode @doio: pointer to io function @bsize: io block size @io_flags: extra parameters for the io function */
void nfs_pageio_init(struct nfs_pageio_descriptor *desc, struct inode *inode, int(*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), size_t bsize, int io_flags)
/* nfs_pageio_init - initialise a page io descriptor @desc: pointer to descriptor @inode: pointer to inode @doio: pointer to io function @bsize: io block size @io_flags: extra parameters for the io function */ void nfs_pageio_init(struct nfs_pageio_descriptor *desc, struct inode *inode, int(*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), size_t bsize, int io_flags)
{ INIT_LIST_HEAD(&desc->pg_list); desc->pg_bytes_written = 0; desc->pg_count = 0; desc->pg_bsize = bsize; desc->pg_base = 0; desc->pg_inode = inode; desc->pg_doio = doio; desc->pg_ioflags = io_flags; desc->pg_error = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Release received buffer. This function will just send release control message. */
static int send_release(struct backend_data *dev_data, const uint8_t *buffer, enum msg_type msg_type, uint8_t ept_addr)
/* Release received buffer. This function will just send release control message. */ static int send_release(struct backend_data *dev_data, const uint8_t *buffer, enum msg_type msg_type, uint8_t ept_addr)
{ const struct icbmsg_config *conf = dev_data->conf; int rx_block_index; rx_block_index = buffer_to_index_validate(&conf->rx, buffer, NULL); if (rx_block_index < 0) { return rx_block_index; } return send_control_message(dev_data, msg_type, ept_addr, rx_block_index); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Function for dispatching a S110 SoftDevice event to all modules with a S110 SoftDevice event handler. This function is called from the S110 SoftDevice event interrupt handler after a S110 SoftDevice event has been received. */
static void ble_evt_dispatch(ble_evt_t *p_ble_evt)
/* Function for dispatching a S110 SoftDevice event to all modules with a S110 SoftDevice event handler. This function is called from the S110 SoftDevice event interrupt handler after a S110 SoftDevice event has been received. */ static void ble_evt_dispatch(ble_evt_t *p_ble_evt)
{ ble_conn_params_on_ble_evt(p_ble_evt); ble_dfu_on_ble_evt(&m_dfu, p_ble_evt); on_ble_evt(p_ble_evt); }
labapart/polymcu
C++
null
201
/* Retrieve the status of a specific thread in the Cadence NAND controller. */
static uint32_t cdns_nand_get_thrd_status(uintptr_t base_address, uint8_t thread)
/* Retrieve the status of a specific thread in the Cadence NAND controller. */ static uint32_t cdns_nand_get_thrd_status(uintptr_t base_address, uint8_t thread)
{ uint32_t status; sys_write32(THREAD_VAL(thread), (base_address + CMD_STATUS_PTR_ADDR)); status = sys_read32((base_address + CMD_STAT_CMD_STATUS)); return status; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* lis3l02dq_read_signed() - attribute function used for 8 bit signed values @dev: the child device associated with the iio_dev or iio_trigger @attr: the attribute being processed @buf: buffer into which put the output string */
static ssize_t lis3l02dq_read_signed(struct device *dev, struct device_attribute *attr, char *buf)
/* lis3l02dq_read_signed() - attribute function used for 8 bit signed values @dev: the child device associated with the iio_dev or iio_trigger @attr: the attribute being processed @buf: buffer into which put the output string */ static ssize_t lis3l02dq_read_signed(struct device *dev, struct device_attribute *attr, char *buf)
{ int ret; s8 val; struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); ret = lis3l02dq_spi_read_reg_8(dev, this_attr->address, (u8 *)&val); return ret ? ret : sprintf(buf, "%d\n", val); }
robutest/uclinux
C++
GPL-2.0
60
/* This function decodes the content. The Memory block pointed by ContentPointer would be freed and replaced with the cooked Redfish payload. */
EFI_STATUS DecodeResponseContent(IN CHAR8 *ContentEncodedValue, IN OUT VOID **ContentPointer, IN OUT UINTN *ContentLength)
/* This function decodes the content. The Memory block pointed by ContentPointer would be freed and replaced with the cooked Redfish payload. */ EFI_STATUS DecodeResponseContent(IN CHAR8 *ContentEncodedValue, IN OUT VOID **ContentPointer, IN OUT UINTN *ContentLength)
{ EFI_STATUS Status; VOID *DecodedPointer; UINTN DecodedLength; if (ContentEncodedValue == NULL) { return EFI_INVALID_PARAMETER; } Status = RedfishContentDecode ( ContentEncodedValue, *ContentPointer, *ContentLength, &DecodedPointer, &DecodedLength ); if (Status == EFI_SUCCESS) { FreePool (*ContentPointer); *ContentPointer = DecodedPointer; *ContentLength = DecodedLength; } return Status; }
tianocore/edk2
C++
Other
4,240
/* find the interface index for a specific class */
uint8_t usbh_interface_find(usb_dev_prop *udev, uint8_t main_class, uint8_t sub_class, uint8_t protocol)
/* find the interface index for a specific class */ uint8_t usbh_interface_find(usb_dev_prop *udev, uint8_t main_class, uint8_t sub_class, uint8_t protocol)
{ usb_desc_itf *pif; uint8_t if_ix = 0U; pif = (usb_desc_itf *)0; while (if_ix < udev->cfg_desc_set.cfg_desc.bNumInterfaces) { pif = &udev->cfg_desc_set.itf_desc_set[if_ix][0].itf_desc; if (((pif->bInterfaceClass == main_class) || (main_class == 0xFFU))&& ((pif->bInterfaceSubClass == sub_class) || (sub_class == 0xFFU))&& ((pif->bInterfaceProtocol == protocol) || (protocol == 0xFFU))) { return if_ix; } if_ix++; } return 0xFFU; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calling copy_to_user() in atomic context is not desirable. Hence first copying the data to a pre-allocated kernel page and then copying to user space in non-atomic context. */
ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, unsigned long offset, int userbuf)
/* Calling copy_to_user() in atomic context is not desirable. Hence first copying the data to a pre-allocated kernel page and then copying to user space in non-atomic context. */ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, unsigned long offset, int userbuf)
{ void *vaddr; if (!csize) return 0; if (!is_crashed_pfn_valid(pfn)) return -EFAULT; vaddr = kmap_atomic_pfn(pfn, KM_PTE0); if (!userbuf) { memcpy(buf, (vaddr + offset), csize); kunmap_atomic(vaddr, KM_PTE0); } else { if (!kdump_buf_page) { printk(KERN_WARNING "Kdump: Kdump buffer page not" " allocated\n"); kunmap_atomic(vaddr, KM_PTE0); return -EFAULT; } copy_page(kdump_buf_page, vaddr); kunmap_atomic(vaddr, KM_PTE0); if (copy_to_user(buf, (kdump_buf_page + offset), csize)) return -EFAULT; } return csize; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base FLEXSPI peripheral base address. param handle pointer to flexspi_handle_t structure. */
__attribute__((section(".ramfunc.$RAM2")))
/* param base FLEXSPI peripheral base address. param handle pointer to flexspi_handle_t structure. */ __attribute__((section(".ramfunc.$RAM2")))
{ uint32_t instance; for (instance = 0; instance < ARRAY_SIZE(s_flexspiBases); instance++) { if (s_flexspiBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_flexspiBases)); return instance; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Sends the next queued packt to the tty port (garmin native mode only) and then sets a timer to call itself again until all queued data is sent. */
static int garmin_flush_queue(struct garmin_data *garmin_data_p)
/* Sends the next queued packt to the tty port (garmin native mode only) and then sets a timer to call itself again until all queued data is sent. */ static int garmin_flush_queue(struct garmin_data *garmin_data_p)
{ unsigned long flags; struct garmin_packet *pkt; if ((garmin_data_p->flags & FLAGS_THROTTLED) == 0) { pkt = pkt_pop(garmin_data_p); if (pkt != NULL) { send_to_tty(garmin_data_p->port, pkt->data, pkt->size); kfree(pkt); mod_timer(&garmin_data_p->timer, (1)+jiffies); } else { spin_lock_irqsave(&garmin_data_p->lock, flags); garmin_data_p->flags &= ~FLAGS_QUEUING; spin_unlock_irqrestore(&garmin_data_p->lock, flags); } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* When a network namespace is destroyed all of the exit methods are called in the reverse of the order with which they were registered. */
int register_pernet_device(struct pernet_operations *ops)
/* When a network namespace is destroyed all of the exit methods are called in the reverse of the order with which they were registered. */ int register_pernet_device(struct pernet_operations *ops)
{ int error; mutex_lock(&net_mutex); error = register_pernet_operations(&pernet_list, ops); if (!error && (first_device == &pernet_list)) first_device = &ops->list; mutex_unlock(&net_mutex); return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clear the End of Operation Status Flag, upper Bank. */
void flash_clear_eop_flag_upper(void)
/* Clear the End of Operation Status Flag, upper Bank. */ void flash_clear_eop_flag_upper(void)
{ if (desig_get_flash_size() > 512) { FLASH_SR2 |= FLASH_SR_EOP; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Update task's mems_allowed and rebind its mempolicy and vmas' mempolicy of it to cpuset's new mems_allowed, and migrate pages to new nodes if memory_migrate flag is set. Called with cgroup_mutex held. */
static void cpuset_change_nodemask(struct task_struct *p, struct cgroup_scanner *scan)
/* Update task's mems_allowed and rebind its mempolicy and vmas' mempolicy of it to cpuset's new mems_allowed, and migrate pages to new nodes if memory_migrate flag is set. Called with cgroup_mutex held. */ static void cpuset_change_nodemask(struct task_struct *p, struct cgroup_scanner *scan)
{ struct mm_struct *mm; struct cpuset *cs; int migrate; const nodemask_t *oldmem = scan->data; nodemask_t newmems; cs = cgroup_cs(scan->cg); guarantee_online_mems(cs, &newmems); task_lock(p); cpuset_change_task_nodemask(p, &newmems); task_unlock(p); mm = get_task_mm(p); if (!mm) return; migrate = is_memory_migrate(cs); mpol_rebind_mm(mm, &cs->mems_allowed); if (migrate) cpuset_migrate_mm(mm, oldmem, &cs->mems_allowed); mmput(mm); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the RTC BCD calendar year value. The year value should only be the abbreviated year tens, meaning if 2021 is desired pass in only 21. */
void rtc_calendar_set_year(uint8_t year)
/* Sets the RTC BCD calendar year value. The year value should only be the abbreviated year tens, meaning if 2021 is desired pass in only 21. */ void rtc_calendar_set_year(uint8_t year)
{ uint8_t bcd_year = _rtc_dec_to_bcd(year); RTC_DR &= ~(RTC_DR_YT_MASK << RTC_DR_YT_SHIFT | RTC_DR_YU_MASK << RTC_DR_YU_SHIFT); RTC_DR |= (((bcd_year >> 4) & RTC_DR_YT_MASK) << RTC_DR_YT_SHIFT) | ((bcd_year & RTC_DR_YU_MASK) << RTC_DR_YU_SHIFT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* main function , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
int main(void)
/* main function , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ int main(void)
{ systick_config(); gd_eval_ledinit(LED1); gd_eval_ledinit(LED2); gd_eval_ledinit(LED3); gd_eval_ledinit(LED4); while(1){ gd_eval_ledon(LED1); gd_eval_ledoff(LED4); delay_1ms(1000); gd_eval_ledon(LED2); gd_eval_ledoff(LED1); delay_1ms(1000); gd_eval_ledon(LED3); gd_eval_ledoff(LED2); delay_1ms(1000); gd_eval_ledon(LED4); gd_eval_ledoff(LED3); delay_1ms(1000); } }
liuxuming/trochili
C++
Apache License 2.0
132
/* xprt_wait_for_buffer_space - wait for transport output buffer to clear @task: task to be put to sleep @action: function pointer to be executed after wait */
void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action)
/* xprt_wait_for_buffer_space - wait for transport output buffer to clear @task: task to be put to sleep @action: function pointer to be executed after wait */ void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action)
{ struct rpc_rqst *req = task->tk_rqstp; struct rpc_xprt *xprt = req->rq_xprt; task->tk_timeout = req->rq_timeout; rpc_sleep_on(&xprt->pending, task, action); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Compute power spectrum of a half-complex (packed) vector */
static void power_spectrum(const spx_word16_t *X, spx_word32_t *ps, int N)
/* Compute power spectrum of a half-complex (packed) vector */ static void power_spectrum(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
/* If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned */
EFI_STATUS EFIAPI NvmExpressGetNamespace(IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *NamespaceId)
/* If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned */ EFI_STATUS EFIAPI NvmExpressGetNamespace(IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *NamespaceId)
{ NVME_NAMESPACE_DEVICE_PATH *Node; NVME_CONTROLLER_PRIVATE_DATA *Private; if ((This == NULL) || (DevicePath == NULL) || (NamespaceId == NULL)) { return EFI_INVALID_PARAMETER; } if (DevicePath->Type != MESSAGING_DEVICE_PATH) { return EFI_UNSUPPORTED; } Node = (NVME_NAMESPACE_DEVICE_PATH *)DevicePath; Private = NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU (This); if (DevicePath->SubType == MSG_NVME_NAMESPACE_DP) { if (DevicePathNodeLength (DevicePath) != sizeof (NVME_NAMESPACE_DEVICE_PATH)) { return EFI_NOT_FOUND; } if ((Node->NamespaceId == 0) || (Node->NamespaceId > Private->ControllerData->Nn)) { return EFI_NOT_FOUND; } *NamespaceId = Node->NamespaceId; return EFI_SUCCESS; } else { return EFI_UNSUPPORTED; } }
tianocore/edk2
C++
Other
4,240
/* Return next attribute in a stream of attributes. */
struct nlattr* nla_next(const struct nlattr *nla, int *remaining)
/* Return next attribute in a stream of attributes. */ struct nlattr* nla_next(const struct nlattr *nla, int *remaining)
{ int totlen = NLA_ALIGN(nla->nla_len); *remaining -= totlen; return (struct nlattr *) ((char *) nla + totlen); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Finds the SMI entry for the requested handler type. */
SMI_ENTRY* EFIAPI SmmCoreFindSmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
/* Finds the SMI entry for the requested handler type. */ SMI_ENTRY* EFIAPI SmmCoreFindSmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
{ LIST_ENTRY *Link; SMI_ENTRY *Item; SMI_ENTRY *SmiEntry; SmiEntry = NULL; for (Link = mSmiEntryList.ForwardLink; Link != &mSmiEntryList; Link = Link->ForwardLink) { Item = CR (Link, SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE); if (CompareGuid (&Item->HandlerType, HandlerType)) { SmiEntry = Item; break; } } if ((SmiEntry == NULL) && Create) { SmiEntry = AllocatePool (sizeof (SMI_ENTRY)); if (SmiEntry != NULL) { SmiEntry->Signature = SMI_ENTRY_SIGNATURE; CopyGuid ((VOID *)&SmiEntry->HandlerType, HandlerType); InitializeListHead (&SmiEntry->SmiHandlers); InsertTailList (&mSmiEntryList, &SmiEntry->AllEntries); } } return SmiEntry; }
tianocore/edk2
C++
Other
4,240
/* gfs2_meta_sync - Sync all buffers associated with a glock @gl: The glock */
void gfs2_meta_sync(struct gfs2_glock *gl)
/* gfs2_meta_sync - Sync all buffers associated with a glock @gl: The glock */ void gfs2_meta_sync(struct gfs2_glock *gl)
{ struct address_space *mapping = gl->gl_aspace->i_mapping; int error; filemap_fdatawrite(mapping); error = filemap_fdatawait(mapping); if (error) gfs2_io_error(gl->gl_sbd); }
robutest/uclinux
C++
GPL-2.0
60
/* Idle hook callback for Idle Tasks to reset the TWDT. This callback will only be registered to the Idle Hook of a particular core when the corresponding Idle Task subscribes to the TWDT. */
static bool idle_hook_cb(void)
/* Idle hook callback for Idle Tasks to reset the TWDT. This callback will only be registered to the Idle Hook of a particular core when the corresponding Idle Task subscribes to the TWDT. */ static bool idle_hook_cb(void)
{ esp_task_wdt_reset(); return true; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* User HANGUP on active/call proceeding state send disc.req */
void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data)
/* User HANGUP on active/call proceeding state send disc.req */ void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data)
{ struct sk_buff *skb; int len; ushort refnum; if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) { printk("capi_disc_req failed\n"); return; } refnum = last_ref_num++ & 0x7fffU; chan->s_refnum = refnum; pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); }
robutest/uclinux
C++
GPL-2.0
60
/* 'mxml_fd_write()' - Write a buffer of data to a file descriptor. */
static int mxml_fd_write(_mxml_fdbuf_t *buf)
/* 'mxml_fd_write()' - Write a buffer of data to a file descriptor. */ static int mxml_fd_write(_mxml_fdbuf_t *buf)
{ int bytes; unsigned char *ptr; if (!buf) return (-1); if (buf->current == buf->buffer) return (0); for (ptr = buf->buffer; ptr < buf->current; ptr += bytes) if ((bytes = write(buf->fd, ptr, buf->current - ptr)) < 0) return (-1); buf->current = buf->buffer; return (0); }
DC-SWAT/DreamShell
C++
null
404
/* returns SUCCESS if the Status bit was found or else ERR_MBX */
s32 igb_check_for_msg(struct e1000_hw *hw, u16 mbx_id)
/* returns SUCCESS if the Status bit was found or else ERR_MBX */ s32 igb_check_for_msg(struct e1000_hw *hw, u16 mbx_id)
{ struct e1000_mbx_info *mbx = &hw->mbx; s32 ret_val = -E1000_ERR_MBX; if (mbx->ops.check_for_msg) ret_val = mbx->ops.check_for_msg(hw, mbx_id); return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* This function sets the control bit of the USCI_I2C module. */
void UI2C_Trigger(UI2C_T *ui2c, uint8_t u8Start, uint8_t u8Stop, uint8_t u8Ptrg, uint8_t u8Ack)
/* This function sets the control bit of the USCI_I2C module. */ void UI2C_Trigger(UI2C_T *ui2c, uint8_t u8Start, uint8_t u8Stop, uint8_t u8Ptrg, uint8_t u8Ack)
{ uint32_t u32Reg = 0u; uint32_t u32Val = ui2c->PROTCTL & ~(UI2C_PROTCTL_STA_Msk | UI2C_PROTCTL_STO_Msk | UI2C_PROTCTL_AA_Msk); if(u8Start) { u32Reg |= UI2C_PROTCTL_STA_Msk; } if(u8Stop) { u32Reg |= UI2C_PROTCTL_STO_Msk; } if(u8Ptrg) { u32Reg |= UI2C_PROTCTL_PTRG_Msk; } if(u8Ack) { u32Reg |= UI2C_PROTCTL_AA_Msk; } ui2c->PROTCTL = u32Val | u32Reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, ARD_D1_TX_Pin|ARD_D0_RX_Pin); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOD, T_VCP_TX_Pin|T_VCP_RX_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Registers a finalization notifier which will be called when the reference count of @closure goes down to 0. Multiple finalization notifiers on a single closure are invoked in unspecified order. If a single call to g_closure_unref() results in the closure being both invalidated and finalized, then the invalidate notifiers will be run before the finalize notifiers. */
void g_closure_add_finalize_notifier(GClosure *closure, gpointer notify_data, GClosureNotify notify_func)
/* Registers a finalization notifier which will be called when the reference count of @closure goes down to 0. Multiple finalization notifiers on a single closure are invoked in unspecified order. If a single call to g_closure_unref() results in the closure being both invalidated and finalized, then the invalidate notifiers will be run before the finalize notifiers. */ void g_closure_add_finalize_notifier(GClosure *closure, gpointer notify_data, GClosureNotify notify_func)
{ guint i; g_return_if_fail (closure != NULL); g_return_if_fail (notify_func != NULL); g_return_if_fail (closure->n_fnotifiers < CLOSURE_MAX_N_FNOTIFIERS); closure->notifiers = g_renew (GClosureNotifyData, closure->notifiers, CLOSURE_N_NOTIFIERS (closure) + 1); if (closure->n_inotifiers) closure->notifiers[(CLOSURE_N_MFUNCS (closure) + closure->n_fnotifiers + closure->n_inotifiers)] = closure->notifiers[(CLOSURE_N_MFUNCS (closure) + closure->n_fnotifiers + 0)]; i = CLOSURE_N_MFUNCS (closure) + closure->n_fnotifiers; closure->notifiers[i].data = notify_data; closure->notifiers[i].notify = notify_func; INC (closure, n_fnotifiers); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sleep-to-wake, return-to-sleep activation threshold in low-power mode. 1 LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */
int32_t lis2dh12_act_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
/* Sleep-to-wake, return-to-sleep activation threshold in low-power mode. 1 LSb = 16mg@2g / 32mg@4g / 62mg@8g / 186mg@16g. */ int32_t lis2dh12_act_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
{ lis2dh12_act_ths_t act_ths; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_ACT_THS, (uint8_t *)&act_ths, 1); if (ret == 0) { act_ths.acth = val; ret = lis2dh12_write_reg(ctx, LIS2DH12_ACT_THS, (uint8_t *)&act_ths, 1); } return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Starts or stops the controller of a CAN connection. */
static HRESULT IxxatVciLibFuncCanControlStart(HANDLE hCanCtl, BOOL fStart)
/* Starts or stops the controller of a CAN connection. */ static HRESULT IxxatVciLibFuncCanControlStart(HANDLE hCanCtl, BOOL fStart)
{ HRESULT result = VCI_E_UNEXPECTED; assert(ixxatVciLibFuncCanControlStartPtr != NULL); assert(ixxatVciDllHandle != NULL); if ((ixxatVciLibFuncCanControlStartPtr != NULL) && (ixxatVciDllHandle != NULL)) { result = ixxatVciLibFuncCanControlStartPtr(hCanCtl, fStart); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Information regarding the number of caches and their sizes, frequency of operation, slot numbers is all considered platform-related information and is not provided by this service. */
EFI_STATUS EFIAPI EdkiiPeiGetProcessorInfo(IN EDKII_PEI_MP_SERVICES2_PPI *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
/* Information regarding the number of caches and their sizes, frequency of operation, slot numbers is all considered platform-related information and is not provided by this service. */ EFI_STATUS EFIAPI EdkiiPeiGetProcessorInfo(IN EDKII_PEI_MP_SERVICES2_PPI *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
{ return MpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuffer, NULL); }
tianocore/edk2
C++
Other
4,240
/* Initializes the COMP peripheral according to the specified. */
void COMP_Init(COMP_Selection_TypeDef selection, COMP_InitTypeDef *init_struct)
/* Initializes the COMP peripheral according to the specified. */ void COMP_Init(COMP_Selection_TypeDef selection, COMP_InitTypeDef *init_struct)
{ *(vu32*)(COMP_BASE + selection) = init_struct->Invert | init_struct->NonInvert | init_struct->Output | init_struct->OutputPol | init_struct->BlankingSrce | init_struct->Hysteresis | init_struct->Mode | init_struct->OFLT; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is a copy of the common vmtruncate, but with the locking corrected to take into account the fact that NFS requires inode->i_size to be updated under the inode->i_lock. */
static int nfs_vmtruncate(struct inode *inode, loff_t offset)
/* This is a copy of the common vmtruncate, but with the locking corrected to take into account the fact that NFS requires inode->i_size to be updated under the inode->i_lock. */ static int nfs_vmtruncate(struct inode *inode, loff_t offset)
{ loff_t oldsize; int err; err = inode_newsize_ok(inode, offset); if (err) goto out; spin_lock(&inode->i_lock); oldsize = inode->i_size; i_size_write(inode, offset); spin_unlock(&inode->i_lock); truncate_pagecache(inode, oldsize, offset); out: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* This function disables interrupt processing by the processor. */
EFI_STATUS EFIAPI CpuDisableInterrupt(IN EFI_CPU_ARCH_PROTOCOL *This)
/* This function disables interrupt processing by the processor. */ EFI_STATUS EFIAPI CpuDisableInterrupt(IN EFI_CPU_ARCH_PROTOCOL *This)
{ ArmDisableInterrupts (); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* 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(LED3); HAL_Delay(200); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Segment LCD Initialization routine for EFM32 STK display. */
void SegmentLCD_Init(bool useBoost)
/* Segment LCD Initialization routine for EFM32 STK display. */ void SegmentLCD_Init(bool useBoost)
{ CMU_ClockEnable(cmuClock_CORELE, true); CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO); CMU_ClockDivSet(cmuClock_LCDpre, LCD_CMU_CLK_PRE); CMU_LCDClkFDIVSet(LCD_CMU_CLK_DIV); CMU_ClockEnable(cmuClock_LCD, true); LCD_DISPLAY_ENABLE(); LCD_IntDisable(0xFFFFFFFF); LCD_Init(&lcdInit); LCD_SEGMENTS_ENABLE(); if (useBoost) { LCD_VBoostSet(LCD_BOOST_LEVEL); LCD_VLCDSelect(lcdVLCDSelVExtBoost); CMU->LCDCTRL |= CMU_LCDCTRL_VBOOSTEN; } SegmentLCD_AllOff(); LCD_SyncBusyDelay(0xFFFFFFFF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* len <= VXFS_NAMELEN and de != NULL are guaranteed by caller. */
static int vxfs_match(int len, const char *const name, struct vxfs_direct *de)
/* len <= VXFS_NAMELEN and de != NULL are guaranteed by caller. */ static int vxfs_match(int len, const char *const name, struct vxfs_direct *de)
{ if (len != de->d_namelen) return 0; if (!de->d_ino) return 0; return !memcmp(name, de->d_name, len); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the @attribute to contain the given @attr_value, if possible. */
void g_file_info_set_attribute_boolean(GFileInfo *info, const char *attribute, gboolean attr_value)
/* Sets the @attribute to contain the given @attr_value, if possible. */ void g_file_info_set_attribute_boolean(GFileInfo *info, const char *attribute, gboolean attr_value)
{ g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); _g_file_info_set_attribute_boolean_by_id (info, lookup_attribute (attribute), attr_value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called. */
void g_object_notify(GObject *object, const gchar *property_name)
/* Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called. */ void g_object_notify(GObject *object, const gchar *property_name)
{ GParamSpec *pspec; g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (property_name != NULL); if (g_atomic_int_get (&object->ref_count) == 0) return; g_object_ref (object); pspec = g_param_spec_pool_lookup (pspec_pool, property_name, G_OBJECT_TYPE (object), TRUE); if (!pspec) g_warning ("%s: object class '%s' has no property named '%s'", G_STRFUNC, G_OBJECT_TYPE_NAME (object), property_name); else g_object_notify_by_spec_internal (object, pspec); g_object_unref (object); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* retval kStatus_Success Lock the sema42 gate successfully. retval kStatus_Failed Sema42 gate has been locked by another processor. */
status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
/* retval kStatus_Success Lock the sema42 gate successfully. retval kStatus_Failed Sema42 gate has been locked by another processor. */ status_t RDC_SEMA42_TryLock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId)
{ assert(gateNum < RDC_SEMA42_GATE_COUNT); status_t status = kStatus_Success; uint8_t regGate; ++masterIndex; regGate = (uint8_t)(RDC_SEMAPHORE_GATE_LDOM(domainId) | RDC_SEMAPHORE_GATE_GTFSM(masterIndex)); RDC_SEMA42_GATEn(base, gateNum) = masterIndex; if (regGate != RDC_SEMA42_GATEn(base, gateNum)) { status = kStatus_Fail; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize the boards on-board LEDs (LD3 and LD4) The LEDs are connected to the following pins: */
static void leds_init(void)
/* Initialize the boards on-board LEDs (LD3 and LD4) The LEDs are connected to the following pins: */ static void leds_init(void)
{ LED_PORT_C->AFSEL &= ~(1 << LED_BLUE_PIN); LED_PORT_D->AFSEL &= ~((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN)); LED_PORT_C->DIR |= (1 << LED_BLUE_PIN); LED_PORT_D->DIR |= ((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN)); IOC->PC_OVER[LED_BLUE_PIN] = IOC_OVERRIDE_OE; IOC->PD_OVER[LED_GREEN_PIN] = IOC_OVERRIDE_OE; IOC->PD_OVER[LED_RED_PIN] = IOC_OVERRIDE_OE; LED_RAINBOW(); }
labapart/polymcu
C++
null
201
/* param base SAI base pointer param order Data order MSB or LSB */
void SAI_RxSetDataOrder(I2S_Type *base, sai_data_order_t order)
/* param base SAI base pointer param order Data order MSB or LSB */ void SAI_RxSetDataOrder(I2S_Type *base, sai_data_order_t order)
{ uint32_t val = (base->RCR4) & (~I2S_RCR4_MF_MASK); val |= I2S_RCR4_MF(order); base->RCR4 = val; }
eclipse-threadx/getting-started
C++
Other
310
/* Set frame size (making an assumption that the supplied size is supported by this controller) */
static int spi_m2s_hw_bt_set(struct m2s_spi_slave *s, int bt)
/* Set frame size (making an assumption that the supplied size is supported by this controller) */ static int spi_m2s_hw_bt_set(struct m2s_spi_slave *s, int bt)
{ int ret = 0; MSS_SPI(s)->control &= ~SPI_CONTROL_ENABLE; MSS_SPI(s)->txrxdf_size = bt; MSS_SPI(s)->control |= SPI_CONTROL_ENABLE; d_printk(3, "bus=%d,bt=%d,txrxdf_size=%d,ret=%d\n", s->slave.bus, bt, MSS_SPI(s)->txrxdf_size, ret); return ret; }
EmcraftSystems/u-boot
C++
Other
181
/* The function is used to Clear reset source by write 1. The */
void SysCtlResetSrcClear(unsigned long ulSrc)
/* The function is used to Clear reset source by write 1. The */ void SysCtlResetSrcClear(unsigned long ulSrc)
{ xHWREG(GCR_RSTSRC) |= ulSrc; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* nlmsg_find_attr - find a specific attribute in a netlink message */
struct nlattr* nlmsg_find_attr(struct nlmsghdr *nlh, int hdrlen, int attrtype)
/* nlmsg_find_attr - find a specific attribute in a netlink message */ struct nlattr* nlmsg_find_attr(struct nlmsghdr *nlh, int hdrlen, int attrtype)
{ return nla_find(nlmsg_attrdata(nlh, hdrlen), nlmsg_attrlen(nlh, hdrlen), attrtype); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Determine whether the Measurement record is for core code. */
BOOLEAN IsCorePerf(IN MEASUREMENT_RECORD *Measurement)
/* Determine whether the Measurement record is for core code. */ BOOLEAN IsCorePerf(IN MEASUREMENT_RECORD *Measurement)
{ BOOLEAN RetVal; RetVal = (BOOLEAN)( ((Measurement->Identifier == MODULE_START_ID) || (Measurement->Identifier == MODULE_END_ID) || (Measurement->Identifier == MODULE_LOADIMAGE_START_ID) || (Measurement->Identifier == MODULE_LOADIMAGE_END_ID) || (Measurement->Identifier == MODULE_DB_START_ID) || (Measurement->Identifier == MODULE_DB_END_ID) || (Measurement->Identifier == MODULE_DB_SUPPORT_START_ID) || (Measurement->Identifier == MODULE_DB_SUPPORT_END_ID) || (Measurement->Identifier == MODULE_DB_STOP_START_ID) || (Measurement->Identifier == MODULE_DB_STOP_START_ID)) ); return RetVal; }
tianocore/edk2
C++
Other
4,240
/* Call PnP BIOS function 0x42, "read ESCD" nvram_base is determined by calling escd_info */
static int __pnp_bios_read_escd(char *data, u32 nvram_base)
/* Call PnP BIOS function 0x42, "read ESCD" nvram_base is determined by calling escd_info */ static int __pnp_bios_read_escd(char *data, u32 nvram_base)
{ u16 status; if (!pnp_bios_present()) return ESCD_FUNCTION_NOT_SUPPORTED; status = call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, data, 65536, __va(nvram_base), 65536); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* A request has just been released. Account for it, update the full and congestion status, wake up any waiters. Called under q->queue_lock. */
static void freed_request(struct request_queue *q, int sync, int priv)
/* A request has just been released. Account for it, update the full and congestion status, wake up any waiters. Called under q->queue_lock. */ static void freed_request(struct request_queue *q, int sync, int priv)
{ struct request_list *rl = &q->rq; rl->count[sync]--; if (priv) rl->elvpriv--; __freed_request(q, sync); if (unlikely(rl->starved[sync ^ 1])) __freed_request(q, sync ^ 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_enable_irq(mss_uart_instance_t *this_uart, mss_uart_irq_t irq_mask)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_enable_irq(mss_uart_instance_t *this_uart, mss_uart_irq_t irq_mask)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); ASSERT(MSS_UART_INVALID_IRQ > irq_mask); if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && (MSS_UART_INVALID_IRQ > irq_mask)) { NVIC_ClearPendingIRQ(this_uart->irqn); this_uart->hw_reg->IER |= (uint8_t)irq_mask & IIRF_MASK; this_uart->hw_reg->IEM |= (uint8_t)(((uint32_t)irq_mask & ~((uint32_t)IIRF_MASK)) >> 4u); NVIC_EnableIRQ(this_uart->irqn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 10.a TLLI The TLLI is encoded as a binary number with a length of 4 octets. TLLI is defined in 3GPP TS 23.003 */
guint16 de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 10.a TLLI The TLLI is encoded as a binary number with a length of 4 octets. TLLI is defined in 3GPP TS 23.003 */ guint16 de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset, tlli; curr_offset = offset; tlli = tvb_get_ntohl(tvb, curr_offset); proto_tree_add_item(tree, hf_gsm_a_rr_tlli, tvb, curr_offset, 4, ENC_BIG_ENDIAN); curr_offset = curr_offset + 4; if(add_string) g_snprintf(add_string, string_len, " - 0x%x", tlli); return(curr_offset - offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* if Count is < 2 then perform no action. if Size is < 1 then perform no action. */
VOID EFIAPI PerformQuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
/* if Count is < 2 then perform no action. if Size is < 1 then perform no action. */ VOID EFIAPI PerformQuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
{ VOID *Buffer; ASSERT (BufferToSort != NULL); ASSERT (CompareFunction != NULL); Buffer = AllocateZeroPool (ElementSize); ASSERT (Buffer != NULL); QuickSort ( BufferToSort, Count, ElementSize, CompareFunction, Buffer ); FreePool (Buffer); return; }
tianocore/edk2
C++
Other
4,240
/* Opens or creates a message channel for a CAN connection of a fieldbus adapter. */
static HRESULT IxxatVciLibFuncCanChannelOpen(HANDLE hDevice, UINT32 dwCanNo, BOOL fExclusive, PHANDLE phCanChn)
/* Opens or creates a message channel for a CAN connection of a fieldbus adapter. */ static HRESULT IxxatVciLibFuncCanChannelOpen(HANDLE hDevice, UINT32 dwCanNo, BOOL fExclusive, PHANDLE phCanChn)
{ HRESULT result = VCI_E_UNEXPECTED; assert(ixxatVciLibFuncCanChannelOpenPtr != NULL); assert(ixxatVciDllHandle != NULL); if ((ixxatVciLibFuncCanChannelOpenPtr != NULL) && (ixxatVciDllHandle != NULL)) { result = ixxatVciLibFuncCanChannelOpenPtr(hDevice, dwCanNo, fExclusive, phCanChn); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { if (CurrentFirmwareMode == MODE_USART_BRIDGE) UARTBridge_Task(); else AVRISP_Task(); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This service enables PEIMs to update the boot mode variable. */
EFI_STATUS EFIAPI PeiServicesSetBootMode(IN EFI_BOOT_MODE BootMode)
/* This service enables PEIMs to update the boot mode variable. */ EFI_STATUS EFIAPI PeiServicesSetBootMode(IN EFI_BOOT_MODE BootMode)
{ CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->SetBootMode (PeiServices, BootMode); }
tianocore/edk2
C++
Other
4,240
/* Set Timer DMA Requests on Capture/Compare Events. Capture/compare events will cause DMA requests to be generated. */
void timer_set_dma_on_compare_event(uint32_t timer_peripheral)
/* Set Timer DMA Requests on Capture/Compare Events. Capture/compare events will cause DMA requests to be generated. */ void timer_set_dma_on_compare_event(uint32_t timer_peripheral)
{ TIM_CR2(timer_peripheral) &= ~TIM_CR2_CCDS; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Get the ADC pin corresponding to the specified ADC channel. */
uint8_t ADC_GetChPin(const CM_ADC_TypeDef *ADCx, uint8_t u8Ch)
/* Get the ADC pin corresponding to the specified ADC channel. */ uint8_t ADC_GetChPin(const CM_ADC_TypeDef *ADCx, uint8_t u8Ch)
{ uint8_t u8RetPin; uint8_t u8FieldOfs; uint8_t u8RegIdx; __IO uint16_t *regCHMUXR; DDL_ASSERT(IS_ADC_REMAP_CH(ADCx, u8Ch)); regCHMUXR = (__IO uint16_t *)((uint32_t)&ADCx->CHMUXR0); u8RegIdx = u8Ch / 4U; u8FieldOfs = (u8Ch % 4U) * 4U; u8RetPin = ((uint8_t)(regCHMUXR[u8RegIdx] >> u8FieldOfs)) & 0xFU; return u8RetPin; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* sys_pipe() is the normal C calling standard for creating a pipe. It's not the way unix traditionally does this, though. */
SYSCALL_DEFINE1(sparc_pipe_real, struct pt_regs *, regs)
/* sys_pipe() is the normal C calling standard for creating a pipe. It's not the way unix traditionally does this, though. */ SYSCALL_DEFINE1(sparc_pipe_real, struct pt_regs *, regs)
{ int fd[2]; int error; error = do_pipe_flags(fd, 0); if (error) goto out; regs->u_regs[UREG_I1] = fd[1]; error = fd[0]; out: return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base Pointer to FLEXIO_I2C_Type structure return Status flag, use status flag to AND #_flexio_i2c_master_status_flags can get the related status. */
uint32_t FLEXIO_I2C_MasterGetStatusFlags(FLEXIO_I2C_Type *base)
/* param base Pointer to FLEXIO_I2C_Type structure return Status flag, use status flag to AND #_flexio_i2c_master_status_flags can get the related status. */ uint32_t FLEXIO_I2C_MasterGetStatusFlags(FLEXIO_I2C_Type *base)
{ uint32_t status = 0; status = ((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1UL << base->shifterIndex[0])) >> base->shifterIndex[0]); status |= (((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1UL << base->shifterIndex[1])) >> (base->shifterIndex[1])) << 1U); status |= (((FLEXIO_GetShifterErrorFlags(base->flexioBase) & (1UL << base->shifterIndex[1])) >> (base->shifterIndex[1])) << 2U); return status; }
eclipse-threadx/getting-started
C++
Other
310
/* I2C MSP Initialization This function configures the hardware resources used in this example. */
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP Initialization This function configures the hardware resources used in this example. */ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hi2c->Instance==I2C1) { __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF4_I2C1; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); __HAL_RCC_I2C1_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Generates a Software interrupt on selected EXTI line. */
void HAL_EXTI_GenerateSWInterrupt(uint32_t EXTI_Line)
/* Generates a Software interrupt on selected EXTI line. */ void HAL_EXTI_GenerateSWInterrupt(uint32_t EXTI_Line)
{ assert_param(IS_HAL_EXTI_CONFIG_LINE(EXTI_Line)); SET_BIT(*(__IO uint32_t *) (((uint32_t) &(EXTI->SWIER1)) + ((EXTI_Line >> 5 ) * 0x20UL)), (uint32_t)(1UL << (EXTI_Line & 0x1FUL))); }
ua1arn/hftrx
C++
null
69