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
/* Configure the compare data of an ADC digital comparator. */
void ADCCompDataSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulCompData, unsigned long ulMatchCnt)
/* Configure the compare data of an ADC digital comparator. */ void ADCCompDataSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulCompData, unsigned long ulMatchCnt)
{ unsigned long ulCompRegAddr; unsigned long ulConfig; xASSERT(ulBase == ADC_BASE); xASSERT((ulComp >= 0) && (ulComp < 2)); xASSERT(ulCompData < 0x1000); xASSERT(ulMatchCnt < 16); ulCompRegAddr = ulBase + ADC_CMPR0 + (4 * ulComp); ulConfig = ((ulCompData << ADC_CMPRX_CMPD_S) | ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reset ADC peripheral registers to their default reset values. */
void ADC_Reset(ADC_T *adc)
/* Reset ADC peripheral registers to their default reset values. */ void ADC_Reset(ADC_T *adc)
{ if (adc == ADC1) { RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC1); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC1); } else if (adc == ADC2) { RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC2); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC2); } else if (adc ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called after each bus is probed, but before its children are examined. */
void __devinit pcibios_fixup_bus(struct pci_bus *b)
/* Called after each bus is probed, but before its children are examined. */ void __devinit pcibios_fixup_bus(struct pci_bus *b)
{ struct pci_dev *dev; if (!b->parent) x86_pci_root_bus_res_quirks(b); pci_read_bridge_bases(b); list_for_each_entry(dev, &b->devices, bus_list) pcibios_fixup_device_resources(dev); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ReleaseVmbusChannel - Release the vmbus channel object itself */
static void ReleaseVmbusChannel(void *context)
/* ReleaseVmbusChannel - Release the vmbus channel object itself */ static void ReleaseVmbusChannel(void *context)
{ struct vmbus_channel *channel = context; DPRINT_ENTER(VMBUS); DPRINT_DBG(VMBUS, "releasing channel (%p)", channel); destroy_workqueue(channel->ControlWQ); DPRINT_DBG(VMBUS, "channel released (%p)", channel); kfree(channel); DPRINT_EXIT(VMBUS); }
robutest/uclinux
C++
GPL-2.0
60
/* The valid interrupt status bits when the USB controller is acting as a device are the following: */
void USBLPMIntEnable(uint32_t ui32Base, uint32_t ui32Ints)
/* The valid interrupt status bits when the USB controller is acting as a device are the following: */ void USBLPMIntEnable(uint32_t ui32Base, uint32_t ui32Ints)
{ ASSERT(ui32Base == USB0_BASE); HWREGB(ui32Base + USB_O_LPMIM) |= ui32Ints; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clears the selected stimer interrupt. ui32Interrupt should be the logical OR of one or more of the following values: */
void am_hal_stimer_int_clear(uint32_t ui32Interrupt)
/* Clears the selected stimer interrupt. ui32Interrupt should be the logical OR of one or more of the following values: */ void am_hal_stimer_int_clear(uint32_t ui32Interrupt)
{ AM_REGn(CTIMER, 0, STMINTCLR) = ui32Interrupt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Determine whether a counter is active. Based on gcc magic. Doesn't change at run-time. */
static int counter_active(struct gcov_info *info, unsigned int type)
/* Determine whether a counter is active. Based on gcc magic. Doesn't change at run-time. */ static int counter_active(struct gcov_info *info, unsigned int type)
{ return (1 << type) & info->ctr_mask; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Offsets are specified to support either contiguous or discontiguous memory transfers, or repeated access to a hardware register, as needed. When accessing hardware registers, both offsets are normally zero. */
void edma_set_src_index(unsigned slot, rt_int16_t src_bidx, rt_int16_t src_cidx)
/* Offsets are specified to support either contiguous or discontiguous memory transfers, or repeated access to a hardware register, as needed. When accessing hardware registers, both offsets are normally zero. */ void edma_set_src_index(unsigned slot, rt_int16_t src_bidx, rt_int16_t src_cidx)
{ unsigned ctlr; ctlr = EDMA_CTLR(slot); slot = EDMA_CHAN_SLOT(slot); if (slot < edma_cc[ctlr]->num_slots) { edma_parm_modify(ctlr, PARM_SRC_DST_BIDX, slot, 0xffff0000, src_bidx); edma_parm_modify(ctlr, PARM_SRC_DST_CIDX, slot, 0xffff0000, src_cidx); }...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SPI Enable Slave Management by Software. In slave mode the NSS hardware input is replaced by an internal software enable/disable of the slave ( */
void spi_enable_software_slave_management(uint32_t spi)
/* SPI Enable Slave Management by Software. In slave mode the NSS hardware input is replaced by an internal software enable/disable of the slave ( */ void spi_enable_software_slave_management(uint32_t spi)
{ SPI_CR1(spi) |= SPI_CR1_SSM; SPI_CR2(spi) &= ~SPI_CR2_SSOE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns true if domain policy violation warning should be printed to console. */
bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain)
/* Returns true if domain policy violation warning should be printed to console. */ bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain)
{ return tomoyo_check_flags(domain, TOMOYO_VERBOSE) != 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @acb: The adapter from which all devices should be removed. */
static void adapter_remove_and_free_all_devices(struct AdapterCtlBlk *acb)
/* @acb: The adapter from which all devices should be removed. */ static void adapter_remove_and_free_all_devices(struct AdapterCtlBlk *acb)
{ struct DeviceCtlBlk *dcb; struct DeviceCtlBlk *tmp; dprintkdbg(DBG_1, "adapter_remove_and_free_all_devices: num=%i\n", list_size(&acb->dcb_list)); list_for_each_entry_safe(dcb, tmp, &acb->dcb_list, list) adapter_remove_and_free_device(acb, dcb); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the Early Wakeup interrupt flag is set or not. */
FlagStatus WWDG_GetFlagStatus(void)
/* Checks whether the Early Wakeup interrupt flag is set or not. */ FlagStatus WWDG_GetFlagStatus(void)
{ FlagStatus bitstatus = RESET; if ((WWDG->SR) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If something weird is required to be done with link/speed, network driver is able to assign a function to implement this. May be useful for PHY's that need to be software-driven. */
int fixed_phy_set_link_update(struct phy_device *phydev, int(*link_update)(struct net_device *, struct fixed_phy_status *))
/* If something weird is required to be done with link/speed, network driver is able to assign a function to implement this. May be useful for PHY's that need to be software-driven. */ int fixed_phy_set_link_update(struct phy_device *phydev, int(*link_update)(struct net_device *, struct fixed_phy_status *))
{ struct fixed_mdio_bus *fmb = &platform_fmb; struct fixed_phy *fp; if (!link_update || !phydev || !phydev->bus) return -EINVAL; list_for_each_entry(fp, &fmb->phys, node) { if (fp->id == phydev->phy_id) { fp->link_update = link_update; fp->phydev = phydev; return 0; } } return -ENOENT; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns zero in case of success and a negative error code in case of failure. */
static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, void *buf, int len, int used_ebs)
/* This function returns zero in case of success and a negative error code in case of failure. */ static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, void *buf, int len, int used_ebs)
{ int err; if (vol->vol_type == UBI_DYNAMIC_VOLUME) { int l = ALIGN(len, ubi->min_io_size); memset(buf + len, 0xFF, l - len); len = ubi_calc_data_len(ubi, buf, l); if (len == 0) { dbg_gen("all %d bytes contain 0xFF - skip", len); return 0; } err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len); } e...
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will init timer4 for system ticks */
void rt_hw_timer_init(void)
/* This function will init timer4 for system ticks */ void rt_hw_timer_init(void)
{ *(RP)TIMER_T1LCR = 880000; *(RP)TIMER_T1CR = 0x06; rt_hw_interrupt_install(INTSRC_TIMER1, rt_timer_handler, RT_NULL, "tick"); rt_hw_interrupt_umask(INTSRC_TIMER1); *(RP)TIMER_T1CR |= 0x01; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* NOTE! You cannot set background to 1 without setting temperature and pressure You cannot set both temperature and pressure when background mode is disabled */
int16_t setOpMode(uint8_t opMode)
/* NOTE! You cannot set background to 1 without setting temperature and pressure You cannot set both temperature and pressure when background mode is disabled */ int16_t setOpMode(uint8_t opMode)
{ opMode &= DPS310__REG_MASK_OPMODE >> DPS310__REG_SHIFT_OPMODE; if (opMode == INVAL_OP_CMD_BOTH || opMode == INVAL_OP_CONT_NONE) { return DPS310__FAIL_UNKNOWN; } if (writeByte(DPS310__REG_ADR_OPMODE, opMode)) { return DPS310__FAIL_UNKNOWN; } dps310_ctx.m_opMode = (Mode)opMode; ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore. */
EFI_STATUS FindDxeCore(IN INTN FvInstance, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
/* Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore. */ EFI_STATUS FindDxeCore(IN INTN FvInstance, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
{ EFI_STATUS Status; EFI_PEI_FV_HANDLE VolumeHandle; if (FileHandle == NULL) { ASSERT (FALSE); return EFI_INVALID_PARAMETER; } *FileHandle = NULL; Status = FfsFindNextVolume (FvInstance, &VolumeHandle); if (!EFI_ERROR (Status)) { Status = FfsFindNextFile (EFI_FV_FILETYPE_FIRMWARE_VOLU...
tianocore/edk2
C++
Other
4,240
/* Asynchronous version of g_subprocess_communicate(). Complete invocation with g_subprocess_communicate_finish(). */
void g_subprocess_communicate_async(GSubprocess *subprocess, GBytes *stdin_buf, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* Asynchronous version of g_subprocess_communicate(). Complete invocation with g_subprocess_communicate_finish(). */ void g_subprocess_communicate_async(GSubprocess *subprocess, GBytes *stdin_buf, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ g_return_if_fail (G_IS_SUBPROCESS (subprocess)); g_return_if_fail (stdin_buf == NULL || (subprocess->flags & G_SUBPROCESS_FLAGS_STDIN_PIPE)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); g_subprocess_communicate_internal (subprocess, FALSE, stdin_buf, cancellable, callback, user_d...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ HAL_SuspendTick(); BSP_LED_On(LED2); while (1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
{ BOOLEAN Flag; Flag = FilterBeforeMmIoWrite (FilterWidth8, Address, &Value); if (Flag) { *(volatile UINT8 *)Address = Value; } FilterAfterMmIoWrite (FilterWidth8, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* 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 Vector26_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 Vector26_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (26 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read SFH7770 device ID and revision numbers. This function reads the sensor hardware identification registers and returns these values in the specified data structure. */
static bool sfh7770_device_id(sensor_hal_t *hal, sensor_data_t *data)
/* Read SFH7770 device ID and revision numbers. This function reads the sensor hardware identification registers and returns these values in the specified data structure. */ static bool sfh7770_device_id(sensor_hal_t *hal, sensor_data_t *data)
{ uint8_t const part_id = sensor_bus_get(hal, SFH7770_PART_ID); data->device.id = (uint32_t)(part_id & PART_ID_MASK) >> PART_ID_SHIFT; data->device.version = (uint32_t)(part_id & PART_REV_MASK); return true; }
memfault/zero-to-main
C++
null
200
/* FDCAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan)
/* FDCAN MSP Initialization This function configures the hardware resources used in this example. */ void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(hfdcan->Instance==FDCAN1) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_FDCAN; PeriphClkInit.FdcanClockSelection = RCC_FDCANCLKSOURCE_PLL; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { ...
feaser/openblt
C++
GNU General Public License v3.0
601
/* PTP_GetStorageIDs Gets Storage Ids and fills stor_ids structure. */
static void PTP_GetStorageIDs(USBH_HandleTypeDef *phost, PTP_StorageIDsTypedef *stor_ids)
/* PTP_GetStorageIDs Gets Storage Ids and fills stor_ids structure. */ static void PTP_GetStorageIDs(USBH_HandleTypeDef *phost, PTP_StorageIDsTypedef *stor_ids)
{ MTP_HandleTypeDef *MTP_Handle = (MTP_HandleTypeDef *)phost->pActiveClass->pData; uint8_t *data = MTP_Handle->ptp.data_container.payload.data; stor_ids->n = PTP_GetArray32 (stor_ids->Storage, data, 0); }
labapart/polymcu
C++
null
201
/* 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 Vector4_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 Vector4_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (4 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* C-Media CM6206 is based on CM106 with two additional registers that are not documented in the data sheet. Values here are chosen based on sniffing USB traffic under Windows. */
static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
/* C-Media CM6206 is based on CM106 with two additional registers that are not documented in the data sheet. Values here are chosen based on sniffing USB traffic under Windows. */ static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
{ int err, reg; int val[] = {0x200c, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000}; for (reg = 0; reg < ARRAY_SIZE(val); reg++) { err = snd_usb_cm106_write_int_reg(dev, reg, val[reg]); if (err < 0) return err; } return err; }
robutest/uclinux
C++
GPL-2.0
60
/* @msg: Padded message @pad_len: Number of expected padding bytes @algo: Checksum algo structure having information on DER encoding etc. */
static int rsa_verify_padding(const uint8_t *msg, const int pad_len, struct checksum_algo *algo)
/* @msg: Padded message @pad_len: Number of expected padding bytes @algo: Checksum algo structure having information on DER encoding etc. */ static int rsa_verify_padding(const uint8_t *msg, const int pad_len, struct checksum_algo *algo)
{ int ff_len; int ret; ret = *msg++; ret |= *msg++ ^ 0x01; ff_len = pad_len - algo->der_len - 3; ret |= *msg ^ 0xff; ret |= memcmp(msg, msg+1, ff_len-1); msg += ff_len; ret |= *msg++; ret |= memcmp(msg, algo->der_prefix, algo->der_len); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Note: the specific put_char operation in the driver layer may go away soon. Don't call it directly, use this method */
int tty_put_char(struct tty_struct *tty, unsigned char ch)
/* Note: the specific put_char operation in the driver layer may go away soon. Don't call it directly, use this method */ int tty_put_char(struct tty_struct *tty, unsigned char ch)
{ if (tty->ops->put_char) return tty->ops->put_char(tty, ch); return tty->ops->write(tty, &ch, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables CAN FD interrupts according to provided mask . */
void CANFD_EnableInt(CANFD_T *psCanfd, uint32_t u32IntLine0, uint32_t u32IntLine1, uint32_t u32TXBTIE, uint32_t u32TXBCIE)
/* Enables CAN FD interrupts according to provided mask . */ void CANFD_EnableInt(CANFD_T *psCanfd, uint32_t u32IntLine0, uint32_t u32IntLine1, uint32_t u32TXBTIE, uint32_t u32TXBCIE)
{ psCanfd->IE = CANFD_ReadReg(&psCanfd->IE) | u32IntLine0 | u32IntLine1; if (u32IntLine0 != 0) { psCanfd->ILS = CANFD_ReadReg(&psCanfd->ILS) & ~u32IntLine0; psCanfd->ILE = CANFD_ReadReg(&psCanfd->ILE) | CANFD_ILE_ENT0_Msk; } if (u32IntLine1 != 0) { psCanfd->ILS = CANFD_Re...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* I2S MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s)
/* I2S MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s)
{ if(hi2s->Instance==SPI2) { __HAL_RCC_SPI2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_15); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_6); HAL_GPIO_DeInit(GPIOI, GPIO_PIN_2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is to display the IPv6 address. */
VOID PxeBcShowIp6Addr(IN EFI_IPv6_ADDRESS *Ip)
/* This function is to display the IPv6 address. */ VOID PxeBcShowIp6Addr(IN EFI_IPv6_ADDRESS *Ip)
{ UINTN Index; for (Index = 0; Index < 16; Index++) { if (Ip->Addr[Index] != 0) { AsciiPrint ("%x", Ip->Addr[Index]); } Index++; if (Index > 15) { return; } if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) { AsciiPrint ("0"); } AsciiPrint ("%x", I...
tianocore/edk2
C++
Other
4,240
/* This CS4270 registers are cached to avoid excessive I2C I/O operations. After the initial read to pre-fill the cache, the CS4270 never updates the register values, so we won't have a cache coherency problem. */
static unsigned int cs4270_read_reg_cache(struct snd_soc_codec *codec, unsigned int reg)
/* This CS4270 registers are cached to avoid excessive I2C I/O operations. After the initial read to pre-fill the cache, the CS4270 never updates the register values, so we won't have a cache coherency problem. */ static unsigned int cs4270_read_reg_cache(struct snd_soc_codec *codec, unsigned int reg)
{ u8 *cache = codec->reg_cache; if ((reg < CS4270_FIRSTREG) || (reg > CS4270_LASTREG)) return -EIO; return cache[reg - CS4270_FIRSTREG]; }
robutest/uclinux
C++
GPL-2.0
60
/* Config the slave select pins of the specified SPI port. The */
void SPISSConfig(unsigned long ulBase, unsigned long ulSSTriggerMode, unsigned long ulSSActType)
/* Config the slave select pins of the specified SPI port. The */ void SPISSConfig(unsigned long ulBase, unsigned long ulSSTriggerMode, unsigned long ulSSActType)
{ xASSERT(ulBase == SPI0_BASE); xASSERT((ulSSTriggerMode == SPI_SS_EDGE_TRIGGER) || (ulSSTriggerMode == SPI_SS_LEVEL_TRIGGER)); xASSERT((ulSSActType == SPI_SS_ACTIVE_LOW_FALLING) || (ulSSActType == SPI_SS_ACTIVE_HIGH_RISING)); xHWREG(ulBase + SPI_SSR) &= ~(SPI_SS_LEVEL_TRIGGER ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* clean up after reading from the cells list */
static void afs_proc_cells_stop(struct seq_file *p, void *v)
/* clean up after reading from the cells list */ static void afs_proc_cells_stop(struct seq_file *p, void *v)
{ up_read(&afs_proc_cells_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* this is a generic routine for printing unknown data; we pass on the linefeed plus indentation string to get a proper output - returns 0 on error */
int print_unknown_data(netdissect_options *ndo, const u_char *cp, const char *ident, int len)
/* this is a generic routine for printing unknown data; we pass on the linefeed plus indentation string to get a proper output - returns 0 on error */ int print_unknown_data(netdissect_options *ndo, const u_char *cp, const char *ident, int len)
{ if (len < 0) { ND_PRINT((ndo,"%sDissector error: print_unknown_data called with negative length", ident)); return(0); } if (ndo->ndo_snapend - cp < len) len = ndo->ndo_snapend - cp; if (len < 0) { ND_PRINT((ndo,"%sDissector error: print_unknown_data called with pointer past end of pa...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function deletes PEB @pnum from the protection queue and returns zero in case of success and %-ENODEV if the PEB was not found. */
static int prot_queue_del(struct ubi_device *ubi, int pnum)
/* This function deletes PEB @pnum from the protection queue and returns zero in case of success and %-ENODEV if the PEB was not found. */ static int prot_queue_del(struct ubi_device *ubi, int pnum)
{ struct ubi_wl_entry *e; e = ubi->lookuptbl[pnum]; if (!e) return -ENODEV; if (paranoid_check_in_pq(ubi, e)) return -ENODEV; list_del(&e->u.list); dbg_wl("deleted PEB %d from the protection queue", e->pnum); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Called to read bytes from the open IRouter pipe. */
static int read_status_check(struct subch_data_s *sd, int *len)
/* Called to read bytes from the open IRouter pipe. */ static int read_status_check(struct subch_data_s *sd, int *len)
{ return ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch, sd->sd_rb, len); }
robutest/uclinux
C++
GPL-2.0
60
/* Routine to get the next Handle, when you are searching for all handles. */
IHANDLE* MmGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
/* Routine to get the next Handle, when you are searching for all handles. */ IHANDLE* MmGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
{ IHANDLE *Handle; Position->Position = Position->Position->ForwardLink; Handle = NULL; *Interface = NULL; if (Position->Position != &gHandleList) { Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE); } return Handle; }
tianocore/edk2
C++
Other
4,240
/* Wait until there is room in the tx fifo. */
static status_t LPI2C_MasterWaitForTxReady(LPI2C_Type *base)
/* Wait until there is room in the tx fifo. */ static status_t LPI2C_MasterWaitForTxReady(LPI2C_Type *base)
{ uint32_t status; size_t txCount; size_t txFifoSize = FSL_FEATURE_LPI2C_FIFO_SIZEn(base); do { status_t result; LPI2C_MasterGetFifoCounts(base, NULL, &txCount); txCount = txFifoSize - txCount; status = LPI2C_MasterGetStatusFlags(base); result = LPI2C_MasterCh...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* pci_clear_master - disables bus-mastering for device dev @dev: the PCI device to disable */
void pci_clear_master(struct pci_dev *dev)
/* pci_clear_master - disables bus-mastering for device dev @dev: the PCI device to disable */ void pci_clear_master(struct pci_dev *dev)
{ __pci_set_master(dev, false); }
robutest/uclinux
C++
GPL-2.0
60
/* Reset the input device and optionally run diagnostics */
EFI_STATUS EFIAPI VirtualKeyboardResetEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* Reset the input device and optionally run diagnostics */ EFI_STATUS EFIAPI VirtualKeyboardResetEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ VIRTUAL_KEYBOARD_DEV *VirtualKeyboardPrivate; EFI_STATUS Status; EFI_TPL OldTpl; VirtualKeyboardPrivate = TEXT_INPUT_EX_VIRTUAL_KEYBOARD_DEV_FROM_THIS (This); Status = VirtualKeyboardPrivate->SimpleTextIn.Reset ( &VirtualKeyboardPri...
tianocore/edk2
C++
Other
4,240
/* In VirtIo 1.0, a device can reject a self-inconsistent feature bitmap through the new VSTAT_FEATURES_OK status bit. (For example if the driver requests a higher level feature but clears a prerequisite feature.) This function is a small wrapper around VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures() that also verifies if th...
EFI_STATUS EFIAPI Virtio10WriteFeatures(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN UINT64 Features, IN OUT UINT8 *DeviceStatus)
/* In VirtIo 1.0, a device can reject a self-inconsistent feature bitmap through the new VSTAT_FEATURES_OK status bit. (For example if the driver requests a higher level feature but clears a prerequisite feature.) This function is a small wrapper around VIRTIO_DEVICE_PROTOCOL.SetGuestFeatures() that also verifies if th...
{ EFI_STATUS Status; if (VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0, 0)) { return EFI_UNSUPPORTED; } Status = VirtIo->SetGuestFeatures (VirtIo, Features); if (EFI_ERROR (Status)) { return Status; } *DeviceStatus |= VSTAT_FEATURES_OK; Status = VirtIo->SetDeviceStatus (VirtIo, *DeviceS...
tianocore/edk2
C++
Other
4,240
/* Returns the current speed of the USB device connected. */
unsigned long USBHostSpeedGet(unsigned long ulBase)
/* Returns the current speed of the USB device connected. */ unsigned long USBHostSpeedGet(unsigned long ulBase)
{ ASSERT(ulBase == USB0_BASE); if(HWREGB(ulBase + USB_O_DEVCTL) & USB_DEVCTL_FSDEV) { return(USB_FULL_SPEED); } if(HWREGB(ulBase + USB_O_DEVCTL) & USB_DEVCTL_LSDEV) { return(USB_LOW_SPEED); } return(USB_UNDEF_SPEED); }
watterott/WebRadio
C++
null
71
/* This function enables the averaging for the specified channels in the ADC Channel Averaging Enable Sequencer Registers. The sequencer must be disabled before writing to these regsiters. */
int XAdcPs_SetSeqAvgEnables(XAdcPs *InstancePtr, u32 AvgEnableChMask)
/* This function enables the averaging for the specified channels in the ADC Channel Averaging Enable Sequencer Registers. The sequencer must be disabled before writing to these regsiters. */ int XAdcPs_SetSeqAvgEnables(XAdcPs *InstancePtr, u32 AvgEnableChMask)
{ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); if ((XAdcPs_GetSequencerMode(InstancePtr) != XADCPS_SEQ_MODE_SAFE)) { return XST_FAILURE; } XAdcPs_WriteInternalReg(InstancePtr, XADCPS_SEQ02_OFFSET, (AvgEnableChMask & XADCPS_SEQ02_CH_VALID_MASK)...
ua1arn/hftrx
C++
null
69
/* param handle UART handle pointer. return Length of received data in RX ring buffer. */
size_t UART_TransferGetRxRingBufferLength(uart_handle_t *handle)
/* param handle UART handle pointer. return Length of received data in RX ring buffer. */ size_t UART_TransferGetRxRingBufferLength(uart_handle_t *handle)
{ assert(handle); size_t size; if (handle->rxRingBufferTail > handle->rxRingBufferHead) { size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail); } else { size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail); } ...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Main function. Execution starts here. Support and FAQ: visit */
int main(void)
/* Main function. Execution starts here. Support and FAQ: visit */ int main(void)
{ sysclk_init(); irq_initialize_vectors(); cpu_irq_enable(); sleepmgr_init(); board_init(); ui_init(); uhc_start(); while (true) { sleepmgr_enter_sleep(); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Given the host-byte-order value of the checksum field in a packet header, and the network-byte-order computed checksum of the data that the checksum covers (including the checksum itself), compute what the checksum field */
uint16_t in_cksum_shouldbe(uint16_t sum, uint16_t computed_sum)
/* Given the host-byte-order value of the checksum field in a packet header, and the network-byte-order computed checksum of the data that the checksum covers (including the checksum itself), compute what the checksum field */ uint16_t in_cksum_shouldbe(uint16_t sum, uint16_t computed_sum)
{ uint32_t shouldbe; shouldbe = sum; shouldbe += ntohs(computed_sum); shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16); shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16); return shouldbe; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* set the priority group , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void nvic_priority_group_set(uint32_t nvic_prigroup)
/* set the priority group , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void nvic_priority_group_set(uint32_t nvic_prigroup)
{ SCB->AIRCR = NVIC_AIRCR_VECTKEY_MASK | nvic_prigroup; }
liuxuming/trochili
C++
Apache License 2.0
132
/* For all the GPIO banks, save the state of each one ready for going into a suspend mode. */
void s3c_pm_save_gpios(void)
/* For all the GPIO banks, save the state of each one ready for going into a suspend mode. */ void s3c_pm_save_gpios(void)
{ struct s3c_gpio_chip *ourchip; unsigned int gpio_nr; for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) { ourchip = s3c_gpiolib_getchip(gpio_nr); if (!ourchip) continue; s3c_pm_save_gpio(ourchip); S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n", ourchip->chip.label, ourchip->pm_save[0], ourc...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
struct isl_map* isl_pip_basic_map_lexopt(struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty, int max)
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ struct isl_map* isl_pip_basic_map_lexopt(struct isl_basic_map *bmap, struct isl_basic_set *dom, struct isl_set **empty, int max)
{ isl_basic_map_free(bmap); isl_basic_set_free(dom); return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is the handler for Repeat Key event triggered by timer. After a repeatable key is pressed, the event would be triggered with interval of USBKBD_REPEAT_DELAY. Once the event is triggered, following trigger will come with interval of USBKBD_REPEAT_RATE. */
VOID EFIAPI USBKeyboardRepeatHandler(IN EFI_EVENT Event, IN VOID *Context)
/* This function is the handler for Repeat Key event triggered by timer. After a repeatable key is pressed, the event would be triggered with interval of USBKBD_REPEAT_DELAY. Once the event is triggered, following trigger will come with interval of USBKBD_REPEAT_RATE. */ VOID EFIAPI USBKeyboardRepeatHandler(IN EFI_EVEN...
{ USB_KB_DEV *UsbKeyboardDevice; USB_KEY UsbKey; UsbKeyboardDevice = (USB_KB_DEV *)Context; if (UsbKeyboardDevice->RepeatKey != 0) { UsbKey.KeyCode = UsbKeyboardDevice->RepeatKey; UsbKey.Down = TRUE; Enqueue (&UsbKeyboardDevice->UsbKeyQueue, &UsbKey, sizeof (UsbKey)); gBS->SetTimer ( ...
tianocore/edk2
C++
Other
4,240
/* Parse a certain dhcp4 option by OptTag in Buffer, and return with start pointer. */
EFI_DHCP4_PACKET_OPTION* PxeBcParseDhcp4Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
/* Parse a certain dhcp4 option by OptTag in Buffer, and return with start pointer. */ EFI_DHCP4_PACKET_OPTION* PxeBcParseDhcp4Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT8 OptTag)
{ EFI_DHCP4_PACKET_OPTION *Option; UINT32 Offset; Option = (EFI_DHCP4_PACKET_OPTION *)Buffer; Offset = 0; while (Offset < Length && Option->OpCode != DHCP4_TAG_EOP) { if (Option->OpCode == OptTag) { return Option; } if (Option->OpCode == DHCP4_TAG_PAD) { Offset++; ...
tianocore/edk2
C++
Other
4,240
/* All the status bit, FIFO and data generation. */
int32_t lps22hb_dev_status_get(stmdev_ctx_t *ctx, lps22hb_dev_stat_t *val)
/* All the status bit, FIFO and data generation. */ int32_t lps22hb_dev_status_get(stmdev_ctx_t *ctx, lps22hb_dev_stat_t *val)
{ int32_t ret; ret = lps22hb_read_reg(ctx, LPS22HB_FIFO_STATUS, (uint8_t*) val, 2); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Release a connection structure and remove it from the list of netiucv connections. */
static void netiucv_remove_connection(struct iucv_connection *conn)
/* Release a connection structure and remove it from the list of netiucv connections. */ static void netiucv_remove_connection(struct iucv_connection *conn)
{ IUCV_DBF_TEXT(trace, 3, __func__); write_lock_bh(&iucv_connection_rwlock); list_del_init(&conn->list); write_unlock_bh(&iucv_connection_rwlock); fsm_deltimer(&conn->timer); netiucv_purge_skb_queue(&conn->collect_queue); if (conn->path) { iucv_path_sever(conn->path, iucvMagic); kfree(conn->path); conn->pa...
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciOr16(IN UINTN Address, IN UINT16 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciOr16(IN UINTN Address, IN UINT16 OrData)
{ return PciExpressOr16 (Address, OrData); }
tianocore/edk2
C++
Other
4,240
/* This function detaches the attached driver (if any) for the given device and restarts the driver probing process. It is intended to use if probing criteria changed during a devices lifetime and driver attachment should change accordingly. */
int device_reprobe(struct device *dev)
/* This function detaches the attached driver (if any) for the given device and restarts the driver probing process. It is intended to use if probing criteria changed during a devices lifetime and driver attachment should change accordingly. */ int device_reprobe(struct device *dev)
{ if (dev->driver) { if (dev->parent) down(&dev->parent->sem); device_release_driver(dev); if (dev->parent) up(&dev->parent->sem); } return bus_rescan_devices_helper(dev, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Fill the gain array for the timedomain quantization. */
static void decode_gain_info(GetBitContext *gb, int *gaininfo)
/* Fill the gain array for the timedomain quantization. */ static void decode_gain_info(GetBitContext *gb, int *gaininfo)
{ int i, n; while (get_bits1(gb)) {} n = get_bits_count(gb) - 1; i = 0; while (n--) { int index = get_bits(gb, 3); int gain = get_bits1(gb) ? get_bits(gb, 4) - 7 : -1; while (i <= index) gaininfo[i++] = gain; } while (i <= 8) gaininfo[i++] = 0; }
DC-SWAT/DreamShell
C++
null
404
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ while(1) { BSP_LED_Toggle(LED3); HAL_Delay(100); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Initialize the HAL timer structure with the callback and the callback argument. Also initializes the HW specific timer pointer. */
int hal_timer_set_cb(int timer_num, struct hal_timer *timer, hal_timer_cb cb_func, void *arg)
/* Initialize the HAL timer structure with the callback and the callback argument. Also initializes the HW specific timer pointer. */ int hal_timer_set_cb(int timer_num, struct hal_timer *timer, hal_timer_cb cb_func, void *arg)
{ int rc; struct nrf52_hal_timer *bsptimer; NRF52_HAL_TIMER_RESOLVE(timer_num, bsptimer); timer->cb_func = cb_func; timer->cb_arg = arg; timer->link.tqe_prev = NULL; timer->bsp_timer = bsptimer; rc = 0; err: return rc; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Initialize the specified tsb by resetting all values to zero. */
void tsb_init(struct tsb *tsb)
/* Initialize the specified tsb by resetting all values to zero. */ void tsb_init(struct tsb *tsb)
{ memset(tsb, 0, sizeof(*tsb)); }
robutest/uclinux
C++
GPL-2.0
60
/* The main entry for NAND booting. It's necessary that SDRAM is already configured and available since this code loads the main U-Boot image from NAND into SDRAM and starts it from there. */
void nand_boot(void)
/* The main entry for NAND booting. It's necessary that SDRAM is already configured and available since this code loads the main U-Boot image from NAND into SDRAM and starts it from there. */ void nand_boot(void)
{ __attribute__((noreturn)) void (*uboot)(void); nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (uchar *)CONFIG_SYS_NAND_U_BOOT_DST); puts("transfering control\n"); flush_cache(CONFIG_SYS_NAND_U_BOOT_DST, CONFIG_SYS_NAND_U_BOOT_SIZE); uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; u...
EmcraftSystems/u-boot
C++
Other
181
/* Set a series of bytes with a random number. Individual bytes are not zero. */
int ICACHE_FLASH_ATTR get_random_NZ(int num_rand_bytes, uint8_t *rand_data)
/* Set a series of bytes with a random number. Individual bytes are not zero. */ int ICACHE_FLASH_ATTR get_random_NZ(int num_rand_bytes, uint8_t *rand_data)
{ int i; if (get_random(num_rand_bytes, rand_data)) return -1; for (i = 0; i < num_rand_bytes; i++) { while (rand_data[i] == 0) rand_data[i] = (uint8_t)(os_random()); } return 0; }
eerimoq/simba
C++
Other
337
/* What prevents a rget to race with a rput? The count must never drop to zero while it is in use. Only rput if it is ok that it is free'd. */
static void smb_rget(struct smb_request *req)
/* What prevents a rget to race with a rput? The count must never drop to zero while it is in use. Only rput if it is ok that it is free'd. */ static void smb_rget(struct smb_request *req)
{ atomic_inc(&req->rq_count); }
robutest/uclinux
C++
GPL-2.0
60
/* Configure the host BARs of the PCIe controller root port so that PCI(e) devices may access the system memory. */
static void pcie_dw_set_host_bars(const void *regs_base)
/* Configure the host BARs of the PCIe controller root port so that PCI(e) devices may access the system memory. */ static void pcie_dw_set_host_bars(const void *regs_base)
{ u32 size = gd->ram_size; u64 max_size; u32 reg; u32 bar0; reg = readl(regs_base + RESIZABLE_BAR_CAP); max_size = 1ULL << (5 + (reg + (1 << 4))); if (size > max_size) { size = max_size; printf("Warning: PCIe BARs can't map all DRAM space\n"); } bar0 = CONFIG_SYS_SDRAM_BASE & ~0xf; bar0 |= PCI_BASE_ADDRES...
4ms/stm32mp1-baremetal
C++
Other
137
/* Set Threshold register. set the threshold register in the NVIC. */
void drv_nvic_set_threshold(uint32_t VectThreshold, uint32_t PrioThreshold)
/* Set Threshold register. set the threshold register in the NVIC. */ void drv_nvic_set_threshold(uint32_t VectThreshold, uint32_t PrioThreshold)
{ NVIC->IPTR = 0x80000000 | (((VectThreshold + 32) & 0xFF) << 8) | ((PrioThreshold & 0x3) << 6); }
pikasTech/PikaPython
C++
MIT License
1,403
/* USBH_MSC_InterfaceDeInit The function DeInit the Pipes used for the MSC class. */
USBH_StatusTypeDef USBH_MSC_InterfaceDeInit(USBH_HandleTypeDef *phost)
/* USBH_MSC_InterfaceDeInit The function DeInit the Pipes used for the MSC class. */ USBH_StatusTypeDef USBH_MSC_InterfaceDeInit(USBH_HandleTypeDef *phost)
{ MSC_HandleTypeDef *MSC_Handle = (MSC_HandleTypeDef *) phost->pActiveClass->pData; if ( MSC_Handle->OutPipe) { USBH_ClosePipe(phost, MSC_Handle->OutPipe); USBH_FreePipe (phost, MSC_Handle->OutPipe); MSC_Handle->OutPipe = 0; } if ( MSC_Handle->InPipe) { USBH_ClosePipe(phost, MSC_Handle->In...
labapart/polymcu
C++
null
201
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs1PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ bool CLOCK_EnableUsbhs1PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
{ static const clock_usb_pll_config_t g_ccmConfigUsbPll = {.loopDivider = 0U}; CLOCK_InitUsb2Pll(&g_ccmConfigUsbPll); USBPHY2->CTRL &= ~USBPHY_CTRL_SFTRST_MASK; USBPHY2->CTRL &= ~USBPHY_CTRL_CLKGATE_MASK; USBPHY2->PWD = 0; USBPHY2->CTRL |= USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK | USBPHY_CTRL_ENAUTOC...
eclipse-threadx/getting-started
C++
Other
310
/* Returns a boolean to indicate whether SEV-ES is enabled. */
BOOLEAN EFIAPI MemEncryptSevEsIsEnabled(VOID)
/* Returns a boolean to indicate whether SEV-ES is enabled. */ BOOLEAN EFIAPI MemEncryptSevEsIsEnabled(VOID)
{ MSR_SEV_STATUS_REGISTER Msr; Msr.Uint32 = InternalMemEncryptSevStatus (); return Msr.Bits.SevEsBit ? TRUE : FALSE; }
tianocore/edk2
C++
Other
4,240
/* Atomically swap in the new signal mask, and wait for a signal. */
asmlinkage int do_sigsuspend(struct pt_regs *regs)
/* Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int do_sigsuspend(struct pt_regs *regs)
{ old_sigset_t mask = regs->d3; sigset_t saveset; mask &= _BLOCKABLE; saveset = current->blocked; siginitset(&current->blocked, mask); recalc_sigpending(); regs->d0 = -EINTR; while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); if (do_signal(&saveset, regs)) return -EINTR; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note: This is not the best behavior for an actual product because uninteresting peers could cause important bonds to be deleted. This is useful for demonstrations and sample apps. */
int ble_store_util_status_rr(struct ble_store_status_event *event, void *arg)
/* Note: This is not the best behavior for an actual product because uninteresting peers could cause important bonds to be deleted. This is useful for demonstrations and sample apps. */ int ble_store_util_status_rr(struct ble_store_status_event *event, void *arg)
{ switch (event->event_code) { case BLE_STORE_EVENT_OVERFLOW: switch (event->overflow.obj_type) { case BLE_STORE_OBJ_TYPE_OUR_SEC: case BLE_STORE_OBJ_TYPE_PEER_SEC: return ble_gap_unpair_oldest_peer(); case BLE_STORE_OBJ_TYPE_CCCD: return ble_gap_unpair_ol...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* I2C MSP Initialization This function configures the hardware resources used in this example: */
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP Initialization This function configures the hardware resources used in this example: */ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
{ GPIO_InitTypeDef GPIO_InitStruct; I2Cx_SCL_GPIO_CLK_ENABLE(); I2Cx_SDA_GPIO_CLK_ENABLE(); I2Cx_CLK_ENABLE(); GPIO_InitStruct.Pin = I2Cx_SCL_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Fills each DAC_Config_T member with its default value. */
void DAC_ConfigStructInit(DAC_Config_T *dacConfig)
/* Fills each DAC_Config_T member with its default value. */ void DAC_ConfigStructInit(DAC_Config_T *dacConfig)
{ dacConfig->trigger = DAC_TRIGGER_NONE; dacConfig->waveGeneration = DAC_WAVE_GENERATION_NONE; dacConfig->maskAmplitudeSelect = DAC_LFSR_MASK_BIT11_1; dacConfig->outputBuffer = DAC_OUTPUT_BUFFER_ENBALE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize the advertising functionality of a BLE device. This should be called once on initialization */
void ble_ll_adv_init(void)
/* Initialize the advertising functionality of a BLE device. This should be called once on initialization */ void ble_ll_adv_init(void)
{ int i; for (i = 0; i < BLE_ADV_INSTANCES; ++i) { ble_ll_adv_sm_init(&g_ble_ll_adv_sm[i]); } }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Write the GPIO group data(status) for bit. @method GPIO_Write */
void GPIO_Write(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
/* Write the GPIO group data(status) for bit. @method GPIO_Write */ void GPIO_Write(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
{ _ASSERT(IS_GPIO_PORT(GPIOx)); _ASSERT(IS_GPIO_PIN(GPIO_Pin)); GPIO_SetBits(GPIOx, GPIO_Pin); GPIO_ResetBits(GPIOx, (GPIO_Pin_TypeDef)(~GPIO_Pin)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief Return Frequency of High-Freq output of FRO return Frequency of High-Freq output of FRO */
static uint32_t CLOCK_GetFroHfFreq(void)
/* brief Return Frequency of High-Freq output of FRO return Frequency of High-Freq output of FRO */ static uint32_t CLOCK_GetFroHfFreq(void)
{ uint32_t freq; if ((SCG0->FIRCCSR & SCG_FIRCCSR_FIRCEN_MASK) == 0UL) { freq = 0; } else if ((SCG0->FIRCCFG & SCG_FIRCCFG_RANGE_MASK) != 0UL) { freq = 144000000U; } else { freq = 48000000U; } return freq; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
{ boottime = systable->boottime; image_handle = img_handle; return EFI_ST_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function return a pointer to a string that contains the message of error. */
const char* rt_strerror(rt_err_t error)
/* This function return a pointer to a string that contains the message of error. */ const char* rt_strerror(rt_err_t error)
{ int i = 0; if (error < 0) error = -error; for (i = 0; i < sizeof(rt_errno_strs) / sizeof(rt_errno_strs[0]); i++) { if (rt_errno_strs[i].error == error) return rt_errno_strs[i].str; } return "EUNKNOW"; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Causes a blocking delay for 'ticks' on the timer. For example: delay(100) would cause a blocking delay for 100 ticks of the timer. */
void delay(uint32_t ticks)
/* Causes a blocking delay for 'ticks' on the timer. For example: delay(100) would cause a blocking delay for 100 ticks of the timer. */ void delay(uint32_t ticks)
{ uint32_t curTicks; curTicks = delayTicks; if (ticks == 0) return; if (curTicks > 0xFFFFFFFF - ticks) { while (delayTicks >= curTicks) { while (delayTicks < (ticks - (0xFFFFFFFF - curTicks))); } } else { while ((delayTicks - curTicks) < ticks); } }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Find a connected ROSE socket given my LCI and device. */
struct sock* rose_find_socket(unsigned int lci, struct rose_neigh *neigh)
/* Find a connected ROSE socket given my LCI and device. */ struct sock* rose_find_socket(unsigned int lci, struct rose_neigh *neigh)
{ struct sock *s; struct hlist_node *node; spin_lock_bh(&rose_list_lock); sk_for_each(s, node, &rose_list) { struct rose_sock *rose = rose_sk(s); if (rose->lci == lci && rose->neighbour == neigh) goto found; } s = NULL; found: spin_unlock_bh(&rose_list_lock); return s; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the states of the RTS modem control signals and trigger level. The */
void UARTModemControlSet(unsigned long ulBase, unsigned long ulControl)
/* Sets the states of the RTS modem control signals and trigger level. The */ void UARTModemControlSet(unsigned long ulBase, unsigned long ulControl)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + USART_MCR) |= USART_MCR_HFC_EN; xHWREG(ulBase + USART_MCR) &= 0xFFFFFFFC; xHWREG(ulBase + USART_MCR) |= ulControl; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function will post an message to usb message queue, */
rt_err_t rt_usbd_post_event(struct udev_msg *msg, rt_size_t size)
/* This function will post an message to usb message queue, */ rt_err_t rt_usbd_post_event(struct udev_msg *msg, rt_size_t size)
{ RT_ASSERT(msg != RT_NULL); return rt_mq_send(&usb_mq, (void *)msg, size); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
{ GPIO_InitTypeDef GPIO_InitStruct; __HAL_RCC_TIM3_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Alternate = GPIO_AF2_TIM3; GPIO_InitStruct.Pin = GPIO_PIN_6; HAL_GPIO_In...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Shrink the dcache for the specified super block. This is used to free the dcache before unmounting a file system */
void shrink_dcache_sb(struct super_block *sb)
/* Shrink the dcache for the specified super block. This is used to free the dcache before unmounting a file system */ void shrink_dcache_sb(struct super_block *sb)
{ __shrink_dcache_sb(sb, NULL, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Update the data pointers according to the number of bytes transferred on the SCSI bus. */
static void fas216_cleanuptransfer(FAS216_Info *info)
/* Update the data pointers according to the number of bytes transferred on the SCSI bus. */ static void fas216_cleanuptransfer(FAS216_Info *info)
{ unsigned long total, residual, fifo; fasdmatype_t dmatype = info->dma.transfer_type; info->dma.transfer_type = fasdma_none; if (dmatype == fasdma_pio || dmatype == fasdma_none) return; if (dmatype == fasdma_real_all) total = info->scsi.SCp.phase; else total = info->scsi.SCp.this_residual; residual = fas2...
robutest/uclinux
C++
GPL-2.0
60
/* The function releases particular strings into the structure instance. */
STATIC VOID FreeInformationData(IN EFI_REDFISH_DISCOVERED_INFORMATION *Information)
/* The function releases particular strings into the structure instance. */ STATIC VOID FreeInformationData(IN EFI_REDFISH_DISCOVERED_INFORMATION *Information)
{ if (Information->Location != NULL) { FreePool (Information->Location); Information->Location = NULL; } if (Information->Uuid != NULL) { FreePool (Information->Uuid); Information->Uuid = NULL; } if (Information->Os != NULL) { FreePool (Information->Os); Information->Os = NULL; } i...
tianocore/edk2
C++
Other
4,240
/* Selects the reverse operation to be performed on input data. */
void CRC_SelectReverseInputData(CRC_REVERSE_INPUT_DATA_T revInData)
/* Selects the reverse operation to be performed on input data. */ void CRC_SelectReverseInputData(CRC_REVERSE_INPUT_DATA_T revInData)
{ CRC->CTRL_B.REVI = revInData; }
pikasTech/PikaPython
C++
MIT License
1,403
/* tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) */
void tick_setup_oneshot(struct clock_event_device *newdev, void(*handler)(struct clock_event_device *), ktime_t next_event)
/* tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) */ void tick_setup_oneshot(struct clock_event_device *newdev, void(*handler)(struct clock_event_device *), ktime_t next_event)
{ newdev->event_handler = handler; clockevents_set_mode(newdev, CLOCK_EVT_MODE_ONESHOT); tick_dev_program_event(newdev, next_event, 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Look for an OpCode/SubOpCode couple in the AML field element grammar, and return a corresponding string. */
CONST CHAR8* AmlGetFieldOpCodeStr(IN UINT8 OpCode, IN UINT8 SubOpCode)
/* Look for an OpCode/SubOpCode couple in the AML field element grammar, and return a corresponding string. */ CONST CHAR8* AmlGetFieldOpCodeStr(IN UINT8 OpCode, IN UINT8 SubOpCode)
{ EAML_PARSE_INDEX Index; if (SubOpCode != 0) { ASSERT (0); return NULL; } for (Index = 0; Index < (sizeof (mAmlFieldEncoding) / sizeof (mAmlFieldEncoding[0])); Index++) { if ((mAmlFieldEncoding[Index].OpCode == OpCode)) { return mAmlFieldEncoding[Index].Str; } } ASSER...
tianocore/edk2
C++
Other
4,240
/* called as task when tx hangs, resets interface (if interface is up) */
static void gelic_net_tx_timeout_task(struct work_struct *work)
/* called as task when tx hangs, resets interface (if interface is up) */ static void gelic_net_tx_timeout_task(struct work_struct *work)
{ struct gelic_card *card = container_of(work, struct gelic_card, tx_timeout_task); struct net_device *netdev = card->netdev[GELIC_PORT_ETHERNET_0]; dev_info(ctodev(card), "%s:Timed out. Restarting... \n", __func__); if (!(netdev->flags & IFF_UP)) goto out; netif_device_detach(netdev); gelic_net_stop(netdev);...
robutest/uclinux
C++
GPL-2.0
60
/* Changes an entry in the directory index table */
static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn, int slot, struct metapage **mp, s64 *lblock)
/* Changes an entry in the directory index table */ static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn, int slot, struct metapage **mp, s64 *lblock)
{ struct dir_table_slot *dirtab_slot; dirtab_slot = find_index(ip, index, mp, lblock); if (!dirtab_slot) return; DTSaddress(dirtab_slot, bn); dirtab_slot->slot = slot; if (*mp) { lock_index(tid, ip, *mp, index); mark_metapage_dirty(*mp); } else set_cflag(COMMIT_Dirtable, ip); }
robutest/uclinux
C++
GPL-2.0
60
/* Scrolls a single row of pixels one column to the left. The column that is scrolled out of the left side of the LCD will be displayed the right side of the LCD. */
void halLcdScrollRow(int y)
/* Scrolls a single row of pixels one column to the left. The column that is scrolled out of the left side of the LCD will be displayed the right side of the LCD. */ void halLcdScrollRow(int y)
{ int i, Address, LcdTableAddressTemp; unsigned int temp; Address = y << 5; halLcdSetAddress( Address ); LcdTableAddressTemp = y + (y << 4); temp = ((LCD_MEM[LcdTableAddressTemp] & 0x0003) <<14); for (i = 0; i < 0x10; i++) halLcdDrawCurrentBlock( ( (LCD_MEM[LcdTableAddressTemp+i] & 0xFFFC ) >> 2 ) \ ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_doc_handler_get_result(CRDocHandler *a_this, gpointer *a_result)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_doc_handler_get_result(CRDocHandler *a_this, gpointer *a_result)
{ g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR); *a_result = a_this->priv->result; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reclaim all the submitted descriptors which have completed its work. */
static void reclaim_free_desc(struct q_inval *qi)
/* Reclaim all the submitted descriptors which have completed its work. */ static void reclaim_free_desc(struct q_inval *qi)
{ while (qi->desc_status[qi->free_tail] == QI_DONE || qi->desc_status[qi->free_tail] == QI_ABORT) { qi->desc_status[qi->free_tail] = QI_FREE; qi->free_tail = (qi->free_tail + 1) % QI_LENGTH; qi->free_cnt++; } }
robutest/uclinux
C++
GPL-2.0
60
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */
int32_t lps22hb_pressure_offset_set(stmdev_ctx_t *ctx, uint8_t *buff)
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */ int32_t lps22hb_pressure_offset_set(stmdev_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lps22hb_write_reg(ctx, LPS22HB_RPDS_L, buff, 2); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Increase a index value in queue. This function increases the index value in the queue, if the index is out of the queue range, it is reset to 0. */
static uint8_t CSI_TransferIncreaseQueueIdx(uint8_t idx)
/* Increase a index value in queue. This function increases the index value in the queue, if the index is out of the queue range, it is reset to 0. */ static uint8_t CSI_TransferIncreaseQueueIdx(uint8_t idx)
{ uint8_t ret; ret = idx + 1U; if (ret >= CSI_DRIVER_ACTUAL_QUEUE_SIZE) { ret = 0U; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Get's the resultant location of the cursor based on the relative movement of the Mouse. */
INT32 GetTextX(IN INT32 GuidX)
/* Get's the resultant location of the cursor based on the relative movement of the Mouse. */ INT32 GetTextX(IN INT32 GuidX)
{ INT32 Gap; MainEditor.MouseAccumulatorX += GuidX; Gap = (MainEditor.MouseAccumulatorX * (INT32)MainEditor.ScreenSize.Column) / (INT32)(50 * (INT32)MainEditor.MouseInterface->Mode->ResolutionX); MainEditor.MouseAccumulatorX = (MainEditor.MouseAccumulatorX * (INT32)MainEditor.ScreenS...
tianocore/edk2
C++
Other
4,240
/* Writes a new I2C password. Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteI2CPassword(uint32_t Instance, const ST25DV_PASSWD PassWord)
/* Writes a new I2C password. Needs the I2C Password presentation to be effective. */ int32_t BSP_NFCTAG_WriteI2CPassword(uint32_t Instance, const ST25DV_PASSWD PassWord)
{ UNUSED(Instance); return ST25DV_WriteI2CPassword(&NfcTagObj, PassWord); }
eclipse-threadx/getting-started
C++
Other
310
/* This adds sysfs entries for a single bus */
int pci_bus_add_child(struct pci_bus *bus)
/* This adds sysfs entries for a single bus */ int pci_bus_add_child(struct pci_bus *bus)
{ int retval; if (bus->bridge) bus->dev.parent = bus->bridge; retval = device_register(&bus->dev); if (retval) return retval; bus->is_added = 1; retval = device_create_file(&bus->dev, &dev_attr_cpuaffinity); if (retval) return retval; retval = device_create_file(&bus->dev, &dev_attr_cpulistaffinity); pci...
robutest/uclinux
C++
GPL-2.0
60
/* cpuidle_unregister_driver - unregisters a driver @drv: the driver */
void cpuidle_unregister_driver(struct cpuidle_driver *drv)
/* cpuidle_unregister_driver - unregisters a driver @drv: the driver */ void cpuidle_unregister_driver(struct cpuidle_driver *drv)
{ if (!drv) return; spin_lock(&cpuidle_driver_lock); cpuidle_curr_driver = NULL; spin_unlock(&cpuidle_driver_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* yaffsfs_FindObject turns a path for an existing object into the object */
static struct yaffs_obj * yaffsfs_FindObject(struct yaffs_obj *relativeDirectory, const YCHAR *path, int symDepth, int getEquiv, struct yaffs_obj **dirOut, int *notDir, int *loop)
/* yaffsfs_FindObject turns a path for an existing object into the object */ static struct yaffs_obj * yaffsfs_FindObject(struct yaffs_obj *relativeDirectory, const YCHAR *path, int symDepth, int getEquiv, struct yaffs_obj **dirOut, int *notDir, int *loop)
{ struct yaffs_obj *dir; struct yaffs_obj *obj; YCHAR *name; dir = yaffsfs_FindDirectory(relDir, path, &name, symDepth, notDir, loop); if (dirOut) *dirOut = dir; if (dir && *name) obj = yaffs_find_by_name(dir, name); else obj = dir; if (getEquiv) obj = yaffs_get_equivalent_obj(obj); return obj; }
4ms/stm32mp1-baremetal
C++
Other
137