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
|
|---|---|---|---|---|---|---|---|
/* Helper function to release periodic advertising chain that was enqueued for advertising set. */
|
void common_release_per_adv_chain(struct ll_adv_set *adv_set)
|
/* Helper function to release periodic advertising chain that was enqueued for advertising set. */
void common_release_per_adv_chain(struct ll_adv_set *adv_set)
|
{
struct lll_adv_sync *lll_sync;
struct pdu_adv *pdu;
lll_sync = adv_set->lll.sync;
pdu = lll_adv_sync_data_peek(lll_sync, NULL);
if (pdu != NULL) {
lll_adv_pdu_linked_release_all(pdu);
}
pdu = (void *)lll_sync->data.pdu[lll_sync->data.first];
if (pdu != NULL) {
lll_adv_pdu_linked_release_all(pdu);
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function is used to clear watchdog irq in case watchdog reset. */
|
void tls_watchdog_clr(void)
|
/* This function is used to clear watchdog irq in case watchdog reset. */
void tls_watchdog_clr(void)
|
{
if (0 == wdg_jumpclear_flag)
{
tls_reg_write32(HR_WDG_INT_CLR, 0x01);
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* @str: ASCII string Return: UTF-16 string. NULL if out of memory. */
|
static u16* efi_str_to_u16(char *str)
|
/* @str: ASCII string Return: UTF-16 string. NULL if out of memory. */
static u16* efi_str_to_u16(char *str)
|
{
efi_uintn_t len;
u16 *out, *dst;
efi_status_t ret;
len = sizeof(u16) * (utf8_utf16_strlen(str) + 1);
ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len, (void **)&out);
if (ret != EFI_SUCCESS)
return NULL;
dst = out;
utf8_utf16_strcpy(&dst, str);
return out;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function sets the suspend bit to prevent iscsi_data_xmit from sending new IO, and if work is queued on the xmit thread it will wait for it to be completed. */
|
void iscsi_suspend_tx(struct iscsi_conn *conn)
|
/* This function sets the suspend bit to prevent iscsi_data_xmit from sending new IO, and if work is queued on the xmit thread it will wait for it to be completed. */
void iscsi_suspend_tx(struct iscsi_conn *conn)
|
{
struct Scsi_Host *shost = conn->session->host;
struct iscsi_host *ihost = shost_priv(shost);
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
if (ihost->workq)
flush_workqueue(ihost->workq);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
|
status_t HAL_CODEC_WM8904_SetMute(void *handle, uint32_t playChannel, bool isMute)
|
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8904_SetMute(void *handle, uint32_t playChannel, bool isMute)
|
{
assert(handle != NULL);
return WM8904_SetChannelMute((wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
playChannel, isMute);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* lis3l02dq_poll_func_th() top half interrupt handler called by trigger @private_data: iio_dev */
|
static void lis3l02dq_poll_func_th(struct iio_dev *indio_dev)
|
/* lis3l02dq_poll_func_th() top half interrupt handler called by trigger @private_data: iio_dev */
static void lis3l02dq_poll_func_th(struct iio_dev *indio_dev)
|
{
struct lis3l02dq_state *st = iio_dev_get_devdata(indio_dev);
st->last_timestamp = indio_dev->trig->timestamp;
schedule_work(&st->work_trigger_to_ring);
st->inter = 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the transfer count for an integrated USB DMA channel. */
|
uint32_t USBDMAChannelCountGet(uint32_t ui32Base, uint32_t ui32Channel)
|
/* Returns the transfer count for an integrated USB DMA channel. */
uint32_t USBDMAChannelCountGet(uint32_t ui32Base, uint32_t ui32Channel)
|
{
ASSERT(ui32Base == USB0_BASE);
ASSERT(ui32Channel < 8);
return(HWREG(ui32Base + USB_O_DMACOUNT0 + (0x10 * ui32Channel)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function returns TRUE if the device path specified by DevicePath is multi-instance. Otherwise, FALSE is returned. If DevicePath is NULL or invalid, then FALSE is returned. */
|
BOOLEAN EFIAPI IsDevicePathMultiInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
/* This function returns TRUE if the device path specified by DevicePath is multi-instance. Otherwise, FALSE is returned. If DevicePath is NULL or invalid, then FALSE is returned. */
BOOLEAN EFIAPI IsDevicePathMultiInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
{
if (mDevicePathLibDevicePathUtilities != NULL) {
return mDevicePathLibDevicePathUtilities->IsDevicePathMultiInstance (DevicePath);
} else {
return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Attribute read call back for the Value V17 attribute. */
|
static ssize_t read_value_v17(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
|
/* Attribute read call back for the Value V17 attribute. */
static ssize_t read_value_v17(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
|
{
const uint8_t *value = attr->user_data;
return bt_gatt_attr_read(conn, attr, buf, len, offset, value,
sizeof(value_v17_value));
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Release buffers and URBs for the B channels */
|
void st5481_release_b(struct st5481_bcs *bcs)
|
/* Release buffers and URBs for the B channels */
void st5481_release_b(struct st5481_bcs *bcs)
|
{
DBG(4,"");
st5481_release_in(&bcs->b_in);
st5481_release_b_out(bcs);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* brief Returns number of bytes transferred so far. param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_Success retval #kStatus_I2C_Busy */
|
status_t I2C_MasterTransferGetCount(I2C_Type *base, i2c_master_handle_t *handle, size_t *count)
|
/* brief Returns number of bytes transferred so far. param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_Success retval #kStatus_I2C_Busy */
status_t I2C_MasterTransferGetCount(I2C_Type *base, i2c_master_handle_t *handle, size_t *count)
|
{
assert(handle != NULL);
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if (handle->state == (uint8_t)kIdleState)
{
*count = 0;
return kStatus_NoTransferInProgress;
}
*count = handle->transferCount;
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* configure the direction of data transfer on the channel */
|
void dma_transfer_direction_config(uint32_t dma_periph, dma_channel_enum channelx, uint8_t direction)
|
/* configure the direction of data transfer on the channel */
void dma_transfer_direction_config(uint32_t dma_periph, dma_channel_enum channelx, uint8_t direction)
|
{
if(ERROR == dma_periph_and_channel_check(dma_periph, channelx)){
DMA_WRONG_HANDLE
}
if(DMA_PERIPHERAL_TO_MEMORY == direction){
DMA_CHCTL(dma_periph, channelx) &= ~DMA_CHXCTL_DIR;
} else {
DMA_CHCTL(dma_periph, channelx) |= DMA_CHXCTL_DIR;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Push a thread on the list of threads that are ready to be scheduled. */
|
static void scheduler_ready_push(struct thrd_t *thrd_p)
|
/* Push a thread on the list of threads that are ready to be scheduled. */
static void scheduler_ready_push(struct thrd_t *thrd_p)
|
{
thrd_prio_list_push_isr(&module.scheduler.ready, &thrd_p->scheduler.elem);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Read the config space of a given PCI device (both normal and extended). */
|
STATIC RETURN_STATUS EFIAPI SegmentDevReadConfig(IN PCI_CAP_DEV *PciDevice, IN UINT16 SourceOffset, OUT VOID *DestinationBuffer, IN UINT16 Size)
|
/* Read the config space of a given PCI device (both normal and extended). */
STATIC RETURN_STATUS EFIAPI SegmentDevReadConfig(IN PCI_CAP_DEV *PciDevice, IN UINT16 SourceOffset, OUT VOID *DestinationBuffer, IN UINT16 Size)
|
{
SEGMENT_DEV *SegmentDev;
UINT16 ConfigSpaceSize;
UINT64 SourceAddress;
SegmentDev = SEGMENT_DEV_FROM_PCI_CAP_DEV (PciDevice);
ConfigSpaceSize = (SegmentDev->MaxDomain == PciCapNormal ?
PCI_MAX_CONFIG_OFFSET : PCI_EXP_MAX_CONFIG_OFFSET);
if (SourceOffset + Size > ConfigSpaceSize) {
return RETURN_UNSUPPORTED;
}
SourceAddress = PCI_SEGMENT_LIB_ADDRESS (
SegmentDev->SegmentNr,
SegmentDev->BusNr,
SegmentDev->DeviceNr,
SegmentDev->FunctionNr,
SourceOffset
);
PciSegmentReadBuffer (SourceAddress, Size, DestinationBuffer);
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Clear the specified Signal Flags of an active thread. */
|
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
|
/* Clear the specified Signal Flags of an active thread. */
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
|
{
return (int32_t)0x80000000U;
}
return __svcSignalClear(thread_id, signals);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Get the Rising Latched PWM counter of the PWM module.
The */
|
unsigned long PWMCAPRisingCounterGet(unsigned long ulBase, unsigned long ulChannel)
|
/* Get the Rising Latched PWM counter of the PWM module.
The */
unsigned long PWMCAPRisingCounterGet(unsigned long ulBase, unsigned long ulChannel)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
return xHWREG(ulBase + PWM_RCAPDAT0 + ulChannelTemp * 8);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* ocfs2_shift_tree_depth() uses this to determine the # clusters value for the new topmost tree record. */
|
static u32 ocfs2_sum_rightmost_rec(struct ocfs2_extent_list *el)
|
/* ocfs2_shift_tree_depth() uses this to determine the # clusters value for the new topmost tree record. */
static u32 ocfs2_sum_rightmost_rec(struct ocfs2_extent_list *el)
|
{
int i;
i = le16_to_cpu(el->l_next_free_rec) - 1;
return le32_to_cpu(el->l_recs[i].e_cpos) +
ocfs2_rec_clusters(el, &el->l_recs[i]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills the LCD with the specified 16-bit color. */
|
void lcdFillRGB(uint16_t data)
|
/* Fills the LCD with the specified 16-bit color. */
void lcdFillRGB(uint16_t data)
|
{
unsigned int i;
ili9325Home();
uint32_t pixels = 320*240;
for ( i=0; i < pixels; i++ )
{
ili9325WriteData(data);
}
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* enable/disable the multi-driver. This is only valid for output and allows the output pin to run as an open collector output. */
|
int at91_set_pio_multi_drive(unsigned port, unsigned pin, int is_on)
|
/* enable/disable the multi-driver. This is only valid for output and allows the output pin to run as an open collector output. */
int at91_set_pio_multi_drive(unsigned port, unsigned pin, int is_on)
|
{
struct at91_port *at91_port = at91_pio_get_port(port);
u32 mask;
if (at91_port && (pin < GPIO_PER_BANK)) {
mask = 1 << pin;
if (is_on)
writel(mask, &at91_port->mder);
else
writel(mask, &at91_port->mddr);
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Displays a bitmap picture loaded in the internal Flash. */
|
void hx8347g_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
|
/* Displays a bitmap picture loaded in the internal Flash. */
void hx8347g_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
|
{
uint32_t index = 0, size = 0;
size = *(volatile uint16_t *) (pbmp + 2);
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
index = *(volatile uint16_t *) (pbmp + 10);
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
size = (size - index)/2;
pbmp += index;
hx8347g_WriteReg(LCD_REG_22, 0xE0);
hx8347g_SetCursor(Xpos, Ypos);
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
hx8347g_WriteReg(LCD_REG_22, 0xA0);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Attribute write call back for the Value V6 attribute. */
|
static ssize_t write_value_v6(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 V6 attribute. */
static ssize_t write_value_v6(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(value_v6_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(value_v6_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
|
/* Gets the state of one GPIO from the DATA ENABLE REGISTER. */
|
uint32_t am_hal_gpio_out_enable_bit_get(uint32_t ui32BitNum)
|
/* Gets the state of one GPIO from the DATA ENABLE REGISTER. */
uint32_t am_hal_gpio_out_enable_bit_get(uint32_t ui32BitNum)
|
{
return (AM_HAL_GPIO_EN(ui32BitNum) & AM_HAL_GPIO_EN_M(ui32BitNum)) ? 1 : 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Search through every FV until you find a file of type FileType */
|
EFI_STATUS EFIAPI FfsAnyFvFindFirstFile(IN EFI_FV_FILETYPE FileType, OUT EFI_PEI_FV_HANDLE *VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
|
/* Search through every FV until you find a file of type FileType */
EFI_STATUS EFIAPI FfsAnyFvFindFirstFile(IN EFI_FV_FILETYPE FileType, OUT EFI_PEI_FV_HANDLE *VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
|
{
EFI_STATUS Status;
UINTN Instance;
Instance = 0;
*FileHandle = NULL;
while (1) {
Status = FfsFindNextVolume (Instance++, VolumeHandle);
if (EFI_ERROR (Status)) {
break;
}
Status = FfsFindNextFile (FileType, *VolumeHandle, FileHandle);
if (!EFI_ERROR (Status)) {
break;
}
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The function is used to Select Low-Voltage Warning Voltage.
The */
|
void SysCtlLVDWarningVolSet(unsigned long ulVoltage)
|
/* The function is used to Select Low-Voltage Warning Voltage.
The */
void SysCtlLVDWarningVolSet(unsigned long ulVoltage)
|
{
xASSERT((ulVoltage == SYSCTL_LVD_WARNING_LOW) ||
(ulVoltage == SYSCTL_LVD_WARNING_MID1) ||
(ulVoltage == SYSCTL_LVD_WARNING_MID2) ||
(ulVoltage == SYSCTL_LVD_WARNING_HIGH));
xHWREGB(PMC_LVDSC2) &= ~PMC_LVDSC2_LVWV_M;
xHWREGB(PMC_LVDSC2) |= ulVoltage;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Checks the unique counts of other tasks to ensure they are still operational. Returns pdTRUE if an error is detected, otherwise pdFALSE. */
|
static char prvCheckOtherTasksAreStillRunning(void)
|
/* Checks the unique counts of other tasks to ensure they are still operational. Returns pdTRUE if an error is detected, otherwise pdFALSE. */
static char prvCheckOtherTasksAreStillRunning(void)
|
{
char cErrorHasOccurred = ( char ) pdFALSE;
if( xAreMathsTaskStillRunning() != pdTRUE )
{
cErrorHasOccurred = ( char ) pdTRUE;
}
return cErrorHasOccurred;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* This also assumes that the inode count has been incremented (or otherwise set) by the caller to indicate that it is now in use by the dcache. */
|
static struct dentry* __d_instantiate_unique(struct dentry *entry, struct inode *inode)
|
/* This also assumes that the inode count has been incremented (or otherwise set) by the caller to indicate that it is now in use by the dcache. */
static struct dentry* __d_instantiate_unique(struct dentry *entry, struct inode *inode)
|
{
struct dentry *alias;
int len = entry->d_name.len;
const char *name = entry->d_name.name;
unsigned int hash = entry->d_name.hash;
if (!inode) {
__d_instantiate(entry, NULL);
return NULL;
}
list_for_each_entry(alias, &inode->i_dentry, d_alias) {
struct qstr *qstr = &alias->d_name;
if (qstr->hash != hash)
continue;
if (alias->d_parent != entry->d_parent)
continue;
if (qstr->len != len)
continue;
if (memcmp(qstr->name, name, len))
continue;
dget_locked(alias);
return alias;
}
__d_instantiate(entry, inode);
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns a pointer to a GATT error object with the specified fields. The returned object is statically allocated, so this function is not reentrant. This function should only ever be called by the ble_hs task. */
|
static struct ble_gatt_error* ble_gattc_error(int status, uint16_t att_handle)
|
/* Returns a pointer to a GATT error object with the specified fields. The returned object is statically allocated, so this function is not reentrant. This function should only ever be called by the ble_hs task. */
static struct ble_gatt_error* ble_gattc_error(int status, uint16_t att_handle)
|
{
static struct ble_gatt_error error;
if (status == 0 || status == BLE_HS_EDONE) {
att_handle = 0;
}
error.status = status;
error.att_handle = att_handle;
return &error;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This is implemented by have a long-lived send_wr and sge which point to a statically allocated ack frame. This ack wr does not fall under the ring accounting that the tx and rx wrs do. The QP attribute specifically makes room for it beyond the ring size. Send completion notices its special wr_id and avoids working with the ring in that case. */
|
static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq, int ack_required)
|
/* This is implemented by have a long-lived send_wr and sge which point to a statically allocated ack frame. This ack wr does not fall under the ring accounting that the tx and rx wrs do. The QP attribute specifically makes room for it beyond the ring size. Send completion notices its special wr_id and avoids working with the ring in that case. */
static void rds_ib_set_ack(struct rds_ib_connection *ic, u64 seq, int ack_required)
|
{
unsigned long flags;
spin_lock_irqsave(&ic->i_ack_lock, flags);
ic->i_ack_next = seq;
if (ack_required)
set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags);
spin_unlock_irqrestore(&ic->i_ack_lock, flags);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Output: void, will modify proto_tree if not null. */
|
static void dissect_hello_ip_authentication_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
|
/* Output: void, will modify proto_tree if not null. */
static void dissect_hello_ip_authentication_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
|
{
if ( length != 0 ) {
proto_tree_add_item( tree, hf_isis_hello_clv_ip_authentication, tvb, offset, length, ENC_ASCII|ENC_NA);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
|
UINT16 EFIAPI PciBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
{
return PciCf8BitFieldRead16 (Address, StartBit, EndBit);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Check if the Rx fifo is full or not.
@method UART_IsRXFIFOFull */
|
Boolean UART_IsRXFIFOFull(UART_TypeDef *UARTx)
|
/* Check if the Rx fifo is full or not.
@method UART_IsRXFIFOFull */
Boolean UART_IsRXFIFOFull(UART_TypeDef *UARTx)
|
{
_ASSERT(IS_UART(UARTx));
return (Boolean)(UARTx->STATUS.bit.RX_FULL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base Pointer to FLEXIO_UART_Type param handle Pointer to flexio_uart_edma_handle_t structure */
|
void FLEXIO_UART_TransferAbortSendEDMA(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_TransferAbortSendEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle)
|
{
assert(handle->txEdmaHandle != NULL);
FLEXIO_UART_EnableTxDMA(base, false);
EDMA_StopTransfer(handle->txEdmaHandle);
handle->txState = (uint8_t)kFLEXIO_UART_TxIdle;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* A device has been removed, remove its routes. */
|
void x25_route_device_down(struct net_device *dev)
|
/* A device has been removed, remove its routes. */
void x25_route_device_down(struct net_device *dev)
|
{
struct x25_route *rt;
struct list_head *entry, *tmp;
write_lock_bh(&x25_route_list_lock);
list_for_each_safe(entry, tmp, &x25_route_list) {
rt = list_entry(entry, struct x25_route, node);
if (rt->dev == dev)
__x25_remove_route(rt);
}
write_unlock_bh(&x25_route_list_lock);
x25_clear_forward_by_dev(dev);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* rpc_call_async - Perform an asynchronous RPC call @clnt: pointer to RPC client @msg: RPC call parameters @flags: RPC call flags @tk_ops: RPC call ops @data: user call data */
|
int rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags, const struct rpc_call_ops *tk_ops, void *data)
|
/* rpc_call_async - Perform an asynchronous RPC call @clnt: pointer to RPC client @msg: RPC call parameters @flags: RPC call flags @tk_ops: RPC call ops @data: user call data */
int rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags, const struct rpc_call_ops *tk_ops, void *data)
|
{
struct rpc_task *task;
struct rpc_task_setup task_setup_data = {
.rpc_client = clnt,
.rpc_message = msg,
.callback_ops = tk_ops,
.callback_data = data,
.flags = flags|RPC_TASK_ASYNC,
};
task = rpc_run_task(&task_setup_data);
if (IS_ERR(task))
return PTR_ERR(task);
rpc_put_task(task);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This two layered interrupt approach means that we allocate IRQ 16 and above for PCI interrupts. The IRQ relates to which bit the interrupt comes in on. This makes interrupt processing much easier. */
|
static int __init eb64p_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
|
/* This two layered interrupt approach means that we allocate IRQ 16 and above for PCI interrupts. The IRQ relates to which bit the interrupt comes in on. This makes interrupt processing much easier. */
static int __init eb64p_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
|
{
static char irq_tab[5][5] __initdata = {
{16+7, 16+7, 16+7, 16+7, 16+7},
{16+0, 16+0, 16+2, 16+4, 16+9},
{16+1, 16+1, 16+3, 16+8, 16+10},
{ -1, -1, -1, -1, -1},
{16+6, 16+6, 16+6, 16+6, 16+6},
};
const long min_idsel = 5, max_idsel = 9, irqs_per_slot = 5;
return COMMON_TABLE_LOOKUP;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Internal worker function to call the Metronome Architectural Protocol for the number of ticks specified by the UINT64 Counter value. WaitForTick() service of the Metronome Architectural Protocol uses a UINT32 for the number of ticks to wait, so this function loops when Counter is larger than 0xffffffff. */
|
VOID CoreInternalWaitForTick(IN UINT64 Counter)
|
/* Internal worker function to call the Metronome Architectural Protocol for the number of ticks specified by the UINT64 Counter value. WaitForTick() service of the Metronome Architectural Protocol uses a UINT32 for the number of ticks to wait, so this function loops when Counter is larger than 0xffffffff. */
VOID CoreInternalWaitForTick(IN UINT64 Counter)
|
{
while (RShiftU64 (Counter, 32) > 0) {
gMetronome->WaitForTick (gMetronome, 0xffffffff);
Counter -= 0xffffffff;
}
gMetronome->WaitForTick (gMetronome, (UINT32)Counter);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Checks whether the specified ADC interrupt has occurred or not. */
|
INTStatus ADC_GetIntStatus(ADC_Module *ADCx, uint16_t ADC_IT)
|
/* Checks whether the specified ADC interrupt has occurred or not. */
INTStatus ADC_GetIntStatus(ADC_Module *ADCx, uint16_t ADC_IT)
|
{
INTStatus bitstatus = RESET;
uint32_t itmask = 0, enablestatus = 0;
assert_param(IsAdcModule(ADCx));
assert_param(IsAdcGetInt(ADC_IT));
itmask = ADC_IT >> 8;
enablestatus = (ADCx->CTRL1 & (uint8_t)ADC_IT);
if (((ADCx->STS & itmask) != (uint32_t)RESET) && enablestatus)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* get the specified DAC interrupt flag (DAC DMA underrun interrupt flag) */
|
FlagStatus dac_interrupt_flag_get(uint32_t dac_periph)
|
/* get the specified DAC interrupt flag (DAC DMA underrun interrupt flag) */
FlagStatus dac_interrupt_flag_get(uint32_t dac_periph)
|
{
FlagStatus temp_flag = RESET;
uint32_t ddudr_flag = 0U, ddudrie_flag = 0U;
if(DAC0 == dac_periph) {
ddudr_flag = DAC_STAT & DAC_STAT_DDUDR0;
ddudrie_flag = DAC_CTL & DAC_CTL_DDUDRIE0;
if((RESET != ddudr_flag) && (RESET != ddudrie_flag)) {
temp_flag = SET;
}
} else {
ddudr_flag = DAC_STAT & DAC_STAT_DDUDR1;
ddudrie_flag = DAC_CTL & DAC_CTL_DDUDRIE1;
if((RESET != ddudr_flag) && (RESET != ddudrie_flag)) {
temp_flag = SET;
}
}
return temp_flag;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The following routines are taken from page 170 of the 7th ARRL Computer Networking Conference paper, as is the whole state machine. */
|
void rose_enquiry_response(struct sock *sk)
|
/* The following routines are taken from page 170 of the 7th ARRL Computer Networking Conference paper, as is the whole state machine. */
void rose_enquiry_response(struct sock *sk)
|
{
struct rose_sock *rose = rose_sk(sk);
if (rose->condition & ROSE_COND_OWN_RX_BUSY)
rose_write_internal(sk, ROSE_RNR);
else
rose_write_internal(sk, ROSE_RR);
rose->vl = rose->vr;
rose->condition &= ~ROSE_COND_ACK_PENDING;
rose_stop_timer(sk);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* start_time (current time) delta1 = E (encoded submission time) delta2 = C (encoded current time) 0x01C2 = Pn + 15min (maximum point for S1) 0x7E38 = Pn+1 - 15min (minimum point for S3) 0x7FF8 = Pn+1 (length of P (period)) */
|
static gint32 dmp_dec_subm_time(guint16 delta1, gint32 start_time)
|
/* start_time (current time) delta1 = E (encoded submission time) delta2 = C (encoded current time) 0x01C2 = Pn + 15min (maximum point for S1) 0x7E38 = Pn+1 - 15min (minimum point for S3) 0x7FF8 = Pn+1 (length of P (period)) */
static gint32 dmp_dec_subm_time(guint16 delta1, gint32 start_time)
|
{
gint32 subm_time = start_time;
guint16 delta2;
delta2 = (guint16) ((subm_time / 2) % 0x7FF8);
if ((delta1 < 0x01C2) && (delta2 >= delta1 + 0x7E38)) {
subm_time += 2 * (0x7FF8 - delta2 + delta1);
} else if ((delta1 >= 0x01C2) && (delta2 < delta1 - 0x01C2)) {
subm_time -= 2 * (0x7FF8 - delta1 + delta2);
} else {
subm_time -= 2 * (delta2 - delta1);
}
return subm_time;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
|
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
|
{
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1|VBUS_SENSE_Pin|GPIO_PIN_3);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* compute x^-0.25 with an exponent and mantissa table. We use linear interpolation to reduce the mantissa table size at a small speed expense (linear interpolation approximately doubles the number of bits of precision). */
|
static float pow_m1_4(WMACodecContext *s, float x)
|
/* compute x^-0.25 with an exponent and mantissa table. We use linear interpolation to reduce the mantissa table size at a small speed expense (linear interpolation approximately doubles the number of bits of precision). */
static float pow_m1_4(WMACodecContext *s, float x)
|
{
union {
float f;
unsigned int v;
} u, t;
unsigned int e, m;
float a, b;
u.f = x;
e = u.v >> 23;
m = (u.v >> (23 - LSP_POW_BITS)) & ((1 << LSP_POW_BITS) - 1);
t.v = ((u.v << LSP_POW_BITS) & ((1 << 23) - 1)) | (127 << 23);
a = s->lsp_pow_m_table1[m];
b = s->lsp_pow_m_table2[m];
return s->lsp_pow_e_table[e] * (a + b * t.f);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Internal function to determine if 2 command names are really the same. */
|
BOOLEAN IsCommand(IN CONST CHAR16 *Command1, IN CONST CHAR16 *Command2)
|
/* Internal function to determine if 2 command names are really the same. */
BOOLEAN IsCommand(IN CONST CHAR16 *Command1, IN CONST CHAR16 *Command2)
|
{
if (StringNoCaseCompare (&Command1, &Command2) == 0) {
return (TRUE);
}
return (FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables bus-mastering on the device and calls pcibios_set_master() to do the needed arch specific settings. */
|
void pci_set_master(struct pci_dev *dev)
|
/* Enables bus-mastering on the device and calls pcibios_set_master() to do the needed arch specific settings. */
void pci_set_master(struct pci_dev *dev)
|
{
__pci_set_master(dev, true);
pcibios_set_master(dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* radix_tree_next_hole may be called under rcu_read_lock. However, like radix_tree_gang_lookup, this will not atomically search a snapshot of the tree at a single point in time. For example, if a hole is created at index 5, then subsequently a hole is created at index 10, radix_tree_next_hole covering both indexes may return 10 if called under rcu_read_lock. */
|
unsigned long radix_tree_next_hole(struct radix_tree_root *root, unsigned long index, unsigned long max_scan)
|
/* radix_tree_next_hole may be called under rcu_read_lock. However, like radix_tree_gang_lookup, this will not atomically search a snapshot of the tree at a single point in time. For example, if a hole is created at index 5, then subsequently a hole is created at index 10, radix_tree_next_hole covering both indexes may return 10 if called under rcu_read_lock. */
unsigned long radix_tree_next_hole(struct radix_tree_root *root, unsigned long index, unsigned long max_scan)
|
{
unsigned long i;
for (i = 0; i < max_scan; i++) {
if (!radix_tree_lookup(root, index))
break;
index++;
if (index == 0)
break;
}
return index;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads the 8-bits of CMOS data at the location specified by Index. The 8-bit read value is returned. */
|
STATIC UINT8 CmosRead8(IN UINTN Index)
|
/* Reads the 8-bits of CMOS data at the location specified by Index. The 8-bit read value is returned. */
STATIC UINT8 CmosRead8(IN UINTN Index)
|
{
IoWrite8 (0x70, (UINT8)Index);
return IoRead8 (0x71);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* ixgbe_atr_set_vm_pool_82599 - Sets the Virtual Machine pool @input: input stream to modify @vm_pool: the Virtual Machine pool to load */
|
s32 ixgbe_atr_set_vm_pool_82599(struct ixgbe_atr_input *input, u8 vm_pool)
|
/* ixgbe_atr_set_vm_pool_82599 - Sets the Virtual Machine pool @input: input stream to modify @vm_pool: the Virtual Machine pool to load */
s32 ixgbe_atr_set_vm_pool_82599(struct ixgbe_atr_input *input, u8 vm_pool)
|
{
input->byte_stream[IXGBE_ATR_VM_POOL_OFFSET] = vm_pool;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ACPI 2.0 chapter 13 access of registers of the EC */
|
static unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
|
/* ACPI 2.0 chapter 13 access of registers of the EC */
static unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
|
{
int timeout = 500;
while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout)
udelay(1);
if (!timeout) {
dev_warn(&smbus->dev->dev,
"Timeout while waiting for IBF to clear\n");
return -ETIMEDOUT;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Find the MFN values from a given FN key. Assumes the complete_reply_hash is already populated. */
|
static guint32 get_mfn_from_fn(guint32 fn)
|
/* Find the MFN values from a given FN key. Assumes the complete_reply_hash is already populated. */
static guint32 get_mfn_from_fn(guint32 fn)
|
{
mfn = val->mfn;
}
return mfn;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Doesn't do a detailed dissection of the lines of the message, just treat as text. */
|
void proto_register_sipfrag(void)
|
/* Doesn't do a detailed dissection of the lines of the message, just treat as text. */
void proto_register_sipfrag(void)
|
{
static hf_register_info hf[] =
{
{ &hf_sipfrag_line,
{ "Line",
"sipfrag.line",FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL
}
},
};
static gint *ett[] =
{
&ett_sipfrag
};
proto_sipfrag = proto_register_protocol("Sipfrag", "SIPFRAG", "sipfrag");
proto_register_field_array(proto_sipfrag, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("sipfrag", dissect_sipfrag, proto_sipfrag);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Enables the EOC on each regular channel conversion. */
|
void ADC_EnableEOCOnEachChannel(ADC_T *adc)
|
/* Enables the EOC on each regular channel conversion. */
void ADC_EnableEOCOnEachChannel(ADC_T *adc)
|
{
adc->CTRL2_B.EOCSEL = BIT_SET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Checks whether the specified ETHERNET DMA Tx Desc flag is set or not. */
|
FlagStatus ETH_GetDmaTxDescFlagStatus(ETH_DMADescType *DMATxDesc, uint32_t ETH_DMATxDescFlag)
|
/* Checks whether the specified ETHERNET DMA Tx Desc flag is set or not. */
FlagStatus ETH_GetDmaTxDescFlagStatus(ETH_DMADescType *DMATxDesc, uint32_t ETH_DMATxDescFlag)
|
{
FlagStatus bitstatus = RESET;
assert_param(IS_ETH_DMATXDESC_GET_FLAG(ETH_DMATxDescFlag));
if ((DMATxDesc->Status & ETH_DMATxDescFlag) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This is mainly a wrapper around driver_register that sets name and bus_type in the embedded struct device_driver correctly. */
|
int css_driver_register(struct css_driver *cdrv)
|
/* This is mainly a wrapper around driver_register that sets name and bus_type in the embedded struct device_driver correctly. */
int css_driver_register(struct css_driver *cdrv)
|
{
cdrv->drv.name = cdrv->name;
cdrv->drv.bus = &css_bus_type;
cdrv->drv.owner = cdrv->owner;
return driver_register(&cdrv->drv);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Copy kernel to iovec. Returns -EFAULT on error. */
|
int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, int offset, int len)
|
/* Copy kernel to iovec. Returns -EFAULT on error. */
int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, int offset, int len)
|
{
int copy;
for (; len > 0; ++iov) {
if (unlikely(offset >= iov->iov_len)) {
offset -= iov->iov_len;
continue;
}
copy = min_t(unsigned int, iov->iov_len - offset, len);
if (copy_to_user(iov->iov_base + offset, kdata, copy))
return -EFAULT;
offset = 0;
kdata += copy;
len -= copy;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* usbhid_quirks_init: apply USB HID quirks specified at module load time */
|
int usbhid_quirks_init(char **quirks_param)
|
/* usbhid_quirks_init: apply USB HID quirks specified at module load time */
int usbhid_quirks_init(char **quirks_param)
|
{
u16 idVendor, idProduct;
u32 quirks;
int n = 0, m;
for (; n < MAX_USBHID_BOOT_QUIRKS && quirks_param[n]; n++) {
m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x",
&idVendor, &idProduct, &quirks);
if (m != 3 ||
usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) {
printk(KERN_WARNING
"Could not parse HID quirk module param %s\n",
quirks_param[n]);
}
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called to respond to a LL control PDU connection parameter request or response. */
|
uint8_t ble_ll_ctrl_conn_param_reply(struct ble_ll_conn_sm *connsm, uint8_t *rsp, struct ble_ll_conn_params *req)
|
/* Called to respond to a LL control PDU connection parameter request or response. */
uint8_t ble_ll_ctrl_conn_param_reply(struct ble_ll_conn_sm *connsm, uint8_t *rsp, struct ble_ll_conn_params *req)
|
{
uint8_t rsp_opcode;
if (connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) {
ble_ll_ctrl_conn_param_pdu_make(connsm, rsp + 1, req);
rsp_opcode = BLE_LL_CTRL_CONN_PARM_RSP;
} else {
ble_ll_ctrl_conn_upd_make(connsm, rsp + 1, req);
rsp_opcode = BLE_LL_CTRL_CONN_UPDATE_IND;
}
return rsp_opcode;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Programs a byte at a specified Option Byte Data address. */
|
FLASH_Status FLASH_ProgramOptionByteData(u32 address, u8 data)
|
/* Programs a byte at a specified Option Byte Data address. */
FLASH_Status FLASH_ProgramOptionByteData(u32 address, u8 data)
|
{
FLASH_Status ret;
__IO u16 temp;
FLASH_OPTB_Enable();
FLASH->CR |= FLASH_CR_OPTPG;
temp = (u16)(~data);
temp = (temp << 8) & 0xFF00;
temp = temp | (u16)data;
address = address & (~0x1);
*(vu16*)address = temp;
ret = FLASH_WaitForLastOperation(ProgramTimeout);
return ret;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* brief Reusable routine to handle master interrupts. note This function does not need to be called unless you are reimplementing the nonblocking API's interrupt handler routines to add special functionality. param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. */
|
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, lpi2c_master_handle_t *handle)
|
/* brief Reusable routine to handle master interrupts. note This function does not need to be called unless you are reimplementing the nonblocking API's interrupt handler routines to add special functionality. param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. */
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, lpi2c_master_handle_t *handle)
|
{
bool isDone;
status_t result;
if (!handle)
{
return;
}
if (handle->state == kIdleState)
{
return;
}
result = LPI2C_RunTransferStateMachine(base, handle, &isDone);
if (isDone || (result != kStatus_Success))
{
LPI2C_MasterDisableInterrupts(base, kMasterIrqFlags);
handle->state = kIdleState;
if (handle->completionCallback)
{
handle->completionCallback(base, handle, result, handle->userData);
}
}
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Reads either a 16- or 32-bit data word from the Local CPU system address */
|
void IPCLiteRtoLDataRead(uint32_t ulFlag, uint32_t ulStatusFlag)
|
/* Reads either a 16- or 32-bit data word from the Local CPU system address */
void IPCLiteRtoLDataRead(uint32_t ulFlag, uint32_t ulStatusFlag)
|
{
uint32_t* pulRAddress;
uint16_t* pusRAddress;
while (!(IpcRegs.IPCSTS.all & ulFlag))
{
}
if (IpcRegs.IPCRECVCOM == IPC_DATA_READ_16)
{
pusRAddress = (uint16_t *)IpcRegs.IPCRECVADDR;
IpcRegs.IPCLOCALREPLY = (uint32_t)(*pusRAddress);
IpcRegs.IPCACK.all |= (ulStatusFlag | ulFlag);
}
else if (IpcRegs.IPCRECVCOM == IPC_DATA_READ_32)
{
pulRAddress = (uint32_t *)IpcRegs.IPCRECVADDR;
IpcRegs.IPCLOCALREPLY = *pulRAddress;
IpcRegs.IPCACK.all |= (ulStatusFlag | ulFlag);
}
else
{
IpcRegs.IPCACK.all |= (ulFlag);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If expression is a constant, fills 'v' with its value and returns 1. Otherwise, returns 0. */
|
int luaK_exp2const(FuncState *fs, const expdesc *e, TValue *v)
|
/* If expression is a constant, fills 'v' with its value and returns 1. Otherwise, returns 0. */
int luaK_exp2const(FuncState *fs, const expdesc *e, TValue *v)
|
{
case VFALSE:
setbfvalue(v);
return 1;
case VTRUE:
setbtvalue(v);
return 1;
case VNIL:
setnilvalue(v);
return 1;
case VKSTR: {
setsvalue(fs->ls->L, v, e->u.strval);
return 1;
}
case VCONST: {
setobj(fs->ls->L, v, const2val(fs, e));
return 1;
}
default: return tonumeral(e, v);
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Obtains the contents of the firmware data segment that was specified by the index parameter. */
|
LIBOPENBLT_EXPORT uint8_t* BltFirmwareGetSegment(uint32_t idx, uint32_t *address, uint32_t *len)
|
/* Obtains the contents of the firmware data segment that was specified by the index parameter. */
LIBOPENBLT_EXPORT uint8_t* BltFirmwareGetSegment(uint32_t idx, uint32_t *address, uint32_t *len)
|
{
uint8_t * result = NULL;
tFirmwareSegment *segmentPtr;
assert(idx < FirmwareGetSegmentCount());
assert(address != NULL);
assert(len != NULL);
if ((address != NULL) && (len != NULL) &&
(idx < FirmwareGetSegmentCount()) )
{
segmentPtr = FirmwareGetSegment(idx);
if (segmentPtr != NULL)
{
*address = segmentPtr->base;
*len = segmentPtr->length;
result = segmentPtr->data;
}
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Fills each ADC_InitStruct member with its default value. */
|
void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
|
/* Fills each ADC_InitStruct member with its default value. */
void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
|
{
ADC_InitStruct->ADC_PRESCARE = ADC_PCLK2_PRESCARE_16;
ADC_InitStruct->ADC_Mode = ADC_Mode_Single;
ADC_InitStruct->ADC_ContinuousConvMode = DISABLE;
ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStruct->ADC_Resolution = ADC_Resolution_12b;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This is called when relaxing access to a PTE. It's also called in the page fault path when we don't hit any of the major fault cases, ie, a minor update of _PAGE_ACCESSED, _PAGE_DIRTY, etc... The generic code will have handled those two for us, we additionally deal with missing execute permission here on some processors */
|
int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address, pte_t *ptep, pte_t entry, int dirty)
|
/* This is called when relaxing access to a PTE. It's also called in the page fault path when we don't hit any of the major fault cases, ie, a minor update of _PAGE_ACCESSED, _PAGE_DIRTY, etc... The generic code will have handled those two for us, we additionally deal with missing execute permission here on some processors */
int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address, pte_t *ptep, pte_t entry, int dirty)
|
{
int changed;
entry = set_access_flags_filter(entry, vma, dirty);
changed = !pte_same(*(ptep), entry);
if (changed) {
if (!(vma->vm_flags & VM_HUGETLB))
assert_pte_locked(vma->vm_mm, address);
__ptep_set_access_flags(ptep, entry);
flush_tlb_page_nohash(vma, address);
}
return changed;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Add the GIC MSI Frame Information to the MADT Table. */
|
STATIC VOID AddGICMsiFrameInfoList(IN EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE *GicMsiFrame, IN CONST CM_ARM_GIC_MSI_FRAME_INFO *GicMsiFrameInfo, IN UINT32 GicMsiFrameCount)
|
/* Add the GIC MSI Frame Information to the MADT Table. */
STATIC VOID AddGICMsiFrameInfoList(IN EFI_ACPI_6_5_GIC_MSI_FRAME_STRUCTURE *GicMsiFrame, IN CONST CM_ARM_GIC_MSI_FRAME_INFO *GicMsiFrameInfo, IN UINT32 GicMsiFrameCount)
|
{
ASSERT (GicMsiFrame != NULL);
ASSERT (GicMsiFrameInfo != NULL);
while (GicMsiFrameCount-- != 0) {
AddGICMsiFrame (GicMsiFrame++, GicMsiFrameInfo++);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Checks whether the FLASH Read Out Protection L2 Status is set or not. */
|
FlagStatus FLASH_GetReadOutProtectionL2STS(void)
|
/* Checks whether the FLASH Read Out Protection L2 Status is set or not. */
FlagStatus FLASH_GetReadOutProtectionL2STS(void)
|
{
FlagStatus readoutstatus = RESET;
if ((FLASH->OBR & RDPRTL2_MSK) != (uint32_t)RESET)
{
readoutstatus = SET;
}
else
{
readoutstatus = RESET;
}
return readoutstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Unfortunately, this has the side effect that a writable INTERNAL_REG_BASE_ADDR is impossible. Oh well. */
|
void my_remap_gt_regs(u32 cur_loc, u32 new_loc)
|
/* Unfortunately, this has the side effect that a writable INTERNAL_REG_BASE_ADDR is impossible. Oh well. */
void my_remap_gt_regs(u32 cur_loc, u32 new_loc)
|
{
u32 temp;
temp = in_le32 ((u32 *) (new_loc + INTERNAL_SPACE_DECODE));
if ((temp & 0xffff) == new_loc >> 16)
return;
temp = (in_le32 ((u32 *) (cur_loc + INTERNAL_SPACE_DECODE)) &
0xffff0000) | (new_loc >> 16);
out_le32 ((u32 *) (cur_loc + INTERNAL_SPACE_DECODE), temp);
while (GTREGREAD (INTERNAL_SPACE_DECODE) != temp);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Given a BPF program, a pcap_pkthdr structure for a packet, and the raw data for the packet, check whether the packet passes the filter. Returns the return value of the filter program, which will be zero if the packet doesn't pass and non-zero if the packet does pass. */
|
int pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h, const u_char *pkt)
|
/* Given a BPF program, a pcap_pkthdr structure for a packet, and the raw data for the packet, check whether the packet passes the filter. Returns the return value of the filter program, which will be zero if the packet doesn't pass and non-zero if the packet does pass. */
int pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h, const u_char *pkt)
|
{
const struct bpf_insn *fcode = fp->bf_insns;
if (fcode != NULL)
return (bpf_filter(fcode, pkt, h->len, h->caplen));
else
return (0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* A socket has left a multicast group on device dev */
|
void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
|
/* A socket has left a multicast group on device dev */
void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
|
{
struct ip_mc_list *i, **ip;
ASSERT_RTNL();
for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
if (i->multiaddr == addr) {
if (--i->users == 0) {
write_lock_bh(&in_dev->mc_list_lock);
*ip = i->next;
in_dev->mc_count--;
write_unlock_bh(&in_dev->mc_list_lock);
igmp_group_dropped(i);
if (!in_dev->dead)
ip_rt_multicast_event(in_dev);
ip_ma_put(i);
return;
}
break;
}
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function returns "start" on success, -ENOMEM on failure. Use cpm_dpram_addr() to get the virtual address of the area. Use cpm_muram_free() to free the allocation. */
|
unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size)
|
/* This function returns "start" on success, -ENOMEM on failure. Use cpm_dpram_addr() to get the virtual address of the area. Use cpm_muram_free() to free the allocation. */
unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size)
|
{
unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_muram_lock, flags);
cpm_muram_info.alignment = 1;
start = rh_alloc_fixed(&cpm_muram_info, offset, size, "commproc");
spin_unlock_irqrestore(&cpm_muram_lock, flags);
return start;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Wait negotiated minimum turn around time, this function actually sets the number of BOS's that must be sent before the next transmitted frame in order to delay for the specified amount of time. This is done to avoid using timers, and the forbidden udelay! */
|
void irlap_wait_min_turn_around(struct irlap_cb *self, struct qos_info *qos)
|
/* Wait negotiated minimum turn around time, this function actually sets the number of BOS's that must be sent before the next transmitted frame in order to delay for the specified amount of time. This is done to avoid using timers, and the forbidden udelay! */
void irlap_wait_min_turn_around(struct irlap_cb *self, struct qos_info *qos)
|
{
__u32 min_turn_time;
__u32 speed;
speed = qos->baud_rate.value;
min_turn_time = qos->min_turn_time.value;
if (speed > 115200) {
self->mtt_required = min_turn_time;
return;
}
self->xbofs_delay = irlap_min_turn_time_in_bytes(speed, min_turn_time);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
|
void MY_LED_Init(void)
|
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
void MY_LED_Init(void)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2, GPIO_PIN_SET);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* LVM calls this function before a (read-only) snapshot is created. This gives us a chance to flush the journal completely and mark the fs clean. */
|
static int ext4_freeze(struct super_block *sb)
|
/* LVM calls this function before a (read-only) snapshot is created. This gives us a chance to flush the journal completely and mark the fs clean. */
static int ext4_freeze(struct super_block *sb)
|
{
int error = 0;
journal_t *journal;
if (sb->s_flags & MS_RDONLY)
return 0;
journal = EXT4_SB(sb)->s_journal;
jbd2_journal_lock_updates(journal);
error = jbd2_journal_flush(journal);
if (error < 0) {
out:
jbd2_journal_unlock_updates(journal);
return error;
}
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
error = ext4_commit_super(sb, 1);
if (error)
goto out;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if the UARTx is busy or not.
@method UART_IsBusy */
|
Boolean UART_IsBusy(UART_TypeDef *UARTx)
|
/* Check if the UARTx is busy or not.
@method UART_IsBusy */
Boolean UART_IsBusy(UART_TypeDef *UARTx)
|
{
_ASSERT(IS_UART(UARTx));
return (Boolean)(!(UARTx->STATUS.bit.RX_EMPTY));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This registers the passed in @drv. Any devices matching the id table will automatically be populated and handed off to the driver's specified probe routine. */
|
int superhyway_register_driver(struct superhyway_driver *drv)
|
/* This registers the passed in @drv. Any devices matching the id table will automatically be populated and handed off to the driver's specified probe routine. */
int superhyway_register_driver(struct superhyway_driver *drv)
|
{
drv->drv.name = drv->name;
drv->drv.bus = &superhyway_bus_type;
return driver_register(&drv->drv);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the display top left drawing limit.
Use this function to set the top left limit of the drawing limit box. */
|
void ili9488_set_top_left_limit(ili9488_coord_t x, ili9488_coord_t y)
|
/* Set the display top left drawing limit.
Use this function to set the top left limit of the drawing limit box. */
void ili9488_set_top_left_limit(ili9488_coord_t x, ili9488_coord_t y)
|
{
limit_start_x = x;
limit_start_y = y;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Apply a single relocation of type @type at @addr. This function is intentionally simple, and does the bare minimum needed to fixup the relocated U-Boot - in particular, it does not check for overflows. */
|
static void apply_reloc(unsigned int type, void *addr, long off)
|
/* Apply a single relocation of type @type at @addr. This function is intentionally simple, and does the bare minimum needed to fixup the relocated U-Boot - in particular, it does not check for overflows. */
static void apply_reloc(unsigned int type, void *addr, long off)
|
{
uint32_t u32;
switch (type) {
case R_MIPS_26:
u32 = *(uint32_t *)addr;
u32 = (u32 & GENMASK(31, 26)) |
((u32 + (off >> 2)) & GENMASK(25, 0));
*(uint32_t *)addr = u32;
break;
case R_MIPS_32:
*(uint32_t *)addr += off;
break;
case R_MIPS_64:
*(uint64_t *)addr += off;
break;
case R_MIPS_HI16:
*(uint32_t *)addr += off >> 16;
break;
default:
panic("Unhandled reloc type %u\n", type);
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Get next available HCI Data Package from the input-copy queue. */
|
static void le_data_read(uint16_t size)
|
/* Get next available HCI Data Package from the input-copy queue. */
static void le_data_read(uint16_t size)
|
{
uint16_t response = sys_cpu_to_le16(CMD_LE_DATA_READ_RSP);
struct net_buf *buf;
read_excess_bytes(size);
size = 0;
edtt_write((uint8_t *)&response, sizeof(response), EDTTT_BLOCK);
buf = net_buf_get(&data_queue, K_FOREVER);
if (buf) {
size = sys_cpu_to_le16(buf->len);
edtt_write((uint8_t *)&size, sizeof(size), EDTTT_BLOCK);
edtt_write((uint8_t *)buf->data, buf->len, EDTTT_BLOCK);
net_buf_unref(buf);
} else {
edtt_write((uint8_t *)&size, sizeof(size), EDTTT_BLOCK);
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* User-defined threshold value for Tap/Double Tap event. 1 LSB = full scale/128. */
|
int32_t lis2dh12_tap_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* User-defined threshold value for Tap/Double Tap event. 1 LSB = full scale/128. */
int32_t lis2dh12_tap_threshold_set(stmdev_ctx_t *ctx, uint8_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.ths = val;
ret = lis2dh12_write_reg(ctx, LIS2DH12_CLICK_THS,
(uint8_t *)&click_ths, 1);
}
return ret;
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* If ServiceBindingGuid is NULL, then ASSERT(). If ChildHandle is NULL, then ASSERT(). */
|
EFI_STATUS EFIAPI NetLibCreateServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN OUT EFI_HANDLE *ChildHandle)
|
/* If ServiceBindingGuid is NULL, then ASSERT(). If ChildHandle is NULL, then ASSERT(). */
EFI_STATUS EFIAPI NetLibCreateServiceChild(IN EFI_HANDLE Controller, IN EFI_HANDLE Image, IN EFI_GUID *ServiceBindingGuid, IN OUT EFI_HANDLE *ChildHandle)
|
{
EFI_STATUS Status;
EFI_SERVICE_BINDING_PROTOCOL *Service;
ASSERT ((ServiceBindingGuid != NULL) && (ChildHandle != NULL));
Status = gBS->OpenProtocol (
Controller,
ServiceBindingGuid,
(VOID **)&Service,
Image,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = Service->CreateChild (Service, ChildHandle);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set the reload value of RXPOSTC and control of RXTC. */
|
void SGPIO_RXPosConfig(SGPIO_TypeDef *SGPIOx, u32 SGPIO_PosRstVal, u32 SGPIO_RXPOSCtl)
|
/* Set the reload value of RXPOSTC and control of RXTC. */
void SGPIO_RXPosConfig(SGPIO_TypeDef *SGPIOx, u32 SGPIO_PosRstVal, u32 SGPIO_RXPOSCtl)
|
{
u32 TempVal;
assert_param(IS_SGPIO_ALL_PERIPH(SGPIOx));
assert_param(SGPIO_PosRstVal <= 0x1f);
TempVal = SGPIOx->SGPIO_RXMC_CTRL;
TempVal &= (~BIT_SGPIO_RX_POS_CTRL);
TempVal |= SGPIO_RXPOSCtl;
SGPIOx->SGPIO_RXMC_CTRL = TempVal;
TempVal = SGPIOx->SGPIO_RXPOSR;
TempVal &= (~BIT_SGPIO_RXPOSRST);
TempVal |= (SGPIO_PosRstVal << 8);
SGPIOx->SGPIO_RXPOSR = TempVal;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* FIX: POSIX 1003.1g is very ambiguous here. It states that asynchronous errors should be reported by getsockopt. We assume this means if you specify SO_ERROR (otherwise whats the point of it). */
|
int sock_common_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
|
/* FIX: POSIX 1003.1g is very ambiguous here. It states that asynchronous errors should be reported by getsockopt. We assume this means if you specify SO_ERROR (otherwise whats the point of it). */
int sock_common_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
|
{
struct sock *sk = sock->sk;
return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Puts HMAC-SHA2 digest of packet data (except for the bytes where this digest will be stored) into that packet. */
|
static int rtmp_handshake_imprint_with_digest(uint8_t *buf)
|
/* Puts HMAC-SHA2 digest of packet data (except for the bytes where this digest will be stored) into that packet. */
static int rtmp_handshake_imprint_with_digest(uint8_t *buf)
|
{
int i, digest_pos = 0;
for (i = 8; i < 12; i++)
digest_pos += buf[i];
digest_pos = (digest_pos % 728) + 12;
rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
rtmp_player_key, PLAYER_KEY_OPEN_PART_LEN,
buf + digest_pos);
return digest_pos;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* brief Return Frequency of DMIC clock return Frequency of DMIC Clock */
|
uint32_t CLOCK_GetDmicClkFreq(void)
|
/* brief Return Frequency of DMIC clock return Frequency of DMIC Clock */
uint32_t CLOCK_GetDmicClkFreq(void)
|
{
uint32_t freq = 0U;
switch (SYSCON->DMICFCLKSEL)
{
case 0U:
freq = CLOCK_GetCoreSysClkFreq();
break;
case 1U:
freq = CLOCK_GetPll0OutFreq();
break;
case 2U:
freq = CLOCK_GetExtClkFreq();
break;
case 3U:
freq = CLOCK_GetFroHfFreq();
break;
case 4U:
freq = CLOCK_GetPll1OutFreq();
break;
case 5U:
freq = CLOCK_GetI2SMClkFreq();
break;
default:
freq = 0U;
break;
}
return freq / ((SYSCON->DMICFCLKDIV & SYSCON_DMICFCLKDIV_DIV_MASK) + 1U);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Configures the CAN_Basic reception filter according to the specified parameters in the basic_filter_init_struct. */
|
void CAN_FilterInit(CAN_Basic_FilterInitTypeDef *basic_filter_init_struct)
|
/* Configures the CAN_Basic reception filter according to the specified parameters in the basic_filter_init_struct. */
void CAN_FilterInit(CAN_Basic_FilterInitTypeDef *basic_filter_init_struct)
|
{
CAN1->ACR = basic_filter_init_struct->CAN_FilterId;
CAN1->AMR = basic_filter_init_struct->CAN_FilterMaskId;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* RETURNS: Pointer to @sd on success, NULL on failure. */
|
static struct sysfs_dirent* sysfs_get_active(struct sysfs_dirent *sd)
|
/* RETURNS: Pointer to @sd on success, NULL on failure. */
static struct sysfs_dirent* sysfs_get_active(struct sysfs_dirent *sd)
|
{
if (unlikely(!sd))
return NULL;
while (1) {
int v, t;
v = atomic_read(&sd->s_active);
if (unlikely(v < 0))
return NULL;
t = atomic_cmpxchg(&sd->s_active, v, v + 1);
if (likely(t == v)) {
rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_);
return sd;
}
if (t < 0)
return NULL;
cpu_relax();
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns 0 on success, or negative on failure. */
|
int pci_iov_init(struct pci_dev *dev)
|
/* Returns 0 on success, or negative on failure. */
int pci_iov_init(struct pci_dev *dev)
|
{
int pos;
if (!pci_is_pcie(dev))
return -ENODEV;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV);
if (pos)
return sriov_init(dev, pos);
return -ENODEV;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* receive a data packet from the USB device */
|
usbh_status usbh_data_recev(usb_core_driver *pudev, uint8_t *buf, uint8_t pp_num, uint16_t len)
|
/* receive a data packet from the USB device */
usbh_status usbh_data_recev(usb_core_driver *pudev, uint8_t *buf, uint8_t pp_num, uint16_t len)
|
{
usb_pipe *pp = &pudev->host.pipe[pp_num];
pp->xfer_buf = buf;
pp->xfer_len = len;
switch (pp->ep.type) {
case USB_EPTYPE_CTRL:
pp->DPID = PIPE_DPID[1];
break;
case USB_EPTYPE_INTR:
pp->DPID = PIPE_DPID[pp->data_toggle_in];
pp->data_toggle_in ^= 1U;
break;
case USB_EPTYPE_BULK:
pp->DPID = PIPE_DPID[pp->data_toggle_in];
break;
case USB_EPTYPE_ISOC:
pp->DPID = PIPE_DPID[0];
break;
default:
break;
}
usbh_request_submit (pudev, pp_num);
return USBH_OK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Given an initialised but unloaded journal struct, poke about in the on-disk structure to update it to the most recent supported version. */
|
int jbd2_journal_update_format(journal_t *journal)
|
/* Given an initialised but unloaded journal struct, poke about in the on-disk structure to update it to the most recent supported version. */
int jbd2_journal_update_format(journal_t *journal)
|
{
journal_superblock_t *sb;
int err;
err = journal_get_superblock(journal);
if (err)
return err;
sb = journal->j_superblock;
switch (be32_to_cpu(sb->s_header.h_blocktype)) {
case JBD2_SUPERBLOCK_V2:
return 0;
case JBD2_SUPERBLOCK_V1:
return journal_convert_superblock_v1(journal, sb);
default:
break;
}
return -EINVAL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* set the SSL context verifying of the SSL context */
|
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int(*verify_callback)(int, X509_STORE_CTX *))
|
/* set the SSL context verifying of the SSL context */
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int(*verify_callback)(int, X509_STORE_CTX *))
|
{
SSL_ASSERT3(ctx);
ctx->verify_mode = mode;
ctx->default_verify_callback = verify_callback;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Setup sdma interrupt. This function attach sdma_interrupt_handler to system and set the isr for every single channel to default one. */
|
void sdma_setup_interrupt(void)
|
/* Setup sdma interrupt. This function attach sdma_interrupt_handler to system and set the isr for every single channel to default one. */
void sdma_setup_interrupt(void)
|
{
register_interrupt_routine(IMX_INT_SDMA, sdma_interrupt_handler);
uint32_t i;
for (i = 0; i < SDMA_NUM_CHANNELS; i++) {
sdma_channel_isr_list[i] = sdma_channel_default_isr;
}
enable_interrupt(IMX_INT_SDMA, CPU_0, 0);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If this interface is not supported, then return zero. */
|
UINTN EFIAPI Sha1GetContextSize(VOID)
|
/* If this interface is not supported, then return zero. */
UINTN EFIAPI Sha1GetContextSize(VOID)
|
{
CALL_CRYPTO_SERVICE (Sha1GetContextSize, (), 0);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Utility to change a property on all regulators simultaneously. */
|
void pmu_set_all_property(pmu_property_t selector, const void *value)
|
/* Utility to change a property on all regulators simultaneously. */
void pmu_set_all_property(pmu_property_t selector, const void *value)
|
{
unsigned regulator;
for (regulator = kPMURegulator_1p1; regulator <= kPMURegulator_SoC; ++regulator)
{
pmu_get_regulator(static_cast<pmu_regulators_t>(regulator)).setProperty(selector, value);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If MenuNumber is great or equal to the number of Menu Entry in the list, then ASSERT. */
|
MENU_ENTRY* LibGetMenuEntry(MENU_OPTION *MenuOption, UINTN MenuNumber)
|
/* If MenuNumber is great or equal to the number of Menu Entry in the list, then ASSERT. */
MENU_ENTRY* LibGetMenuEntry(MENU_OPTION *MenuOption, UINTN MenuNumber)
|
{
MENU_ENTRY *NewMenuEntry;
UINTN Index;
LIST_ENTRY *List;
ASSERT (MenuNumber < MenuOption->MenuNumber);
List = MenuOption->Head.ForwardLink;
for (Index = 0; Index < MenuNumber; Index++) {
List = List->ForwardLink;
}
NewMenuEntry = CR (List, MENU_ENTRY, Link, MENU_ENTRY_SIGNATURE);
return NewMenuEntry;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer. param callback FlexIO I2S eDMA callback function called while finished a block. param userData User parameter for callback. param dmaHandle eDMA handle for FlexIO I2S. This handle is a static value allocated by users. */
|
void FLEXIO_I2S_TransferTxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
|
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer. param callback FlexIO I2S eDMA callback function called while finished a block. param userData User parameter for callback. param dmaHandle eDMA handle for FlexIO I2S. This handle is a static value allocated by users. */
void FLEXIO_I2S_TransferTxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
|
{
assert(handle && dmaHandle);
memset(handle, 0, sizeof(*handle));
handle->dmaHandle = dmaHandle;
handle->callback = callback;
handle->userData = userData;
handle->state = kFLEXIO_I2S_Idle;
s_edmaPrivateHandle[0].base = base;
s_edmaPrivateHandle[0].handle = handle;
EDMA_InstallTCDMemory(dmaHandle, STCD_ADDR(handle->tcd), FLEXIO_I2S_XFER_QUEUE_SIZE);
EDMA_SetCallback(dmaHandle, FLEXIO_I2S_TxEDMACallback, &s_edmaPrivateHandle[0]);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get Wakeup Flag.
The wakeup flag is set when a wakeup event has been received. It is cleared by software (see */
|
bool pwr_get_wakeup_flag(void)
|
/* Get Wakeup Flag.
The wakeup flag is set when a wakeup event has been received. It is cleared by software (see */
bool pwr_get_wakeup_flag(void)
|
{
return PWR_CSR & PWR_CSR_WUF;
}
/**@}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Return the child objects buffer from AML Handle's buffer. */
|
EFI_STATUS AmlGetChildFromObjectBuffer(IN EFI_AML_HANDLE *AmlParentHandle, IN UINT8 *CurrentBuffer, OUT VOID **Buffer)
|
/* Return the child objects buffer from AML Handle's buffer. */
EFI_STATUS AmlGetChildFromObjectBuffer(IN EFI_AML_HANDLE *AmlParentHandle, IN UINT8 *CurrentBuffer, OUT VOID **Buffer)
|
{
AML_BYTE_ENCODING *AmlByteEncoding;
UINTN DataSize;
while ((UINTN)CurrentBuffer < (UINTN)(AmlParentHandle->Buffer + AmlParentHandle->Size)) {
AmlByteEncoding = AmlSearchByOpByte (CurrentBuffer);
if (AmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
if ((AmlByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0) {
*Buffer = CurrentBuffer;
return EFI_SUCCESS;
}
DataSize = AmlGetObjectSize (
AmlByteEncoding,
CurrentBuffer,
(UINTN)AmlParentHandle->Buffer + AmlParentHandle->Size - (UINTN)CurrentBuffer
);
if (DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
CurrentBuffer += DataSize;
}
*Buffer = NULL;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* qint_destroy_obj(): Free all memory allocated by a QInt object */
|
static void qint_destroy_obj(QObject *obj)
|
/* qint_destroy_obj(): Free all memory allocated by a QInt object */
static void qint_destroy_obj(QObject *obj)
|
{
assert(obj != NULL);
g_free(qobject_to_qint(obj));
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* ufshcd_is_device_present - Check if any device connected to the host controller */
|
static bool ufshcd_is_device_present(struct ufs_hba *hba)
|
/* ufshcd_is_device_present - Check if any device connected to the host controller */
static bool ufshcd_is_device_present(struct ufs_hba *hba)
|
{
return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) &
DEVICE_PRESENT) ? true : false;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Delete given attribute and deallocate all its memory */
|
static void __irias_delete_attrib(struct ias_attrib *attrib)
|
/* Delete given attribute and deallocate all its memory */
static void __irias_delete_attrib(struct ias_attrib *attrib)
|
{
IRDA_ASSERT(attrib != NULL, return;);
IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;);
kfree(attrib->name);
irias_delete_value(attrib->value);
attrib->magic = ~IAS_ATTRIB_MAGIC;
kfree(attrib);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Setup the input buffer state to scan the given bytes. The next call to yylex() will scan from a */
|
YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len)
|
/* Setup the input buffer state to scan the given bytes. The next call to yylex() will scan from a */
YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len)
|
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
n = (yy_size_t) (_yybytes_len + 2);
buf = (char *) yyalloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
b->yy_is_our_buffer = 1;
return b;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.