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
|
|---|---|---|---|---|---|---|---|
/* We insert Isochronous URBs directly into the frame list at the beginning */
|
static void uhci_insert_td_in_frame_list(struct uhci_hcd *uhci, struct uhci_td *td, unsigned framenum)
|
/* We insert Isochronous URBs directly into the frame list at the beginning */
static void uhci_insert_td_in_frame_list(struct uhci_hcd *uhci, struct uhci_td *td, unsigned framenum)
|
{
framenum &= (UHCI_NUMFRAMES - 1);
td->frame = framenum;
if (uhci->frame_cpu[framenum]) {
struct uhci_td *ftd, *ltd;
ftd = uhci->frame_cpu[framenum];
ltd = list_entry(ftd->fl_list.prev, struct uhci_td, fl_list);
list_add_tail(&td->fl_list, &ftd->fl_list);
td->link = ltd->link;
wmb();
ltd->link = LINK_TO_TD(td);
} else {
td->link = uhci->frame[framenum];
wmb();
uhci->frame[framenum] = LINK_TO_TD(td);
uhci->frame_cpu[framenum] = td;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @type: OS type (IH_OS_...) @comp_type: Compression type being used (IH_COMP_...) @is_xip: true if the load address matches the image start */
|
static void print_decomp_msg(int comp_type, int type, bool is_xip)
|
/* @type: OS type (IH_OS_...) @comp_type: Compression type being used (IH_COMP_...) @is_xip: true if the load address matches the image start */
static void print_decomp_msg(int comp_type, int type, bool is_xip)
|
{
const char *name = genimg_get_type_name(type);
if (comp_type == IH_COMP_NONE)
printf(" %s %s\n", is_xip ? "XIP" : "Loading", name);
else
printf(" Uncompressing %s\n", name);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns: TRUE if the key was found and removed from the #GHashTable */
|
gboolean g_hash_table_steal(GHashTable *hash_table, gconstpointer key)
|
/* Returns: TRUE if the key was found and removed from the #GHashTable */
gboolean g_hash_table_steal(GHashTable *hash_table, gconstpointer key)
|
{
return g_hash_table_remove_internal (hash_table, key, FALSE);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Retrieves the descriptor for a memory region containing a specified address. */
|
EFI_STATUS EFIAPI CoreGetMemorySpaceDescriptor(IN EFI_PHYSICAL_ADDRESS BaseAddress, OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor)
|
/* Retrieves the descriptor for a memory region containing a specified address. */
EFI_STATUS EFIAPI CoreGetMemorySpaceDescriptor(IN EFI_PHYSICAL_ADDRESS BaseAddress, OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor)
|
{
EFI_STATUS Status;
LIST_ENTRY *StartLink;
LIST_ENTRY *EndLink;
EFI_GCD_MAP_ENTRY *Entry;
if (Descriptor == NULL) {
return EFI_INVALID_PARAMETER;
}
CoreAcquireGcdMemoryLock ();
Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdMemorySpaceMap);
if (EFI_ERROR (Status)) {
Status = EFI_NOT_FOUND;
} else {
ASSERT (StartLink != NULL && EndLink != NULL);
Entry = CR (StartLink, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
BuildMemoryDescriptor (Descriptor, Entry);
}
CoreReleaseGcdMemoryLock ();
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
|
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
{
long __res;
asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
: "=a" (__res)
: "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
return __res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get actual LPTIM instance clock source. @rmtoll CFG CKSEL LPTIM_GetClockSource. */
|
uint32_t LPTIM_GetClockSource(LPTIM_Module *LPTIMx)
|
/* Get actual LPTIM instance clock source. @rmtoll CFG CKSEL LPTIM_GetClockSource. */
uint32_t LPTIM_GetClockSource(LPTIM_Module *LPTIMx)
|
{
return (uint32_t)(READ_BIT(LPTIMx->CFG, LPTIM_CFG_CLKSEL));
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* we've determined that we can make the mapping, now translate what we now know into VMA flags */
|
static unsigned long determine_vm_flags(struct file *file, unsigned long prot, unsigned long flags, unsigned long capabilities)
|
/* we've determined that we can make the mapping, now translate what we now know into VMA flags */
static unsigned long determine_vm_flags(struct file *file, unsigned long prot, unsigned long flags, unsigned long capabilities)
|
{
unsigned long vm_flags;
vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
if (!(capabilities & BDI_CAP_MAP_DIRECT)) {
if (file && !(prot & PROT_WRITE))
vm_flags |= VM_MAYSHARE;
}
else {
if (flags & MAP_SHARED)
vm_flags |= VM_MAYSHARE | VM_SHARED;
else if ((((vm_flags & capabilities) ^ vm_flags) & BDI_CAP_VMFLAGS) == 0)
vm_flags |= VM_MAYSHARE;
}
if ((flags & MAP_PRIVATE) && tracehook_expect_breakpoints(current))
vm_flags &= ~VM_MAYSHARE;
return vm_flags;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* flush_journal_list frequently needs to find a newer transaction for a given block. This does that, or returns NULL if it can't find anything */
|
static struct reiserfs_journal_list* find_newer_jl_for_cn(struct reiserfs_journal_cnode *cn)
|
/* flush_journal_list frequently needs to find a newer transaction for a given block. This does that, or returns NULL if it can't find anything */
static struct reiserfs_journal_list* find_newer_jl_for_cn(struct reiserfs_journal_cnode *cn)
|
{
struct super_block *sb = cn->sb;
b_blocknr_t blocknr = cn->blocknr;
cn = cn->hprev;
while (cn) {
if (cn->sb == sb && cn->blocknr == blocknr && cn->jlist) {
return cn->jlist;
}
cn = cn->hprev;
}
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return: 0 on success or a negative error code on failure. */
|
int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start, u16 end)
|
/* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start, u16 end)
|
{
u8 payload[4] = { start >> 8, start & 0xff, end >> 8, end & 0xff };
ssize_t err;
err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_PAGE_ADDRESS, payload,
sizeof(payload));
if (err < 0)
return err;
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Check whether 'status' signals a syntax error and the error message at the top of the stack ends with the above mark for incomplete statements. */
|
static int incomplete(lua_State *L, int status)
|
/* Check whether 'status' signals a syntax error and the error message at the top of the stack ends with the above mark for incomplete statements. */
static int incomplete(lua_State *L, int status)
|
{
size_t lmsg;
const char *msg = lua_tolstring(L, -1, &lmsg);
if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) {
lua_pop(L, 1);
return 1;
}
}
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Returns: TRUE if the mount was successfully remounted. FALSE otherwise. */
|
gboolean g_mount_remount_finish(GMount *mount, GAsyncResult *result, GError **error)
|
/* Returns: TRUE if the mount was successfully remounted. FALSE otherwise. */
gboolean g_mount_remount_finish(GMount *mount, GAsyncResult *result, GError **error)
|
{
GMountIface *iface;
g_return_val_if_fail (G_IS_MOUNT (mount), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
if (g_async_result_legacy_propagate_error (result, error))
return FALSE;
else if (g_async_result_is_tagged (result, g_mount_remount))
return g_task_propagate_boolean (G_TASK (result), error);
iface = G_MOUNT_GET_IFACE (mount);
return (* iface->remount_finish) (mount, result, error);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* The control element is supposed to have the private_value field set up via HDA_BIND_MUTE*() macros. */
|
int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
/* The control element is supposed to have the private_value field set up via HDA_BIND_MUTE*() macros. */
int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
unsigned long pval;
int i, indices, err = 0, change = 0;
mutex_lock(&codec->control_mutex);
pval = kcontrol->private_value;
indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT;
for (i = 0; i < indices; i++) {
kcontrol->private_value = (pval & ~AMP_VAL_IDX_MASK) |
(i << AMP_VAL_IDX_SHIFT);
err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
if (err < 0)
break;
change |= err;
}
kcontrol->private_value = pval;
mutex_unlock(&codec->control_mutex);
return err < 0 ? err : change;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if Transmit underrun error interrupt is enabled @rmtoll IER TXUNRIE LL_SWPMI_IsEnabledIT_TXUNR. */
|
uint32_t LL_SWPMI_IsEnabledIT_TXUNR(SWPMI_TypeDef *SWPMIx)
|
/* Check if Transmit underrun error interrupt is enabled @rmtoll IER TXUNRIE LL_SWPMI_IsEnabledIT_TXUNR. */
uint32_t LL_SWPMI_IsEnabledIT_TXUNR(SWPMI_TypeDef *SWPMIx)
|
{
return ((READ_BIT(SWPMIx->IER, SWPMI_IER_TXUNRIE) == (SWPMI_IER_TXUNRIE)) ? 1UL : 0UL);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* DevicePathNode must be Mac Address type and this will populate the MappingItem. */
|
EFI_STATUS DevPathSerialMacAddr(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
/* DevicePathNode must be Mac Address type and this will populate the MappingItem. */
EFI_STATUS DevPathSerialMacAddr(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
{
MAC_ADDR_DEVICE_PATH *Mac;
UINTN HwAddressSize;
UINTN Index;
CHAR16 Buffer[64];
CHAR16 *PBuffer;
ASSERT (DevicePathNode != NULL);
ASSERT (MappingItem != NULL);
Mac = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
if ((Mac->IfType == 0x01) || (Mac->IfType == 0x00)) {
HwAddressSize = 6;
}
for (Index = 0, PBuffer = Buffer; Index < HwAddressSize; Index++, PBuffer += 2) {
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Mac->MacAddress.Addr[Index]);
}
return AppendCSDStr (MappingItem, Buffer);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* @wm8400: Pointer to wm8400 control structure @reg: Register to read */
|
u16 wm8400_reg_read(struct wm8400 *wm8400, u8 reg)
|
/* @wm8400: Pointer to wm8400 control structure @reg: Register to read */
u16 wm8400_reg_read(struct wm8400 *wm8400, u8 reg)
|
{
u16 val;
mutex_lock(&wm8400->io_lock);
wm8400_read(wm8400, reg, 1, &val);
mutex_unlock(&wm8400->io_lock);
return val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI S3PciBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3PciBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
|
{
return InternalSavePciWrite8ValueToBootScript (Address, PciBitFieldOr8 (Address, StartBit, EndBit, OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enable the scrolling feature with the specified amount of lines. */
|
void ili9225_enable_scroll(uint8_t uc_linenum)
|
/* Enable the scrolling feature with the specified amount of lines. */
void ili9225_enable_scroll(uint8_t uc_linenum)
|
{
ili9225_write_register(ILI9225_VERTICAL_SCROLL_CTRL3, ILI9225_VERTICAL_SCROLL_CTRL3_SST(uc_linenum));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* ZigBee Device Profile dissector for the set user descriptor */
|
void dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
|
/* ZigBee Device Profile dissector for the set user descriptor */
void dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version)
|
{
guint offset = 0;
guint8 status;
guint16 device = 0;
status = zdp_parse_status(tree, tvb, &offset);
if (version >= ZBEE_VERSION_2007) {
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL);
}
zbee_append_info(tree, pinfo, ", Device: 0x%04x", device);
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
|
/* The function is synchronous and does not return until the erase operation has completed. */
|
uint32_t EEPROMMassErase(void)
|
/* The function is synchronous and does not return until the erase operation has completed. */
uint32_t EEPROMMassErase(void)
|
{
HWREG(EEPROM_EEDBGME) = EEPROM_MASS_ERASE_KEY | EEPROM_EEDBGME_ME;
_EEPROMWaitForDone();
SysCtlPeripheralReset(SYSCTL_PERIPH_EEPROM0);
SysCtlDelay(2);
_EEPROMWaitForDone();
return (HWREG(EEPROM_EEDONE));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
|
UINT32 EFIAPI PciSegmentBitFieldRead32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit)
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI PciSegmentBitFieldRead32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit)
|
{
return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Add an operation to the echo buffer to move back one column. */
|
static void echo_move_back_col(struct n_tty_data *ldata)
|
/* Add an operation to the echo buffer to move back one column. */
static void echo_move_back_col(struct n_tty_data *ldata)
|
{
add_echo_byte(ECHO_OP_START, ldata);
add_echo_byte(ECHO_OP_MOVE_BACK_COL, ldata);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
|
UINT32 EFIAPI S3IoRead32(IN UINTN Port)
|
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
UINT32 EFIAPI S3IoRead32(IN UINTN Port)
|
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoRead32 (Port));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configures the transceiver.
This function is called to configure the transceiver after reset. */
|
static void trx_config(void)
|
/* Configures the transceiver.
This function is called to configure the transceiver after reset. */
static void trx_config(void)
|
{
uint16_t rand_value;
pal_trx_reg_write(RG_TRX_CTRL_0,
((CLKM_2mA << 6) | (CLKM_2mA << 4) | CLKM_1MHz));
pal_trx_bit_write(SR_AACK_SET_PD, PD_ACK_BIT_SET_ENABLE);
pal_trx_bit_write(SR_TX_AUTO_CRC_ON, TX_AUTO_CRC_ENABLE);
pal_trx_reg_write(RG_IRQ_MASK, TRX_IRQ_DEFAULT);
rand_value = (uint16_t) rand();
pal_trx_reg_write(RG_CSMA_SEED_0, (uint8_t) rand_value);
pal_trx_bit_write(SR_CSMA_SEED_1, (uint8_t) (rand_value >> 8));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* The mapping is cacheline aligned, so there's no information in the bottom few bits of the address. We're looking for 10 bits (4MB / 4k), so let's drop the bottom 8 bits and use bits 8-17. */
|
static int get_offset(struct address_space *mapping)
|
/* The mapping is cacheline aligned, so there's no information in the bottom few bits of the address. We're looking for 10 bits (4MB / 4k), so let's drop the bottom 8 bits and use bits 8-17. */
static int get_offset(struct address_space *mapping)
|
{
int offset = (unsigned long) mapping << (PAGE_SHIFT - 8);
return offset & 0x3FF000;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Converts a text device path node to PCI root device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPciRoot(IN CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to PCI root device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPciRoot(IN CHAR16 *TextDeviceNode)
|
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0a03);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* RETURN VALUES: 0 - success -ENOSPC - insufficient free blocks. */
|
static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx)
|
/* RETURN VALUES: 0 - success -ENOSPC - insufficient free blocks. */
static int dbFindLeaf(dmtree_t *tp, int l2nb, int *leafidx)
|
{
int ti, n = 0, k, x = 0;
if (l2nb > tp->dmt_stree[ROOT])
return -ENOSPC;
for (k = le32_to_cpu(tp->dmt_height), ti = 1;
k > 0; k--, ti = ((ti + n) << 2) + 1) {
for (x = ti, n = 0; n < 4; n++) {
if (l2nb <= tp->dmt_stree[x + n])
break;
}
assert(n < 4);
}
*leafidx = x + n - le32_to_cpu(tp->dmt_leafidx);
return (0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Removes the last string from StringList and frees the memory associated with it. */
|
EFI_STATUS RemoveLastStringFromList(IN STRING_LIST *StringList)
|
/* Removes the last string from StringList and frees the memory associated with it. */
EFI_STATUS RemoveLastStringFromList(IN STRING_LIST *StringList)
|
{
if (StringList->Count == 0) {
return EFI_INVALID_PARAMETER;
}
free (StringList->Strings[StringList->Count - 1]);
StringList->Count--;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function registers device and driver to the kernel, requests irq handler and allocates memory for channel objects */
|
static __init int vpif_init(void)
|
/* This function registers device and driver to the kernel, requests irq handler and allocates memory for channel objects */
static __init int vpif_init(void)
|
{
return platform_driver_register(&vpif_driver);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* nfs_wait_bit_killable - helper for functions that are sleeping on bit locks @word: long word containing the bit lock */
|
int nfs_wait_bit_killable(void *word)
|
/* nfs_wait_bit_killable - helper for functions that are sleeping on bit locks @word: long word containing the bit lock */
int nfs_wait_bit_killable(void *word)
|
{
if (fatal_signal_pending(current))
return -ERESTARTSYS;
schedule();
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns zero if successful, or a negative error code on failure. */
|
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
|
/* Returns zero if successful, or a negative error code on failure. */
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
|
{
struct snd_pcm_runtime *runtime;
if (PCM_RUNTIME_CHECK(substream))
return -EINVAL;
runtime = substream->runtime;
if (runtime->dma_area == NULL)
return 0;
if (runtime->dma_buffer_p != &substream->dma_buffer) {
snd_dma_free_pages(runtime->dma_buffer_p);
kfree(runtime->dma_buffer_p);
}
snd_pcm_set_runtime_buffer(substream, NULL);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return the enabled WDT interrupts.
This function returns the enabled WDT interrupts. */
|
uint32_t am_hal_wdt_int_enable_get(void)
|
/* Return the enabled WDT interrupts.
This function returns the enabled WDT interrupts. */
uint32_t am_hal_wdt_int_enable_get(void)
|
{
return AM_REG(WDT, INTEN);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This file contains network checksum routines that are better done in an architecture-specific manner due to speed. */
|
static unsigned short from32to16(unsigned a)
|
/* This file contains network checksum routines that are better done in an architecture-specific manner due to speed. */
static unsigned short from32to16(unsigned a)
|
{
unsigned short b = a >> 16;
asm("addw %w2,%w0\n\t"
"adcw $0,%w0\n"
: "=r" (b)
: "0" (b), "r" (a));
return b;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* 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. */
|
void GPIOPinIntDisable(unsigned long ulPort, unsigned char ucPins)
|
/* 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. */
void GPIOPinIntDisable(unsigned long ulPort, unsigned char ucPins)
|
{
ASSERT(GPIOBaseValid(ulPort));
HWREG(ulPort + GPIO_O_IM) &= ~(ucPins);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* Returns the size in bytes of one single block of a device. This does not take into account the spare zones size. */
|
uint32_t nand_flash_model_get_block_size_in_bytes(const struct nand_flash_model *model)
|
/* Returns the size in bytes of one single block of a device. This does not take into account the spare zones size. */
uint32_t nand_flash_model_get_block_size_in_bytes(const struct nand_flash_model *model)
|
{
return (model->block_size_in_kilobytes * 1024);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* serial core request to flush & disable uart */
|
static void bcm_uart_shutdown(struct uart_port *port)
|
/* serial core request to flush & disable uart */
static void bcm_uart_shutdown(struct uart_port *port)
|
{
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
bcm_uart_writel(port, 0, UART_IR_REG);
spin_unlock_irqrestore(&port->lock, flags);
bcm_uart_disable(port);
bcm_uart_flush(port);
free_irq(port->irq, port);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified I2C interrupt has occurred or not. */
|
ITStatus I2C_GetITStatus(I2C_TypeDef *I2Cx, uint32_t I2C_IT)
|
/* Checks whether the specified I2C interrupt has occurred or not. */
ITStatus I2C_GetITStatus(I2C_TypeDef *I2Cx, uint32_t I2C_IT)
|
{
ITStatus bitstatus = RESET;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_I2C_GET_IT(I2C_IT));
if((I2Cx->IC_RAW_INTR_STAT & I2C_IT) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If reading, bounce the data from the buffer after the request has been handled by the host driver */
|
void mmc_queue_bounce_post(struct mmc_queue *mq)
|
/* If reading, bounce the data from the buffer after the request has been handled by the host driver */
void mmc_queue_bounce_post(struct mmc_queue *mq)
|
{
unsigned long flags;
if (!mq->bounce_buf)
return;
if (rq_data_dir(mq->req) != READ)
return;
local_irq_save(flags);
sg_copy_from_buffer(mq->bounce_sg, mq->bounce_sg_len,
mq->bounce_buf, mq->sg[0].length);
local_irq_restore(flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* STM32L4R/Sxx devices can have up to 512 4K pages on two 256x4K pages banks */
|
static unsigned int get_page(off_t offset)
|
/* STM32L4R/Sxx devices can have up to 512 4K pages on two 256x4K pages banks */
static unsigned int get_page(off_t offset)
|
{
return offset >> STM32L4X_PAGE_SHIFT;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns true if the specified bank has an ECC error; otherwise, false. */
|
static bool ppc4xx_edac_check_bank_error(const struct ppc4xx_ecc_status *status, unsigned int bank)
|
/* Returns true if the specified bank has an ECC error; otherwise, false. */
static bool ppc4xx_edac_check_bank_error(const struct ppc4xx_ecc_status *status, unsigned int bank)
|
{
switch (bank) {
case 0:
return status->ecces & SDRAM_ECCES_BK0ER;
case 1:
return status->ecces & SDRAM_ECCES_BK1ER;
default:
return false;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Writes and returns a new value to DR1. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
|
UINTN EFIAPI AsmWriteDr1(UINTN Dr1)
|
/* Writes and returns a new value to DR1. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr1(UINTN Dr1)
|
{
__asm__ __volatile__ (
"movl %0, %%dr1"
:
: "r" (Dr1)
);
return Dr1;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* To notify on status updates, we (ab)use the NOTIFY hypercall, with the descriptor address of the device. A zero status means "reset". */
|
static void set_status(struct virtio_device *vdev, u8 status)
|
/* To notify on status updates, we (ab)use the NOTIFY hypercall, with the descriptor address of the device. A zero status means "reset". */
static void set_status(struct virtio_device *vdev, u8 status)
|
{
unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices;
to_lgdev(vdev)->desc->status = status;
kvm_hypercall1(LHCALL_NOTIFY, (max_pfn << PAGE_SHIFT) + offset);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check next packet is relocation packet3, do bo validation and compute GPU offset using the provided start. */
|
static int r600_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
|
/* Check next packet is relocation packet3, do bo validation and compute GPU offset using the provided start. */
static int r600_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
|
{
struct radeon_cs_packet p3reloc;
int r;
r = r600_cs_packet_parse(p, &p3reloc, p->idx);
if (r) {
return 0;
}
if (p3reloc.type != PACKET_TYPE3 || p3reloc.opcode != PACKET3_NOP) {
return 0;
}
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Perform a soft reset of ELM and return after reset is done. */
|
void elm_reset(void)
|
/* Perform a soft reset of ELM and return after reset is done. */
void elm_reset(void)
|
{
writel((readl(&elm_cfg->sysconfig) | ELM_SYSCONFIG_SOFTRESET),
&elm_cfg->sysconfig);
while ((readl(&elm_cfg->sysstatus) & ELM_SYSSTATUS_RESETDONE) !=
ELM_SYSSTATUS_RESETDONE)
;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Terminate the current address acquire. All the allocated resources are released. Be careful when calling this function. A rule related to this is: only call DhcpEndSession at the highest level, such as DhcpInput, DhcpOnTimerTick...At the other level, just return error. */
|
VOID DhcpEndSession(IN DHCP_SERVICE *DhcpSb, IN EFI_STATUS Status)
|
/* Terminate the current address acquire. All the allocated resources are released. Be careful when calling this function. A rule related to this is: only call DhcpEndSession at the highest level, such as DhcpInput, DhcpOnTimerTick...At the other level, just return error. */
VOID DhcpEndSession(IN DHCP_SERVICE *DhcpSb, IN EFI_STATUS Status)
|
{
if (DHCP_CONNECTED (DhcpSb->DhcpState)) {
DhcpCallUser (DhcpSb, Dhcp4AddressLost, NULL, NULL);
} else {
DhcpCallUser (DhcpSb, Dhcp4Fail, NULL, NULL);
}
DhcpCleanLease (DhcpSb);
DhcpSb->IoStatus = Status;
DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_ALL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set image_size and ${filesize} to the total size of the downloaded image. */
|
void fastboot_data_complete(char *response)
|
/* Set image_size and ${filesize} to the total size of the downloaded image. */
void fastboot_data_complete(char *response)
|
{
fastboot_okay(NULL, response);
printf("\ndownloading of %d bytes finished\n", fastboot_bytes_received);
image_size = fastboot_bytes_received;
env_set_hex("filesize", image_size);
fastboot_bytes_expected = 0;
fastboot_bytes_received = 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Return whether a failed active open has allocated a TID */
|
static int act_open_has_tid(int status)
|
/* Return whether a failed active open has allocated a TID */
static int act_open_has_tid(int status)
|
{
return status != CPL_ERR_TCAM_FULL && status != CPL_ERR_CONN_EXIST &&
status != CPL_ERR_ARP_MISS;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Indicates the attached device's readiness to handle PHY-related work. Used during startup to start the PHY, and after a call to phy_stop() to resume operation. Also used to indicate the MDIO bus has cleared an error condition. */
|
void phy_start(struct phy_device *phydev)
|
/* Description: Indicates the attached device's readiness to handle PHY-related work. Used during startup to start the PHY, and after a call to phy_stop() to resume operation. Also used to indicate the MDIO bus has cleared an error condition. */
void phy_start(struct phy_device *phydev)
|
{
mutex_lock(&phydev->lock);
switch (phydev->state) {
case PHY_STARTING:
phydev->state = PHY_PENDING;
break;
case PHY_READY:
phydev->state = PHY_UP;
break;
case PHY_HALTED:
phydev->state = PHY_RESUMING;
default:
break;
}
mutex_unlock(&phydev->lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each TMR_InitType member with its default value. */
|
void TMR_StructInit(TMR_InitType *InitStruct)
|
/* Fills each TMR_InitType member with its default value. */
void TMR_StructInit(TMR_InitType *InitStruct)
|
{
InitStruct->ClockSource = TMR_CLKSRC_INTERNAL;
InitStruct->EXTGT = TMR_EXTGT_DISABLE;
InitStruct->Period = 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Performs an atomic compare exchange operation on the 32-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. */
|
UINT32 EFIAPI InternalSyncCompareExchange32(IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
|
/* Performs an atomic compare exchange operation on the 32-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. */
UINT32 EFIAPI InternalSyncCompareExchange32(IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
|
{
__asm__ __volatile__ (
"lock \n\t"
"cmpxchgl %2, %1 \n\t"
: "+a" (CompareValue),
"+m" (*Value)
: "r" (ExchangeValue)
: "memory",
"cc"
);
return CompareValue;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reads and returns the current value of MM3. This function is only available on IA-32 and x64. */
|
UINT64 EFIAPI AsmReadMm3(VOID)
|
/* Reads and returns the current value of MM3. This function is only available on IA-32 and x64. */
UINT64 EFIAPI AsmReadMm3(VOID)
|
{
_asm {
push eax
push eax
movq [esp], mm3
pop eax
pop edx
emms
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* STUSB1602 checks the Power Role SWAP status (bit2 0x18 */
|
Power_Role_Swap_TypeDef STUSB1602_Power_Role_Swap_Status_Get(uint8_t Addr)
|
/* STUSB1602 checks the Power Role SWAP status (bit2 0x18 */
Power_Role_Swap_TypeDef STUSB1602_Power_Role_Swap_Status_Get(uint8_t Addr)
|
{
STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
return (Power_Role_Swap_TypeDef)(reg.b.PR_SWAP_EN);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* @family: Generic netlink family the group belongs to. @grp: The group to unregister, must have been registered successfully previously. */
|
void genl_unregister_mc_group(struct genl_family *family, struct genl_multicast_group *grp)
|
/* @family: Generic netlink family the group belongs to. @grp: The group to unregister, must have been registered successfully previously. */
void genl_unregister_mc_group(struct genl_family *family, struct genl_multicast_group *grp)
|
{
genl_lock();
__genl_unregister_mc_group(family, grp);
genl_unlock();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* You should not use this function to access IO space, use memcpy_toio() or memcpy_fromio() instead. */
|
void* memcpy(void *dest, const void *src, size_t count)
|
/* You should not use this function to access IO space, use memcpy_toio() or memcpy_fromio() instead. */
void* memcpy(void *dest, const void *src, size_t count)
|
{
char *tmp = dest;
const char *s = src;
while (count--)
*tmp++ = *s++;
return dest;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Translate raw data into Unicode (according to different encode), and translate Unicode into key information. (according to different standard). */
|
VOID TranslateRawDataToEfiKey(IN TERMINAL_DEV *TerminalDevice)
|
/* Translate raw data into Unicode (according to different encode), and translate Unicode into key information. (according to different standard). */
VOID TranslateRawDataToEfiKey(IN TERMINAL_DEV *TerminalDevice)
|
{
switch (TerminalDevice->TerminalType) {
case TerminalTypePcAnsi:
case TerminalTypeVt100:
case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm:
case TerminalTypeLinux:
case TerminalTypeXtermR6:
case TerminalTypeVt400:
case TerminalTypeSCO:
AnsiRawDataToUnicode (TerminalDevice);
UnicodeToEfiKey (TerminalDevice);
break;
case TerminalTypeVtUtf8:
VTUTF8RawDataToUnicode (TerminalDevice);
UnicodeToEfiKey (TerminalDevice);
break;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* general buffer to hold results from APDU calls */
|
VCardResponse* vcard_response_new_bytes(VCard *card, unsigned char *buf, int len, int Le, unsigned char sw1, unsigned char sw2)
|
/* general buffer to hold results from APDU calls */
VCardResponse* vcard_response_new_bytes(VCard *card, unsigned char *buf, int len, int Le, unsigned char sw1, unsigned char sw2)
|
{
VCardResponse *new_response;
if (len > Le) {
return vcard_init_buffer_response(card, buf, len);
}
new_response = vcard_response_new_data(buf, len);
if (new_response == NULL) {
return NULL;
}
vcard_response_set_status_bytes(new_response, sw1, sw2);
return new_response;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* cio_disable_subchannel - disable a subchannel. @sch: subchannel to disable */
|
int cio_disable_subchannel(struct subchannel *sch)
|
/* cio_disable_subchannel - disable a subchannel. @sch: subchannel to disable */
int cio_disable_subchannel(struct subchannel *sch)
|
{
int retry;
int ret;
CIO_TRACE_EVENT(2, "dissch");
CIO_TRACE_EVENT(2, dev_name(&sch->dev));
if (sch_is_pseudo_sch(sch))
return 0;
if (cio_update_schib(sch))
return -ENODEV;
sch->config.ena = 0;
for (retry = 0; retry < 3; retry++) {
ret = cio_commit_config(sch);
if (ret == -EBUSY) {
struct irb irb;
if (tsch(sch->schid, &irb) != 0)
break;
} else
break;
}
CIO_HEX_EVENT(2, &ret, sizeof(ret));
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: the data element corresponding to the string, or NULL if it is not found. */
|
gpointer g_dataset_id_get_data(gconstpointer dataset_location, GQuark key_id)
|
/* Returns: the data element corresponding to the string, or NULL if it is not found. */
gpointer g_dataset_id_get_data(gconstpointer dataset_location, GQuark key_id)
|
{
gpointer retval = NULL;
g_return_val_if_fail (dataset_location != NULL, NULL);
G_LOCK (g_dataset_global);
if (key_id && g_dataset_location_ht)
{
GDataset *dataset;
dataset = g_dataset_lookup (dataset_location);
if (dataset)
retval = g_datalist_id_get_data (&dataset->datalist, key_id);
}
G_UNLOCK (g_dataset_global);
return retval;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Get the PDMA of a channel busy or not. */
|
xtBoolean PDMAChannelIsBusy(unsigned long ulChannelID)
|
/* Get the PDMA of a channel busy or not. */
xtBoolean PDMAChannelIsBusy(unsigned long ulChannelID)
|
{
xASSERT(xDMAChannelIDValid(ulChannelID));
return ((xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CSR)
| PDMA_CSR_TEN) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Looks up the device configuration based on the unique device ID. A table contains the configuration info for each device in the system. */
|
XQspiPs_Config* XQspiPs_LookupConfig(u16 DeviceId)
|
/* Looks up the device configuration based on the unique device ID. A table contains the configuration info for each device in the system. */
XQspiPs_Config* XQspiPs_LookupConfig(u16 DeviceId)
|
{
XQspiPs_Config *CfgPtr = NULL;
int Index;
for (Index = 0; Index < XPAR_XQSPIPS_NUM_INSTANCES; Index++) {
if (XQspiPs_ConfigTable[Index].DeviceId == DeviceId) {
CfgPtr = &XQspiPs_ConfigTable[Index];
break;
}
}
return CfgPtr;
}
/** @}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* If @mem is NULL it simply returns, so there is no need to check @mem against NULL before calling this function. */
|
void g_free(gpointer mem)
|
/* If @mem is NULL it simply returns, so there is no need to check @mem against NULL before calling this function. */
void g_free(gpointer mem)
|
{
if (G_LIKELY (mem))
free (mem);
TRACE(GLIB_MEM_FREE((void*) mem));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function is called when a packet transmission fails to complete within a reasonable period, on the assumption that an interrupt have failed or the interface is locked up. This function will reinitialize the hardware. */
|
static void amd8111e_tx_timeout(struct net_device *dev)
|
/* This function is called when a packet transmission fails to complete within a reasonable period, on the assumption that an interrupt have failed or the interface is locked up. This function will reinitialize the hardware. */
static void amd8111e_tx_timeout(struct net_device *dev)
|
{
struct amd8111e_priv* lp = netdev_priv(dev);
int err;
printk(KERN_ERR "%s: transmit timed out, resetting\n",
dev->name);
spin_lock_irq(&lp->lock);
err = amd8111e_restart(dev);
spin_unlock_irq(&lp->lock);
if(!err)
netif_wake_queue(dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* A device has been discovered in front of this station, we report directly to LMP. */
|
void irlap_discovery_confirm(struct irlap_cb *self, hashbin_t *discovery_log)
|
/* A device has been discovered in front of this station, we report directly to LMP. */
void irlap_discovery_confirm(struct irlap_cb *self, hashbin_t *discovery_log)
|
{
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
IRDA_ASSERT(self->notify.instance != NULL, return;);
if (discovery_log)
irda_device_set_media_busy(self->netdev, FALSE);
irlmp_link_discovery_confirm(self->notify.instance, discovery_log);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Process SET PGID request result for a single path. */
|
static void spid_callback(struct ccw_device *cdev, void *data, int rc)
|
/* Process SET PGID request result for a single path. */
static void spid_callback(struct ccw_device *cdev, void *data, int rc)
|
{
struct subchannel *sch = to_subchannel(cdev->dev.parent);
struct ccw_request *req = &cdev->private->req;
switch (rc) {
case 0:
sch->vpm |= req->lpm & sch->opm;
break;
case -EACCES:
break;
case -EOPNOTSUPP:
if (cdev->private->flags.mpath) {
cdev->private->flags.mpath = 0;
goto out_restart;
}
cdev->private->flags.pgroup = 0;
goto out_restart;
default:
goto err;
}
req->lpm >>= 1;
spid_do(cdev);
return;
out_restart:
verify_start(cdev);
return;
err:
verify_done(cdev, rc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The HwInfoParser shall use the information provided by the HwDataSource to initialise the internal state of the parser or to index the data. This internal state shall be linked to the ParserHandle using an implementation defined mechanism. */
|
EFI_STATUS EFIAPI HwInfoParserInit(IN VOID *HwDataSource, IN VOID *Context, IN HW_INFO_ADD_OBJECT HwInfoAdd, OUT HW_INFO_PARSER_HANDLE *ParserHandle)
|
/* The HwInfoParser shall use the information provided by the HwDataSource to initialise the internal state of the parser or to index the data. This internal state shall be linked to the ParserHandle using an implementation defined mechanism. */
EFI_STATUS EFIAPI HwInfoParserInit(IN VOID *HwDataSource, IN VOID *Context, IN HW_INFO_ADD_OBJECT HwInfoAdd, OUT HW_INFO_PARSER_HANDLE *ParserHandle)
|
{
FDT_HW_INFO_PARSER *FdtParserHandle;
if ((ParserHandle == NULL) ||
(HwInfoAdd == NULL) ||
(HwDataSource == NULL) ||
(fdt_check_header (HwDataSource) < 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
FdtParserHandle = AllocateZeroPool (sizeof (FDT_HW_INFO_PARSER));
if (FdtParserHandle == NULL) {
*ParserHandle = NULL;
return EFI_OUT_OF_RESOURCES;
}
FdtParserHandle->Fdt = HwDataSource;
FdtParserHandle->Context = Context;
FdtParserHandle->HwInfoAdd = HwInfoAdd;
*ParserHandle = (HW_INFO_PARSER_HANDLE)FdtParserHandle;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
|
EFI_STATUS EFIAPI I2cBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI I2cBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mI2cBusDriverNameTable,
DriverName,
(BOOLEAN)(This != &gI2cBusComponentName2)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* igbvf_irq_disable - Mask off interrupt generation on the NIC */
|
static void igbvf_irq_disable(struct igbvf_adapter *adapter)
|
/* igbvf_irq_disable - Mask off interrupt generation on the NIC */
static void igbvf_irq_disable(struct igbvf_adapter *adapter)
|
{
struct e1000_hw *hw = &adapter->hw;
ew32(EIMC, ~0);
if (adapter->msix_entries)
ew32(EIAC, 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables the events that can trigger a uDMA request. */
|
void TimerDMAEventSet(uint32_t ui32Base, uint32_t ui32DMAEvent)
|
/* Enables the events that can trigger a uDMA request. */
void TimerDMAEventSet(uint32_t ui32Base, uint32_t ui32DMAEvent)
|
{
ASSERT(_TimerBaseValid(ui32Base));
HWREG(ui32Base + TIMER_O_DMAEV) = ui32DMAEvent;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Input pkt hook. Will call bound ip_vs_app specific function called by ipvs packet handler, assumes previously checked cp!=NULL. returns false if can't handle packet (oom). */
|
int ip_vs_app_pkt_in(struct ip_vs_conn *cp, struct sk_buff *skb)
|
/* Input pkt hook. Will call bound ip_vs_app specific function called by ipvs packet handler, assumes previously checked cp!=NULL. returns false if can't handle packet (oom). */
int ip_vs_app_pkt_in(struct ip_vs_conn *cp, struct sk_buff *skb)
|
{
struct ip_vs_app *app;
if ((app = cp->app) == NULL)
return 1;
if (cp->protocol == IPPROTO_TCP)
return app_tcp_pkt_in(cp, skb, app);
if (app->pkt_in == NULL)
return 1;
return app->pkt_in(app, cp, skb, NULL);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* ADC Read the Overrun Flag.
The overrun flag is set when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted. */
|
bool adc_get_overrun_flag(uint32_t adc)
|
/* ADC Read the Overrun Flag.
The overrun flag is set when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted. */
bool adc_get_overrun_flag(uint32_t adc)
|
{
return ADC_SR(adc) & ADC_SR_OVR;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Qsort comparison routine for the block leaf entries. */
|
static int xfs_dir2_block_sort(const void *a, const void *b)
|
/* Qsort comparison routine for the block leaf entries. */
static int xfs_dir2_block_sort(const void *a, const void *b)
|
{
const xfs_dir2_leaf_entry_t *la;
const xfs_dir2_leaf_entry_t *lb;
la = a;
lb = b;
return be32_to_cpu(la->hashval) < be32_to_cpu(lb->hashval) ? -1 :
(be32_to_cpu(la->hashval) > be32_to_cpu(lb->hashval) ? 1 : 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Queue a request to the head of the device ccw_queue. Start the I/O if possible. */
|
void dasd_add_request_head(struct dasd_ccw_req *cqr)
|
/* Queue a request to the head of the device ccw_queue. Start the I/O if possible. */
void dasd_add_request_head(struct dasd_ccw_req *cqr)
|
{
struct dasd_device *device;
unsigned long flags;
device = cqr->startdev;
spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
cqr->status = DASD_CQR_QUEUED;
list_add(&cqr->devlist, &device->ccw_queue);
dasd_schedule_device_bh(device);
spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The example of the function of read and write. */
|
void AT25FS0xReadWrite(void)
|
/* The example of the function of read and write. */
void AT25FS0xReadWrite(void)
|
{
unsigned long i;
unsigned short ulID;
xSysCtlClockSet(50000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ);
UartInit();
AT25FS0xInit(10000000);
ulID = AT25FS0xIDcodeGet();
i = ulID;
UartPrintfNumber(ulID);
UartPrintfChar('\n');
UartPrintfChar('\r');
for(i = 0; i < Length; i++)
{
ucWriteData[i] = i;
}
AT25FS0xChipErase();
AT25FS0xWrite(ucWriteData, 100, Length);
SysCtlDelay(50000000);
AT25FS0xDataRead(ucReadData, 100, Length);
for(i = 0; i < Length; i++)
{
UartPrintfChar(ucReadData[i]);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Free memory associated with a variable serialization instance */
|
RETURN_STATUS EFIAPI SerializeVariablesFreeInstance(IN EFI_HANDLE Handle)
|
/* Free memory associated with a variable serialization instance */
RETURN_STATUS EFIAPI SerializeVariablesFreeInstance(IN EFI_HANDLE Handle)
|
{
SV_INSTANCE *Instance;
Instance = SV_FROM_HANDLE (Handle);
if (Instance->Signature != SV_SIGNATURE) {
return RETURN_INVALID_PARAMETER;
}
Instance->Signature = 0;
if (Instance->BufferPtr != NULL) {
FreePool (Instance->BufferPtr);
}
FreePool (Instance);
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read a byte from the given I2C instance. */
|
uint8_t _i2c_s_sync_read_byte(const struct _i2c_s_sync_device *const device)
|
/* Read a byte from the given I2C instance. */
uint8_t _i2c_s_sync_read_byte(const struct _i2c_s_sync_device *const device)
|
{
return hri_sercomi2cs_read_DATA_reg(device->hw);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* platform_leave - prepare the machine for switching to the normal mode of operation using the platform driver (called with interrupts disabled) */
|
static void platform_leave(int platform_mode)
|
/* platform_leave - prepare the machine for switching to the normal mode of operation using the platform driver (called with interrupts disabled) */
static void platform_leave(int platform_mode)
|
{
if (platform_mode && hibernation_ops)
hibernation_ops->leave();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable The VBat Sensor. This enables the battery voltage measurements on ADC1 channel 18. On STM32F42x and STM32F43x, this must be disabled when the temperature sensor is enabled. If both are enabled, only the VBat conversion is performed. */
|
void adc_enable_vbat_sensor(void)
|
/* Enable The VBat Sensor. This enables the battery voltage measurements on ADC1 channel 18. On STM32F42x and STM32F43x, this must be disabled when the temperature sensor is enabled. If both are enabled, only the VBat conversion is performed. */
void adc_enable_vbat_sensor(void)
|
{
ADC_CCR |= ADC_CCR_VBATE;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* enable/disable the glitch filter; mostly used with IRQ handling. */
|
int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
|
/* enable/disable the glitch filter; mostly used with IRQ handling. */
int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
|
{
void __iomem *pio = pin_to_controller(pin);
unsigned mask = pin_to_mask(pin);
if (!pio)
return -EINVAL;
__raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Reads the sensor and returns the data as a sensors_event_t. */
|
err_t lsm303magGetSensorEvent(sensors_event_t *event)
|
/* Reads the sensor and returns the data as a sensors_event_t. */
err_t lsm303magGetSensorEvent(sensors_event_t *event)
|
{
memset(event, 0, sizeof(sensors_event_t));
event->version = sizeof(sensors_event_t);
event->sensor_id = _lsm303magSensorID;
event->type = SENSOR_TYPE_MAGNETIC_FIELD;
event->timestamp = delayGetTicks();
ASSERT_STATUS(lsm303magRead());
event->magnetic.x = _lsm303magData.x / _lsm303mag_Gauss_LSB_XY * SENSORS_GAUSS_TO_MICROTESLA;
event->magnetic.y = _lsm303magData.y / _lsm303mag_Gauss_LSB_XY * SENSORS_GAUSS_TO_MICROTESLA;
event->magnetic.z = _lsm303magData.z / _lsm303mag_Gauss_LSB_Z * SENSORS_GAUSS_TO_MICROTESLA;
return ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* This function is used to disable the tamper feature functionality. All other configuration settings are left unmodified, allowing a call to */
|
void HibernateTamperDisable(void)
|
/* This function is used to disable the tamper feature functionality. All other configuration settings are left unmodified, allowing a call to */
void HibernateTamperDisable(void)
|
{
HWREG(HIB_LOCK) = HIB_LOCK_HIBLOCK_KEY;
_HibernateWriteComplete();
HWREG(HIB_TPCTL) &= ~HIB_TPCTL_TPEN;
_HibernateWriteComplete();
HWREG(HIB_LOCK) = 0;
_HibernateWriteComplete();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable AHB1 peripheral clock during Low Power (Sleep) mode. */
|
void RCM_DisableAHB1PeriphClockLPMode(uint32_t AHB1Periph)
|
/* Disable AHB1 peripheral clock during Low Power (Sleep) mode. */
void RCM_DisableAHB1PeriphClockLPMode(uint32_t AHB1Periph)
|
{
RCM->LPAHB1CLKEN &= (uint32_t)~AHB1Periph;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
|
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
|
{
if(heth->Instance==ETH)
{
__HAL_RCC_ETH_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_14|GPIO_PIN_13|GPIO_PIN_11);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7);
HAL_NVIC_DisableIRQ(ETH_IRQn);
}
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Close UART communication and free memory from UART descriptor. */
|
int32_t usr_uart_remove(struct uart_desc *desc)
|
/* Close UART communication and free memory from UART descriptor. */
int32_t usr_uart_remove(struct uart_desc *desc)
|
{
if(!desc)
return -1;
return adi_uart_Close(h_uart_device);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Read then Measure and log an EFI boot variable, and extend the measurement result into PCR. according to TCG PC Client PFP spec 0021 Section 2.4.4.2 */
|
EFI_STATUS ReadAndMeasureBootVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
|
/* Read then Measure and log an EFI boot variable, and extend the measurement result into PCR. according to TCG PC Client PFP spec 0021 Section 2.4.4.2 */
EFI_STATUS ReadAndMeasureBootVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
|
{
return ReadAndMeasureVariable (
MapPcrToMrIndex (1),
EV_EFI_VARIABLE_BOOT,
VarName,
VendorGuid,
VarSize,
VarData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). */
|
UINT64 EFIAPI IoWrite64(IN UINTN Port, IN UINT64 Value)
|
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64 EFIAPI IoWrite64(IN UINTN Port, IN UINT64 Value)
|
{
CONST EFI_PEI_SERVICES **PeiServices;
EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
ASSERT ((Port & 7) == 0);
CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64)Port, Value);
return Value;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Send data described by an array of iovecs out the i/o port. */
|
STATIC VOID BIov_SendAll(IN BIO_VEC b[])
|
/* Send data described by an array of iovecs out the i/o port. */
STATIC VOID BIov_SendAll(IN BIO_VEC b[])
|
{
INT32 i;
if (b != NULL) {
for (i = 0; b[i].Base; i++) {
BIov_Send (b[i].Base, b[i].Len);
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is similar to 'lnc_add()', but it does not create a copy of @node but inserts @node to TNC directly. */
|
static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
|
/* This function is similar to 'lnc_add()', but it does not create a copy of @node but inserts @node to TNC directly. */
static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, void *node)
|
{
int err;
ubifs_assert(!zbr->leaf);
ubifs_assert(zbr->len != 0);
err = ubifs_validate_entry(c, node);
if (err) {
dbg_dump_stack();
dbg_dump_node(c, node);
return err;
}
zbr->leaf = node;
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Selects the clock source to output on MCO pin. */
|
void RCC_MCOConfig(uint8_t RCC_MCO)
|
/* Selects the clock source to output on MCO pin. */
void RCC_MCOConfig(uint8_t RCC_MCO)
|
{
assert_param(IS_RCC_MCO(RCC_MCO));
*(__IO uint8_t *) CFGR_BYTE4_ADDRESS = RCC_MCO;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* ac97 interface Wait for the ac97 serial bus to be free. return nonzero if the bus is still busy. */
|
static int snd_m3_ac97_wait(struct snd_m3 *chip)
|
/* ac97 interface Wait for the ac97 serial bus to be free. return nonzero if the bus is still busy. */
static int snd_m3_ac97_wait(struct snd_m3 *chip)
|
{
int i = 10000;
do {
if (! (snd_m3_inb(chip, 0x30) & 1))
return 0;
cpu_relax();
} while (i-- > 0);
snd_printk(KERN_ERR "ac97 serial bus busy\n");
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Push a formatted message referring to file access onto the statusbar. */
|
static void statusbar_push_file_msg(const gchar *msg_format,...) G_GNUC_PRINTF(1
|
/* Push a formatted message referring to file access onto the statusbar. */
static void statusbar_push_file_msg(const gchar *msg_format,...) G_GNUC_PRINTF(1
|
{
va_list ap;
gchar *msg;
if (higher_priority_status_level(STATUS_LEVEL_FILE))
return;
status_levels[STATUS_LEVEL_FILE]++;
va_start(ap, msg_format);
msg = g_strdup_vprintf(msg_format, ap);
va_end(ap);
gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, msg);
g_free(msg);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* fasync_helper() is used by almost all character device drivers to set up the fasync queue, and for regular files by the file lease code. It returns negative on error, 0 if it did no changes and positive if it added/deleted the entry. */
|
int fasync_helper(int fd, struct file *filp, int on, struct fasync_struct **fapp)
|
/* fasync_helper() is used by almost all character device drivers to set up the fasync queue, and for regular files by the file lease code. It returns negative on error, 0 if it did no changes and positive if it added/deleted the entry. */
int fasync_helper(int fd, struct file *filp, int on, struct fasync_struct **fapp)
|
{
if (!on)
return fasync_remove_entry(filp, fapp);
return fasync_add_entry(fd, filp, fapp);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Remove a picture from the long term reference list by its index in that list. */
|
static Picture* remove_long(H264Context *h, int i, int ref_mask)
|
/* Remove a picture from the long term reference list by its index in that list. */
static Picture* remove_long(H264Context *h, int i, int ref_mask)
|
{
if(unreference_pic(h, pic, ref_mask)){
assert(h->long_ref[i]->long_ref == 1);
h->long_ref[i]->long_ref= 0;
h->long_ref[i]= NULL;
h->long_ref_count--;
}
}
return pic;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* This convenience API allows consumers to free multiple regulator clients in a single API call. */
|
void regulator_bulk_free(int num_consumers, struct regulator_bulk_data *consumers)
|
/* This convenience API allows consumers to free multiple regulator clients in a single API call. */
void regulator_bulk_free(int num_consumers, struct regulator_bulk_data *consumers)
|
{
int i;
for (i = 0; i < num_consumers; i++) {
regulator_put(consumers[i].consumer);
consumers[i].consumer = NULL;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read header information from EEPROM into global structure. */
|
static int read_eeprom(struct board_eeconfig *header)
|
/* Read header information from EEPROM into global structure. */
static int read_eeprom(struct board_eeconfig *header)
|
{
if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR))
return -ENODEV;
if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
sizeof(struct board_eeconfig)))
return -EIO;
if (header->magic != BOARD_MAGIC) {
if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
sizeof(struct board_eeconfig)))
return -EIO;
if (header->magic != BOARD_MAGIC)
return -EINVAL;
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Setup EDC and other parameters for operation with an optical module. */
|
static int ael2020_setup_sr_edc(struct cphy *phy)
|
/* Setup EDC and other parameters for operation with an optical module. */
static int ael2020_setup_sr_edc(struct cphy *phy)
|
{
static struct reg_val regs[] = {
{ MDIO_MMD_PMAPMD, 0xcc01, 0xffff, 0x488a },
{ MDIO_MMD_PMAPMD, 0xcb1b, 0xffff, 0x0200 },
{ MDIO_MMD_PMAPMD, 0xcb1c, 0xffff, 0x00f0 },
{ MDIO_MMD_PMAPMD, 0xcc06, 0xffff, 0x00e0 },
{ 0, 0, 0, 0 }
};
int err;
err = set_phy_regs(phy, regs);
msleep(50);
if (err)
return err;
phy->priv = edc_sr;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check and return Redfish resource of the given Redpath. */
|
EFI_STATUS RedfishCheckIfRedpathExist(IN REDFISH_SERVICE RedfishService, IN CHAR8 *Redpath, IN REDFISH_RESPONSE *Response OPTIONAL)
|
/* Check and return Redfish resource of the given Redpath. */
EFI_STATUS RedfishCheckIfRedpathExist(IN REDFISH_SERVICE RedfishService, IN CHAR8 *Redpath, IN REDFISH_RESPONSE *Response OPTIONAL)
|
{
EFI_STATUS Status;
REDFISH_RESPONSE TempResponse;
if (Redpath == NULL) {
return EFI_INVALID_PARAMETER;
}
Status = RedfishGetByService (RedfishService, Redpath, &TempResponse);
if (EFI_ERROR (Status)) {
return Status;
}
if (Response == NULL) {
RedfishFreeResponse (
TempResponse.StatusCode,
TempResponse.HeaderCount,
TempResponse.Headers,
TempResponse.Payload
);
} else {
CopyMem ((VOID *)Response, (VOID *)&TempResponse, sizeof (REDFISH_RESPONSE));
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* @regno: boolean, 0 copy local, 1 get_user() function @red: frame buffer colormap structure @green: The green value which can be up to 16 bits wide @blue: The blue value which can be up to 16 bits wide. @transp: If supported the alpha value which can be up to 16 bits wide. @info: frame buffer info structure */
|
static int ffb_setcolreg(unsigned, unsigned, unsigned, unsigned, unsigned, struct fb_info *)
|
/* @regno: boolean, 0 copy local, 1 get_user() function @red: frame buffer colormap structure @green: The green value which can be up to 16 bits wide @blue: The blue value which can be up to 16 bits wide. @transp: If supported the alpha value which can be up to 16 bits wide. @info: frame buffer info structure */
static int ffb_setcolreg(unsigned, unsigned, unsigned, unsigned, unsigned, struct fb_info *)
|
{
u32 value;
if (regno >= 16)
return 1;
red >>= 8;
green >>= 8;
blue >>= 8;
value = (blue << 16) | (green << 8) | red;
((u32 *)info->pseudo_palette)[regno] = value;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Run adc_read for given channels and collect specified number of samples. */
|
static void start_adc_read(const struct device *adc_dev, uint32_t channel_mask, int samples)
|
/* Run adc_read for given channels and collect specified number of samples. */
static void start_adc_read(const struct device *adc_dev, uint32_t channel_mask, int samples)
|
{
int ret;
const struct adc_sequence_options *options_ptr;
const struct adc_sequence_options options = {
.extra_samplings = samples - 1,
};
if (samples > 1) {
options_ptr = &options;
} else {
options_ptr = NULL;
}
const struct adc_sequence sequence = {
.options = options_ptr,
.channels = channel_mask,
.buffer = m_sample_buffer,
.buffer_size = sizeof(m_sample_buffer),
.resolution = ADC_RESOLUTION,
};
ret = adc_read(adc_dev, &sequence);
zassert_ok(ret, "adc_read() failed with code %d", ret);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Bits taken from various places. We now use the slot ID instead of the device identifiers to select which interrupt is routed where. */
|
static int __init netwinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
|
/* Bits taken from various places. We now use the slot ID instead of the device identifiers to select which interrupt is routed where. */
static int __init netwinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
|
{
switch (slot) {
case 0:
return 0;
case 9:
return IRQ_NETWINDER_VGA;
case 10:
return IRQ_NETWINDER_ETHER100;
case 12:
return IRQ_ISA_HARDDISK1;
case 13:
return IRQ_NETWINDER_ETHER10;
default:
printk(KERN_ERR "PCI: unknown device in slot %s\n",
pci_name(dev));
return 0;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Retrieve the organization name (O) string from one X.509 certificate. */
|
RETURN_STATUS EFIAPI X509GetOrganizationName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *NameBuffer OPTIONAL, IN OUT UINTN *NameBufferSize)
|
/* Retrieve the organization name (O) string from one X.509 certificate. */
RETURN_STATUS EFIAPI X509GetOrganizationName(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT CHAR8 *NameBuffer OPTIONAL, IN OUT UINTN *NameBufferSize)
|
{
CALL_CRYPTO_SERVICE (X509GetOrganizationName, (Cert, CertSize, NameBuffer, NameBufferSize), RETURN_UNSUPPORTED);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If arg_element->dest points to a place to store a possible value, read it If there is a callback registered, call it after */
|
static void cmd_handle_this_matched_arg(char *argv, int offset, struct args_struct_t *arg_element)
|
/* If arg_element->dest points to a place to store a possible value, read it If there is a callback registered, call it after */
static void cmd_handle_this_matched_arg(char *argv, int offset, struct args_struct_t *arg_element)
|
{
if (arg_element->dest != NULL) {
if (arg_element->is_switch) {
if (arg_element->type == 'b') {
*(bool *)arg_element->dest = true;
} else {
posix_print_error_and_exit(CMD_ERR_BOOL_SWI);
}
} else {
cmd_read_option_value(&argv[offset],
arg_element->dest,
arg_element->type,
arg_element->option);
}
}
if (arg_element->call_when_found) {
arg_element->call_when_found(argv, offset);
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.