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
/* Returns: the next available fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs */
GType g_type_fundamental_next(void)
/* Returns: the next available fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs */ GType g_type_fundamental_next(void)
{ GType type; G_READ_LOCK (&type_rw_lock); type = static_fundamental_next; G_READ_UNLOCK (&type_rw_lock); type = G_TYPE_MAKE_FUNDAMENTAL (type); return type <= G_TYPE_FUNDAMENTAL_MAX ? type : 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Same as xfs_bioerror, except that we are releasing the buffer here ourselves, and avoiding the biodone call. This is meant for userdata errors; metadata bufs come with iodone functions attached, so that we can track down errors. */
int xfs_bioerror_relse(xfs_buf_t *bp)
/* Same as xfs_bioerror, except that we are releasing the buffer here ourselves, and avoiding the biodone call. This is meant for userdata errors; metadata bufs come with iodone functions attached, so that we can track down errors. */ int xfs_bioerror_relse(xfs_buf_t *bp)
{ int64_t fl; ASSERT(XFS_BUF_IODONE_FUNC(bp) != xfs_buf_iodone_callbacks); ASSERT(XFS_BUF_IODONE_FUNC(bp) != xlog_iodone); fl = XFS_BUF_BFLAGS(bp); XFS_BUF_UNREAD(bp); XFS_BUF_UNDELAYWRITE(bp); XFS_BUF_DONE(bp); XFS_BUF_STALE(bp); XFS_BUF_CLR_IODONE_FUNC(bp); XFS_BUF_CLR_BDSTRAT_FUNC(bp); if (!(fl & XFS_B_AS...
robutest/uclinux
C++
GPL-2.0
60
/* Create the MPU context for a new process. This is called from init_new_context. */
int mpu_init_new_context(struct task_struct *tsk, struct mm_struct *mm)
/* Create the MPU context for a new process. This is called from init_new_context. */ int mpu_init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{ mpu_context_init(mm); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the specified ADC DMA request. */
void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the specified ADC DMA request. */ void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CFGR1 |= (uint32_t)ADC_CFGR1_DMAEN; } else { ADCx->CFGR1 &= (uint32_t)(~ADC_CFGR1_DMAEN); } }
ajhc/demo-cortex-m3
C++
null
38
/* Manually detach device from driver. When called for a USB interface, @dev->parent->sem must be held. */
void device_release_driver(struct device *dev)
/* Manually detach device from driver. When called for a USB interface, @dev->parent->sem must be held. */ void device_release_driver(struct device *dev)
{ down(&dev->sem); __device_release_driver(dev); up(&dev->sem); }
robutest/uclinux
C++
GPL-2.0
60
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */
void rt_hw_trap_pabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */ void rt_hw_trap_pabt(struct rt_hw_register *regs)
{ rt_kprintf("prefetch abort\n"); rt_hw_show_register(regs); if (rt_thread_self() != RT_NULL) rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* A check for whether or not the parent directory has changed. In the case it has, we assume that the dentries are untrustworthy and may need to be looked up again. */
static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
/* A check for whether or not the parent directory has changed. In the case it has, we assume that the dentries are untrustworthy and may need to be looked up again. */ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
{ if (IS_ROOT(dentry)) return 1; if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONE) return 0; if (!nfs_verify_change_attribute(dir, dentry->d_time)) return 0; if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0) return 0; if (!nfs_verify_change_attribute(dir, dentry->d_time)) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Create an RGB surface from an existing memory buffer */
SDL_Surface* SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
/* Create an RGB surface from an existing memory buffer */ SDL_Surface* SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{ SDL_Surface *surface; surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, depth, Rmask, Gmask, Bmask, Amask); if ( surface != NULL ) { surface->flags |= SDL_PREALLOC; surface->pixels = pixels; surface->w = width; surface->h = height; surface->pitch = pitch; SDL_SetClipRe...
DC-SWAT/DreamShell
C++
null
404
/* Timer Set Period. Specify the timer period in the auto-reload register. */
void timer_set_period(uint32_t timer_peripheral, uint32_t period)
/* Timer Set Period. Specify the timer period in the auto-reload register. */ void timer_set_period(uint32_t timer_peripheral, uint32_t period)
{ TIM_ARR(timer_peripheral) = period; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Write a value to the specified pin(s). Write the corresponding bit values to the output pin(s) specified by */
void xGPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned long ucVal)
/* Write a value to the specified pin(s). Write the corresponding bit values to the output pin(s) specified by */ void xGPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned long ucVal)
{ xASSERT(GPIOBaseValid(ulPort)); xHWREG(ulPort + GPIO_DOUT) = ((ucVal & 1) ? (xHWREG(ulPort + GPIO_DOUT) | ulPins) : (xHWREG(ulPort + GPIO_DOUT) & ~(ulPins))); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* There are circumstances in which we can try to wake a task which has already started to run but is not in state TASK_RUNNING. try_to_wake_up() returns zero in this (rare) case, and we handle it by continuing to scan the queue. */
static void __wake_up_common(wait_queue_head_t *q, unsigned int mode, int nr_exclusive, int wake_flags, void *key)
/* There are circumstances in which we can try to wake a task which has already started to run but is not in state TASK_RUNNING. try_to_wake_up() returns zero in this (rare) case, and we handle it by continuing to scan the queue. */ static void __wake_up_common(wait_queue_head_t *q, unsigned int mode, int nr_exclusive...
{ wait_queue_t *curr, *next; list_for_each_entry_safe(curr, next, &q->task_list, task_list) { unsigned flags = curr->flags; if (curr->func(curr, mode, wake_flags, key) && (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive) break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads the result of a CRC operation in the EC module. */
uint32_t CRCResultRead(uint32_t ui32Base)
/* Reads the result of a CRC operation in the EC module. */ uint32_t CRCResultRead(uint32_t ui32Base)
{ ASSERT(ui32Base == DTHE_BASE); return(HWREG(DTHE_BASE + DTHE_O_CRC_RSLT_PP)); }
micropython/micropython
C++
Other
18,334
/* Get the element's address when read receive buffer. */
static uint32_t MCAN_GetRxBufferElementAddress(CAN_Type *base, uint8_t idx)
/* Get the element's address when read receive buffer. */ static uint32_t MCAN_GetRxBufferElementAddress(CAN_Type *base, uint8_t idx)
{ assert(idx <= 63U); uint32_t eSize; eSize = (base->RXESC & CAN_RXESC_RBDS_MASK) >> CAN_RXESC_RBDS_SHIFT; if (eSize < 5U) { eSize += 4U; } else { eSize = eSize * 4U - 10U; } return (base->RXBC & CAN_RXBC_RBSA_MASK) + idx * eSize * 4U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the number of deallocation, or 0 if not found */
int xmlListRemoveAll(xmlListPtr l, void *data)
/* Returns the number of deallocation, or 0 if not found */ int xmlListRemoveAll(xmlListPtr l, void *data)
{ int count=0; if (l == NULL) return(0); while(xmlListRemoveFirst(l, data)) count++; return count; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called from a server thread as it's exiting. Caller must hold the BKL or the "service mutex", whichever is appropriate for the service. */
void svc_exit_thread(struct svc_rqst *rqstp)
/* Called from a server thread as it's exiting. Caller must hold the BKL or the "service mutex", whichever is appropriate for the service. */ void svc_exit_thread(struct svc_rqst *rqstp)
{ struct svc_serv *serv = rqstp->rq_server; struct svc_pool *pool = rqstp->rq_pool; svc_release_buffer(rqstp); kfree(rqstp->rq_resp); kfree(rqstp->rq_argp); kfree(rqstp->rq_auth_data); spin_lock_bh(&pool->sp_lock); pool->sp_nrthreads--; list_del(&rqstp->rq_all); spin_unlock_bh(&pool->sp_lock); kfree(rqstp); ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* enable or disable UART break contol function . */
void USI_UARTBreakCtl(USI_TypeDef *USIx, u32 NewState)
/* enable or disable UART break contol function . */ void USI_UARTBreakCtl(USI_TypeDef *USIx, u32 NewState)
{ u32 RegValue; assert_param(IS_ALL_USI_PERIPH(USIx)); RegValue = USIx->UART_CTRL; if(NewState == ENABLE) RegValue |= USI_UART_BREAK_CTRL; else RegValue &= (~ USI_UART_BREAK_CTRL); USIx->UART_CTRL = RegValue; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Configures a Timer to emulate an encoder sensor outputs in Forward direction. */
static void Emulate_Forward_Direction(TIM_HandleTypeDef *htim)
/* Configures a Timer to emulate an encoder sensor outputs in Forward direction. */ static void Emulate_Forward_Direction(TIM_HandleTypeDef *htim)
{ sConfig.Pulse = (EMU_PERIOD * 1 )/4; if(HAL_TIM_OC_ConfigChannel(htim, &sConfig, TIM_CHANNEL_1) != HAL_OK) { Error_Handler(); } sConfig.Pulse = (EMU_PERIOD * 3 )/4; if(HAL_TIM_OC_ConfigChannel(htim, &sConfig, TIM_CHANNEL_2) != HAL_OK) { Error_Handler(); } if(HAL_TIM_OC_Start(htim, TIM_CH...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Checks whether the Tamper Pin Event flag is set or not. */
FlagStatus BKP_GetTEFlag(void)
/* Checks whether the Tamper Pin Event flag is set or not. */ FlagStatus BKP_GetTEFlag(void)
{ return (FlagStatus)(*(__IO uint32_t*)CTRLSTS_TEF_BB); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Selects the specified ETHERNET DMA Tx Desc Checksum Insertion. */
void ETH_ConfigDmaTxDescChecksumInsertion(ETH_DMADescType *DMATxDesc, uint32_t DMATxDesc_Checksum)
/* Selects the specified ETHERNET DMA Tx Desc Checksum Insertion. */ void ETH_ConfigDmaTxDescChecksumInsertion(ETH_DMADescType *DMATxDesc, uint32_t DMATxDesc_Checksum)
{ assert_param(IS_ETH_DMA_TX_DESC_CHECKSUM(DMATxDesc_Checksum)); DMATxDesc->CtrlOrBufSize |= DMATxDesc_Checksum; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Config the SPI peripheral according to the specified parameters in the adcConfig. */
void SPI_Config(SPI_T *spi, SPI_Config_T *spiConfig)
/* Config the SPI peripheral according to the specified parameters in the adcConfig. */ void SPI_Config(SPI_T *spi, SPI_Config_T *spiConfig)
{ spi->CTRL1_B.MSMCFG = spiConfig->mode; spi->CTRL2_B.DSCFG = spiConfig->length; spi->CTRL1_B.CPHA = spiConfig->phase; spi->CTRL1_B.CPOL = spiConfig->polarity; spi->CTRL1_B.SSEN = spiConfig->slaveSelect; spi->CTRL1_B.LSBSEL = spiConfig->firstBit; spi->CTRL1 &=(uint16_t)~0xC400; spi->...
pikasTech/PikaPython
C++
MIT License
1,403
/* Set the slave select pins of the specified SPI port. The */
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
/* Set the slave select pins of the specified SPI port. The */ void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
{ xASSERT(ulBase == SPI0_BASE); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0)); xHWREG(ulBase + SPI_SSR) &= ~SPI_AUTOSS; xHWREG(ulBase + SPI_SSR) |= ulSSMode; xHWREG(ulBase + SPI_SSR) &= ~0x00000001; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function handles DMA2 Stream 6 interrupt request. */
void DMA2_Stream6_IRQHandler(void)
/* This function handles DMA2 Stream 6 interrupt request. */ void DMA2_Stream6_IRQHandler(void)
{ HAL_DMA_IRQHandler(hcryp.hdmain); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* set_rx_timeout - Set rx timeout and threshold values. @port: port to use @timeout: timeout value in ticks */
static int set_rx_timeout(struct ioc3_port *port, int timeout)
/* set_rx_timeout - Set rx timeout and threshold values. @port: port to use @timeout: timeout value in ticks */ static int set_rx_timeout(struct ioc3_port *port, int timeout)
{ int threshold; port->ip_rx_timeout = timeout; threshold = timeout * port->ip_baud / 4000; if (threshold == 0) threshold = 1; if ((unsigned)threshold > (unsigned)SSCR_RX_THRESHOLD) return 1; port->ip_sscr &= ~SSCR_RX_THRESHOLD; port->ip_sscr |= threshold; writel(port->ip_sscr, &port->ip_serial_regs->sscr);...
robutest/uclinux
C++
GPL-2.0
60
/* This function retrieves the processor's current interrupt state a returns it in State. If interrupts are currently enabled, then TRUE is returned. If interrupts are currently disabled, then FALSE is returned. */
EFI_STATUS EFIAPI CpuGetInterruptState(IN EFI_CPU_ARCH_PROTOCOL *This, OUT BOOLEAN *State)
/* This function retrieves the processor's current interrupt state a returns it in State. If interrupts are currently enabled, then TRUE is returned. If interrupts are currently disabled, then FALSE is returned. */ EFI_STATUS EFIAPI CpuGetInterruptState(IN EFI_CPU_ARCH_PROTOCOL *This, OUT BOOLEAN *State)
{ if (State == NULL) { return EFI_INVALID_PARAMETER; } *State = ArmGetInterruptState (); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Helper functions dumps any remaining data into the data dissector. */
static void zcl_dump_data(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree)
/* Helper functions dumps any remaining data into the data dissector. */ static void zcl_dump_data(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree)
{ proto_tree *root = proto_tree_get_root(tree); guint length = tvb_captured_length_remaining(tvb, offset); tvbuff_t *remainder; if (length > 0) { remainder = tvb_new_subset_remaining(tvb, offset); call_data_dissector(remainder, pinfo, root); } return; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read whether the specified DMA Channel interrupts is set or not. */
uint8_t DMA_ReadIntFlag(DMA_INT_FLAG_T flag)
/* Read whether the specified DMA Channel interrupts is set or not. */ uint8_t DMA_ReadIntFlag(DMA_INT_FLAG_T flag)
{ if((flag & 0x10000000) != RESET ) { if((DMA2->INTSTS & flag ) != RESET ) { return SET ; } else { return RESET ; } } else { if((DMA1->INTSTS & flag ) != RESET ) { return SET ; } else { ...
pikasTech/PikaPython
C++
MIT License
1,403
/* This function gets GCD Mem Space type from MTRR Type. */
UINT64 GetMemorySpaceAttributeFromMtrrType(IN MTRR_MEMORY_CACHE_TYPE Type)
/* This function gets GCD Mem Space type from MTRR Type. */ UINT64 GetMemorySpaceAttributeFromMtrrType(IN MTRR_MEMORY_CACHE_TYPE Type)
{ switch (Type) { case CacheUncacheable: return EFI_MEMORY_UC; case CacheWriteCombining: return EFI_MEMORY_WC; case CacheWriteThrough: return EFI_MEMORY_WT; case CacheWriteProtected: return EFI_MEMORY_WP; case CacheWriteBack: return EFI_MEMORY_WB; default: r...
tianocore/edk2
C++
Other
4,240
/* Process address lists from the HELLO msg in the information bases */
static void process_temp_tables(void)
/* Process address lists from the HELLO msg in the information bases */ static void process_temp_tables(void)
{ nib_entry_t *nib_elt; timex_t now; vtimer_now(&now); iib_update_lt_status(&now); nib_elt = nib_process_hello(); if (nib_elt) { originator_link_tuple = iib_process_hello(if_pid, nib_elt, val_time, sym, lost); if (originator_link_tuple) { iib_process_metric_msg(origin...
labapart/polymcu
C++
null
201
/* initialize and configures all required resources for audio play function */
static uint8_t init(uint32_t audio_freq, uint32_t volume, uint32_t options)
/* initialize and configures all required resources for audio play function */ static uint8_t init(uint32_t audio_freq, uint32_t volume, uint32_t options)
{ static uint32_t initialized = 0U; if (0U == initialized) { if (0U != eval_audio_init(OUTPUT_DEVICE_AUTO, (uint8_t)volume, audio_freq)) { audio_state = AUDIO_STATE_ERROR; return AUDIO_FAIL; } initialized = 1U; } audio_state = AUDIO_STATE_ACTIVE; retur...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fill a picture in LED matrix from FLASH. */
void DotMatrixShowPic(unsigned char ucIndex)
/* Fill a picture in LED matrix from FLASH. */ void DotMatrixShowPic(unsigned char ucIndex)
{ unsigned char Page_Write,i,j; if(g_ucPageIndex == 0) Page_Write = 1; if(g_ucPageIndex == 1) Page_Write = 0; for (i = 0; i<8; i++) { for(j = 0; j < 8; j++) { dots[Page_Write][i][j][0] = pgm_read_byte(&(pic[ucIndex][i][j][2])); dots[Page_Write]...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Interrupt handler for USART. Echo the bytes received and start the next receive. */
void USART0_Handler(void)
/* Interrupt handler for USART. Echo the bytes received and start the next receive. */ void USART0_Handler(void)
{ usart_lin_handler(LIN_SLAVE_NODE_NUM); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function prepares to return from the post-single-step breakpoint trap. */
static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb)
/* This function prepares to return from the post-single-step breakpoint trap. */ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb)
{ u32 insn = p->ainsn.insn[0]; regs->tnpc = relbranch_fixup(insn, p, regs); regs->tpc = kcb->kprobe_orig_tnpc; retpc_fixup(regs, insn, (unsigned long) p->addr); regs->tstate = ((regs->tstate & ~TSTATE_PIL) | kcb->kprobe_orig_tstate_pil); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the discontinuous mode for the selected ADC regular group channel. */
void ADC_DiscModeChannelCountConfig(ADC_TypeDef *ADCx, uint8_t Number)
/* Configures the discontinuous mode for the selected ADC regular group channel. */ void ADC_DiscModeChannelCountConfig(ADC_TypeDef *ADCx, uint8_t Number)
{ uint32_t tmpreg1 = 0; uint32_t tmpreg2 = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_REGULAR_DISC_NUMBER(Number)); tmpreg1 = ADCx->CR1; tmpreg1 &= CR1_DISCNUM_RESET; tmpreg2 = Number - 1; tmpreg1 |= tmpreg2 << 13; ADCx->CR1 = tmpreg1; }
avem-labs/Avem
C++
MIT License
1,752
/* Receive a piece of data in non-blocking way. */
static void FLEXIO_I2S_ReadNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size)
/* Receive a piece of data in non-blocking way. */ static void FLEXIO_I2S_ReadNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size)
{ uint32_t i = 0; uint8_t j = 0; uint8_t bytesPerWord = bitWidth / 8U; uint32_t data = 0; for (i = 0; i < size / bytesPerWord; i++) { data = (base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex]); for (j = 0; j < bytesPerWord; j++) { ...
eclipse-threadx/getting-started
C++
Other
310
/* if(ch <= 3) { //32bit } else { //16bit } } */
uint32_t ra_gpt_timer_get_period(uint32_t ch)
/* if(ch <= 3) { //32bit } else { //16bit } } */ uint32_t ra_gpt_timer_get_period(uint32_t ch)
{ return 0ul; } else { return gpt_reg->GTPR + 1; } }
micropython/micropython
C++
Other
18,334
/* This API gives data to the given register and the data is written in the corresponding register address. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_write_reg(u8 adr_u8, u8 *data_u8, u8 len_u8)
/* This API gives data to the given register and the data is written in the corresponding register address. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_write_reg(u8 adr_u8, u8 *data_u8, u8 len_u8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_WRITE_FUNC (p_bma2x2->dev_addr, adr_u8, data_u8, len_u8); if (p_bma2x2->power_mode_u8 != BMA2x2_MODE_NORMAL...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read lptimer Counter. Read back the value of lptimer counter. */
uint16_t lptimer_get_counter(uint32_t lptimer_peripheral)
/* Read lptimer Counter. Read back the value of lptimer counter. */ uint16_t lptimer_get_counter(uint32_t lptimer_peripheral)
{ return LPTIM_CNT(lptimer_peripheral); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Retrieve the information of whether the Link Pointer field is valid or not. */
BOOLEAN GetTDLinkPtrValidorInvalid(IN TD_STRUCT *PtrTDStruct)
/* Retrieve the information of whether the Link Pointer field is valid or not. */ BOOLEAN GetTDLinkPtrValidorInvalid(IN TD_STRUCT *PtrTDStruct)
{ if ((PtrTDStruct->TDData.TDLinkPtrTerminate & BIT0) != 0) { return FALSE; } else { return TRUE; } }
tianocore/edk2
C++
Other
4,240
/* This lets us keep regulatory code which is updated on a regulatory basis in userspace. */
static int call_crda(const char *alpha2)
/* This lets us keep regulatory code which is updated on a regulatory basis in userspace. */ static int call_crda(const char *alpha2)
{ char country_env[9 + 2] = "COUNTRY="; char *envp[] = { country_env, NULL }; if (!is_world_regdom((char *) alpha2)) printk(KERN_INFO "cfg80211: Calling CRDA for country: %c%c\n", alpha2[0], alpha2[1]); else printk(KERN_INFO "cfg80211: Calling CRDA to update world " "regulatory domain\n"); country_e...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Init the ADC of the motor shield for current get. */
void AMSMotorADCInit(void)
/* Init the ADC of the motor shield for current get. */ void AMSMotorADCInit(void)
{ unsigned long ulBufferIn[2] = {10,11}; xSysCtlPeripheralClockSourceSet(xSYSCTL_ADC0_MAIN, 3); xSysCtlPeripheralEnable2(sADC_BASE); sA0PinTypeADC(); sA1PinTypeADC(); xADCEnable(sADC_BASE); ADCRegularConfigure(sADC_BASE, ADC_OP_SCAN, ADC_TRIGGER_PROCESSOR); ADCRegularConfigure(sADC_BASE, AD...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* ENET Tx and Rx function enable (include MAC and DMA module) */
void enet_enable(void)
/* ENET Tx and Rx function enable (include MAC and DMA module) */ void enet_enable(void)
{ enet_tx_enable(); enet_rx_enable(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: a #gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced. */
gssize g_output_stream_splice_finish(GOutputStream *stream, GAsyncResult *result, GError **error)
/* Returns: a #gssize of the number of bytes spliced. Note that if the number of bytes spliced is greater than G_MAXSSIZE, then that will be returned, and there is no way to determine the actual number of bytes spliced. */ gssize g_output_stream_splice_finish(GOutputStream *stream, GAsyncResult *result, GError **error...
{ g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), FALSE); g_return_val_if_fail (g_task_is_valid (result, stream), FALSE); g_return_val_if_fail (g_async_result_is_tagged (result, g_output_stream_splice_async), FALSE); return g_task_propagate_int (G_TASK (result), error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Creates an item for bControlSize, and a subtree for the bmControl bitmask. */
static int dissect_bmControl(proto_tree *tree, tvbuff_t *tvb, int offset, gint ett_subtree, const int **bm_items)
/* Creates an item for bControlSize, and a subtree for the bmControl bitmask. */ static int dissect_bmControl(proto_tree *tree, tvbuff_t *tvb, int offset, gint ett_subtree, const int **bm_items)
{ guint8 bm_size = 0; bm_size = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_usb_vid_bControlSize, tvb, offset, 1, ENC_LITTLE_ENDIAN); ++offset; if (bm_size > 0) { proto_tree_add_bitmask_len(tree, tvb, offset, bm_size, hf_usb_vid_bmControl, ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* List of RCs comes from the 'struct class uwb_rc_class'. */
static int uwb_rc_index_match(struct device *dev, void *data)
/* List of RCs comes from the 'struct class uwb_rc_class'. */ static int uwb_rc_index_match(struct device *dev, void *data)
{ int *index = data; struct uwb_rc *rc = dev_get_drvdata(dev); if (rc->index == *index) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* RETURN: MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. */
void mv_xor_hal_init(u32 chan_num)
/* RETURN: MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. */ void mv_xor_hal_init(u32 chan_num)
{ u32 i; for (i = 0; i < chan_num; i++) { mv_xor_cmd_set(i, MV_STOP); mv_xor_ctrl_set(i, (1 << XEXCR_REG_ACC_PROTECT_OFFS) | (4 << XEXCR_DST_BURST_LIMIT_OFFS) | (4 << XEXCR_SRC_BURST_LIMIT_OFFS)); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressWrite32(IN UINTN Address, IN UINT32 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciExpressWrite32(IN UINTN Address, IN UINT32 Value)
{ ASSERT_INVALID_PCI_ADDRESS (Address); return MmioWrite32 ((UINTN)GetPciExpressBaseAddress () + Address, Value); }
tianocore/edk2
C++
Other
4,240
/* Free up the resources used by a ppp channel. */
static void ppp_destroy_channel(struct channel *pch)
/* Free up the resources used by a ppp channel. */ static void ppp_destroy_channel(struct channel *pch)
{ atomic_dec(&channel_count); if (!pch->file.dead) { printk(KERN_ERR "ppp: destroying undead channel %p !\n", pch); return; } skb_queue_purge(&pch->file.xq); skb_queue_purge(&pch->file.rq); kfree(pch); }
robutest/uclinux
C++
GPL-2.0
60
/* Input: buf: C string containing an unsigned integer value representing the number of NFSD threads to start size: non-zero length of C string in @buf Output: On success: NFS service is started; passed-in buffer filled with ' */
static ssize_t write_threads(struct file *file, char *buf, size_t size)
/* Input: buf: C string containing an unsigned integer value representing the number of NFSD threads to start size: non-zero length of C string in @buf Output: On success: NFS service is started; passed-in buffer filled with ' */ static ssize_t write_threads(struct file *file, char *buf, size_t size)
{ char *mesg = buf; int rv; if (size > 0) { int newthreads; rv = get_int(&mesg, &newthreads); if (rv) return rv; if (newthreads < 0) return -EINVAL; rv = nfsd_svc(NFS_PORT, newthreads); if (rv < 0) return rv; } else rv = nfsd_nrthreads(); return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n...
robutest/uclinux
C++
GPL-2.0
60
/* Determines whether the given Remote to Local IPC flags are busy or not. */
Uint16 IPCRtoLFlagBusy(uint32_t ulFlags)
/* Determines whether the given Remote to Local IPC flags are busy or not. */ Uint16 IPCRtoLFlagBusy(uint32_t ulFlags)
{ Uint16 returnStatus; if ((IpcRegs.IPCSTS.all & ulFlags) == 0) { returnStatus = 0; } else { returnStatus = 1; } return returnStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set an environment variable to an value in hex */
int env_set_hex(const char *varname, ulong value)
/* Set an environment variable to an value in hex */ int env_set_hex(const char *varname, ulong value)
{ char str[17]; sprintf(str, "%lx", value); return env_set(varname, str); }
4ms/stm32mp1-baremetal
C++
Other
137
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_ENABLE(); } else if(htim_base->Instance==TIM5) { __HAL_RCC_TIM5_CLK_ENABLE(); } else if(htim_base->Instance==TIM8) { __HAL_RCC_TIM8_CLK_ENABLE(); } else if(h...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* deliver reply data to an FS.CreateFile or an FS.MakeDir */
static int afs_deliver_fs_create_vnode(struct afs_call *call, struct sk_buff *skb, bool last)
/* deliver reply data to an FS.CreateFile or an FS.MakeDir */ static int afs_deliver_fs_create_vnode(struct afs_call *call, struct sk_buff *skb, bool last)
{ struct afs_vnode *vnode = call->reply; const __be32 *bp; _enter("{%u},{%u},%d", call->unmarshall, skb->len, last); afs_transfer_reply(call, skb); if (!last) return 0; if (call->reply_size != call->reply_max) return -EBADMSG; bp = call->buffer; xdr_decode_AFSFid(&bp, call->reply2); xdr_decode_AFSFetchStat...
robutest/uclinux
C++
GPL-2.0
60
/* Convert some rows of samples to the JPEG colorspace. This version handles grayscale output with no conversion. The source can be either plain grayscale or YCbCr (since Y == gray). */
grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
/* Convert some rows of samples to the JPEG colorspace. This version handles grayscale output with no conversion. The source can be either plain grayscale or YCbCr (since Y == gray). */ grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
{ register JSAMPROW inptr; register JSAMPROW outptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->image_width; int instride = cinfo->input_components; while (--num_rows >= 0) { inptr = *input_buf++; outptr = output_buf[0][output_row]; output_row++; for (c...
nanoframework/nf-interpreter
C++
MIT License
293
/* Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */
void ioread8_rep(void __iomem *port, void *dst, unsigned long count)
/* Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ void ioread8_rep(void __iomem *port, void *dst, unsigned long count)
{ while ((unsigned long)dst & 0x3) { if (!count) return; count--; *(unsigned char *)dst = ioread8(port); dst += 1; } while (count >= 4) { unsigned int w; count -= 4; w = ioread8(port); w |= ioread8(port) << 8; w |= ioread8(port) << 16; w |= ioread8(port) << 24; *(unsigned int *)dst = w; ds...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the RTC module time values in standard format */
void XMC_RTC_GetTimeStdFormat(struct tm *const stdtime)
/* Gets the RTC module time values in standard format */ void XMC_RTC_GetTimeStdFormat(struct tm *const stdtime)
{ XMC_RTC_TIME_t time; time.raw0 = RTC->TIM0; time.raw1 = RTC->TIM1; stdtime->tm_sec = (int8_t)time.seconds; stdtime->tm_min = (int8_t)time.minutes; stdtime->tm_hour = (int8_t)time.hours; stdtime->tm_mday = ((int8_t)time.days + (int8_t)1); stdtime->tm_mon = (int8_t)time.month; stdtime->tm_year = (int3...
feaser/openblt
C++
GNU General Public License v3.0
601
/* USBH_IsocSendData Sends the data on Isochronous OUT Endpoint. */
USBH_StatusTypeDef USBH_IsocSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint32_t length, uint8_t pipe_num)
/* USBH_IsocSendData Sends the data on Isochronous OUT Endpoint. */ USBH_StatusTypeDef USBH_IsocSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint32_t length, uint8_t pipe_num)
{ (void)USBH_LL_SubmitURB(phost, pipe_num, 0U, USBH_EP_ISO, USBH_PID_DATA, buff, (uint16_t)length, 0U); return USBH_OK; }
ua1arn/hftrx
C++
null
69
/* Register the Service D and all its Characteristics... */
void service_d_2_init(void)
/* Register the Service D and all its Characteristics... */ void service_d_2_init(void)
{ bt_gatt_service_register(&service_d_2_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The function is used to Get BOD state. */
xtBoolean SysCtlBODStateGet(void)
/* The function is used to Get BOD state. */ xtBoolean SysCtlBODStateGet(void)
{ return (xHWREG(GCR_BODCR) & GCR_BODCR_BOD_OUT)>>6; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Add a key (string) to the given list */
void airpcap_add_key_to_list(GtkListStore *key_list_store, gchar *type, gchar *key, gchar *ssid)
/* Add a key (string) to the given list */ void airpcap_add_key_to_list(GtkListStore *key_list_store, gchar *type, gchar *key, gchar *ssid)
{ GtkTreeIter iter; gtk_list_store_insert_with_values(key_list_store , &iter, G_MAXINT, KL_COL_TYPE, type, KL_COL_KEY, key, KL_COL_SSID, ssid, -1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Because the lscsa and code may cross segment boundaires, we check to see if mappings are required for the start and end of each range. We currently assume that the mappings are smaller that one segment - if not, something is seriously wrong. */
void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa, void *code, int code_size)
/* Because the lscsa and code may cross segment boundaires, we check to see if mappings are required for the start and end of each range. We currently assume that the mappings are smaller that one segment - if not, something is seriously wrong. */ void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa, vo...
{ struct spu_slb slbs[4]; int i, nr_slbs = 0; void *addrs[] = { lscsa, (void *)lscsa + sizeof(*lscsa) - 1, code, code + code_size - 1 }; for (i = 0; i < ARRAY_SIZE(addrs); i++) { if (__slb_present(slbs, nr_slbs, addrs[i])) continue; __spu_kernel_slb(addrs[i], &slbs[nr_slbs]); nr_slbs++; } spin_lock_...
EmcraftSystems/linux-emcraft
C++
Other
266
/* set or clear the timeout for a key */
long keyctl_set_timeout(key_serial_t id, unsigned timeout)
/* set or clear the timeout for a key */ long keyctl_set_timeout(key_serial_t id, unsigned timeout)
{ struct timespec now; struct key *key; key_ref_t key_ref; time_t expiry; long ret; key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL, KEY_SETATTR); if (IS_ERR(key_ref)) { ret = PTR_ERR(key_ref); goto error; } key = key_ref_to_ptr(key_ref); down_write(&key->sem); expiry = 0; if ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the clock rate of the specified I2C port. The */
void I2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk)
/* Set the clock rate of the specified I2C port. The */ void I2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk)
{ unsigned long ulHclk; unsigned long ulDiv; xASSERT((ulBase == I2C0_BASE)); if (ulBase == I2C0_BASE) { SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0); } xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1; ulHclk = SysCtlHClockGet(); ulDiv = (unsigned long) (((ulHclk * 10)/(ulI2CClk * 4) +...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This request sets up the specified Ethernet power management pattern filter as described in the data structure. */
EFI_STATUS EFIAPI SetUsbRndisPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, IN UINT16 Length, IN VOID *PatternFilter)
/* This request sets up the specified Ethernet power management pattern filter as described in the data structure. */ EFI_STATUS EFIAPI SetUsbRndisPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, IN UINT16 Length, IN VOID *PatternFilter)
{ EFI_USB_DEVICE_REQUEST Request; UINT32 TransStatus; USB_RNDIS_DEVICE *UsbRndisDevice; UsbRndisDevice = USB_RNDIS_DEVICE_FROM_THIS (This); Request.RequestType = USB_ETHERNET_SET_REQ_TYPE; Request.Request = SET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ; Request.Value = Val...
tianocore/edk2
C++
Other
4,240
/* Fills each TIM_TimeBaseInitStruct member with its default value. */
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
/* Fills each TIM_TimeBaseInitStruct member with its default value. */ void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
{ TIM_TimeBaseInitStruct->TIM_Period = 0xFFFF; TIM_TimeBaseInitStruct->TIM_Prescaler = 0x0000; TIM_TimeBaseInitStruct->TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseInitStruct->TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInitStruct->TIM_RepetitionCounter = 0x0000; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Extract the config image from an authenticated image. */
BOOLEAN EFIAPI ExtractConfigImage(IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **ConfigImage, OUT UINTN *ConfigImageSize)
/* Extract the config image from an authenticated image. */ BOOLEAN EFIAPI ExtractConfigImage(IN VOID *AuthenticatedImage, IN UINTN AuthenticatedImageSize, OUT VOID **ConfigImage, OUT UINTN *ConfigImageSize)
{ BOOLEAN Result; UINT32 FileHeaderSize; *ConfigImage = NULL; *ConfigImageSize = 0; Result = GetFfsByName (AuthenticatedImage, AuthenticatedImageSize, &gEdkiiSystemFmpCapsuleConfigFileGuid, EFI_FV_FILETYPE_RAW, ConfigImage, ConfigImageSize); if (!Result) { return FALSE; } if (IS_FFS_FILE2 (*C...
tianocore/edk2
C++
Other
4,240
/* This function is use to set up the handle (@ida) that you will pass to the rest of the functions. */
void ida_init(struct ida *ida)
/* This function is use to set up the handle (@ida) that you will pass to the rest of the functions. */ void ida_init(struct ida *ida)
{ memset(ida, 0, sizeof(struct ida)); idr_init(&ida->idr); }
robutest/uclinux
C++
GPL-2.0
60
/* Reverses the effect of usb_hcd_at91_probe(), first invoking the HCD's stop() method. It is always called from a thread context, "rmmod" or something similar. */
static void usb_hcd_at91_remove(struct usb_hcd *, struct platform_device *)
/* Reverses the effect of usb_hcd_at91_probe(), first invoking the HCD's stop() method. It is always called from a thread context, "rmmod" or something similar. */ static void usb_hcd_at91_remove(struct usb_hcd *, struct platform_device *)
{ usb_remove_hcd(hcd); at91_stop_hc(pdev); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) clk_put(hclk); clk_put(fclk); clk_put(iclk); fclk = iclk = hclk = NULL; dev_set_drvdata(&pdev->dev, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* DMA Channel Enable Fixed Sized Peripheral Increment after Transfer. Ensure that the stream is disabled otherwise the setting will not be changed. */
void dma_enable_fixed_peripheral_increment_mode(uint32_t dma, uint8_t stream)
/* DMA Channel Enable Fixed Sized Peripheral Increment after Transfer. Ensure that the stream is disabled otherwise the setting will not be changed. */ void dma_enable_fixed_peripheral_increment_mode(uint32_t dma, uint8_t stream)
{ DMA_SCR(dma, stream) |= (DMA_SxCR_PINC | DMA_SxCR_PINCOS); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* HRPWM negative edge adjust delay counts configuration for specified channel. */
void HRPWM_ChNegativeAdjustConfig(uint32_t u32Ch, uint8_t u8DelayNum)
/* HRPWM negative edge adjust delay counts configuration for specified channel. */ void HRPWM_ChNegativeAdjustConfig(uint32_t u32Ch, uint8_t u8DelayNum)
{ __IO uint32_t *CRx; DDL_ASSERT(IS_VALID_HRPWM_CH(u32Ch)); CRx = (__IO uint32_t *)(((uint32_t)&CM_HRPWM->CR1) + 4UL * (u32Ch - 1UL)); MODIFY_REG32(*CRx, HRPWM_CR_NSEL, ((uint32_t)u8DelayNum - 1UL) << HRPWM_CR_NSEL_POS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This service is a wrapper for the UEFI Runtime Service GetVariable(). */
EFI_STATUS EFIAPI InternalGetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data)
/* This service is a wrapper for the UEFI Runtime Service GetVariable(). */ EFI_STATUS EFIAPI InternalGetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data)
{ return mSmmVariable->SmmGetVariable ( VariableName, VendorGuid, Attributes, DataSize, Data ); }
tianocore/edk2
C++
Other
4,240
/* On success return a newly allocated copy of the channel-path description data associated with the given channel-path ID. Return NULL on error. */
void* chp_get_chp_desc(struct chp_id chpid)
/* On success return a newly allocated copy of the channel-path description data associated with the given channel-path ID. Return NULL on error. */ void* chp_get_chp_desc(struct chp_id chpid)
{ struct channel_path *chp; struct channel_path_desc *desc; chp = chpid_to_chp(chpid); if (!chp) return NULL; desc = kmalloc(sizeof(struct channel_path_desc), GFP_KERNEL); if (!desc) return NULL; memcpy(desc, &chp->desc, sizeof(struct channel_path_desc)); return desc; }
robutest/uclinux
C++
GPL-2.0
60
/* Migrate IRQ data structures (irq_desc, chip_data, etc.) over to the new "home node" of the IRQ. */
static void init_copy_kstat_irqs(struct irq_desc *old_desc, struct irq_desc *desc, int node, int nr)
/* Migrate IRQ data structures (irq_desc, chip_data, etc.) over to the new "home node" of the IRQ. */ static void init_copy_kstat_irqs(struct irq_desc *old_desc, struct irq_desc *desc, int node, int nr)
{ init_kstat_irqs(desc, node, nr); if (desc->kstat_irqs != old_desc->kstat_irqs) memcpy(desc->kstat_irqs, old_desc->kstat_irqs, nr * sizeof(*desc->kstat_irqs)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Spill all of this CPU's per-cpu pages back into the buddy allocator. */
void drain_local_pages(void *arg)
/* Spill all of this CPU's per-cpu pages back into the buddy allocator. */ void drain_local_pages(void *arg)
{ drain_pages(smp_processor_id()); }
robutest/uclinux
C++
GPL-2.0
60
/* Read TC72 temperature value and handle data in float. */
float TC72TemperReadFloat(void)
/* Read TC72 temperature value and handle data in float. */ float TC72TemperReadFloat(void)
{ float fTem; short sTempValue; sTempValue = TC72TemperRead(); fTem = (float)sTempValue * 0.25; return fTem; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* this function returns the bus and virtual addresses of the static pool */
static int sep_get_static_pool_addr_handler(struct sep_device *sep, unsigned long arg)
/* this function returns the bus and virtual addresses of the static pool */ static int sep_get_static_pool_addr_handler(struct sep_device *sep, unsigned long arg)
{ int error; struct sep_driver_static_pool_addr_t command_args; dbg("SEP Driver:--------> sep_get_static_pool_addr_handler start\n"); command_args.physical_static_address = sep->shared_bus + SEP_DRIVER_STATIC_AREA_OFFSET_IN_BYTES; command_args.virtual_static_address = (unsigned long)sep->shared_addr + SEP_DRIVER_S...
robutest/uclinux
C++
GPL-2.0
60
/* Locates and extracts the QEMU SMBIOS data if present in fw_cfg */
UINT8* GetQemuSmbiosTables(VOID)
/* Locates and extracts the QEMU SMBIOS data if present in fw_cfg */ UINT8* GetQemuSmbiosTables(VOID)
{ EFI_STATUS Status; FIRMWARE_CONFIG_ITEM Tables; UINTN TablesSize; UINT8 *QemuTables; if (!PcdGetBool (PcdQemuSmbiosValidated)) { return NULL; } Status = QemuFwCfgFindFile ( "etc/smbios/smbios-tables", &Tables, &Tables...
tianocore/edk2
C++
Other
4,240
/* In the rtc_only+DRR in self-refresh boot path we have the board type info in the rtc scratch pad register hence we bypass the costly i2c reads to eeprom and directly programthe board name string */
void rtc_only_update_board_type(u32 btype)
/* In the rtc_only+DRR in self-refresh boot path we have the board type info in the rtc scratch pad register hence we bypass the costly i2c reads to eeprom and directly programthe board name string */ void rtc_only_update_board_type(u32 btype)
{ const char *name = ""; const char *rev = "1.0"; switch (btype) { case RTC_BOARD_EPOS: name = "AM43EPOS"; break; case RTC_BOARD_EVM14: name = "AM43__GP"; rev = "1.4"; break; case RTC_BOARD_EVM12: name = "AM43__GP"; rev = "1.2"; break; case RTC_BOARD_GPEVM: name = "AM43__GP"; break; case RTC...
4ms/stm32mp1-baremetal
C++
Other
137
/* ocfs2_open_unlock unlock PR and EX mode open locks. */
void ocfs2_open_unlock(struct inode *inode)
/* ocfs2_open_unlock unlock PR and EX mode open locks. */ void ocfs2_open_unlock(struct inode *inode)
{ struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_open_lockres; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); mlog_entry_void(); mlog(0, "inode %llu drop open lock\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); if (ocfs2_mount_local(osb)) goto out; if(lockres->l_ro_holders) ocfs2_cluster_unl...
robutest/uclinux
C++
GPL-2.0
60
/* Interface function to clear the port feature for non-root hub. */
EFI_STATUS UsbHubClearPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
/* Interface function to clear the port feature for non-root hub. */ EFI_STATUS UsbHubClearPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
{ EFI_STATUS Status; Status = UsbHubCtrlClearPortFeature (HubIf->Device, Port, (UINT8)Feature); return Status; }
tianocore/edk2
C++
Other
4,240
/* set the interface value to the connected device */
usbh_status usbh_setinterface(usbh_host *uhost, uint8_t itf_num, uint8_t set)
/* set the interface value to the connected device */ usbh_status usbh_setinterface(usbh_host *uhost, uint8_t itf_num, uint8_t set)
{ usbh_status status = USBH_BUSY; usbh_control *usb_ctl = &uhost->control; if (CTL_IDLE == usb_ctl->ctl_state) { usb_ctl->setup.req = (usb_req) { .bmRequestType = USB_TRX_OUT | USB_RECPTYPE_ITF | USB_REQTYPE_STRD, .bRequest = USB_SET_INTERFACE, .wValue ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function leave the QSPI memory from deep power down mode. */
uint8_t BSP_QSPI_LeaveDeepPowerDown(void)
/* This function leave the QSPI memory from deep power down mode. */ uint8_t BSP_QSPI_LeaveDeepPowerDown(void)
{ QSPI_CommandTypeDef sCommand; sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE; sCommand.Instruction = NO_OPERATION_CMD; sCommand.AddressMode = QSPI_ADDRESS_NONE; sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE; sCommand.DataMode = QSPI_DATA_NONE; sCommand.DummyCycles ...
eclipse-threadx/getting-started
C++
Other
310
/* Performs an atomic decrement of the 32-bit unsigned integer specified by Value and returns the decremented value. The decrement operation must be performed using MP safe mechanisms. */
UINT32 EFIAPI InternalSyncDecrement(IN volatile UINT32 *Value)
/* Performs an atomic decrement of the 32-bit unsigned integer specified by Value and returns the decremented value. The decrement operation must be performed using MP safe mechanisms. */ UINT32 EFIAPI InternalSyncDecrement(IN volatile UINT32 *Value)
{ UINT32 Result; __asm__ __volatile__ ( "movl $-1, %%eax \n\t" "lock \n\t" "xadd %%eax, %1 \n\t" "dec %%eax \n\t" : "=&a" (Result), "+m" (*Value) : : "memory", "cc" ); return Result; }
tianocore/edk2
C++
Other
4,240
/* We detected a chip without a FIFO. Only two fall into this category - the original 8250 and the 16450. The 16450 has a scratch register (accessible with LCR=0) */
static void autoconfig_8250(struct uart_8250_port *up)
/* We detected a chip without a FIFO. Only two fall into this category - the original 8250 and the 16450. The 16450 has a scratch register (accessible with LCR=0) */ static void autoconfig_8250(struct uart_8250_port *up)
{ unsigned char scratch, status1, status2; up->port.type = PORT_8250; scratch = serial_in(up, UART_SCR); serial_outp(up, UART_SCR, 0xa5); status1 = serial_in(up, UART_SCR); serial_outp(up, UART_SCR, 0x5a); status2 = serial_in(up, UART_SCR); serial_outp(up, UART_SCR, scratch); if (status1 == 0xa5 && status2 == ...
robutest/uclinux
C++
GPL-2.0
60
/* Read TC Register C (RC) on the specified channel. */
uint32_t tc_read_rc(Tc *p_tc, uint32_t ul_channel)
/* Read TC Register C (RC) on the specified channel. */ uint32_t tc_read_rc(Tc *p_tc, uint32_t ul_channel)
{ Assert(p_tc); Assert(ul_channel < (sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0]))); return p_tc->TC_CHANNEL[ul_channel].TC_RC; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Set MSI/MSIX message data. This is required for msi_notify()/msix_notify() which will write at the addresses via spapr_msi_write(). */
static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix, unsigned first_irq, unsigned req_num)
/* Set MSI/MSIX message data. This is required for msi_notify()/msix_notify() which will write at the addresses via spapr_msi_write(). */ static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix, unsigned first_irq, unsigned req_num)
{ unsigned i; MSIMessage msg = { .address = addr, .data = first_irq }; if (!msix) { msi_set_message(pdev, msg); trace_spapr_pci_msi_setup(pdev->name, 0, msg.address); return; } for (i = 0; i < req_num; ++i, ++msg.data) { msix_set_message(pdev, i, msg); trace_s...
ve3wwg/teensy3_qemu
C++
Other
15
/* Backup function for HFileImage. Only a few fields need to be backup. This is for making the file buffer refresh as few as possible. */
EFI_STATUS HFileImageBackup(VOID)
/* Backup function for HFileImage. Only a few fields need to be backup. This is for making the file buffer refresh as few as possible. */ EFI_STATUS HFileImageBackup(VOID)
{ SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName); HFileImageBackupVar.FileName = CatSPrint (NULL, L"%s", HFileImage.FileName); if (HFileImageBackupVar.FileName == NULL) { return EFI_OUT_OF_RESOURCES; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Return the number of hardware sectors between beginning of bio and an end point indicated by a bio_vec index and an offset within that vector's page. */
sector_t bio_sector_offset(struct bio *bio, unsigned short index, unsigned int offset)
/* Return the number of hardware sectors between beginning of bio and an end point indicated by a bio_vec index and an offset within that vector's page. */ sector_t bio_sector_offset(struct bio *bio, unsigned short index, unsigned int offset)
{ unsigned int sector_sz; struct bio_vec *bv; sector_t sectors; int i; sector_sz = queue_logical_block_size(bio->bi_bdev->bd_disk->queue); sectors = 0; if (index >= bio->bi_idx) index = bio->bi_vcnt - 1; __bio_for_each_segment(bv, bio, i, 0) { if (i == index) { if (offset > bv->bv_offset) sectors += ...
robutest/uclinux
C++
GPL-2.0
60
/* The clock_cpu_getres() function shall return the resolution of CPU time, the number of nanosecond per tick. */
uint64_t clock_cpu_getres(void)
/* The clock_cpu_getres() function shall return the resolution of CPU time, the number of nanosecond per tick. */ uint64_t clock_cpu_getres(void)
{ if (_cputime_ops) return _cputime_ops->cputime_getres(); rt_set_errno(ENOSYS); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Do OR operation with the value of the specified EMMC host controller mmio register. */
EFI_STATUS EFIAPI EmmcPeimHcOrMmio(IN UINTN Address, IN UINT8 Count, IN VOID *OrData)
/* Do OR operation with the value of the specified EMMC host controller mmio register. */ EFI_STATUS EFIAPI EmmcPeimHcOrMmio(IN UINTN Address, IN UINT8 Count, IN VOID *OrData)
{ EFI_STATUS Status; UINT64 Data; UINT64 Or; Status = EmmcPeimHcRwMmio (Address, TRUE, Count, &Data); if (EFI_ERROR (Status)) { return Status; } if (Count == 1) { Or = *(UINT8 *)OrData; } else if (Count == 2) { Or = *(UINT16 *)OrData; } else if (Count == 4) { Or = *(UINT32 *...
tianocore/edk2
C++
Other
4,240
/* Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to point to next instruction. */
VOID DisassembleInstruction(IN UINT8 **OpCodePtr, IN BOOLEAN Thumb, IN BOOLEAN Extended, IN OUT UINT32 *ItBlock, OUT CHAR8 *Buf, OUT UINTN Size)
/* Place a disassembly of **OpCodePtr into buffer, and update OpCodePtr to point to next instruction. */ VOID DisassembleInstruction(IN UINT8 **OpCodePtr, IN BOOLEAN Thumb, IN BOOLEAN Extended, IN OUT UINT32 *ItBlock, OUT CHAR8 *Buf, OUT UINTN Size)
{ AsciiSPrint (Buf, Size, "AArch64 not supported"); return; }
tianocore/edk2
C++
Other
4,240
/* Minimum value of absolute values of a floating-point vector. */
void arm_absmin_f32(const float32_t *pSrc, uint32_t blockSize, float32_t *pResult, uint32_t *pIndex)
/* Minimum value of absolute values of a floating-point vector. */ void arm_absmin_f32(const float32_t *pSrc, uint32_t blockSize, float32_t *pResult, uint32_t *pIndex)
{ float32_t minVal, out; uint32_t blkCnt, outIndex; outIndex = 0U; out = fabsf(*pSrc++); blkCnt = (blockSize - 1U); while (blkCnt > 0U) { minVal = fabsf(*pSrc++); if (out > minVal) { out = minVal; outIndex = blockSize - blkCnt; } blkCnt--; } *pResult = out; ...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Queue @work to work processor @task for async execution. @task must have been created with kthread_worker_create(). Returns true if @work was successfully queued, false if it was already pending. */
bool queue_kthread_work(struct kthread_worker *worker, struct kthread_work *work)
/* Queue @work to work processor @task for async execution. @task must have been created with kthread_worker_create(). Returns true if @work was successfully queued, false if it was already pending. */ bool queue_kthread_work(struct kthread_worker *worker, struct kthread_work *work)
{ bool ret = false; unsigned long flags; spin_lock_irqsave(&worker->lock, flags); if (list_empty(&work->node)) { list_add_tail(&work->node, &worker->work_list); work->queue_seq++; if (likely(worker->task)) wake_up_process(worker->task); ret = true; } spin_unlock_irqrestore(&worker->lock, flags); retur...
EmcraftSystems/linux-emcraft
C++
Other
266
/* cxgb3i_setup_conn_pagesize - setup the conn.'s ddp page size @tdev: t3cdev adapter @tid: connection id @reply: request reply from h/w @pgsz: ddp page size set up the ddp page size for a connection identified by tid */
int cxgb3i_setup_conn_pagesize(struct t3cdev *tdev, unsigned int tid, int reply, unsigned long pgsz)
/* cxgb3i_setup_conn_pagesize - setup the conn.'s ddp page size @tdev: t3cdev adapter @tid: connection id @reply: request reply from h/w @pgsz: ddp page size set up the ddp page size for a connection identified by tid */ int cxgb3i_setup_conn_pagesize(struct t3cdev *tdev, unsigned int tid, int reply, unsigned long pgs...
{ int pgidx = cxgb3i_ddp_find_page_index(pgsz); return setup_conn_pgidx(tdev, tid, pgidx, reply); }
robutest/uclinux
C++
GPL-2.0
60
/* Read MIB counters in order to reset them, then zero all the stats fields in memory */
static void mpc52xx_fec_reset_stats(struct net_device *dev)
/* Read MIB counters in order to reset them, then zero all the stats fields in memory */ static void mpc52xx_fec_reset_stats(struct net_device *dev)
{ struct mpc52xx_fec_priv *priv = netdev_priv(dev); struct mpc52xx_fec __iomem *fec = priv->fec; out_be32(&fec->mib_control, FEC_MIB_DISABLE); memset_io(&fec->rmon_t_drop, 0, offsetof(struct mpc52xx_fec, reserved10) - offsetof(struct mpc52xx_fec, rmon_t_drop)); out_be32(&fec->mib_control, 0); memset(&de...
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified ADC DMA request. */
void ADC_EnableDMA(ADC_Module *ADCx, FunctionalState Cmd)
/* Enables or disables the specified ADC DMA request. */ void ADC_EnableDMA(ADC_Module *ADCx, FunctionalState Cmd)
{ assert_param(IsAdcDmaModule(ADCx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { ADCx->CTRL2 |= CTRL2_DMA_SET; } else { ADCx->CTRL2 &= CTRL2_DMA_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Find out frequency generated by the 25_50mhz RC osciallator. */
static uint32_t get_rcosc_25_50mhz_frequency(void)
/* Find out frequency generated by the 25_50mhz RC osciallator. */ static uint32_t get_rcosc_25_50mhz_frequency(void)
{ uint32_t rcosc_div2; uint32_t rcosc_frequency; rcosc_div2 = SYSREG->MSSDDR_PLL_STATUS & RCOSC_DIV2_MASK; if(0u == rcosc_div2) { rcosc_frequency = FREQ_25MHZ; } else { rcosc_frequency = FREQ_50MHZ; } return rcosc_frequency; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Blink a specific icon on the LCD glass. This function will blink a specific icon. */
void xpro_lcd_blink_icon_start(uint8_t icon_com, uint8_t icon_seg)
/* Blink a specific icon on the LCD glass. This function will blink a specific icon. */ void xpro_lcd_blink_icon_start(uint8_t icon_com, uint8_t icon_seg)
{ if (icon_seg < 2) { xpro_lcd_show_icon(icon_com,icon_seg); slcd_disable(); struct slcd_blink_config blink_config; slcd_blink_get_config_defaults(&blink_config); blink_config.blink_all_seg = false; blink_config.fc = CONF_XPRO_LCD_BLINK_TIMER; slcd_blink_set_config(&blink_config); slcd_set_blink_pixel(...
memfault/zero-to-main
C++
null
200
/* Returns: (transfer none): The user data pointer set, or NULL */
gpointer g_object_get_qdata(GObject *object, GQuark quark)
/* Returns: (transfer none): The user data pointer set, or NULL */ gpointer g_object_get_qdata(GObject *object, GQuark quark)
{ g_return_val_if_fail (G_IS_OBJECT (object), NULL); return quark ? g_datalist_id_get_data (&object->qdata, quark) : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* exported: expand the variable length event to linear buffer space. */
static int seq_copy_in_kernel(char **bufptr, const void *src, int size)
/* exported: expand the variable length event to linear buffer space. */ static int seq_copy_in_kernel(char **bufptr, const void *src, int size)
{ memcpy(*bufptr, src, size); *bufptr += size; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns -1 in case of error, the index in the stack otherwise */
int namePush(xmlParserCtxtPtr ctxt, const xmlChar *value)
/* Returns -1 in case of error, the index in the stack otherwise */ int namePush(xmlParserCtxtPtr ctxt, const xmlChar *value)
{ if (ctxt == NULL) return (-1); if (ctxt->nameNr >= ctxt->nameMax) { const xmlChar * *tmp; tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, ctxt->nameMax * 2 * sizeof(ctxt->nameTab[0])); if (tmp == N...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330