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 |
|---|---|---|---|---|---|---|---|
/* Task to read and process the HID report descriptor and HID reports from the device and display the results onto the board LEDs. */ | void JoystickHost_Task(void) | /* Task to read and process the HID report descriptor and HID reports from the device and display the results onto the board LEDs. */
void JoystickHost_Task(void) | {
if (USB_HostState != HOST_STATE_Configured)
return;
Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
{
if (Pipe_IsReadWriteAllowed())
{
uint8_t JoystickReport[Pipe_BytesInPipe()];
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe(), NULL);
ProcessJoystickReport... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* That means that in order to get to the block containing the byte at offset 101342453, we would load the indirect block pointed to by pointer 0 in the dinode. We would then load the indirect block pointed to by pointer 48 in that indirect block. We would then load the data block pointed to by pointer 165 in that indi... | static void find_metapath(const struct gfs2_sbd *sdp, u64 block, struct metapath *mp, unsigned int height) | /* That means that in order to get to the block containing the byte at offset 101342453, we would load the indirect block pointed to by pointer 0 in the dinode. We would then load the indirect block pointed to by pointer 48 in that indirect block. We would then load the data block pointed to by pointer 165 in that indi... | {
unsigned int i;
for (i = height; i--;)
mp->mp_list[i] = do_div(block, sdp->sd_inptrs);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routines also unmaps the page at virtual kernel address 0, so that we can trap those pesky NULL-reference errors in the kernel. */ | void __init paging_init(void) | /* This routines also unmaps the page at virtual kernel address 0, so that we can trap those pesky NULL-reference errors in the kernel. */
void __init paging_init(void) | {
pagetable_init();
__flush_tlb_all();
kmap_init();
sparse_init();
zone_sizes_init();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* nlmclnt_done - Release resources allocated by nlmclnt_init() @host: nlm_host structure reserved by nlmclnt_init() */ | void nlmclnt_done(struct nlm_host *host) | /* nlmclnt_done - Release resources allocated by nlmclnt_init() @host: nlm_host structure reserved by nlmclnt_init() */
void nlmclnt_done(struct nlm_host *host) | {
nlm_release_host(host);
lockd_down();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with */ | BOOLEAN EFIAPI AcquireSpinLockOrFail(IN OUT SPIN_LOCK *SpinLock) | /* If SpinLock is NULL, then ASSERT(). If SpinLock was not initialized with */
BOOLEAN EFIAPI AcquireSpinLockOrFail(IN OUT SPIN_LOCK *SpinLock) | {
SPIN_LOCK LockValue;
VOID *Result;
ASSERT (SpinLock != NULL);
LockValue = *SpinLock;
ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
_ReadWriteBarrier ();
Result = InterlockedCompareExchangePointer (
(VOID **)SpinLock,
(VOID *)SPIN_LOCK_RELEA... | tianocore/edk2 | C++ | Other | 4,240 |
/* brief Setup peripheral clock dividers. param div_name : Clock divider name param divided_by_value: Value to be divided return Nothing */ | void CLOCK_SetClkDiv(clock_div_name_t div_name, uint32_t divided_by_value) | /* brief Setup peripheral clock dividers. param div_name : Clock divider name param divided_by_value: Value to be divided return Nothing */
void CLOCK_SetClkDiv(clock_div_name_t div_name, uint32_t divided_by_value) | {
volatile uint32_t *pClkDiv;
pClkDiv = &(SYSCON->SYSTICKCLKDIV[0]);
((volatile uint32_t *)pClkDiv)[(uint32_t)div_name] = 0x3UL << 29U;
if (divided_by_value == 0U)
{
((volatile uint32_t *)pClkDiv)[(uint32_t)div_name] = 1UL << 30U;
}
else
{
((volatile uint32_t *)pClkDiv)[(... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called from timer callback functions. When connection is busy (during sending a data frame) timer expiration event must be queued. Otherwise this event can be sent to connection state machine. Queued events will process by llc_backlog_rcv function after sending data frame. */ | static void llc_process_tmr_ev(struct sock *sk, struct sk_buff *skb) | /* This function is called from timer callback functions. When connection is busy (during sending a data frame) timer expiration event must be queued. Otherwise this event can be sent to connection state machine. Queued events will process by llc_backlog_rcv function after sending data frame. */
static void llc_proces... | {
if (llc_sk(sk)->state == LLC_CONN_OUT_OF_SVC) {
printk(KERN_WARNING "%s: timer called on closed connection\n",
__func__);
kfree_skb(skb);
} else {
if (!sock_owned_by_user(sk))
llc_conn_state_process(sk, skb);
else {
llc_set_backlog_type(skb, LLC_EVENT);
sk_add_backlog(sk, skb);
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will get network interface device in network interface device list by netdev name. */ | struct netdev* netdev_get_by_name(const char *name) | /* This function will get network interface device in network interface device list by netdev name. */
struct netdev* netdev_get_by_name(const char *name) | {
rt_base_t level;
rt_slist_t *node = RT_NULL;
struct netdev *netdev = RT_NULL;
if (netdev_list == RT_NULL)
{
return RT_NULL;
}
level = rt_spin_lock_irqsave(&_spinlock);
for (node = &(netdev_list->list); node; node = rt_slist_next(node))
{
netdev = rt_slist_entry(node... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check the status of the FIFO buffer of the specified SPI port. */ | void SPITimeOutValSet(unsigned long ulBase, unsigned long ulTimeOutVal) | /* Check the status of the FIFO buffer of the specified SPI port. */
void SPITimeOutValSet(unsigned long ulBase, unsigned long ulTimeOutVal) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
xHWREG(ulBase + SPI_FTOCR) = ulTimeOutVal;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Checks if controller can change the whitelist. If scanning is enabled and using the whitelist the controller is not allowed to change the whitelist. */ | int ble_ll_scan_can_chg_whitelist(void) | /* Checks if controller can change the whitelist. If scanning is enabled and using the whitelist the controller is not allowed to change the whitelist. */
int ble_ll_scan_can_chg_whitelist(void) | {
int rc;
struct ble_ll_scan_sm *scansm;
struct ble_ll_scan_params *scanp;
scansm = &g_ble_ll_scan_sm;
scanp = scansm->scanp;
if (scansm->scan_enabled && (scanp->scan_filt_policy & 1)) {
rc = 0;
} else {
rc = 1;
}
return rc;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Returns 0 if access is permitted, an error code otherwise */ | static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | /* Returns 0 if access is permitted, an error code otherwise */
static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | {
struct smk_audit_info ad;
if (iattr->ia_valid & ATTR_FORCE)
return 0;
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS);
smk_ad_setfield_u_fs_path_dentry(&ad, dentry);
return smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* scc_check_altstatus - Read device alternate status reg @ap: port where the device is */ | static u8 scc_check_altstatus(struct ata_port *ap) | /* scc_check_altstatus - Read device alternate status reg @ap: port where the device is */
static u8 scc_check_altstatus(struct ata_port *ap) | {
return in_be32(ap->ioaddr.altstatus_addr);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 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(). */ | UINT8 EFIAPI PciExpressBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* 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(). */
UINT8 EFIAPI PciExpressBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | {
ASSERT_INVALID_PCI_ADDRESS (Address);
return MmioBitFieldRead8 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Wait for MSTATUS bit to be set, and clear it afterwards, with time out. */ | static int mcux_i3c_status_wait_clear_timeout(I3C_Type *base, uint32_t mask, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us) | /* Wait for MSTATUS bit to be set, and clear it afterwards, with time out. */
static int mcux_i3c_status_wait_clear_timeout(I3C_Type *base, uint32_t mask, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us) | {
int ret;
ret = mcux_i3c_status_wait_timeout(base, mask, init_delay_us,
step_delay_us, total_delay_us);
if (ret != 0) {
goto out;
}
ret = mcux_i3c_status_clear_timeout(base, mask, init_delay_us,
step_delay_us, total_delay_us);
out:
return ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Persists receiver context if there is a free place. */ | static int mdm_receiver_get(struct mdm_receiver_context *ctx) | /* Persists receiver context if there is a free place. */
static int mdm_receiver_get(struct mdm_receiver_context *ctx) | {
int i;
for (i = 0; i < MAX_MDM_CTX; i++) {
if (!contexts[i]) {
contexts[i] = ctx;
return 0;
}
}
return -ENOMEM;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Match the requested auth flavors with the list returned by the server. Returns zero and sets the mount's authentication flavor on success; returns -EACCES if server does not support the requested flavor. */ | static int nfs_walk_authlist(struct nfs_parsed_mount_data *args, struct nfs_mount_request *request) | /* Match the requested auth flavors with the list returned by the server. Returns zero and sets the mount's authentication flavor on success; returns -EACCES if server does not support the requested flavor. */
static int nfs_walk_authlist(struct nfs_parsed_mount_data *args, struct nfs_mount_request *request) | {
unsigned int i, j, server_authlist_len = *(request->auth_flav_len);
if (server_authlist_len == 0)
return 0;
for (i = 0; i < args->auth_flavor_len; i++)
for (j = 0; j < server_authlist_len; j++)
if (args->auth_flavors[i] == request->auth_flavs[j]) {
dfprintk(MOUNT, "NFS: using auth flavor %d\n",
req... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ | int IMG_InitTIF() | /* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int IMG_InitTIF() | {
IMG_SetError("TIFF images are not supported");
return(-1);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* @fdt: ptr to device tree @nodeoffset: node to update @status: FDT_STATUS_OKAY, FDT_STATUS_DISABLED, FDT_STATUS_FAIL, FDT_STATUS_FAIL_ERROR_CODE @error_code: optional, only used if status is FDT_STATUS_FAIL_ERROR_CODE */ | int fdt_set_node_status(void *fdt, int nodeoffset, enum fdt_status status, unsigned int error_code) | /* @fdt: ptr to device tree @nodeoffset: node to update @status: FDT_STATUS_OKAY, FDT_STATUS_DISABLED, FDT_STATUS_FAIL, FDT_STATUS_FAIL_ERROR_CODE @error_code: optional, only used if status is FDT_STATUS_FAIL_ERROR_CODE */
int fdt_set_node_status(void *fdt, int nodeoffset, enum fdt_status status, unsigned int error_co... | {
char buf[16];
int ret = 0;
if (nodeoffset < 0)
return nodeoffset;
switch (status) {
case FDT_STATUS_OKAY:
ret = fdt_setprop_string(fdt, nodeoffset, "status", "okay");
break;
case FDT_STATUS_DISABLED:
ret = fdt_setprop_string(fdt, nodeoffset, "status", "disabled");
break;
case FDT_STATUS_FAIL:
ret =... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Dummy handler for Rx offload packets in case we get an offload packet before proper processing is setup. This complains and drops the packet as it isn't normal to get offload packets at this stage. */ | static int rx_offload_blackhole(struct t3cdev *dev, struct sk_buff **skbs, int n) | /* Dummy handler for Rx offload packets in case we get an offload packet before proper processing is setup. This complains and drops the packet as it isn't normal to get offload packets at this stage. */
static int rx_offload_blackhole(struct t3cdev *dev, struct sk_buff **skbs, int n) | {
while (n--)
dev_kfree_skb_any(skbs[n]);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Go through timeout list (for this task only) and remove the first matching entry, even though the timeout has not triggered yet. */ | void sys_untimeout(sys_timeout_handler h, void *arg) | /* Go through timeout list (for this task only) and remove the first matching entry, even though the timeout has not triggered yet. */
void sys_untimeout(sys_timeout_handler h, void *arg) | {
struct sys_timeouts *timeouts;
struct sys_timeo *prev_t, *t;
timeouts = sys_arch_timeouts();
if (timeouts == NULL) {
LWIP_ASSERT("sys_untimeout: timeouts != NULL", timeouts != NULL);
return;
}
if (timeouts->next == NULL) {
return;
}
for (t = timeouts->next, prev_t = NULL; t != NULL; prev_t... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Octets with the highest bit set will be converted to the Unicode REPLACEMENT CHARACTER. */ | static guint8* tvb_get_ascii_string(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint length) | /* Octets with the highest bit set will be converted to the Unicode REPLACEMENT CHARACTER. */
static guint8* tvb_get_ascii_string(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint length) | {
const guint8 *ptr;
ptr = ensure_contiguous(tvb, offset, length);
return get_ascii_string(scope, ptr, length);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function updates the receive sequence time stamp for this vport. The receive sequence time stamp indicates the time that the last frame of the the sequence that has been idle for the longest amount of time was received. the driver uses this time stamp to indicate if any received sequences have timed out. */ | void lpfc_update_rcv_time_stamp(struct lpfc_vport *vport) | /* This function updates the receive sequence time stamp for this vport. The receive sequence time stamp indicates the time that the last frame of the the sequence that has been idle for the longest amount of time was received. the driver uses this time stamp to indicate if any received sequences have timed out. */
vo... | {
struct lpfc_dmabuf *h_buf;
struct hbq_dmabuf *dmabuf = NULL;
h_buf = list_get_first(&vport->rcv_buffer_list,
struct lpfc_dmabuf, list);
if (!h_buf)
return;
dmabuf = container_of(h_buf, struct hbq_dmabuf, hbuf);
vport->rcv_buffer_time_stamp = dmabuf->time_stamp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sends a byte of data to one of the TWIHS slaves on the bus. */ | void twihs_write_byte(Twihs *p_twihs, uint8_t uc_byte) | /* Sends a byte of data to one of the TWIHS slaves on the bus. */
void twihs_write_byte(Twihs *p_twihs, uint8_t uc_byte) | {
p_twihs->TWIHS_THR = uc_byte;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The constructor function caches the PCI Express Base Address and creates a Set Virtual Address Map event to convert physical address to virtual addresses. */ | EFI_STATUS EFIAPI DxeRuntimePciSegmentLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The constructor function caches the PCI Express Base Address and creates a Set Virtual Address Map event to convert physical address to virtual addresses. */
EFI_STATUS EFIAPI DxeRuntimePciSegmentLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = gBS->CreateEvent (
EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
TPL_NOTIFY,
DxeRuntimePciSegmentLibVirtualNotify,
NULL,
&mDxeRuntimePciSegmentLibVirtualNotifyEvent
);
ASSERT_EFI_ERROR (... | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks if the supplied year is a leap year or not. */ | bool rtcIsLeapYear(int32_t year) | /* Checks if the supplied year is a leap year or not. */
bool rtcIsLeapYear(int32_t year) | {
if (year >= 1900)
{
year -= 1900;
}
if (((year % 400) == 100) || (((year % 4) == 0) && ((year % 100) != 0)))
{
return RTC_LEAP_YEAR;
}
return RTC_NON_LEAP_YEAR;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* Free the memory block from the memory pool. */ | VOID UsbHcFreeMemBlock(IN USBHC_MEM_POOL *Pool, IN USBHC_MEM_BLOCK *Block) | /* Free the memory block from the memory pool. */
VOID UsbHcFreeMemBlock(IN USBHC_MEM_POOL *Pool, IN USBHC_MEM_BLOCK *Block) | {
ASSERT ((Pool != NULL) && (Block != NULL));
IoMmuFreeBuffer (EFI_SIZE_TO_PAGES (Block->BufLen), Block->BufHost, Block->Mapping);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return address map of exception handler template so that C code can generate exception tables. */ | VOID ArchUpdateIdtEntry(OUT IA32_IDT_GATE_DESCRIPTOR *IdtEntry, IN UINTN InterruptHandler) | /* Return address map of exception handler template so that C code can generate exception tables. */
VOID ArchUpdateIdtEntry(OUT IA32_IDT_GATE_DESCRIPTOR *IdtEntry, IN UINTN InterruptHandler) | {
IdtEntry->Bits.OffsetLow = (UINT16)(UINTN)InterruptHandler;
IdtEntry->Bits.OffsetHigh = (UINT16)((UINTN)InterruptHandler >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)((UINTN)InterruptHandler >> 32);
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Latch interrupt request to the INT_SOURCE (24h) register.. */ | int32_t lps22hh_int_notification_get(stmdev_ctx_t *ctx, lps22hh_lir_t *val) | /* Latch interrupt request to the INT_SOURCE (24h) register.. */
int32_t lps22hh_int_notification_get(stmdev_ctx_t *ctx, lps22hh_lir_t *val) | {
lps22hh_interrupt_cfg_t reg;
int32_t ret;
ret = lps22hh_read_reg(ctx, LPS22HH_INTERRUPT_CFG, (uint8_t *) ®,
1);
switch (reg.lir) {
case LPS22HH_INT_PULSED:
*val = LPS22HH_INT_PULSED;
break;
case LPS22HH_INT_LATCHED:
*val = LPS22HH_INT_LATCHED;
break;... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* fc_fcp_abts_resp() - Send an ABTS response @fsp: The FCP packet that is being aborted @fp: The response frame */ | static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) | /* fc_fcp_abts_resp() - Send an ABTS response @fsp: The FCP packet that is being aborted @fp: The response frame */
static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) | {
int ba_done = 1;
struct fc_ba_rjt *brp;
struct fc_frame_header *fh;
fh = fc_frame_header_get(fp);
switch (fh->fh_r_ctl) {
case FC_RCTL_BA_ACC:
break;
case FC_RCTL_BA_RJT:
brp = fc_frame_payload_get(fp, sizeof(*brp));
if (brp && brp->br_reason == FC_BA_RJT_LOG_ERR)
break;
default:
ba_done = 0;
}
i... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: (transfer full): #GIcon for the @drive. Free the returned object with g_object_unref(). */ | GIcon* g_drive_get_icon(GDrive *drive) | /* Returns: (transfer full): #GIcon for the @drive. Free the returned object with g_object_unref(). */
GIcon* g_drive_get_icon(GDrive *drive) | {
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
iface = G_DRIVE_GET_IFACE (drive);
return (* iface->get_icon) (drive);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Print the hexical BYTE immediate data to instruction content. */ | UINTN EdbPrintImmData8(IN UINT8 Data) | /* Print the hexical BYTE immediate data to instruction content. */
UINTN EdbPrintImmData8(IN UINT8 Data) | {
EDBSPrintWithOffset (
mInstructionString.Content,
EDB_INSTRUCTION_CONTENT_MAX_SIZE,
mInstructionContentOffset,
L"(0x%02x)",
(UINTN)Data
);
mInstructionContentOffset += 6;
return mInstructionContentOffset;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Send GO_IDLE command to reset all cards to idle state. */ | static status_t MMC_GoIdle(mmc_card_t *card) | /* Send GO_IDLE command to reset all cards to idle state. */
static status_t MMC_GoIdle(mmc_card_t *card) | {
assert(card);
return SDMMC_GoIdle(card->host.base, card->host.transfer);
} | labapart/polymcu | C++ | null | 201 |
/* Application Event Interface.
This function retrieves, parses, and handles an event received. The application is notified of an event through the callback registered in */ | ADI_BLER_EVENT adi_radio_GetEvent(void) | /* Application Event Interface.
This function retrieves, parses, and handles an event received. The application is notified of an event through the callback registered in */
ADI_BLER_EVENT adi_radio_GetEvent(void) | {
ADI_BLE_TRANSPORT_RESULT eTransportResult;
ADI_BLE_EVENT_PACKET sParsedEventPacket;
ADI_BLER_RESULT eResult;
uint8_t nBytes;
ADI_BLE_LOCK_RADIO(ADI_BLER_LOCK_RADIO_TIMEOUT);
memset(pBLERadio->eventPkt, 0u, ADI_RADIO_RES_HEADER_LEN);
eTransportResult = adi_tal_... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Invoked when error is detected at the Root Port. */ | static void find_source_device(struct pci_dev *parent, struct aer_err_info *e_info) | /* Invoked when error is detected at the Root Port. */
static void find_source_device(struct pci_dev *parent, struct aer_err_info *e_info) | {
struct pci_dev *dev = parent;
int result;
result = find_device_iter(dev, e_info);
if (result)
return;
pci_walk_bus(parent->subordinate, find_device_iter, e_info);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Stops audio Codec playing. It powers down the codec. */ | static uint32_t Codec_Stop(uint32_t CodecPdwnMode) | /* Stops audio Codec playing. It powers down the codec. */
static uint32_t Codec_Stop(uint32_t CodecPdwnMode) | {
uint32_t counter = 0;
Codec_Mute(AUDIO_MUTE_ON);
if (CodecPdwnMode == CODEC_PDWN_SW)
{
counter += Codec_WriteRegister(0x02, 0x9F);
}
else
{
counter += Codec_WriteRegister(0x02, 0x9F);
Delay(0xFFF);
GPIO_WriteBit(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, Bit_RESET);
}
return counter;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_input_set_column_num(CRInput *a_this, glong a_col) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_set_column_num(CRInput *a_this, glong a_col) | {
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
PRIVATE (a_this)->col = a_col;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Description: Generate a CIPSO option using the local tag. Returns the size of the tag on success, negative values on failure. */ | static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr, unsigned char *buffer, u32 buffer_len) | /* Description: Generate a CIPSO option using the local tag. Returns the size of the tag on success, negative values on failure. */
static int cipso_v4_gentag_loc(const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr, unsigned char *buffer, u32 buffer_len) | {
if (!(secattr->flags & NETLBL_SECATTR_SECID))
return -EPERM;
buffer[0] = CIPSO_V4_TAG_LOCAL;
buffer[1] = CIPSO_V4_TAG_LOC_BLEN;
*(u32 *)&buffer[2] = secattr->attr.secid;
return CIPSO_V4_TAG_LOC_BLEN;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Does the current CPU require a yet-as-unscheduled grace period? */ | static int cpu_needs_another_gp(struct rcu_state *rsp, struct rcu_data *rdp) | /* Does the current CPU require a yet-as-unscheduled grace period? */
static int cpu_needs_another_gp(struct rcu_state *rsp, struct rcu_data *rdp) | {
return *rdp->nxttail[RCU_DONE_TAIL] && !rcu_gp_in_progress(rsp);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets up the periodic ISR used for the RTOS tick. */ | static void prvSetupTimerInterrupt(void) | /* Sets up the periodic ISR used for the RTOS tick. */
static void prvSetupTimerInterrupt(void) | {
const unsigned short usClockHz = 15000UL;
const unsigned short usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL;
OSMC = 0x16U;
RTCEN = 1U;
ITMC = 0x0000;
ITMK = 1U;
ITPR1 = 1U;
ITPR0 = 1U;
ITMC = usCompareMatch;
ITIF = 0U;
ITMK = 0U;
ITMC |= 0x8000;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Example to clear an interrupt flag: code RTWDOG_ClearStatusFlags(wdog_base,kRTWDOG_InterruptFlag); endcode param base RTWDOG peripheral base address. param mask The status flags to clear. The parameter can be any combination of the following values: arg kRTWDOG_InterruptFlag */ | void RTWDOG_ClearStatusFlags(RTWDOG_Type *base, uint32_t mask) | /* Example to clear an interrupt flag: code RTWDOG_ClearStatusFlags(wdog_base,kRTWDOG_InterruptFlag); endcode param base RTWDOG peripheral base address. param mask The status flags to clear. The parameter can be any combination of the following values: arg kRTWDOG_InterruptFlag */
void RTWDOG_ClearStatusFlags(RTWDOG_T... | {
if (mask & kRTWDOG_InterruptFlag)
{
base->CS |= RTWDOG_CS_FLG_MASK;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configures the high and low thresholds of the analog watchdog. */ | void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold) | /* Configures the high and low thresholds of the analog watchdog. */
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_THRESHOLD(HighThreshold));
assert_param(IS_ADC_THRESHOLD(LowThreshold));
ADCx->TR = LowThreshold | ((uint32_t)HighThreshold << 16);
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* This Function Wait until Data RX Ready, and return Data Read from UART. */ | uint8_t uart_read_timeout(uart_num_t uart_num, uint32_t rx_timeout_nb_cycles, uart_error_t *error) | /* This Function Wait until Data RX Ready, and return Data Read from UART. */
uint8_t uart_read_timeout(uart_num_t uart_num, uint32_t rx_timeout_nb_cycles, uart_error_t *error) | {
uint32_t uart_port;
uint8_t uart_val;
uint32_t counter;
uart_port = uart_num;
counter = 0;
while ((UART_LSR(uart_port) & UART_LSR_RDR) == 0) {
if (rx_timeout_nb_cycles > 0) {
counter++;
if (counter >= rx_timeout_nb_cycles) {
*error = UART_TIMEOUT_ERROR;
return 0;
}
}
}
uart_val = (UART_RB... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* hw_free callback: clean up the buffer description table and release the buffer */ | static int snd_via82xx_hw_free(struct snd_pcm_substream *substream) | /* hw_free callback: clean up the buffer description table and release the buffer */
static int snd_via82xx_hw_free(struct snd_pcm_substream *substream) | {
struct via82xx *chip = snd_pcm_substream_chip(substream);
struct viadev *viadev = substream->runtime->private_data;
clean_via_table(viadev, substream, chip->pci);
snd_pcm_lib_free_pages(substream);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* It returns 0 if no resize is needed, 1 otherwise. */ | static int ir_is_resize_needed(struct ir_scancode_table *table, int n_elems) | /* It returns 0 if no resize is needed, 1 otherwise. */
static int ir_is_resize_needed(struct ir_scancode_table *table, int n_elems) | {
int cur_size = ir_roundup_tablesize(table->size);
int new_size = ir_roundup_tablesize(n_elems);
if (cur_size == new_size)
return 0;
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the numbers of pbufs on the ooseq list */ | static int tcp_oos_pbuf_count(struct tcp_pcb *pcb) | /* Get the numbers of pbufs on the ooseq list */
static int tcp_oos_pbuf_count(struct tcp_pcb *pcb) | {
int num = 0;
struct tcp_seg* seg = pcb->ooseq;
while(seg != NULL) {
num += pbuf_clen(seg->p);
seg = seg->next;
}
return num;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Get pool size table index from the specified size. */ | STATIC UINTN GetPoolIndexFromSize(UINTN Size) | /* Get pool size table index from the specified size. */
STATIC UINTN GetPoolIndexFromSize(UINTN Size) | {
UINTN Index;
for (Index = 0; Index < MAX_POOL_LIST; Index++) {
if (mPoolSizeTable[Index] >= Size) {
return Index;
}
}
return MAX_POOL_LIST;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Gets the number of pages in each flash region. */ | uint32_t flashcalw_get_page_count_per_region(void) | /* Gets the number of pages in each flash region. */
uint32_t flashcalw_get_page_count_per_region(void) | {
return flashcalw_get_page_count() / FLASH_NB_OF_REGIONS;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Allow dissector key names to be sorted alphabetically */ | static gint compare_dissector_key_name(gconstpointer dissector_a, gconstpointer dissector_b) | /* Allow dissector key names to be sorted alphabetically */
static gint compare_dissector_key_name(gconstpointer dissector_a, gconstpointer dissector_b) | {
return strcmp((const char*)dissector_a, (const char*)dissector_b);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Registers the event callback functions that should be called by the CAN interface. */ | static void VectorXlRegisterEvents(tCanEvents const *events) | /* Registers the event callback functions that should be called by the CAN interface. */
static void VectorXlRegisterEvents(tCanEvents const *events) | {
assert(events != NULL);
if (events != NULL)
{
vectorXlEventsList = realloc(vectorXlEventsList,
(sizeof(tCanEvents) * (vectorXlEventsEntries + 1)));
assert(vectorXlEventsList != NULL);
if (vectorXlEventsList != NULL)
{
vectorXlEventsEntries++;
vectorXl... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function will write a character to serial without interrupt enable mode */ | void rt_serial_putc(const char c) | /* This function will write a character to serial without interrupt enable mode */
void rt_serial_putc(const char c) | {
if (c=='\n')rt_serial_putc('\r');
while(!(UTRSTAT0 & USTAT_TXB_EMPTY));
UTXH0 = (rt_uint8_t)c;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Definition of a pure virtual function.
Calling this function is an error. */ | void __cxa_pure_virtual() | /* Definition of a pure virtual function.
Calling this function is an error. */
void __cxa_pure_virtual() | {
core_panic(PANIC_GENERAL_ERROR, "PURE VIRTUAL CALL");
} | labapart/polymcu | C++ | null | 201 |
/* This function allocates space for a new copy of the device path specified by DevicePath. If DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer is returned. Otherwise, NULL is return... | EFI_DEVICE_PATH_PROTOCOL* EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | /* This function allocates space for a new copy of the device path specified by DevicePath. If DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer is returned. Otherwise, NULL is return... | {
return mDevicePathLibDevicePathUtilities->DuplicateDevicePath (DevicePath);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the Internal Low Speed oscillator (LSI). LSI can not be disabled if the IWDG is running. */ | void RCC_LSICmd(FunctionalState state) | /* Enables or disables the Internal Low Speed oscillator (LSI). LSI can not be disabled if the IWDG is running. */
void RCC_LSICmd(FunctionalState state) | {
MODIFY_REG(RCC->CSR, RCC_CSR_LSION | RCC_CSR_LSIOENLV, RCC_CSR_LSIOENLV | (state << RCC_CSR_LSION_Pos));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Goal: Once we split the thing into several virtual filesystems, we will get rid of magical ranges (and this comment, BTW). */ | static unsigned int get_inode_number(void) | /* Goal: Once we split the thing into several virtual filesystems, we will get rid of magical ranges (and this comment, BTW). */
static unsigned int get_inode_number(void) | {
unsigned int i;
int error;
retry:
if (ida_pre_get(&proc_inum_ida, GFP_KERNEL) == 0)
return 0;
spin_lock(&proc_inum_lock);
error = ida_get_new(&proc_inum_ida, &i);
spin_unlock(&proc_inum_lock);
if (error == -EAGAIN)
goto retry;
else if (error)
return 0;
if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
spin_lo... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Setup the USB PLL to 480 MHz If enable equals 0 then disable PLL Only clock sources IRC and XTAL are valid Mode1a only: Normal operating mode without post- and pre-divider
Set PLL USB (PL550M) */ | void SetPLLUSB(CLKSRC_Type src_clk, uint8_t enable) | /* Setup the USB PLL to 480 MHz If enable equals 0 then disable PLL Only clock sources IRC and XTAL are valid Mode1a only: Normal operating mode without post- and pre-divider
Set PLL USB (PL550M) */
void SetPLLUSB(CLKSRC_Type src_clk, uint8_t enable) | {
if(!enable)
{
LPC_CGU->PLL0USB_CTRL |= PD_ENABLE;
}
else
{
LPC_CGU->PLL0USB_CTRL |= PD_ENABLE;
LPC_CGU->PLL0USB_NP_DIV = (98<<0) | (514<<12);
LPC_CGU->PLL0USB_MDIV = (0xB<<17)|(0x10<<22)|(0<<28)|(0x7FFA<<0); LPC_CGU->PLL0USB_CTRL =(SRC_XTAL<<24) | (0x3<<2) | CLKEN;
LPC_CGU->BASE_USB0_CLK = (0<<0) | (... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* 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 SafeInt32ToUint8(IN INT32 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 SafeInt32ToUint8(IN INT32 Operand, OUT UINT8 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if ((Operand >= 0) && (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 |
/* Returns true if we were not chosen on boot or if we were chosen and filesystem registration succeeded. */ | static int __init init_smk_fs(void) | /* Returns true if we were not chosen on boot or if we were chosen and filesystem registration succeeded. */
static int __init init_smk_fs(void) | {
int err;
if (!security_module_enable(&smack_ops))
return 0;
err = register_filesystem(&smk_fs_type);
if (!err) {
smackfs_mount = kern_mount(&smk_fs_type);
if (IS_ERR(smackfs_mount)) {
printk(KERN_ERR "smackfs: could not mount!\n");
err = PTR_ERR(smackfs_mount);
smackfs_mount = NULL;
}
}
smk_ci... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). As a result, much of the error checking on the parameters to Stop() has been moved into this common boot service. It is legal to call Stop() from other locations, but the following calling restrictions must be followed or... | EFI_STATUS EFIAPI IScsiIp4DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL) | /* The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). As a result, much of the error checking on the parameters to Stop() has been moved into this common boot service. It is legal to call Stop() from other locations, but the following calling restrictions must be followed or... | {
return IScsiStop (
This,
ControllerHandle,
NumberOfChildren,
ChildHandleBuffer,
IP_VERSION_4
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* s2io_restart_nic - Resets the NIC. @data : long pointer to the device private structure Description: This function is scheduled to be run by the s2io_tx_watchdog function after 0.5 secs to reset the NIC. The idea is to reduce the run time of the watch dog routine which is run holding a spin lock. */ | static void s2io_restart_nic(struct work_struct *work) | /* s2io_restart_nic - Resets the NIC. @data : long pointer to the device private structure Description: This function is scheduled to be run by the s2io_tx_watchdog function after 0.5 secs to reset the NIC. The idea is to reduce the run time of the watch dog routine which is run holding a spin lock. */
static void s2i... | {
struct s2io_nic *sp = container_of(work, struct s2io_nic, rst_timer_task);
struct net_device *dev = sp->dev;
rtnl_lock();
if (!netif_running(dev))
goto out_unlock;
s2io_card_down(sp);
if (s2io_card_up(sp)) {
DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", dev->name);
}
s2io_wake_all_tx_queue(sp);
DBG_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If AuthData is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI ImageTimestampVerify(IN CONST UINT8 *AuthData, IN UINTN DataSize, IN CONST UINT8 *TsaCert, IN UINTN CertSize, OUT EFI_TIME *SigningTime) | /* If AuthData is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI ImageTimestampVerify(IN CONST UINT8 *AuthData, IN UINTN DataSize, IN CONST UINT8 *TsaCert, IN UINTN CertSize, OUT EFI_TIME *SigningTime) | {
CALL_CRYPTO_SERVICE (ImageTimestampVerify, (AuthData, DataSize, TsaCert, CertSize, SigningTime), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This file is part of the Simba project. */ | int mock_write_slip_init(void *buf_p, size_t size, void *chout_p, int res) | /* This file is part of the Simba project. */
int mock_write_slip_init(void *buf_p, size_t size, void *chout_p, int res) | {
harness_mock_write("slip_init(): return (buf_p)",
buf_p,
size);
harness_mock_write("slip_init(size)",
&size,
sizeof(size));
harness_mock_write("slip_init(): return (chout_p)",
chout_p,
... | eerimoq/simba | C++ | Other | 337 |
/* Remove a RtkBuffer from specified rtkqueue at list head. */ | RTK_BUFFER* RtbDequeueHead(IN OUT RTB_QUEUE_HEAD *RtkQueueHead) | /* Remove a RtkBuffer from specified rtkqueue at list head. */
RTK_BUFFER* RtbDequeueHead(IN OUT RTB_QUEUE_HEAD *RtkQueueHead) | {
RTK_BUFFER* Rtb = NULL;
aos_mutex_lock(&RtkQueueHead->Lock, AOS_WAIT_FOREVER);
if (RtbQueueIsEmpty(RtkQueueHead))
{
aos_mutex_unlock(&RtkQueueHead->Lock);
return NULL;
}
Rtb = (RTK_BUFFER*)RtkQueueHead->List.Next;
RtbRemoveNode(RtkQueueHead, Rtb);
aos_mutex_unlock(... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Check the status of the Rx buffer of the specified SPI port. */ | xtBoolean SPIIsRxFull(unsigned long ulBase) | /* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxFull(unsigned long ulBase) | {
xASSERT(ulBase == SPI0_BASE);
return ((xHWREG(ulBase + SPI_SR) & SPI_SR_RXBNE)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* param base I2S peripheral base address. param handle Pointer to usart_dma_handle_t structure. param xfer I2S DMA transfer structure. See #i2s_transfer_t. param i2s_channel I2S start channel number retval kStatus_Success */ | status_t I2S_TransferSendLoopDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t *xfer, uint32_t loopTransferCount) | /* param base I2S peripheral base address. param handle Pointer to usart_dma_handle_t structure. param xfer I2S DMA transfer structure. See #i2s_transfer_t. param i2s_channel I2S start channel number retval kStatus_Success */
status_t I2S_TransferSendLoopDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t *xf... | {
assert(handle != NULL);
assert(handle->i2sLoopDMADescriptor != NULL);
handle->state = (uint32_t)kI2S_DmaStateTx;
return I2S_TransferLoopDMA(base, handle, xfer, loopTransferCount);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions */ | static bool indev_reset_check(lv_indev_t *indev) | /* Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions */
static bool indev_reset_check(lv_indev_t *indev) | {
if(indev->reset_query) {
indev_obj_act = NULL;
}
return indev->reset_query;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Find in between all events timers which is the next one. (and update the internal next_timer_* accordingly) */ | void nsi_hws_find_next_event(void) | /* Find in between all events timers which is the next one. (and update the internal next_timer_* accordingly) */
void nsi_hws_find_next_event(void) | {
next_timer_index = 0;
next_timer_time = *__nsi_hw_events_start[0].timer;
for (unsigned int i = 1; i < number_of_events ; i++) {
if (next_timer_time > *__nsi_hw_events_start[i].timer) {
next_timer_index = i;
next_timer_time = *__nsi_hw_events_start[i].timer;
}
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Programs the DmaRxBaseAddress with the Rx descriptor base address. Rx Descriptor's base address is available in the gmacdev structure. This function progrms the Dma Rx Base address with the starting address of the descriptor ring or chain. */ | void synopGMAC_init_rx_desc_base(synopGMACdevice *gmacdev) | /* Programs the DmaRxBaseAddress with the Rx descriptor base address. Rx Descriptor's base address is available in the gmacdev structure. This function progrms the Dma Rx Base address with the starting address of the descriptor ring or chain. */
void synopGMAC_init_rx_desc_base(synopGMACdevice *gmacdev) | {
synopGMACWriteReg(gmacdev->DmaBase, DmaRxBaseAddr, (u32)gmacdev->RxDescDma);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Start a DHCP client, and wait for a lease to be acquired. */ | void app_dhcpv4_startup(void) | /* Start a DHCP client, and wait for a lease to be acquired. */
void app_dhcpv4_startup(void) | {
struct net_if *iface;
net_mgmt_init_event_callback(&mgmt_cb, handler,
NET_EVENT_IPV4_ADDR_ADD);
net_mgmt_add_event_callback(&mgmt_cb);
iface = net_if_get_default();
net_dhcpv4_start(iface);
k_sem_take(&got_address, K_FOREVER);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Worker function to MP-related information on the requested processor at the instant this call is made. */ | EFI_STATUS GetProcessorInformation(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer) | /* Worker function to MP-related information on the requested processor at the instant this call is made. */
EFI_STATUS GetProcessorInformation(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer) | {
EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi;
EFI_STATUS Status;
CPU_FEATURES_DATA *CpuFeaturesData;
CpuFeaturesData = GetCpuFeaturesData ();
CpuMp2Ppi = CpuFeaturesData->MpService.Ppi;
Status = CpuMp2Ppi->GetProcessorInfo (
CpuMp2Ppi,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Called asynchronously after the last tty kref is dropped, and the tty layer has already done the tty_shutdown(tty); */ | static void serial_cleanup(struct tty_struct *tty) | /* Called asynchronously after the last tty kref is dropped, and the tty layer has already done the tty_shutdown(tty); */
static void serial_cleanup(struct tty_struct *tty) | {
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial;
struct module *owner;
if (port->console)
return;
dbg("%s - port %d", __func__, port->number);
tty->driver_data = NULL;
serial = port->serial;
owner = serial->type->driver.owner;
mutex_lock(&serial->disc_mutex);
if (!serial->discon... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* t h r o w I n f o */ | returnValue MessageHandling_throwInfo(MessageHandling *_THIS, returnValue Inumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus) | /* t h r o w I n f o */
returnValue MessageHandling_throwInfo(MessageHandling *_THIS, returnValue Inumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus) | {
if ( Inumber < SUCCESSFUL_RETURN )
return MessageHandling_throwError( _THIS,RET_INFO_UNDEFINED,0,__FUNC__,__FILE__,__LINE__,VS_VISIBLE );
if ( _THIS->infoVisibility == VS_VISIBLE )
return MessageHandling_throwMessage( _THIS,Inumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"INFO" );
... | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* param base SPI peripheral base address. param handle Pointer to the spi_master_handle_t structure which stores the transfer state. param count The number of bytes transferred by using the non-blocking transaction. return status of status_t. */ | status_t SPI_MasterTransferGetCount(SPI_Type *base, spi_master_handle_t *handle, size_t *count) | /* param base SPI peripheral base address. param handle Pointer to the spi_master_handle_t structure which stores the transfer state. param count The number of bytes transferred by using the non-blocking transaction. return status of status_t. */
status_t SPI_MasterTransferGetCount(SPI_Type *base, spi_master_handle_t ... | {
assert(NULL != handle);
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if (handle->state != (uint32_t)kStatus_SPI_Busy)
{
*count = 0;
return kStatus_NoTransferInProgress;
}
*count = handle->totalByteCount - handle->rxRemainingBytes;
return kStatus_Su... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* NB. To be 100% safe against broken PCI devices, the caller should take steps to avoid an infinite loop. */ | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap) | /* NB. To be 100% safe against broken PCI devices, the caller should take steps to avoid an infinite loop. */
int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap) | {
return __pci_find_next_ht_cap(dev, pos + PCI_CAP_LIST_NEXT, ht_cap);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Simulate gettimeofday using do_gettimeofday which only allows a timeval and therefore only yields usec accuracy */ | void getnstimeofday(struct timespec *tv) | /* Simulate gettimeofday using do_gettimeofday which only allows a timeval and therefore only yields usec accuracy */
void getnstimeofday(struct timespec *tv) | {
struct timeval x;
do_gettimeofday(&x);
tv->tv_sec = x.tv_sec;
tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* See "mss_ace.h" for details of how to use this function. */ | ace_channel_handle_t ACE_get_input_channel_handle(adc_channel_id_t channel_id) | /* See "mss_ace.h" for details of how to use this function. */
ace_channel_handle_t ACE_get_input_channel_handle(adc_channel_id_t channel_id) | {
uint16_t channel_idx;
ace_channel_handle_t channel_handle = INVALID_CHANNEL_HANDLE;
for ( channel_idx = 0u; channel_idx < (uint16_t)ACE_NB_OF_INPUT_CHANNELS; ++channel_idx )
{
if ( g_ace_channel_desc_table[channel_idx].signal_id == channel_id )
{
channel_handle = (ace_chan... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* SATA interface between low level driver and command layer */ | static ulong sata_read_common(struct ahci_uc_priv *uc_priv, struct blk_desc *desc, ulong blknr, lbaint_t blkcnt, void *buffer) | /* SATA interface between low level driver and command layer */
static ulong sata_read_common(struct ahci_uc_priv *uc_priv, struct blk_desc *desc, ulong blknr, lbaint_t blkcnt, void *buffer) | {
u32 rc;
if (desc->lba48)
rc = ata_low_level_rw_lba48(uc_priv, blknr, blkcnt, buffer,
READ_CMD);
else
rc = ata_low_level_rw_lba28(uc_priv, blknr, blkcnt, buffer,
READ_CMD);
return rc;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* strnlen - Find the length of a length-limited string @s: The string to be sized @count: The maximum number of bytes to search */ | size_t strnlen(const char *s, size_t count) | /* strnlen - Find the length of a length-limited string @s: The string to be sized @count: The maximum number of bytes to search */
size_t strnlen(const char *s, size_t count) | {
const char *sc;
for (sc = s; count-- && *sc != '\0'; ++sc);
return sc - s;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the UARTx peripheral registers to their default reset values. */ | void UART_DeInit(UART_TypeDef *UARTx) | /* Deinitializes the UARTx peripheral registers to their default reset values. */
void UART_DeInit(UART_TypeDef *UARTx) | {
assert_param(IS_UART_ALL_PERIPH(UARTx));
switch (*(uint32_t*)&UARTx)
{
case UART1_BASE:
RCC_APB2PeriphResetCmd(RCC_APB2Periph_UART1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_UART1, DISABLE);
break;
default:
break;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Process function helper. Displays low data rate warning if the ADC output data rate is smaller than 80 times the register update rate. If this is the case the application may stop the CLI capability and freeze. */ | static int32_t cn0414_process_low_odr_warning(struct cn0414_dev *dev) | /* Process function helper. Displays low data rate warning if the ADC output data rate is smaller than 80 times the register update rate. If this is the case the application may stop the CLI capability and freeze. */
static int32_t cn0414_process_low_odr_warning(struct cn0414_dev *dev) | {
int32_t ret;
ret = usr_uart_write_string(dev->uart_descriptor,
(uint8_t*)"\nCARE! SAMPLE RATE CRITICALLY LOW!\n");
if(ret != CN0414_SUCCESS)
goto finish;
ret = usr_uart_write_string(dev->uart_descriptor, (uint8_t*)">");
if(ret != CN0414_SUCCESS)
goto finish;
finish:
low_sample_rate_flag = 2;
return... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Mark the beginning of PATH TOV handling. IO completion callbacks are still pending. */ | void bfa_cb_itnim_tov_begin(void *cb_arg) | /* Mark the beginning of PATH TOV handling. IO completion callbacks are still pending. */
void bfa_cb_itnim_tov_begin(void *cb_arg) | {
struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg;
bfa_trc(itnim->fcs, itnim->rport->pwwn);
bfa_fcb_itnim_tov_begin(itnim->itnim_drv);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* It returns zero on success, or a standard errno code on error. */ | int ip6_sk_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) | /* It returns zero on success, or a standard errno code on error. */
int ip6_sk_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) | {
*dst = NULL;
if (sk) {
*dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
*dst = ip6_sk_dst_check(sk, *dst, fl);
}
return ip6_dst_lookup_tail(sk, dst, fl);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Command response callback function for sd_ble_gap_authenticate BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gap_authenticate_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gap_authenticate BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_authenticate_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code = 0;
const uint32_t err_code = ble_gap_authenticate_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Get the elapsed milliseconds science a previous time stamp */ | uint32_t lv_tick_elaps(uint32_t prev_tick) | /* Get the elapsed milliseconds science a previous time stamp */
uint32_t lv_tick_elaps(uint32_t prev_tick) | {
uint32_t act_time = lv_tick_get();
if(act_time >= prev_tick) {
prev_tick = act_time - prev_tick;
} else {
prev_tick = UINT32_MAX - prev_tick + 1;
prev_tick += act_time;
}
return prev_tick;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This function retrieves a pointer to the currently selected radio button in a radio group. */ | struct wtk_radio_button* wtk_radio_group_get_selected(struct wtk_radio_group *group) | /* This function retrieves a pointer to the currently selected radio button in a radio group. */
struct wtk_radio_button* wtk_radio_group_get_selected(struct wtk_radio_group *group) | {
Assert(group);
return group->selected;
} | memfault/zero-to-main | C++ | null | 200 |
/* do_IRQ handles all normal device IRQs (the special SMP cross-CPU interrupts have their own specific handlers). */ | unsigned int do_IRQ(int irq, struct uml_pt_regs *regs) | /* do_IRQ handles all normal device IRQs (the special SMP cross-CPU interrupts have their own specific handlers). */
unsigned int do_IRQ(int irq, struct uml_pt_regs *regs) | {
struct pt_regs *old_regs = set_irq_regs((struct pt_regs *)regs);
irq_enter();
__do_IRQ(irq);
irq_exit();
set_irq_regs(old_regs);
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the RTC SCCR to clear status bits. */ | void rtc_clear_status(Rtc *p_rtc, uint32_t ul_clear) | /* Set the RTC SCCR to clear status bits. */
void rtc_clear_status(Rtc *p_rtc, uint32_t ul_clear) | {
p_rtc->RTC_SCCR = ul_clear;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */ | void rt_hw_trap_dabt(struct rt_hw_register *regs) | /* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */
void rt_hw_trap_dabt(struct rt_hw_register *regs) | { rt_kprintf("Data Abort ");
rt_hw_show_register(regs);
if (rt_thread_self() != RT_NULL)
rt_kprintf("Current Thread: %s\n", rt_thread_self()->name);
rt_hw_cpu_shutdown();
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Returns negative errno on error, or zero on success. */ | static int epson1355fb_blank(int blank_mode, struct fb_info *info) | /* Returns negative errno on error, or zero on success. */
static int epson1355fb_blank(int blank_mode, struct fb_info *info) | {
struct epson1355_par *par = info->par;
switch (blank_mode) {
case FB_BLANK_UNBLANK:
case FB_BLANK_NORMAL:
lcd_enable(par, 1);
backlight_enable(1);
break;
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
backlight_enable(0);
break;
case FB_BLANK_POWERDOWN:
backlight_enable(0);
lcd_enable(... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each ADC_InitStruct member with its default value. */ | void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct) | /* Fills each ADC_InitStruct member with its default value. */
void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct) | {
ADC_InitStruct->ADC_Resolution = ADC_Resolution_12b;
ADC_InitStruct->ADC_ScanConvMode = DISABLE;
ADC_InitStruct->ADC_ContinuousConvMode = DISABLE;
ADC_InitStruct->ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStruct->A... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Disable the main oscillator.
Sets the IOSCDIS bit in SYSCTL_RCC, disabling the main oscillator. */ | void rcc_disable_main_osc(void) | /* Disable the main oscillator.
Sets the IOSCDIS bit in SYSCTL_RCC, disabling the main oscillator. */
void rcc_disable_main_osc(void) | {
SYSCTL_RCC |= SYSCTL_RCC_MOSCDIS;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Usually drivers set the DMA timing at the point the set_dmamode call is made. IT821x however requires we load new timings on the transitions in some cases. */ | static void it821x_passthru_bmdma_start(struct ata_queued_cmd *qc) | /* Usually drivers set the DMA timing at the point the set_dmamode call is made. IT821x however requires we load new timings on the transitions in some cases. */
static void it821x_passthru_bmdma_start(struct ata_queued_cmd *qc) | {
struct ata_port *ap = qc->ap;
struct ata_device *adev = qc->dev;
struct it821x_dev *itdev = ap->private_data;
int unit = adev->devno;
if (itdev->mwdma[unit] != MWDMA_OFF)
it821x_program(ap, adev, itdev->mwdma[unit]);
else if (itdev->udma[unit] != UDMA_OFF && itdev->timing10)
it821x_program_udma(ap, adev, it... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* FDCAN MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan) | /* FDCAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hfdcan->Instance==FDCAN1)
{
LL_RCC_SetFDCANClockSource(LL_RCC_FDCAN_CLKSOURCE_HSE);
__HAL_RCC_FDCAN_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* write long value into buffer memory over memory data register (MDR), */ | static void write_mdr(struct s_smc *smc, u_long val) | /* write long value into buffer memory over memory data register (MDR), */
static void write_mdr(struct s_smc *smc, u_long val) | {
CHECK_NPP() ;
MDRW(val) ;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Registers a listener to listen for completion of the current stop procedure. */ | static void ble_hs_stop_register_listener(struct ble_hs_stop_listener *listener, ble_hs_stop_fn *fn, void *arg) | /* Registers a listener to listen for completion of the current stop procedure. */
static void ble_hs_stop_register_listener(struct ble_hs_stop_listener *listener, ble_hs_stop_fn *fn, void *arg) | {
BLE_HS_DBG_ASSERT(fn != NULL);
listener->fn = fn;
listener->arg = arg;
SLIST_INSERT_HEAD(&ble_hs_stop_listeners, listener, link);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This routine can only be used during init, since smp_boot_data is an init data structure. We have to use smp_boot_data.cpu_phys_id to find the physical id of the processor because the normal cpu_physical_id() relies on data structures that may not be initialized yet. */ | static int __init pxm_to_nasid(int pxm) | /* This routine can only be used during init, since smp_boot_data is an init data structure. We have to use smp_boot_data.cpu_phys_id to find the physical id of the processor because the normal cpu_physical_id() relies on data structures that may not be initialized yet. */
static int __init pxm_to_nasid(int pxm) | {
int i;
int nid;
nid = pxm_to_node(pxm);
for (i = 0; i < num_node_memblks; i++) {
if (node_memblk[i].nid == nid) {
return NASID_GET(node_memblk[i].start_paddr);
}
}
return -1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Wait end of transfer and check if received Data are well. */ | void WaitAndCheckEndOfTransfer(void) | /* Wait end of transfer and check if received Data are well. */
void WaitAndCheckEndOfTransfer(void) | {
while (ubTransmissionComplete != 1)
{
}
LL_DMA_DisableStream(DMA2, LL_DMA_STREAM_3);
while (ubReceptionComplete != 1)
{
}
LL_DMA_DisableStream(DMA2, LL_DMA_STREAM_2);
if(Buffercmp8((uint8_t*)aTxBuffer, (uint8_t*)aRxBuffer, ubNbDataToTransmit))
{
LED_Blinking(LED_BLINK_ERROR);
}
else
{
... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Block running Thread execution and register it as Ready to Run. */ | static void osRtxThreadBlock(os_thread_t *thread) | /* Block running Thread execution and register it as Ready to Run. */
static void osRtxThreadBlock(os_thread_t *thread) | {
prev = next;
next = next->thread_next;
}
thread->thread_prev = prev;
thread->thread_next = next;
prev->thread_next = thread;
if (next != NULL) {
next->thread_prev = thread;
}
EvrRtxThreadPreempted(thread);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore. */ | EFI_PEI_FILE_HANDLE DxeIplFindDxeCore(VOID) | /* Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore. */
EFI_PEI_FILE_HANDLE DxeIplFindDxeCore(VOID) | {
EFI_STATUS Status;
UINTN Instance;
EFI_PEI_FV_HANDLE VolumeHandle;
EFI_PEI_FILE_HANDLE FileHandle;
Instance = 0;
while (TRUE) {
Status = PeiServicesFfsFindNextVolume (Instance, &VolumeHandle);
if (EFI_ERROR (Status)) {
REPORT_STATUS_CODE (EFI_PROGRESS_CODE, (EFI_... | tianocore/edk2 | C++ | Other | 4,240 |
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer param format Pointer to FlexIO I2S audio data format structure. param srcClock_Hz FlexIO I2S clock source frequency in Hz, it should be 0 while in slave mode. retval kStatus_Success Audio format set successfully. retval kStatu... | void FLEXIO_I2S_TransferSetFormatEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz) | /* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer param format Pointer to FlexIO I2S audio data format structure. param srcClock_Hz FlexIO I2S clock source frequency in Hz, it should be 0 while in slave mode. retval kStatus_Success Audio format set successfully. retval kStatu... | {
assert((handle != NULL) && (format != NULL));
if (srcClock_Hz != 0UL)
{
FLEXIO_I2S_MasterSetFormat(base, format, srcClock_Hz);
}
else
{
FLEXIO_I2S_SlaveSetFormat(base, format);
}
handle->bytesPerFrame = format->bitWidth / 8U;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Policy must be within lowest and highest possible CPU Frequency, and at least one possible state must be within min and max. */ | static int powernow_k6_verify(struct cpufreq_policy *policy) | /* Policy must be within lowest and highest possible CPU Frequency, and at least one possible state must be within min and max. */
static int powernow_k6_verify(struct cpufreq_policy *policy) | {
return cpufreq_frequency_table_verify(policy, &clock_ratio[0]);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.