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
/* Enables or disables the RTC reference clock detection. */
ErrorStatus RTC_RefClockCmd(FunctionalState NewState)
/* Enables or disables the RTC reference clock detection. */ ErrorStatus RTC_RefClockCmd(FunctionalState NewState)
{ ErrorStatus status = ERROR; assert_param(IS_FUNCTIONAL_STATE(NewState)); RTC->WPR = 0xCA; RTC->WPR = 0x53; if (RTC_EnterInitMode() == ERROR) { status = ERROR; } else { if (NewState != DISABLE) { RTC->CR |= RTC_CR_REFCKON; } else { RTC->CR &= ~RTC_CR_REFCKON; }...
ajhc/demo-cortex-m3
C++
null
38
/* Executes an MWAIT instruction with the register state specified by Eax and Ecx. Returns Eax. This function is only available on IA-32 and x64. */
UINTN EFIAPI AsmMwait(IN UINTN RegisterEax, IN UINTN RegisterEcx)
/* Executes an MWAIT instruction with the register state specified by Eax and Ecx. Returns Eax. This function is only available on IA-32 and x64. */ UINTN EFIAPI AsmMwait(IN UINTN RegisterEax, IN UINTN RegisterEcx)
{ _asm { mov eax, RegisterEax mov ecx, RegisterEcx _emit 0x0f _emit 0x01 _emit 0xC9 } }
tianocore/edk2
C++
Other
4,240
/* Register devres @res to @dev. @res should have been allocated using devres_alloc(). On driver detach, the associated release function will be invoked and devres will be freed automatically. */
void devres_add(struct device *dev, void *res)
/* Register devres @res to @dev. @res should have been allocated using devres_alloc(). On driver detach, the associated release function will be invoked and devres will be freed automatically. */ void devres_add(struct device *dev, void *res)
{ struct devres *dr = container_of(res, struct devres, data); unsigned long flags; spin_lock_irqsave(&dev->devres_lock, flags); add_dr(dev, &dr->node); spin_unlock_irqrestore(&dev->devres_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* 8-bit packed samples => RGBA w/ associated alpha (known to have Map == NULL) */
DECLAREContigPutFunc(putRGBAAcontig8bittile)
/* 8-bit packed samples => RGBA w/ associated alpha (known to have Map == NULL) */ DECLAREContigPutFunc(putRGBAAcontig8bittile)
{ int samplesperpixel = img->samplesperpixel; (void) x; (void) y; fromskew *= samplesperpixel; for( ; h > 0; --h) { UNROLL8(w, NOP, *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]); pp += samplesperpixel); cp += toskew; pp += fromskew; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Read the "reg" property of Node in DeviceTree as a UINT64 base address. */
STATIC RETURN_STATUS GetBaseAddress(IN CONST VOID *DeviceTree, IN INT32 Node, OUT UINT64 *BaseAddress)
/* Read the "reg" property of Node in DeviceTree as a UINT64 base address. */ STATIC RETURN_STATUS GetBaseAddress(IN CONST VOID *DeviceTree, IN INT32 Node, OUT UINT64 *BaseAddress)
{ CONST CHAR8 *NodeStatus; CONST VOID *RegProp; INT32 PropSize; NodeStatus = fdt_getprop (DeviceTree, Node, "status", NULL); if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) { return RETURN_DEVICE_ERROR; } RegProp = fdt_getprop (DeviceTree, Node, "reg", &PropSize); if (...
tianocore/edk2
C++
Other
4,240
/* Returns the FLASH Write Protection Option Bytes value. */
uint32_t FLASH_OB_GetWRP1(void)
/* Returns the FLASH Write Protection Option Bytes value. */ uint32_t FLASH_OB_GetWRP1(void)
{ return (uint32_t)(FLASH->WRPR1); }
avem-labs/Avem
C++
MIT License
1,752
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
{ if(hltdc->Instance==LTDC) { __HAL_RCC_LTDC_CLK_DISABLE(); HAL_GPIO_DeInit(ENABLE_GPIO_Port, ENABLE_Pin); HAL_GPIO_DeInit(GPIOA, B5_Pin|VSYNC_Pin|G2_Pin|R4_Pin |R5_Pin); HAL_GPIO_DeInit(GPIOB, R3_Pin|R6_Pin|G4_Pin|G5_Pin |B6_Pin|B7_Pin); HAL_G...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* get_tacc - turn tACC value into cycle time @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. @val: The bank timing register value, shifed down. */
static unsigned int get_tacc(unsigned long hclk_tns, unsigned long val)
/* get_tacc - turn tACC value into cycle time @hclk_tns: The cycle time for HCLK, in 10ths of nanoseconds. @val: The bank timing register value, shifed down. */ static unsigned int get_tacc(unsigned long hclk_tns, unsigned long val)
{ val &= 7; return hclk_tns * tacc_tab[val]; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable RTC Timer wake-up function that chip can be waken up from power down mode by Time Tick or Alarm Match. */
void RTCWakeupEnable(void)
/* Enable RTC Timer wake-up function that chip can be waken up from power down mode by Time Tick or Alarm Match. */ void RTCWakeupEnable(void)
{ RTCWriteEnable(); xHWREG(RTC_TTR) |= RTC_TTR_TWKE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return: index into SLI4 fast-path FCP queue index. */
static uint32_t lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba)
/* Return: index into SLI4 fast-path FCP queue index. */ static uint32_t lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba)
{ ++phba->fcp_qidx; if (phba->fcp_qidx >= phba->cfg_fcp_wq_count) phba->fcp_qidx = 0; return phba->fcp_qidx; }
robutest/uclinux
C++
GPL-2.0
60
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */
void pinmux_init(void)
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */ void pinmux_init(void)
{ pinmux_clear_tristate_input_clamping(); gpio_config_table(apalis_tk1_gpio_inits, ARRAY_SIZE(apalis_tk1_gpio_inits)); pinmux_config_pingrp_table(apalis_tk1_pingrps, ARRAY_SIZE(apalis_tk1_pingrps)); pinmux_config_drvgrp_table(apalis_tk1_drvgrps, ARRAY_SIZE(apalis_tk1_drvgrps)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Determines the flash page that the address belongs to. end of FlashGetBank */
static blt_int32u FlashGetPage(blt_addr address)
/* Determines the flash page that the address belongs to. end of FlashGetBank */ static blt_int32u FlashGetPage(blt_addr address)
{ blt_int32u result = 0; ASSERT_RT(address >= FLASH_BASE); ASSERT_RT((address - FLASH_BASE) < FLASH_SIZE); if (FlashIsDualBankMode() == BLT_FALSE) { result = (address - FLASH_BASE) / FlashGetPageSize(); } else { if (FlashGetBank(address) == FLASH_BANK_1) { result = (address - FLASH_BAS...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Copies messages from FIFO into a message buffert. */
void CANFD_CopyRxFifoToMsgBuf(CANFD_BUF_T *psRxBuf, CANFD_FD_MSG_T *psMsgBuf)
/* Copies messages from FIFO into a message buffert. */ void CANFD_CopyRxFifoToMsgBuf(CANFD_BUF_T *psRxBuf, CANFD_FD_MSG_T *psMsgBuf)
{ CANFD_CopyDBufToMsgBuf(psRxBuf, psMsgBuf); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the clock rate of the specified I2C port. The */
void I2CSlaveInit(unsigned long ulBase, unsigned long ulAddrConfig, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
/* Set the clock rate of the specified I2C port. The */ void I2CSlaveInit(unsigned long ulBase, unsigned long ulAddrConfig, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
{ xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE)); xASSERT(!(ucSlaveAddr & 0x80)); I2CEnable(ulBase); xHWREG(ulBase + I2C_OAR1) = ulAddrConfig | (ucSlaveAddr << 1); xHWREG(ulBase + I2C_CR1) &= ~I2C_CR1_ENGC; xHWREG(ulBase + I2C_CR1) |= I2C_CR1_ACK; xHWREG(ulBase + I2C_CR1) |= ulGener...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* generate a system reset to reload the option byte */
void ob_reset(void)
/* generate a system reset to reload the option byte */ void ob_reset(void)
{ FMC_CTL |= FMC_CTL_OBRLD; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Return Value: The 6 most significant bits of the 32-bit CRC result */
static unsigned char fec_hash_address(const unsigned char *addr)
/* Return Value: The 6 most significant bits of the 32-bit CRC result */ static unsigned char fec_hash_address(const unsigned char *addr)
{ unsigned long crc; unsigned char byte; int i, j; crc = 0xFFFFFFFF; for(i=0; i<6; ++i) { byte = addr[i]; for(j=0; j<8; ++j) { if((byte & 0x01)^(crc & 0x01)) { crc >>= 1; crc = crc ^ 0xEDB88320; } else { crc >>= 1; } byte >>= 1; } } return (unsigned char)(crc >> 26); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* s3c_fb_enable() - Set the state of the main LCD output @sfb: The main framebuffer state. @enable: The state to set. */
static void s3c_fb_enable(struct s3c_fb *sfb, int enable)
/* s3c_fb_enable() - Set the state of the main LCD output @sfb: The main framebuffer state. @enable: The state to set. */ static void s3c_fb_enable(struct s3c_fb *sfb, int enable)
{ u32 vidcon0 = readl(sfb->regs + VIDCON0); if (enable) vidcon0 |= VIDCON0_ENVID | VIDCON0_ENVID_F; else { if (!(vidcon0 & VIDCON0_ENVID)) return; vidcon0 |= VIDCON0_ENVID; vidcon0 &= ~VIDCON0_ENVID_F; } writel(vidcon0, sfb->regs + VIDCON0); }
robutest/uclinux
C++
GPL-2.0
60
/* Request the PE to perform a VCONN Swap. */
USBPD_StatusTypeDef USBPD_DPM_RequestVconnSwap(uint8_t PortNum)
/* Request the PE to perform a VCONN Swap. */ USBPD_StatusTypeDef USBPD_DPM_RequestVconnSwap(uint8_t PortNum)
{ return USBPD_PE_Request_CtrlMessage(PortNum, USBPD_CONTROLMSG_VCONN_SWAP, USBPD_SOPTYPE_SOP); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017. Implementation determines salt length automatically from the signature encoding. Mask generation function is the same as the message digest algorithm. Salt length should be equal to digest length. */
BOOLEAN EFIAPI RsaPssVerify(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN CONST UINT8 *Signature, IN UINTN SigSize, IN UINT16 DigestLen, IN UINT16 SaltLen)
/* Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017. Implementation determines salt length automatically from the signature encoding. Mask generation function is the same as the message digest algorithm. Salt length should be equal to digest length. */ BOOLEAN EFIAPI RsaPssVerify(IN VOID ...
{ CALL_CRYPTO_SERVICE (RsaPssVerify, (RsaContext, Message, MsgSize, Signature, SigSize, DigestLen, SaltLen), FALSE); }
tianocore/edk2
C++
Other
4,240
/* ISR to manage the reception of bits to the software UART. */
ISR(TIMER1_COMPA_vect, ISR_BLOCK)
/* ISR to manage the reception of bits to the software UART. */ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
{ uint8_t SRX_Cached = (SRXPIN & (1 << SRX)); if (RX_BitsRemaining) { RX_Data >>= 1; RX_BitsRemaining--; if (SRX_Cached) RX_Data |= (1 << 7); } else { TCCR1B = 0; EIFR = (1 << INTF0); EIMSK = (1 << INT0); if (SRX_Cached) RingBuffer_Insert(&UARTtoUSB_Buffer, RX_Data); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Change Logs: Date Author Notes RT-Thread the first version */
int cpu_get_pll_clk(void)
/* Change Logs: Date Author Notes RT-Thread the first version */ int cpu_get_pll_clk(void)
{ rt_uint32_t reg; int n, k, m, p; reg = CCU->pll_cpu_ctrl; if (!(reg & (0x01 << 31))) return 0; p = PLL_CPU_DIV_P(reg) + 1; n = PLL_CPU_FACTOR_N(reg) + 1; k = PLL_CPU_FACTOR_K(reg) + 1; m = PLL_CPU_FACTOR_M(reg) + 1; return (_24MHZ_ * n * k) / (m * p); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the display orientation. Example of usage (for setting landscape mode): */
void hx8347a_set_orientation(uint8_t flags)
/* Set the display orientation. Example of usage (for setting landscape mode): */ void hx8347a_set_orientation(uint8_t flags)
{ uint8_t setting = 0; uint8_t regval; setting |= (flags & HX8347A_FLIP_X ? HX8347A_FLIP_X_MASK : 0); setting |= (flags & HX8347A_FLIP_Y ? HX8347A_FLIP_Y_MASK : 0); setting |= (flags & HX8347A_SWITCH_XY ? HX8347A_SWITCH_XY_MASK : 0); regval = hx8347a_read_register(HX8347A_MEMACCESSCTRL); regval &= ~(HX8347A_FLIP...
remotemcu/remcu-chip-sdks
C++
null
436
/* for rawmidi inputs, you can call this function from the event handler of a remote port which is attached to the virmidi via SNDRV_VIRMIDI_SEQ_ATTACH. event handler of virmidi port */
static int snd_virmidi_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
/* for rawmidi inputs, you can call this function from the event handler of a remote port which is attached to the virmidi via SNDRV_VIRMIDI_SEQ_ATTACH. event handler of virmidi port */ static int snd_virmidi_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop)
{ struct snd_virmidi_dev *rdev; rdev = private_data; if (!(rdev->flags & SNDRV_VIRMIDI_USE)) return 0; return snd_virmidi_dev_receive_event(rdev, ev); }
robutest/uclinux
C++
GPL-2.0
60
/* Context switch function used by the tick. This must be identical to vPortYield() from the call to vTaskSwitchContext() onwards. The only difference from vPortYield() is the tick count is incremented as the call comes from the tick ISR. */
void vPortYieldFromTick(void)
/* Context switch function used by the tick. This must be identical to vPortYield() from the call to vTaskSwitchContext() onwards. The only difference from vPortYield() is the tick count is incremented as the call comes from the tick ISR. */ void vPortYieldFromTick(void)
{ portSAVE_CONTEXT(); vTaskIncrementTick(); vTaskSwitchContext(); portRESTORE_CONTEXT(); asm volatile ( "ret" ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Flushes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Flushes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_Flush(pdev->pData, ep_addr); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq)
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ bool CLOCK_EnableUsbhs...
{ CCM->CCGR6 |= CCM_CCGR6_CG0_MASK; USB2->USBCMD |= USBHS_USBCMD_RST_MASK; for (volatile uint32_t i = 0; i < 400000; i++) { __ASM("nop"); } PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) | (PMU_REG_3P0_OUTPUT_TRG(0x17) | PMU_REG_3P0_ENABLE_LINR...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief Return PLL0 input clock rate return PLL0 input clock rate */
uint32_t CLOCK_GetPLL0InClockRate(void)
/* brief Return PLL0 input clock rate return PLL0 input clock rate */ uint32_t CLOCK_GetPLL0InClockRate(void)
{ uint32_t clkRate = 0U; switch ((SCG0->APLLCTRL & SCG_APLLCTRL_SOURCE_MASK) >> SCG_APLLCTRL_SOURCE_SHIFT) { case 0x00U: clkRate = CLOCK_GetExtClkFreq(); break; case 0x01U: clkRate = CLOCK_GetClk48MFreq(); break; case 0x02U: ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* NFS XDR decode functions Decode simple status reply */
static int nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy)
/* NFS XDR decode functions Decode simple status reply */ static int nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy)
{ int status; if ((status = ntohl(*p++)) != 0) status = nfs_stat_to_errno(status); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* This function sets the clock prescaler for an QSPI device. The device must be idle rather than busy transferring data before setting these device options. */
s32 XQspiPs_SetClkPrescaler(XQspiPs *InstancePtr, u8 Prescaler)
/* This function sets the clock prescaler for an QSPI device. The device must be idle rather than busy transferring data before setting these device options. */ s32 XQspiPs_SetClkPrescaler(XQspiPs *InstancePtr, u8 Prescaler)
{ u32 ConfigReg; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); Xil_AssertNonvoid(Prescaler <= XQSPIPS_CR_PRESC_MAXIMUM); if (InstancePtr->IsBusy) { return XST_DEVICE_BUSY; } ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress, XQSPI...
ua1arn/hftrx
C++
null
69
/* Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */
nm_bsp_reset(void)
/* Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */ nm_bsp_reset(void)
{ pio_set_pin_low(CONF_WILC_PIN_CHIP_ENABLE); pio_set_pin_low(CONF_WILC_PIN_RESET); nm_bsp_sleep(100); pio_set_pin_high(CONF_WILC_PIN_CHIP_ENABLE); nm_bsp_sleep(100); pio_set_pin_high(CONF_WILC_PIN_RESET); nm_bsp_sleep(100); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */
void app_entry(void)
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */ void app_entry(void)
{ uint32_t *pSrc, *pDest; pSrc = &_etext; pDest = &_srelocate; if (pSrc != pDest) { for (; pDest < &_erelocate;) { *pDest++ = *pSrc++; } } for (pDest = &_szero; pDest < &_ezero;) { *pDest++ = 0; } __libc_init_array(); main(); return; }
memfault/zero-to-main
C++
null
200
/* Configures a Timer to emulate an encoder sensor outputs in Backward direction. */
static void Emulate_Backward_Direction(TIM_HandleTypeDef *htim)
/* Configures a Timer to emulate an encoder sensor outputs in Backward direction. */ static void Emulate_Backward_Direction(TIM_HandleTypeDef *htim)
{ sConfig.Pulse = (EMU_PERIOD * 3 )/4; if(HAL_TIM_OC_ConfigChannel(htim, &sConfig, TIM_CHANNEL_1) != HAL_OK) { Error_Handler(); } sConfig.Pulse = (EMU_PERIOD * 1 )/4; if(HAL_TIM_OC_ConfigChannel(htim, &sConfig, TIM_CHANNEL_2) != HAL_OK) { Error_Handler(); } if(HAL_TIM_OC_Start(htim, TIM_CHANNE...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* mixart_BA0 proc interface for BAR 0 - read callback */
static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *buf, unsigned long count, unsigned long pos)
/* mixart_BA0 proc interface for BAR 0 - read callback */ static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *buf, unsigned long count, unsigned long pos)
{ struct mixart_mgr *mgr = entry->private_data; count = count & ~3; if(count <= 0) return 0; if(pos + count > MIXART_BA0_SIZE) count = (long)(MIXART_BA0_SIZE - pos); if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count)) return -EFAULT; return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the captured data from a sample sequence of regular channel. */
unsigned long ADCDataRegularGet(unsigned long ulBase, unsigned long ulADCMode)
/* Get the captured data from a sample sequence of regular channel. */ unsigned long ADCDataRegularGet(unsigned long ulBase, unsigned long ulADCMode)
{ unsigned long ulReturn = 0; xASSERT((ulBase == ADC1_BASE) || (ulBase == ADC2_BASE) || (ulBase == ADC3_BASE)); xASSERT((ulADCMode == ADC_MODE_NORMAL) || (ulADCMode == ADC_MODE_DUAL)); if(ulADCMode == ADC_MODE_NORMAL) { ulReturn = xHWREG(ulBase + ADC_DR) & ADC_DR_DATA_M; } else {...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The incompatible_features bit is only set if the image file header was updated successfully. Therefore it is not required to check the return value of this function. */
int qcow2_mark_dirty(BlockDriverState *bs)
/* The incompatible_features bit is only set if the image file header was updated successfully. Therefore it is not required to check the return value of this function. */ int qcow2_mark_dirty(BlockDriverState *bs)
{ BDRVQcowState *s = bs->opaque; uint64_t val; int ret; assert(s->qcow_version >= 3); if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) { return 0; } val = cpu_to_be64(s->incompatible_features | QCOW2_INCOMPAT_DIRTY); ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, incompatib...
ve3wwg/teensy3_qemu
C++
Other
15
/* DMA2D MSP Initialization This function configures the hardware resources used in this example: */
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
/* DMA2D MSP Initialization This function configures the hardware resources used in this example: */ void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
{ __HAL_RCC_DMA2D_CLK_ENABLE(); HAL_NVIC_SetPriority(DMA2D_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA2D_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* When the operation is finished, @callback will be called. You can then call g_network_monitor_can_reach_finish() to get the result of the operation. */
void g_network_monitor_can_reach_async(GNetworkMonitor *monitor, GSocketConnectable *connectable, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* When the operation is finished, @callback will be called. You can then call g_network_monitor_can_reach_finish() to get the result of the operation. */ void g_network_monitor_can_reach_async(GNetworkMonitor *monitor, GSocketConnectable *connectable, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer ...
{ GNetworkMonitorInterface *iface; iface = G_NETWORK_MONITOR_GET_INTERFACE (monitor); iface->can_reach_async (monitor, connectable, cancellable, callback, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Write 1 byte to Trace Hub MMIO addr + 0x0. */
VOID EFIAPI MipiSystWriteD8(IN VOID *MipiSystHandle, IN UINT8 Data)
/* Write 1 byte to Trace Hub MMIO addr + 0x0. */ VOID EFIAPI MipiSystWriteD8(IN VOID *MipiSystHandle, IN UINT8 Data)
{ MIPI_SYST_HANDLE *MipiSystH; MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle; MmioWrite8 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data); }
tianocore/edk2
C++
Other
4,240
/* Returns the status of the selected input IO pin. */
uint8_t IOE_ReadIOPin(uint32_t IO_Pin)
/* Returns the status of the selected input IO pin. */ uint8_t IOE_ReadIOPin(uint32_t IO_Pin)
{ uint8_t DeviceAddr = 0; uint8_t tmp = 0; if (IO_Pin & IO1_IN_ALL_PINS) { DeviceAddr = IOE_1_ADDR; } else { return PARAM_ERROR; } tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_MP_STA); if ((tmp & (uint8_t)IO_Pin) != 0) { return BitSet; } else { return BitReset...
remotemcu/remcu-chip-sdks
C++
null
436
/* This routine stalls the driver until all outstanding commands are returned. Caller must release the Hardware Lock prior to calling this routine. */
static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
/* This routine stalls the driver until all outstanding commands are returned. Caller must release the Hardware Lock prior to calling this routine. */ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
{ uint32_t index = 0; int stat = QLA_SUCCESS; unsigned long flags; struct scsi_cmnd *cmd; int wait_cnt = WAIT_CMD_TOV; while (wait_cnt) { spin_lock_irqsave(&ha->hardware_lock, flags); for (index = 0; index < ha->host->can_queue; index++) { cmd = scsi_host_find_tag(ha->host, index); if (cmd != NULL) ...
robutest/uclinux
C++
GPL-2.0
60
/* If BufferSize is 0, then no output buffer is produced and 0 is returned. */
UINTN EFIAPI AsciiBSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN BASE_LIST Marker)
/* If BufferSize is 0, then no output buffer is produced and 0 is returned. */ UINTN EFIAPI AsciiBSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN BASE_LIST Marker)
{ return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker); }
tianocore/edk2
C++
Other
4,240
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM6) { __HAL_RCC_TIM6_CLK_ENABLE(); } else if(htim_base->Instance==TIM10) { __HAL_RCC_TIM10_CLK_ENABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_ENABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Originally from kernel/power/process.c freezing is complete, mark current process as frozen */
static void frozen_process(void)
/* Originally from kernel/power/process.c freezing is complete, mark current process as frozen */ static void frozen_process(void)
{ if (!unlikely(current->flags & PF_NOFREEZE)) { current->flags |= PF_FROZEN; wmb(); } clear_freeze_flag(current); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configure the SX8651 device to generate IT on given INT pin connected to MCU as EXTI. */
int32_t SX8651_EnableIT(SX8651_Object_t *pObj)
/* Configure the SX8651 device to generate IT on given INT pin connected to MCU as EXTI. */ int32_t SX8651_EnableIT(SX8651_Object_t *pObj)
{ (void)(pObj); return SX8651_OK; }
eclipse-threadx/getting-started
C++
Other
310
/* ladder_enable_device - setup for the governor @dev: the CPU */
static int ladder_enable_device(struct cpuidle_device *dev)
/* ladder_enable_device - setup for the governor @dev: the CPU */ static int ladder_enable_device(struct cpuidle_device *dev)
{ int i; struct ladder_device *ldev = &per_cpu(ladder_devices, dev->cpu); struct ladder_device_state *lstate; struct cpuidle_state *state; ldev->last_state_idx = CPUIDLE_DRIVER_STATE_START; for (i = 0; i < dev->state_count; i++) { state = &dev->states[i]; lstate = &ldev->states[i]; lstate->stats.promotion_c...
robutest/uclinux
C++
GPL-2.0
60
/* Locates the PCI bridge associated with the ATA function and providing it is a Winbond 553 reports the revision. If it cannot find a revision or the right device it returns -1 */
static int sl82c105_bridge_revision(struct pci_dev *pdev)
/* Locates the PCI bridge associated with the ATA function and providing it is a Winbond 553 reports the revision. If it cannot find a revision or the right device it returns -1 */ static int sl82c105_bridge_revision(struct pci_dev *pdev)
{ struct pci_dev *bridge; bridge = pci_get_slot(pdev->bus, PCI_DEVFN(PCI_SLOT(pdev->devfn), 0)); if (!bridge) return -1; if (bridge->vendor != PCI_VENDOR_ID_WINBOND || bridge->device != PCI_DEVICE_ID_WINBOND_83C553 || bridge->class >> 8 != PCI_CLASS_BRIDGE_ISA) { pci_dev_put(bridge); r...
EmcraftSystems/linux-emcraft
C++
Other
266
/* return The enabled interrupts. This is the logical OR of members of the enumeration ::snvs_interrupt_enable_t */
uint32_t SNVS_LP_SRTC_GetEnabledInterrupts(SNVS_Type *base)
/* return The enabled interrupts. This is the logical OR of members of the enumeration ::snvs_interrupt_enable_t */ uint32_t SNVS_LP_SRTC_GetEnabledInterrupts(SNVS_Type *base)
{ uint32_t val = 0U; if (base->LPCR & SNVS_LPCR_LPTA_EN_MASK) { val |= kSNVS_SRTC_AlarmInterrupt; } return val; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Find an EAZ entry in the list. return a string with corresponding msn. */
char* act2000_find_eaz(act2000_card *card, char eaz)
/* Find an EAZ entry in the list. return a string with corresponding msn. */ char* act2000_find_eaz(act2000_card *card, char eaz)
{ struct msn_entry *p = card->msn_list; while (p) { if (p->eaz == eaz) return(p->msn); p = p->next; } return("\0"); }
robutest/uclinux
C++
GPL-2.0
60
/* Called by ptep_set_access_flags, must flush on CPUs for which the DSI handler can't just "fixup" the TLB on a write fault */
void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr)
/* Called by ptep_set_access_flags, must flush on CPUs for which the DSI handler can't just "fixup" the TLB on a write fault */ void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr)
{ if (Hash != 0) return; _tlbie(addr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disables control interrupts on a specified USB controller. */
void USBIntDisableControl(uint32_t ui32Base, uint32_t ui32Flags)
/* Disables control interrupts on a specified USB controller. */ void USBIntDisableControl(uint32_t ui32Base, uint32_t ui32Flags)
{ ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Flags & ~(USB_INTCTRL_ALL)) == 0); if (ui32Flags & USB_INTCTRL_STATUS) { HWREGB(ui32Base + USB_O_IE) &= ~(ui32Flags & USB_INTCTRL_STATUS); } if (ui32Flags & USB_INTCTRL_POWER_FAULT) { HWREG(ui32Base + USB_O_EPCIM) = 0; } if...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add a new entry to the list. Insert a new entry after the specified head. This is good for implementing stacks. */
void ListAddToHead(PRT_LIST_ENTRY ListNew, PRT_LIST_HEAD ListHead)
/* Add a new entry to the list. Insert a new entry after the specified head. This is good for implementing stacks. */ void ListAddToHead(PRT_LIST_ENTRY ListNew, PRT_LIST_HEAD ListHead)
{ ListAdd(ListNew, ListHead, ListHead->Next); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This API reads the Feature and Hardware interrupt status from the sensor. */
uint16_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev)
/* This API reads the Feature and Hardware interrupt status from the sensor. */ uint16_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data[2] = {0}; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_INT_STAT_0_ADDR, data, 2, dev); if (rslt == BMA4_OK) { *int_status = data[0]; *((uint8_t *)int_status + 1) = data[1]; } ...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* All flags specified in @flags are set, all flags not specified in @flags are cleared. Returns: %0 on success, -EINVAL on an invalid flag combination. */
int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
/* All flags specified in @flags are set, all flags not specified in @flags are cleared. Returns: %0 on success, -EINVAL on an invalid flag combination. */ int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
{ if ((flags & CCWDEV_EARLY_NOTIFICATION) && (flags & CCWDEV_REPORT_ALL)) return -EINVAL; cdev->private->options.fast = (flags & CCWDEV_EARLY_NOTIFICATION) != 0; cdev->private->options.repall = (flags & CCWDEV_REPORT_ALL) != 0; cdev->private->options.pgroup = (flags & CCWDEV_DO_PATHGROUP) != 0; cdev->privat...
robutest/uclinux
C++
GPL-2.0
60
/* MSI/MSIX memory region implementation. The handler handles both MSI and MSIX. For MSI-X, the vector number is encoded as a part of the address, data is set to 0. For MSI, the vector number is encoded in least bits in data. */
static void spapr_msi_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
/* MSI/MSIX memory region implementation. The handler handles both MSI and MSIX. For MSI-X, the vector number is encoded as a part of the address, data is set to 0. For MSI, the vector number is encoded in least bits in data. */ static void spapr_msi_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
{ uint32_t irq = data; trace_spapr_pci_msi_write(addr, data, irq); qemu_irq_pulse(xics_get_qirq(spapr->icp, irq)); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Sets the current CPU interrupt state to the state specified by InterruptState. If InterruptState is TRUE, then interrupts are enabled. If InterruptState is FALSE, then interrupts are disabled. InterruptState is returned. */
BOOLEAN EFIAPI SetInterruptState(IN BOOLEAN InterruptState)
/* Sets the current CPU interrupt state to the state specified by InterruptState. If InterruptState is TRUE, then interrupts are enabled. If InterruptState is FALSE, then interrupts are disabled. InterruptState is returned. */ BOOLEAN EFIAPI SetInterruptState(IN BOOLEAN InterruptState)
{ if (InterruptState) { EnableInterrupts (); } else { DisableInterrupts (); } return InterruptState; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sensors) GPIO interrupts. */
uint32_t BOARD_envSensEnableIRQ(bool enable)
/* Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sensors) GPIO interrupts. */ uint32_t BOARD_envSensEnableIRQ(bool enable)
{ uint32_t status; status = BOARD_picRegBitsSet( BOARD_PIC_REG_INT_ENABLE, enable, BOARD_PIC_REG_INT_ENABLE_UV_ALS ); return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Update counters atomically now that memcpy is done. */
static void xlog_state_finish_copy(xlog_t *log, xlog_in_core_t *iclog, int record_cnt, int copy_bytes)
/* Update counters atomically now that memcpy is done. */ static void xlog_state_finish_copy(xlog_t *log, xlog_in_core_t *iclog, int record_cnt, int copy_bytes)
{ spin_lock(&log->l_icloglock); be32_add_cpu(&iclog->ic_header.h_num_logops, record_cnt); iclog->ic_offset += copy_bytes; spin_unlock(&log->l_icloglock); }
robutest/uclinux
C++
GPL-2.0
60
/* mmc_queue_resume - resume a previously suspended MMC request queue @mq: MMC queue to resume */
void mmc_queue_resume(struct mmc_queue *mq)
/* mmc_queue_resume - resume a previously suspended MMC request queue @mq: MMC queue to resume */ void mmc_queue_resume(struct mmc_queue *mq)
{ struct request_queue *q = mq->queue; unsigned long flags; if (mq->flags & MMC_QUEUE_SUSPENDED) { mq->flags &= ~MMC_QUEUE_SUSPENDED; up(&mq->thread_sem); spin_lock_irqsave(q->queue_lock, flags); blk_start_queue(q); spin_unlock_irqrestore(q->queue_lock, flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* DMA2D MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
/* DMA2D MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
{ if(hdma2d->Instance==DMA2D) { __HAL_RCC_DMA2D_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: OffHookWithCgpnMessage Opcode: 0x0024 Type: CallControl Direction: dev2pbx VarLength: no */
static void handle_OffHookWithCgpnMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: OffHookWithCgpnMessage Opcode: 0x0024 Type: CallControl Direction: dev2pbx VarLength: no */ static void handle_OffHookWithCgpnMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ guint32 hdr_version = tvb_get_letohl(ptvcursor_tvbuff(cursor), 4); guint32 VariableDirnumSize = (hdr_version >= V18_MSG_TYPE) ? 25 : 24; ptvcursor_add(cursor, hf_skinny_callingPartyNumber, VariableDirnumSize, ENC_ASCII|ENC_NA); ptvcursor_add(cursor, hf_skinny_cgpnVoiceMailbox, VariableDirnumSize, ENC_ASCII|EN...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns the current speed of the USB device connected. */
uint32_t USBHostSpeedGet(uint32_t ui32Base)
/* Returns the current speed of the USB device connected. */ uint32_t USBHostSpeedGet(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); if(HWREGB(ui32Base + USB_O_DEVCTL) & USB_DEVCTL_FSDEV) { return(USB_FULL_SPEED); } if(HWREGB(ui32Base + USB_O_DEVCTL) & USB_DEVCTL_LSDEV) { return(USB_LOW_SPEED); } return(USB_UNDEF_SPEED); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routine wraps the actual slow_ring event process routine from the API jump table function pointer from the lpfc_hba struct. */
void lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t mask)
/* This routine wraps the actual slow_ring event process routine from the API jump table function pointer from the lpfc_hba struct. */ void lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t mask)
{ phba->lpfc_sli_handle_slow_ring_event(phba, pring, mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Print the Generic IE for the device Note : indentation is broken. We need to fix that. */
static int print_gen_ie_info(int skfd, char *ifname, char *args[], int count)
/* Print the Generic IE for the device Note : indentation is broken. We need to fix that. */ static int print_gen_ie_info(int skfd, char *ifname, char *args[], int count)
{ struct iwreq wrq; unsigned char buf[IW_GENERIC_IE_MAX]; args = args; count = count; wrq.u.data.pointer = (caddr_t)buf; wrq.u.data.length = IW_GENERIC_IE_MAX; wrq.u.data.flags = 0; if(iw_get_ext(skfd, ifname, SIOCGIWGENIE, &wrq) < 0) fprintf(stderr, "%-8.16s no generic IE (%s).\n\n", i...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Output: f is the i-th difference of the curve after one step */
static void fd_fwd(double f[4])
/* Output: f is the i-th difference of the curve after one step */ static void fd_fwd(double f[4])
{ f[0] += f[1]; f[1] += f[2]; f[2] += f[3]; }
xboot/xboot
C++
MIT License
779
/* Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE to ACCESS Register in the time of default TIS_TIMEOUT_A. */
EFI_STATUS TisPcRequestUseTpm(IN TIS_PC_REGISTERS_PTR TisReg)
/* Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE to ACCESS Register in the time of default TIS_TIMEOUT_A. */ EFI_STATUS TisPcRequestUseTpm(IN TIS_PC_REGISTERS_PTR TisReg)
{ EFI_STATUS Status; if (TisReg == NULL) { return EFI_INVALID_PARAMETER; } if (!TisPcPresenceCheck (TisReg)) { return EFI_NOT_FOUND; } MmioWrite8 ((UINTN)&TisReg->Access, TIS_PC_ACC_RQUUSE); Status = TisPcWaitRegisterBits ( &TisReg->Access, (UINT8)(TIS_PC_ACC_ACTIVE |TIS...
tianocore/edk2
C++
Other
4,240
/* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer MOVE event is sent to the resize window. This function either starts or continues a drag operation, depending on current state. */
static void wtk_handle_resize_move(struct wtk_frame *frame, struct win_pointer_event const *event)
/* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer MOVE event is sent to the resize window. This function either starts or continues a drag operation, depending on current state. */ static void wtk_handle_resize_move(struct wtk_frame *frame, struct win_pointer_event ...
{ switch (frame->state) { case WTK_FRAME_AWAITING_RESIZE: if (wtk_is_drag_threshold_exceeded(&(event->pos))) { wtk_start_drag(&(event->pos)); frame->state = WTK_FRAME_RESIZING; } break; case WTK_FRAME_RESIZING: wtk_continue_drag(&(event->last_pos), &(event->pos)); break; default: break; } }
memfault/zero-to-main
C++
null
200
/* Returns the most recent received data by the SPIx peripheral. */
uint16_t SPI_ReceiveData(SPI_TypeDef *SPIx)
/* Returns the most recent received data by the SPIx peripheral. */ uint16_t SPI_ReceiveData(SPI_TypeDef *SPIx)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); return SPIx->RXREG; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* bind the socket file description into the SSL */
int SSL_set_fd(SSL *ssl, int fd)
/* bind the socket file description into the SSL */ int SSL_set_fd(SSL *ssl, int fd)
{ SSL_ASSERT1(ssl); SSL_ASSERT1(fd >= 0); SSL_METHOD_CALL(set_fd, ssl, fd, 0); return 1; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per...
void ADCSoftwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Factor)
/* Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per...
{ uint32_t ui32Value; ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); ASSERT(ui32SequenceNum < 3); ASSERT(((ui32Factor == 2) || (ui32Factor == 4) || (ui32Factor == 8)) && ((ui32SequenceNum == 0) || (ui32Factor != 8))); for(ui32Value = 0, ui32Factor >>= 1; ui32Factor; u...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Japan (red swirl) - 0x30 Japan (black swirl) - 0x58 USA (red swirl) - 0x31 USA (black swirl) - 0x59 Europe (blue swirl) - 0x32 Europe (black swirl) - 0x5A */
uint8* flash_factory_set_country(uint8 *data, int country, int black_swirl)
/* Japan (red swirl) - 0x30 Japan (black swirl) - 0x58 USA (red swirl) - 0x31 USA (black swirl) - 0x59 Europe (blue swirl) - 0x32 Europe (black swirl) - 0x5A */ uint8* flash_factory_set_country(uint8 *data, int country, int black_swirl)
{ case 1: data[2] = black_swirl ? 0x58 : 0x30; break; case 2: data[2] = black_swirl ? 0x59 : 0x31; break; case 3: data[2] = black_swirl ? 0x5A : 0x32; break; default: break; } return data; }
DC-SWAT/DreamShell
C++
null
404
/* Check for the presence of an ATA66 capable cable on the interface. Problematic as it seems some cards don't have the needed logic onboard. */
static u8 it821x_cable_detect(ide_hwif_t *hwif)
/* Check for the presence of an ATA66 capable cable on the interface. Problematic as it seems some cards don't have the needed logic onboard. */ static u8 it821x_cable_detect(ide_hwif_t *hwif)
{ return ATA_CBL_PATA80; }
robutest/uclinux
C++
GPL-2.0
60
/* De-initialize UART Interface. stops operation and releases the software resources used by the interface. */
int32_t csi_usart_uninitialize(usart_handle_t handle)
/* De-initialize UART Interface. stops operation and releases the software resources used by the interface. */ int32_t csi_usart_uninitialize(usart_handle_t handle)
{ USART_NULL_PARAM_CHK(handle); ck_usart_priv_t *usart_priv = handle; drv_irq_disable(usart_priv->irq); drv_irq_unregister(usart_priv->irq); usart_priv->cb_event = NULL; return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Note that g_closure_invalidate() will also be called when the reference count of a closure drops to zero (unless it has already been invalidated before). */
void g_closure_invalidate(GClosure *closure)
/* Note that g_closure_invalidate() will also be called when the reference count of a closure drops to zero (unless it has already been invalidated before). */ void g_closure_invalidate(GClosure *closure)
{ g_return_if_fail (closure != NULL); if (!closure->is_invalid) { gboolean was_invalid; g_closure_ref (closure); SWAP (closure, is_invalid, TRUE, &was_invalid); if (!was_invalid) closure_invoke_notifiers (closure, INOTIFY); g_closure_unref (closure); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Program a 32 bit Word to FLASH. This performs all operations necessary to program a 32 bit word to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased. */
void flash_program_word(uint32_t address, uint32_t data)
/* Program a 32 bit Word to FLASH. This performs all operations necessary to program a 32 bit word to FLASH memory. The program error flag should be checked separately for the event that memory was not properly erased. */ void flash_program_word(uint32_t address, uint32_t data)
{ flash_wait_for_last_operation(); flash_set_program_size(FLASH_CR_PROGRAM_X32); FLASH_CR |= FLASH_CR_PG; MMIO32(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PG; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* получить число герц - тон CW сигнала (в десятках герц). Для телеграфа отображается частота сигнала при частоте cwpitch, при SSB - при нулевых биениях */
static int_least16_t gettone_bysubmode(uint_fast8_t submode, uint_fast8_t forcelsb)
/* получить число герц - тон CW сигнала (в десятках герц). Для телеграфа отображается частота сигнала при частоте cwpitch, при SSB - при нулевых биениях */ static int_least16_t gettone_bysubmode(uint_fast8_t submode, uint_fast8_t forcelsb)
{ const int_least16_t t = gettone_bymode(submodes [submode].mode); return UPPERTOSIGN16(getsubmodelsb(submode, forcelsb), t); }
ua1arn/hftrx
C++
null
69
/* Check the CRC16 calculating result with the expected value. */
en_flag_status_t CRC_CRC16_CheckData(uint16_t u16InitValue, uint8_t u8DataWidth, const void *pvData, uint32_t u32Len, uint16_t u16ExpectValue)
/* Check the CRC16 calculating result with the expected value. */ en_flag_status_t CRC_CRC16_CheckData(uint16_t u16InitValue, uint8_t u8DataWidth, const void *pvData, uint32_t u32Len, uint16_t u16ExpectValue)
{ __IO uint32_t u32Count = CRC_CALC_CLK_COUNT; en_flag_status_t enStatus = RESET; uint32_t u32Expect_Value = u16ExpectValue; if ((pvData != NULL) && (u32Len != 0UL)) { (void)CRC_CRC16_Calculate(u16InitValue, u8DataWidth, pvData, u32Len); u32Expect_Value = CRC_ConvertCrcValue(u32Expect_Va...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Requirement (1) ensures we can correct for the required bitflip density. Requirement (2) ensures we can correct even when all bitflips are clumped in the same sector. */
static bool nand_ecc_strength_good(struct mtd_info *mtd)
/* Requirement (1) ensures we can correct for the required bitflip density. Requirement (2) ensures we can correct even when all bitflips are clumped in the same sector. */ static bool nand_ecc_strength_good(struct mtd_info *mtd)
{ struct nand_chip *chip = mtd_to_nand(mtd); struct nand_ecc_ctrl *ecc = &chip->ecc; int corr, ds_corr; if (ecc->size == 0 || chip->ecc_step_ds == 0) return true; corr = (mtd->writesize * ecc->strength) / ecc->size; ds_corr = (mtd->writesize * chip->ecc_strength_ds) / chip->ecc_step_ds; return corr >= ds_corr ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Stub for now while investigating the r1 quirk in the old driver. */
static void cmd646r1_bmdma_stop(struct ata_queued_cmd *qc)
/* Stub for now while investigating the r1 quirk in the old driver. */ static void cmd646r1_bmdma_stop(struct ata_queued_cmd *qc)
{ ata_bmdma_stop(qc); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize the ft5336 communication bus from MCU to FT5336 : ie I2C channel initialization (if required). */
void ft5336_Init(uint16_t DeviceAddr)
/* Initialize the ft5336 communication bus from MCU to FT5336 : ie I2C channel initialization (if required). */ void ft5336_Init(uint16_t DeviceAddr)
{ TS_IO_Delay(200); ft5336_I2C_InitializeIfRequired(); }
eclipse-threadx/getting-started
C++
Other
310
/* This file is part of the Simba project. */
static __attribute__((section(".second_stage")))
/* This file is part of the Simba project. */ static __attribute__((section(".second_stage")))
{ uint16_t size; struct uart_device_t uart_device = { .drv_p = NULL, .regs_p = SPC5_LINFLEX_0 }; uart_device_start(&uart_device, BAUDRATE); uart_device_read(&uart_device, &size, 2); uart_device_read(&uart_device, &buf[0], size); return (((int (*)())(&buf[0]))()); }
eerimoq/simba
C++
Other
337
/* This file is part of the Simba project. */
uint32_t crc_32(uint32_t crc, const void *buf_p, size_t size)
/* This file is part of the Simba project. */ uint32_t crc_32(uint32_t crc, const void *buf_p, size_t size)
{ ASSERTN(buf_p != NULL, EINVAL); const uint8_t *b_p; size_t i; b_p = buf_p; crc ^= 0xfffffffful; while (size > 0) { crc = (crc ^ *b_p++); for (i = 0; i < 8; i++) { crc = (crc >> 1) ^ (0xedb88320 & (-(crc & 1))); } size--; } return (~crc); }
eerimoq/simba
C++
Other
337
/* "memset" on IO memory space. This needs to be optimized. */
void memset_io(volatile void __iomem *dst, int c, unsigned long count)
/* "memset" on IO memory space. This needs to be optimized. */ void memset_io(volatile void __iomem *dst, int c, unsigned long count)
{ while (count) { count--; writeb(c, dst); dst++; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function flushes cache for particular transfer descriptor. */
static void ci_flush_td(struct ept_queue_item *td)
/* This function flushes cache for particular transfer descriptor. */ static void ci_flush_td(struct ept_queue_item *td)
{ const unsigned long start = (unsigned long)td; const unsigned long end = (unsigned long)td + ILIST_ENT_SZ; flush_dcache_range(start, end); }
4ms/stm32mp1-baremetal
C++
Other
137
/* For all these reasons, the caller must be prepared for this function to return. The simplest way to handle it is to just enter an infinite loop and wait for the power to be removed. */
void HibernateRequest(void)
/* For all these reasons, the caller must be prepared for this function to return. The simplest way to handle it is to just enter an infinite loop and wait for the power to be removed. */ void HibernateRequest(void)
{ HWREG(HIB_CTL) |= HIB_CTL_HIBREQ; _HibernateWriteComplete(); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Verify the Guided Section GUID by checking if there is the Guided Section GUID HOB recorded the GUID itself. */
BOOLEAN VerifyGuidedSectionGuid(IN EFI_GUID *GuidedSectionGuid, OUT EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI **GuidedSectionExtraction)
/* Verify the Guided Section GUID by checking if there is the Guided Section GUID HOB recorded the GUID itself. */ BOOLEAN VerifyGuidedSectionGuid(IN EFI_GUID *GuidedSectionGuid, OUT EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI **GuidedSectionExtraction)
{ EFI_PEI_HOB_POINTERS Hob; EFI_GUID *GuidRecorded; VOID *Interface; EFI_STATUS Status; Hob.Raw = GetFirstGuidHob (GuidedSectionGuid); if (Hob.Raw != NULL) { GuidRecorded = (EFI_GUID *)GET_GUID_HOB_DATA (Hob); if (CompareGuid (GuidRecorded, GuidedSectionGuid...
tianocore/edk2
C++
Other
4,240
/* One function for each procedure in the NFS protocol. */
static int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
/* One function for each procedure in the NFS protocol. */ static int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
{ struct rpc_message msg = { .rpc_proc = &nfs_procedures[NFSPROC_GETATTR], .rpc_argp = fhandle, .rpc_resp = fattr, }; int status; dprintk("NFS call getattr\n"); nfs_fattr_init(fattr); status = rpc_call_sync(server->client, &msg, 0); dprintk("NFS reply getattr: %d\n", status); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables simultaneously the two DAC channels software triggers. */
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState)
/* Enables or disables simultaneously the two DAC channels software triggers. */ void DAC_DualSoftwareTriggerCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DAC->SWTRIGR |= DUAL_SWTRIG_Set ; } else { DAC->SWTRIGR &= DUAL_SWTRIG_Reset; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Reads one character of data received over the USB CDC ACM Virtual COM Port. The function reads data character from the receive intermediate buffer that was received over the Virtual COM Port. */
int32_t USBD_CDC_ACM_GetChar(void)
/* Reads one character of data received over the USB CDC ACM Virtual COM Port. The function reads data character from the receive intermediate buffer that was received over the Virtual COM Port. */ int32_t USBD_CDC_ACM_GetChar(void)
{ uint8_t ch; if ((USBD_CDC_ACM_DataRead(&ch, 1)) == 1) { return ((int32_t) ch); } return (-1); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* 63 - must be 1 to indicate d64 mode to CE hardware 62 - barrier bit ... controlled with tioce_dma_barrier() 61 - msi bit ... specified through dma_flags 60:54 - reserved, MBZ */
static u64 tioce_dma_d64(unsigned long ct_addr, int dma_flags)
/* 63 - must be 1 to indicate d64 mode to CE hardware 62 - barrier bit ... controlled with tioce_dma_barrier() 61 - msi bit ... specified through dma_flags 60:54 - reserved, MBZ */ static u64 tioce_dma_d64(unsigned long ct_addr, int dma_flags)
{ u64 bus_addr; bus_addr = ct_addr | (1UL << 63); if (dma_flags & SN_DMA_MSI) bus_addr |= (1UL << 61); return bus_addr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Makes the given context the current one for drawing operations. */
int glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
/* Makes the given context the current one for drawing operations. */ int glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
{ window_impl_t *impl; EGLSurface surface = NULL; if (window) { impl = (window_impl_t *)window->driverdata; surface = impl->surface; } if (eglMakeCurrent(egl_disp, surface, surface, context) != EGL_TRUE) { return -1; } return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Get the UART transmit ready status. This routine returns the given UART's transmit ready status. */
static int poll_tx_ready(const struct device *dev)
/* Get the UART transmit ready status. This routine returns the given UART's transmit ready status. */ static int poll_tx_ready(const struct device *dev)
{ const struct uart_stellaris_config *config = dev->config; return (config->uart->fr & UARTFR_TXFE); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* __unmap_underlying_blocks - just a helper function to unmap set of blocks described by @bh */
static void __unmap_underlying_blocks(struct inode *inode, struct buffer_head *bh)
/* __unmap_underlying_blocks - just a helper function to unmap set of blocks described by @bh */ static void __unmap_underlying_blocks(struct inode *inode, struct buffer_head *bh)
{ struct block_device *bdev = inode->i_sb->s_bdev; int blocks, i; blocks = bh->b_size >> inode->i_blkbits; for (i = 0; i < blocks; i++) unmap_underlying_metadata(bdev, bh->b_blocknr + i); }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_clear_break(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_clear_break(mss_uart_instance_t *this_uart)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { clear_bit_reg8(&this_uart->hw_reg->LCR,SB); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Atomically adds @delta to @ptr and returns true if the result is negative, or false when result is greater than or equal to zero. */
int atomic64_add_negative(u64 delta, atomic64_t *ptr)
/* Atomically adds @delta to @ptr and returns true if the result is negative, or false when result is greater than or equal to zero. */ int atomic64_add_negative(u64 delta, atomic64_t *ptr)
{ s64 new_val = atomic64_add_return(delta, ptr); return new_val < 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: @rq is about to be mixed merged. Make sure the attributes which can be mixed are set in each bio and mark @rq as mixed merged. */
void blk_rq_set_mixed_merge(struct request *rq)
/* Description: @rq is about to be mixed merged. Make sure the attributes which can be mixed are set in each bio and mark @rq as mixed merged. */ void blk_rq_set_mixed_merge(struct request *rq)
{ unsigned int ff = rq->cmd_flags & REQ_FAILFAST_MASK; struct bio *bio; if (rq->cmd_flags & REQ_MIXED_MERGE) return; for (bio = rq->bio; bio; bio = bio->bi_next) { WARN_ON_ONCE((bio->bi_rw & REQ_FAILFAST_MASK) && (bio->bi_rw & REQ_FAILFAST_MASK) != ff); bio->bi_rw |= ff; } rq->cmd_flags |= REQ_MIXED...
EmcraftSystems/linux-emcraft
C++
Other
266
/* <flags> is ignored in this driver, all writes to the tool are instantaneous */
int edtt_write(uint8_t *ptr, size_t size, int flags)
/* <flags> is ignored in this driver, all writes to the tool are instantaneous */ int edtt_write(uint8_t *ptr, size_t size, int flags)
{ if (edtt_mode_enabled == false) { return -1; } bs_trace_raw_time(9, "EDTT: Asked to write %i bytes\n", size); if (write(fifo[TO_EDTT], ptr, size) != size) { if (errno == EPIPE) { bs_trace_error_line("EDTT IF suddenly closed by other " "end\n"); } if ((errno == EAGAIN) || (errno == EWOULDBLOCK)...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Check whether the instruction at regs->nip is a store using an update addressing form which will update r1. */
static int store_updates_sp(struct pt_regs *regs)
/* Check whether the instruction at regs->nip is a store using an update addressing form which will update r1. */ static int store_updates_sp(struct pt_regs *regs)
{ unsigned int inst; if (get_user(inst, (unsigned int __user *)regs->nip)) return 0; if (((inst >> 16) & 0x1f) != 1) return 0; switch (inst >> 26) { case 37: case 39: case 45: case 53: case 55: return 1; case 62: return (inst & 3) == 1; case 31: switch ((inst >> 1) & 0x3ff) { case 181: case 183...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the configuration of DMA for LPC channels. */
unsigned long LPCChannelDMAConfigGet(unsigned long ulBase)
/* Gets the configuration of DMA for LPC channels. */ unsigned long LPCChannelDMAConfigGet(unsigned long ulBase)
{ ASSERT(ulBase == LPC0_BASE); return(HWREG(ulBase + LPC_O_DMACX) & 0x000000FF); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* XXX These values could be set by the bt_psplit routine. The problem is that the entry has to be popped off of the stack etc. or the values have to be passed all the way back to bt_split/bt_rroot and it's not very clean. */
static recno_t rec_total(PAGE *h)
/* XXX These values could be set by the bt_psplit routine. The problem is that the entry has to be popped off of the stack etc. or the values have to be passed all the way back to bt_split/bt_rroot and it's not very clean. */ static recno_t rec_total(PAGE *h)
{ recno_t recs; indx_t nxt, top; for (recs = 0, nxt = 0, top = NEXTINDEX(h); nxt < top; ++nxt) recs += GETRINTERNAL(h, nxt)->nrecs; return (recs); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536