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
/* To generate a key to KS SRAM for ECDH. */
int32_t RNG_ECDH(uint32_t u32KeySize)
/* To generate a key to KS SRAM for ECDH. */ int32_t RNG_ECDH(uint32_t u32KeySize)
{ int32_t timeout; int32_t i; CRPT->PRNG_CTL = (u32KeySize << CRPT_PRNG_CTL_KEYSZ_Pos) | 0xc0 | CRPT_PRNG_CTL_START_Msk; timeout = 0x10000; i = 0; while(CRPT->PRNG_CTL & CRPT_PRNG_CTL_BUSY_Msk) { if(i++ > timeout) return -1; } if(CRPT->PRNG_KSSTS & CRPT_PRNG_KSSTS_KCTLERR_Msk) return -1; return (CRPT->PRNG_KSSTS & CRPT_PRNG_KSCTL_NUM_Msk); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* inc_ep_stats_bytes - Update ep stats counts @ep: physical endpoint @count: bytes transfered on endpoint @is_in: ep direction (USB_DIR_IN or 0) */
static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in)
/* inc_ep_stats_bytes - Update ep stats counts @ep: physical endpoint @count: bytes transfered on endpoint @is_in: ep direction (USB_DIR_IN or 0) */ static void inc_ep_stats_bytes(struct pxa_ep *ep, int count, int is_in)
{ if (is_in) ep->stats.in_bytes += count; else ep->stats.out_bytes += count; }
robutest/uclinux
C++
GPL-2.0
60
/* config synchronous codes unmask in embedded synchronous mode */
void dci_sync_codes_unmask_config(uint8_t frame_start, uint8_t line_start, uint8_t line_end, uint8_t frame_end)
/* config synchronous codes unmask in embedded synchronous mode */ void dci_sync_codes_unmask_config(uint8_t frame_start, uint8_t line_start, uint8_t line_end, uint8_t frame_end)
{ DCI_SCUMSK = ((uint32_t)frame_start | ((uint32_t)line_start << 8) | ((uint32_t)line_end << 16) | ((uint32_t)frame_end << 24)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert a traffic control handle to a character string (Reentrant). */
char* rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len)
/* Convert a traffic control handle to a character string (Reentrant). */ char* rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len)
{ if (TC_H_ROOT == handle) snprintf(buf, len, "root"); else if (TC_H_UNSPEC == handle) snprintf(buf, len, "none"); else if (0 == TC_H_MAJ(handle)) snprintf(buf, len, ":%02x", TC_H_MIN(handle)); else if (0 == TC_H_MIN(handle)) snprintf(buf, len, "%02x:", TC_H_MAJ(handle) >> 16); else snprintf(buf, len, "%02x:%02x", TC_H_MAJ(handle) >> 16, TC_H_MIN(handle)); return buf; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function simply sends an IOCTL to the driver, which in turn ticks the PC Watchdog card to reset its internal timer so it doesn't trigger a computer reset. */
static void keep_alive(void)
/* This function simply sends an IOCTL to the driver, which in turn ticks the PC Watchdog card to reset its internal timer so it doesn't trigger a computer reset. */ static void keep_alive(void)
{ int dummy; ioctl(fd, WDIOC_KEEPALIVE, &dummy); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Puts a data element into the SPI transmit FIFO. This function replaces the original SPIDataNonBlockingPut() API and performs the same actions. A macro is provided in */
long SPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
/* Puts a data element into the SPI transmit FIFO. This function replaces the original SPIDataNonBlockingPut() API and performs the same actions. A macro is provided in */ long SPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xASSERT(ulData < 256); if(xHWREGB(ulBase + SPI_S) & SPI_S_SPTEF) { xHWREGB(ulBase + SPI_D) = (unsigned char)ulData; return(1); } else { return(0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* introduce function I3C_SlaveTransferHandleGetStatusFlags. This function was deal get status flag. */
static bool I3C_SlaveTransferHandleGetStatusFlags(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_handleIrq_param_t *stateParams)
/* introduce function I3C_SlaveTransferHandleGetStatusFlags. This function was deal get status flag. */ static bool I3C_SlaveTransferHandleGetStatusFlags(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_handleIrq_param_t *stateParams)
{ assert(NULL != base && NULL != handle && NULL != stateParams); uint32_t errFlags; stateParams->flags = I3C_SlaveGetStatusFlags(base); errFlags = I3C_SlaveGetErrorStatusFlags(base); stateParams->pendingInts = I3C_SlaveGetPendingInterrupts(base); stateParams->enabledInts = I3C_SlaveGetEnabledInterrupts(base); if (0UL != (errFlags & (uint32_t)kSlaveErrorFlags)) { handle->transfer.event = (uint32_t)kI3C_SlaveCompletionEvent; handle->transfer.completionStatus = I3C_SlaveCheckAndClearError(base, errFlags); if ((0UL != (handle->eventMask & (uint32_t)kI3C_SlaveCompletionEvent)) && (NULL != handle->callback)) { handle->callback(base, &handle->transfer, handle->userData); } return false; } return true; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function: MX25_RDSFDP Arguments: flash_address, 32 bit flash memory address target_address, buffer address to store returned data byte_length, length of returned data in byte unit Description: RDSFDP can retrieve the operating characteristics, structure and vendor-specified information such as identifying information, memory size, operating voltages and timinginformation of device Return Message: FlashAddressInvalid, FlashOperationSuccess */
ReturnMsg MX25_RDSFDP(uint32_t flash_address, uint8_t *target_address, uint32_t byte_length)
/* Function: MX25_RDSFDP Arguments: flash_address, 32 bit flash memory address target_address, buffer address to store returned data byte_length, length of returned data in byte unit Description: RDSFDP can retrieve the operating characteristics, structure and vendor-specified information such as identifying information, memory size, operating voltages and timinginformation of device Return Message: FlashAddressInvalid, FlashOperationSuccess */ ReturnMsg MX25_RDSFDP(uint32_t flash_address, uint8_t *target_address, uint32_t byte_length)
{ uint32_t index; uint8_t addr_4byte_mode; if( flash_address > FlashSize ) return FlashAddressInvalid; if( IsFlash4Byte() ) addr_4byte_mode = TRUE; else addr_4byte_mode = FALSE; CS_Low(); SendByte( FLASH_CMD_RDSFDP, SIO ); SendFlashAddr( flash_address, SIO, addr_4byte_mode ); InsertDummyCycle ( 8 ); for( index=0; index < byte_length; index++ ) { *(target_address + index) = GetByte( SIO ); } CS_High(); return FlashOperationSuccess; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Function used to retrieve the string name given an AirpcapValidationType, or NULL in case of error */
const gchar* airpcap_get_validation_name(AirpcapValidationType vt)
/* Function used to retrieve the string name given an AirpcapValidationType, or NULL in case of error */ const gchar* airpcap_get_validation_name(AirpcapValidationType vt)
{ if (vt == AIRPCAP_VT_ACCEPT_EVERYTHING) { return AIRPCAP_VALIDATION_TYPE_NAME_ALL; } else if (vt == AIRPCAP_VT_ACCEPT_CORRECT_FRAMES) { return AIRPCAP_VALIDATION_TYPE_NAME_CORRECT; } else if (vt == AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES) { return AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT; } else if (vt == AIRPCAP_VT_UNKNOWN) { return AIRPCAP_VALIDATION_TYPE_NAME_UNKNOWN; } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disable interrupt flag accumulator stop mode of selected channel. */
void EPWM_DisableAccStopMode(EPWM_T *epwm, uint32_t u32ChannelNum)
/* Disable interrupt flag accumulator stop mode of selected channel. */ void EPWM_DisableAccStopMode(EPWM_T *epwm, uint32_t u32ChannelNum)
{ (epwm)->IFA[u32ChannelNum] &= ~EPWM_IFA0_STPMOD_Msk; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The init_hwif_cs5530() routine guarantees that all drives will have valid default PIO timings set up before we get here. */
static void cs5530_set_pio_mode(ide_drive_t *drive, const u8 pio)
/* The init_hwif_cs5530() routine guarantees that all drives will have valid default PIO timings set up before we get here. */ static void cs5530_set_pio_mode(ide_drive_t *drive, const u8 pio)
{ unsigned long basereg = CS5530_BASEREG(drive->hwif); unsigned int format = (inl(basereg + 4) >> 31) & 1; outl(cs5530_pio_timings[format][pio], basereg + ((drive->dn & 1)<<3)); }
robutest/uclinux
C++
GPL-2.0
60
/* SPI0 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI0_IRQHandler(void)
/* SPI0 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI0_IRQHandler(void)
{ unsigned long ulEventFlags; unsigned long ulBase = SPI0_BASE; ulEventFlags = xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_IF; xHWREG(ulBase + SPI_CNTRL) |= ulEventFlags; if(g_pfnSPIHandlerCallbacks[0]) { g_pfnSPIHandlerCallbacks[0](0, 0, ulEventFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function multiplies a field element by x in the polynomial field representation. It uses 64-bit word operations to gain speed but compensates for machine endianess and hence works correctly on both big and little endian machines. */
static void esp_gf128mul_x_ble(unsigned char r[16], const unsigned char x[16])
/* This function multiplies a field element by x in the polynomial field representation. It uses 64-bit word operations to gain speed but compensates for machine endianess and hence works correctly on both big and little endian machines. */ static void esp_gf128mul_x_ble(unsigned char r[16], const unsigned char x[16])
{ uint64_t a, b, ra, rb; GET_UINT64_LE( a, x, 0 ); GET_UINT64_LE( b, x, 8 ); ra = ( a << 1 ) ^ 0x0087 >> ( 8 - ( ( b >> 63 ) << 3 ) ); rb = ( a >> 63 ) | ( b << 1 ); PUT_UINT64_LE( ra, r, 0 ); PUT_UINT64_LE( rb, r, 8 ); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This routine should not be called by a driver after its disconnect method has returned. */
void usb_poison_urb(struct urb *urb)
/* This routine should not be called by a driver after its disconnect method has returned. */ void usb_poison_urb(struct urb *urb)
{ might_sleep(); if (!(urb && urb->dev && urb->ep)) return; atomic_inc(&urb->reject); usb_hcd_unlink_urb(urb, -ENOENT); wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the Reference Divider value of a specific channel. */
static int fdc2x1x_set_fref_divider(const struct device *dev, uint8_t chx, uint16_t fref_div)
/* Set the Reference Divider value of a specific channel. */ static int fdc2x1x_set_fref_divider(const struct device *dev, uint8_t chx, uint16_t fref_div)
{ return fdc2x1x_reg_write_mask(dev, FDC2X1X_CLOCK_DIVIDERS_CH0 + chx, FDC2X1X_CLK_DIV_CHX_FREF_DIV_MSK, FDC2X1X_CLK_DIV_CHX_FREF_DIV_SET(fref_div)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Invalidate a level 1 Data cache line. If the byte specified by the address (Addr) is cached by the Data cache, the cacheline containing that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are NOT written to system memory before the line is invalidated. */
void Xil_L1DCacheInvalidateLine(u32 adr)
/* Invalidate a level 1 Data cache line. If the byte specified by the address (Addr) is cached by the Data cache, the cacheline containing that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are NOT written to system memory before the line is invalidated. */ void Xil_L1DCacheInvalidateLine(u32 adr)
{ mtcp(XREG_CP15_CACHE_SIZE_SEL, 0U); mtcp(XREG_CP15_INVAL_DC_LINE_MVA_POC, (adr & (~0x1FU))); dsb(); }
ua1arn/hftrx
C++
null
69
/* Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).. */
int32_t lsm6dso_mag_z_orient_set(lsm6dso_ctx_t *ctx, lsm6dso_mag_z_axis_t val)
/* Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).. */ int32_t lsm6dso_mag_z_orient_set(lsm6dso_ctx_t *ctx, lsm6dso_mag_z_axis_t val)
{ lsm6dso_mag_cfg_a_t reg; int32_t ret; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_MAG_CFG_A, (uint8_t*)&reg); if (ret == 0) { reg.mag_z_axis = (uint8_t) val; ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_MAG_CFG_A, (uint8_t*)&reg); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Allocates and Initializes one Diffie-Hellman Context for subsequent use. */
VOID* EFIAPI CryptoServiceDhNew(VOID)
/* Allocates and Initializes one Diffie-Hellman Context for subsequent use. */ VOID* EFIAPI CryptoServiceDhNew(VOID)
{ return CALL_BASECRYPTLIB (Dh.Services.New, DhNew, (), NULL); }
tianocore/edk2
C++
Other
4,240
/* Gets the width in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetWidth(void)
/* Gets the width in pixels of the LCD screen (varies depending on the current screen orientation) */ uint16_t lcdGetWidth(void)
{ switch (lcdOrientation) { case LCD_ORIENTATION_PORTRAIT: return ili9328Properties.width; break; case LCD_ORIENTATION_LANDSCAPE: default: return ili9328Properties.height; } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Gets a data element from the SPI interface. */
void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
/* Gets a data element from the SPI interface. */ void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
{ unsigned long i; unsigned char ucBitLength = SPIBitLengthGet(ulBase); xASSERT(ulBase == SPI0_BASE); for (i=0; i<ulLen; i++) { if (ucBitLength <= 8) { ((unsigned char*)pulRData)[i] = SPISingleDataReadWrite(ulBase, 0xFF); } else if (ucBitLength >= 8 && ucBitLength <= 16) { ((unsigned short*)pulRData)[i] = SPISingleDataReadWrite(ulBase, 0xFFFF); } else { ((unsigned long*)pulRData)[i] = SPISingleDataReadWrite(ulBase, 0xFFFFFF); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* @handle: handle of the loaded image @systable: system table */
static int setup_reboot(const efi_handle_t handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup_reboot(const efi_handle_t handle, const struct efi_system_table *systable)
{ watchdog_reset = false; return setup(handle, systable); }
4ms/stm32mp1-baremetal
C++
Other
137
/* The length of the hash result is dependent on the algorithm that is selected with the */
void SHAMD5HMACProcess(uint32_t ui32Base, uint32_t *pui32DataSrc, uint32_t ui32DataLength, uint32_t *pui32HashResult)
/* The length of the hash result is dependent on the algorithm that is selected with the */ void SHAMD5HMACProcess(uint32_t ui32Base, uint32_t *pui32DataSrc, uint32_t ui32DataLength, uint32_t *pui32HashResult)
{ ASSERT(ui32Base == SHAMD5_BASE); while((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_CONTEXT_READY) == 0) { } SHAMD5HashLengthSet(ui32Base, ui32DataLength); _SHAMD5DataWriteMultiple(ui32Base, pui32DataSrc, ui32DataLength); while((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0) { } SHAMD5ResultRead(ui32Base, pui32HashResult); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This does not return an error code because the core cannot care less if monitoring is not established. */
static void mon_bus_add(struct usb_bus *ubus)
/* This does not return an error code because the core cannot care less if monitoring is not established. */ static void mon_bus_add(struct usb_bus *ubus)
{ mon_bus_init(ubus); mutex_lock(&mon_lock); if (mon_bus0.nreaders != 0) ubus->monitored = 1; mutex_unlock(&mon_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Note - this device is not accessible from any high-level drivers (including generics), which is probably not optimal. We can add hooks later to attach */
struct scsi_device* scsi_get_host_dev(struct Scsi_Host *shost)
/* Note - this device is not accessible from any high-level drivers (including generics), which is probably not optimal. We can add hooks later to attach */ struct scsi_device* scsi_get_host_dev(struct Scsi_Host *shost)
{ struct scsi_device *sdev = NULL; struct scsi_target *starget; mutex_lock(&shost->scan_mutex); if (!scsi_host_scan_allowed(shost)) goto out; starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id); if (!starget) goto out; sdev = scsi_alloc_sdev(starget, 0, NULL); if (sdev) { sdev->sdev_gendev.parent = get_device(&starget->dev); sdev->borken = 0; } else scsi_target_reap(starget); put_device(&starget->dev); out: mutex_unlock(&shost->scan_mutex); return sdev; }
robutest/uclinux
C++
GPL-2.0
60
/* return 1 if the end of file was reached, 0 elsewhere */
int ZEXPORT unzeof(unzFile file)
/* return 1 if the end of file was reached, 0 elsewhere */ int ZEXPORT unzeof(unzFile file)
{ unz64_s* s; file_in_zip64_read_info_s* pfile_in_zip_read_info; if (file==NULL) return UNZ_PARAMERROR; s=(unz64_s*)file; pfile_in_zip_read_info=s->pfile_in_zip_read; if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; if (pfile_in_zip_read_info->rest_read_uncompressed == 0) return 1; else return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* On really big machines, get_writeback_state is expensive, so try to avoid calling it too often (ratelimiting). But once we're over the dirty memory limit we decrease the ratelimiting by a lot, to prevent individual processes from overshooting the limit by (ratelimit_pages) each. */
void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, unsigned long nr_pages_dirtied)
/* On really big machines, get_writeback_state is expensive, so try to avoid calling it too often (ratelimiting). But once we're over the dirty memory limit we decrease the ratelimiting by a lot, to prevent individual processes from overshooting the limit by (ratelimit_pages) each. */ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, unsigned long nr_pages_dirtied)
{ unsigned long ratelimit; unsigned long *p; ratelimit = ratelimit_pages; if (mapping->backing_dev_info->dirty_exceeded) ratelimit = 8; preempt_disable(); p = &__get_cpu_var(bdp_ratelimits); *p += nr_pages_dirtied; if (unlikely(*p >= ratelimit)) { ratelimit = sync_writeback_pages(*p); *p = 0; preempt_enable(); balance_dirty_pages(mapping, ratelimit); return; } preempt_enable(); }
robutest/uclinux
C++
GPL-2.0
60
/* We now support a flag for forced unmount like the other 'big iron' unixes. Our API is identical to OSF/1 to avoid making a mess of AMD */
SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
/* We now support a flag for forced unmount like the other 'big iron' unixes. Our API is identical to OSF/1 to avoid making a mess of AMD */ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
{ struct path path; int retval; retval = user_path(name, &path); if (retval) goto out; retval = -EINVAL; if (path.dentry != path.mnt->mnt_root) goto dput_and_out; if (!check_mnt(path.mnt)) goto dput_and_out; retval = -EPERM; if (!capable(CAP_SYS_ADMIN)) goto dput_and_out; retval = do_umount(path.mnt, flags); dput_and_out: dput(path.dentry); mntput_no_expire(path.mnt); out: return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified EXTI line flag is set or not. */
FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
/* Checks whether the specified EXTI line flag is set or not. */ FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
{ FlagStatus bitstatus = RESET; assert_param(IS_GET_EXTI_LINE(EXTI_Line)); if ((EXTI->PR & EXTI_Line) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Copies data from the source to the destination address. */
void CpuMemCopy(blt_addr dest, blt_addr src, blt_int16u len)
/* Copies data from the source to the destination address. */ void CpuMemCopy(blt_addr dest, blt_addr src, blt_int16u len)
{ blt_int8u *from, *to; from = (blt_int8u *)src; to = (blt_int8u *)dest; while (len-- > 0) { *to++ = *from++; CopService(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Registers an interrupt handler for the comparator interrupt. */
void ComparatorIntRegister(unsigned long ulBase, unsigned long ulComp, void(*pfnHandler)(void))
/* Registers an interrupt handler for the comparator interrupt. */ void ComparatorIntRegister(unsigned long ulBase, unsigned long ulComp, void(*pfnHandler)(void))
{ ASSERT(ulBase == COMP_BASE); ASSERT(ulComp < 3); IntRegister(INT_COMP0 + ulComp, pfnHandler); IntEnable(INT_COMP0 + ulComp); HWREG(ulBase + COMP_O_ACINTEN) |= 1 << ulComp; }
watterott/WebRadio
C++
null
71
/* Set the Multiple Timer control when RXMR0 matches RXTC. */
void SGPIO_RXMR0MULConfig(SGPIO_TypeDef *SGPIOx, u32 SGPIO_RXMR0Val, u32 SGPIO_RXMR0MULCtl)
/* Set the Multiple Timer control when RXMR0 matches RXTC. */ void SGPIO_RXMR0MULConfig(SGPIO_TypeDef *SGPIOx, u32 SGPIO_RXMR0Val, u32 SGPIO_RXMR0MULCtl)
{ u32 TempVal; assert_param(IS_SGPIO_ALL_PERIPH(SGPIOx)); assert_param(SGPIO_RXMR0Val <= 0xffff); SGPIOx->SGPIO_RXMR0 = SGPIO_RXMR0Val; TempVal = SGPIOx->SGPIO_RXMC_CTRL; TempVal &= (~BIT_SGPIO_RX_MR0MUL_CTRL); TempVal |= SGPIO_RXMR0MULCtl; SGPIOx->SGPIO_RXMC_CTRL = TempVal; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* There's very little reason to use this, you should really have a struct block_device just about everywhere and use bdevname() instead. */
const char* __bdevname(dev_t dev, char *buffer)
/* There's very little reason to use this, you should really have a struct block_device just about everywhere and use bdevname() instead. */ const char* __bdevname(dev_t dev, char *buffer)
{ scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)", MAJOR(dev), MINOR(dev)); return buffer; }
robutest/uclinux
C++
GPL-2.0
60
/* Slave Send a byte to I2C bus. This function is to send a byte on specified I2C BUS. */
void xI2CSlaveDataPut(unsigned long ulBase, unsigned char ucData)
/* Slave Send a byte to I2C bus. This function is to send a byte on specified I2C BUS. */ void xI2CSlaveDataPut(unsigned long ulBase, unsigned char ucData)
{ xI2CMasterDataPut(ulBase, ucData); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set CCAT mode @mode: use CCAT_MODE_CONFIG or CCAT_MODE_RUN */
void weim_cs0_settings(u32 mode)
/* Set CCAT mode @mode: use CCAT_MODE_CONFIG or CCAT_MODE_RUN */ void weim_cs0_settings(u32 mode)
{ struct weim *weim_regs = (struct weim *)WEIM_BASE_ADDR; writel(0x0, &weim_regs->cs0gcr1); writel(mode, &weim_regs->cs0gcr1); writel(0x00001002, &weim_regs->cs0gcr2); writel(0x04000000, &weim_regs->cs0rcr1); writel(0x00000000, &weim_regs->cs0rcr2); writel(0x04000000, &weim_regs->cs0wcr1); writel(0x00000000, &weim_regs->cs0wcr2); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Finds the protocol instance for the requested handle and protocol. Note: This function doesn't do parameters checking, it's caller's responsibility to pass in valid parameters. */
PROTOCOL_INTERFACE* CoreFindProtocolInterface(IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
/* Finds the protocol instance for the requested handle and protocol. Note: This function doesn't do parameters checking, it's caller's responsibility to pass in valid parameters. */ PROTOCOL_INTERFACE* CoreFindProtocolInterface(IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
{ PROTOCOL_INTERFACE *Prot; PROTOCOL_ENTRY *ProtEntry; LIST_ENTRY *Link; ASSERT_LOCKED (&gProtocolDatabaseLock); Prot = NULL; ProtEntry = CoreFindProtocolEntry (Protocol, FALSE); if (ProtEntry != NULL) { for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); if ((Prot->Interface == Interface) && (Prot->Protocol == ProtEntry)) { break; } Prot = NULL; } } return Prot; }
tianocore/edk2
C++
Other
4,240
/* R3000 style TLB load/store/modify handlers. This places the pte into ENTRYLO0 and writes it with tlbwi. Then it returns. */
static void __cpuinit build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp)
/* R3000 style TLB load/store/modify handlers. This places the pte into ENTRYLO0 and writes it with tlbwi. Then it returns. */ static void __cpuinit build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp)
{ uasm_i_mtc0(p, pte, C0_ENTRYLO0); uasm_i_mfc0(p, tmp, C0_EPC); uasm_i_tlbwi(p); uasm_i_jr(p, tmp); uasm_i_rfe(p); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine is called by the EBC execute functions to read EBC immediate values from the code stream. Since we can't assume alignment, each tries to read in the biggest chunks size available, but will revert to smaller reads if necessary. */
INT8 VmReadImmed8(IN VM_CONTEXT *VmPtr, IN UINT32 Offset)
/* This routine is called by the EBC execute functions to read EBC immediate values from the code stream. Since we can't assume alignment, each tries to read in the biggest chunks size available, but will revert to smaller reads if necessary. */ INT8 VmReadImmed8(IN VM_CONTEXT *VmPtr, IN UINT32 Offset)
{ return *(INT8 *)(VmPtr->Ip + Offset); }
tianocore/edk2
C++
Other
4,240
/* A level 2 link has timed out, therefore it appears to be a poor link, then don't use that neighbour until it is reset. Blow away all through routes and connections using this route. */
void rose_link_failed(ax25_cb *ax25, int reason)
/* A level 2 link has timed out, therefore it appears to be a poor link, then don't use that neighbour until it is reset. Blow away all through routes and connections using this route. */ void rose_link_failed(ax25_cb *ax25, int reason)
{ struct rose_neigh *rose_neigh; spin_lock_bh(&rose_neigh_list_lock); rose_neigh = rose_neigh_list; while (rose_neigh != NULL) { if (rose_neigh->ax25 == ax25) break; rose_neigh = rose_neigh->next; } if (rose_neigh != NULL) { rose_neigh->ax25 = NULL; ax25_cb_put(ax25); rose_del_route_by_neigh(rose_neigh); rose_kill_by_neigh(rose_neigh); } spin_unlock_bh(&rose_neigh_list_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Advance the receive pointer for the queue to the next message. */
void gru_free_message(struct gru_message_queue_desc *mqd, void *mesg)
/* Advance the receive pointer for the queue to the next message. */ void gru_free_message(struct gru_message_queue_desc *mqd, void *mesg)
{ struct message_queue *mq = mqd->mq; struct message_header *mhdr = mq->next; void *next, *pnext; int half = -1; int lines = mhdr->lines; if (lines == 2) restore_present2(mhdr, MQS_EMPTY); mhdr->present = MQS_EMPTY; pnext = mq->next; next = pnext + GRU_CACHE_LINE_BYTES * lines; if (next == mq->limit) { next = mq->start; half = 1; } else if (pnext < mq->start2 && next >= mq->start2) { half = 0; } if (half >= 0) mq->hstatus[half] = 1; mq->next = next; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will get next buffer from the dma queue and set the buffer address in the vpif register for capture. the buffer is marked active */
static void vpif_schedule_next_buffer(struct common_obj *common)
/* This function will get next buffer from the dma queue and set the buffer address in the vpif register for capture. the buffer is marked active */ static void vpif_schedule_next_buffer(struct common_obj *common)
{ unsigned long addr = 0; common->next_frm = list_entry(common->dma_queue.next, struct videobuf_buffer, queue); list_del(&common->next_frm->queue); common->next_frm->state = VIDEOBUF_ACTIVE; if (V4L2_MEMORY_USERPTR == common->memory) addr = common->next_frm->boff; else addr = videobuf_to_dma_contig(common->next_frm); common->set_addr(addr + common->ytop_off, addr + common->ybtm_off, addr + common->ctop_off, addr + common->cbtm_off); }
robutest/uclinux
C++
GPL-2.0
60
/* The net buffer allocated has the BlockOpNum's NET_BLOCK_OP, and its associated NET_VECTOR has the BlockNum's NET_BLOCK. But all the NET_BLOCK_OP and NET_BLOCK remain un-initialized. */
NET_BUF* NetbufAllocStruct(IN UINT32 BlockNum, IN UINT32 BlockOpNum)
/* The net buffer allocated has the BlockOpNum's NET_BLOCK_OP, and its associated NET_VECTOR has the BlockNum's NET_BLOCK. But all the NET_BLOCK_OP and NET_BLOCK remain un-initialized. */ NET_BUF* NetbufAllocStruct(IN UINT32 BlockNum, IN UINT32 BlockOpNum)
{ NET_BUF *Nbuf; NET_VECTOR *Vector; ASSERT (BlockOpNum >= 1); Nbuf = AllocateZeroPool (NET_BUF_SIZE (BlockOpNum)); if (Nbuf == NULL) { return NULL; } Nbuf->Signature = NET_BUF_SIGNATURE; Nbuf->RefCnt = 1; Nbuf->BlockOpNum = BlockOpNum; InitializeListHead (&Nbuf->List); if (BlockNum != 0) { Vector = AllocateZeroPool (NET_VECTOR_SIZE (BlockNum)); if (Vector == NULL) { goto FreeNbuf; } Vector->Signature = NET_VECTOR_SIGNATURE; Vector->RefCnt = 1; Vector->BlockNum = BlockNum; Nbuf->Vector = Vector; } return Nbuf; FreeNbuf: FreePool (Nbuf); return NULL; }
tianocore/edk2
C++
Other
4,240
/* Forces the TIMx output 1 waveform to active or inactive level. */
void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
/* Forces the TIMx output 1 waveform to active or inactive level. */ void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
{ uint32_t tmpccmr1 = 0; assert_param(IS_TIM_LIST1_PERIPH(TIMx)); assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC1M; tmpccmr1 |= TIM_ForcedAction; TIMx->CCMR1 = tmpccmr1; }
ajhc/demo-cortex-m3
C++
null
38
/* This function divides the 64-bit unsigned value Dividend by the 32-bit unsigned value Divisor and generates a 32-bit remainder. This function returns the 32-bit unsigned remainder. */
UINT32 EFIAPI InternalMathModU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
/* This function divides the 64-bit unsigned value Dividend by the 32-bit unsigned value Divisor and generates a 32-bit remainder. This function returns the 32-bit unsigned remainder. */ UINT32 EFIAPI InternalMathModU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
{ _asm { mov eax, dword ptr [Dividend + 4] mov ecx, Divisor xor edx, edx div ecx mov eax, dword ptr [Dividend + 0] div ecx mov eax, edx } }
tianocore/edk2
C++
Other
4,240
/* trigger_transmit causes the card to check for frames to be transmitted. This is accomplished by writing to the CSR1 port. The documentation claims that the act of writing is sufficient and that the value is ignored; I chose zero. */
static void trigger_transmit(struct xircom_private *card)
/* trigger_transmit causes the card to check for frames to be transmitted. This is accomplished by writing to the CSR1 port. The documentation claims that the act of writing is sufficient and that the value is ignored; I chose zero. */ static void trigger_transmit(struct xircom_private *card)
{ unsigned int val; enter("trigger_transmit"); val = 0; outl(val, card->io_port + CSR1); leave("trigger_transmit"); }
robutest/uclinux
C++
GPL-2.0
60
/* Wait for the env to be ready for execute specified TRB. */
EFI_STATUS EmmcPeimWaitTrbEnv(IN UINTN Bar, IN EMMC_TRB *Trb)
/* Wait for the env to be ready for execute specified TRB. */ EFI_STATUS EmmcPeimWaitTrbEnv(IN UINTN Bar, IN EMMC_TRB *Trb)
{ EFI_STATUS Status; EMMC_COMMAND_PACKET *Packet; UINT64 Timeout; BOOLEAN InfiniteWait; Packet = Trb->Packet; Timeout = Packet->Timeout; if (Timeout == 0) { InfiniteWait = TRUE; } else { InfiniteWait = FALSE; } while (InfiniteWait || (Timeout > 0)) { Status = EmmcPeimCheckTrbEnv (Bar, Trb); if (Status != EFI_NOT_READY) { return Status; } MicroSecondDelay (1); Timeout--; } return EFI_TIMEOUT; }
tianocore/edk2
C++
Other
4,240
/* We need sometimes to load the physical address of a kernel object. Often we can convert the virtual address to physical at execution time, but sometimes (either for performance reasons or during error recovery) we cannot to this. Patch the marked bundles to load the physical address. */
void __init ia64_patch_vtop(unsigned long start, unsigned long end)
/* We need sometimes to load the physical address of a kernel object. Often we can convert the virtual address to physical at execution time, but sometimes (either for performance reasons or during error recovery) we cannot to this. Patch the marked bundles to load the physical address. */ void __init ia64_patch_vtop(unsigned long start, unsigned long end)
{ s32 *offp = (s32 *) start; u64 ip; while (offp < (s32 *) end) { ip = (u64) offp + *offp; ia64_patch_imm64(ip, ia64_tpa(get_imm64(ip))); ia64_fc((void *) ip); ++offp; } ia64_sync_i(); ia64_srlz_i(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is called to asynchronously write the buffer associated with this buf log item out to disk. The buffer will already have been locked by a successful call to xfs_buf_item_trylock(). If the buffer still has B_DELWRI set, then get it going out to disk with a call to bawrite(). If not, then just release the buffer. */
STATIC void xfs_buf_item_push(xfs_buf_log_item_t *bip)
/* This is called to asynchronously write the buffer associated with this buf log item out to disk. The buffer will already have been locked by a successful call to xfs_buf_item_trylock(). If the buffer still has B_DELWRI set, then get it going out to disk with a call to bawrite(). If not, then just release the buffer. */ STATIC void xfs_buf_item_push(xfs_buf_log_item_t *bip)
{ xfs_buf_t *bp; ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); trace_xfs_buf_item_push(bip); bp = bip->bli_buf; if (XFS_BUF_ISDELAYWRITE(bp)) { int error; error = xfs_bawrite(bip->bli_item.li_mountp, bp); if (error) xfs_fs_cmn_err(CE_WARN, bip->bli_item.li_mountp, "xfs_buf_item_push: pushbuf error %d on bip %p, bp %p", error, bip, bp); } else { xfs_buf_relse(bp); } }
robutest/uclinux
C++
GPL-2.0
60
/* The signal handle of IP6's recycle event. It is called back when the upper layer releases the packet. */
VOID EFIAPI Ip6OnRecyclePacket(IN EFI_EVENT Event, IN VOID *Context)
/* The signal handle of IP6's recycle event. It is called back when the upper layer releases the packet. */ VOID EFIAPI Ip6OnRecyclePacket(IN EFI_EVENT Event, IN VOID *Context)
{ IP6_RXDATA_WRAP *Wrap; Wrap = (IP6_RXDATA_WRAP *)Context; EfiAcquireLockOrFail (&Wrap->IpInstance->RecycleLock); RemoveEntryList (&Wrap->Link); EfiReleaseLock (&Wrap->IpInstance->RecycleLock); ASSERT (!NET_BUF_SHARED (Wrap->Packet)); NetbufFree (Wrap->Packet); gBS->CloseEvent (Wrap->RxData.RecycleSignal); FreePool (Wrap); }
tianocore/edk2
C++
Other
4,240
/* Retrieve ordinal number of the given sercom hardware instance. */
static uint8_t _sercom_get_hardware_index(const void *const hw)
/* Retrieve ordinal number of the given sercom hardware instance. */ static uint8_t _sercom_get_hardware_index(const void *const hw)
{ Sercom *const sercom_modules[] = SERCOM_INSTS; for (uint32_t i = 0; i < SERCOM_INST_NUM; i++) { if ((uint32_t)hw == (uint32_t)sercom_modules[i]) { return i; } } return 0; }
eclipse-threadx/getting-started
C++
Other
310
/* Converts the number of bytes in power of two and returns the power. */
uint8_t convert_from_bytes_to_power_of_two(uint16_t NumberOfBytes)
/* Converts the number of bytes in power of two and returns the power. */ uint8_t convert_from_bytes_to_power_of_two(uint16_t NumberOfBytes)
{ uint8_t count = 0; while (NumberOfBytes != 1) { NumberOfBytes >>= 1; count++; } return(count); }
avem-labs/Avem
C++
MIT License
1,752
/* Returns the amount or 0 if none or an error occured */
size_t xmlBufAvail(const xmlBufPtr buf)
/* Returns the amount or 0 if none or an error occured */ size_t xmlBufAvail(const xmlBufPtr buf)
{ if ((!buf) || (buf->error)) return 0; CHECK_COMPAT(buf) return(buf->size - buf->use); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Create an instance of a json from a pool. */
static json_t * poolAlloc(jsonPool_t *pool)
/* Create an instance of a json from a pool. */ static json_t * poolAlloc(jsonPool_t *pool)
{ jsonStaticPool_t *spool = json_serviceOf(pool, jsonStaticPool_t, pool); if (spool->nextFree >= spool->qty) return 0; return spool->mem + spool->nextFree++; }
Luos-io/luos_engine
C++
MIT License
496
/* This function handles sEE DMA TX interrupt request. */
void EEPROM_I2C_DMA_TX_IRQHandler(void)
/* This function handles sEE DMA TX interrupt request. */ void EEPROM_I2C_DMA_TX_IRQHandler(void)
{ HAL_DMA_IRQHandler(heval_I2c.hdmatx); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Insert extents into the leaf block. The extent (@o_start) is overwritten by inserted extents. */
static void mext_insert_inside_block(struct ext4_extent *o_start, struct ext4_extent *o_end, struct ext4_extent *start_ext, struct ext4_extent *new_ext, struct ext4_extent *end_ext, struct ext4_extent_header *eh, int range_to_move)
/* Insert extents into the leaf block. The extent (@o_start) is overwritten by inserted extents. */ static void mext_insert_inside_block(struct ext4_extent *o_start, struct ext4_extent *o_end, struct ext4_extent *start_ext, struct ext4_extent *new_ext, struct ext4_extent *end_ext, struct ext4_extent_header *eh, int range_to_move)
{ int i = 0; unsigned long len; if (range_to_move && o_end < EXT_LAST_EXTENT(eh)) { len = (unsigned long)(EXT_LAST_EXTENT(eh) + 1) - (unsigned long)(o_end + 1); memmove(o_end + 1 + range_to_move, o_end + 1, len); } if (start_ext->ee_len) o_start[i++].ee_len = start_ext->ee_len; if (new_ext->ee_len) { o_start[i] = *new_ext; ext4_ext_store_pblock(&o_start[i++], ext_pblock(new_ext)); } if (end_ext->ee_len) o_start[i] = *end_ext; le16_add_cpu(&eh->eh_entries, range_to_move); }
robutest/uclinux
C++
GPL-2.0
60
/* A new qset is created if one does not already exist. */
struct whc_qset* get_qset(struct whc *whc, struct urb *urb, gfp_t mem_flags)
/* A new qset is created if one does not already exist. */ struct whc_qset* get_qset(struct whc *whc, struct urb *urb, gfp_t mem_flags)
{ struct whc_qset *qset; qset = urb->ep->hcpriv; if (qset == NULL) { qset = qset_alloc(whc, mem_flags); if (qset == NULL) return NULL; qset->ep = urb->ep; urb->ep->hcpriv = qset; qset_fill_qh(whc, qset, urb); } return qset; }
robutest/uclinux
C++
GPL-2.0
60
/* Any new configuration parameters written to the display engine are not activated until the global configuration valid flag is set in the CONFIG_VALID register. */
STATIC VOID SetConfigValid(VOID)
/* Any new configuration parameters written to the display engine are not activated until the global configuration valid flag is set in the CONFIG_VALID register. */ STATIC VOID SetConfigValid(VOID)
{ if (mDpDeviceId == MALIDP_500) { MmioOr32 (DP_BASE + DP_DP500_CONFIG_VALID, DP_DC_CONFIG_VALID); } else { MmioOr32 (DP_BASE + DP_DC_CONFIG_VALID, DP_DC_CONFIG_VALID); } }
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciWrite32(IN UINTN Address, IN UINT32 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciWrite32(IN UINTN Address, IN UINT32 Value)
{ return PciCf8Write32 (Address, Value); }
tianocore/edk2
C++
Other
4,240
/* Get Word1 of the unique device identifier (UID based on 96 bits) */
uint32_t LL_GetUID_Word1(void)
/* Get Word1 of the unique device identifier (UID based on 96 bits) */ uint32_t LL_GetUID_Word1(void)
{ return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U)))); }
remotemcu/remcu-chip-sdks
C++
null
436
/* A '-' followed by the 'name' of a socket means we close the socket. */
static ssize_t __write_ports_delfd(char *buf)
/* A '-' followed by the 'name' of a socket means we close the socket. */ static ssize_t __write_ports_delfd(char *buf)
{ char *toclose; int len = 0; toclose = kstrdup(buf + 1, GFP_KERNEL); if (toclose == NULL) return -ENOMEM; if (nfsd_serv != NULL) len = svc_sock_names(nfsd_serv, buf, SIMPLE_TRANSACTION_LIMIT, toclose); if (len >= 0) lockd_down(); kfree(toclose); return len; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes key 3 configuration registers, which are used for encryption or decryption. */
void AESKey3Set(uint32_t ui32Base, uint32_t *pui32Key)
/* Writes key 3 configuration registers, which are used for encryption or decryption. */ void AESKey3Set(uint32_t ui32Base, uint32_t *pui32Key)
{ ASSERT(ui32Base == AES_BASE); HWREG(ui32Base + AES_O_KEY2_4) = pui32Key[0]; HWREG(ui32Base + AES_O_KEY2_5) = pui32Key[1]; HWREG(ui32Base + AES_O_KEY2_6) = pui32Key[2]; HWREG(ui32Base + AES_O_KEY2_7) = pui32Key[3]; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Parameter: card = pointer to card struct. c = char to store. */
static void isdnloop_putmsg(isdnloop_card *card, unsigned char c)
/* Parameter: card = pointer to card struct. c = char to store. */ static void isdnloop_putmsg(isdnloop_card *card, unsigned char c)
{ ulong flags; spin_lock_irqsave(&card->isdnloop_lock, flags); *card->msg_buf_write++ = (c == 0xff) ? '\n' : c; if (card->msg_buf_write == card->msg_buf_read) { if (++card->msg_buf_read > card->msg_buf_end) card->msg_buf_read = card->msg_buf; } if (card->msg_buf_write > card->msg_buf_end) card->msg_buf_write = card->msg_buf; spin_unlock_irqrestore(&card->isdnloop_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Properly shutdown the hcd, call driver's shutdown routine. */
static int ehci_hcd_xilinx_of_shutdown(struct of_device *op)
/* Properly shutdown the hcd, call driver's shutdown routine. */ static int ehci_hcd_xilinx_of_shutdown(struct of_device *op)
{ struct usb_hcd *hcd = dev_get_drvdata(&op->dev); if (hcd->driver->shutdown) hcd->driver->shutdown(hcd); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call. */
int usb_get_status(struct usb_host_virt_dev *dev, s32 type, s32 target, void *data)
/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call. */ int usb_get_status(struct usb_host_virt_dev *dev, s32 type, s32 target, void *data)
{ s32 ret = 0; u16 *status = malloc(sizeof(*status)); if (!status) { __err("ERR: usb_get_status, malloc failed"); return -ENOMEM; } memset(status, 0, sizeof(*status)); ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, status, sizeof(*status), USB_CTRL_GET_TIMEOUT); *(u16 *)data = *status; if (status) { free(status); status = NULL; } else { __err("ERR: parameter is NULL, can't free"); } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called by the tty driver when there's room for more data to send. */
static void gigaset_tty_wakeup(struct tty_struct *tty)
/* Called by the tty driver when there's room for more data to send. */ static void gigaset_tty_wakeup(struct tty_struct *tty)
{ struct cardstate *cs = cs_get(tty); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); if (!cs) return; tasklet_schedule(&cs->write_tasklet); cs_put(cs); }
robutest/uclinux
C++
GPL-2.0
60
/* Disables GPIO pins and USART from FPGA register access. */
static void spiDisable(void)
/* Disables GPIO pins and USART from FPGA register access. */ static void spiDisable(void)
{ USART_Reset(USART_USED); GPIO_PinModeSet(gpioPortD, 13, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPIBUS_CONNECT, 13, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPIBUS_CONNECT, 12, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_TX, PIN_SPI_TX, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_RX, PIN_SPI_RX, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_CLK, PIN_SPI_CLK, gpioModeDisabled, 0); GPIO_PinModeSet(PORT_SPI_CS, PIN_SPI_CS, gpioModeDisabled, 0); CMU_ClockEnable(USART_CLK, false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clear the stimer counter. This function clears the STimer Counter and leaves the stimer running. */
void am_hal_stimer_counter_clear(void)
/* Clear the stimer counter. This function clears the STimer Counter and leaves the stimer running. */ void am_hal_stimer_counter_clear(void)
{ AM_REG(CTIMER, STCFG) |= AM_REG_CTIMER_STCFG_CLEAR_M; AM_REG(CTIMER, STCFG) &= ~AM_REG_CTIMER_STCFG_CLEAR_M; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* After finished, mnt_drop_write must be called as usual to drop the reference. */
int mnt_clone_write(struct vfsmount *mnt)
/* After finished, mnt_drop_write must be called as usual to drop the reference. */ int mnt_clone_write(struct vfsmount *mnt)
{ if (__mnt_is_readonly(mnt)) return -EROFS; preempt_disable(); inc_mnt_writers(mnt); preempt_enable(); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the version of the embedded ARM processor. */
uint32_t chipid_read_processor(Chipid *p_chipid)
/* Get the version of the embedded ARM processor. */ uint32_t chipid_read_processor(Chipid *p_chipid)
{ return p_chipid->CHIPID_CIDR & CHIPID_CIDR_EPROC_Msk; }
remotemcu/remcu-chip-sdks
C++
null
436
/* The usb-host may poll the endpoint faster then our guest, resulting in lots of smaller bulkp-s. The below buffered_bulk_in_complete* functions combine data from multiple bulkp-s into a single packet, avoiding bufpq overflows. */
static void usbredir_buffered_bulk_add_data_to_packet(USBRedirDevice *dev, struct buf_packet *bulkp, int count, USBPacket *p, uint8_t ep)
/* The usb-host may poll the endpoint faster then our guest, resulting in lots of smaller bulkp-s. The below buffered_bulk_in_complete* functions combine data from multiple bulkp-s into a single packet, avoiding bufpq overflows. */ static void usbredir_buffered_bulk_add_data_to_packet(USBRedirDevice *dev, struct buf_packet *bulkp, int count, USBPacket *p, uint8_t ep)
{ usb_packet_copy(p, bulkp->data + bulkp->offset, count); bulkp->offset += count; if (bulkp->offset == bulkp->len) { usbredir_handle_status(dev, p, bulkp->status); bufp_free(dev, bulkp, ep); } }
ve3wwg/teensy3_qemu
C++
Other
15
/* You must explicitly specifiy the @generation for which the node ID is valid, to avoid sending packets to the wrong nodes when we race with a bus reset. */
int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, u64 addr, quadlet_t *buffer, size_t length)
/* You must explicitly specifiy the @generation for which the node ID is valid, to avoid sending packets to the wrong nodes when we race with a bus reset. */ int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, u64 addr, quadlet_t *buffer, size_t length)
{ struct hpsb_packet *packet; int retval; if (length == 0) return -EINVAL; packet = hpsb_make_writepacket(host, node, addr, buffer, length); if (!packet) return -ENOMEM; packet->generation = generation; retval = hpsb_send_packet_and_wait(packet); if (retval < 0) goto hpsb_write_fail; retval = hpsb_packet_success(packet); hpsb_write_fail: hpsb_free_tlabel(packet); hpsb_free_packet(packet); return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* Wake up duration event. 1LSb = 1 / ODR. */
int32_t lsm6dso_wkup_dur_set(stmdev_ctx_t *ctx, uint8_t val)
/* Wake up duration event. 1LSb = 1 / ODR. */ int32_t lsm6dso_wkup_dur_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dso_wake_up_dur_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t *)&reg, 1); if (ret == 0) { reg.wake_dur = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns non-zero if opcode modifies the interrupt flag. */
static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
/* Returns non-zero if opcode modifies the interrupt flag. */ static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
{ switch (*insn) { case 0xfa: case 0xfb: case 0xcf: case 0x9d: return 1; } if (is_REX_prefix(insn)) return is_IF_modifier(++insn); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* qset_delete - wait for a qset to be unused, then free it. */
void qset_delete(struct whc *whc, struct whc_qset *qset)
/* qset_delete - wait for a qset to be unused, then free it. */ void qset_delete(struct whc *whc, struct whc_qset *qset)
{ wait_for_completion(&qset->remove_complete); qset_free(whc, qset); }
robutest/uclinux
C++
GPL-2.0
60
/* Remove the pernet operations structure from the list to be used when network namespaces are created or destroyed. In addition run the exit method for all existing network namespaces. */
void unregister_pernet_device(struct pernet_operations *ops)
/* Remove the pernet operations structure from the list to be used when network namespaces are created or destroyed. In addition run the exit method for all existing network namespaces. */ void unregister_pernet_device(struct pernet_operations *ops)
{ mutex_lock(&net_mutex); if (&ops->list == first_device) first_device = first_device->next; unregister_pernet_operations(ops); mutex_unlock(&net_mutex); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @new_blocks: on return it will store the new block numbers for the indirect blocks(if needed) and the first direct block, @blks: on return it will store the total number of allocated direct blocks */
static int ext2_alloc_blocks(struct inode *inode, ext2_fsblk_t goal, int indirect_blks, int blks, ext2_fsblk_t new_blocks[4], int *err)
/* @new_blocks: on return it will store the new block numbers for the indirect blocks(if needed) and the first direct block, @blks: on return it will store the total number of allocated direct blocks */ static int ext2_alloc_blocks(struct inode *inode, ext2_fsblk_t goal, int indirect_blks, int blks, ext2_fsblk_t new_blocks[4], int *err)
{ int target, i; unsigned long count = 0; int index = 0; ext2_fsblk_t current_block = 0; int ret = 0; target = blks + indirect_blks; while (1) { count = target; current_block = ext2_new_blocks(inode,goal,&count,err); if (*err) goto failed_out; target -= count; while (index < indirect_blks && count) { new_blocks[index++] = current_block++; count--; } if (count > 0) break; } new_blocks[index] = current_block; ret = count; *err = 0; return ret; failed_out: for (i = 0; i <index; i++) ext2_free_blocks(inode, new_blocks[i], 1); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Analyse the changes in an effect, and tell if we need to send a magnitude parameter packet */
static int need_magnitude_modifier(struct iforce *iforce, struct ff_effect *old, struct ff_effect *effect)
/* Analyse the changes in an effect, and tell if we need to send a magnitude parameter packet */ static int need_magnitude_modifier(struct iforce *iforce, struct ff_effect *old, struct ff_effect *effect)
{ if (effect->type != FF_CONSTANT) { dev_warn(&iforce->dev->dev, "bad effect type in %s\n", __func__); return 0; } return old->u.constant.level != effect->u.constant.level; }
robutest/uclinux
C++
GPL-2.0
60
/* scsi_host_put - dec a Scsi_Host ref count @shost: Pointer to Scsi_Host to dec. */
void scsi_host_put(struct Scsi_Host *shost)
/* scsi_host_put - dec a Scsi_Host ref count @shost: Pointer to Scsi_Host to dec. */ void scsi_host_put(struct Scsi_Host *shost)
{ put_device(&shost->shost_gendev); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the TIMx Output Compare 3 Fast feature. */
void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 3 Fast feature. */ void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= CCMR_OC13FE_Reset; tmpccmr2 |= TIM_OCFast; TIMx->CCMR2 = tmpccmr2; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The duplicated net buffer will allocate its own memory to hold the data of the source net buffer. */
NET_BUF* EFIAPI NetbufDuplicate(IN NET_BUF *Nbuf, IN OUT NET_BUF *Duplicate OPTIONAL, IN UINT32 HeadSpace)
/* The duplicated net buffer will allocate its own memory to hold the data of the source net buffer. */ NET_BUF* EFIAPI NetbufDuplicate(IN NET_BUF *Nbuf, IN OUT NET_BUF *Duplicate OPTIONAL, IN UINT32 HeadSpace)
{ UINT8 *Dst; NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); if (Duplicate == NULL) { Duplicate = NetbufAlloc (Nbuf->TotalSize + HeadSpace); } if (Duplicate == NULL) { return NULL; } CopyMem (Duplicate->ProtoData, Nbuf->ProtoData, NET_PROTO_DATA); NetbufReserve (Duplicate, HeadSpace); Dst = NetbufAllocSpace (Duplicate, Nbuf->TotalSize, NET_BUF_TAIL); NetbufCopy (Nbuf, 0, Nbuf->TotalSize, Dst); return Duplicate; }
tianocore/edk2
C++
Other
4,240
/* This function provides accurate delay (in milliseconds) based on variable incremented. */
__weak void ald_delay_1ms(__IO uint32_t delay)
/* This function provides accurate delay (in milliseconds) based on variable incremented. */ __weak void ald_delay_1ms(__IO uint32_t delay)
{ uint32_t tick, __delay; switch (__systick_interval) { case ALD_SYSTICK_INTERVAL_1MS: __delay = delay; break; case ALD_SYSTICK_INTERVAL_10MS: __delay = delay / 10; break; case ALD_SYSTICK_INTERVAL_100MS: __delay = delay / 100; break; case ALD_SYSTICK_INTERVAL_1000MS: __delay = delay / 1000; break; default: __delay = delay; break; } tick = ald_get_tick(); __delay = __delay == 0 ? 1 : __delay; while ((ald_get_tick() - tick) < __delay) ; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Polls the status of the Write In Progress (WIP) flag in the EEPROM's status register and loop until write operation has completed. */
uint32_t sEE_WaitEepromStandbyState(void)
/* Polls the status of the Write In Progress (WIP) flag in the EEPROM's status register and loop until write operation has completed. */ uint32_t sEE_WaitEepromStandbyState(void)
{ uint8_t sEEstatus = 0; sEE_CS_LOW(); sEE_SendByte(sEE_CMD_RDSR); do { sEEstatus = sEE_SendByte(sEE_DUMMY_BYTE); } while ((sEEstatus & sEE_WIP_FLAG) == SET); sEE_CS_HIGH(); return 0; }
avem-labs/Avem
C++
MIT License
1,752
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
{ ASSERT ((Port & 3) == 0); return (UINT32)IoWriteWorker (Port, EfiCpuIoWidthUint32, Value); }
tianocore/edk2
C++
Other
4,240
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI MnpDestroyServiceChildEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ EFI_STATUS EFIAPI MnpDestroyServiceChildEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
{ MNP_SERVICE_DATA *MnpServiceData; MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry); return MnpDestroyServiceChild (MnpServiceData); }
tianocore/edk2
C++
Other
4,240
/* Return value: number of pages requested to be freed which were not */
static long cmm_free_pages(long nr)
/* Return value: number of pages requested to be freed which were not */ static long cmm_free_pages(long nr)
{ struct cmm_page_array *pa; unsigned long addr; cmm_dbg("Begin free of %ld pages.\n", nr); spin_lock(&cmm_lock); pa = cmm_page_list; while (nr) { if (!pa || pa->index <= 0) break; addr = pa->page[--pa->index]; if (pa->index == 0) { pa = pa->next; free_page((unsigned long) cmm_page_list); cmm_page_list = pa; } plpar_page_set_active(__pa(addr)); free_page(addr); loaned_pages--; nr--; totalram_pages++; } spin_unlock(&cmm_lock); cmm_dbg("End request with %ld pages unfulfilled\n", nr); return nr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Change Logs: Date Author Notes Wayne First version */
unsigned int mii_nway_result(unsigned int negotiated)
/* Change Logs: Date Author Notes Wayne First version */ unsigned int mii_nway_result(unsigned int negotiated)
{ unsigned int ret; if (negotiated & LPA_100FULL) ret = LPA_100FULL; else if (negotiated & LPA_100BASE4) ret = LPA_100BASE4; else if (negotiated & LPA_100HALF) ret = LPA_100HALF; else if (negotiated & LPA_10FULL) ret = LPA_10FULL; else ret = LPA_10HALF; return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the value of the selected IO pins. */
void stmpe1600_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState)
/* Set the value of the selected IO pins. */ void stmpe1600_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState)
{ uint8_t tmpData[2] = {0 , 0}; IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPMR, tmpData, 2); tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8)); if(PinState != 0) { tmp |= (uint16_t)IO_Pin; } else { tmp &= ~(uint16_t)IO_Pin; } IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPSR, (uint8_t *)&tmp, 2); }
eclipse-threadx/getting-started
C++
Other
310
/* If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
/* If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ VOID* EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
{ if (Length == 0) { return Buffer; } ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); return InternalMemSetMem (Buffer, Length, Value); }
tianocore/edk2
C++
Other
4,240
/* Initializes all fields of the font options object to default values. */
void _cairo_font_options_init_default(cairo_font_options_t *options)
/* Initializes all fields of the font options object to default values. */ void _cairo_font_options_init_default(cairo_font_options_t *options)
{ options->antialias = CAIRO_ANTIALIAS_DEFAULT; options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT; options->hint_style = CAIRO_HINT_STYLE_DEFAULT; options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT; options->round_glyph_positions = CAIRO_ROUND_GLYPH_POS_DEFAULT; options->variations = NULL; }
xboot/xboot
C++
MIT License
779
/* Enable anti version rollback. FVC can limit the version number to be increased only to avoid version rollback. This function is used to enable it. */
void FVC_EnableMonotone(void)
/* Enable anti version rollback. FVC can limit the version number to be increased only to avoid version rollback. This function is used to enable it. */ void FVC_EnableMonotone(void)
{ FVC->CTL = FVC_VCODE | FVC_CTL_MONOEN_Msk; while(FVC->STS & FVC->STS & FVC_STS_BUSY_Msk) {} }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This I2C function resynchronizes communication. Parameters are not used for I2C. */
uint8_t sha204p_resync(uint8_t size, uint8_t *response)
/* This I2C function resynchronizes communication. Parameters are not used for I2C. */ uint8_t sha204p_resync(uint8_t size, uint8_t *response)
{ twi_package_t twi_package = { .chip = (uint8_t) 0xFF, .addr_length = 1, .length = 0, .buffer = (void *) response, .addr[0] = 0 }; (void) twi_master_read(ATSHA204_TWI_PORT, &twi_package); return sha204p_reset_io(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* whether to stretch SCL low when data is not ready in slave mode */
void i2c_stretch_scl_low_config(uint32_t i2c_periph, uint32_t stretchpara)
/* whether to stretch SCL low when data is not ready in slave mode */ void i2c_stretch_scl_low_config(uint32_t i2c_periph, uint32_t stretchpara)
{ uint32_t ctl = 0U; ctl = I2C_CTL0(i2c_periph); ctl &= ~(I2C_CTL0_DISSTRC); ctl |= stretchpara; I2C_CTL0(i2c_periph) = ctl; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* alps_poll() - poll the touchpad for current motion packet. Used in resync. */
static int alps_poll(struct psmouse *psmouse)
/* alps_poll() - poll the touchpad for current motion packet. Used in resync. */ static int alps_poll(struct psmouse *psmouse)
{ struct alps_data *priv = psmouse->private; unsigned char buf[6]; bool poll_failed; if (priv->i->flags & ALPS_PASS) alps_passthrough_mode(psmouse, true); poll_failed = ps2_command(&psmouse->ps2dev, buf, PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0; if (priv->i->flags & ALPS_PASS) alps_passthrough_mode(psmouse, false); if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0) return -1; if ((psmouse->badbyte & 0xc8) == 0x08) { if (ps2_command(&psmouse->ps2dev, buf, PSMOUSE_CMD_POLL | (3 << 8))) return -1; } memcpy(psmouse->packet, buf, sizeof(buf)); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Standard_GetDescriptorData is used for descriptors transfer. : This routine is used for the descriptors resident in Flash or RAM pDesc can be in either Flash or RAM The purpose of this routine is to have a versatile way to response descriptors request. It allows user to generate certain descriptors with software or read descriptors from external storage part by part. Input : - Length - Length of the data in this transfer. */
uint8_t* Standard_GetDescriptorData(uint16_t Length, USB_OneDescriptor *pDesc)
/* Standard_GetDescriptorData is used for descriptors transfer. : This routine is used for the descriptors resident in Flash or RAM pDesc can be in either Flash or RAM The purpose of this routine is to have a versatile way to response descriptors request. It allows user to generate certain descriptors with software or read descriptors from external storage part by part. Input : - Length - Length of the data in this transfer. */ uint8_t* Standard_GetDescriptorData(uint16_t Length, USB_OneDescriptor *pDesc)
{ uint32_t wOffset; wOffset = pInformation->Ctrl_Info.Usb_wOffset; if (Length == 0) { pInformation->Ctrl_Info.Usb_wLength = pDesc->Descriptor_Size - wOffset; return 0; } return pDesc->Descriptor + wOffset; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This API is used to get the tap threshold in the register 0x2B bit from 0 to 4. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_tap_thres(u8 *tap_thres_u8)
/* This API is used to get the tap threshold in the register 0x2B bit from 0 to 4. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_tap_thres(u8 *tap_thres_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_TAP_THRES_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *tap_thres_u8 = BMA2x2_GET_BITSLICE (data_u8, BMA2x2_TAP_THRES); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Erase a Page of FLASH. Note that the page sizes differ between devices. See the reference manual or the FLASH programming manual for details. */
void flash_erase_page(uint32_t page_address)
/* Erase a Page of FLASH. Note that the page sizes differ between devices. See the reference manual or the FLASH programming manual for details. */ void flash_erase_page(uint32_t page_address)
{ flash_wait_for_last_operation(); if ((DESIG_FLASH_SIZE > 512) && (page_address >= FLASH_BASE+0x00080000)) { FLASH_CR2 |= FLASH_CR_PER; FLASH_AR2 = page_address; FLASH_CR2 |= FLASH_CR_STRT; } else { FLASH_CR |= FLASH_CR_PER; FLASH_AR = page_address; FLASH_CR |= FLASH_CR_STRT; } flash_wait_for_last_operation(); if ((DESIG_FLASH_SIZE > 512) && (page_address >= FLASH_BASE+0x00080000)) { FLASH_CR2 &= ~FLASH_CR_PER; } else { FLASH_CR &= ~FLASH_CR_PER; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* registering the path loss handler of the application */
void register_pathloss_handler(reporter_callback_t pathloss_fn)
/* registering the path loss handler of the application */ void register_pathloss_handler(reporter_callback_t pathloss_fn)
{ pathloss_cb = pathloss_fn; }
remotemcu/remcu-chip-sdks
C++
null
436
/* tipc_link_stop - purge all inbound and outbound messages associated with link @l_ptr: pointer to link */
void tipc_link_stop(struct link *l_ptr)
/* tipc_link_stop - purge all inbound and outbound messages associated with link @l_ptr: pointer to link */ void tipc_link_stop(struct link *l_ptr)
{ struct sk_buff *buf; struct sk_buff *next; buf = l_ptr->oldest_deferred_in; while (buf) { next = buf->next; buf_discard(buf); buf = next; } buf = l_ptr->first_out; while (buf) { next = buf->next; buf_discard(buf); buf = next; } tipc_link_reset_fragments(l_ptr); buf_discard(l_ptr->proto_msg_queue); l_ptr->proto_msg_queue = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if data has been received and loaded in SSC_RHR. */
uint32_t ssc_is_rx_ready(Ssc *p_ssc)
/* Check if data has been received and loaded in SSC_RHR. */ uint32_t ssc_is_rx_ready(Ssc *p_ssc)
{ if (p_ssc->SSC_SR & SSC_SR_RXRDY) { return SSC_RC_YES; } return SSC_RC_NO; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Clear slave resume flag @rmtoll ICR CSRF LL_SWPMI_ClearFlag_SR. */
void LL_SWPMI_ClearFlag_SR(SWPMI_TypeDef *SWPMIx)
/* Clear slave resume flag @rmtoll ICR CSRF LL_SWPMI_ClearFlag_SR. */ void LL_SWPMI_ClearFlag_SR(SWPMI_TypeDef *SWPMIx)
{ WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CSRF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Extract the startoff field from a disk format bmap extent record. */
xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r)
/* Extract the startoff field from a disk format bmap extent record. */ xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r)
{ return ((xfs_fileoff_t)be64_to_cpu(r->l0) & xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; }
robutest/uclinux
C++
GPL-2.0
60