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
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */
CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */ CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
{ return (CONST EFI_PEI_SERVICES **)ArmReadTpidrurw (); }
tianocore/edk2
C++
Other
4,240
/* Initializes cel evaluators and sets their source coordinates */
static void create_cel_evals(RoqContext *enc, RoqTempdata *tempData)
/* Initializes cel evaluators and sets their source coordinates */ static void create_cel_evals(RoqContext *enc, RoqTempdata *tempData)
{ int n=0, x, y, i; tempData->cel_evals = av_malloc(enc->width*enc->height/64 * sizeof(CelEvaluation)); for (y=0; y<enc->height; y+=16) for (x=0; x<enc->width; x+=16) for(i=0; i<4; i++) { tempData->cel_evals[n ].sourceX = x + (i&1)*8; tempData->cel_evals[...
DC-SWAT/DreamShell
C++
null
404
/* Clear out all data in the circular buffer. */
static void cypress_buf_clear(struct cypress_buf *cb)
/* Clear out all data in the circular buffer. */ static void cypress_buf_clear(struct cypress_buf *cb)
{ if (cb != NULL) cb->buf_get = cb->buf_put; }
robutest/uclinux
C++
GPL-2.0
60
/* Get Alert Level for the immedaite alert service. This funtions is used to get the most recent alert level for the immediate alert service. */
ADI_BLE_ALERT_LEVEL adi_ble_GetImmediateAlertLevel(void)
/* Get Alert Level for the immedaite alert service. This funtions is used to get the most recent alert level for the immediate alert service. */ ADI_BLE_ALERT_LEVEL adi_ble_GetImmediateAlertLevel(void)
{ return (pBLERadio->sImmAlertLevel.eAlertLevel); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_om_parser_simply_parse_buf(const guchar *a_buf, gulong a_len, enum CREncoding a_enc, CRStyleSheet **a_result)
/* Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_om_parser_simply_parse_buf(const guchar *a_buf, gulong a_len, enum CREncoding a_enc, CRStyleSheet **a_result)
{ CROMParser *parser = NULL; enum CRStatus status = CR_OK; parser = cr_om_parser_new (NULL); if (!parser) { cr_utils_trace_info ("Could not create om parser"); cr_utils_trace_info ("System possibly out of memory"); return CR_ERROR; ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Handles an incoming ATT error response for the specified mtu-exchange proc. */
static void ble_gattc_mtu_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified mtu-exchange proc. */ static void ble_gattc_mtu_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); ble_gattc_mtu_cb(proc, status, att_handle, 0); }
Nicholas3388/LuaNode
C++
Other
1,055
/* The minimum duration (LSb = 1/ODR) of the Interrupt 1 event to be recognized.. */
int32_t lis2dh12_int2_gen_duration_get(stmdev_ctx_t *ctx, uint8_t *val)
/* The minimum duration (LSb = 1/ODR) of the Interrupt 1 event to be recognized.. */ int32_t lis2dh12_int2_gen_duration_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_int2_duration_t int2_duration; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_INT2_DURATION, (uint8_t *)&int2_duration, 1); *val = (uint8_t)int2_duration.d; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* phys_device is a bad name for this. What I really want is a way to differentiate between memory ranges that are part of physical devices that constitute a complete removable unit or fru. i.e. do these ranges belong to the same physical device, s.t. if I offline all of these sections I can then remove the physical de...
static ssize_t show_phys_device(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
/* phys_device is a bad name for this. What I really want is a way to differentiate between memory ranges that are part of physical devices that constitute a complete removable unit or fru. i.e. do these ranges belong to the same physical device, s.t. if I offline all of these sections I can then remove the physical de...
{ struct memory_block *mem = container_of(dev, struct memory_block, sysdev); return sprintf(buf, "%d\n", mem->phys_device); }
robutest/uclinux
C++
GPL-2.0
60
/* mpt_add_chain - Place a 32 bit chain SGE at address pAddr. @pAddr: virtual address for SGE @next: nextChainOffset value (u32's) @length: length of next SGL segment @dma_addr: Physical address */
static void mpt_add_chain(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr)
/* mpt_add_chain - Place a 32 bit chain SGE at address pAddr. @pAddr: virtual address for SGE @next: nextChainOffset value (u32's) @length: length of next SGL segment @dma_addr: Physical address */ static void mpt_add_chain(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr)
{ SGEChain32_t *pChain = (SGEChain32_t *) pAddr; pChain->Length = cpu_to_le16(length); pChain->Flags = MPI_SGE_FLAGS_CHAIN_ELEMENT; pChain->NextChainOffset = next; pChain->Address = cpu_to_le32(dma_addr); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified I2C acknowledge feature. */
void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables the specified I2C acknowledge feature. */ void I2C_AcknowledgeConfig(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { I2Cx->CR1 |= I2C_CR1_ACK; } else { I2Cx->CR1 &= (uint16_t)~((uint16_t)I2C_CR1_ACK); } }
MaJerle/stm32f429
C++
null
2,036
/* Convert a hex number to its ASCII code. */
UINT8 EFIAPI AsciiFromHex(IN UINT8 Hex)
/* Convert a hex number to its ASCII code. */ UINT8 EFIAPI AsciiFromHex(IN UINT8 Hex)
{ if (Hex < 10) { return (UINT8)(Hex + '0'); } if (Hex < 16) { return (UINT8)(Hex - 10 + 'A'); } ASSERT (FALSE); return (UINT8)-1; }
tianocore/edk2
C++
Other
4,240
/* Returns a vector_desc entry for an source, the cpu parameter is used to tell GPIO_INT and GPIO_NMI from different CPUs */
static struct vector_desc_t* find_desc_for_source(int source, int cpu)
/* Returns a vector_desc entry for an source, the cpu parameter is used to tell GPIO_INT and GPIO_NMI from different CPUs */ static struct vector_desc_t* find_desc_for_source(int source, int cpu)
{ struct vector_desc_t *vd = vector_desc_head; while (vd != NULL) { if (!(vd->flags & VECDESC_FL_SHARED)) { if (vd->source == source && cpu == vd->cpu) { break; } } else if (vd->cpu == cpu) { bool found = false; struct shared_vector_desc_t *svd = vd->shared_vec_info; assert(svd != NULL); whi...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Reads the microcode signature from architectural MSR 0x8B. */
UINT32 GetMicrocodeSignature(VOID)
/* Reads the microcode signature from architectural MSR 0x8B. */ UINT32 GetMicrocodeSignature(VOID)
{ MSR_IA32_BIOS_SIGN_ID_REGISTER BiosSignIdMsr; AsmWriteMsr64 (MSR_IA32_BIOS_SIGN_ID, 0); AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, NULL, NULL); BiosSignIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_BIOS_SIGN_ID); return BiosSignIdMsr.Bits.MicrocodeUpdateSignature; }
tianocore/edk2
C++
Other
4,240
/* Get a pressure sample from a specified sensor. This returns the scaled value of a pressure sample taken from a user-specified pressure sensor. */
static int32_t barometric_pressure(sensor_t *sensor)
/* Get a pressure sample from a specified sensor. This returns the scaled value of a pressure sample taken from a user-specified pressure sensor. */ static int32_t barometric_pressure(sensor_t *sensor)
{ sensor_data_t data; data.scaled = true; sensor_get_pressure(sensor, &data); return *(data.value); }
memfault/zero-to-main
C++
null
200
/* Change Logs: Date Author Notes Bernard the first version */
int main(int argc, char **argv)
/* Change Logs: Date Author Notes Bernard the first version */ int main(int argc, char **argv)
{ rt_kprintf("periph_get_pll_clk:%d\n", periph_get_pll_clk()); rt_kprintf("cpu_get_clk:%d\n", cpu_get_clk()); rt_kprintf("ahb_get_clk:%d\n", ahb_get_clk()); rt_kprintf("apb_get_clk:%d\n", apb_get_clk()); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base I2C base pointer. param handle pointer to i2c_master_handle_t structure which stores the transfer state. param xfer pointer to i2c_master_transfer_t structure. retval kStatus_Success Successfully start the data transmission. retval kStatus_I2C_Busy Previous transmission still not finished. retval kStatus_...
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer)
/* param base I2C base pointer. param handle pointer to i2c_master_handle_t structure which stores the transfer state. param xfer pointer to i2c_master_transfer_t structure. retval kStatus_Success Successfully start the data transmission. retval kStatus_I2C_Busy Previous transmission still not finished. retval kStatus_...
{ assert(NULL != handle); assert(NULL != xfer); status_t result = kStatus_Success; if (handle->state != (uint8_t)kIdleState) { result = kStatus_I2C_Busy; } else { result = I2C_InitTransferStateMachine(base, handle, xfer); if (result == kStatus_Success) { ...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This is kind of nasty. Hardware using Intel chipsets may require the video opregion code to be run first in order to initialise state before any ACPI video calls are made. To handle this we defer registration of the video class until the opregion code has run. */
static int __init acpi_video_init(void)
/* This is kind of nasty. Hardware using Intel chipsets may require the video opregion code to be run first in order to initialise state before any ACPI video calls are made. To handle this we defer registration of the video class until the opregion code has run. */ static int __init acpi_video_init(void)
{ dmi_check_system(video_dmi_table); if (intel_opregion_present()) return 0; return acpi_video_register(); }
robutest/uclinux
C++
GPL-2.0
60
/* Notes: There is no timeout for this operation. if this operation is unreliable for a given host, then the host itself needs to put a timer on it, and set the host back to a consistent state prior to returning. */
static int scsi_try_target_reset(struct scsi_cmnd *scmd)
/* Notes: There is no timeout for this operation. if this operation is unreliable for a given host, then the host itself needs to put a timer on it, and set the host back to a consistent state prior to returning. */ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
{ unsigned long flags; int rtn; if (!scmd->device->host->hostt->eh_target_reset_handler) return FAILED; rtn = scmd->device->host->hostt->eh_target_reset_handler(scmd); if (rtn == SUCCESS) { spin_lock_irqsave(scmd->device->host->host_lock, flags); __starget_for_each_device(scsi_target(scmd->device), NULL, ...
robutest/uclinux
C++
GPL-2.0
60
/* Read BufferSize bytes from Offset into Buffer. Reads may support reads that are not aligned on sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the read request is less than a sector in length. Aligned - A read of N contiguous sectors. OverRun - The last byte is not ...
EFI_STATUS EFIAPI DiskIoReadDisk(IN EFI_DISK_IO_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, OUT VOID *Buffer)
/* Read BufferSize bytes from Offset into Buffer. Reads may support reads that are not aligned on sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the read request is less than a sector in length. Aligned - A read of N contiguous sectors. OverRun - The last byte is not ...
{ return DiskIo2ReadWriteDisk ( DISK_IO_PRIVATE_DATA_FROM_DISK_IO (This), FALSE, MediaId, Offset, NULL, BufferSize, (UINT8 *)Buffer ); }
tianocore/edk2
C++
Other
4,240
/* Event handler for the library USB mode change event. */
void EVENT_USB_UIDChange(void)
/* Event handler for the library USB mode change event. */ void EVENT_USB_UIDChange(void)
{ printf_P(PSTR(ESC_FG_YELLOW "UID Change to %S mode\r\n" ESC_FG_WHITE), (USB_CurrentMode == USB_MODE_Device) ? PSTR("Device") : PSTR("Host")); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Add the resolved addresses that are in use to the list used to create the NRB */
static void ipv4_hash_table_resolved_to_list(gpointer key _U_, gpointer value, gpointer user_data)
/* Add the resolved addresses that are in use to the list used to create the NRB */ static void ipv4_hash_table_resolved_to_list(gpointer key _U_, gpointer value, gpointer user_data)
{ addrinfo_lists_t *lists = (addrinfo_lists_t*)user_data; hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *)value; if ((ipv4_hash_table_entry->flags & USED_AND_RESOLVED_MASK) == RESOLVED_ADDRESS_USED) { lists->ipv4_addr_list = g_list_prepend(lists->ipv4_addr_list, ipv4_hash_table_entry); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called at device close to release the file's handle references on objects. */
static int drm_gem_object_release_handle(int id, void *ptr, void *data)
/* Called at device close to release the file's handle references on objects. */ static int drm_gem_object_release_handle(int id, void *ptr, void *data)
{ struct drm_gem_object *obj = ptr; drm_gem_object_handle_unreference(obj); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* compare two timers' target values, return the one with lower value. if either is NULL, return the other. if both are NULL, return NULL. */
static xtimer_t* _compare(xtimer_t *a, xtimer_t *b)
/* compare two timers' target values, return the one with lower value. if either is NULL, return the other. if both are NULL, return NULL. */ static xtimer_t* _compare(xtimer_t *a, xtimer_t *b)
{ if (a && b) { return a->target <= b->target ? a : b; } else { return a ? a : b; } }
labapart/polymcu
C++
null
201
/* Complete the clone and the original request with the error status through softirq context. */
static void dm_complete_request(struct request *clone, int error)
/* Complete the clone and the original request with the error status through softirq context. */ static void dm_complete_request(struct request *clone, int error)
{ struct dm_rq_target_io *tio = clone->end_io_data; struct request *rq = tio->orig; if (unlikely(blk_barrier_rq(clone))) { dm_done(clone, error, true); return; } tio->error = error; rq->completion_data = clone; blk_complete_request(rq); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable/disable the DIV_ONE feature of the specified SPI port. When this fuction is enabled, both the REORDER field and the VARCLK_EN field must be configured as 0. In other words, the byte-reorder function, byte suspend function and variable clock function must be disable. */
void SPIDivOneFunction(unsigned long ulBase, xtBoolean xtEnable)
/* Enable/disable the DIV_ONE feature of the specified SPI port. When this fuction is enabled, both the REORDER field and the VARCLK_EN field must be configured as 0. In other words, the byte-reorder function, byte suspend function and variable clock function must be disable. */ void SPIDivOneFunction(unsigned long ul...
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); if (xtEnable) { xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_DIV_ONE; xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_VARCLK_EN; xHWREG(ulBase + SPI_CNTRL) &= (~SPI_CNTRL_REORDER_M); } else { xHWREG(ulBase + SPI_CN...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Checks whether the FLASH Read out Protection Status is set or not. */
FlagStatus FLASH_OB_GetRDP(void)
/* Checks whether the FLASH Read out Protection Status is set or not. */ FlagStatus FLASH_OB_GetRDP(void)
{ FlagStatus readstatus = RESET; if ((uint8_t)(FLASH->OBR & (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2)) != RESET) { readstatus = SET; } else { readstatus = RESET; } return readstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handler installed in the vector table. Simply call what is installed in 'static void(*handler)(void)'. */
void z_arm_nmi(void)
/* Handler installed in the vector table. Simply call what is installed in 'static void(*handler)(void)'. */ void z_arm_nmi(void)
{ handler(); z_arm_int_exit(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* We have to disable the codec interrupt in the handler because it can take upto 1ms to clear the interrupt source. We schedule a task in a work queue to do the actual interaction with the chip. The interrupt is then enabled again in the slow handler when the source has been cleared. */
static irqreturn_t wm97xx_pen_interrupt(int irq, void *dev_id)
/* We have to disable the codec interrupt in the handler because it can take upto 1ms to clear the interrupt source. We schedule a task in a work queue to do the actual interaction with the chip. The interrupt is then enabled again in the slow handler when the source has been cleared. */ static irqreturn_t wm97xx_pen_...
{ struct wm97xx *wm = dev_id; if (!work_pending(&wm->pen_event_work)) { wm->mach_ops->irq_enable(wm, 0); queue_work(wm->ts_workq, &wm->pen_event_work); } return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable the LS clock source connection to TIM for measurement. */
void BEEP_LSClockToTIMConnectCmd(FunctionalState NewState)
/* Enable or disable the LS clock source connection to TIM for measurement. */ void BEEP_LSClockToTIMConnectCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { BEEP->CSR1 |= BEEP_CSR1_MSR; } else { BEEP->CSR1 &= (uint8_t)(~BEEP_CSR1_MSR); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetFlagStatus(TIM_Module *TIMx, uint32_t TIM_FLAG)
/* Checks whether the specified TIM flag is set or not. */ FlagStatus TIM_GetFlagStatus(TIM_Module *TIMx, uint32_t TIM_FLAG)
{ INTStatus bitstatus = RESET; assert_param(IsTimAllModule(TIMx)); assert_param(IsTimGetFlag(TIM_FLAG)); if ((TIMx->STS & TIM_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
pikasTech/PikaPython
C++
MIT License
1,403
/* The timer is only armed if the neh is active. */
void uwb_rc_neh_arm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
/* The timer is only armed if the neh is active. */ void uwb_rc_neh_arm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
{ unsigned long flags; spin_lock_irqsave(&rc->neh_lock, flags); if (neh->context) mod_timer(&neh->timer, jiffies + msecs_to_jiffies(UWB_RC_CMD_TIMEOUT_MS)); spin_unlock_irqrestore(&rc->neh_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* @device_path 1st device path @device_path_instance 2nd device path */
static struct efi_device_path* EFIAPI append_device_path_instance(const struct efi_device_path *device_path, const struct efi_device_path *device_path_instance)
/* @device_path 1st device path @device_path_instance 2nd device path */ static struct efi_device_path* EFIAPI append_device_path_instance(const struct efi_device_path *device_path, const struct efi_device_path *device_path_instance)
{ EFI_ENTRY("%pD, %pD", device_path, device_path_instance); return EFI_EXIT(efi_dp_append_instance(device_path, device_path_instance)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Decodes the message length according to the MQTT algorithm */
int mqtt_packet_decode(int(*getcharfn)(unsigned char *, int), int *value)
/* Decodes the message length according to the MQTT algorithm */ int mqtt_packet_decode(int(*getcharfn)(unsigned char *, int), int *value)
{ unsigned char c; int multiplier = 1; int len = 0; #define MAX_NO_OF_REMAINING_LENGTH_BYTES 4 FUNC_ENTRY; *value = 0; do { int rc = MQTTPACKET_READ_ERROR; if (++len > MAX_NO_OF_REMAINING_LENGTH_BYTES) { rc = MQTTPACKET_READ_ERROR; goto exit; } rc = (*getcharfn)(&c, 1); if (rc != 1) goto exi...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* CLI command to read and display a device register. */
int32_t ad7124_8pmdz_reg_read(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
/* CLI command to read and display a device register. */ int32_t ad7124_8pmdz_reg_read(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
{ uint8_t reg_addr; int32_t ret; uint8_t buff[50]; reg_addr = strtol((char *)arg, NULL, 16); if (reg_addr >= AD7124_REG_NO) return cli_write_string(dev->cli_handler, (uint8_t*)"Wrong register address.\n"); ret = ad7124_read_register(dev->ad7124_handler, &dev->ad7124_handler->regs[reg_addr]); if(ret...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* this function set PLL P, M and S value in D-PHY */
void exynos_mipi_dsi_set_phy_tunning(struct mipi_dsim_device *dsim, unsigned int value)
/* this function set PLL P, M and S value in D-PHY */ void exynos_mipi_dsi_set_phy_tunning(struct mipi_dsim_device *dsim, unsigned int value)
{ struct exynos_mipi_dsim *mipi_dsim = (struct exynos_mipi_dsim *)samsung_get_base_mipi_dsim(); writel(DSIM_AFC_CTL(value), &mipi_dsim->phyacchr); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Registers an asynchronous callback function with the driver. Registers an asynchronous callback with the DAC driver, fired when a callback condition occurs. */
enum status_code dac_register_callback(struct dac_module *const module_inst, const enum dac_channel channel, const dac_callback_t callback, const enum dac_callback type)
/* Registers an asynchronous callback function with the driver. Registers an asynchronous callback with the DAC driver, fired when a callback condition occurs. */ enum status_code dac_register_callback(struct dac_module *const module_inst, const enum dac_channel channel, const dac_callback_t callback, const enum dac_c...
{ Assert(module_inst); Assert(callback); if (module_inst->start_on_event[channel] == false) { return STATUS_ERR_UNSUPPORTED_DEV; } if ((uint8_t)type < DAC_CALLBACK_N) { module_inst->callback[channel][(uint8_t)type] = callback; return STATUS_OK; } return STATUS_ERR_INVALID_ARG; }
memfault/zero-to-main
C++
null
200
/* update the contents of the FRV userspace FP/Media registers */
static int fpmregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf)
/* update the contents of the FRV userspace FP/Media registers */ static int fpmregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf)
{ struct user_fpmedia_regs *fpregs = &target->thread.user->f; int ret; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, fpregs, 0, sizeof(*fpregs)); if (ret < 0) return ret; return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, sizeof(*fpregs), -1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Cause a EXTI Event trigger for a sample sequence. */
void ADCExtiEventTrigger(unsigned long ulBase)
/* Cause a EXTI Event trigger for a sample sequence. */ void ADCExtiEventTrigger(unsigned long ulBase)
{ xASSERT(ulBase == ADC_BASE); xHWREG(ulBase + ADC_TCR) |= ADC_TCR_ADEXTI_EN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Weight of XL user offset bits of registers X_OFS_USR (73h), Y_OFS_USR (74h), Z_OFS_USR (75h).. */
int32_t lsm6dso_xl_offset_weight_set(lsm6dso_ctx_t *ctx, lsm6dso_usr_off_w_t val)
/* Weight of XL user offset bits of registers X_OFS_USR (73h), Y_OFS_USR (74h), Z_OFS_USR (75h).. */ int32_t lsm6dso_xl_offset_weight_set(lsm6dso_ctx_t *ctx, lsm6dso_usr_off_w_t val)
{ lsm6dso_ctrl6_c_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL6_C, (uint8_t*)&reg, 1); if (ret == 0) { reg.usr_off_w = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL6_C, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Validate the FormSet. If the formset is not validate, remove it from the list. */
BOOLEAN ValidateFormSet(FORM_BROWSER_FORMSET *FormSet)
/* Validate the FormSet. If the formset is not validate, remove it from the list. */ BOOLEAN ValidateFormSet(FORM_BROWSER_FORMSET *FormSet)
{ BOOLEAN Find; ASSERT (FormSet != NULL); Find = ValidateHiiHandle (FormSet->HiiHandle); if (!Find && (FormSet != gCurrentSelection->FormSet)) { CleanBrowserStorage (FormSet); RemoveEntryList (&FormSet->Link); DestroyFormSet (FormSet); } return Find; }
tianocore/edk2
C++
Other
4,240
/* The byte ordering of bitmaps is more natural on little endian architectures. */
int slow_bitmap_empty(const unsigned long *bitmap, long bits)
/* The byte ordering of bitmaps is more natural on little endian architectures. */ int slow_bitmap_empty(const unsigned long *bitmap, long bits)
{ long k, lim = bits/BITS_PER_LONG; for (k = 0; k < lim; ++k) { if (bitmap[k]) { return 0; } } if (bits % BITS_PER_LONG) { if (bitmap[k] & BITMAP_LAST_WORD_MASK(bits)) { return 0; } } return 1; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Command response callback function for sd_ble_uuid_decode BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t uuid_decode_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_uuid_decode BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t uuid_decode_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_uuid_decode_rsp_dec(p_buffer, length, (ble_uuid_t * *)&mp_out_params[0], &result_code); APP_...
labapart/polymcu
C++
null
201
/* Schedule a procedure to run on the specified CPU in blocking mode. */
EFI_STATUS EFIAPI SmmBlockingStartupThisAp(IN EFI_AP_PROCEDURE Procedure, IN UINTN CpuIndex, IN OUT VOID *ProcArguments OPTIONAL)
/* Schedule a procedure to run on the specified CPU in blocking mode. */ EFI_STATUS EFIAPI SmmBlockingStartupThisAp(IN EFI_AP_PROCEDURE Procedure, IN UINTN CpuIndex, IN OUT VOID *ProcArguments OPTIONAL)
{ PROCEDURE_WRAPPER Wrapper; Wrapper.Procedure = Procedure; Wrapper.ProcedureArgument = ProcArguments; return InternalSmmStartupThisAp (ProcedureWrapper, CpuIndex, &Wrapper, NULL, 0, NULL); }
tianocore/edk2
C++
Other
4,240
/* Converts a text device path node to USB wireless device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbWireless(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB wireless device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbWireless(IN CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_WIRELESS; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* Handler for the CMD_LOAD_ADDRESS command, loading the given device address into a global storage variable for later use, and issuing LOAD EXTENDED ADDRESS commands to the attached device as required. */
static void V2Protocol_LoadAddress(void)
/* Handler for the CMD_LOAD_ADDRESS command, loading the given device address into a global storage variable for later use, and issuing LOAD EXTENDED ADDRESS commands to the attached device as required. */ static void V2Protocol_LoadAddress(void)
{ Endpoint_Read_Stream_BE(&CurrentAddress, sizeof(CurrentAddress), NULL); Endpoint_ClearOUT(); Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPADDR); Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN); if (CurrentAddress & (1UL << 31)) MustLoadExtendedAddress = true; Endpoint_Write_8(CMD_LOAD_ADDRESS); Endpoint_Write_8(...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* If PackageListGuid is NULL, then ASSERT(). If StringId is 0, then ASSERT. */
EFI_STRING EFIAPI HiiGetPackageString(IN CONST EFI_GUID *PackageListGuid, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
/* If PackageListGuid is NULL, then ASSERT(). If StringId is 0, then ASSERT. */ EFI_STRING EFIAPI HiiGetPackageString(IN CONST EFI_GUID *PackageListGuid, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
{ EFI_HII_HANDLE *HiiHandleBuffer; EFI_HII_HANDLE HiiHandle; ASSERT (PackageListGuid != NULL); HiiHandleBuffer = HiiGetHiiHandles (PackageListGuid); if (HiiHandleBuffer == NULL) { return NULL; } HiiHandle = HiiHandleBuffer[0]; FreePool (HiiHandleBuffer); return HiiGetString (HiiHandle, StringId,...
tianocore/edk2
C++
Other
4,240
/* 6.. FMS Define Variable List (Confirmed Service Id = 7) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_def_variable_list_req_list_of_idxes(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 value)
/* 6.. FMS Define Variable List (Confirmed Service Id = 7) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_def_variable_list_req_list_of_idxes(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 value)
{ proto_tree *sub_tree; guint d; if (!tree) { return; } sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 * value, ett_ff_fms_def_variable_list_req_list_of_idxes, NULL, "List Of Indexes (%u bytes)", 4 * value); for (d = 0; d < value; d++) { proto_tree_ad...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Unregisters the I2O bus and frees driver array. */
void i2o_driver_exit(void)
/* Unregisters the I2O bus and frees driver array. */ void i2o_driver_exit(void)
{ bus_unregister(&i2o_bus_type); kfree(i2o_drivers); }
robutest/uclinux
C++
GPL-2.0
60
/* Asserts RESET, CLR or LDAC in a software manner. */
int32_t ad5791_soft_instruction(struct ad5791_dev *dev, uint8_t instruction_bit)
/* Asserts RESET, CLR or LDAC in a software manner. */ int32_t ad5791_soft_instruction(struct ad5791_dev *dev, uint8_t instruction_bit)
{ int32_t status = 0; status = ad5791_set_register_value(dev, AD5791_CMD_WR_SOFT_CTRL, instruction_bit); if(status < 0) { return status; } mdelay(1); return status; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Each logical counter has a corresponding control register. */
void ps3_write_pm07_control(u32 cpu, u32 ctr, u32 val)
/* Each logical counter has a corresponding control register. */ void ps3_write_pm07_control(u32 cpu, u32 ctr, u32 val)
{ int result; static const u64 mask = 0xFFFFFFFFFFFFFFFFULL; u64 old_value; if (ctr >= NR_CTRS) { dev_dbg(sbd_core(), "%s:%u: ctr too big: %u\n", __func__, __LINE__, ctr); return; } result = lv1_set_lpm_counter_control(lpm_priv->lpm_id, ctr, val, mask, &old_value); if (result) dev_err(sbd_core...
EmcraftSystems/linux-emcraft
C++
Other
266
/* a > b : > 0 a = b : 0 a < b : < 0 */
int nstime_cmp(const nstime_t *a, const nstime_t *b)
/* a > b : > 0 a = b : 0 a < b : < 0 */ int nstime_cmp(const nstime_t *a, const nstime_t *b)
{ if (G_UNLIKELY(nstime_is_unset(a))) { if (G_UNLIKELY(nstime_is_unset(b))) { return 0; } else { return -1; } } else { if (G_UNLIKELY(nstime_is_unset(b))) { return 1; } } if (a->secs == b->secs) { return a->nsecs - b->ns...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* NAND write with ECC. Used when performing writes in interrupt context, this may for example be called by mtdoops when writing an oops while in panic. */
static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const uint8_t *buf)
/* NAND write with ECC. Used when performing writes in interrupt context, this may for example be called by mtdoops when writing an oops while in panic. */ static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const uint8_t *buf)
{ struct nand_chip *chip = mtd_to_nand(mtd); struct mtd_oob_ops ops; int ret; panic_nand_wait(mtd, chip, 400); panic_nand_get_device(chip, mtd, FL_WRITING); memset(&ops, 0, sizeof(ops)); ops.len = len; ops.datbuf = (uint8_t *)buf; ops.mode = MTD_OPS_PLACE_OOB; ret = nand_do_write_ops(mtd, to, &ops); *retlen ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Resets the PWR peripheral registers to their default reset values. */
void PMU_Reset(void)
/* Resets the PWR peripheral registers to their default reset values. */ void PMU_Reset(void)
{ RCM_EnableAPB1PeriphClock(RCM_APB1_PERIPH_PMU); RCM_DisableAPB1PeriphClock(RCM_APB1_PERIPH_PMU); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Starts the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost)
/* Starts the Low Level portion of the Host driver. */ USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost)
{ HAL_HCD_Start(phost->pData); return USBH_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Returns the number of bytes which are printed into the buffer. */
static ssize_t i2o_device_show_class_id(struct device *dev, struct device_attribute *attr, char *buf)
/* Returns the number of bytes which are printed into the buffer. */ static ssize_t i2o_device_show_class_id(struct device *dev, struct device_attribute *attr, char *buf)
{ struct i2o_device *i2o_dev = to_i2o_device(dev); sprintf(buf, "0x%03x\n", i2o_dev->lct_data.class_id); return strlen(buf) + 1; }
robutest/uclinux
C++
GPL-2.0
60
/* convert get_user_pages() return value to posix mlock() error */
static int __mlock_posix_error_return(long retval)
/* convert get_user_pages() return value to posix mlock() error */ static int __mlock_posix_error_return(long retval)
{ if (retval == -EFAULT) retval = -ENOMEM; else if (retval == -ENOMEM) retval = -EAGAIN; return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* De-initialize TIMER Interface. stops operation and releases the software resources used by the interface. */
int32_t csi_timer_uninitialize(timer_handle_t handle)
/* De-initialize TIMER Interface. stops operation and releases the software resources used by the interface. */ int32_t csi_timer_uninitialize(timer_handle_t handle)
{ TIMER_NULL_PARAM_CHK(handle); dw_timer_priv_t *timer_priv = (dw_timer_priv_t *)handle; dw_timer_reg_t *addr = (dw_timer_reg_t *)(timer_priv->base); timer_deactive_control(addr); timer_priv->cb_event = NULL; drv_nvic_disable_irq(timer_priv->irq); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables the PWM dead band output and sets the dead band delays. */
void PWMDeadBandEnable(uint32_t ui32Base, uint32_t ui32Gen, uint16_t ui16Rise, uint16_t ui16Fall)
/* Enables the PWM dead band output and sets the dead band delays. */ void PWMDeadBandEnable(uint32_t ui32Base, uint32_t ui32Gen, uint16_t ui16Rise, uint16_t ui16Fall)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(_PWMGenValid(ui32Gen)); ASSERT(ui16Rise < 4096); ASSERT(ui16Fall < 4096); ui32Gen = PWM_GEN_BADDR(ui32Base, ui32Gen); HWREG(ui32Gen + PWM_O_X_DBRISE) = ui16Rise; HWREG(ui32Gen + PWM_O_X_DBFALL) = ui16Fall; HWREG(ui32Gen + PWM_O_X_DBCTL) |= PWM_X_DB...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. */
EFI_STATUS EFIAPI EmuGopQuerytMode(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, IN UINT32 ModeNumber, OUT UINTN *SizeOfInfo, OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info)
/* Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. */ EFI_STATUS EFIAPI EmuGopQuerytMode(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, IN UINT32 ModeNumber, OUT UINTN *SizeOfInfo, OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info)
{ GOP_PRIVATE_DATA *Private; GOP_MODE_DATA *ModeData; Private = GOP_PRIVATE_DATA_FROM_THIS (This); if ((Info == NULL) || (SizeOfInfo == NULL) || ((UINTN)ModeNumber >= This->Mode->MaxMode)) { return EFI_INVALID_PARAMETER; } *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); if (...
tianocore/edk2
C++
Other
4,240
/* Enables or disables access to the RTC and backup registers. */
void PWR_BackupAccessCmd(FunctionalState NewState)
/* Enables or disables access to the RTC and backup registers. */ void PWR_BackupAccessCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if(NewState!=DISABLE) { PWR->CR |= 0x00000100; } else { PWR->CR &= 0xfffffeff; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If m->queue_if_no_path and m->saved_queue_if_no_path hold the same value then we are not between multipath_presuspend() and multipath_resume() calls and we have no need to check for the DMF_NOFLUSH_SUSPENDING flag. */
static int __must_push_back(struct multipath *m)
/* If m->queue_if_no_path and m->saved_queue_if_no_path hold the same value then we are not between multipath_presuspend() and multipath_resume() calls and we have no need to check for the DMF_NOFLUSH_SUSPENDING flag. */ static int __must_push_back(struct multipath *m)
{ return (m->queue_if_no_path != m->saved_queue_if_no_path && dm_noflush_suspending(m->ti)); }
robutest/uclinux
C++
GPL-2.0
60
/* convert an hexadecimal numeric string to a number, following C99 specification for 'strtod' */
static lua_Number lua_strx2number(const char *s, char **endptr)
/* convert an hexadecimal numeric string to a number, following C99 specification for 'strtod' */ static lua_Number lua_strx2number(const char *s, char **endptr)
{ s++; r = readhexa(&s, r, &e); } if (i == 0 && e == 0) return 0.0; e *= -4; *endptr = cast(char *, s); if (*s == 'p' || *s == 'P') { int exp1 = 0; int neg1; s++; neg1 = isneg(&s); if (!lisdigit(cast_uchar(*s))) goto ret; while (lisdigit(cast_uchar(*s))) exp1 = ...
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it find...
EFI_STATUS EFIAPI BotGetNumberOfBlockDevices(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it find...
{ *NumberBlockDevices = 1; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* eap_peer_tls_reauth_init - Re-initialize shared TLS for session resumption @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() @data: Data for TLS processing Returns: 0 on success, -1 on failure */
int eap_peer_tls_reauth_init(struct eap_sm *sm, struct eap_ssl_data *data)
/* eap_peer_tls_reauth_init - Re-initialize shared TLS for session resumption @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() @data: Data for TLS processing Returns: 0 on success, -1 on failure */ int eap_peer_tls_reauth_init(struct eap_sm *sm, struct eap_ssl_data *data)
{ eap_peer_tls_reset_input(data); eap_peer_tls_reset_output(data); return tls_connection_shutdown(data->ssl_ctx, data->conn); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This function locks a logical eraseblock for writing if there is no contention and does nothing if there is contention. Returns %0 in case of success, %1 in case of contention, and and a negative error code in case of failure. */
static int leb_write_trylock(struct ubi_device *ubi, int vol_id, int lnum)
/* This function locks a logical eraseblock for writing if there is no contention and does nothing if there is contention. Returns %0 in case of success, %1 in case of contention, and and a negative error code in case of failure. */ static int leb_write_trylock(struct ubi_device *ubi, int vol_id, int lnum)
{ struct ubi_ltree_entry *le; le = ltree_add_entry(ubi, vol_id, lnum); if (IS_ERR(le)) return PTR_ERR(le); if (down_write_trylock(&le->mutex)) return 0; spin_lock(&ubi->ltree_lock); le->users -= 1; ubi_assert(le->users >= 0); if (le->users == 0) { rb_erase(&le->rb, &ubi->ltree); kfree(le); } spin_unlo...
robutest/uclinux
C++
GPL-2.0
60
/* Walk all the element of the list in reverse order and apply the walker function to it */
void xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user)
/* Walk all the element of the list in reverse order and apply the walker function to it */ void xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user)
{ if((walker(lk->data, user)) == 0) break; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Always try to find and enable PCI display devices. */
VOID PlatformInitializeConsole(IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole)
/* Always try to find and enable PCI display devices. */ VOID PlatformInitializeConsole(IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole)
{ UINTN Index; VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath); for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) { if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) { EfiBootManagerUpdateConsoleVariable ( ConIn, PlatformConsole[Index].D...
tianocore/edk2
C++
Other
4,240
/* All interrupt signals become available on INT1 pin.. */
int32_t lsm6dso_all_on_int1_set(lsm6dso_ctx_t *ctx, uint8_t val)
/* All interrupt signals become available on INT1 pin.. */ int32_t lsm6dso_all_on_int1_set(lsm6dso_ctx_t *ctx, uint8_t val)
{ lsm6dso_ctrl4_c_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL4_C, (uint8_t*)&reg, 1); if (ret == 0) { reg.int2_on_int1 = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL4_C, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* mii_check_gmii_support - check if the MII supports Gb interfaces @mii: the MII interface */
int mii_check_gmii_support(struct mii_if_info *mii)
/* mii_check_gmii_support - check if the MII supports Gb interfaces @mii: the MII interface */ int mii_check_gmii_support(struct mii_if_info *mii)
{ int reg; reg = mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR); if (reg & BMSR_ESTATEN) { reg = mii->mdio_read(mii->dev, mii->phy_id, MII_ESTATUS); if (reg & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Return with a pointer to the active screen */
lv_obj_t* lv_disp_get_scr_act(lv_disp_t *disp)
/* Return with a pointer to the active screen */ lv_obj_t* lv_disp_get_scr_act(lv_disp_t *disp)
{ if(!disp) disp = lv_disp_get_default(); if(!disp) { LV_LOG_WARN("lv_scr_act: no display registered to get its top layer"); return NULL; } return disp->act_scr; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* fc_fcp_ddp_done() - Calls a LLD's ddp_done routine to release any DDP related resources for a fcp_pkt @fsp: The FCP packet that DDP had been used on */
static void fc_fcp_ddp_done(struct fc_fcp_pkt *fsp)
/* fc_fcp_ddp_done() - Calls a LLD's ddp_done routine to release any DDP related resources for a fcp_pkt @fsp: The FCP packet that DDP had been used on */ static void fc_fcp_ddp_done(struct fc_fcp_pkt *fsp)
{ struct fc_lport *lport; if (!fsp) return; if (fsp->xfer_ddp == FC_XID_UNKNOWN) return; lport = fsp->lp; if (lport->tt.ddp_done) { fsp->xfer_len = lport->tt.ddp_done(lport, fsp->xfer_ddp); fsp->xfer_ddp = FC_XID_UNKNOWN; } }
robutest/uclinux
C++
GPL-2.0
60
/* Note, this function synchronizes even VFS inodes which are locked (@i_mutex) by the caller of the budgeting function, because write-back does not touch @i_mutex. */
static void shrink_liability(struct ubifs_info *c, int nr_to_write)
/* Note, this function synchronizes even VFS inodes which are locked (@i_mutex) by the caller of the budgeting function, because write-back does not touch @i_mutex. */ static void shrink_liability(struct ubifs_info *c, int nr_to_write)
{ down_read(&c->vfs_sb->s_umount); writeback_inodes_sb(c->vfs_sb, WB_REASON_FS_FREE_SPACE); up_read(&c->vfs_sb->s_umount); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This tells the low-level filesystem that a write is about to be performed to it, and makes sure that writes are allowed before returning success. When the write operation is finished, mnt_drop_write() must be called. This is effectively a refcount. */
int mnt_want_write(struct vfsmount *mnt)
/* This tells the low-level filesystem that a write is about to be performed to it, and makes sure that writes are allowed before returning success. When the write operation is finished, mnt_drop_write() must be called. This is effectively a refcount. */ int mnt_want_write(struct vfsmount *mnt)
{ int ret = 0; preempt_disable(); inc_mnt_writers(mnt); smp_mb(); while (mnt->mnt_flags & MNT_WRITE_HOLD) cpu_relax(); smp_rmb(); if (__mnt_is_readonly(mnt)) { dec_mnt_writers(mnt); ret = -EROFS; goto out; } out: preempt_enable(); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Create a fragment key for permanent use; it must point to persistent data, so that it can be used to add entries. */
static gpointer fragment_addresses_persistent_key(const packet_info *pinfo, const guint32 id, const void *data _U_)
/* Create a fragment key for permanent use; it must point to persistent data, so that it can be used to add entries. */ static gpointer fragment_addresses_persistent_key(const packet_info *pinfo, const guint32 id, const void *data _U_)
{ fragment_addresses_key *key = g_slice_new(fragment_addresses_key); copy_address(&key->src, &pinfo->src); copy_address(&key->dst, &pinfo->dst); key->id = id; return (gpointer)key; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* GLIB_CHECK_VERSION(2,28,0) adds g_get_real_time which could minimize or replace this */
static void compute_elapsed(capture_file *cf, GTimeVal *start_time)
/* GLIB_CHECK_VERSION(2,28,0) adds g_get_real_time which could minimize or replace this */ static void compute_elapsed(capture_file *cf, GTimeVal *start_time)
{ gdouble delta_time; GTimeVal time_now; g_get_current_time(&time_now); delta_time = (time_now.tv_sec - start_time->tv_sec) * 1e6 + time_now.tv_usec - start_time->tv_usec; cf->computed_elapsed = (gulong) (delta_time / 1000); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToUintn(IN INT64 Operand, OUT UINTN *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeInt64ToUintn(IN INT64 Operand, OUT UINTN *Result)
{ return SafeInt64ToUint32 (Operand, (UINT32 *)Result); }
tianocore/edk2
C++
Other
4,240
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S DMA handle pointer. */
void FLEXIO_I2S_TransferAbortSendEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle)
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S DMA handle pointer. */ void FLEXIO_I2S_TransferAbortSendEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle)
{ assert(handle); EDMA_AbortTransfer(handle->dmaHandle); FLEXIO_I2S_TxEnableDMA(base, false); handle->state = kFLEXIO_I2S_Idle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the rate at which the SysTick counter wraps; this equates to the number of processor clocks between interrupts. */
unsigned long SysTickPeriodGet(void)
/* This function returns the rate at which the SysTick counter wraps; this equates to the number of processor clocks between interrupts. */ unsigned long SysTickPeriodGet(void)
{ return(HWREG(NVIC_ST_RELOAD) + 1); }
watterott/WebRadio
C++
null
71
/* Get the Rising Latched PWM counter of the PWM module. The */
unsigned long PWMCAPRisingCounterGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the Rising Latched PWM counter of the PWM module. The */ unsigned long PWMCAPRisingCounterGet(unsigned long ulBase, unsigned long ulChannel)
{ xASSERT(ulBase == PWMA_BASE); xASSERT(((ulChannel >= 0) || (ulChannel <= 3))); return xHWREG(ulBase + PWM_CRLR0 + ulChannel * 8); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This implementation assumes that reading or writing an aligned 32-bit integer is an atomic operation. If that assumption is not true, then this routine is not threadsafe. */
SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag)
/* This implementation assumes that reading or writing an aligned 32-bit integer is an atomic operation. If that assumption is not true, then this routine is not threadsafe. */ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag)
{ wsdStatInit; if( op<0 || op>=ArraySize(wsdStat.nowValue) ){ return SQLITE_MISUSE_BKPT; } *pCurrent = wsdStat.nowValue[op]; *pHighwater = wsdStat.mxValue[op]; if( resetFlag ){ wsdStat.mxValue[op] = wsdStat.nowValue[op]; } return SQLITE_OK; }
DC-SWAT/DreamShell
C++
null
404
/* Determine if there is slow work available for dispatch */
static bool slow_work_available(int vsmax)
/* Determine if there is slow work available for dispatch */ static bool slow_work_available(int vsmax)
{ return !list_empty(&slow_work_queue) || (!list_empty(&vslow_work_queue) && atomic_read(&vslow_work_executing_count) < vsmax); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function performs a software reset of a SOC */
void PRCMSOCReset(void)
/* This function performs a software reset of a SOC */ void PRCMSOCReset(void)
{ HWREG(GPRCM_BASE+ GPRCM_O_MCU_GLOBAL_SOFT_RESET) |= 0x1; }
micropython/micropython
C++
Other
18,334
/* Data Nat Page Consumption Fault @ Nat Consumption Vector Refer to SDM Vol2 Table 5-6 & 8-1 */
void dnat_page_consumption(struct kvm_vcpu *vcpu, u64 vadr)
/* Data Nat Page Consumption Fault @ Nat Consumption Vector Refer to SDM Vol2 Table 5-6 & 8-1 */ void dnat_page_consumption(struct kvm_vcpu *vcpu, u64 vadr)
{ _nat_consumption_fault(vcpu, vadr, DATA); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Example: If you have a matrix A 5 x 6 and you want to cut the values from A to matrix B with size 3 x 3 and you want to start at 0,0 and end at 3,3 Code: cut(A, 5, 6, B, 0, 2, 0, 2); // Because indexing from zero */
void cut(double *A, int row, int column, double *B, int start_row, int stop_row, int start_column, int stop_column)
/* Example: If you have a matrix A 5 x 6 and you want to cut the values from A to matrix B with size 3 x 3 and you want to start at 0,0 and end at 3,3 Code: cut(A, 5, 6, B, 0, 2, 0, 2); // Because indexing from zero */ void cut(double *A, int row, int column, double *B, int start_row, int stop_row, int start_column, i...
{ memcpy(B, data, sizeof(double) * out_columns); B += out_columns; data += in_columns; } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Called when the architecture exits its oops handler, after printing everything. */
void oops_exit(void)
/* Called when the architecture exits its oops handler, after printing everything. */ void oops_exit(void)
{ do_oops_enter_exit(); print_oops_end_marker(); kmsg_dump(KMSG_DUMP_OOPS); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Routines which queue packet commands take as a final argument a pointer to a request_sense struct. If execution of the command results in an error with a CHECK CONDITION status, this structure will be filled with the results of the subsequent request sense command. The pointer can also be NULL, in which case no sens...
static void msf_from_bcd(struct atapi_msf *msf)
/* Routines which queue packet commands take as a final argument a pointer to a request_sense struct. If execution of the command results in an error with a CHECK CONDITION status, this structure will be filled with the results of the subsequent request sense command. The pointer can also be NULL, in which case no sens...
{ msf->minute = bcd2bin(msf->minute); msf->second = bcd2bin(msf->second); msf->frame = bcd2bin(msf->frame); }
robutest/uclinux
C++
GPL-2.0
60
/* Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* InternalAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages)
/* Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* InternalAllocatePages(IN EF...
{ EFI_STATUS Status; EFI_PHYSICAL_ADDRESS Memory; if (Pages == 0) { return NULL; } Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); if (EFI_ERROR (Status)) { return NULL; } return (VOID *)(UINTN)Memory; }
tianocore/edk2
C++
Other
4,240
/* Find a supported UDF file system in block device. */
EFI_STATUS FindUdfFileSystem(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT EFI_LBA *StartingLBA, OUT EFI_LBA *EndingLBA)
/* Find a supported UDF file system in block device. */ EFI_STATUS FindUdfFileSystem(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT EFI_LBA *StartingLBA, OUT EFI_LBA *EndingLBA)
{ EFI_STATUS Status; UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER AnchorPoint; EFI_LBA LastRecordedBlock; Status = FindUdfVolumeIdentifiers (BlockIo, DiskIo); if (EFI_ERROR (Status)) { return Status; } Status = FindAnchorVolumeDescriptorPointer ( ...
tianocore/edk2
C++
Other
4,240
/* Monotonic counter event handler. This handler updates the high part of monotonic counter. */
VOID EFIAPI EfiMtcEventHandler(IN EFI_EVENT Event, IN VOID *Context)
/* Monotonic counter event handler. This handler updates the high part of monotonic counter. */ VOID EFIAPI EfiMtcEventHandler(IN EFI_EVENT Event, IN VOID *Context)
{ UINT32 HighCount; MonotonicCounterDriverGetNextHighMonotonicCount (&HighCount); }
tianocore/edk2
C++
Other
4,240
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
{ EFI_STATUS Status; ASSERT (Pages != 0); if (BufferInSmram (Buffer)) { Status = SmmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages); } else { Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages); } ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* The "interrupts" property requires to know the number of cells used to encode an interrupt. This information is stored in the interrupt-controller of the input Node. */
EFI_STATUS EFIAPI FdtGetInterruptCellsInfo(IN CONST VOID *Fdt, IN INT32 IntcNode, OUT INT32 *IntCells)
/* The "interrupts" property requires to know the number of cells used to encode an interrupt. This information is stored in the interrupt-controller of the input Node. */ EFI_STATUS EFIAPI FdtGetInterruptCellsInfo(IN CONST VOID *Fdt, IN INT32 IntcNode, OUT INT32 *IntCells)
{ CONST UINT32 *Data; INT32 Size; if ((Fdt == NULL) || (IntCells == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } Data = fdt_getprop (Fdt, IntcNode, "#interrupt-cells", &Size); if ((Data == NULL) || (Size != sizeof (UINT32))) { ASSERT (0); return EFI_ABORTED; } *I...
tianocore/edk2
C++
Other
4,240
/* This function will set usb device interface string description. */
rt_err_t rt_usbd_device_set_interface_string(udevice_t device, int index, const char *string)
/* This function will set usb device interface string description. */ rt_err_t rt_usbd_device_set_interface_string(udevice_t device, int index, const char *string)
{ RT_ASSERT(device != RT_NULL); RT_ASSERT(string != RT_NULL); RT_ASSERT(index < MAX_INTF_STR); device->str_intf[index] = string; return RT_EOK; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This return the handle number for the calling processor. This service may be called from the BSP and APs. */
EFI_STATUS EFIAPI MpInitLibWhoAmI(OUT UINTN *ProcessorNumber)
/* This return the handle number for the calling processor. This service may be called from the BSP and APs. */ EFI_STATUS EFIAPI MpInitLibWhoAmI(OUT UINTN *ProcessorNumber)
{ CPU_MP_DATA *CpuMpData; if (ProcessorNumber == NULL) { return EFI_INVALID_PARAMETER; } CpuMpData = GetCpuMpData (); return GetProcessorNumber (CpuMpData, ProcessorNumber); }
tianocore/edk2
C++
Other
4,240
/* add bytecode to lib, and copy the bytecode to the buff in the lib */
int LibObj_staticLink(LibObj *self, char *module_name, uint8_t *bytecode, size_t size)
/* add bytecode to lib, and copy the bytecode to the buff in the lib */ int LibObj_staticLink(LibObj *self, char *module_name, uint8_t *bytecode, size_t size)
{ Args buffs = {0}; char* module_obj_name = strsReplace(&buffs, module_name, ".", "|"); if (!obj_isArgExist(self, module_obj_name)) { obj_newObj(self, module_obj_name, "", New_TinyObj); } PikaObj* module_obj = obj_getObj(self, module_obj_name); uint16_t name_len = strGetSize(module_name)...
pikasTech/PikaPython
C++
MIT License
1,403
/* Removes the USB controller from the bus in device mode. */
void USBDevDisconnect(uint32_t ui32Base)
/* Removes the USB controller from the bus in device mode. */ void USBDevDisconnect(uint32_t ui32Base)
{ ASSERT(ui32Base == USB0_BASE); HWREGB(ui32Base + USB_O_POWER) &= (~USB_POWER_SOFTCONN); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* serial register for STM32 support STM32F103VB and STM32F103ZE */
rt_err_t rt_hw_serial_register(rt_device_t device, const char *name, rt_uint32_t flag, struct avr32_serial_device *serial)
/* serial register for STM32 support STM32F103VB and STM32F103ZE */ rt_err_t rt_hw_serial_register(rt_device_t device, const char *name, rt_uint32_t flag, struct avr32_serial_device *serial)
{ RT_ASSERT(device != RT_NULL); if ((flag & RT_DEVICE_FLAG_DMA_RX) || (flag & RT_DEVICE_FLAG_INT_TX)) { RT_ASSERT(0); } device->type = RT_Device_Class_Char; device->rx_indicate = RT_NULL; device->tx_complete = RT_NULL; device->init = rt_serial_init; device->open = rt_serial_open; device->close = rt_...
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* This file is part of the Simba project. */
int mock_write_led_7seg_ht16k33_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_led_7seg_ht16k33_module_init(int res)
{ harness_mock_write("led_7seg_ht16k33_module_init()", NULL, 0); harness_mock_write("led_7seg_ht16k33_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Converts the unicode character of the string from uppercase to lowercase. This is a internal function. */
VOID EFIAPI HiiToLower(IN EFI_STRING ConfigString)
/* Converts the unicode character of the string from uppercase to lowercase. This is a internal function. */ VOID EFIAPI HiiToLower(IN EFI_STRING ConfigString)
{ EFI_STRING String; BOOLEAN Lower; ASSERT (ConfigString != NULL); for (String = ConfigString, Lower = FALSE; *String != L'\0'; String++) { if (*String == L'=') { Lower = TRUE; } else if (*String == L'&') { Lower = FALSE; } else if (Lower && (*String >= L'A') && (*String <= L'F')) {...
tianocore/edk2
C++
Other
4,240
/* Returns negative errno on error, or zero on success. */
static int epson1355fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
/* Returns negative errno on error, or zero on success. */ static int epson1355fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
{ struct epson1355_par *par = info->par; u32 start; if (var->xoffset != 0) return -EINVAL; if (var->yoffset + info->var.yres > info->var.yres_virtual) return -EINVAL; start = (info->fix.line_length >> 1) * var->yoffset; epson1355_write_reg20(par, start, REG_SCRN1_DISP_START_ADDR0); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Function to check that PLL can be modified. */
static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct)
/* Function to check that PLL can be modified. */ static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct)
{ uint32_t pllfreq; assert_param(IS_LL_UTILS_PLLM_VALUE(UTILS_PLLInitStruct->PLLM)); assert_param(IS_LL_UTILS_PLLN_VALUE(UTILS_PLLInitStruct->PLLN)); assert_param(IS_LL_UTILS_PLLP_VALUE(UTILS_PLLInitStruct->PLLP)); assert_param(IS_LL_UTILS_FRACN_VALUE(UTILS_PLLInitStruct->FRACN)); pllfreq = LL_RCC_CalcPLLCl...
ua1arn/hftrx
C++
null
69