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: 1 if event is valid / 0 if event is not valid */ | static int ibmvfc_valid_event(struct ibmvfc_event_pool *pool, struct ibmvfc_event *evt) | /* Return value: 1 if event is valid / 0 if event is not valid */
static int ibmvfc_valid_event(struct ibmvfc_event_pool *pool, struct ibmvfc_event *evt) | {
int index = evt - pool->events;
if (index < 0 || index >= pool->size)
return 0;
if (evt != pool->events + index)
return 0;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* check_wakeup_irqs - check if any wake-up interrupts are pending */ | int check_wakeup_irqs(void) | /* check_wakeup_irqs - check if any wake-up interrupts are pending */
int check_wakeup_irqs(void) | {
struct irq_desc *desc;
int irq;
for_each_irq_desc(irq, desc)
if ((desc->status & IRQ_WAKEUP) && (desc->status & IRQ_PENDING))
return -EBUSY;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Writes and returns a new value to DR3. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmWriteDr3(UINTN Dr3) | /* Writes and returns a new value to DR3. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr3(UINTN Dr3) | {
__asm__ __volatile__ (
"movl %0, %%dr3"
:
: "r" (Dr3)
);
return Dr3;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* @ks : The chip information This routine removes all mcast addresses set in the hardware. */ | static void ks_clear_mcast(struct ks_net *ks) | /* @ks : The chip information This routine removes all mcast addresses set in the hardware. */
static void ks_clear_mcast(struct ks_net *ks) | {
u16 i, mcast_size;
for (i = 0; i < HW_MCAST_SIZE; i++)
ks->mcast_bits[i] = 0;
mcast_size = HW_MCAST_SIZE >> 2;
for (i = 0; i < mcast_size; i++)
ks_wrreg16(ks, KS_MAHTR0 + (2*i), 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Construction function for DMAGO instruction. This function fills the program buffer with the constructed instruction. */ | static INLINE int XDmaPs_Instr_DMAGO(char *DmaProg, unsigned int Cn, u32 Imm, unsigned int Ns) | /* Construction function for DMAGO instruction. This function fills the program buffer with the constructed instruction. */
static INLINE int XDmaPs_Instr_DMAGO(char *DmaProg, unsigned int Cn, u32 Imm, unsigned int Ns) | {
*DmaProg = 0xA0 | ((Ns << 1) & 0x02);
*(DmaProg + 1) = (u8)(Cn & 0x07);
XDmaPs_Memcpy4(DmaProg + 2, (char *)&Imm);
return 6;
} | ua1arn/hftrx | C++ | null | 69 |
/* This function provides accurate delay (in milliseconds) based on variable incremented. */ | __weak void HAL_Delay(__IO uint32_t Delay) | /* This function provides accurate delay (in milliseconds) based on variable incremented. */
__weak void HAL_Delay(__IO uint32_t Delay) | {
uint32_t tickstart = 0;
tickstart = HAL_GetTick();
while((HAL_GetTick() - tickstart) < Delay)
{
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Write to LED selector register, which determines the source that drives the LED output. */ | static void pca955x_write_ls(struct i2c_client *client, int n, u8 val) | /* Write to LED selector register, which determines the source that drives the LED output. */
static void pca955x_write_ls(struct i2c_client *client, int n, u8 val) | {
struct pca955x_led *pca955x = i2c_get_clientdata(client);
i2c_smbus_write_byte_data(client,
pca95xx_num_input_regs(pca955x->chipdef->bits) + 4 + n,
val);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called from timer task to run mDNS responder. */ | static void _mdns_scheduler_run() | /* Called from timer task to run mDNS responder. */
static void _mdns_scheduler_run() | {
MDNS_SERVICE_LOCK();
mdns_tx_packet_t * p = _mdns_server->tx_queue_head;
mdns_action_t * action = NULL;
if (!p) {
MDNS_SERVICE_UNLOCK();
return;
}
if ((int32_t)(p->send_at - (xTaskGetTickCount() * portTICK_PERIOD_MS)) < 0) {
action = (mdns_action_t *)malloc(sizeof(mdns_... | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Convert bitmask of attributes to a character string */ | char* nl_object_attrs2str(struct nl_object *obj, uint32_t attrs, char *buf, size_t len) | /* Convert bitmask of attributes to a character string */
char* nl_object_attrs2str(struct nl_object *obj, uint32_t attrs, char *buf, size_t len) | {
struct nl_object_ops *ops = obj_ops(obj);
if (ops->oo_attrs2str != NULL)
return ops->oo_attrs2str(attrs, buf, len);
else {
memset(buf, 0, len);
return buf;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* wdog is the iomem address of the cfg register */ | void sbwdog_pet(char __iomem *wdog) | /* wdog is the iomem address of the cfg register */
void sbwdog_pet(char __iomem *wdog) | {
spin_lock(&sbwd_lock);
__raw_writeb(__raw_readb(wdog) | 1, wdog);
spin_unlock(&sbwd_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Submit a USB get HID report request for the USB device specified by UsbIo, Interface, ReportId, and ReportType, and return the report in the buffer specified by Report. If UsbIo is NULL, then ASSERT(). If Report is NULL, then ASSERT(). */ | EFI_STATUS EFIAPI UsbGetReportRequest(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT8 Interface, IN UINT8 ReportId, IN UINT8 ReportType, IN UINT16 ReportLen, OUT UINT8 *Report) | /* Submit a USB get HID report request for the USB device specified by UsbIo, Interface, ReportId, and ReportType, and return the report in the buffer specified by Report. If UsbIo is NULL, then ASSERT(). If Report is NULL, then ASSERT(). */
EFI_STATUS EFIAPI UsbGetReportRequest(IN EFI_USB_IO_PROTOCOL *UsbIo, IN UINT8 ... | {
UINT32 Status;
EFI_STATUS Result;
EFI_USB_DEVICE_REQUEST Request;
ASSERT (UsbIo != NULL);
ASSERT (Report != NULL);
Request.RequestType = USB_HID_CLASS_GET_REQ_TYPE;
Request.Request = EFI_USB_GET_REPORT_REQUEST;
Request.Value = (UINT16)((ReportType << 8) | Repor... | tianocore/edk2 | C++ | Other | 4,240 |
/* Change Logs: Date Author Notes tanek first version This function will put STM32F4xx into sleep mode. */ | static void sleep(struct rt_pm *pm, uint8_t mode) | /* Change Logs: Date Author Notes tanek first version This function will put STM32F4xx into sleep mode. */
static void sleep(struct rt_pm *pm, uint8_t mode) | {
switch (mode)
{
case PM_SLEEP_MODE_NONE:
break;
case PM_SLEEP_MODE_IDLE:
break;
case PM_SLEEP_MODE_LIGHT:
HAL_SuspendTick();
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
break;
case PM_SLEEP_MODE_DEEP:
HAL_SuspendTick();
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: 0 if no one is waiting, != 0 otherwise */ | int stdma_others_waiting(void) | /* Returns: 0 if no one is waiting, != 0 otherwise */
int stdma_others_waiting(void) | {
return waitqueue_active(&stdma_wait);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: (array length=count) (element-type guint8) (transfer none): read-only buffer */ | const void* g_buffered_input_stream_peek_buffer(GBufferedInputStream *stream, gsize *count) | /* Returns: (array length=count) (element-type guint8) (transfer none): read-only buffer */
const void* g_buffered_input_stream_peek_buffer(GBufferedInputStream *stream, gsize *count) | {
GBufferedInputStreamPrivate *priv;
g_return_val_if_fail (G_IS_BUFFERED_INPUT_STREAM (stream), NULL);
priv = stream->priv;
if (count)
*count = priv->end - priv->pos;
return priv->buffer + priv->pos;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enroll new KEK into the System without PK's authentication. The SignatureOwner GUID will be Private->SignatureGUID. */ | EFI_STATUS EnrollKeyExchangeKey(IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private) | /* Enroll new KEK into the System without PK's authentication. The SignatureOwner GUID will be Private->SignatureGUID. */
EFI_STATUS EnrollKeyExchangeKey(IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private) | {
UINT16 *FilePostFix;
EFI_STATUS Status;
UINTN NameLength;
if ((Private->FileContext->FHandle == NULL) || (Private->FileContext->FileName == NULL) || (Private->SignatureGUID == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = SetSecureBootMode (CUSTOM_SECURE_BOOT_MODE);
if (EFI_ERROR (St... | tianocore/edk2 | C++ | Other | 4,240 |
/* Set ps_hold data driving value high This enables the machine to stay powered on after the initial power-on condition goes away (e.g. power button). */ | void set_ps_hold_ctrl(void) | /* Set ps_hold data driving value high This enables the machine to stay powered on after the initial power-on condition goes away (e.g. power button). */
void set_ps_hold_ctrl(void) | {
if (cpu_is_exynos5())
exynos5_set_ps_hold_ctrl();
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Writes an unsigned 8 bit values over I2C. */ | err_t ht16k33Write8(uint8_t reg, uint8_t value) | /* Writes an unsigned 8 bit values over I2C. */
err_t ht16k33Write8(uint8_t reg, uint8_t value) | {
I2CWriteLength = 3;
I2CReadLength = 0;
I2CMasterBuffer[0] = HT16K33_I2C_ADDRESS;
I2CMasterBuffer[1] = reg;
I2CMasterBuffer[2] = (value);
ASSERT_I2C_STATUS(i2cEngine());
return ERROR_NONE;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* I2C Set the secondary 7 bit Slave Address for the Peripheral.
This sets a secondary address for Slave mode operation, in 7 bit form. */ | void i2c_set_own_7bit_slave_address_two(uint32_t i2c, uint8_t slave) | /* I2C Set the secondary 7 bit Slave Address for the Peripheral.
This sets a secondary address for Slave mode operation, in 7 bit form. */
void i2c_set_own_7bit_slave_address_two(uint32_t i2c, uint8_t slave) | {
uint16_t val = (uint16_t)(slave << 1);
I2C_OAR2(i2c) = val;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Enable or disable the read of the unit for background space. */ | void MPU_BackgroundReadCmd(uint32_t u32Unit, en_functional_state_t enNewState) | /* Enable or disable the read of the unit for background space. */
void MPU_BackgroundReadCmd(uint32_t u32Unit, en_functional_state_t enNewState) | {
uint32_t u32UnitPos = 0UL;
uint32_t u32Temp;
DDL_ASSERT(IS_MPU_UNLOCK());
DDL_ASSERT(IS_MPU_UNIT(u32Unit));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
u32Temp = u32Unit;
while (0UL != u32Temp) {
if (0UL != (u32Temp & 0x1UL)) {
if (DISABLE != enNewState) {
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as opposed to a regular memory cleansing writeback. The difference between these two operations is that if a dirty page/buffer is encountered, it must be waited upon, and not just skipped over. */ | int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, loff_t end, int sync_mode) | /* If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as opposed to a regular memory cleansing writeback. The difference between these two operations is that if a dirty page/buffer is encountered, it must be waited upon, and not just skipped over. */
int __filemap_fdatawrite_range(struct address_sp... | {
int ret;
struct writeback_control wbc = {
.sync_mode = sync_mode,
.nr_to_write = LONG_MAX,
.range_start = start,
.range_end = end,
};
if (!mapping_cap_writeback_dirty(mapping))
return 0;
ret = do_writepages(mapping, &wbc);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets output data for the specified GPIO port. */ | long GPIOPinPortDoutGet(unsigned long ulPort) | /* Gets output data for the specified GPIO port. */
long GPIOPinPortDoutGet(unsigned long ulPort) | {
xASSERT(GPIOBaseValid(ulPort));
return(xHWREG(ulPort + GPIO_DOUT));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This helper just factors out common code between do_lo_send_direct_write() and do_lo_send_write(). */ | static int __do_lo_send_write(struct file *file, u8 *buf, const int len, loff_t pos) | /* This helper just factors out common code between do_lo_send_direct_write() and do_lo_send_write(). */
static int __do_lo_send_write(struct file *file, u8 *buf, const int len, loff_t pos) | {
ssize_t bw;
mm_segment_t old_fs = get_fs();
set_fs(get_ds());
bw = file->f_op->write(file, buf, len, &pos);
set_fs(old_fs);
if (likely(bw == len))
return 0;
printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n",
(unsigned long long)pos, len);
if (bw >= 0)
bw = -EIO;
return bw;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disables the automatic hardware adjustement of HSI48TRM bits. */ | void CRS_DisableAutomaticCalibration(void) | /* Disables the automatic hardware adjustement of HSI48TRM bits. */
void CRS_DisableAutomaticCalibration(void) | {
CRS->CTRL_B.AUTOTRMEN = RESET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Simply wakes up any task that is blocked on the trace_wait queue. These is used with trace_poll for tasks polling the trace. */ | void trace_wake_up(void) | /* Simply wakes up any task that is blocked on the trace_wait queue. These is used with trace_poll for tasks polling the trace. */
void trace_wake_up(void) | {
int cpu;
if (trace_flags & TRACE_ITER_BLOCK)
return;
cpu = get_cpu();
if (!runqueue_is_locked(cpu))
wake_up(&trace_wait);
put_cpu();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 'type_cb()' - XML data type callback for mxmlLoadFile()... */ | mxml_type_t type_cb(mxml_node_t *node) | /* 'type_cb()' - XML data type callback for mxmlLoadFile()... */
mxml_type_t type_cb(mxml_node_t *node) | {
const char *type;
if ((type = mxmlElementGetAttr(node, "type")) == NULL)
type = node->value.element.name;
if (!strcmp(type, "integer"))
return (MXML_INTEGER);
else if (!strcmp(type, "opaque") || !strcmp(type, "pre"))
return (MXML_OPAQUE);
else if (!strcmp(type, "real"))
return (MXML_REAL);
... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Show that threads can be aborted from interrupt context.
Spwan a thread, then enter ISR context in main thread and abort the child thread. Check if ISR completed and target thread was aborted. */ | ZTEST(threads_lifecycle, test_abort_from_isr_not_self) | /* Show that threads can be aborted from interrupt context.
Spwan a thread, then enter ISR context in main thread and abort the child thread. Check if ISR completed and target thread was aborted. */
ZTEST(threads_lifecycle, test_abort_from_isr_not_self) | {
k_tid_t tid;
isr_finished = false;
k_sem_init(&sem_abort, 0, 1);
tid = k_thread_create(&tdata, tstack, STACK_SIZE, entry_aborted_thread,
NULL, NULL, NULL, 0, 0, K_NO_WAIT);
k_sem_take(&sem_abort, K_FOREVER);
irq_offload(offload_func, (void *)tid);
k_thread_join(&tdata, K_FOREVER);
zassert_true(isr_finished... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Enable the assertion of core reset signal when a brownout detection occurs. */ | void supc_enable_brownout_reset(Supc *p_supc) | /* Enable the assertion of core reset signal when a brownout detection occurs. */
void supc_enable_brownout_reset(Supc *p_supc) | {
uint32_t ul_mr = p_supc->SUPC_MR & (~(SUPC_MR_KEY_Msk | SUPC_MR_BODRSTEN));
p_supc->SUPC_MR = SUPC_MR_KEY_PASSWD | ul_mr | SUPC_MR_BODRSTEN;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Checks if a command exists as a dynamic command protocol instance */ | BOOLEAN ShellCommandDynamicCommandExists(IN CONST CHAR16 *CommandString) | /* Checks if a command exists as a dynamic command protocol instance */
BOOLEAN ShellCommandDynamicCommandExists(IN CONST CHAR16 *CommandString) | {
return (BOOLEAN)((ShellCommandFindDynamicCommand (CommandString) != NULL));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sends the contents of a data buffer through the specified USART peripheral. This function returns immediately (1 if the buffer has been queued, 0 otherwise); poll the ENDTX and TXBUFE bits of the USART status register to check for the transfer completion. */ | unsigned char USART_WriteBuffer(AT91S_USART *usart, void *buffer, unsigned int size) | /* Sends the contents of a data buffer through the specified USART peripheral. This function returns immediately (1 if the buffer has been queued, 0 otherwise); poll the ENDTX and TXBUFE bits of the USART status register to check for the transfer completion. */
unsigned char USART_WriteBuffer(AT91S_USART *usart, void ... | {
if ((usart->US_TCR == 0) && (usart->US_TNCR == 0)) {
usart->US_TPR = (unsigned int) buffer;
usart->US_TCR = size;
usart->US_PTCR = AT91C_PDC_TXTEN;
return 1;
}
else if (usart->US_TNCR == 0) {
usart->US_TNPR = (unsigned int) buffer;
usart->US_TNCR = size;
... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Returns 0 on success or negative error code on failure. */ | static int __exit i2o_proc_fs_destroy(void) | /* Returns 0 on success or negative error code on failure. */
static int __exit i2o_proc_fs_destroy(void) | {
struct i2o_controller *c;
list_for_each_entry(c, &i2o_controllers, list)
i2o_proc_iop_remove(i2o_proc_dir_root, c);
remove_proc_entry("i2o", NULL);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ | static int stm32f2_init(void) | /* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int stm32f2_init(void) | {
LL_FLASH_EnableInstCache();
LL_FLASH_EnableDataCache();
SystemCoreClock = 16000000;
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* DESCRIPTION: Query the PLIC what interrupt we should serve. Perform an interrupt claim by reading the claim register, which returns the ID of the highest-priority pending interrupt or zero if there is no pending interrupt. A successful claim also atomically clears the corresponding pending bit on the interrupt sourc... | int plic_claim(void) | /* DESCRIPTION: Query the PLIC what interrupt we should serve. Perform an interrupt claim by reading the claim register, which returns the ID of the highest-priority pending interrupt or zero if there is no pending interrupt. A successful claim also atomically clears the corresponding pending bit on the interrupt sourc... | {
int hart = __raw_hartid();
int irq = *(uint32_t *)PLIC_CLAIM(hart);
return irq;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The DECnet spec requires that the "routing layer" accepts packets which are at least 230 bytes in size. This excludes any headers which the NSP layer might add, so we always assume that we'll be using the maximal length header on data packets. The variation in length is due to the inclusion (or not) of the two 16 bi... | unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu) | /* The DECnet spec requires that the "routing layer" accepts packets which are at least 230 bytes in size. This excludes any headers which the NSP layer might add, so we always assume that we'll be using the maximal length header on data packets. The variation in length is due to the inclusion (or not) of the two 16 bi... | {
unsigned mss = 230 - DN_MAX_NSP_DATA_HEADER;
if (dev) {
struct dn_dev *dn_db = dev->dn_ptr;
mtu -= LL_RESERVED_SPACE(dev);
if (dn_db->use_long)
mtu -= 21;
else
mtu -= 6;
mtu -= DN_MAX_NSP_DATA_HEADER;
} else {
mtu -= (21 + DN_MAX_NSP_DATA_HEADER + 16);
}
if (mtu > mss)
mss = mtu;
return mss;... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* TEI interrupt processing for UART mode. The TEI interrupt fires after the last byte is transmitted on the TX pin. The user callback function is called with the UART_EVENT_TX_COMPLETE event code (if it is registered in */ | void sci_uart_tei_isr(void) | /* TEI interrupt processing for UART mode. The TEI interrupt fires after the last byte is transmitted on the TX pin. The user callback function is called with the UART_EVENT_TX_COMPLETE event code (if it is registered in */
void sci_uart_tei_isr(void) | {
FSP_CONTEXT_SAVE;
IRQn_Type irq = R_FSP_CurrentIrqGet();
sci_uart_instance_ctrl_t * p_ctrl = (sci_uart_instance_ctrl_t *) R_FSP_IsrContextGet(irq);
p_ctrl->p_reg->SCR &= (uint8_t) ~(SCI_SCR_TIE_MASK | SCI_SCR_TEIE_MASK);
r_sci_uart_call_callback(p_ctrl, 0U, UART_EVENT_TX_COMPLETE);
R_BSP_IrqSt... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector15_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector15_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (15 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */ | void Error_Handler(void) | /* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
void Error_Handler(void) | {
while (1)
{
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Correct a list of gray objects. Return pointer to where rest of the list should be linked. Because this correction is done after sweeping, young objects might be turned white and still be in the list. They are only removed. 'TOUCHED1' objects are advanced to 'TOUCHED2' and remain on the list; Non-white threads also ... | static GCObject** correctgraylist(GCObject **p) | /* Correct a list of gray objects. Return pointer to where rest of the list should be linked. Because this correction is done after sweeping, young objects might be turned white and still be in the list. They are only removed. 'TOUCHED1' objects are advanced to 'TOUCHED2' and remain on the list; Non-white threads also ... | {
GCObject **next = getgclist(curr);
if (iswhite(curr))
goto remove;
else if (getage(curr) == G_TOUCHED1) {
lua_assert(isgray(curr));
nw2black(curr);
changeage(curr, G_TOUCHED1, G_TOUCHED2);
goto remain;
}
else if (curr->tt == LUA_VTHREAD) {
lua_assert(isgray(curr... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Check whether the flag is set or reset. */ | uint16_t TMR_ReadStatusFlag(TMR_T *tmr, TMR_FLAG_T flag) | /* Check whether the flag is set or reset. */
uint16_t TMR_ReadStatusFlag(TMR_T *tmr, TMR_FLAG_T flag) | {
if ((tmr->STS & flag) != RESET)
{
return SET;
}
else
{
return RESET;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Writes an 8-bit register.. If UseMmio is TRUE, then the value is written to MMIO space. If UseMmio is FALSE, then the value is written to I/O space. The parameter Offset is added to the base address of the registers. */ | UINT8 SerialPortWriteRegister(UINTN Base, UINTN Offset, UINT8 Value, BOOLEAN UseMmio, UINT8 RegisterStride) | /* Writes an 8-bit register.. If UseMmio is TRUE, then the value is written to MMIO space. If UseMmio is FALSE, then the value is written to I/O space. The parameter Offset is added to the base address of the registers. */
UINT8 SerialPortWriteRegister(UINTN Base, UINTN Offset, UINT8 Value, BOOLEAN UseMmio, UINT8 Regis... | {
if (UseMmio) {
return MmioWrite8 (Base + Offset * RegisterStride, Value);
} else {
return IoWrite8 (Base + Offset * RegisterStride, Value);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */... | {
VOID *Buffer;
Buffer = AllocatePool (AllocationSize);
if (Buffer == NULL) {
return NULL;
}
ZeroMem (Buffer, AllocationSize);
return Buffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the current value of the burst transfer counter. */ | uint32_t I2CMasterBurstCountGet(uint32_t ui32Base) | /* Returns the current value of the burst transfer counter. */
uint32_t I2CMasterBurstCountGet(uint32_t ui32Base) | {
ASSERT(_I2CBaseValid(ui32Base));
return(HWREG(ui32Base + I2C_O_MBCNT));
} | micropython/micropython | C++ | Other | 18,334 |
/* stop a charge-transfer sequence when TSI is in software trigger mode */ | void tsi_software_stop(void) | /* stop a charge-transfer sequence when TSI is in software trigger mode */
void tsi_software_stop(void) | {
TSI_CTL &= ~TSI_CTL_TSIS;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Boolean function indiciating if a CODEC register is volatile. */ | int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg) | /* Boolean function indiciating if a CODEC register is volatile. */
int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg) | {
if (codec->volatile_register)
return codec->volatile_register(reg);
else
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* vmalloc=size forces the vmalloc area to be exactly 'size' bytes. This can be used to increase (or decrease) the vmalloc area - the default is 128m. */ | static int __init parse_vmalloc(char *arg) | /* vmalloc=size forces the vmalloc area to be exactly 'size' bytes. This can be used to increase (or decrease) the vmalloc area - the default is 128m. */
static int __init parse_vmalloc(char *arg) | {
if (!arg)
return -EINVAL;
__VMALLOC_RESERVE = memparse(arg, &arg) + VMALLOC_OFFSET;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initiates a read packet operation.
Reads a data packet from the specified slave address on the I */ | enum status_code i2c_master_read_packet_job(struct i2c_master_module *const module, struct i2c_master_packet *const packet) | /* Initiates a read packet operation.
Reads a data packet from the specified slave address on the I */
enum status_code i2c_master_read_packet_job(struct i2c_master_module *const module, struct i2c_master_packet *const packet) | {
Assert(module);
Assert(module->hw);
Assert(packet);
if (module->buffer_remaining > 0) {
return STATUS_BUSY;
}
module->send_stop = true;
module->send_nack = true;
return _i2c_master_read_packet(module, packet);
} | memfault/zero-to-main | C++ | null | 200 |
/* set the number of remaining data to be transferred by the DMA */ | void dma_transfer_number_config(uint32_t dma_periph, dma_channel_enum channelx, uint32_t number) | /* set the number of remaining data to be transferred by the DMA */
void dma_transfer_number_config(uint32_t dma_periph, dma_channel_enum channelx, uint32_t number) | {
DMA_CHCNT(dma_periph, channelx) = (number & DMA_CHANNEL_CNT_MASK);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* See _g_freedesktop_dbus_call_reload_config_sync() for the synchronous, blocking version of this method. */ | void _g_freedesktop_dbus_call_reload_config(_GFreedesktopDBus *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) | /* See _g_freedesktop_dbus_call_reload_config_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_reload_config(_GFreedesktopDBus *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) | {
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
"ReloadConfig",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
callback,
user_data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Un-Register the Service B.2 and all its Characteristics... */ | void service_b_2_1_remove(void) | /* Un-Register the Service B.2 and all its Characteristics... */
void service_b_2_1_remove(void) | {
bt_gatt_service_unregister(&service_b_2_1_svc);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ | int main(void) | /* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void) | {
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
USB_USBTask();
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Update only state field of an address mapping */ | int wlp_eda_update_node_state(struct wlp_eda *eda, const struct uwb_dev_addr *dev_addr, const enum wlp_wss_connect state) | /* Update only state field of an address mapping */
int wlp_eda_update_node_state(struct wlp_eda *eda, const struct uwb_dev_addr *dev_addr, const enum wlp_wss_connect state) | {
int result = -ENOENT;
struct wlp_eda_node *itr;
unsigned long flags;
spin_lock_irqsave(&eda->lock, flags);
list_for_each_entry(itr, &eda->cache, list_node) {
if (!memcmp(&itr->dev_addr, dev_addr, sizeof(itr->dev_addr))) {
itr->state = state;
result = 0;
goto out_unlock;
}
}
out_unlock:
spin_unlock... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* UART MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_UART_MspInit(UART_HandleTypeDef *huart) | /* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Sets the owner of the lockres, associated to the mle, to UNKNOWN */ | static struct dlm_lock_resource* dlm_reset_mleres_owner(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle) | /* Sets the owner of the lockres, associated to the mle, to UNKNOWN */
static struct dlm_lock_resource* dlm_reset_mleres_owner(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle) | {
struct dlm_lock_resource *res;
res = __dlm_lookup_lockres(dlm, mle->mname, mle->mnamelen,
mle->mnamehash);
if (res) {
spin_unlock(&dlm->master_lock);
spin_lock(&res->spinlock);
dlm_set_lockres_owner(dlm, res, DLM_LOCK_RES_OWNER_UNKNOWN);
dlm_move_lockres_to_recovery_list(dlm, res);
spin_unlock(&re... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DMA get current destination offset in non-sequence mode. */ | uint32_t DMA_GetNonSeqDestOffset(const CM_DMA_TypeDef *DMAx, uint8_t u8Ch) | /* DMA get current destination offset in non-sequence mode. */
uint32_t DMA_GetNonSeqDestOffset(const CM_DMA_TypeDef *DMAx, uint8_t u8Ch) | {
DDL_ASSERT(IS_DMA_UNIT(DMAx));
DDL_ASSERT(IS_DMA_CH(u8Ch));
return (READ_REG32_BIT(DMA_CH_REG(DMAx->MONDNSEQCTL0, u8Ch), DMA_DNSEQCTL_DOFFSET));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return: 0 on success -EINVAL invalid (out of range) protocol number -EBUSY protocol already in use -ENOBUF if proto_register() fails */ | int can_proto_register(struct can_proto *cp) | /* Return: 0 on success -EINVAL invalid (out of range) protocol number -EBUSY protocol already in use -ENOBUF if proto_register() fails */
int can_proto_register(struct can_proto *cp) | {
int proto = cp->protocol;
int err = 0;
if (proto < 0 || proto >= CAN_NPROTO) {
printk(KERN_ERR "can: protocol number %d out of range\n",
proto);
return -EINVAL;
}
err = proto_register(cp->prot, 0);
if (err < 0)
return err;
spin_lock(&proto_tab_lock);
if (proto_tab[proto]) {
printk(KERN_ERR "c... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeUint16ToUint8(IN UINT16 Operand, OUT UINT8 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint16ToUint8(IN UINT16 Operand, OUT UINT8 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand <= MAX_UINT8) {
*Result = (UINT8)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = UINT8_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* dump device's information, name, id, parent, bus, driver, drv_data included */ | int u_device_dump(struct u_device *dev) | /* dump device's information, name, id, parent, bus, driver, drv_data included */
int u_device_dump(struct u_device *dev) | {
ddkc_err("dev is NULL\r\n");
return -1;
}
ddkc_info("dev:%p, dev->name:%s, id:%d, dev_id:%d, parent:%p, bus:%p, drv:%p, drv_data:%p\r\n",
dev, dev->name,
dev->id, dev->dev_id,
dev->parent, dev->bus, dev->drv, dev->driver_data);
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Shutdown the sending side of a connection. Much like close except that we don't receive shut down or sock_set_flag(sk, SOCK_DEAD). */ | void tcp_shutdown(struct sock *sk, int how) | /* Shutdown the sending side of a connection. Much like close except that we don't receive shut down or sock_set_flag(sk, SOCK_DEAD). */
void tcp_shutdown(struct sock *sk, int how) | {
if (!(how & SEND_SHUTDOWN))
return;
if ((1 << sk->sk_state) &
(TCPF_ESTABLISHED | TCPF_SYN_SENT |
TCPF_SYN_RECV | TCPF_CLOSE_WAIT)) {
if (tcp_close_state(sk))
tcp_send_fin(sk);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Processes and authenticates blocks of data, either encrypt it or decrypts it. */ | bool AESDataProcessAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length, uint32_t *pui32AuthSrc, uint32_t ui32AuthLength, uint32_t *pui32Tag) | /* Processes and authenticates blocks of data, either encrypt it or decrypts it. */
bool AESDataProcessAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length, uint32_t *pui32AuthSrc, uint32_t ui32AuthLength, uint32_t *pui32Tag) | {
uint32_t ui32Count;
ASSERT(ui32Base == AES_BASE);
AESLengthSet(ui32Base, (uint64_t)ui32Length);
AESAuthLengthSet(ui32Base, ui32AuthLength);
for(ui32Count = 0; ui32Count < ui32AuthLength; ui32Count += 16)
{
AESDataWrite(ui32Base, pui32AuthSrc + (ui32Count / 4));
}
for(ui32Count ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reduce the maximal size of Stream's Buffer (MaxBufferSize field). */ | EFI_STATUS EFIAPI AmlStreamReduceMaxBufferSize(IN AML_STREAM *Stream, IN UINT32 Diff) | /* Reduce the maximal size of Stream's Buffer (MaxBufferSize field). */
EFI_STATUS EFIAPI AmlStreamReduceMaxBufferSize(IN AML_STREAM *Stream, IN UINT32 Diff) | {
if (!IS_STREAM (Stream) ||
(Diff == 0) ||
((Stream->MaxBufferSize - Diff) <= Stream->Index))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Stream->MaxBufferSize -= Diff;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This is used directly or indirectly to implement gpio_get_value(). It returns the zero or nonzero value provided by the associated gpio_chip.get() method; or zero if no such method is provided. */ | int __gpio_get_value(unsigned gpio) | /* This is used directly or indirectly to implement gpio_get_value(). It returns the zero or nonzero value provided by the associated gpio_chip.get() method; or zero if no such method is provided. */
int __gpio_get_value(unsigned gpio) | {
struct gpio_chip *chip;
chip = gpio_to_chip(gpio);
WARN_ON(extra_checks && chip->can_sleep);
return chip->get ? chip->get(chip, gpio - chip->base) : 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310 @etdev: pointer to our adapter structure */ | void et131x_tx_dma_disable(struct et131x_adapter *etdev) | /* et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310 @etdev: pointer to our adapter structure */
void et131x_tx_dma_disable(struct et131x_adapter *etdev) | {
writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT,
&etdev->regs->txdma.csr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called by hardware driver to signal that the controller is up and running. */ | void capi_ctr_ready(struct capi_ctr *card) | /* Called by hardware driver to signal that the controller is up and running. */
void capi_ctr_ready(struct capi_ctr *card) | {
card->cardstate = CARD_RUNNING;
printk(KERN_NOTICE "kcapi: card [%03d] \"%s\" ready.\n",
card->cnr, card->name);
notify_push(KCI_CONTRUP, card->cnr, 0, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT8 EFIAPI PciBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldAnd8(IN UINTN... | {
return PciCf8BitFieldAnd8 (Address, StartBit, EndBit, AndData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function parses the PCC Subspace type 3. */ | STATIC VOID DumpPccSubspaceType3(IN UINT8 *Ptr, IN UINT8 Length) | /* This function parses the PCC Subspace type 3. */
STATIC VOID DumpPccSubspaceType3(IN UINT8 *Ptr, IN UINT8 Length) | {
ParseAcpi (
TRUE,
2,
"Subspace Type 3",
Ptr,
Length,
PARSER_PARAMS (PccSubspaceType3Parser)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* @time_out time out value in milli seconds. Must be smaller than 0x01000000. */ | static void MAC_set_time_out(uint32_t time_out) | /* @time_out time out value in milli seconds. Must be smaller than 0x01000000. */
static void MAC_set_time_out(uint32_t time_out) | {
g_mss_mac.time_out_value = (time_out * 122u) / 10u;
g_mss_mac.last_timer_value = (uint16_t)( MAC->CSR11 & CSR11_TIM_MASK );
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Use this when you have no reliable task/vma, typically from interrupt context. It is less reliable than using the task's vma and may give false positives: */ | int in_gate_area_no_task(unsigned long addr) | /* Use this when you have no reliable task/vma, typically from interrupt context. It is less reliable than using the task's vma and may give false positives: */
int in_gate_area_no_task(unsigned long addr) | {
return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Delete card's pending timers, send STOP to linklevel */ | static void icn_stopcard(icn_card *card) | /* Delete card's pending timers, send STOP to linklevel */
static void icn_stopcard(icn_card *card) | {
unsigned long flags;
isdn_ctrl cmd;
spin_lock_irqsave(&card->lock, flags);
if (card->flags & ICN_FLAGS_RUNNING) {
card->flags &= ~ICN_FLAGS_RUNNING;
del_timer(&card->st_timer);
del_timer(&card->rb_timer);
spin_unlock_irqrestore(&card->lock, flags);
cmd.command = ISDN_STAT_STOP;
cmd.driver = card->myid... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads a CAN message from the receive queue of a PCAN Channel. */ | static TPCANStatus PCanUsbLibFuncRead(TPCANHandle Channel, TPCANMsg *MessageBuffer, TPCANTimestamp *TimestampBuffer) | /* Reads a CAN message from the receive queue of a PCAN Channel. */
static TPCANStatus PCanUsbLibFuncRead(TPCANHandle Channel, TPCANMsg *MessageBuffer, TPCANTimestamp *TimestampBuffer) | {
TPCANStatus result = PCAN_ERROR_INITIALIZE;
assert(pCanUsbLibFuncReadPtr != NULL);
assert(pCanUsbDllHandle != NULL);
if ((pCanUsbLibFuncReadPtr != NULL) && (pCanUsbDllHandle != NULL))
{
result = pCanUsbLibFuncReadPtr(Channel, MessageBuffer, TimestampBuffer);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Reads and returns the current value of MM6. This function is only available on IA-32 and X64. */ | UINT64 EFIAPI AsmReadMm6(VOID) | /* Reads and returns the current value of MM6. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm6(VOID) | {
UINT64 Data;
__asm__ __volatile__ (
"movd %%mm6, %0 \n\t"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* brief Aborts the slave non-blocking transfers. note This API could be called at any time to stop slave for handling the bus events. param base The LPI2C peripheral base address. param handle Pointer to #lpi2c_slave_handle_t structure which stores the transfer state. retval #kStatus_Success retval #kStatus_LPI2C_Idle... | void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle) | /* brief Aborts the slave non-blocking transfers. note This API could be called at any time to stop slave for handling the bus events. param base The LPI2C peripheral base address. param handle Pointer to #lpi2c_slave_handle_t structure which stores the transfer state. retval #kStatus_Success retval #kStatus_LPI2C_Idle... | {
assert(NULL != handle);
if (handle->isBusy)
{
LPI2C_SlaveDisableInterrupts(base, (uint32_t)kLPI2C_SlaveIrqFlags);
base->STAR = LPI2C_STAR_TXNACK_MASK;
(void)memset(&handle->transfer, 0, sizeof(handle->transfer));
handle->isBusy = false;
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* dccp_feat_register_sp - Register requests to change SP feature values @sk: client or listening socket @feat: one of dccp_feature_numbers @is_local: whether the local (1) or remote (0) @feat is meant @list: array of preferred values, in descending order of preference @len: length of @list in bytes */ | int dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local, u8 const *list, u8 len) | /* dccp_feat_register_sp - Register requests to change SP feature values @sk: client or listening socket @feat: one of dccp_feature_numbers @is_local: whether the local (1) or remote (0) @feat is meant @list: array of preferred values, in descending order of preference @len: length of @list in bytes */
int dccp_feat_r... | {
if (sk->sk_state != DCCP_CLOSED)
return -EISCONN;
if (dccp_feat_type(feat) != FEAT_SP)
return -EINVAL;
return __feat_register_sp(&dccp_sk(sk)->dccps_featneg, feat, is_local,
0, list, len);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Register/Clear RX callback. Callback will be invoked after the next received frame.
This function is usually invoked from the RX callback itself with NULL callback, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */ | void gmac_dev_set_rx_callback(gmac_device_t *p_gmac_dev, gmac_dev_tx_cb_t func_rx_cb) | /* Register/Clear RX callback. Callback will be invoked after the next received frame.
This function is usually invoked from the RX callback itself with NULL callback, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */
void gmac_dev_set_rx_callback(gmac... | {
Gmac *p_hw = p_gmac_dev->p_hw;
if (func_rx_cb == NULL) {
gmac_disable_interrupt(p_hw, GMAC_IDR_RCOMP);
p_gmac_dev->func_rx_cb = NULL;
} else {
p_gmac_dev->func_rx_cb = func_rx_cb;
gmac_enable_interrupt(p_hw, GMAC_IER_RCOMP);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Enables or disables I2C Extended Clock Timeout (SCL cumulative Timeout detection). */ | void I2C_ExtendedClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState) | /* Enables or disables I2C Extended Clock Timeout (SCL cumulative Timeout detection). */
void I2C_ExtendedClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState) | {
assert_param(IS_I2C_1_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->TIMEOUTR |= I2C_TIMEOUTR_TEXTEN;
}
else
{
I2Cx->TIMEOUTR &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TEXTEN);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Registration works over both AF_INET and AF_INET6, and services registered via this function are advertised as available for any address. If the local rpcbind daemon is listening on AF_INET6, services registered via this function will be advertised on IN6ADDR_ANY (ie available for all AF_INET and AF_INET6 addresses)... | int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port) | /* Registration works over both AF_INET and AF_INET6, and services registered via this function are advertised as available for any address. If the local rpcbind daemon is listening on AF_INET6, services registered via this function will be advertised on IN6ADDR_ANY (ie available for all AF_INET and AF_INET6 addresses)... | {
struct rpcbind_args map = {
.r_prog = prog,
.r_vers = vers,
.r_prot = prot,
.r_port = port,
};
struct rpc_message msg = {
.rpc_argp = &map,
};
int error;
error = rpcb_create_local();
if (error)
return error;
dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
"rpcbind\n", (port ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of "data" to the allocated memory, zero terminates the allocated memory, and returns a pointer to the allocated memory. If the allocation fails, the program dies. */ | void* xmemdupz(const void *data, size_t len) | /* xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of "data" to the allocated memory, zero terminates the allocated memory, and returns a pointer to the allocated memory. If the allocation fails, the program dies. */
void* xmemdupz(const void *data, size_t len) | {
char *p = xmalloc(len + 1);
memcpy(p, data, len);
p[len] = '\0';
return p;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the first valid block number on the range list. */ | INTN Mtftp4GetNextBlockNum(IN LIST_ENTRY *Head) | /* Get the first valid block number on the range list. */
INTN Mtftp4GetNextBlockNum(IN LIST_ENTRY *Head) | {
MTFTP4_BLOCK_RANGE *Range;
if (IsListEmpty (Head)) {
return -1;
}
Range = NET_LIST_HEAD (Head, MTFTP4_BLOCK_RANGE, Link);
return Range->Start;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Performs a software reset of a MCU and associated peripherals */ | void PRCMMCUReset(tBoolean bIncludeSubsystem) | /* Performs a software reset of a MCU and associated peripherals */
void PRCMMCUReset(tBoolean bIncludeSubsystem) | {
if(bIncludeSubsystem)
{
HWREG(GPRCM_BASE+ GPRCM_O_APPS_SOFT_RESET) = 0x2;
}
else
{
HWREG(GPRCM_BASE+ GPRCM_O_APPS_SOFT_RESET) = 0x1;
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Enables or disables the TIM peripheral Main Outputs. */ | void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Enables or disables the TIM peripheral Main Outputs. */
void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST2_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->BDTR |= TIM_BDTR_MOE;
}
else
{
TIMx->BDTR &= (uint16_t)(~((uint16_t)TIM_BDTR_MOE));
}
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* Deal with any received signals. This includes ctrl-C to stop the program. */ | static void sig_int(int signo) | /* Deal with any received signals. This includes ctrl-C to stop the program. */
static void sig_int(int signo) | {
(void) signo;
if (FD_pipe != -1)
{
printf("\nClosing pipe.\n");
close(FD_pipe);
}
if (FD_com != -1)
{
printf("\nClosing serial port.\n");
close(FD_com);
}
printf("\nSignal captured and devices shut down.\n");
exit(0);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* The default values are: code config->clockSource = kGPT_ClockSource_Periph; config->divider = 1U; config->enableRunInStop = true; config->enableRunInWait = true; config->enableRunInDoze = false; config->enableRunInDbg = false; config->enableFreeRun = true; config->enableMode = true; endcode param config Pointer to t... | void GPT_GetDefaultConfig(gpt_config_t *config) | /* The default values are: code config->clockSource = kGPT_ClockSource_Periph; config->divider = 1U; config->enableRunInStop = true; config->enableRunInWait = true; config->enableRunInDoze = false; config->enableRunInDbg = false; config->enableFreeRun = true; config->enableMode = true; endcode param config Pointer to t... | {
assert(config);
memset(config, 0, sizeof(*config));
config->clockSource = kGPT_ClockSource_Periph;
config->divider = 1U;
config->enableRunInStop = true;
config->enableRunInWait = true;
config->enableRunInDoze = false;
config->enableRunInDbg = false;
config->enableFreeR... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* 7.3.2.9.1 Slice data partition A RBSP syntax slice_data_partition_a_layer_rbsp( ) */ | static void dissect_h264_slice_data_partition_a_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset) | /* 7.3.2.9.1 Slice data partition A RBSP syntax slice_data_partition_a_layer_rbsp( ) */
static void dissect_h264_slice_data_partition_a_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset) | {
gint bit_offset;
bit_offset = offset <<3;
bit_offset = dissect_h264_slice_header(tree, tvb, pinfo, bit_offset);
dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
proto_tree_add_expert(tree, pinfo, &ei_h264_undecoded, tvb, bit_offset>>3, -1);
return;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* sys_arch_protect() is only required if your port is supporting an operating system. */ | sys_prot_t sys_arch_protect(void) | /* sys_arch_protect() is only required if your port is supporting an operating system. */
sys_prot_t sys_arch_protect(void) | {
vPortEnterCritical();
return 1;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Read and write a data element from and to the SPI interface. */ | unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData) | /* Read and write a data element from and to the SPI interface. */
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData) | {
unsigned long ulReadTemp;
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY))
{
}
xHWREG(ulBase + SPI_TX0) = ulWData;
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY;
while((xHWREG(ulBase ... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns zero if successful, or a negative error code on failure. */ | int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) | /* Returns zero if successful, or a negative error code on failure. */
int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm) | {
struct snd_pcm_substream *substream;
int stream;
for (stream = 0; stream < 2; stream++)
for (substream = pcm->streams[stream].substream; substream; substream = substream->next)
snd_pcm_lib_preallocate_free(substream);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Finish an iteration. Always call this function after iteration is complete whether the iteration ran till the end or not. */ | void class_dev_iter_exit(struct class_dev_iter *iter) | /* Finish an iteration. Always call this function after iteration is complete whether the iteration ran till the end or not. */
void class_dev_iter_exit(struct class_dev_iter *iter) | {
klist_iter_exit(&iter->ki);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* for now each logical cpu is in its own vector allocation domain. */ | static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask) | /* for now each logical cpu is in its own vector allocation domain. */
static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask) | {
cpumask_clear(retmask);
cpumask_set_cpu(cpu, retmask);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* s e t T o F a s t */ | returnValue Options_setToFast(Options *_THIS) | /* s e t T o F a s t */
returnValue Options_setToFast(Options *_THIS) | {
return Options_setToMPC( _THIS );
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* Helper function which handles entry to and exit from light sleep Placed into IRAM as flash may need some time to be powered on. */ | static esp_err_t esp_light_sleep_inner(uint32_t pd_flags, uint32_t flash_enable_time_us, rtc_vddsdio_config_t vddsdio_config) IRAM_ATTR __attribute__((noinline)) | /* Helper function which handles entry to and exit from light sleep Placed into IRAM as flash may need some time to be powered on. */
static esp_err_t esp_light_sleep_inner(uint32_t pd_flags, uint32_t flash_enable_time_us, rtc_vddsdio_config_t vddsdio_config) IRAM_ATTR __attribute__((noinline)) | {
esp_err_t err = esp_sleep_start(pd_flags);
if (vddsdio_config.force) {
rtc_vddsdio_set_config(vddsdio_config);
}
if (pd_flags & RTC_SLEEP_PD_VDDSDIO) {
ets_delay_us(flash_enable_time_us);
}
return err;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Expands the 3 byte size commonly used in Firmware Volume data structures */ | VOID FvBufCompact3ByteSize(OUT VOID *SizeDest, IN UINT32 Size) | /* Expands the 3 byte size commonly used in Firmware Volume data structures */
VOID FvBufCompact3ByteSize(OUT VOID *SizeDest, IN UINT32 Size) | {
((UINT8*)SizeDest)[0] = (UINT8)Size;
((UINT8*)SizeDest)[1] = (UINT8)(Size >> 8);
((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */ | EFI_STATUS SdPeimGetCsd(IN SD_PEIM_HC_SLOT *Slot, IN UINT16 Rca, OUT SD_CSD *Csd) | /* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
EFI_STATUS SdPeimGetCsd(IN SD_PEIM_HC_SLOT *Slot, IN UINT16 Rca, OUT SD_CSD *Csd) | {
SD_COMMAND_BLOCK SdCmdBlk;
SD_STATUS_BLOCK SdStatusBlk;
SD_COMMAND_PACKET Packet;
EFI_STATUS Status;
ZeroMem (&SdCmdBlk, sizeof (SdCmdBlk));
ZeroMem (&SdStatusBlk, sizeof (SdStatusBlk));
ZeroMem (&Packet, sizeof (Packet));
Packet.SdCmdBlk = &SdCmdBlk;
Packet.SdStatusBlk = &SdStatusB... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: the last element in the #GSList, or NULL if the #GSList has no elements */ | GSList* g_slist_last(GSList *list) | /* Returns: the last element in the #GSList, or NULL if the #GSList has no elements */
GSList* g_slist_last(GSList *list) | {
if (list)
{
while (list->next)
list = list->next;
}
return list;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT32 EFIAPI PciBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI PciBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN... | {
return BitFieldRead32 (PciRead32 (Address), StartBit, EndBit);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* retval kStatus_Success Started successfully. retval kStatus_CSI_NoFullBuffer There is no full frame buffer in queue. */ | status_t CSI_TransferGetFullBuffer(CSI_Type *base, csi_handle_t *handle, uint32_t *frameBuffer) | /* retval kStatus_Success Started successfully. retval kStatus_CSI_NoFullBuffer There is no full frame buffer in queue. */
status_t CSI_TransferGetFullBuffer(CSI_Type *base, csi_handle_t *handle, uint32_t *frameBuffer) | {
uint32_t csicr1;
status_t status;
uint8_t queueReadIdx;
uint8_t queueWriteIdx;
queueReadIdx = handle->queueReadIdx;
queueWriteIdx = handle->queueWriteIdx;
if (queueReadIdx == queueWriteIdx)
{
status = kStatus_CSI_NoFullBuffer;
}
else
{
csicr1 = CSI_REG_CR1(... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the BLE core stack version.
This API is used to get the core BLE stack version */ | ADI_BLER_RESULT adi_radio_GetCoreStackVersion(uint32_t *const pVersion) | /* Returns the BLE core stack version.
This API is used to get the core BLE stack version */
ADI_BLER_RESULT adi_radio_GetCoreStackVersion(uint32_t *const pVersion) | {
ADI_BLER_RESULT bleResult;
ASSERT(pVersion != NULL);
ADI_BLE_LOGEVENT(LOGID_CMD_BLEM_GET_STACK_VER);
ADI_BLE_RADIO_CMD_START(CMD_BLEM_GET_STACK_VER);
bleResult = bler_process_cmd(CMD_BLEM_GET_STACK_VER, 0u, pVersion, 4u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult = ADI_BLE_WAIT_FOR_COM... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* sweep at most 'countin' elements from a list of GCObjects erasing dead objects, where a dead object is one marked with the old (non current) white; change all non-dead objects back to white, preparing for next collection cycle. Return where to continue the traversal or NULL if list is finished. ('*countout' gets the... | static GCObject** sweeplist(lua_State *L, GCObject **p, int countin, int *countout) | /* sweep at most 'countin' elements from a list of GCObjects erasing dead objects, where a dead object is one marked with the old (non current) white; change all non-dead objects back to white, preparing for next collection cycle. Return where to continue the traversal or NULL if list is finished. ('*countout' gets the... | {
global_State *g = G(L);
int ow = otherwhite(g);
int i;
int white = luaC_white(g);
for (i = 0; *p != NULL && i < countin; i++) {
GCObject *curr = *p;
int marked = curr->marked;
if (isdeadm(ow, marked)) {
*p = curr->next;
freeobj(L, curr);
}
else {
curr->marked = cast_byt... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This function is used by the IDE bus driver to get inquiry data. Data format of Identify data is defined by the Interface GUID. */ | EFI_STATUS EFIAPI ScsiDiskInfoInquiry(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *InquiryData, IN OUT UINT32 *InquiryDataSize) | /* This function is used by the IDE bus driver to get inquiry data. Data format of Identify data is defined by the Interface GUID. */
EFI_STATUS EFIAPI ScsiDiskInfoInquiry(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *InquiryData, IN OUT UINT32 *InquiryDataSize) | {
EFI_STATUS Status;
SCSI_DISK_DEV *ScsiDiskDevice;
ScsiDiskDevice = SCSI_DISK_DEV_FROM_DISKINFO (This);
Status = EFI_BUFFER_TOO_SMALL;
if (*InquiryDataSize >= sizeof (ScsiDiskDevice->InquiryData)) {
Status = EFI_SUCCESS;
CopyMem (InquiryData, &ScsiDiskDevice->InquiryData, sizeof (ScsiDiskDevice-... | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the HTS221 temperature sensor output data rate. */ | int32_t HTS221_TEMP_SetOutputDataRate(HTS221_Object_t *pObj, float Odr) | /* Set the HTS221 temperature sensor output data rate. */
int32_t HTS221_TEMP_SetOutputDataRate(HTS221_Object_t *pObj, float Odr) | {
return HTS221_SetOutputDataRate(pObj, Odr);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi) | /* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi) | {
if(hqspi->Instance==QUADSPI)
{
__HAL_RCC_QSPI_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_6);
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_2);
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_13|GPIO_PIN_12|GPIO_PIN_11);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the receive buffer size for a given USB endpoint. */ | static uint16_t calc_ep_count_rx(uint16_t *size) | /* Set the receive buffer size for a given USB endpoint. */
static uint16_t calc_ep_count_rx(uint16_t *size) | {
uint16_t size_value = *size, reg;
if (size_value > 62) {
uint16_t blocks_32byte = DIVIDE_AND_CEIL(size_value, 32) & 0x1F;
size_value = blocks_32byte * 32;
reg = USB_EP_COUNT_RX_BL_SIZE |
USB_EP_COUNT_RX_NUM_BLOCK(blocks_32byte - 1);
} else {
uint16_t blocks_2byte = DIVIDE_AND_CEIL(size_value, 2) & 0x1F... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Request the PE to send a GET_COUNTRY_CODES message. */ | USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryCodes(uint8_t PortNum) | /* Request the PE to send a GET_COUNTRY_CODES message. */
USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryCodes(uint8_t PortNum) | {
return USBPD_PE_Request_CtrlMessage(PortNum, USBPD_CONTROLMSG_GET_COUNTRY_CODES, USBPD_SOPTYPE_SOP);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.