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 |
|---|---|---|---|---|---|---|---|
/* mux the pin to the "B" internal peripheral role. */ | int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup) | /* mux the pin to the "B" internal peripheral role. */
int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup) | {
void __iomem *pio = pin_to_controller(pin);
unsigned mask = pin_to_mask(pin);
if (!pio)
return -EINVAL;
__raw_writel(mask, pio + PIO_IDR);
__raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
__raw_writel(mask, pio + PIO_BSR);
__raw_writel(mask, pio + PIO_PDR);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* We only start I/O when something is connected to both sides of this port. If nothing is listening on the host side, we may be pointlessly filling up our TX buffers and FIFO. */ | static int gs_start_io(struct gs_port *port) | /* We only start I/O when something is connected to both sides of this port. If nothing is listening on the host side, we may be pointlessly filling up our TX buffers and FIFO. */
static int gs_start_io(struct gs_port *port) | {
struct list_head *head = &port->read_pool;
struct usb_ep *ep = port->port_usb->out;
int status;
unsigned started;
status = gs_alloc_requests(ep, head, gs_read_complete);
if (status)
return status;
status = gs_alloc_requests(port->port_usb->in, &port->write_pool,
gs_write_complete);
if (status) {
gs_free_requests(ep, head);
return status;
}
port->n_read = 0;
started = gs_start_rx(port);
if (started) {
tty_wakeup(port->port_tty);
} else {
gs_free_requests(ep, head);
gs_free_requests(port->port_usb->in, &port->write_pool);
status = -EIO;
}
return status;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. */ | void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle) | /* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. */
void LPSPI_SlaveTransferAbortEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle) | {
assert(handle);
LPSPI_DisableDMA(base, kLPSPI_RxDmaEnable | kLPSPI_TxDmaEnable);
EDMA_AbortTransfer(handle->edmaRxRegToRxDataHandle);
EDMA_AbortTransfer(handle->edmaTxDataToTxRegHandle);
handle->state = kLPSPI_Idle;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clear the DWD violation flag.
This function will clear dwd status register. */ | void dwdClearFlag(void) | /* Clear the DWD violation flag.
This function will clear dwd status register. */
void dwdClearFlag(void) | {
rtiREG1->WDSTATUS = 0xFFU;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ | gboolean _g_freedesktop_dbus_call_get_connection_unix_user_sync(_GFreedesktopDBus *proxy, const gchar *arg_name, guint *out_uid, GCancellable *cancellable, GError **error) | /* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_get_connection_unix_user_sync(_GFreedesktopDBus *proxy, const gchar *arg_name, guint *out_uid, GCancellable *cancellable, GError **error) | {
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
"GetConnectionUnixUser",
g_variant_new ("(s)",
arg_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"(u)",
out_uid);
g_variant_unref (_ret);
_out:
return _ret != NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Return TIOCSER_TEMT when transmitter FIFO and Shift register is empty. */ | static u_int atmel_tx_empty(struct uart_port *port) | /* Return TIOCSER_TEMT when transmitter FIFO and Shift register is empty. */
static u_int atmel_tx_empty(struct uart_port *port) | {
return (UART_GET_CSR(port) & ATMEL_US_TXEMPTY) ? TIOCSER_TEMT : 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Same as skb_read_bits, but calculate a checksum at the same time. */ | static size_t xdr_skb_read_and_csum_bits(struct xdr_skb_reader *desc, void *to, size_t len) | /* Same as skb_read_bits, but calculate a checksum at the same time. */
static size_t xdr_skb_read_and_csum_bits(struct xdr_skb_reader *desc, void *to, size_t len) | {
unsigned int pos;
__wsum csum2;
if (len > desc->count)
len = desc->count;
pos = desc->offset;
csum2 = skb_copy_and_csum_bits(desc->skb, pos, to, len, 0);
desc->csum = csum_block_add(desc->csum, csum2, pos);
desc->count -= len;
desc->offset += len;
return len;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write current date/time or alarm date/time to RTC Module. This function is to configure current date/time or alarm date/time. */ | void xRTCTimeWrite(xtTime *pxtTime, unsigned long ulTimeAlarm) | /* Write current date/time or alarm date/time to RTC Module. This function is to configure current date/time or alarm date/time. */
void xRTCTimeWrite(xtTime *pxtTime, unsigned long ulTimeAlarm) | {
RTCTimeWrite(tTime(pxtTime), ulTimeAlarm);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Checks whether the specified SPI interrupt has occurred or not. */ | it_status_t ald_spi_get_it_status(ald_spi_handle_t *hperh, ald_spi_it_t it) | /* Checks whether the specified SPI interrupt has occurred or not. */
it_status_t ald_spi_get_it_status(ald_spi_handle_t *hperh, ald_spi_it_t it) | {
assert_param(IS_SPI(hperh->perh));
assert_param(IS_SPI_IT(it));
if (hperh->perh->IVS & it)
return SET;
return RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ | uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt) | /* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt) | {
return 0U;
}
if (ep_dir == 0U) {
return 0U;
}
if ((ep_num == 0U) && (ep0_no_data_stage != 0)) {
return 0U;
}
if ((ep_num == 0U) && (ep0_dir == 0)) {
return 0U;
}
ep_max_len = ep_config[ep_dir][ep_num].max_packet_size;
if (len > ep_max_len) {
len = ep_max_len;
}
if ((ep_num == 0U) && (len < ep_max_len)) {
ep0_status_next = 1U;
}
memcpy((void *)&ep_buf[ep_dir][ep_num][0], (const void *)pData, len);
usbd_dma(EPNum, &ep_buf[ep_dir][ep_num][0], len);
return len;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* The mm being torn down won't ever be active again, so any Icache lines tagged with its ASID won't be visible for the rest of the lifetime of this ASID cycle. Before the ASID gets reused, there will be a flush_cache_all. Hence we don't need to touch the I-cache. This is similar to the lack of action needed in flush_tlb_mm - see fault.c. */ | static void sh5_flush_cache_mm(void *unused) | /* The mm being torn down won't ever be active again, so any Icache lines tagged with its ASID won't be visible for the rest of the lifetime of this ASID cycle. Before the ASID gets reused, there will be a flush_cache_all. Hence we don't need to touch the I-cache. This is similar to the lack of action needed in flush_tlb_mm - see fault.c. */
static void sh5_flush_cache_mm(void *unused) | {
sh64_dcache_purge_all();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* vApplicationGetTimerTaskMemory gets called when configSUPPORT_STATIC_ALLOCATION equals to 1 and is required for static memory allocation support. */ | void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) | /* vApplicationGetTimerTaskMemory gets called when configSUPPORT_STATIC_ALLOCATION equals to 1 and is required for static memory allocation support. */
void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) | {
*ppxTimerTaskTCBBuffer = &Timer_TCB;
*ppxTimerTaskStackBuffer = &Timer_Stack[0];
*pulTimerTaskStackSize = (uint32_t)configTIMER_TASK_STACK_DEPTH;
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Check the value whether in the valid list. */ | STATIC BOOLEAN EFIAPI IsInValidList(IN UINT32 Value, IN UINT32 *ValidList, IN UINT32 ValidListLength) | /* Check the value whether in the valid list. */
STATIC BOOLEAN EFIAPI IsInValidList(IN UINT32 Value, IN UINT32 *ValidList, IN UINT32 ValidListLength) | {
UINT32 index;
if (ValidList == NULL) {
return FALSE;
}
for (index = 0; index < ValidListLength; index++) {
if (ValidList[index] == Value) {
return TRUE;
}
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Starts transmission of the data on the bulk OUT pipe. Because USB bulk transmissions are quick, this function does not use the overlapped functionality, which means the caller is blocked until the tranmission completed. */ | static uint8_t UblTransmit(uint8_t *data, uint16_t len) | /* Starts transmission of the data on the bulk OUT pipe. Because USB bulk transmissions are quick, this function does not use the overlapped functionality, which means the caller is blocked until the tranmission completed. */
static uint8_t UblTransmit(uint8_t *data, uint16_t len) | {
DWORD bytesWritten = 0;
if (WinUsb_WritePipe(bulkUsbDev.hWinUSBDev, bulkUsbDev.pipeBulkOut, data, len,
&bytesWritten, NULL) == 0)
{
return UBL_ERROR;
}
if (bytesWritten != len)
{
return UBL_ERROR;
}
return UBL_OKAY;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Enable lptimer Preload mode.
Enable lptimer preload mode, delaying update of period and compare registers to the end of current period. */ | void lptimer_enable_preload(uint32_t lptimer_peripheral) | /* Enable lptimer Preload mode.
Enable lptimer preload mode, delaying update of period and compare registers to the end of current period. */
void lptimer_enable_preload(uint32_t lptimer_peripheral) | {
LPTIM_CFGR(lptimer_peripheral) |= LPTIM_CFGR_PRELOAD;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI S3PciSegmentAndThenOr16(IN UINT64 Address, IN UINT16 AndData, IN UINT16 OrData) | /* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI S3PciSegmentAndThenOr16(IN UINT64 Address, IN UINT16 AndData, IN UINT16 OrData) | {
return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentAndThenOr16 (Address, AndData, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configures the alternate function of a GPIO pin. */ | void GPIOPinConfigure(const unsigned long ulPinConfig) | /* Configures the alternate function of a GPIO pin. */
void GPIOPinConfigure(const unsigned long ulPinConfig) | {
unsigned long ulRegValue;
if(ulPinConfig & 0x00000100)
{
ulRegValue = xHWREG(GCR_GPBALT);
ulRegValue &= ~(0x03 << ((ulPinConfig >> 8) & 0x0f));
ulRegValue |= ((0x03 & ulPinConfig) << ((ulPinConfig >> 8) & 0x0f));
xHWREG(GCR_GPBALT) = ulRegValue;
}
else
{
ulRegValue = xHWREG(GCR_GPAALT);
ulRegValue &= ~(0x03 << ((ulPinConfig >> 8) & 0x0f));
ulRegValue |= ((0x03 & ulPinConfig) << ((ulPinConfig >> 8) & 0x0f));
xHWREG(GCR_GPAALT) = ulRegValue;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return total number of clock devices supported by the clock management protocol. */ | STATIC EFI_STATUS ClockGetTotalClocks(IN SCMI_CLOCK_PROTOCOL *This, OUT UINT32 *TotalClocks) | /* Return total number of clock devices supported by the clock management protocol. */
STATIC EFI_STATUS ClockGetTotalClocks(IN SCMI_CLOCK_PROTOCOL *This, OUT UINT32 *TotalClocks) | {
EFI_STATUS Status;
UINT32 *ReturnValues;
Status = ScmiGetProtocolAttributes (ScmiProtocolIdClock, &ReturnValues);
if (EFI_ERROR (Status)) {
return Status;
}
*TotalClocks = SCMI_CLOCK_PROTOCOL_TOTAL_CLKS (ReturnValues[0]);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function reads the pending data in the device. */ | EFI_STATUS EFIAPI AtaPacketReadPendingData(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_IDE_REGISTERS *IdeRegisters) | /* This function reads the pending data in the device. */
EFI_STATUS EFIAPI AtaPacketReadPendingData(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_IDE_REGISTERS *IdeRegisters) | {
UINT8 AltRegister;
UINT16 TempWordBuffer;
AltRegister = IdeReadPortB (PciIo, IdeRegisters->AltOrDev);
if ((AltRegister & ATA_STSREG_BSY) == ATA_STSREG_BSY) {
return EFI_NOT_READY;
}
if ((AltRegister & (ATA_STSREG_BSY | ATA_STSREG_DRQ)) == ATA_STSREG_DRQ) {
TempWordBuffer = IdeReadPortB (PciIo, IdeRegisters->AltOrDev);
while ((TempWordBuffer & (ATA_STSREG_BSY | ATA_STSREG_DRQ)) == ATA_STSREG_DRQ) {
IdeReadPortWMultiple (
PciIo,
IdeRegisters->Data,
1,
&TempWordBuffer
);
TempWordBuffer = IdeReadPortB (PciIo, IdeRegisters->AltOrDev);
}
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function enables all tracing buffers that may have been disabled with tracing_off. */ | void tracing_on(void) | /* This function enables all tracing buffers that may have been disabled with tracing_off. */
void tracing_on(void) | {
set_bit(RB_BUFFERS_ON_BIT, &ring_buffer_flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If no filename is given to av_open_input_file because you want to get the local port first, then you must call this function to set the remote server address. */ | int rtp_set_remote_url(URLContext *h, const char *uri) | /* If no filename is given to av_open_input_file because you want to get the local port first, then you must call this function to set the remote server address. */
int rtp_set_remote_url(URLContext *h, const char *uri) | {
RTPContext *s = h->priv_data;
char hostname[256];
int port;
char buf[1024];
char path[1024];
ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
path, sizeof(path), uri);
ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
udp_set_remote_url(s->rtp_hd, buf);
ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path);
udp_set_remote_url(s->rtcp_hd, buf);
return 0;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* De-initializes the FMC PCCARD Bank registers to their default reset values. */ | void FMC_PCCARDDeInit(void) | /* De-initializes the FMC PCCARD Bank registers to their default reset values. */
void FMC_PCCARDDeInit(void) | {
FMC_Bank4->PCR4 = 0x00000018;
FMC_Bank4->SR4 = 0x00000000; FMC_Bank4->PMEM4 = 0xFCFCFCFC;
FMC_Bank4->PATT4 = 0xFCFCFCFC;
FMC_Bank4->PIO4 = 0xFCFCFCFC;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Fast processing for the common case of 2:1 horizontal and 2:1 vertical. It's still a box filter. */ | h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) | /* Fast processing for the common case of 2:1 horizontal and 2:1 vertical. It's still a box filter. */
h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr) | {
JSAMPARRAY output_data = *output_data_ptr;
register JSAMPROW inptr, outptr;
register JSAMPLE invalue;
JSAMPROW outend;
int inrow, outrow;
inrow = outrow = 0;
while (outrow < cinfo->max_v_samp_factor) {
inptr = input_data[inrow];
outptr = output_data[outrow];
outend = outptr + cinfo->output_width;
while (outptr < outend) {
invalue = *inptr++;
*outptr++ = invalue;
*outptr++ = invalue;
}
jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
1, cinfo->output_width);
inrow++;
outrow += 2;
}
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Set the order of descriptors within the group are processed when saving register values. */ | static void SSARC_SetGroupSaveOrder(SSARC_LP_Type *base, uint8_t groupID, ssarc_save_restore_order_t order) | /* Set the order of descriptors within the group are processed when saving register values. */
static void SSARC_SetGroupSaveOrder(SSARC_LP_Type *base, uint8_t groupID, ssarc_save_restore_order_t order) | {
assert(groupID < SSARC_LP_DESC_CTRL0_COUNT);
if (order == kSSARC_ProcessFromStartToEnd)
{
base->GROUPS[groupID].DESC_CTRL0 &= ~SSARC_LP_DESC_CTRL0_SV_ORDER_MASK;
}
else
{
base->GROUPS[groupID].DESC_CTRL0 |= SSARC_LP_DESC_CTRL0_SV_ORDER_MASK;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USART Clock initialization function.
Enables register interface and peripheral clock */ | void TARGET_IO_CLOCK_init() | /* USART Clock initialization function.
Enables register interface and peripheral clock */
void TARGET_IO_CLOCK_init() | {
hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM4_GCLK_ID_CORE, CONF_GCLK_SERCOM4_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM4_GCLK_ID_SLOW, CONF_GCLK_SERCOM4_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
hri_mclk_set_APBCMASK_SERCOM4_bit(MCLK);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Attribute write call back for the Value V2 attribute. */ | static ssize_t write_value_v2_5(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) | /* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2_5(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) | {
char *value = attr->user_data;
if (offset >= sizeof(value_v2_5_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(value_v2_5_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
memcpy(value + offset, buf, len);
return len;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Free all memory associated with the nodes and routes lists. */ | void __exit nr_rt_free(void) | /* Free all memory associated with the nodes and routes lists. */
void __exit nr_rt_free(void) | {
struct nr_neigh *s = NULL;
struct nr_node *t = NULL;
struct hlist_node *node, *nodet;
spin_lock_bh(&nr_neigh_list_lock);
spin_lock_bh(&nr_node_list_lock);
nr_node_for_each_safe(t, node, nodet, &nr_node_list) {
nr_node_lock(t);
nr_remove_node_locked(t);
nr_node_unlock(t);
}
nr_neigh_for_each_safe(s, node, nodet, &nr_neigh_list) {
while(s->count) {
s->count--;
nr_neigh_put(s);
}
nr_remove_neigh_locked(s);
}
spin_unlock_bh(&nr_node_list_lock);
spin_unlock_bh(&nr_neigh_list_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reads and returns the current value of CS. This function is only available on IA-32 and X64. */ | UINT16 EFIAPI AsmReadCs(VOID) | /* Reads and returns the current value of CS. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadCs(VOID) | {
UINT16 Data;
__asm__ __volatile__ (
"mov %%cs, %0"
:"=a" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable the PWM output of the PWM module.
The */ | void xPWMOutputDisable(unsigned long ulBase, unsigned long ulChannel) | /* Disable the PWM output of the PWM module.
The */
void xPWMOutputDisable(unsigned long ulBase, unsigned long ulChannel) | {
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannel >= 0) || (ulChannel <= 1)));
xHWREG(ulBase + PWM_POE) &= ~(PWM_POE_PWM0 << (ulChannel));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* IDL long LockServiceDatabase( IDL SC_HANDLE dbhandle, IDL SC_HANDLE lock, IDL ); */ | static int svcctl_dissect_LockServiceDatabase_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL long LockServiceDatabase( IDL SC_HANDLE dbhandle, IDL SC_HANDLE lock, IDL ); */
static int svcctl_dissect_LockServiceDatabase_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = dissect_nt_policy_hnd(
tvb, offset, pinfo, tree, di, drep, hf_svcctl_hnd, NULL,
NULL, FALSE, TRUE);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base Pointer to FLEXIO_UART_Type param handle Pointer to flexio_uart_edma_handle_t structure */ | void FLEXIO_UART_TransferAbortReceiveEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle) | /* param base Pointer to FLEXIO_UART_Type param handle Pointer to flexio_uart_edma_handle_t structure */
void FLEXIO_UART_TransferAbortReceiveEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle) | {
assert(handle->rxEdmaHandle != NULL);
FLEXIO_UART_EnableRxDMA(base, false);
EDMA_StopTransfer(handle->rxEdmaHandle);
handle->rxState = (uint8_t)kFLEXIO_UART_RxIdle;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed */ | static uint32_t overlay_get_target_phandle(const void *fdto, int fragment) | /* returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed */
static uint32_t overlay_get_target_phandle(const void *fdto, int fragment) | {
const uint32_t *val;
int len;
val = fdt_getprop(fdto, fragment, "target", &len);
if (!val)
return 0;
if ((len != sizeof(*val)) || (*val == (uint32_t)-1))
return (uint32_t)-1;
return fdt32_to_cpu(*val);
} | xboot/xboot | C++ | MIT License | 779 |
/* Callback for the HID Report Parser. This function is called each time the HID report parser is about to store an IN, OUT or FEATURE item into the HIDReportInfo structure. To save on RAM, we are able to filter out items we aren't interested in (preventing us from being able to extract them later on, but saving on the RAM they would have occupied). */ | bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t *const CurrentItem) | /* Callback for the HID Report Parser. This function is called each time the HID report parser is about to store an IN, OUT or FEATURE item into the HIDReportInfo structure. To save on RAM, we are able to filter out items we aren't interested in (preventing us from being able to extract them later on, but saving on the RAM they would have occupied). */
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t *const CurrentItem) | {
bool IsJoystick = false;
for (HID_CollectionPath_t* CurrPath = CurrentItem->CollectionPath; CurrPath != NULL; CurrPath = CurrPath->Parent)
{
if ((CurrPath->Usage.Page == USAGE_PAGE_GENERIC_DCTRL) &&
(CurrPath->Usage.Usage == USAGE_JOYSTICK))
{
IsJoystick = true;
break;
}
}
if (!IsJoystick)
return false;
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Converts a text device path node to Hardware Controller device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextCtrl(CHAR16 *TextDeviceNode) | /* Converts a text device path node to Hardware Controller device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextCtrl(CHAR16 *TextDeviceNode) | {
CHAR16 *ControllerStr;
CONTROLLER_DEVICE_PATH *Controller;
ControllerStr = GetNextParamStr (&TextDeviceNode);
Controller = (CONTROLLER_DEVICE_PATH *) CreateDeviceNode (
HARDWARE_DEVICE_PATH,
HW_CONTROLLER_DP,
(UINT16) sizeof (CONTROLLER_DEVICE_PATH)
);
Controller->ControllerNumber = (UINT32) Strtoi (ControllerStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Controller;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* function to register callback to be called when device gets paired */ | void register_ble_paired_event_cb(ble_gap_event_callback_t paired_cb_fn) | /* function to register callback to be called when device gets paired */
void register_ble_paired_event_cb(ble_gap_event_callback_t paired_cb_fn) | {
ble_paired_cb = paired_cb_fn;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Set the state of the voltage comparator interrupt status bits.
AM_HAL_VCOMP_INT_OUTHI AM_HAL_VCOMP_INT_OUTLO */ | void am_hal_vcomp_int_set(uint32_t ui32Interrupt) | /* Set the state of the voltage comparator interrupt status bits.
AM_HAL_VCOMP_INT_OUTHI AM_HAL_VCOMP_INT_OUTLO */
void am_hal_vcomp_int_set(uint32_t ui32Interrupt) | {
AM_REG(VCOMP, INTSET) = ui32Interrupt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Discard the directory structure when an OFile will be freed. Volume will cache this directory if the OFile does not represent a deleted file. */ | VOID FatDiscardODir(IN FAT_OFILE *OFile) | /* Discard the directory structure when an OFile will be freed. Volume will cache this directory if the OFile does not represent a deleted file. */
VOID FatDiscardODir(IN FAT_OFILE *OFile) | {
FAT_ODIR *ODir;
FAT_VOLUME *Volume;
Volume = OFile->Volume;
ODir = OFile->ODir;
if (!OFile->DirEnt->Invalid) {
ODir->DirCacheTag = OFile->FileCluster;
InsertHeadList (&Volume->DirCacheList, &ODir->DirCacheLink);
if (Volume->DirCacheCount == FAT_MAX_DIR_CACHE_COUNT) {
ODir = ODIR_FROM_DIRCACHELINK (Volume->DirCacheList.BackLink);
RemoveEntryList (&ODir->DirCacheLink);
} else {
Volume->DirCacheCount++;
ODir = NULL;
}
}
if (ODir != NULL) {
FatFreeODir (ODir);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ | static void format_capacity(char *buf, guint32 value) | /* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_capacity(char *buf, guint32 value) | {
g_snprintf(buf, ITEM_LABEL_LENGTH,
"%s (%c)",
val_to_str_const(value, ouch_capacity_val, "Unknown"),
value);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Perform a DES encryption with a 16-byte key and 8-byte data item. It's in fact 3 susbsequent call to crypt_des_ecb with a 7-byte key. Missing bytes for the key are replaced by 0; Returns output in response, which is expected to be 24 bytes. */ | static int crypt_des_ecb_long(guint8 *response, const guint8 *key, const guint8 *data) | /* Perform a DES encryption with a 16-byte key and 8-byte data item. It's in fact 3 susbsequent call to crypt_des_ecb with a 7-byte key. Missing bytes for the key are replaced by 0; Returns output in response, which is expected to be 24 bytes. */
static int crypt_des_ecb_long(guint8 *response, const guint8 *key, const guint8 *data) | {
guint8 pw21[21];
memset(pw21, 0, sizeof(pw21));
memcpy(pw21, key, 16);
memset(response, 0, 24);
crypt_des_ecb(response, data, pw21, 1);
crypt_des_ecb(response + 8, data, pw21 + 7, 1);
crypt_des_ecb(response + 16, data, pw21 + 14, 1);
return 1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Examine the status of the next Rx FIFO to see if it contains new data. */ | static unsigned long prvCheckRxFifoStatus(void) | /* Examine the status of the next Rx FIFO to see if it contains new data. */
static unsigned long prvCheckRxFifoStatus(void) | {
unsigned long ulReturn = 0;
if( ( pxCurrentRxDesc->status & ACT ) != 0 )
{
}
else if( ( pxCurrentRxDesc->status & FE ) != 0 )
{
pxCurrentRxDesc->status &= ~( FP1 | FP0 | FE );
pxCurrentRxDesc->status &= ~( RMAF | RRF | RTLF | RTSF | PRE | CERF );
pxCurrentRxDesc->status |= ACT;
pxCurrentRxDesc = pxCurrentRxDesc->next;
if( EDMAC.EDRRR.LONG == 0x00000000UL )
{
EDMAC.EDRRR.LONG = 0x00000001UL;
} }
else
{
if( ( pxCurrentRxDesc->status & FP0 ) == FP0 )
{
ulReturn = pxCurrentRxDesc->size;
}
else
{
prvResetEverything();
}
}
return ulReturn;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */ | static bool bma180_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data) | /* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
static bool bma180_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data) | {
sensor_hal_t *const hal = sensor->hal;
switch (type) {
case SENSOR_READ_ACCELERATION:
return bma180_get_accel(hal, data);
case SENSOR_READ_TEMPERATURE:
return bma180_get_temperature(hal, data);
case SENSOR_READ_ID:
return bma180_device_id(hal, data);
default:
sensor->err = SENSOR_ERR_FUNCTION;
return false;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns: TRUE if @cancellable is cancelled, FALSE if called with NULL or if item is not cancelled. */ | gboolean g_cancellable_is_cancelled(GCancellable *cancellable) | /* Returns: TRUE if @cancellable is cancelled, FALSE if called with NULL or if item is not cancelled. */
gboolean g_cancellable_is_cancelled(GCancellable *cancellable) | {
return cancellable != NULL && cancellable->priv->cancelled;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get the SPI interrupt flag of the specified SPI port. */ | unsigned long xSPIStatusGet(unsigned long ulBase, xtBoolean xbMasked) | /* Get the SPI interrupt flag of the specified SPI port. */
unsigned long xSPIStatusGet(unsigned long ulBase, xtBoolean xbMasked) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
xASSERT(bMasked == xfalse);
return (xHWREG(ulBase + SPI_STATUS) & 0x000C14EE);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enable EFM32 access to periheral on DVK board. */ | void DVK_enablePeripheral(DVKPeripheral peri) | /* Enable EFM32 access to periheral on DVK board. */
void DVK_enablePeripheral(DVKPeripheral peri) | {
uint16_t bit;
uint16_t tmp;
bit = (uint16_t) peri;
tmp = DVK_readRegister(BC_PERCTRL);
tmp |= bit;
if ((peri == DVK_RS232A) || (peri == DVK_RS232B))
{
tmp &= ~(BC_PERCTRL_RS232_SHUTDOWN);
}
if (peri == DVK_IRDA)
{
tmp &= ~(BC_PERCTRL_IRDA_SHUTDOWN);
}
DVK_writeRegister(BC_PERCTRL, tmp);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Always use UUID for lookups if it's present, otherwise use name or dev. */ | static struct hash_cell* __find_device_hash_cell(struct dm_ioctl *param) | /* Always use UUID for lookups if it's present, otherwise use name or dev. */
static struct hash_cell* __find_device_hash_cell(struct dm_ioctl *param) | {
struct mapped_device *md;
void *mdptr = NULL;
if (*param->uuid)
return __get_uuid_cell(param->uuid);
if (*param->name)
return __get_name_cell(param->name);
md = dm_get_md(huge_decode_dev(param->dev));
if (!md)
goto out;
mdptr = dm_get_mdptr(md);
if (!mdptr)
dm_put(md);
out:
return mdptr;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns the time until the timer expires. */ | clock_time_t timer_remaining(struct timer *t) | /* This function returns the time until the timer expires. */
clock_time_t timer_remaining(struct timer *t) | {
return t->start + t->interval - clock_time();
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This is a version of ip_compute_csum() optimized for IP headers, which always checksum on 4 octet boundaries. */ | __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | /* This is a version of ip_compute_csum() optimized for IP headers, which always checksum on 4 octet boundaries. */
__sum16 ip_fast_csum(const void *iph, unsigned int ihl) | {
return (__force __sum16)~do_csum(iph,ihl*4);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the given bit(s) in a register in the IO expander. */ | uint32_t BOARD_picRegBitsSet(uint8_t addr, bool set, uint8_t bitMask) | /* Sets the given bit(s) in a register in the IO expander. */
uint32_t BOARD_picRegBitsSet(uint8_t addr, bool set, uint8_t bitMask) | {
uint32_t status;
uint8_t value;
picWake();
status = picReadReg( addr, &value );
if( status != BOARD_OK ) {
goto cleanup;
}
if( set ) {
value |= bitMask;
}
else {
value &= ~bitMask;
}
status = picWriteReg( addr, value );
picSleep();
cleanup:
return status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Called very early, MMU is off, device-tree isn't unflattened */ | static int __init mpc836x_mds_probe(void) | /* Called very early, MMU is off, device-tree isn't unflattened */
static int __init mpc836x_mds_probe(void) | {
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "MPC836xMDS");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Prepare for output to a stdio stream. The caller must have already opened the stream, and is responsible for closing it after finishing compression. */ | jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile) | /* Prepare for output to a stdio stream. The caller must have already opened the stream, and is responsible for closing it after finishing compression. */
jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile) | {
my_dest_ptr dest;
if (cinfo->dest == NULL) {
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
SIZEOF(my_destination_mgr));
}
dest = (my_dest_ptr) cinfo->dest;
dest->pub.init_destination = init_destination;
dest->pub.empty_output_buffer = empty_output_buffer;
dest->pub.term_destination = term_destination;
dest->outfile = outfile;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Convert UINT32 data of the FDT blob to little-endian */ | UINT32 EFIAPI Fdt32ToCpu(IN UINT32 Value) | /* Convert UINT32 data of the FDT blob to little-endian */
UINT32 EFIAPI Fdt32ToCpu(IN UINT32 Value) | {
return fdt32_to_cpu (Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* NOTE: ownership of 'value' is transferred to the QDict */ | void qdict_put_obj(QDict *qdict, const char *key, QObject *value) | /* NOTE: ownership of 'value' is transferred to the QDict */
void qdict_put_obj(QDict *qdict, const char *key, QObject *value) | {
unsigned int bucket;
QDictEntry *entry;
bucket = tdb_hash(key) % QDICT_BUCKET_MAX;
entry = qdict_find(qdict, key, bucket);
if (entry) {
qobject_decref(entry->value);
entry->value = value;
} else {
entry = alloc_entry(key, value);
QLIST_INSERT_HEAD(&qdict->table[bucket], entry, next);
qdict->size++;
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* This code gets the size of name of variable. */ | UINTN NameSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat) | /* This code gets the size of name of variable. */
UINTN NameSizeOfVariable(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat) | {
AUTHENTICATED_VARIABLE_HEADER *AuthVariable;
AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *)Variable;
if (AuthFormat) {
if ((AuthVariable->State == (UINT8)(-1)) ||
(AuthVariable->DataSize == (UINT32)(-1)) ||
(AuthVariable->NameSize == (UINT32)(-1)) ||
(AuthVariable->Attributes == (UINT32)(-1)))
{
return 0;
}
return (UINTN)AuthVariable->NameSize;
} else {
if ((Variable->State == (UINT8)(-1)) ||
(Variable->DataSize == (UINT32)(-1)) ||
(Variable->NameSize == (UINT32)(-1)) ||
(Variable->Attributes == (UINT32)(-1)))
{
return 0;
}
return (UINTN)Variable->NameSize;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If List is NULL, then ASSERT(). If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */ | LIST_ENTRY* EFIAPI GetPreviousNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node) | /* If List is NULL, then ASSERT(). If Node is NULL, then ASSERT(). If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
LIST_ENTRY* EFIAPI GetPreviousNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node) | {
ASSERT_VERIFY_NODE_IN_VALID_LIST (List, Node, TRUE);
return Node->BackLink;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable the HW timer tick interrupts with a period <period> in microseconds */ | void hwtimer_enable(uint64_t period) | /* Enable the HW timer tick interrupts with a period <period> in microseconds */
void hwtimer_enable(uint64_t period) | {
tick_p = period;
hw_timer_tick_timer = nsi_hws_get_time() + tick_p;
hwtimer_update_timer();
nsi_hws_find_next_event();
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Uninstall the EFI memory attribute protocol if it exists. */ | STATIC VOID UninstallEfiMemoryAttributesProtocol(VOID) | /* Uninstall the EFI memory attribute protocol if it exists. */
STATIC VOID UninstallEfiMemoryAttributesProtocol(VOID) | {
EFI_STATUS Status;
EFI_HANDLE Handle;
UINTN Size;
VOID *MemoryAttributeProtocol;
Size = sizeof (Handle);
Status = gBS->LocateHandle (
ByProtocol,
&gEfiMemoryAttributeProtocolGuid,
NULL,
&Size,
&Handle
);
if (EFI_ERROR (Status)) {
ASSERT (Status == EFI_NOT_FOUND);
return;
}
Status = gBS->HandleProtocol (
Handle,
&gEfiMemoryAttributeProtocolGuid,
&MemoryAttributeProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->UninstallProtocolInterface (
Handle,
&gEfiMemoryAttributeProtocolGuid,
MemoryAttributeProtocol
);
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Caller must have changed pm_idle to the new value before the call. Old pm_idle value will not be used by any CPU after the return of this function. */ | void cpu_idle_wait(void) | /* Caller must have changed pm_idle to the new value before the call. Old pm_idle value will not be used by any CPU after the return of this function. */
void cpu_idle_wait(void) | {
smp_mb();
smp_call_function(do_nothing, NULL, 1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the pointer to the HOB list is NULL, then ASSERT(). */ | EFI_BOOT_MODE EFIAPI GetBootModeHob(VOID) | /* If the pointer to the HOB list is NULL, then ASSERT(). */
EFI_BOOT_MODE EFIAPI GetBootModeHob(VOID) | {
ASSERT (FALSE);
return MAX_UINT32;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clears a Stall condition on an endpoint of the Low Level Driver. */ | USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | /* Clears a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | {
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr);
switch (hal_status) {
case HAL_OK :
usb_status = USBD_OK;
break;
case HAL_ERROR :
usb_status = USBD_FAIL;
break;
case HAL_BUSY :
usb_status = USBD_BUSY;
break;
case HAL_TIMEOUT :
usb_status = USBD_FAIL;
break;
default :
usb_status = USBD_FAIL;
break;
}
return usb_status;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This may be called recursively if e.g. an async NFS task updates the attributes and finds that dirty pages must be flushed. NOTE: Upon exit of this function the task is guaranteed to be released. In particular note that tk_release() will have been called, so your task memory may have been freed. */ | void rpc_execute(struct rpc_task *task) | /* This may be called recursively if e.g. an async NFS task updates the attributes and finds that dirty pages must be flushed. NOTE: Upon exit of this function the task is guaranteed to be released. In particular note that tk_release() will have been called, so your task memory may have been freed. */
void rpc_execute(struct rpc_task *task) | {
rpc_set_active(task);
rpc_set_running(task);
__rpc_execute(task);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function decodes the lock and unlock door response */ | static void dissect_zcl_door_lock_lock_unlock_door_response(tvbuff_t *tvb, proto_tree *tree, guint *offset) | /* This function decodes the lock and unlock door response */
static void dissect_zcl_door_lock_lock_unlock_door_response(tvbuff_t *tvb, proto_tree *tree, guint *offset) | {
proto_tree_add_item(tree, hf_zbee_zcl_door_lock_status, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
*offset += 1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | /* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | {
if(hspi->Instance==SPI2)
{
__HAL_RCC_SPI2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_4|GPIO_PIN_3|GPIO_PIN_1);
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Event notification that is fired when GUIDed Event Group is signaled. */ | STATIC VOID EFIAPI MmGuidedEventNotify(IN EFI_EVENT Event, IN VOID *Context) | /* Event notification that is fired when GUIDed Event Group is signaled. */
STATIC VOID EFIAPI MmGuidedEventNotify(IN EFI_EVENT Event, IN VOID *Context) | {
EFI_MM_COMMUNICATE_HEADER Header;
UINTN Size;
CopyGuid (&Header.HeaderGuid, Context);
Header.MessageLength = 1;
Header.Data[0] = 0;
Size = sizeof (Header);
MmCommunication2Communicate (&mMmCommunication2, &Header, &Header, &Size);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Attempts to queue a new command with the host adapter. Will return zero if successful or indicate a host busy condition if not (which will cause the mid layer to call us again later with the command) */ | static int i91u_queuecommand(struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *)) | /* Attempts to queue a new command with the host adapter. Will return zero if successful or indicate a host busy condition if not (which will cause the mid layer to call us again later with the command) */
static int i91u_queuecommand(struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *)) | {
struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata;
struct scsi_ctrl_blk *cmnd;
cmd->scsi_done = done;
cmnd = initio_alloc_scb(host);
if (!cmnd)
return SCSI_MLQUEUE_HOST_BUSY;
initio_build_scb(host, cmnd, cmd);
initio_exec_scb(host, cmnd);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Common USART0 TX interrupt handler.
This function handles USART0 TX complete interrupt request */ | void USART0_TX_IRQHandler(void) | /* Common USART0 TX interrupt handler.
This function handles USART0 TX complete interrupt request */
void USART0_TX_IRQHandler(void) | {
rt_interrupt_enter();
if (USART0->IF & USART_IF_TXC)
{
if (usartCbTable[0].cbFunc != RT_NULL)
{
(usartCbTable[0].cbFunc)(usartCbTable[0].userPtr);
}
BITBAND_Peripheral(&(USART0->IFC), _USART_IF_TXC_SHIFT, 0x1UL);
}
rt_interrupt_leave();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get contents of register REGNO in task TASK. */ | static long get_reg(struct task_struct *task, int regno) | /* Get contents of register REGNO in task TASK. */
static long get_reg(struct task_struct *task, int regno) | {
unsigned long *addr;
if (regno == PT_USP)
addr = &task->thread.usp;
else if (regno < ARRAY_SIZE(regoff))
addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
else
return 0;
return *addr;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the LIR_Click bit is not set, the interrupt is kept high for the duration of the latency window. If the LIR_Click bit is set, the interrupt is kept high until the CLICK_SRC(39h) register is read.. */ | int32_t lis2dh12_tap_notification_mode_set(stmdev_ctx_t *ctx, lis2dh12_lir_click_t val) | /* If the LIR_Click bit is not set, the interrupt is kept high for the duration of the latency window. If the LIR_Click bit is set, the interrupt is kept high until the CLICK_SRC(39h) register is read.. */
int32_t lis2dh12_tap_notification_mode_set(stmdev_ctx_t *ctx, lis2dh12_lir_click_t val) | {
lis2dh12_click_ths_t click_ths;
int32_t ret;
ret = lis2dh12_read_reg(ctx, LIS2DH12_CLICK_THS,
(uint8_t *)&click_ths, 1);
if (ret == 0)
{
click_ths.lir_click = (uint8_t)val;
ret = lis2dh12_write_reg(ctx, LIS2DH12_CLICK_THS,
(uint8_t *)&click_ths, 1);
}
return ret;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* NOTE: this should always be called with parent dir i_mutex taken. */ | int ocfs2_find_files_on_disk(const char *name, int namelen, u64 *blkno, struct inode *inode, struct ocfs2_dir_lookup_result *lookup) | /* NOTE: this should always be called with parent dir i_mutex taken. */
int ocfs2_find_files_on_disk(const char *name, int namelen, u64 *blkno, struct inode *inode, struct ocfs2_dir_lookup_result *lookup) | {
int status = -ENOENT;
mlog(0, "name=%.*s, blkno=%p, inode=%llu\n", namelen, name, blkno,
(unsigned long long)OCFS2_I(inode)->ip_blkno);
status = ocfs2_find_entry(name, namelen, inode, lookup);
if (status)
goto leave;
*blkno = le64_to_cpu(lookup->dl_entry->inode);
status = 0;
leave:
return status;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add the GIC Interrupt Translation Service Information to the MADT Table. */ | STATIC VOID AddGICItsList(IN EFI_ACPI_6_5_GIC_ITS_STRUCTURE *GicIts, IN CONST CM_ARM_GIC_ITS_INFO *GicItsInfo, IN UINT32 GicItsCount) | /* Add the GIC Interrupt Translation Service Information to the MADT Table. */
STATIC VOID AddGICItsList(IN EFI_ACPI_6_5_GIC_ITS_STRUCTURE *GicIts, IN CONST CM_ARM_GIC_ITS_INFO *GicItsInfo, IN UINT32 GicItsCount) | {
ASSERT (GicIts != NULL);
ASSERT (GicItsInfo != NULL);
while (GicItsCount-- != 0) {
AddGICInterruptTranslationService (GicIts++, GicItsInfo++);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Worker function gets the content in fixed MTRRs */ | MTRR_FIXED_SETTINGS* MtrrGetFixedMtrrWorker(OUT MTRR_FIXED_SETTINGS *FixedSettings) | /* Worker function gets the content in fixed MTRRs */
MTRR_FIXED_SETTINGS* MtrrGetFixedMtrrWorker(OUT MTRR_FIXED_SETTINGS *FixedSettings) | {
UINT32 Index;
for (Index = 0; Index < MTRR_NUMBER_OF_FIXED_MTRR; Index++) {
FixedSettings->Mtrr[Index] =
AsmReadMsr64 (mMtrrLibFixedMtrrTable[Index].Msr);
}
return FixedSettings;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The USBCMD HSEE Bit will be reset to default 0 by USBCMD Host Controller Reset(HCRST). This function is to set USBCMD HSEE Bit if PCICMD SERR# Enable Bit is set. */ | VOID XhcSetHsee(IN USB_XHCI_INSTANCE *Xhc) | /* The USBCMD HSEE Bit will be reset to default 0 by USBCMD Host Controller Reset(HCRST). This function is to set USBCMD HSEE Bit if PCICMD SERR# Enable Bit is set. */
VOID XhcSetHsee(IN USB_XHCI_INSTANCE *Xhc) | {
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT16 XhciCmd;
PciIo = Xhc->PciIo;
Status = PciIo->Pci.Read (
PciIo,
EfiPciIoWidthUint16,
PCI_COMMAND_OFFSET,
sizeof (XhciCmd) / sizeof (UINT16),
&XhciCmd
);
if (!EFI_ERROR (Status)) {
if ((XhciCmd & EFI_PCI_COMMAND_SERR) != 0) {
XhcSetOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_HSEE);
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing. */ | EFI_LBA GetAtapi6Capacity(IN ATA_DEVICE *AtaDevice) | /* This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing. */
EFI_LBA GetAtapi6Capacity(IN ATA_DEVICE *AtaDevice) | {
EFI_LBA Capacity;
EFI_LBA TmpLba;
UINTN Index;
ATA_IDENTIFY_DATA *IdentifyData;
IdentifyData = AtaDevice->IdentifyData;
if ((IdentifyData->command_set_supported_83 & BIT10) == 0) {
return 0;
}
Capacity = 0;
for (Index = 0; Index < 4; Index++) {
TmpLba = IdentifyData->maximum_lba_for_48bit_addressing[Index];
Capacity |= LShiftU64 (TmpLba, 16 * Index);
}
return Capacity;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Should be called without the journal lock held. */ | void journal_unlock_updates(journal_t *journal) | /* Should be called without the journal lock held. */
void journal_unlock_updates(journal_t *journal) | {
J_ASSERT(journal->j_barrier_count != 0);
mutex_unlock(&journal->j_barrier);
spin_lock(&journal->j_state_lock);
--journal->j_barrier_count;
spin_unlock(&journal->j_state_lock);
wake_up(&journal->j_wait_transaction_locked);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* A mask can be applied on the slave device address in slave mode in order to allow multiple address answer. For each bit of the MASK field set to one the corresponding SADR bit will be masked. */ | void twihs_mask_slave_addr(Twihs *p_twihs, uint32_t ul_mask) | /* A mask can be applied on the slave device address in slave mode in order to allow multiple address answer. For each bit of the MASK field set to one the corresponding SADR bit will be masked. */
void twihs_mask_slave_addr(Twihs *p_twihs, uint32_t ul_mask) | {
p_twihs->TWIHS_SMR |= TWIHS_SMR_MASK(ul_mask);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */ | EFI_STATUS EFIAPI NvmeBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer) | /* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */
EFI_STATUS EFIAPI NvmeBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer) | {
PEI_NVME_CONTROLLER_PRIVATE_DATA *Private;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
return NvmeBlockIoPeimReadBlocks (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
StartLBA,
BufferSize,
Buffer
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI S3PciWrite16(IN UINTN Address, IN UINT16 Value) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI S3PciWrite16(IN UINTN Address, IN UINT16 Value) | {
return InternalSavePciWrite16ValueToBootScript (Address, PciWrite16 (Address, Value));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Discard data from a connection. Mostly used to discard wrong-sized messages. Returns 0 on success, logs a message and returns -1 on a network error. */ | static int rpcap_discard(SOCKET sock, uint32 len, char *errbuf) | /* Discard data from a connection. Mostly used to discard wrong-sized messages. Returns 0 on success, logs a message and returns -1 on a network error. */
static int rpcap_discard(SOCKET sock, uint32 len, char *errbuf) | {
if (len != 0)
{
if (sock_discard(sock, len, errbuf, PCAP_ERRBUF_SIZE) == -1)
{
return -1;
}
}
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function will initialize a pipe device and put it under control of resource management. */ | rt_err_t rt_pipe_init(struct rt_pipe_device *pipe, const char *name, enum rt_pipe_flag flag, rt_uint8_t *buf, rt_size_t size) | /* This function will initialize a pipe device and put it under control of resource management. */
rt_err_t rt_pipe_init(struct rt_pipe_device *pipe, const char *name, enum rt_pipe_flag flag, rt_uint8_t *buf, rt_size_t size) | {
RT_ASSERT(pipe);
RT_ASSERT(buf);
rt_list_init(&pipe->suspended_read_list);
rt_list_init(&pipe->suspended_write_list);
rt_ringbuffer_init(&pipe->ringbuffer, buf, size);
pipe->flag = flag;
pipe->parent.type = RT_Device_Class_Pipe;
pipe->parent.init = RT_NULL;
pipe->parent.open = RT_NULL;
pipe->parent.close = RT_NULL;
pipe->parent.read = rt_pipe_read;
pipe->parent.write = rt_pipe_write;
pipe->parent.control = rt_pipe_control;
return rt_device_register(&(pipe->parent), name, RT_DEVICE_FLAG_RDWR);
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Make sure there's data to read. Wait for input if we can, otherwise return an appropriate error. */ | static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags) | /* Make sure there's data to read. Wait for input if we can, otherwise return an appropriate error. */
static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags) | {
int ret;
if (pipe->nrbufs)
return 0;
ret = 0;
pipe_lock(pipe);
while (!pipe->nrbufs) {
if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}
if (!pipe->writers)
break;
if (!pipe->waiting_writers) {
if (flags & SPLICE_F_NONBLOCK) {
ret = -EAGAIN;
break;
}
}
pipe_wait(pipe);
}
pipe_unlock(pipe);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ | EFI_STATUS EFIAPI Ip6DestroyChildEntryByAddr(IN LIST_ENTRY *Entry, IN VOID *Context) | /* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI Ip6DestroyChildEntryByAddr(IN LIST_ENTRY *Entry, IN VOID *Context) | {
IP6_PROTOCOL *Instance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
EFI_IPv6_ADDRESS *Address;
Instance = NET_LIST_USER_STRUCT_S (Entry, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
ServiceBinding = ((IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT *)Context)->ServiceBinding;
Address = ((IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT *)Context)->Address;
if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.StationAddress, Address)) {
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert FvHandle and DriverName into an EFI device path */ | EFI_DEVICE_PATH_PROTOCOL* SmmFvToDevicePath(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName) | /* Convert FvHandle and DriverName into an EFI device path */
EFI_DEVICE_PATH_PROTOCOL* SmmFvToDevicePath(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName) | {
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
EFI_DEVICE_PATH_PROTOCOL *FileNameDevicePath;
Status = gBS->HandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
if (EFI_ERROR (Status)) {
FileNameDevicePath = NULL;
} else {
EfiInitializeFwVolDevicepathNode (&mFvDevicePath.File, DriverName);
SetDevicePathEndNode (&mFvDevicePath.End);
FileNameDevicePath = AppendDevicePath (
FvDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
);
}
return FileNameDevicePath;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Developed at SunPro, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice */ | double cos(double x) | /* Developed at SunPro, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice */
double cos(double x) | {
double y[2],z=0.0;
int32_t n, ix;
GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff;
if(ix <= 0x3fe921fb) return __kernel_cos(x,z);
else if (ix>=0x7ff00000) return x-x;
else {
n = __ieee754_rem_pio2(x,y);
switch(n&3) {
case 0: return __kernel_cos(y[0],y[1]);
case 1: return -__kernel_sin(y[0],y[1],1);
case 2: return -__kernel_cos(y[0],y[1]);
default:
return __kernel_sin(y[0],y[1],1);
}
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Change the current location to file FNAME, line LNO. */ | void loc_set_file(const char *fname, int lno) | /* Change the current location to file FNAME, line LNO. */
void loc_set_file(const char *fname, int lno) | {
assert (fname || cur_loc->kind == LOC_FILE);
cur_loc->kind = LOC_FILE;
cur_loc->num = lno;
if (fname) {
cur_loc->ptr = fname;
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Configures the RWW EEPROM memory during the startup.
This function will assign the first two bytes of RWW EEPROM as memory index representing number of entries stored and initializes the memory index */ | void memory_index_init(void) | /* Configures the RWW EEPROM memory during the startup.
This function will assign the first two bytes of RWW EEPROM as memory index representing number of entries stored and initializes the memory index */
void memory_index_init(void) | {
rww_eeprom_emulator_read_buffer(SET_TO_ZERO, (uint8_t *)&memory_index,
LENGTH_OF_MEMORY_INDEX);
if(memory_index == EEPROM_EMPTY_CHAR) {
memory_index = SET_TO_ZERO;
rww_eeprom_emulator_write_buffer(SET_TO_ZERO,
(const uint8_t *)&memory_index, LENGTH_OF_MEMORY_INDEX);
rww_eeprom_emulator_commit_page_buffer();
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Release the buffers on an SGE free-buffer Rx queue. HW fetching from this queue should be stopped before calling this function. */ | static void free_rx_bufs(struct pci_dev *pdev, struct sge_fl *q) | /* Release the buffers on an SGE free-buffer Rx queue. HW fetching from this queue should be stopped before calling this function. */
static void free_rx_bufs(struct pci_dev *pdev, struct sge_fl *q) | {
unsigned int cidx = q->cidx;
while (q->credits--) {
struct rx_sw_desc *d = &q->sdesc[cidx];
clear_rx_desc(pdev, q, d);
if (++cidx == q->size)
cidx = 0;
}
if (q->pg_chunk.page) {
__free_pages(q->pg_chunk.page, q->order);
q->pg_chunk.page = NULL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* memstick_suspend_host - notify bus driver of host suspension @host - host to use */ | void memstick_suspend_host(struct memstick_host *host) | /* memstick_suspend_host - notify bus driver of host suspension @host - host to use */
void memstick_suspend_host(struct memstick_host *host) | {
mutex_lock(&host->lock);
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
mutex_unlock(&host->lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the length of the boot item string beyond 70 Char, just display 70 Char. */ | VOID PxeBcDisplayBootItem(IN UINT8 *Str, IN UINT8 Len) | /* If the length of the boot item string beyond 70 Char, just display 70 Char. */
VOID PxeBcDisplayBootItem(IN UINT8 *Str, IN UINT8 Len) | {
UINT8 Tmp;
Len = (UINT8)MIN (PXEBC_DISPLAY_MAX_LINE, Len);
Tmp = Str[Len];
Str[Len] = 0;
AsciiPrint ("%a \n", Str);
Str[Len] = Tmp;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The pin is 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 GPIOPinTypePECITx(uint32_t ui32Port, uint8_t ui8Pins) | /* The pin is 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 GPIOPinTypePECITx(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 |
/* Initialises the USB hardware and sets up the USB stack by installing default callbacks. */ | BOOL USBInit(void) | /* Initialises the USB hardware and sets up the USB stack by installing default callbacks. */
BOOL USBInit(void) | {
USBHwInit();
USBHwRegisterDevIntHandler(HandleUsbReset);
USBHwRegisterEPIntHandler(0x00, USBHandleControlTransfer);
USBHwRegisterEPIntHandler(0x80, USBHandleControlTransfer);
USBHwEPConfig(0x00, MAX_PACKET_SIZE0);
USBHwEPConfig(0x80, MAX_PACKET_SIZE0);
USBRegisterRequestHandler(REQTYPE_TYPE_STANDARD, USBHandleStandardRequest, abStdReqData);
return TRUE;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* do_IRQ handles all normal device IRQ's (the special SMP cross-CPU interrupts have their own specific handlers). */ | void __irq_entry do_IRQ(unsigned int irq) | /* do_IRQ handles all normal device IRQ's (the special SMP cross-CPU interrupts have their own specific handlers). */
void __irq_entry do_IRQ(unsigned int irq) | {
irq_enter();
__DO_IRQ_SMTC_HOOK(irq);
generic_handle_irq(irq);
irq_exit();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns 1 if sufficient resources, 0 if not */ | static int check_gru_resources(struct gru_state *gru, int cbr_au_count, int dsr_au_count, int max_active_contexts) | /* Returns 1 if sufficient resources, 0 if not */
static int check_gru_resources(struct gru_state *gru, int cbr_au_count, int dsr_au_count, int max_active_contexts) | {
return hweight64(gru->gs_cbr_map) >= cbr_au_count
&& hweight64(gru->gs_dsr_map) >= dsr_au_count
&& gru->gs_active_contexts < max_active_contexts;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* clockevents_register_notifier - register a clock events change listener */ | int clockevents_register_notifier(struct notifier_block *nb) | /* clockevents_register_notifier - register a clock events change listener */
int clockevents_register_notifier(struct notifier_block *nb) | {
unsigned long flags;
int ret;
raw_spin_lock_irqsave(&clockevents_lock, flags);
ret = raw_notifier_chain_register(&clockevents_chain, nb);
raw_spin_unlock_irqrestore(&clockevents_lock, flags);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Locking: locks called line discipline but ldisc poll method may be re-entered freely by other callers. */ | static unsigned int tty_poll(struct file *, poll_table *) | /* Locking: locks called line discipline but ldisc poll method may be re-entered freely by other callers. */
static unsigned int tty_poll(struct file *, poll_table *) | {
struct tty_struct *tty;
struct tty_ldisc *ld;
int ret = 0;
tty = (struct tty_struct *)filp->private_data;
if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll"))
return 0;
ld = tty_ldisc_ref_wait(tty);
if (ld->ops->poll)
ret = (ld->ops->poll)(tty, filp, wait);
tty_ldisc_deref(ld);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */ | EFI_STATUS EFIAPI XenBusDxeDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */
EFI_STATUS EFIAPI XenBusDxeDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
if (!XenHypercallIsAvailable ()) {
return EFI_ABORTED;
}
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gXenBusDxeDriverBinding,
ImageHandle,
&gXenBusDxeComponentName,
&gXenBusDxeComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ | int main(void) | /* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void) | {
SetupHardware();
GlobalInterruptEnable();
for (;;)
USB_USBTask();
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Negotiate the minimum turn around time. This is a type 1 parameter and will be negotiated independently for each station */ | static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get) | /* Negotiate the minimum turn around time. This is a type 1 parameter and will be negotiated independently for each station */
static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get) | {
struct irlap_cb *self = (struct irlap_cb *) instance;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
if (get)
param->pv.i = self->qos_rx.min_turn_time.bits;
else
self->qos_tx.min_turn_time.bits = (__u8) param->pv.i;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* calc_data_growth - calculate approximate amount of new data from budgeting request. */ | static int calc_data_growth(const struct ubifs_info *c, const struct ubifs_budget_req *req) | /* calc_data_growth - calculate approximate amount of new data from budgeting request. */
static int calc_data_growth(const struct ubifs_info *c, const struct ubifs_budget_req *req) | {
int data_growth;
data_growth = req->new_ino ? c->inode_budget : 0;
if (req->new_page)
data_growth += c->page_budget;
if (req->new_dent)
data_growth += c->dent_budget;
data_growth += req->new_ino_d;
return data_growth;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function generates a sync signal for the object.
All suspended threads waiting on this sync object are resumed */ | OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t *pSyncObj) | /* This function generates a sync signal for the object.
All suspended threads waiting on this sync object are resumed */
OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t *pSyncObj) | {
xSemaphoreGive( *pSyncObj );
return OSI_OK;
} | micropython/micropython | C++ | Other | 18,334 |
/* Disable the interrupt in the SYSTICK.
This function disables the interupt in the systick timer. */ | void am_hal_systick_int_disable(void) | /* Disable the interrupt in the SYSTICK.
This function disables the interupt in the systick timer. */
void am_hal_systick_int_disable(void) | {
AM_REG(SYSTICK, SYSTCSR) &= ~AM_REG_SYSTICK_SYSTCSR_TICKINT_M;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Note: SCSI ACK assertion needs with ACKENB=1, AUTODIRECTION=1. */ | static void nsp32_sack_assert(nsp32_hw_data *) | /* Note: SCSI ACK assertion needs with ACKENB=1, AUTODIRECTION=1. */
static void nsp32_sack_assert(nsp32_hw_data *) | {
unsigned int base = data->BaseAddress;
unsigned char busctrl;
busctrl = nsp32_read1(base, SCSI_BUS_CONTROL);
busctrl |= (BUSCTL_ACK | AUTODIRECTION | ACKENB);
nsp32_write1(base, SCSI_BUS_CONTROL, busctrl);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.