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
/* After seveval rounds of scanning , it is necessary to take the average . */
void SetScanAverageValue(uint8_t N)
/* After seveval rounds of scanning , it is necessary to take the average . */ void SetScanAverageValue(uint8_t N)
{ uint32_t Temp = 0; if (N <= 3) { Temp = LPRCNT->CTRL; Temp &= (~LPRCNT_CTRL_AVGSEL); Temp |= (uint32_t)(N << 18); LPRCNT->CTRL = Temp; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief reset the different block of the interface. param base SDIF peripheral base address. param mask indicate which block to reset. param timeout value,set to wait the bit self clear return reset result. */
bool SDIF_Reset(SDIF_Type *base, uint32_t mask, uint32_t timeout)
/* brief reset the different block of the interface. param base SDIF peripheral base address. param mask indicate which block to reset. param timeout value,set to wait the bit self clear return reset result. */ bool SDIF_Reset(SDIF_Type *base, uint32_t mask, uint32_t timeout)
{ base->CTRL |= mask; if (IS_SDIF_FLAG_SET(mask, kSDIF_ResetDMAInterface)) { base->BMOD = (base->BMOD & (~SDIF_BMOD_DE_MASK)) | SDIF_BMOD_SWR_MASK; } while ((base->CTRL & mask) != 0UL) { if (0UL == timeout) { break; } timeout--; } retur...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert a packed value from cbuint64 to a UINT64 value. */
UINT64 cb_unpack64(IN struct cbuint64 val)
/* Convert a packed value from cbuint64 to a UINT64 value. */ UINT64 cb_unpack64(IN struct cbuint64 val)
{ return LShiftU64 (val.hi, 32) | val.lo; }
tianocore/edk2
C++
Other
4,240
/* UART EDMA receive finished callback function. This function is called when UART EDMA receive finished. It disables the UART RX EDMA request and sends kStatus_UART_RxIdle to UART callback. */
static void UART_ReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* UART EDMA receive finished callback function. This function is called when UART EDMA receive finished. It disables the UART RX EDMA request and sends kStatus_UART_RxIdle to UART callback. */ static void UART_ReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{ assert(param); uart_edma_private_handle_t *uartPrivateHandle = (uart_edma_private_handle_t *)param; handle = handle; tcds = tcds; if (transferDone) { UART_TransferAbortReceiveEDMA(uartPrivateHandle->base, uartPrivateHandle->handle); if (uartPrivateHandle->handle->callback) ...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Get the sample point location for a given bitrate. */
static uint16_t sample_point_for_bitrate(uint32_t bitrate)
/* Get the sample point location for a given bitrate. */ static uint16_t sample_point_for_bitrate(uint32_t bitrate)
{ uint16_t sample_pnt; if (bitrate > 800000) { sample_pnt = 750; } else if (bitrate > 500000) { sample_pnt = 800; } else { sample_pnt = 875; } return sample_pnt; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Sets the pin mode and configures the pin for use by SD Host peripheral */
void PinTypeSDHost(unsigned long ulPin, unsigned long ulPinMode)
/* Sets the pin mode and configures the pin for use by SD Host peripheral */ void PinTypeSDHost(unsigned long ulPin, unsigned long ulPinMode)
{ PinModeSet(ulPin,ulPinMode); PinConfigSet(ulPin,PIN_STRENGTH_2MA,PIN_TYPE_STD); }
micropython/micropython
C++
Other
18,334
/* Sets the current local time and date information. */
EFI_STATUS EFIAPI LibSetTime(IN EFI_TIME *Time)
/* Sets the current local time and date information. */ EFI_STATUS EFIAPI LibSetTime(IN EFI_TIME *Time)
{ EFI_STATUS Status; UINT32 EpochSeconds; if ((Time->Year < 1970) || (Time->Year >= 2106)) { return EFI_UNSUPPORTED; } if (!mPL031Initialized) { Status = InitializePL031 (); if (EFI_ERROR (Status)) { return Status; } } EpochSeconds = (UINT32)EfiTimeToEpoch (Time); if (Time->T...
tianocore/edk2
C++
Other
4,240
/* In cases where a dual chip select mode is in use and different clock rates are required for each chip select, the */
void EPIDividerSet(uint32_t ui32Base, uint32_t ui32Divider)
/* In cases where a dual chip select mode is in use and different clock rates are required for each chip select, the */ void EPIDividerSet(uint32_t ui32Base, uint32_t ui32Divider)
{ ASSERT(ui32Base == EPI0_BASE); HWREG(ui32Base + EPI_O_BAUD) = ui32Divider; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* For licensing information, see the file 'LICENCE' in this directory. */
static int mtd_fake_writev(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen)
/* For licensing information, see the file 'LICENCE' in this directory. */ static int mtd_fake_writev(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen)
{ unsigned long i; size_t totlen = 0, thislen; int ret = 0; for (i=0; i<count; i++) { if (!vecs[i].iov_len) continue; ret = mtd->write(mtd, to, vecs[i].iov_len, &thislen, vecs[i].iov_base); totlen += thislen; if (ret || thislen != vecs[i].iov_len) break; to += vecs[i].iov_len; } if (retlen) *ret...
robutest/uclinux
C++
GPL-2.0
60
/* This function is called as the kvm VM fd is being released. Shutdown all irqfds that still remain open */
void kvm_irqfd_release(struct kvm *kvm)
/* This function is called as the kvm VM fd is being released. Shutdown all irqfds that still remain open */ void kvm_irqfd_release(struct kvm *kvm)
{ struct _irqfd *irqfd, *tmp; spin_lock_irq(&kvm->irqfds.lock); list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) irqfd_deactivate(irqfd); spin_unlock_irq(&kvm->irqfds.lock); flush_workqueue(irqfd_cleanup_wq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the SDADCx external trigger edge for injected channels conversion. */
void SDADC_ExternalTrigInjectedConvEdgeConfig(SDADC_TypeDef *SDADCx, uint32_t SDADC_ExternalTrigInjecConvEdge)
/* Configures the SDADCx external trigger edge for injected channels conversion. */ void SDADC_ExternalTrigInjectedConvEdgeConfig(SDADC_TypeDef *SDADCx, uint32_t SDADC_ExternalTrigInjecConvEdge)
{ uint32_t tmpreg = 0; assert_param(IS_SDADC_ALL_PERIPH(SDADCx)); assert_param(IS_SDADC_EXT_INJEC_TRIG_EDGE(SDADC_ExternalTrigInjecConvEdge)); tmpreg = SDADCx->CR2; tmpreg &= (uint32_t) (~SDADC_CR2_JEXTEN); tmpreg |= SDADC_ExternalTrigInjecConvEdge; SDADCx->CR2 = tmpreg; }
avem-labs/Avem
C++
MIT License
1,752
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { CheckJoystickMovement(); CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); CDC_Device_USBTask(&VirtualSerial_CDC_Interface); HID_Device_USBTask(&Mouse_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* We allocate a page from the first 1MB of memory for the wakeup routine for when we come back from a sleep state. The runtime allocator allows specification of <16MB pages, but not <1MB pages. */
void __init acpi_reserve_wakeup_memory(void)
/* We allocate a page from the first 1MB of memory for the wakeup routine for when we come back from a sleep state. The runtime allocator allows specification of <16MB pages, but not <1MB pages. */ void __init acpi_reserve_wakeup_memory(void)
{ unsigned long mem; if ((&wakeup_code_end - &wakeup_code_start) > WAKEUP_SIZE) { printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n"); return; } mem = find_e820_area(0, 1<<20, WAKEUP_SIZE, PAGE_SIZE); if (mem == -1L) { printk(KERN_ERR "ACPI: Cannot allocate lowmem, S3 disabled.\n"); r...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize TSC and delay the periodic timer init to late x86_late_time_init() so ioremap works. */
void __init time_init(void)
/* Initialize TSC and delay the periodic timer init to late x86_late_time_init() so ioremap works. */ void __init time_init(void)
{ late_time_init = x86_late_time_init; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize The MLME Queue, used by MLME Functions. */
int MlmeQueueInit(struct rt_mlme_queue *Queue)
/* Initialize The MLME Queue, used by MLME Functions. */ int MlmeQueueInit(struct rt_mlme_queue *Queue)
{ int i; NdisAllocateSpinLock(&Queue->Lock); Queue->Num = 0; Queue->Head = 0; Queue->Tail = 0; for (i = 0; i < MAX_LEN_OF_MLME_QUEUE; i++) { Queue->Entry[i].Occupied = FALSE; Queue->Entry[i].MsgLen = 0; NdisZeroMemory(Queue->Entry[i].Msg, MGMT_DMA_BUFFER_SIZE); } return NDIS_STATUS_SUCCESS; }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(handle); if (!handle->rxRingBuffer) { LPUART_DisableInterrupts(base, kLPUART_RxDataRegFullInterruptEnable | kLPUART_RxOverrunInterruptEnable | kLPUART_IdleLineInterruptEnable); } handle->rxDataSize = 0U; handle->rxState = kLPUART_RxIdle...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentRead32(IN UINT64 Address)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciSegmentRead32(IN UINT64 Address)
{ UINTN Count; PCI_SEGMENT_INFO *SegmentInfo; SegmentInfo = GetPciSegmentInfo (&Count); return MmioRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count)); }
tianocore/edk2
C++
Other
4,240
/* Routine implementing u-boot ls command which lists content of a given directory on a current partition. */
int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* Routine implementing u-boot ls command which lists content of a given directory on a current partition. */ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ char *filename = "/"; int ret; struct part_info *part; if (argc == 2) filename = argv[1]; if (mtdparts_init() !=0) return 1; if ((part = jffs2_part_info(current_mtd_dev, current_mtd_partnum))){ if (cramfs_check(part)) { ret = cramfs_ls (part, filename); } else { ret = jffs2_1pass_ls(part, filename...
EmcraftSystems/u-boot
C++
Other
181
/* param handle i2c master handle. param deviceAddress codec device address. param subAddress register address. param subaddressSize register address width. param txBuff tx buffer pointer. param txBuffSize tx buffer size. return kStatus_HAL_I2cSuccess is success, else send failed. */
status_t CODEC_I2C_Send(void *handle, uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *txBuff, uint8_t txBuffSize)
/* param handle i2c master handle. param deviceAddress codec device address. param subAddress register address. param subaddressSize register address width. param txBuff tx buffer pointer. param txBuffSize tx buffer size. return kStatus_HAL_I2cSuccess is success, else send failed. */ status_t CODEC_I2C_Send(void *hand...
{ hal_i2c_master_transfer_t masterXfer; masterXfer.slaveAddress = deviceAddress; masterXfer.direction = kHAL_I2cWrite; masterXfer.subaddress = (uint32_t)subAddress; masterXfer.subaddressSize = subaddressSize; masterXfer.data = txBuff; masterXfer.dataSize = txBuffSi...
eclipse-threadx/getting-started
C++
Other
310
/* This function handles External lines 15_10 interrupt request. */
void EXTI15_10_IRQHandler(void)
/* This function handles External lines 15_10 interrupt request. */ void EXTI15_10_IRQHandler(void)
{ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_14); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function is used to unregister drivers using the composite driver framework. */
void usb_composite_unregister(struct usb_composite_driver *driver)
/* This function is used to unregister drivers using the composite driver framework. */ void usb_composite_unregister(struct usb_composite_driver *driver)
{ if (composite != driver) return; usb_gadget_unregister_driver(&composite_driver); composite = NULL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* System Power Configuration The system Power is configured as follow : */
static void SystemPower_Config(void)
/* System Power Configuration The system Power is configured as follow : */ static void SystemPower_Config(void)
{ __HAL_RCC_PWR_CLK_ENABLE(); HAL_PWR_EnableBkUpAccess(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Implementation notes: Special case single element list, unroll/inline the sorting of the first two elements. Some tail recursion is used since we iterate on the bottom-up solution of the problem (we start with a small sorted list and keep merging other lists of the same size to it). */
static struct edge* sort_edges(struct edge *list, unsigned int level, struct edge **head_out)
/* Implementation notes: Special case single element list, unroll/inline the sorting of the first two elements. Some tail recursion is used since we iterate on the bottom-up solution of the problem (we start with a small sorted list and keep merging other lists of the same size to it). */ static struct edge* sort_edge...
{ struct edge *head_other, *remaining; unsigned int i; head_other = list->next; if (head_other == NULL) { *head_out = list; return NULL; } remaining = head_other->next; if (list->x.quo <= head_other->x.quo) { *head_out = list; head_other->next = NULL; } else { *head_out = head_other...
xboot/xboot
C++
MIT License
779
/* Copy an openpromio structure in kernel space back to user space. */
static int copyout(void __user *info, struct openpromio *opp, int len)
/* Copy an openpromio structure in kernel space back to user space. */ static int copyout(void __user *info, struct openpromio *opp, int len)
{ if (copy_to_user(info, opp, len)) return -EFAULT; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function retrieves the period of timer interrupts in 100ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled. */
STATIC EFI_STATUS EFIAPI WatchdogGetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
/* This function retrieves the period of timer interrupts in 100ns units, returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is returned, then the timer is currently disabled. */ STATIC EFI_STATUS EFIAPI WatchdogGetTimerPerio...
{ if (TimerPeriod == NULL) { return EFI_INVALID_PARAMETER; } *TimerPeriod = mTimerPeriod; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Description: If a driver consumes less than the assigned budget in its run of the iopoll handler, it'll end the polled mode by calling this function. The iopoll handler will not be invoked again before blk_iopoll_sched_prep() is called. */
void blk_iopoll_complete(struct blk_iopoll *iopoll)
/* Description: If a driver consumes less than the assigned budget in its run of the iopoll handler, it'll end the polled mode by calling this function. The iopoll handler will not be invoked again before blk_iopoll_sched_prep() is called. */ void blk_iopoll_complete(struct blk_iopoll *iopoll)
{ unsigned long flags; local_irq_save(flags); __blk_iopoll_complete(iopoll); local_irq_restore(flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Display at provided coordinates the provided ASCII character with the provided text and background colors and with the provided magnify coefficient. */
void LCD_DisplayChar(u8 x, u8 y, u8 Ascii, u16 TextColor, u16 BGndColor, u16 CharMagniCoeff)
/* Display at provided coordinates the provided ASCII character with the provided text and background colors and with the provided magnify coefficient. */ void LCD_DisplayChar(u8 x, u8 y, u8 Ascii, u16 TextColor, u16 BGndColor, u16 CharMagniCoeff)
{ LCD_DrawChar( x, y, 7, (u8*)&AsciiDotsTable[ (Ascii-32) * 14 ], TextColor, BGndColor, CharMagniCoeff ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Writes a new I2C password. Needs the I2C Password presentation to be effective. */
int32_t ST25DV_WriteI2CPassword(ST25DV_Object_t *pObj, const ST25DV_PASSWD PassWord)
/* Writes a new I2C password. Needs the I2C Password presentation to be effective. */ int32_t ST25DV_WriteI2CPassword(ST25DV_Object_t *pObj, const ST25DV_PASSWD PassWord)
{ uint8_t ai2c_message[17] = {0}; uint8_t i; ai2c_message[8] = 0x07; for( i = 0; i < 4; i++ ) { ai2c_message[i] = ( PassWord.MsbPasswd >> ( (3 - i) * 8) ) & 0xFF; ai2c_message[i + 4] = ( PassWord.LsbPasswd >> ( (3 - i) * 8) ) & 0xFF; ai2c_message[i + 9] = ai2c_message[i]; ai2c_message[i + 13] ...
eclipse-threadx/getting-started
C++
Other
310
/* Resets or collects the statistics on a network interface. */
EFI_STATUS WinNtSnpStatistics(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
/* Resets or collects the statistics on a network interface. */ EFI_STATUS WinNtSnpStatistics(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
{ WIN_NT_SNP_PRIVATE *Private; Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This); return EFI_UNSUPPORTED; }
tianocore/edk2
C++
Other
4,240
/* Returns the most recent received data by the USARTx peripheral. */
uint16_t USART_ReceiveData(USART_TypeDef *USARTx)
/* Returns the most recent received data by the USARTx peripheral. */ uint16_t USART_ReceiveData(USART_TypeDef *USARTx)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); return (uint16_t)(USARTx->RDR & (uint16_t)0x01FF); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes lizhirui first version */
void mmu_enable_user_page_access()
/* Change Logs: Date Author Notes lizhirui first version */ void mmu_enable_user_page_access()
{ set_csr(sstatus, SSTATUS_SUM); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SYSCTRL HSTIMER Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_HSTMR_ClkEnRstRelease(void)
/* SYSCTRL HSTIMER Bus Clock Enable and Reset Release. */ void LL_SYSCTRL_HSTMR_ClkEnRstRelease(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_HSTIMERBusClk_En(SYSCTRL); __LL_SYSCTRL_HSTIMERSoftRst_Release(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets a data element from the SPI interface with Noblock. */
long xSPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SPI interface with Noblock. */ long xSPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
{ unsigned long ulTemp; unsigned char ucBitLength = xSPIBitLengthGet(ulBase); xASSERT(ulBase == SPI0_BASE); ulTemp = xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY; if(!ulTemp) { return 0; } if(ucBitLength <= 8 && ucBitLength != 0) { *pulData = xHWREG(ulBase + SPI_RX0...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI1IntHandler(void)
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI1IntHandler(void)
{ unsigned long ulEventFlags; unsigned long ulBase = SPI1_BASE; ulEventFlags = xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_IF; xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_IF; if(g_pfnSPIHandlerCallbacks[1]) { g_pfnSPIHandlerCallbacks[1](0, 0, ulEventFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Configure the RTT to generate an alarm at the given time. alarm happens when CRTV value equals ALMV+1, so RTT_AR should be alarmtime - 1. if you want to get alarm when rtt hit 0 , ALMV should be set to 0xFFFFFFFF. */
uint32_t rtt_write_alarm_time(Rtt *p_rtt, uint32_t ul_alarm_time)
/* Configure the RTT to generate an alarm at the given time. alarm happens when CRTV value equals ALMV+1, so RTT_AR should be alarmtime - 1. if you want to get alarm when rtt hit 0 , ALMV should be set to 0xFFFFFFFF. */ uint32_t rtt_write_alarm_time(Rtt *p_rtt, uint32_t ul_alarm_time)
{ uint32_t flag; flag = p_rtt->RTT_MR & RTT_MR_ALMIEN; rtt_disable_interrupt(RTT, RTT_MR_ALMIEN); if(ul_alarm_time == 0) { p_rtt->RTT_AR = 0xFFFFFFFF; } else { p_rtt->RTT_AR = ul_alarm_time - 1; } if (flag) { rtt_enable_interrupt(RTT, RTT_MR_ALMIEN); } return 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Sets the duty cycle of a FAN channel when in manual mode. */
void FanChannelDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulDuty)
/* Sets the duty cycle of a FAN channel when in manual mode. */ void FanChannelDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulDuty)
{ ASSERT(ulBase == FAN0_BASE); ASSERT(ulChannel <= 5); ASSERT(ulDuty < 512); HWREG(ulBase + FAN_O_CMD0 + (ulChannel * 0x10)) = (ulDuty << FAN_CMD0_DC_S) & FAN_CMD0_DC_M; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: TRUE if transformation and validation were successful, FALSE otherwise and @dest_value is left untouched. */
gboolean g_param_value_convert(GParamSpec *pspec, const GValue *src_value, GValue *dest_value, gboolean strict_validation)
/* Returns: TRUE if transformation and validation were successful, FALSE otherwise and @dest_value is left untouched. */ gboolean g_param_value_convert(GParamSpec *pspec, const GValue *src_value, GValue *dest_value, gboolean strict_validation)
{ GValue tmp_value = G_VALUE_INIT; g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE); g_return_val_if_fail (G_IS_VALUE (src_value), FALSE); g_return_val_if_fail (G_IS_VALUE (dest_value), FALSE); g_return_val_if_fail (PSPEC_APPLIES_TO_VALUE (pspec, dest_value), FALSE); g_value_init (&tmp_value, G_VALUE_T...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return current line of text. Called by dialog_textbox() and print_line(). 'page' should point to start of current line before calling, and will be updated to point to start of next line. */
static char * get_line(void)
/* Return current line of text. Called by dialog_textbox() and print_line(). 'page' should point to start of current line before calling, and will be updated to point to start of next line. */ static char * get_line(void)
{ int i = 0; static char line[MAX_LEN + 1]; end_reached = 0; while (*page != '\n') { if (*page == '\0') { end_reached = 1; break; } else if (i < MAX_LEN) line[i++] = *(page++); else { if (i == MAX_LEN) line[i++] = '\0'; page++; } } if (i <= MAX_LEN) line[i] = '\0'; if (!end_reached) ...
Nicholas3388/LuaNode
C++
Other
1,055
/* sets the status for Double Buffer Endpoint to STALL */
void USB_SetDouBleBuferEpStall(uint8_t bEpNum, uint8_t bDir)
/* sets the status for Double Buffer Endpoint to STALL */ void USB_SetDouBleBuferEpStall(uint8_t bEpNum, uint8_t bDir)
{ uint16_t Endpoint_DTOG_Status; Endpoint_DTOG_Status = USB_GetEndPoint(bEpNum); if (bDir == EP_DBUF_OUT) { _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPRX_DATTOG1); } else if (bDir == EP_DBUF_IN) { _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPTX_DATTOG1); } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Send lValue to the lPhyReg within the PHY. */
static long prvWritePHY(long lPhyReg, long lValue)
/* Send lValue to the lPhyReg within the PHY. */ static long prvWritePHY(long lPhyReg, long lValue)
{ const long lMaxTime = 10; long x; EMAC->MADR = DP83848C_DEF_ADR | lPhyReg; EMAC->MWTD = lValue; x = 0; for( x = 0; x < lMaxTime; x++ ) { if( ( EMAC->MIND & MIND_BUSY ) == 0 ) { break; } vTaskDelay( emacSHORT_DELAY ); } if( x < lMaxTime ) { return pdPASS; } else { return pdFAIL; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. */
mxml_node_t* mxmlSAXLoadFd(mxml_node_t *top, int fd, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data)
/* The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. */ mxml_node_t* mxmlSAXLoadFd(mxml_node_t *top, int fd, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void *sax_data)
{ _mxml_fdbuf_t buf; buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer; return (mxml_load_data(top, &buf, cb, mxml_fd_getc, sax_cb, sax_data)); }
DC-SWAT/DreamShell
C++
null
404
/* This routine is called by the kernel after it has written a series of characters to the tty device using put_char(). */
static void sclp_vt220_flush_chars(struct tty_struct *tty)
/* This routine is called by the kernel after it has written a series of characters to the tty device using put_char(). */ static void sclp_vt220_flush_chars(struct tty_struct *tty)
{ if (!sclp_vt220_queue_running) sclp_vt220_emit_current(); else sclp_vt220_flush_later = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* "memset" on IO memory space. This needs to be optimized. */
void memset_io(volatile void __iomem *dst, int c, long count)
/* "memset" on IO memory space. This needs to be optimized. */ void memset_io(volatile void __iomem *dst, int c, long count)
{ unsigned char ch = (char)(c & 0xff); while (count) { count--; writeb(ch, dst); dst++; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table. */
EFI_STATUS EFIAPI SmbiosLibInitializeFromTemplate(IN SMBIOS_TEMPLATE_ENTRY *Template)
/* Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table. */ EFI_STATUS EFIAPI SmbiosLibInitializeFromTemplate(IN SMBIOS_TEMPLATE_ENTRY *Template)
{ EFI_STATUS Status; UINTN Index; if (Template == NULL) { return EFI_INVALID_PARAMETER; } Status = EFI_SUCCESS; for (Index = 0; Template[Index].Entry != NULL; Index++) { Status = SmbiosLibCreateEntry (Template[Index].Entry, Template[Index].StringArray); } return Status; }
tianocore/edk2
C++
Other
4,240
/* Send a new alert notification to the given category with the given info string. */
static int ble_svc_ans_new_alert_notify(uint8_t cat_id, const char *info_str)
/* Send a new alert notification to the given category with the given info string. */ static int ble_svc_ans_new_alert_notify(uint8_t cat_id, const char *info_str)
{ int info_str_len; memset(&ble_svc_ans_new_alert_val, '\0', BLE_SVC_ANS_NEW_ALERT_MAX_LEN); ble_svc_ans_new_alert_val[0] = cat_id; ble_svc_ans_new_alert_val[1] = ble_svc_ans_new_alert_cnt[cat_id]; if (info_str) { info_str_len = strlen(info_str); if (info_str_len > BLE_SVC...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* USBH_MSC_BOT_REQ_GetMaxLUN The function the MSC BOT GetMaxLUN request. */
USBH_StatusTypeDef USBH_MSC_BOT_REQ_GetMaxLUN(USBH_HandleTypeDef *phost, uint8_t *Maxlun)
/* USBH_MSC_BOT_REQ_GetMaxLUN The function the MSC BOT GetMaxLUN request. */ USBH_StatusTypeDef USBH_MSC_BOT_REQ_GetMaxLUN(USBH_HandleTypeDef *phost, uint8_t *Maxlun)
{ phost->Control.setup.b.bmRequestType = USB_D2H | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE; phost->Control.setup.b.bRequest = USB_REQ_GET_MAX_LUN; phost->Control.setup.b.wValue.w = 0U; phost->Control.setup.b.wIndex.w = 0U; phost->Control.setup.b.wLength.w = 1U...
ua1arn/hftrx
C++
null
69
/* Returns a frequency, or a negative error code, or 0 for auto. */
int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq)
/* Returns a frequency, or a negative error code, or 0 for auto. */ int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq)
{ if (freq->e == 0) { if (freq->m < 0) return 0; return ieee80211_channel_to_frequency(freq->m); } else { int i, div = 1000000; for (i = 0; i < freq->e; i++) div /= 10; if (div <= 0) return -EINVAL; return freq->m / div; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables I2C Idle Clock Timeout (Bus idle SCL and SDA high detection). */
void I2C_IdleClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables I2C Idle Clock Timeout (Bus idle SCL and SDA high detection). */ void I2C_IdleClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_1_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { I2Cx->TIMEOUTR |= I2C_TIMEOUTR_TIDLE; } else { I2Cx->TIMEOUTR &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TIDLE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Inform the application about the Interrupt IN transfer completion. */
static void usbd_vendor_write_interrupt_async_complete(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status)
/* Inform the application about the Interrupt IN transfer completion. */ static void usbd_vendor_write_interrupt_async_complete(uint8_t ep_addr, void *p_buf, uint32_t buf_len, uint32_t xfer_len, void *p_arg, sl_status_t status)
{ sli_usbd_vendor_ctrl_t *p_ctrl; void *p_callback_arg; (void)&ep_addr; p_ctrl = (sli_usbd_vendor_ctrl_t *)p_arg; p_callback_arg = p_ctrl->interrupt_write_async_arg_ptr; p_ctrl->comm_ptr->interrupt_in_active_transfer = false; p_ctrl->interrupt_write_async_function(p_ctrl->class_nbr, ...
nanoframework/nf-interpreter
C++
MIT License
293
/* ibmvfc_bsg_timeout_done - Completion handler for cancelling BSG commands @evt: struct ibmvfc_event */
static void ibmvfc_bsg_timeout_done(struct ibmvfc_event *evt)
/* ibmvfc_bsg_timeout_done - Completion handler for cancelling BSG commands @evt: struct ibmvfc_event */ static void ibmvfc_bsg_timeout_done(struct ibmvfc_event *evt)
{ struct ibmvfc_host *vhost = evt->vhost; ibmvfc_free_event(evt); vhost->aborting_passthru = 0; dev_info(vhost->dev, "Passthru command cancelled\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* This service enables the sending of commands to the TPM12. */
EFI_STATUS EFIAPI Tpm12SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
/* This service enables the sending of commands to the TPM12. */ EFI_STATUS EFIAPI Tpm12SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
{ PTP_INTERFACE_TYPE PtpInterface; PtpInterface = Tpm12GetPtpInterface ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress)); switch (PtpInterface) { case PtpInterfaceFifo: case PtpInterfaceTis: return Tpm12TisTpmCommand ( (TIS_PC_REGISTERS_PTR)(UINTN)PcdGet64 (PcdTpmBaseAddress), ...
tianocore/edk2
C++
Other
4,240
/* Cyclom 2X Interrupt Service Routine. o acknowledge Cyclom 2X hardware interrupt. o call protocol-specific interrupt service routine, if any. */
static irqreturn_t cycx_isr(int irq, void *dev_id)
/* Cyclom 2X Interrupt Service Routine. o acknowledge Cyclom 2X hardware interrupt. o call protocol-specific interrupt service routine, if any. */ static irqreturn_t cycx_isr(int irq, void *dev_id)
{ struct cycx_device *card = dev_id; if (card->wandev.state == WAN_UNCONFIGURED) goto out; if (card->in_isr) { printk(KERN_WARNING "%s: interrupt re-entrancy on IRQ %d!\n", card->devname, card->wandev.irq); goto out; } if (card->isr) card->isr(card); return IRQ_HANDLED; out: return IRQ_NONE; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable the interrupt of the specified TMR2 channel. */
void TMR2_IntCmd(CM_TMR2_TypeDef *TMR2x, uint32_t u32IntType, en_functional_state_t enNewState)
/* Enable or disable the interrupt of the specified TMR2 channel. */ void TMR2_IntCmd(CM_TMR2_TypeDef *TMR2x, uint32_t u32IntType, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_TMR2_UNIT(TMR2x)); DDL_ASSERT(IS_TMR2_INT(u32IntType)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); if (enNewState == ENABLE) { SET_REG32_BIT(TMR2x->ICONR, u32IntType); } else { CLR_REG32_BIT(TMR2x->ICONR, u32IntType); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if Logical Volume Descriptor is supported by current EDK2 UDF file system implementation. */
BOOLEAN IsLogicalVolumeDescriptorSupported(UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc)
/* Check if Logical Volume Descriptor is supported by current EDK2 UDF file system implementation. */ BOOLEAN IsLogicalVolumeDescriptorSupported(UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc)
{ switch (LogicalVolDesc->DomainIdentifier.Suffix.Domain.UdfRevision) { case 0x0102: case 0x0150: case 0x0200: case 0x0201: case 0x0250: case 0x0260: break; default: return FALSE; } if (LogicalVolDesc->NumberOfPartitionMaps > 1) { return FALSE; } if ((LogicalVolDesc...
tianocore/edk2
C++
Other
4,240
/* Parse the URL and set the relevant members of the */
static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
/* Parse the URL and set the relevant members of the */ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
{ CURLUcode result = seturl(url, u, flags); if(result) { free_urlhandle(u); memset(u, 0, sizeof(struct Curl_URL)); } return result; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If two array elements compare equal, their order in the sorted array is undefined. If you want equal elements to keep their order (i.e. you want a stable sort) you can write a comparison function that, if two elements would otherwise compare equal, compares them by their addresses. */
void g_byte_array_sort(GByteArray *array, GCompareFunc compare_func)
/* If two array elements compare equal, their order in the sorted array is undefined. If you want equal elements to keep their order (i.e. you want a stable sort) you can write a comparison function that, if two elements would otherwise compare equal, compares them by their addresses. */ void g_byte_array_sort(GByteAr...
{ g_array_sort ((GArray *)array, compare_func); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Forces the TIMx output 4 waveform to active or inactive level. */
void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
/* Forces the TIMx output 4 waveform to active or inactive level. */ void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= CCMR_OC24M_Mask; tmpccmr2 |= (uint16_t)(TIM_ForcedAction << 8); TIMx->CCMR2 = tmpccmr2; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write one 4-byte long word to the data EEPROM memory. The address must be 4-byte aligned. */
void __eeprom_program_long(unsigned char __near *dst, unsigned long v)
/* Write one 4-byte long word to the data EEPROM memory. The address must be 4-byte aligned. */ void __eeprom_program_long(unsigned char __near *dst, unsigned long v)
{ FLASH_ProgramWord((u32)dst, (u32)v); }
remotemcu/remcu-chip-sdks
C++
null
436
/* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
{ return (UINT8)IoWriteWorker (Port, EfiCpuIoWidthUint8, Value); }
tianocore/edk2
C++
Other
4,240
/* Set address that the device is sending before a transaction. */
int32_t i2c_set_address(i2c_desc *desc, uint8_t new_address)
/* Set address that the device is sending before a transaction. */ int32_t i2c_set_address(i2c_desc *desc, uint8_t new_address)
{ return adi_i2c_SetSlaveAddress(master_i2c_dev, new_address); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* lps_public BFA LPS public functions Allocate a lport srvice tag. */
struct bfa_lps_s* bfa_lps_alloc(struct bfa_s *bfa)
/* lps_public BFA LPS public functions Allocate a lport srvice tag. */ struct bfa_lps_s* bfa_lps_alloc(struct bfa_s *bfa)
{ struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); struct bfa_lps_s *lps = NULL; bfa_q_deq(&mod->lps_free_q, &lps); if (lps == NULL) return NULL; list_add_tail(&lps->qe, &mod->lps_active_q); bfa_sm_set_state(lps, bfa_lps_sm_init); return lps; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: 0 upon success or -ERANGE if the reference clock rate is out of range. */
static int __wrpll_update_parent_rate(struct wrpll_cfg *c, unsigned long parent_rate)
/* Returns: 0 upon success or -ERANGE if the reference clock rate is out of range. */ static int __wrpll_update_parent_rate(struct wrpll_cfg *c, unsigned long parent_rate)
{ u8 max_r_for_parent; if (parent_rate > MAX_INPUT_FREQ || parent_rate < MIN_POST_DIVR_FREQ) return -ERANGE; c->parent_rate = parent_rate; max_r_for_parent = div_u64(parent_rate, MIN_POST_DIVR_FREQ); c->max_r = min_t(u8, MAX_DIVR_DIVISOR, max_r_for_parent); c->init_r = DIV_ROUND_UP_ULL(parent_rate, MAX_POST_DIV...
4ms/stm32mp1-baremetal
C++
Other
137
/* Dispose of the state data for the drives control loop */
static void dispose_drives_state(struct drives_pid_state *state)
/* Dispose of the state data for the drives control loop */ static void dispose_drives_state(struct drives_pid_state *state)
{ if (state->monitor == NULL) return; device_remove_file(&of_dev->dev, &dev_attr_drives_temperature); device_remove_file(&of_dev->dev, &dev_attr_drives_fan_rpm); state->monitor = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Register a function to be executed on a tap event. The tap direction is represented by one of the following: */
int dmp_register_tap_cb(void(*func)(unsigned char, unsigned char))
/* Register a function to be executed on a tap event. The tap direction is represented by one of the following: */ int dmp_register_tap_cb(void(*func)(unsigned char, unsigned char))
{ dmp.tap_cb = func; return 0; }
Luos-io/luos_engine
C++
MIT License
496
/* PCI address bit 16 - 24: bus number bit 8 - 15: devfun number bit 0 - 7: offset in configuration space of a given pci device */
static PCIDevice* pci_dev_find_by_addr(PCIBus *bus, uint32_t addr)
/* PCI address bit 16 - 24: bus number bit 8 - 15: devfun number bit 0 - 7: offset in configuration space of a given pci device */ static PCIDevice* pci_dev_find_by_addr(PCIBus *bus, uint32_t addr)
{ uint8_t bus_num = addr >> 16; uint8_t devfn = addr >> 8; return pci_find_device(bus, bus_num, devfn); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Clears the "tally counters" for CRC errors and missed frames(?). It has been reported that some chips need a write of 0 to clear these, for others the counters are set to 1 when written to and instead cleared when read. So we clear them both ways ... */
static void clear_tally_counters(void __iomem *ioaddr)
/* Clears the "tally counters" for CRC errors and missed frames(?). It has been reported that some chips need a write of 0 to clear these, for others the counters are set to 1 when written to and instead cleared when read. So we clear them both ways ... */ static void clear_tally_counters(void __iomem *ioaddr)
{ iowrite32(0, ioaddr + RxMissed); ioread16(ioaddr + RxCRCErrs); ioread16(ioaddr + RxMissed); }
robutest/uclinux
C++
GPL-2.0
60
/* ETR timing alert. There are two causes: 1) port state change, check the usability of the port 2) port alert, one of the ETR-data-validity bits (v1-v2 bits of the sldr-status word) or ETR-data word 1 (edf1) or ETR-data word 3 (edf3) or ETR-data word 4 (edf4) has changed. */
static void etr_timing_alert(struct etr_irq_parm *)
/* ETR timing alert. There are two causes: 1) port state change, check the usability of the port 2) port alert, one of the ETR-data-validity bits (v1-v2 bits of the sldr-status word) or ETR-data word 1 (edf1) or ETR-data word 3 (edf3) or ETR-data word 4 (edf4) has changed. */ static void etr_timing_alert(struct etr_ir...
{ if (intparm->pc0) set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events); if (intparm->pc1) set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events); if (intparm->eai) set_bit(ETR_EVENT_PORT_ALERT, &etr_events); queue_work(time_sync_wq, &etr_work); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the discontinuous mode on regular group channel for the specified ADC. */
void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the discontinuous mode on regular group channel for the specified ADC. */ void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CR1 |= (uint32_t)ADC_CR1_DISCEN; } else { ADCx->CR1 &= (uint32_t)(~ADC_CR1_DISCEN); } }
avem-labs/Avem
C++
MIT License
1,752
/* Walk all dissector tables calling a user supplied function only on any entry that has been changed from its original state. */
void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
/* Walk all dissector tables calling a user supplied function only on any entry that has been changed from its original state. */ void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
{ dissector_foreach_info_t info; info.caller_data = user_data; info.caller_func = func; info.next_func = dissector_table_foreach_changed_func; g_hash_table_foreach(dissector_tables, dissector_all_tables_foreach_func, &info); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Register Command Function: MX25_RDSR Arguments: StatusReg, 8 bit buffer to store status register value Description: The RDSR instruction is for reading Status Register Bits. Return Message: FlashOperationSuccess */
ReturnMsg MX25_RDSR(uint8_t *StatusReg)
/* Register Command Function: MX25_RDSR Arguments: StatusReg, 8 bit buffer to store status register value Description: The RDSR instruction is for reading Status Register Bits. Return Message: FlashOperationSuccess */ ReturnMsg MX25_RDSR(uint8_t *StatusReg)
{ uint8_t gDataBuffer; CS_Low(); SendByte( FLASH_CMD_RDSR, SIO ); gDataBuffer = GetByte( SIO ); CS_High(); *StatusReg = gDataBuffer; return FlashOperationSuccess; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */
BOOLEAN EFIAPI CryptoServiceEcGroupGetCurve(IN CONST VOID *EcGroup, OUT VOID *BnPrime, OUT VOID *BnA, OUT VOID *BnB, IN VOID *BnCtx)
/* Get EC curve parameters. While elliptic curve equation is Y^2 mod P = (X^3 + AX + B) Mod P. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */ BOOLEAN EFIAPI CryptoServiceEcGroupGetCurve(IN...
{ return CALL_BASECRYPTLIB (Ec.Services.GroupGetCurve, EcGroupGetCurve, (EcGroup, BnPrime, BnA, BnB, BnCtx), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Check that all PLLs are ready therefore configuration can be done. */
static ErrorStatus UTILS_IsPLLsReady(void)
/* Check that all PLLs are ready therefore configuration can be done. */ static ErrorStatus UTILS_IsPLLsReady(void)
{ ErrorStatus status = SUCCESS; if (LL_RCC_PLL1_IsReady() != 0U) { status = ERROR; } if (LL_RCC_PLL2_IsReady() != 0U) { status = ERROR; } if (LL_RCC_PLL3_IsReady() != 0U) { status = ERROR; } if (LL_RCC_PLL4_IsReady() != 0U) { status = ERROR; } return status; }
ua1arn/hftrx
C++
null
69
/* Reset the board. This ignores the ENx registers. */
void __pixis_reset(void)
/* Reset the board. This ignores the ENx registers. */ void __pixis_reset(void)
{ PIXIS_WRITE(rst, 0); while (1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Writes a buffer to PE internal data memory (DMEM) from the host through indirect access registers. */
static void pe_dmem_memcpy_to32(int id, u32 dst, const void *src, unsigned int len)
/* Writes a buffer to PE internal data memory (DMEM) from the host through indirect access registers. */ static void pe_dmem_memcpy_to32(int id, u32 dst, const void *src, unsigned int len)
{ pe_mem_memcpy_to32(id, pe[id].dmem_base_addr | dst | PE_MEM_ACCESS_DMEM, src, len); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function checks if any part of the range <start,end> is mapped with type. */
int e820_any_mapped(u64 start, u64 end, unsigned type)
/* This function checks if any part of the range <start,end> is mapped with type. */ int e820_any_mapped(u64 start, u64 end, unsigned type)
{ int i; for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; if (type && ei->type != type) continue; if (ei->addr >= end || ei->addr + ei->size <= start) continue; return 1; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If there is no data in the receive FIFO, then this function will wait in a polling loop until data is available. */
void I2SRxDataGet(unsigned long ulBase, unsigned long *pulData)
/* If there is no data in the receive FIFO, then this function will wait in a polling loop until data is available. */ void I2SRxDataGet(unsigned long ulBase, unsigned long *pulData)
{ ASSERT(ulBase == I2S0_BASE); while(HWREG(ulBase + I2S_O_RXLEV) == 0) { } *pulData = HWREG(ulBase + I2S_O_RXFIFO); }
watterott/WebRadio
C++
null
71
/* igbvf_remove is called by the PCI subsystem to alert the driver that it should release a PCI device. The could be caused by a Hot-Plug event, or because the driver is going to be removed from memory. */
static void __devexit igbvf_remove(struct pci_dev *pdev)
/* igbvf_remove is called by the PCI subsystem to alert the driver that it should release a PCI device. The could be caused by a Hot-Plug event, or because the driver is going to be removed from memory. */ static void __devexit igbvf_remove(struct pci_dev *pdev)
{ struct net_device *netdev = pci_get_drvdata(pdev); struct igbvf_adapter *adapter = netdev_priv(netdev); struct e1000_hw *hw = &adapter->hw; set_bit(__IGBVF_DOWN, &adapter->state); del_timer_sync(&adapter->watchdog_timer); flush_scheduled_work(); unregister_netdev(netdev); igbvf_reset_interrupt_capability(adap...
robutest/uclinux
C++
GPL-2.0
60
/* this function handles the request for freeing dma table for synhronic actions */
static int sep_free_dma_table_data_handler(struct sep_device *sep)
/* this function handles the request for freeing dma table for synhronic actions */ static int sep_free_dma_table_data_handler(struct sep_device *sep)
{ dbg("SEP Driver:--------> sep_free_dma_table_data_handler start\n"); sep_free_dma_pages(sep->in_page_array, sep->in_num_pages, 0); if (sep->out_page_array) sep_free_dma_pages(sep->out_page_array, sep->out_num_pages, 1); sep->in_page_array = 0; sep->out_page_array = 0; sep->in_num_pages = 0; sep->out_num_page...
robutest/uclinux
C++
GPL-2.0
60
/* Pause watchdog operation. Sets the pause signal to stop the watchdog timing */
int intel_adsp_watchdog_pause(const struct device *dev, const int channel_id)
/* Pause watchdog operation. Sets the pause signal to stop the watchdog timing */ int intel_adsp_watchdog_pause(const struct device *dev, const int channel_id)
{ const struct intel_adsp_wdt_dev_cfg *const dev_config = dev->config; if (channel_id >= arch_num_cpus()) { return -EINVAL; } intel_adsp_wdt_pause(dev_config->base, channel_id); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */
void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */ void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
{ FLEXIO_UART_DisableInterrupts(base, (uint32_t)kFLEXIO_UART_TxDataRegEmptyInterruptEnable); handle->txDataSize = 0U; handle->txState = (uint8_t)kFLEXIO_UART_TxIdle; }
eclipse-threadx/getting-started
C++
Other
310
/* Print a parser warning, using the source file name and line number set by a previous call to SetParserPosition(). */
VOID ParserWarning(UINT32 ErrorCode, CHAR8 *OffendingText, CHAR8 *MsgFmt,...)
/* Print a parser warning, using the source file name and line number set by a previous call to SetParserPosition(). */ VOID ParserWarning(UINT32 ErrorCode, CHAR8 *OffendingText, CHAR8 *MsgFmt,...)
{ va_list List; if (mPrintLimitsSet) { if (mMaxWarningsPlusErrors != 0) { if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) { PrintLimitExceeded (); return ; } } if (mMaxWarnings != 0) { if (mWarningCount > mMaxWarnings) { PrintLimitExceeded (); ...
tianocore/edk2
C++
Other
4,240
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range spec...
UINT16 EFIAPI IoBitFieldOr16(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If 16-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range spec...
{ return IoWrite16 ( Port, BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData) ); }
tianocore/edk2
C++
Other
4,240
/* Ends control endpoint OUT request (completes usb request), and puts control endpoint into idle state */
static void ep0_end_out_req(struct pxa_ep *ep, struct pxa27x_request *req)
/* Ends control endpoint OUT request (completes usb request), and puts control endpoint into idle state */ static void ep0_end_out_req(struct pxa_ep *ep, struct pxa27x_request *req)
{ set_ep0state(ep->dev, OUT_STATUS_STAGE); ep_end_out_req(ep, req); ep0_idle(ep->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the FIFO buffer of the specified SPI port. */
void SPIFIFOClear(unsigned long ulBase, unsigned long ulRxTx)
/* Clear the FIFO buffer of the specified SPI port. */ void SPIFIFOClear(unsigned long ulBase, unsigned long ulRxTx)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); xHWREG(ulBase + SPI_FIFOCTL) |= ulRxTx; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Gets the GPIO instance according to the GPIO base. */
static uint32_t GPIO_GetInstance(GPIO_Type *base)
/* Gets the GPIO instance according to the GPIO base. */ static uint32_t GPIO_GetInstance(GPIO_Type *base)
{ uint32_t instance; for (instance = 0; instance < FSL_FEATURE_SOC_GPIO_COUNT; instance++) { if (s_gpioBases[instance] == base) { break; } } assert(instance < FSL_FEATURE_SOC_GPIO_COUNT); return instance; }
labapart/polymcu
C++
null
201
/* This should only be called when a serious anomally has been detected. This will turn off the function tracing, ring buffers, and other tracing utilites. It takes no locks and can be called from any context. */
void ftrace_off_permanent(void)
/* This should only be called when a serious anomally has been detected. This will turn off the function tracing, ring buffers, and other tracing utilites. It takes no locks and can be called from any context. */ void ftrace_off_permanent(void)
{ tracing_disabled = 1; ftrace_stop(); tracing_off_permanent(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The destructor function frees memory allocated by constructor, and closes related events. It will ASSERT() if that related operation fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI RuntimeResetSystemLibDeconstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The destructor function frees memory allocated by constructor, and closes related events. It will ASSERT() if that related operation fails and it will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI RuntimeResetSystemLibDeconstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; ASSERT (gBS != NULL); Status = gBS->CloseEvent (mRuntimeResetSystemLibVirtualAddressChangeEvent); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* CMD9: Addressed card sends its card-specific data (CSD) on the CMD line mci. */
static bool sd_mmc_cmd9_mci(void)
/* CMD9: Addressed card sends its card-specific data (CSD) on the CMD line mci. */ static bool sd_mmc_cmd9_mci(void)
{ if (!driver_send_cmd(SDMMC_MCI_CMD9_SEND_CSD, (uint32_t)sd_mmc_card->rca << 16)) { return false; } driver_get_response_128(sd_mmc_card->csd); return true; }
memfault/zero-to-main
C++
null
200
/* This function is used to manage a USB device with an interrupt transfer pipe. */
EFI_STATUS EFIAPI UsbEthEcmInterrupt(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN BOOLEAN IsNewTransfer, IN UINTN PollingInterval, IN EFI_USB_DEVICE_REQUEST *Request)
/* This function is used to manage a USB device with an interrupt transfer pipe. */ EFI_STATUS EFIAPI UsbEthEcmInterrupt(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN BOOLEAN IsNewTransfer, IN UINTN PollingInterval, IN EFI_USB_DEVICE_REQUEST *Request)
{ EFI_STATUS Status; USB_ETHERNET_DRIVER *UsbEthDriver; UINTN DataLength; UsbEthDriver = USB_ETHERNET_DEV_FROM_THIS (This); DataLength = 0; if (IsNewTransfer) { DataLength = sizeof (EFI_USB_DEVICE_REQUEST) + sizeof (USB_CONNECT_SPEED_CHANGE); Status = UsbEthDriver->Us...
tianocore/edk2
C++
Other
4,240
/* This function parses the IORT Node Id Mapping array. */
STATIC VOID DumpIortNodeIdMappings(IN UINT8 *Ptr, IN UINT32 Length, IN UINT32 MappingCount)
/* This function parses the IORT Node Id Mapping array. */ STATIC VOID DumpIortNodeIdMappings(IN UINT8 *Ptr, IN UINT32 Length, IN UINT32 MappingCount)
{ UINT32 Index; UINT32 Offset; CHAR8 Buffer[40]; Index = 0; Offset = 0; while ((Index < MappingCount) && (Offset < Length)) { AsciiSPrint ( Buffer, sizeof (Buffer), "ID Mapping [%d]", Index ); Offset += ParseAcpi ( TRUE, 4...
tianocore/edk2
C++
Other
4,240
/* Puts a data element into the SSI transmit FIFO as the end of a frame. */
void SSIAdvDataPutFrameEnd(uint32_t ui32Base, uint32_t ui32Data)
/* Puts a data element into the SSI transmit FIFO as the end of a frame. */ void SSIAdvDataPutFrameEnd(uint32_t ui32Base, uint32_t ui32Data)
{ ASSERT(_SSIBaseValid(ui32Base)); ASSERT((ui32Data & 0xffffff00) == 0); while(!(HWREG(ui32Base + SSI_O_SR) & SSI_SR_TNF)) { } HWREG(ui32Base + SSI_O_CR1) |= SSI_CR1_EOM; HWREG(ui32Base + SSI_O_DR) = ui32Data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will return the amount of WCMD delay on the given channel as an absolute PI count. */
uint32_t get_wcmd(uint8_t channel)
/* This function will return the amount of WCMD delay on the given channel as an absolute PI count. */ uint32_t get_wcmd(uint8_t channel)
{ uint32_t reg; uint32_t temp; uint32_t pi_count; ENTERFN(); reg = CMDPTRREG + channel * DDRIOCCC_CH_OFFSET; temp = msg_port_alt_read(DDRPHY, reg); temp >>= 8; temp &= 0xf; pi_count = temp * HALF_CLK; reg = CMDDLLPICODER1 + channel * DDRIOCCC_CH_OFFSET; temp = msg_port_alt_read(DDRPHY, reg); temp >>= 16; t...
4ms/stm32mp1-baremetal
C++
Other
137
/* This function is the implementation of SPI1 handler named in startup code. It passes the instance to the shared DSPI IRQ handler. */
void SPI1_IRQHandler(void)
/* This function is the implementation of SPI1 handler named in startup code. It passes the instance to the shared DSPI IRQ handler. */ void SPI1_IRQHandler(void)
{ DSPI_DRV_EdmaIRQHandler(SPI1_IDX); }
remotemcu/remcu-chip-sdks
C++
null
436
/* If Count is greater than 31, then ASSERT(). */
UINT32 EFIAPI RRotU32(IN UINT32 Operand, IN UINTN Count)
/* If Count is greater than 31, then ASSERT(). */ UINT32 EFIAPI RRotU32(IN UINT32 Operand, IN UINTN Count)
{ ASSERT (Count < 32); return (Operand >> Count) | (Operand << (32 - Count)); }
tianocore/edk2
C++
Other
4,240
/* General outline: remap really low stuff to SuperIO, stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) is mapped through the PCI IO window. Stuff with high bits (PXSEG) should be way beyond the window, and is used w/o translation for compatibility. */
unsigned char sh7751systemh_inb(unsigned long port)
/* General outline: remap really low stuff to SuperIO, stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) is mapped through the PCI IO window. Stuff with high bits (PXSEG) should be way beyond the window, and is used w/o translation for compatibility. */ unsigned char sh7751systemh_inb(unsigned long p...
{ if (PXSEG(port)) return *(volatile unsigned char *)port; else if (port <= 0x3F1) return *(volatile unsigned char *)ETHER_IOMAP(port); else return (*port2adr(port))&0xff; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If a runtime driver exits with an error, it must call this routine to free the allocated resource before the exiting. */
EFI_STATUS EFIAPI DxeRuntimeDebugLibSerialPortDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* If a runtime driver exits with an error, it must call this routine to free the allocated resource before the exiting. */ EFI_STATUS EFIAPI DxeRuntimeDebugLibSerialPortDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ return SystemTable->BootServices->CloseEvent (mEfiExitBootServicesEvent); }
tianocore/edk2
C++
Other
4,240
/* Use the TDVMCALL instruction to handle msr write */
STATIC UINT64 WriteMsrExit(IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
/* Use the TDVMCALL instruction to handle msr write */ STATIC UINT64 WriteMsrExit(IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
{ UINT64 Status; MSR_DATA Data; Data.Regs.Eax = (UINT32)Regs->Rax; Data.Regs.Edx = (UINT32)Regs->Rdx; Status = TdVmCall (EXIT_REASON_MSR_WRITE, Regs->Rcx, Data.Val, 0, 0, NULL); return Status; }
tianocore/edk2
C++
Other
4,240
/* Clean swap cache pages can be directly isolated. A later page fault will bring in the known good data from disk. */
static int me_swapcache_dirty(struct page *p, unsigned long pfn)
/* Clean swap cache pages can be directly isolated. A later page fault will bring in the known good data from disk. */ static int me_swapcache_dirty(struct page *p, unsigned long pfn)
{ ClearPageDirty(p); ClearPageUptodate(p); if (!delete_from_lru_cache(p)) return DELAYED; else return FAILED; }
robutest/uclinux
C++
GPL-2.0
60
/* _base_disable_msix - disables msix @ioc: per adapter object */
static void _base_disable_msix(struct MPT2SAS_ADAPTER *ioc)
/* _base_disable_msix - disables msix @ioc: per adapter object */ static void _base_disable_msix(struct MPT2SAS_ADAPTER *ioc)
{ if (ioc->msix_enable) { pci_disable_msix(ioc->pdev); kfree(ioc->msix_table_backup); ioc->msix_table_backup = NULL; ioc->msix_enable = 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns The low order bits of the JTAG chain that shifted out of the circle. */
uint32_t cvmx_helper_qlm_jtag_shift(int qlm, int bits, uint32_t data)
/* Returns The low order bits of the JTAG chain that shifted out of the circle. */ uint32_t cvmx_helper_qlm_jtag_shift(int qlm, int bits, uint32_t data)
{ union cvmx_ciu_qlm_jtgd jtgd; jtgd.u64 = 0; jtgd.s.shift = 1; jtgd.s.shft_cnt = bits - 1; jtgd.s.shft_reg = data; if (!OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)) jtgd.s.select = 1 << qlm; cvmx_write_csr(CVMX_CIU_QLM_JTGD, jtgd.u64); do { jtgd.u64 = cvmx_read_csr(CVMX_CIU_QLM_JTGD); } while (jtgd.s.shift); ...
EmcraftSystems/linux-emcraft
C++
Other
266