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
/* Inputs : cmd - struct scsi_cmnd structure to have pointers reset. */
static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)
/* Inputs : cmd - struct scsi_cmnd structure to have pointers reset. */ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd)
{ if (scsi_bufflen(cmd)) { cmd->SCp.buffer = scsi_sglist(cmd); cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer); cmd->SCp.this_residual = cmd->SCp.buffer->length; } else { cmd->SCp.buffer = NULL; cmd->SCp.buffers_residual = 0; cmd->SCp.ptr = NULL; cmd->SCp.this_residual = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Determines if there are any space in the transmit register. */
xtBoolean UARTSpaceAvail(unsigned long ulBase)
/* Determines if there are any space in the transmit register. */ xtBoolean UARTSpaceAvail(unsigned long ulBase)
{ xtBoolean ulStatus = xfalse; xASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) || (ulBase == UART2_BASE) ); ulStatus = (xtBoolean)(xHWREGB(ulBase + UART_012_S1) & ((unsigned char) UART_012_S1_TDRE_MASK)); if(0 != ulStatus) { ulStatus = 1; } else { ulStatus = 0; } return (ulStatus); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function returns the size, in bytes, of the image execution info table specified by ImageExeInfoTable. If ImageExeInfoTable is NULL, then 0 is returned. */
UINTN GetImageExeInfoTableSize(EFI_IMAGE_EXECUTION_INFO_TABLE *ImageExeInfoTable)
/* This function returns the size, in bytes, of the image execution info table specified by ImageExeInfoTable. If ImageExeInfoTable is NULL, then 0 is returned. */ UINTN GetImageExeInfoTableSize(EFI_IMAGE_EXECUTION_INFO_TABLE *ImageExeInfoTable)
{ UINTN Index; EFI_IMAGE_EXECUTION_INFO *ImageExeInfoItem; UINTN TotalSize; if (ImageExeInfoTable == NULL) { return 0; } ImageExeInfoItem = (EFI_IMAGE_EXECUTION_INFO *)((UINT8 *)ImageExeInfoTable + sizeof (EFI_IMAGE_EXECUTION_INFO_TABLE)); TotalSize = sizeof (EFI_IMAGE_EXECUTION_INFO_TABLE); for (Index = 0; Index < ImageExeInfoTable->NumberOfImages; Index++) { TotalSize += ReadUnaligned32 ((UINT32 *)&ImageExeInfoItem->InfoSize); ImageExeInfoItem = (EFI_IMAGE_EXECUTION_INFO *)((UINT8 *)ImageExeInfoItem + ReadUnaligned32 ((UINT32 *)&ImageExeInfoItem->InfoSize)); } return TotalSize; }
tianocore/edk2
C++
Other
4,240
/* Remember policies even when nobody has shared memory mapped. The policies are kept in Red-Black tree linked from the inode. They are protected by the sp->lock spinlock, which should be held for any accesses to the tree. */
static struct sp_node* sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
/* Remember policies even when nobody has shared memory mapped. The policies are kept in Red-Black tree linked from the inode. They are protected by the sp->lock spinlock, which should be held for any accesses to the tree. */ static struct sp_node* sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
{ struct rb_node *n = sp->root.rb_node; while (n) { struct sp_node *p = rb_entry(n, struct sp_node, nd); if (start >= p->end) n = n->rb_right; else if (end <= p->start) n = n->rb_left; else break; } if (!n) return NULL; for (;;) { struct sp_node *w = NULL; struct rb_node *prev = rb_prev(n); if (!prev) break; w = rb_entry(prev, struct sp_node, nd); if (w->end <= start) break; n = prev; } return rb_entry(n, struct sp_node, nd); }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter. */
void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData)
/* param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter. */ void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData)
{ assert(handle != NULL); (void)memset(handle, 0, sizeof(*handle)); s_lpspiHandle[LPSPI_GetInstance(base)] = handle; s_lpspiSlaveIsr = LPSPI_SlaveTransferHandleIRQ; handle->callback = callback; handle->userData = userData; }
eclipse-threadx/getting-started
C++
Other
310
/* Function for creating a timer user id from the current interrupt level. */
static timer_user_id_t user_id_get(void)
/* Function for creating a timer user id from the current interrupt level. */ static timer_user_id_t user_id_get(void)
{ timer_user_id_t ret; STATIC_ASSERT(APP_TIMER_INT_LEVELS == 3); switch (current_int_priority_get()) { case APP_IRQ_PRIORITY_HIGH: ret = APP_HIGH_USER_ID; break; case APP_IRQ_PRIORITY_LOW: ret = APP_LOW_USER_ID; break; default: ret = THREAD_MODE_USER_ID; break; } return ret; }
labapart/polymcu
C++
null
201
/* Set the OBJECT_NO_SCAN flag for the object corresponding to the give pointer. Such object will not be scanned by kmemleak but references to it are searched. */
static void object_no_scan(unsigned long ptr)
/* Set the OBJECT_NO_SCAN flag for the object corresponding to the give pointer. Such object will not be scanned by kmemleak but references to it are searched. */ static void object_no_scan(unsigned long ptr)
{ unsigned long flags; struct kmemleak_object *object; object = find_and_get_object(ptr, 0); if (!object) { kmemleak_warn("Not scanning unknown object at 0x%08lx\n", ptr); return; } spin_lock_irqsave(&object->lock, flags); object->flags |= OBJECT_NO_SCAN; spin_unlock_irqrestore(&object->lock, flags); put_object(object); }
robutest/uclinux
C++
GPL-2.0
60
/* If PemData is NULL, then return FALSE. If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceRsaGetPrivateKeyFromPem(IN CONST UINT8 *PemData, IN UINTN PemSize, IN CONST CHAR8 *Password, OUT VOID **RsaContext)
/* If PemData is NULL, then return FALSE. If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceRsaGetPrivateKeyFromPem(IN CONST UINT8 *PemData, IN UINTN PemSize, IN CONST CHAR8 *Password, OUT VOID **RsaContext)
{ return CALL_BASECRYPTLIB (Rsa.Services.GetPrivateKeyFromPem, RsaGetPrivateKeyFromPem, (PemData, PemSize, Password, RsaContext), FALSE); }
tianocore/edk2
C++
Other
4,240
/* check if SSL want to lookup X509 certification */
int SSL_want_x509_lookup(const SSL *ssl)
/* check if SSL want to lookup X509 certification */ int SSL_want_x509_lookup(const SSL *ssl)
{ SSL_ASSERT1(ssl); return (SSL_want(ssl) == SSL_WRITING); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* stm32_copro_stop() - Stop the STM32 remote processor @dev: corresponding STM32 remote processor device */
static int stm32_copro_stop(struct udevice *dev)
/* stm32_copro_stop() - Stop the STM32 remote processor @dev: corresponding STM32 remote processor device */ static int stm32_copro_stop(struct udevice *dev)
{ return stm32_copro_reset(dev); }
4ms/stm32mp1-baremetal
C++
Other
137
/* create a file and send fd on success return -errno on error */
static int do_create(struct iovec *iovec)
/* create a file and send fd on success return -errno on error */ static int do_create(struct iovec *iovec)
{ int ret; V9fsString path; int flags, mode, uid, gid, cur_uid, cur_gid; v9fs_string_init(&path); ret = proxy_unmarshal(iovec, PROXY_HDR_SZ, "sdddd", &path, &flags, &mode, &uid, &gid); if (ret < 0) { goto unmarshal_err_out; } ret = setugid(uid, gid, &cur_uid, &cur_gid); if (ret < 0) { goto unmarshal_err_out; } ret = open(path.data, flags, mode); if (ret < 0) { ret = -errno; } resetugid(cur_uid, cur_gid); unmarshal_err_out: v9fs_string_free(&path); return ret; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Implementation of cong_avoid. Will only call newReno CA when away from inference. From TCP-LP's paper, this will be handled in additive increasement. */
static void tcp_lp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
/* Implementation of cong_avoid. Will only call newReno CA when away from inference. From TCP-LP's paper, this will be handled in additive increasement. */ static void tcp_lp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
{ struct lp *lp = inet_csk_ca(sk); if (!(lp->flag & LP_WITHIN_INF)) tcp_reno_cong_avoid(sk, ack, in_flight); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Appends a number of bytes to a page in the internal Flash. */
int32_t flash_append(struct flash_descriptor *flash, uint32_t dst_addr, uint8_t *buffer, uint32_t length)
/* Appends a number of bytes to a page in the internal Flash. */ int32_t flash_append(struct flash_descriptor *flash, uint32_t dst_addr, uint8_t *buffer, uint32_t length)
{ ASSERT(flash && buffer && length); uint32_t page_size = _flash_get_page_size(&flash->dev); uint32_t total_pages = _flash_get_total_pages(&flash->dev); if ((dst_addr > page_size * total_pages) || (dst_addr + length > page_size * total_pages)) { return ERR_BAD_ADDRESS; } if (_flash_is_locked(&flash->dev, dst_addr)) { return ERR_DENIED; } _flash_append(&flash->dev, dst_addr, buffer, length); return ERR_NONE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures the TIMx Output Compare 3 Fast feature. */
void TIM_ConfigOc3Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 3 Fast feature. */ void TIM_ConfigOc3Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr2 = 0; assert_param(IsTimList3Module(TIMx)); assert_param(IsTimOcFastState(TIM_OCFast)); tmpccmr2 = TIMx->CCMOD2; tmpccmr2 &= (uint16_t) ~((uint16_t)TIM_CCMOD2_OC3FEN); tmpccmr2 |= TIM_OCFast; TIMx->CCMOD2 = tmpccmr2; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function returns zero in case of success and a negative error code in case of failure. */
int ubi_register_volume_notifier(struct notifier_block *nb, int ignore_existing)
/* This function returns zero in case of success and a negative error code in case of failure. */ int ubi_register_volume_notifier(struct notifier_block *nb, int ignore_existing)
{ int err; err = blocking_notifier_chain_register(&ubi_notifiers, nb); if (err != 0) return err; if (ignore_existing) return 0; mutex_lock(&ubi_devices_mutex); ubi_enumerate_volumes(nb); mutex_unlock(&ubi_devices_mutex); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Must be called when a user of a device is finished with it. When the last user of the device calls this function, the memory of the device is freed. */
void usb_put_dev(struct usb_device *dev)
/* Must be called when a user of a device is finished with it. When the last user of the device calls this function, the memory of the device is freed. */ void usb_put_dev(struct usb_device *dev)
{ if (dev) put_device(&dev->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Link the queue head to the asynchronous schedule list. UEFI only supports one CTRL/BULK transfer at a time due to its interfaces. This simplifies the AsynList management: A reclamation header is always linked to the AsyncListAddr, the only active QH is appended to it. */
VOID EhcLinkQhToAsync(IN PEI_USB2_HC_DEV *Ehc, IN PEI_EHC_QH *Qh)
/* Link the queue head to the asynchronous schedule list. UEFI only supports one CTRL/BULK transfer at a time due to its interfaces. This simplifies the AsynList management: A reclamation header is always linked to the AsyncListAddr, the only active QH is appended to it. */ VOID EhcLinkQhToAsync(IN PEI_USB2_HC_DEV *Ehc, IN PEI_EHC_QH *Qh)
{ PEI_EHC_QH *Head; Head = Ehc->ReclaimHead; Qh->NextQh = Head->NextQh; Head->NextQh = Qh; Qh->QhHw.HorizonLink = QH_LINK (Head, EHC_TYPE_QH, FALSE); Head->QhHw.HorizonLink = QH_LINK (Qh, EHC_TYPE_QH, FALSE); }
tianocore/edk2
C++
Other
4,240
/* Returns the all unmasked interrupt status after reading the DmaStatus register. */
u32 synopGMAC_get_interrupt_type(synopGMACdevice *gmacdev)
/* Returns the all unmasked interrupt status after reading the DmaStatus register. */ u32 synopGMAC_get_interrupt_type(synopGMACdevice *gmacdev)
{ u32 data; u32 interrupts = 0; data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus); synopGMACWriteReg(gmacdev->DmaBase, DmaStatus, data); if (data & DmaIntErrorMask) interrupts |= synopGMACDmaError; if (data & DmaIntRxNormMask) interrupts |= synopGMACDmaRxNormal; if (data & DmaIntRxAbnMask) interrupts |= synopGMACDmaRxAbnormal; if (data & DmaIntRxStoppedMask) interrupts |= synopGMACDmaRxStopped; if (data & DmaIntTxNormMask) interrupts |= synopGMACDmaTxNormal; if (data & DmaIntTxAbnMask) interrupts |= synopGMACDmaTxAbnormal; if (data & DmaIntTxStoppedMask) interrupts |= synopGMACDmaTxStopped; return interrupts; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the clock source for the specified timer module. */
void TimerClockSourceSet(uint32_t ui32Base, uint32_t ui32Source)
/* Sets the clock source for the specified timer module. */ void TimerClockSourceSet(uint32_t ui32Base, uint32_t ui32Source)
{ ASSERT(_TimerBaseValid(ui32Base)); ASSERT((ui32Source == TIMER_CLOCK_SYSTEM) || (ui32Source == TIMER_CLOCK_PIOSC)); HWREG(ui32Base + TIMER_O_CC) = ui32Source; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets the current touch screen threshhold level from EEPROM (if present) or returns the default value from projectconfig.h. */
uint8_t tsGetThreshhold(void)
/* Gets the current touch screen threshhold level from EEPROM (if present) or returns the default value from projectconfig.h. */ uint8_t tsGetThreshhold(void)
{ uint8_t thold = eepromReadU8(CFG_EEPROM_TOUCHSCREEN_THRESHHOLD); if (thold != 0xFF) { _tsThreshhold = thold; } else { _tsThreshhold = CFG_TFTLCD_TS_DEFAULTTHRESHOLD; } return _tsThreshhold; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Get the LPUART instance from peripheral base address. */
uint32_t LPUART_GetInstance(LPUART_Type *base)
/* Get the LPUART instance from peripheral base address. */ uint32_t LPUART_GetInstance(LPUART_Type *base)
{ uint32_t instance; for (instance = 0; instance < FSL_FEATURE_SOC_LPUART_COUNT; instance++) { if (s_lpuartBases[instance] == base) { break; } } assert(instance < FSL_FEATURE_SOC_LPUART_COUNT); return instance; }
labapart/polymcu
C++
null
201
/* Use the VMGEXIT instruction to handle a RDTSC event. */
STATIC UINT64 RdtscExit(IN OUT GHCB *Ghcb, IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData)
/* Use the VMGEXIT instruction to handle a RDTSC event. */ STATIC UINT64 RdtscExit(IN OUT GHCB *Ghcb, IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData)
{ UINT64 Status; Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0); if (Status != 0) { return Status; } if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) || !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx)) { return UnsupportedExit (Ghcb, Regs, InstructionData); } Regs->Rax = Ghcb->SaveArea.Rax; Regs->Rdx = Ghcb->SaveArea.Rdx; return 0; }
tianocore/edk2
C++
Other
4,240
/* Sets the RTC module alarm time value in standard format */
void XMC_RTC_SetAlarmStdFormat(const struct tm *const stdtime)
/* Sets the RTC module alarm time value in standard format */ void XMC_RTC_SetAlarmStdFormat(const struct tm *const stdtime)
{ XMC_RTC_ALARM_t alarm; alarm.seconds = stdtime->tm_sec; alarm.minutes = stdtime->tm_min; alarm.hours = stdtime->tm_hour; alarm.days = stdtime->tm_mday - 1; alarm.month = stdtime->tm_mon; alarm.year = stdtime->tm_year + XMC_RTC_YEAR_OFFSET; XMC_RTC_SetAlarm(&alarm); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Removes and deletes the top of the stack, if present. The next element becomes the new top. */
void yypop_buffer_state(void)
/* Removes and deletes the top of the stack, if present. The next element becomes the new top. */ void yypop_buffer_state(void)
{ if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* sw_ccheck() checks synchronization bits and computes checksum of nibbles. */
static int sw_check(__u64 t)
/* sw_ccheck() checks synchronization bits and computes checksum of nibbles. */ static int sw_check(__u64 t)
{ unsigned char sum = 0; if ((t & 0x8080808080808080ULL) ^ 0x80) return -1; while (t) { sum += t & 0xf; t >>= 4; } return sum & 0xf; }
robutest/uclinux
C++
GPL-2.0
60
/* USB Device Resume Function Called automatically on USB Device Resume Return Value: None */
void USBD_Resume(void)
/* USB Device Resume Function Called automatically on USB Device Resume Return Value: None */ void USBD_Resume(void)
{ UDPHS->UDPHS_IEN &= ~UDPHS_IEN_WAKE_UP; UDPHS->UDPHS_IEN |= UDPHS_IEN_DET_SUSPD; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* copy_reserved_iova - copies the reserved between domains @from: - source doamin from where to copy @to: - destination domin where to copy This function copies reserved iova's from one doamin to other. */
void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to)
/* copy_reserved_iova - copies the reserved between domains @from: - source doamin from where to copy @to: - destination domin where to copy This function copies reserved iova's from one doamin to other. */ void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to)
{ unsigned long flags; struct rb_node *node; spin_lock_irqsave(&from->iova_rbtree_lock, flags); for (node = rb_first(&from->rbroot); node; node = rb_next(node)) { struct iova *iova = container_of(node, struct iova, node); struct iova *new_iova; new_iova = reserve_iova(to, iova->pfn_lo, iova->pfn_hi); if (!new_iova) printk(KERN_ERR "Reserve iova range %lx@%lx failed\n", iova->pfn_lo, iova->pfn_lo); } spin_unlock_irqrestore(&from->iova_rbtree_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Starts no hold measurement of relative humidity and temperature from a Si/21 sensor. */
sl_status_t sl_si70xx_start_no_hold_measure_rh_and_temp(sl_i2cspm_t *i2cspm, uint8_t addr)
/* Starts no hold measurement of relative humidity and temperature from a Si/21 sensor. */ sl_status_t sl_si70xx_start_no_hold_measure_rh_and_temp(sl_i2cspm_t *i2cspm, uint8_t addr)
{ sl_status_t retval; retval = sl_si70xx_start_no_hold_measure(i2cspm, addr, SI70XX_MEASURE_RH_NH); return retval; }
eclipse-threadx/getting-started
C++
Other
310
/* Clear the PWM interrupt flag of the PWM module. The */
void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Clear the PWM interrupt flag of the PWM module. The */ void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xASSERT((ulIntType == PWM_INT_CHXCC) || (ulIntType == PWM_INT_UEV1)); if (ulIntType == PWM_INT_UEV1) { xHWREG(ulBase + TIMER_INTSR) &= ~ulIntType; } else { xHWREG(ulBase + TIMER_INTSR) &= ~(PWM_INT_CHXCC << ulChannelTemp); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* param base RDC peripheral base address. param master Which master to set. param domainAssignment Pointer to the assignment. */
void RDC_SetMasterDomainAssignment(RDC_Type *base, rdc_master_t master, const rdc_domain_assignment_t *domainAssignment)
/* param base RDC peripheral base address. param master Which master to set. param domainAssignment Pointer to the assignment. */ void RDC_SetMasterDomainAssignment(RDC_Type *base, rdc_master_t master, const rdc_domain_assignment_t *domainAssignment)
{ assert((uint32_t)master < RDC_MDA_COUNT); rdc_mda_reg_t mda; mda._mda = *domainAssignment; base->MDA[master] = mda._u32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Stop the SYSTICK. This function stops the systick timer. */
void am_hal_systick_stop(void)
/* Stop the SYSTICK. This function stops the systick timer. */ void am_hal_systick_stop(void)
{ AM_REG(SYSTICK, SYSTCSR) &= ~AM_REG_SYSTICK_SYSTCSR_ENABLE_M; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ks_read_config - read chip configuration of bus width. @ks: The chip information */
static void ks_read_config(struct eth_device *dev)
/* ks_read_config - read chip configuration of bus width. @ks: The chip information */ static void ks_read_config(struct eth_device *dev)
{ u16 reg_data = 0; reg_data = ks_rdreg8(dev, KS_CCR) & 0x00FF; reg_data |= ks_rdreg8(dev, KS_CCR + 1) << 8; ks->sharedbus = (reg_data & CCR_SHARED) == CCR_SHARED; if (reg_data & CCR_8BIT) { ks->bus_width = ENUM_BUS_8BIT; ks->extra_byte = 1; } else if (reg_data & CCR_16BIT) { ks->bus_width = ENUM_BUS_16BIT; ks->extra_byte = 2; } else { ks->bus_width = ENUM_BUS_32BIT; ks->extra_byte = 4; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port. */
VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
/* In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port. */ VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
{ if (IsTdxGuest ()) { TdIoWriteFifo32 (Port, Count, Buffer); } else { SevIoWriteFifo32 (Port, Count, Buffer); } }
tianocore/edk2
C++
Other
4,240
/* This handler function must be called by the AC97C interrupt service routine. Identifies which event was activated and calls the associated function. */
void AC97C_Handler(void)
/* This handler function must be called by the AC97C interrupt service routine. Identifies which event was activated and calls the associated function. */ void AC97C_Handler(void)
{ unsigned int status; status = AT91C_BASE_AC97C->AC97C_SR; status &= AT91C_BASE_AC97C->AC97C_IMR; if ((status & AT91C_AC97C_COEVT) != 0) { CodecHandler(); } if ((status & AT91C_AC97C_CAEVT) != 0) { ChannelAHandler(); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Converts a text device path node to Hardware PC card device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPcCard(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Hardware PC card device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPcCard(CHAR16 *TextDeviceNode)
{ CHAR16 *FunctionNumberStr; PCCARD_DEVICE_PATH *Pccard; FunctionNumberStr = GetNextParamStr (&TextDeviceNode); Pccard = (PCCARD_DEVICE_PATH *) CreateDeviceNode ( HARDWARE_DEVICE_PATH, HW_PCCARD_DP, (UINT16) sizeof (PCCARD_DEVICE_PATH) ); Pccard->FunctionNumber = (UINT8) Strtoi (FunctionNumberStr); return (EFI_DEVICE_PATH_PROTOCOL *) Pccard; }
tianocore/edk2
C++
Other
4,240
/* This function returns sign whether interrupt line is in asserted state This depends on the type of interrupt used. For INTX interrupt line will be asserted until explicit deassertion, for MSI(X) interrupt line will be deasserted automatically due to notification semantics of the MSI(X) interrupts */
static bool _vmxnet3_assert_interrupt_line(VMXNET3State *s, uint32_t int_idx)
/* This function returns sign whether interrupt line is in asserted state This depends on the type of interrupt used. For INTX interrupt line will be asserted until explicit deassertion, for MSI(X) interrupt line will be deasserted automatically due to notification semantics of the MSI(X) interrupts */ static bool _vmxnet3_assert_interrupt_line(VMXNET3State *s, uint32_t int_idx)
{ PCIDevice *d = PCI_DEVICE(s); if (s->msix_used && msix_enabled(d)) { VMW_IRPRN("Sending MSI-X notification for vector %u", int_idx); msix_notify(d, int_idx); return false; } if (s->msi_used && msi_enabled(d)) { VMW_IRPRN("Sending MSI notification for vector %u", int_idx); msi_notify(d, int_idx); return false; } VMW_IRPRN("Asserting line for interrupt %u", int_idx); pci_irq_assert(d); return true; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Things to do upon first use of a card. This must run with the rtnl lock held. */
static int cxgb_up(struct adapter *adapter)
/* Things to do upon first use of a card. This must run with the rtnl lock held. */ static int cxgb_up(struct adapter *adapter)
{ int err = 0; if (!(adapter->flags & FULL_INIT_DONE)) { err = t1_init_hw_modules(adapter); if (err) goto out_err; enable_hw_csum(adapter); adapter->flags |= FULL_INIT_DONE; } t1_interrupts_clear(adapter); adapter->params.has_msi = !disable_msi && !pci_enable_msi(adapter->pdev); err = request_irq(adapter->pdev->irq, t1_interrupt, adapter->params.has_msi ? 0 : IRQF_SHARED, adapter->name, adapter); if (err) { if (adapter->params.has_msi) pci_disable_msi(adapter->pdev); goto out_err; } t1_sge_start(adapter->sge); t1_interrupts_enable(adapter); out_err: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* All string identifier should be allocated using this routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. */
int __init usb_string_id(struct usb_composite_dev *cdev)
/* All string identifier should be allocated using this routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. */ int __init usb_string_id(struct usb_composite_dev *cdev)
{ if (cdev->next_string_id < 254) { cdev->next_string_id++; return cdev->next_string_id; } return -ENODEV; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize Framework Layer. Initialize companion module and register callback. */
ADI_BLER_RESULT adi_ble_Init(ADI_CALLBACK const pCallbackFunc, void *const pCBParam)
/* Initialize Framework Layer. Initialize companion module and register callback. */ ADI_BLER_RESULT adi_ble_Init(ADI_CALLBACK const pCallbackFunc, void *const pCBParam)
{ ADI_BLER_RESULT eResult; ADI_TMR_RESULT eTmrResult; ASSERT(pCallbackFunc != NULL); pApplicationCallback = pCallbackFunc; pApplicationParameter = pCBParam; eTmrResult = adi_tmr_Init(ADI_BLE_NOOS_GP_TIMER, TimerCallback, NULL, true); RETURN_ERROR(eTmrResult, ADI_TMR_SUCCESS, ADI_BLER_FAILURE); eResult = adi_radio_Init(BleCallback); RETURN_ERROR(eResult, ADI_BLER_SUCCESS, eResult); return adi_ble_WaitForEventWithTimeout(CORE_INITIALIZATION_RSP, ADI_BLE_INIT_CORE_INIT_RSP_TIME_MS); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an error. */
struct file* dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, const struct cred *cred)
/* dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an error. */ struct file* dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, const struct cred *cred)
{ int error; struct file *f; validate_creds(cred); if (!mnt) { printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__); dump_stack(); return ERR_PTR(-EINVAL); } error = -ENFILE; f = get_empty_filp(); if (f == NULL) { dput(dentry); mntput(mnt); return ERR_PTR(error); } f->f_flags = flags; return __dentry_open(dentry, mnt, f, NULL, cred); }
robutest/uclinux
C++
GPL-2.0
60
/* This is guaranteed to be a stable sort since version 2.32. */
void g_array_sort(GArray *farray, GCompareFunc compare_func)
/* This is guaranteed to be a stable sort since version 2.32. */ void g_array_sort(GArray *farray, GCompareFunc compare_func)
{ GRealArray *array = (GRealArray*) farray; g_return_if_fail (array != NULL); g_qsort_with_data (array->data, array->len, array->elt_size, (GCompareDataFunc)compare_func, NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static int dio700_cs_attach(struct pcmcia_device *)
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ static int dio700_cs_attach(struct pcmcia_device *)
{ struct local_info_t *local; printk(KERN_INFO "ni_daq_700: cs-attach\n"); dev_dbg(&link->dev, "dio700_cs_attach()\n"); local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); if (!local) return -ENOMEM; local->link = link; link->priv = local; link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; link->irq.Handler = NULL; link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; pcmcia_cur_dev = link; dio700_config(link); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Check if header of WSS information attribute valid */
static int wlp_check_wss_info_attr_hdr(struct wlp *wlp, struct wlp_attr_hdr *hdr, size_t buflen)
/* Check if header of WSS information attribute valid */ static int wlp_check_wss_info_attr_hdr(struct wlp *wlp, struct wlp_attr_hdr *hdr, size_t buflen)
{ struct device *dev = &wlp->rc->uwb_dev.dev; size_t len; int result = 0; if (buflen < sizeof(*hdr)) { dev_err(dev, "WLP: Not enough space in buffer to parse" " WSS information attribute header.\n"); result = -EIO; goto out; } if (le16_to_cpu(hdr->type) != WLP_ATTR_WSS_INFO) { result = -ENODATA; goto out; } len = le16_to_cpu(hdr->length); if (buflen < sizeof(*hdr) + len) { dev_err(dev, "WLP: Not enough space in buffer to parse " "variable data. Got %d, expected %d.\n", (int)buflen, (int)(sizeof(*hdr) + len)); result = -EIO; goto out; } result = len; out: return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Check the ID whether it is equal 0x54. */
xtBoolean TC77IDCheck(void)
/* Check the ID whether it is equal 0x54. */ xtBoolean TC77IDCheck(void)
{ short sIDValue; sIDValue = TC77IDcodeGet(); return (sIDValue == 0x54) ? xtrue : xfalse; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enables or disables the Internal High Speed oscillator (HSI). HSI can not be stopped if it is used directly or through the PLL as system clock. */
void RCC_HSICmd(FunctionalState NewState)
/* Enables or disables the Internal High Speed oscillator (HSI). HSI can not be stopped if it is used directly or through the PLL as system clock. */ void RCC_HSICmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if(NewState==ENABLE) { RCC->CR |= CR_HSION_Set; } else { RCC->CR &= CR_HSION_Set; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciExpressAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciExpressAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT16)-1; } return MmioAndThenOr16 ( (UINTN)GetPciExpressBaseAddress () + Address, AndData, OrData ); }
tianocore/edk2
C++
Other
4,240
/* Change Logs: Date Author Notes Rbb666 first version */
void cy_bsp_all_init(void)
/* Change Logs: Date Author Notes Rbb666 first version */ void cy_bsp_all_init(void)
{ cy_rslt_t result; result = cybsp_init(); if (result != CY_RSLT_SUCCESS) { CY_ASSERT(0); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* returns SUCCESS if it successfully copied message into the buffer */
static s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size)
/* returns SUCCESS if it successfully copied message into the buffer */ static s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size)
{ s32 err; u16 i; err = e1000_obtain_mbx_lock_vf(hw); if (err) goto out_no_write; e1000_check_for_ack_vf(hw); e1000_check_for_msg_vf(hw); for (i = 0; i < size; i++) array_ew32(VMBMEM(0), i, msg[i]); hw->mbx.stats.msgs_tx++; ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_REQ); out_no_write: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* returns cft->mode if ->mode is not 0 returns S_IRUGO|S_IWUSR if it has both a read and a write handler returns S_IRUGO if it has only a read handler returns S_IWUSR if it has only a write hander */
static mode_t cgroup_file_mode(const struct cftype *cft)
/* returns cft->mode if ->mode is not 0 returns S_IRUGO|S_IWUSR if it has both a read and a write handler returns S_IRUGO if it has only a read handler returns S_IWUSR if it has only a write hander */ static mode_t cgroup_file_mode(const struct cftype *cft)
{ mode_t mode = 0; if (cft->mode) return cft->mode; if (cft->read || cft->read_u64 || cft->read_s64 || cft->read_map || cft->read_seq_string) mode |= S_IRUGO; if (cft->write || cft->write_u64 || cft->write_s64 || cft->write_string || cft->trigger) mode |= S_IWUSR; return mode; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Selects the USART WakeUp method form stop mode. */
void USART_StopModeWakeUpSourceConfig(USART_TypeDef *USARTx, uint32_t USART_WakeUpSource)
/* Selects the USART WakeUp method form stop mode. */ void USART_StopModeWakeUpSourceConfig(USART_TypeDef *USARTx, uint32_t USART_WakeUpSource)
{ assert_param(IS_USART_123_PERIPH(USARTx)); assert_param(IS_USART_STOPMODE_WAKEUPSOURCE(USART_WakeUpSource)); USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_WUS); USARTx->CR3 |= USART_WakeUpSource; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 3.3) If 3.1 and 3.2 do not dictate that the missing report count for t should not be incremented, then the sender SOULD increment missing report count for t (according to and ). */
static int sctp_cacc_skip(struct sctp_transport *primary, struct sctp_transport *transport, int count_of_newacks, __u32 tsn)
/* 3.3) If 3.1 and 3.2 do not dictate that the missing report count for t should not be incremented, then the sender SOULD increment missing report count for t (according to and ). */ static int sctp_cacc_skip(struct sctp_transport *primary, struct sctp_transport *transport, int count_of_newacks, __u32 tsn)
{ if (primary->cacc.changeover_active && (sctp_cacc_skip_3_1(primary, transport, count_of_newacks) || sctp_cacc_skip_3_2(primary, tsn))) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disables simultaneously the two DAC channels software triggers. */
void DAC_DisableDualSoftwareTrigger(void)
/* Disables simultaneously the two DAC channels software triggers. */ void DAC_DisableDualSoftwareTrigger(void)
{ DAC->SWTRG &= DUAL_SWTRIG_RESET; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Finds the sbp2_command for a given outstanding SCpnt. Only looks at the in-use list. Must be called with lu->cmd_orb_lock held. */
static struct sbp2_command_info* sbp2util_find_command_for_SCpnt(struct sbp2_lu *lu, void *SCpnt)
/* Finds the sbp2_command for a given outstanding SCpnt. Only looks at the in-use list. Must be called with lu->cmd_orb_lock held. */ static struct sbp2_command_info* sbp2util_find_command_for_SCpnt(struct sbp2_lu *lu, void *SCpnt)
{ struct sbp2_command_info *cmd; if (!list_empty(&lu->cmd_orb_inuse)) list_for_each_entry(cmd, &lu->cmd_orb_inuse, list) if (cmd->Current_SCpnt == SCpnt) return cmd; return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* eligible tree holds backlogged classes being sorted by their eligible times. there is one eligible tree per hfsc instance. */
static void eltree_insert(struct hfsc_class *cl)
/* eligible tree holds backlogged classes being sorted by their eligible times. there is one eligible tree per hfsc instance. */ static void eltree_insert(struct hfsc_class *cl)
{ struct rb_node **p = &cl->sched->eligible.rb_node; struct rb_node *parent = NULL; struct hfsc_class *cl1; while (*p != NULL) { parent = *p; cl1 = rb_entry(parent, struct hfsc_class, el_node); if (cl->cl_e >= cl1->cl_e) p = &parent->rb_right; else p = &parent->rb_left; } rb_link_node(&cl->el_node, parent, p); rb_insert_color(&cl->el_node, &cl->sched->eligible); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Select the chip. This function selects the specified chip by driving its CS line low. */
static void _at25dfx_chip_select(struct at25dfx_chip_module *chip)
/* Select the chip. This function selects the specified chip by driving its CS line low. */ static void _at25dfx_chip_select(struct at25dfx_chip_module *chip)
{ port_pin_set_output_level(chip->cs_pin, false); }
memfault/zero-to-main
C++
null
200
/* Start timer: Setup a 32 bit timer, running at 1KHz Versatile Express Motherboard provides 1 MHz timer */
static void vexpress_timer_init(void)
/* Start timer: Setup a 32 bit timer, running at 1KHz Versatile Express Motherboard provides 1 MHz timer */ static void vexpress_timer_init(void)
{ writel(SP810_TIMER0_ENSEL | SP810_TIMER1_ENSEL | SP810_TIMER2_ENSEL | SP810_TIMER3_ENSEL | readl(&sysctrl_base->scctrl), &sysctrl_base->scctrl); writel(SYSTIMER_RELOAD, &systimer_base->timer0load); writel(SYSTIMER_RELOAD, &systimer_base->timer0value); writel(SYSTIMER_EN | SYSTIMER_32BIT | readl(&systimer_base->timer0control), &systimer_base->timer0control); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check if SETUP packet is ready in cache. */
static bool _usbd_ep_is_setup(uint8_t epn)
/* Check if SETUP packet is ready in cache. */ static bool _usbd_ep_is_setup(uint8_t epn)
{ return hri_usbendpoint_get_EPINTFLAG_reg(USB, epn, USB_DEVICE_EPINTFLAG_RXSTP); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if FIFO is empty. As this function only reads the read and write pointers once, this function is reentrant and thus thread and ISR save without any mutexes. */
bool tu_fifo_empty(tu_fifo_t *f)
/* Check if FIFO is empty. As this function only reads the read and write pointers once, this function is reentrant and thus thread and ISR save without any mutexes. */ bool tu_fifo_empty(tu_fifo_t *f)
{ return f->wr_idx == f->rd_idx; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns the current memory target used by double buffer transfer. */
uint32_t DMA_GetCurrentMemoryTarget(DMA_Stream_TypeDef *DMAy_Streamx)
/* Returns the current memory target used by double buffer transfer. */ uint32_t DMA_GetCurrentMemoryTarget(DMA_Stream_TypeDef *DMAy_Streamx)
{ uint32_t tmp = 0; assert_param(IS_DMA_ALL_PERIPH(DMAy_Streamx)); if ((DMAy_Streamx->CR & DMA_SxCR_CT) != 0) { tmp = 1; } else { tmp = 0; } return tmp; }
MaJerle/stm32f429
C++
null
2,036
/* Set the source address mode of the specified dma channel. */
en_result_t Dma_SetSourceIncMode(en_dma_channel_t enCh, en_address_mode_t enMode)
/* Set the source address mode of the specified dma channel. */ en_result_t Dma_SetSourceIncMode(en_dma_channel_t enCh, en_address_mode_t enMode)
{ ASSERT(IS_VALID_CH(enCh)); ASSERT(IS_VALID_ADDR_MODE(enMode)); if((!IS_VALID_CH(enCh)) || (!IS_VALID_ADDR_MODE(enMode))) { return ErrorInvalidParameter; } if(enCh == DmaCh0) { M0P_DMAC->CONFB0_f.FS = enMode; } else{ M0P_DMAC->CONFB1_f.FS = enMode; } return Ok; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize new opaque EcGroup object. This object represents an EC curve and and is used for calculation within this group. This object should be freed using EcGroupFree() function. */
VOID* EFIAPI CryptoServiceEcGroupInit(IN UINTN CryptoNid)
/* Initialize new opaque EcGroup object. This object represents an EC curve and and is used for calculation within this group. This object should be freed using EcGroupFree() function. */ VOID* EFIAPI CryptoServiceEcGroupInit(IN UINTN CryptoNid)
{ return CALL_BASECRYPTLIB (Ec.Services.GroupInit, EcGroupInit, (CryptoNid), NULL); }
tianocore/edk2
C++
Other
4,240
/* Get the data register address used for DMA transfer @rmtoll TDR TD LL_SWPMI_DMA_GetRegAddr */
uint32_t LL_SWPMI_DMA_GetRegAddr(SWPMI_TypeDef *SWPMIx, uint32_t Direction)
/* Get the data register address used for DMA transfer @rmtoll TDR TD LL_SWPMI_DMA_GetRegAddr */ uint32_t LL_SWPMI_DMA_GetRegAddr(SWPMI_TypeDef *SWPMIx, uint32_t Direction)
{ uint32_t data_reg_addr; if (Direction == LL_SWPMI_DMA_REG_DATA_TRANSMIT) { data_reg_addr = (uint32_t)&(SWPMIx->TDR); } else { data_reg_addr = (uint32_t)&(SWPMIx->RDR); } return data_reg_addr; }
remotemcu/remcu-chip-sdks
C++
null
436
/* sunxi_lcd_dsi_gen_write - write command and para to mipi panel. @screen_id: The index of screen. @command: Command to be transfer. @para: The pointer to para. @para_num: The number of para */
s32 sunxi_lcd_dsi_gen_write(u32 screen_id, u8 command, u8 *para, u32 para_num)
/* sunxi_lcd_dsi_gen_write - write command and para to mipi panel. @screen_id: The index of screen. @command: Command to be transfer. @para: The pointer to para. @para_num: The number of para */ s32 sunxi_lcd_dsi_gen_write(u32 screen_id, u8 command, u8 *para, u32 para_num)
{ if (g_lcd_drv.src_ops.sunxi_lcd_dsi_gen_write) return g_lcd_drv.src_ops.sunxi_lcd_dsi_gen_write(screen_id, command, para, para_num); return -1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the status of the FIFO buffer of the specified SPI port. */
unsigned long SPIFIFOStatusGet(unsigned long ulBase)
/* Check the status of the FIFO buffer of the specified SPI port. */ unsigned long SPIFIFOStatusGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); return (xHWREG(ulBase + SPI_CNTRL) & (SPI_CNTRL_TX_FULL) || (SPI_CNTRL_RX_FULL) || (SPI_CNTRL_TX_EMPTY) || (SPI_CNTRL_RX_EMPTY)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read OUTDATA registers. This function copies OUTDATA to output buffer. */
static void hashcrypt_get_data(HASHCRYPT_Type *base, uint32_t *output, size_t outputSize)
/* Read OUTDATA registers. This function copies OUTDATA to output buffer. */ static void hashcrypt_get_data(HASHCRYPT_Type *base, uint32_t *output, size_t outputSize)
{ uint32_t digest[8]; while (0U == (base->STATUS & HASHCRYPT_STATUS_DIGEST_MASK)) { } for (int i = 0; i < 8; i++) { digest[i] = swap_bytes(base->DIGEST0[i]); } if (outputSize > sizeof(digest)) { outputSize = sizeof(digest); } (void)hashcrypt_memcpy(output, digest, outputSize); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* undo a mapping between cpu and apicid. Uses logical apicids for multiquad, else physical apic ids */
static void __init unmap_cpu_to_physid(int, int)
/* undo a mapping between cpu and apicid. Uses logical apicids for multiquad, else physical apic ids */ static void __init unmap_cpu_to_physid(int, int)
{ physid_2_cpu[phys_id] = -1; cpu_2_physid[cpu_id] = -1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reference value for interrupt generation. LSB = ~16@2g / ~31@4g / ~63@8g / ~127@16g. */
int32_t lis2dh12_filter_reference_set(stmdev_ctx_t *ctx, uint8_t *buff)
/* Reference value for interrupt generation. LSB = ~16@2g / ~31@4g / ~63@8g / ~127@16g. */ int32_t lis2dh12_filter_reference_set(stmdev_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lis2dh12_write_reg(ctx, LIS2DH12_REFERENCE, buff, 1); return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* determine if the FP/Media registers have actually been used */
static int fpmregs_active(struct task_struct *target, const struct user_regset *regset)
/* determine if the FP/Media registers have actually been used */ static int fpmregs_active(struct task_struct *target, const struct user_regset *regset)
{ return tsk_used_math(target) ? regset->n : 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_enc_handler_resolve_enc_alias(const guchar *a_alias_name, enum CREncoding *a_enc)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_enc_handler_resolve_enc_alias(const guchar *a_alias_name, enum CREncoding *a_enc)
{ gulong i = 0; guchar *alias_name_up = NULL; enum CRStatus status = CR_ENCODING_NOT_FOUND_ERROR; g_return_val_if_fail (a_alias_name != NULL, CR_BAD_PARAM_ERROR); alias_name_up = g_strdup (a_alias_name); g_ascii_strup (alias_name_up, -1); for (i = 0; gv_default_aliases[i].name; i++) { if (!strcmp (gv_default_aliases[i].name, alias_name_up)) { *a_enc = gv_default_aliases[i].encoding; status = CR_OK; break; } } return status; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* At exit, the @ha's flags.enable_64bit_addressing set to indicated supported addressing method. */
static void qla2x00_config_dma_addressing(struct qla_hw_data *ha)
/* At exit, the @ha's flags.enable_64bit_addressing set to indicated supported addressing method. */ static void qla2x00_config_dma_addressing(struct qla_hw_data *ha)
{ ha->flags.enable_64bit_addressing = 0; if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { if (MSD(dma_get_required_mask(&ha->pdev->dev)) && !pci_set_consistent_dma_mask(ha->pdev, DMA_BIT_MASK(64))) { ha->flags.enable_64bit_addressing = 1; ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; return; } } dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); pci_set_consistent_dma_mask(ha->pdev, DMA_BIT_MASK(32)); }
robutest/uclinux
C++
GPL-2.0
60
/* Unfortunately, ASoC V1 does make it possible to determine the DMA/SSI data when a substream is created, so for now we need to store this data into a global variable. This means that we can only support one DMA controller, and hence only one SSI. */
int fsl_dma_configure(struct fsl_dma_info *dma_info)
/* Unfortunately, ASoC V1 does make it possible to determine the DMA/SSI data when a substream is created, so for now we need to store this data into a global variable. This means that we can only support one DMA controller, and hence only one SSI. */ int fsl_dma_configure(struct fsl_dma_info *dma_info)
{ static int initialized; if (initialized) return 0; dma_global_data.ssi_stx_phys = dma_info->ssi_stx_phys; dma_global_data.ssi_srx_phys = dma_info->ssi_srx_phys; dma_global_data.dma_channel[0] = dma_info->dma_channel[0]; dma_global_data.dma_channel[1] = dma_info->dma_channel[1]; dma_global_data.irq[0] = dma_info->dma_irq[0]; dma_global_data.irq[1] = dma_info->dma_irq[1]; dma_global_data.assigned[0] = 0; dma_global_data.assigned[1] = 0; initialized = 1; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 1 if the given PCM format is little-endian, 0 if big-endian, or a negative error code if endian not specified. */
int snd_pcm_format_little_endian(snd_pcm_format_t format)
/* Returns 1 if the given PCM format is little-endian, 0 if big-endian, or a negative error code if endian not specified. */ int snd_pcm_format_little_endian(snd_pcm_format_t format)
{ int val; if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) return -EINVAL; if ((val = pcm_formats[format].le) < 0) return -EINVAL; return val; }
robutest/uclinux
C++
GPL-2.0
60
/* get the FMC option byte BOR threshold value */
uint8_t ob_user_bor_threshold_get(void)
/* get the FMC option byte BOR threshold value */ uint8_t ob_user_bor_threshold_get(void)
{ return (uint8_t)((uint8_t)FMC_OBCTL0 & 0x0CU); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Indicates if there are any data in the buffer */
static int ircomm_tty_chars_in_buffer(struct tty_struct *tty)
/* Indicates if there are any data in the buffer */ static int ircomm_tty_chars_in_buffer(struct tty_struct *tty)
{ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned long flags; int len = 0; IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); spin_lock_irqsave(&self->spinlock, flags); if (self->tx_skb) len = self->tx_skb->len; spin_unlock_irqrestore(&self->spinlock, flags); return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Change Logs: Date Author Notes balanceTWK the first version */
static rt_err_t rt_inputcapture_init(struct rt_device *dev)
/* Change Logs: Date Author Notes balanceTWK the first version */ static rt_err_t rt_inputcapture_init(struct rt_device *dev)
{ rt_err_t ret; struct rt_inputcapture_device *inputcapture; RT_ASSERT(dev != RT_NULL); ret = RT_EOK; inputcapture = (struct rt_inputcapture_device *)dev; inputcapture->watermark = RT_INPUT_CAPTURE_RB_SIZE / 2; if (inputcapture->ops->init) { ret = inputcapture->ops->init(inputcapture); } return ret; }
pikasTech/PikaPython
C++
MIT License
1,403
/* If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then return FALSE. If P7Length overflow, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Pkcs7GetSigners(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT UINT8 **CertStack, OUT UINTN *StackLength, OUT UINT8 **TrustedCert, OUT UINTN *CertLength)
/* If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then return FALSE. If P7Length overflow, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Pkcs7GetSigners(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT UINT8 **CertStack, OUT UINTN *StackLength, OUT UINT8 **TrustedCert, OUT UINTN *CertLength)
{ CALL_CRYPTO_SERVICE (Pkcs7GetSigners, (P7Data, P7Length, CertStack, StackLength, TrustedCert, CertLength), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Sets the direction and mode of the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void xGPIODirModeSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulPinIO)
/* Sets the direction and mode of the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void xGPIODirModeSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulPinIO)
{ unsigned long ulBit; xASSERT(GPIOBaseValid(ulPort)); xASSERT((ulPinIO == xGPIO_DIR_MODE_IN) || (ulPinIO == xGPIO_DIR_MODE_OUT) || (ulPinIO == xGPIO_DIR_MODE_OD) || (ulPinIO == xGPIO_DIR_MODE_QB)); for(ulBit=0; ulBit<8; ulBit++) { if(ulPins & (1 << ulBit)) { GPIODirModeSet(ulPort, ulBit, ulPinIO); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* sermouse_interrupt() handles incoming characters, either gathering them into packets or passing them to the command routine as command output. */
static irqreturn_t sermouse_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
/* sermouse_interrupt() handles incoming characters, either gathering them into packets or passing them to the command routine as command output. */ static irqreturn_t sermouse_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
{ struct sermouse *sermouse = serio_get_drvdata(serio); if (time_after(jiffies, sermouse->last + HZ/10)) sermouse->count = 0; sermouse->last = jiffies; if (sermouse->type > SERIO_SUN) sermouse_process_ms(sermouse, data); else sermouse_process_msc(sermouse, data); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
{ GPIO_InitTypeDef GPIO_InitStruct; __HAL_RCC_TIM1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE(); GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Alternate = GPIO_AF1_TIM1; GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_10; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_11; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function validates the chip ID of device */
static int drv_acc_gyro_bosch_bmi120_validate_id(i2c_dev_t *drv, uint8_t id_value)
/* This function validates the chip ID of device */ static int drv_acc_gyro_bosch_bmi120_validate_id(i2c_dev_t *drv, uint8_t id_value)
{ uint8_t value = 0x00; int ret = 0; if(drv == NULL) { return -1; } ret = sensor_i2c_read(drv, BMI120_USER_CHIP_ID__REG, &value, I2C_DATA_LEN, I2C_OP_RETRIES); if(unlikely(ret) != 0) { printf("read CHIPID failed \n"); return ret; } printf("read CHIPID %x\n", value); if(id_value != value) { printf("failed read CHIPID %x\n", value); } return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function handler the set flow id command */
static int sep_set_flow_id_handler(struct sep_device *sep, unsigned long flow_id)
/* This function handler the set flow id command */ static int sep_set_flow_id_handler(struct sep_device *sep, unsigned long flow_id)
{ int error = 0; struct sep_flow_context_t *flow_data_ptr; mutex_lock(&sep_mutex); flow_data_ptr = sep_find_flow_context(sep, SEP_TEMP_FLOW_ID); if (flow_data_ptr) flow_data_ptr->flow_id = flow_id; else error = -EINVAL; mutex_unlock(&sep_mutex); return error; }
robutest/uclinux
C++
GPL-2.0
60
/* Popluate pipe descriptors for copying to/from waiters' buffers. This routine cycles through the waiters on the wait queue and creates a list of threads that will have data directly copied to / read from their buffers. This list helps us avoid double copying later. */
static size_t pipe_waiter_list_populate(sys_dlist_t *list, _wait_q_t *wait_q, size_t bytes_to_xfer)
/* Popluate pipe descriptors for copying to/from waiters' buffers. This routine cycles through the waiters on the wait queue and creates a list of threads that will have data directly copied to / read from their buffers. This list helps us avoid double copying later. */ static size_t pipe_waiter_list_populate(sys_dlist_t *list, _wait_q_t *wait_q, size_t bytes_to_xfer)
{ struct waitq_walk_data walk_data; walk_data.list = list; walk_data.bytes_requested = bytes_to_xfer; walk_data.bytes_available = 0; (void) z_sched_waitq_walk(wait_q, pipe_walk_op, &walk_data); return walk_data.bytes_available; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Adjust the kvec to move on 'n' bytes (from nfs/sunrpc) */
static int smb_move_iov(struct kvec **data, size_t *num, struct kvec *vec, unsigned amount)
/* Adjust the kvec to move on 'n' bytes (from nfs/sunrpc) */ static int smb_move_iov(struct kvec **data, size_t *num, struct kvec *vec, unsigned amount)
{ struct kvec *iv = *data; int i; int len; while (iv->iov_len <= amount) { amount -= iv->iov_len; iv++; (*num)--; } vec[0].iov_len = iv->iov_len-amount; vec[0].iov_base =((unsigned char *)iv->iov_base)+amount; iv++; len = vec[0].iov_len; for (i = 1; i < *num; i++) { vec[i] = *iv++; len += vec[i].iov_len; } *data = vec; return len; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
/* Checks whether the specified TIM flag is set or not. */ FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
{ ITStatus bitstatus = RESET; assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_GET_FLAG(TIM_FLAG)); assert_param(IS_TIM_PERIPH_FLAG(TIMx, TIM_FLAG)); if ((TIMx->SR & TIM_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base I2S base pointer. param handle pointer to handle structure. param dmaHandle pointer to dma handle structure. param callback function to be called back when transfer is done or fails. param userData pointer to data passed to callback. */
void I2S_RxTransferCreateHandleDMA(I2S_Type *base, i2s_dma_handle_t *handle, dma_handle_t *dmaHandle, i2s_dma_transfer_callback_t callback, void *userData)
/* param base I2S base pointer. param handle pointer to handle structure. param dmaHandle pointer to dma handle structure. param callback function to be called back when transfer is done or fails. param userData pointer to data passed to callback. */ void I2S_RxTransferCreateHandleDMA(I2S_Type *base, i2s_dma_handle_t *handle, dma_handle_t *dmaHandle, i2s_dma_transfer_callback_t callback, void *userData)
{ I2S_TxTransferCreateHandleDMA(base, handle, dmaHandle, callback, userData); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the set of fault triggers currently configured for a given PWM generator. */
uint32_t PWMGenFaultTriggerGet(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Group)
/* Returns the set of fault triggers currently configured for a given PWM generator. */ uint32_t PWMGenFaultTriggerGet(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Group)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(_PWMGenValid(ui32Gen)); ASSERT((ui32Group == PWM_FAULT_GROUP_0) || (ui32Group == PWM_FAULT_GROUP_1)); if (ui32Group == PWM_FAULT_GROUP_0) { return (HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_FLTSRC0)); } else { return (HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_FLTSRC1)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We received a WDTR. Let everything be aware of the changes. */
static void sym_setwide(struct sym_hcb *np, int target, u_char wide)
/* We received a WDTR. Let everything be aware of the changes. */ static void sym_setwide(struct sym_hcb *np, int target, u_char wide)
{ struct sym_tcb *tp = &np->target[target]; struct scsi_target *starget = tp->starget; sym_settrans(np, target, 0, 0, 0, wide, 0, 0); if (wide) tp->tgoal.renego = NS_WIDE; else tp->tgoal.renego = 0; tp->tgoal.check_nego = 0; tp->tgoal.width = wide; spi_offset(starget) = 0; spi_period(starget) = 0; spi_width(starget) = wide; spi_iu(starget) = 0; spi_dt(starget) = 0; spi_qas(starget) = 0; if (sym_verbose >= 3) sym_announce_transfer_rate(tp); }
robutest/uclinux
C++
GPL-2.0
60
/* every callback is supposed to be called in chip->reg_lock spinlock */
static void atiixp_out_flush_dma(struct atiixp_modem *chip)
/* every callback is supposed to be called in chip->reg_lock spinlock */ static void atiixp_out_flush_dma(struct atiixp_modem *chip)
{ atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_OUT1_FLUSH); }
robutest/uclinux
C++
GPL-2.0
60
/* Unmap the capabilities and adapter info DMA buffers */
static void unmap_persist_bufs(struct ibmvscsi_host_data *hostdata)
/* Unmap the capabilities and adapter info DMA buffers */ static void unmap_persist_bufs(struct ibmvscsi_host_data *hostdata)
{ dma_unmap_single(hostdata->dev, hostdata->caps_addr, sizeof(hostdata->caps), DMA_BIDIRECTIONAL); dma_unmap_single(hostdata->dev, hostdata->adapter_info_addr, sizeof(hostdata->madapter_info), DMA_BIDIRECTIONAL); }
robutest/uclinux
C++
GPL-2.0
60
/* @qlm: QLM to disable 2nd order CDR for. */
void __cvmx_helper_errata_qlm_disable_2nd_order_cdr(int qlm)
/* @qlm: QLM to disable 2nd order CDR for. */ void __cvmx_helper_errata_qlm_disable_2nd_order_cdr(int qlm)
{ int lane; cvmx_helper_qlm_jtag_init(); for (lane = 0; lane < 4; lane++) { cvmx_helper_qlm_jtag_shift_zeros(qlm, 63 - 0 + 1); cvmx_helper_qlm_jtag_shift(qlm, 67 - 64 + 1, 3); cvmx_helper_qlm_jtag_shift_zeros(qlm, 76 - 68 + 1); cvmx_helper_qlm_jtag_shift(qlm, 77 - 77 + 1, 1); cvmx_helper_qlm_jtag_shift_zeros(qlm, 267 - 78 + 1); } cvmx_helper_qlm_jtag_update(qlm); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* 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 (CPU_LOAD.Updated) { printf("W: %u; S: %u; Load: %5.2f\n", CPU_LOAD.WCNT, CPU_LOAD.SCNT, CPU_LOAD.Load); } TM_DISCO_LedToggle(LED_ALL); if (TM_DISCO_ButtonPressed()) { i = 0; while (i++ < 0x1FFF); } TM_CPULOAD_GoToSleepMode(&CPU_LOAD, TM_LOWPOWERMODE_SleepUntilInterrupt); } }
MaJerle/stm32f429
C++
null
2,036
/* Return the number of timer ticks per second. */
ulong get_tbclk(void)
/* Return the number of timer ticks per second. */ ulong get_tbclk(void)
{ return gd->arch.timer_rate_hz; }
4ms/stm32mp1-baremetal
C++
Other
137
/* The constructor function locates DevicePathUtilities protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI DevicePathLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function locates DevicePathUtilities protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI DevicePathLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gBS->LocateProtocol ( &gEfiDevicePathUtilitiesProtocolGuid, NULL, (VOID **)&mDevicePathLibDevicePathUtilities ); ASSERT_EFI_ERROR (Status); ASSERT (mDevicePathLibDevicePathUtilities != NULL); return Status; }
tianocore/edk2
C++
Other
4,240
/* Get status from the ongoing or last asynchronous transfer operation. Returns the error from a given ongoing or last asynchronous transfer operation. Either from a read or write transfer. */
enum status_code usart_get_job_status(struct usart_module *const module, enum usart_transceiver_type transceiver_type)
/* Get status from the ongoing or last asynchronous transfer operation. Returns the error from a given ongoing or last asynchronous transfer operation. Either from a read or write transfer. */ enum status_code usart_get_job_status(struct usart_module *const module, enum usart_transceiver_type transceiver_type)
{ Assert(module); enum status_code status_code; switch(transceiver_type) { case USART_TRANSCEIVER_RX: status_code = module->rx_status; break; case USART_TRANSCEIVER_TX: status_code = module->tx_status; break; default: status_code = STATUS_ERR_INVALID_ARG; break; } return status_code; }
memfault/zero-to-main
C++
null
200
/* Fills each RTC_ConfigStruct member with its default value. */
void RTC_ConfigStructInit(RTC_Config_T *rtcConfig)
/* Fills each RTC_ConfigStruct member with its default value. */ void RTC_ConfigStructInit(RTC_Config_T *rtcConfig)
{ rtcConfig->format = RTC_HOURFORMAT_24; rtcConfig->asynchPrediv = (uint32_t)0x7F; rtcConfig->synchPrediv = (uint32_t)0xFF; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes the data interface to the LCD controller SSD2119. */
EMSTATUS DMDIF_init(uint32_t cmdRegAddr, uint32_t dataRegAddr)
/* Initializes the data interface to the LCD controller SSD2119. */ EMSTATUS DMDIF_init(uint32_t cmdRegAddr, uint32_t dataRegAddr)
{ command_register = cmdRegAddr; data_register = dataRegAddr; DVK_displayControl(DVK_Display_SPI); return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* vpif_buffer_setup: This function allocates memory for the buffers */
static int vpif_buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
/* vpif_buffer_setup: This function allocates memory for the buffers */ static int vpif_buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{ struct vpif_fh *fh = q->priv_data; struct channel_obj *ch = fh->channel; struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; if (V4L2_MEMORY_MMAP != common->memory) return 0; *size = config_params.channel_bufsize[ch->channel_id]; if (*count < config_params.min_numbuffers) *count = config_params.min_numbuffers; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* @blob: Device tree blob holding state @node: Node to write our state into */
static int sandbox_tpm_write_state(void *blob, int node)
/* @blob: Device tree blob holding state @node: Node to write our state into */ static int sandbox_tpm_write_state(void *blob, int node)
{ int i; for (i = 0; i < NV_SEQ_COUNT; i++) { char prop_name[20]; if (g_state.nvdata[i].present) { sprintf(prop_name, "nvdata%d", i); fdt_setprop(blob, node, prop_name, g_state.nvdata[i].data, NV_DATA_SIZE); } } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check the functions to see if they each have an objsection. If not, then the linker must have eliminated them. */
static void check_functions(void)
/* Check the functions to see if they each have an objsection. If not, then the linker must have eliminated them. */ static void check_functions(void)
{ struct func_info *func, *end; unsigned long removed_code_size = 0; int not_found = 0; for (func = func_list, end = func + func_count; func < end; func++) { if (!func->objsection) { removed_code_size += func->code_size; not_found++; } } check_trace_config(); warn("%d functions removed by linker, %ld code size\n", not_found, removed_code_size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* USB Device MSC ATA Pass-Through Callback Parameters: None Return Value: None */
void USBD_MSC_ATAPassThrough(void)
/* USB Device MSC ATA Pass-Through Callback Parameters: None Return Value: None */ void USBD_MSC_ATAPassThrough(void)
{ if (!USBD_MSC_DataInFormat()) { return; } USBD_MSC_BulkBuf[ 0] = 0x02; USBD_MSC_BulkBuf[ 1] = 0x02; BulkLen = 2; BulkStage = MSC_BS_DATA_IN_LAST; if (USBD_MSC_CSW.dDataResidue > BulkLen) { USBD_MSC_CBW.dDataLength = BulkLen; USBD_MSC_CSW.dDataResidue = BulkLen; } USBD_WriteEP(usbd_msc_ep_bulkin | 0x80, USBD_MSC_BulkBuf, BulkLen); USBD_MSC_CSW.dDataResidue -= BulkLen; USBD_MSC_CSW.bStatus = CSW_CMD_FAILED; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140