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 |
|---|---|---|---|---|---|---|---|
/* CAN MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) | /* CAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hcan->Instance==CAN1)
{
__HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_Ini... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Add or modify a property in the given node. */ | INT32 EFIAPI FdtSetProp(IN VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN CONST VOID *Value, IN UINT32 Length) | /* Add or modify a property in the given node. */
INT32 EFIAPI FdtSetProp(IN VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN CONST VOID *Value, IN UINT32 Length) | {
return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Update Remaining Us for all Active timers and sync timer task. */ | static void TimersUpdateSyncTask(uint32_t remainingUs) | /* Update Remaining Us for all Active timers and sync timer task. */
static void TimersUpdateSyncTask(uint32_t remainingUs) | {
TimersUpdate(true, false, remainingUs);
s_timermanager.previousTimeInUs = HAL_TimerGetCurrentTimerCount((hal_timer_handle_t)s_timermanager.halTimerHandle);
NotifyTimersTask();
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Configures for the selected ADC and its sampling time. */ | void ADC_ChannelConfig(ADC_TypeDef *ADCx, uint32_t ADC_Channel, uint32_t ADC_SampleTime) | /* Configures for the selected ADC and its sampling time. */
void ADC_ChannelConfig(ADC_TypeDef *ADCx, uint32_t ADC_Channel, uint32_t ADC_SampleTime) | {
uint32_t tmpreg = 0;
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_CHANNEL(ADC_Channel));
assert_param(IS_ADC_SAMPLE_TIME(ADC_SampleTime));
ADCx->CHSELR |= (uint32_t)ADC_Channel;
tmpreg &= ~ADC_SMPR1_SMPR;
tmpreg |= (uint32_t)ADC_SampleTime;
ADCx->SMPR = tmpreg ;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return value: a pointer to the subscribed string. */ | gchar* scs_subscribe(SCS_collection *c, const gchar *s) | /* Return value: a pointer to the subscribed string. */
gchar* scs_subscribe(SCS_collection *c, const gchar *s) | {
(*ip)++;
} else {
ip = g_slice_new(guint);
*ip = 0;
len = strlen(s) + 1;
if (len <= SCS_SMALL_SIZE) {
len = SCS_SMALL_SIZE;
} else if (len <= SCS_MEDIUM_SIZE) {
len = SCS_MEDIUM_SIZE;
} else if (len <= SCS_LARGE_SIZE) {
len = SCS_LARGE_SIZE;
} else if (len < SCS_HUGE_SIZE) {
len = SCS_HUG... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Sets current global font character rotation steps.
Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache. */ | void gfxPrimitivesSetFontRotation(Uint32 rotation) | /* Sets current global font character rotation steps.
Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise. Changing the rotation, will reset the character cache. */
void gfxPrimitivesSetFontRotation(Uint32 rotation) | {
int i;
rotation = rotation & 3;
if (charRotation != rotation)
{
charRotation = rotation;
if ((charRotation==1) || (charRotation==3))
{
charWidthLocal = charHeight;
charHeightLocal = charWidth;
}
else
{
charWidthLocal = charWidth;
charHeightLocal = charHeight;
}
for (i = 0; i < 256; i++... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This API reads the Hardware interrupt status from the sensor. */ | uint16_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev) | /* This API reads the Hardware interrupt status from the sensor. */
uint16_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev) | {
uint16_t rslt = BMA4_OK;
if (dev == NULL) {
rslt = BMA4_E_NULL_PTR;
} else {
rslt = bma4_read_regs(BMA4_INT_STAT_1_ADDR, int_status_1, 1, dev);
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */ | UINT32 EFIAPI MmioRead32(IN UINTN Address) | /* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI MmioRead32(IN UINTN Address) | {
UINT32 Value;
BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth32, Address, &Value);
if (Flag) {
Value = *(volatile UINT32 *)Address;
}
FilterAfterMmIoRead (FilterWidth32, Address, &Value);
return Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This disables the TX queue and cleans up a KS8695 ethernet device. */ | static int ks8695_stop(struct net_device *ndev) | /* This disables the TX queue and cleans up a KS8695 ethernet device. */
static int ks8695_stop(struct net_device *ndev) | {
struct ks8695_priv *ksp = netdev_priv(ndev);
netif_stop_queue(ndev);
napi_disable(&ksp->napi);
netif_carrier_off(ndev);
ks8695_shutdown(ksp);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Notice that notifiers are automatically removed after they are run. */ | void g_closure_remove_invalidate_notifier(GClosure *closure, gpointer notify_data, GClosureNotify notify_func) | /* Notice that notifiers are automatically removed after they are run. */
void g_closure_remove_invalidate_notifier(GClosure *closure, gpointer notify_data, GClosureNotify notify_func) | {
g_return_if_fail (closure != NULL);
g_return_if_fail (notify_func != NULL);
if (closure->is_invalid && closure->in_inotify &&
((gpointer) closure->marshal) == ((gpointer) notify_func) &&
closure->data == notify_data)
closure->marshal = NULL;
else if (!closure_try_remove_inotify (closure, notif... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Register locations derived from NVClock by Roderick Colenbrander */ | static int nv40_get_intensity(struct backlight_device *bd) | /* Register locations derived from NVClock by Roderick Colenbrander */
static int nv40_get_intensity(struct backlight_device *bd) | {
struct drm_device *dev = bl_get_data(bd);
int val = (nv_rd32(dev, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK)
>> 16;
return val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable IO compensation mechanism By default the I/O compensation cell is not used. However when the I/O output buffer speed is configured in 50 MHz mode and above, it is recommended to use the compensation cell for a slew rate control on I/O tf(IO)out/tr(IO)out commutation to reduce the I/O noise on the power supply... | HAL_StatusTypeDef HAL_SYSCFG_EnableIOCompensation(void) | /* Enable IO compensation mechanism By default the I/O compensation cell is not used. However when the I/O output buffer speed is configured in 50 MHz mode and above, it is recommended to use the compensation cell for a slew rate control on I/O tf(IO)out/tr(IO)out commutation to reduce the I/O noise on the power supply... | {
if (count-- == 0U) {
return HAL_TIMEOUT;
}
} while (__HAL_SYSCFG_CMP_CELL_GET_FLAG() == 0U);
HAL_SYSCFG_CompensationCodeSelect(SYSCFG_CELL_CODE);
return status;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* May sleep while waiting for reference counter to become zero. */ | void cn_del_callback(struct cb_id *id) | /* May sleep while waiting for reference counter to become zero. */
void cn_del_callback(struct cb_id *id) | {
struct cn_dev *dev = &cdev;
cn_queue_del_callback(dev->cbdev, id);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) | /* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
TIMx_CLK_ENABLE();
TIMx_CHANNEL_GPIO_PORT();
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF_TIMx;
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL1;
HAL_GPIO_Init(TIMx_... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Configures the tim Internal Trigger as External Clock. */ | void TIM_ITRxExternalClockConfig(TIM_TypeDef *tim, TIMTS_TypeDef source) | /* Configures the tim Internal Trigger as External Clock. */
void TIM_ITRxExternalClockConfig(TIM_TypeDef *tim, TIMTS_TypeDef source) | {
TIM_SelectInputTrigger(tim, source);
SET_BIT(tim->SMCR, TIM_SlaveMode_External1);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Internal function that tells the architecture code whether a particular irq has been exclusively allocated or is available for driver use. */ | int can_request_irq(unsigned int irq, unsigned long irqflags) | /* Internal function that tells the architecture code whether a particular irq has been exclusively allocated or is available for driver use. */
int can_request_irq(unsigned int irq, unsigned long irqflags) | {
struct irq_desc *desc = irq_to_desc(irq);
struct irqaction *action;
if (!desc)
return 0;
if (desc->status & IRQ_NOREQUEST)
return 0;
action = desc->action;
if (action)
if (irqflags & action->flags & IRQF_SHARED)
action = NULL;
return !action;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base SCTimer peripheral base address param event Event number to enable in the current state */ | void SCTIMER_ScheduleEvent(SCT_Type *base, uint32_t event) | /* param base SCTimer peripheral base address param event Event number to enable in the current state */
void SCTIMER_ScheduleEvent(SCT_Type *base, uint32_t event) | {
base->EV[event].STATE |= (1UL << s_currentState);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The value is masked so as to only change the value of DCR_STROBE, DCR_AUTOFD, DCR_nINIT, and DCR_SELECT. */ | static void parport_ip32_write_control(struct parport *p, unsigned char c) | /* The value is masked so as to only change the value of DCR_STROBE, DCR_AUTOFD, DCR_nINIT, and DCR_SELECT. */
static void parport_ip32_write_control(struct parport *p, unsigned char c) | {
const unsigned int wm =
DCR_STROBE | DCR_AUTOFD | DCR_nINIT | DCR_SELECT;
CHECK_EXTRA_BITS(p, c, wm);
__parport_ip32_frob_control(p, wm, c & wm);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The constructor function initializes the Performance Measurement Enable flag and registers SmmBase2 protocol notify callback. It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS. */ | EFI_STATUS EFIAPI SmmCorePerformanceLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The constructor function initializes the Performance Measurement Enable flag and registers SmmBase2 protocol notify callback. It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI SmmCorePerformanceLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *... | {
EFI_STATUS Status;
EFI_EVENT Event;
VOID *Registration;
mPerformanceMeasurementEnabled = (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
if (!PerformanceMeasurementEnabled ()) {
return EFI_SUCCESS;
}
Status = gBS->CreateEve... | tianocore/edk2 | C++ | Other | 4,240 |
/* Divide two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to */ | BOOLEAN EFIAPI BigNumDiv(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes) | /* Divide two Big Numbers. Please note, all "out" Big number arguments should be properly initialized by calling to */
BOOLEAN EFIAPI BigNumDiv(IN CONST VOID *BnA, IN CONST VOID *BnB, OUT VOID *BnRes) | {
CALL_CRYPTO_SERVICE (BigNumDiv, (BnA, BnB, BnRes), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* interpret an 8 byte "filetime" structure to a time_t It's originally in "100ns units since jan 1st 1601" */ | static time_t interpret_long_date(const u_char *p) | /* interpret an 8 byte "filetime" structure to a time_t It's originally in "100ns units since jan 1st 1601" */
static time_t interpret_long_date(const u_char *p) | {
double d;
time_t ret;
d = (EXTRACT_LE_32BITS(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24));
d -= 369.0 * 365.25 * 24 * 60 * 60;
d += (3 * 24 * 60 * 60 + 6 * 60 * 60 + 2);
if (d < 0)
return(0);
ret = (time_t)d;
return(ret);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This API is the entry point. Call this API before using all other APIs. This API reads the chip-id of the sensor which is the first step to verify the sensor and also it configures the read mechanism of SPI and I2C interface. */ | uint16_t bma4_init(struct bma4_dev *dev) | /* This API is the entry point. Call this API before using all other APIs. This API reads the chip-id of the sensor which is the first step to verify the sensor and also it configures the read mechanism of SPI and I2C interface. */
uint16_t bma4_init(struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0;
if ((dev == NULL) || (dev->bus_read == NULL) || (dev->bus_write == NULL)) {
rslt |= BMA4_E_NULL_PTR;
} else {
if (dev->interface == BMA4_SPI_INTERFACE)
dev->dummy_byte = 1;
else
dev->dummy_byte = 0;
rslt |= bm... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* This function handles DMA2 Stream 6 interrupt request. */ | void DMA2_Stream6_IRQHandler(void) | /* This function handles DMA2 Stream 6 interrupt request. */
void DMA2_Stream6_IRQHandler(void) | {
BSP_SD_DMA_Tx_IRQHandler();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function is used to check the eMMC timing. */ | s32 XSdPs_CheckEmmcTiming(XSdPs *InstancePtr, u8 *ExtCsd) | /* This function is used to check the eMMC timing. */
s32 XSdPs_CheckEmmcTiming(XSdPs *InstancePtr, u8 *ExtCsd) | {
s32 Status;
Status = XSdPs_Get_Mmc_ExtCsd(InstancePtr, ExtCsd);
if (Status != XST_SUCCESS) {
Status = XST_FAILURE;
goto RETURN_PATH;
}
if (InstancePtr->Mode == XSDPS_HS200_MODE) {
if (ExtCsd[EXT_CSD_HS_TIMING_BYTE] != EXT_CSD_HS_TIMING_HS200) {
Status = XST_FAIL... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set digital low pass filter. The following LPF settings are supported: 188, 98, 42, 20, 10, 5. */ | int mpu_set_lpf(unsigned short lpf) | /* Set digital low pass filter. The following LPF settings are supported: 188, 98, 42, 20, 10, 5. */
int mpu_set_lpf(unsigned short lpf) | {
unsigned char data;
if (!(st.chip_cfg.sensors))
return -1;
if (lpf >= 188)
data = INV_FILTER_188HZ;
else if (lpf >= 98)
data = INV_FILTER_98HZ;
else if (lpf >= 42)
data = INV_FILTER_42HZ;
else if (lpf >= 20)
data = INV_FILTER_20HZ;
else if (lpf >= 10... | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Service routine to read status register until ready, or timeout occurs. Returns non-zero if error. */ | static int wait_till_ready(struct m25p_spifi *flash) | /* Service routine to read status register until ready, or timeout occurs. Returns non-zero if error. */
static int wait_till_ready(struct m25p_spifi *flash) | {
unsigned long deadline;
int sr;
deadline = jiffies + MAX_READY_WAIT_JIFFIES;
do {
if ((sr = read_sr(flash)) < 0)
break;
if (!(sr & SR_WIP))
return 0;
cond_resched();
} while (!time_after_eq(jiffies, deadline));
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */ | UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value) | /* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value) | {
ASSERT ((Address & 7) == 0);
return (UINT64)MmioWriteWorker (Address, EfiCpuIoWidthUint64, Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Like copy_strings, but get argv and its values from kernel memory. */ | int copy_strings_kernel(int argc, char **argv, struct linux_binprm *bprm) | /* Like copy_strings, but get argv and its values from kernel memory. */
int copy_strings_kernel(int argc, char **argv, struct linux_binprm *bprm) | {
int r;
mm_segment_t oldfs = get_fs();
set_fs(KERNEL_DS);
r = copy_strings(argc, (char __user * __user *)argv, bprm);
set_fs(oldfs);
return r;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Created on: 16 feb. 2019 Author: Daniel Mårtensson Sum all rows from A size row x column, into a flat matrix B size 1 x column */ | void sumrows(double *A, double *B, int row, int column) | /* Created on: 16 feb. 2019 Author: Daniel Mårtensson Sum all rows from A size row x column, into a flat matrix B size 1 x column */
void sumrows(double *A, double *B, int row, int column) | {
for(int i = 0; i < row; i++){
*(B + j) += *((A + i*column) + j);
}
}
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* Used by the fuzzer component. Original source code contributed by A. Schiffler for GSOC project. */ | void SDLTest_RandomInit(SDLTest_RandomContext *rndContext, unsigned int xi, unsigned int ci) | /* Used by the fuzzer component. Original source code contributed by A. Schiffler for GSOC project. */
void SDLTest_RandomInit(SDLTest_RandomContext *rndContext, unsigned int xi, unsigned int ci) | {
if (rndContext==NULL) return;
rndContext->a = 1655692410;
rndContext->x = 30903;
rndContext->c = 0;
if (xi != 0) {
rndContext->x = xi;
}
rndContext->c = ci;
rndContext->ah = rndContext->a >> 16;
rndContext->al = rndContext->a & 65535;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This function returns the real bus clock of USCI_I2C module. */ | uint32_t UI2C_GetBusClockFreq(UI2C_T *ui2c) | /* This function returns the real bus clock of USCI_I2C module. */
uint32_t UI2C_GetBusClockFreq(UI2C_T *ui2c) | {
uint32_t u32Divider;
uint32_t u32Pclk;
if((ui2c == UI2C1) || (ui2c == UI2C1_NS))
{
u32Pclk = CLK_GetPCLK1Freq();
}
else
{
u32Pclk = CLK_GetPCLK0Freq();
}
u32Divider = (ui2c->BRGEN & UI2C_BRGEN_CLKDIV_Msk) >> UI2C_BRGEN_CLKDIV_Pos;
return (u32Pclk / ((u32Divider ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Disable Backup Domain Write Protection.
This allows backup domain registers to be changed. These registers are write protected after a reset. */ | void pwr_disable_backup_domain_write_protect(void) | /* Disable Backup Domain Write Protection.
This allows backup domain registers to be changed. These registers are write protected after a reset. */
void pwr_disable_backup_domain_write_protect(void) | {
PWR_CR |= PWR_CR_DBP;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* This API is used to get the status of fifo data select in the register 0x3E bit 0 and 1. */ | BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_data_select(u8 *v_fifo_data_select_u8) | /* This API is used to get the status of fifo data select in the register 0x3E bit 0 and 1. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_fifo_data_select(u8 *v_fifo_data_select_u8) | {
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr,
BMG160_FIFO_CGF0_ADDR... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Uses a critical section to determine if there is any space in a queue. */ | static BaseType_t prvIsQueueFull(Queue_t *pxQueue) PRIVILEGED_FUNCTION | /* Uses a critical section to determine if there is any space in a queue. */
static BaseType_t prvIsQueueFull(Queue_t *pxQueue) PRIVILEGED_FUNCTION | {
BaseType_t xReturn;
taskENTER_CRITICAL_ISR(&pxQueue->mux);
{
if( pxQueue->uxMessagesWaiting == pxQueue->uxLength )
{
xReturn = pdTRUE;
}
else
{
xReturn = pdFALSE;
}
}
taskEXIT_CRITICAL_ISR(&pxQueue->mux);
return xReturn;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Let MAX7359 take a catnap: Autosleep just for 256 ms. */ | static void max7359_take_catnap(struct i2c_client *client) | /* Let MAX7359 take a catnap: Autosleep just for 256 ms. */
static void max7359_take_catnap(struct i2c_client *client) | {
max7359_write_reg(client, MAX7359_REG_SLEEP, MAX7359_AUTOSLEEP_256);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In a single threaded sys_arch implementation, this function will simply return a pointer to a global sys_timeouts variable stored in the sys_arch module. */ | struct sys_timeouts* sys_arch_timeouts(void) | /* In a single threaded sys_arch implementation, this function will simply return a pointer to a global sys_timeouts variable stored in the sys_arch module. */
struct sys_timeouts* sys_arch_timeouts(void) | {
sys_tcb_t *ptask;
ptask = sys_arch_thread_current( );
LWIP_ASSERT( "sys_arch_timeouts: ptask != NULL", ptask != NULL );
return ptask != NULL ? &( ptask->timeouts ) : NULL;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* RETURN VALUES erp erp-pointer to the already defined error recovery procedure OR NULL if a 'new' error occurred. */ | static struct dasd_ccw_req* dasd_3990_erp_in_erp(struct dasd_ccw_req *cqr) | /* RETURN VALUES erp erp-pointer to the already defined error recovery procedure OR NULL if a 'new' error occurred. */
static struct dasd_ccw_req* dasd_3990_erp_in_erp(struct dasd_ccw_req *cqr) | {
struct dasd_ccw_req *erp_head = cqr,
*erp_match = NULL;
int match = 0;
if (cqr->refers == NULL) {
return NULL;
}
do {
match = dasd_3990_erp_error_match(erp_head, cqr->refers);
erp_match = cqr;
cqr = cqr->refers;
} while ((cqr->refers != NULL) && (!match));
if (!match) {
return NULL;
}
return erp_m... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Build a netlink request message to delete a rule */ | int rtnl_rule_build_delete_request(struct rtnl_rule *rule, int flags, struct nl_msg **result) | /* Build a netlink request message to delete a rule */
int rtnl_rule_build_delete_request(struct rtnl_rule *rule, int flags, struct nl_msg **result) | {
return build_rule_msg(rule, RTM_DELRULE, flags, result);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* converts an integer to a "floating point byte", represented as (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if eeeee != 0 and (xxx) otherwise. */ | int luaO_int2fb(unsigned int x) | /* converts an integer to a "floating point byte", represented as (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if eeeee != 0 and (xxx) otherwise. */
int luaO_int2fb(unsigned int x) | {
x = (x+1) >> 1;
e++;
}
if (x < 8) return x;
else return ((e+1) << 3) | (cast_int(x) - 8);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Try to wait a status of specified flags. */ | int32_t I2C_WaitStatus(const CM_I2C_TypeDef *I2Cx, uint32_t u32Flag, en_flag_status_t enStatus, uint32_t u32Timeout) | /* Try to wait a status of specified flags. */
int32_t I2C_WaitStatus(const CM_I2C_TypeDef *I2Cx, uint32_t u32Flag, en_flag_status_t enStatus, uint32_t u32Timeout) | {
int32_t i32Ret = LL_ERR_TIMEOUT;
uint32_t u32RegStatusBit;
DDL_ASSERT(IS_I2C_UNIT(I2Cx));
DDL_ASSERT(IS_I2C_FLAG(u32Flag));
DDL_ASSERT(IS_I2C_FLAG_STD(enStatus));
for (;;) {
u32RegStatusBit = (READ_REG32_BIT(I2Cx->SR, u32Flag));
if (((enStatus == SET) && (u32Flag == u32RegStatu... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Pixel off: src = 0 Pixel on: src > 0 */ | static void cfag12864b_format(unsigned char *matrix) | /* Pixel off: src = 0 Pixel on: src > 0 */
static void cfag12864b_format(unsigned char *matrix) | {
unsigned char i, j, n;
for (i = 0; i < CFAG12864B_HEIGHT; i++)
for (j = 0; j < CFAG12864B_WIDTH / CFAG12864B_BPB; j++) {
cfag12864b_buffer[i * CFAG12864B_WIDTH / CFAG12864B_BPB +
j] = 0;
for (n = 0; n < CFAG12864B_BPB; n++)
if (matrix[i * CFAG12864B_WIDTH +
j * CFAG12864B_BPB + n])
cfag12864b_buf... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Document specific function(s) in a file. Call kernel-doc with the following parameters: kernel-doc -docbook -function function1 */ | static void singfunc(char *filename, char *line) | /* Document specific function(s) in a file. Call kernel-doc with the following parameters: kernel-doc -docbook -function function1 */
static void singfunc(char *filename, char *line) | {
char *vec[200];
int i, idx = 0;
int startofsym = 1;
vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK;
for (i=0; line[i]; i++) {
if (isspace(line[i])) {
line[i] = '\0';
startofsym = 1;
continue;
... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* checks whether this descriptor contains end of frame. This function is to check whether the descriptor's data buffer contains end of ethernet frame? */ | bool synopGMAC_is_eof_in_rx_desc(DmaDesc *desc) | /* checks whether this descriptor contains end of frame. This function is to check whether the descriptor's data buffer contains end of ethernet frame? */
bool synopGMAC_is_eof_in_rx_desc(DmaDesc *desc) | {
return ((desc->status & DescRxLast) == DescRxLast);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialize window system, set up root window, hook into touch driver.
This function initializes the windowing system. Call this function before any other window system operations, as this initializes the root window, internal queues and other internals. */ | void win_init(void) | /* Initialize window system, set up root window, hook into touch driver.
This function initializes the windowing system. Call this function before any other window system operations, as this initializes the root window, internal queues and other internals. */
void win_init(void) | {
win_root.attributes.area.size.x = gfx_get_width();
win_root.attributes.area.size.y = gfx_get_height();
win_root.attributes.background = &win_root_background;
win_event_queue.free = WIN_EVENT_QUEUE_SIZE;
win_event_queue.start = win_event_queue_buffer;
win_event_queue.front = win_event_queue_buffer;
win_event_qu... | memfault/zero-to-main | C++ | null | 200 |
/* Enables internal loopback mode for an I2C port. */ | void I2CLoopbackEnable(uint32_t ui32Base) | /* Enables internal loopback mode for an I2C port. */
void I2CLoopbackEnable(uint32_t ui32Base) | {
ASSERT(_I2CBaseValid(ui32Base));
HWREG(ui32Base + I2C_O_MCR) |= I2C_MCR_LPBK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Calculates data rate corresponding to a given 802.11ac MCS index, bandwidth, and guard interval. */ | static float ieee80211_vhtrate(int mcs_index, guint bandwidth_index, gboolean short_gi) | /* Calculates data rate corresponding to a given 802.11ac MCS index, bandwidth, and guard interval. */
static float ieee80211_vhtrate(int mcs_index, guint bandwidth_index, gboolean short_gi) | {
return (float)(ieee80211_vhtinfo[mcs_index].data_bits_per_symbol * subcarriers[bandwidth_index] / (short_gi ? 3.6 : 4.0) / 52.0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This was the second switch in rtp_parse packet. Normalizes time, if required, sets stream_index, etc. */ | static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp) | /* This was the second switch in rtp_parse packet. Normalizes time, if required, sets stream_index, etc. */
static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp) | {
if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {
int64_t addend;
int delta_timestamp;
delta_timestamp = timestamp - s->last_rtcp_timestamp;
addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32);
pkt->pt... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Disables a device specific interrupt in the NVIC interrupt controller. */ | void CORTEX_NVIC_DisableIRQ(IRQn_Type IRQn) | /* Disables a device specific interrupt in the NVIC interrupt controller. */
void CORTEX_NVIC_DisableIRQ(IRQn_Type IRQn) | {
assert_parameters(IS_CORTEX_NVIC_DEVICE_IRQ(IRQn));
NVIC_DisableIRQ(IRQn);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write a character trought UART in a blocking call. */ | static int32_t usr_uart_write_block(struct uart_desc *desc, uint8_t data) | /* Write a character trought UART in a blocking call. */
static int32_t usr_uart_write_block(struct uart_desc *desc, uint8_t data) | {
int32_t ret;
const uint32_t buf_size = 1;
uint32_t hw_error;
if(desc->has_callback) {
ret = adi_uart_SubmitTxBuffer((ADI_UART_HANDLE const)h_uart_device,
&data, buf_size, DMA_NOT_USE);
if(ret != ADI_UART_SUCCESS)
return ret;
tx_done++;
while(tx_done > 0);
if(tx_done == 0)
return 0;
el... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* returns: 0 on success Negative error code on failure */ | static int overlay_adjust_local_phandles(void *fdto, uint32_t delta) | /* returns: 0 on success Negative error code on failure */
static int overlay_adjust_local_phandles(void *fdto, uint32_t delta) | {
return overlay_adjust_node_phandles (fdto, 0, delta);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Description: Start an audit message using the type specified in @type and fill the audit message with some fields common to all NetLabel audit messages. This function should only be used by protocol engines, not LSMs. Returns a pointer to the audit buffer on success, NULL on failure. */ | struct audit_buffer* netlbl_audit_start(int type, struct netlbl_audit *audit_info) | /* Description: Start an audit message using the type specified in @type and fill the audit message with some fields common to all NetLabel audit messages. This function should only be used by protocol engines, not LSMs. Returns a pointer to the audit buffer on success, NULL on failure. */
struct audit_buffer* netlbl_... | {
return netlbl_audit_start_common(type, audit_info);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Registers an interrupt handler for a GPIO port. */ | void GPIOIntRegister(uint32_t ui32Port, void(*pfnIntHandler)(void)) | /* Registers an interrupt handler for a GPIO port. */
void GPIOIntRegister(uint32_t ui32Port, void(*pfnIntHandler)(void)) | {
uint32_t ui32Int;
ASSERT(_GPIOBaseValid(ui32Port));
ui32Int = _GPIOIntNumberGet(ui32Port);
ASSERT(ui32Int != 0);
IntRegister(ui32Int, pfnIntHandler);
IntEnable(ui32Int);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* process_cpl_msg: -> host Top-level CPL message processing used by most CPL messages that pertain to connections. */ | static void process_cpl_msg(void(*fn)(struct s3_conn *, struct sk_buff *), struct s3_conn *c3cn, struct sk_buff *skb) | /* process_cpl_msg: -> host Top-level CPL message processing used by most CPL messages that pertain to connections. */
static void process_cpl_msg(void(*fn)(struct s3_conn *, struct sk_buff *), struct s3_conn *c3cn, struct sk_buff *skb) | {
spin_lock_bh(&c3cn->lock);
fn(c3cn, skb);
spin_unlock_bh(&c3cn->lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Scroll the display left without changing the RAM */ | void pi_lcd_scroll_left(const struct device *gpio_dev) | /* Scroll the display left without changing the RAM */
void pi_lcd_scroll_left(const struct device *gpio_dev) | {
_pi_lcd_command(gpio_dev, LCD_CURSOR_SHIFT |
LCD_DISPLAY_MOVE | LCD_MOVE_LEFT);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* 0 or more than 0 is returned when validation is succeeded (either bypass because of optional transport mode, or next index of the mathced secpath state with the template. -1 is returned when no matching template is found. Otherwise "-2 - errored_index" is returned. */ | static int xfrm_policy_ok(struct xfrm_tmpl *tmpl, struct sec_path *sp, int start, unsigned short family) | /* 0 or more than 0 is returned when validation is succeeded (either bypass because of optional transport mode, or next index of the mathced secpath state with the template. -1 is returned when no matching template is found. Otherwise "-2 - errored_index" is returned. */
static int xfrm_policy_ok(struct xfrm_tmpl *tmp... | {
int idx = start;
if (tmpl->optional) {
if (tmpl->mode == XFRM_MODE_TRANSPORT)
return start;
} else
start = -1;
for (; idx < sp->len; idx++) {
if (xfrm_state_ok(tmpl, sp->xvec[idx], family))
return ++idx;
if (sp->xvec[idx]->props.mode != XFRM_MODE_TRANSPORT) {
if (start == -1)
start = -2-idx;
... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* IP initialization: fill in IP protocol switch table. All protocols not implemented in kernel go to raw IP protocol handler. */ | void ip_init(Slirp *slirp) | /* IP initialization: fill in IP protocol switch table. All protocols not implemented in kernel go to raw IP protocol handler. */
void ip_init(Slirp *slirp) | {
slirp->ipq.ip_link.next = slirp->ipq.ip_link.prev = &slirp->ipq.ip_link;
udp_init(slirp);
tcp_init(slirp);
icmp_init(slirp);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Set timer counter value. This function is used to set timer clock counter value. */ | void TimerLoadSet(unsigned long ulBase, unsigned long ulValue) | /* Set timer counter value. This function is used to set timer clock counter value. */
void TimerLoadSet(unsigned long ulBase, unsigned long ulValue) | {
xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) ||
(ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) );
xHWREG(ulBase + TIMER_TC) = ulValue;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Sets up the periodic ISR used for the RTOS tick. */ | static void prvSetupTimerInterrupt(void) | /* Sets up the periodic ISR used for the RTOS tick. */
static void prvSetupTimerInterrupt(void) | {
TAU0EN = 1;
TT0 = 0xff;
TMMK05 = 1; TMIF05 = 0;
TMPR005 = 0;
TMPR105 = 0;
TMR05 = 0x0000;
TDR05 = ( portTickType ) ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );
TOM0 &= ~0x0020; TOL0 &= ~0x0020; TOE0 &= ~0x0020;
TMMK05 = 0;
TS0 |= 0x0020;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* strcpy - Copy a NUL terminated string @dest: Where to copy the string to @src: Where to copy the string from */ | char* strcpy(char *dest, const char *src) | /* strcpy - Copy a NUL terminated string @dest: Where to copy the string to @src: Where to copy the string from */
char* strcpy(char *dest, const char *src) | {
char *tmp = dest;
while ((*dest++ = *src++) != '\0');
return tmp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: 0 if scan is not done / 1 if scan is done */ | static int ibmvfc_scan_finished(struct Scsi_Host *shost, unsigned long time) | /* Returns: 0 if scan is not done / 1 if scan is done */
static int ibmvfc_scan_finished(struct Scsi_Host *shost, unsigned long time) | {
unsigned long flags;
struct ibmvfc_host *vhost = shost_priv(shost);
int done = 0;
spin_lock_irqsave(shost->host_lock, flags);
if (time >= (init_timeout * HZ)) {
dev_info(vhost->dev, "Scan taking longer than %d seconds, "
"continuing initialization\n", init_timeout);
done = 1;
}
if (vhost->scan_complete... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function provides a standard way to execute Smbus script as defined in the SmBus Specification. The data can either be of the Length byte, word, or a block of data. */ | UINTN InternalSmBusExec(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *Status OPTIONAL) | /* This function provides a standard way to execute Smbus script as defined in the SmBus Specification. The data can either be of the Length byte, word, or a block of data. */
UINTN InternalSmBusExec(IN EFI_SMBUS_OPERATION SmbusOperation, IN UINTN SmBusAddress, IN UINTN Length, IN OUT VOID *Buffer, OUT RETURN_STATUS *S... | {
RETURN_STATUS ReturnStatus;
EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);
ReturnStatus = mSmbus->Execute (
mSmbus,
SmbusDeviceAddress,
SM... | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the selected DAC channel software trigger. */ | void DAC_SoftwareTriggerCmd(DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState) | /* Enables or disables the selected DAC channel software trigger. */
void DAC_SoftwareTriggerCmd(DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState) | {
assert_param(IS_DAC_ALL_PERIPH(DACx));
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DACx->SWTRIGR |= (uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4);
}
else
{
DACx->SWTRIGR &= ~((uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Chan... | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Function for notifying connection manager event to the application. */ | static __INLINE void app_evt_notify(dm_handle_t const *const p_handle, dm_event_t const *const p_event, uint32_t event_result) | /* Function for notifying connection manager event to the application. */
static __INLINE void app_evt_notify(dm_handle_t const *const p_handle, dm_event_t const *const p_event, uint32_t event_result) | {
dm_event_cb_t app_cb = m_application_table[0].ntf_cb;
DM_MUTEX_UNLOCK();
DM_TRC("[DM]: Notifying application of event 0x%02X\r\n", p_event->event_id);
UNUSED_VARIABLE(app_cb(p_handle, p_event, event_result));
DM_MUTEX_LOCK();
} | labapart/polymcu | C++ | null | 201 |
/* These routines return the length of the address in bytes on success and -1 if the prefix length is too long. */ | int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset, guint8 *addr, guint32 prefix_len) | /* These routines return the length of the address in bytes on success and -1 if the prefix length is too long. */
int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset, guint8 *addr, guint32 prefix_len) | {
guint32 addr_len;
if (prefix_len > 32)
return -1;
addr_len = (prefix_len + 7) / 8;
memset(addr, 0, 4);
tvb_memcpy(tvb, addr, offset, addr_len);
if (prefix_len % 8)
addr[addr_len - 1] &= ((0xff00 >> (prefix_len % 8)) & 0xff);
return addr_len;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enables a Generic Clock Generator that was previously configured.
Starts the clock generation of a Generic Clock Generator that was previously configured via a call to */ | void system_gclk_gen_enable(const uint8_t generator) | /* Enables a Generic Clock Generator that was previously configured.
Starts the clock generation of a Generic Clock Generator that was previously configured via a call to */
void system_gclk_gen_enable(const uint8_t generator) | {
while (system_gclk_is_syncing(generator)) {
};
system_interrupt_enter_critical_section();
GCLK->GENCTRL[generator].reg |= GCLK_GENCTRL_GENEN;
system_interrupt_leave_critical_section();
} | memfault/zero-to-main | C++ | null | 200 |
/* Counts the new reader in the appropriate per-CPU element of the srcu_struct. Must be called from process context. Returns an index that must be passed to the matching srcu_read_unlock(). */ | int srcu_read_lock(struct srcu_struct *sp) | /* Counts the new reader in the appropriate per-CPU element of the srcu_struct. Must be called from process context. Returns an index that must be passed to the matching srcu_read_unlock(). */
int srcu_read_lock(struct srcu_struct *sp) | {
int idx;
preempt_disable();
idx = sp->completed & 0x1;
barrier();
per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]++;
srcu_barrier();
preempt_enable();
return idx;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will initilize the usb class driver related data structure, and it should be invoked in the usb system initialization. */ | rt_err_t rt_usbh_class_driver_init(void) | /* This function will initilize the usb class driver related data structure, and it should be invoked in the usb system initialization. */
rt_err_t rt_usbh_class_driver_init(void) | {
rt_list_init(&_driver_list);
return RT_EOK;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Increments the refcount of the device and it's backend modules */ | static struct uwb_rc* uwb_rc_get(struct uwb_rc *rc) | /* Increments the refcount of the device and it's backend modules */
static struct uwb_rc* uwb_rc_get(struct uwb_rc *rc) | {
if (rc->ready == 0)
return NULL;
uwb_dev_get(&rc->uwb_dev);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocateReservedPool(IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateReserve... | {
return InternalAllocatePool (EfiReservedMemoryType, AllocationSize);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* We do not break out once an IE is found in the cache. It is currently possible to have more than one IE with the same ID included in the beacon. We don't reallocate, we just mark the size smaller. */ | static void uwb_rc_ie_cache_rm(struct uwb_rc *uwb_rc, enum uwb_ie to_remove) | /* We do not break out once an IE is found in the cache. It is currently possible to have more than one IE with the same ID included in the beacon. We don't reallocate, we just mark the size smaller. */
static void uwb_rc_ie_cache_rm(struct uwb_rc *uwb_rc, enum uwb_ie to_remove) | {
struct uwb_ie_hdr *ie;
size_t len = le16_to_cpu(uwb_rc->ies->wIELength);
void *ptr;
size_t size;
ptr = uwb_rc->ies->IEData;
size = len;
for (;;) {
ie = uwb_ie_next(&ptr, &size);
if (!ie)
break;
if (ie->element_id == to_remove) {
len -= sizeof(struct uwb_ie_hdr) + ie->length;
memmove(ie, ptr, siz... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initialization function for the Q31 IIR lattice filter. */ | void arm_iir_lattice_init_q31(arm_iir_lattice_instance_q31 *S, uint16_t numStages, q31_t *pkCoeffs, q31_t *pvCoeffs, q31_t *pState, uint32_t blockSize) | /* Initialization function for the Q31 IIR lattice filter. */
void arm_iir_lattice_init_q31(arm_iir_lattice_instance_q31 *S, uint16_t numStages, q31_t *pkCoeffs, q31_t *pvCoeffs, q31_t *pState, uint32_t blockSize) | {
S->numStages = numStages;
S->pkCoeffs = pkCoeffs;
S->pvCoeffs = pvCoeffs;
memset(pState, 0, (numStages + blockSize) * sizeof(q31_t));
S->pState = pState;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Below here are the bits used by OCFS2_IOC_REFLINK() to fake sys_reflink(). This will go away when vfs_reflink() exists in fs/namei.c. */ | static int ocfs2_may_create(struct inode *dir, struct dentry *child) | /* Below here are the bits used by OCFS2_IOC_REFLINK() to fake sys_reflink(). This will go away when vfs_reflink() exists in fs/namei.c. */
static int ocfs2_may_create(struct inode *dir, struct dentry *child) | {
if (child->d_inode)
return -EEXIST;
if (IS_DEADDIR(dir))
return -ENOENT;
return inode_permission(dir, MAY_WRITE | MAY_EXEC);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clears the states of the RTS modem control signals.
The */ | void xUARTModemControlClear(unsigned long ulBase, unsigned long ulControl) | /* Clears the states of the RTS modem control signals.
The */
void xUARTModemControlClear(unsigned long ulBase, unsigned long ulControl) | {
xASSERT((ulBase == UART0_BASE) ||(ulBase == UART1_BASE) );
xHWREG(ulBase + UART_MCR) &= ~(ulControl & UART_MCR_RTS);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Set the display bottom right drawing limit.
Use this function to set the bottom right corner of the drawing limit box. */ | void ili93xx_set_bottom_right_limit(ili93xx_coord_t x, ili93xx_coord_t y) | /* Set the display bottom right drawing limit.
Use this function to set the bottom right corner of the drawing limit box. */
void ili93xx_set_bottom_right_limit(ili93xx_coord_t x, ili93xx_coord_t y) | {
limit_end_x = x;
limit_end_y = y;
ili93xx_send_draw_limits(true);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base PDM base pointer. param handle PDM eDMA handle pointer. param base PDM peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */ | void PDM_TransferCreateHandleEDMA(PDM_Type *base, pdm_edma_handle_t *handle, pdm_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle) | /* param base PDM base pointer. param handle PDM eDMA handle pointer. param base PDM peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */
void PDM... | {
assert((handle != NULL) && (dmaHandle != NULL));
uint32_t instance = PDM_GetInstance(base);
(void)memset(handle, 0, sizeof(*handle));
handle->dmaHandle = dmaHandle;
handle->callback = callback;
handle->userData = userData;
handle->state = (uint32_t)kPDM_Idle;
s_edmaPrivateHandle[inst... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API is used to parse the aux data from the FIFO data and store it in the instance of the structure bmi160_aux_data. */ | static void unpack_aux_data(struct bmi160_aux_data *aux_data, uint16_t data_start_index, const struct bmi160_dev *dev) | /* This API is used to parse the aux data from the FIFO data and store it in the instance of the structure bmi160_aux_data. */
static void unpack_aux_data(struct bmi160_aux_data *aux_data, uint16_t data_start_index, const struct bmi160_dev *dev) | {
aux_data->data[0] = dev->fifo->data[data_start_index++];
aux_data->data[1] = dev->fifo->data[data_start_index++];
aux_data->data[2] = dev->fifo->data[data_start_index++];
aux_data->data[3] = dev->fifo->data[data_start_index++];
aux_data->data[4] = dev->fifo->data[data_start_index++];
aux_data-... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* The caller must hold sufficient locks to avoid violating the horrible 5uS delay rule. */ | static int z8530_read_port(unsigned long p) | /* The caller must hold sufficient locks to avoid violating the horrible 5uS delay rule. */
static int z8530_read_port(unsigned long p) | {
u8 r=inb(Z8530_PORT_OF(p));
if(p&Z8530_PORT_SLEEP)
udelay(5);
return r;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* assign_aeb_to_av - assigns a SEB to a given ainf_volume and removes it from it's original list. @ai: ubi_attach_info object @aeb: the to be assigned SEB @av: target scan volume */ | static void assign_aeb_to_av(struct ubi_attach_info *ai, struct ubi_ainf_peb *aeb, struct ubi_ainf_volume *av) | /* assign_aeb_to_av - assigns a SEB to a given ainf_volume and removes it from it's original list. @ai: ubi_attach_info object @aeb: the to be assigned SEB @av: target scan volume */
static void assign_aeb_to_av(struct ubi_attach_info *ai, struct ubi_ainf_peb *aeb, struct ubi_ainf_volume *av) | {
struct ubi_ainf_peb *tmp_aeb;
struct rb_node **p = &ai->volumes.rb_node, *parent = NULL;
p = &av->root.rb_node;
while (*p) {
parent = *p;
tmp_aeb = rb_entry(parent, struct ubi_ainf_peb, u.rb);
if (aeb->lnum != tmp_aeb->lnum) {
if (aeb->lnum < tmp_aeb->lnum)
p = &(*p)->rb_left;
else
p = &(*p)->... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel Channel to configure param mode Signal to output when a FORCE_OUT is triggered */ | void PWM_SetupForceSignal(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_force_signal_t mode) | /* param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel Channel to configure param mode Signal to output when a FORCE_OUT is triggered */
void PWM_SetupForceSignal(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_force_signal_t mode) | {
uint16_t shift;
uint16_t reg;
shift = subModule * 4 + pwmChannel * 2;
reg = base->DTSRCSEL;
reg &= ~(0x3U << shift);
reg |= (uint16_t)((uint16_t)mode << shift);
base->DTSRCSEL = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Internal function to add memory write opcode to the table. */ | EFI_STATUS BootScriptWriteMemWrite(IN VA_LIST Marker) | /* Internal function to add memory write opcode to the table. */
EFI_STATUS BootScriptWriteMemWrite(IN VA_LIST Marker) | {
S3_BOOT_SCRIPT_LIB_WIDTH Width;
UINT64 Address;
UINTN Count;
UINT8 *Buffer;
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Address = VA_ARG (Marker, UINT64);
Count = VA_ARG (Marker, UINTN);
Buffer = VA_ARG (Marker, UINT8 *);
return... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function causes a systemwide reset. The exact type of the reset is defined by the EFI_GUID that follows the Null-terminated Unicode string passed into ResetData. If the platform does not recognize the EFI_GUID in ResetData the platform must pick a supported reset type to perform.The platform may optionally log ... | VOID EFIAPI ResetPlatformSpecific(IN UINTN DataSize, IN VOID *ResetData) | /* This function causes a systemwide reset. The exact type of the reset is defined by the EFI_GUID that follows the Null-terminated Unicode string passed into ResetData. If the platform does not recognize the EFI_GUID in ResetData the platform must pick a supported reset type to perform.The platform may optionally log ... | {
gRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask val... | UINT8 EFIAPI PciExpressBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask val... | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT8)-1;
}
return MmioBitFieldAndThenOr8 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
AndData,
OrData
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* mtk_pll_calc_values - calculate good values for a given input frequency. @clk: The clk @pcw: The pcw value (output) @postdiv: The post divider (output) @freq: The desired target frequency */ | static void mtk_pll_calc_values(struct clk *clk, u32 *pcw, u32 *postdiv, u32 freq) | /* mtk_pll_calc_values - calculate good values for a given input frequency. @clk: The clk @pcw: The pcw value (output) @postdiv: The post divider (output) @freq: The desired target frequency */
static void mtk_pll_calc_values(struct clk *clk, u32 *pcw, u32 *postdiv, u32 freq) | {
struct mtk_clk_priv *priv = dev_get_priv(clk->dev);
const struct mtk_pll_data *pll = &priv->tree->plls[clk->id];
unsigned long fmin = 1000 * MHZ;
u64 _pcw;
u32 val;
if (freq > pll->fmax)
freq = pll->fmax;
for (val = 0; val < 5; val++) {
*postdiv = 1 << val;
if ((u64)freq * *postdiv >= fmin)
break;
}
... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ | gboolean _g_freedesktop_dbus_call_hello_finish(_GFreedesktopDBus *proxy, gchar **out_assigned_name, GAsyncResult *res, GError **error) | /* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_hello_finish(_GFreedesktopDBus *proxy, gchar **out_assigned_name, GAsyncResult *res, GError **error) | {
GVariant *_ret;
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"(s)",
out_assigned_name);
g_variant_unref (_ret);
_out:
return _ret != NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Sets the timer load value for a 64-bit timer. */ | void TimerLoadSet64(uint32_t ui32Base, uint64_t ui64Value) | /* Sets the timer load value for a 64-bit timer. */
void TimerLoadSet64(uint32_t ui32Base, uint64_t ui64Value) | {
ASSERT(_TimerBaseValid(ui32Base));
HWREG(ui32Base + TIMER_O_TBILR) = ui64Value >> 32;
HWREG(ui32Base + TIMER_O_TAILR) = ui64Value & 0xffffffff;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Enter Power Down mode with co-operated instruction by the Cortex-M3. */ | void CLKPWR_PowerDown(void) | /* Enter Power Down mode with co-operated instruction by the Cortex-M3. */
void CLKPWR_PowerDown(void) | {
SCB->SCR = 0x4;
LPC_SC->PCON = 0x09;
__WFI();
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Figure out if BCM5482 is in serdes or copper mode and determine link configuration accordingly */ | static int bcm5482_startup(struct phy_device *phydev) | /* Figure out if BCM5482 is in serdes or copper mode and determine link configuration accordingly */
static int bcm5482_startup(struct phy_device *phydev) | {
int ret;
if (bcm5482_is_serdes(phydev)) {
bcm5482_parse_serdes_sr(phydev);
phydev->port = PORT_FIBRE;
return 0;
}
ret = genphy_update_link(phydev);
if (ret)
return ret;
return bcm54xx_parse_status(phydev);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* ide_error() takes action based on the error returned by the drive. For normal I/O that may well include retries. We deal with both new-style (taskfile) and old style command handling here. In the case of taskfile command handling there is work left to do */ | ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) | /* ide_error() takes action based on the error returned by the drive. For normal I/O that may well include retries. We deal with both new-style (taskfile) and old style command handling here. In the case of taskfile command handling there is work left to do */
ide_startstop_t ide_error(ide_drive_t *drive, const char *... | {
struct request *rq;
u8 err;
err = ide_dump_status(drive, msg, stat);
rq = drive->hwif->rq;
if (rq == NULL)
return ide_stopped;
if (!blk_fs_request(rq)) {
if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
struct ide_cmd *cmd = rq->special;
if (cmd)
ide_complete_cmd(drive, cmd, stat, err);
} else if (b... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Open the blockdevice described by the special file at @path, claim it for the @holder. */ | struct block_device* open_bdev_exclusive(const char *path, fmode_t mode, void *holder) | /* Open the blockdevice described by the special file at @path, claim it for the @holder. */
struct block_device* open_bdev_exclusive(const char *path, fmode_t mode, void *holder) | {
struct block_device *bdev;
int error = 0;
bdev = lookup_bdev(path);
if (IS_ERR(bdev))
return bdev;
error = blkdev_get(bdev, mode);
if (error)
return ERR_PTR(error);
error = -EACCES;
if ((mode & FMODE_WRITE) && bdev_read_only(bdev))
goto blkdev_put;
error = bd_claim(bdev, holder);
if (error)
goto blk... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 on success, or EBUSY on error. A warning message is also printed on failure. */ | int pci_request_regions(struct pci_dev *pdev, const char *res_name) | /* Returns 0 on success, or EBUSY on error. A warning message is also printed on failure. */
int pci_request_regions(struct pci_dev *pdev, const char *res_name) | {
return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get positive or negative noise threshold for specified channel. */ | u32 CapTouch_GetNoiseThres(CAPTOUCH_TypeDef *CapTouch, u8 Channel, u8 type) | /* Get positive or negative noise threshold for specified channel. */
u32 CapTouch_GetNoiseThres(CAPTOUCH_TypeDef *CapTouch, u8 Channel, u8 type) | { u8 value;
assert_param(IS_CAPTOUCH_ALL_PERIPH(CapTouch));
assert_param(IS_CT_CHANNEL(Channel));
if(type)
value = (CapTouch->CT_CH[Channel].ATHR & BIT_MASK_CHX_N_ENT) >> 24;
else
value = (CapTouch->CT_CH[Channel].ATHR & BIT_MASK_CHX_P_ENT) >> 16;
return value;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Resume from a power safe. The BIOS already restored the TPM state. */ | int tpm_pm_resume(struct device *dev) | /* Resume from a power safe. The BIOS already restored the TPM state. */
int tpm_pm_resume(struct device *dev) | {
struct tpm_chip *chip = dev_get_drvdata(dev);
if (chip == NULL)
return -ENODEV;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns an 32bit unfolded checksum of the buffer. src and dst are best aligned to 64bits. */ | __wsum csum_partial_copy_to_user(const void *src, void __user *dst, int len, __wsum isum, int *errp) | /* Returns an 32bit unfolded checksum of the buffer. src and dst are best aligned to 64bits. */
__wsum csum_partial_copy_to_user(const void *src, void __user *dst, int len, __wsum isum, int *errp) | {
might_sleep();
if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) {
*errp = -EFAULT;
return 0;
}
if (unlikely((unsigned long)dst & 6)) {
while (((unsigned long)dst & 6) && len >= 2) {
__u16 val16 = *(__u16 *)src;
isum = (__force __wsum)add32_with_carry(
(__force unsigned)isum, val16);
*errp = _... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is obviously inefficient and may be revised in the future. */ | struct mon_bus* mon_bus_lookup(unsigned int num) | /* This is obviously inefficient and may be revised in the future. */
struct mon_bus* mon_bus_lookup(unsigned int num) | {
struct list_head *p;
struct mon_bus *mbus;
if (num == 0) {
return &mon_bus0;
}
list_for_each (p, &mon_buses) {
mbus = list_entry(p, struct mon_bus, bus_link);
if (mbus->u_bus->busnum == num) {
return mbus;
}
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the GPIO port from a short Pin. */ | unsigned long GPIOPinToPort(unsigned long ulPort, unsigned long ulPin) | /* Get the GPIO port from a short Pin. */
unsigned long GPIOPinToPort(unsigned long ulPort, unsigned long ulPin) | {
xASSERT(GPIOBaseValid(ulPort));
return ulPort;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Blank the display based on value in blank_mode */ | static int w100fb_blank(int blank_mode, struct fb_info *info) | /* Blank the display based on value in blank_mode */
static int w100fb_blank(int blank_mode, struct fb_info *info) | {
struct w100fb_par *par = info->par;
struct w100_tg_info *tg = par->mach->tg;
switch(blank_mode) {
case FB_BLANK_NORMAL:
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
case FB_BLANK_POWERDOWN:
if (par->blanked == 0) {
if(tg && tg->suspend)
tg->suspend(par);
par->blanked = 1;
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The layout of the ibm,dynamic-memory property is a number N of lmb list entries followed by N lmb list entries. Each lmb list entry contains information as layed out in the */ | static int of_get_drconf_memory(struct device_node *memory, const u32 **dm) | /* The layout of the ibm,dynamic-memory property is a number N of lmb list entries followed by N lmb list entries. Each lmb list entry contains information as layed out in the */
static int of_get_drconf_memory(struct device_node *memory, const u32 **dm) | {
const u32 *prop;
u32 len, entries;
prop = of_get_property(memory, "ibm,dynamic-memory", &len);
if (!prop || len < sizeof(unsigned int))
return 0;
entries = *prop++;
if (len < (entries * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int))
return 0;
*dm = prop;
return entries;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Stop ADC conversion, both sequence A and sequence B. */ | void ADC_Stop(CM_ADC_TypeDef *ADCx) | /* Stop ADC conversion, both sequence A and sequence B. */
void ADC_Stop(CM_ADC_TypeDef *ADCx) | {
DDL_ASSERT(IS_ADC_UNIT(ADCx));
WRITE_REG8(ADCx->STR, 0U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Retrieve the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. */ | EFI_STATUS MpServicesUnitTestGetNumberOfProcessors(IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors) | /* Retrieve the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. */
EFI_STATUS MpServicesUnitTestGetNumberOfProcessors(IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors) | {
return MpServices.Ppi->GetNumberOfProcessors (MpServices.Ppi, NumberOfProcessors, NumberOfEnabledProcessors);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the deep sleep behavior when VDD/VDCIN is not drop. */ | void PMU_PDNDSleepConfig(uint32_t VDCIN_PDNS, uint32_t VDD_PDNS) | /* Set the deep sleep behavior when VDD/VDCIN is not drop. */
void PMU_PDNDSleepConfig(uint32_t VDCIN_PDNS, uint32_t VDD_PDNS) | {
uint32_t tmp;
assert_parameters(IS_PMU_VDCINPDNS(VDCIN_PDNS));
assert_parameters(IS_PMU_VDDPDNS(VDD_PDNS));
tmp = ANA->CTRL;
tmp &= ~(ANA_CTRL_PDNS | ANA_CTRL_PDNS2);
tmp |= (VDCIN_PDNS | VDD_PDNS);
ANA->CTRL = tmp;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.