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
|
|---|---|---|---|---|---|---|---|
/* Returns: 1 if host can accept command / 0 if not */
|
static int ibmvfc_host_chkready(struct ibmvfc_host *vhost)
|
/* Returns: 1 if host can accept command / 0 if not */
static int ibmvfc_host_chkready(struct ibmvfc_host *vhost)
|
{
int result = 0;
switch (vhost->state) {
case IBMVFC_LINK_DEAD:
case IBMVFC_HOST_OFFLINE:
result = DID_NO_CONNECT << 16;
break;
case IBMVFC_NO_CRQ:
case IBMVFC_INITIALIZING:
case IBMVFC_HALTED:
case IBMVFC_LINK_DOWN:
result = DID_REQUEUE << 16;
break;
case IBMVFC_ACTIVE:
result = 0;
break;
};
return result;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Retrieves the error dispatch entry with the specified op code. */
|
static ble_gattc_err_fn* ble_gattc_err_dispatch_get(uint8_t op)
|
/* Retrieves the error dispatch entry with the specified op code. */
static ble_gattc_err_fn* ble_gattc_err_dispatch_get(uint8_t op)
|
{
BLE_HS_DBG_ASSERT(op < BLE_GATT_OP_CNT);
return ble_gattc_err_dispatch[op];
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */
|
EFI_STATUS EFIAPI Dns6Poll(IN EFI_DNS6_PROTOCOL *This)
|
/* In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */
EFI_STATUS EFIAPI Dns6Poll(IN EFI_DNS6_PROTOCOL *This)
|
{
DNS_INSTANCE *Instance;
EFI_UDP6_PROTOCOL *Udp;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This);
if (Instance->State == DNS_STATE_UNCONFIGED) {
return EFI_NOT_STARTED;
} else if (Instance->State == DNS_STATE_DESTROY) {
return EFI_DEVICE_ERROR;
}
Udp = Instance->UdpIo->Protocol.Udp6;
return Udp->Poll (Udp);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialize the communicate buffer using DataSize and Function number. */
|
VOID InitCommunicateBuffer(OUT VOID **CommunicateBuffer, OUT VOID **DataPtr, IN UINTN DataSize, IN UINTN Function)
|
/* Initialize the communicate buffer using DataSize and Function number. */
VOID InitCommunicateBuffer(OUT VOID **CommunicateBuffer, OUT VOID **DataPtr, IN UINTN DataSize, IN UINTN Function)
|
{
EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader;
SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader;
SmmCommunicateHeader = AllocateZeroPool (DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE);
ASSERT (SmmCommunicateHeader != NULL);
CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmFaultTolerantWriteProtocolGuid);
SmmCommunicateHeader->MessageLength = DataSize + SMM_FTW_COMMUNICATE_HEADER_SIZE;
SmmFtwFunctionHeader = (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *)SmmCommunicateHeader->Data;
SmmFtwFunctionHeader->Function = Function;
*CommunicateBuffer = SmmCommunicateHeader;
if (DataPtr != NULL) {
*DataPtr = SmmFtwFunctionHeader->Data;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Init interrupts callback for the specified UART Port.
The */
|
void UARTIntCallbackInit(unsigned long ulBase, xtEventCallback pfnCallback)
|
/* Init interrupts callback for the specified UART Port.
The */
void UARTIntCallbackInit(unsigned long ulBase, xtEventCallback pfnCallback)
|
{
xASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) ||
(ulBase == UART2_BASE) );
switch(ulBase)
{
case UART0_BASE:
{
g_pfnUARTHandlerCallbacks[0] = pfnCallback;
break;
}
case UART1_BASE:
{
g_pfnUARTHandlerCallbacks[1] = pfnCallback;
break;
}
case UART2_BASE:
{
g_pfnUARTHandlerCallbacks[2] = pfnCallback;
break;
}
default:
{
break;
}
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function is the common entry point of MM Status Code Router. It produces MM Report Status Code Handler and Status Code protocol. */
|
EFI_STATUS GenericStatusCodeCommonEntry(VOID)
|
/* This function is the common entry point of MM Status Code Router. It produces MM Report Status Code Handler and Status Code protocol. */
EFI_STATUS GenericStatusCodeCommonEntry(VOID)
|
{
EFI_STATUS Status;
EFI_HANDLE Handle;
Handle = NULL;
Status = gMmst->MmInstallProtocolInterface (
&Handle,
&gEfiMmRscHandlerProtocolGuid,
EFI_NATIVE_INTERFACE,
&mSmmRscHandlerProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gMmst->MmInstallProtocolInterface (
&Handle,
&gEfiMmStatusCodeProtocolGuid,
EFI_NATIVE_INTERFACE,
&mSmmStatusCodeProtocol
);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Used to catch tasks that attempt to return from their implementing function. */
|
static void prvTaskExitError(void)
|
/* Used to catch tasks that attempt to return from their implementing function. */
static void prvTaskExitError(void)
|
{
configASSERT( ulPortInterruptNesting == ~0UL );
portDISABLE_INTERRUPTS();
for( ;; );
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* @mod: Xterm shift mask @key_state: receives the state of the shift, alt, control, and logo keys */
|
void set_shift_mask(int mod, struct efi_key_state *key_state)
|
/* @mod: Xterm shift mask @key_state: receives the state of the shift, alt, control, and logo keys */
void set_shift_mask(int mod, struct efi_key_state *key_state)
|
{
key_state->key_shift_state = EFI_SHIFT_STATE_VALID;
if (mod) {
--mod;
if (mod & 1)
key_state->key_shift_state |= EFI_LEFT_SHIFT_PRESSED;
if (mod & 2)
key_state->key_shift_state |= EFI_LEFT_ALT_PRESSED;
if (mod & 4)
key_state->key_shift_state |= EFI_LEFT_CONTROL_PRESSED;
if (!mod || (mod & 8))
key_state->key_shift_state |= EFI_LEFT_LOGO_PRESSED;
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Copy keys from one btree block to another. */
|
STATIC void xfs_btree_copy_keys(struct xfs_btree_cur *cur, union xfs_btree_key *dst_key, union xfs_btree_key *src_key, int numkeys)
|
/* Copy keys from one btree block to another. */
STATIC void xfs_btree_copy_keys(struct xfs_btree_cur *cur, union xfs_btree_key *dst_key, union xfs_btree_key *src_key, int numkeys)
|
{
ASSERT(numkeys >= 0);
memcpy(dst_key, src_key, numkeys * cur->bc_ops->key_len);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Attribute write call back for the Long descriptor V2D2 attribute. */
|
static ssize_t write_long_des_v2d2_1(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 Long descriptor V2D2 attribute. */
static ssize_t write_long_des_v2d2_1(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
|
{
uint8_t *value = attr->user_data;
if (offset >= sizeof(long_des_v2d2_1_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(long_des_v2d2_1_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
|
/* Check if Both transmission and reception are completed and SWP is switched to the SUSPENDED state @rmtoll ISR TCF LL_SWPMI_IsActiveFlag_TC. */
|
uint32_t LL_SWPMI_IsActiveFlag_TC(SWPMI_TypeDef *SWPMIx)
|
/* Check if Both transmission and reception are completed and SWP is switched to the SUSPENDED state @rmtoll ISR TCF LL_SWPMI_IsActiveFlag_TC. */
uint32_t LL_SWPMI_IsActiveFlag_TC(SWPMI_TypeDef *SWPMIx)
|
{
return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_TCF) == (SWPMI_ISR_TCF)) ? 1UL : 0UL);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Writes an unsigned 8 bit values over I2C. */
|
err_t lsm303magWrite8(uint8_t addr, uint8_t reg, uint8_t value)
|
/* Writes an unsigned 8 bit values over I2C. */
err_t lsm303magWrite8(uint8_t addr, uint8_t reg, uint8_t value)
|
{
I2CWriteLength = 3;
I2CReadLength = 0;
I2CMasterBuffer[0] = addr;
I2CMasterBuffer[1] = reg;
I2CMasterBuffer[2] = (value);
ASSERT_I2C_STATUS(i2cEngine());
return ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Get Digital Core logic supply source to be used during Deep Sleep. */
|
static void lf_get_deepsleep_core_supply_cfg(uint32_t exclude_from_pd, uint32_t *dcdc_voltage)
|
/* Get Digital Core logic supply source to be used during Deep Sleep. */
static void lf_get_deepsleep_core_supply_cfg(uint32_t exclude_from_pd, uint32_t *dcdc_voltage)
|
{
*dcdc_voltage = (uint32_t)V_DCDC_0P950;
if (((exclude_from_pd & (uint32_t)kPDRUNCFG_PD_USB1_PHY) != 0UL) &&
((exclude_from_pd & (uint32_t)kPDRUNCFG_PD_LDOUSBHS) != 0UL))
{
PMC->MISCCTRL |= PMC_MISCCTRL_LOWPWR_FLASH_BUF_MASK;
*dcdc_voltage =
(uint32_t)V_DCDC_1P000;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* returns TRUE if first argument is earlier than second */
|
static gboolean is_earlier(nstime_t *l, nstime_t *r)
|
/* returns TRUE if first argument is earlier than second */
static gboolean is_earlier(nstime_t *l, nstime_t *r)
|
{
if (l->secs > r->secs) {
return FALSE;
} else if (l->secs < r->secs) {
return TRUE;
} else if (l->nsecs > r->nsecs) {
return FALSE;
}
return TRUE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Read the whole usb hub descriptor. It is necessary to do it in two steps because hub descriptor is of variable length. */
|
EFI_STATUS PeiUsbHubReadDesc(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi, OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor)
|
/* Read the whole usb hub descriptor. It is necessary to do it in two steps because hub descriptor is of variable length. */
EFI_STATUS PeiUsbHubReadDesc(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi, OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor)
|
{
EFI_STATUS Status;
Status = PeiGetHubDescriptor (PeiServices, PeiUsbDevice, UsbIoPpi, 2, HubDescriptor);
if (EFI_ERROR (Status)) {
return Status;
}
return PeiGetHubDescriptor (PeiServices, PeiUsbDevice, UsbIoPpi, HubDescriptor->Length, HubDescriptor);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* gfs2_glock_dq_uninit_m - release multiple glocks @num_gh: the number of structures @ghs: an array of struct gfs2_holder structures */
|
void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs)
|
/* gfs2_glock_dq_uninit_m - release multiple glocks @num_gh: the number of structures @ghs: an array of struct gfs2_holder structures */
void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs)
|
{
unsigned int x;
for (x = 0; x < num_gh; x++)
gfs2_glock_dq_uninit(&ghs[x]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads in and processes the next report from the attached device, displaying the report contents on the board LEDs and via the serial port. */
|
void ReadNextReport(void)
|
/* Reads in and processes the next report from the attached device, displaying the report contents on the board LEDs and via the serial port. */
void ReadNextReport(void)
|
{
if (USB_HostState != HOST_STATE_Configured)
return;
Pipe_SelectPipe(HID_DATA_IN_PIPE);
Pipe_Unfreeze();
if (!(Pipe_IsINReceived()))
{
Pipe_Freeze();
return;
}
if (Pipe_IsReadWriteAllowed())
{
uint8_t ReportINData[Pipe_BytesInPipe()];
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData), NULL);
for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
printf_P(PSTR("0x%02X "), ReportINData[CurrByte]);
puts_P(PSTR("\r\n"));
}
Pipe_ClearIN();
Pipe_Freeze();
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Reverses the effect of usb_poison_anchored_urbs the anchor can be used normally after it returns */
|
void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
|
/* Reverses the effect of usb_poison_anchored_urbs the anchor can be used normally after it returns */
void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
|
{
unsigned long flags;
struct urb *lazarus;
spin_lock_irqsave(&anchor->lock, flags);
list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
usb_unpoison_urb(lazarus);
}
anchor->poisoned = 0;
spin_unlock_irqrestore(&anchor->lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USART able to wake up the MCU from deep-sleep mode. */
|
void usart_wakeup_enable(uint32_t usart_periph)
|
/* USART able to wake up the MCU from deep-sleep mode. */
void usart_wakeup_enable(uint32_t usart_periph)
|
{
USART_CTL0(usart_periph) |=USART_CTL0_UESM;
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* Reads the byte value from the linear address. */
|
static blt_int8u FlashGetGlobalAddrByte(blt_addr addr)
|
/* Reads the byte value from the linear address. */
static blt_int8u FlashGetGlobalAddrByte(blt_addr addr)
|
{
blt_int8u oldPage;
blt_int8u result;
oldPage = FLASH_PPAGE_REG;
FLASH_PPAGE_REG = FlashGetPhysPage(addr);
result = *((blt_int8u *)FlashGetPhysAddr(addr));
FLASH_PPAGE_REG = oldPage;
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
|
UINT16 EFIAPI PciRead16(IN UINTN Address)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciRead16(IN UINTN Address)
|
{
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
return (UINT16)SmmPciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint16);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* calculate the crc for a given info frame */
|
static void r600_hdmi_infoframe_checksum(uint8_t packetType, uint8_t versionNumber, uint8_t length, uint8_t *frame)
|
/* calculate the crc for a given info frame */
static void r600_hdmi_infoframe_checksum(uint8_t packetType, uint8_t versionNumber, uint8_t length, uint8_t *frame)
|
{
int i;
frame[0] = packetType + versionNumber + length;
for (i = 1; i <= length; i++)
frame[0] += frame[i];
frame[0] = 0x100 - frame[0];
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills a constant value into a floating-point vector. */
|
void arm_fill_f64(float64_t value, float64_t *pDst, uint32_t blockSize)
|
/* Fills a constant value into a floating-point vector. */
void arm_fill_f64(float64_t value, float64_t *pDst, uint32_t blockSize)
|
{
uint32_t blkCnt;
blkCnt = blockSize;
while (blkCnt > 0U)
{
*pDst++ = value;
blkCnt--;
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* If the aio_fsync() function fails or aiocbp indicates an error condition, data is not guaranteed to have been successfully transferred. */
|
static void aio_fync_work(struct rt_work *work, void *work_data)
|
/* If the aio_fsync() function fails or aiocbp indicates an error condition, data is not guaranteed to have been successfully transferred. */
static void aio_fync_work(struct rt_work *work, void *work_data)
|
{
int result;
rt_ubase_t level;
struct aiocb *cb = (struct aiocb*)work_data;
RT_ASSERT(cb != RT_NULL);
result = fsync(cb->aio_fildes);
level = rt_hw_interrupt_disable();
if (result < 0)
cb->aio_result = errno;
else
cb->aio_result = 0;
rt_hw_interrupt_enable(level);
return ;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Given a struct clk of a rate-selectable clksel clock, and a clock divisor, find the corresponding register field value. The return register value is the value before left-shifting. Returns ~0 on error */
|
u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
|
/* Given a struct clk of a rate-selectable clksel clock, and a clock divisor, find the corresponding register field value. The return register value is the value before left-shifting. Returns ~0 on error */
u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
|
{
const struct clksel *clks;
const struct clksel_rate *clkr;
WARN_ON(div == 0);
clks = omap2_get_clksel_by_parent(clk, clk->parent);
if (!clks)
return ~0;
for (clkr = clks->rates; clkr->div; clkr++) {
if ((clkr->flags & cpu_mask) && (clkr->div == div))
break;
}
if (!clkr->div) {
printk(KERN_ERR "clock: Could not find divisor %d for "
"clock %s parent %s\n", div, clk->name,
clk->parent->name);
return ~0;
}
return clkr->val;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Apart form GPIOs, only the RTC alarm can be a wakeup event. */
|
static int sa1100_set_wake(unsigned int irq, unsigned int on)
|
/* Apart form GPIOs, only the RTC alarm can be a wakeup event. */
static int sa1100_set_wake(unsigned int irq, unsigned int on)
|
{
if (irq == IRQ_RTCAlrm) {
if (on)
PWER |= PWER_RTC;
else
PWER &= ~PWER_RTC;
return 0;
}
return -EINVAL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base SPDIF base pointer param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_RxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid. */
|
status_t SPDIF_TransferReceiveNonBlocking(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer)
|
/* param base SPDIF base pointer param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_RxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid. */
status_t SPDIF_TransferReceiveNonBlocking(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer)
|
{
assert(handle);
if (handle->spdifQueue[handle->queueUser].data)
{
return kStatus_SPDIF_QueueFull;
}
handle->transferSize[handle->queueUser] = xfer->dataSize;
handle->spdifQueue[handle->queueUser].data = xfer->data;
handle->spdifQueue[handle->queueUser].dataSize = xfer->dataSize;
handle->spdifQueue[handle->queueUser].udata = xfer->udata;
handle->spdifQueue[handle->queueUser].qdata = xfer->qdata;
handle->queueUser = (handle->queueUser + 1) % SPDIF_XFER_QUEUE_SIZE;
handle->state = kSPDIF_Busy;
SPDIF_EnableInterrupts(base, kSPDIF_UChannelReceiveRegisterFull | kSPDIF_QChannelReceiveRegisterFull |
kSPDIF_RxFIFOFull | kSPDIF_RxControlChannelChange);
SPDIF_RxEnable(base, true);
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* tipc_named_publish - tell other nodes about a new publication by this node */
|
void tipc_named_publish(struct publication *publ)
|
/* tipc_named_publish - tell other nodes about a new publication by this node */
void tipc_named_publish(struct publication *publ)
|
{
struct sk_buff *buf;
struct distr_item *item;
list_add_tail(&publ->local_list, &publ_root);
publ_cnt++;
buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
if (!buf) {
warn("Publication distribution failure\n");
return;
}
item = (struct distr_item *)msg_data(buf_msg(buf));
publ_to_item(item, publ);
dbg("tipc_named_withdraw: broadcasting publish msg\n");
tipc_cltr_broadcast(buf);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Board-specific knowlege like creating devices or pin setup is to be kept out of drivers as much as possible. In particular, pin setup may be handled by the boot loader, and drivers should expect it will normally have been done by the time they're probed. */
|
static int __init omap_init_devices(void)
|
/* Board-specific knowlege like creating devices or pin setup is to be kept out of drivers as much as possible. In particular, pin setup may be handled by the boot loader, and drivers should expect it will normally have been done by the time they're probed. */
static int __init omap_init_devices(void)
|
{
omap_init_dsp();
omap_init_kp();
omap_init_rng();
omap_init_uwire();
omap_init_wdt();
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* I2C 0 interrupt handler. This function is the I2C interrupt handler, it simple execute the callback function if there be one. */
|
void I2C0IntHandler(void)
|
/* I2C 0 interrupt handler. This function is the I2C interrupt handler, it simple execute the callback function if there be one. */
void I2C0IntHandler(void)
|
{
if(g_pfnI2CHandlerCallbacks[0] != 0)
{
g_pfnI2CHandlerCallbacks[0](0, 0, 0, 0);
}
else
{
while(1);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Compares two memory buffers of a given length. */
|
INTN EFIAPI InternalMemCompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
|
/* Compares two memory buffers of a given length. */
INTN EFIAPI InternalMemCompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
|
{
while ((--Length != 0) &&
(*(INT8 *)DestinationBuffer == *(INT8 *)SourceBuffer))
{
DestinationBuffer = (INT8 *)DestinationBuffer + 1;
SourceBuffer = (INT8 *)SourceBuffer + 1;
}
return (INTN)*(UINT8 *)DestinationBuffer - (INTN)*(UINT8 *)SourceBuffer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set TXBD read pointer, updated by CM4 driver. */
|
void SDIO_TXBD_RPTR_Set(u16 Val)
|
/* Set TXBD read pointer, updated by CM4 driver. */
void SDIO_TXBD_RPTR_Set(u16 Val)
|
{
HAL_SDIO_WRITE16(REG_SPDIO_TXBD_RPTR, Val);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* This function disables USB HS PHY PLL clock. */
|
void CLOCK_DisableUsbhs0PhyPllClock(void)
|
/* This function disables USB HS PHY PLL clock. */
void CLOCK_DisableUsbhs0PhyPllClock(void)
|
{
CCM_ANALOG->PLL_USB1 &= ~CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK;
USBPHY1->CTRL |= USBPHY_CTRL_CLKGATE_MASK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Save the pixels of a rectangle part of the LCD into a RAM variable. */
|
void LCD_RectRead(u16 x, u16 y, u16 width, u16 height, u8 *bmp)
|
/* Save the pixels of a rectangle part of the LCD into a RAM variable. */
void LCD_RectRead(u16 x, u16 y, u16 width, u16 height, u8 *bmp)
|
{
int i;
int bytesize = (width * height) *2;
LCD_SetRect_For_Cmd( x, y, width, height );
LCD_SendLCDCmd(ST7637_RAMRD);
LCD_ReadLCDData();
for( i = 0; i < bytesize; i++ )
{
*bmp++ = LCD_ReadLCDData();
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Reads the flash word at offset into data. Offset is converted to bytes before read. */
|
static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset, u16 *data)
|
/* Reads the flash word at offset into data. Offset is converted to bytes before read. */
static s32 e1000_read_flash_word_ich8lan(struct e1000_hw *hw, u32 offset, u16 *data)
|
{
offset <<= 1;
return e1000_read_flash_data_ich8lan(hw, offset, 2, data);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fetch an array of RATIONAL or SRATIONAL values. */
|
static int TIFFFetchRationalArray(TIFF *tif, TIFFDirEntry *dir, float *v)
|
/* Fetch an array of RATIONAL or SRATIONAL values. */
static int TIFFFetchRationalArray(TIFF *tif, TIFFDirEntry *dir, float *v)
|
{
int ok = 0;
uint32* l;
l = (uint32*)CheckMalloc(tif,
dir->tdir_count*TIFFDataWidth(dir->tdir_type),
"to fetch array of rationals");
if (l) {
if (TIFFFetchData(tif, dir, (char *)l)) {
uint32 i;
for (i = 0; i < dir->tdir_count; i++) {
ok = cvtRational(tif, dir,
l[2*i+0], l[2*i+1], &v[i]);
if (!ok)
break;
}
}
_TIFFfree((char *)l);
}
return (ok);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Set bus status while flash program or erase. */
|
void EFM_SetBusStatus(uint32_t u32Status)
|
/* Set bus status while flash program or erase. */
void EFM_SetBusStatus(uint32_t u32Status)
|
{
DDL_ASSERT(IS_EFM_REG_UNLOCK());
DDL_ASSERT(IS_EFM_BUS_STATUS(u32Status));
DDL_ASSERT(IS_EFM_FWMC_UNLOCK());
WRITE_REG32(bCM_EFM->FWMC_b.BUSHLDCTL, u32Status);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns: TRUE if the character is a hexadecimal digit */
|
gboolean g_unichar_isxdigit(gunichar c)
|
/* Returns: TRUE if the character is a hexadecimal digit */
gboolean g_unichar_isxdigit(gunichar c)
|
{
return ((c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F')
|| (TYPE (c) == G_UNICODE_DECIMAL_NUMBER));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Function for freeing instance. Instance identifier is provided in the parameter 'p_instance' in case the routine succeeds. */
|
static __INLINE void connection_instance_free(uint32_t const *p_instance)
|
/* Function for freeing instance. Instance identifier is provided in the parameter 'p_instance' in case the routine succeeds. */
static __INLINE void connection_instance_free(uint32_t const *p_instance)
|
{
DM_TRC("[DM]:[CI 0x%02X]: Freeing connection instance\r\n", (*p_instance));
if (m_connection_table[*p_instance].state != STATE_IDLE)
{
DM_LOG("[DM]:[%02X]: Freed connection instance.\r\n", (*p_instance));
connection_instance_init(*p_instance);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Receive message from a message queue within abstime time.
See IEEE 1003.1 */
|
int mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abstime)
|
/* Receive message from a message queue within abstime time.
See IEEE 1003.1 */
int mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abstime)
|
{
mqueue_desc *mqd = (mqueue_desc *)mqdes;
int32_t timeout = (int32_t) timespec_to_timeoutms(abstime);
return receive_message(mqd, msg_ptr, msg_len, K_MSEC(timeout));
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Gets the current device hub address for this endpoint. */
|
uint32_t USBHostHubAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags)
|
/* Gets the current device hub address for this endpoint. */
uint32_t USBHostHubAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags)
|
{
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) ||
(ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) ||
(ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) ||
(ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7));
if (ui32Flags & USB_EP_HOST_OUT)
{
return (HWREGB(ui32Base + USB_O_TXHUBADDR0 + (ui32Endpoint >> 1)));
}
else
{
return (HWREGB(ui32Base + USB_O_TXHUBADDR0 + 4 + (ui32Endpoint >> 1)));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calculate a clock divider(CD) and a fractional part (FP) for the USART asynchronous modes to generate a baudrate as close as possible to the baudrate set point. */
|
uint32_t usart_set_async_baudrate(Usart *p_usart, uint32_t baudrate, uint32_t ul_mck)
|
/* Calculate a clock divider(CD) and a fractional part (FP) for the USART asynchronous modes to generate a baudrate as close as possible to the baudrate set point. */
uint32_t usart_set_async_baudrate(Usart *p_usart, uint32_t baudrate, uint32_t ul_mck)
|
{
uint32_t over;
uint32_t cd_fp;
uint32_t cd;
uint32_t fp;
if (ul_mck >= HIGH_FRQ_SAMPLE_DIV * baudrate) {
over = HIGH_FRQ_SAMPLE_DIV;
} else {
over = LOW_FRQ_SAMPLE_DIV;
}
cd_fp = (8 * ul_mck + (over * baudrate) / 2) / (over * baudrate);
cd = cd_fp >> 3;
fp = cd_fp & 0x07;
if (cd < MIN_CD_VALUE || cd > MAX_CD_VALUE) {
return 1;
}
if (over == 8) {
p_usart->US_MR |= US_MR_OVER;
}
p_usart->US_BRGR = (cd << US_BRGR_CD_Pos) | (fp << US_BRGR_FP_Pos);
return 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
|
uint16_t lcdGetHeight(void)
|
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetHeight(void)
|
{
switch (lcdOrientation)
{
case LCD_ORIENTATION_PORTRAIT:
return ili9328Properties.height;
break;
case LCD_ORIENTATION_LANDSCAPE:
default:
return ili9328Properties.width;
}
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* SPI Set Bidirectional Simplex Receive Only Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire), and is placed in a receive state. */
|
void spi_set_bidirectional_receive_only_mode(uint32_t spi)
|
/* SPI Set Bidirectional Simplex Receive Only Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire), and is placed in a receive state. */
void spi_set_bidirectional_receive_only_mode(uint32_t spi)
|
{
SPI_CR1(spi) |= SPI_CR1_BIDIMODE;
SPI_CR1(spi) &= ~SPI_CR1_BIDIOE;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */
|
static void x25_asy_write_wakeup(struct tty_struct *tty)
|
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */
static void x25_asy_write_wakeup(struct tty_struct *tty)
|
{
int actual;
struct x25_asy *sl = tty->disc_data;
if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev))
return;
if (sl->xleft <= 0) {
sl->dev->stats.tx_packets++;
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
x25_asy_unlock(sl);
return;
}
actual = tty->ops->write(tty, sl->xhead, sl->xleft);
sl->xleft -= actual;
sl->xhead += actual;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* FLEXIO UART EDMA send finished callback function.
This function is called when FLEXIO UART EDMA send finished. It disables the UART TX EDMA request and sends kStatus_FLEXIO_UART_TxIdle to FLEXIO UART callback. */
|
static void FLEXIO_UART_TransferSendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
|
/* FLEXIO UART EDMA send finished callback function.
This function is called when FLEXIO UART EDMA send finished. It disables the UART TX EDMA request and sends kStatus_FLEXIO_UART_TxIdle to FLEXIO UART callback. */
static void FLEXIO_UART_TransferSendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
|
{
flexio_uart_edma_private_handle_t *uartPrivateHandle = (flexio_uart_edma_private_handle_t *)param;
assert(uartPrivateHandle->handle != NULL);
handle = handle;
tcds = tcds;
if (transferDone)
{
FLEXIO_UART_TransferAbortSendEDMA(uartPrivateHandle->base, uartPrivateHandle->handle);
if (uartPrivateHandle->handle->callback != NULL)
{
uartPrivateHandle->handle->callback(uartPrivateHandle->base, uartPrivateHandle->handle,
kStatus_FLEXIO_UART_TxIdle, uartPrivateHandle->handle->userData);
}
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* This function waits until all asynchronous function calls have been done. */
|
void async_synchronize_full(void)
|
/* This function waits until all asynchronous function calls have been done. */
void async_synchronize_full(void)
|
{
do {
async_synchronize_cookie(next_cookie);
} while (!list_empty(&async_running) || !list_empty(&async_pending));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* USB Device MSC Get Max LUN Request Callback Called automatically on USB Device Get Max LUN Request Parameters: None Return Value: TRUE - Success, FALSE - Error */
|
BOOL USBD_MSC_GetMaxLUN(void)
|
/* USB Device MSC Get Max LUN Request Callback Called automatically on USB Device Get Max LUN Request Parameters: None Return Value: TRUE - Success, FALSE - Error */
BOOL USBD_MSC_GetMaxLUN(void)
|
{
USBD_EP0Buf[0] = 0;
return (__TRUE);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* NOTE: there's no dissector here, just registration routines to set up the dissector table for the IANA OUI. */
|
void proto_register_iana_oui(void)
|
/* NOTE: there's no dissector here, just registration routines to set up the dissector table for the IANA OUI. */
void proto_register_iana_oui(void)
|
{
static hf_register_info hf[] = {
{ &hf_llc_iana_pid,
{ "PID", "llc.iana_pid", FT_UINT16, BASE_HEX,
VALS(iana_pid_vals), 0x0, NULL, HFILL }
}
};
llc_add_oui(OUI_IANA, "llc.iana_pid", "LLC IANA OUI PID", hf, -1);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Get pointer to CPU MP Data structure from GUIDed HOB. */
|
VOID AmdSevUpdateCpuMpData(IN CPU_MP_DATA *CpuMpData)
|
/* Get pointer to CPU MP Data structure from GUIDed HOB. */
VOID AmdSevUpdateCpuMpData(IN CPU_MP_DATA *CpuMpData)
|
{
CPU_MP_DATA *OldCpuMpData;
OldCpuMpData = GetCpuMpDataFromGuidedHob ();
OldCpuMpData->NewCpuMpData = CpuMpData;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* switch high-driver mode this bit set by software only when IRC16M or HXTAL used as system clock */
|
void pmu_highdriver_switch_select(uint32_t highdr_switch)
|
/* switch high-driver mode this bit set by software only when IRC16M or HXTAL used as system clock */
void pmu_highdriver_switch_select(uint32_t highdr_switch)
|
{
while(SET != pmu_flag_get(PMU_FLAG_HDRF)){
}
PMU_CTL &= ~PMU_CTL_HDS;
PMU_CTL |= highdr_switch;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* brief Return Frequency of EWM0 return Frequency of EWM0 */
|
uint32_t CLOCK_GetEwm0ClkFreq(void)
|
/* brief Return Frequency of EWM0 return Frequency of EWM0 */
uint32_t CLOCK_GetEwm0ClkFreq(void)
|
{
uint32_t freq = 0U;
switch (SYSCON->EWM0CLKSEL)
{
case 1U:
freq = CLOCK_GetClk16KFreq((uint32_t)kCLOCK_Clk16KToWake);
break;
case 2U:
freq = CLOCK_GetOsc32KFreq((uint32_t)kCLOCK_Osc32kToWake);
break;
default:
freq = 0U;
break;
}
return freq;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* XOR a block of data into the provided state. This supports only blocks whose length is a multiple of 64 bits. */
|
static void xor_block(uint64_t *A, const void *data, size_t rate)
|
/* XOR a block of data into the provided state. This supports only blocks whose length is a multiple of 64 bits. */
static void xor_block(uint64_t *A, const void *data, size_t rate)
|
{
size_t u;
for (u = 0; u < rate; u += 8) {
A[u >> 3] ^= br_dec64le((const unsigned char *)data + u);
}
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* This function returns PEB @pnum from the protection trees and returns zero in case of success and %-ENODEV if the PEB was not found in the protection trees. */
|
static int prot_tree_del(struct ubi_device *ubi, int pnum)
|
/* This function returns PEB @pnum from the protection trees and returns zero in case of success and %-ENODEV if the PEB was not found in the protection trees. */
static int prot_tree_del(struct ubi_device *ubi, int pnum)
|
{
struct rb_node *p;
struct ubi_wl_prot_entry *pe = NULL;
p = ubi->prot.pnum.rb_node;
while (p) {
pe = rb_entry(p, struct ubi_wl_prot_entry, rb_pnum);
if (pnum == pe->e->pnum)
goto found;
if (pnum < pe->e->pnum)
p = p->rb_left;
else
p = p->rb_right;
}
return -ENODEV;
found:
ubi_assert(pe->e->pnum == pnum);
rb_erase(&pe->rb_aec, &ubi->prot.aec);
rb_erase(&pe->rb_pnum, &ubi->prot.pnum);
kfree(pe);
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* This function will insert a device path package to package list firstly then invoke notification functions if any. This is a internal function. */
|
EFI_STATUS AddDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN OUT HII_DATABASE_RECORD *DatabaseRecord)
|
/* This function will insert a device path package to package list firstly then invoke notification functions if any. This is a internal function. */
EFI_STATUS AddDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN OUT HII_DATABASE_RECORD *DatabaseRecord)
|
{
EFI_STATUS Status;
if (DevicePath == NULL) {
return EFI_SUCCESS;
}
ASSERT (Private != NULL);
ASSERT (DatabaseRecord != NULL);
Status = InsertDevicePathPackage (
DevicePath,
NotifyType,
DatabaseRecord->PackageList
);
if (EFI_ERROR (Status)) {
return Status;
}
return InvokeRegisteredFunction (
Private,
NotifyType,
(VOID *)DatabaseRecord->PackageList->DevicePathPkg,
EFI_HII_PACKAGE_DEVICE_PATH,
DatabaseRecord->Handle
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Stop the merging process and wait until it finishes. */
|
static void stop_merge(struct dm_snapshot *s)
|
/* Stop the merging process and wait until it finishes. */
static void stop_merge(struct dm_snapshot *s)
|
{
set_bit(SHUTDOWN_MERGE, &s->state_bits);
wait_on_bit(&s->state_bits, RUNNING_MERGE, wait_schedule,
TASK_UNINTERRUPTIBLE);
clear_bit(SHUTDOWN_MERGE, &s->state_bits);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Platform device IDs are assumed to be encoded like this: "<name><instance>", where <name> is a short description of the type of device, like "pci" or "floppy", and <instance> is the enumerated instance of the device, like '0' or '42'. Driver IDs are simply "<name>". So, extract the <name> from the platform_device structure, and compare it against the name of the driver. Return whether they match or not. */
|
static int platform_match(struct device *dev, struct device_driver *drv)
|
/* Platform device IDs are assumed to be encoded like this: "<name><instance>", where <name> is a short description of the type of device, like "pci" or "floppy", and <instance> is the enumerated instance of the device, like '0' or '42'. Driver IDs are simply "<name>". So, extract the <name> from the platform_device structure, and compare it against the name of the driver. Return whether they match or not. */
static int platform_match(struct device *dev, struct device_driver *drv)
|
{
struct platform_device *pdev = to_platform_device(dev);
struct platform_driver *pdrv = to_platform_driver(drv);
if (pdrv->id_table)
return platform_match_id(pdrv->id_table, pdev) != NULL;
return (strcmp(pdev->name, drv->name) == 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* In the early version 2 core ColdFire parts the IMR register was 16 bits in size. Version 3 (and later version 2) core parts have a 32 bit sized IMR register. Provide some size independant methods to access the IMR register. */
|
void mcf_setimr(int index)
|
/* In the early version 2 core ColdFire parts the IMR register was 16 bits in size. Version 3 (and later version 2) core parts have a 32 bit sized IMR register. Provide some size independant methods to access the IMR register. */
void mcf_setimr(int index)
|
{
u32 imr;
imr = __raw_readl(MCF_MBAR + MCFSIM_IMR);
__raw_writel(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Allocate one page for creating 4KB-page based on 2MB-page. */
|
VOID AcquirePage(UINT64 *Uplink)
|
/* Allocate one page for creating 4KB-page based on 2MB-page. */
VOID AcquirePage(UINT64 *Uplink)
|
{
UINT64 Address;
Address = mPFPageBuffer + EFI_PAGES_TO_SIZE (mPFPageIndex);
ZeroMem ((VOID *)(UINTN)Address, EFI_PAGE_SIZE);
if ((mPFPageUplink[mPFPageIndex] != NULL) && ((*mPFPageUplink[mPFPageIndex] & ~mAddressEncMask & PHYSICAL_ADDRESS_MASK) == Address)) {
*mPFPageUplink[mPFPageIndex] = 0;
}
*Uplink = Address | mAddressEncMask | PAGE_ATTRIBUTE_BITS;
mPFPageUplink[mPFPageIndex] = Uplink;
mPFPageIndex = (mPFPageIndex + 1) % MAX_PF_PAGE_COUNT;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* LZ4_setStreamDecode() : Use this function to instruct where to find the dictionary. This function is not necessary if previous data is still available where it was decoded. Loading a size of 0 is allowed (same effect as no dictionary). */
|
int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
|
/* LZ4_setStreamDecode() : Use this function to instruct where to find the dictionary. This function is not necessary if previous data is still available where it was decoded. Loading a size of 0 is allowed (same effect as no dictionary). */
int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
|
{
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
lz4sd->prefixSize = (size_t) dictSize;
lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize;
lz4sd->externalDict = NULL;
lz4sd->extDictSize = 0;
return 1;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
|
gboolean _g_freedesktop_dbus_call_list_names_sync(_GFreedesktopDBus *proxy, gchar ***out_names, GCancellable *cancellable, GError **error)
|
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_list_names_sync(_GFreedesktopDBus *proxy, gchar ***out_names, GCancellable *cancellable, GError **error)
|
{
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
"ListNames",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"(^as)",
out_names);
g_variant_unref (_ret);
_out:
return _ret != NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Sends nack signal on bus.
Sends a nack signal on bus. */
|
void i2c_master_send_nack(struct i2c_master_module *const module)
|
/* Sends nack signal on bus.
Sends a nack signal on bus. */
void i2c_master_send_nack(struct i2c_master_module *const module)
|
{
Assert(module);
Assert(module->hw);
SercomI2cm *const i2c_module = &(module->hw->I2CM);
_i2c_master_wait_for_sync(module);
i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Requeue all the un-ack-ed frames on the output queue to be picked up by nr_kick called from the timer. This arrangement handles the possibility of an empty output queue. */
|
void nr_requeue_frames(struct sock *sk)
|
/* Requeue all the un-ack-ed frames on the output queue to be picked up by nr_kick called from the timer. This arrangement handles the possibility of an empty output queue. */
void nr_requeue_frames(struct sock *sk)
|
{
struct sk_buff *skb, *skb_prev = NULL;
while ((skb = skb_dequeue(&nr_sk(sk)->ack_queue)) != NULL) {
if (skb_prev == NULL)
skb_queue_head(&sk->sk_write_queue, skb);
else
skb_append(skb_prev, skb, &sk->sk_write_queue);
skb_prev = skb;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get timer current counter value. This function is used to get timer current counter value. */
|
unsigned long TimerValueGet(unsigned long ulBase)
|
/* Get timer current counter value. This function is used to get timer current counter value. */
unsigned long TimerValueGet(unsigned long ulBase)
|
{
xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) ||
(ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) );
return (xHWREG(ulBase + TIMER_TC));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function is executed in case of error occurrence. */
|
static void Error_Handler(void)
|
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
|
{
BSP_LED_On(LED3);
BSP_LCD_SelectLayer(0);
while(1)
{
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* param base UART peripheral base address. param handle UART handle pointer. */
|
void UART_TransferAbortReceive(UART_Type *base, uart_handle_t *handle)
|
/* param base UART peripheral base address. param handle UART handle pointer. */
void UART_TransferAbortReceive(UART_Type *base, uart_handle_t *handle)
|
{
assert(handle);
if (!handle->rxRingBuffer)
{
UART_DisableInterrupts(base, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable |
kUART_FramingErrorInterruptEnable | kUART_IdleLineInterruptEnable);
if (UART_C1_PE_MASK & base->C1)
{
UART_DisableInterrupts(base, kUART_ParityErrorInterruptEnable);
}
}
handle->rxDataSize = 0U;
handle->rxState = kUART_RxIdle;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT32 EFIAPI S3PciSegmentBitFieldAnd32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentBitFieldAnd32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
|
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldAnd32 (Address, StartBit, EndBit, AndData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* initialize the struct snd_akm4xxx record with the template */
|
int snd_ice1712_akm4xxx_init(struct snd_akm4xxx *ak, const struct snd_akm4xxx *temp, const struct snd_ak4xxx_private *_priv, struct snd_ice1712 *ice)
|
/* initialize the struct snd_akm4xxx record with the template */
int snd_ice1712_akm4xxx_init(struct snd_akm4xxx *ak, const struct snd_akm4xxx *temp, const struct snd_ak4xxx_private *_priv, struct snd_ice1712 *ice)
|
{
struct snd_ak4xxx_private *priv;
if (_priv != NULL) {
priv = kmalloc(sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
*priv = *_priv;
} else {
priv = NULL;
}
*ak = *temp;
ak->card = ice->card;
ak->private_value[0] = (unsigned long)priv;
ak->private_data[0] = ice;
if (ak->ops.lock == NULL)
ak->ops.lock = snd_ice1712_akm4xxx_lock;
if (ak->ops.unlock == NULL)
ak->ops.unlock = snd_ice1712_akm4xxx_unlock;
if (ak->ops.write == NULL)
ak->ops.write = snd_ice1712_akm4xxx_write;
snd_akm4xxx_init(ak);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USART initialization function.
Enables USART peripheral, clocks and initializes USART driver */
|
void TARGET_IO_init(void)
|
/* USART initialization function.
Enables USART peripheral, clocks and initializes USART driver */
void TARGET_IO_init(void)
|
{
TARGET_IO_CLOCK_init();
usart_async_init(&TARGET_IO, SERCOM3, TARGET_IO_buffer, TARGET_IO_BUFFER_SIZE, (void *)NULL);
TARGET_IO_PORT_init();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Work out how long the sync pulse lasts Value is 1/(time in seconds) */
|
static void calc_hsync(struct w100fb_par *par)
|
/* Work out how long the sync pulse lasts Value is 1/(time in seconds) */
static void calc_hsync(struct w100fb_par *par)
|
{
unsigned long hsync;
struct w100_mode *mode = par->mode;
union crtc_ss_u crtc_ss;
if (mode->pixclk_src == CLK_SRC_XTAL)
hsync=par->mach->xtal_freq;
else
hsync=((par->fastpll_mode && mode->fast_pll_freq) ? mode->fast_pll_freq : mode->pll_freq)*100000;
hsync /= (w100_pwr_state.pclk_cntl.f.pclk_post_div + 1);
crtc_ss.val = readl(remapped_regs + mmCRTC_SS);
if (crtc_ss.val)
par->hsync_len = hsync / (crtc_ss.f.ss_end-crtc_ss.f.ss_start);
else
par->hsync_len = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Tells whether the Lock Error interrupt is enabled. */
|
bool flashcalw_is_lock_error_int_enabled(void)
|
/* Tells whether the Lock Error interrupt is enabled. */
bool flashcalw_is_lock_error_int_enabled(void)
|
{
return ((HFLASHC->FLASHCALW_FCR & FLASHCALW_FCR_LOCKE) != 0);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Checks whether the specified RTC interrupt has occurred or not. */
|
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
|
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
|
{
ITStatus bitstatus = RESET;
uint32_t tmpreg = 0, enablestatus = 0;
assert_param(IS_RTC_GET_IT(RTC_IT));
tmpreg = (uint32_t)(RTC->TAFCR & (RTC_TAFCR_TAMPIE));
enablestatus = (uint32_t)((RTC->CR & RTC_IT) | (tmpreg & (RTC_IT >> 15)));
tmpreg = (uint32_t)((RTC->ISR & (uint32_t)(RTC_IT >> 4)));
if ((enablestatus != (uint32_t)RESET) && ((tmpreg & 0x0000FFFF) != (uint32_t)RESET))
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Backing store (temporary file) management. Backing store objects are only used when the value returned by jpeg_mem_available is less than the total space needed. You can dispense with these routines if you have plenty of virtual memory; see jmemnobs.c. For MS-DOS we support three types of backing storage: */
|
read_file_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
|
/* Backing store (temporary file) management. Backing store objects are only used when the value returned by jpeg_mem_available is less than the total space needed. You can dispense with these routines if you have plenty of virtual memory; see jmemnobs.c. For MS-DOS we support three types of backing storage: */
read_file_store(j_common_ptr cinfo, backing_store_ptr info, void FAR *buffer_address, long file_offset, long byte_count)
|
{
if (jdos_seek(info->handle.file_handle, file_offset))
ERREXIT(cinfo, JERR_TFILE_SEEK);
if (byte_count > 65535L)
ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
if (jdos_read(info->handle.file_handle, buffer_address,
(unsigned short) byte_count))
ERREXIT(cinfo, JERR_TFILE_READ);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* About: Purpose Implementation of the HIDDJoystickInputReport class. Initializes a joystick input report instance. */
|
void HIDDJoystickInputReport_Initialize(HIDDJoystickInputReport *report)
|
/* About: Purpose Implementation of the HIDDJoystickInputReport class. Initializes a joystick input report instance. */
void HIDDJoystickInputReport_Initialize(HIDDJoystickInputReport *report)
|
{
report->buttons1 = 0;
report->buttons2 = 0;
report->buttons3 = 0;
report->X = 0;
report->Y = 0;
report->Z = 0;
report->Rx = 0;
report->Ry = 0;
report->Rz = 0;
report->S1 = 0;
report->S2 = 0;
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Description: The PHY infrastructure can run a state machine which tracks whether the PHY is starting up, negotiating, etc. This function starts the timer which tracks the state of the PHY. If you want to be notified when the state changes, pass in the callback @handler, otherwise, pass NULL. If you want to maintain your own state machine, do not call this function. */
|
void phy_start_machine(struct phy_device *phydev, void(*handler)(struct net_device *))
|
/* Description: The PHY infrastructure can run a state machine which tracks whether the PHY is starting up, negotiating, etc. This function starts the timer which tracks the state of the PHY. If you want to be notified when the state changes, pass in the callback @handler, otherwise, pass NULL. If you want to maintain your own state machine, do not call this function. */
void phy_start_machine(struct phy_device *phydev, void(*handler)(struct net_device *))
|
{
phydev->adjust_state = handler;
schedule_delayed_work(&phydev->state_queue,
phy_state_timeout_init > 0 ? phy_state_timeout_init : HZ);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If 8-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI S3IoBitFieldOr8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
|
/* If 8-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3IoBitFieldOr8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
|
{
return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldOr8 (Port, StartBit, EndBit, OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The function checks whether SEV-SNP guest is booted under VMPL0. */
|
STATIC BOOLEAN SevSnpIsVmpl0(VOID)
|
/* The function checks whether SEV-SNP guest is booted under VMPL0. */
STATIC BOOLEAN SevSnpIsVmpl0(VOID)
|
{
UINT64 Rdx;
EFI_STATUS Status;
Rdx = 1;
Status = AsmRmpAdjust ((UINT64)gVmpl0Data, 0, Rdx);
if (EFI_ERROR (Status)) {
return FALSE;
}
return TRUE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set the polarity of the output pin.
Valid values for ui32TimerSegment are: */
|
void am_hal_ctimer_pin_invert(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment, bool bInvertOutput)
|
/* Set the polarity of the output pin.
Valid values for ui32TimerSegment are: */
void am_hal_ctimer_pin_invert(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment, bool bInvertOutput)
|
{
volatile uint32_t *pui32ConfigReg;
pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
(ui32TimerNumber * TIMER_OFFSET));
AM_CRITICAL_BEGIN_ASM
if ( bInvertOutput )
{
AM_REGVAL(pui32ConfigReg) |= (ui32TimerSegment &
(AM_REG_CTIMER_CTRL0_TMRA0POL_M |
AM_REG_CTIMER_CTRL0_TMRB0POL_M));
}
else
{
AM_REGVAL(pui32ConfigReg) &= ~(ui32TimerSegment &
(AM_REG_CTIMER_CTRL0_TMRA0POL_M |
AM_REG_CTIMER_CTRL0_TMRB0POL_M));
}
AM_CRITICAL_END_ASM
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Registers an interrupt handler for the LCD controller module. */
|
void LCDIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
|
/* Registers an interrupt handler for the LCD controller module. */
void LCDIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
|
{
ASSERT(ui32Base == LCD0_BASE);
ASSERT(pfnHandler);
IntRegister(INT_LCD0, pfnHandler);
IntEnable(INT_LCD0);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The return value is guaranteed to be monotonic in that range as long as there is always less than 89 seconds between successive calls to this function. */
|
unsigned long long sched_clock(void)
|
/* The return value is guaranteed to be monotonic in that range as long as there is always less than 89 seconds between successive calls to this function. */
unsigned long long sched_clock(void)
|
{
unsigned long long v = cnt32_to_63(readl(REALVIEW_REFCOUNTER));
v *= 125<<1;
do_div(v, 3<<1);
return v;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Provide default configuration for the application initialization handler. */
|
void cn0401_get_config(struct cn0401_init_param *init_param)
|
/* Provide default configuration for the application initialization handler. */
void cn0401_get_config(struct cn0401_init_param *init_param)
|
{
can_ctrl_get_config(&init_param->can_ctrl_init);
init_param->cli_init.uart_init.baudrate = bd115200;
init_param->cli_init.uart_init.bits_no = 8;
init_param->cli_init.uart_init.has_callback = true;
init_param->aux_gpio = 0x1B;
init_param->silent_gpio = 0x09;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
|
UINT64* EFIAPI MmioWriteBuffer64(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT64 *Buffer)
|
/* If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64* EFIAPI MmioWriteBuffer64(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT64 *Buffer)
|
{
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = (UINT64 *)Buffer;
while (Length != 0) {
MmioWrite64 (StartAddress, *(Buffer++));
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* USBH_MSC_GetMaxLUN The function return the Max LUN supported. */
|
uint8_t USBH_MSC_GetMaxLUN(USBH_HandleTypeDef *phost)
|
/* USBH_MSC_GetMaxLUN The function return the Max LUN supported. */
uint8_t USBH_MSC_GetMaxLUN(USBH_HandleTypeDef *phost)
|
{
if ((phost->device.is_connected == 0U) || (phost->gState != HOST_CLASS))
{
return 0xFFU;
}
if (phost->pActiveClass == NULL || phost->pActiveClass->pData == NULL)
{
return 0xFFU;
}
MSC_HandleTypeDef *MSC_Handle = (MSC_HandleTypeDef*) phost->pActiveClass->pData;
if ((phost->gState == HOST_CLASS) && (MSC_Handle->state == MSC_IDLE))
{
return (uint8_t) MSC_Handle->max_lunv [0];
}
return 0xFFU;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* 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);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Add a pointer event to the internal event queue.
This function creates a struct win_event from the pointer event and adds it to the internal event queue. The event data is copied, so there is no need to keep the event variable alive after calling this function. */
|
void win_queue_pointer_event(const struct win_pointer_event *event)
|
/* Add a pointer event to the internal event queue.
This function creates a struct win_event from the pointer event and adds it to the internal event queue. The event data is copied, so there is no need to keep the event variable alive after calling this function. */
void win_queue_pointer_event(const struct win_pointer_event *event)
|
{
struct win_event w_event;
w_event.type = WIN_EVENT_POINTER;
w_event.pointer = *event;
win_queue_event(&w_event);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* We're finished using the context for an address space. */
|
void destroy_context(struct mm_struct *mm)
|
/* We're finished using the context for an address space. */
void destroy_context(struct mm_struct *mm)
|
{
preempt_disable();
if (mm->context.id != NO_CONTEXT) {
clear_bit(mm->context.id, context_map);
mm->context.id = NO_CONTEXT;
}
preempt_enable();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read whether the specifie DMA Channel flag is set or not. */
|
uint8_t DMA_ReadStatusFlag(DMA_FLAG_T flag)
|
/* Read whether the specifie DMA Channel flag is set or not. */
uint8_t DMA_ReadStatusFlag(DMA_FLAG_T flag)
|
{
if ((DMA1->INTSTS & flag) != RESET)
{
return SET ;
}
else
{
return RESET ;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Some devices don't have PCI PM caps but can still generate wakeup events through platform methods (like ACPI events). If @dev supports platform wakeup events, set the device flag to indicate as much. This may be redundant if the device also supports PCI PM caps, but double initialization should be safe in that case. */
|
void platform_pci_wakeup_init(struct pci_dev *dev)
|
/* Some devices don't have PCI PM caps but can still generate wakeup events through platform methods (like ACPI events). If @dev supports platform wakeup events, set the device flag to indicate as much. This may be redundant if the device also supports PCI PM caps, but double initialization should be safe in that case. */
void platform_pci_wakeup_init(struct pci_dev *dev)
|
{
if (!platform_pci_can_wakeup(dev))
return;
device_set_wakeup_capable(&dev->dev, true);
device_set_wakeup_enable(&dev->dev, false);
platform_pci_sleep_wake(dev, false);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Wait for ULPI PHY reset to complete. Actual wait for reset must be done in a view port specific way, because it involves checking the DIR line. */
|
static int __ulpi_reset_wait(struct ulpi_viewport *ulpi_vp)
|
/* Wait for ULPI PHY reset to complete. Actual wait for reset must be done in a view port specific way, because it involves checking the DIR line. */
static int __ulpi_reset_wait(struct ulpi_viewport *ulpi_vp)
|
{
u32 val;
int timeout = CONFIG_USB_ULPI_TIMEOUT;
while (--timeout) {
val = ulpi_read(ulpi_vp, &ulpi->function_ctrl);
if (!(val & ULPI_FC_RESET))
return 0;
udelay(1);
}
printf("ULPI: %s: reset timed out\n", __func__);
return ULPI_ERROR;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Internal function to add smbus execute opcode to the table. */
|
EFI_STATUS BootScriptWriteSmbusExecute(IN VA_LIST Marker)
|
/* Internal function to add smbus execute opcode to the table. */
EFI_STATUS BootScriptWriteSmbusExecute(IN VA_LIST Marker)
|
{
EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
EFI_SMBUS_DEVICE_COMMAND Command;
EFI_SMBUS_OPERATION Operation;
BOOLEAN PecCheck;
VOID *Buffer;
UINTN *DataSize;
UINTN SmBusAddress;
SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);
Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);
Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION);
PecCheck = VA_ARG (Marker, BOOLEAN);
SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress, Command, 0, PecCheck);
DataSize = VA_ARG (Marker, UINTN *);
Buffer = VA_ARG (Marker, VOID *);
return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is called to increment a global variable "lib_tick" used as application time base. */
|
__weak void ald_inc_tick(void)
|
/* This function is called to increment a global variable "lib_tick" used as application time base. */
__weak void ald_inc_tick(void)
|
{
++lib_tick;
ald_systick_irq_cbk();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* No error: return = 0 Unable to open: return = -1 Unable to mmap: return = -2 */
|
static int cfag12864b_init(char *path)
|
/* No error: return = 0 Unable to open: return = -1 Unable to mmap: return = -2 */
static int cfag12864b_init(char *path)
|
{
cfag12864b_fd = open(path, O_RDWR);
if (cfag12864b_fd == -1)
return -1;
cfag12864b_mem = mmap(0, CFAG12864B_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, cfag12864b_fd, 0);
if (cfag12864b_mem == MAP_FAILED) {
close(cfag12864b_fd);
return -2;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* check whether the controls with the given name and direction suffix already exist */
|
static int check_existing_control(struct hda_codec *codec, const char *type, const char *dir)
|
/* check whether the controls with the given name and direction suffix already exist */
static int check_existing_control(struct hda_codec *codec, const char *type, const char *dir)
|
{
struct snd_ctl_elem_id id;
memset(&id, 0, sizeof(id));
sprintf(id.name, "%s %s Volume", type, dir);
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
if (snd_ctl_find_id(codec->bus->card, &id))
return 1;
sprintf(id.name, "%s %s Switch", type, dir);
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
if (snd_ctl_find_id(codec->bus->card, &id))
return 1;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialize LCD panel.
Make sure high - to - low transition to reset the panel */
|
static void lcdif_panel_init(void)
|
/* Initialize LCD panel.
Make sure high - to - low transition to reset the panel */
static void lcdif_panel_init(void)
|
{
BW_LCDIF_CTRL1_RESET(0);
hal_delay_us(100*1000);
BW_LCDIF_CTRL1_RESET(1); hal_delay_us(10*1000);
BW_LCDIF_CTRL1_RESET(0);
hal_delay_us(10*1000);
BW_LCDIF_CTRL1_RESET(1); hal_delay_us(1*1000);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Reads and returns the current value of SS. This function is only available on IA-32 and X64. */
|
UINT16 EFIAPI AsmReadSs(VOID)
|
/* Reads and returns the current value of SS. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadSs(VOID)
|
{
UINT16 Data;
__asm__ __volatile__ (
"mov %%ss, %0"
:"=a" (Data)
);
return Data;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* initialise an inode cache slab element prior to any use */
|
static void afs_i_init_once(void *foo)
|
/* initialise an inode cache slab element prior to any use */
static void afs_i_init_once(void *foo)
|
{
struct afs_vnode *vnode = _vnode;
memset(vnode, 0, sizeof(*vnode));
inode_init_once(&vnode->vfs_inode);
init_waitqueue_head(&vnode->update_waitq);
mutex_init(&vnode->permits_lock);
mutex_init(&vnode->validate_lock);
spin_lock_init(&vnode->writeback_lock);
spin_lock_init(&vnode->lock);
INIT_LIST_HEAD(&vnode->writebacks);
INIT_LIST_HEAD(&vnode->pending_locks);
INIT_LIST_HEAD(&vnode->granted_locks);
INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work);
INIT_WORK(&vnode->cb_broken_work, afs_broken_callback_work);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will initialize a thread, normally it's used to initialize a static thread object. */
|
rt_err_t rt_thread_init(struct rt_thread *thread, const char *name, void(*entry)(void *parameter), void *parameter, void *stack_start, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
|
/* This function will initialize a thread, normally it's used to initialize a static thread object. */
rt_err_t rt_thread_init(struct rt_thread *thread, const char *name, void(*entry)(void *parameter), void *parameter, void *stack_start, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
|
{
RT_ASSERT(thread != RT_NULL);
RT_ASSERT(stack_start != RT_NULL);
rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);
return _thread_init(thread,
name,
entry,
parameter,
stack_start,
stack_size,
priority,
tick);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* De-Initializes the Low Level portion of the Device driver. */
|
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
|
/* De-Initializes the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
|
{
HAL_PCD_DeInit(pdev->pData);
return USBD_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Gets interrupt status for the specified PWM generator block. */
|
uint32_t PWMGenIntStatus(uint32_t ui32Base, uint32_t ui32Gen, bool bMasked)
|
/* Gets interrupt status for the specified PWM generator block. */
uint32_t PWMGenIntStatus(uint32_t ui32Base, uint32_t ui32Gen, bool bMasked)
|
{
ASSERT(ui32Base == PWM0_BASE);
ASSERT(_PWMGenValid(ui32Gen));
ui32Gen = PWM_GEN_BADDR(ui32Base, ui32Gen);
if (bMasked == true)
{
return (HWREG(ui32Gen + PWM_O_X_ISC));
}
else
{
return (HWREG(ui32Gen + PWM_O_X_RIS));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Helper function to dissect the IAS ZoneStatus bitmask. */
|
static void dissect_zcl_ias_zone_status(proto_tree *tree, tvbuff_t *tvb, guint offset)
|
/* Helper function to dissect the IAS ZoneStatus bitmask. */
static void dissect_zcl_ias_zone_status(proto_tree *tree, tvbuff_t *tvb, guint offset)
|
{
static const int *ias_zone_statuses[] = {
&hf_zbee_zcl_ias_zone_status_alarm1,
&hf_zbee_zcl_ias_zone_status_alarm2,
&hf_zbee_zcl_ias_zone_status_tamper,
&hf_zbee_zcl_ias_zone_status_battery,
&hf_zbee_zcl_ias_zone_status_supervision_reports,
&hf_zbee_zcl_ias_zone_status_restore_reports,
&hf_zbee_zcl_ias_zone_status_trouble,
&hf_zbee_zcl_ias_zone_status_ac_mains,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_ias_zone_status, ett_zbee_zcl_ias_zone_status, ias_zone_statuses, ENC_NA);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.