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 |
|---|---|---|---|---|---|---|---|
/* Return value: number of bytes printed to buffer */ | static ssize_t ibmvfc_show_log_level(struct device *dev, struct device_attribute *attr, char *buf) | /* Return value: number of bytes printed to buffer */
static ssize_t ibmvfc_show_log_level(struct device *dev, struct device_attribute *attr, char *buf) | {
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
unsigned long flags = 0;
int len;
spin_lock_irqsave(shost->host_lock, flags);
len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->log_level);
spin_unlock_irqrestore(shost->host_lock, flags);
return len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. */ | void pbuf_cat(struct pbuf *h, struct pbuf *t) | /* Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. */
void pbuf_cat(struct pbuf *h, struct pbuf *t) | {
struct pbuf *p;
LWIP_ERROR("(h != NULL) && (t != NULL) (programmer violates API)",
((h != NULL) && (t != NULL)), return;);
for (p = h; p->next != NULL; p = p->next) {
p->tot_len += t->tot_len;
}
LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
LWIP_ASSERT("p->next == NULL", p->next == NULL);
p->tot_len += t->tot_len;
p->next = t;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* @dev: Panel device containing the backlight to update @percent: Brightness value (0=off, 1=min brightness, 100=full brightness) */ | int panel_set_backlight(struct udevice *dev, int percent) | /* @dev: Panel device containing the backlight to update @percent: Brightness value (0=off, 1=min brightness, 100=full brightness) */
int panel_set_backlight(struct udevice *dev, int percent) | {
struct panel_ops *ops = panel_get_ops(dev);
if (!ops->set_backlight)
return -ENOSYS;
return ops->set_backlight(dev, percent);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Change Logs: Date Author Notes BalanceTWK add port file */ | int w5500_spi_device_init() | /* Change Logs: Date Author Notes BalanceTWK add port file */
int w5500_spi_device_init() | {
__HAL_RCC_GPIOB_CLK_ENABLE();
return rt_hw_spi_device_attach("spi2", "spi20", GET_PIN(B, 12));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return value: The round glyph posistions flag for the font options object. */ | cairo_round_glyph_positions_t _cairo_font_options_get_round_glyph_positions(const cairo_font_options_t *options) | /* Return value: The round glyph posistions flag for the font options object. */
cairo_round_glyph_positions_t _cairo_font_options_get_round_glyph_positions(const cairo_font_options_t *options) | {
if (cairo_font_options_status ((cairo_font_options_t *) options))
return CAIRO_ROUND_GLYPH_POS_DEFAULT;
return options->round_glyph_positions;
} | xboot/xboot | C++ | MIT License | 779 |
/* Enable/disable the 3 wire feature of the specified SPI port.
In no slave select signal mode, the BIDIROE, SPI_C2, shuld be set as 1. */ | void SPI3WireEnable(unsigned long ulBase, unsigned long ulMode) | /* Enable/disable the 3 wire feature of the specified SPI port.
In no slave select signal mode, the BIDIROE, SPI_C2, shuld be set as 1. */
void SPI3WireEnable(unsigned long ulBase, unsigned long ulMode) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
xASSERT((ulMode == SPI_MODE_MASTER) || (ulMode == SPI_MODE_SLAVE));
xHWREGB(ulBase + SPI_C2) |= SPI_C2_SPC0;
xHWREGB(ulBase + SPI_C2) &= ~SPI_C2_BIDIROE;
if(ulMode == SPI_MODE_MASTER)
{
xHWREGB(ulBase + SPI_C2) |= SPI_C2_BIDIROE;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return the number of words that can be safely read from the read fifo. */ | static u32 fifo_icap_read_fifo_occupancy(struct hwicap_drvdata *drvdata) | /* Return the number of words that can be safely read from the read fifo. */
static u32 fifo_icap_read_fifo_occupancy(struct hwicap_drvdata *drvdata) | {
return in_be32(drvdata->base_address + XHI_RFO_OFFSET);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Correctly setup FAS216 chip for specified transfer period. Notes : we need to switch the chip out of FASTSCSI mode if we have a transfer period >= 200ns - otherwise the chip will violate the SCSI timings. */ | static void fas216_set_sync(FAS216_Info *info, int target) | /* Correctly setup FAS216 chip for specified transfer period. Notes : we need to switch the chip out of FASTSCSI mode if we have a transfer period >= 200ns - otherwise the chip will violate the SCSI timings. */
static void fas216_set_sync(FAS216_Info *info, int target) | {
unsigned int cntl3;
fas216_writeb(info, REG_SOF, info->device[target].sof);
fas216_writeb(info, REG_STP, info->device[target].stp);
cntl3 = info->scsi.cfg[2];
if (info->device[target].period >= (200 / 4))
cntl3 = cntl3 & ~CNTL3_FASTSCSI;
fas216_writeb(info, REG_CNTL3, cntl3);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check permission between a pair of tasks, e.g. signal checks, fork check, ptrace check, etc. tsk1 is the actor and tsk2 is the target */ | static int task_has_perm(const struct task_struct *tsk1, const struct task_struct *tsk2, u32 perms) | /* Check permission between a pair of tasks, e.g. signal checks, fork check, ptrace check, etc. tsk1 is the actor and tsk2 is the target */
static int task_has_perm(const struct task_struct *tsk1, const struct task_struct *tsk2, u32 perms) | {
const struct task_security_struct *__tsec1, *__tsec2;
u32 sid1, sid2;
rcu_read_lock();
__tsec1 = __task_cred(tsk1)->security; sid1 = __tsec1->sid;
__tsec2 = __task_cred(tsk2)->security; sid2 = __tsec2->sid;
rcu_read_unlock();
return avc_has_perm(sid1, sid2, SECCLASS_PROCESS, perms, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes all available UARTs as serial ports. Platforms can call this function when they want to have default behaviour for serial ports (e.g initialize them all as serial ports). */ | void __init omap_serial_init(void) | /* Initializes all available UARTs as serial ports. Platforms can call this function when they want to have default behaviour for serial ports (e.g initialize them all as serial ports). */
void __init omap_serial_init(void) | {
int i;
for (i = 0; i < ARRAY_SIZE(omap_uart); i++)
omap_serial_init_port(i);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* @fdt: pointer to the device tree to check/adjust @s: string to find/add @allocated: Set to 0 if the string was found, 1 if not found and so allocated. Ignored if can_assume(NO_ROLLBACK) */ | static int fdt_find_add_string_(void *fdt, const char *s, int *allocated) | /* @fdt: pointer to the device tree to check/adjust @s: string to find/add @allocated: Set to 0 if the string was found, 1 if not found and so allocated. Ignored if can_assume(NO_ROLLBACK) */
static int fdt_find_add_string_(void *fdt, const char *s, int *allocated) | {
char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
const char *p;
char *new;
int len = strlen(s) + 1;
int err;
if (!can_assume(NO_ROLLBACK))
*allocated = 0;
p = fdt_find_string_(strtab, fdt_size_dt_strings(fdt), s);
if (p)
return (p - strtab);
new = strtab + fdt_size_dt_strings(fdt);
err = fdt_splice_string_(fdt, len);
if (err)
return err;
if (!can_assume(NO_ROLLBACK))
*allocated = 1;
memcpy(new, s, len);
return (new - strtab);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* called, if tx hangs. Schedules a task that resets the interface */ | static void spider_net_tx_timeout(struct net_device *netdev) | /* called, if tx hangs. Schedules a task that resets the interface */
static void spider_net_tx_timeout(struct net_device *netdev) | {
struct spider_net_card *card;
card = netdev_priv(netdev);
atomic_inc(&card->tx_timeout_task_counter);
if (netdev->flags & IFF_UP)
schedule_work(&card->tx_timeout_task);
else
atomic_dec(&card->tx_timeout_task_counter);
card->spider_stats.tx_timeouts++;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ixgbe_sfp_link_config - set up SFP+ link @adapter: pointer to private adapter struct */ | static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) | /* ixgbe_sfp_link_config - set up SFP+ link @adapter: pointer to private adapter struct */
static void ixgbe_sfp_link_config(struct ixgbe_adapter *adapter) | {
struct ixgbe_hw *hw = &adapter->hw;
if (hw->phy.multispeed_fiber) {
hw->mac.ops.setup_sfp(hw);
if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK))
schedule_work(&adapter->multispeed_fiber_task);
} else {
if (!(adapter->flags & IXGBE_FLAG_IN_SFP_MOD_TASK))
schedule_work(&adapter->sfp_config_module_task);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Serializes a sensor_t object as a byte array. */ | size_t sensorsSerializeSensor(uint8_t *buffer, const sensor_t *sensor) | /* Serializes a sensor_t object as a byte array. */
size_t sensorsSerializeSensor(uint8_t *buffer, const sensor_t *sensor) | {
size_t i = 0;
memcpy(&buffer[i], &sensor->name, sizeof sensor->name);
i += sizeof sensor->name;
memcpy(&buffer[i], &sensor->version, sizeof sensor->version);
i += sizeof sensor->version;
memcpy(&buffer[i], &sensor->sensor_id, sizeof sensor->sensor_id);
i += sizeof sensor->sensor_id;
memcpy(&buffer[i], &sensor->type, sizeof sensor->type);
i += sizeof sensor->type;
memcpy(&buffer[i], &sensor->max_value, sizeof sensor->max_value);
i += sizeof sensor->max_value;
memcpy(&buffer[i], &sensor->min_value, sizeof sensor->min_value);
i += sizeof sensor->min_value;
memcpy(&buffer[i], &sensor->resolution, sizeof sensor->resolution);
i += sizeof sensor->resolution;
memcpy(&buffer[i], &sensor->min_delay, sizeof sensor->min_delay);
i += sizeof sensor->min_delay;
return i;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* Note that the program must first call XStrm_RxGetLen before pulling data out of the receive channel of the FIFO with XStrm_Read. */ | u32 XStrm_RxGetLen(XStrm_RxFifoStreamer *InstancePtr) | /* Note that the program must first call XStrm_RxGetLen before pulling data out of the receive channel of the FIFO with XStrm_Read. */
u32 XStrm_RxGetLen(XStrm_RxFifoStreamer *InstancePtr) | {
u32 len;
InstancePtr->HeadIndex = InstancePtr->FifoWidth;
len = (*InstancePtr->GetLenFn)(InstancePtr->FifoInstance);
InstancePtr->FrmByteCnt = len;
return len;
} | ua1arn/hftrx | C++ | null | 69 |
/* Wrapper function to MmInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications */ | EFI_STATUS EFIAPI MmInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface) | /* Wrapper function to MmInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications */
EFI_STATUS EFIAPI MmInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface) | {
return MmInstallProtocolInterfaceNotify (
UserHandle,
Protocol,
InterfaceType,
Interface,
TRUE
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initializes the software UART, ready for data transmission and reception into the global ring buffers. */ | void SoftUART_Init(void) | /* Initializes the software UART, ready for data transmission and reception into the global ring buffers. */
void SoftUART_Init(void) | {
STXPORT |= (1 << STX);
STXDDR |= (1 << STX);
SRXPORT |= (1 << SRX);
EICRA = (1 << ISC01);
EIMSK = (1 << INT0);
SoftUART_SetBaud(9600);
TIMSK1 = (1 << OCIE1A);
TIMSK3 = (1 << OCIE3A);
TCCR3B = ((1 << CS30) | (1 << WGM32));
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Check type equivalence in a name list like <name1>|<name2>|... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ | SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) | /* Check type equivalence in a name list like <name1>|<name2>|... Return 0 if equal, -1 if nb < tb, 1 if nb > tb */
SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) | {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Configure the Push buttons.
Configure the PIO as inputs and generate corresponding interrupt when pressed or released. */ | static void configure_buttons(void) | /* Configure the Push buttons.
Configure the PIO as inputs and generate corresponding interrupt when pressed or released. */
static void configure_buttons(void) | {
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, 10);
pio_handler_set(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_ID,
PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_ATTR, button1_handler);
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_1_ID);
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Read the fw_cfg file into the caller-provided CHAR8 array. NUL-terminate the array. */ | STATIC RETURN_STATUS QemuFwCfgGetAsString(IN CONST CHAR8 *FileName, IN OUT UINTN *BufferSize, OUT CHAR8 *Buffer) | /* Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Read the fw_cfg file into the caller-provided CHAR8 array. NUL-terminate the array. */
STATIC RETURN_STATUS QemuFwCfgGetAsString(IN CONST CHAR8 *FileName, IN OUT UINTN *BufferSize, OUT CHAR8 *Buffer) | {
RETURN_STATUS Status;
FIRMWARE_CONFIG_ITEM FwCfgItem;
UINTN FwCfgSize;
if (!QemuFwCfgIsAvailable ()) {
return RETURN_UNSUPPORTED;
}
Status = QemuFwCfgFindFile (FileName, &FwCfgItem, &FwCfgSize);
if (RETURN_ERROR (Status)) {
return Status;
}
if (FwCfgSize > *BufferSize) {
return RETURN_PROTOCOL_ERROR;
}
QemuFwCfgSelectItem (FwCfgItem);
QemuFwCfgReadBytes (FwCfgSize, Buffer);
if ((FwCfgSize > 0) && (Buffer[FwCfgSize - 1] == '\0')) {
*BufferSize = FwCfgSize;
return RETURN_SUCCESS;
}
if (FwCfgSize == *BufferSize) {
return RETURN_PROTOCOL_ERROR;
}
Buffer[FwCfgSize] = '\0';
*BufferSize = FwCfgSize + 1;
return RETURN_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* serial core request to enable modem status interrupt reporting */ | static void bcm_uart_enable_ms(struct uart_port *port) | /* serial core request to enable modem status interrupt reporting */
static void bcm_uart_enable_ms(struct uart_port *port) | {
unsigned int val;
val = bcm_uart_readl(port, UART_IR_REG);
val |= UART_IR_MASK(UART_IR_EXTIP);
bcm_uart_writel(port, val, UART_IR_REG);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This file is part of the Simba project. */ | int mock_write_pwm_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_pwm_module_init(int res) | {
harness_mock_write("pwm_module_init()",
NULL,
0);
harness_mock_write("pwm_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* This routine will put a word into the user area in the process kernel stack. */ | static int put_stack_long(struct task_struct *task, int offset, unsigned long data) | /* This routine will put a word into the user area in the process kernel stack. */
static int put_stack_long(struct task_struct *task, int offset, unsigned long data) | {
unsigned char *stack;
stack = (unsigned char *)(task->thread.uregs);
stack += offset;
*(unsigned long *) stack = data;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read the current ACPI tick counter using the counter address cached by this instance's constructor. */ | UINT32 InternalAcpiGetTimerTick(VOID) | /* Read the current ACPI tick counter using the counter address cached by this instance's constructor. */
UINT32 InternalAcpiGetTimerTick(VOID) | {
return IoRead32 (mAcpiTimerIoAddr);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Delay execution to maintain a constant framerate and calculate fps.
Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset. */ | Uint32 SDL_framerateDelay(FPSmanager *manager) | /* Delay execution to maintain a constant framerate and calculate fps.
Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset. */
Uint32 SDL_framerateDelay(FPSmanager *manager) | {
Uint32 current_ticks;
Uint32 target_ticks;
Uint32 the_delay;
Uint32 time_passed = 0;
if (manager == NULL) {
return 0;
}
if (manager->baseticks == 0) {
SDL_initFramerate(manager);
}
manager->framecount++;
current_ticks = _getTicks();
time_passed = current_ticks - manager->lastticks;
manager->lastticks = current_ticks;
target_ticks = manager->baseticks + (Uint32) ((float) manager->framecount * manager->rateticks);
if (current_ticks <= target_ticks) {
the_delay = target_ticks - current_ticks;
SDL_Delay(the_delay);
} else {
manager->framecount = 0;
manager->baseticks = _getTicks();
}
return time_passed;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* FSM start address register (r/w). First available address is 0x033C.. */ | int32_t lsm6dso_fsm_start_address_set(lsm6dso_ctx_t *ctx, uint8_t *buff) | /* FSM start address register (r/w). First available address is 0x033C.. */
int32_t lsm6dso_fsm_start_address_set(lsm6dso_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
uint8_t index;
index = 0x00U;
ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_FSM_START_ADD_L, &buff[index]);
if (ret == 0) {
index++;
ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_FSM_START_ADD_H,
&buff[index]);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* The destructor function closes the End of DXE event. */ | EFI_STATUS EFIAPI PlatformVarCleanupLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The destructor function closes the End of DXE event. */
EFI_STATUS EFIAPI PlatformVarCleanupLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = gBS->CloseEvent (mPlatVarCleanupLibEndOfDxeEvent);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Do not audit the selinux permission check, as this is applied to all processes that allocate mappings. */ | static int selinux_vm_enough_memory(struct mm_struct *mm, long pages) | /* Do not audit the selinux permission check, as this is applied to all processes that allocate mappings. */
static int selinux_vm_enough_memory(struct mm_struct *mm, long pages) | {
int rc, cap_sys_admin = 0;
rc = selinux_capable(current, current_cred(), CAP_SYS_ADMIN,
SECURITY_CAP_NOAUDIT);
if (rc == 0)
cap_sys_admin = 1;
return __vm_enough_memory(mm, pages, cap_sys_admin);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write data to the specified page in AT24CXX. */ | uint32_t at24cxx_write_page(uint32_t u32_page_address, uint32_t u32_page_size, uint8_t const *p_wr_buffer) | /* Write data to the specified page in AT24CXX. */
uint32_t at24cxx_write_page(uint32_t u32_page_address, uint32_t u32_page_size, uint8_t const *p_wr_buffer) | {
twi_package_t twi_package;
uint32_t start_address = (u32_page_address * u32_page_size) & 0xFFFF;
twi_package.chip = BOARD_AT24C_ADDRESS;
at24c_build_word_address(twi_package.addr, start_address);
twi_package.addr_length = AT24C_MEM_ADDR_LEN;
twi_package.buffer = (uint8_t *)p_wr_buffer;
twi_package.length = u32_page_size;
if (twi_master_write(BOARD_AT24C_TWI_INSTANCE, &twi_package) !=
TWI_SUCCESS) {
return AT24C_WRITE_FAIL;
}
at24cxx_acknowledge_polling(&twi_package);
return AT24C_WRITE_SUCCESS;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This service retrieves the result of a previous invocation of SetActivePcrBanks. */ | EFI_STATUS EFIAPI Tcg2GetResultOfSetActivePcrBanks(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *OperationPresent, OUT UINT32 *Response) | /* This service retrieves the result of a previous invocation of SetActivePcrBanks. */
EFI_STATUS EFIAPI Tcg2GetResultOfSetActivePcrBanks(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *OperationPresent, OUT UINT32 *Response) | {
UINT32 ReturnCode;
if ((OperationPresent == NULL) || (Response == NULL)) {
return EFI_INVALID_PARAMETER;
}
ReturnCode = Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (OperationPresent, Response);
if (ReturnCode == TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS) {
return EFI_SUCCESS;
} else {
return EFI_UNSUPPORTED;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This file is part of the Simba project. */ | int mock_write_hx711_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_hx711_module_init(int res) | {
harness_mock_write("hx711_module_init()",
NULL,
0);
harness_mock_write("hx711_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Callback function called by PE layer when HardReset message received from PRL. */ | void USBPD_DPM_HardReset(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole, USBPD_HR_Status_TypeDef Status) | /* Callback function called by PE layer when HardReset message received from PRL. */
void USBPD_DPM_HardReset(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole, USBPD_HR_Status_TypeDef Status) | {
USBPD_VDM_UserReset(PortNum);
switch (Status)
{
case USBPD_HR_STATUS_START_ACK:
case USBPD_HR_STATUS_START_REQ:
if (USBPD_PORTPOWERROLE_SRC == CurrentRole)
{
DPM_AssertRp(PortNum);
DPM_TurnOffPower(PortNum, USBPD_PORTPOWERROLE_SRC);
}
else
{
USBPD_PWR_IF_VBUSIsEnabled(PortNum);
}
break;
case USBPD_HR_STATUS_COMPLETED:
if (USBPD_PORTPOWERROLE_SRC == CurrentRole)
{
DPM_TurnOnPower(PortNum,CurrentRole);
}
break;
default:
break;
}
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Returns the size, in bytes, of the firmware image currently stored in the firmware device. This function is used to by the GetImage() and GetImageInfo() services of the Firmware Management Protocol. If the image size can not be determined from the firmware device, then 0 must be returned. */ | EFI_STATUS EFIAPI FmpDeviceGetSize(OUT UINTN *Size) | /* Returns the size, in bytes, of the firmware image currently stored in the firmware device. This function is used to by the GetImage() and GetImageInfo() services of the Firmware Management Protocol. If the image size can not be determined from the firmware device, then 0 must be returned. */
EFI_STATUS EFIAPI FmpDeviceGetSize(OUT UINTN *Size) | {
if (Size == NULL) {
return EFI_INVALID_PARAMETER;
}
*Size = 0;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enter/Exit CAN Initialization mode @prv: stm32 can private @in: 1 - enter Init; 0 - exit Init */ | static int stm32_chip_init(struct stm32_prv *prv, int in) | /* Enter/Exit CAN Initialization mode @prv: stm32 can private @in: 1 - enter Init; 0 - exit Init */
static int stm32_chip_init(struct stm32_prv *prv, int in) | {
u32 val;
int i;
val = readl(prv->reg + STM_CAN_MCR_BASE);
if (in)
val |= STM_CAN_MCR_INRQ;
else
val &= ~STM_CAN_MCR_INRQ;
writel(val, prv->reg + STM_CAN_MCR_BASE);
for (i = 0; i < STM_CAN_INIT_TOUT; i++) {
val = readl(prv->reg + STM_CAN_MSR_BASE) & STM_CAN_MSR_INAK;
if (in) {
if (val)
break;
} else {
if (!val)
break;
}
usleep_range(1000, 1000);
}
val = readl(prv->reg + STM_CAN_MSR_BASE) & STM_CAN_MSR_INAK;
return in ? (val ? 0 : -ETIMEDOUT) : (!val ? 0 : -ETIMEDOUT);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Context: Any context. Caller must prevent the records pointed to by @pd and @pwd from changing during execution. */ | static void __prci_wrpll_read_cfg(struct __prci_data *pd, struct __prci_wrpll_data *pwd) | /* Context: Any context. Caller must prevent the records pointed to by @pd and @pwd from changing during execution. */
static void __prci_wrpll_read_cfg(struct __prci_data *pd, struct __prci_wrpll_data *pwd) | {
__prci_wrpll_unpack(&pwd->c, __prci_readl(pd, pwd->cfg0_offs));
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Clears out all files from the Fv buffer in memory */ | EFI_STATUS FvBufDuplicate(IN VOID *SourceFv, IN OUT VOID **DestinationFv) | /* Clears out all files from the Fv buffer in memory */
EFI_STATUS FvBufDuplicate(IN VOID *SourceFv, IN OUT VOID **DestinationFv) | {
EFI_STATUS Status;
UINTN size;
if (DestinationFv == NULL) {
return EFI_INVALID_PARAMETER;
}
Status = FvBufGetSize (SourceFv, &size);
if (EFI_ERROR (Status)) {
return Status;
}
if (*DestinationFv == NULL) {
*DestinationFv = CommonLibBinderAllocate (size);
if (*DestinationFv == NULL) {
return EFI_OUT_OF_RESOURCES;
}
}
CommonLibBinderCopyMem (*DestinationFv, SourceFv, size);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* connect TM/16 break input to the selected parameter */ | void syscfg_lock_config(uint32_t syscfg_lock) | /* connect TM/16 break input to the selected parameter */
void syscfg_lock_config(uint32_t syscfg_lock) | {
SYSCFG_CFG2 |= (uint32_t) syscfg_lock;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* param base ACMP peripheral base address. return Status flags asserted mask. See "_acmp_status_flags". */ | uint32_t ACMP_GetStatusFlags(CMP_Type *base) | /* param base ACMP peripheral base address. return Status flags asserted mask. See "_acmp_status_flags". */
uint32_t ACMP_GetStatusFlags(CMP_Type *base) | {
uint32_t status = 0U;
uint32_t tmp32 = base->C0;
if (CMP_C0_CFR_MASK == (tmp32 & CMP_C0_CFR_MASK))
{
status |= (uint32_t)kACMP_OutputRisingEventFlag;
}
if (CMP_C0_CFF_MASK == (tmp32 & CMP_C0_CFF_MASK))
{
status |= (uint32_t)kACMP_OutputFallingEventFlag;
}
if (CMP_C0_COUT_MASK == (tmp32 & CMP_C0_COUT_MASK))
{
status |= (uint32_t)kACMP_OutputAssertEventFlag;
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API sets the I2C device address of auxiliary sensor. */ | uint16_t bma4_set_i2c_device_addr(struct bma4_dev *dev) | /* This API sets the I2C device address of auxiliary sensor. */
uint16_t bma4_set_i2c_device_addr(struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0, dev_id = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_AUX_DEV_ID_ADDR, &data, 1, dev);
if (rslt == BMA4_OK) {
dev_id = BMA4_SET_BITSLICE(data, BMA4_I2C_DEVICE_ADDR, dev->aux_config.aux_dev_addr);
rslt |= bma4_write_regs(BMA4_AUX_DEV_ID_ADDR, &dev_id, 1, dev);
}
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Enables or disables the Internal Low Speed oscillator (LSI). */ | void RCC_EnableLsi(FunctionalState Cmd) | /* Enables or disables the Internal Low Speed oscillator (LSI). */
void RCC_EnableLsi(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
*(__IO uint32_t*)CTRLSTS_LSIEN_BB = (uint32_t)Cmd;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Reads a 16 bit integer from the address space of a given SDIO function. If there is a problem reading the address, 0xffff is returned and @err_ret will contain the error code. */ | u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret) | /* Reads a 16 bit integer from the address space of a given SDIO function. If there is a problem reading the address, 0xffff is returned and @err_ret will contain the error code. */
u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret) | {
int ret;
if (err_ret)
*err_ret = 0;
ret = sdio_memcpy_fromio(func, func->tmpbuf, addr, 2);
if (ret) {
if (err_ret)
*err_ret = ret;
return 0xFFFF;
}
return le16_to_cpup((__le16 *)func->tmpbuf);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ | int pxa_tstc_dev(unsigned int uart_index) | /* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int pxa_tstc_dev(unsigned int uart_index) | {
struct pxa_uart_regs *uart_regs;
uart_regs = pxa_uart_index_to_regs(uart_index);
if (!uart_regs)
return -1;
return readl(&uart_regs->lsr) & LSR_DR;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Return: false - we are done with this request true - still buffers pending for this request */ | static bool blk_end_bidi_request(struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes) | /* Return: false - we are done with this request true - still buffers pending for this request */
static bool blk_end_bidi_request(struct request *rq, int error, unsigned int nr_bytes, unsigned int bidi_bytes) | {
struct request_queue *q = rq->q;
unsigned long flags;
if (blk_update_bidi_request(rq, error, nr_bytes, bidi_bytes))
return true;
spin_lock_irqsave(q->queue_lock, flags);
blk_finish_request(rq, error);
spin_unlock_irqrestore(q->queue_lock, flags);
return false;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_input_consume_white_spaces(CRInput *a_this, gulong *a_nb_chars) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_consume_white_spaces(CRInput *a_this, gulong *a_nb_chars) | {
enum CRStatus status = CR_OK;
guint32 cur_char = 0,
nb_consumed = 0;
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_nb_chars,
CR_BAD_PARAM_ERROR);
for (nb_consumed = 0;
((*a_nb_chars > 0) && (nb_consumed < *a_nb_chars));
nb_consumed++) {
status = cr_input_peek_char (a_this, &cur_char);
if (status != CR_OK)
break;
if (cr_utils_is_white_space (cur_char) == TRUE) {
status = cr_input_read_char (a_this, &cur_char);
if (status != CR_OK)
break;
continue;
}
break;
}
if (nb_consumed && status == CR_END_OF_INPUT_ERROR) {
status = CR_OK;
}
return status;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Invalidates all buffer-cache entries on a disk. It should be called when a disk has been changed */ | static void flush_disk(struct block_device *bdev) | /* Invalidates all buffer-cache entries on a disk. It should be called when a disk has been changed */
static void flush_disk(struct block_device *bdev) | {
if (__invalidate_device(bdev)) {
char name[BDEVNAME_SIZE] = "";
if (bdev->bd_disk)
disk_name(bdev->bd_disk, 0, name);
printk(KERN_WARNING "VFS: busy inodes on changed media or "
"resized disk %s\n", name);
}
if (!bdev->bd_disk)
return;
if (disk_partitionable(bdev->bd_disk))
bdev->bd_invalidated = 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Adds a master port to the network list of associated master ports.. */ | static void rio_net_add_mport(struct rio_net *net, struct rio_mport *port) | /* Adds a master port to the network list of associated master ports.. */
static void rio_net_add_mport(struct rio_net *net, struct rio_mport *port) | {
spin_lock(&rio_global_list_lock);
list_add_tail(&port->nnode, &net->mports);
spin_unlock(&rio_global_list_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Before you start, select your target, on the right of the "Load" button */ | int main(void) | /* Before you start, select your target, on the right of the "Load" button */
int main(void) | {
TM_DISCO_LedOn(LED_GREEN);
}
d = TM_OTP_Read(15, 6);
if (d == 0x96) {
TM_DISCO_LedOn(LED_RED);
}
if (TM_OTP_BlockLocked(15)) {
}
while (1) {
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Event notification function for SIMPLE_TEXT_IN.WaitForKey event Signal the event if there is key available */ | VOID EFIAPI KeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context) | /* Event notification function for SIMPLE_TEXT_IN.WaitForKey event Signal the event if there is key available */
VOID EFIAPI KeyboardWaitForKey(IN EFI_EVENT Event, IN VOID *Context) | {
EFI_TPL OldTpl;
KEYBOARD_CONSOLE_IN_DEV *ConsoleIn;
EFI_KEY_DATA KeyData;
ConsoleIn = (KEYBOARD_CONSOLE_IN_DEV *)Context;
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
KeyboardTimerHandler (NULL, ConsoleIn);
if (!ConsoleIn->KeyboardErr) {
while (!IsEfikeyBufEmpty (&ConsoleIn->EfiKeyQueue)) {
CopyMem (
&KeyData,
&(ConsoleIn->EfiKeyQueue.Buffer[ConsoleIn->EfiKeyQueue.Head]),
sizeof (EFI_KEY_DATA)
);
if ((KeyData.Key.ScanCode == SCAN_NULL) && (KeyData.Key.UnicodeChar == CHAR_NULL)) {
PopEfikeyBufHead (&ConsoleIn->EfiKeyQueue, &KeyData);
continue;
}
gBS->SignalEvent (Event);
break;
}
}
gBS->RestoreTPL (OldTpl);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the XBARB instance from peripheral base address. */ | static uint32_t XBARB_GetInstance(XBARB_Type *base) | /* Get the XBARB instance from peripheral base address. */
static uint32_t XBARB_GetInstance(XBARB_Type *base) | {
uint32_t instance;
for (instance = 0; instance < ARRAY_SIZE(s_xbarbBases); instance++)
{
if (s_xbarbBases[instance] == base)
{
break;
}
}
assert(instance < ARRAY_SIZE(s_xbarbBases));
return instance;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* These access an Atmel AT24 SEEPROM using their glue chip registers. */ | static void at24_writedatabyte(unsigned long regaddr, unsigned char byte) | /* These access an Atmel AT24 SEEPROM using their glue chip registers. */
static void at24_writedatabyte(unsigned long regaddr, unsigned char byte) | {
int i;
for (i = 0; i < 8; i++) {
at24_setlines(regaddr, 0, (byte >> (7-i))&0x01);
at24_setlines(regaddr, 1, (byte >> (7-i))&0x01);
at24_setlines(regaddr, 0, (byte >> (7-i))&0x01);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The Name in the document type declaration must match the element type of the root element. */ | void xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) | /* The Name in the document type declaration must match the element type of the root element. */
void xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) | {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"xmlParseDocTypeDecl : no DOCTYPE name !\n");
}
ctxt->intSubName = name;
SKIP_BLANKS;
URI = xmlParseExternalID(ctxt, &ExternalID, 1);
if ((URI != NULL) || (ExternalID != NULL)) {
ctxt->hasExternalSubset = 1;
}
ctxt->extSubURI = URI;
ctxt->extSubSystem = ExternalID;
SKIP_BLANKS;
if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
(!ctxt->disableSAX))
ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI);
if (ctxt->instate == XML_PARSER_EOF)
return;
if (RAW == '[')
return;
if (RAW != '>') {
xmlFatalErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, NULL);
}
NEXT;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Valid values are logical combinations of the following: */ | void SysCtlResetBehaviorSet(uint32_t ui32Behavior) | /* Valid values are logical combinations of the following: */
void SysCtlResetBehaviorSet(uint32_t ui32Behavior) | {
HWREG(SYSCTL_RESBEHAVCTL) = ui32Behavior;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get object's and its ancestors type. Put their name in */ | void lv_obj_get_type(lv_obj_t *obj, lv_obj_type_t *buf) | /* Get object's and its ancestors type. Put their name in */
void lv_obj_get_type(lv_obj_t *obj, lv_obj_type_t *buf) | {
lv_obj_type_t tmp;
memset(buf, 0, sizeof(lv_obj_type_t));
memset(&tmp, 0, sizeof(lv_obj_type_t));
obj->signal_func(obj, LV_SIGNAL_GET_TYPE, &tmp);
uint8_t cnt;
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
if(tmp.type[cnt] == NULL) break;
}
uint8_t i;
for(i = 0; i < cnt; i++) {
buf->type[i] = tmp.type[cnt - 1 - i];
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This function sets the state of the M24SR RF disable pin. */ | void NFC_IO_RfDisable(uint8_t PinState) | /* This function sets the state of the M24SR RF disable pin. */
void NFC_IO_RfDisable(uint8_t PinState) | {
HAL_GPIO_WritePin(NFC_GPIO_RFDISABLE_PIN_PORT,NFC_GPIO_RFDISABLE_PIN,(GPIO_PinState)PinState);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4
|GPIO_PIN_5);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_3);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check if samples for specific channel are correct. It can check samples with arithmetic sequence with common difference. */ | static void check_samples(int expected_count, int32_t start_mv_value, int step, int num_channels, int channel_id, int32_t ref_mv, enum adc_gain gain) | /* Check if samples for specific channel are correct. It can check samples with arithmetic sequence with common difference. */
static void check_samples(int expected_count, int32_t start_mv_value, int step, int num_channels, int channel_id, int32_t ref_mv, enum adc_gain gain) | {
int32_t output, expected;
int i, ret;
for (i = channel_id; i < expected_count; i += num_channels) {
expected = start_mv_value + i / num_channels * step;
output = m_sample_buffer[i];
ret = adc_raw_to_millivolts(ref_mv, gain, ADC_RESOLUTION,
&output);
zassert_ok(ret, "adc_raw_to_millivolts() failed with code %d",
ret);
zassert_within(expected, output, MV_OUTPUT_EPS,
"%u != %u [%u] should has set value",
expected, output, i);
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* oversamplingRate: a value from 0 to 7 that decides about the precision of the measurement If this value equals n, the DPS310 will perform 2^n measurements and combine the results returns: 0 on success -3 if the DPS310 is already busy -2 if the object initialization failed -1 on other fail */ | int16_t startMeasureTempOnce(uint8_t oversamplingRate) | /* oversamplingRate: a value from 0 to 7 that decides about the precision of the measurement If this value equals n, the DPS310 will perform 2^n measurements and combine the results returns: 0 on success -3 if the DPS310 is already busy -2 if the object initialization failed -1 on other fail */
int16_t startMeasureTempOnce(uint8_t oversamplingRate) | {
if (dps310_ctx.m_initFail) {
return DPS310__FAIL_INIT_FAILED;
}
if (dps310_ctx.m_opMode != IDLE) {
return DPS310__FAIL_TOOBUSY;
}
if (oversamplingRate != dps310_ctx.m_tempOsr) {
if (configTemp(0U, oversamplingRate) != DPS310__SUCCEEDED) {
return DPS310__FAIL_UNKNOWN;
}
}
return setOpMode_3param(0U, 1U, 0U);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Arguments to a READ call. Since we read data directly into the page cache, we also set up the reply iovec here so that iov points exactly to the page we want to fetch. */ | static int nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) | /* Arguments to a READ call. Since we read data directly into the page cache, we also set up the reply iovec here so that iov points exactly to the page we want to fetch. */
static int nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) | {
struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
unsigned int replen;
u32 count = args->count;
p = xdr_encode_fhandle(p, args->fh);
p = xdr_encode_hyper(p, args->offset);
*p++ = htonl(count);
req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readres_sz) << 2;
xdr_inline_pages(&req->rq_rcv_buf, replen,
args->pages, args->pgbase, count);
req->rq_rcv_buf.flags |= XDRBUF_READ;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 4 bytes to Trace Hub MMIO addr + 0x18. */ | VOID EFIAPI MipiSystWriteD32Mts(IN VOID *MipiSystHandle, IN UINT32 Data) | /* Write 4 bytes to Trace Hub MMIO addr + 0x18. */
VOID EFIAPI MipiSystWriteD32Mts(IN VOID *MipiSystHandle, IN UINT32 Data) | {
MIPI_SYST_HANDLE *MipiSystH;
MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;
MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x18), Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Search DMA channel context for specified DMA channel resource. */ | static hpm_dma_channel_context_t * dma_manager_search_channel_context(const hpm_dma_resource_t *resource) | /* Search DMA channel context for specified DMA channel resource. */
static hpm_dma_channel_context_t * dma_manager_search_channel_context(const hpm_dma_resource_t *resource) | {
hpm_dma_channel_context_t *channel_ctx = NULL;
if ((resource != NULL) && (resource->channel < DMA_SOC_CHANNEL_NUM)) {
uint32_t instance;
uint32_t channel;
bool has_found = false;
for (instance = 0; instance < DMA_SOC_MAX_COUNT; instance++) {
if (resource->base == HPM_DMA_MGR->dma_instance[instance].base) {
has_found = true;
break;
}
}
channel = resource->channel;
if (has_found) {
channel_ctx = &HPM_DMA_MGR->channels[instance][channel];
}
}
return channel_ctx;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return index of first table entry with a matching short option or -1 if no match was found. */ | static int find_shortoption(struct arg_hdr **table, char shortopt) | /* Return index of first table entry with a matching short option or -1 if no match was found. */
static int find_shortoption(struct arg_hdr **table, char shortopt) | {
int tabindex;
for(tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++)
{
if (table[tabindex]->shortopts &&
strchr(table[tabindex]->shortopts, shortopt))
return tabindex;
}
return -1;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Returns n number of characters from the ring buffer or until empty. */ | uint32_t am_hal_uart_char_receive_buffered(uint32_t ui32Module, char *pcString, uint32_t ui32MaxChars) | /* Returns n number of characters from the ring buffer or until empty. */
uint32_t am_hal_uart_char_receive_buffered(uint32_t ui32Module, char *pcString, uint32_t ui32MaxChars) | {
uint32_t ui32NumChars = 0;
while (am_hal_queue_data_left(&g_psRxQueue[ui32Module]) && ui32MaxChars)
{
am_hal_queue_item_get(&g_psRxQueue[ui32Module], pcString, 1);
ui32MaxChars--;
ui32NumChars++;
pcString++;
}
return ui32NumChars;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: %1 if the device represents a SAS Port, %0 else */ | int scsi_is_sas_port(const struct device *dev) | /* Returns: %1 if the device represents a SAS Port, %0 else */
int scsi_is_sas_port(const struct device *dev) | {
return dev->release == sas_port_release;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initialize a directory with its "." and ".." entries. */ | int xfs_dir_init(xfs_trans_t *tp, xfs_inode_t *dp, xfs_inode_t *pdp) | /* Initialize a directory with its "." and ".." entries. */
int xfs_dir_init(xfs_trans_t *tp, xfs_inode_t *dp, xfs_inode_t *pdp) | {
xfs_da_args_t args;
int error;
memset((char *)&args, 0, sizeof(args));
args.dp = dp;
args.trans = tp;
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino)))
return error;
return xfs_dir2_sf_create(&args, pdp->i_ino);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Closes Indeo5 decoder and cleans up its context. */ | static av_cold int decode_close(AVCodecContext *avctx) | /* Closes Indeo5 decoder and cleans up its context. */
static av_cold int decode_close(AVCodecContext *avctx) | {
IVI5DecContext *ctx = avctx->priv_data;
ff_ivi_free_buffers(&ctx->planes[0]);
if (ctx->mb_vlc.cust_tab.table)
free_vlc(&ctx->mb_vlc.cust_tab);
if (ctx->frame.data[0])
avctx->release_buffer(avctx, &ctx->frame);
return 0;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* here we have to do not much, since pcm and controls are already freed */ | static int snd_usb_audio_free(struct snd_usb_audio *chip) | /* here we have to do not much, since pcm and controls are already freed */
static int snd_usb_audio_free(struct snd_usb_audio *chip) | {
kfree(chip);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Old style boot options parsing. Only for compatibility. */ | static int __init mcheck_disable(char *str) | /* Old style boot options parsing. Only for compatibility. */
static int __init mcheck_disable(char *str) | {
mce_disabled = 1;
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It converts a pointer to a new virtual address. */ | VOID EFIAPI RuntimeCryptLibAddressChangeEvent(IN EFI_EVENT Event, IN VOID *Context) | /* This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It converts a pointer to a new virtual address. */
VOID EFIAPI RuntimeCryptLibAddressChangeEvent(IN EFI_EVENT Event, IN VOID *Context) | {
EfiConvertPointer (0x0, (VOID **)&mRTPageTable->DataAreaBase);
EfiConvertPointer (0x0, (VOID **)&mRTPageTable);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Signal to the hardware that the End Of Interrupt state has been reached. */ | STATIC EFI_STATUS EFIAPI GicV3EndOfInterrupt(IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, IN HARDWARE_INTERRUPT_SOURCE Source) | /* Signal to the hardware that the End Of Interrupt state has been reached. */
STATIC EFI_STATUS EFIAPI GicV3EndOfInterrupt(IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This, IN HARDWARE_INTERRUPT_SOURCE Source) | {
if (Source >= mGicNumInterrupts) {
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
ArmGicV3EndOfInterrupt (Source);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the target bus width to be set on the bus. */ | UINT8 SdGetTargetBusWidth(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming) | /* Get the target bus width to be set on the bus. */
UINT8 SdGetTargetBusWidth(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming) | {
UINT8 BusWidth;
UINT8 PreferredBusWidth;
PreferredBusWidth = Private->Slot[SlotIndex].OperatingParameters.BusWidth;
if ((BusTiming == SdMmcSdDs) || (BusTiming == SdMmcSdHs)) {
if ((PreferredBusWidth != EDKII_SD_MMC_BUS_WIDTH_IGNORE) &&
((PreferredBusWidth == 1) || (PreferredBusWidth == 4)))
{
BusWidth = PreferredBusWidth;
} else {
BusWidth = 4;
}
} else {
BusWidth = 4;
}
return BusWidth;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Auto configure the media here rather than setting the port at compile time. This routine is called by de4x5_init() and when a loss of media is detected (excessive collisions, loss of carrier, no carrier or link fail or no recent receive activity) to check whether the user has been sneaky and changed the port on us. */ | static int autoconf_media(struct net_device *dev) | /* Auto configure the media here rather than setting the port at compile time. This routine is called by de4x5_init() and when a loss of media is detected (excessive collisions, loss of carrier, no carrier or link fail or no recent receive activity) to check whether the user has been sneaky and changed the port on us. */
static int autoconf_media(struct net_device *dev) | {
struct de4x5_private *lp = netdev_priv(dev);
u_long iobase = dev->base_addr;
disable_ast(dev);
lp->c_media = AUTO;
inl(DE4X5_MFC);
lp->media = INIT;
lp->tcount = 0;
de4x5_ast(dev);
return lp->media;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Name: ddr3_get_vco_freq Desc: read S@R and return VCO frequency Args: Notes: Returns: required value */ | u32 ddr3_get_vco_freq(void) | /* Name: ddr3_get_vco_freq Desc: read S@R and return VCO frequency Args: Notes: Returns: required value */
u32 ddr3_get_vco_freq(void) | {
u32 fab, cpu_freq, ui_vco_freq;
fab = ddr3_get_fab_opt();
cpu_freq = ddr3_get_cpu_freq();
if (fab == 2 || fab == 3 || fab == 7 || fab == 8 || fab == 10 ||
fab == 15 || fab == 17 || fab == 20)
ui_vco_freq = cpu_freq + CLK_CPU;
else
ui_vco_freq = cpu_freq;
return ui_vco_freq;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* ZigBee Device Profile dissector for the store node descriptor */ | void dissect_zbee_zdp_rsp_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | /* ZigBee Device Profile dissector for the store node descriptor */
void dissect_zbee_zdp_rsp_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | {
guint offset = 0;
guint8 status;
status = zdp_parse_status(tree, tvb, &offset);
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
zdp_dump_excess(tvb, offset, pinfo, tree);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* returns the path of the 'dentry' from the root of its filesystem. */ | int seq_dentry(struct seq_file *m, struct dentry *dentry, char *esc) | /* returns the path of the 'dentry' from the root of its filesystem. */
int seq_dentry(struct seq_file *m, struct dentry *dentry, char *esc) | {
char *buf;
size_t size = seq_get_buf(m, &buf);
int res = -1;
if (size) {
char *p = dentry_path(dentry, buf, size);
if (!IS_ERR(p)) {
char *end = mangle_path(buf, p, esc);
if (end)
res = end - buf;
}
}
seq_commit(m, res);
return res;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the same as rds_rdma_send_complete except we don't do any locking - we have all the ingredients (message, socket, socket lock) and can just move the notifier. */ | static void __rds_rdma_send_complete(struct rds_sock *rs, struct rds_message *rm, int status) | /* This is the same as rds_rdma_send_complete except we don't do any locking - we have all the ingredients (message, socket, socket lock) and can just move the notifier. */
static void __rds_rdma_send_complete(struct rds_sock *rs, struct rds_message *rm, int status) | {
struct rds_rdma_op *ro;
ro = rm->m_rdma_op;
if (ro && ro->r_notify && ro->r_notifier) {
ro->r_notifier->n_status = status;
list_add_tail(&ro->r_notifier->n_list, &rs->rs_notify_queue);
ro->r_notifier = NULL;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It convers pointer to new virtual address. */ | VOID EFIAPI SmmIplSetVirtualAddressNotify(IN EFI_EVENT Event, IN VOID *Context) | /* This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It convers pointer to new virtual address. */
VOID EFIAPI SmmIplSetVirtualAddressNotify(IN EFI_EVENT Event, IN VOID *Context) | {
EfiConvertPointer (0x0, (VOID **)&mSmmControl2);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Note: Bitwise-anding the results along each component gives the expected result for [a,b) x [A,B) intersection [c,d) x [C,D). */ | static int intersect_interval(double a, double b, double c, double d) | /* Note: Bitwise-anding the results along each component gives the expected result for [a,b) x [A,B) intersection [c,d) x [C,D). */
static int intersect_interval(double a, double b, double c, double d) | {
if (c <= a && b <= d)
return INSIDE;
else if (a >= d || b <= c)
return OUTSIDE;
else
return PARTIAL;
} | xboot/xboot | C++ | MIT License | 779 |
/* Sets Volume attributes. No polarity translations are done. */ | EFI_STATUS EFIAPI FvbProtocolSetAttributes(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes) | /* Sets Volume attributes. No polarity translations are done. */
EFI_STATUS EFIAPI FvbProtocolSetAttributes(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes) | {
EFI_STATUS Status;
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
FvbDevice = FVB_DEVICE_FROM_THIS (This);
Status = FvbSetVolumeAttributes (FvbDevice->Instance, Attributes);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Internal helper functions Read the status register, returning its value in the location Return the status register value. Returns negative if error occurred. */ | static int read_sr(struct m25p *flash) | /* Internal helper functions Read the status register, returning its value in the location Return the status register value. Returns negative if error occurred. */
static int read_sr(struct m25p *flash) | {
ssize_t retval;
u8 code = OPCODE_RDSR;
u8 val;
retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
if (retval < 0) {
dev_err(&flash->spi->dev, "error %d reading SR\n",
(int) retval);
return retval;
}
return val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Ensable the specified ADC injected channels conversion through. */ | void ADC_EnableExternalTrigInjectedConv(ADC_T *adc) | /* Ensable the specified ADC injected channels conversion through. */
void ADC_EnableExternalTrigInjectedConv(ADC_T *adc) | {
adc->CTRL2_B.INJEXTTRGEN = BIT_SET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Deinitializes the TIMx peripheral registers to their default reset values. */ | void TIM_DeInit(TIM_TypeDef *TIMx) | /* Deinitializes the TIMx peripheral registers to their default reset values. */
void TIM_DeInit(TIM_TypeDef *TIMx) | {
assert_param(IS_TIM_ALL_PERIPH(TIMx));
if (TIMx == TIM1)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM1, DISABLE);
}
else if (TIMx == TIM3)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM3, DISABLE);
}
else if (TIMx == TIM6)
{
RCC_APB2PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB1Periph_TIM6, DISABLE);
}
else
{
if (TIMx == TIM7)
{
RCC_APB2PeriphResetCmd(RCC_APB1Periph_TIM7, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB1Periph_TIM7, DISABLE);
}
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* get a little endian short (16bits) from a pointer
Caller should ensure parameters are valid. */ | uint16_t BytesGetLe16(const void *ptr) | /* get a little endian short (16bits) from a pointer
Caller should ensure parameters are valid. */
uint16_t BytesGetLe16(const void *ptr) | {
const uint8_t *p = (const uint8_t *)ptr;
return p[0] | (p[1] << 8);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is used to do initial Reset Configuration. */ | s32 XSdPs_ResetConfig(XSdPs *InstancePtr) | /* This function is used to do initial Reset Configuration. */
s32 XSdPs_ResetConfig(XSdPs *InstancePtr) | {
s32 Status;
XSdPs_DisableBusPower(InstancePtr);
Status = XSdPs_Reset(InstancePtr, XSDPS_SWRST_ALL_MASK);
if (Status != XST_SUCCESS) {
Status = XST_FAILURE;
goto RETURN_PATH ;
}
XSdPs_EnableBusPower(InstancePtr);
RETURN_PATH:
return Status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allocate memory for configure parameter such as timeout value for Dst, then copy the configure parameter from Src to Dst. */ | EFI_STATUS Dns4CopyConfigure(OUT EFI_DNS4_CONFIG_DATA *Dst, IN EFI_DNS4_CONFIG_DATA *Src) | /* Allocate memory for configure parameter such as timeout value for Dst, then copy the configure parameter from Src to Dst. */
EFI_STATUS Dns4CopyConfigure(OUT EFI_DNS4_CONFIG_DATA *Dst, IN EFI_DNS4_CONFIG_DATA *Src) | {
UINTN Len;
UINT32 Index;
CopyMem (Dst, Src, sizeof (*Dst));
Dst->DnsServerList = NULL;
if (Src->DnsServerList != NULL) {
Len = Src->DnsServerListCount * sizeof (EFI_IPv4_ADDRESS);
Dst->DnsServerList = AllocatePool (Len);
if (Dst->DnsServerList == NULL) {
Dns4CleanConfigure (Dst);
return EFI_OUT_OF_RESOURCES;
}
for (Index = 0; Index < Src->DnsServerListCount; Index++) {
CopyMem (&Dst->DnsServerList[Index], &Src->DnsServerList[Index], sizeof (EFI_IPv4_ADDRESS));
}
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return: 0 if all goes good, else appropriate error message. */ | static int k3_dsp_probe(struct udevice *dev) | /* Return: 0 if all goes good, else appropriate error message. */
static int k3_dsp_probe(struct udevice *dev) | {
struct k3_dsp_privdata *dsp;
int ret;
dev_dbg(dev, "%s\n", __func__);
dsp = dev_get_priv(dev);
ret = k3_dsp_of_to_priv(dev, dsp);
if (ret) {
dev_dbg(dev, "%s: Probe failed with error %d\n", __func__, ret);
return ret;
}
dev_dbg(dev, "Remoteproc successfully probed\n");
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Unlock the kernel context for the specified blade. Context is not unloaded but may be stolen before next use. */ | static void gru_unlock_kernel_context(int blade_id) | /* Unlock the kernel context for the specified blade. Context is not unloaded but may be stolen before next use. */
static void gru_unlock_kernel_context(int blade_id) | {
struct gru_blade_state *bs;
bs = gru_base[blade_id];
up_read(&bs->bs_kgts_sema);
STAT(unlock_kernel_context);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SPI Next Transmit is a CRC Word.
The next transmission to take place is a crc word from the hardware crc unit. This must be called before transmission to distinguish between sending of a data or CRC word. */ | void spi_set_next_tx_from_crc(uint32_t spi) | /* SPI Next Transmit is a CRC Word.
The next transmission to take place is a crc word from the hardware crc unit. This must be called before transmission to distinguish between sending of a data or CRC word. */
void spi_set_next_tx_from_crc(uint32_t spi) | {
SPI_CR1(spi) |= SPI_CR1_CRCNEXT;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* zfcp_erp_notify - Trigger ERP action. @erp_action: ERP action to continue. @set_mask: ERP action status flags to set. */ | void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask) | /* zfcp_erp_notify - Trigger ERP action. @erp_action: ERP action to continue. @set_mask: ERP action status flags to set. */
void zfcp_erp_notify(struct zfcp_erp_action *erp_action, unsigned long set_mask) | {
struct zfcp_adapter *adapter = erp_action->adapter;
unsigned long flags;
write_lock_irqsave(&adapter->erp_lock, flags);
if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) {
erp_action->status |= set_mask;
zfcp_erp_action_ready(erp_action);
}
write_unlock_irqrestore(&adapter->erp_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get Endpoint Physical Address Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: Endpoint Physical Address */ | uint32_t EPAdr(uint32_t EPNum) | /* Get Endpoint Physical Address Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: Endpoint Physical Address */
uint32_t EPAdr(uint32_t EPNum) | {
val += 1;
}
return (val);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* register the console at a more appropriate time send an exit message to GDB */ | void gdbstub_exit(int status) | /* register the console at a more appropriate time send an exit message to GDB */
void gdbstub_exit(int status) | {
unsigned char checksum;
int count;
unsigned char ch;
sprintf(output_buffer,"W%02x",status&0xff);
gdbstub_tx_char('$');
checksum = 0;
count = 0;
while ((ch = output_buffer[count]) != 0) {
gdbstub_tx_char(ch);
checksum += ch;
count += 1;
}
gdbstub_tx_char('#');
gdbstub_tx_char(hex_asc_hi(checksum));
gdbstub_tx_char(hex_asc_lo(checksum));
gdbstub_tx_char('-');
gdbstub_tx_flush();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enqueues the caller thread.
The caller thread is enqueued and put to sleep until it is dequeued or the specified timeouts expires. */ | msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout) | /* Enqueues the caller thread.
The caller thread is enqueued and put to sleep until it is dequeued or the specified timeouts expires. */
msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout) | {
queue_elem_t e;
msg_t msg;
osalDbgCheck(tqp != NULL);
ThreadsQueuePush(tqp, &e);
msg = osalThreadSuspendTimeoutS(&e.tr, timeout);
ElementDequeue(&e);
return msg;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Set the burst length for a I2C master FIFO operation. */ | void I2CMasterBurstLengthSet(uint32_t ui32Base, uint8_t ui8Length) | /* Set the burst length for a I2C master FIFO operation. */
void I2CMasterBurstLengthSet(uint32_t ui32Base, uint8_t ui8Length) | {
ASSERT(_I2CBaseValid(ui32Base) && (ui8Length < 255));
HWREG(ui32Base + I2C_O_MBLEN) = ui8Length;
} | micropython/micropython | C++ | Other | 18,334 |
/* ADC Set Clock Prescale.
The ADC clock taken from the many sources. */ | void adc_set_clk_source(uint32_t adc, uint32_t source) | /* ADC Set Clock Prescale.
The ADC clock taken from the many sources. */
void adc_set_clk_source(uint32_t adc, uint32_t source) | {
ADC_CFGR2(adc) = ((ADC_CFGR2(adc) & ~ADC_CFGR2_CKMODE) | source);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Checks whether the specified IWDG flag is set or not. */ | FlagStatus IWDG_GetFlagStatus(u16 flag) | /* Checks whether the specified IWDG flag is set or not. */
FlagStatus IWDG_GetFlagStatus(u16 flag) | {
return ((IWDG->SR & flag) != (u32)RESET) ? SET : RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Resets the RF Disable configuration.
Needs the I2C Password presentation to be effective. */ | int32_t ST25DV_ResetRFDisable(ST25DV_Object_t *pObj) | /* Resets the RF Disable configuration.
Needs the I2C Password presentation to be effective. */
int32_t ST25DV_ResetRFDisable(ST25DV_Object_t *pObj) | {
uint8_t reg_value = 0;
return st25dv_set_rf_mngt_rfdis(&(pObj->Ctx), ®_value);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Gets the next descriptor from the chain, and must be called with the channel's desc_lock held. Allocates more descriptors if the channel has run out. */ | static struct ioat_desc_sw* ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat) | /* Gets the next descriptor from the chain, and must be called with the channel's desc_lock held. Allocates more descriptors if the channel has run out. */
static struct ioat_desc_sw* ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat) | {
struct ioat_desc_sw *new;
if (!list_empty(&ioat->free_desc)) {
new = to_ioat_desc(ioat->free_desc.next);
list_del(&new->node);
} else {
new = ioat_dma_alloc_descriptor(ioat, GFP_ATOMIC);
if (!new) {
dev_err(to_dev(&ioat->base), "alloc failed\n");
return NULL;
}
}
dev_dbg(to_dev(&ioat->base), "%s: allocated: %d\n",
__func__, desc_id(new));
prefetch(new->hw);
return new;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2);
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_6);
}
else if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOD, STLK_RX_Pin|STLK_TX_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the Reference Count value of a specific channel. */ | static int fdc2x1x_set_rcount(const struct device *dev, uint8_t chx, uint16_t rcount) | /* Set the Reference Count value of a specific channel. */
static int fdc2x1x_set_rcount(const struct device *dev, uint8_t chx, uint16_t rcount) | {
return fdc2x1x_reg_write(dev, FDC2X1X_RCOUNT_CH0 + chx, rcount);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Copy arg vector into a new buffer, concatenating arguments with spaces. */ | static char* copy_argv(register char **argv) | /* Copy arg vector into a new buffer, concatenating arguments with spaces. */
static char* copy_argv(register char **argv) | {
register char **p;
register u_int len = 0;
char *buf;
char *src, *dst;
p = argv;
if (*p == NULL)
return 0;
while (*p)
len += strlen(*p++) + 1;
buf = (char *)malloc(len);
if (buf == NULL)
error("copy_argv: malloc");
p = argv;
dst = buf;
while ((src = *p++) != NULL) {
while ((*dst++ = *src++) != '\0')
;
dst[-1] = ' ';
}
dst[-1] = '\0';
return buf;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. */ | UINTN EFIAPI UnicodeSPrintAsciiFormat(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...) | /* If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. */
UINTN EFIAPI UnicodeSPrintAsciiFormat(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...) | {
VA_LIST Marker;
UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
VA_END (Marker);
return NumberOfPrinted;
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.