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
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */
void SAI_TransferRxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *rxDmaHandle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */ void SAI_TransferRxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *rxDmaHandle)
{ assert((handle != NULL) && (rxDmaHandle != NULL)); uint32_t instance = SAI_GetInstance(base); (void)memset(handle, 0, sizeof(*handle)); handle->dmaHandle = rxDmaHandle; handle->callback = callback; handle->userData = userData; handle->state = (uint32_t)kSAI_Idle; s_edmaPrivateHandle[instance][1].base = base; s_edmaPrivateHandle[instance][1].handle = handle; EDMA_InstallTCDMemory(rxDmaHandle, STCD_ADDR(handle->tcd), SAI_XFER_QUEUE_SIZE); EDMA_SetCallback(rxDmaHandle, SAI_RxEDMACallback, &s_edmaPrivateHandle[instance][1]); }
eclipse-threadx/getting-started
C++
Other
310
/* Find an interface of the service with the same Ip/Netmask pair. */
IP4_INTERFACE* Ip4FindStationAddress(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip, IN IP4_ADDR Netmask)
/* Find an interface of the service with the same Ip/Netmask pair. */ IP4_INTERFACE* Ip4FindStationAddress(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip, IN IP4_ADDR Netmask)
{ LIST_ENTRY *Entry; IP4_INTERFACE *IpIf; NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) { IpIf = NET_LIST_USER_STRUCT (Entry, IP4_INTERFACE, Link); if (IpIf->Configured && (IpIf->Ip == Ip) && (IpIf->SubnetMask == Netmask)) { return IpIf; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Enable/Disable I2C 14-bit timeout counter of the specified I2C port. The */
void I2CTimeoutCounterSet(unsigned long ulBase, unsigned long ulEnable, unsigned long ulDiv4)
/* Enable/Disable I2C 14-bit timeout counter of the specified I2C port. The */ void I2CTimeoutCounterSet(unsigned long ulBase, unsigned long ulEnable, unsigned long ulDiv4)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xASSERT((ulEnable == I2C_TIMEOUT_EN) || (ulEnable == I2C_TIMEOUT_DIS)); xASSERT((ulDiv4 == I2C_TIMEOUT_DIV4) || (ulDiv4 == I2C_TIMEOUT_DIV_NO)); xHWREG(ulBase + I2C_O_TOC) &= ~0x00000006; xHWREG(ulBase + I2C_O_TOC) |= ulEnable | ulDiv4; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* this function is a POSIX compliant version, which will open a file and return a file descriptor according specified flags. */
int open(const char *file, int flags,...)
/* this function is a POSIX compliant version, which will open a file and return a file descriptor according specified flags. */ int open(const char *file, int flags,...)
{ int fd, result; struct dfs_fd *d; fd = fd_new(); if (fd < 0) { rt_set_errno(-ENOMEM); return -1; } d = fd_get(fd); result = dfs_file_open(d, file, flags); if (result < 0) { fd_put(d); fd_put(d); rt_set_errno(result); return -1; } fd_put(d); return fd; }
pikasTech/PikaPython
C++
MIT License
1,403
/* All string identifier should be allocated using this, @usb_string_ids_tab() or @usb_string_ids_n() routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. */
int usb_string_id(struct usb_composite_dev *cdev)
/* All string identifier should be allocated using this, @usb_string_ids_tab() or @usb_string_ids_n() routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. */ int usb_string_id(struct usb_composite_dev *cdev)
{ if (cdev->next_string_id < 254) { cdev->next_string_id++; return cdev->next_string_id; } return -ENODEV; }
4ms/stm32mp1-baremetal
C++
Other
137
/* get a little endian long long (64bits) from a pointer Caller should ensure parameters are valid. */
uint64_t BytesGetLe64(const void *ptr)
/* get a little endian long long (64bits) from a pointer Caller should ensure parameters are valid. */ uint64_t BytesGetLe64(const void *ptr)
{ const uint8_t *p = (const uint8_t *)ptr; return BytesGetLe32(p) | ((uint64_t)BytesGetLe32(p + 4) << 32); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes the current value of MM2. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm2(IN UINT64 Value)
/* Writes the current value of MM2. This function is only available on IA32 and X64. */ VOID EFIAPI AsmWriteMm2(IN UINT64 Value)
{ __asm__ __volatile__ ( "movq %0, %%mm2" : : "m" (Value) ); }
tianocore/edk2
C++
Other
4,240
/* fpga_info front end to fpga_dev_info. If devnum is invalid, report on all available devices. */
int fpga_info(int devnum)
/* fpga_info front end to fpga_dev_info. If devnum is invalid, report on all available devices. */ int fpga_info(int devnum)
{ if (devnum == FPGA_INVALID_DEVICE) { if (next_desc > 0) { int dev; for (dev = 0; dev < next_desc; dev++) fpga_dev_info(dev); return FPGA_SUCCESS; } else { printf("%s: No FPGA devices available.\n", __func__); return FPGA_FAIL; } } return fpga_dev_info(devnum); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configures and enables PLL to generate output clock based on input clock. */
int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out)
/* Configures and enables PLL to generate output clock based on input clock. */ int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out)
{ if (dai->ops && dai->ops->set_pll) return dai->ops->set_pll(dai, pll_id, source, freq_in, freq_out); else return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the main functional clock and interface clock for all of the omap_hwmods associated with the omap_device. Returns 0. */
int omap_device_disable_clocks(struct omap_device *od)
/* Disable the main functional clock and interface clock for all of the omap_hwmods associated with the omap_device. Returns 0. */ int omap_device_disable_clocks(struct omap_device *od)
{ struct omap_hwmod *oh; int i; for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) omap_hwmod_disable_clocks(oh); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Setup function invoked at boot to parse the ncr5380= command line. */
static int __init do_NCR5380_setup(char *str)
/* Setup function invoked at boot to parse the ncr5380= command line. */ static int __init do_NCR5380_setup(char *str)
{ int ints[10]; get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_NCR5380, str, ints); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* When a uDMA transfer is completed, the channel is automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer. */
void uDMAChannelEnable(uint32_t ui32ChannelNum)
/* When a uDMA transfer is completed, the channel is automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer. */ void uDMAChannelEnable(uint32_t ui32ChannelNum)
{ ASSERT((ui32ChannelNum & 0xffff) < 32); HWREG(UDMA_ENASET) = 1 << (ui32ChannelNum & 0x1f); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read and decompress the datablock located at <start_block> in the filesystem. The cache is used here to avoid duplicating locking and read/decompress code. */
struct squashfs_cache_entry* squashfs_get_datablock(struct super_block *sb, u64 start_block, int length)
/* Read and decompress the datablock located at <start_block> in the filesystem. The cache is used here to avoid duplicating locking and read/decompress code. */ struct squashfs_cache_entry* squashfs_get_datablock(struct super_block *sb, u64 start_block, int length)
{ struct squashfs_sb_info *msblk = sb->s_fs_info; return squashfs_cache_get(sb, msblk->read_page, start_block, length); }
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for the library USB WakeUp event. */
void EVENT_USB_Device_Connect(void)
/* Event handler for the library USB WakeUp event. */ void EVENT_USB_Device_Connect(void)
{ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Copy pixels from SRAM to the screen. Used to copy a large quantitative of data to the screen in one go. */
void ili93xx_copy_pixels_to_screen(const ili93xx_color_t *pixels, uint32_t count)
/* Copy pixels from SRAM to the screen. Used to copy a large quantitative of data to the screen in one go. */ void ili93xx_copy_pixels_to_screen(const ili93xx_color_t *pixels, uint32_t count)
{ Assert(count > 0); if (g_uc_device_type == DEVICE_TYPE_ILI9325) { LCD_IR(0); LCD_IR(ILI9325_GRAM_DATA_REG); } else if (g_uc_device_type == DEVICE_TYPE_ILI9341) { LCD_IR(ILI9341_CMD_MEMORY_WRITE); LCD_IR(0); LCD_IR(ILI9341_CMD_WRITE_MEMORY_CONTINUE); } while (count--) { LCD_WD((*pixels >> 16) & 0xFF); LCD_WD((*pixels >> 8) & 0xFF); LCD_WD(*pixels & 0xFF); pixels++; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns the number of byte removed or 0 in case of failure */
size_t xmlBufShrink(xmlBufPtr buf, size_t len)
/* Returns the number of byte removed or 0 in case of failure */ size_t xmlBufShrink(xmlBufPtr buf, size_t len)
{ buf->content += len; buf->size -= len; if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { size_t start_buf = buf->content - buf->contentIO; if (start_buf >= buf->size) { memmove(buf->contentIO, &buf->content[0], buf->use); buf->content = buf->contentIO; buf->content[buf->use] = 0; buf->size += start_buf; } } } else { memmove(buf->content, &buf->content[len], buf->use); buf->content[buf->use] = 0; } UPDATE_COMPAT(buf) return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* device_pm_unlock - Unlock the list of active devices used by the PM core. */
void device_pm_unlock(void)
/* device_pm_unlock - Unlock the list of active devices used by the PM core. */ void device_pm_unlock(void)
{ mutex_unlock(&dpm_list_mtx); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is called to increment a global variable "uwTick" used as application time base. */
__weak void HAL_IncTick(void)
/* This function is called to increment a global variable "uwTick" used as application time base. */ __weak void HAL_IncTick(void)
{ uwTick += (uint32_t)uwTickFreq; }
ua1arn/hftrx
C++
null
69
/* For tight control over page level allocator and protection flags use __vmalloc() instead. */
void* vmalloc_node(unsigned long size, int node)
/* For tight control over page level allocator and protection flags use __vmalloc() instead. */ void* vmalloc_node(unsigned long size, int node)
{ return __vmalloc_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL, node, __builtin_return_address(0)); }
robutest/uclinux
C++
GPL-2.0
60
/* Function: MX25_PGM_ERS_R Arguments: None Description: The PGM_ERS_R resume Sector-Erase, Block-Erase or Page-Program operations. Return Message: FlashOperationSuccess */
ReturnMsg MX25_PGM_ERS_R(void)
/* Function: MX25_PGM_ERS_R Arguments: None Description: The PGM_ERS_R resume Sector-Erase, Block-Erase or Page-Program operations. Return Message: FlashOperationSuccess */ ReturnMsg MX25_PGM_ERS_R(void)
{ CS_Low(); SendByte( FLASH_CMD_PGM_ERS_R, SIO ); CS_High(); return FlashOperationSuccess; }
remotemcu/remcu-chip-sdks
C++
null
436
/* BusLogic_AppendProbeAddressISA appends a single ISA I/O Address to the list of I/O Address and Bus Probe Information to be checked for potential BusLogic Host Adapters. */
static void __init BusLogic_AppendProbeAddressISA(unsigned long IO_Address)
/* BusLogic_AppendProbeAddressISA appends a single ISA I/O Address to the list of I/O Address and Bus Probe Information to be checked for potential BusLogic Host Adapters. */ static void __init BusLogic_AppendProbeAddressISA(unsigned long IO_Address)
{ struct BusLogic_ProbeInfo *ProbeInfo; if (BusLogic_ProbeInfoCount >= BusLogic_MaxHostAdapters) return; ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; ProbeInfo->HostAdapterType = BusLogic_MultiMaster; ProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus; ProbeInfo->IO_Address = IO_Address; ProbeInfo->PCI_Device = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* AmebaD don't support sleep api, please refer to AN400 power save Section. */
void sleep_ex_selective(uint32_t wakeup_event, uint32_t sleep_duration, uint32_t clk_sourec_enable, uint32_t sdr_enable)
/* AmebaD don't support sleep api, please refer to AN400 power save Section. */ void sleep_ex_selective(uint32_t wakeup_event, uint32_t sleep_duration, uint32_t clk_sourec_enable, uint32_t sdr_enable)
{ ( void ) wakeup_event; ( void ) sleep_duration; ( void ) clk_sourec_enable; ( void ) sdr_enable; assert_param(0); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* s3c_pm_save_gpio() - save gpio chip data for suspend @ourchip: The chip for suspend. */
static void s3c_pm_save_gpio(struct s3c_gpio_chip *ourchip)
/* s3c_pm_save_gpio() - save gpio chip data for suspend @ourchip: The chip for suspend. */ static void s3c_pm_save_gpio(struct s3c_gpio_chip *ourchip)
{ struct s3c_gpio_pm *pm = ourchip->pm; if (pm == NULL || pm->save == NULL) S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); else pm->save(ourchip); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* User task that triggers measurements of sensor every seconds. It uses function */
void user_task(void *pvParameters)
/* User task that triggers measurements of sensor every seconds. It uses function */ void user_task(void *pvParameters)
{ bme680_values_float_t values; TickType_t last_wakeup = xTaskGetTickCount(); uint32_t duration = bme680_get_measurement_duration(sensor); while (1) { if (bme680_force_measurement (sensor)) { vTaskDelay (duration); if (bme680_get_results_float (sensor, &values)) printf("%.3f BME680 Sensor: %.2f °C, %.2f %%, %.2f hPa, %.2f Ohm\n", (double)sdk_system_get_time()*1e-3, values.temperature, values.humidity, values.pressure, values.gas_resistance); } vTaskDelayUntil(&last_wakeup, 1000 / portTICK_PERIOD_MS); } }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Set the contents of a G_TYPE_INT64 #GValue to @v_int64. */
gint64 g_value_get_int64(const GValue *value)
/* Set the contents of a G_TYPE_INT64 #GValue to @v_int64. */ gint64 g_value_get_int64(const GValue *value)
{ g_return_val_if_fail (G_VALUE_HOLDS_INT64 (value), 0); return value->data[0].v_int64; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return value: CAIRO_STATUS_SUCCESS if successful or CAIRO_STATUS_NO_MEMORY if insufficient memory is available. */
cairo_status_t _cairo_cache_insert(cairo_cache_t *cache, cairo_cache_entry_t *entry)
/* Return value: CAIRO_STATUS_SUCCESS if successful or CAIRO_STATUS_NO_MEMORY if insufficient memory is available. */ cairo_status_t _cairo_cache_insert(cairo_cache_t *cache, cairo_cache_entry_t *entry)
{ cairo_status_t status; if (entry->size && ! cache->freeze_count) _cairo_cache_shrink_to_accommodate (cache, entry->size); status = _cairo_hash_table_insert (cache->hash_table, (cairo_hash_entry_t *) entry); if (unlikely (status)) return status; cache->size += entry->size; return CAIRO_STATUS_SUCCESS; }
xboot/xboot
C++
MIT License
779
/* CLI command to clear the flash software buffer. */
int32_t cn0503_flash_swbuff_clear(struct cn0503_dev *dev, uint8_t *arg)
/* CLI command to clear the flash software buffer. */ int32_t cn0503_flash_swbuff_clear(struct cn0503_dev *dev, uint8_t *arg)
{ int16_t i; for (i = 0; i < CN0503_FLASH_BUFF_SIZE; i++) dev->sw_flash_buffer[i] = 0xFFFFFFFF; cli_write_string(dev->cli_handler, (uint8_t *)"RESP: FL_CLEARBUF\n"); return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Unregister a PE/COFF image that has been registered with the emulator. This should be done before the image is unloaded from memory. */
EFI_STATUS EFIAPI EbcUnregisterImage(IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS ImageBase)
/* Unregister a PE/COFF image that has been registered with the emulator. This should be done before the image is unloaded from memory. */ EFI_STATUS EFIAPI EbcUnregisterImage(IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS ImageBase)
{ return EbcUnloadImage (NULL, (VOID *)(UINTN)ImageBase); }
tianocore/edk2
C++
Other
4,240
/* remove the PCI control struct from the global list */
static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci)
/* remove the PCI control struct from the global list */ static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci)
{ list_del_rcu(&pci->link); call_rcu(&pci->rcu, complete_edac_pci_list_del); rcu_barrier(); }
robutest/uclinux
C++
GPL-2.0
60
/* find a class-specified interface descriptor with the given subtype. */
void* snd_usb_find_csint_desc(void *buffer, int buflen, void *after, u8 dsubtype)
/* find a class-specified interface descriptor with the given subtype. */ void* snd_usb_find_csint_desc(void *buffer, int buflen, void *after, u8 dsubtype)
{ unsigned char *p = after; while ((p = snd_usb_find_desc(buffer, buflen, p, USB_DT_CS_INTERFACE)) != NULL) { if (p[0] >= 3 && p[2] == dsubtype) return p; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* This function extends the used data area of the buffer at the buffer start. If this would exceed the total buffer headroom the kernel will panic. A pointer to the first byte of the extra data is returned. */
unsigned char* skb_push(struct sk_buff *skb, unsigned int len)
/* This function extends the used data area of the buffer at the buffer start. If this would exceed the total buffer headroom the kernel will panic. A pointer to the first byte of the extra data is returned. */ unsigned char* skb_push(struct sk_buff *skb, unsigned int len)
{ skb->data -= len; skb->len += len; if (unlikely(skb->data<skb->head)) skb_under_panic(skb, len, __builtin_return_address(0)); return skb->data; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read the MAC address from FEC's registers PALR PAUR. User is supposed to configure these registers when MAC address is known from another source (fuse), but on TS4800, MAC address is not fused and the bootrom configure these registers on startup. */
static int fec_get_mac_from_register(uint32_t base_addr)
/* Read the MAC address from FEC's registers PALR PAUR. User is supposed to configure these registers when MAC address is known from another source (fuse), but on TS4800, MAC address is not fused and the bootrom configure these registers on startup. */ static int fec_get_mac_from_register(uint32_t base_addr)
{ unsigned char ethaddr[6]; u32 reg_mac[2]; int i; reg_mac[0] = in_be32(base_addr + 0xE4); reg_mac[1] = in_be32(base_addr + 0xE8); for(i = 0; i < 6; i++) ethaddr[i] = (reg_mac[i / 4] >> ((i % 4) * 8)) & 0xFF; if (is_valid_ethaddr(ethaddr)) { eth_env_set_enetaddr("ethaddr", ethaddr); return 0; } return -1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Fills each SP_StructInit member with its default value. */
void AUDIO_SP_StructInit(SP_InitTypeDef *SP_InitStruct)
/* Fills each SP_StructInit member with its default value. */ void AUDIO_SP_StructInit(SP_InitTypeDef *SP_InitStruct)
{ SP_InitStruct->SP_WordLen = SP_WL_16; SP_InitStruct->SP_DataFormat = SP_DF_I2S; SP_InitStruct->SP_MonoStereo = SP_CH_STEREO; SP_InitStruct->SP_SelRxCh = SP_RX_CH_LR; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* That gets run when evict_chunk() ends up needing to kill */
static int prune_tree_thread(void *unused)
/* That gets run when evict_chunk() ends up needing to kill */ static int prune_tree_thread(void *unused)
{ mutex_lock(&audit_cmd_mutex); mutex_lock(&audit_filter_mutex); while (!list_empty(&prune_list)) { struct audit_tree *victim; victim = list_entry(prune_list.next, struct audit_tree, list); list_del_init(&victim->list); mutex_unlock(&audit_filter_mutex); prune_one(victim); mutex_lock(&audit_filter_mutex); } mutex_unlock(&audit_filter_mutex); mutex_unlock(&audit_cmd_mutex); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will detach a thread. The thread object will be removed from thread queue and detached/deleted from system object management. */
rt_err_t rt_thread_detach(rt_thread_t thread)
/* This function will detach a thread. The thread object will be removed from thread queue and detached/deleted from system object management. */ rt_err_t rt_thread_detach(rt_thread_t thread)
{ rt_base_t lock; RT_ASSERT(thread != RT_NULL); rt_schedule_remove_thread(thread); rt_timer_detach(&(thread->thread_timer)); thread->stat = RT_THREAD_CLOSE; rt_object_detach((rt_object_t)thread); if (thread->cleanup != RT_NULL) { lock = rt_hw_interrupt_disable(); rt_list_insert_after(&rt_thread_defunct, &(thread->tlist)); rt_hw_interrupt_enable(lock); } return RT_EOK; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* If the device is not connected, data is ignored and the function returns @count. If the buffer is full, the function returns 0. If an existing IUCV communicaton path has been severed, -EPIPE is returned (that can be passed to HVC layer to cause a tty hangup). */
static int hvc_iucv_queue(struct hvc_iucv_private *priv, const char *buf, int count)
/* If the device is not connected, data is ignored and the function returns @count. If the buffer is full, the function returns 0. If an existing IUCV communicaton path has been severed, -EPIPE is returned (that can be passed to HVC layer to cause a tty hangup). */ static int hvc_iucv_queue(struct hvc_iucv_private *priv, const char *buf, int count)
{ size_t len; if (priv->iucv_state == IUCV_DISCONN) return count; if (priv->iucv_state == IUCV_SEVERED) return -EPIPE; len = min_t(size_t, count, SNDBUF_SIZE - priv->sndbuf_len); if (!len) return 0; memcpy(priv->sndbuf + priv->sndbuf_len, buf, len); priv->sndbuf_len += len; if (priv->iucv_state == IUCV_CONNECTED) schedule_delayed_work(&priv->sndbuf_work, QUEUE_SNDBUF_DELAY); return len; }
robutest/uclinux
C++
GPL-2.0
60
/* Write one 16 bit register to a INA220 device and swap byte order, if necessary. */
static int ina220_write_reg(ina220_t *dev, uint8_t reg, uint16_t in)
/* Write one 16 bit register to a INA220 device and swap byte order, if necessary. */ static int ina220_write_reg(ina220_t *dev, uint8_t reg, uint16_t in)
{ union { char c[2]; uint16_t u16; } tmp = { .u16 = 0 }; int status = 0; tmp.u16 = HTONS(in); status = i2c_write_regs(dev->i2c, dev->addr, reg, &tmp.c[0], 2); if (status != 2) { return -1; } return 0; }
labapart/polymcu
C++
null
201
/* Returns the events that can trigger a DMA request. */
unsigned long TimerDMAEventGet(unsigned long ulBase)
/* Returns the events that can trigger a DMA request. */ unsigned long TimerDMAEventGet(unsigned long ulBase)
{ ASSERT(TimerBaseValid(ulBase)); return(HWREG(ulBase + TIMER_O_DMAEV)); }
micropython/micropython
C++
Other
18,334
/* Performs common cleanup for periodic transfers after a Transfer Complete interrupt. This function should be called after any endpoint type specific handling is finished to release the host channel. */
static void dwc2_complete_periodic_xfer(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, int chnum, struct dwc2_qtd *qtd, enum dwc2_halt_status halt_status)
/* Performs common cleanup for periodic transfers after a Transfer Complete interrupt. This function should be called after any endpoint type specific handling is finished to release the host channel. */ static void dwc2_complete_periodic_xfer(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, int chnum, struct dwc2_qtd *qtd, enum dwc2_halt_status halt_status)
{ u32 hctsiz = readl(hsotg->regs + HCTSIZ(chnum)); qtd->error_count = 0; if (!chan->ep_is_in || (hctsiz & TSIZ_PKTCNT_MASK) == 0) dwc2_release_channel(hsotg, chan, qtd, halt_status); else dwc2_halt_channel(hsotg, chan, qtd, halt_status); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: the maximum height of the tree beneath @root */
guint g_node_max_height(GNode *root)
/* Returns: the maximum height of the tree beneath @root */ guint g_node_max_height(GNode *root)
{ GNode *child; guint max_height = 0; if (!root) return 0; child = root->children; while (child) { guint tmp_height; tmp_height = g_node_max_height (child); if (tmp_height > max_height) max_height = tmp_height; child = child->next; } return max_height + 1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns: a signed 16-bit/2-byte value read from @stream or %0 if an error occurred. */
gint16 g_data_input_stream_read_int16(GDataInputStream *stream, GCancellable *cancellable, GError **error)
/* Returns: a signed 16-bit/2-byte value read from @stream or %0 if an error occurred. */ gint16 g_data_input_stream_read_int16(GDataInputStream *stream, GCancellable *cancellable, GError **error)
{ gint16 v; g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), 0); if (read_data (stream, &v, 2, cancellable, error)) { switch (stream->priv->byte_order) { case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: v = GINT16_FROM_BE (v); break; case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: v = GINT16_FROM_LE (v); break; case G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN: default: break; } return v; } return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Give a buffer with the given to use during drawing. Be careful to not use the buffer while other processes are using it. */
void* lv_draw_get_buf(uint32_t size)
/* Give a buffer with the given to use during drawing. Be careful to not use the buffer while other processes are using it. */ void* lv_draw_get_buf(uint32_t size)
{ if(size <= draw_buf_size) return LV_GC_ROOT(_lv_draw_buf); LV_LOG_TRACE("lv_draw_get_buf: allocate"); draw_buf_size = size; if(LV_GC_ROOT(_lv_draw_buf) == NULL) { LV_GC_ROOT(_lv_draw_buf) = lv_mem_alloc(size); lv_mem_assert(LV_GC_ROOT(_lv_draw_buf)); return LV_GC_ROOT(_lv_draw_buf); } LV_GC_ROOT(_lv_draw_buf) = lv_mem_realloc(LV_GC_ROOT(_lv_draw_buf), size); lv_mem_assert(LV_GC_ROOT(_lv_draw_buf)); return LV_GC_ROOT(_lv_draw_buf); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function returns LEB properties for a LEB with free space or NULL if the function is unable to find a LEB quickly. */
const struct ubifs_lprops* ubifs_fast_find_free(struct ubifs_info *c)
/* This function returns LEB properties for a LEB with free space or NULL if the function is unable to find a LEB quickly. */ const struct ubifs_lprops* ubifs_fast_find_free(struct ubifs_info *c)
{ struct ubifs_lprops *lprops; struct ubifs_lpt_heap *heap; ubifs_assert(mutex_is_locked(&c->lp_mutex)); heap = &c->lpt_heap[LPROPS_FREE - 1]; if (heap->cnt == 0) return NULL; lprops = heap->arr[0]; ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); ubifs_assert(!(lprops->flags & LPROPS_INDEX)); return lprops; }
EmcraftSystems/u-boot
C++
Other
181
/* Returns: Number of bytes written, or -1 on error */
gssize g_output_stream_write_bytes(GOutputStream *stream, GBytes *bytes, GCancellable *cancellable, GError **error)
/* Returns: Number of bytes written, or -1 on error */ gssize g_output_stream_write_bytes(GOutputStream *stream, GBytes *bytes, GCancellable *cancellable, GError **error)
{ gsize size; gconstpointer data; data = g_bytes_get_data (bytes, &size); return g_output_stream_write (stream, data, size, cancellable, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If this function returns, it means that the system does not support warm reset. */
VOID EFIAPI ResetWarm(VOID)
/* If this function returns, it means that the system does not support warm reset. */ VOID EFIAPI ResetWarm(VOID)
{ SbiSystemReset (SBI_SRST_RESET_TYPE_WARM_REBOOT, SBI_SRST_RESET_REASON_NONE); }
tianocore/edk2
C++
Other
4,240
/* Creates a new SSL_CTX object as framework to establish TLS/SSL enabled connections. */
VOID* EFIAPI TlsCtxNew(IN UINT8 MajorVer, IN UINT8 MinorVer)
/* Creates a new SSL_CTX object as framework to establish TLS/SSL enabled connections. */ VOID* EFIAPI TlsCtxNew(IN UINT8 MajorVer, IN UINT8 MinorVer)
{ SSL_CTX *TlsCtx; UINT16 ProtoVersion; ProtoVersion = (MajorVer << 8) | MinorVer; TlsCtx = SSL_CTX_new (SSLv23_client_method ()); if (TlsCtx == NULL) { return NULL; } SSL_CTX_set_options (TlsCtx, SSL_OP_NO_SSLv3); SSL_CTX_set_min_proto_version (TlsCtx, ProtoVersion); return (VOID *)TlsCtx; }
tianocore/edk2
C++
Other
4,240
/* This function modifies the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */
EFI_STATUS EFIAPI CpuSetMemoryAttributes(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
/* This function modifies the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */ EFI_STATUS EFIAPI CpuSetMemoryAttributes(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
{ return RiscVSetMemoryAttributes (BaseAddress, Length, Attributes); }
tianocore/edk2
C++
Other
4,240
/* Returns the number of command packets that the host is allowed to send to the controller. */
static uint8_t ble_ll_hci_get_num_cmd_pkts(void)
/* Returns the number of command packets that the host is allowed to send to the controller. */ static uint8_t ble_ll_hci_get_num_cmd_pkts(void)
{ return BLE_LL_CFG_NUM_HCI_CMD_PKTS; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Receives a byte that has been sent to the I2C Master. */
unsigned long xI2CMasterDataGet(unsigned long ulBase)
/* Receives a byte that has been sent to the I2C Master. */ unsigned long xI2CMasterDataGet(unsigned long ulBase)
{ unsigned long ulData; ulData = xHWREG(ulBase + I2C_O_DAT); xHWREG(ulBase + I2C_O_CON) |= I2C_CON_SI; return ulData; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The function is used to Get APB2 clock and the UNIT is in Hz. */
unsigned long SysCtlAPB2ClockGet(void)
/* The function is used to Get APB2 clock and the UNIT is in Hz. */ unsigned long SysCtlAPB2ClockGet(void)
{ unsigned long ulTemp,ulAPB2Clock; ulAPB2Clock = SysCtlHClockGet(); ulTemp = (xHWREG(RCC_CFGR) & RCC_CFGR_PPRE2_M) >> RCC_CFGR_PPRE2_S; ulTemp = (unsigned long)g_APBAHBPrescTable[ulTemp]; ulAPB2Clock = ulAPB2Clock >> ulTemp; return ulAPB2Clock; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* In of_node_put() this function is passed to kref_put() as the destructor. */
static void of_node_release(struct kref *kref)
/* In of_node_put() this function is passed to kref_put() as the destructor. */ static void of_node_release(struct kref *kref)
{ struct device_node *node = kref_to_device_node(kref); struct property *prop = node->properties; if (!of_node_check_flag(node, OF_DETACHED)) { printk(KERN_INFO "WARNING: Bad of_node_put() on %s\n", node->full_name); dump_stack(); kref_init(&node->kref); return; } if (!of_node_check_flag(node, OF_DYNAMIC)) return; while (prop) { struct property *next = prop->next; kfree(prop->name); kfree(prop->value); kfree(prop); prop = next; if (!prop) { prop = node->deadprops; node->deadprops = NULL; } } kfree(node->full_name); kfree(node->data); kfree(node); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Register the handler to extract CRC32 guided section. */
EFI_STATUS EFIAPI DxeCrc32GuidedSectionExtractLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Register the handler to extract CRC32 guided section. */ EFI_STATUS EFIAPI DxeCrc32GuidedSectionExtractLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ return ExtractGuidedSectionRegisterHandlers ( &gEfiCrc32GuidedSectionExtractionGuid, Crc32GuidedSectionGetInfo, Crc32GuidedSectionHandler ); }
tianocore/edk2
C++
Other
4,240
/* list_del - deletes entry from list. @entry: the element to delete from the list. Note: list_empty on entry does not return true after this, the entry is in an undefined state. */
void list_del(struct list_head *entry)
/* list_del - deletes entry from list. @entry: the element to delete from the list. Note: list_empty on entry does not return true after this, the entry is in an undefined state. */ void list_del(struct list_head *entry)
{ WARN(entry->prev->next != entry, "list_del corruption. prev->next should be %p, " "but was %p\n", entry, entry->prev->next); WARN(entry->next->prev != entry, "list_del corruption. next->prev should be %p, " "but was %p\n", entry, entry->next->prev); __list_del(entry->prev, entry->next); entry->next = LIST_POISON1; entry->prev = LIST_POISON2; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is called to upper case given unicode string. */
static CHAR16* UpperCaseString(IN CHAR16 *Str)
/* This routine is called to upper case given unicode string. */ static CHAR16* UpperCaseString(IN CHAR16 *Str)
{ CHAR16 *Cptr; for (Cptr = Str; *Cptr != L'\0'; Cptr++) { if ((L'a' <= *Cptr) && (*Cptr <= L'z')) { *Cptr = *Cptr - L'a' + L'A'; } } return Str; }
tianocore/edk2
C++
Other
4,240
/* dissect_knet_tcp is the dissector which is called by Wireshark when kNet TCP packets are captured. */
static int dissect_knet_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* dissect_knet_tcp is the dissector which is called by Wireshark when kNet TCP packets are captured. */ static int dissect_knet_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ dissect_knet(tvb, pinfo, tree, KNET_TCP_PACKET); return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function reads qiov->size bytes starting at pos from the backing file. If there is no backing file then zeroes are read. */
static void qed_read_backing_file(BDRVQEDState *s, uint64_t pos, QEMUIOVector *qiov, BlockDriverCompletionFunc *cb, void *opaque)
/* This function reads qiov->size bytes starting at pos from the backing file. If there is no backing file then zeroes are read. */ static void qed_read_backing_file(BDRVQEDState *s, uint64_t pos, QEMUIOVector *qiov, BlockDriverCompletionFunc *cb, void *opaque)
{ uint64_t backing_length = 0; size_t size; if (s->bs->backing_hd) { int64_t l = bdrv_getlength(s->bs->backing_hd); if (l < 0) { cb(opaque, l); return; } backing_length = l; } if (pos >= backing_length || pos + qiov->size > backing_length) { qemu_iovec_memset(qiov, 0, 0, qiov->size); } if (pos >= backing_length) { cb(opaque, 0); return; } size = MIN((uint64_t)backing_length - pos, qiov->size); BLKDBG_EVENT(s->bs->file, BLKDBG_READ_BACKING_AIO); bdrv_aio_readv(s->bs->backing_hd, pos / BDRV_SECTOR_SIZE, qiov, size / BDRV_SECTOR_SIZE, cb, opaque); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Starts the hardware using the generic start_hw function. Then performs device-specific: Clears the rate limiter registers. */
static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw)
/* Starts the hardware using the generic start_hw function. Then performs device-specific: Clears the rate limiter registers. */ static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw)
{ u32 q_num; s32 ret_val; ret_val = ixgbe_start_hw_generic(hw); for (q_num = 0; q_num < hw->mac.max_tx_queues; q_num++) { IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, q_num); IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); } IXGBE_WRITE_FLUSH(hw); hw->mac.autotry_restart = true; if (ret_val == 0) ret_val = ixgbe_verify_fw_version_82599(hw); return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* onenand_sync_read_bufferram - Read the bufferram area with Sync. Burst mode */
static int onenand_sync_read_bufferram(struct mtd_info *mtd, int area, unsigned char *buffer, int offset, size_t count)
/* onenand_sync_read_bufferram - Read the bufferram area with Sync. Burst mode */ static int onenand_sync_read_bufferram(struct mtd_info *mtd, int area, unsigned char *buffer, int offset, size_t count)
{ struct onenand_chip *this = mtd->priv; void __iomem *bufferram; bufferram = this->base + area; bufferram += onenand_bufferram_offset(mtd, area); this->mmcontrol(mtd, ONENAND_SYS_CFG1_SYNC_READ); if (ONENAND_CHECK_BYTE_ACCESS(count)) { unsigned short word; count--; word = this->read_word(bufferram + offset + count); buffer[count] = (word & 0xff); } memcpy(buffer, bufferram + offset, count); this->mmcontrol(mtd, 0); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Name: ddr3_tip_a38x_select_ddr_controller. Desc: Enable/Disable access to Marvell's server. Args: dev_num - device number enable - whether to enable or disable the server Notes: Returns: MV_OK if success, other error code if fail. */
static int ddr3_tip_a38x_select_ddr_controller(u8 dev_num, int enable)
/* Name: ddr3_tip_a38x_select_ddr_controller. Desc: Enable/Disable access to Marvell's server. Args: dev_num - device number enable - whether to enable or disable the server Notes: Returns: MV_OK if success, other error code if fail. */ static int ddr3_tip_a38x_select_ddr_controller(u8 dev_num, int enable)
{ u32 reg; reg = reg_read(DUAL_DUNIT_CFG_REG); if (enable) reg |= (1 << 6); else reg &= ~(1 << 6); reg_write(DUAL_DUNIT_CFG_REG, reg); return MV_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Unbind @ctx from the physical spu it is running on and schedule the highest priority context to run on the freed physical spu. */
void spu_deactivate(struct spu_context *ctx)
/* Unbind @ctx from the physical spu it is running on and schedule the highest priority context to run on the freed physical spu. */ void spu_deactivate(struct spu_context *ctx)
{ spu_context_nospu_trace(spu_deactivate__enter, ctx); __spu_deactivate(ctx, 1, MAX_PRIO); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Deinitializes the CAN peripheral registers to their default reset values. */
void CAN_DeInit(CAN_TypeDef *CANx)
/* Deinitializes the CAN peripheral registers to their default reset values. */ void CAN_DeInit(CAN_TypeDef *CANx)
{ assert_param(IS_CAN_ALL_PERIPH(CANx)); if (CANx == CAN1) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN1, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_CAN1, DISABLE); } }
avem-labs/Avem
C++
MIT License
1,752
/* Converts a text device path node to text relative offset device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextRelativeOffsetRange(CHAR16 *TextDeviceNode)
/* Converts a text device path node to text relative offset device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextRelativeOffsetRange(CHAR16 *TextDeviceNode)
{ CHAR16 *StartingOffsetStr; CHAR16 *EndingOffsetStr; MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset; StartingOffsetStr = GetNextParamStr (&TextDeviceNode); EndingOffsetStr = GetNextParamStr (&TextDeviceNode); Offset = (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *) CreateDeviceNode ( MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, (UINT16) sizeof (MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH) ); Strtoi64 (StartingOffsetStr, &Offset->StartingOffset); Strtoi64 (EndingOffsetStr, &Offset->EndingOffset); return (EFI_DEVICE_PATH_PROTOCOL *) Offset; }
tianocore/edk2
C++
Other
4,240
/* Wait for M24LCxx Standby state. A Stop condition at the end of a Write command triggers the internal Write cycle. */
void M24LCxxWaitEepromStandbyState(void)
/* Wait for M24LCxx Standby state. A Stop condition at the end of a Write command triggers the internal Write cycle. */ void M24LCxxWaitEepromStandbyState(void)
{ volatile unsigned short usSR1Tmp = 0; do { xHWREG(M24LCxx_PIN_I2C_PORT + I2C_CR1) |= I2C_CR1_START; usSR1Tmp = xHWREG(M24LCxx_PIN_I2C_PORT + I2C_SR1); xI2CMasterDataPut(M24LCxx_PIN_I2C_PORT, (M24LCxx_ADDRESS << 1) | 0); }while(!((xHWREG(M24LCxx_PIN_I2C_PORT + I2C_SR1)) & I2C_SR1_ADDR)); I2CFlagStatusClear(M24LCxx_PIN_I2C_PORT, I2C_SR1_AF); xHWREG(M24LCxx_PIN_I2C_PORT + I2C_CR1) |= I2C_CR1_STOP; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Pass on all buffers to the hardware. Return only when there are no more buffers pending. */
static void sclp_vt220_flush_buffer(struct tty_struct *tty)
/* Pass on all buffers to the hardware. Return only when there are no more buffers pending. */ static void sclp_vt220_flush_buffer(struct tty_struct *tty)
{ sclp_vt220_emit_current(); }
robutest/uclinux
C++
GPL-2.0
60
/* Read data with special length in master mode through the USIx peripheral under in-house IP. */
u8 USI_I2C_MasterRead(USI_TypeDef *USIx, u8 *pBuf, u8 len)
/* Read data with special length in master mode through the USIx peripheral under in-house IP. */ u8 USI_I2C_MasterRead(USI_TypeDef *USIx, u8 *pBuf, u8 len)
{ u8 cnt = 0; assert_param(IS_USI_I2C_ALL_PERIPH(USIx)); for(cnt = 0; cnt < len; cnt++) { if(cnt >= len - 1) { USIx->TX_FIFO_WRITE = 0x0003 << 8; } else { USIx->TX_FIFO_WRITE = 0x0001 << 8; } while((USI_I2C_CheckRXFIFOState(USIx, USI_RXFIFO_EMPTY)) == 1) { if(USI_I2C_GetRawINT(USIx) & USI_I2C_TX_ABRT_RSTS) { USI_I2C_ClearAllINT(USIx); return cnt; } } *pBuf++ = (u8)USIx->RX_FIFO_READ; } return cnt; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This service switches the requested AP to be the BSP from that point onward. This service changes the BSP for all purposes. This call can only be performed by the current BSP. */
EFI_STATUS EFIAPI MpInitLibSwitchBSP(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
/* This service switches the requested AP to be the BSP from that point onward. This service changes the BSP for all purposes. This call can only be performed by the current BSP. */ EFI_STATUS EFIAPI MpInitLibSwitchBSP(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
{ return SwitchBSPWorker (ProcessorNumber, EnableOldBSP); }
tianocore/edk2
C++
Other
4,240
/* read a sequence '=*]', leaving the last bracket. If sequence is well formed, return its number of '='s + 2; otherwise, return 1 if it is a single bracket (no '='s and no 2nd bracket); otherwise (an unfinished '[==...') return 0. */
static size_t skip_sep(LexState *ls)
/* read a sequence '=*]', leaving the last bracket. If sequence is well formed, return its number of '='s + 2; otherwise, return 1 if it is a single bracket (no '='s and no 2nd bracket); otherwise (an unfinished '[==...') return 0. */ static size_t skip_sep(LexState *ls)
{ save_and_next(ls); count++; } return (ls->current == s) ? count + 2 : (count == 0) ? 1 : 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Functions associated with SGI_XPC_NOTIFY IRQ. Check to see if any chctl flags were sent from the specified partition. */
static void xpc_check_for_sent_chctl_flags_sn2(struct xpc_partition *part)
/* Functions associated with SGI_XPC_NOTIFY IRQ. Check to see if any chctl flags were sent from the specified partition. */ static void xpc_check_for_sent_chctl_flags_sn2(struct xpc_partition *part)
{ union xpc_channel_ctl_flags chctl; unsigned long irq_flags; chctl.all_flags = xpc_receive_IRQ_amo_sn2(part->sn.sn2. local_chctl_amo_va); if (chctl.all_flags == 0) return; spin_lock_irqsave(&part->chctl_lock, irq_flags); part->chctl.all_flags |= chctl.all_flags; spin_unlock_irqrestore(&part->chctl_lock, irq_flags); dev_dbg(xpc_chan, "received notify IRQ from partid=%d, chctl.all_flags=" "0x%llx\n", XPC_PARTID(part), chctl.all_flags); xpc_wakeup_channel_mgr(part); }
robutest/uclinux
C++
GPL-2.0
60
/* Free the receive buffers for each ring slot and any attached socket buffers that need to go away. */
static void velocity_free_rd_ring(struct velocity_info *vptr)
/* Free the receive buffers for each ring slot and any attached socket buffers that need to go away. */ static void velocity_free_rd_ring(struct velocity_info *vptr)
{ int i; if (vptr->rx.info == NULL) return; for (i = 0; i < vptr->options.numrx; i++) { struct velocity_rd_info *rd_info = &(vptr->rx.info[i]); struct rx_desc *rd = vptr->rx.ring + i; memset(rd, 0, sizeof(*rd)); if (!rd_info->skb) continue; pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); rd_info->skb = NULL; } kfree(vptr->rx.info); vptr->rx.info = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Resets the device. This function will perform a software reset of the entire device. Processor and all peripherals will be reset and all device registers will return to their default values (with the exception of the reset cause register, which will maintain its current value but have the software reset bit set as well). */
void SysCtlReset(void)
/* Resets the device. This function will perform a software reset of the entire device. Processor and all peripherals will be reset and all device registers will return to their default values (with the exception of the reset cause register, which will maintain its current value but have the software reset bit set as well). */ void SysCtlReset(void)
{ xHWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ; while(1) { } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get ultra low frequency RC oscillator clock frequency for target system. */
uint32_t SystemULFRCOClockGet(void)
/* Get ultra low frequency RC oscillator clock frequency for target system. */ uint32_t SystemULFRCOClockGet(void)
{ return EFM32_ULFRCO_FREQ; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Enables Multicast frames. When enabled all multicast frames are passed. */
void synopGMAC_multicast_enable(synopGMACdevice *gmacdev)
/* Enables Multicast frames. When enabled all multicast frames are passed. */ void synopGMAC_multicast_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacMulticastFilter); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Overreliance on memalign is a sure way to fragment space. */
void * dlmemalign(size_t, size_t)
/* Overreliance on memalign is a sure way to fragment space. */ void * dlmemalign(size_t, size_t)
{ return internal_memalign(gm, alignment, bytes); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Normally we invlidate everything, but if we are moving into LM_ST_DEFERRED from LM_ST_SHARED or LM_ST_EXCLUSIVE then we can keep hold of the metadata, since it won't have changed. */
static void inode_go_inval(struct gfs2_glock *gl, int flags)
/* Normally we invlidate everything, but if we are moving into LM_ST_DEFERRED from LM_ST_SHARED or LM_ST_EXCLUSIVE then we can keep hold of the metadata, since it won't have changed. */ static void inode_go_inval(struct gfs2_glock *gl, int flags)
{ struct gfs2_inode *ip = gl->gl_object; gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); if (flags & DIO_METADATA) { struct address_space *mapping = gl->gl_aspace->i_mapping; truncate_inode_pages(mapping, 0); if (ip) { set_bit(GIF_INVALID, &ip->i_flags); forget_all_cached_acls(&ip->i_inode); } } if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) gl->gl_sbd->sd_rindex_uptodate = 0; if (ip && S_ISREG(ip->i_inode.i_mode)) truncate_inode_pages(ip->i_inode.i_mapping, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Unregisters an interrupt handler for an Ethernet interrupt. */
void EMACIntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for an Ethernet interrupt. */ void EMACIntUnregister(uint32_t ui32Base)
{ IntDisable(INT_EMAC0_TM4C129); IntUnregister(INT_EMAC0_TM4C129); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the Timer for One Cycle and Stop. */
void timer_one_shot_mode(uint32_t timer_peripheral)
/* Enable the Timer for One Cycle and Stop. */ void timer_one_shot_mode(uint32_t timer_peripheral)
{ TIM_CR1(timer_peripheral) |= TIM_CR1_OPM; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f' */
static void clearvalues(global_State *g, GCObject *l, GCObject *f)
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f' */ static void clearvalues(global_State *g, GCObject *l, GCObject *f)
{ Table *h = gco2t(l); Node *n, *limit = gnodelast(h); unsigned int i; for (i = 0; i < h->sizearray; i++) { TValue *o = &h->array[i]; if (iscleared(g, o)) setnilvalue(o); } for (n = gnode(h, 0); n < limit; n++) { if (!ttisnil(gval(n)) && iscleared(g, gval(n))) { setnilvalue(gval(n)); removeentry(n); } } } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Return non-zero if a channel-path with the given chpid is registered, zero otherwise. */
int chp_is_registered(struct chp_id chpid)
/* Return non-zero if a channel-path with the given chpid is registered, zero otherwise. */ int chp_is_registered(struct chp_id chpid)
{ return chpid_to_chp(chpid) != NULL; }
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)
{ HID_Device_ProcessControlRequest(&MediaControl_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Function for allocating instance. The instance identifier is provided in the 'p_instance' parameter if the routine succeeds. */
static __INLINE uint32_t connection_instance_allocate(uint32_t *p_instance)
/* Function for allocating instance. The instance identifier is provided in the 'p_instance' parameter if the routine succeeds. */ static __INLINE uint32_t connection_instance_allocate(uint32_t *p_instance)
{ uint32_t err_code; DM_TRC("[DM]: Request to allocation connection instance\r\n"); err_code = connection_instance_find(BLE_CONN_HANDLE_INVALID, STATE_IDLE, p_instance); if (err_code == NRF_SUCCESS) { DM_LOG("[DM]:[%02X]: Connection Instance Allocated.\r\n", (*p_instance)); m_connection_table[*p_instance].state = STATE_CONNECTED; } else { DM_LOG("[DM]: No free connection instances available\r\n"); err_code = NRF_ERROR_NO_MEM; } return err_code; }
labapart/polymcu
C++
null
201
/* Turns on creation and storage of HAL type results. */
inv_error_t inv_enable_eMPL_outputs(void)
/* Turns on creation and storage of HAL type results. */ inv_error_t inv_enable_eMPL_outputs(void)
{ inv_error_t result; result = inv_init_eMPL_outputs(); if (result) return result; return inv_register_mpl_start_notification(inv_start_eMPL_outputs); }
Luos-io/luos_engine
C++
MIT License
496
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */
status_t LPSPI_SlaveTransferGetCount(LPSPI_Type *base, lpspi_slave_handle_t *handle, size_t *count)
/* param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */ status_t LPSPI_SlaveTransferGetCount(LPSPI_Type *base, lpspi_slave_handle_t *handle, size_t *count)
{ assert(handle != NULL); if (NULL == count) { return kStatus_InvalidArgument; } if (handle->state != (uint8_t)kLPSPI_Busy) { *count = 0; return kStatus_NoTransferInProgress; } size_t remainingByte; if (handle->rxData != NULL) { remainingByte = handle->rxRemainingByteCount; } else { remainingByte = handle->txRemainingByteCount; } *count = handle->totalByteCount - remainingByte; return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* Start the control loops after everything is up, that is create the thread that will make them run */
static void start_control_loops(void)
/* Start the control loops after everything is up, that is create the thread that will make them run */ static void start_control_loops(void)
{ init_completion(&ctrl_complete); ctrl_task = kthread_run(main_control_loop, NULL, "kfand"); }
robutest/uclinux
C++
GPL-2.0
60
/* param base SPI base pointer param baudrate_Bps baud rate needed in Hz. param srcClock_Hz SPI source clock frequency in Hz. */
status_t SPI_MasterSetBaud(SPI_Type *base, uint32_t baudrate_Bps, uint32_t srcClock_Hz)
/* param base SPI base pointer param baudrate_Bps baud rate needed in Hz. param srcClock_Hz SPI source clock frequency in Hz. */ status_t SPI_MasterSetBaud(SPI_Type *base, uint32_t baudrate_Bps, uint32_t srcClock_Hz)
{ uint32_t tmpDiv; assert(!((NULL == base) || (0U == baudrate_Bps) || (0U == srcClock_Hz))); if ((NULL == base) || (0U == baudrate_Bps) || (0U == srcClock_Hz)) { return kStatus_InvalidArgument; } tmpDiv = ((srcClock_Hz * 10U) / baudrate_Bps + 5U) / 10U - 1U; if (tmpDiv > 0xFFFFU) { return kStatus_SPI_BaudrateNotSupport; } base->DIV &= ~SPI_DIV_DIVVAL_MASK; base->DIV |= SPI_DIV_DIVVAL(tmpDiv); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Adjusts the supplied color to have the specified intensity (0..100). 100 will leave the color as is at full intensity, 50 will reduce the color intensity by half, and 0 will return black. This function is useful for anti-aliasing and sub-pixel rendering since colors are returned as a percentage of the original value, depending on the amount of space they take up in the sub-pixel array. */
uint16_t colorsDim(uint16_t color, uint8_t intensity)
/* Adjusts the supplied color to have the specified intensity (0..100). 100 will leave the color as is at full intensity, 50 will reduce the color intensity by half, and 0 will return black. This function is useful for anti-aliasing and sub-pixel rendering since colors are returned as a percentage of the original value, depending on the amount of space they take up in the sub-pixel array. */ uint16_t colorsDim(uint16_t color, uint8_t intensity)
{ uint16_t r, g, b; r = ((((color >> 11) & 0x1F) * intensity) / 100) & 0x1F; g = ((((color >> 5) & 0x3F) * intensity) / 100) & 0x3F; b = (((color & 0x1F) * intensity) / 100) & 0x1F; return (r << 11) | (g << 6) | b; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Un-Register the Service B.1 and all its Characteristics... */
void service_b_1_2_remove(void)
/* Un-Register the Service B.1 and all its Characteristics... */ void service_b_1_2_remove(void)
{ bt_gatt_service_unregister(&service_b_1_2_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Resets the media status (but not the whole device?) */
static int alauda_reset_media(struct us_data *us)
/* Resets the media status (but not the whole device?) */ static int alauda_reset_media(struct us_data *us)
{ unsigned char *command = us->iobuf; memset(command, 0, 9); command[0] = ALAUDA_BULK_CMD; command[1] = ALAUDA_BULK_RESET_MEDIA; command[8] = MEDIA_PORT(us); return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, command, 9, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* This routine returns the numbers of characters the tty driver will accept for queuing to be written. This number is subject to change as output buffers get emptied, or if the output flow control is acted. */
static int sclp_vt220_write_room(struct tty_struct *tty)
/* This routine returns the numbers of characters the tty driver will accept for queuing to be written. This number is subject to change as output buffers get emptied, or if the output flow control is acted. */ static int sclp_vt220_write_room(struct tty_struct *tty)
{ unsigned long flags; struct list_head *l; int count; spin_lock_irqsave(&sclp_vt220_lock, flags); count = 0; if (sclp_vt220_current_request != NULL) count = sclp_vt220_space_left(sclp_vt220_current_request); list_for_each(l, &sclp_vt220_empty) count += SCLP_VT220_MAX_CHARS_PER_BUFFER; spin_unlock_irqrestore(&sclp_vt220_lock, flags); return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: 0 - failed to acquire the lock atomicly 1 - acquired the lock <0 - error */
static int futex_proxy_trylock_atomic(u32 __user *pifutex, struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2, union futex_key *key1, union futex_key *key2, struct futex_pi_state **ps, int set_waiters)
/* Returns: 0 - failed to acquire the lock atomicly 1 - acquired the lock <0 - error */ static int futex_proxy_trylock_atomic(u32 __user *pifutex, struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2, union futex_key *key1, union futex_key *key2, struct futex_pi_state **ps, int set_waiters)
{ struct futex_q *top_waiter = NULL; u32 curval; int ret; if (get_futex_value_locked(&curval, pifutex)) return -EFAULT; top_waiter = futex_top_waiter(hb1, key1); if (!top_waiter) return 0; if (!match_futex(top_waiter->requeue_pi_key, key2)) return -EINVAL; ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, set_waiters); if (ret == 1) requeue_pi_wake_futex(top_waiter, key2, hb2); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */
unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */ unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); return (xHWREG(ulBase + SPI_CNTRL2) & SPI_CNTRL2_SLV_START_INTSTS); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If the EIPV bit is set, it means the saved IP is the instruction which caused the MCE. */
static int error_context(struct mce *m)
/* If the EIPV bit is set, it means the saved IP is the instruction which caused the MCE. */ static int error_context(struct mce *m)
{ if (m->mcgstatus & MCG_STATUS_EIPV) return (m->ip && (m->cs & 3) == 3) ? IN_USER : IN_KERNEL; return IN_KERNEL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* On PowerPC we implement it using the timebase register. */
unsigned long post_time_ms(unsigned long base)
/* On PowerPC we implement it using the timebase register. */ unsigned long post_time_ms(unsigned long base)
{ return (unsigned long)get_ticks() / (get_tbclk() / CONFIG_SYS_HZ) - base; }
EmcraftSystems/u-boot
C++
Other
181
/* Debounce time. If the time between two consecutive steps is greater than DEB_TIME*80ms, the debouncer is reactivated. Default value: 01101. */
int32_t lsm6dsl_pedo_timeout_set(stmdev_ctx_t *ctx, uint8_t val)
/* Debounce time. If the time between two consecutive steps is greater than DEB_TIME*80ms, the debouncer is reactivated. Default value: 01101. */ int32_t lsm6dsl_pedo_timeout_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dsl_pedo_deb_reg_t pedo_deb_reg; int32_t ret; ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A); if(ret == 0){ ret = lsm6dsl_read_reg(ctx, LSM6DSL_PEDO_DEB_REG, (uint8_t*)&pedo_deb_reg, 1); if(ret == 0){ pedo_deb_reg.deb_time = val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_PEDO_DEB_REG, (uint8_t*)&pedo_deb_reg, 1); if(ret == 0){ ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK); } } } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* param base GPC CPU module base address. param setPointRun The set point CPU want the system to transit in the run mode. */
void GPC_CM_RequestRunModeSetPointTransition(GPC_CPU_MODE_CTRL_Type *base, uint8_t setPointRun)
/* param base GPC CPU module base address. param setPointRun The set point CPU want the system to transit in the run mode. */ void GPC_CM_RequestRunModeSetPointTransition(GPC_CPU_MODE_CTRL_Type *base, uint8_t setPointRun)
{ uint32_t tmp32 = base->CM_SP_CTRL; tmp32 &= ~(GPC_CPU_MODE_CTRL_CM_SP_CTRL_CPU_SP_RUN_MASK); tmp32 |= GPC_CPU_MODE_CTRL_CM_SP_CTRL_CPU_SP_RUN_EN_MASK | GPC_CPU_MODE_CTRL_CM_SP_CTRL_CPU_SP_RUN(setPointRun); base->CM_SP_CTRL = tmp32; while ((base->CM_SP_CTRL & GPC_CPU_MODE_CTRL_CM_SP_CTRL_CPU_SP_RUN_EN_MASK) != 0UL) { } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the Mailbox mode. Needs the I2C Password presentation to be effective. */
int32_t ST25DV_WriteMBMode(ST25DV_Object_t *pObj, const ST25DV_EN_STATUS MB_mode)
/* Sets the Mailbox mode. Needs the I2C Password presentation to be effective. */ int32_t ST25DV_WriteMBMode(ST25DV_Object_t *pObj, const ST25DV_EN_STATUS MB_mode)
{ uint8_t reg_value; int32_t status; reg_value = (uint8_t)MB_mode; status = st25dv_set_mb_mode_rw(&(pObj->Ctx), &reg_value); return status; }
eclipse-threadx/getting-started
C++
Other
310
/* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{ RCC_OscInitTypeDef RCC_OscInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; RCC_OscInitStruct.LSIState = RCC_LSI_ON; if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { Error_Handler(); } __HAL_RCC_RTC_ENABLE(); HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 0x0F, 0); HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* InternalVarCheckReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ VOID* InternalVarCheckReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
{ VOID *NewBuffer; NewBuffer = InternalVarCheckAllocateZeroPool (NewSize); if ((NewBuffer != NULL) && (OldBuffer != NULL)) { CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); InternalVarCheckFreePool (OldBuffer); } return NewBuffer; }
tianocore/edk2
C++
Other
4,240
/* gpr_init() function is common for boards using MX6S, MX6DL, MX6D, MX6Q and MX6QP processors */
void gpr_init(void)
/* gpr_init() function is common for boards using MX6S, MX6DL, MX6D, MX6Q and MX6QP processors */ void gpr_init(void)
{ struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; if (!is_mx6dqp() && !is_mx6dq() && !is_mx6sdl()) return; writel(0xF00000CF, &iomux->gpr[4]); if (is_mx6dqp()) { writel(0x77177717, &iomux->gpr[6]); writel(0x77177717, &iomux->gpr[7]); } else { writel(0x007F007F, &iomux->gpr[6]); writel(0x007F007F, &iomux->gpr[7]); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Lights all LEDs in one random color up. Then switches them to the next random color. */
static int ws2812_effects_mode_random_color()
/* Lights all LEDs in one random color up. Then switches them to the next random color. */ static int ws2812_effects_mode_random_color()
{ *p++ = g; *p++ = r; *p++ = b; for (j = 3; j < pixbuf_channels(buffer); j++) { *p++ = 0; } } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* This function will get the Caller ID info and replace the current string This is how it looks the caller Id: rg, ci(/29, "3035550002","Ale Sipura 2") */
static void mgcp_caller_id(gchar *signalStr, gchar **callerId)
/* This function will get the Caller ID info and replace the current string This is how it looks the caller Id: rg, ci(/29, "3035550002","Ale Sipura 2") */ static void mgcp_caller_id(gchar *signalStr, gchar **callerId)
{ gchar **arrayStr; if (signalStr == NULL) return; arrayStr = g_strsplit(signalStr, "\"", 3); if (g_strv_length(arrayStr) == 3 && strstr(arrayStr[0], "ci(")) { g_free(*callerId); *callerId = g_strdup(arrayStr[1]); } g_strfreev(arrayStr); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330