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
/* This could be made generic for all sysdev classes. */
struct memory_block* find_memory_block(struct mem_section *section)
/* This could be made generic for all sysdev classes. */ struct memory_block* find_memory_block(struct mem_section *section)
{ struct kobject *kobj; struct sys_device *sysdev; struct memory_block *mem; char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1]; sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, __section_nr(section)); kobj = kset_find_obj(&memory_sysdev_class.kset, name); if (!kobj) return NULL; sysdev = container_of(kobj, struct sys_device, kobj); mem = container_of(sysdev, struct memory_block, sysdev); return mem; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes Back the data cache lines specified by ScatterGatherList. */
VOID CapsuleCacheWriteBack(IN EFI_PHYSICAL_ADDRESS ScatterGatherList)
/* Writes Back the data cache lines specified by ScatterGatherList. */ VOID CapsuleCacheWriteBack(IN EFI_PHYSICAL_ADDRESS ScatterGatherList)
{ EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc; if (!EfiAtRuntime ()) { Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList; do { WriteBackDataCacheRange ( (VOID *)(UINTN)Desc, (UINTN)sizeof (*Desc) ); if (Desc->Length > 0) { WriteBackDataCacheRange ( (VOID *)(UINTN)Desc->Union.DataBlock, (UINTN)Desc->Length ); Desc++; } else if (Desc->Union.ContinuationPointer > 0) { Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)Desc->Union.ContinuationPointer; } } while (Desc->Length > 0 || Desc->Union.ContinuationPointer > 0); WriteBackDataCacheRange ( (VOID *)(UINTN)Desc, (UINTN)sizeof (*Desc) ); } }
tianocore/edk2
C++
Other
4,240
/* side effects of acpi_boot_init: acpi_lapic = 1 if LAPIC found acpi_ioapic = 1 if IOAPIC found if (acpi_lapic && acpi_ioapic) smp_found_config = 1; if acpi_blacklisted() acpi_disabled = 1; acpi_irq_model=... ... */
void __init acpi_boot_table_init(void)
/* side effects of acpi_boot_init: acpi_lapic = 1 if LAPIC found acpi_ioapic = 1 if IOAPIC found if (acpi_lapic && acpi_ioapic) smp_found_config = 1; if acpi_blacklisted() acpi_disabled = 1; acpi_irq_model=... ... */ void __init acpi_boot_table_init(void)
{ dmi_check_system(acpi_dmi_table); if (acpi_disabled && !acpi_ht) return; if (acpi_table_init()) { disable_acpi(); return; } acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); if (acpi_blacklisted()) { if (acpi_force) { printk(KERN_WARNING PREFIX "acpi=force override\n"); } else { printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); disable_acpi(); return; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns TRUE if the machine type of PE/COFF image is supported. Supported does not mean the image can be executed it means the PE/COFF loader supports loading and relocating of the image type. It's up to the caller to support the entry point. */
BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine)
/* Returns TRUE if the machine type of PE/COFF image is supported. Supported does not mean the image can be executed it means the PE/COFF loader supports loading and relocating of the image type. It's up to the caller to support the entry point. */ BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine)
{ if (Machine == IMAGE_FILE_MACHINE_LOONGARCH64) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Config string is a comma separated set of i/o addresses of EISA cards. */
static int cpqarray_setup(char *str)
/* Config string is a comma separated set of i/o addresses of EISA cards. */ static int cpqarray_setup(char *str)
{ int i, ints[9]; (void)get_options(str, ARRAY_SIZE(ints), ints); for(i=0; i<ints[0] && i<8; i++) eisa[i] = ints[i+1]; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power */
void adc_disable_regulator(uint32_t adc)
/* Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power */ void adc_disable_regulator(uint32_t adc)
{ ADC_CR(adc) &= ~ADC_CR_ADVREGEN_MASK; ADC_CR(adc) |= ADC_CR_ADVREGEN_DISABLE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns 1 if bus reset already in progress, 0 otherwise. */
int hpsb_bus_reset(struct hpsb_host *host)
/* Returns 1 if bus reset already in progress, 0 otherwise. */ int hpsb_bus_reset(struct hpsb_host *host)
{ if (host->in_bus_reset) { HPSB_NOTICE("%s called while bus reset already in progress", __func__); return 1; } abort_requests(host); host->in_bus_reset = 1; host->irm_id = -1; host->is_irm = 0; host->busmgr_id = -1; host->is_busmgr = 0; host->is_cycmst = 0; host->node_count = 0; host->selfid_count = 0; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the writeback bits on all of the file pages for a compressed write */
static noinline int end_compressed_writeback(struct inode *inode, u64 start, unsigned long ram_size)
/* Clear the writeback bits on all of the file pages for a compressed write */ static noinline int end_compressed_writeback(struct inode *inode, u64 start, unsigned long ram_size)
{ unsigned long index = start >> PAGE_CACHE_SHIFT; unsigned long end_index = (start + ram_size - 1) >> PAGE_CACHE_SHIFT; struct page *pages[16]; unsigned long nr_pages = end_index - index + 1; int i; int ret; while (nr_pages > 0) { ret = find_get_pages_contig(inode->i_mapping, index, min_t(unsigned long, nr_pages, ARRAY_SIZE(pages)), pages); if (ret == 0) { nr_pages -= 1; index += 1; continue; } for (i = 0; i < ret; i++) { end_page_writeback(pages[i]); page_cache_release(pages[i]); } nr_pages -= ret; index += ret; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function computes the bit position of the lowest bit set in the 32-bit value specified by Operand. If Operand is zero, then -1 is returned. Otherwise, a value between 0 and 31 is returned. */
INTN EFIAPI LowBitSet32(IN UINT32 Operand)
/* This function computes the bit position of the lowest bit set in the 32-bit value specified by Operand. If Operand is zero, then -1 is returned. Otherwise, a value between 0 and 31 is returned. */ INTN EFIAPI LowBitSet32(IN UINT32 Operand)
{ INTN BitIndex; if (Operand == 0) { return -1; } for (BitIndex = 0; 0 == (Operand & 1); BitIndex++, Operand >>= 1) { } return BitIndex; }
tianocore/edk2
C++
Other
4,240
/* Adjust the congestion window after a retransmit timeout has occurred. */
static void xs_udp_timer(struct rpc_task *task)
/* Adjust the congestion window after a retransmit timeout has occurred. */ static void xs_udp_timer(struct rpc_task *task)
{ xprt_adjust_cwnd(task, -ETIMEDOUT); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Given desired divider ratio, return the value that needs to be set in Clock and AC Timing Control register */
static u32 get_clk_reg_val(ulong divider_ratio)
/* Given desired divider ratio, return the value that needs to be set in Clock and AC Timing Control register */ static u32 get_clk_reg_val(ulong divider_ratio)
{ ulong inc = 0, div; ulong scl_low, scl_high, data; for (div = 0; divider_ratio >= 16; div++) { inc |= (divider_ratio & 1); divider_ratio >>= 1; } divider_ratio += inc; scl_low = (divider_ratio >> 1) - 1; scl_high = divider_ratio - scl_low - 2; data = I2CD_CACTC_BASE | (scl_high << I2CD_TCKHIGH_SHIFT) | (scl_low << I2CD_TCKLOW_SHIFT) | (div << I2CD_BASE_DIV_SHIFT); return data; }
4ms/stm32mp1-baremetal
C++
Other
137
/* mixart_BA1 proc interface for BAR 1 - read callback */
static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *buf, unsigned long count, unsigned long pos)
/* mixart_BA1 proc interface for BAR 1 - read callback */ static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *buf, unsigned long count, unsigned long pos)
{ struct mixart_mgr *mgr = entry->private_data; count = count & ~3; if(count <= 0) return 0; if(pos + count > MIXART_BA1_SIZE) count = (long)(MIXART_BA1_SIZE - pos); if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count)) return -EFAULT; return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Deinitializes the EXTI peripheral registers to their default reset values. */
void EXTI_DeInit(void)
/* Deinitializes the EXTI peripheral registers to their default reset values. */ void EXTI_DeInit(void)
{ EXTI->IMASK = 0x00000000; EXTI->EMASK = 0x00000000; EXTI->RT_CFG = 0x00000000; EXTI->FT_CFG = 0x00000000; EXTI->PEND = 0x0FFFFFFF; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Power up the main PLL. USERCC2 must have been set by a call to */
void rcc_pll_on(void)
/* Power up the main PLL. USERCC2 must have been set by a call to */ void rcc_pll_on(void)
{ SYSCTL_RCC2 &= ~SYSCTL_RCC2_PWRDN2; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Stops the TIMER output compare signal generation on the complementary output. */
void ald_timer_ocn_stop(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
/* Stops the TIMER output compare signal generation on the complementary output. */ void ald_timer_ocn_stop(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
{ assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); timer_ccxn_channel_cmd(hperh->perh, ch, DISABLE); ALD_TIMER_MOE_DISABLE(hperh); ALD_TIMER_DISABLE(hperh); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* tipc_subseq_alloc - allocate a specified number of sub-sequence structures */
static struct sub_seq* tipc_subseq_alloc(u32 cnt)
/* tipc_subseq_alloc - allocate a specified number of sub-sequence structures */ static struct sub_seq* tipc_subseq_alloc(u32 cnt)
{ struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC); return sseq; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Source is NULL, then ASSERT(). If Destination is NULL, then ASSERT(). If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT(). */
RETURN_STATUS EFIAPI UefiDecompress(IN CONST VOID *Source, IN OUT VOID *Destination, IN OUT VOID *Scratch OPTIONAL)
/* If Source is NULL, then ASSERT(). If Destination is NULL, then ASSERT(). If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT(). */ RETURN_STATUS EFIAPI UefiDecompress(IN CONST VOID *Source, IN OUT VOID *Destination, IN OUT VOID *Scratch OPTIONAL)
{ return UefiTianoDecompress (Source, Destination, Scratch, 1); }
tianocore/edk2
C++
Other
4,240
/* This function is called to initialize external sdram. */
static void rt_hw_exdram_init(void)
/* This function is called to initialize external sdram. */ static void rt_hw_exdram_init(void)
{ *pEBIU_AMBCTL1 = 0xFFFFFF02; ssync(); *pEBIU_AMGCTL = 0x00FF; ssync(); if (SDRS != ((*pEBIU_SDSTAT) & SDRS)) { return; } *pEBIU_SDRRC = 0x01A0; *pEBIU_SDBCTL = 0x0025; *pEBIU_SDGCTL = 0x0091998D; ssync(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This API is used to get Slow Offset duration status in the register 0x31 bit 4,5 and 6. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_slow_offset_durn(u8 *v_offset_durn_u8)
/* This API is used to get Slow Offset duration status in the register 0x31 bit 4,5 and 6. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_slow_offset_durn(u8 *v_offset_durn_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_SLOW_OFFSET_DURN__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_offset_durn_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_SLOW_OFFSET_DURN); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* configure the data timeout, data length and data block size */
void sdio_data_config(uint32_t data_timeout, uint32_t data_length, uint32_t data_blocksize)
/* configure the data timeout, data length and data block size */ void sdio_data_config(uint32_t data_timeout, uint32_t data_length, uint32_t data_blocksize)
{ SDIO_DATATO &= ~SDIO_DATATO_DATATO; SDIO_DATALEN &= ~SDIO_DATALEN_DATALEN; SDIO_DATACTL &= ~SDIO_DATACTL_BLKSZ; SDIO_DATATO = data_timeout; SDIO_DATALEN = data_length; SDIO_DATACTL |= data_blocksize; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieve ordinal number of the given USART hardware instance. */
uint8_t _usart_async_get_hardware_index(const struct _usart_async_device *const device)
/* Retrieve ordinal number of the given USART hardware instance. */ uint8_t _usart_async_get_hardware_index(const struct _usart_async_device *const device)
{ ASSERT(device); return _usart_get_hardware_index(device->hw); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables the specified NOR/SRAM Memory Bank. */
void FMC_NORSRAMCmd(uint32_t FMC_Bank, FunctionalState NewState)
/* Enables or disables the specified NOR/SRAM Memory Bank. */ void FMC_NORSRAMCmd(uint32_t FMC_Bank, FunctionalState NewState)
{ assert_param(IS_FMC_NORSRAM_BANK(FMC_Bank)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { FMC_Bank1->BTCR[FMC_Bank] |= BCR_MBKEN_SET; } else { FMC_Bank1->BTCR[FMC_Bank] &= BCR_MBKEN_RESET; } }
MaJerle/stm32f429
C++
null
2,036
/* Draws a string using the supplied font data. */
void sharpmemDrawString(uint16_t x, uint16_t y, const char *text, struct FONT_DEF font)
/* Draws a string using the supplied font data. */ void sharpmemDrawString(uint16_t x, uint16_t y, const char *text, struct FONT_DEF font)
{ uint8_t l; for (l = 0; l < strlen(text); l++) { sharpmemDrawChar(x + (l * (font.u8Width + 1)), y, text[l], font); } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Compute size order. Returns the exponent of the smaller power of two which is greater or equal to given number. */
int drm_order(unsigned long size)
/* Compute size order. Returns the exponent of the smaller power of two which is greater or equal to given number. */ int drm_order(unsigned long size)
{ int order; unsigned long tmp; for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ; if (size & (size - 1)) ++order; return order; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the pulse width of the specified channel in microseconds. */
void pwmout_pulsewidth_us(pwmout_t *obj, int us)
/* Set the pulse width of the specified channel in microseconds. */ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
{ u32 ccrx; obj->pulse = (float)us; ccrx = (u32)(obj->pulse * 40 / (prescaler + 1)) & 0x0000ffff; RTIM_CCRxSet(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], ccrx, obj->pwm_idx & (~BIT_PWM_TIM_IDX_FLAG)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* libc/string/strstr.c Finds the first occurrence of a substring in a string */
char* strstr(const char *s1, const char *s2)
/* libc/string/strstr.c Finds the first occurrence of a substring in a string */ char* strstr(const char *s1, const char *s2)
{ size_t l1, l2; l2 = strlen(s2); if (!l2) return (char *)s1; l1 = strlen(s1); while (l1 >= l2) { l1--; if (!memcmp(s1, s2, l2)) return (char *)s1; s1++; } return NULL; }
xboot/xboot
C++
MIT License
779
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */ UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
{ UINTN ApicBase; ApicBase = InternalX86GetApicBase (); InternalX86Delay ( ApicBase, (UINT32)DivU64x32 ( MultU64x64 ( InternalX86GetTimerFrequency (ApicBase), NanoSeconds ), 1000000000u ) ); return NanoSeconds; }
tianocore/edk2
C++
Other
4,240
/* The AB3100 is usually assigned address 0x48 (7-bit) The chip is defined in the platform i2c_board_data section. */
u8 ab3100_get_chip_type(struct ab3100 *ab3100)
/* The AB3100 is usually assigned address 0x48 (7-bit) The chip is defined in the platform i2c_board_data section. */ u8 ab3100_get_chip_type(struct ab3100 *ab3100)
{ u8 chip = ABUNKNOWN; switch (ab3100->chip_id & 0xf0) { case 0xa0: chip = AB3000; break; case 0xc0: chip = AB3100; break; } return chip; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets all general-purpose fuses with the appropriate erase and write operations. */
void flashcalw_set_all_gp_fuses(uint64_t value)
/* Sets all general-purpose fuses with the appropriate erase and write operations. */ void flashcalw_set_all_gp_fuses(uint64_t value)
{ uint32_t error_status; switch (value) { case (uint64_t)-1: flashcalw_erase_all_gp_fuses(false); break; case (uint64_t)0: flashcalw_write_all_gp_fuses((uint64_t)0); break; default: flashcalw_erase_all_gp_fuses(false); error_status = flashcalw_error_status; flashcalw_write_all_gp_fuses(value); flashcalw_error_status |= error_status; break; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
{ if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_6); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_3|GPIO_PIN_5); } else if(hspi->Instance==SPI2) { __HAL_RCC_SPI2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15); } else if(hspi->Instance==SPI5) { __HAL_RCC_SPI5_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function erases the main instance + the customer INFO space. */
int am_hal_flash_erase_main_plus_info(uint32_t ui32ProgramKey, uint32_t ui32Inst)
/* This function erases the main instance + the customer INFO space. */ int am_hal_flash_erase_main_plus_info(uint32_t ui32ProgramKey, uint32_t ui32Inst)
{ return g_am_hal_flash.flash_erase_main_plus_info(ui32ProgramKey, ui32Inst); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Start keyboard handler on the new keyboard by refreshing LED state to match the rest of the system. */
static void kbd_start(struct input_handle *handle)
/* Start keyboard handler on the new keyboard by refreshing LED state to match the rest of the system. */ static void kbd_start(struct input_handle *handle)
{ tasklet_disable(&keyboard_tasklet); if (ledstate != 0xff) kbd_update_leds_helper(handle, &ledstate); tasklet_enable(&keyboard_tasklet); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will suspend execution of the calling thread until one of the specified signal becomes pending and return the signal number. */
int sigwait(const sigset_t *set, int *sig)
/* This function will suspend execution of the calling thread until one of the specified signal becomes pending and return the signal number. */ int sigwait(const sigset_t *set, int *sig)
{ siginfo_t si; if (sigtimedwait(set, &si, 0) < 0) return -1; *sig = si.si_signo; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Mallocs a block of memory and initializes an mbuf pool to use it. The specified block_size indicates the size of an mbuf acquired from the pool if it contains a pkthdr. */
int mem_malloc_mbufpkt_pool(struct os_mempool *mempool, struct os_mbuf_pool *mbuf_pool, int num_blocks, int block_size, char *name, void **out_buf)
/* Mallocs a block of memory and initializes an mbuf pool to use it. The specified block_size indicates the size of an mbuf acquired from the pool if it contains a pkthdr. */ int mem_malloc_mbufpkt_pool(struct os_mempool *mempool, struct os_mbuf_pool *mbuf_pool, int num_blocks, int block_size, char *name, void **out_buf)
{ int rc; rc = mem_malloc_mbuf_pool(mempool, mbuf_pool, num_blocks, block_size + sizeof (struct os_mbuf_pkthdr), name, out_buf); return rc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* DAC960_V1_QueueMonitoringCommand queues a Monitoring Command to DAC960 V1 Firmware Controllers. */
static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *Command)
/* DAC960_V1_QueueMonitoringCommand queues a Monitoring Command to DAC960 V1 Firmware Controllers. */ static void DAC960_V1_QueueMonitoringCommand(DAC960_Command_T *Command)
{ DAC960_Controller_T *Controller = Command->Controller; DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox; DAC960_V1_ClearCommand(Command); Command->CommandType = DAC960_MonitoringCommand; CommandMailbox->Type3.CommandOpcode = DAC960_V1_Enquiry; CommandMailbox->Type3.BusAddress = Controller->V1.NewEnquiryDMA; DAC960_QueueCommand(Command); }
robutest/uclinux
C++
GPL-2.0
60
/* If we are copying a small region we just dispatch a single job to do the copy, otherwise the io has to be split up into many jobs. */
static void dispatch_job(struct kcopyd_job *job)
/* If we are copying a small region we just dispatch a single job to do the copy, otherwise the io has to be split up into many jobs. */ static void dispatch_job(struct kcopyd_job *job)
{ struct dm_kcopyd_client *kc = job->kc; atomic_inc(&kc->nr_jobs); if (unlikely(!job->source.count)) push(&kc->complete_jobs, job); else push(&kc->pages_jobs, job); wake(kc); }
robutest/uclinux
C++
GPL-2.0
60
/* magellan_crunch_nibbles() verifies that the bytes sent from the Magellan have correct upper nibbles for the lower ones, if not, the packet will be thrown away. It also strips these upper halves to simplify further processing. */
static int magellan_crunch_nibbles(unsigned char *data, int count)
/* magellan_crunch_nibbles() verifies that the bytes sent from the Magellan have correct upper nibbles for the lower ones, if not, the packet will be thrown away. It also strips these upper halves to simplify further processing. */ static int magellan_crunch_nibbles(unsigned char *data, int count)
{ static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?"; do { if (data[count] == nibbles[data[count] & 0xf]) data[count] = data[count] & 0xf; else return -1; } while (--count); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The following code cannot be run from FLASH! */
static void flash_cmd(int width, volatile unsigned char *addr, int offset, unsigned char cmd)
/* The following code cannot be run from FLASH! */ static void flash_cmd(int width, volatile unsigned char *addr, int offset, unsigned char cmd)
{ if(width==4) { unsigned long cmd32=(cmd<<16)|cmd; *(volatile unsigned long *)(addr+offset*2)=cmd32; } else if (width == 2) { *(volatile unsigned short *)((unsigned short*)addr+offset)=cmd; } else { *(volatile unsigned char *)(addr+offset)=cmd; } }
EmcraftSystems/u-boot
C++
Other
181
/* Initialize DPM (port power role, PWR_IF, CAD and PE Init procedures) */
USBPD_StatusTypeDef USBPD_DPM_UserInit(void)
/* Initialize DPM (port power role, PWR_IF, CAD and PE Init procedures) */ USBPD_StatusTypeDef USBPD_DPM_UserInit(void)
{ USBPD_PWR_IF_Init(); osMessageQDef(MsgBox, DPM_BOX_MESSAGES_MAX, uint32_t); DPMMsgBox = osMessageCreate(osMessageQ(MsgBox), NULL); osThreadDef(DPM, USBPD_DPM_UserExecute, osPriorityLow, 0, 120); if(NULL == osThreadCreate(osThread(DPM), &DPMMsgBox)) { return USBPD_ERROR; } return USBPD_OK; }
st-one/X-CUBE-USB-PD
C++
null
110
/* This is the shell command handler function pointer callback type. This function handles the command when it is invoked in the shell. */
SHELL_STATUS EFIAPI DpCommandHandler(IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN EFI_SYSTEM_TABLE *SystemTable, IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN EFI_SHELL_PROTOCOL *Shell)
/* This is the shell command handler function pointer callback type. This function handles the command when it is invoked in the shell. */ SHELL_STATUS EFIAPI DpCommandHandler(IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN EFI_SYSTEM_TABLE *SystemTable, IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN EFI_SHELL_PROTOCOL *Shell)
{ gEfiShellParametersProtocol = ShellParameters; gEfiShellProtocol = Shell; return RunDp (gImageHandle, SystemTable); }
tianocore/edk2
C++
Other
4,240
/* The UNREG_FCFI mailbox command supports Fibre Channel Forwarders (FCFs). The SLI Host uses the command to inactivate an FCFI. */
void lpfc_unreg_fcfi(struct lpfcMboxq *mbox, uint16_t fcfi)
/* The UNREG_FCFI mailbox command supports Fibre Channel Forwarders (FCFs). The SLI Host uses the command to inactivate an FCFI. */ void lpfc_unreg_fcfi(struct lpfcMboxq *mbox, uint16_t fcfi)
{ memset(mbox, 0, sizeof(*mbox)); bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_UNREG_FCFI); bf_set(lpfc_unreg_fcfi, &mbox->u.mqe.un.unreg_fcfi, fcfi); }
robutest/uclinux
C++
GPL-2.0
60
/* This delay function is intended to be used only in early stage of boot, where clock are not set up yet. The timer used here is reset on every boot and takes a few seconds to roll. The boot doesn't take that long, so to keep the code simple, it doesn't take rolling into consideration. */
void early_delay(int delay)
/* This delay function is intended to be used only in early stage of boot, where clock are not set up yet. The timer used here is reset on every boot and takes a few seconds to roll. The boot doesn't take that long, so to keep the code simple, it doesn't take rolling into consideration. */ void early_delay(int delay)
{ struct mxs_digctl_regs *digctl_regs = (struct mxs_digctl_regs *)MXS_DIGCTL_BASE; uint32_t st = readl(&digctl_regs->hw_digctl_microseconds); st += delay; while (st > readl(&digctl_regs->hw_digctl_microseconds)) ; }
4ms/stm32mp1-baremetal
C++
Other
137
/* returns: 1, if all hashes are valid 0, otherwise (or on error) */
int fit_image_verify(const void *fit, int image_noffset)
/* returns: 1, if all hashes are valid 0, otherwise (or on error) */ int fit_image_verify(const void *fit, int image_noffset)
{ const void *data; size_t size; int noffset = 0; char *err_msg = ""; if (fit_image_get_data_and_size(fit, image_noffset, &data, &size)) { err_msg = "Can't get image data/size"; printf("error!\n%s for '%s' hash node in '%s' image node\n", err_msg, fit_get_name(fit, noffset, NULL), fit_get_name(fit, image_noffset, NULL)); return 0; } return fit_image_verify_with_data(fit, image_noffset, data, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enables or disables DATA EEPROM fixed Time programming (2*Tprog). */
void DATA_EEPROM_FixedTimeProgramCmd(FunctionalState NewState)
/* Enables or disables DATA EEPROM fixed Time programming (2*Tprog). */ void DATA_EEPROM_FixedTimeProgramCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if(NewState != DISABLE) { FLASH->PECR |= (uint32_t)FLASH_PECR_FTDW; } else { FLASH->PECR &= (uint32_t)(~((uint32_t)FLASH_PECR_FTDW)); } }
avem-labs/Avem
C++
MIT License
1,752
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ BSP_LED_On(LED3); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* SCSI midlayer limits the number of retries to scmd->allowed. scmd->retries is decremented for commands which get retried due to unrelated failures (qc->err_mask is zero). */
void ata_eh_qc_retry(struct ata_queued_cmd *qc)
/* SCSI midlayer limits the number of retries to scmd->allowed. scmd->retries is decremented for commands which get retried due to unrelated failures (qc->err_mask is zero). */ void ata_eh_qc_retry(struct ata_queued_cmd *qc)
{ struct scsi_cmnd *scmd = qc->scsicmd; if (!qc->err_mask && scmd->retries) scmd->retries--; __ata_eh_qc_complete(qc); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param handle codec handle. param cmd module control cmd, reference _codec_module_ctrl_cmd. param data value to write, when cmd is kCODEC_ModuleRecordSourceChannel, the data should be a value combine of channel and source, please reference macro CODEC_MODULE_RECORD_SOURCE_CHANNEL(source, LP, LN, RP, RN), reference codec specific driver for detail configurations. return kStatus_Success is success, else configure failed. */
status_t CODEC_ModuleControl(codec_handle_t *handle, codec_module_ctrl_cmd_t cmd, uint32_t data)
/* param handle codec handle. param cmd module control cmd, reference _codec_module_ctrl_cmd. param data value to write, when cmd is kCODEC_ModuleRecordSourceChannel, the data should be a value combine of channel and source, please reference macro CODEC_MODULE_RECORD_SOURCE_CHANNEL(source, LP, LN, RP, RN), reference codec specific driver for detail configurations. return kStatus_Success is success, else configure failed. */ status_t CODEC_ModuleControl(codec_handle_t *handle, codec_module_ctrl_cmd_t cmd, uint32_t data)
{ assert((handle != NULL) && (handle->codecConfig != NULL)); assert(handle->codecCapability != NULL); if (cmd == kCODEC_ModuleSwitchI2SInInterface) { if ((handle->codecCapability->codecModuleCapability & (uint32_t)kCODEC_SupportModuleI2SInSwitchInterface) == 0U) { return kStatus_CODEC_NotSupport; } } else { return kStatus_CODEC_NotSupport; } return HAL_CODEC_ModuleControl(handle, (uint32_t)cmd, data); }
eclipse-threadx/getting-started
C++
Other
310
/* param base SAI base pointer param mask Channel enable mask, 0 means all channel FIFO disabled, 1 means channel 0 enabled, 3 means both channel 0 and channel 1 enabled. */
void SAI_RxSetChannelFIFOMask(I2S_Type *base, uint8_t mask)
/* param base SAI base pointer param mask Channel enable mask, 0 means all channel FIFO disabled, 1 means channel 0 enabled, 3 means both channel 0 and channel 1 enabled. */ void SAI_RxSetChannelFIFOMask(I2S_Type *base, uint8_t mask)
{ base->RCR3 &= ~I2S_RCR3_RCE_MASK; base->RCR3 |= I2S_RCR3_RCE(mask); }
eclipse-threadx/getting-started
C++
Other
310
/* In this function we override the bundle with the break instruction at the given slot. */
static void __kprobes prepare_break_inst(uint template, uint slot, uint major_opcode, unsigned long kprobe_inst, struct kprobe *p, int qp)
/* In this function we override the bundle with the break instruction at the given slot. */ static void __kprobes prepare_break_inst(uint template, uint slot, uint major_opcode, unsigned long kprobe_inst, struct kprobe *p, int qp)
{ unsigned long break_inst = BREAK_INST; bundle_t *bundle = &p->opcode.bundle; break_inst |= qp; switch (slot) { case 0: bundle->quad0.slot0 = break_inst; break; case 1: bundle->quad0.slot1_p0 = break_inst; bundle->quad1.slot1_p1 = break_inst >> (64-46); break; case 2: bundle->quad1.slot2 = break_inst; break; } update_kprobe_inst_flag(template, slot, major_opcode, kprobe_inst, p); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* fcoe_fip_send() - Send an Ethernet-encapsulated FIP frame @fip: The FCoE controller @skb: The FIP packet to be sent */
static void fcoe_fip_send(struct fcoe_ctlr *, struct sk_buff *)
/* fcoe_fip_send() - Send an Ethernet-encapsulated FIP frame @fip: The FCoE controller @skb: The FIP packet to be sent */ static void fcoe_fip_send(struct fcoe_ctlr *, struct sk_buff *)
{ skb->dev = fcoe_from_ctlr(fip)->netdev; dev_queue_xmit(skb); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if SWP bus is in DEACTIVATED state @rmtoll ISR DEACTF LL_SWPMI_IsActiveFlag_DEACT. */
uint32_t LL_SWPMI_IsActiveFlag_DEACT(SWPMI_TypeDef *SWPMIx)
/* Check if SWP bus is in DEACTIVATED state @rmtoll ISR DEACTF LL_SWPMI_IsActiveFlag_DEACT. */ uint32_t LL_SWPMI_IsActiveFlag_DEACT(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_DEACTF) == (SWPMI_ISR_DEACTF)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the HTS221 temperature sensor output data rate. */
int32_t HTS221_TEMP_GetOutputDataRate(HTS221_Object_t *pObj, float *Odr)
/* Get the HTS221 temperature sensor output data rate. */ int32_t HTS221_TEMP_GetOutputDataRate(HTS221_Object_t *pObj, float *Odr)
{ return HTS221_GetOutputDataRate(pObj, Odr); }
eclipse-threadx/getting-started
C++
Other
310
/* This is a helper function which initializes various UBIFS constants after the master node has been read. It also checks various UBIFS parameters and makes sure they are all right. */
static void init_constants_master(struct ubifs_info *c)
/* This is a helper function which initializes various UBIFS constants after the master node has been read. It also checks various UBIFS parameters and makes sure they are all right. */ static void init_constants_master(struct ubifs_info *c)
{ long long tmp64; c->bi.min_idx_lebs = ubifs_calc_min_idx_lebs(c); c->report_rp_size = ubifs_reported_space(c, c->rp_size); tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt + 1; tmp64 *= (long long)c->leb_size - c->leb_overhead; tmp64 = ubifs_reported_space(c, tmp64); c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This API is used to get the any motion(int2_any_motion) interrupt2 enable bits of the sensor in the registers 0x19 bit 1. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr2_any_motion(u8 *v_intr2_any_motion_u8)
/* This API is used to get the any motion(int2_any_motion) interrupt2 enable bits of the sensor in the registers 0x19 bit 1. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr2_any_motion(u8 *v_intr2_any_motion_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_INTR_MAP_TWO_INTR2_ANY_MOTION__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_intr2_any_motion_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_INTR_MAP_TWO_INTR2_ANY_MOTION); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: the size of the bytes skipped, or %-1 on error. */
gssize g_input_stream_skip_finish(GInputStream *stream, GAsyncResult *result, GError **error)
/* Returns: the size of the bytes skipped, or %-1 on error. */ gssize g_input_stream_skip_finish(GInputStream *stream, GAsyncResult *result, GError **error)
{ GInputStreamClass *class; g_return_val_if_fail (G_IS_INPUT_STREAM (stream), -1); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), -1); if (g_async_result_legacy_propagate_error (result, error)) return -1; else if (g_async_result_is_tagged (result, g_input_stream_skip_async)) return g_task_propagate_int (G_TASK (result), error); class = G_INPUT_STREAM_GET_CLASS (stream); return class->skip_finish (stream, result, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Fill in the cmd array /GDC FIFO commands/ to draw a 16bit image. Make sure cmd has enough room! */
static void mb86290fb_imageblit16(u32 *cmd, u16 step, u16 dx, u16 dy, u16 width, u16 height, u32 fgcolor, u32 bgcolor, const struct fb_image *image, struct fb_info *info)
/* Fill in the cmd array /GDC FIFO commands/ to draw a 16bit image. Make sure cmd has enough room! */ static void mb86290fb_imageblit16(u32 *cmd, u16 step, u16 dx, u16 dy, u16 width, u16 height, u32 fgcolor, u32 bgcolor, const struct fb_image *image, struct fb_info *info)
{ int i; unsigned const char *line; u16 bytes; i = 0; line = image->data; bytes = image->width << 1; cmd[0] = (GDC_TYPE_DRAWBITMAPP << 24) | (GDC_CMD_BLT_DRAW << 16) | (2 + step * height); cmd[1] = (dy << 16) | dx; cmd[2] = (height << 16) | width; while (i < height) { memcpy(&cmd[3 + i * step], line, step); line += bytes; i++; } }
robutest/uclinux
C++
GPL-2.0
60
/* Configure the selected source to generate a global interrupt or not. */
void stmpe811_TS_ClearIT(uint16_t DeviceAddr)
/* Configure the selected source to generate a global interrupt or not. */ void stmpe811_TS_ClearIT(uint16_t DeviceAddr)
{ stmpe811_ClearGlobalIT(DeviceAddr, STMPE811_TS_IT); }
eclipse-threadx/getting-started
C++
Other
310
/* Fills each DCI InitStruct member with its default value. */
void DCI_ConfigStructInit(DCI_Config_T *dciConfig)
/* Fills each DCI InitStruct member with its default value. */ void DCI_ConfigStructInit(DCI_Config_T *dciConfig)
{ dciConfig->captureMode = DCI_CAPTURE_MODE_CONTINUOUS; dciConfig->synchroMode = DCI_SYNCHRO_MODE_HARDWARE; dciConfig->pckPolarity = DCI_PCK_POL_FALLING; dciConfig->vsyncPolarity = DCI_VSYNC_POL_LOW; dciConfig->hsyncPolarity = DCI_HSYNC_POL_LOW; dciConfig->capturerate = DCI_CAPTURE_RATE_ALL_FRAME; dciConfig->extendedDataMode = DCI_EXTENDED_DATA_MODE_8B; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Output a character in polled mode. The behavior of CDC ACM poll out is: */
static void cdc_acm_poll_out(const struct device *dev, unsigned char c)
/* Output a character in polled mode. The behavior of CDC ACM poll out is: */ static void cdc_acm_poll_out(const struct device *dev, unsigned char c)
{ struct cdc_acm_dev_data_t * const dev_data = dev->data; dev_data->tx_ready = false; while (!ring_buf_put(dev_data->tx_ringbuf, &c, 1)) { if (k_is_in_isr() || !dev_data->flow_ctrl) { LOG_INF("Ring buffer full, discard %c", c); break; } k_msleep(1); } k_work_schedule_for_queue(&USB_WORK_Q, &dev_data->tx_work, K_MSEC(1)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Retrieves the location of the System Management System Table (SMST). */
EFI_STATUS EFIAPI SmmBase2GetSmstLocation(IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT EFI_SMM_SYSTEM_TABLE2 **Smst)
/* Retrieves the location of the System Management System Table (SMST). */ EFI_STATUS EFIAPI SmmBase2GetSmstLocation(IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT EFI_SMM_SYSTEM_TABLE2 **Smst)
{ if ((This == NULL) || (Smst == NULL)) { return EFI_INVALID_PARAMETER; } if (!gSmmCorePrivate->InSmm) { return EFI_UNSUPPORTED; } *Smst = gSmmCorePrivate->Smst; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Registers an interrupt handler for the memory management fault. */
void MPUIntRegister(void(*pfnHandler)(void))
/* Registers an interrupt handler for the memory management fault. */ void MPUIntRegister(void(*pfnHandler)(void))
{ ASSERT(pfnHandler); IntRegister(FAULT_MPU, pfnHandler); IntEnable(FAULT_MPU); }
watterott/WebRadio
C++
null
71
/* This function enables the uDMA controller. The uDMA controller must be enabled before it can be configured and used. */
void uDMAEnable(void)
/* This function enables the uDMA controller. The uDMA controller must be enabled before it can be configured and used. */ void uDMAEnable(void)
{ HWREG(UDMA_CFG) = UDMA_CFG_MASTEN; }
watterott/WebRadio
C++
null
71
/* This function reads status register by ap3216c sensor measurement */
uint8_t ap3216c_get_IntStatus(void)
/* This function reads status register by ap3216c sensor measurement */ uint8_t ap3216c_get_IntStatus(void)
{ uint8_t IntStatus; read_regs(AP3216C_SYS_INT_STATUS_REG, 1, &IntStatus); return IntStatus; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* 7.3.3 Slice header syntax slice_header( ) XXX Just parse a few bytes */
static int dissect_h264_slice_header(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
/* 7.3.3 Slice header syntax slice_header( ) XXX Just parse a few bytes */ static int dissect_h264_slice_header(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
{ dissect_h264_exp_golomb_code(tree, hf_h264_first_mb_in_slice, tvb, &bit_offset, H264_UE_V); dissect_h264_exp_golomb_code(tree, hf_h264_slice_type, tvb, &bit_offset, H264_UE_V); dissect_h264_exp_golomb_code(tree, hf_h264_pic_parameter_set_id, tvb, &bit_offset, H264_UE_V); return bit_offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 0 on success, -EINVAL if the parameters do not match any registered events. */
int trace_set_clr_event(const char *system, const char *event, int set)
/* Returns 0 on success, -EINVAL if the parameters do not match any registered events. */ int trace_set_clr_event(const char *system, const char *event, int set)
{ return __ftrace_set_clr_event(NULL, system, event, set); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Wrapper for calling the default reset handler which puts the communication module in a disconnected state. */
void reset_handler(void)
/* Wrapper for calling the default reset handler which puts the communication module in a disconnected state. */ void reset_handler(void)
{ REG_INITRG = 0x00; REG_INITRM = 0x39; REG_INITEE = 0x09; INIT_SP_FROM_STARTUP_DESC(); _Startup(); main(); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* control ss line depend on controlled Output mode. */
static int32_t dw_spi_ss_control(dw_spi_priv_t *spi_priv, spi_ss_stat_e stat)
/* control ss line depend on controlled Output mode. */ static int32_t dw_spi_ss_control(dw_spi_priv_t *spi_priv, spi_ss_stat_e stat)
{ if (spi_priv->ss_mode == SPI_SS_MASTER_HW_OUTPUT) { if (stat == SPI_SS_INACTIVE) { csi_gpio_pin_write(pgpio_pin_handle, true); } else if (stat == SPI_SS_ACTIVE) { csi_gpio_pin_write(pgpio_pin_handle, false); } else { return -1; } } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This use case demonstrates that the dynamically allocated memory is out of use and aos_realloc is called to expand the memory. */
int mem_realloc(void)
/* This use case demonstrates that the dynamically allocated memory is out of use and aos_realloc is called to expand the memory. */ int mem_realloc(void)
{ struct message *old_ptr = NULL, *new_ptr = NULL; old_ptr = (struct message *)aos_malloc(sizeof(struct message) * 4); if (old_ptr == NULL) { printf("[%s]aos_malloc error\n", MODULE_NAME); return -1; } memset(old_ptr, 0, sizeof(struct message) * 4); new_ptr = aos_realloc(old_ptr, sizeof(struct message) * 6); if (new_ptr == NULL) { aos_free(old_ptr); old_ptr = NULL; printf("[%s]aos_realloc task1 error\n", MODULE_NAME); return -1; } printf("[%s]aos_realloc success!\n", MODULE_NAME); aos_free(new_ptr); new_ptr = NULL; return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Clear the DMA interrupt flag of a channel. */
void DMAChannelIntFlagClear(unsigned long ulChannelID, unsigned long ulIntFlags)
/* Clear the DMA interrupt flag of a channel. */ void DMAChannelIntFlagClear(unsigned long ulChannelID, unsigned long ulIntFlags)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); xASSERT(ulIntFlags == DMA_EVENT_TC); xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DSR_BCR_DONE) |= ulIntFlags; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* finds the next empty or unused universal address containers */
static universal_address_container_t* universal_address_get_next_unused_entry(void)
/* finds the next empty or unused universal address containers */ static universal_address_container_t* universal_address_get_next_unused_entry(void)
{ if (universal_address_table_filled < UNIVERSAL_ADDRESS_MAX_ENTRIES) { for (size_t i = 0; i < UNIVERSAL_ADDRESS_MAX_ENTRIES; ++i) { if (universal_address_table[i].use_count == 0) { return &(universal_address_table[i]); } } } return NULL; }
labapart/polymcu
C++
null
201
/* brief DMA instance 0, channel 2 IRQ handler. */
void EDMA_0_CH2_DriverIRQHandler(void)
/* brief DMA instance 0, channel 2 IRQ handler. */ void EDMA_0_CH2_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(0U, 2U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Address family must be initialized, and address must not be the ANY address for that family. */
static int nfs_verify_server_address(struct sockaddr *addr)
/* Address family must be initialized, and address must not be the ANY address for that family. */ static int nfs_verify_server_address(struct sockaddr *addr)
{ switch (addr->sa_family) { case AF_INET: { struct sockaddr_in *sa = (struct sockaddr_in *)addr; return sa->sin_addr.s_addr != htonl(INADDR_ANY); } case AF_INET6: { struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr; return !ipv6_addr_any(sa); } } dfprintk(MOUNT, "NFS: Invalid IP address specified\n"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* allocate a VCardResponse structure, plus space for the data buffer, and set up everything but the resonse bytes. */
VCardResponse* vcard_response_new_data(unsigned char *buf, int len)
/* allocate a VCardResponse structure, plus space for the data buffer, and set up everything but the resonse bytes. */ VCardResponse* vcard_response_new_data(unsigned char *buf, int len)
{ VCardResponse *new_response; new_response = (VCardResponse *)g_malloc(sizeof(VCardResponse)); new_response->b_data = g_malloc(len + 2); memcpy(new_response->b_data, buf, len); new_response->b_total_len = len+2; new_response->b_len = len; new_response->b_type = VCARD_MALLOC; return new_response; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Called from pm_system_suspend(int32_t ticks) in subsys/power.c For deep sleep pm_system_suspend has executed all the driver power management call backs. */
void pm_state_set(enum pm_state state, uint8_t substate_id)
/* Called from pm_system_suspend(int32_t ticks) in subsys/power.c For deep sleep pm_system_suspend has executed all the driver power management call backs. */ void pm_state_set(enum pm_state state, uint8_t substate_id)
{ ARG_UNUSED(substate_id); switch (state) { case PM_STATE_SUSPEND_TO_IDLE: z_power_soc_sleep(); break; case PM_STATE_SUSPEND_TO_RAM: z_power_soc_deep_sleep(); break; default: break; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set or unset the suspension state of a device. If the device already is in the requested state we just return its status. */
static int dev_suspend(struct dm_ioctl *param, size_t param_size)
/* Set or unset the suspension state of a device. If the device already is in the requested state we just return its status. */ static int dev_suspend(struct dm_ioctl *param, size_t param_size)
{ if (param->flags & DM_SUSPEND_FLAG) return do_suspend(param); return do_resume(param); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will calculate the tick from millisecond. */
rt_tick_t rt_tick_from_millisecond(rt_int32_t ms)
/* This function will calculate the tick from millisecond. */ rt_tick_t rt_tick_from_millisecond(rt_int32_t ms)
{ rt_tick_t tick; if (ms < 0) { tick = (rt_tick_t)RT_WAITING_FOREVER; } else { tick = RT_TICK_PER_SECOND * (ms / 1000); tick += (RT_TICK_PER_SECOND * (ms % 1000) + 999) / 1000; } return tick; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Time period register for step detection on delta time (r/w).. */
int32_t lsm6dso_pedo_steps_period_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
/* Time period register for step detection on delta time (r/w).. */ int32_t lsm6dso_pedo_steps_period_get(lsm6dso_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; uint8_t index; index = 0x00U; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_L, &buff[index]); if (ret == 0) { index++; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_PEDO_SC_DELTAT_H, &buff[index]); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* This function decodes the Move to Color payload. */
static void dissect_zcl_color_control_move_to_color(tvbuff_t *tvb, proto_tree *tree, guint *offset)
/* This function decodes the Move to Color payload. */ static void dissect_zcl_color_control_move_to_color(tvbuff_t *tvb, proto_tree *tree, guint *offset)
{ proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_X, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_Y, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* sc6000_mpu_irq_to_softcfg - Decode MPU-401 irq number into cfg code. */
static __devinit unsigned char sc6000_mpu_irq_to_softcfg(int mpu_irq)
/* sc6000_mpu_irq_to_softcfg - Decode MPU-401 irq number into cfg code. */ static __devinit unsigned char sc6000_mpu_irq_to_softcfg(int mpu_irq)
{ unsigned char val = 0; switch (mpu_irq) { case 5: val = 4; break; case 7: val = 0x44; break; case 9: val = 0x84; break; case 10: val = 0xc4; break; default: break; } return val; }
robutest/uclinux
C++
GPL-2.0
60
/* Make directory. This operation is not idempotent. N.B. After this call resp->fh needs an fh_put */
static __be32 nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, struct nfsd_diropres *resp)
/* Make directory. This operation is not idempotent. N.B. After this call resp->fh needs an fh_put */ static __be32 nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, struct nfsd_diropres *resp)
{ __be32 nfserr; dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); if (resp->fh.fh_dentry) { printk(KERN_WARNING "nfsd_proc_mkdir: response already verified??\n"); } argp->attrs.ia_valid &= ~ATTR_SIZE; fh_init(&resp->fh, NFS_FHSIZE); nfserr = nfsd_create(rqstp, &argp->fh, argp->name, argp->len, &argp->attrs, S_IFDIR, 0, &resp->fh); fh_put(&argp->fh); return nfsd_return_dirop(nfserr, resp); }
robutest/uclinux
C++
GPL-2.0
60
/* READ a byte from the NVRAM and then send an ACK to say we have got it, GPIO0 must already be set as an input */
static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ack_data, u_char *gpreg, u_char *gpcntl)
/* READ a byte from the NVRAM and then send an ACK to say we have got it, GPIO0 must already be set as an input */ static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ack_data, u_char *gpreg, u_char *gpcntl)
{ int x; u_char read_bit; *read_data = 0; for (x = 0; x < 8; x++) { S24C16_do_bit(np, &read_bit, 1, gpreg); *read_data |= ((read_bit & 0x01) << (7 - x)); } S24C16_write_ack(np, ack_data, gpreg, gpcntl); }
robutest/uclinux
C++
GPL-2.0
60
/* This makes a copy of a vector of USB descriptors. Its primary use is to support usb_function objects which can have multiple copies, each needing different descriptors. Functions may have static tables of descriptors, which are used as templates and customized with identifiers (for interfaces, strings, endpoints, and more) as needed by a given function instance. */
struct usb_descriptor_header** __init usb_copy_descriptors(struct usb_descriptor_header **src)
/* This makes a copy of a vector of USB descriptors. Its primary use is to support usb_function objects which can have multiple copies, each needing different descriptors. Functions may have static tables of descriptors, which are used as templates and customized with identifiers (for interfaces, strings, endpoints, and more) as needed by a given function instance. */ struct usb_descriptor_header** __init usb_copy_descriptors(struct usb_descriptor_header **src)
{ struct usb_descriptor_header **tmp; unsigned bytes; unsigned n_desc; void *mem; struct usb_descriptor_header **ret; for (bytes = 0, n_desc = 0, tmp = src; *tmp; tmp++, n_desc++) bytes += (*tmp)->bLength; bytes += (n_desc + 1) * sizeof(*tmp); mem = kmalloc(bytes, GFP_KERNEL); if (!mem) return NULL; tmp = mem; ret = mem; mem += (n_desc + 1) * sizeof(*tmp); while (*src) { memcpy(mem, *src, (*src)->bLength); *tmp = mem; tmp++; mem += (*src)->bLength; src++; } *tmp = NULL; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Clears all the errors contained in the parser error stack. Frees all the errors, and the stack that contains'em. */
static enum CRStatus cr_parser_clear_errors(CRParser *a_this)
/* Clears all the errors contained in the parser error stack. Frees all the errors, and the stack that contains'em. */ static enum CRStatus cr_parser_clear_errors(CRParser *a_this)
{ GList *cur = NULL; g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); for (cur = PRIVATE (a_this)->err_stack; cur; cur = cur->next) { if (cur->data) { cr_parser_error_destroy ((CRParserError *) cur->data); } } if (PRIVATE (a_this)->err_stack) { g_list_free (PRIVATE (a_this)->err_stack); PRIVATE (a_this)->err_stack = NULL; } return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* get the next packet scheduled for sending on a specific interface */
static mdns_tx_packet_t* _mdns_get_next_pcb_packet(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
/* get the next packet scheduled for sending on a specific interface */ static mdns_tx_packet_t* _mdns_get_next_pcb_packet(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
{ mdns_tx_packet_t * q = _mdns_server->tx_queue_head; while (q) { if (q->tcpip_if == tcpip_if && q->ip_protocol == ip_protocol) { return q; } q = q->next; } return NULL; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* serial core request to disable tx ASAP (used for flow control) */
static void bcm_uart_stop_tx(struct uart_port *port)
/* serial core request to disable tx ASAP (used for flow control) */ static void bcm_uart_stop_tx(struct uart_port *port)
{ unsigned int val; val = bcm_uart_readl(port, UART_CTL_REG); val &= ~(UART_CTL_TXEN_MASK); bcm_uart_writel(port, val, UART_CTL_REG); val = bcm_uart_readl(port, UART_IR_REG); val &= ~UART_TX_INT_MASK; bcm_uart_writel(port, val, UART_IR_REG); }
robutest/uclinux
C++
GPL-2.0
60
/* Selects gyroscope OIS chain digital high-pass filter cutoff.. */
int32_t lsm6dso_aux_gy_hp_bandwidth_set(stmdev_ctx_t *ctx, lsm6dso_hpm_ois_t val)
/* Selects gyroscope OIS chain digital high-pass filter cutoff.. */ int32_t lsm6dso_aux_gy_hp_bandwidth_set(stmdev_ctx_t *ctx, lsm6dso_hpm_ois_t val)
{ lsm6dso_ctrl2_ois_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL2_OIS, (uint8_t *)&reg, 1); if (ret == 0) { reg.hpm_ois = (uint8_t)val & 0x03U; reg.hp_en_ois = ((uint8_t)val & 0x10U) >> 4; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL2_OIS, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Get Configuration USB Request Parameters: None (global SetupPacket) Return Value: TRUE - Success, FALSE - Error */
static uint32_t USB_ReqGetConfiguration(void)
/* Get Configuration USB Request Parameters: None (global SetupPacket) Return Value: TRUE - Success, FALSE - Error */ static uint32_t USB_ReqGetConfiguration(void)
{ case REQUEST_TO_DEVICE: EP0Data.pData = (uint8_t *)&USB_Configuration; break; default: return (FALSE); } return (TRUE); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Draws a number of pixels of the same color to the display. */
EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
/* Draws a number of pixels of the same color to the display. */ EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
{ uint32_t clipRemaining; uint32_t statusCode; uint32_t color; if (!initialized){ return DMD_ERROR_DRIVER_NOT_INITIALIZED; } statusCode = setPixelAddress(x, y); if (statusCode != DMD_OK){ return statusCode; } clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth + dimensions.clipWidth - x; if (numPixels > clipRemaining){ return DMD_ERROR_TOO_MUCH_DATA; } DMDIF_prepareDataAccess( ); color = colorTransform24To16bpp(red, green, blue); DMDIF_writeDataRepeated(color, numPixels); return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Select The Timer counter detect phase. This function is to select The Timer counter detect phase. */
void xTimerCounterDetectPhaseSelect(unsigned long ulBase, unsigned long ulChannel, unsigned long ulPhase)
/* Select The Timer counter detect phase. This function is to select The Timer counter detect phase. */ void xTimerCounterDetectPhaseSelect(unsigned long ulBase, unsigned long ulChannel, unsigned long ulPhase)
{ (void) ulChannel; xASSERT( (ulBase == xTIMER0_BASE) || (ulBase == xTIMER1_BASE) || (ulBase == xTIMER2_BASE) || (ulBase == xTIMER3_BASE) ); xASSERT( (ulChannel == xTIMER0_BASE) || (ulChannel == xTIMER1_BASE) ); xASSERT( (ulPhase == xTIMER_COUNTER_RISING) || (ulPhase == xTIMER_COUNTER_FALLING) ); if(ulPhase == xTIMER_COUNTER_FALLING) { xHWREG(ulBase + TIMER_CTCR) = 0x10; } else { xHWREG(ulBase + TIMER_CTCR) = 0x01; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reads a block of 4-byte words from the CIM control region. */
int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, unsigned int n, unsigned int *valp)
/* Reads a block of 4-byte words from the CIM control region. */ int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, unsigned int n, unsigned int *valp)
{ int ret = 0; if (t3_read_reg(adap, A_CIM_HOST_ACC_CTRL) & F_HOSTBUSY) return -EBUSY; for ( ; !ret && n--; addr += 4) { t3_write_reg(adap, A_CIM_HOST_ACC_CTRL, CIM_CTL_BASE + addr); ret = t3_wait_op_done(adap, A_CIM_HOST_ACC_CTRL, F_HOSTBUSY, 0, 5, 2); if (!ret) *valp++ = t3_read_reg(adap, A_CIM_HOST_ACC_DATA); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal Function. Allocate n pages from free page list below MaxAddress. */
UINTN InternalAllocMaxAddress(IN OUT LIST_ENTRY *FreePageList, IN UINTN NumberOfPages, IN UINTN MaxAddress)
/* Internal Function. Allocate n pages from free page list below MaxAddress. */ UINTN InternalAllocMaxAddress(IN OUT LIST_ENTRY *FreePageList, IN UINTN NumberOfPages, IN UINTN MaxAddress)
{ LIST_ENTRY *Node; FREE_PAGE_LIST *Pages; for (Node = FreePageList->BackLink; Node != FreePageList; Node = Node->BackLink) { Pages = BASE_CR (Node, FREE_PAGE_LIST, Link); if ((Pages->NumberOfPages >= NumberOfPages) && ((UINTN)Pages + EFI_PAGES_TO_SIZE (NumberOfPages) - 1 <= MaxAddress)) { return InternalAllocPagesOnOneNode (Pages, NumberOfPages, MaxAddress); } } return (UINTN)(-1); }
tianocore/edk2
C++
Other
4,240
/* Due to usage of multiple display related APIs resolution data is located in more than one place. This function updates them all. */
static void set_resolution_params(int x, int y)
/* Due to usage of multiple display related APIs resolution data is located in more than one place. This function updates them all. */ static void set_resolution_params(int x, int y)
{ panel_cfg.lcd_size = PANEL_LCD_SIZE(x, y); panel_info.vl_col = x; panel_info.vl_row = y; lcd_line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function returns if the forced battery check initiated by a call to the */
uint32_t HibernateBatCheckDone(void)
/* This function returns if the forced battery check initiated by a call to the */ uint32_t HibernateBatCheckDone(void)
{ return(HWREG(HIB_CTL) & HIB_CTL_BATCHK); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The Tx ring has been full longer than the watchdog timeout value. The transmitter must be hung? */
static void au1k_tx_timeout(struct net_device *)
/* The Tx ring has been full longer than the watchdog timeout value. The transmitter must be hung? */ static void au1k_tx_timeout(struct net_device *)
{ u32 speed; struct au1k_private *aup = netdev_priv(dev); printk(KERN_ERR "%s: tx timeout\n", dev->name); speed = aup->speed; aup->speed = 0; au1k_irda_set_speed(dev, speed); aup->tx_full = 0; netif_wake_queue(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculates a clock divider ( ISO7816 clock calculation: */
static int usart_set_iso7816_clock(volatile avr32_usart_t *usart, unsigned int clock, unsigned long pba_hz)
/* Calculates a clock divider ( ISO7816 clock calculation: */ static int usart_set_iso7816_clock(volatile avr32_usart_t *usart, unsigned int clock, unsigned long pba_hz)
{ unsigned int cd = (pba_hz + clock / 2) / clock; if (cd < 1 || cd > (1 << AVR32_USART_BRGR_CD_SIZE) - 1) return USART_INVALID_INPUT; usart->mr = (usart->mr & ~(AVR32_USART_MR_USCLKS_MASK | AVR32_USART_MR_SYNC_MASK | AVR32_USART_MR_OVER_MASK)) | AVR32_USART_MR_USCLKS_MCK << AVR32_USART_MR_USCLKS_OFFSET | AVR32_USART_MR_OVER_X16 << AVR32_USART_MR_OVER_OFFSET; usart->brgr = cd << AVR32_USART_BRGR_CD_OFFSET; return USART_SUCCESS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_usart_mode(mss_uart_instance_t *this_uart, mss_uart_usart_mode_t mode)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_set_usart_mode(mss_uart_instance_t *this_uart, mss_uart_usart_mode_t mode)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); ASSERT(MSS_UART_INVALID_SYNC_MODE > mode); if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) && (MSS_UART_INVALID_SYNC_MODE > mode)) { this_uart->hw_reg->MM0 &= ~SYNC_ASYNC_MODE_MASK; this_uart->hw_reg->MM0 |= (uint8_t)mode; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these functions. */
unsigned int kfifo_out(struct kfifo *fifo, void *to, unsigned int len)
/* Note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these functions. */ unsigned int kfifo_out(struct kfifo *fifo, void *to, unsigned int len)
{ len = min(kfifo_len(fifo), len); __kfifo_out_data(fifo, to, len, 0); __kfifo_add_out(fifo, len); return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* AmlCodeGenNameString ("_HID", "HID0000", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_HID, "HID0000") */
EFI_STATUS EFIAPI AmlCodeGenNameString(IN CONST CHAR8 *NameString, IN CHAR8 *String, IN AML_NODE_HEADER *ParentNode OPTIONAL, OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL)
/* AmlCodeGenNameString ("_HID", "HID0000", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(_HID, "HID0000") */ EFI_STATUS EFIAPI AmlCodeGenNameString(IN CONST CHAR8 *NameString, IN CHAR8 *String, IN AML_NODE_HEADER *ParentNode OPTIONAL, OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL)
{ EFI_STATUS Status; AML_OBJECT_NODE *ObjectNode; if ((NameString == NULL) || (String == NULL) || ((ParentNode == NULL) && (NewObjectNode == NULL))) { ASSERT (0); return EFI_INVALID_PARAMETER; } Status = AmlCodeGenString (String, &ObjectNode); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } Status = AmlCodeGenName ( NameString, ObjectNode, ParentNode, NewObjectNode ); if (EFI_ERROR (Status)) { ASSERT (0); AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); } return Status; }
tianocore/edk2
C++
Other
4,240
/* Various session state calls XXX Should be #define's The socket state stuff needs work, these often get call 2 or 3 times each when only 1 was needed */
void soisfconnecting(struct socket *so)
/* Various session state calls XXX Should be #define's The socket state stuff needs work, these often get call 2 or 3 times each when only 1 was needed */ void soisfconnecting(struct socket *so)
{ so->so_state &= ~(SS_NOFDREF|SS_ISFCONNECTED|SS_FCANTRCVMORE| SS_FCANTSENDMORE|SS_FWDRAIN); so->so_state |= SS_ISFCONNECTING; }
ve3wwg/teensy3_qemu
C++
Other
15
/* DeInitializes the peripherals used by the SPI FLASH driver. */
void sFLASH_LowLevel_DeInit(void)
/* DeInitializes the peripherals used by the SPI FLASH driver. */ void sFLASH_LowLevel_DeInit(void)
{ GPIO_InitTypeDef GPIO_InitStructure; SPI_Cmd(sFLASH_SPI, DISABLE); SPI_I2S_DeInit(sFLASH_SPI); RCC_APB2PeriphClockCmd(sFLASH_SPI_CLK, DISABLE); GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_SCK_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(sFLASH_SPI_SCK_GPIO_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MISO_PIN; GPIO_Init(sFLASH_SPI_MISO_GPIO_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MOSI_PIN; GPIO_Init(sFLASH_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = sFLASH_CS_PIN; GPIO_Init(sFLASH_CS_GPIO_PORT, &GPIO_InitStructure); }
avem-labs/Avem
C++
MIT License
1,752