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
/* Adds the static @interface_type to @instantiable_type. The information contained in the #GInterfaceInfo structure pointed to by @info is used to manage the relationship. */
void g_type_add_interface_static(GType instance_type, GType interface_type, const GInterfaceInfo *info)
/* Adds the static @interface_type to @instantiable_type. The information contained in the #GInterfaceInfo structure pointed to by @info is used to manage the relationship. */ void g_type_add_interface_static(GType instance_type, GType interface_type, const GInterfaceInfo *info)
{ g_return_if_fail (G_TYPE_IS_INSTANTIATABLE (instance_type)); g_return_if_fail (g_type_parent (interface_type) == G_TYPE_INTERFACE); g_rec_mutex_lock (&class_init_rec_mutex); G_WRITE_LOCK (&type_rw_lock); if (check_add_interface_L (instance_type, interface_type)) { TypeNode *node = lookup_type_node...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disables the device (putting it in lower power sleep mode) */
int tcs34725Disable(lua_State *L)
/* Disables the device (putting it in lower power sleep mode) */ int tcs34725Disable(lua_State *L)
{ uint8_t reg = 0; reg = tcs34725Read8(TCS34725_ENABLE); tcs34725Write8(TCS34725_ENABLE, reg & ~(TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN)); _tcs34725Initialised = false; return 0; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* This function writes a char in the LCD RAM. */
void LCD_GLASS_DisplayChar(uint8_t *ch, Point_Typedef point, Apostrophe_Typedef apostrophe, uint8_t position)
/* This function writes a char in the LCD RAM. */ void LCD_GLASS_DisplayChar(uint8_t *ch, Point_Typedef point, Apostrophe_Typedef apostrophe, uint8_t position)
{ while(LCD_GetFlagStatus(LCD_FLAG_UDR) != RESET) { } LCD_GLASS_WriteChar(ch, point, apostrophe, position); LCD_UpdateDisplayRequest(); }
avem-labs/Avem
C++
MIT License
1,752
/* RTC Interrupt Handler, invoke callback if defined. The interrupt table is in assembly startup file startup_efm32.s. */
void RTC_IRQHandler(void)
/* RTC Interrupt Handler, invoke callback if defined. The interrupt table is in assembly startup file startup_efm32.s. */ void RTC_IRQHandler(void)
{ RTC_IntClear(RTC_IF_COMP0); RTC_IntDisable(RTC_IF_COMP0); rtcFlag = false; }
remotemcu/remcu-chip-sdks
C++
null
436
/* 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 Vector12_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 Vector12_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (12 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* calculate the amount of free blocks in the map. */
unsigned int adfs_map_free(struct super_block *sb)
/* calculate the amount of free blocks in the map. */ unsigned int adfs_map_free(struct super_block *sb)
{ struct adfs_sb_info *asb = ADFS_SB(sb); struct adfs_discmap *dm; unsigned int total = 0; unsigned int zone; dm = asb->s_map; zone = asb->s_map_size; do { total += scan_free_map(asb, dm++); } while (--zone > 0); return signed_asl(total, asb->s_map2blk); }
robutest/uclinux
C++
GPL-2.0
60
/* Description: When a PHY interrupt occurs, the handler disables interrupts, and schedules a work task to clear the interrupt. */
static irqreturn_t phy_interrupt(int irq, void *phy_dat)
/* Description: When a PHY interrupt occurs, the handler disables interrupts, and schedules a work task to clear the interrupt. */ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
{ struct phy_device *phydev = phy_dat; if (PHY_HALTED == phydev->state) return IRQ_NONE; disable_irq_nosync(irq); atomic_inc(&phydev->irq_disable); schedule_work(&phydev->phy_queue); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* send an subscription notify event to user client: client must be user client. */
int snd_seq_client_notify_subscription(int client, int port, struct snd_seq_port_subscribe *info, int evtype)
/* send an subscription notify event to user client: client must be user client. */ int snd_seq_client_notify_subscription(int client, int port, struct snd_seq_port_subscribe *info, int evtype)
{ struct snd_seq_event event; memset(&event, 0, sizeof(event)); event.type = evtype; event.data.connect.dest = info->dest; event.data.connect.sender = info->sender; return snd_seq_system_notify(client, port, &event); }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_pidpei_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_set_pidpei_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); ASSERT(handler != INVALID_IRQ_HANDLER); if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && (handler != INVALID_IRQ_HANDLER)) { this_uart->pid_pei_handler = handler; NVIC_ClearPendingIRQ( this_uar...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal)
{ ASSERT(GPIOBaseValid(ulPort)); HWREG(ulPort + (GPIO_O_GPIO_DATA + (ucPins << 2))) = ucVal; }
micropython/micropython
C++
Other
18,334
/* This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. If there are any bit differences in the two GUIDs, then FALSE is returned. */
BOOLEAN LocalCompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
/* This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned. If there are any bit differences in the two GUIDs, then FALSE is returned. */ BOOLEAN LocalCompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
{ UINT64 *Left; UINT64 *Right; Left = (UINT64 *)Guid1; Right = (UINT64 *)Guid2; return (BOOLEAN)(Left[0] == Right[0] && Left[1] == Right[1]); }
tianocore/edk2
C++
Other
4,240
/* Form the 64 bit 8390 multicast table from the linked list of addresses associated with this dev structure. */
static void make_mc_bits(u8 *bits, struct net_device *dev)
/* Form the 64 bit 8390 multicast table from the linked list of addresses associated with this dev structure. */ static void make_mc_bits(u8 *bits, struct net_device *dev)
{ struct dev_mc_list *dmi; u32 crc; for (dmi=dev->mc_list; dmi; dmi=dmi->next) { crc = ether_crc(ETH_ALEN, dmi->dmi_addr); bits[crc>>29] |= (1<<((crc>>26)&7)); } }
robutest/uclinux
C++
GPL-2.0
60
/* This routines are called before setting or resetting tty->stopped. They enable or disable transmitter interrupts, as necessary. */
static void mxser_stop(struct tty_struct *tty)
/* This routines are called before setting or resetting tty->stopped. They enable or disable transmitter interrupts, as necessary. */ static void mxser_stop(struct tty_struct *tty)
{ struct mxser_port *info = tty->driver_data; unsigned long flags; spin_lock_irqsave(&info->slock, flags); if (info->IER & UART_IER_THRI) { info->IER &= ~UART_IER_THRI; outb(info->IER, info->ioaddr + UART_IER); } spin_unlock_irqrestore(&info->slock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Initiates a read data byte (READ) sequence from the Flash. This is done by driving the /CS line low to select the device, then the READ instruction is transmitted followed by 3 bytes address. This function exit and keep the /CS line low, so the Flash still being selected. With this technique the whole content of the...
void sFLASH_StartReadSequence(uint32_t ReadAddr)
/* Initiates a read data byte (READ) sequence from the Flash. This is done by driving the /CS line low to select the device, then the READ instruction is transmitted followed by 3 bytes address. This function exit and keep the /CS line low, so the Flash still being selected. With this technique the whole content of the...
{ sFLASH_CS_LOW(); sFLASH_SendByte(sFLASH_CMD_READ); sFLASH_SendByte((ReadAddr & 0xFF0000) >> 16); sFLASH_SendByte((ReadAddr& 0xFF00) >> 8); sFLASH_SendByte(ReadAddr & 0xFF); }
avem-labs/Avem
C++
MIT License
1,752
/* Note, the DW_RESET pin should not be driven high externally. */
static int dwt_hw_reset(const struct device *dev)
/* Note, the DW_RESET pin should not be driven high externally. */ static int dwt_hw_reset(const struct device *dev)
{ const struct dwt_hi_cfg *hi_cfg = dev->config; if (gpio_pin_configure_dt(&hi_cfg->rst_gpio, GPIO_OUTPUT_ACTIVE)) { LOG_ERR("Failed to configure GPIO pin %u", hi_cfg->rst_gpio.pin); return -EINVAL; } k_sleep(K_MSEC(1)); gpio_pin_set_dt(&hi_cfg->rst_gpio, 0); k_sleep(K_MSEC(5)); if (gpio_pin_configure_dt(&hi...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Sets the number of packets to request when transferring multiple bulk packets. */
void USBEndpointPacketCountSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Count)
/* Sets the number of packets to request when transferring multiple bulk packets. */ void USBEndpointPacketCountSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Count)
{ HWREG(ui32Base + USB_O_RQPKTCOUNT1 + (0x4 * (USBEPToIndex(ui32Endpoint) - 1))) = ui32Count; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* mtd_ooblayout_ecc - Get the OOB region definition of a specific ECC section @mtd: MTD device structure */
int mtd_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *oobecc)
/* mtd_ooblayout_ecc - Get the OOB region definition of a specific ECC section @mtd: MTD device structure */ int mtd_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *oobecc)
{ memset(oobecc, 0, sizeof(*oobecc)); if (!mtd || section < 0) return -EINVAL; if (!mtd->ooblayout || !mtd->ooblayout->ecc) return -ENOTSUPP; return mtd->ooblayout->ecc(mtd, section, oobecc); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Searches base to base for an item that matches *key. */
void* _lv_utils_bsearch(const void *key, const void *base, uint32_t n, uint32_t size, int32_t(*cmp)(const void *pRef, const void *pElement))
/* Searches base to base for an item that matches *key. */ void* _lv_utils_bsearch(const void *key, const void *base, uint32_t n, uint32_t size, int32_t(*cmp)(const void *pRef, const void *pElement))
{ const char * middle; int32_t c; for(middle = base; n != 0;) { middle += (n / 2) * size; if((c = (*cmp)(key, middle)) > 0) { n = (n / 2) - ((n & 1) == 0); base = (middle += size); } else if(c < 0) { n /= 2; middle = base; ...
pikasTech/PikaPython
C++
MIT License
1,403
/* Search an area of @size in the kernel virtual mapping area, and reserved it for out purposes. Returns the area descriptor on success or NULL on failure. */
struct vm_struct* get_vm_area(unsigned long size, unsigned long flags)
/* Search an area of @size in the kernel virtual mapping area, and reserved it for out purposes. Returns the area descriptor on success or NULL on failure. */ struct vm_struct* get_vm_area(unsigned long size, unsigned long flags)
{ return __get_vm_area_node(size, 1, flags, VMALLOC_START, VMALLOC_END, -1, GFP_KERNEL, __builtin_return_address(0)); }
robutest/uclinux
C++
GPL-2.0
60
/* If DestinationGuid is NULL, then ASSERT(). If SourceGuid is NULL, then ASSERT(). */
GUID* EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
/* If DestinationGuid is NULL, then ASSERT(). If SourceGuid is NULL, then ASSERT(). */ GUID* EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
{ WriteUnaligned64 ( (UINT64 *)DestinationGuid, ReadUnaligned64 ((CONST UINT64 *)SourceGuid) ); WriteUnaligned64 ( (UINT64 *)DestinationGuid + 1, ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1) ); return DestinationGuid; }
tianocore/edk2
C++
Other
4,240
/* The timer is used to implement the timing for the protocol. */
static void timer0_delay_callback(void *cb_param, uint32_t event, void *arg)
/* The timer is used to implement the timing for the protocol. */ static void timer0_delay_callback(void *cb_param, uint32_t event, void *arg)
{ if(delay_flag != 0) delay_flag--; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Gets the number of bits transferred per frame. */
unsigned char SPIBitLengthGet(unsigned long ulBase)
/* Gets the number of bits transferred per frame. */ unsigned char SPIBitLengthGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); return (xHWREG(ulBase + SPI_CNTRL1) & SPI_CNTRL1_DFL_M); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */
void PWMA_RELOAD3_IRQHandler(void)
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */ void PWMA_RELOAD3_IRQHandler(void)
{ PWM_HAL_ClearReloadFlag(g_pwmBase[0], 3U); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns pointer to registered object with id, which is next number to given id. */
void* idr_get_next(struct idr *idp, int *nextidp)
/* Returns pointer to registered object with id, which is next number to given id. */ void* idr_get_next(struct idr *idp, int *nextidp)
{ struct idr_layer *p, *pa[MAX_LEVEL]; struct idr_layer **paa = &pa[0]; int id = *nextidp; int n, max; n = idp->layers * IDR_BITS; max = 1 << n; p = rcu_dereference(idp->top); if (!p) return NULL; while (id < max) { while (n > 0 && p) { n -= IDR_BITS; *paa++ = p; p = rcu_dereference(p->ary[(id >> ...
robutest/uclinux
C++
GPL-2.0
60
/* Update the PK form base on the input file path info. */
BOOLEAN EFIAPI UpdatePKFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
/* Update the PK form base on the input file path info. */ BOOLEAN EFIAPI UpdatePKFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
{ return UpdatePage (FilePath, FORMID_ENROLL_PK_FORM); }
tianocore/edk2
C++
Other
4,240
/* Returns 0 if dma_alloc_coherent should continue with allocating from generic memory areas, or !0 if dma_alloc_coherent should return @ret. */
int dma_alloc_from_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle, void **ret)
/* Returns 0 if dma_alloc_coherent should continue with allocating from generic memory areas, or !0 if dma_alloc_coherent should return @ret. */ int dma_alloc_from_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle, void **ret)
{ struct dma_coherent_mem *mem; int order = get_order(size); int pageno; if (!dev) return 0; mem = dev->dma_mem; if (!mem) return 0; *ret = NULL; if (unlikely(size > (mem->size << PAGE_SHIFT))) goto err; pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); if (unlikely(pageno < 0)) goto er...
robutest/uclinux
C++
GPL-2.0
60
/* Returns a byte from buffer. As per the offset given this function returns byte from buffer. */
int32_t FSGetByte(uint8_t *buffer, int32_t iOffsetInUint8)
/* Returns a byte from buffer. As per the offset given this function returns byte from buffer. */ int32_t FSGetByte(uint8_t *buffer, int32_t iOffsetInUint8)
{ int32_t temp; temp = ((uint8_t) buffer[iOffsetInUint8]); return temp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the number of bytes of data available in the circular buffer. */
static int ti_buf_data_avail(struct circ_buf *cb)
/* Return the number of bytes of data available in the circular buffer. */ static int ti_buf_data_avail(struct circ_buf *cb)
{ return CIRC_CNT(cb->head, cb->tail, TI_WRITE_BUF_SIZE); }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to FLEXIO_I2C_Type structure param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state */
void FLEXIO_I2C_MasterTransferAbort(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle)
/* param base Pointer to FLEXIO_I2C_Type structure param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state */ void FLEXIO_I2C_MasterTransferAbort(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle)
{ assert(handle != NULL); FLEXIO_I2C_MasterDisableInterrupts( base, (uint32_t)kFLEXIO_I2C_TxEmptyInterruptEnable | (uint32_t)kFLEXIO_I2C_RxFullInterruptEnable); handle->state = (uint8_t)kFLEXIO_I2C_Idle; }
eclipse-threadx/getting-started
C++
Other
310
/* Allocate a new buffer and add it to the list of free buffers for this context. Must be called with ohci->lock held. */
static int context_add_buffer(struct context *ctx)
/* Allocate a new buffer and add it to the list of free buffers for this context. Must be called with ohci->lock held. */ static int context_add_buffer(struct context *ctx)
{ struct descriptor_buffer *desc; dma_addr_t uninitialized_var(bus_addr); int offset; if (ctx->total_allocation >= 16*1024*1024) return -ENOMEM; desc = dma_alloc_coherent(ctx->ohci->card.device, PAGE_SIZE, &bus_addr, GFP_ATOMIC); if (!desc) return -ENOMEM; offset = (void *)&desc->buffer - (void *)desc; d...
robutest/uclinux
C++
GPL-2.0
60
/* param base ENET_QOS peripheral base address. param enable Enable/Disable Rx parser function */
status_t ENET_QOS_EnableRxParser(ENET_QOS_Type *base, bool enable)
/* param base ENET_QOS peripheral base address. param enable Enable/Disable Rx parser function */ status_t ENET_QOS_EnableRxParser(ENET_QOS_Type *base, bool enable)
{ status_t result = kStatus_Success; if (enable) { base->MTL_OPERATION_MODE |= ENET_QOS_MTL_OPERATION_MODE_FRPE_MASK; } else { base->MTL_OPERATION_MODE &= ~ENET_QOS_MTL_OPERATION_MODE_FRPE_MASK; result = ENET_QOS_PollStatusFlag(&(base->MTL_RXP_CONTROL_STATUS), ENET_QOS_MT...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @virt_addr: index into EDA cache used to determine which element to execute the function on @dev_addr: device address of element in cache will be returned using @dev_addr @function: function to execute on element of cache (must be atomic) @priv: private data of function */
int wlp_eda_for_virtual(struct wlp_eda *eda, const unsigned char virt_addr[ETH_ALEN], struct uwb_dev_addr *dev_addr, wlp_eda_for_each_f function, void *priv)
/* @virt_addr: index into EDA cache used to determine which element to execute the function on @dev_addr: device address of element in cache will be returned using @dev_addr @function: function to execute on element of cache (must be atomic) @priv: private data of function */ int wlp_eda_for_virtual(struct wlp_eda *ed...
{ int result = 0; struct wlp *wlp = container_of(eda, struct wlp, eda); struct wlp_eda_node *itr; unsigned long flags; int found = 0; spin_lock_irqsave(&eda->lock, flags); list_for_each_entry(itr, &eda->cache, list_node) { if (!memcmp(itr->virt_addr, virt_addr, sizeof(itr->virt_addr))) { result = (*fu...
robutest/uclinux
C++
GPL-2.0
60
/* This is the same as __round_jiffies() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early. */
unsigned long __round_jiffies_up(unsigned long j, int cpu)
/* This is the same as __round_jiffies() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early. */ unsigned long __round_jiffies_up(unsigned long j, int cpu)
{ return round_jiffies_common(j, cpu, true); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Calling this on a board that does not support it can be a very dangerous thing. The Madge board, for instance, will lock your machine hard when this is called. Luckily, its supported in a separate driver. */
static void sk_isa_read_eeprom(struct net_device *dev)
/* Calling this on a board that does not support it can be a very dangerous thing. The Madge board, for instance, will lock your machine hard when this is called. Luckily, its supported in a separate driver. */ static void sk_isa_read_eeprom(struct net_device *dev)
{ int i; sk_isa_sifwritew(dev, 0, SIFADX); sk_isa_sifwritew(dev, 0, SIFADR); dev->addr_len = 6; for(i = 0; i < 6; i++) dev->dev_addr[i] = sk_isa_sifreadw(dev, SIFINC) >> 8; }
robutest/uclinux
C++
GPL-2.0
60
/* RCC Set the USB Prescale Factor. The prescale factor can be set to 1 (no prescale) for use when the PLL clock is 48MHz, or 1.5 to generate the 48MHz USB clock from a 64MHz PLL clock. */
void rcc_set_usbpre(uint32_t usbpre)
/* RCC Set the USB Prescale Factor. The prescale factor can be set to 1 (no prescale) for use when the PLL clock is 48MHz, or 1.5 to generate the 48MHz USB clock from a 64MHz PLL clock. */ void rcc_set_usbpre(uint32_t usbpre)
{ RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_USBPRE) | usbpre; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Is used on I2O controller removal or LCT modification, when the device is removed from the system. Note that the device could still hang around until the refcount reaches 0. */
void i2o_device_remove(struct i2o_device *i2o_dev)
/* Is used on I2O controller removal or LCT modification, when the device is removed from the system. Note that the device could still hang around until the refcount reaches 0. */ void i2o_device_remove(struct i2o_device *i2o_dev)
{ struct i2o_device *tmp; struct i2o_controller *c = i2o_dev->iop; i2o_driver_notify_device_remove_all(i2o_dev); sysfs_remove_link(&i2o_dev->device.kobj, "parent"); sysfs_remove_link(&i2o_dev->device.kobj, "user"); list_for_each_entry(tmp, &c->devices, list) { if (tmp->lct_data.parent_tid == i2o_dev->lct_data.t...
robutest/uclinux
C++
GPL-2.0
60
/* Returns the device_node pointer with refcount incremented. Use of_node_put() on it when done. */
struct device_node* of_parse_phandle(struct device_node *np, const char *phandle_name, int index)
/* Returns the device_node pointer with refcount incremented. Use of_node_put() on it when done. */ struct device_node* of_parse_phandle(struct device_node *np, const char *phandle_name, int index)
{ const phandle *phandle; int size; phandle = of_get_property(np, phandle_name, &size); if ((!phandle) || (size < sizeof(*phandle) * (index + 1))) return NULL; return of_find_node_by_phandle(phandle[index]); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If the return value is non-negative, it is the new refcount of the cluster. If it is negative, it is -errno and indicates an error. */
int qcow2_update_cluster_refcount(BlockDriverState *bs, int64_t cluster_index, int addend, enum qcow2_discard_type type)
/* If the return value is non-negative, it is the new refcount of the cluster. If it is negative, it is -errno and indicates an error. */ int qcow2_update_cluster_refcount(BlockDriverState *bs, int64_t cluster_index, int addend, enum qcow2_discard_type type)
{ BDRVQcowState *s = bs->opaque; int ret; ret = update_refcount(bs, cluster_index << s->cluster_bits, 1, addend, type); if (ret < 0) { return ret; } return get_refcount(bs, cluster_index); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int IMG_InitPNG()
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ int IMG_InitPNG()
{ IMG_SetError("PNG images are not supported"); return(-1); }
DC-SWAT/DreamShell
C++
null
404
/* Get the length of received data in RX ring buffer. */
static size_t FLEXIO_UART_TransferGetRxRingBufferLength(flexio_uart_handle_t *handle)
/* Get the length of received data in RX ring buffer. */ static size_t FLEXIO_UART_TransferGetRxRingBufferLength(flexio_uart_handle_t *handle)
{ size_t size; if (handle->rxRingBufferTail > handle->rxRingBufferHead) { size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail); } else { size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail); } return size; }
labapart/polymcu
C++
null
201
/* Function updating 'tlm_configured' property of slot registry when slot is being cleared. */
static void update_tlm_configured_on_clearing(es_slot_reg_t *p_reg, uint8_t slot_no)
/* Function updating 'tlm_configured' property of slot registry when slot is being cleared. */ static void update_tlm_configured_on_clearing(es_slot_reg_t *p_reg, uint8_t slot_no)
{ if (p_reg->tlm_configured && slot_no == p_reg->tlm_slot) { p_reg->tlm_configured = false; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC1) { __HAL_RCC_ADC12_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function return %1 if the LEB properties should be added to the LEB properties tree in memory. Otherwise %0 is returned. */
static int valuable(struct ubifs_info *c, const struct ubifs_lprops *lprops)
/* This function return %1 if the LEB properties should be added to the LEB properties tree in memory. Otherwise %0 is returned. */ static int valuable(struct ubifs_info *c, const struct ubifs_lprops *lprops)
{ int n, cat = lprops->flags & LPROPS_CAT_MASK; struct ubifs_lpt_heap *heap; switch (cat) { case LPROPS_DIRTY: case LPROPS_DIRTY_IDX: case LPROPS_FREE: heap = &c->lpt_heap[cat - 1]; if (heap->cnt < heap->max_cnt) return 1; if (lprops->free + lprops->dirty >= c->dark_wm) return 1; return 0; case LPR...
robutest/uclinux
C++
GPL-2.0
60
/* This is based on the wall_to_monotonic offset and the total suspend time. Calls to settimeofday will affect the value returned (which basically means that however wrong your real time clock is at boot time, you get the right time here). */
void getboottime(struct timespec *ts)
/* This is based on the wall_to_monotonic offset and the total suspend time. Calls to settimeofday will affect the value returned (which basically means that however wrong your real time clock is at boot time, you get the right time here). */ void getboottime(struct timespec *ts)
{ struct timespec boottime = { .tv_sec = wall_to_monotonic.tv_sec + total_sleep_time.tv_sec, .tv_nsec = wall_to_monotonic.tv_nsec + total_sleep_time.tv_nsec }; set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Serializes a disconnect packet into the supplied buffer, ready for writing to a socket */
int mqtt_serialize_disconnect(unsigned char *buf, int buflen)
/* Serializes a disconnect packet into the supplied buffer, ready for writing to a socket */ int mqtt_serialize_disconnect(unsigned char *buf, int buflen)
{ return mqtt_serialize_zero(buf, buflen, MQTTPACKET_DISCONNECT); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f' */
static void clearbyvalues(global_State *g, GCObject *l, GCObject *f)
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f' */ static void clearbyvalues(global_State *g, GCObject *l, GCObject *f)
{ Table *h = gco2t(l); Node *n, *limit = gnodelast(h); unsigned int i; unsigned int asize = luaH_realasize(h); for (i = 0; i < asize; i++) { TValue *o = &h->array[i]; if (iscleared(g, gcvalueN(o))) setempty(o); } for (n = gnode(h, 0); n < limit; n++) { if (iscleared...
Nicholas3388/LuaNode
C++
Other
1,055
/* Check if Transmit Holding Register is empty. Check if the last data written in USART_THR have been loaded in TSR and the last data loaded in TSR have been transmitted. */
uint32_t usart_is_tx_empty(Usart *p_usart)
/* Check if Transmit Holding Register is empty. Check if the last data written in USART_THR have been loaded in TSR and the last data loaded in TSR have been transmitted. */ uint32_t usart_is_tx_empty(Usart *p_usart)
{ return (p_usart->US_CSR & US_CSR_TXEMPTY) > 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Atomic bitwise exclusive OR (XOR) primitive. is atomically bitwise XOR'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value)
/* Atomic bitwise exclusive OR (XOR) primitive. is atomically bitwise XOR'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */ atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value)
{ unsigned int key; atomic_val_t ret; key = irq_lock(); ret = *target; *target ^= value; irq_unlock(key); return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Returns next buffer for TX. Can wait if no buffer available. */
static unsigned char* enet_get_tx_buffer(struct ethernetif *ethernetif)
/* Returns next buffer for TX. Can wait if no buffer available. */ static unsigned char* enet_get_tx_buffer(struct ethernetif *ethernetif)
{ LWIP_UNUSED_ARG(ethernetif); static unsigned char ucBuffer[ENET_FRAME_MAX_FRAMELEN]; return ucBuffer; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Atomic get-and-set primitive. is atomically written at <target> and the previous value at <target> is returned. */
atomic_val_t z_impl_atomic_set(atomic_t *target, atomic_val_t value)
/* Atomic get-and-set primitive. is atomically written at <target> and the previous value at <target> is returned. */ atomic_val_t z_impl_atomic_set(atomic_t *target, atomic_val_t value)
{ k_spinlock_key_t key; atomic_val_t ret; key = k_spin_lock(&lock); ret = *target; *target = value; k_spin_unlock(&lock, key); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* MCU decoding for DC successive approximation refinement scan. Note: we assume such scans can be multi-component, although the spec is not very clear on the point. */
decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* MCU decoding for DC successive approximation refinement scan. Note: we assume such scans can be multi-component, although the spec is not very clear on the point. */ decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy; unsigned char *st; JCOEF p1; int blkn; if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) process_restart(cinfo); entropy->restarts_to_go--; } st = entropy->fixed_bin; p1 = 1 << cinfo->Al; for (blkn = 0; blkn...
xboot/xboot
C++
MIT License
779
/* Return the entire driver board structure to a user app. */
static int stli_getbrdstruct(struct stlibrd __user *arg)
/* Return the entire driver board structure to a user app. */ static int stli_getbrdstruct(struct stlibrd __user *arg)
{ struct stlibrd stli_dummybrd; struct stlibrd *brdp; if (copy_from_user(&stli_dummybrd, arg, sizeof(struct stlibrd))) return -EFAULT; if (stli_dummybrd.brdnr >= STL_MAXBRDS) return -ENODEV; brdp = stli_brds[stli_dummybrd.brdnr]; if (!brdp) return -ENODEV; if (copy_to_user(arg, brdp, sizeof(struct stlibrd)...
robutest/uclinux
C++
GPL-2.0
60
/* Stops the TIMER PWM signal generation on the complementary output. in interrupt mode. */
void ald_timer_pwmn_stop_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
/* Stops the TIMER PWM signal generation on the complementary output. in interrupt mode. */ void ald_timer_pwmn_stop_by_it(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
{ ald_timer_ocn_stop_by_it(hperh, ch); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clears the CAU3 module. This function can be used to clear all sensitive data from theCAU3 module, such as private keys. It is called internally by the CAU3 driver in case of an error or operation complete. */
void cau3_clear_all(CAU3_Type *base, bool addPKHA)
/* Clears the CAU3 module. This function can be used to clear all sensitive data from theCAU3 module, such as private keys. It is called internally by the CAU3 driver in case of an error or operation complete. */ void cau3_clear_all(CAU3_Type *base, bool addPKHA)
{ base->CW = (uint32_t)kCAU3_ClearAll; if (addPKHA) { cau3_pkha_clear_regabne(base, true, true, true, true); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* set the SSL context if we can read as many as data */
void SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes)
/* set the SSL context if we can read as many as data */ void SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes)
{ SSL_ASSERT3(ctx); ctx->read_ahead = yes; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* ppc440spe_desc_init_xor - initialize the descriptor for XOR operation */
static void ppc440spe_desc_init_xor(struct ppc440spe_adma_desc_slot *desc, int src_cnt, unsigned long flags)
/* ppc440spe_desc_init_xor - initialize the descriptor for XOR operation */ static void ppc440spe_desc_init_xor(struct ppc440spe_adma_desc_slot *desc, int src_cnt, unsigned long flags)
{ struct xor_cb *hw_desc = desc->hw_desc; memset(desc->hw_desc, 0, sizeof(struct xor_cb)); desc->hw_next = NULL; desc->src_cnt = src_cnt; desc->dst_cnt = 1; hw_desc->cbc = XOR_CBCR_TGT_BIT | src_cnt; if (flags & DMA_PREP_INTERRUPT) hw_desc->cbc |= XOR_CBCR_CBCE_BIT; }
robutest/uclinux
C++
GPL-2.0
60
/* Init interrupts callback for the specified I2C Port. */
void I2CIntCallbackInit(unsigned long ulBase, xtEventCallback xtI2CCallback)
/* Init interrupts callback for the specified I2C Port. */ void I2CIntCallbackInit(unsigned long ulBase, xtEventCallback xtI2CCallback)
{ xASSERT((ulBase == I2C0_BASE)); g_pfnI2CHandlerCallbacks[0] = xtI2CCallback; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */
BOOLEAN IsTypeInBuffer(IN EFI_HII_VALUE *Value)
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */ BOOLEAN IsTypeInBuffer(IN EFI_HII_VALUE *Value)
{ switch (Value->Type) { case EFI_IFR_TYPE_BUFFER: case EFI_IFR_TYPE_DATE: case EFI_IFR_TYPE_TIME: case EFI_IFR_TYPE_REF: return TRUE; default: return FALSE; } }
tianocore/edk2
C++
Other
4,240
/* This function parse the value got from TPM2_GetCapability and return the InputBufferSize. */
EFI_STATUS EFIAPI Tpm2GetCapabilityInputBufferSize(OUT UINT32 *InputBufferSize)
/* This function parse the value got from TPM2_GetCapability and return the InputBufferSize. */ EFI_STATUS EFIAPI Tpm2GetCapabilityInputBufferSize(OUT UINT32 *InputBufferSize)
{ TPMS_CAPABILITY_DATA TpmCap; TPMI_YES_NO MoreData; EFI_STATUS Status; Status = Tpm2GetCapability ( TPM_CAP_TPM_PROPERTIES, TPM_PT_INPUT_BUFFER, 1, &MoreData, &TpmCap ); if (EFI_ERROR (Status)) { return St...
tianocore/edk2
C++
Other
4,240
/* Fast approximation to the trigonometric cosine function for floating-point data. */
float32_t arm_cos_f32(float32_t x)
/* Fast approximation to the trigonometric cosine function for floating-point data. */ float32_t arm_cos_f32(float32_t x)
{ float32_t cosVal, fract, in; uint16_t index; float32_t a, b; int32_t n; float32_t findex; in = x * 0.159154943092f + 0.25f; n = (int32_t) in; if (in < 0.0f) { n--; } in = in - (float32_t) n; findex = (float32_t) FAST_MATH_TABLE_SIZE * in; index = ((uint16_t)findex) & 0x1ff; fract = fin...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Enable Power Voltage Detector. This provides voltage level threshold detection. The result of detection is provided in the power voltage detector output flag (see */
void pwr_enable_power_voltage_detect(uint32_t pvd_level)
/* Enable Power Voltage Detector. This provides voltage level threshold detection. The result of detection is provided in the power voltage detector output flag (see */ void pwr_enable_power_voltage_detect(uint32_t pvd_level)
{ PWR_CR &= ~PWR_CR_PLS_MASK; PWR_CR |= (PWR_CR_PVDE | pvd_level); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* alloc memory for the gather ring no need to alloc buf for the ring gdr_tail, gdr_head and gdr_count are initialized by this function */
static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
/* alloc memory for the gather ring no need to alloc buf for the ring gdr_tail, gdr_head and gdr_count are initialized by this function */ static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
{ dev->gdr = dma_alloc_coherent(dev->core_dev->device, sizeof(struct ce_gd) * PPC4XX_NUM_GD, &dev->gdr_pa, GFP_ATOMIC); if (!dev->gdr) return -ENOMEM; memset(dev->gdr, 0, sizeof(struct ce_gd) * PPC4XX_NUM_GD); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void)
{ Audio_Device_ProcessControlRequest(&Speaker_Audio_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns the number of IOCB entries needed to store @dsds. */
static uint16_t qla24xx_calc_iocbs(uint16_t dsds)
/* Returns the number of IOCB entries needed to store @dsds. */ static uint16_t qla24xx_calc_iocbs(uint16_t dsds)
{ uint16_t iocbs; iocbs = 1; if (dsds > 1) { iocbs += (dsds - 1) / 5; if ((dsds - 1) % 5) iocbs++; } return iocbs; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculates the remaining file size and new position of the pointer. */
void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
/* Calculates the remaining file size and new position of the pointer. */ void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
{ if(audio_state == AUDIO_STATE_PLAY) { buffer_ctl.offset = BUFFER_OFFSET_FULL; BSP_AUDIO_OUT_ChangeBuffer((uint16_t*)&buffer_ctl.buff[0], AUDIO_BUFFER_SIZE /2); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This is one of those areas where the initial VMS concepts don't really map onto the Linux concepts, and since we introduced multiple addresses per interface we have to cope with slightly odd ways of finding out what "our address" really is. Mostly it's not a problem; for this we just guess a sensible default. Eventu...
int dn_dev_bind_default(__le16 *addr)
/* This is one of those areas where the initial VMS concepts don't really map onto the Linux concepts, and since we introduced multiple addresses per interface we have to cope with slightly odd ways of finding out what "our address" really is. Mostly it's not a problem; for this we just guess a sensible default. Eventu...
{ struct net_device *dev; int rv; dev = dn_dev_get_default(); last_chance: if (dev) { rv = dn_dev_get_first(dev, addr); dev_put(dev); if (rv == 0 || dev == init_net.loopback_dev) return rv; } dev = init_net.loopback_dev; dev_hold(dev); goto last_chance; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Standard USB MIDI protocol: see the spec. Midiman protocol: like the standard protocol, but the control byte is the fourth byte in each packet, and uses length instead of CIN. */
static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length)
/* Standard USB MIDI protocol: see the spec. Midiman protocol: like the standard protocol, but the control byte is the fourth byte in each packet, and uses length instead of CIN. */ static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length)
{ int i; for (i = 0; i + 3 < buffer_length; i += 4) if (buffer[i] != 0) { int cable = buffer[i] >> 4; int length = snd_usbmidi_cin_length[buffer[i] & 0x0f]; snd_usbmidi_input_data(ep, cable, &buffer[i + 1], length); } }
robutest/uclinux
C++
GPL-2.0
60
/* This function prepares node at @node to be written to the media - it calculates node CRC and fills the common header. */
void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last)
/* This function prepares node at @node to be written to the media - it calculates node CRC and fills the common header. */ void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last)
{ uint32_t crc; struct ubifs_ch *ch = node; unsigned long long sqnum = next_sqnum(c); ubifs_assert(len >= UBIFS_CH_SZ); ch->magic = cpu_to_le32(UBIFS_NODE_MAGIC); ch->len = cpu_to_le32(len); if (last) ch->group_type = UBIFS_LAST_OF_NODE_GROUP; else ch->group_type = UBIFS_IN_NODE_GROUP; ch->sqnum = cpu_to_l...
robutest/uclinux
C++
GPL-2.0
60
/* Write unprotect read-only pages if Cr0.Bits.WP is 1. */
VOID SmmWriteUnprotectReadOnlyPage(OUT BOOLEAN *WriteProtect)
/* Write unprotect read-only pages if Cr0.Bits.WP is 1. */ VOID SmmWriteUnprotectReadOnlyPage(OUT BOOLEAN *WriteProtect)
{ IA32_CR0 Cr0; Cr0.UintN = AsmReadCr0 (); *WriteProtect = (Cr0.Bits.WP != 0); if (*WriteProtect) { Cr0.Bits.WP = 0; AsmWriteCr0 (Cr0.UintN); } }
tianocore/edk2
C++
Other
4,240
/* suspend the whole driver as soon as the first interface is suspended resume only when the last interface is resumed */
int usbnet_suspend(struct usb_interface *intf, pm_message_t message)
/* suspend the whole driver as soon as the first interface is suspended resume only when the last interface is resumed */ int usbnet_suspend(struct usb_interface *intf, pm_message_t message)
{ struct usbnet *dev = usb_get_intfdata(intf); if (!dev->suspend_count++) { spin_lock_irq(&dev->txq.lock); if (dev->txq.qlen && (message.event & PM_EVENT_AUTO)) { spin_unlock_irq(&dev->txq.lock); return -EBUSY; } else { set_bit(EVENT_DEV_ASLEEP, &dev->flags); spin_unlock_irq(&dev->txq.lock); } ...
robutest/uclinux
C++
GPL-2.0
60
/* Set the threshold for activity detection for all 3-axis */
static int adxl372_set_activity_threshold_xyz(const struct device *dev, uint8_t axis_reg_h, const struct adxl372_activity_threshold *act)
/* Set the threshold for activity detection for all 3-axis */ static int adxl372_set_activity_threshold_xyz(const struct device *dev, uint8_t axis_reg_h, const struct adxl372_activity_threshold *act)
{ int i, ret; for (i = 0; i < 3; i++) { ret = adxl372_set_activity_threshold(dev, axis_reg_h, act); if (ret) { return ret; } axis_reg_h += 2U; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Check whether the USART in SPI master mode contains a received character. */
uint32_t usart_spi_is_rx_ready(volatile avr32_usart_t *p_usart)
/* Check whether the USART in SPI master mode contains a received character. */ uint32_t usart_spi_is_rx_ready(volatile avr32_usart_t *p_usart)
{ return (p_usart->csr & AVR32_USART_CSR_RXRDY_MASK) != 0; }
memfault/zero-to-main
C++
null
200
/* Performs the necessary steps to cleanup after invoking VMGEXIT. Must be called after obtaining needed fields within the GHCB. */
VOID EFIAPI CcExitVmgDone(IN OUT GHCB *Ghcb, IN BOOLEAN InterruptState)
/* Performs the necessary steps to cleanup after invoking VMGEXIT. Must be called after obtaining needed fields within the GHCB. */ VOID EFIAPI CcExitVmgDone(IN OUT GHCB *Ghcb, IN BOOLEAN InterruptState)
{ if (InterruptState) { EnableInterrupts (); } }
tianocore/edk2
C++
Other
4,240
/* Internal Function. Free a pool by specified PoolIndex. */
EFI_STATUS InternalFreePoolByIndex(IN FREE_POOL_HEADER *FreePoolHdr)
/* Internal Function. Free a pool by specified PoolIndex. */ EFI_STATUS InternalFreePoolByIndex(IN FREE_POOL_HEADER *FreePoolHdr)
{ UINTN PoolIndex; ASSERT ((FreePoolHdr->Header.Size & (FreePoolHdr->Header.Size - 1)) == 0); ASSERT (((UINTN)FreePoolHdr & (FreePoolHdr->Header.Size - 1)) == 0); ASSERT (FreePoolHdr->Header.Size >= MIN_POOL_SIZE); PoolIndex = (UINTN)(HighBitSet32 ((UINT32)FreePoolHdr->Header.Size) - MIN_...
tianocore/edk2
C++
Other
4,240
/* param base XRDC2 peripheral base address. param memSlot Which memory slot descriptor to set. param valid True to set valid, false to set invalid. */
void XRDC2_SetMemSlotAccessValid(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool valid)
/* param base XRDC2 peripheral base address. param memSlot Which memory slot descriptor to set. param valid True to set valid, false to set invalid. */ void XRDC2_SetMemSlotAccessValid(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool valid)
{ uint32_t reg = base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 & ~XRDC2_EAL_MASK; if (valid) { base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = (reg | XRDC2_MSC_MSAC_W1_VLD_MASK); } else { base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = (reg & ~XRDC2_MSC_MSAC_W1_VLD_MA...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable Transmit underrun error interrupt @rmtoll IER TXUNRIE LL_SWPMI_EnableIT_TXUNR. */
void LL_SWPMI_EnableIT_TXUNR(SWPMI_TypeDef *SWPMIx)
/* Enable Transmit underrun error interrupt @rmtoll IER TXUNRIE LL_SWPMI_EnableIT_TXUNR. */ void LL_SWPMI_EnableIT_TXUNR(SWPMI_TypeDef *SWPMIx)
{ SET_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* For the MSP430 microcontroller family, please consider disabling the watchdog timer here, as it could time-out during the data segment initialization. To disable the watchdog timer, include a suitable device header file (or "msp430.h") and add the following line to the function below: */
int __low_level_init(void)
/* For the MSP430 microcontroller family, please consider disabling the watchdog timer here, as it could time-out during the data segment initialization. To disable the watchdog timer, include a suitable device header file (or "msp430.h") and add the following line to the function below: */ int __low_level_init(void)
{ _DINT(); WDTCTL = WDTPW+WDTHOLD; return 1; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function creates a Task. Creates a new Task and add it to the last of tasks that are ready to run */
OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry, const signed char *const pcName, unsigned short usStackDepth, void *pvParameters, unsigned long uxPriority, OsiTaskHandle *pTaskHandle)
/* This function creates a Task. Creates a new Task and add it to the last of tasks that are ready to run */ OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry, const signed char *const pcName, unsigned short usStackDepth, void *pvParameters, unsigned long uxPriority, OsiTaskHandle *pTaskHandle)
{ ASSERT (pdPASS == xTaskCreate( pEntry, (char const*)pcName, (usStackDepth/(sizeof( portSTACK_TYPE ))), pvParameters,(unsigned portBASE_TYPE)uxPriority, (TaskHandle_t*)pTaskHandle )); return OSI_OK; }
micropython/micropython
C++
Other
18,334
/* Returns response received from the card for the last command. */
uint32_t SDIO_GetResponse(uint32_t SDIO_RESP)
/* Returns response received from the card for the last command. */ uint32_t SDIO_GetResponse(uint32_t SDIO_RESP)
{ __IO uint32_t tmp = 0; assert_param(IS_SDIO_RESP(SDIO_RESP)); tmp = SDIO_RESP_ADDR + SDIO_RESP; return (*(__IO uint32_t *) tmp); }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* sunxi_lcd_cpu_write_data - write data to cpu panel. @screen_id: The index of screen. @data: Data to be transfer. */
s32 sunxi_lcd_cpu_write_data(u32 screen_id, u32 data)
/* sunxi_lcd_cpu_write_data - write data to cpu panel. @screen_id: The index of screen. @data: Data to be transfer. */ s32 sunxi_lcd_cpu_write_data(u32 screen_id, u32 data)
{ if (g_lcd_drv.src_ops.sunxi_lcd_cpu_write_data) return g_lcd_drv.src_ops.sunxi_lcd_cpu_write_data(screen_id, data); return -1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get number of memory blocks used in a Memory Pool. */
static uint32_t svcRtxMemoryPoolGetCount(osMemoryPoolId_t mp_id)
/* Get number of memory blocks used in a Memory Pool. */ static uint32_t svcRtxMemoryPoolGetCount(osMemoryPoolId_t mp_id)
{ EvrRtxMemoryPoolGetCount(mp, 0U); return 0U; } EvrRtxMemoryPoolGetCount(mp, mp->mp_info.used_blocks); return mp->mp_info.used_blocks; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* USBH_GetNextDesc This function return the next descriptor header. */
USBH_DescHeader_t* USBH_GetNextDesc(uint8_t *pbuf, uint16_t *ptr)
/* USBH_GetNextDesc This function return the next descriptor header. */ USBH_DescHeader_t* USBH_GetNextDesc(uint8_t *pbuf, uint16_t *ptr)
{ USBH_DescHeader_t *pnext; *ptr += ((USBH_DescHeader_t *)(void *)pbuf)->bLength; pnext = (USBH_DescHeader_t *)(void *)((uint8_t *)(void *)pbuf + \ ((USBH_DescHeader_t *)(void *)pbuf)->bLength); return (pnext); }
ua1arn/hftrx
C++
null
69
/* The function is used to Get LVD state. */
xtBoolean SysCtlLVDStateGet(void)
/* The function is used to Get LVD state. */ xtBoolean SysCtlLVDStateGet(void)
{ return (xHWREG(PWRCU_LVDCSR) & PWRCU_LVDCSR_LVDF)>>19; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Disable all Blink. This function will disable all Blink content. */
void xpro_lcd_blink_disable(void)
/* Disable all Blink. This function will disable all Blink content. */ void xpro_lcd_blink_disable(void)
{ slcd_disable_frame_counter(CONF_XPRO_LCD_BLINK_TIMER); slcd_disable_blink(); }
memfault/zero-to-main
C++
null
200
/* Reset usart peripheral registers to their default reset values. */
void USART_Reset(USART_T *usart)
/* Reset usart peripheral registers to their default reset values. */ void USART_Reset(USART_T *usart)
{ if (USART1 == usart) { RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_USART1); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_USART1); } else if (USART2 == usart) { RCM_EnableAPB1PeriphReset(RCM_APB1_PERIPH_USART2); RCM_DisableAPB1PeriphReset(RCM_APB1_PERIPH_USART2); } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Only net clients created with the legacy -net option and NICs need this. */
static char* assign_name(NetClientState *nc1, const char *model)
/* Only net clients created with the legacy -net option and NICs need this. */ static char* assign_name(NetClientState *nc1, const char *model)
{ NetClientState *nc; int id = 0; QTAILQ_FOREACH(nc, &net_clients, next) { if (nc == nc1) { continue; } if (strcmp(nc->model, model) == 0) { id++; } } return g_strdup_printf("%s.%d", model, id); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Start the RTOS Kernel with executing the specified thread. */
osStatus osKernelStart(osThreadDef_t *thread_def, void *argument)
/* Start the RTOS Kernel with executing the specified thread. */ osStatus osKernelStart(osThreadDef_t *thread_def, void *argument)
{ osThreadCreate(thread_def, argument); rt_system_scheduler_start(); return osOK; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Disables generator and fault interrupts for a PWM module. */
void PWMIntDisable(uint32_t ui32Base, uint32_t ui32GenFault)
/* Disables generator and fault interrupts for a PWM module. */ void PWMIntDisable(uint32_t ui32Base, uint32_t ui32GenFault)
{ ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE)); ASSERT((ui32GenFault & ~(PWM_INT_GEN_0 | PWM_INT_GEN_1 | PWM_INT_GEN_2 | PWM_INT_GEN_3 | PWM_INT_FAULT0 | PWM_INT_FAULT1 | PWM_INT_FAULT2 | PWM_INT_FAULT3)) == 0); HWREG(ui32Base + PWM_O_I...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Un-Register the Service B.2 and all its Characteristics... */
void service_b_2_3_remove(void)
/* Un-Register the Service B.2 and all its Characteristics... */ void service_b_2_3_remove(void)
{ bt_gatt_service_unregister(&service_b_2_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* show_boot_progress: - indicate state of the boot process */
void show_boot_progress(int status)
/* show_boot_progress: - indicate state of the boot process */ void show_boot_progress(int status)
{ switch(status) { case 1: csb226_set_led(0,1); break; case 5: csb226_set_led(1,1); break; case 15: csb226_set_led(2,1); break; } return; }
EmcraftSystems/u-boot
C++
Other
181
/* Store the basic register settings needed by the controller. */
static void configure_hc(struct uhci_hcd *uhci)
/* Store the basic register settings needed by the controller. */ static void configure_hc(struct uhci_hcd *uhci)
{ outb(USBSOF_DEFAULT, uhci->io_addr + USBSOF); outl(uhci->frame_dma_handle, uhci->io_addr + USBFLBASEADD); outw(uhci->frame_number & UHCI_MAX_SOF_NUMBER, uhci->io_addr + USBFRNUM); uhci_to_hcd(uhci)->state = HC_STATE_SUSPENDED; mb(); pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, USBLEGSUP_DE...
robutest/uclinux
C++
GPL-2.0
60
/* "I ask you, have you ever known what it is to be an orphan?" */
static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignored_task)
/* "I ask you, have you ever known what it is to be an orphan?" */ static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignored_task)
{ struct task_struct *p; do_each_pid_task(pgrp, PIDTYPE_PGID, p) { if ((p == ignored_task) || (p->exit_state && thread_group_empty(p)) || is_global_init(p->real_parent)) continue; if (task_pgrp(p->real_parent) != pgrp && task_session(p->real_parent) == task_session(p)) return 0; } while_e...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function creates a new device node in a newly allocated buffer of size NodeLength and initializes the device path node header with NodeType and NodeSubType. The new device path node is returned. If NodeLength is smaller than a device path header, then NULL is returned. If there is not enough memory to allocate ...
EFI_DEVICE_PATH_PROTOCOL* UefiDevicePathLibCreateDeviceNode(UINT8 NodeType, UINT8 NodeSubType, UINT16 NodeLength)
/* This function creates a new device node in a newly allocated buffer of size NodeLength and initializes the device path node header with NodeType and NodeSubType. The new device path node is returned. If NodeLength is smaller than a device path header, then NULL is returned. If there is not enough memory to allocate ...
{ EFI_DEVICE_PATH_PROTOCOL *DevicePath; if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { return NULL; } DevicePath = AllocateZeroPool (NodeLength); if (DevicePath != NULL) { DevicePath->Type = NodeType; DevicePath->SubType = NodeSubType; SetDevicePathNodeLength (DevicePath, Nod...
tianocore/edk2
C++
Other
4,240
/* Send a sequence of bytes to a SPI device. Received bytes on the SPI bus are discarded. */
status_code_t spi_write_packet(SPI_t *spi, const uint8_t *data, size_t len)
/* Send a sequence of bytes to a SPI device. Received bytes on the SPI bus are discarded. */ status_code_t spi_write_packet(SPI_t *spi, const uint8_t *data, size_t len)
{ while (len--) { spi_write_single(spi, *data++); while (!spi_is_rx_full(spi)) { } } return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* gets a TypeCode complex string parameter and displays it in the relevant tree. */
static void dissect_typecode_string_param(tvbuff_t *tvb, proto_tree *tree, gint *offset, gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id)
/* gets a TypeCode complex string parameter and displays it in the relevant tree. */ static void dissect_typecode_string_param(tvbuff_t *tvb, proto_tree *tree, gint *offset, gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id)
{ guint32 u_octet4; const gchar *buf; u_octet4 = get_CDR_string(tvb, &buf, offset, new_stream_is_big_endian, new_boundary); proto_tree_add_uint(tree, hf_giop_string_length, tvb, *offset-u_octet4-4, 4, u_octet4); if (u_octet4 > 0) { proto_tree_add_string(tree, hf_id, tvb, *offset...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Converts a text device path node to Bluetooth LE device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextBluetoothLE(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to Bluetooth LE device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextBluetoothLE(IN CHAR16 *TextDeviceNode)
{ CHAR16 *BluetoothLeAddrStr; CHAR16 *BluetoothLeAddrTypeStr; BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp; BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode); BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode); BluetoothLeDp = (BLUETOOTH_LE_DEVICE_...
tianocore/edk2
C++
Other
4,240
/* Returns 0 on success, or negative on failure. */
int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
/* Returns 0 on success, or negative on failure. */ int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
{ might_sleep(); if (!dev->is_physfn) return -ENODEV; return sriov_enable(dev, nr_virtfn); }
robutest/uclinux
C++
GPL-2.0
60
/* I2C MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
{ if(hi2c->Instance==I2C1) { __HAL_RCC_I2C1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_9); } else if(hi2c->Instance==I2C2) { __HAL_RCC_I2C2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_0); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_1); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes the IrIAP layer, called by the module cleanup code in irmod.c */
void iriap_cleanup(void)
/* Initializes the IrIAP layer, called by the module cleanup code in irmod.c */ void iriap_cleanup(void)
{ irlmp_unregister_service(service_handle); hashbin_delete(iriap, (FREE_FUNC) __iriap_close); hashbin_delete(irias_objects, (FREE_FUNC) __irias_delete_object); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: true if the response was an ACK, else returns false. */
static bool ti_sci_is_response_ack(void *r)
/* Return: true if the response was an ACK, else returns false. */ static bool ti_sci_is_response_ack(void *r)
{ struct ti_sci_msg_hdr *hdr = r; return hdr->flags & TI_SCI_FLAG_RESP_GENERIC_ACK ? true : false; }
4ms/stm32mp1-baremetal
C++
Other
137