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 |
|---|---|---|---|---|---|---|---|
/* This is an API between the MCU model/IRQ handling side and the IRQ controller model */ | void hw_irq_ctrl_clear_irq(unsigned int irq) | /* This is an API between the MCU model/IRQ handling side and the IRQ controller model */
void hw_irq_ctrl_clear_irq(unsigned int irq) | {
irq_status &= ~((uint64_t)1<<irq);
irq_premask &= ~((uint64_t)1<<irq);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function returns %1 if nodes are dropped and %0 otherwise. */ | static int drop_incomplete_group(struct ubifs_scan_leb *sleb, int *offs) | /* This function returns %1 if nodes are dropped and %0 otherwise. */
static int drop_incomplete_group(struct ubifs_scan_leb *sleb, int *offs) | {
int dropped = 0;
while (!list_empty(&sleb->nodes)) {
struct ubifs_scan_node *snod;
struct ubifs_ch *ch;
snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node,
list);
ch = snod->node;
if (ch->group_type != UBIFS_IN_NODE_GROUP)
return dropped;
dbg_rcvry("dropping node at %d:%d", sleb->lnum, ... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* IDL typedef struct { IDL char computer_name; IDL long timecreated; IDL long serial_number; IDL } UAS_INFO_0; */ | static int netlogon_dissect_UAS_INFO_0(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL typedef struct { IDL char computer_name; IDL long timecreated; IDL long serial_number; IDL } UAS_INFO_0; */
static int netlogon_dissect_UAS_INFO_0(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
guint32 time_created;
if(di->conformant_run){
return offset;
}
proto_tree_add_item(tree, hf_netlogon_computer_name, tvb, offset, 16, ENC_ASCII|ENC_NA);
offset += 16;
time_created = tvb_get_guint32(tvb, offset, DREP_ENC_INTEGER(drep));
proto_tree_add_uint_format_value(tree, hf_netlo... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* free buffer used from the application realizing it to the line toggles bit SW_BUF in the double buffered endpoint register */ | void USB_FreeUserBuf(uint8_t bEpNum, uint8_t bDir) | /* free buffer used from the application realizing it to the line toggles bit SW_BUF in the double buffered endpoint register */
void USB_FreeUserBuf(uint8_t bEpNum, uint8_t bDir) | {
if (bDir == EP_DBUF_OUT)
{
_ToggleDTOG_TX(bEpNum);
}
else if (bDir == EP_DBUF_IN)
{
_ToggleDTOG_RX(bEpNum);
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function is wrapper function to validate the buffer. */ | BOOLEAN EFIAPI VarCheckPolicyIsBufferOutsideValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length) | /* This function is wrapper function to validate the buffer. */
BOOLEAN EFIAPI VarCheckPolicyIsBufferOutsideValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length) | {
return MmIsBufferOutsideMmValid (Buffer, Length);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the I2C interrupt flag of the specified I2C port.
The */ | xtBoolean I2CIntFlagGet(unsigned long ulBase) | /* Get the I2C interrupt flag of the specified I2C port.
The */
xtBoolean I2CIntFlagGet(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
return ((xHWREG(ulBase + I2C_O_CON) & I2C_CON_SI) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Notify about a clock event change. Called with clockevents_lock held. */ | static void clockevents_do_notify(unsigned long reason, void *dev) | /* Notify about a clock event change. Called with clockevents_lock held. */
static void clockevents_do_notify(unsigned long reason, void *dev) | {
raw_notifier_call_chain(&clockevents_chain, reason, dev);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* static void fd_dma_interrupt(int irq, void *dev_id) { } */ | static int grab_drive(struct floppy_state *fs, enum swim_state state, int interruptible) | /* static void fd_dma_interrupt(int irq, void *dev_id) { } */
static int grab_drive(struct floppy_state *fs, enum swim_state state, int interruptible) | {
unsigned long flags;
spin_lock_irqsave(&fs->lock, flags);
if (fs->state != idle) {
++fs->wanted;
while (fs->state != available) {
if (interruptible && signal_pending(current)) {
--fs->wanted;
spin_unlock_irqrestore(&fs->lock, flags);
return -EINTR;
}
interruptible_sleep_on(&fs->wait);
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the declaration of an EFI image entry point. */ | EFI_STATUS EFIAPI RedfishDiscoverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* This is the declaration of an EFI image entry point. */
EFI_STATUS EFIAPI RedfishDiscoverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EFI_SUCCESS;
InitializeListHead (&mRedfishDiscoverList);
InitializeListHead (&mRedfishInstanceList);
InitializeListHead (&mEfiRedfishDiscoverNetworkInterface);
InitializeListHead (&mEfiRedfishDiscoverRestExInstance);
Status = EfiLibInstallDriverBindingComponentName2 (
... | tianocore/edk2 | C++ | Other | 4,240 |
/* If 16-bit I/O port operations are not supported, then ASSERT(). */ | VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | /* If 16-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | {
UINT16 *Buffer16;
ASSERT ((Port & 1) == 0);
Buffer16 = (UINT16 *)Buffer;
while (Count-- > 0) {
IoWrite16 (Port, *Buffer16++);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* When a unknown page type is encountered drain as many buffers as possible in the hope to turn the page into a LRU or free page, which we can handle. */ | void shake_page(struct page *p, int access) | /* When a unknown page type is encountered drain as many buffers as possible in the hope to turn the page into a LRU or free page, which we can handle. */
void shake_page(struct page *p, int access) | {
if (!PageSlab(p)) {
lru_add_drain_all();
if (PageLRU(p))
return;
drain_all_pages();
if (PageLRU(p) || is_free_buddy_page(p))
return;
}
if (access) {
int nr;
do {
nr = shrink_slab(1000, GFP_KERNEL, 1000);
if (page_count(p) == 0)
break;
} while (nr > 10);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Attempt to detach a locked page from its ->mapping. If it is dirty or if someone else has a ref on the page, abort and return 0. If it was successfully detached, return 1. Assumes the caller has a single ref on this page. */ | int remove_mapping(struct address_space *mapping, struct page *page) | /* Attempt to detach a locked page from its ->mapping. If it is dirty or if someone else has a ref on the page, abort and return 0. If it was successfully detached, return 1. Assumes the caller has a single ref on this page. */
int remove_mapping(struct address_space *mapping, struct page *page) | {
if (__remove_mapping(mapping, page)) {
page_unfreeze_refs(page, 1);
return 1;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the status of I2C was initialized or not. */ | static uint8_t ft5336_Get_I2C_InitializedStatus(void) | /* Return the status of I2C was initialized or not. */
static uint8_t ft5336_Get_I2C_InitializedStatus(void) | {
return(ft5336_handle.i2cInitialized);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Update the header checksums for a dirty inode based on its contents. Caller is expected to hold the buffer head underlying oi and mark it dirty. */ | static void omfs_update_checksums(struct omfs_inode *oi) | /* Update the header checksums for a dirty inode based on its contents. Caller is expected to hold the buffer head underlying oi and mark it dirty. */
static void omfs_update_checksums(struct omfs_inode *oi) | {
int xor, i, ofs = 0, count;
u16 crc = 0;
unsigned char *ptr = (unsigned char *) oi;
count = be32_to_cpu(oi->i_head.h_body_size);
ofs = sizeof(struct omfs_header);
crc = crc_itu_t(crc, ptr + ofs, count);
oi->i_head.h_crc = cpu_to_be16(crc);
xor = ptr[0];
for (i = 1; i < OMFS_XOR_COUNT; i++)
xor ^= ptr[i];
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Kernel thread which handles packets that are completed. This way the packet's "complete" function is asynchronously run in process context. Only packets which have a "complete" function may be sent here. */ | static int hpsbpkt_thread(void *__hi) | /* Kernel thread which handles packets that are completed. This way the packet's "complete" function is asynchronously run in process context. Only packets which have a "complete" function may be sent here. */
static int hpsbpkt_thread(void *__hi) | {
struct hpsb_packet *packet, *p;
struct list_head tmp;
int may_schedule;
while (!kthread_should_stop()) {
INIT_LIST_HEAD(&tmp);
spin_lock_irq(&pending_packets_lock);
list_splice_init(&hpsbpkt_queue, &tmp);
spin_unlock_irq(&pending_packets_lock);
list_for_each_entry_safe(packet, p, &tmp, queue) {
list_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the specified DAC channel DMA request. */ | void DAC_DmaEnable(FunctionalState Cmd) | /* Enables or disables the specified DAC channel DMA request. */
void DAC_DmaEnable(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DAC->CTRL |= DAC_CTRL_DMAEN;
}
else
{
DAC->CTRL &= ~DAC_CTRL_DMAEN;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Sets the RF Sleep configuration.
Needs the I2C Password presentation to be effective. */ | int32_t ST25DV_SetRFSleep(ST25DV_Object_t *pObj) | /* Sets the RF Sleep configuration.
Needs the I2C Password presentation to be effective. */
int32_t ST25DV_SetRFSleep(ST25DV_Object_t *pObj) | {
uint8_t reg_value = 1;
return st25dv_set_rf_mngt_rfsleep(&(pObj->Ctx), ®_value);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT16 EFIAPI S3MmioBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* If 16-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT16 EFIAPI S3MmioBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | {
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldRead16 (Address, StartBit, EndBit));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* /proc/pid/fd needs a special permission handler so that a process can still access /proc/self/fd after it has executed a setuid(). */ | static int proc_fd_permission(struct inode *inode, int mask) | /* /proc/pid/fd needs a special permission handler so that a process can still access /proc/self/fd after it has executed a setuid(). */
static int proc_fd_permission(struct inode *inode, int mask) | {
int rv;
rv = generic_permission(inode, mask, NULL);
if (rv == 0)
return 0;
if (task_pid(current) == proc_pid(inode))
rv = 0;
return rv;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the hardware irq controller data for an irq */ | int set_irq_data(unsigned int irq, void *data) | /* Set the hardware irq controller data for an irq */
int set_irq_data(unsigned int irq, void *data) | {
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
if (!desc) {
printk(KERN_ERR
"Trying to install controller data for IRQ%d\n", irq);
return -EINVAL;
}
raw_spin_lock_irqsave(&desc->lock, flags);
desc->handler_data = data;
raw_spin_unlock_irqrestore(&desc->lock, flags);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write to frequency prescaler register, used to program the period of the PWM output. period = (PSCx + 1) / 38 */ | static void pca955x_write_psc(struct i2c_client *client, int n, u8 val) | /* Write to frequency prescaler register, used to program the period of the PWM output. period = (PSCx + 1) / 38 */
static void pca955x_write_psc(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) + 2*n,
val);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Locking Note: The rport lock is expected to be held before calling this routine */ | static void fc_rport_error(struct fc_rport_priv *, struct fc_frame *) | /* Locking Note: The rport lock is expected to be held before calling this routine */
static void fc_rport_error(struct fc_rport_priv *, struct fc_frame *) | {
FC_RPORT_DBG(rdata, "Error %ld in state %s, retries %d\n",
IS_ERR(fp) ? -PTR_ERR(fp) : 0,
fc_rport_state(rdata), rdata->retries);
switch (rdata->rp_state) {
case RPORT_ST_PLOGI:
case RPORT_ST_LOGO:
fc_rport_enter_delete(rdata, RPORT_EV_FAILED);
break;
case RPORT_ST_RTV:
fc_rport_enter_ready(r... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets the current interrupt status of the Hibernation module. */ | unsigned long HibernateIntStatus(tBoolean bMasked) | /* Gets the current interrupt status of the Hibernation module. */
unsigned long HibernateIntStatus(tBoolean bMasked) | {
if(bMasked == true)
{
return(HWREG(HIB_MIS) & 0xf);
}
else
{
return(HWREG(HIB_RIS) & 0xf);
}
} | watterott/WebRadio | C++ | null | 71 |
/* Return Value: TRUE if succeeded; FALSE if failed. */ | BOOL RFbShutDown(IN PSDevice pDevice) | /* Return Value: TRUE if succeeded; FALSE if failed. */
BOOL RFbShutDown(IN PSDevice pDevice) | {
BOOL bResult = TRUE;
switch (pDevice->byRFType) {
case RF_AIROHA7230 :
bResult = IFRFbWriteEmbeded (pDevice->PortOffset, 0x1ABAEF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW);
break;
default :
bResult = TRUE;
break;
}
return bResult;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function finds the table specified by the handle and returns a pointer to it. If the handle is not found, EFI_NOT_FOUND is returned and the contents of Table are undefined. */ | EFI_STATUS FindTableByHandle(IN UINTN Handle, IN LIST_ENTRY *TableList, OUT EFI_ACPI_TABLE_LIST **Table) | /* This function finds the table specified by the handle and returns a pointer to it. If the handle is not found, EFI_NOT_FOUND is returned and the contents of Table are undefined. */
EFI_STATUS FindTableByHandle(IN UINTN Handle, IN LIST_ENTRY *TableList, OUT EFI_ACPI_TABLE_LIST **Table) | {
LIST_ENTRY *CurrentLink;
EFI_ACPI_TABLE_LIST *CurrentTable;
ASSERT (Table);
CurrentLink = TableList->ForwardLink;
while (CurrentLink != TableList) {
CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
if (CurrentTable->Handle == Handle) {
*Table = CurrentTable;
return ... | tianocore/edk2 | C++ | Other | 4,240 |
/* VDM Discover SVID callback (retrieve SVID supported by device for answer to Discovery mode) */ | static USBPD_StatusTypeDef USBPD_VDM_DiscoverSVIDs(uint8_t PortNum, uint16_t **p_SVID_Info, uint8_t *nb) | /* VDM Discover SVID callback (retrieve SVID supported by device for answer to Discovery mode) */
static USBPD_StatusTypeDef USBPD_VDM_DiscoverSVIDs(uint8_t PortNum, uint16_t **p_SVID_Info, uint8_t *nb) | {
*nb = SVIDInfo[PortNum].NumSVIDs;
*p_SVID_Info = SVIDInfo[PortNum].SVIDs;
return USBPD_ACK;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* The returned device is referenced and won't be released till iterator is proceed to the next device or exited. The caller is free to do whatever it wants to do with the device including calling back into class code. */ | struct device* class_dev_iter_next(struct class_dev_iter *iter) | /* The returned device is referenced and won't be released till iterator is proceed to the next device or exited. The caller is free to do whatever it wants to do with the device including calling back into class code. */
struct device* class_dev_iter_next(struct class_dev_iter *iter) | {
struct klist_node *knode;
struct device *dev;
while (1) {
knode = klist_next(&iter->ki);
if (!knode)
return NULL;
dev = container_of(knode, struct device, knode_class);
if (!iter->type || iter->type == dev->type)
return dev;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the specified I2C PEC transfer. */ | void I2C_SendPEC(I2C_Module *I2Cx, FunctionalState Cmd) | /* Enables or disables the specified I2C PEC transfer. */
void I2C_SendPEC(I2C_Module *I2Cx, FunctionalState Cmd) | {
assert_param(IS_I2C_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
I2Cx->CTRL1 |= CTRL1_PEC_SET;
}
else
{
I2Cx->CTRL1 &= CTRL1_PEC_RESET;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr */ | CHAR8* BasicReadRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *OutBufPtr) | /* Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr */
CHAR8* BasicReadRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *OutBufPtr) | {
UINTN RegSize;
RegSize = 0;
while (RegSize < REG_SIZE) {
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
RegSize = RegSize + 8;
}
return O... | tianocore/edk2 | C++ | Other | 4,240 |
/* Change Logs: Date Author Notes yi.qiu first version */ | void* dlsym(void *handle, const char *symbol) | /* Change Logs: Date Author Notes yi.qiu first version */
void* dlsym(void *handle, const char *symbol) | {
int i;
rt_module_t module;
RT_ASSERT(handle != RT_NULL);
module = (rt_module_t)handle;
for(i=0; i<module->nsym; i++)
{
if (rt_strcmp(module->symtab[i].name, symbol) == 0)
return (void*)module->symtab[i].addr;
}
return RT_NULL;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Clockevent device Clock event device set mode function */ | static void clockevent_tmr_set_mode(enum clock_event_mode mode, struct clock_event_device *clk) | /* Clockevent device Clock event device set mode function */
static void clockevent_tmr_set_mode(enum clock_event_mode mode, struct clock_event_device *clk) | {
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
kinetis_pit_enable(KINETIS_CLOCKEVENT_PIT, 1);
break;
case CLOCK_EVT_MODE_ONESHOT:
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
default:
kinetis_pit_enable(KINETIS_CLOCKEVENT_PIT, 0);
break;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 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 Vector25_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 Vector25_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (25 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Create performance record with event description and a timestamp. */ | EFI_STATUS EFIAPI CreatePerformanceMeasurement(IN CONST VOID *CallerIdentifier OPTIONAL, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 TimeStamp OPTIONAL, IN UINT64 Address OPTIONAL, IN UINT32 Identifier, IN PERF_MEASUREMENT_ATTRIBUTE Attribute) | /* Create performance record with event description and a timestamp. */
EFI_STATUS EFIAPI CreatePerformanceMeasurement(IN CONST VOID *CallerIdentifier OPTIONAL, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 TimeStamp OPTIONAL, IN UINT64 Address OPTIONAL, IN UINT32 Identifier, IN PERF_MEASUREM... | {
EFI_STATUS Status;
Status = EFI_SUCCESS;
AcquireSpinLock (&mSmmFpdtLock);
Status = InsertFpdtRecord (CallerIdentifier, Guid, String, TimeStamp, Address, (UINT16)Identifier, Attribute);
ReleaseSpinLock (&mSmmFpdtLock);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. param count Number of bytes transferred so far by the non-blocking transaction. */ | status_t FLEXIO_SPI_MasterTransferGetCountEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, size_t *count) | /* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. param count Number of bytes transferred so far by the non-blocking transaction. */
status_t FLEXIO_SPI_MasterTransferGetCountEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, size_t *count) | {
assert(handle != NULL);
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if (handle->rxInProgress)
{
*count =
(handle->transferSize - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Pushes a 64 bit unsigned value to the VM stack. */ | VOID PushU64(IN VM_CONTEXT *VmPtr, IN UINT64 Arg) | /* Pushes a 64 bit unsigned value to the VM stack. */
VOID PushU64(IN VM_CONTEXT *VmPtr, IN UINT64 Arg) | {
VmPtr->Gpr[0] -= sizeof (UINT64);
*(UINT64 *)VmPtr->Gpr[0] = Arg;
return;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If 32-bit operations are not supported, 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(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger tha... | UINT32 EFIAPI BitFieldAndThenOr32(IN UINT32 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData) | /* If 32-bit operations are not supported, 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(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger tha... | {
ASSERT (EndBit < 32);
ASSERT (StartBit <= EndBit);
return BitFieldOr32 (
BitFieldAnd32 (Operand, StartBit, EndBit, AndData),
StartBit,
EndBit,
OrData
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function is called by the TCP/IP stack when an IP packet should be sent. It calls the function called low_level_output() to do the actual transmission of the packet. */ | static err_t ethernetif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) | /* This function is called by the TCP/IP stack when an IP packet should be sent. It calls the function called low_level_output() to do the actual transmission of the packet. */
static err_t ethernetif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) | {
return etharp_output(netif, ipaddr, p);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Get the ACMP instance from the peripheral base address. */ | static uint32_t ACMP_GetInstance(CMP_Type *base) | /* Get the ACMP instance from the peripheral base address. */
static uint32_t ACMP_GetInstance(CMP_Type *base) | {
uint32_t instance = 0U;
for (instance = 0; instance < ARRAY_SIZE(s_acmpBases); instance++)
{
if (s_acmpBases[instance] == base)
{
break;
}
}
assert(instance < ARRAY_SIZE(s_acmpBases));
return instance;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Start accounting for a delay statistic using its starting timestamp (@start) */ | static void delayacct_start(struct timespec *start) | /* Start accounting for a delay statistic using its starting timestamp (@start) */
static void delayacct_start(struct timespec *start) | {
do_posix_clock_monotonic_gettime(start);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* main function
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ | int main(void) | /* main function
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
int main(void) | {
nvic_priority_group_set(NVIC_PRIGROUP_PRE0_SUB4);
nvic_irq_enable(LVD_IRQn,0,0);
rcu_periph_clock_enable(RCU_PMU);
gd_eval_ledinit (LED1);
gd_eval_ledon(LED1);
exti_init(EXTI_16, EXTI_INTERRUPT, EXTI_TRIG_BOTH);
pmu_lvd_select(PMU_LVDT_7);
while(1);
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* A network transaction timed out, reset the device. */ | static void ks8695_timeout(struct net_device *ndev) | /* A network transaction timed out, reset the device. */
static void ks8695_timeout(struct net_device *ndev) | {
struct ks8695_priv *ksp = netdev_priv(ndev);
netif_stop_queue(ndev);
ks8695_shutdown(ksp);
ks8695_reset(ksp);
ks8695_update_mac(ksp);
ks8695_init_net(ksp);
ks8695_set_multicast(ndev);
netif_start_queue(ndev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns : 0 on success, non zero on a failure such as a watchdog timeout. */ | static int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) | /* Returns : 0 on success, non zero on a failure such as a watchdog timeout. */
static int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) | {
register unsigned char *d = dst;
register unsigned short reg = (unsigned short) (instance->io_port +
P_DATA_REG_OFFSET);
register int i = len;
int ii = 0;
while ( !(inb(instance->io_port + P_STATUS_REG_OFFSET) & P_ST_RDY) )
++ii;
insb( reg, d, i );
if ( inb(instance->io_port + P_TIMEO... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function checks and requests an I/O region, reporting an error if there is a conflict. */ | static int pc263_request_region(unsigned minor, unsigned long from, unsigned long extent) | /* This function checks and requests an I/O region, reporting an error if there is a conflict. */
static int pc263_request_region(unsigned minor, unsigned long from, unsigned long extent) | {
if (!from || !request_region(from, extent, PC263_DRIVER_NAME)) {
printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n",
minor, from, extent);
return -EIO;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* is_slob_page: True for all slob pages (false for bigblock pages) */ | static int is_slob_page(struct slob_page *sp) | /* is_slob_page: True for all slob pages (false for bigblock pages) */
static int is_slob_page(struct slob_page *sp) | {
return PageSlab((struct page *)sp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Scans all the CRTCs in @dev's mode_config. If they're using @fb, removes it, setting it to NULL. */ | void drm_framebuffer_cleanup(struct drm_framebuffer *fb) | /* Scans all the CRTCs in @dev's mode_config. If they're using @fb, removes it, setting it to NULL. */
void drm_framebuffer_cleanup(struct drm_framebuffer *fb) | {
struct drm_device *dev = fb->dev;
struct drm_crtc *crtc;
struct drm_mode_set set;
int ret;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
if (crtc->fb == fb) {
memset(&set, 0, sizeof(struct drm_mode_set));
set.crtc = crtc;
set.fb = NULL;
ret = crtc->funcs->set_config(&set);
if (r... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set RTC prescalars.
This sets the RTC synchronous and asynchronous prescalars. */ | void rtc_set_prescaler(uint32_t sync, uint32_t async) | /* Set RTC prescalars.
This sets the RTC synchronous and asynchronous prescalars. */
void rtc_set_prescaler(uint32_t sync, uint32_t async) | {
RTC_PRER = (sync & RTC_PRER_PREDIV_S_MASK);
RTC_PRER |= (async << RTC_PRER_PREDIV_A_SHIFT);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */ | void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle) | /* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */
void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle) | {
if (!handle->rxRingBuffer)
{
FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_RxDataRegFullInterruptEnable);
}
handle->rxDataSize = 0U;
handle->rxState = kFLEXIO_UART_RxIdle;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Description: vxfs_clear_inode() is called on the final iput and frees the private inode area. */ | void vxfs_clear_inode(struct inode *ip) | /* Description: vxfs_clear_inode() is called on the final iput and frees the private inode area. */
void vxfs_clear_inode(struct inode *ip) | {
kmem_cache_free(vxfs_inode_cachep, ip->i_private);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Remove rejected pci device from specific root bridge handle. */ | VOID RemoveRejectedPciDevices(IN EFI_HANDLE RootBridgeHandle, IN PCI_IO_DEVICE *Bridge) | /* Remove rejected pci device from specific root bridge handle. */
VOID RemoveRejectedPciDevices(IN EFI_HANDLE RootBridgeHandle, IN PCI_IO_DEVICE *Bridge) | {
PCI_IO_DEVICE *Temp;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *LastLink;
if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
return;
}
CurrentLink = Bridge->ChildList.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &Bridge->ChildList) {
Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink... | tianocore/edk2 | C++ | Other | 4,240 |
/* Used by lock managers to cancel blocked requests */ | int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | /* Used by lock managers to cancel blocked requests */
int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | {
if (filp->f_op && filp->f_op->lock)
return filp->f_op->lock(filp, F_CANCELLK, fl);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* inet_ehash_secret must be set exactly once Instead of using a dedicated spinlock, we (ab)use inetsw_lock */ | void build_ehash_secret(void) | /* inet_ehash_secret must be set exactly once Instead of using a dedicated spinlock, we (ab)use inetsw_lock */
void build_ehash_secret(void) | {
u32 rnd;
do {
get_random_bytes(&rnd, sizeof(rnd));
} while (rnd == 0);
spin_lock_bh(&inetsw_lock);
if (!inet_ehash_secret)
inet_ehash_secret = rnd;
spin_unlock_bh(&inetsw_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) | /* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
TIMx_CLK_ENABLE();
TIMx_CHANNEL1_GPIO_PORT();
TIMx_CHANNEL2_GPIO_PORT();
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF_TIMx;
GPIO_InitStruct.Pull = GPIO_PUPD_CHANNEL1;
GPIO_InitStruct.Pin = GPI... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* configure RCU function
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ | void rcu_config(void) | /* configure RCU function
, V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void rcu_config(void) | {
rcu_periph_clock_enable(RCU_GPIOB);
rcu_periph_clock_enable(RCU_OPAIVREF);
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* This function returns the address of the last valid sector. */ | Ctrl_status nand_flash_read_capacity(uint32_t *nb_sector) | /* This function returns the address of the last valid sector. */
Ctrl_status nand_flash_read_capacity(uint32_t *nb_sector) | {
if (nand_flash_status == NAND_FLASH_UNLOADED) {
return CTRL_NO_PRESENT;
}
if (nand_flash_status == NAND_FLASH_NOT_INIT) {
if (nand_flash_translation_initialize(&nf_translation, 0,
cmd_address, addr_address, data_address, 0,
0, page_write_buffer, page_read_buffer)) {
return CTRL_NO_PRESENT;
}
nan... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Find the first active NET/ROM device, usually "nr0". */ | struct net_device* nr_dev_first(void) | /* Find the first active NET/ROM device, usually "nr0". */
struct net_device* nr_dev_first(void) | {
struct net_device *dev, *first = NULL;
rcu_read_lock();
for_each_netdev_rcu(&init_net, dev) {
if ((dev->flags & IFF_UP) && dev->type == ARPHRD_NETROM)
if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
first = dev;
}
if (first)
dev_hold(first);
rcu_read_unlock();
return first;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initialize EMAC interface, including descriptors, MAC address, and PHY. */ | void EMAC_Open(uint8_t *pu8MacAddr) | /* Initialize EMAC interface, including descriptors, MAC address, and PHY. */
void EMAC_Open(uint8_t *pu8MacAddr) | {
EMAC_TxDescInit();
EMAC_RxDescInit();
EMAC_SetMacAddr(pu8MacAddr);
EMAC->INTEN = EMAC_INTEN_RXIEN_Msk |
EMAC_INTEN_TXIEN_Msk |
EMAC_INTEN_RXGDIEN_Msk |
EMAC_INTEN_TXCPIEN_Msk |
EMAC_INTEN_RXBEIEN_Msk |
EMAC_INTEN... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the XFMC NAND ECC feature. */ | void XFMC_EnableNandEcc(XFMC_Bank23_Module *Bank, FunctionalState Cmd) | /* Enables or disables the XFMC NAND ECC feature. */
void XFMC_EnableNandEcc(XFMC_Bank23_Module *Bank, FunctionalState Cmd) | {
assert_param(IS_XFMC_NAND_BANK(Bank));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
Bank->CTRLx |= XFMC_NAND_ECC_ENABLE;
}
else
{
Bank->CTRLx &= ~XFMC_NAND_ECC_ENABLE;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write data element to the SPI interface with Noblock. This function transmitted data to the interface of the specified SPI module with Noblock. */ | void xSPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData) | /* Write data element to the SPI interface with Noblock. This function transmitted data to the interface of the specified SPI module with Noblock. */
void xSPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + S0SPDR) = ulData & S0SPDR_DATA_M;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return: Whether we reached the end of a level in the hierarchy or not. */ | static int ebml_level_end(MatroskaDemuxContext *matroska) | /* Return: Whether we reached the end of a level in the hierarchy or not. */
static int ebml_level_end(MatroskaDemuxContext *matroska) | {
ByteIOContext *pb = matroska->ctx->pb;
int64_t pos = url_ftell(pb);
if (matroska->num_levels > 0) {
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
if (pos - level->start >= level->length) {
matroska->num_levels--;
return 1;
}
}
r... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Enable specify I2C Controller and set Clock Divider. */ | uint32_t I2C_Open(I2C_T *i2c, uint32_t u32BusClock) | /* Enable specify I2C Controller and set Clock Divider. */
uint32_t I2C_Open(I2C_T *i2c, uint32_t u32BusClock) | {
uint32_t u32Div;
uint32_t u32Pclk;
if ((i2c == I2C1) || (i2c == I2C3))
{
u32Pclk = CLK_GetPCLK1Freq();
}
else
{
u32Pclk = CLK_GetPCLK0Freq();
}
u32Div = (uint32_t)(((u32Pclk * 10U) / (u32BusClock * 4U) + 5U) / 10U - 1U);
i2c->CLKDIV = u32Div;
i2c->CTL0 |= I2... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called in order to decode "LogRequest" payload command. */ | static void dissect_zcl_appl_stats_log_req(tvbuff_t *tvb, proto_tree *tree, guint *offset) | /* This function is called in order to decode "LogRequest" payload command. */
static void dissect_zcl_appl_stats_log_req(tvbuff_t *tvb, proto_tree *tree, guint *offset) | {
proto_tree_add_item(tree, hf_zbee_zcl_appl_stats_log_id, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
*offset += 4;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* We simply tag the chunk as a violation. The state machine will log the violation and continue. */ | sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | /* We simply tag the chunk as a violation. The state machine will log the violation and continue. */
sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | {
struct sctp_chunk *chunk = arg;
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t)))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
return SCTP_DISPOSITION_VIOLATION;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* empty_log_bytes - calculate amount of empty space in the log. */ | static long long empty_log_bytes(const struct ubifs_info *c) | /* empty_log_bytes - calculate amount of empty space in the log. */
static long long empty_log_bytes(const struct ubifs_info *c) | {
long long h, t;
h = (long long)c->lhead_lnum * c->leb_size + c->lhead_offs;
t = (long long)c->ltail_lnum * c->leb_size;
if (h >= t)
return c->log_bytes - h + t;
else
return t - h;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called when the error recovery driver tells us that its OK to resume normal operation. Use completion to allow halted scsi ops to resume. */ | static void sym2_io_resume(struct pci_dev *pdev) | /* Called when the error recovery driver tells us that its OK to resume normal operation. Use completion to allow halted scsi ops to resume. */
static void sym2_io_resume(struct pci_dev *pdev) | {
struct Scsi_Host *shost = pci_get_drvdata(pdev);
struct sym_data *sym_data = shost_priv(shost);
spin_lock_irq(shost->host_lock);
if (sym_data->io_reset)
complete_all(sym_data->io_reset);
spin_unlock_irq(shost->host_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SPC peripheral base address. param level IO VDD Low-voltage level selection. */ | void SPC_SetIOVDDLowVoltageLevel(SPC_Type *base, spc_low_voltage_level_select_t level) | /* param base SPC peripheral base address. param level IO VDD Low-voltage level selection. */
void SPC_SetIOVDDLowVoltageLevel(SPC_Type *base, spc_low_voltage_level_select_t level) | {
uint32_t reg;
reg = base->VD_IO_CFG;
base->VD_IO_CFG &= ~(SPC_VD_IO_CFG_LVDRE_MASK | SPC_VD_IO_CFG_LVDIE_MASK | SPC_VD_IO_CFG_LVSEL_MASK);
reg |= SPC_VD_IO_CFG_LVSEL(level);
base->VD_IO_CFG = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinTypeUART(uint32_t ui32Port, uint8_t ui8Pins) | /* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeUART(uint32_t ui32Port, uint8_t ui8Pins) | {
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Clears all the pending interrupts. If the Dma status register is read then all the interrupts gets cleared */ | void synopGMAC_clear_interrupt(synopGMACdevice *gmacdev) | /* Clears all the pending interrupts. If the Dma status register is read then all the interrupts gets cleared */
void synopGMAC_clear_interrupt(synopGMACdevice *gmacdev) | {
u32 data;
data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
TR("DMA status reg = 0x%x before cleared!\n", data);
synopGMACWriteReg(gmacdev->DmaBase, DmaStatus, data);
TR("DMA status reg = 0x%x after cleared!\n", data);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RETURNS: Pointer to found devres, NULL if not found. */ | void* devres_find(struct device *dev, dr_release_t release, dr_match_t match, void *match_data) | /* RETURNS: Pointer to found devres, NULL if not found. */
void* devres_find(struct device *dev, dr_release_t release, dr_match_t match, void *match_data) | {
struct devres *dr;
unsigned long flags;
spin_lock_irqsave(&dev->devres_lock, flags);
dr = find_dr(dev, release, match, match_data);
spin_unlock_irqrestore(&dev->devres_lock, flags);
if (dr)
return dr->data;
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* LPUART EDMA send finished callback function.
This function is called when LPUART EDMA send finished. It disables the LPUART TX EDMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */ | static void LPUART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | /* LPUART EDMA send finished callback function.
This function is called when LPUART EDMA send finished. It disables the LPUART TX EDMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */
static void LPUART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds) | {
assert(param);
lpuart_edma_private_handle_t *lpuartPrivateHandle = (lpuart_edma_private_handle_t *)param;
handle = handle;
tcds = tcds;
if (transferDone)
{
LPUART_TransferAbortSendEDMA(lpuartPrivateHandle->base, lpuartPrivateHandle->handle);
if (lpuartPrivateHandle->handle->cal... | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Notifies the USB disconnection bus events to the device stack */ | sl_status_t sli_usbd_core_disconnect_event(void) | /* Notifies the USB disconnection bus events to the device stack */
sl_status_t sli_usbd_core_disconnect_event(void) | {
usbd_core_set_event(SLI_USBD_EVENT_BUS_DISCONNECT);
return SL_STATUS_OK;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Reads the PHY register at offset using the serial gigabit media independent interface and stores the retrieved information in data. */ | static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *) | /* Reads the PHY register at offset using the serial gigabit media independent interface and stores the retrieved information in data. */
static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *) | {
s32 ret_val = -E1000_ERR_PARAM;
if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
hw_dbg("PHY Address %u is out of range\n", offset);
goto out;
}
ret_val = hw->phy.ops.acquire(hw);
if (ret_val)
goto out;
ret_val = igb_read_phy_reg_i2c(hw, offset, data);
hw->phy.ops.release(hw);
out:
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* prepares EthDB for unloading
Note that this function is fully documented in the main component header file, IxEthDB.h. */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBUnload(void) | /* prepares EthDB for unloading
Note that this function is fully documented in the main component header file, IxEthDB.h. */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBUnload(void) | {
IxEthDBPortId portIndex;
if (!ethDBInitializationComplete)
{
return IX_ETH_DB_SUCCESS;
}
for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
{
if (ixEthDBPortInfo[portIndex].enabled)
{
return IX_ETH_DB_BUSY;
}
}
for (por... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Checks if the USART is in multidrop mode. */ | static __always_inline int usart_mode_is_multidrop(volatile avr32_usart_t *usart) | /* Checks if the USART is in multidrop mode. */
static __always_inline int usart_mode_is_multidrop(volatile avr32_usart_t *usart) | {
return ((usart->mr >> AVR32_USART_MR_PAR_OFFSET) & AVR32_USART_MR_PAR_MULTI) == AVR32_USART_MR_PAR_MULTI;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* mpc52xx_lpbfifo_submit - Submit an LPB FIFO transfer request. @req: Pointer to request structure */ | int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req) | /* mpc52xx_lpbfifo_submit - Submit an LPB FIFO transfer request. @req: Pointer to request structure */
int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req) | {
unsigned long flags;
if (!lpbfifo.regs)
return -ENODEV;
spin_lock_irqsave(&lpbfifo.lock, flags);
if (lpbfifo.req) {
spin_unlock_irqrestore(&lpbfifo.lock, flags);
return -EBUSY;
}
lpbfifo.req = req;
req->irq_count = 0;
req->irq_ticks = 0;
req->buffer_not_done_cnt = 0;
req->pos = 0;
mpc52xx_lpbfifo_kic... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* XXX - what if we get a short write? */ | int pcap_sendpacket(pcap_t *p, const u_char *buf, int size) | /* XXX - what if we get a short write? */
int pcap_sendpacket(pcap_t *p, const u_char *buf, int size) | {
if (p->inject_op(p, buf, size) == -1)
return (-1);
return (0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Clear WDT status flag. This function can be used to clear special wdt status flag. */ | void WDTStatusFlagClear(unsigned long ulFlags) | /* Clear WDT status flag. This function can be used to clear special wdt status flag. */
void WDTStatusFlagClear(unsigned long ulFlags) | {
xASSERT(ulFlags == WDT_FLAG_TIMEOUT);
xHWREG(WDT_BASE + WDT_MOD) &= ~WDMOD_TOF;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0xAA;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0x55;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return: 0 if all went ok, else return appropriate error */ | static int k3_dsp_init(struct udevice *dev) | /* Return: 0 if all went ok, else return appropriate error */
static int k3_dsp_init(struct udevice *dev) | {
dev_dbg(dev, "%s\n", __func__);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function frees an aligned buffer for the SCSI disk to perform SCSI IO operations. */ | VOID FreeAlignedBuffer(IN VOID *Buffer, IN UINTN BufferSize) | /* This function frees an aligned buffer for the SCSI disk to perform SCSI IO operations. */
VOID FreeAlignedBuffer(IN VOID *Buffer, IN UINTN BufferSize) | {
if (Buffer != NULL) {
FreeAlignedPages (Buffer, EFI_SIZE_TO_PAGES (BufferSize));
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This is guaranteed to be a stable sort since version 2.32. */ | void g_ptr_array_sort_with_data(GPtrArray *array, GCompareDataFunc compare_func, gpointer user_data) | /* This is guaranteed to be a stable sort since version 2.32. */
void g_ptr_array_sort_with_data(GPtrArray *array, GCompareDataFunc compare_func, gpointer user_data) | {
g_return_if_fail (array != NULL);
g_qsort_with_data (array->pdata,
array->len,
sizeof (gpointer),
compare_func,
user_data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This may be called from either NET_RX_SOFTIRQ or IRQ. */ | void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) | /* This may be called from either NET_RX_SOFTIRQ or IRQ. */
void fcoe_ctlr_recv(struct fcoe_ctlr *fip, struct sk_buff *skb) | {
skb_queue_tail(&fip->fip_recv_list, skb);
schedule_work(&fip->recv_work);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocate the next device address from the host */ | static uint8_t alloc_device_address(usbh_host *host) | /* Allocate the next device address from the host */
static uint8_t alloc_device_address(usbh_host *host) | {
unsigned i, j;
for (i = 0; i < 127; i++) {
uint8_t addr = host->next_device_address & 0x7F;
addr = (!addr) ? 1 : addr;
host->next_device_address = (addr == 0x7F) ? 1 : (addr + 1);
for (j = 0; j < DEVICE_ARRAY_LENGTH; j++) {
usbh_device *dev = &host->devices[j];
if (IS_DEVICE_VALID(dev) && dev->address... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* This function configures the system to enter Standby mode with RTC clocked by LSI and with Backup SRAM ON for current consumption measurement purpose. */ | void StandbyRTCBKPSRAMMode_Measure(void) | /* This function configures the system to enter Standby mode with RTC clocked by LSI and with Backup SRAM ON for current consumption measurement purpose. */
void StandbyRTCBKPSRAMMode_Measure(void) | {
PWR_BackupAccessCmd(ENABLE);
RCC_LSICmd(ENABLE);
while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
{
}
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
RCC_RTCCLKCmd(ENABLE);
RTC_WaitForSynchro();
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_BKPSRAM, ENABLE);
PWR_BackupRegulatorCmd(ENABLE);
while(PWR_GetFla... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* System Power Configuration The system Power is configured as follow : */ | static void SystemPower_Config(void) | /* System Power Configuration The system Power is configured as follow : */
static void SystemPower_Config(void) | {
__HAL_RCC_PWR_CLK_ENABLE();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Event handler for the library USB Control Request reception event. */ | void EVENT_USB_Device_ControlRequest(void) | /* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void) | {
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Return value: 0 for success, -1 for failure */ | int fc_fabric_logoff(struct fc_lport *lport) | /* Return value: 0 for success, -1 for failure */
int fc_fabric_logoff(struct fc_lport *lport) | {
lport->tt.disc_stop_final(lport);
mutex_lock(&lport->lp_mutex);
if (lport->dns_rdata)
lport->tt.rport_logoff(lport->dns_rdata);
mutex_unlock(&lport->lp_mutex);
lport->tt.rport_flush_queue();
mutex_lock(&lport->lp_mutex);
fc_lport_enter_logo(lport);
mutex_unlock(&lport->lp_mutex);
cancel_delayed_work_sync(&... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USBH_AUDIO_GetOutOffset return the current buffer pointer for OUT proces. */ | int32_t USBH_AUDIO_GetOutOffset(USBH_HandleTypeDef *phost) | /* USBH_AUDIO_GetOutOffset return the current buffer pointer for OUT proces. */
int32_t USBH_AUDIO_GetOutOffset(USBH_HandleTypeDef *phost) | {
AUDIO_HandleTypeDef *AUDIO_Handle;
if(phost->gState == HOST_CLASS)
{
AUDIO_Handle = phost->pActiveClass->pData;
if(AUDIO_Handle->play_state == AUDIO_PLAYBACK_PLAY)
{
return AUDIO_Handle->headphone.partial_ptr;
}
}
return -1;
} | micropython/micropython | C++ | Other | 18,334 |
/* Function to compare 2 MP_INFORMATION2_HOB_DATA pointer based on ProcessorIndex. */ | INTN EFIAPI MpInformation2HobCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2) | /* Function to compare 2 MP_INFORMATION2_HOB_DATA pointer based on ProcessorIndex. */
INTN EFIAPI MpInformation2HobCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2) | {
if ((*(MP_INFORMATION2_HOB_DATA **)Buffer1)->ProcessorIndex > (*(MP_INFORMATION2_HOB_DATA **)Buffer2)->ProcessorIndex) {
return 1;
} else if ((*(MP_INFORMATION2_HOB_DATA **)Buffer1)->ProcessorIndex < (*(MP_INFORMATION2_HOB_DATA **)Buffer2)->ProcessorIndex) {
return -1;
}
return 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or Disables Timer CRR preload function.
The */ | void TimerCHCRRPreloadConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulProload) | /* Enables or Disables Timer CRR preload function.
The */
void TimerCHCRRPreloadConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulProload) | {
xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE));
xASSERT((ulChannel == TIMER_CH_0) || (ulChannel == TIMER_CH_1) ||
(ulChannel == TIMER_CH_2) || (ulChannel == TIMER_CH_3));
xASSERT((ulProload == TIMER_CRR_PROLOAD_IMM) ||
(ulProload == TIMER_CRR_PROLOAD_UD));
if(ulPr... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* We need to wrap this check in cfq_cfqq_slice_new(), since ->slice_end isn't valid until the first request from the dispatch is activated and the slice time set. */ | static bool cfq_slice_used(struct cfq_queue *cfqq) | /* We need to wrap this check in cfq_cfqq_slice_new(), since ->slice_end isn't valid until the first request from the dispatch is activated and the slice time set. */
static bool cfq_slice_used(struct cfq_queue *cfqq) | {
if (cfq_cfqq_slice_new(cfqq))
return 0;
if (time_before(jiffies, cfqq->slice_end))
return 0;
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This routine returns the number of characters in the write buffer of the SCLP driver. The provided number includes all characters that are stored in the SCCB (will be written next time the SCLP is not busy) as well as characters in the write buffer (will not be written as long as there is a final line feed missing).... | static int sclp_tty_chars_in_buffer(struct tty_struct *tty) | /* This routine returns the number of characters in the write buffer of the SCLP driver. The provided number includes all characters that are stored in the SCCB (will be written next time the SCLP is not busy) as well as characters in the write buffer (will not be written as long as there is a final line feed missing).... | {
unsigned long flags;
struct list_head *l;
struct sclp_buffer *t;
int count;
spin_lock_irqsave(&sclp_tty_lock, flags);
count = 0;
if (sclp_ttybuf != NULL)
count = sclp_chars_in_buffer(sclp_ttybuf);
list_for_each(l, &sclp_tty_outqueue) {
t = list_entry(l, struct sclp_buffer, list);
count += sclp_chars_in_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Start the tcw on the given ccw device. Return zero on success, non-zero otherwise. */ | int ccw_device_tm_start(struct ccw_device *cdev, struct tcw *tcw, unsigned long intparm, u8 lpm) | /* Start the tcw on the given ccw device. Return zero on success, non-zero otherwise. */
int ccw_device_tm_start(struct ccw_device *cdev, struct tcw *tcw, unsigned long intparm, u8 lpm) | {
return ccw_device_tm_start_key(cdev, tcw, intparm, lpm,
PAGE_DEFAULT_KEY);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the I2Cx peripheral registers to their default reset values. */ | void I2C_DeInit(I2C_Module *I2Cx) | /* Deinitializes the I2Cx peripheral registers to their default reset values. */
void I2C_DeInit(I2C_Module *I2Cx) | {
assert_param(IS_I2C_PERIPH(I2Cx));
if (I2Cx == I2C1)
{
RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_I2C1, ENABLE);
RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_I2C1, DISABLE);
}
else
{
RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_I2C2, ENABLE);
RCC_EnableAPB1PeriphReset(... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Set the OFile and its child OFile with the error Status */ | VOID FatSetVolumeError(IN FAT_OFILE *OFile, IN EFI_STATUS Status) | /* Set the OFile and its child OFile with the error Status */
VOID FatSetVolumeError(IN FAT_OFILE *OFile, IN EFI_STATUS Status) | {
LIST_ENTRY *Link;
FAT_OFILE *ChildOFile;
if (!EFI_ERROR (OFile->Error)) {
OFile->Error = Status;
}
for (Link = OFile->ChildHead.ForwardLink; Link != &OFile->ChildHead; Link = Link->ForwardLink) {
ChildOFile = OFILE_FROM_CHILDLINK (Link);
FatSetVolumeError (ChildOFile, Status);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Identify module we are running on, set gd->board_type to the index in hw_id_list corresponding to the module identifed, or to CM5200_UNKNOWN_MODULE if we can't identify the module. */ | static void identify_module(hw_id_t hw_id) | /* Identify module we are running on, set gd->board_type to the index in hw_id_list corresponding to the module identifed, or to CM5200_UNKNOWN_MODULE if we can't identify the module. */
static void identify_module(hw_id_t hw_id) | {
int i, j, element;
char match;
gd->board_type = CM5200_UNKNOWN_MODULE;
for (i = 0; i < sizeof (hw_id_list) / sizeof (char **); ++i) {
match = 1;
for (j = 0; j < sizeof (hw_id_identify) / sizeof (int); ++j) {
element = hw_id_identify[j];
if (strncmp(hw_id_list[i][element],
&hw_id[element][0],
h... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Prints the HID Collection path (along with each node's attributes) to the serial port for display to the user, from the given starting node to the root node. */ | void OutputCollectionPath(const HID_CollectionPath_t *const CollectionPath) | /* Prints the HID Collection path (along with each node's attributes) to the serial port for display to the user, from the given starting node to the root node. */
void OutputCollectionPath(const HID_CollectionPath_t *const CollectionPath) | {
const HID_CollectionPath_t* CurrentNode = CollectionPath;
while (CurrentNode != NULL)
{
printf_P(PSTR(" |\r\n"
" - Type: 0x%02" PRIX8 "\r\n"
" - Usage: 0x%02" PRIX8 "\r\n"),
CurrentNode->Type, CurrentNode->Usage);
CurrentNode = CurrentNode->Parent;
}
printf_P(PSTR(" ... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* The entry point for Udp6 driver that installs the driver binding and component name protocol on its ImageHandle. */ | EFI_STATUS EFIAPI Udp6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The entry point for Udp6 driver that installs the driver binding and component name protocol on its ImageHandle. */
EFI_STATUS EFIAPI Udp6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gUdp6DriverBinding,
ImageHandle,
&gUdp6ComponentName,
&gUdp6ComponentName2
);
if (!EFI_ERROR (Status)) {
mUdp6RandomPo... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the number of axis on the device. */ | int SDL_HapticNumAxes(SDL_Haptic *haptic) | /* Returns the number of axis on the device. */
int SDL_HapticNumAxes(SDL_Haptic *haptic) | {
if (!ValidHaptic(haptic)) {
return -1;
}
return haptic->naxes;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This function is used to set modules trigger by timer interrupt. */ | void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask) | /* This function is used to set modules trigger by timer interrupt. */
void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask) | {
timer->TRGCTL = (timer->TRGCTL & ~(TIMER_TRGCTL_TRGPWM_Msk | TIMER_TRGCTL_TRGEADC_Msk | TIMER_TRGCTL_TRGPDMA_Msk)) | u32Mask;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* return_unused_pool_pebs - returns unused PEB to the free tree. @ubi: UBI device description object @pool: fastmap pool description object */ | static void return_unused_pool_pebs(struct ubi_device *ubi, struct ubi_fm_pool *pool) | /* return_unused_pool_pebs - returns unused PEB to the free tree. @ubi: UBI device description object @pool: fastmap pool description object */
static void return_unused_pool_pebs(struct ubi_device *ubi, struct ubi_fm_pool *pool) | {
int i;
struct ubi_wl_entry *e;
for (i = pool->used; i < pool->size; i++) {
e = ubi->lookuptbl[pool->pebs[i]];
wl_tree_add(e, &ubi->free);
ubi->free_count++;
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Checks whether the specified DAC interrupt has occurred or not. */ | ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT) | /* Checks whether the specified DAC interrupt has occurred or not. */
ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT) | {
ITStatus bitstatus = RESET;
uint32_t enablestatus = 0;
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_DAC_IT(DAC_IT));
enablestatus = (DAC->CR & (DAC_IT << DAC_Channel)) ;
if (((DAC->SR & (DAC_IT << DAC_Channel)) != (uint32_t)RESET) && enablestatus)
{
bitstatus = SET;
}
else
{
... | MaJerle/stm32f429 | C++ | null | 2,036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.