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
/* EjectCpu needs to know the BSP at SMI exit at a point when some of the EFI_SMM_CPU_SERVICE_PROTOCOL state has been torn down. Reuse the logic from OvmfPkg::PlatformSmmBspElection() to do that. */
STATIC BOOLEAN CheckIfBsp(VOID)
/* EjectCpu needs to know the BSP at SMI exit at a point when some of the EFI_SMM_CPU_SERVICE_PROTOCOL state has been torn down. Reuse the logic from OvmfPkg::PlatformSmmBspElection() to do that. */ STATIC BOOLEAN CheckIfBsp(VOID)
{ MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr; BOOLEAN IsBsp; ApicBaseMsr.Uint64 = AsmReadMsr64 (MSR_IA32_APIC_BASE); IsBsp = (BOOLEAN)(ApicBaseMsr.Bits.BSP == 1); return IsBsp; }
tianocore/edk2
C++
Other
4,240
/* param base ADC peripheral base address. param channelGroup Channel group index. param config Pointer to the "adc_channel_config_t" structure for the conversion channel. */
void ADC_SetChannelConfig(ADC_Type *base, uint32_t channelGroup, const adc_channel_config_t *config)
/* param base ADC peripheral base address. param channelGroup Channel group index. param config Pointer to the "adc_channel_config_t" structure for the conversion channel. */ void ADC_SetChannelConfig(ADC_Type *base, uint32_t channelGroup, const adc_channel_config_t *config)
{ assert(NULL != config); assert(channelGroup < (uint32_t)FSL_FEATURE_ADC_CONVERSION_CONTROL_COUNT); uint32_t tmp32; tmp32 = ADC_HC_ADCH(config->channelNumber); if (config->enableInterruptOnConversionCompleted) { tmp32 |= ADC_HC_AIEN_MASK; } base->HC[channelGroup] = tmp32; }
eclipse-threadx/getting-started
C++
Other
310
/* This function is called after a PCI bus error affecting this device has been detected. */
static pci_ers_result_t atl1e_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
/* This function is called after a PCI bus error affecting this device has been detected. */ static pci_ers_result_t atl1e_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
{ struct net_device *netdev = pci_get_drvdata(pdev); struct atl1e_adapter *adapter = netdev_priv(netdev); netif_device_detach(netdev); if (state == pci_channel_io_perm_failure) return PCI_ERS_RESULT_DISCONNECT; if (netif_running(netdev)) atl1e_down(adapter); pci_disable_device(pdev); return PCI_ERS_RESULT_NE...
robutest/uclinux
C++
GPL-2.0
60
/* Match an RGB value to a particular palette index */
Uint8 SDL_FindColor(SDL_Palette *pal, Uint8 r, Uint8 g, Uint8 b)
/* Match an RGB value to a particular palette index */ Uint8 SDL_FindColor(SDL_Palette *pal, Uint8 r, Uint8 g, Uint8 b)
{ unsigned int smallest; unsigned int distance; int rd, gd, bd; int i; Uint8 pixel=0; smallest = ~0; for ( i=0; i<pal->ncolors; ++i ) { rd = pal->colors[i].r - r; gd = pal->colors[i].g - g; bd = pal->colors[i].b - b; distance = (rd*rd)+(gd*gd)+(bd*bd); if ( distance < smallest ) { pixel = i; if (...
DC-SWAT/DreamShell
C++
null
404
/* Set or enable a specific feature of Device. */
USB_Result Standard_SetDeviceFeature(void)
/* Set or enable a specific feature of Device. */ USB_Result Standard_SetDeviceFeature(void)
{ SetBit(pInformation->CurrentFeature, 5); pUser_Standard_Requests->User_SetDeviceFeature(); return Success; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Handle a read reply that fills part of a page. */
static void nfs_readpage_result_partial(struct rpc_task *task, void *calldata)
/* Handle a read reply that fills part of a page. */ static void nfs_readpage_result_partial(struct rpc_task *task, void *calldata)
{ struct nfs_read_data *data = calldata; if (nfs_readpage_result(task, data) != 0) return; if (task->tk_status < 0) return; nfs_readpage_truncate_uninitialised_page(data); nfs_readpage_retry(task, data); }
robutest/uclinux
C++
GPL-2.0
60
/* Insert the memory block to the pool's list of the blocks. */
VOID UfsPeimInsertMemBlockToPool(IN UFS_PEIM_MEM_BLOCK *Head, IN UFS_PEIM_MEM_BLOCK *Block)
/* Insert the memory block to the pool's list of the blocks. */ VOID UfsPeimInsertMemBlockToPool(IN UFS_PEIM_MEM_BLOCK *Head, IN UFS_PEIM_MEM_BLOCK *Block)
{ ASSERT ((Head != NULL) && (Block != NULL)); Block->Next = Head->Next; Head->Next = Block; }
tianocore/edk2
C++
Other
4,240
/* Enable Transmit buffer empty interrupt @rmtoll IER TXBEIE LL_SWPMI_EnableIT_TXBE. */
void LL_SWPMI_EnableIT_TXBE(SWPMI_TypeDef *SWPMIx)
/* Enable Transmit buffer empty interrupt @rmtoll IER TXBEIE LL_SWPMI_EnableIT_TXBE. */ void LL_SWPMI_EnableIT_TXBE(SWPMI_TypeDef *SWPMIx)
{ SET_BIT(SWPMIx->IER, SWPMI_IER_TXBEIE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Update the value of an 16-bit PCI configuration register in a PCI device. If the PCI Configuration register specified by PciAddress is already programmed with a non-zero value, then return the current value. Otherwise update the PCI configuration register specified by PciAddress with the value specified by Value and...
UINT16 SerialPortLibUpdatePciRegister16(UINTN PciAddress, UINT16 Value, UINT16 Mask)
/* Update the value of an 16-bit PCI configuration register in a PCI device. If the PCI Configuration register specified by PciAddress is already programmed with a non-zero value, then return the current value. Otherwise update the PCI configuration register specified by PciAddress with the value specified by Value and...
{ UINT16 CurrentValue; CurrentValue = PciRead16 (PciAddress) & Mask; if (CurrentValue != 0) { return CurrentValue; } return PciWrite16 (PciAddress, Value & Mask); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the Pin(s) active level inversion. */
void USART_InvPinCmd(USART_TypeDef *USARTx, uint32_t USART_InvPin, FunctionalState NewState)
/* Enables or disables the Pin(s) active level inversion. */ void USART_InvPinCmd(USART_TypeDef *USARTx, uint32_t USART_InvPin, FunctionalState NewState)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_USART_INVERSTION_PIN(USART_InvPin)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR2 |= USART_InvPin; } else { USARTx->CR2 &= (uint32_t)~USART_InvPin; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateRuntimePages(IN UINTN Pages)
/* Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocateRuntim...
{ return InternalAllocatePages (EfiRuntimeServicesData, Pages); }
tianocore/edk2
C++
Other
4,240
/* struct pci_slot is refcounted, so destroying them is really easy; we just call kobject_put on its kobj and let our release methods do the rest. */
void pci_destroy_slot(struct pci_slot *slot)
/* struct pci_slot is refcounted, so destroying them is really easy; we just call kobject_put on its kobj and let our release methods do the rest. */ void pci_destroy_slot(struct pci_slot *slot)
{ dev_dbg(&slot->bus->dev, "dev %02x, dec refcount to %d\n", slot->number, atomic_read(&slot->kobj.kref.refcount) - 1); down_write(&pci_bus_sem); kobject_put(&slot->kobj); up_write(&pci_bus_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes Chushicheng the first version Program listing: This is a touch device usage routine The routine exports touch_sample commands to the control terminal Command invocation format: touch_sample Program function: The terminal prints the coordinates of the touch point */
static int touch_sample(void)
/* Change Logs: Date Author Notes Chushicheng the first version Program listing: This is a touch device usage routine The routine exports touch_sample commands to the control terminal Command invocation format: touch_sample Program function: The terminal prints the coordinates of the touch point */ static int touch_s...
{ gt911_input_t ctp_input; rt_device_t dev = rt_device_find("capt"); RT_ASSERT(dev != RT_NULL); capt_t *capt = (capt_t*)dev->user_data; while(1) { gt911_ctp_read(&capt->gt911, &ctp_input); for (rt_uint8_t i = 0; i < ctp_input.num_pos; i++) { if (ctp_input.pos...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 on success, or -ENOMEM if no memory could be allocated. */
int firmware_map_add(u64 start, u64 end, const char *type)
/* Returns 0 on success, or -ENOMEM if no memory could be allocated. */ int firmware_map_add(u64 start, u64 end, const char *type)
{ struct firmware_map_entry *entry; entry = kmalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC); if (!entry) return -ENOMEM; return firmware_map_add_entry(start, end, type, entry); }
robutest/uclinux
C++
GPL-2.0
60
/* Allocate and zero more components. Does not consume bi. */
static void ICACHE_FLASH_ATTR more_comps(bigint *bi, int n)
/* Allocate and zero more components. Does not consume bi. */ static void ICACHE_FLASH_ATTR more_comps(bigint *bi, int n)
{ if (n > bi->max_comps) { bi->max_comps = max(bi->max_comps * 2, n); bi->comps = (comp*)realloc(bi->comps, bi->max_comps * COMP_BYTE_SIZE); } if (n > bi->size) { memset(&bi->comps[bi->size], 0, (n-bi->size)*COMP_BYTE_SIZE); } bi->size = n; }
eerimoq/simba
C++
Other
337
/* This is used directly or indirectly to implement gpio_to_irq(). It returns the number of the IRQ signaled by this (input) GPIO, or a negative errno. */
int __gpio_to_irq(unsigned gpio)
/* This is used directly or indirectly to implement gpio_to_irq(). It returns the number of the IRQ signaled by this (input) GPIO, or a negative errno. */ int __gpio_to_irq(unsigned gpio)
{ struct gpio_chip *chip; chip = gpio_to_chip(gpio); return chip->to_irq ? chip->to_irq(chip, gpio - chip->base) : -ENXIO; }
robutest/uclinux
C++
GPL-2.0
60
/* This API used to get the z repetition in the register 0x52 bit 0 to 7. */
BMM050_RETURN_FUNCTION_TYPE bmm050_get_rep_Z(u8 *v_rep_z_u8)
/* This API used to get the z repetition in the register 0x52 bit 0 to 7. */ BMM050_RETURN_FUNCTION_TYPE bmm050_get_rep_Z(u8 *v_rep_z_u8)
{ BMM050_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 v_data_u8 = BMM050_INIT_VALUE; if (p_bmm050 == BMM050_NULL) { return E_BMM050_NULL_PTR; } else { com_rslt = p_bmm050->BMM050_BUS_READ_FUNC( p_bmm050->dev_addr, BMM050_REP_Z, ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This handler responds by turning on bus power. If the DWC_otg controller is in low power mode, this handler brings the controller out of low power mode before turning on bus power. */
static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg)
/* This handler responds by turning on bus power. If the DWC_otg controller is in low power mode, this handler brings the controller out of low power mode before turning on bus power. */ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg)
{ dev_dbg(hsotg->dev, "++Session Request Interrupt++\n"); writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read the specified image into an ABGR-format rastertaking in account specified orientation. */
int TIFFReadRGBAImageOriented(TIFF *tif, uint32 rwidth, uint32 rheight, uint32 *raster, int orientation, int stop)
/* Read the specified image into an ABGR-format rastertaking in account specified orientation. */ int TIFFReadRGBAImageOriented(TIFF *tif, uint32 rwidth, uint32 rheight, uint32 *raster, int orientation, int stop)
{ char emsg[1024] = ""; TIFFRGBAImage img; int ok; if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) { img.req_orientation = (uint16)orientation; ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth, rwidth, img.height); TIFFRGBAImageEnd(&img); } else { TIFF...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Set lptimer Waveform Output Polarity High. Set lptimer waveform output to reflect compare result between LPTIN_CNT and LPTIM_CMP. */
void lptimer_set_waveform_polarity_high(uint32_t lptimer_peripheral)
/* Set lptimer Waveform Output Polarity High. Set lptimer waveform output to reflect compare result between LPTIN_CNT and LPTIM_CMP. */ void lptimer_set_waveform_polarity_high(uint32_t lptimer_peripheral)
{ LPTIM_CFGR(lptimer_peripheral) |= LPTIM_CFGR_WAVPOL; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* The default is to simply calculate the BS values as specified in the INTEL SA1100 development manual "Expansion Memory (PCMCIA) Configuration Register (MECR)" that's section 10.2.5 in */
static unsigned int sa1100_pcmcia_default_mecr_timing(struct soc_pcmcia_socket *skt, unsigned int cpu_speed, unsigned int cmd_time)
/* The default is to simply calculate the BS values as specified in the INTEL SA1100 development manual "Expansion Memory (PCMCIA) Configuration Register (MECR)" that's section 10.2.5 in */ static unsigned int sa1100_pcmcia_default_mecr_timing(struct soc_pcmcia_socket *skt, unsigned int cpu_speed, unsigned int cmd_tim...
{ return sa1100_pcmcia_mecr_bs(cmd_time, cpu_speed); }
robutest/uclinux
C++
GPL-2.0
60
/* Copies All pointer and size alignments are supported. */
volatile void* flashcalw_memset8(volatile void *dst, uint8_t src, size_t nbytes, bool erase)
/* Copies All pointer and size alignments are supported. */ volatile void* flashcalw_memset8(volatile void *dst, uint8_t src, size_t nbytes, bool erase)
{ return flashcalw_memset16(dst, src | (uint16_t)src << 8, nbytes, erase); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns the number of data received in the buffer 1 of a double Buffer endpoint. */
uint16_t USB_GetEpDblBuf1Cnt(uint8_t bEpNum)
/* Returns the number of data received in the buffer 1 of a double Buffer endpoint. */ uint16_t USB_GetEpDblBuf1Cnt(uint8_t bEpNum)
{ return (_GetEPDblBuf1Count(bEpNum)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* It is the caller's responsibility to save the old node, if desired, otherwise the reference to the old node will be lost. If NewNode is not NULL, set its parent to ObjectNode. */
EFI_STATUS EFIAPI AmlSetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
/* It is the caller's responsibility to save the old node, if desired, otherwise the reference to the old node will be lost. If NewNode is not NULL, set its parent to ObjectNode. */ EFI_STATUS EFIAPI AmlSetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index, IN AML_NODE_HEADER *NewNode)
{ if (IS_AML_OBJECT_NODE (ObjectNode) && (Index <= (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode)) && ((NewNode == NULL) || IS_AML_OBJECT_NODE (NewNode) || IS_...
tianocore/edk2
C++
Other
4,240
/* Unlock the Option Byte Access. This enables write access to the option bytes. It is locked by default on reset. */
void flash_unlock_option_bytes(void)
/* Unlock the Option Byte Access. This enables write access to the option bytes. It is locked by default on reset. */ void flash_unlock_option_bytes(void)
{ FLASH_OPTCR |= FLASH_OPTCR_OPTLOCK; FLASH_OPTKEYR = FLASH_OPTKEYR_KEY1; FLASH_OPTKEYR = FLASH_OPTKEYR_KEY2; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* configure TIMER channel control shadow register update control */
void timer_channel_control_shadow_update_config(uint32_t timer_periph, uint16_t timer_ccuctl)
/* configure TIMER channel control shadow register update control */ void timer_channel_control_shadow_update_config(uint32_t timer_periph, uint16_t timer_ccuctl)
{ TIMER_CTL1(timer_periph) &= (uint32_t)(~ TIMER_CTL1_CCUC); TIMER_CTL1(timer_periph) |= (uint32_t)timer_ccuctl; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Return with the pointer of the next node after act. */
void* ramfs_ll_get_next(ramfs_ll_t *ll, void *act)
/* Return with the pointer of the next node after act. */ void* ramfs_ll_get_next(ramfs_ll_t *ll, void *act)
{ void *next = NULL; ramfs_ll_node_t *node = act; if (ll != NULL) { memcpy(&next, node + RAMFS_LL_NEXT_OFFSET(ll), sizeof(void *)); } return next; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* hcu_led_set value to be placed into the LEDs (max 6 bit) */
void hcu_led_set(u32 value)
/* hcu_led_set value to be placed into the LEDs (max 6 bit) */ void hcu_led_set(u32 value)
{ u32 tmp = ~value; tmp = (tmp << 23) | 0x7FFFFF; out_be32((u32 *)GPIO0_OR, tmp); }
EmcraftSystems/u-boot
C++
Other
181
/* Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c */
static int ipw2100_wx_set_encode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *key)
/* Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c */ static int ipw2100_wx_set_encode(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *key)
{ struct ipw2100_priv *priv = libipw_priv(dev); return libipw_wx_set_encode(priv->ieee, info, wrqu, key); }
robutest/uclinux
C++
GPL-2.0
60
/* 82575 silicon has a serialized gigabit media independent interface (sgmii) which can be enabled for use in the embedded applications. Simply return the current state of the sgmii interface. */
static bool igb_sgmii_active_82575(struct e1000_hw *)
/* 82575 silicon has a serialized gigabit media independent interface (sgmii) which can be enabled for use in the embedded applications. Simply return the current state of the sgmii interface. */ static bool igb_sgmii_active_82575(struct e1000_hw *)
{ struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; return dev_spec->sgmii_active; }
robutest/uclinux
C++
GPL-2.0
60
/* DESCRIPTION: Writing the interrupt ID it received from the claim (irq) to the complete register would signal the PLIC we've served this IRQ. The PLIC does not check whether the completion ID is the same as the last claim ID for that target. If the completion ID does not match an interrupt source that is currently en...
void plic_complete(int irq)
/* DESCRIPTION: Writing the interrupt ID it received from the claim (irq) to the complete register would signal the PLIC we've served this IRQ. The PLIC does not check whether the completion ID is the same as the last claim ID for that target. If the completion ID does not match an interrupt source that is currently en...
{ int hart = __raw_hartid(); *(uint32_t *)PLIC_COMPLETE(hart) = irq; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called under journal->j_list_lock. The caller provided us with a ref against the buffer, and we drop that here. */
static void release_buffer_page(struct buffer_head *bh)
/* Called under journal->j_list_lock. The caller provided us with a ref against the buffer, and we drop that here. */ static void release_buffer_page(struct buffer_head *bh)
{ struct page *page; if (buffer_dirty(bh)) goto nope; if (atomic_read(&bh->b_count) != 1) goto nope; page = bh->b_page; if (!page) goto nope; if (page->mapping) goto nope; if (!trylock_page(page)) goto nope; page_cache_get(page); __brelse(bh); try_to_free_buffers(page); unlock_page(page); page_cac...
robutest/uclinux
C++
GPL-2.0
60
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_15; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.S...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The available mappings are supplied on a per-device basis in */
void GPIOPinConfigure(uint32_t ui32PinConfig)
/* The available mappings are supplied on a per-device basis in */ void GPIOPinConfigure(uint32_t ui32PinConfig)
{ uint32_t ui32Base, ui32Shift; ASSERT(((ui32PinConfig >> 16) & 0xff) < 18); ASSERT(((ui32PinConfig >> 8) & 0xe3) == 0); ui32Base = (ui32PinConfig >> 16) & 0xff; if(HWREG(SYSCTL_GPIOHBCTL) & (1 << ui32Base)) { ui32Base = g_pui32GPIOBaseAddrs[(ui32Base << 1) + 1]; } else { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_DISABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_DISABLE(); } else if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_12|GPIO_PIN_13); } else if(htim_base->Instance==TI...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find and display image base address and return image base and its entry point. */
VOID DumpModuleImageInfo(IN UINTN CurrentEip)
/* Find and display image base address and return image base and its entry point. */ VOID DumpModuleImageInfo(IN UINTN CurrentEip)
{ EFI_STATUS Status; UINTN Pe32Data; VOID *PdbPointer; VOID *EntryPoint; Pe32Data = PeCoffSearchImageBase (CurrentEip); if (Pe32Data == 0) { InternalPrintMessage ("!!!! Can't find image information. !!!!\n"); } else { Status = PeCoffLoaderGetEntryPoint ((VOID *)Pe32Data, &Entr...
tianocore/edk2
C++
Other
4,240
/* This function enables the wakeup function of USCI_I2C module. */
void UI2C_EnableWakeup(UI2C_T *ui2c, uint8_t u8WakeupMode)
/* This function enables the wakeup function of USCI_I2C module. */ void UI2C_EnableWakeup(UI2C_T *ui2c, uint8_t u8WakeupMode)
{ ui2c->WKCTL = (ui2c->WKCTL & ~UI2C_WKCTL_WKADDREN_Msk) | (u8WakeupMode | UI2C_WKCTL_WKEN_Msk); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Copy 'size' bytes from 'src' to 'dest', correcting endianness if given 'islittle' is different from native endianness. */
static void copywithendian(volatile char *dest, volatile const char *src, int size, int islittle)
/* Copy 'size' bytes from 'src' to 'dest', correcting endianness if given 'islittle' is different from native endianness. */ static void copywithendian(volatile char *dest, volatile const char *src, int size, int islittle)
{ if (islittle == nativeendian.little) { while (size-- != 0) *(dest++) = *(src++); } else { dest += size - 1; while (size-- != 0) *(dest--) = *(src++); } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* ep0_get_status - fill in URB data with appropriate status @device: @urb: @index: @requesttype: */
static int ep0_get_status(struct usb_device_instance *device, struct urb *urb, int index, int requesttype)
/* ep0_get_status - fill in URB data with appropriate status @device: @urb: @index: @requesttype: */ static int ep0_get_status(struct usb_device_instance *device, struct urb *urb, int index, int requesttype)
{ char *cp; urb->actual_length = 2; cp = (char*)urb->buffer; cp[0] = cp[1] = 0; switch (requesttype) { case USB_REQ_RECIPIENT_DEVICE: cp[0] = USB_STATUS_SELFPOWERED; break; case USB_REQ_RECIPIENT_INTERFACE: break; case USB_REQ_RECIPIENT_ENDPOINT: cp[0] = usbd_endpoint_halted (device, index); break; c...
EmcraftSystems/u-boot
C++
Other
181
/* Enables ADC, starts conversion of insert group with interruption. */
ald_status_t ald_adc_insert_start_by_it(ald_adc_handle_t *hperh)
/* Enables ADC, starts conversion of insert group with interruption. */ ald_status_t ald_adc_insert_start_by_it(ald_adc_handle_t *hperh)
{ assert_param(IS_ADC_TYPE(hperh->perh)); SET_BIT(hperh->state, ALD_ADC_STATE_BUSY_I); ALD_ADC_ENABLE(hperh); WRITE_REG(hperh->perh->CLR, ALD_ADC_FLAG_ICHS | ALD_ADC_FLAG_ICH); ald_adc_interrupt_config(hperh, ALD_ADC_IT_ICH, ENABLE); if (!(READ_BIT(hperh->perh->CON0, ADC_CON0_IAUTO_MSK))) ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* allow the fileserver to see if the cache manager is still alive */
static void SRXAFSCB_CallBack(struct work_struct *work)
/* allow the fileserver to see if the cache manager is still alive */ static void SRXAFSCB_CallBack(struct work_struct *work)
{ struct afs_call *call = container_of(work, struct afs_call, work); _enter(""); afs_send_empty_reply(call); afs_break_callbacks(call->server, call->count, call->request); _leave(""); }
robutest/uclinux
C++
GPL-2.0
60
/* write to PCI config space and transfer it to MSR write. */
void cs5536_pci_conf_write4(int function, int reg, u32 value)
/* write to PCI config space and transfer it to MSR write. */ void cs5536_pci_conf_write4(int function, int reg, u32 value)
{ if ((function <= CS5536_FUNC_START) || (function >= CS5536_FUNC_END)) return; if ((reg < 0) || (reg > 0x100) || ((reg & 0x03) != 0)) return; if (vsm_conf_write[function] != NULL) vsm_conf_write[function](reg, value); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Attribute write call back for the Value V4 attribute. */
static ssize_t write_value_v4_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V4 attribute. */ static ssize_t write_value_v4_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ uint8_t *value = attr->user_data; if (offset >= sizeof(value_v4_1_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v4_1_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Round up a positive 32-bit value to the next whole power of two, and return the bit position of the highest bit set in the result. Equivalent to ceil(log2(x)). */
STATIC INTN HighBitSetRoundUp32(IN UINT32 Operand)
/* Round up a positive 32-bit value to the next whole power of two, and return the bit position of the highest bit set in the result. Equivalent to ceil(log2(x)). */ STATIC INTN HighBitSetRoundUp32(IN UINT32 Operand)
{ INTN HighBit; HighBit = HighBitSet32 (Operand); if (HighBit == -1) { return HighBit; } if ((Operand & (Operand - 1)) != 0) { ++HighBit; } return (HighBit < 32) ? HighBit : -1; }
tianocore/edk2
C++
Other
4,240
/* Combine two segments, which must be contiguous. If pad is true, it's okay for there to be padding between. */
static void combine(struct sect *base, struct sect *new, int pad)
/* Combine two segments, which must be contiguous. If pad is true, it's okay for there to be padding between. */ static void combine(struct sect *base, struct sect *new, int pad)
{ if (!base->len) *base = *new; else if (new->len) { if (base->vaddr + base->len != new->vaddr) { if (pad) base->len = new->vaddr - base->vaddr; else { fprintf(stderr, "Non-contiguous data can't be converted.\n"); exit(1); } } base->len += new->len; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the TIM Capture Compare Channel xN. */
void TIM_EnableCapCmpChN(TIM_Module *TIMx, uint16_t Channel, uint32_t TIM_CCxN)
/* Enables or disables the TIM Capture Compare Channel xN. */ void TIM_EnableCapCmpChN(TIM_Module *TIMx, uint16_t Channel, uint32_t TIM_CCxN)
{ uint16_t tmp = 0; assert_param(IsTimList2Module(TIMx)); assert_param(IsTimComplementaryCh(Channel)); assert_param(IsTimCapCmpNState(TIM_CCxN)); tmp = CAPCMPEN_CCNE_SET << Channel; TIMx->CCEN &= (uint32_t)~tmp; TIMx->CCEN |= (uint32_t)(TIM_CCxN << Channel); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Round text sizes so that the svg viewer only needs a discrete number of renderings of the font */
static double round_text_size(double size)
/* Round text sizes so that the svg viewer only needs a discrete number of renderings of the font */ static double round_text_size(double size)
{ int loop = 100; double target = 10.0; if (size >= 10.0) return size; while (loop--) { if (size >= target) return target; target = target / 2.0; } return size; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { HID_Device_USBTask(&Keyboard_HID_Interface); HID_Device_USBTask(&Mouse_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function gets back the FSP API first parameter passed by the bootloader. */
UINTN EFIAPI GetFspApiParameter(VOID)
/* This function gets back the FSP API first parameter passed by the bootloader. */ UINTN EFIAPI GetFspApiParameter(VOID)
{ FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); return *(UINTN *)(FspData->CoreStack + CONTEXT_STACK_OFFSET (ApiParam[0])); }
tianocore/edk2
C++
Other
4,240
/* If Sha512Context is NULL, then return FALSE. If NewSha512Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sha512Duplicate(IN CONST VOID *Sha512Context, OUT VOID *NewSha512Context)
/* If Sha512Context is NULL, then return FALSE. If NewSha512Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Sha512Duplicate(IN CONST VOID *Sha512Context, OUT VOID *NewSha512Context)
{ if ((Sha512Context == NULL) || (NewSha512Context == NULL)) { return FALSE; } CopyMem (NewSha512Context, Sha512Context, sizeof (SHA512_CTX)); return TRUE; }
tianocore/edk2
C++
Other
4,240
/* lpfc_bsg_request - handle a bsg request from the FC transport @job: fc_bsg_job to handle */
int lpfc_bsg_request(struct fc_bsg_job *job)
/* lpfc_bsg_request - handle a bsg request from the FC transport @job: fc_bsg_job to handle */ int lpfc_bsg_request(struct fc_bsg_job *job)
{ uint32_t msgcode; int rc = -EINVAL; msgcode = job->request->msgcode; switch (msgcode) { case FC_BSG_HST_VENDOR: rc = lpfc_bsg_hst_vendor(job); break; case FC_BSG_RPT_ELS: rc = lpfc_bsg_rport_els(job); break; case FC_BSG_RPT_CT: rc = lpfc_bsg_rport_ct(job); break; default: break; } return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the FLASH Write Protection Option Bytes value. */
uint32_t FLASH_OB_GetWRP3(void)
/* Returns the FLASH Write Protection Option Bytes value. */ uint32_t FLASH_OB_GetWRP3(void)
{ return (uint32_t)(FLASH->WRPR3); }
remotemcu/remcu-chip-sdks
C++
null
436
/* A possible improvement here would be to have the tools add a per-device flag to the store entry, indicating whether it is needed at boot time. This would allow people who knew what they were doing to accelerate their boot slightly, but of course needs tools or manual intervention to set up those flags correctly. */
static void wait_for_devices(struct xenbus_driver *xendrv)
/* A possible improvement here would be to have the tools add a per-device flag to the store entry, indicating whether it is needed at boot time. This would allow people who knew what they were doing to accelerate their boot slightly, but of course needs tools or manual intervention to set up those flags correctly. */...
{ unsigned long start = jiffies; struct device_driver *drv = xendrv ? &xendrv->driver : NULL; unsigned int seconds_waited = 0; if (!ready_to_wait_for_devices || !xen_domain()) return; while (exists_connecting_device(drv)) { if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { if (!seconds_waited) p...
robutest/uclinux
C++
GPL-2.0
60
/* Zero the heap and initialize start, end and lowest-free */
void mem_init(void)
/* Zero the heap and initialize start, end and lowest-free */ void mem_init(void)
{ struct mem *mem; LWIP_ASSERT("Sanity check alignment", (SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0); ram = (u8_t *)LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER); mem = (struct mem *)(void *)ram; mem->next = MEM_SIZE_ALIGNED; mem->prev = 0; mem->used = 0; ram_end = (struct mem *)(void *)&ram[MEM_SIZE_ALIG...
Nicholas3388/LuaNode
C++
Other
1,055
/* This function handles EXTI line 4 to 15 interrupts. */
void EXTI4_15_IRQHandler(void)
/* This function handles EXTI line 4 to 15 interrupts. */ void EXTI4_15_IRQHandler(void)
{ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8); HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13); }
Luos-io/luos_engine
C++
MIT License
496
/* Enable the interrupt to get timestamping interrupt. This enables the host to get the interrupt when (1) system time is greater or equal to the target time high and low register or (2) there is a overflow in th esecond register. */
void synopGMAC_TS_int_enable(synopGMACdevice *gmacdev)
/* Enable the interrupt to get timestamping interrupt. This enables the host to get the interrupt when (1) system time is greater or equal to the target time high and low register or (2) there is a overflow in th esecond register. */ void synopGMAC_TS_int_enable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacInterruptMask, GmacPmtIntMask); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Hands off the ZCL Illuminance Level Sensing dissector. */
void proto_reg_handoff_zbee_zcl_illum_level_sen(void)
/* Hands off the ZCL Illuminance Level Sensing dissector. */ void proto_reg_handoff_zbee_zcl_illum_level_sen(void)
{ zbee_zcl_init_cluster( proto_zbee_zcl_illum_level_sen, ett_zbee_zcl_illum_level_sen, ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING, hf_zbee_zcl_illum_level_sen_attr_id, -1, -1, (zb...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initializes SPI interface for access to board controller FPGA registers. */
static void SPI_BC_Init(void)
/* Initializes SPI interface for access to board controller FPGA registers. */ static void SPI_BC_Init(void)
{ USART_InitSync_TypeDef bcinit = USART_INITSYNC_DEFAULT; CMU_ClockEnable(USART_CLK, true); GPIO_PinModeSet(PORT_SPI_TX, PIN_SPI_TX, gpioModePushPull, 0); GPIO_PinModeSet(PORT_SPI_RX, PIN_SPI_RX, gpioModeInput, 0); GPIO_PinModeSet(PORT_SPI_CLK, PIN_SPI_CLK, gpioModePushPull, 0); GPIO_PinModeSet(PORT_SPI_CS,...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Master command code used for stamping for sensor sync.. */
int32_t lsm6dsl_sh_cmd_sens_sync_set(stmdev_ctx_t *ctx, uint8_t val)
/* Master command code used for stamping for sensor sync.. */ int32_t lsm6dsl_sh_cmd_sens_sync_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dsl_master_cmd_code_t master_cmd_code; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_MASTER_CMD_CODE, (uint8_t*)&master_cmd_code, 1); if(ret == 0){ master_cmd_code.master_cmd_code = val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_MASTER_CMD_CODE, (...
eclipse-threadx/getting-started
C++
Other
310
/* Determines if a CPU feature is enabled in PcdCpuFeaturesSupport bit mask. If a CPU feature is disabled in PcdCpuFeaturesSupport then all the code/data associated with that feature should be optimized away if compiler optimizations are enabled. */
BOOLEAN EFIAPI IsCpuFeatureSupported(IN UINT32 Feature)
/* Determines if a CPU feature is enabled in PcdCpuFeaturesSupport bit mask. If a CPU feature is disabled in PcdCpuFeaturesSupport then all the code/data associated with that feature should be optimized away if compiler optimizations are enabled. */ BOOLEAN EFIAPI IsCpuFeatureSupported(IN UINT32 Feature)
{ return IsCpuFeatureSetInCpuPcd ( (UINT8 *)PcdGetPtr (PcdCpuFeaturesSupport), PcdGetSize (PcdCpuFeaturesSupport), Feature ); }
tianocore/edk2
C++
Other
4,240
/* This function returns after the IPI has been accepted by the target processor. */
VOID EFIAPI SendFixedIpi(IN UINT32 ApicId, IN UINT8 Vector)
/* This function returns after the IPI has been accepted by the target processor. */ VOID EFIAPI SendFixedIpi(IN UINT32 ApicId, IN UINT8 Vector)
{ LOCAL_APIC_ICR_LOW IcrLow; IcrLow.Uint32 = 0; IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_FIXED; IcrLow.Bits.Level = 1; IcrLow.Bits.Vector = Vector; SendIpi (IcrLow.Uint32, ApicId); }
tianocore/edk2
C++
Other
4,240
/* Checks whether the specified PWR flag is set or not. */
FlagStatus PWR_GetFlagStatus(PWR_FLAG_TypeDef PWR_FLAG)
/* Checks whether the specified PWR flag is set or not. */ FlagStatus PWR_GetFlagStatus(PWR_FLAG_TypeDef PWR_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_PWR_FLAG(PWR_FLAG)); if ((PWR_FLAG & PWR_FLAG_VREFINTF) != 0) { if ((PWR->CSR2 & PWR_CR2_VREFINTF) != (uint8_t)RESET ) { bitstatus = SET; } else { bitstatus = RESET; } } else { if ((PWR->CSR1 & PWR_FLAG) != (uint8_t)RE...
remotemcu/remcu-chip-sdks
C++
null
436
/* Register the Service E and all its Characteristics... */
void service_e_3_init(void)
/* Register the Service E and all its Characteristics... */ void service_e_3_init(void)
{ bt_gatt_service_register(&service_e_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* search empty pages which may contain given size */
static struct snd_util_memblk* search_empty(struct snd_util_memhdr *hdr, int size)
/* search empty pages which may contain given size */ static struct snd_util_memblk* search_empty(struct snd_util_memhdr *hdr, int size)
{ struct snd_util_memblk *blk, *prev; int page, psize; struct list_head *p; psize = get_aligned_page(size + ALIGN_PAGE_SIZE -1); prev = NULL; page = 0; list_for_each(p, &hdr->block) { blk = list_entry(p, struct snd_util_memblk, list); if (page + psize <= firstpg(blk)) goto __found_pages; page = lastpg(b...
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the RTC hardware @rtc RTC private data structure */
static int kinetis_rtc_hw_init(struct kinetis_rtc *rtc)
/* Initialize the RTC hardware @rtc RTC private data structure */ static int kinetis_rtc_hw_init(struct kinetis_rtc *rtc)
{ int ret = 0; writel(0x0, &KINETIS_RTC(rtc)->rtc_ier); writel(0x0, &KINETIS_RTC(rtc)->rtc_tcr); if (readl(&KINETIS_RTC(rtc)->rtc_sr) & KINETIS_RTC_SR_TIF) { writel(0x0, &KINETIS_RTC(rtc)->rtc_sr); writel(0x1, &KINETIS_RTC(rtc)->rtc_tsr); } writel(KINETIS_RTC_SR_TCE, &KINETIS_RTC(rtc)->rtc_sr); d_printk(1, "...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Do OR operation with the Value of AHCI Operation register. */
VOID AhciOrReg(IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 OrData)
/* Do OR operation with the Value of AHCI Operation register. */ VOID AhciOrReg(IN UINTN AhciBar, IN UINT32 Offset, IN UINT32 OrData)
{ UINT32 Data; Data = AhciReadReg (AhciBar, Offset); Data |= OrData; AhciWriteReg (AhciBar, Offset, Data); }
tianocore/edk2
C++
Other
4,240
/* Cleans off all the quotes in the string. */
EFI_STATUS ShellLevel2StripQuotes(IN CONST CHAR16 *OriginalString, OUT CHAR16 **CleanString)
/* Cleans off all the quotes in the string. */ EFI_STATUS ShellLevel2StripQuotes(IN CONST CHAR16 *OriginalString, OUT CHAR16 **CleanString)
{ CHAR16 *Walker; if ((OriginalString == NULL) || (CleanString == NULL)) { return EFI_INVALID_PARAMETER; } *CleanString = AllocateCopyPool (StrSize (OriginalString), OriginalString); if (*CleanString == NULL) { return EFI_OUT_OF_RESOURCES; } for (Walker = *CleanString; Walker != NULL && *Walker !...
tianocore/edk2
C++
Other
4,240
/* Get the Mac address in to the address specified. The mac register contents are read and written to buffer passed. */
s32 synopGMAC_get_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
/* Get the Mac address in to the address specified. The mac register contents are read and written to buffer passed. */ s32 synopGMAC_get_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
{ u32 data; data = synopGMACReadReg(gmacdev->MacBase,MacHigh); MacAddr[5] = (data >> 8) & 0xff; MacAddr[4] = (data) & 0xff; data = synopGMACReadReg(gmacdev->MacBase,MacLow); MacAddr[3] = (data >> 24) & 0xff; MacAddr[2] = (data >> 16) & 0xff; MacAddr[1] = (data >> 8 ) & 0xff; M...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the page does not get brought uptodate, return -EIO. */
struct page* read_cache_page(struct address_space *mapping, pgoff_t index, int(*filler)(void *, struct page *), void *data)
/* If the page does not get brought uptodate, return -EIO. */ struct page* read_cache_page(struct address_space *mapping, pgoff_t index, int(*filler)(void *, struct page *), void *data)
{ return wait_on_page_read(read_cache_page_async(mapping, index, filler, data)); }
robutest/uclinux
C++
GPL-2.0
60
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the tx descriptor in tx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */
void synopGMAC_take_desc_ownership_tx(synopGMACdevice *gmacdev)
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the tx descriptor in tx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */ void synopGMAC_take_des...
{ s32 i; DmaDesc *desc; desc = gmacdev->TxDesc; for(i = 0; i < gmacdev->TxDescCount; i++){ if(synopGMAC_is_tx_desc_chained(desc)){ synopGMAC_take_desc_ownership(desc); desc = (DmaDesc *)desc->data2; } else{ synopGMAC_take_desc_ownership(desc + ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Update non-volatile variables stored on the file system. */
EFI_STATUS EFIAPI UpdateNvVarsOnFileSystem()
/* Update non-volatile variables stored on the file system. */ EFI_STATUS EFIAPI UpdateNvVarsOnFileSystem()
{ if (mNvVarsFileLibFsHandle == NULL) { return EFI_NOT_STARTED; } else { return SaveNvVarsToFs (mNvVarsFileLibFsHandle); } }
tianocore/edk2
C++
Other
4,240
/* returns: zero in case of success or a negative value if fail. */
static int fit_image_extract(const void *fit, int image_noffset, const char *file_name)
/* returns: zero in case of success or a negative value if fail. */ static int fit_image_extract(const void *fit, int image_noffset, const char *file_name)
{ const void *file_data; size_t file_size = 0; fit_image_get_data(fit, image_noffset, &file_data, &file_size); return imagetool_save_subimage(file_name, (ulong) file_data, file_size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This API is used to get the Latch interrupt in the register 0x21 bit from 0 to 3. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_latch_intr(u8 *v_latch_intr_u8)
/* This API is used to get the Latch interrupt in the register 0x21 bit from 0 to 3. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_latch_intr(u8 *v_latch_intr_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_RST_LATCH_ADD...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferAbortSendEDMA(I2S_Type *base, sai_edma_handle_t *handle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ void SAI_TransferAbortSendEDMA(I2S_Type *base, sai_edma_handle_t *handle)
{ assert(handle != NULL); EDMA_AbortTransfer(handle->dmaHandle); base->TCR3 &= ~I2S_TCR3_TCE_MASK; SAI_TxEnableDMA(base, kSAI_FIFORequestDMAEnable, false); SAI_TxEnable(base, false); if ((base->TCSR & I2S_TCSR_TE_MASK) == 0UL) { base->TCSR |= (I2S_TCSR_FR_MASK | I2S_TCSR_SR_MASK); ...
eclipse-threadx/getting-started
C++
Other
310
/* This routine is invoked by the ELS timer after timeout. It posts the ELS timer timeout event by setting the WORKER_ELS_TMO bit to the work port event bitmap and then invokes the lpfc_worker_wake_up() routine to wake up the worker thread. It is for the worker thread to invoke the routine lpfc_els_timeout_handler() to...
void lpfc_els_timeout(unsigned long ptr)
/* This routine is invoked by the ELS timer after timeout. It posts the ELS timer timeout event by setting the WORKER_ELS_TMO bit to the work port event bitmap and then invokes the lpfc_worker_wake_up() routine to wake up the worker thread. It is for the worker thread to invoke the routine lpfc_els_timeout_handler() to...
{ struct lpfc_vport *vport = (struct lpfc_vport *) ptr; struct lpfc_hba *phba = vport->phba; uint32_t tmo_posted; unsigned long iflag; spin_lock_irqsave(&vport->work_port_lock, iflag); tmo_posted = vport->work_port_events & WORKER_ELS_TMO; if (!tmo_posted) vport->work_port_events |= WORKER_ELS_TMO; spin_unl...
robutest/uclinux
C++
GPL-2.0
60
/* Deinitializes the GPIOx peripheral registers to their default reset values. */
void GPIO_DeInit(GPIO_TypeDef *GPIOx)
/* Deinitializes the GPIOx peripheral registers to their default reset values. */ void GPIO_DeInit(GPIO_TypeDef *GPIOx)
{ GPIOx->CR2 = GPIO_CR2_RESET_VALUE; GPIOx->ODR = GPIO_ODR_RESET_VALUE; GPIOx->DDR = GPIO_DDR_RESET_VALUE; GPIOx->CR1 = GPIO_CR1_RESET_VALUE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base CSI peripheral base address. param index Buffer index. param addr Frame buffer address to set. */
void CSI_SetRxBufferAddr(CSI_Type *base, uint8_t index, uint32_t addr)
/* param base CSI peripheral base address. param index Buffer index. param addr Frame buffer address to set. */ void CSI_SetRxBufferAddr(CSI_Type *base, uint8_t index, uint32_t addr)
{ if (index) { base->CSIDMASA_FB2 = addr; } else { base->CSIDMASA_FB1 = addr; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes Bernard first implementation Wangmeng sep4020 implementation */
void rt_hw_serial_putc(const char c)
/* Change Logs: Date Author Notes Bernard first implementation Wangmeng sep4020 implementation */ void rt_hw_serial_putc(const char c)
{ if (c=='\n') rt_hw_serial_putc('\r'); while (!((*(RP)UART0_LSR) & 0x40)); *(RP)(UART0_BASE) = c; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: This is the hashing function for the unlabeled hash table, it returns the bucket number for the given device/interface. The caller is responsible for calling the rcu_read_lock() functions. */
static u32 netlbl_unlhsh_hash(int ifindex)
/* Description: This is the hashing function for the unlabeled hash table, it returns the bucket number for the given device/interface. The caller is responsible for calling the rcu_read_lock() functions. */ static u32 netlbl_unlhsh_hash(int ifindex)
{ return ifindex & (rcu_dereference(netlbl_unlhsh)->size - 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set specified Event port output data port pins. */
void EP_SetPins(uint8_t u8EventPort, uint16_t u16EventPin)
/* Set specified Event port output data port pins. */ void EP_SetPins(uint8_t u8EventPort, uint16_t u16EventPin)
{ DDL_ASSERT(IS_EVENT_PORT(u8EventPort)); DDL_ASSERT(IS_EVENT_PIN(u16EventPin)); SET_REG32_BIT(PEVNTODR_REG(u8EventPort), u16EventPin); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function handles external lines 5 to 9 interrupt request. */
void EXTI9_5_IRQHandler(void)
/* This function handles external lines 5 to 9 interrupt request. */ void EXTI9_5_IRQHandler(void)
{ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_9); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Read or write specified device descriptor of a UFS device. */
EFI_STATUS UfsRwDeviceDesc(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT VOID *Descriptor, IN OUT UINT32 *DescSize)
/* Read or write specified device descriptor of a UFS device. */ EFI_STATUS UfsRwDeviceDesc(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT VOID *Descriptor, IN OUT UINT32 *DescSize)
{ UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet; EFI_STATUS Status; if (DescSize == NULL) { return EFI_INVALID_PARAMETER; } ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET)); if (Read) { Packet.DataDirection = UfsDataIn; Packet.Opcode = UtpQueryFun...
tianocore/edk2
C++
Other
4,240
/* Process new points from a input device. indev->state.pressed has to be set */
static void indev_button_proc(lv_indev_t *i, lv_indev_data_t *data)
/* Process new points from a input device. indev->state.pressed has to be set */ static void indev_button_proc(lv_indev_t *i, lv_indev_data_t *data)
{ i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x; i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y; if(i->proc.types.pointer.last_point.x == i->proc.types.pointer.act_point.x && i->proc.types.pointer.last_point.y == i->proc.types.pointer.act_point.y && data->state ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function is to write data into transmit FIFO to send data out. */
void SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
/* This function is to write data into transmit FIFO to send data out. */ void SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
{ uint32_t u32Count; for (u32Count = 0UL; u32Count != u32WriteBytes; u32Count++) { while (SCUART_GET_TX_FULL(sc)) { ; } sc->DAT = pu8TxBuf[u32Count]; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for starting Capacitive Sensor High module. Function enables one slider and one button. */
static void csense_start(void)
/* Function for starting Capacitive Sensor High module. Function enables one slider and one button. */ static void csense_start(void)
{ ret_code_t err_code; static uint16_t touched_counter = 0; err_code = nrf_csense_init(nrf_csense_handler, APP_TIMER_TICKS_TIMEOUT); APP_ERROR_CHECK(err_code); nrf_csense_instance_context_set(&m_button, (void*)&touched_counter); nrf_csense_instance_context_set(&m_slider, (void*)slider_handler); ...
remotemcu/remcu-chip-sdks
C++
null
436
/* Enables button interrupt(s) with low to high transitions. */
void halButtonsInterruptEnable(unsigned char buttonIntEnableMask)
/* Enables button interrupt(s) with low to high transitions. */ void halButtonsInterruptEnable(unsigned char buttonIntEnableMask)
{ BUTTON_PORT_IES &= ~buttonIntEnableMask; BUTTON_PORT_IFG &= ~buttonIntEnableMask; BUTTON_PORT_IE |= buttonIntEnableMask; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Select the chip. This function selects the specified chip by driving its CS line low. */
static void _mx25v_chip_select(void)
/* Select the chip. This function selects the specified chip by driving its CS line low. */ static void _mx25v_chip_select(void)
{ port_pin_set_output_level(MX25V_SPI_PIN_CS, false); }
memfault/zero-to-main
C++
null
200
/* Initiates a write packet operation. Writes a data packet to the specified slave address on the I */
enum status_code i2c_master_write_packet_job(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
/* Initiates a write packet operation. Writes a data packet to the specified slave address on the I */ enum status_code i2c_master_write_packet_job(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
{ Assert(module); Assert(module->hw); Assert(packet); if (module->buffer_remaining > 0) { return STATUS_BUSY; } module->no_stop = false; return _i2c_master_write_packet(module, packet); }
memfault/zero-to-main
C++
null
200
/* Sets the cursor to the specified X/Y position. */
void hx8347gSetCursor(const uint16_t x, const uint16_t y)
/* Sets the cursor to the specified X/Y position. */ void hx8347gSetCursor(const uint16_t x, const uint16_t y)
{ hx8347gWriteRegister(HX8347G_CMD_COLADDRSTART2, x>>8); hx8347gWriteRegister(HX8347G_CMD_COLADDRSTART1, x); hx8347gWriteRegister(HX8347G_CMD_ROWADDRSTART2, y>>8); hx8347gWriteRegister(HX8347G_CMD_ROWADDRSTART1, y); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Waits to send a character from the specified port. */
void xUARTCharPut(unsigned long ulBase, unsigned char ucData)
/* Waits to send a character from the specified port. */ void xUARTCharPut(unsigned long ulBase, unsigned char ucData)
{ UARTCharPut(ulBase, ucData); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read the GCM Authentication Tag "T" generated in AES_TAGRx registers. */
static void aes_read_gcm_auth_tag(Aes *const p_aes, uint32_t *p_auth_tag_buffer)
/* Read the GCM Authentication Tag "T" generated in AES_TAGRx registers. */ static void aes_read_gcm_auth_tag(Aes *const p_aes, uint32_t *p_auth_tag_buffer)
{ uint8_t i; for (i = 0; i < 4; i++) { p_auth_tag_buffer[i] = aes_read_tag(p_aes, i); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Checks whether the TIM interrupt has occurred or not. */
ITStatus TIM_GetITStatus(TIM_TypeDef *TIMx, uint16_t TIM_IT)
/* Checks whether the TIM interrupt has occurred or not. */ ITStatus TIM_GetITStatus(TIM_TypeDef *TIMx, uint16_t TIM_IT)
{ ITStatus bitstatus = RESET; uint16_t itstatus = 0x0, itenable = 0x0; assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_GET_IT(TIM_IT)); assert_param(IS_TIM_PERIPH_IT(TIMx, TIM_IT)); itstatus = TIMx->SR & TIM_IT; itenable = TIMx->DIER & TIM_IT; if ((itstatus != (uint16_t)RESE...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialises the fields of the file lock which are invariant for free file_locks. */
static void init_once(void *foo)
/* Initialises the fields of the file lock which are invariant for free file_locks. */ static void init_once(void *foo)
{ struct file_lock *lock = (struct file_lock *) foo; locks_init_lock(lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Given a PCI bus, returns the highest PCI bus number present in the set including the given PCI bus and its list of child PCI buses. */
unsigned char pci_bus_max_busnr(struct pci_bus *bus)
/* Given a PCI bus, returns the highest PCI bus number present in the set including the given PCI bus and its list of child PCI buses. */ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
{ struct list_head *tmp; unsigned char max, n; max = bus->subordinate; list_for_each(tmp, &bus->children) { n = pci_bus_max_busnr(pci_bus_b(tmp)); if(n > max) max = n; } return max; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is called after a PCI bus error affecting this device has been detected. */
static pci_ers_result_t bnx2_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
/* This function is called after a PCI bus error affecting this device has been detected. */ static pci_ers_result_t bnx2_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
{ struct net_device *dev = pci_get_drvdata(pdev); struct bnx2 *bp = netdev_priv(dev); rtnl_lock(); netif_device_detach(dev); if (state == pci_channel_io_perm_failure) { rtnl_unlock(); return PCI_ERS_RESULT_DISCONNECT; } if (netif_running(dev)) { bnx2_netif_stop(bp); del_timer_sync(&bp->timer); bnx2_res...
robutest/uclinux
C++
GPL-2.0
60
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector44_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector44_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (44 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Start the tcw on the given ccw device. Return zero on success, non-zero otherwise. */
int ccw_device_tm_start_timeout(struct ccw_device *cdev, struct tcw *tcw, unsigned long intparm, u8 lpm, int expires)
/* Start the tcw on the given ccw device. Return zero on success, non-zero otherwise. */ int ccw_device_tm_start_timeout(struct ccw_device *cdev, struct tcw *tcw, unsigned long intparm, u8 lpm, int expires)
{ return ccw_device_tm_start_timeout_key(cdev, tcw, intparm, lpm, PAGE_DEFAULT_KEY, expires); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: TRUE if the @mount can be ejected. */
gboolean g_mount_can_eject(GMount *mount)
/* Returns: TRUE if the @mount can be ejected. */ gboolean g_mount_can_eject(GMount *mount)
{ GMountIface *iface; g_return_val_if_fail (G_IS_MOUNT (mount), FALSE); iface = G_MOUNT_GET_IFACE (mount); return (* iface->can_eject) (mount); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ADC Enable Analog Watchdog for a Selected Channel. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */
void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t channel)
/* ADC Enable Analog Watchdog for a Selected Channel. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */ void adc_enable_analog_watchdog_on_selected_chann...
{ uint32_t reg32; reg32 = (ADC_CFGR1(adc) & ~ADC_CFGR1_AWD1CH); if (channel < 18) { reg32 |= channel; } ADC_CFGR1(adc) = reg32; ADC_CFGR1(adc) |= ADC_CFGR1_AWD1SGL; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* flush the outstanding callback breaks on a server */
void afs_flush_callback_breaks(struct afs_server *server)
/* flush the outstanding callback breaks on a server */ void afs_flush_callback_breaks(struct afs_server *server)
{ cancel_delayed_work(&server->cb_break_work); queue_delayed_work(afs_callback_update_worker, &server->cb_break_work, 0); }
robutest/uclinux
C++
GPL-2.0
60