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 |
|---|---|---|---|---|---|---|---|
/* API to wait for requested duration. Note: IfxScuCcu_wait shall not use STM in future, because we can guarantee that STM is enabled after reset but If PLL init is called for changing the frequency during runtime, there is no guarantee that STM is enabled. */ | IFX_STATIC void IfxScuCcu_wait(float32 timeSec) | /* API to wait for requested duration. Note: IfxScuCcu_wait shall not use STM in future, because we can guarantee that STM is enabled after reset but If PLL init is called for changing the frequency during runtime, there is no guarantee that STM is enabled. */
IFX_STATIC void IfxScuCcu_wait(float32 timeSec) | {
uint32 stmCount = (uint32)(IfxScuCcu_getStmFrequency() * timeSec);
uint32 stmCountBegin = STM0_TIM0.U;
while ((uint32)(STM0_TIM0.U - stmCountBegin) < stmCount)
{
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Get Connection Handle.
This API is used to get the handle of the connection currently active with the remote device specified in pBleAddr. */ | ADI_BLER_RESULT adi_radio_GetConnectionHandle(uint8_t *const pBleAddr, uint16_t *const pConnHandle) | /* Get Connection Handle.
This API is used to get the handle of the connection currently active with the remote device specified in pBleAddr. */
ADI_BLER_RESULT adi_radio_GetConnectionHandle(uint8_t *const pBleAddr, uint16_t *const pConnHandle) | {
ADI_BLER_RESULT bleResult;
ASSERT(pBleAddr != NULL);
ASSERT(pConnHandle != NULL);
ADI_BLE_LOGEVENT(LOGID_CMD_BLEGAP_GET_CONNECTION_HANDLE);
ADI_BLE_RADIO_CMD_START(CMD_BLEGAP_GET_CONNECTION_HANDLE);
memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], pBleAddr, 6u);
bleResult = bler_process_cmd(CMD_BLEGAP_GET_CONNECTION_HANDLE, 6u, pConnHandle, 2u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT);
}
ADI_BLE_RADIO_CMD_END();
return (bleResult);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* If the timeout specified by TimeoutInMicroseconds expires before the AP returns from Procedure, then execution of Procedure by the AP is terminated. The AP is available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). */ | EFI_STATUS EFIAPI StartupThisAP(IN EFI_MP_SERVICES_PROTOCOL *This, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL) | /* If the timeout specified by TimeoutInMicroseconds expires before the AP returns from Procedure, then execution of Procedure by the AP is terminated. The AP is available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). */
EFI_STATUS EFIAPI StartupThisAP(IN EFI_MP_SERVICES_PROTOCOL *This, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL) | {
return MpInitLibStartupThisAP (
Procedure,
ProcessorNumber,
WaitEvent,
TimeoutInMicroseconds,
ProcedureArgument,
Finished
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable the automatic slave select function. Only available in Master mode. */ | void USPI_EnableAutoSS(USPI_T *uspi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel) | /* Enable the automatic slave select function. Only available in Master mode. */
void USPI_EnableAutoSS(USPI_T *uspi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel) | {
(void)u32SSPinMask;
uspi->LINECTL = (uspi->LINECTL & ~USPI_LINECTL_CTLOINV_Msk) | u32ActiveLevel;
uspi->PROTCTL |= USPI_PROTCTL_AUTOSS_Msk;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Once configured, the non-blocking read is started by calling */ | void EPINonBlockingReadConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulDataSize, unsigned long ulAddress) | /* Once configured, the non-blocking read is started by calling */
void EPINonBlockingReadConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulDataSize, unsigned long ulAddress) | {
unsigned long ulOffset;
ASSERT(ulBase == EPI0_BASE);
ASSERT(ulChannel < 2);
ASSERT(ulDataSize < 4);
ASSERT(ulAddress < 0x20000000);
ulOffset = ulChannel * (EPI_O_RSIZE1 - EPI_O_RSIZE0);
HWREG(ulBase + EPI_O_RSIZE0 + ulOffset) = ulDataSize;
HWREG(ulBase + EPI_O_RADDR0 + ulOffset) = ulAddress;
} | watterott/WebRadio | C++ | null | 71 |
/* Function for initializing the ANT SDM profile instance. */ | static ret_code_t ant_sdm_init(ant_sdm_profile_t *p_profile, ant_channel_config_t const *p_channel_config) | /* Function for initializing the ANT SDM profile instance. */
static ret_code_t ant_sdm_init(ant_sdm_profile_t *p_profile, ant_channel_config_t const *p_channel_config) | {
p_profile->channel_number = p_channel_config->channel_number;
p_profile->page_1 = DEFAULT_ANT_SDM_PAGE1();
p_profile->page_2 = DEFAULT_ANT_SDM_PAGE2();
p_profile->page_3 = DEFAULT_ANT_SDM_PAGE3();
p_profile->page_22 = DEFAULT_ANT_SDM_PAGE22();
p_profile->common = DEFAULT_ANT_SDM_COMMON_DATA();
p_profile->page_80 = DEFAULT_ANT_COMMON_page80();
p_profile->page_81 = DEFAULT_ANT_COMMON_page81();
LOG_SDM("ANT SDM channel %u init\n\r", p_profile->channel_number);
return ant_channel_init(p_channel_config);
} | labapart/polymcu | C++ | null | 201 |
/* ZigBee Device Profile dissector for the recover binding */ | void dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | /* ZigBee Device Profile dissector for the recover binding */
void dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | {
guint offset = 0; zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL);
zdp_dump_excess(tvb, offset, pinfo, tree);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Configure the LCD controller, download the color palette and start a looped DMA transfer of the frame image data. Called only in internal controller mode. */ | static int omap_lcdc_set_update_mode(enum omapfb_update_mode mode) | /* Configure the LCD controller, download the color palette and start a looped DMA transfer of the frame image data. Called only in internal controller mode. */
static int omap_lcdc_set_update_mode(enum omapfb_update_mode mode) | {
int r = 0;
if (mode != lcdc.update_mode) {
switch (mode) {
case OMAPFB_AUTO_UPDATE:
setup_regs();
load_palette();
setup_lcd_dma();
set_load_mode(OMAP_LCDC_LOAD_FRAME);
enable_irqs(OMAP_LCDC_IRQ_DONE);
enable_controller();
lcdc.update_mode = mode;
break;
case OMAPFB_UPDATE_DISABLED:
disable_controller();
omap_stop_lcd_dma();
lcdc.update_mode = mode;
break;
default:
r = -EINVAL;
}
}
return r;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return: 0 if setting the lane count was successful, -ve on error */ | static int set_lane_count(struct udevice *dev, u8 lane_count) | /* Return: 0 if setting the lane count was successful, -ve on error */
static int set_lane_count(struct udevice *dev, u8 lane_count) | {
struct dp_tx *dp_tx = dev_get_priv(dev);
int status;
u8 val;
if (!is_connected(dev))
return -ENODEV;
printf(" set lane count to %u\n", lane_count);
dp_tx->link_config.lane_count = lane_count;
set_reg(dev, REG_LANE_COUNT_SET, dp_tx->link_config.lane_count);
status = aux_read(dev, DPCD_LANE_COUNT_SET, 0x1, &val);
if (status)
return -EIO;
val &= ~DPCD_LANE_COUNT_SET_MASK;
val |= dp_tx->link_config.lane_count;
status = aux_write(dev, DPCD_LANE_COUNT_SET, 0x1, &val);
if (status)
return -EIO;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Accelerometer axis user offset correction xpressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C. The value must be in the range .. */ | int32_t lsm6dsl_xl_usr_offset_get(stmdev_ctx_t *ctx, uint8_t *buff) | /* Accelerometer axis user offset correction xpressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C. The value must be in the range .. */
int32_t lsm6dsl_xl_usr_offset_get(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_X_OFS_USR, buff, 3);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* register a callback for device status
This function registers a callback for device status. The registered callback is used to report changes in the status of the device controller. */ | static void usb_register_status_callback(usb_dc_status_callback cb) | /* register a callback for device status
This function registers a callback for device status. The registered callback is used to report changes in the status of the device controller. */
static void usb_register_status_callback(usb_dc_status_callback cb) | {
usb_dev.status_callback = cb;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Unregisters an interrupt handler for a SPI interrupt. */ | void SPIIntUnregister(unsigned long ulBase) | /* Unregisters an interrupt handler for a SPI interrupt. */
void SPIIntUnregister(unsigned long ulBase) | {
unsigned long ulInt;
ulInt = SPIIntNumberGet(ulBase);
IntDisable(ulInt);
IntUnregister(ulInt);
} | micropython/micropython | C++ | Other | 18,334 |
/* Cleans off all the quotes in the string. */ | EFI_STATUS InternalShellStripQuotes(IN CONST CHAR16 *OriginalString, OUT CHAR16 **CleanString) | /* Cleans off all the quotes in the string. */
EFI_STATUS InternalShellStripQuotes(IN CONST CHAR16 *OriginalString, OUT CHAR16 **CleanString) | {
CHAR16 *Walker;
if ((OriginalString == NULL) || (CleanString == NULL)) {
return EFI_INVALID_PARAMETER;
}
*CleanString = AllocateCopyPool (StrSize (OriginalString), OriginalString);
if (*CleanString == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL; Walker++) {
if (*Walker == L'\"') {
CopyMem (Walker, Walker+1, StrSize (Walker) - sizeof (Walker[0]));
}
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* this function will return a sub-path name under directory. */ | const char* dfs_subdir(const char *directory, const char *filename) | /* this function will return a sub-path name under directory. */
const char* dfs_subdir(const char *directory, const char *filename) | {
const char *dir;
if (strlen(directory) == strlen(filename))
return NULL;
dir = filename + strlen(directory);
if ((*dir != '/') && (dir != filename))
{
dir --;
}
return dir;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function configures the system to enter Standby mode for current consumption measurement purpose. */ | void StandbyMode_Measure(void) | /* This function configures the system to enter Standby mode for current consumption measurement purpose. */
void StandbyMode_Measure(void) | {
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);
HAL_PWR_EnterSTANDBYMode();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If Signature is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE. */ | BOOLEAN EFIAPI RsaPkcs1Verify(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, IN CONST UINT8 *Signature, IN UINTN SigSize) | /* If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If Signature is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE. */
BOOLEAN EFIAPI RsaPkcs1Verify(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, IN CONST UINT8 *Signature, IN UINTN SigSize) | {
CALL_CRYPTO_SERVICE (RsaPkcs1Verify, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* main example code
The main function will draw all the graphic primitives from the graphic library on a line from left to right (incrementing x) and repeat this from bottom to top with varying colors (incrementing y). Below the figures it draws the Atmel logo centered on the screen. */ | int main(void) | /* main example code
The main function will draw all the graphic primitives from the graphic library on a line from left to right (incrementing x) and repeat this from bottom to top with varying colors (incrementing y). Below the figures it draws the Atmel logo centered on the screen. */
int main(void) | {
static struct mxt_device device;
board_init();
sysclk_init();
membag_init();
gfx_init();
mxt_init(&device);
win_init();
setup_gui_root_window();
if (app_widget_launch() == false) {
show_out_of_memory_error();
for (;;);
}
while (true) {
struct win_pointer_event win_touch_event;
while (read_touch_event(&device, &win_touch_event)) {
win_queue_pointer_event(&win_touch_event);
}
win_process_events();
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Smallish @nr_to_scan's are deposited in @nr_saved_scan, until we collected @swap_cluster_max pages to scan. */ | static unsigned long nr_scan_try_batch(unsigned long nr_to_scan, unsigned long *nr_saved_scan) | /* Smallish @nr_to_scan's are deposited in @nr_saved_scan, until we collected @swap_cluster_max pages to scan. */
static unsigned long nr_scan_try_batch(unsigned long nr_to_scan, unsigned long *nr_saved_scan) | {
unsigned long nr;
*nr_saved_scan += nr_to_scan;
nr = *nr_saved_scan;
if (nr >= SWAP_CLUSTER_MAX)
*nr_saved_scan = 0;
else
nr = 0;
return nr;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called by the Device Policy Manager to start the USB-C Subsystem. */ | int usbc_start(const struct device *dev) | /* Called by the Device Policy Manager to start the USB-C Subsystem. */
int usbc_start(const struct device *dev) | {
struct usbc_port_data *data = dev->data;
data->request.val = PRIV_PORT_REQUEST_START;
k_fifo_put(&data->request_fifo, &data->request);
k_thread_resume(data->port_thread);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Recover HRC/MRC state and system clock after wake up stop mode. */ | static void PWC_ClockRecover(void) | /* Recover HRC/MRC state and system clock after wake up stop mode. */
static void PWC_ClockRecover(void) | {
DDL_ASSERT(IS_PWC_CLK_UNLOCKED());
if (0U == READ_REG8_BIT(CM_PWC->STPMCR, PWC_STPMCR_CKSMRC)) {
if ((PWC_SYSCLK_SRC_HRC == m_u8SysClockSource) || (PWC_SYSCLK_SRC_PLL == m_u8SysClockSource)) {
PWC_SetSysClk(m_u8SysClockSource);
WRITE_REG8(CM_CMU->MRCCR, m_u8MrcState);
}
WRITE_REG8(CM_CMU->HRCCR, m_u8HrcState);
}
SystemCoreClockUpdate();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* NOTE: If the regulator is disabled it will return the voltage value. This function should not be used to determine regulator state. */ | int regulator_get_voltage(struct regulator *regulator) | /* NOTE: If the regulator is disabled it will return the voltage value. This function should not be used to determine regulator state. */
int regulator_get_voltage(struct regulator *regulator) | {
int ret;
mutex_lock(®ulator->rdev->mutex);
ret = _regulator_get_voltage(regulator->rdev);
mutex_unlock(®ulator->rdev->mutex);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return an allocated buffer to the pool of free buffers. */ | static void prvReturnBuffer(unsigned char *pucBuffer) | /* Return an allocated buffer to the pool of free buffers. */
static void prvReturnBuffer(unsigned char *pucBuffer) | {
unsigned long ul;
for( ul = 0; ul < ETH_NUM_BUFFERS; ul++ )
{
if( ETH_BUF( ul ) == ( unsigned long ) pucBuffer )
{
ucBufferInUse[ ul ] = pdFALSE;
break;
}
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function sets up the seed value for the pseudorandom number generator. If Seed is not NULL, then the seed passed in is used. If Seed is NULL, then default seed is used. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize) | /* This function sets up the seed value for the pseudorandom number generator. If Seed is not NULL, then the seed passed in is used. If Seed is NULL, then default seed is used. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RandomSeed(IN CONST UINT8 *Seed OPTIONAL, IN UINTN SeedSize) | {
CALL_CRYPTO_SERVICE (RandomSeed, (Seed, SeedSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disables SIR (IrDA) mode on the specified UART. */ | void UARTDisableIrDA(unsigned long ulBase) | /* Disables SIR (IrDA) mode on the specified UART. */
void UARTDisableIrDA(unsigned long ulBase) | {
xASSERT(UARTBaseValid(ulBase));
xHWREG(ulBase + UART_FUN_SEL) &= ~(UART_FUN_SEL_IRDA_EN);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Called whenever a 32-bit process running under a 64-bit kernel performs an ioctl on /dev/dri/card<n>. */ | long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | /* Called whenever a 32-bit process running under a 64-bit kernel performs an ioctl on /dev/dri/card<n>. */
long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | {
unsigned int nr = DRM_IOCTL_NR(cmd);
drm_ioctl_compat_t *fn = NULL;
int ret;
if (nr < DRM_COMMAND_BASE)
return drm_compat_ioctl(filp, cmd, arg);
if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls))
fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE];
if (fn != NULL)
ret = (*fn) (filp, cmd, arg);
else
ret = drm_ioctl(filp, cmd, arg);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Find the vma of a GRU segment. Caller must hold mmap_sem. */ | struct vm_area_struct* gru_find_vma(unsigned long vaddr) | /* Find the vma of a GRU segment. Caller must hold mmap_sem. */
struct vm_area_struct* gru_find_vma(unsigned long vaddr) | {
struct vm_area_struct *vma;
vma = find_vma(current->mm, vaddr);
if (vma && vma->vm_start <= vaddr && vma->vm_ops == &gru_vm_ops)
return vma;
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the TIMx Output Compare 3 Fast feature. */ | void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast) | /* Configures the TIMx Output Compare 3 Fast feature. */
void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast) | {
uint32_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC3FE;
tmpccmr2 |= TIM_OCFast;
TIMx->CCMR2 = tmpccmr2;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* param base FlexCAN peripheral base address. param maskIdx The Index of individual Mask. param mask Rx Individual Mask value. */ | void FLEXCAN_SetRxIndividualMask(CAN_Type *base, uint8_t maskIdx, uint32_t mask) | /* param base FlexCAN peripheral base address. param maskIdx The Index of individual Mask. param mask Rx Individual Mask value. */
void FLEXCAN_SetRxIndividualMask(CAN_Type *base, uint8_t maskIdx, uint32_t mask) | {
assert(maskIdx <= (base->MCR & CAN_MCR_MAXMB_MASK));
FLEXCAN_EnterFreezeMode(base);
base->RXIMR[maskIdx] = mask;
FLEXCAN_ExitFreezeMode(base);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Returns NULL for an illegal name, (xmlChar*) 1 for success and the name for mismatch */ | static const xmlChar* xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) | /* Returns NULL for an illegal name, (xmlChar*) 1 for success and the name for mismatch */
static const xmlChar* xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) | {
++in;
++cmp;
ctxt->input->col++;
}
if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {
ctxt->input->cur = in;
return (const xmlChar*) 1;
}
ret = xmlParseName (ctxt);
if (ret == other) {
return (const xmlChar*) 1;
}
return ret;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Reads the current Y position using the ADC. */ | uint32_t tsReadY(void) | /* Reads the current Y position using the ADC. */
uint32_t tsReadY(void) | {
if (!_tsInitialised) tsInit();
TS_YP_FUNC_GPIO;
TS_YM_FUNC_GPIO;
TS_XP_FUNC_GPIO;
gpioSetDir (TS_YP_PORT, TS_YP_PIN, 1);
gpioSetDir (TS_YM_PORT, TS_YM_PIN, 1);
gpioSetDir (TS_XP_PORT, TS_XP_PIN, 0);
gpioSetValue(TS_YP_PORT, TS_YP_PIN, 1);
gpioSetValue(TS_YM_PORT, TS_YM_PIN, 0);
TS_XM_FUNC_ADC;
return adcRead(TS_XM_ADC_CHANNEL);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Update an ARM MOVT or MOVW immediate instruction immediate data. */ | VOID ThumbMovtImmediatePatch(IN OUT UINT16 *Instruction, IN UINT16 Address) | /* Update an ARM MOVT or MOVW immediate instruction immediate data. */
VOID ThumbMovtImmediatePatch(IN OUT UINT16 *Instruction, IN UINT16 Address) | {
UINT16 Patch;
Patch = ((Address >> 12) & 0x000f);
Patch |= (((Address & BIT11) != 0) ? BIT10 : 0);
*(Instruction) = (*Instruction & ~0x040f) | Patch;
Patch = Address & 0x000000ff;
Patch |= ((Address << 4) & 0x00007000);
Instruction++;
*Instruction = (*Instruction & ~0x70ff) | Patch;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Call to wake waiting processes after buffer space has opened up. */ | void hpsb_iso_wake(struct hpsb_iso *iso) | /* Call to wake waiting processes after buffer space has opened up. */
void hpsb_iso_wake(struct hpsb_iso *iso) | {
wake_up_interruptible(&iso->waitq);
if (iso->callback)
iso->callback(iso);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initiate a TCP connection with host:port and the given protocol */ | int mbedtls_net_connect(mbedtls_net_context *ctx, const char *host, const char *port, int) | /* Initiate a TCP connection with host:port and the given protocol */
int mbedtls_net_connect(mbedtls_net_context *ctx, const char *host, const char *port, int) | {
switch (*error) {
case Error::Dns:
return MBEDTLS_ERR_NET_UNKNOWN_HOST;
default:
return MBEDTLS_ERR_NET_CONNECT_FAILED;
}
} else {
return 0;
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Get EP CmdStat pointer Parameters: EPNum: endpoint number */ | uint32_t* GetEpCmdStatPtr(uint32_t EPNum) | /* Get EP CmdStat pointer Parameters: EPNum: endpoint number */
uint32_t* GetEpCmdStatPtr(uint32_t EPNum) | {
uint32_t *ptr = (uint32_t *)EP_LIST_BASE;
ptr += (EPNum & USB_LOGICAL_EP_MASK) * 4;
if (EPNum & USB_IN_MASK) {
ptr += 2;
}
return ptr;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Places a packet in the transmit queue of a network interface. */ | EFI_STATUS EmuSnpTransmit(IN EMU_SNP_PROTOCOL *This, IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL) | /* Places a packet in the transmit queue of a network interface. */
EFI_STATUS EmuSnpTransmit(IN EMU_SNP_PROTOCOL *This, IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL) | {
EMU_SNP_PRIVATE *Private;
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
return EFI_UNSUPPORTED;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Calculate the number of bytes that would be required to store the new attribute (whether local or remote only calculate bytes in this block). This routine decides as a side effect whether the attribute will be a "local" or a "remote" attribute. */ | int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local) | /* Calculate the number of bytes that would be required to store the new attribute (whether local or remote only calculate bytes in this block). This routine decides as a side effect whether the attribute will be a "local" or a "remote" attribute. */
int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local) | {
int size;
size = xfs_attr_leaf_entsize_local(namelen, valuelen);
if (size < xfs_attr_leaf_entsize_local_max(blocksize)) {
if (local) {
*local = 1;
}
} else {
size = xfs_attr_leaf_entsize_remote(namelen);
if (local) {
*local = 0;
}
}
return(size);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Build a wide negotiation message in our message buffer based on the input parameters. */ | static void ahc_construct_wdtr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, u_int bus_width) | /* Build a wide negotiation message in our message buffer based on the input parameters. */
static void ahc_construct_wdtr(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, u_int bus_width) | {
ahc->msgout_index += spi_populate_width_msg(
ahc->msgout_buf + ahc->msgout_index, bus_width);
ahc->msgout_len += 4;
if (bootverbose) {
printf("(%s:%c:%d:%d): Sending WDTR %x\n",
ahc_name(ahc), devinfo->channel, devinfo->target,
devinfo->lun, bus_width);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */ | static void ctcm_chx_stop(fsm_instance *fi, int event, void *arg) | /* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */
static void ctcm_chx_stop(fsm_instance *fi, int event, void *arg) | {
fsm_newstate(fi, CTC_STATE_STOPPED);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each ADC_CommonInitStruct member with its default value. */ | void ADC_CommonStructInit(ADC_CommonInitTypeDef *ADC_CommonInitStruct) | /* Fills each ADC_CommonInitStruct member with its default value. */
void ADC_CommonStructInit(ADC_CommonInitTypeDef *ADC_CommonInitStruct) | {
ADC_CommonInitStruct->ADC_Mode = ADC_Mode_Independent;
ADC_CommonInitStruct->ADC_Prescaler = ADC_Prescaler_Div2;
ADC_CommonInitStruct->ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;
ADC_CommonInitStruct->ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_5Cycles;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Return the value of the General Configuration Register. */ | static uint32_t hpet_gconf_get(void) | /* Return the value of the General Configuration Register. */
static uint32_t hpet_gconf_get(void) | {
return sys_read32(GCONF_REG);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Free the memory block from the memory pool. */ | VOID UsbHcFreeMemBlock(IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool, IN USBHC_MEM_BLOCK *Block) | /* Free the memory block from the memory pool. */
VOID UsbHcFreeMemBlock(IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool, IN USBHC_MEM_BLOCK *Block) | {
ASSERT ((Pool != NULL) && (Block != NULL));
IoMmuFreeBuffer (Ehc->IoMmu, EFI_SIZE_TO_PAGES (Block->BufLen), Block->BufHost, Block->Mapping);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Gets a data element from the SPI interface with block. */ | void xSPIDataGet(unsigned long ulBase, unsigned long *pulData) | /* Gets a data element from the SPI interface with block. */
void xSPIDataGet(unsigned long ulBase, unsigned long *pulData) | {
unsigned char ucBitLength = SPIBitLengthGet(ulBase);
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY))
{
}
if (ucBitLength <= 8 && ucBitLength != 0 )
{
*pulData = xHWREG(ulBase + SPI_RX0) & 0xFF;
}
else
{
*pulData = xHWREG(ulBase + SPI_RX0) & 0xFFFF;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */ | VOID* EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment) | /* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */
VOID* EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment) | {
return InternalAllocateAlignedPages (EfiBootServicesData, Pages, Alignment);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Notes: This function has the job of initializing a number of fields related to error handling. Typically this will be called once for each command, as required. */ | static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) | /* Notes: This function has the job of initializing a number of fields related to error handling. Typically this will be called once for each command, as required. */
static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) | {
cmd->serial_number = 0;
scsi_set_resid(cmd, 0);
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
if (cmd->cmd_len == 0)
cmd->cmd_len = scsi_command_size(cmd->cmnd);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Search a segment of memory space in GCD map. The result is a range of GCD entry list. */ | EFI_STATUS CoreSearchGcdMapEntry(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, OUT LIST_ENTRY **StartLink, OUT LIST_ENTRY **EndLink, IN LIST_ENTRY *Map) | /* Search a segment of memory space in GCD map. The result is a range of GCD entry list. */
EFI_STATUS CoreSearchGcdMapEntry(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, OUT LIST_ENTRY **StartLink, OUT LIST_ENTRY **EndLink, IN LIST_ENTRY *Map) | {
LIST_ENTRY *Link;
EFI_GCD_MAP_ENTRY *Entry;
ASSERT (Length != 0);
*StartLink = NULL;
*EndLink = NULL;
Link = Map->ForwardLink;
while (Link != Map) {
Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
if ((BaseAddress >= Entry->BaseAddress) && (BaseAddress <= Entry->EndAddress)) {
*StartLink = Link;
}
if (*StartLink != NULL) {
if (((BaseAddress + Length - 1) >= Entry->BaseAddress) &&
((BaseAddress + Length - 1) <= Entry->EndAddress))
{
*EndLink = Link;
return EFI_SUCCESS;
}
}
Link = Link->ForwardLink;
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This code gets the size of variable header. */ | UINTN GetVariableHeaderSize(IN BOOLEAN AuthFlag) | /* This code gets the size of variable header. */
UINTN GetVariableHeaderSize(IN BOOLEAN AuthFlag) | {
UINTN Value;
if (AuthFlag) {
Value = sizeof (AUTHENTICATED_VARIABLE_HEADER);
} else {
Value = sizeof (VARIABLE_HEADER);
}
return Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initializes the Tiny ADC peripheral registers to their default reset values. */ | void TADC_DeInit(void) | /* Initializes the Tiny ADC peripheral registers to their default reset values. */
void TADC_DeInit(void) | {
ANA->REGF = ANA_REGF_RSTValue;
ANA->INTSTS = ANA_INTSTS_INTSTS13;
ANA->MISC_A &= ~ANA_MISC_TADCTH;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* find_first_dirty - find first dirty znode. @znode: znode to begin searching from */ | static struct ubifs_znode* find_first_dirty(struct ubifs_znode *znode) | /* find_first_dirty - find first dirty znode. @znode: znode to begin searching from */
static struct ubifs_znode* find_first_dirty(struct ubifs_znode *znode) | {
int i, cont;
if (!znode)
return NULL;
while (1) {
if (znode->level == 0) {
if (ubifs_zn_dirty(znode))
return znode;
return NULL;
}
cont = 0;
for (i = 0; i < znode->child_cnt; i++) {
struct ubifs_zbranch *zbr = &znode->zbranch[i];
if (zbr->znode && ubifs_zn_dirty(zbr->znode)) {
znode = zbr->znode;
cont = 1;
break;
}
}
if (!cont) {
if (ubifs_zn_dirty(znode))
return znode;
return NULL;
}
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Prepare controller for a transaction and call i2c_davinci_xfer_msg */ | static int i2c_davinci_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg msgs[], int num) | /* Prepare controller for a transaction and call i2c_davinci_xfer_msg */
static int i2c_davinci_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg msgs[], int num) | {
struct davinci_i2c_dev *dev = bus->priv;
int i;
int ret;
i2c_dbg("%s: msgs: %d\n", __func__, num);
ret = i2c_davinci_wait_bus_not_busy(dev, 1);
if (ret < 0)
{
i2c_dbg("timeout waiting for bus ready\n");
return ret;
}
for (i = 0; i < num; i++)
{
ret = i2c_davinci_xfer_msg(bus, &msgs[i], (i == (num - 1)));
i2c_dbg("%s [%d/%d] ret: %d\n", __func__, i + 1, num,
ret);
if (ret < 0)
return ret;
}
return num;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the simulated time when the process will stop */ | void nsi_hws_set_end_of_time(uint64_t new_end_of_time) | /* Set the simulated time when the process will stop */
void nsi_hws_set_end_of_time(uint64_t new_end_of_time) | {
end_of_time = new_end_of_time;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Clear the autoreload register update interrupt flag (ARROKCF). @rmtoll ICR ARROKCF LPTIM_ClearFlag_ARROK. */ | void LPTIM_ClearFlag_ARROK(LPTIM_Module *LPTIMx) | /* Clear the autoreload register update interrupt flag (ARROKCF). @rmtoll ICR ARROKCF LPTIM_ClearFlag_ARROK. */
void LPTIM_ClearFlag_ARROK(LPTIM_Module *LPTIMx) | {
SET_BIT(LPTIMx->INTCLR, LPTIM_INTCLR_ARRUPDCF);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Function for extracting the BSP event valid at startup.
When a button was used to wake up the device, the button press will not generate an interrupt. This function reads which button was pressed at startup, and returns the appropriate BSP event. */ | static uint32_t startup_event_extract(bsp_event_t *p_startup_event) | /* Function for extracting the BSP event valid at startup.
When a button was used to wake up the device, the button press will not generate an interrupt. This function reads which button was pressed at startup, and returns the appropriate BSP event. */
static uint32_t startup_event_extract(bsp_event_t *p_startup_event) | {
uint32_t err_code;
bool wakeup_button_is_pressed, bond_erase_button_is_pressed;
err_code = bsp_button_is_pressed(BTN_ID_WAKEUP, &wakeup_button_is_pressed);
RETURN_ON_ERROR(err_code);
err_code = bsp_button_is_pressed(BTN_ID_WAKEUP_BOND_DELETE, &bond_erase_button_is_pressed);
RETURN_ON_ERROR(err_code);
if (bond_erase_button_is_pressed)
{
*p_startup_event = BSP_EVENT_CLEAR_BONDING_DATA;
}
else if (wakeup_button_is_pressed)
{
*p_startup_event = BSP_EVENT_WAKEUP;
}
else
{
*p_startup_event = BSP_EVENT_NOTHING;
}
return NRF_SUCCESS;
} | labapart/polymcu | C++ | null | 201 |
/* show_scaling_driver - show the current cpufreq HW/BIOS limitation */ | static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) | /* show_scaling_driver - show the current cpufreq HW/BIOS limitation */
static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) | {
unsigned int limit;
int ret;
if (cpufreq_driver->bios_limit) {
ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
if (!ret)
return sprintf(buf, "%u\n", limit);
}
return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Recursively print the subtree under the Node. This is an internal function. */ | STATIC VOID EFIAPI AmlDbgPrintTreeInternal(IN AML_NODE_HEADER *Node, IN BOOLEAN Recurse, IN UINT8 Level) | /* Recursively print the subtree under the Node. This is an internal function. */
STATIC VOID EFIAPI AmlDbgPrintTreeInternal(IN AML_NODE_HEADER *Node, IN BOOLEAN Recurse, IN UINT8 Level) | {
AML_NODE_HEADER *ChildNode;
if (!IS_AML_NODE_VALID (Node)) {
ASSERT (0);
return;
}
if (IS_AML_DATA_NODE (Node)) {
AmlDbgPrintDataNode ((AML_DATA_NODE *)Node, Level);
return;
} else if (IS_AML_OBJECT_NODE (Node)) {
AmlDbgPrintObjectNode ((AML_OBJECT_NODE *)Node, Level);
} else if (IS_AML_ROOT_NODE (Node)) {
AmlDbgPrintRootNode ((AML_ROOT_NODE *)Node, Level);
} else {
ASSERT (0);
return;
}
if (!Recurse) {
return;
}
ChildNode = AmlGetNextSibling (Node, NULL);
while (ChildNode != NULL) {
ASSERT (Level < MAX_UINT8);
AmlDbgPrintTreeInternal (ChildNode, Recurse, (UINT8)(Level + 1));
ChildNode = AmlGetNextSibling (Node, ChildNode);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* create memory pools for biovec's in a bio_set. use the global biovec slabs created for general use. */ | static int biovec_create_pools(struct bio_set *bs, int pool_entries) | /* create memory pools for biovec's in a bio_set. use the global biovec slabs created for general use. */
static int biovec_create_pools(struct bio_set *bs, int pool_entries) | {
struct biovec_slab *bp = bvec_slabs + BIOVEC_MAX_IDX;
bs->bvec_pool = mempool_create_slab_pool(pool_entries, bp->slab);
if (!bs->bvec_pool)
return -ENOMEM;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for cleaning up after a failed encryption procedure. */ | static void encryption_failure(uint16_t conn_handle, pm_sec_error_code_t error, uint8_t error_src) | /* Function for cleaning up after a failed encryption procedure. */
static void encryption_failure(uint16_t conn_handle, pm_sec_error_code_t error, uint8_t error_src) | {
smd_evt_t evt =
{
.evt_id = SMD_EVT_LINK_ENCRYPTION_FAILED,
.conn_handle = conn_handle,
.params =
{
.link_encryption_failed =
{
.error = error,
.error_src = error_src,
}
}
};
ble_conn_state_user_flag_set(conn_handle, m_smd.flag_id_sec_proc, false);
evt_send(&evt);
return;
} | labapart/polymcu | C++ | null | 201 |
/* Get the return address for a single stackframe and return a pointer to the next frame tail. */ | static struct frame_tail* user_backtrace(struct frame_tail *tail, struct perf_callchain_entry *entry) | /* Get the return address for a single stackframe and return a pointer to the next frame tail. */
static struct frame_tail* user_backtrace(struct frame_tail *tail, struct perf_callchain_entry *entry) | {
struct frame_tail buftail;
if (!access_ok(VERIFY_READ, tail, sizeof(buftail)))
return NULL;
if (__copy_from_user_inatomic(&buftail, tail, sizeof(buftail)))
return NULL;
callchain_store(entry, buftail.lr);
if (tail >= buftail.fp)
return NULL;
return buftail.fp - 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Generate definitions needed by assembly language modules. This code generates raw asm output which is post-processed to extract and format the required data. */ | void foo(void) | /* Generate definitions needed by assembly language modules. This code generates raw asm output which is post-processed to extract and format the required data. */
void foo(void) | {
OFFSET(TI_task, thread_info, task);
OFFSET(TI_exec_domain, thread_info, exec_domain);
OFFSET(TI_flags, thread_info, flags);
OFFSET(TI_cpu, thread_info, cpu);
OFFSET(TI_preempt_count, thread_info, preempt_count);
OFFSET(TI_rar_saved, thread_info, rar_saved);
OFFSET(TI_rsr_saved, thread_info, rsr_saved);
OFFSET(TI_restart_block, thread_info, restart_block);
BLANK();
OFFSET(TSK_active_mm, task_struct, active_mm);
BLANK();
OFFSET(MM_pgd, mm_struct, pgd);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Change Logs: Date Author Notes RT-Thread the first version */ | RT_WEAK void machine_reset(void) | /* Change Logs: Date Author Notes RT-Thread the first version */
RT_WEAK void machine_reset(void) | {
rt_kprintf("reboot system...\n");
rt_hw_interrupt_disable();
while (1);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Returns CR_OK upon succesful completion, an error code otherwise. */ | enum CRStatus cr_rgb_set_to_inherit(CRRgb *a_this, gboolean a_inherit) | /* Returns CR_OK upon succesful completion, an error code otherwise. */
enum CRStatus cr_rgb_set_to_inherit(CRRgb *a_this, gboolean a_inherit) | {
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
a_this->inherit = a_inherit ;
return CR_OK ;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function should not be in .ramcode, because it will be called only once before self-upgrade. */ | void envm_init(void) | /* This function should not be in .ramcode, because it will be called only once before self-upgrade. */
void envm_init(void) | {
lpc178x_iap_init();
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos' using sendpage(). Return the number of bytes sent. */ | static int pipe_to_sendpage(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) | /* Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos' using sendpage(). Return the number of bytes sent. */
static int pipe_to_sendpage(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) | {
struct file *file = sd->u.file;
loff_t pos = sd->pos;
int ret, more;
ret = buf->ops->confirm(pipe, buf);
if (!ret) {
more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
if (file->f_op && file->f_op->sendpage)
ret = file->f_op->sendpage(file, buf->page, buf->offset,
sd->len, &pos, more);
else
ret = -EINVAL;
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI MmioRead32(IN UINTN Address) | /* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI MmioRead32(IN UINTN Address) | {
CONST EFI_PEI_SERVICES **PeiServices;
EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
ASSERT ((Address & 3) == 0);
return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64)Address);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This helper function marks UBIFS inode @ui as clean by cleaning the @ui->dirty flag and releasing its budget. Note, VFS may still treat the inode as dirty and try to write it back, but 'ubifs_write_inode()' would just do nothing. */ | static void mark_inode_clean(struct ubifs_info *c, struct ubifs_inode *ui) | /* This helper function marks UBIFS inode @ui as clean by cleaning the @ui->dirty flag and releasing its budget. Note, VFS may still treat the inode as dirty and try to write it back, but 'ubifs_write_inode()' would just do nothing. */
static void mark_inode_clean(struct ubifs_info *c, struct ubifs_inode *ui) | {
if (ui->dirty)
ubifs_release_dirty_inode_budget(c, ui);
ui->dirty = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get Formset_storage base on the input varstoreid info. */ | FORMSET_STORAGE* GetFstStgFromVarId(IN FORM_BROWSER_FORMSET *FormSet, IN EFI_VARSTORE_ID VarStoreId) | /* Get Formset_storage base on the input varstoreid info. */
FORMSET_STORAGE* GetFstStgFromVarId(IN FORM_BROWSER_FORMSET *FormSet, IN EFI_VARSTORE_ID VarStoreId) | {
FORMSET_STORAGE *FormsetStorage;
LIST_ENTRY *Link;
BOOLEAN Found;
Found = FALSE;
FormsetStorage = NULL;
Link = GetFirstNode (&FormSet->StorageListHead);
while (!IsNull (&FormSet->StorageListHead, Link)) {
FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link);
if (FormsetStorage->VarStoreId == VarStoreId) {
Found = TRUE;
break;
}
Link = GetNextNode (&FormSet->StorageListHead, Link);
}
return Found ? FormsetStorage : NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Init irq param with the given usart hardware instance. */ | static void _usart_init_irq_param(const void *const hw, struct _usart_async_device *dev) | /* Init irq param with the given usart hardware instance. */
static void _usart_init_irq_param(const void *const hw, struct _usart_async_device *dev) | {
if (hw == USART1) {
_usart1_dev = dev;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Calculate Cumulative Clock low Time-out of SMBus active period. */ | void I2C_SMBusClockLoTimeout(I2C_T *i2c, uint32_t ms, uint32_t u32Pclk) | /* Calculate Cumulative Clock low Time-out of SMBus active period. */
void I2C_SMBusClockLoTimeout(I2C_T *i2c, uint32_t ms, uint32_t u32Pclk) | {
uint32_t u32Div, u32Pclk_kHz;
i2c->BUSCTL &= ~I2C_BUSCTL_TIDLE_Msk;
i2c->TOCTL &= ~I2C_TOCTL_TOCEN_Msk;
u32Pclk_kHz = u32Pclk / 1000U;
u32Div = ((ms * u32Pclk_kHz) / (16U * 1024U)) - 1U;
if(u32Div <= 0xFFU)
{
i2c->CLKTOUT = u32Div;
}
else
{
i2c->TOCTL |= I2C_TOCTL_TOCEN_Msk;
i2c->CLKTOUT = (((ms * u32Pclk_kHz) / (16U * 1024U * 4U)) - 1U) & 0xFFU;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This functions converts in place a buffer of ABGR interleaved data into RGB interleaved data, discarding A. */ | tsize_t t2p_sample_abgr_to_rgb(tdata_t, uint32) | /* This functions converts in place a buffer of ABGR interleaved data into RGB interleaved data, discarding A. */
tsize_t t2p_sample_abgr_to_rgb(tdata_t, uint32) | {
uint32 i=0;
uint32 sample=0;
for(i=0;i<samplecount;i++){
sample=((uint32*)data)[i];
((char*)data)[i*3]= (char) (sample & 0xff);
((char*)data)[i*3+1]= (char) ((sample>>8) & 0xff);
((char*)data)[i*3+2]= (char) ((sample>>16) & 0xff);
}
return(i*3);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Dispatch initialization request to sub status code devices based on customized feature flags. */ | VOID InitializationDispatcherWorker(VOID) | /* Dispatch initialization request to sub status code devices based on customized feature flags. */
VOID InitializationDispatcherWorker(VOID) | {
EFI_STATUS Status;
if (PcdGetBool (PcdStatusCodeUseSerial)) {
Status = SerialPortInitialize ();
ASSERT_EFI_ERROR (Status);
}
if (PcdGetBool (PcdStatusCodeUseMemory)) {
Status = MemoryStatusCodeInitializeWorker ();
ASSERT_EFI_ERROR (Status);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function initializes the compressor which were compiled in. Returns zero in case of success and a negative error code in case of failure. */ | int __init ubifs_compressors_init(void) | /* This function initializes the compressor which were compiled in. Returns zero in case of success and a negative error code in case of failure. */
int __init ubifs_compressors_init(void) | {
int err;
err = compr_init(&lzo_compr);
if (err)
return err;
err = compr_init(&zlib_compr);
if (err)
return err;
err = compr_init(&none_compr);
if (err)
return err;
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Obtains a SID associated with the security context that has the string representation specified by @scontext. Returns -EINVAL if the context is invalid, -ENOMEM if insufficient memory is available, or 0 on success. */ | int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid) | /* Obtains a SID associated with the security context that has the string representation specified by @scontext. Returns -EINVAL if the context is invalid, -ENOMEM if insufficient memory is available, or 0 on success. */
int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid) | {
return security_context_to_sid_core(scontext, scontext_len,
sid, SECSID_NULL, GFP_KERNEL, 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Wait for the given number of milliseconds (using the dwTimeStamp generated by the SAM microcontrollers' system tick). */ | static void mdelay(uint32_t ul_dly_ticks) | /* Wait for the given number of milliseconds (using the dwTimeStamp generated by the SAM microcontrollers' system tick). */
static void mdelay(uint32_t ul_dly_ticks) | {
uint32_t ul_cur_ticks;
ul_cur_ticks = gs_ul_ms_ticks;
while ((gs_ul_ms_ticks - ul_cur_ticks) < ul_dly_ticks);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Heuristic interpreter for the ZigBee PRO beacon dissectors. */ | static gboolean dissect_zbee_beacon_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) | /* Heuristic interpreter for the ZigBee PRO beacon dissectors. */
static gboolean dissect_zbee_beacon_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) | {
ieee802154_packet *packet = (ieee802154_packet *)data;
if (!packet) return FALSE;
if (packet->src_addr_mode != IEEE802154_FCF_ADDR_SHORT) return FALSE;
if (tvb_get_guint8(tvb, 0) != ZBEE_NWK_BEACON_PROTOCOL_ID) return FALSE;
dissect_zbee_beacon(tvb, pinfo, tree, packet);
return TRUE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function restores CR2 register when on-demand paging is enabled. */ | VOID RestoreCr2(IN UINTN Cr2) | /* This function restores CR2 register when on-demand paging is enabled. */
VOID RestoreCr2(IN UINTN Cr2) | {
if (!mCpuSmmRestrictedMemoryAccess) {
AsmWriteCr2 (Cr2);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The values for fieldmask are defined in xfs_inode_item.h. We always log all of the core inode if any of it has changed, and we always log all of the inline data/extents/b-tree root if any of them has changed. */ | void xfs_trans_log_inode(xfs_trans_t *tp, xfs_inode_t *ip, uint flags) | /* The values for fieldmask are defined in xfs_inode_item.h. We always log all of the core inode if any of it has changed, and we always log all of the inline data/extents/b-tree root if any of them has changed. */
void xfs_trans_log_inode(xfs_trans_t *tp, xfs_inode_t *ip, uint flags) | {
xfs_log_item_desc_t *lidp;
ASSERT(ip->i_transp == tp);
ASSERT(ip->i_itemp != NULL);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(ip->i_itemp));
ASSERT(lidp != NULL);
tp->t_flags |= XFS_TRANS_DIRTY;
lidp->lid_flags |= XFS_LID_DIRTY;
flags |= ip->i_itemp->ili_last_fields;
ip->i_itemp->ili_format.ilf_fields |= flags;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Find the udevice that either has the name passed in as devname or has an alias named devname. */ | struct udevice* eth_get_dev_by_name(const char *devname) | /* Find the udevice that either has the name passed in as devname or has an alias named devname. */
struct udevice* eth_get_dev_by_name(const char *devname) | {
int seq = -1;
char *endp = NULL;
const char *startp = NULL;
struct udevice *it;
struct uclass *uc;
int len = strlen("eth");
if (!strncmp(devname, "eth", len) && strlen(devname) > len) {
startp = devname + len;
seq = simple_strtoul(startp, &endp, 10);
}
uclass_get(UCLASS_ETH, &uc);
uclass_foreach_dev(it, uc) {
if (device_probe(it))
continue;
if (strcmp(it->name, devname) == 0 ||
(endp > startp && it->seq == seq))
return it;
}
return NULL;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* slist_wc_append() appends a string to the linked list. This function can be used as an initialization function as well as an append function. */ | struct slist_wc* slist_wc_append(struct slist_wc *list, const char *data) | /* slist_wc_append() appends a string to the linked list. This function can be used as an initialization function as well as an append function. */
struct slist_wc* slist_wc_append(struct slist_wc *list, const char *data) | {
struct curl_slist *new_item = curl_slist_append(NULL, data);
if(!new_item)
return NULL;
if(!list) {
list = malloc(sizeof(struct slist_wc));
if(!list) {
curl_slist_free_all(new_item);
return NULL;
}
list->first = new_item;
list->last = new_item;
return list;
}
list->last->next = new_item;
list->last = list->last->next;
return list;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Returns a bit field marking the highest possibility lower than value. */ | static int value_highest_bit(__u32 value, __u32 *array, int size, __u16 *field) | /* Returns a bit field marking the highest possibility lower than value. */
static int value_highest_bit(__u32 value, __u32 *array, int size, __u16 *field) | {
int i;
__u16 mask = 0x1;
__u16 result = 0x0;
for (i=0; i < size; i++) {
if (array[i] <= value)
break;
mask <<= 1;
}
result |= mask;
if(i >= size)
i = size - 1;
*field = result;
return i;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* phy_update_link: Make the emulated PHY link state match the QEMU "interface" state. */ | static void phy_update_link(GemState *s) | /* phy_update_link: Make the emulated PHY link state match the QEMU "interface" state. */
static void phy_update_link(GemState *s) | {
DB_PRINT("down %d\n", qemu_get_queue(s->nic)->link_down);
if (qemu_get_queue(s->nic)->link_down) {
s->phy_regs[PHY_REG_STATUS] &= ~(PHY_REG_STATUS_ANEGCMPL |
PHY_REG_STATUS_LINK);
s->phy_regs[PHY_REG_INT_ST] |= PHY_REG_INT_ST_LINKC;
} else {
s->phy_regs[PHY_REG_STATUS] |= (PHY_REG_STATUS_ANEGCMPL |
PHY_REG_STATUS_LINK);
s->phy_regs[PHY_REG_INT_ST] |= (PHY_REG_INT_ST_LINKC |
PHY_REG_INT_ST_ANEGCMPL |
PHY_REG_INT_ST_ENERGY);
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Enables GMAC to look for wake up frame. Wake up frame is defined by the user. */ | void synopGMAC_wakeup_frame_enable(synopGMACdevice *gmacdev) | /* Enables GMAC to look for wake up frame. Wake up frame is defined by the user. */
void synopGMAC_wakeup_frame_enable(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev->MacBase, GmacPmtCtrlStatus, GmacPmtWakeupFrameEnable);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* stm32_copro_set_hold_boot() - Hold boot bit management @dev: corresponding STM32 remote processor device @hold: hold boot value */ | static int stm32_copro_set_hold_boot(struct udevice *dev, bool hold) | /* stm32_copro_set_hold_boot() - Hold boot bit management @dev: corresponding STM32 remote processor device @hold: hold boot value */
static int stm32_copro_set_hold_boot(struct udevice *dev, bool hold) | {
struct stm32_copro_privdata *priv;
uint val;
int ret;
priv = dev_get_priv(dev);
val = hold ? RCC_GCR_HOLD_BOOT : RCC_GCR_RELEASE_BOOT;
if (priv->secured_soc) {
return stm32_smc_exec(STM32_SMC_RCC, STM32_SMC_REG_WRITE,
priv->hold_boot_offset, val);
}
ret = regmap_update_bits(priv->hold_boot_regmap, priv->hold_boot_offset,
priv->hold_boot_mask, val);
if (ret)
dev_err(dev, "failed to set hold boot\n");
return ret;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Wish we could just send scancodes straight to the guest which already has code for dealing with this... */ | static void xenfb_key_event(void *opaque, int scancode) | /* Wish we could just send scancodes straight to the guest which already has code for dealing with this... */
static void xenfb_key_event(void *opaque, int scancode) | {
struct XenInput *xenfb = opaque;
int down = 1;
if (scancode == 0xe0) {
xenfb->extended = 1;
return;
} else if (scancode & 0x80) {
scancode &= 0x7f;
down = 0;
}
if (xenfb->extended) {
scancode |= 0x80;
xenfb->extended = 0;
}
xenfb_send_key(xenfb, down, scancode2linux[scancode]);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Enable the IrDA function if tty->ldisc.num is N_IRDA. In other cases, disable IrDA function. */ | static void bfin_serial_set_ldisc(struct uart_port *port) | /* Enable the IrDA function if tty->ldisc.num is N_IRDA. In other cases, disable IrDA function. */
static void bfin_serial_set_ldisc(struct uart_port *port) | {
int line = port->line;
unsigned short val;
if (line >= port->state->port.tty->driver->num)
return;
switch (port->state->port.tty->termios->c_line) {
case N_IRDA:
val = UART_GET_GCTL(&bfin_serial_ports[line]);
val |= (IREN | RPOLC);
UART_PUT_GCTL(&bfin_serial_ports[line], val);
break;
default:
val = UART_GET_GCTL(&bfin_serial_ports[line]);
val &= ~(IREN | RPOLC);
UART_PUT_GCTL(&bfin_serial_ports[line], val);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* pressure_ref: The Reference pressure value is a 24-bit data expressed as 2’s complement. The value is used when AUTOZERO or AUTORIFP function is enabled. */ | int32_t lps22hb_pressure_ref_set(stmdev_ctx_t *ctx, uint8_t *buff) | /* pressure_ref: The Reference pressure value is a 24-bit data expressed as 2’s complement. The value is used when AUTOZERO or AUTORIFP function is enabled. */
int32_t lps22hb_pressure_ref_set(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lps22hb_write_reg(ctx, LPS22HB_REF_P_XL, buff, 3);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Obtains the segment as the specified index from the linked list with firmware data. */ | tFirmwareSegment* FirmwareGetSegment(uint32_t segmentIdx) | /* Obtains the segment as the specified index from the linked list with firmware data. */
tFirmwareSegment* FirmwareGetSegment(uint32_t segmentIdx) | {
tFirmwareSegment * currentSegment = NULL;
uint32_t currentIdx;
assert(segmentIdx < FirmwareGetSegmentCount());
if (segmentIdx < FirmwareGetSegmentCount())
{
if (segmentList != NULL)
{
currentSegment = segmentList;
for (currentIdx = 0; currentIdx < segmentIdx; currentIdx++)
{
currentSegment = currentSegment->next;
assert(currentSegment != NULL);
if (currentSegment == NULL)
{
break;
}
}
}
}
return currentSegment;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Pushes an error on the parser error stack. */ | static enum CRStatus cr_parser_push_error(CRParser *a_this, const guchar *a_msg, enum CRStatus a_status) | /* Pushes an error on the parser error stack. */
static enum CRStatus cr_parser_push_error(CRParser *a_this, const guchar *a_msg, enum CRStatus a_status) | {
enum CRStatus status = CR_OK;
CRParserError *error = NULL;
CRInputPos pos;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_msg, CR_BAD_PARAM_ERROR);
error = cr_parser_error_new (a_msg, a_status);
g_return_val_if_fail (error, CR_ERROR);
RECORD_INITIAL_POS (a_this, &pos);
cr_parser_error_set_pos
(error, pos.line, pos.col, pos.next_byte_index - 1);
PRIVATE (a_this)->err_stack =
g_list_prepend (PRIVATE (a_this)->err_stack, error);
if (PRIVATE (a_this)->err_stack == NULL)
goto error;
return CR_OK;
error:
if (error) {
cr_parser_error_destroy (error);
error = NULL;
}
return status;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Gets a data element from the SPI receive FIFO. */ | void SPIDataGet(unsigned long ulBase, unsigned long *pulData) | /* Gets a data element from the SPI receive FIFO. */
void SPIDataGet(unsigned long ulBase, unsigned long *pulData) | {
xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE));
while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_RXNE))
{
}
*pulData = xHWREG(ulBase + SPI_DR);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Check if the private key is located in valid range of curve. */ | int ECC_IsPrivateKeyValid(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char private_k[]) | /* Check if the private key is located in valid range of curve. */
int ECC_IsPrivateKeyValid(CRPT_T *crpt, E_ECC_CURVE ecc_curve, char private_k[]) | {
uint32_t i;
(void)crpt;
pCurve = get_curve(ecc_curve);
if (pCurve == NULL)
{
return -1;
}
if (strlen(private_k) < strlen(pCurve->Eorder))
{
return 1;
}
if (strlen(private_k) > strlen(pCurve->Eorder))
{
return 0;
}
for (i = 0U; i < strlen(private_k); i++)
{
if (get_nibble_value(private_k[i]) < get_nibble_value(pCurve->Eorder[i]))
{
return 1;
}
if (get_nibble_value(private_k[i]) > get_nibble_value(pCurve->Eorder[i]))
{
return 0;
}
}
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function calculates the value needed for a valid UINT16 checksum */ | UINT16 CalculateChecksum16(IN UINT16 *Buffer, IN UINTN Size) | /* This function calculates the value needed for a valid UINT16 checksum */
UINT16 CalculateChecksum16(IN UINT16 *Buffer, IN UINTN Size) | {
return (UINT16) (0x10000 - CalculateSum16 (Buffer, Size));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* @id: family ID to remove from the table */ | void wimax_id_table_rm(struct wimax_dev *wimax_dev) | /* @id: family ID to remove from the table */
void wimax_id_table_rm(struct wimax_dev *wimax_dev) | {
spin_lock(&wimax_id_table_lock);
list_del_init(&wimax_dev->id_table_node);
spin_unlock(&wimax_id_table_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If List is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */ | LIST_ENTRY* EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List) | /* If List is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
LIST_ENTRY* EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List) | {
ASSERT (InternalBaseLibIsListValid (List));
return List->ForwardLink;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: (transfer none): the #GTypePlugin for the dynamic interface @interface_type of @instance_type */ | GTypePlugin* g_type_interface_get_plugin(GType instance_type, GType interface_type) | /* Returns: (transfer none): the #GTypePlugin for the dynamic interface @interface_type of @instance_type */
GTypePlugin* g_type_interface_get_plugin(GType instance_type, GType interface_type) | {
TypeNode *node;
TypeNode *iface;
g_return_val_if_fail (G_TYPE_IS_INTERFACE (interface_type), NULL);
node = lookup_type_node_I (instance_type);
iface = lookup_type_node_I (interface_type);
if (node && iface)
{
IFaceHolder *iholder;
GTypePlugin *plugin;
G_READ_LOCK (&type_rw_lock);
iholder = iface_node_get_holders_L (iface);
while (iholder && iholder->instance_type != instance_type)
iholder = iholder->next;
plugin = iholder ? iholder->plugin : NULL;
G_READ_UNLOCK (&type_rw_lock);
return plugin;
}
g_return_val_if_fail (node == NULL, NULL);
g_return_val_if_fail (iface == NULL, NULL);
g_warning (G_STRLOC ": attempt to look up plugin for invalid instance/interface type pair.");
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* ADC Disable an External Trigger for Injected Channels. */ | void adc_disable_external_trigger_injected(uint32_t adc) | /* ADC Disable an External Trigger for Injected Channels. */
void adc_disable_external_trigger_injected(uint32_t adc) | {
ADC_CR2(adc) &= ~ADC_CR2_JEXTTRIG;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Get the PWM interrupt flag of the PWM module.
The */ | xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | /* Get the PWM interrupt flag of the PWM module.
The */
xtBoolean PWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | {
unsigned long ulChannelTemp;
unsigned long ulIntStatus;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xASSERT((ulIntType == PWM_INT_CHXCC) || (ulIntType == PWM_INT_UEV1));
if (ulIntType == PWM_INT_UEV1)
{
ulIntStatus = xHWREG(ulBase + TIMER_INTSR) & ulIntType;
if(ulIntStatus != 0)
{
return xtrue;
}
}
else
{
ulIntStatus = xHWREG(ulBase + TIMER_INTSR) & (PWM_INT_CHXCC << ulChannelTemp);
if(ulIntStatus != 0)
{
return xtrue;
}
}
return xfalse;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9);
HAL_DMA_DeInit(huart->hdmarx);
HAL_NVIC_DisableIRQ(USART3_IRQn);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Get root bridge device instance by specific root bridge handle. */ | PCI_IO_DEVICE* GetRootBridgeByHandle(EFI_HANDLE RootBridgeHandle) | /* Get root bridge device instance by specific root bridge handle. */
PCI_IO_DEVICE* GetRootBridgeByHandle(EFI_HANDLE RootBridgeHandle) | {
PCI_IO_DEVICE *RootBridgeDev;
LIST_ENTRY *CurrentLink;
CurrentLink = mPciDevicePool.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {
RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
if (RootBridgeDev->Handle == RootBridgeHandle) {
return RootBridgeDev;
}
CurrentLink = CurrentLink->ForwardLink;
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads and returns a character from the DBGU. */ | unsigned char DBGU_GetChar() | /* Reads and returns a character from the DBGU. */
unsigned char DBGU_GetChar() | {
while ((AT91C_BASE_DBGU->DBGU_CSR & AT91C_US_RXRDY) == 0);
return AT91C_BASE_DBGU->DBGU_RHR;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Handle Bulk In Endpoint Events.
The function handles Bulk In endpoint events. It calls USBD_CDC_ACM_EP_BULKIN_HandleData function to handle send data unless data was being accessed in which case function just returns. */ | void USBD_CDC_ACM_EP_BULKIN_Event(uint32_t event) | /* Handle Bulk In Endpoint Events.
The function handles Bulk In endpoint events. It calls USBD_CDC_ACM_EP_BULKIN_HandleData function to handle send data unless data was being accessed in which case function just returns. */
void USBD_CDC_ACM_EP_BULKIN_Event(uint32_t event) | {
if (data_send_access
) {
return;
}
data_send_access = 1;
USBD_CDC_ACM_EP_BULKIN_HandleData();
data_send_access = 0;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* leave DFU mode and reset device to jump to user loaded code */ | static void dfu_mode_leave(usb_dev *udev) | /* leave DFU mode and reset device to jump to user loaded code */
static void dfu_mode_leave(usb_dev *udev) | {
usbd_dfu_handler *dfu = (usbd_dfu_handler *)udev->class_data[USBD_DFU_INTERFACE];
dfu->manifest_state = MANIFEST_COMPLETE;
if (dfu_config_desc.dfu_func.bmAttributes & 0x04U) {
dfu->bState = STATE_DFU_MANIFEST_SYNC;
} else {
dfu->bState = STATE_DFU_MANIFEST_WAIT_RESET;
fmc_lock();
NVIC_SystemReset();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Chunk the readahead into 2 megabyte units, so that we don't pin too much memory at once. */ | int force_page_cache_readahead(struct address_space *mapping, struct file *filp, pgoff_t offset, unsigned long nr_to_read) | /* Chunk the readahead into 2 megabyte units, so that we don't pin too much memory at once. */
int force_page_cache_readahead(struct address_space *mapping, struct file *filp, pgoff_t offset, unsigned long nr_to_read) | {
int ret = 0;
if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
return -EINVAL;
nr_to_read = max_sane_readahead(nr_to_read);
while (nr_to_read) {
int err;
unsigned long this_chunk = (2 * 1024 * 1024) / PAGE_CACHE_SIZE;
if (this_chunk > nr_to_read)
this_chunk = nr_to_read;
err = __do_page_cache_readahead(mapping, filp,
offset, this_chunk, 0);
if (err < 0) {
ret = err;
break;
}
ret += err;
offset += this_chunk;
nr_to_read -= this_chunk;
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.