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
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
int main(int argc, char *argv[])
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */ int main(int argc, char *argv[])
{ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL ES support on this system\n"); return 1; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Finds (stable) ethernet/IP address pair from ARP table using interface and IP address index. */
s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr **eth_ret, struct ip_addr **ip_ret)
/* Finds (stable) ethernet/IP address pair from ARP table using interface and IP address index. */ s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr **eth_ret, struct ip_addr **ip_ret)
{ s8_t i; i = 0; while (i < ARP_TABLE_SIZE) { if ((arp_table[i].state == ETHARP_STATE_STABLE) && (arp_table[i].netif == netif) && ip_addr_cmp(ipaddr, &arp_table[i].ipaddr) ) { *eth_ret = &arp_table[i].ethaddr; *ip_ret = &arp_table[i].ipaddr; return i; } i++; ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Function to receive a PIMA event container from the attached still image device. */
uint8_t SImage_ReceiveEventHeader(void)
/* Function to receive a PIMA event container from the attached still image device. */ uint8_t SImage_ReceiveEventHeader(void)
{ uint8_t ErrorCode; Pipe_SelectPipe(SIMAGE_EVENTS_PIPE); Pipe_Unfreeze(); ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock), NULL); Pipe_ClearIN(); Pipe_Freeze(); return ErrorCode; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Wakes up the Air Quality / Gas Sensor. */
uint32_t BOARD_gasSensorWake(bool wake)
/* Wakes up the Air Quality / Gas Sensor. */ uint32_t BOARD_gasSensorWake(bool wake)
{ uint32_t status; if( wake ) { status = BOARD_picWriteReg( BOARD_PIC_REG_CCS_CTRL, BOARD_PIC_REG_CCS_CTRL_EN | BOARD_PIC_REG_CCS_CTRL_WAKE ); } else { status = BOARD_picWriteReg( BOARD_PIC_REG_CCS_CTRL, BOARD_PIC_REG_CCS_CTRL_EN ); } return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Enables or disables the specified I2C DMA requests. */
void I2C_DMACmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables the specified I2C DMA requests. */ void I2C_DMACmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { I2Cx->CR2 |= I2C_CR2_DMAEN; } else { I2Cx->CR2 &= (uint16_t)~((uint16_t)I2C_CR2_DMAEN); } }
MaJerle/stm32f429
C++
null
2,036
/* scsi_kunmap_atomic_sg - atomically unmap a virtual address, previously mapped with scsi_kmap_atomic_sg @virt: virtual address to be unmapped */
void scsi_kunmap_atomic_sg(void *virt)
/* scsi_kunmap_atomic_sg - atomically unmap a virtual address, previously mapped with scsi_kmap_atomic_sg @virt: virtual address to be unmapped */ void scsi_kunmap_atomic_sg(void *virt)
{ kunmap_atomic(virt, KM_BIO_SRC_IRQ); }
robutest/uclinux
C++
GPL-2.0
60
/* Send the termios settings for this port to the slave. This sleeps waiting for the command to complete - so must have user context. */
static int stli_setport(struct tty_struct *tty)
/* Send the termios settings for this port to the slave. This sleeps waiting for the command to complete - so must have user context. */ static int stli_setport(struct tty_struct *tty)
{ struct stliport *portp = tty->driver_data; struct stlibrd *brdp; asyport_t aport; if (portp == NULL) return -ENODEV; if (portp->brdnr >= stli_nrbrds) return -ENODEV; brdp = stli_brds[portp->brdnr]; if (brdp == NULL) return -ENODEV; stli_mkasyport(tty, portp, &aport, tty->termios); return(stli_cmdwait(b...
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes breo.com first version */
void DumpClock(const char *msg)
/* Change Logs: Date Author Notes breo.com first version */ void DumpClock(const char *msg)
{ RCC_ClocksType RCC_ClockFreq; rt_kprintf("--------------------------------\n"); rt_kprintf("%s:\n", msg); RCC_GetClocksFreqValue(&RCC_ClockFreq); rt_kprintf("SYSCLK: %d\n", RCC_ClockFreq.SysclkFreq); rt_kprintf("HCLK: %d\n", RCC_ClockFreq.HclkFreq); rt_kprintf("PCLK1: %d\n", RCC_ClockFreq....
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* calc reverse path for wheel this simplifies the reverse path calculation Return: 1:ok -1 error */
int calc_rev_wheel(BYTE *wheel, BYTE *backpath)
/* calc reverse path for wheel this simplifies the reverse path calculation Return: 1:ok -1 error */ int calc_rev_wheel(BYTE *wheel, BYTE *backpath)
{ int i; for (i = 0; i < WHEEL_SIZE; i++) { if (wheel[i] >= WHEEL_SIZE) { return -1; } backpath[wheel[i]] = i; } return 1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Get Authentication Payload Timeout. This funtions is used to get the authentication payload timeout */
void adi_ble_GetAuthTimeout(uint32_t *pTimeout)
/* Get Authentication Payload Timeout. This funtions is used to get the authentication payload timeout */ void adi_ble_GetAuthTimeout(uint32_t *pTimeout)
{ ASSERT(pTimeout != NULL); *pTimeout = pBLERadio->nAuthenticationTimeout; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* @mmio_ptr: pointer to a pointer to the start of the memory-mapped IO region @len: size of the memory-mapped IO region Returns: status code */
efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
/* @mmio_ptr: pointer to a pointer to the start of the memory-mapped IO region @len: size of the memory-mapped IO region Returns: status code */ efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len)
{ struct efi_runtime_mmio_list *newmmio; u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT; uint64_t addr = *(uintptr_t *)mmio_ptr; efi_status_t ret; ret = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false); if (ret != EFI_SUCCESS) return EFI_OUT_OF_RESOURCES; newmmio = calloc(1, sizeof(*newmmio)); if (!ne...
4ms/stm32mp1-baremetal
C++
Other
137
/* configure TIMER the internal trigger as external clock input */
void timer_itrx_external_clock_config(uint32_t timer_periph, uint32_t timer_intrigger)
/* configure TIMER the internal trigger as external clock input */ void timer_itrx_external_clock_config(uint32_t timer_periph, uint32_t timer_intrigger)
{ timer_input_trigger_source_select(timer_periph,timer_intrigger); TIMER_SMCFG(timer_periph) |= (uint32_t)TIMER_SLAVE_MODE_EXTERNAL0; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Update ConOutDev and ErrOutDev variables to add the device path of GOP controller itself and the sibling controllers. */
BOOLEAN ConPlatformUpdateGopCandidate(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* Update ConOutDev and ErrOutDev variables to add the device path of GOP controller itself and the sibling controllers. */ BOOLEAN ConPlatformUpdateGopCandidate(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_STATUS Status; EFI_HANDLE PciHandle; EFI_HANDLE GopHandle; EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; TempDevicePath = DevicePath; Status = gBS->LocateDevicePath (&gEfiGraphicsOutputProtocolGuid, &TempDevicePath, &GopHandle); if (EFI_ERROR (Status...
tianocore/edk2
C++
Other
4,240
/* We don't have any data, so we send silence. */
static int prepare_nodata_playback_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb)
/* We don't have any data, so we send silence. */ static int prepare_nodata_playback_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb)
{ unsigned int i, offs, counts; struct snd_urb_ctx *ctx = urb->context; int stride = runtime->frame_bits >> 3; offs = 0; urb->dev = ctx->subs->dev; for (i = 0; i < ctx->packets; ++i) { counts = snd_usb_audio_next_packet_size(subs); urb->iso_frame_desc[i].offset = offs * stride; urb->iso_frame_desc[i].length...
robutest/uclinux
C++
GPL-2.0
60
/* Returns the number of bytes that can safely be written in the FIFO. A return value of zero means that the calling function should terminate as fast as possible. */
static unsigned int parport_ip32_fwp_wait_polling(struct parport *p)
/* Returns the number of bytes that can safely be written in the FIFO. A return value of zero means that the calling function should terminate as fast as possible. */ static unsigned int parport_ip32_fwp_wait_polling(struct parport *p)
{ struct parport_ip32_private * const priv = p->physport->private_data; struct parport * const physport = p->physport; unsigned long expire; unsigned int count; unsigned int ecr; expire = jiffies + physport->cad->timeout; count = 0; while (1) { if (parport_ip32_fifo_wait_break(p, expire)) break; ecr = pa...
robutest/uclinux
C++
GPL-2.0
60
/* Read errors are reported with an console message in TShark. */
static void read_failure_message(const char *filename, int err)
/* Read errors are reported with an console message in TShark. */ static void read_failure_message(const char *filename, int err)
{ cmdarg_err("An error occurred while reading from the file \"%s\": %s.", filename, g_strerror(err)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Check duplicated I/O interrupt assignment table entry, to make sure there is only one entry with the given bus, device and interrupt pin. */
static bool check_dup_entry(struct mpc_config_intsrc *intsrc_base, int entry_num, int bus, int device, int pin)
/* Check duplicated I/O interrupt assignment table entry, to make sure there is only one entry with the given bus, device and interrupt pin. */ static bool check_dup_entry(struct mpc_config_intsrc *intsrc_base, int entry_num, int bus, int device, int pin)
{ struct mpc_config_intsrc *intsrc = intsrc_base; int i; for (i = 0; i < entry_num; i++) { if (intsrc->mpc_srcbus == bus && intsrc->mpc_srcbusirq == ((device << 2) | (pin - 1))) break; intsrc++; } return (i == entry_num) ? false : true; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Function called in case of error detected in USART IT Handler. */
void USART_TransferError_Callback(void)
/* Function called in case of error detected in USART IT Handler. */ void USART_TransferError_Callback(void)
{ LL_DMA_DisableStream(DMA2, LL_DMA_STREAM_7); LL_DMA_DisableStream(DMA2, LL_DMA_STREAM_5); LED_Blinking(LED_BLINK_ERROR); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Enable the periodic schedule then wait EHC to actually enable it. */
EFI_STATUS EhcEnablePeriodSchd(IN PEI_USB2_HC_DEV *Ehc, IN UINT32 Timeout)
/* Enable the periodic schedule then wait EHC to actually enable it. */ EFI_STATUS EhcEnablePeriodSchd(IN PEI_USB2_HC_DEV *Ehc, IN UINT32 Timeout)
{ EFI_STATUS Status; EhcSetOpRegBit (Ehc, EHC_USBCMD_OFFSET, USBCMD_ENABLE_PERIOD); Status = EhcWaitOpRegBit (Ehc, EHC_USBSTS_OFFSET, USBSTS_PERIOD_ENABLED, TRUE, Timeout); return Status; }
tianocore/edk2
C++
Other
4,240
/* Set the RTC in the virtual service processor This requires flowing LpEvents to the primary partition */
int iSeries_set_rtc_time(struct rtc_time *tm)
/* Set the RTC in the virtual service processor This requires flowing LpEvents to the primary partition */ int iSeries_set_rtc_time(struct rtc_time *tm)
{ mf_set_rtc(tm); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Indicates on which output the signal is currently active (when the push pull mode is enabled) */
uint32_t HRTIM_GetCurrentPushPullStatus(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx)
/* Indicates on which output the signal is currently active (when the push pull mode is enabled) */ uint32_t HRTIM_GetCurrentPushPullStatus(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx)
{ uint32_t current_pushpull_status; assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); current_pushpull_status = (HRTIMx->HRTIM_TIMERx[TimerIdx].TIMxISR & HRTIM_TIMISR_CPPSTAT); return current_pushpull_status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base CRC peripheral address. param data Input data stream, MSByte in data. param dataSize Size in bytes of the input data buffer. */
void CRC_WriteData(CRC_Type *base, const uint8_t *data, size_t dataSize)
/* param base CRC peripheral address. param data Input data stream, MSByte in data. param dataSize Size in bytes of the input data buffer. */ void CRC_WriteData(CRC_Type *base, const uint8_t *data, size_t dataSize)
{ const uint32_t *data32; while ((0U != dataSize) && (0U != ((uint32_t)data & 3U))) { base->ACCESS8BIT.DATALL = *data; data++; dataSize--; } data32 = (const uint32_t *)(uint32_t)data; while (dataSize >= sizeof(uint32_t)) { base->DATA = *data32; data32+...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the amount of space left in the hardware FIFO. This function reads the IOSLAVE FIFOPTR register and determines the amount of space left in the IOS LRAM FIFO. */
static uint32_t fifo_space_left(void)
/* Check the amount of space left in the hardware FIFO. This function reads the IOSLAVE FIFOPTR register and determines the amount of space left in the IOS LRAM FIFO. */ static uint32_t fifo_space_left(void)
{ return ((uint32_t)g_ui32HwFifoSize- AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ) - 1); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This also stores the host for indexing by minor, which is somewhat dirty. */
static int ub_id_get(void)
/* This also stores the host for indexing by minor, which is somewhat dirty. */ static int ub_id_get(void)
{ unsigned long flags; int i; spin_lock_irqsave(&ub_lock, flags); for (i = 0; i < UB_MAX_HOSTS; i++) { if (ub_hostv[i] == 0) { ub_hostv[i] = 1; spin_unlock_irqrestore(&ub_lock, flags); return i; } } spin_unlock_irqrestore(&ub_lock, flags); return -1; }
robutest/uclinux
C++
GPL-2.0
60
/* RakNet is just a dissector. It is invoked by protocols whose applications are built using the RakNet libs. */
static int dissect_raknet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* RakNet is just a dissector. It is invoked by protocols whose applications are built using the RakNet libs. */ static int dissect_raknet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ guint8 packet_id; col_set_str(pinfo->cinfo, COL_PROTOCOL, "RAKNET"); col_clear(pinfo->cinfo, COL_INFO); packet_id = tvb_get_guint8(tvb, 0); if (!dissector_try_uint_new(raknet_dissector_table, packet_id, tvb, pinfo, tree, TRUE, NULL)) { proto_tree_add_expert(tree, pinfo, &ei...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Iterate over the object_list and return the first valid object at or after the required position with its use_count incremented. The function triggers a memory scanning when the pos argument points to the first position. */
static void* kmemleak_seq_start(struct seq_file *seq, loff_t *pos)
/* Iterate over the object_list and return the first valid object at or after the required position with its use_count incremented. The function triggers a memory scanning when the pos argument points to the first position. */ static void* kmemleak_seq_start(struct seq_file *seq, loff_t *pos)
{ struct kmemleak_object *object; loff_t n = *pos; int err; err = mutex_lock_interruptible(&scan_mutex); if (err < 0) return ERR_PTR(err); rcu_read_lock(); list_for_each_entry_rcu(object, &object_list, object_list) { if (n-- > 0) continue; if (get_object(object)) goto out; } object = NULL; out: re...
robutest/uclinux
C++
GPL-2.0
60
/* remove the ring buffer and release it if assigned */
static void atiixp_clear_dma_packets(struct atiixp *chip, struct atiixp_dma *dma, struct snd_pcm_substream *substream)
/* remove the ring buffer and release it if assigned */ static void atiixp_clear_dma_packets(struct atiixp *chip, struct atiixp_dma *dma, struct snd_pcm_substream *substream)
{ if (dma->desc_buf.area) { writel(0, chip->remap_addr + dma->ops->llp_offset); snd_dma_free_pages(&dma->desc_buf); dma->desc_buf.area = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* Find the most appropriate command matching the command line */
static const iwconfig_cmd* find_command(const char *cmd)
/* Find the most appropriate command matching the command line */ static const iwconfig_cmd* find_command(const char *cmd)
{ const iwconfig_cmd * found = NULL; int ambig = 0; unsigned int len = strlen(cmd); int i; for(i = 0; iwconfig_cmds[i].cmd != NULL; ++i) { if(strncasecmp(iwconfig_cmds[i].cmd, cmd, len) != 0) continue; if(len == strlen(iwconfig_cmds[i].cmd)) return &iwconfig_cmds[i]; if(found == N...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Poll the given ITM stimulus register until not busy. */
bool am_hal_itm_stimulus_not_busy(uint32_t ui32StimReg)
/* Poll the given ITM stimulus register until not busy. */ bool am_hal_itm_stimulus_not_busy(uint32_t ui32StimReg)
{ uint32_t ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg)); while (!AM_REGVAL(ui32StimAddr)); return true; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @eeprom: The eeprom structure in which we find the delay index to map. */
static void __devinit eeprom_index_to_delay(struct NvRamType *eeprom)
/* @eeprom: The eeprom structure in which we find the delay index to map. */ static void __devinit eeprom_index_to_delay(struct NvRamType *eeprom)
{ eeprom->delay_time = eeprom_index_to_delay_map[eeprom->delay_time]; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is satisfied or after a defined duration. */
STATIC EFI_STATUS EFIAPI PciIoPollIo(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
/* Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is satisfied or after a defined duration. */ STATIC EFI_STATUS EFIAPI PciIoPollIo(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN U...
{ NON_DISCOVERABLE_PCI_DEVICE *Dev; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc; UINTN Count; EFI_STATUS Status; if ((UINT32)Width > EfiPciIoWidthUint64) { return EFI_INVALID_PARAMETER; } if (Result == NULL) { return EFI_INVALID_PARAMETER; ...
tianocore/edk2
C++
Other
4,240
/* NOTE WELL: cap_has_capability() cannot be used like the kernel's capable() and has_capability() functions. That is, it has the reverse semantics: cap_has_capability() returns 0 when a task has a capability, but the kernel's capable() and has_capability() returns 1 for this case. */
int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap, int audit)
/* NOTE WELL: cap_has_capability() cannot be used like the kernel's capable() and has_capability() functions. That is, it has the reverse semantics: cap_has_capability() returns 0 when a task has a capability, but the kernel's capable() and has_capability() returns 1 for this case. */ int cap_capable(struct task_struc...
{ return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */
FMC_STATUS_T FMC_WaitForLastOperation(uint32_t timeOut)
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */ FMC_STATUS_T FMC_WaitForLastOperation(uint32_t timeOut)
{ FMC_STATUS_T status = FMC_STATUS_COMPLETE; status = FMC_ReadStatus(); while ((status == FMC_STATUS_BUSY) && (timeOut != 0)) { status = FMC_ReadStatus(); timeOut--; } if (timeOut == 0x00) { status = FMC_STATUS_TIMEOUT; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: the monotonic ready time, -1 for "never" */
gint64 g_source_get_ready_time(GSource *source)
/* Returns: the monotonic ready time, -1 for "never" */ gint64 g_source_get_ready_time(GSource *source)
{ g_return_val_if_fail (source != NULL, -1); return source->priv->ready_time; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Display the font bitmap data in the given position. */
static void font_bitmap_display(uint8_t page, uint8_t column)
/* Display the font bitmap data in the given position. */ static void font_bitmap_display(uint8_t page, uint8_t column)
{ uint32_t i; ssd1306_set_page_address(page); ssd1306_set_column_address(column); for (i = 0; i < (8 * font_bitmap_width); i++) { ssd1306_write_data(font_bitmap_show[i]); } ssd1306_set_page_address(page + 1); ssd1306_set_column_address(column); for (i = 0; i < (8 * font_bitmap_width); i++) { ssd1306_write_d...
remotemcu/remcu-chip-sdks
C++
null
436
/* 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 mRunningOnQ35 ? PciExpressOr16 (Address, OrData) : PciCf8Or16 (Address, OrData); }
tianocore/edk2
C++
Other
4,240
/* Common EFI functions Unfortunately we cannot access any code outside what is built especially for the stub. lib/string.c is already being built for the U-Boot payload so it uses the wrong compiler flags. Add our own memset() here. */
static void efi_memset(void *ptr, int ch, int size)
/* Common EFI functions Unfortunately we cannot access any code outside what is built especially for the stub. lib/string.c is already being built for the U-Boot payload so it uses the wrong compiler flags. Add our own memset() here. */ static void efi_memset(void *ptr, int ch, int size)
{ char *dest = ptr; while (size-- > 0) *dest++ = ch; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Sends the current status of the device to the host. */
static void GetDeviceStatus(const USBDDriver *pDriver)
/* Sends the current status of the device to the host. */ static void GetDeviceStatus(const USBDDriver *pDriver)
{ static unsigned short data; const USBConfigurationDescriptor *pConfiguration; data = 0; if (USBD_IsHighSpeed()) { pConfiguration = pDriver->pDescriptors->pHsConfiguration; } else { pConfiguration = pDriver->pDescriptors->pFsConfiguration; } if (pDriver->cfgnum != 0) { ...
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Before you start, select your target, on the right of the "Load" button */
int main(void)
/* Before you start, select your target, on the right of the "Load" button */ int main(void)
{ if (TM_DISCO_ButtonPressed()) { TM_DISCO_LedOn(LED_RED | LED_GREEN); } else { TM_DISCO_LedOff(LED_RED | LED_GREEN); } if (TM_DISCO_ButtonOnPressed()) { GPIOD->BSRRL = LED_BLUE; } if (TM_DISCO_ButtonOnReleased()) { GPIOD->BSRRH = LED_BLUE; } } }
MaJerle/stm32f429
C++
null
2,036
/* Selects the GPIO pin used as Event output. */
void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
/* Selects the GPIO pin used as Event output. */ void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
{ uint32_t tmpreg = 0x00; assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource)); assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource)); tmpreg = AFIO->EVCR; tmpreg &= EVCR_PORTPINCONFIG_MASK; tmpreg |= (uint32_t)GPIO_PortSource << 0x04; tmpreg |= GPIO_PinSource; AFIO->EVCR = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Encode a byte (8bits) to 5B representation (output 10 bit) */
__STATIC_INLINE uint32_t PHY_Encode5b_Byte(uint8_t val)
/* Encode a byte (8bits) to 5B representation (output 10 bit) */ __STATIC_INLINE uint32_t PHY_Encode5b_Byte(uint8_t val)
{ return coding4b5b[val & 0x0F] | (coding4b5b[(val >> 4) & 0x0F] << 5); }
st-one/X-CUBE-USB-PD
C++
null
110
/* __device_complete - indicate to the accelerometer that we are done reading data, and then initiate an async refresh. Callers must hold hdaps_mtx. */
static void __device_complete(void)
/* __device_complete - indicate to the accelerometer that we are done reading data, and then initiate an async refresh. Callers must hold hdaps_mtx. */ static void __device_complete(void)
{ inb(0x161f); inb(0x1604); __device_refresh(); }
robutest/uclinux
C++
GPL-2.0
60
/* DMAMUX Set Request Generator Trigger Polarity. Set DMAMUX Request Generator input signal polarity (dmamux_rgxcr_gpol). */
void dmamux_set_request_generator_trigger_pol(uint32_t dmamux, uint8_t rg_channel, uint8_t polarity)
/* DMAMUX Set Request Generator Trigger Polarity. Set DMAMUX Request Generator input signal polarity (dmamux_rgxcr_gpol). */ void dmamux_set_request_generator_trigger_pol(uint32_t dmamux, uint8_t rg_channel, uint8_t polarity)
{ uint32_t reg32 = DMAMUX_RGxCR(dmamux, rg_channel); reg32 &= ~(DMAMUX_RGxCR_GPOL_MASK << DMAMUX_RGxCR_GPOL_SHIFT); reg32 |= ((polarity & DMAMUX_RGxCR_GPOL_MASK) << DMAMUX_RGxCR_GPOL_SHIFT); DMAMUX_RGxCR(dmamux, rg_channel) = reg32; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHE...
static int compat_agpioc_info_wrap(struct agp_file_private *priv, void __user *arg)
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHE...
{ struct agp_info32 userinfo; struct agp_kern_info kerninfo; agp_copy_info(agp_bridge, &kerninfo); userinfo.version.major = kerninfo.version.major; userinfo.version.minor = kerninfo.version.minor; userinfo.bridge_id = kerninfo.device->vendor | (kerninfo.device->device << 16); userinfo.agp_mode = kerninfo.mo...
robutest/uclinux
C++
GPL-2.0
60
/* Get size of the sector (in bytes), which covers the address specified */
static u32 spansion_sec_size(struct spansion_spi_flash *spsn, u32 addr)
/* Get size of the sector (in bytes), which covers the address specified */ static u32 spansion_sec_size(struct spansion_spi_flash *spsn, u32 addr)
{ struct spansion_spi_flash_params *p = spsn->params; u32 size = 0, i; for (i = 0; i < DIF_SEC_SIZE_NUM; i++) { if (!(addr < p->end[i])) continue; size = p->page_size * p->pages_per_sector[i]; break; } return size; }
EmcraftSystems/u-boot
C++
Other
181
/* Compute the intersection of the old QoS capabilities with new ones */
void irda_qos_compute_intersection(struct qos_info *qos, struct qos_info *new)
/* Compute the intersection of the old QoS capabilities with new ones */ void irda_qos_compute_intersection(struct qos_info *qos, struct qos_info *new)
{ IRDA_ASSERT(qos != NULL, return;); IRDA_ASSERT(new != NULL, return;); qos->baud_rate.bits &= new->baud_rate.bits; qos->window_size.bits &= new->window_size.bits; qos->min_turn_time.bits &= new->min_turn_time.bits; qos->max_turn_time.bits &= new->max_turn_time.bits; qos->data_size.bits &= ne...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note an OID when we find one for later processing when we know how to interpret it. */
int pkcs7_note_OID(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen)
/* Note an OID when we find one for later processing when we know how to interpret it. */ int pkcs7_note_OID(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen)
{ struct pkcs7_parse_context *ctx = context; ctx->last_oid = look_up_OID(value, vlen); if (ctx->last_oid == OID__NR) { char buffer[50]; sprint_oid(value, vlen, buffer, sizeof(buffer)); printk("PKCS7: Unknown OID: [%lu] %s\n", (unsigned long)value - ctx->data, buffer); } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Collect all the endpoints in the raw memory ranges. */
VOID CollectEndpoints(IN OUT UINT64 *Endpoints, IN OUT UINT32 *EndPointCount, IN MTRR_MEMORY_RANGE *RawMemoryRanges, IN UINT32 RawMemoryRangeCount)
/* Collect all the endpoints in the raw memory ranges. */ VOID CollectEndpoints(IN OUT UINT64 *Endpoints, IN OUT UINT32 *EndPointCount, IN MTRR_MEMORY_RANGE *RawMemoryRanges, IN UINT32 RawMemoryRangeCount)
{ UINT32 Index; UINT32 RawRangeIndex; ASSERT ((RawMemoryRangeCount << 1) == *EndPointCount); for (Index = 0; Index < *EndPointCount; Index += 2) { RawRangeIndex = Index >> 1; Endpoints[Index] = RawMemoryRanges[RawRangeIndex].BaseAddress; Endpoints[Index + 1] = RawMemoryRanges[RawRangeIn...
tianocore/edk2
C++
Other
4,240
/* IDL typedef struct { IDL long element_82; IDL byte *element_83; IDL } TYPE_12; */
static int dissect_browser_TYPE_12_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL typedef struct { IDL long element_82; IDL byte *element_83; IDL } TYPE_12; */ static int dissect_browser_TYPE_12_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ guint32 len; if(di->conformant_run){ offset =dissect_ndr_ucarray(tvb, offset, pinfo, tree, di, drep, NULL); return offset; } offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_browser_unknown_long, &len); proto_tree_add_item(tree, hf_browser_unknown_bytes, tvb, offset, len, ENC_NA); offs...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Utility function to get the handler for a specific interrupt. */
void* CORE_GetNvicRamTableHandler(IRQn_Type irqN)
/* Utility function to get the handler for a specific interrupt. */ void* CORE_GetNvicRamTableHandler(IRQn_Type irqN)
{ EFM_ASSERT(((int)irqN >= -16) && ((int)irqN < EXT_IRQ_COUNT)); return (void*)((uint32_t*)(((uint32_t*)SCB->VTOR)[(int)irqN + 16])); }
eclipse-threadx/getting-started
C++
Other
310
/* e1000_rar_set_vf - set device MAC address @hw: pointer to the HW structure @addr: pointer to the receive address @index receive address array register */
static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32)
/* e1000_rar_set_vf - set device MAC address @hw: pointer to the HW structure @addr: pointer to the receive address @index receive address array register */ static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32)
{ struct e1000_mbx_info *mbx = &hw->mbx; u32 msgbuf[3]; u8 *msg_addr = (u8 *)(&msgbuf[1]); s32 ret_val; memset(msgbuf, 0, 12); msgbuf[0] = E1000_VF_SET_MAC_ADDR; memcpy(msg_addr, addr, 6); ret_val = mbx->ops.write_posted(hw, msgbuf, 3); if (!ret_val) ret_val = mbx->ops.read_posted(hw, msgbuf, 3); msgbuf[0] ...
robutest/uclinux
C++
GPL-2.0
60
/* Build a parallel protocol request message in our message buffer based on the input parameters. */
static void ahc_construct_ppr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, u_int period, u_int offset, u_int bus_width, u_int ppr_options)
/* Build a parallel protocol request message in our message buffer based on the input parameters. */ static void ahc_construct_ppr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, u_int period, u_int offset, u_int bus_width, u_int ppr_options)
{ if (offset == 0) period = AHC_ASYNC_XFER_PERIOD; ahc->msgout_index += spi_populate_ppr_msg( ahc->msgout_buf + ahc->msgout_index, period, offset, bus_width, ppr_options); ahc->msgout_len += 8; if (bootverbose) { printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, " "offset %x, ppr_option...
robutest/uclinux
C++
GPL-2.0
60
/* Configures, when the PINC (Peripheral Increment address mode) bit is set, if the peripheral address should be incremented with the data size (configured with PSIZE bits) or by a fixed offset equal to 4 (32-bit aligned addresses). */
void DMA_PeriphIncOffsetSizeConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_Pincos)
/* Configures, when the PINC (Peripheral Increment address mode) bit is set, if the peripheral address should be incremented with the data size (configured with PSIZE bits) or by a fixed offset equal to 4 (32-bit aligned addresses). */ void DMA_PeriphIncOffsetSizeConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_P...
{ assert_param(IS_DMA_ALL_PERIPH(DMAy_Streamx)); assert_param(IS_DMA_PINCOS_SIZE(DMA_Pincos)); if(DMA_Pincos != DMA_PINCOS_Psize) { DMAy_Streamx->CR |= (uint32_t)DMA_SxCR_PINCOS; } else { DMAy_Streamx->CR &= ~(uint32_t)DMA_SxCR_PINCOS; } }
MaJerle/stm32f429
C++
null
2,036
/* This function sets the FspSiliconInit UPD data pointer. */
VOID EFIAPI SetFspSiliconInitUpdDataPointer(IN VOID *SiliconInitUpdPtr)
/* This function sets the FspSiliconInit UPD data pointer. */ VOID EFIAPI SetFspSiliconInitUpdDataPointer(IN VOID *SiliconInitUpdPtr)
{ FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); FspData->SiliconInitUpdPtr = SiliconInitUpdPtr; }
tianocore/edk2
C++
Other
4,240
/* Returns the most recent received data by the SPIx peripheral. */
uint16_t SPI_I2S_ReceiveData16(SPI_TypeDef *SPIx)
/* Returns the most recent received data by the SPIx peripheral. */ uint16_t SPI_I2S_ReceiveData16(SPI_TypeDef *SPIx)
{ assert_param(IS_SPI_ALL_PERIPH_EXT(SPIx)); return SPIx->DR; }
ajhc/demo-cortex-m3
C++
null
38
/* Sends the initialisation sequence to the display controller. */
void hx8347gInitDisplay(void)
/* Sends the initialisation sequence to the display controller. */ void hx8347gInitDisplay(void)
{ uint8_t i, a, d; LPC_GPIO->SET[HX8347G_DATA_PORT] &= ~HX8347G_DATA_MASK; SET_RD; SET_WR; SET_CS; SET_CD; CLR_RESET; delay(10); SET_RESET; delay(500); for (i = 0; i < sizeof(HX8347G_InitSequence) / 2; i++) { a = HX8347G_InitSequence[i*2]; d = HX8347G_InitSequence[i*2 + 1]; if (a ==...
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* st_ref_mutex must be held entering this routine. Because it is called on last put, you should always use the scsi_tape_get() scsi_tape_put() helpers which manipulate the semaphore directly and never do a direct kref_put(). */
static void scsi_tape_release(struct kref *)
/* st_ref_mutex must be held entering this routine. Because it is called on last put, you should always use the scsi_tape_get() scsi_tape_put() helpers which manipulate the semaphore directly and never do a direct kref_put(). */ static void scsi_tape_release(struct kref *)
{ struct scsi_tape *tpnt = to_scsi_tape(kref); struct gendisk *disk = tpnt->disk; tpnt->device = NULL; if (tpnt->buffer) { normalize_buffer(tpnt->buffer); kfree(tpnt->buffer->reserved_pages); kfree(tpnt->buffer); } disk->private_data = NULL; put_disk(disk); kfree(tpnt); return; }
robutest/uclinux
C++
GPL-2.0
60
/* find out the number of processor cores on the die */
static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
/* find out the number of processor cores on the die */ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
{ unsigned int eax, ebx, ecx, edx; if (c->cpuid_level < 4) return 1; cpuid_count(4, 0, &eax, &ebx, &ecx, &edx); if (eax & 0x1f) return (eax >> 26) + 1; else return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller: prevent update of the BAR0, which doesn't look like a normal BAR. */
static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
/* Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller: prevent update of the BAR0, which doesn't look like a normal BAR. */ static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
{ dev->resource[0].flags |= IORESOURCE_PCI_FIXED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* A non-blocking sockets causes the function to return immediately if no data is available. */
int nl_recvmsgs(struct nl_sock *sk, struct nl_cb *cb)
/* A non-blocking sockets causes the function to return immediately if no data is available. */ int nl_recvmsgs(struct nl_sock *sk, struct nl_cb *cb)
{ if (cb->cb_recvmsgs_ow) return cb->cb_recvmsgs_ow(sk, cb); else return recvmsgs(sk, cb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If inode1 or inode2 is NULL, return -EIO. Otherwise, return 0. */
static int mext_check_null_inode(struct inode *inode1, struct inode *inode2, const char *function)
/* If inode1 or inode2 is NULL, return -EIO. Otherwise, return 0. */ static int mext_check_null_inode(struct inode *inode1, struct inode *inode2, const char *function)
{ int ret = 0; if (inode1 == NULL) { ext4_error(inode2->i_sb, function, "Both inodes should not be NULL: " "inode1 NULL inode2 %lu", inode2->i_ino); ret = -EIO; } else if (inode2 == NULL) { ext4_error(inode1->i_sb, function, "Both inodes should not be NULL: " "inode1 %lu inode2 NULL", inode1->i_ino...
robutest/uclinux
C++
GPL-2.0
60
/* Function for receiving and validating notifications received from the Notification Provider. */
static void on_evt_gattc_notif(ble_ancs_c_t *p_ancs, const ble_evt_t *p_ble_evt)
/* Function for receiving and validating notifications received from the Notification Provider. */ static void on_evt_gattc_notif(ble_ancs_c_t *p_ancs, const ble_evt_t *p_ble_evt)
{ const ble_gattc_evt_hvx_t * p_notif = &p_ble_evt->evt.gattc_evt.params.hvx; if(p_ble_evt->evt.gattc_evt.conn_handle != p_ancs->conn_handle) { return; } if (p_notif->handle == p_ancs->service.notif_source_char.handle_value) { parse_notif(p_ancs, p_notif->data, p_notif->len); ...
labapart/polymcu
C++
null
201
/* Signaled when PS3_SM_RX_MSG_LEN_MIN bytes arrive at the vuart port. */
static void ps3_sys_manager_work(struct ps3_system_bus_device *dev)
/* Signaled when PS3_SM_RX_MSG_LEN_MIN bytes arrive at the vuart port. */ static void ps3_sys_manager_work(struct ps3_system_bus_device *dev)
{ ps3_sys_manager_handle_msg(dev); ps3_vuart_read_async(dev, PS3_SM_RX_MSG_LEN_MIN); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Forces the card to stop transmission in Multiple Block Read Operation. */
unsigned char SDTransmissionStop(void)
/* Forces the card to stop transmission in Multiple Block Read Operation. */ unsigned char SDTransmissionStop(void)
{ unsigned char pucParam[4] = {0,0,0,0}, ucResp; return (SDCmdWrite(SD_CMD12, pucParam, SD_CMD12_R, &ucResp)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Sends a byte of data to one of the TWI slaves on the bus. */
void twi_write_byte(Twi *p_twi, uint8_t uc_byte)
/* Sends a byte of data to one of the TWI slaves on the bus. */ void twi_write_byte(Twi *p_twi, uint8_t uc_byte)
{ p_twi->TWI_THR = uc_byte; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* SPI Data Read. Data is read from the SPI interface after the incoming transfer has finished. */
uint16_t spi_read(uint32_t spi)
/* SPI Data Read. Data is read from the SPI interface after the incoming transfer has finished. */ uint16_t spi_read(uint32_t spi)
{ while (!(SPI_SR(spi) & SPI_SR_RXNE)); return SPI_DR(spi); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Mark the buffer as not needing to be unlocked when the buf item's IOP_UNLOCK() routine is called. The buffer must already be locked and associated with the given transaction. */
void xfs_trans_bhold(xfs_trans_t *tp, xfs_buf_t *bp)
/* Mark the buffer as not needing to be unlocked when the buf item's IOP_UNLOCK() routine is called. The buffer must already be locked and associated with the given transaction. */ void xfs_trans_bhold(xfs_trans_t *tp, xfs_buf_t *bp)
{ xfs_buf_log_item_t *bip; ASSERT(XFS_BUF_ISBUSY(bp)); ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); ASSERT(!(bip->bli_format.blf_flags & XFS_BLI_CANCEL)); ASSERT(a...
robutest/uclinux
C++
GPL-2.0
60
/* If UnicodeStringTable is NULL, then EFI_SUCCESS is returned. Otherwise, each language code, and each Unicode string in the Unicode string table are freed, and EFI_SUCCESS is returned. */
EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
/* If UnicodeStringTable is NULL, then EFI_SUCCESS is returned. Otherwise, each language code, and each Unicode string in the Unicode string table are freed, and EFI_SUCCESS is returned. */ EFI_STATUS EFIAPI FreeUnicodeStringTable(IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable)
{ UINTN Index; if (UnicodeStringTable == NULL) { return EFI_SUCCESS; } for (Index = 0; UnicodeStringTable[Index].Language != NULL; Index++) { FreePool (UnicodeStringTable[Index].Language); if (UnicodeStringTable[Index].UnicodeString != NULL) { FreePool (UnicodeStringTable[Index].UnicodeString...
tianocore/edk2
C++
Other
4,240
/* Convert memory chunk array to a memory segment list so there is a single list that contains both r/w memory and shared memory segments. */
static int __init vmem_convert_memory_chunk(void)
/* Convert memory chunk array to a memory segment list so there is a single list that contains both r/w memory and shared memory segments. */ static int __init vmem_convert_memory_chunk(void)
{ struct memory_segment *seg; int i; mutex_lock(&vmem_mutex); for (i = 0; i < MEMORY_CHUNKS; i++) { if (!memory_chunk[i].size) continue; seg = kzalloc(sizeof(*seg), GFP_KERNEL); if (!seg) panic("Out of memory...\n"); seg->start = memory_chunk[i].addr; seg->size = memory_chunk[i].size; insert_memor...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable Receive CRC error interrupt @rmtoll IER RXBERIE LL_SWPMI_DisableIT_RXBER. */
void LL_SWPMI_DisableIT_RXBER(SWPMI_TypeDef *SWPMIx)
/* Disable Receive CRC error interrupt @rmtoll IER RXBERIE LL_SWPMI_DisableIT_RXBER. */ void LL_SWPMI_DisableIT_RXBER(SWPMI_TypeDef *SWPMIx)
{ CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* get the SSL context ahead signal if we can read as many as data */
long SSL_CTX_get_read_ahead(SSL_CTX *ctx)
/* get the SSL context ahead signal if we can read as many as data */ long SSL_CTX_get_read_ahead(SSL_CTX *ctx)
{ SSL_ASSERT1(ctx); return ctx->read_ahead; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Call the "noirq" resume handlers for all devices marked as DPM_OFF_IRQ and enable device drivers to receive interrupts. */
void dpm_resume_noirq(pm_message_t state)
/* Call the "noirq" resume handlers for all devices marked as DPM_OFF_IRQ and enable device drivers to receive interrupts. */ void dpm_resume_noirq(pm_message_t state)
{ struct device *dev; ktime_t starttime = ktime_get(); mutex_lock(&dpm_list_mtx); transition_started = false; list_for_each_entry(dev, &dpm_list, power.entry) if (dev->power.status > DPM_OFF) { int error; dev->power.status = DPM_OFF; error = device_resume_noirq(dev, state); if (error) pm_dev_err(...
robutest/uclinux
C++
GPL-2.0
60
/* param base FlexCAN peripheral base address. param mask Rx Message Buffer Global Mask value. */
void FLEXCAN_SetRxMbGlobalMask(CAN_Type *base, uint32_t mask)
/* param base FlexCAN peripheral base address. param mask Rx Message Buffer Global Mask value. */ void FLEXCAN_SetRxMbGlobalMask(CAN_Type *base, uint32_t mask)
{ FLEXCAN_EnterFreezeMode(base); base->RXMGMASK = mask; base->RX14MASK = mask; base->RX15MASK = mask; FLEXCAN_ExitFreezeMode(base); }
eclipse-threadx/getting-started
C++
Other
310
/* parport_ip32_read_econtrol - read contents of the ECR register */
static unsigned int parport_ip32_read_econtrol(struct parport *p)
/* parport_ip32_read_econtrol - read contents of the ECR register */ static unsigned int parport_ip32_read_econtrol(struct parport *p)
{ struct parport_ip32_private * const priv = p->physport->private_data; return readb(priv->regs.ecr); }
robutest/uclinux
C++
GPL-2.0
60
/* Write multiple words of data to the IDE data port. Call the IO abstraction once to do the complete read, not one word at a time */
VOID EFIAPI IdeWritePortWMultiple(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT16 Port, IN UINTN Count, IN VOID *Buffer)
/* Write multiple words of data to the IDE data port. Call the IO abstraction once to do the complete read, not one word at a time */ VOID EFIAPI IdeWritePortWMultiple(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT16 Port, IN UINTN Count, IN VOID *Buffer)
{ ASSERT (PciIo != NULL); ASSERT (Buffer != NULL); PciIo->Io.Write ( PciIo, EfiPciIoWidthFifoUint16, EFI_PCI_IO_PASS_THROUGH_BAR, (UINT64)Port, Count, (UINT16 *)Buffer ); }
tianocore/edk2
C++
Other
4,240
/* This function returns true if the Checksum is bypassed in the hardware. Valid only when enhaced status available is set in RDES0 bit 0. This is valid only for Enhanced Descriptor. */
bool synopGMAC_ES_is_rx_checksum_bypassed(synopGMACdevice *gmacdev, u32 ext_status)
/* This function returns true if the Checksum is bypassed in the hardware. Valid only when enhaced status available is set in RDES0 bit 0. This is valid only for Enhanced Descriptor. */ bool synopGMAC_ES_is_rx_checksum_bypassed(synopGMACdevice *gmacdev, u32 ext_status)
{ return ((ext_status & DescRxChkSumBypass) != 0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* read a string and add it to tree */
static void read_string(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
/* read a string and add it to tree */ static void read_string(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
{ int byteLength; read_type(offset, tvb, etch_tree); byteLength = read_length(offset, tvb, etch_tree); proto_tree_add_item(etch_tree, hf_etch_string, tvb, *offset, byteLength, ENC_ASCII|ENC_NA); (*offset) += byteLength; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_Off(LED1); BSP_LED_On(LED2); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* retval kStatus_Success Enable IO Low Voltage Detect successfully. */
status_t SPC_EnableActiveModeIOLowVoltageDetect(SPC_Type *base, bool enable)
/* retval kStatus_Success Enable IO Low Voltage Detect successfully. */ status_t SPC_EnableActiveModeIOLowVoltageDetect(SPC_Type *base, bool enable)
{ status_t status = kStatus_Success; if (enable) { base->ACTIVE_CFG |= SPC_ACTIVE_CFG_IO_LVDE_MASK; } else { base->ACTIVE_CFG &= ~SPC_ACTIVE_CFG_IO_LVDE_MASK; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unregisters an interrupt handler for the CAN controller. */
void CANIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for the CAN controller. */ void CANIntUnregister(unsigned long ulBase)
{ unsigned long ulIntNumber; ASSERT(CANBaseValid(ulBase)); ulIntNumber = CANIntNumberGet(ulBase); IntUnregister(ulIntNumber); IntDisable(ulIntNumber); }
watterott/WebRadio
C++
null
71
/* Construction function for DMANOP instruction. This function fills the program buffer with the constructed instruction. */
static INLINE int XDmaPs_Instr_DMANOP(char *DmaProg)
/* Construction function for DMANOP instruction. This function fills the program buffer with the constructed instruction. */ static INLINE int XDmaPs_Instr_DMANOP(char *DmaProg)
{ *DmaProg = 0x18; return 1; }
ua1arn/hftrx
C++
null
69
/* Configure the mode and trigger source of a sample sequence. */
void xADCConfigure(unsigned long ulBase, unsigned long ulMode, unsigned long ulTrigger)
/* Configure the mode and trigger source of a sample sequence. */ void xADCConfigure(unsigned long ulBase, unsigned long ulMode, unsigned long ulTrigger)
{ xASSERT(ulBase == xADC0_BASE); xASSERT((ulMode == xADC_MODE_SCAN_SINGLE_CYCLE) || (ulMode == xADC_MODE_SCAN_CONTINUOUS) ); xASSERT((ulTrigger == xADC_TRIGGER_PROCESSOR) || (ulTrigger == xADC_TRIGGER_EXT_PB2) ); xHWREG(ulBase + ADC_RST) |= ADC_ADCRST_ADRST...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check for a network adaptor of this type, and return '0' iff one exists. If dev->base_addr == 0, probe all likely locations. If dev->base_addr == 1, always return failure. If dev->base_addr == 2, allocate space for the device and return success (detachable devices only). */
static int __init do_netcard_probe(struct net_device *dev)
/* Check for a network adaptor of this type, and return '0' iff one exists. If dev->base_addr == 0, probe all likely locations. If dev->base_addr == 1, always return failure. If dev->base_addr == 2, allocate space for the device and return success (detachable devices only). */ static int __init do_netcard_probe(struct...
{ int i; int base_addr = dev->base_addr; int irq = dev->irq; if (base_addr > 0x1ff) return netcard_probe1(dev, base_addr); else if (base_addr != 0) return -ENXIO; for (i = 0; netcard_portlist[i]; i++) { int ioaddr = netcard_portlist[i]; if (netcard_probe1(dev, ioaddr) == 0) return 0; dev->irq = irq; ...
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified DMA2D's flag is set or not. */
FlagStatus DMA2D_GetFlagStatus(uint32_t DMA2D_FLAG)
/* Checks whether the specified DMA2D's flag is set or not. */ FlagStatus DMA2D_GetFlagStatus(uint32_t DMA2D_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_DMA2D_GET_FLAG(DMA2D_FLAG)); if (((DMA2D->ISR) & DMA2D_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
MaJerle/stm32f429
C++
null
2,036
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus RTC_GetITStatus(uint16_t RTC_IT)
/* Checks whether the specified RTC interrupt has occurred or not. */ ITStatus RTC_GetITStatus(uint16_t RTC_IT)
{ ITStatus bitstatus = RESET; assert_param(IS_RTC_GET_IT(RTC_IT)); bitstatus = (ITStatus)(RTC->CRL & RTC_IT); if (((RTC->CRH & RTC_IT) != (uint16_t)RESET) && (bitstatus != (uint16_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* This is a special map_sg function which is used if we should map a device which is not handled by an AMD IOMMU in the system. */
static int map_sg_no_iommu(struct device *dev, struct scatterlist *sglist, int nelems, int dir)
/* This is a special map_sg function which is used if we should map a device which is not handled by an AMD IOMMU in the system. */ static int map_sg_no_iommu(struct device *dev, struct scatterlist *sglist, int nelems, int dir)
{ struct scatterlist *s; int i; for_each_sg(sglist, s, nelems, i) { s->dma_address = (dma_addr_t)sg_phys(s); s->dma_length = s->length; } return nelems; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the time-base counter reached its maximum value flag of selected channel. */
uint32_t BPWM_GetWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum)
/* Get the time-base counter reached its maximum value flag of selected channel. */ uint32_t BPWM_GetWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum)
{ return (((bpwm)->STATUS & BPWM_STATUS_CNTMAX0_Msk) ? 1UL : 0UL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 in case of success, -1 otherwise */
static int xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler, int len)
/* Returns 0 in case of success, -1 otherwise */ static int xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler, int len)
{ int ret = 0; if (handler != NULL) { if (ctxt->input != NULL) { ret = xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, len); } else { xmlErrInternal(ctxt, "xmlSwitchToEncoding : no input\n", NULL); return(-1); } ctxt->charset = XML_CHAR_ENCODING_UTF8; } el...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set NBYTES in the DMA channel's TCD to nbytes. */
int kinetis_dma_ch_set_nbytes(int ch, u32 nbytes)
/* Set NBYTES in the DMA channel's TCD to nbytes. */ int kinetis_dma_ch_set_nbytes(int ch, u32 nbytes)
{ DMAAPI_LOCKED_BEGIN KINETIS_DMA->tcd[ch].nbytes = nbytes; DMAAPI_LOCKED_END }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(DAC_TypeDef *DACx, uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */ void DAC_Init(DAC_TypeDef *DACx, uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
{ uint32_t tmpreg1 = 0, tmpreg2 = 0; assert_param(IS_DAC_ALL_PERIPH(DACx)); assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger)); assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration)); assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude)); ...
avem-labs/Avem
C++
MIT License
1,752
/* Set up the clock output pin so that the current system clock frequency can be monitored via an external frequency counter or oscilloscope. */
static void setup_clock_out_pin(void)
/* Set up the clock output pin so that the current system clock frequency can be monitored via an external frequency counter or oscilloscope. */ static void setup_clock_out_pin(void)
{ struct system_pinmux_config pin_mux; system_pinmux_get_config_defaults(&pin_mux); pin_mux.mux_position = CONF_CLOCK_PIN_MUX; system_pinmux_pin_set_config(CONF_CLOCK_PIN_OUT, &pin_mux); }
memfault/zero-to-main
C++
null
200
/* Enables ODR CHANGE virtual sensor to be batched in FIFO.. */
int32_t lsm6dso_fifo_virtual_sens_odr_chg_set(lsm6dso_ctx_t *ctx, uint8_t val)
/* Enables ODR CHANGE virtual sensor to be batched in FIFO.. */ int32_t lsm6dso_fifo_virtual_sens_odr_chg_set(lsm6dso_ctx_t *ctx, uint8_t val)
{ lsm6dso_fifo_ctrl2_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t*)&reg, 1); if (ret == 0) { reg.odrchg_en = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Releases the PCI I/O and memory resources previously reserved by a successful call to pci_request_region. Call this function only after all use of the PCI regions has ceased. */
void pci_release_region(struct pci_dev *pdev, int bar)
/* Releases the PCI I/O and memory resources previously reserved by a successful call to pci_request_region. Call this function only after all use of the PCI regions has ceased. */ void pci_release_region(struct pci_dev *pdev, int bar)
{ struct pci_devres *dr; if (pci_resource_len(pdev, bar) == 0) return; if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) release_region(pci_resource_start(pdev, bar), pci_resource_len(pdev, bar)); else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) release_mem_region(pci_resource_start(pdev, bar), ...
robutest/uclinux
C++
GPL-2.0
60
/* OS entry point to allow for host driver to free allocated memory Called if no device present or device being unloaded */
void mptscsih_slave_destroy(struct scsi_device *sdev)
/* OS entry point to allow for host driver to free allocated memory Called if no device present or device being unloaded */ void mptscsih_slave_destroy(struct scsi_device *sdev)
{ struct Scsi_Host *host = sdev->host; MPT_SCSI_HOST *hd = shost_priv(host); VirtTarget *vtarget; VirtDevice *vdevice; struct scsi_target *starget; starget = scsi_target(sdev); vtarget = starget->hostdata; vdevice = sdev->hostdata; mptscsih_search_running_cmds(hd, vdevice); vtarget->num_luns--; mptscsih_...
robutest/uclinux
C++
GPL-2.0
60
/* Software MMI handler that is called when a ExitBoot Service event is signaled. */
EFI_STATUS EFIAPI MmExitBootServiceHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
/* Software MMI handler that is called when a ExitBoot Service event is signaled. */ EFI_STATUS EFIAPI MmExitBootServiceHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
{ EFI_HANDLE MmHandle; EFI_STATUS Status; STATIC BOOLEAN mInExitBootServices = FALSE; Status = EFI_SUCCESS; if (!mInExitBootServices) { MmHandle = NULL; Status = MmInstallProtocolInterface ( &MmHandle, &gEfiEventExitBootServicesGuid, EFI_...
tianocore/edk2
C++
Other
4,240
/* On ISR exit. Set LF to CRLF conversion */
static void set_auto_cr_lf(void *context, bool on)
/* On ISR exit. Set LF to CRLF conversion */ static void set_auto_cr_lf(void *context, bool on)
{ sl_iostream_uart_context_t *uart_context = (sl_iostream_uart_context_t *)context; sl_atomic_store(uart_context->lf_to_crlf, on); }
eclipse-threadx/getting-started
C++
Other
310
/* ZigBee Device Profile dissector for the power descriptor */
void dissect_zbee_zdp_rsp_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the power descriptor */ void dissect_zbee_zdp_rsp_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint8 status; guint16 device; status = zdp_parse_status(tree, tvb, &offset); device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); if (status == ZBEE_ZDP_STATUS_SUCCESS) { zdp_parse_power_desc(tree, ett_zbee_...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function searches for DXE capsules from the associated device and returns the number and maximum size in bytes of the capsules discovered. Entry 1 is assumed to be the highest load priority and entry N is assumed to be the lowest priority. */
EFI_STATUS EFIAPI GetNumberRecoveryCapsules(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This, OUT UINTN *NumberRecoveryCapsules)
/* This function searches for DXE capsules from the associated device and returns the number and maximum size in bytes of the capsules discovered. Entry 1 is assumed to be the highest load priority and entry N is assumed to be the lowest priority. */ EFI_STATUS EFIAPI GetNumberRecoveryCapsules(IN EFI_PEI_SERVICES **Pei...
{ EFI_STATUS Status; PEI_FAT_PRIVATE_DATA *PrivateData; UINTN Index; UINTN RecoveryCapsuleCount; PEI_FILE_HANDLE Handle; PrivateData = PEI_FAT_PRIVATE_DATA_FROM_THIS (This); RecoveryCapsuleCount = 0; for (Index = 0; Index < PrivateData->VolumeCount; Inde...
tianocore/edk2
C++
Other
4,240
/* Checks whether the specified ADC interrupt has occurred or not. */
ITStatus ADC_GetITStatus(ADC_TypeDef *ADCx, uint32_t ADC_IT)
/* Checks whether the specified ADC interrupt has occurred or not. */ ITStatus ADC_GetITStatus(ADC_TypeDef *ADCx, uint32_t ADC_IT)
{ ITStatus bitstatus = RESET; uint32_t enablestatus = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_GET_IT(ADC_IT)); enablestatus = (uint32_t)(ADCx->IER & ADC_IT); if (((uint32_t)(ADCx->ISR & ADC_IT) != (uint32_t)RESET) && (enablestatus != (uint32_t)RESET)) { bitstatus = SET; } els...
ajhc/demo-cortex-m3
C++
null
38
/* get and put functions for the table, exposed to modules. */
struct sysrq_key_op* __sysrq_get_key_op(int key)
/* get and put functions for the table, exposed to modules. */ struct sysrq_key_op* __sysrq_get_key_op(int key)
{ struct sysrq_key_op *op_p = NULL; int i; i = sysrq_key_table_key2index(key); if (i != -1) op_p = sysrq_key_table[i]; return op_p; }
robutest/uclinux
C++
GPL-2.0
60