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: (transfer none): the invocation hint of the innermost signal emission. */
|
GSignalInvocationHint* g_signal_get_invocation_hint(gpointer instance)
|
/* Returns: (transfer none): the invocation hint of the innermost signal emission. */
GSignalInvocationHint* g_signal_get_invocation_hint(gpointer instance)
|
{
Emission *emission = NULL;
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE (instance), NULL);
SIGNAL_LOCK ();
emission = emission_find_innermost (instance);
SIGNAL_UNLOCK ();
return emission ? &emission->ihint : NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Receives data from the connected socket. Use after successful curl_easy_perform() with CURLOPT_CONNECT_ONLY option. Returns CURLE_OK on success, error code on error. */
|
CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen, size_t *n)
|
/* Receives data from the connected socket. Use after successful curl_easy_perform() with CURLOPT_CONNECT_ONLY option. Returns CURLE_OK on success, error code on error. */
CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen, size_t *n)
|
{
curl_socket_t sfd;
CURLcode result;
ssize_t n1;
struct connectdata *c;
if(Curl_is_in_callback(data))
return CURLE_RECURSIVE_API_CALL;
result = easy_connection(data, &sfd, &c);
if(result)
return result;
*n = 0;
result = Curl_read(c, sfd, buffer, buflen, &n1);
if(result)
return result;
*n = (size_t)n1;
return CURLE_OK;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
{
if(huart->Instance==LPUART1)
{
__HAL_RCC_LPUART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_7|GPIO_PIN_8);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* A value of "0" will results in 2^64 loops. */
|
void sdelay(unsigned long loops)
|
/* A value of "0" will results in 2^64 loops. */
void sdelay(unsigned long loops)
|
{
__asm__ volatile ("1:\n" "subs %0, %0, #1\n"
"b.ne 1b" : "=r" (loops) : "0"(loops) : "cc");
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* If namespace bits don't match return 0. If all match then return 1. */
|
STATIC int xfs_attr_namesp_match(int arg_flags, int ondisk_flags)
|
/* If namespace bits don't match return 0. If all match then return 1. */
STATIC int xfs_attr_namesp_match(int arg_flags, int ondisk_flags)
|
{
return XFS_ATTR_NSP_ONDISK(ondisk_flags) == XFS_ATTR_NSP_ARGS_TO_ONDISK(arg_flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check whether expression 'e' is a literal integer or float in proper range to fit in a register (sB or sC). */
|
static int isSCnumber(expdesc *e, int *pi, int *isfloat)
|
/* Check whether expression 'e' is a literal integer or float in proper range to fit in a register (sB or sC). */
static int isSCnumber(expdesc *e, int *pi, int *isfloat)
|
{
*pi = int2sC(cast_int(i));
return 1;
}
else
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Enable an IOS Access Interrupt.
This function may be used to enable an interrupt to the NVIC. */
|
void am_hal_ios_access_int_enable(uint32_t ui32Interrupt)
|
/* Enable an IOS Access Interrupt.
This function may be used to enable an interrupt to the NVIC. */
void am_hal_ios_access_int_enable(uint32_t ui32Interrupt)
|
{
AM_REG(IOSLAVE, REGACCINTEN) |= ui32Interrupt;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If trans is not null, we'll do a friendly check for a transaction that is already flushing things and force the IO down ourselves. */
|
int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode)
|
/* If trans is not null, we'll do a friendly check for a transaction that is already flushing things and force the IO down ourselves. */
int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode)
|
{
u64 last_mod;
last_mod = max(BTRFS_I(inode)->generation, BTRFS_I(inode)->last_trans);
if (last_mod < root->fs_info->last_trans_committed)
return 0;
if (trans && root->fs_info->running_transaction->blocked) {
btrfs_wait_ordered_range(inode, 0, (u64)-1);
return 0;
}
spin_lock(&root->fs_info->ordered_extent_lock);
if (list_empty(&BTRFS_I(inode)->ordered_operations)) {
list_add_tail(&BTRFS_I(inode)->ordered_operations,
&root->fs_info->ordered_operations);
}
spin_unlock(&root->fs_info->ordered_extent_lock);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @handle: handle of the loaded image @systable: system table */
|
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
|
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
|
{
efi_status_t ret;
boottime = systable->boottime;
notification_count = 0;
ret = boottime->create_event(EVT_SIGNAL_EXIT_BOOT_SERVICES,
TPL_CALLBACK, notify,
(void *)¬ification_count,
&event_notify);
if (ret != EFI_SUCCESS) {
efi_st_error("could not create event\n");
return EFI_ST_FAILURE;
}
return EFI_ST_SUCCESS;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* The function check if the specified Attr is set. */
|
STATIC BOOLEAN AmdMemEncryptionAttrCheck(IN UINT64 CurrentAttr, IN CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr)
|
/* The function check if the specified Attr is set. */
STATIC BOOLEAN AmdMemEncryptionAttrCheck(IN UINT64 CurrentAttr, IN CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr)
|
{
switch (Attr) {
case CCAttrAmdSev:
return CurrentAttr >= CCAttrAmdSev;
case CCAttrAmdSevEs:
return CurrentAttr >= CCAttrAmdSevEs;
case CCAttrAmdSevSnp:
return CurrentAttr == CCAttrAmdSevSnp;
default:
return FALSE;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base CRC peripheral address. param data Input data stream, MSByte in data. param dataSize Size of the input data buffer in bytes. */
|
void CRC_WriteData(CRC_Type *base, const uint8_t *data, size_t dataSize)
|
/* param base CRC peripheral address. param data Input data stream, MSByte in data. param dataSize Size of the input data buffer in bytes. */
void CRC_WriteData(CRC_Type *base, const uint8_t *data, size_t dataSize)
|
{
const uint32_t *data32;
while ((0U != dataSize) && (0U != ((uint32_t)data & 3U)))
{
*((__O uint8_t *)&(base->WR_DATA)) = *data;
data++;
dataSize--;
}
data32 = (const uint32_t *)(uint32_t)data;
while (dataSize >= sizeof(uint32_t))
{
*((__O uint32_t *)&(base->WR_DATA)) = *data32;
data32++;
dataSize -= sizeof(uint32_t);
}
data = (const uint8_t *)data32;
while (0U != dataSize)
{
*((__O uint8_t *)&(base->WR_DATA)) = *data;
data++;
dataSize--;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read length bytes from metadata position <block, offset> (block is the start of the compressed block on disk, and offset is the offset into the block once decompressed). Data is packed into consecutive blocks, and length bytes may require reading more than one block. */
|
int squashfs_read_metadata(struct super_block *sb, void *buffer, u64 *block, int *offset, int length)
|
/* Read length bytes from metadata position <block, offset> (block is the start of the compressed block on disk, and offset is the offset into the block once decompressed). Data is packed into consecutive blocks, and length bytes may require reading more than one block. */
int squashfs_read_metadata(struct super_block *sb, void *buffer, u64 *block, int *offset, int length)
|
{
struct squashfs_sb_info *msblk = sb->s_fs_info;
int bytes, copied = length;
struct squashfs_cache_entry *entry;
TRACE("Entered squashfs_read_metadata [%llx:%x]\n", *block, *offset);
while (length) {
entry = squashfs_cache_get(sb, msblk->block_cache, *block, 0);
if (entry->error)
return entry->error;
else if (*offset >= entry->length)
return -EIO;
bytes = squashfs_copy_data(buffer, entry, *offset, length);
if (buffer)
buffer += bytes;
length -= bytes;
*offset += bytes;
if (*offset == entry->length) {
*block = entry->next_index;
*offset = 0;
}
squashfs_cache_put(entry);
}
return copied;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Removes an element, without calling its destroy notifier. */
|
gpointer g_datalist_id_remove_no_notify(GData **datalist, GQuark key_id)
|
/* Removes an element, without calling its destroy notifier. */
gpointer g_datalist_id_remove_no_notify(GData **datalist, GQuark key_id)
|
{
gpointer ret_data = NULL;
g_return_val_if_fail (datalist != NULL, NULL);
if (key_id)
ret_data = g_data_set_internal (datalist, key_id, NULL, (GDestroyNotify) 42, NULL);
return ret_data;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Caution: This function may receive untrusted input. The data size is external input, so this function will validate it carefully to avoid buffer overflow. */
|
EFI_STATUS EFIAPI RuntimeServiceGetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data)
|
/* Caution: This function may receive untrusted input. The data size is external input, so this function will validate it carefully to avoid buffer overflow. */
EFI_STATUS EFIAPI RuntimeServiceGetVariable(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data)
|
{
EFI_STATUS Status;
if ((VariableName == NULL) || (VendorGuid == NULL) || (DataSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (VariableName[0] == 0) {
return EFI_NOT_FOUND;
}
AcquireLockOnlyAtBootTime (&mVariableServicesLock);
if (FeaturePcdGet (PcdEnableVariableRuntimeCache)) {
Status = FindVariableInRuntimeCache (VariableName, VendorGuid, Attributes, DataSize, Data);
} else {
Status = FindVariableInSmm (VariableName, VendorGuid, Attributes, DataSize, Data);
}
ReleaseLockOnlyAtBootTime (&mVariableServicesLock);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* add_bufferf() add the formatted input to the buffer. */
|
CURLcode Curl_add_bufferf(Curl_send_buffer **inp, const char *fmt,...)
|
/* add_bufferf() add the formatted input to the buffer. */
CURLcode Curl_add_bufferf(Curl_send_buffer **inp, const char *fmt,...)
|
{
char *s;
va_list ap;
Curl_send_buffer *in = *inp;
va_start(ap, fmt);
s = vaprintf(fmt, ap);
va_end(ap);
if(s) {
CURLcode result = Curl_add_buffer(inp, s, strlen(s));
free(s);
return result;
}
free(in->buffer);
free(in);
*inp = NULL;
return CURLE_OUT_OF_MEMORY;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Make a object permanently as gray-colored so that it can no longer be reported as a leak. This is used in general to mark a false positive. */
|
static void make_gray_object(unsigned long ptr)
|
/* Make a object permanently as gray-colored so that it can no longer be reported as a leak. This is used in general to mark a false positive. */
static void make_gray_object(unsigned long ptr)
|
{
paint_ptr(ptr, KMEMLEAK_GREY);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* retrieve the contents of MN10300 userspace FPU registers */
|
static int fpuregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
|
/* retrieve the contents of MN10300 userspace FPU registers */
static int fpuregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
|
{
const struct fpu_state_struct *fpregs = &target->thread.fpu_state;
int ret;
unlazy_fpu(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
fpregs, 0, sizeof(*fpregs));
if (ret < 0)
return ret;
return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
sizeof(*fpregs), -1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base peripheral base address. return Mask of asserted status flags. See to "_dcdc_status_flags_t". */
|
uint32_t DCDC_GetstatusFlags(DCDC_Type *base)
|
/* param base peripheral base address. return Mask of asserted status flags. See to "_dcdc_status_flags_t". */
uint32_t DCDC_GetstatusFlags(DCDC_Type *base)
|
{
uint32_t tmp32 = 0U;
if (DCDC_REG0_STS_DC_OK_MASK == (DCDC_REG0_STS_DC_OK_MASK & base->REG0))
{
tmp32 |= kDCDC_LockedOKStatus;
}
return tmp32;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Convert one Null-terminated ASCII string to EFI_IPv6_ADDRESS. The format of the string is defined in RFC 4291 - Text Representation of Addresses. */
|
EFI_STATUS EFIAPI NetLibAsciiStrToIp6(IN CONST CHAR8 *String, OUT EFI_IPv6_ADDRESS *Ip6Address)
|
/* Convert one Null-terminated ASCII string to EFI_IPv6_ADDRESS. The format of the string is defined in RFC 4291 - Text Representation of Addresses. */
EFI_STATUS EFIAPI NetLibAsciiStrToIp6(IN CONST CHAR8 *String, OUT EFI_IPv6_ADDRESS *Ip6Address)
|
{
RETURN_STATUS Status;
CHAR8 *EndPointer;
Status = AsciiStrToIpv6Address (String, &EndPointer, Ip6Address, NULL);
if (RETURN_ERROR (Status) || (*EndPointer != '\0')) {
return EFI_INVALID_PARAMETER;
} else {
return EFI_SUCCESS;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* install a process keyring directly to a credentials struct */
|
int install_process_keyring_to_cred(struct cred *new)
|
/* install a process keyring directly to a credentials struct */
int install_process_keyring_to_cred(struct cred *new)
|
{
struct key *keyring;
int ret;
if (new->tgcred->process_keyring)
return -EEXIST;
keyring = keyring_alloc("_pid", new->uid, new->gid,
new, KEY_ALLOC_QUOTA_OVERRUN, NULL);
if (IS_ERR(keyring))
return PTR_ERR(keyring);
spin_lock_irq(&new->tgcred->lock);
if (!new->tgcred->process_keyring) {
new->tgcred->process_keyring = keyring;
keyring = NULL;
ret = 0;
} else {
ret = -EEXIST;
}
spin_unlock_irq(&new->tgcred->lock);
key_put(keyring);
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Decodes the message length according to the MQTT algorithm, non-blocking */
|
static int MQTTPacket_decodenb(MQTTTransport *trp)
|
/* Decodes the message length according to the MQTT algorithm, non-blocking */
static int MQTTPacket_decodenb(MQTTTransport *trp)
|
{
unsigned char c;
int rc = MQTTPACKET_READ_ERROR;
FUNC_ENTRY;
if(trp->len == 0){
trp->multiplier = 1;
trp->rem_len = 0;
}
do {
int frc;
if (++(trp->len) > MAX_NO_OF_REMAINING_LENGTH_BYTES)
goto exit;
if ((frc=(*trp->getfn)(trp->sck, &c, 1)) == -1)
goto exit;
if (frc == 0){
rc = 0;
goto exit;
}
trp->rem_len += (c & 127) * trp->multiplier;
trp->multiplier *= 128;
} while ((c & 128) != 0);
rc = trp->len;
exit:
FUNC_EXIT_RC(rc);
return rc;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Return the cast type (Unicast/Broadcast) specific to an interface. All the addresses are host byte ordered. */
|
INTN Ip4GetNetCast(IN IP4_ADDR IpAddr, IN IP4_INTERFACE *IpIf)
|
/* Return the cast type (Unicast/Broadcast) specific to an interface. All the addresses are host byte ordered. */
INTN Ip4GetNetCast(IN IP4_ADDR IpAddr, IN IP4_INTERFACE *IpIf)
|
{
if (IpAddr == IpIf->Ip) {
return IP4_LOCAL_HOST;
} else if (IpAddr == IpIf->SubnetBrdcast) {
return IP4_SUBNET_BROADCAST;
} else if (IpAddr == IpIf->NetBrdcast) {
return IP4_NET_BROADCAST;
}
return 0;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Write a string of bytes through the software UART. */
|
int32_t swuart_write_string(struct swuart_dev *dev, uint8_t *string, uint32_t size)
|
/* Write a string of bytes through the software UART. */
int32_t swuart_write_string(struct swuart_dev *dev, uint8_t *string, uint32_t size)
|
{
uint32_t i;
int32_t check;
for(i = 0; i < size; i++) {
check = swuart_write_char(dev, &string[i]);
if(check != 0)
return check;
swuart_delay(dev, dev->half_period);
swuart_delay(dev, dev->half_period);
}
return 0;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Reads and returns the current value of CR0. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
|
UINTN EFIAPI AsmReadCr0(VOID)
|
/* Reads and returns the current value of CR0. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadCr0(VOID)
|
{
UINTN Data;
__asm__ __volatile__ (
"movl %%cr0,%0"
: "=a" (Data)
);
return Data;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Drain the FIFO and device of any stuck data following a command failing to complete. In some cases this is neccessary before a reset will recover the device. */
|
void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc)
|
/* Drain the FIFO and device of any stuck data following a command failing to complete. In some cases this is neccessary before a reset will recover the device. */
void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc)
|
{
int count;
struct ata_port *ap;
if (qc == NULL || qc->dma_dir == DMA_TO_DEVICE)
return;
ap = qc->ap;
for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ)
&& count++ < 65536;)
ioread8(ap->ioaddr.data_addr);
if (count)
ata_port_printk(ap, KERN_WARNING, "drained %d bytes to clear DRQ.\n",
count);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Since we're most likely to be called by dentry_iput(), we only use the dentry to find the sillydelete. We then copy the name into the qstr. */
|
void nfs_complete_unlink(struct dentry *dentry, struct inode *inode)
|
/* Since we're most likely to be called by dentry_iput(), we only use the dentry to find the sillydelete. We then copy the name into the qstr. */
void nfs_complete_unlink(struct dentry *dentry, struct inode *inode)
|
{
struct nfs_unlinkdata *data = NULL;
spin_lock(&dentry->d_lock);
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
dentry->d_flags &= ~DCACHE_NFSFS_RENAMED;
data = dentry->d_fsdata;
}
spin_unlock(&dentry->d_lock);
if (data != NULL && (NFS_STALE(inode) || !nfs_call_unlink(dentry, data)))
nfs_free_unlinkdata(data);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return pointer to the tsb associated with this tcw. */
|
struct tsb* tcw_get_tsb(struct tcw *tcw)
|
/* Return pointer to the tsb associated with this tcw. */
struct tsb* tcw_get_tsb(struct tcw *tcw)
|
{
return (struct tsb *) ((addr_t) tcw->tsb);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns total numbers of ports implemented by the switch device. */
|
static u8 rio_get_swpinfo_tports(struct rio_mport *mport, u16 destid, u8 hopcount)
|
/* Returns total numbers of ports implemented by the switch device. */
static u8 rio_get_swpinfo_tports(struct rio_mport *mport, u16 destid, u8 hopcount)
|
{
u32 result;
rio_mport_read_config_32(mport, destid, hopcount, RIO_SWP_INFO_CAR,
&result);
return RIO_GET_TOTAL_PORTS(result);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Receive one 4-9 bit frame, (or part of 10-16 bit frame) with extended information.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */
|
uint16_t USART_RxExt(USART_TypeDef *usart)
|
/* Receive one 4-9 bit frame, (or part of 10-16 bit frame) with extended information.
Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */
uint16_t USART_RxExt(USART_TypeDef *usart)
|
{
while (!(usart->STATUS & USART_STATUS_RXDATAV))
;
return (uint16_t)(usart->RXDATAX);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Initialize USART Interface. 1. Initializes the resources needed for the USART interface 2.registers event callback function. */
|
usart_handle_t csi_usart_initialize(int32_t idx, usart_event_cb_t cb_event)
|
/* Initialize USART Interface. 1. Initializes the resources needed for the USART interface 2.registers event callback function. */
usart_handle_t csi_usart_initialize(int32_t idx, usart_event_cb_t cb_event)
|
{
uint32_t base = 0u;
uint32_t irq = 0u;
void *handler;
int32_t ret = target_usart_init(idx, &base, &irq, &handler);
if (ret < 0 || ret >= CONFIG_USART_NUM)
{
return NULL;
}
ck_usart_priv_t *usart_priv = &usart_instance[idx];
usart_priv->base = base;
usart_priv->irq = irq;
usart_priv->cb_event = cb_event;
usart_priv->idx = idx;
ck_usart_reg_t *addr = (ck_usart_reg_t *)(usart_priv->base);
addr->IER = IER_RDA_INT_ENABLE | IIR_RECV_LINE_ENABLE;
drv_irq_register(usart_priv->irq, handler);
drv_irq_enable(usart_priv->irq);
return usart_priv;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enables or disables write access to IWDG_PR and IWDG_RLR registers. */
|
void IWDG_WriteConfig(uint16_t IWDG_WriteAccess)
|
/* Enables or disables write access to IWDG_PR and IWDG_RLR registers. */
void IWDG_WriteConfig(uint16_t IWDG_WriteAccess)
|
{
assert_param(IS_IWDG_WRITE(IWDG_WriteAccess));
IWDG->KEY = IWDG_WriteAccess;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Called when the battery is low to limit the backlight intensity. If limit==0 clear any limit, otherwise limit the intensity */
|
void corgibl_limit_intensity(int limit)
|
/* Called when the battery is low to limit the backlight intensity. If limit==0 clear any limit, otherwise limit the intensity */
void corgibl_limit_intensity(int limit)
|
{
struct backlight_device *bd = generic_backlight_device;
mutex_lock(&bd->ops_lock);
if (limit)
bd->props.state |= GENERICBL_BATTLOW;
else
bd->props.state &= ~GENERICBL_BATTLOW;
backlight_update_status(generic_backlight_device);
mutex_unlock(&bd->ops_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* SFR-CACC algorithm: F) If count_of_newacks is less than 2, let d be the destination to which t was sent. If cacc_saw_newack is 0 for destination d, then the sender MUST NOT increment missing report count for t. */
|
static int sctp_cacc_skip_3_1_f(struct sctp_transport *transport, int count_of_newacks)
|
/* SFR-CACC algorithm: F) If count_of_newacks is less than 2, let d be the destination to which t was sent. If cacc_saw_newack is 0 for destination d, then the sender MUST NOT increment missing report count for t. */
static int sctp_cacc_skip_3_1_f(struct sctp_transport *transport, int count_of_newacks)
|
{
if (count_of_newacks < 2 && !transport->cacc.cacc_saw_newack)
return 1;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Since the EFI stub cannot access most of the U-Boot code, add our own simple console output functions here. The EFI app will not use these since it can use the normal console. */
|
void efi_putc(struct efi_priv *priv, const char ch)
|
/* Since the EFI stub cannot access most of the U-Boot code, add our own simple console output functions here. The EFI app will not use these since it can use the normal console. */
void efi_putc(struct efi_priv *priv, const char ch)
|
{
struct efi_simple_text_output_protocol *con = priv->sys_table->con_out;
uint16_t ucode[2];
ucode[0] = ch;
ucode[1] = '\0';
con->output_string(con, ucode);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns the output value set for a GPIO pin. */
|
bool gpio_get_gpio_pin_output_value(uint32_t pin)
|
/* Returns the output value set for a GPIO pin. */
bool gpio_get_gpio_pin_output_value(uint32_t pin)
|
{
volatile avr32_gpio_port_t *gpio_port = &AVR32_GPIO.port[pin >> 5];
return (gpio_port->ovr >> (pin & 0x1F)) & 1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */
|
struct win_window* wtk_frame_as_child(struct wtk_frame *frame)
|
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */
struct win_window* wtk_frame_as_child(struct wtk_frame *frame)
|
{
Assert(frame);
return frame->container;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* read function for 16bit buswith with endianess conversion */
|
static u_char au_read_byte16(struct mtd_info *mtd)
|
/* read function for 16bit buswith with endianess conversion */
static u_char au_read_byte16(struct mtd_info *mtd)
|
{
struct nand_chip *this = mtd->priv;
u_char ret = (u_char) cpu_to_le16(readw(this->IO_ADDR_R));
au_sync();
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* helper routine for returning string descriptors in UTF-16LE input can actually be ISO-8859-1; ASCII is its 7-bit subset */
|
static int ascii2utf(char *s, u8 *utf, int utfmax)
|
/* helper routine for returning string descriptors in UTF-16LE input can actually be ISO-8859-1; ASCII is its 7-bit subset */
static int ascii2utf(char *s, u8 *utf, int utfmax)
|
{
int retval;
for (retval = 0; *s && utfmax > 1; utfmax -= 2, retval += 2) {
*utf++ = *s++;
*utf++ = 0;
}
return retval;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Fills each LCD_InitStruct member with its default value. */
|
void LCD_StructInit(LCD_InitType *LCD_InitStruct)
|
/* Fills each LCD_InitStruct member with its default value. */
void LCD_StructInit(LCD_InitType *LCD_InitStruct)
|
{
LCD_InitStruct->BKFILL = LCD_BKFILL_0;
LCD_InitStruct->Drv = LCD_DRV_300;
LCD_InitStruct->FBMODE = LCD_FBMODE_BUFA;
LCD_InitStruct->FRQ = LCD_FRQ_64H;
LCD_InitStruct->SWPR = 0;
LCD_InitStruct->Type = LCD_TYPE_4COM;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Poll TX status to make a non-blocking write call blocking. */
|
void usr_uart_poll_tx(struct uart_desc *desc)
|
/* Poll TX status to make a non-blocking write call blocking. */
void usr_uart_poll_tx(struct uart_desc *desc)
|
{
bool tx_complete;
do {
adi_uart_IsTxComplete((ADI_UART_HANDLE const)h_uart_device,
&tx_complete);
} while(!tx_complete);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Registers an interrupt handler for the USB controller. */
|
void USBIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
|
/* Registers an interrupt handler for the USB controller. */
void USBIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
|
{
ASSERT(ulBase == USB0_BASE);
IntRegister(INT_USB0, pfnHandler);
IntEnable(INT_USB0);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* STUSB1602 checks the CURRENT_ADVERTISED status on CC (bit7-6 0x18 */
|
Current_Capability_Advertised_TypeDef STUSB1602_Current_Advertised_Get(uint8_t Addr)
|
/* STUSB1602 checks the CURRENT_ADVERTISED status on CC (bit7-6 0x18 */
Current_Capability_Advertised_TypeDef STUSB1602_Current_Advertised_Get(uint8_t Addr)
|
{
STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
return (Current_Capability_Advertised_TypeDef)(reg.b.CC_CURRENT_ADVERTISED);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Disable Multicast frames. When disabled multicast frame filtering depends on HMC bit. */
|
void synopGMAC_multicast_disable(synopGMACdevice *gmacdev)
|
/* Disable Multicast frames. When disabled multicast frame filtering depends on HMC bit. */
void synopGMAC_multicast_disable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacMulticastFilter);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If Address > 0x0FFFFFFF, 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(). */
|
UINT32 EFIAPI PciExpressBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
/* If Address > 0x0FFFFFFF, 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(). */
UINT32 EFIAPI PciExpressBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
{
ASSERT_INVALID_PCI_ADDRESS (Address);
return MmioBitFieldRead32 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Free a device structure, all reports, and all fields. */
|
void hid_free_device(HidDev_t *HidDev)
|
/* Free a device structure, all reports, and all fields. */
void hid_free_device(HidDev_t *HidDev)
|
{
unsigned int i = 0;
unsigned int j = 0;
for (i = 0; i < USB_HID_REPORT_TYPES; i++) {
usbHidReportEnum_t *report_enum = HidDev->HidReportEnum + i;
for (j = 0; j < 256; j++) {
usbHidReport_t *report = report_enum->Report[j];
if (report){
report_enum->ReportNum -= 1;
hid_free_report(report);
report_enum->Report[j] = NULL;
}
}
}
if(HidDev->collection){
hal_free(HidDev->collection);
HidDev->collection = NULL;
}
return ;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Stops the low level portion of the device driver. */
|
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
|
/* Stops the low level portion of the device driver. */
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
|
{
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_Stop(pdev->pData);
usb_status = USBD_Get_USB_Status(hal_status);
return usb_status;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Splits float parameters of the CGNSINF response on '.' */
|
static int gnss_split_on_dot(const char *src, int32_t *f1, int32_t *f2)
|
/* Splits float parameters of the CGNSINF response on '.' */
static int gnss_split_on_dot(const char *src, int32_t *f1, int32_t *f2)
|
{
char *dot = strchr(src, '.');
if (!dot) {
return -1;
}
*dot = '\0';
*f1 = (int32_t)strtol(src, NULL, 10);
*f2 = (int32_t)strtol(dot + 1, NULL, 10);
if (*f1 < 0) {
*f2 = -*f2;
}
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This API sets the significant motion interrupt of the sensor.This interrupt occurs when there is change in user location. */
|
static int8_t set_accel_sig_motion_int(struct bmi160_int_settg *int_config, struct bmi160_dev *dev)
|
/* This API sets the significant motion interrupt of the sensor.This interrupt occurs when there is change in user location. */
static int8_t set_accel_sig_motion_int(struct bmi160_int_settg *int_config, struct bmi160_dev *dev)
|
{
int8_t rslt;
rslt = null_ptr_check(dev);
if ((rslt != BMI160_OK) || (int_config == NULL))
{
rslt = BMI160_E_NULL_PTR;
}
else
{
struct bmi160_acc_sig_mot_int_cfg *sig_mot_int_cfg = &(int_config->int_type_cfg.acc_sig_motion_int);
rslt = enable_sig_motion_int(sig_mot_int_cfg, dev);
if (rslt == BMI160_OK)
{
rslt = config_sig_motion_int_settg(int_config, sig_mot_int_cfg, dev);
}
}
return rslt;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Check if Transmit Hold Register is empty. Check if the last data written in UART_THR has been loaded in TSR and the last data loaded in TSR has been transmitted. */
|
uint32_t uart_is_tx_empty(Uart *p_uart)
|
/* Check if Transmit Hold Register is empty. Check if the last data written in UART_THR has been loaded in TSR and the last data loaded in TSR has been transmitted. */
uint32_t uart_is_tx_empty(Uart *p_uart)
|
{
return (p_uart->UART_SR & UART_SR_TXEMPTY) > 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function returns the number of orphans that can be written in half the total space. That leaves half the space for adding new orphans. */
|
static int tot_avail_orphs(struct ubifs_info *c)
|
/* This function returns the number of orphans that can be written in half the total space. That leaves half the space for adding new orphans. */
static int tot_avail_orphs(struct ubifs_info *c)
|
{
int avail_lebs, avail;
avail_lebs = c->orph_lebs;
avail = avail_lebs *
((c->leb_size - UBIFS_ORPH_NODE_SZ) / sizeof(__le64));
return avail / 2;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Returns: pointer of srtuct rtw_cbuf, NULL for allocation failure */
|
struct rtw_cbuf* rtw_cbuf_alloc(u32 size)
|
/* Returns: pointer of srtuct rtw_cbuf, NULL for allocation failure */
struct rtw_cbuf* rtw_cbuf_alloc(u32 size)
|
{
struct rtw_cbuf *cbuf;
cbuf = (struct rtw_cbuf *)rtw_malloc(sizeof(*cbuf) + sizeof(void*)*size);
if (cbuf) {
cbuf->write = cbuf->read = 0;
cbuf->size = size;
}
return cbuf;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Serializes the connack packet into the supplied buffer. */
|
int MQTTSerialize_connack(unsigned char *buf, int buflen, unsigned char connack_rc, unsigned char sessionPresent)
|
/* Serializes the connack packet into the supplied buffer. */
int MQTTSerialize_connack(unsigned char *buf, int buflen, unsigned char connack_rc, unsigned char sessionPresent)
|
{
MQTTHeader header = {0};
int rc = 0;
unsigned char* ptr = buf;
MQTTConnackFlags flags = {0};
FUNC_ENTRY;
if (buflen < 2) {
rc = MQTTPACKET_BUFFER_TOO_SHORT;
goto exit;
}
header.byte = 0;
header.bits.type = CONNACK;
writeChar(&ptr, header.byte);
ptr += MQTTPacket_encode(ptr, 2);
flags.all = 0;
flags.bits.sessionpresent = sessionPresent;
writeChar(&ptr, flags.all);
writeChar(&ptr, connack_rc);
rc = ptr - buf;
exit:
FUNC_EXIT_RC(rc);
return rc;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* remove an item and push it to the free items queue */
|
static void lv_lru_remove_item(lv_lru_t *cache, lv_lru_item_t *prev, lv_lru_item_t *item, uint32_t hash_index)
|
/* remove an item and push it to the free items queue */
static void lv_lru_remove_item(lv_lru_t *cache, lv_lru_item_t *prev, lv_lru_item_t *item, uint32_t hash_index)
|
{
if(prev)
prev->next = item->next;
else
cache->items[hash_index] = (lv_lru_item_t *) item->next;
cache->free_memory += item->value_length;
cache->value_free(item->value);
cache->key_free(item->key);
lv_memset_00(item, sizeof(lv_lru_item_t));
item->next = cache->free_items;
cache->free_items = item;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* If any reserved bits in Address are set, 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI S3PciSegmentBitFieldAnd8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
|
/* If any reserved bits in Address are set, 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3PciSegmentBitFieldAnd8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
|
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentBitFieldAnd8 (Address, StartBit, EndBit, AndData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* IDL typedef struct { IDL char cred; IDL } CREDENTIAL; */
|
static int netlogon_dissect_CREDENTIAL(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_)
|
/* IDL typedef struct { IDL char cred; IDL } CREDENTIAL; */
static int netlogon_dissect_CREDENTIAL(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_)
|
{
if(di->conformant_run){
return offset;
}
proto_tree_add_item(tree, hf_netlogon_credential, tvb, offset, 8,
ENC_NA);
offset += 8;
return offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Extracts the physical address on the flash page number from a linear address. */
|
static blt_int16u FlashGetPhysAddr(blt_addr addr)
|
/* Extracts the physical address on the flash page number from a linear address. */
static blt_int16u FlashGetPhysAddr(blt_addr addr)
|
{
return (blt_int16u)(((blt_int16u)addr % FLASH_PAGE_SIZE) + FLASH_PAGE_OFFSET);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* return state of serial control and status signals */
|
static int tiocmget(struct tty_struct *tty, struct file *file)
|
/* return state of serial control and status signals */
static int tiocmget(struct tty_struct *tty, struct file *file)
|
{
struct slgt_info *info = tty->driver_data;
unsigned int result;
unsigned long flags;
spin_lock_irqsave(&info->lock,flags);
get_signals(info);
spin_unlock_irqrestore(&info->lock,flags);
result = ((info->signals & SerialSignal_RTS) ? TIOCM_RTS:0) +
((info->signals & SerialSignal_DTR) ? TIOCM_DTR:0) +
((info->signals & SerialSignal_DCD) ? TIOCM_CAR:0) +
((info->signals & SerialSignal_RI) ? TIOCM_RNG:0) +
((info->signals & SerialSignal_DSR) ? TIOCM_DSR:0) +
((info->signals & SerialSignal_CTS) ? TIOCM_CTS:0);
DBGINFO(("%s tiocmget value=%08X\n", info->device_name, result));
return result;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* wait for a page to finish being written to the cache */
|
void __fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *page)
|
/* wait for a page to finish being written to the cache */
void __fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *page)
|
{
wait_queue_head_t *wq = bit_waitqueue(&cookie->flags, 0);
wait_event(*wq, !__fscache_check_page_write(cookie, page));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialises the memory management block using internal memory pool. This function needs to be called when the system starts up. */
|
pn532_error_t pn532_mem_initLocal(void)
|
/* Initialises the memory management block using internal memory pool. This function needs to be called when the system starts up. */
pn532_error_t pn532_mem_initLocal(void)
|
{
bpool((void*)_pn532_mem_pool, (bufsize)(sizeof(_pn532_mem_pool)));
_pn532_mem_initialised = TRUE;
return PN532_ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Set a single color register. The values supplied are already rounded down to the hardware's capabilities (according to the entries in the var structure). Return != 0 for invalid regno. */
|
static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info)
|
/* Set a single color register. The values supplied are already rounded down to the hardware's capabilities (according to the entries in the var structure). Return != 0 for invalid regno. */
static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info)
|
{
struct sgivw_par *par = (struct sgivw_par *) info->par;
if (regno > 255)
return 1;
red >>= 8;
green >>= 8;
blue >>= 8;
while (par->cmap_fifo == 0)
par->cmap_fifo = par->regs->cm_fifo;
par->regs->cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
par->cmap_fifo--;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* STUSB1602 checks the VDD_OVLO_Threshold State (EN or DIS) (bit6 0x2E */
|
VDD_OVLO_Threshold_TypeDef STUSB1602_VDD_OVLO_Threshold_Get(uint8_t Addr)
|
/* STUSB1602 checks the VDD_OVLO_Threshold State (EN or DIS) (bit6 0x2E */
VDD_OVLO_Threshold_TypeDef STUSB1602_VDD_OVLO_Threshold_Get(uint8_t Addr)
|
{
STUSB1602_VBUS_MONITORING_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1);
return (VDD_OVLO_Threshold_TypeDef)(reg.b.VDD_OVLO_DISABLE);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Generate an audit message from the contents of @buf, which is owned by the current task. @buf->mutex must be locked. */
|
static void tty_audit_buf_push_current(struct tty_audit_buf *buf)
|
/* Generate an audit message from the contents of @buf, which is owned by the current task. @buf->mutex must be locked. */
static void tty_audit_buf_push_current(struct tty_audit_buf *buf)
|
{
uid_t auid = audit_get_loginuid(current);
unsigned int sessionid = audit_get_sessionid(current);
tty_audit_buf_push(current, auid, sessionid, buf);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Tracking area update complete No more IE's Tracking area update reject */
|
static void nas_emm_trac_area_upd_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
|
/* Tracking area update complete No more IE's Tracking area update reject */
static void nas_emm_trac_area_upd_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
|
{
guint32 curr_offset;
guint32 consumed;
guint curr_len;
curr_offset = offset;
curr_len = len;
pinfo->link_dir = P2P_DIR_DL;
ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
ELEM_OPT_TLV(0x5F, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
ELEM_OPT_TV_SHORT( 0xA0, NAS_PDU_TYPE_EMM, DE_EMM_EXT_CAUSE, NULL );
EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_nas_eps_extraneous_data);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Disable output pins.
Onlyc the ones where bits are set to "1" are touched, everything else remains in the old state. */
|
void gpio_disable(uint32_t gpioport, uint32_t gpios)
|
/* Disable output pins.
Onlyc the ones where bits are set to "1" are touched, everything else remains in the old state. */
void gpio_disable(uint32_t gpioport, uint32_t gpios)
|
{
GPIO_GPERC(gpioport) = gpios;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Force generate a timer event.
The event specification consists of 8 possible events that can be forced on the timer. The forced events are automatically cleared by hardware. The UG event is useful to cause shadow registers to be preloaded before the timer is started to avoid uncertainties in the first cycle in case an update event may never be generated. */
|
void timer_generate_event(uint32_t timer_peripheral, uint32_t event)
|
/* Force generate a timer event.
The event specification consists of 8 possible events that can be forced on the timer. The forced events are automatically cleared by hardware. The UG event is useful to cause shadow registers to be preloaded before the timer is started to avoid uncertainties in the first cycle in case an update event may never be generated. */
void timer_generate_event(uint32_t timer_peripheral, uint32_t event)
|
{
TIM_EGR(timer_peripheral) |= event;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Return CR_OK upon successful completion, an error code otherwise. */
|
enum CRStatus cr_input_set_line_num(CRInput *a_this, glong a_line_num)
|
/* Return CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_set_line_num(CRInput *a_this, glong a_line_num)
|
{
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
PRIVATE (a_this)->line = a_line_num;
return CR_OK;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* ZigBee Device Profile dissector for the backup binding */
|
void dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
/* ZigBee Device Profile dissector for the backup binding */
void dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
{
guint offset = 0;
guint8 status;
status = zdp_parse_status(tree, tvb, &offset); zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL);
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
zdp_dump_excess(tvb, offset, pinfo, tree);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
|
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
|
{
BOOLEAN Flag;
ASSERT ((Address & 3) == 0);
Flag = FilterBeforeMmIoWrite (FilterWidth32, Address, &Value);
if (Flag) {
*(volatile UINT32 *)Address = Value;
}
FilterAfterMmIoWrite (FilterWidth32, Address, &Value);
return Value;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Release all locks held by clients accessing this file system. */
|
int nlmsvc_unlock_all_by_sb(struct super_block *sb)
|
/* Release all locks held by clients accessing this file system. */
int nlmsvc_unlock_all_by_sb(struct super_block *sb)
|
{
int ret;
ret = nlm_traverse_files(sb, nlmsvc_always_match, nlmsvc_match_sb);
return ret ? -EIO : 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the device and lock it for exclusive access */
|
static int nand_get_device(struct mtd_info *mtd, int new_state)
|
/* Get the device and lock it for exclusive access */
static int nand_get_device(struct mtd_info *mtd, int new_state)
|
{
struct nand_chip *chip = mtd_to_nand(mtd);
chip->state = new_state;
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Get the leaf entry for a given linear address from one entry in page table */
|
UINT64 GetEntryFromSubPageTable(IN IA32_PAGING_ENTRY *PagingEntry, IN OUT UINTN *Level, IN UINTN MaxLeafLevel, IN UINT64 Address)
|
/* Get the leaf entry for a given linear address from one entry in page table */
UINT64 GetEntryFromSubPageTable(IN IA32_PAGING_ENTRY *PagingEntry, IN OUT UINTN *Level, IN UINTN MaxLeafLevel, IN UINT64 Address)
|
{
UINT64 Index;
IA32_PAGING_ENTRY *ChildPageEntry;
if (PagingEntry->Pce.Present == 0) {
return 0;
}
if ((PagingEntry->Uint64 & mValidMaskLeafFlag[*Level].Uint64) == mValidMaskLeafFlag[*Level].Uint64) {
return PagingEntry->Uint64;
}
ChildPageEntry = (IA32_PAGING_ENTRY *)(UINTN)(IA32_PNLE_PAGE_TABLE_BASE_ADDRESS (&PagingEntry->Pnle));
*Level = *Level -1;
Index = Address >> (*Level * 9 + 3);
ASSERT (Index == (Index & ((1<< 9) - 1)));
return GetEntryFromSubPageTable (&ChildPageEntry[Index], Level, MaxLeafLevel, Address - (Index << (9 * *Level + 3)));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* P2P needs mac addresses for P2P device and interface. If no device address it specified, these are derived from the primary net device, ie. the permanent ethernet address of the device. */
|
static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr)
|
/* P2P needs mac addresses for P2P device and interface. If no device address it specified, these are derived from the primary net device, ie. the permanent ethernet address of the device. */
static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr)
|
{
struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
bool local_admin = false;
if (!dev_addr || is_zero_ether_addr(dev_addr)) {
dev_addr = pri_ifp->mac_addr;
local_admin = true;
}
memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
if (local_admin)
p2p->dev_addr[0] |= 0x02;
memcpy(p2p->int_addr, p2p->dev_addr, ETH_ALEN);
p2p->int_addr[0] |= 0x02;
p2p->int_addr[4] ^= 0x80;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Allwinner A10/A20 SoCs were using pins PC0,PC1,PC2,PC23 for booting from SPI Flash, everything else is using pins PC0,PC1,PC2,PC3. */
|
static void spi0_pinmux_setup(unsigned int pin_function)
|
/* Allwinner A10/A20 SoCs were using pins PC0,PC1,PC2,PC23 for booting from SPI Flash, everything else is using pins PC0,PC1,PC2,PC3. */
static void spi0_pinmux_setup(unsigned int pin_function)
|
{
unsigned int pin;
for (pin = SUNXI_GPC(0); pin <= SUNXI_GPC(2); pin++)
sunxi_gpio_set_cfgpin(pin, pin_function);
if (IS_ENABLED(CONFIG_MACH_SUN4I) || IS_ENABLED(CONFIG_MACH_SUN7I))
sunxi_gpio_set_cfgpin(SUNXI_GPC(23), pin_function);
else
sunxi_gpio_set_cfgpin(SUNXI_GPC(3), pin_function);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Trigger the hardware to transfer one frame from DMA buffer based on sync signal. */
|
void LCDC_MCUDMATrigger(LCDC_TypeDef *LCDCx)
|
/* Trigger the hardware to transfer one frame from DMA buffer based on sync signal. */
void LCDC_MCUDMATrigger(LCDC_TypeDef *LCDCx)
|
{
assert_param(IS_LCDC_ALL_PERIPH(LCDCx));
LCDCx->LCDC_DMA_MODE_CFG |= LCDC_DMA_MODE_CFG_TRIGGER_ONE_TIME;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Put a byte into the ring buffer. If ring buffer is full, this operation will fail. */
|
rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch)
|
/* Put a byte into the ring buffer. If ring buffer is full, this operation will fail. */
rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch)
|
{
RT_ASSERT(rb != RT_NULL);
if (!rt_ringbuffer_space_len(rb))
return 0;
rb->buffer_ptr[rb->write_index] = ch;
if (rb->write_index == rb->buffer_size - 1)
{
rb->write_mirror = ~rb->write_mirror;
rb->write_index = 0;
}
else
{
rb->write_index++;
}
return 1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initializes the microcontroller core clock.
The following configuration selects the internal 48 MHz DCO1 to source the MCU and the peripherals: */
|
void SystemCoreClockSetup(void)
|
/* Initializes the microcontroller core clock.
The following configuration selects the internal 48 MHz DCO1 to source the MCU and the peripherals: */
void SystemCoreClockSetup(void)
|
{
const XMC_SCU_CLOCK_CONFIG_t CLOCK_XMC1_0_CONFIG =
{
.pclk_src = XMC_SCU_CLOCK_PCLKSRC_DOUBLE_MCLK,
.rtc_src = XMC_SCU_CLOCK_RTCCLKSRC_DCO2,
.fdiv = 0U,
.idiv = 1U,
.dclk_src = XMC_SCU_CLOCK_DCLKSRC_DCO1,
.oschp_mode = XMC_SCU_CLOCK_OSCHP_MODE_OSC,
.osclp_mode = XMC_SCU_CLOCK_OSCLP_MODE_DISABLED
};
XMC_SCU_CLOCK_Init(&CLOCK_XMC1_0_CONFIG);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Register Findme Target.
Registers the findme target with the radio. This enables the findme target service at the radio end. Applications can set the alert levels after registering the service. */
|
ADI_BLER_RESULT adi_radio_Register_FindmeTarget(void)
|
/* Register Findme Target.
Registers the findme target with the radio. This enables the findme target service at the radio end. Applications can set the alert levels after registering the service. */
ADI_BLER_RESULT adi_radio_Register_FindmeTarget(void)
|
{
ADI_BLER_RESULT bleResult;
ADI_BLE_LOGEVENT(LOGID_CMD_FM_TARGET_REG);
ADI_BLE_RADIO_CMD_START(CMD_FM_TARGET_REG);
bleResult = bler_process_cmd(CMD_FM_TARGET_REG, 0u, NULL, 0u);
if(bleResult == ADI_BLER_SUCCESS){
bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT);
}
ADI_BLE_RADIO_CMD_END();
return (bleResult);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Reads the values present of the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
|
long GPIOPinRead(unsigned long ulPort, unsigned long ulPins)
|
/* Reads the values present of the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
long GPIOPinRead(unsigned long ulPort, unsigned long ulPins)
|
{
xASSERT(GPIOBaseValid(ulPort));
return(xHWREG(ulPort +GPIO_PIN ) & (ulPins));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Avoid consuming memory with our now useless rbtree. */
|
static int tracing_stat_release(struct inode *i, struct file *f)
|
/* Avoid consuming memory with our now useless rbtree. */
static int tracing_stat_release(struct inode *i, struct file *f)
|
{
struct stat_session *session = i->i_private;
reset_stat_session(session);
return seq_release(i, f);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Function for clearing an event flag in NRF_NFCT registers. */
|
static void nrf_nfct_event_clear(volatile uint32_t *p_event)
|
/* Function for clearing an event flag in NRF_NFCT registers. */
static void nrf_nfct_event_clear(volatile uint32_t *p_event)
|
{
*p_event = 0;
volatile uint32_t dummy = *p_event;
(void)dummy;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* The register selects a DWORD (32 bit) register offset. Hence it doesn't get shifted by 2 bits as we want to "drop" the bottom two bits. */
|
static int mk_conf_addr(struct pci_bus *bus_dev, unsigned int device_fn, int where, unsigned long *pci_addr, unsigned char *type1)
|
/* The register selects a DWORD (32 bit) register offset. Hence it doesn't get shifted by 2 bits as we want to "drop" the bottom two bits. */
static int mk_conf_addr(struct pci_bus *bus_dev, unsigned int device_fn, int where, unsigned long *pci_addr, unsigned char *type1)
|
{
u8 bus = bus_dev->number;
*type1 = (bus != 0);
*pci_addr = (bus << 16) | (device_fn << 8) | where;
DBGC(("mk_conf_addr(bus=%d ,device_fn=0x%x, where=0x%x,"
" returning address 0x%p\n"
bus, device_fn, where, *pci_addr));
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* So we use a bh handler to take care of close events. */
|
static void usbredir_chardev_close_bh(void *opaque)
|
/* So we use a bh handler to take care of close events. */
static void usbredir_chardev_close_bh(void *opaque)
|
{
USBRedirDevice *dev = opaque;
usbredir_device_disconnect(dev);
if (dev->parser) {
DPRINTF("destroying usbredirparser\n");
usbredirparser_destroy(dev->parser);
dev->parser = NULL;
}
if (dev->watch) {
g_source_remove(dev->watch);
dev->watch = 0;
}
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* m o v e F r e e T o F i x e d */
|
returnValue Bounds_moveFreeToFixed(Bounds *_THIS, int number, SubjectToStatus _status)
|
/* m o v e F r e e T o F i x e d */
returnValue Bounds_moveFreeToFixed(Bounds *_THIS, int number, SubjectToStatus _status)
|
{
if ( ( number < 0 ) || ( number >= _THIS->n ) )
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
if ( Bounds_removeIndex( _THIS,Bounds_getFree( _THIS ),number ) != SUCCESSFUL_RETURN )
return THROWERROR( RET_MOVING_BOUND_FAILED );
if ( Bounds_addIndex( _THIS,Bounds_getFixed( _THIS ),number,_status ) != SUCCESSFUL_RETURN )
return THROWERROR( RET_MOVING_BOUND_FAILED );
return SUCCESSFUL_RETURN;
}
|
DanielMartensson/EmbeddedLapack
|
C++
|
MIT License
| 129
|
/* Advance a list_head iterator. The iterator should be positioned at the start of a css_set */
|
static void cgroup_advance_iter(struct cgroup *cgrp, struct cgroup_iter *it)
|
/* Advance a list_head iterator. The iterator should be positioned at the start of a css_set */
static void cgroup_advance_iter(struct cgroup *cgrp, struct cgroup_iter *it)
|
{
struct list_head *l = it->cg_link;
struct cg_cgroup_link *link;
struct css_set *cg;
do {
l = l->next;
if (l == &cgrp->css_sets) {
it->cg_link = NULL;
return;
}
link = list_entry(l, struct cg_cgroup_link, cgrp_link_list);
cg = link->cg;
} while (list_empty(&cg->tasks));
it->cg_link = l;
it->task = cg->tasks.next;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If an error would be returned, then the function will also ASSERT(). */
|
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
|
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If an error would be returned, then the function will also ASSERT(). */
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
|
{
return mPrint2SProtocol->UnicodeValueToStringS (Buffer, BufferSize, Flags, Value, Width);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function for sending acknowledgement to I2C Master.
This function will write an acknowledgement byte 's' on I2C bus to indicate the master that it has received and programmed the data. */
|
static void send_ack(void)
|
/* Function for sending acknowledgement to I2C Master.
This function will write an acknowledgement byte 's' on I2C bus to indicate the master that it has received and programmed the data. */
static void send_ack(void)
|
{
uint8_t ack = 's';
packet.data_length = 1;
packet.data = &ack;
while (i2c_slave_write_packet_wait(&slave, &packet) != STATUS_OK);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Try to open specified file with following names: ./name /name The latter is used when srctree is separate from objtree when compiling the kernel. Return NULL if file is not found. */
|
FILE* zconf_fopen(const char *name)
|
/* Try to open specified file with following names: ./name /name The latter is used when srctree is separate from objtree when compiling the kernel. Return NULL if file is not found. */
FILE* zconf_fopen(const char *name)
|
{
char *env, fullname[PATH_MAX+1];
FILE *f;
f = fopen(name, "r");
if (!f && name != NULL && name[0] != '/') {
env = getenv(SRCTREE);
if (env) {
sprintf(fullname, "%s/%s", env, name);
f = fopen(fullname, "r");
}
}
return f;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* The function returns whether or not the device is Opal Locked. TRUE means that the device is partially or fully locked. This will perform a Level 0 Discovery and parse the locking feature descriptor */
|
BOOLEAN IsOpalDeviceLocked(OPAL_PEI_DEVICE *OpalDev, BOOLEAN *BlockSidSupported)
|
/* The function returns whether or not the device is Opal Locked. TRUE means that the device is partially or fully locked. This will perform a Level 0 Discovery and parse the locking feature descriptor */
BOOLEAN IsOpalDeviceLocked(OPAL_PEI_DEVICE *OpalDev, BOOLEAN *BlockSidSupported)
|
{
OPAL_SESSION Session;
OPAL_DISK_SUPPORT_ATTRIBUTE SupportedAttributes;
TCG_LOCKING_FEATURE_DESCRIPTOR LockingFeature;
UINT16 OpalBaseComId;
TCG_RESULT Ret;
Session.Sscp = &OpalDev->Sscp;
Session.MediaId = 0;
Ret = OpalGetSupportedAttributesInfo (&Session, &SupportedAttributes, &OpalBaseComId);
if (Ret != TcgResultSuccess) {
return FALSE;
}
Session.OpalBaseComId = OpalBaseComId;
*BlockSidSupported = SupportedAttributes.BlockSid == 1 ? TRUE : FALSE;
Ret = OpalGetLockingInfo (&Session, &LockingFeature);
if (Ret != TcgResultSuccess) {
return FALSE;
}
return OpalDeviceLocked (&SupportedAttributes, &LockingFeature);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This file is part of the TinyUSB stack. */
|
void USBHS_IRQHandler(void)
|
/* This file is part of the TinyUSB stack. */
void USBHS_IRQHandler(void)
|
{
__asm volatile ("call USBHS_IRQHandler_impl; mret");
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Handles a notification that a read-by-type response has been fully processed for the specified discover-all-characteristics proc. */
|
static int ble_gattc_disc_all_chrs_rx_complete(struct ble_gattc_proc *proc, int status)
|
/* Handles a notification that a read-by-type response has been fully processed for the specified discover-all-characteristics proc. */
static int ble_gattc_disc_all_chrs_rx_complete(struct ble_gattc_proc *proc, int status)
|
{
int rc;
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status != 0) {
ble_gattc_disc_all_chrs_cb(proc, status, 0, NULL);
return BLE_HS_EDONE;
}
if (proc->disc_all_chrs.prev_handle == proc->disc_all_chrs.end_handle) {
ble_gattc_disc_all_chrs_cb(proc, BLE_HS_EDONE, 0, NULL);
return BLE_HS_EDONE;
}
rc = ble_gattc_disc_all_chrs_resume(proc);
if (rc != 0) {
return BLE_HS_EDONE;
}
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Returns the source or destination address for the specified integrated USB DMA channel. */
|
void* USBDMAChannelAddressGet(uint32_t ui32Base, uint32_t ui32Channel)
|
/* Returns the source or destination address for the specified integrated USB DMA channel. */
void* USBDMAChannelAddressGet(uint32_t ui32Base, uint32_t ui32Channel)
|
{
ASSERT(ui32Base == USB0_BASE);
ASSERT(ui32Channel < 8);
return ((void *)HWREG(ui32Base + USB_O_DMAADDR0 + (0x10 * ui32Channel)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Schedule USBD event processing.
Should be called after usbd_evt_put(). */
|
static void usbd_work_schedule(void)
|
/* Schedule USBD event processing.
Should be called after usbd_evt_put(). */
static void usbd_work_schedule(void)
|
{
k_work_submit_to_queue(&usbd_work_queue, &get_usbd_ctx()->usb_work);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Deserializes the supplied (wire) buffer into unsuback data */
|
int mqtt_deserialize_unsuback(unsigned short *packetid, unsigned char *buf, int buflen)
|
/* Deserializes the supplied (wire) buffer into unsuback data */
int mqtt_deserialize_unsuback(unsigned short *packetid, unsigned char *buf, int buflen)
|
{
unsigned char type = 0;
unsigned char dup = 0;
int rc = 0;
FUNC_ENTRY;
rc = mqtt_deserialize_ack(&type, &dup, packetid, buf, buflen);
if (type == MQTTPACKET_UNSUBACK)
rc = 1;
FUNC_EXIT_RC(rc);
return rc;
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* Selects if the channel clears when CLEAR pin is activated. */
|
void ad5755_channel_clear_enable(struct ad5755_dev *dev, uint8_t channel, uint8_t clear_en)
|
/* Selects if the channel clears when CLEAR pin is activated. */
void ad5755_channel_clear_enable(struct ad5755_dev *dev, uint8_t channel, uint8_t clear_en)
|
{
uint32_t old_dac_ctrl_reg = 0;
uint32_t new_dac_ctrl_reg = 0;
old_dac_ctrl_reg = ad5755_get_register_value(dev,
AD5755_RD_CTRL_REG(channel));
old_dac_ctrl_reg &= ~(AD5755_DAC_CLR_EN);
new_dac_ctrl_reg |= old_dac_ctrl_reg | (clear_en * AD5755_DAC_CLR_EN);
ad5755_set_control_registers(dev,
AD5755_CREG_DAC,
channel,
new_dac_ctrl_reg);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Copy parameter control struct, including a possible path allocated at the end of the struct. */
|
static struct autofs_dev_ioctl* copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
|
/* Copy parameter control struct, including a possible path allocated at the end of the struct. */
static struct autofs_dev_ioctl* copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
|
{
struct autofs_dev_ioctl tmp, *ads;
if (copy_from_user(&tmp, in, sizeof(tmp)))
return ERR_PTR(-EFAULT);
if (tmp.size < sizeof(tmp))
return ERR_PTR(-EINVAL);
ads = kmalloc(tmp.size, GFP_KERNEL);
if (!ads)
return ERR_PTR(-ENOMEM);
if (copy_from_user(ads, in, tmp.size)) {
kfree(ads);
return ERR_PTR(-EFAULT);
}
return ads;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Routine to discard the specified number of bytes from the control endpoint stream. This is used to discard unused bytes in the stream from the host, including the memory program block suffix. */
|
static void DiscardFillerBytes(uint8_t NumberOfBytes)
|
/* Routine to discard the specified number of bytes from the control endpoint stream. This is used to discard unused bytes in the stream from the host, including the memory program block suffix. */
static void DiscardFillerBytes(uint8_t NumberOfBytes)
|
{
while (NumberOfBytes--)
{
if (!(Endpoint_BytesInEndpoint()))
{
Endpoint_ClearOUT();
while (!(Endpoint_IsOUTReceived()))
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
}
else
{
Endpoint_Discard_8();
}
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* @node: &struct plist_node pointer - entry to be removed @head: &struct plist_head pointer - list head */
|
void plist_del(struct plist_node *node, struct plist_head *head)
|
/* @node: &struct plist_node pointer - entry to be removed @head: &struct plist_head pointer - list head */
void plist_del(struct plist_node *node, struct plist_head *head)
|
{
plist_check_head(head);
if (!list_empty(&node->plist.prio_list)) {
struct plist_node *next = plist_first(&node->plist);
list_move_tail(&next->plist.prio_list, &node->plist.prio_list);
list_del_init(&node->plist.prio_list);
}
list_del_init(&node->plist.node_list);
plist_check_head(head);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Handles inbound message interrupts. Executes a registered inbound mailbox event handler and acks the interrupt occurrence. */
|
static irqreturn_t fsl_rio_rx_handler(int irq, void *dev_instance)
|
/* Handles inbound message interrupts. Executes a registered inbound mailbox event handler and acks the interrupt occurrence. */
static irqreturn_t fsl_rio_rx_handler(int irq, void *dev_instance)
|
{
int isr;
struct rio_mport *port = (struct rio_mport *)dev_instance;
struct rio_priv *priv = port->priv;
isr = in_be32(&priv->msg_regs->isr);
if (isr & RIO_MSG_ISR_TE) {
pr_info("RIO: inbound message reception error\n");
out_be32((void *)&priv->msg_regs->isr, RIO_MSG_ISR_TE);
goto out;
}
if (isr & RIO_MSG_ISR_DIQI) {
port->inb_msg[0].mcback(port, priv->msg_rx_ring.dev_id, -1, -1);
out_be32(&priv->msg_regs->isr, RIO_MSG_ISR_DIQI);
}
out:
return IRQ_HANDLED;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If the flags parameter is BUF_TRYLOCK, then we'll only return the superblock buffer if it can be locked without sleeping. If it can't then we'll return NULL. */
|
xfs_buf_t* xfs_getsb(xfs_mount_t *mp, int flags)
|
/* If the flags parameter is BUF_TRYLOCK, then we'll only return the superblock buffer if it can be locked without sleeping. If it can't then we'll return NULL. */
xfs_buf_t* xfs_getsb(xfs_mount_t *mp, int flags)
|
{
xfs_buf_t *bp;
ASSERT(mp->m_sb_bp != NULL);
bp = mp->m_sb_bp;
if (flags & XFS_BUF_TRYLOCK) {
if (!XFS_BUF_CPSEMA(bp)) {
return NULL;
}
} else {
XFS_BUF_PSEMA(bp, PRIBIO);
}
XFS_BUF_HOLD(bp);
ASSERT(XFS_BUF_ISDONE(bp));
return bp;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Determine if String is a valid representation for a time or date. */
|
BOOLEAN InternalIsTimeLikeString(IN CONST CHAR16 *String, IN CONST CHAR16 Char, IN CONST UINTN Min, IN CONST UINTN Max, IN CONST BOOLEAN MinusOk)
|
/* Determine if String is a valid representation for a time or date. */
BOOLEAN InternalIsTimeLikeString(IN CONST CHAR16 *String, IN CONST CHAR16 Char, IN CONST UINTN Min, IN CONST UINTN Max, IN CONST BOOLEAN MinusOk)
|
{
UINTN Count;
Count = 0;
if (MinusOk) {
if (*String == L'-') {
String++;
}
}
if (!ShellIsDecimalDigitCharacter (*String)) {
return (FALSE);
}
for ( ; String != NULL && *String != CHAR_NULL; String++) {
if (*String == Char) {
Count++;
if (Count > Max) {
return (FALSE);
}
continue;
}
if (!ShellIsDecimalDigitCharacter (*String)) {
return (FALSE);
}
}
if (Count < Min) {
return (FALSE);
}
return (TRUE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.