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 |
|---|---|---|---|---|---|---|---|
/* pdcs_autoboot_read - Stable Storage autoboot flag output. @buf: The output buffer to write to. */ | static ssize_t pdcs_autoboot_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf) | /* pdcs_autoboot_read - Stable Storage autoboot flag output. @buf: The output buffer to write to. */
static ssize_t pdcs_autoboot_read(struct kobject *kobj, struct kobj_attribute *attr, char *buf) | {
return pdcs_auto_read(kobj, attr, buf, PF_AUTOBOOT);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Task function for blinking the LED as a fixed timer interval. */ | void LedBlinkTask(void) | /* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void) | {
static blt_bool ledOn = BLT_FALSE;
static blt_int32u nextBlinkEvent = 0;
if (TimerGet() >= nextBlinkEvent)
{
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
IfxPort_setPinLow(&MODULE_P00, 5U);
}
else
{
ledOn = BLT_FALSE;
IfxPort_setPinHigh(&MODULE_P00, 5U);
}
nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This is called AFTER we have verified that there is room on the page for the pair (PAIRFITS has returned true) so we go right ahead and start moving stuff on. */ | static void putpair(char *p, const DBT *key, const DBT *val) | /* This is called AFTER we have verified that there is room on the page for the pair (PAIRFITS has returned true) so we go right ahead and start moving stuff on. */
static void putpair(char *p, const DBT *key, const DBT *val) | {
register u_int16_t *bp, n, off;
bp = (u_int16_t *)p;
n = bp[0];
off = OFFSET(bp) - key->size;
memmove(p + off, key->data, key->size);
bp[++n] = off;
off -= val->size;
memmove(p + off, val->data, val->size);
bp[++n] = off;
bp[0] = n;
bp[n + 1] = off - ((n + 3) * sizeof(u_int16_t));
bp[n + 2] = off;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Allocate a dir-state structure. We don't put them on the stack since they're large. */ | xfs_da_state_t* xfs_da_state_alloc(void) | /* Allocate a dir-state structure. We don't put them on the stack since they're large. */
xfs_da_state_t* xfs_da_state_alloc(void) | {
return kmem_zone_zalloc(xfs_da_state_zone, KM_NOFS);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable a expio pin's interrupt by clearing the bit in the imr. */ | static void expio_unmask_irq(uint32_t irq) | /* Enable a expio pin's interrupt by clearing the bit in the imr. */
static void expio_unmask_irq(uint32_t irq) | {
uint16_t reg;
uint32_t expio = MXC_IRQ_TO_EXPIO(irq);
reg = __raw_readw(CPLD_INT_MASK_REG);
reg &= ~(1 << expio);
__raw_writew(reg, CPLD_INT_MASK_REG);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Create a single YUV cell from a 2x2 section of the image */ | static void frame_block_to_cell(uint8_t *block, uint8_t **data, int top, int left, int *stride) | /* Create a single YUV cell from a 2x2 section of the image */
static void frame_block_to_cell(uint8_t *block, uint8_t **data, int top, int left, int *stride) | {
int i, j, u=0, v=0;
for (i=0; i<2; i++)
for (j=0; j<2; j++) {
int x = (top+i)*stride[0] + left + j;
*block++ = data[0][x];
x = (top+i)*stride[1] + left + j;
u += data[1][x];
v += data[2][x];
}
*block++ = (u+2)/4;
*block++ = (v+2)/4;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* The first half of the feature bitmask is for us to advertise features. The second half is for the Guest to accept features. */ | static void add_feature(struct device *dev, unsigned bit) | /* The first half of the feature bitmask is for us to advertise features. The second half is for the Guest to accept features. */
static void add_feature(struct device *dev, unsigned bit) | {
u8 *features = get_feature_bits(dev);
if (dev->desc->feature_len <= bit / CHAR_BIT) {
assert(dev->desc->config_len == 0);
dev->feature_len = dev->desc->feature_len = (bit/CHAR_BIT) + 1;
}
features[bit / CHAR_BIT] |= (1 << (bit % CHAR_BIT));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the clock rate of the specified I2C port.
The */ | void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned long ulGeneralCall) | /* Set the clock rate of the specified I2C port.
The */
void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned long ulGeneralCall) | {
xASSERT((ulBase == I2C0_BASE));
if (ulBase == I2C0_BASE)
{
SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
}
xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1;
xHWREG(ulBase + I2C_O_CON) = 0;
xHWREG(ulBase + I2C_O_ADDR0) = (ucSlaveAddr << 1) | ulGeneralCall;
xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1;
xHWREG(ulBase + I2C_O_CON) |= I2C_CON_AA;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* !IMPORTANT: The SSW Configuration shall be defined at Application SW Configuration Please refer to iLLD demos for startup sw configuration (Ifx_Cfg_Ssw.c and .h) */ | static void __StartUpSoftware(void) | /* !IMPORTANT: The SSW Configuration shall be defined at Application SW Configuration Please refer to iLLD demos for startup sw configuration (Ifx_Cfg_Ssw.c and .h) */
static void __StartUpSoftware(void) | {
Ifx_Ssw_setAddressReg(a1, __SDATA2(0));
Ifx_Ssw_MTCR(CPU_PSW, IFX_CFG_SSW_PSW_DEFAULT);
if (Ifx_Ssw_isApplicationReset() != 1)
{
Ifx_Ssw_jumpToFunction(__StartUpSoftware_Phase2);
}
else
{
Ifx_Ssw_jumpToFunction(__StartUpSoftware_Phase3ApplicationResetPath);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Encode a point into a buffer. This function assumes that the point is valid, in affine coordinates, and not the point at infinity. */ | static void p256_encode(void *dst, const p256_jacobian *P) | /* Encode a point into a buffer. This function assumes that the point is valid, in affine coordinates, and not the point at infinity. */
static void p256_encode(void *dst, const p256_jacobian *P) | {
unsigned char *buf;
buf = dst;
buf[0] = 0x04;
le13_to_be8(buf + 1, 32, P->x);
le13_to_be8(buf + 33, 32, P->y);
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* calc_load - update the avenrun load estimates 10 ticks after the CPUs have updated calc_load_tasks. */ | void calc_global_load(void) | /* calc_load - update the avenrun load estimates 10 ticks after the CPUs have updated calc_load_tasks. */
void calc_global_load(void) | {
unsigned long upd = calc_load_update + 10;
long active;
if (time_before(jiffies, upd))
return;
active = atomic_long_read(&calc_load_tasks);
active = active > 0 ? active * FIXED_1 : 0;
avenrun[0] = calc_load(avenrun[0], EXP_1, active);
avenrun[1] = calc_load(avenrun[1], EXP_5, active);
avenrun[2] = calc_load(avenrun[2], EXP_15, active);
calc_load_update += LOAD_FREQ;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable or disable the access control of the unit. */ | void MPU_UnitCmd(uint32_t u32Unit, en_functional_state_t enNewState) | /* Enable or disable the access control of the unit. */
void MPU_UnitCmd(uint32_t u32Unit, en_functional_state_t enNewState) | {
__IO uint32_t *CR;
uint32_t u32UnitPos = 0UL;
uint32_t u32Temp;
DDL_ASSERT(IS_MPU_UNLOCK());
DDL_ASSERT(IS_MPU_UNIT(u32Unit));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
u32Temp = u32Unit;
while (0UL != u32Temp) {
if (0UL != (u32Temp & 0x1UL)) {
CR = MPU_CR_ADDR(u32UnitPos);
if (DISABLE != enNewState) {
SET_REG32_BIT(*CR, MPU_SCR_SMPUE);
} else {
CLR_REG32_BIT(*CR, MPU_SCR_SMPUE);
}
}
u32Temp >>= 1UL;
u32UnitPos++;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set one or zero to the selected GPIO pin. */ | int32_t csi_gpio_pin_write(gpio_pin_handle_t pin, bool value) | /* Set one or zero to the selected GPIO pin. */
int32_t csi_gpio_pin_write(gpio_pin_handle_t pin, bool value) | {
GPIO_NULL_PARAM_CHK(pin);
if (value < 0) {
return ERR_GPIO(EDRV_PARAMETER);
}
dw_gpio_pin_priv_t *gpio_pin_priv = pin;
dw_gpio_priv_t *gpio_priv = gpio_pin_priv->handle;
uint8_t offset = gpio_pin_priv->idx;
uint32_t port_value = value << offset;
gpio_priv->value = port_value;
gpio_write(gpio_priv, (1 << offset));
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Parse the AML stream and populate the root node. */ | STATIC EFI_STATUS EFIAPI AmlPopulateRootNode(IN AML_ROOT_NODE *RootNode, IN OUT AML_STREAM *FStream, IN OUT LIST_ENTRY *NameSpaceRefList) | /* Parse the AML stream and populate the root node. */
STATIC EFI_STATUS EFIAPI AmlPopulateRootNode(IN AML_ROOT_NODE *RootNode, IN OUT AML_STREAM *FStream, IN OUT LIST_ENTRY *NameSpaceRefList) | {
EFI_STATUS Status;
if (!IS_AML_ROOT_NODE (RootNode) ||
!IS_STREAM (FStream) ||
IS_END_OF_STREAM (FStream) ||
!IS_STREAM_FORWARD (FStream) ||
(NameSpaceRefList == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlParseVariableArguments (
(AML_NODE_HEADER *)RootNode,
FStream,
NameSpaceRefList
);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* sets one QoS priority => traffic class mapping */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass) | /* sets one QoS priority => traffic class mapping */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass) | {
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT || trafficClass >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
{
return IX_ETH_DB_INVALID_PRIORITY;
}
ixEthDBPortInfo[portID].priorityTable[userPriority] = trafficClass;
return ixEthDBUpdateTrafficClass(portID, userPriority);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Builds a pdu frame as an RR command. */ | void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) | /* Builds a pdu frame as an RR command. */
void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) | {
struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_RR;
pdu->ctrl_2 = p_bit & LLC_S_PF_BIT_MASK;
pdu->ctrl_1 &= 0x0F;
pdu->ctrl_2 |= (nr << 1) & 0xFE;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Parameter: card = pointer to card struct. ch = channel to watch for. */ | static void isdnloop_start_ctimer(isdnloop_card *card, int ch) | /* Parameter: card = pointer to card struct. ch = channel to watch for. */
static void isdnloop_start_ctimer(isdnloop_card *card, int ch) | {
unsigned long flags;
spin_lock_irqsave(&card->isdnloop_lock, flags);
init_timer(&card->c_timer[ch]);
card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT;
if (ch)
card->c_timer[ch].function = isdnloop_atimeout1;
else
card->c_timer[ch].function = isdnloop_atimeout0;
card->c_timer[ch].data = (unsigned long) card;
add_timer(&card->c_timer[ch]);
spin_unlock_irqrestore(&card->isdnloop_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes a data buffer in flash (data are 32-bit aligned). */ | uint32_t FLASH_If_Write(uint32_t Address, uint32_t Data) | /* Writes a data buffer in flash (data are 32-bit aligned). */
uint32_t FLASH_If_Write(uint32_t Address, uint32_t Data) | {
if (Address <= (uint32_t) USER_FLASH_LAST_PAGE_ADDRESS)
{
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, Address, Data) != HAL_OK)
return (1);
}
else
{
return (1);
}
return (0);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Lock a read-write lock object for writing immediately.
See IEEE 1003.1 */ | int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) | /* Lock a read-write lock object for writing immediately.
See IEEE 1003.1 */
int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) | {
struct posix_rwlock *rwl;
rwl = get_posix_rwlock(*rwlock);
if (rwl == NULL) {
return EINVAL;
}
return write_lock_acquire(rwl, 0);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Don't use these speedup functions in NAND boot image, since the image has to fit into 4kByte. */ | static void ndfc_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len) | /* Don't use these speedup functions in NAND boot image, since the image has to fit into 4kByte. */
static void ndfc_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len) | {
struct nand_chip *this = mtdinfo->priv;
ulong base = (ulong) this->IO_ADDR_W & 0xffffff00;
uint32_t *p = (uint32_t *) buf;
for (; len > 0; len -= 4)
out_be32((u32 *)(base + NDFC_DATA), *p++);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Function for parsing bytes received on the UART until a SLIP escape byte is received.
Number of SLIP decoded bytes received and stored in mp_rx_buffer. */ | static void handle_rx_byte_default(uint8_t byte) | /* Function for parsing bytes received on the UART until a SLIP escape byte is received.
Number of SLIP decoded bytes received and stored in mp_rx_buffer. */
static void handle_rx_byte_default(uint8_t byte) | {
switch (byte)
{
case APP_SLIP_END:
handle_slip_end();
break;
case APP_SLIP_ESC:
handle_rx_byte = handle_rx_byte_esc;
break;
default:
mp_rx_buffer[m_rx_received_count++] = byte;
break;
}
} | labapart/polymcu | C++ | null | 201 |
/* Changes the state of a network interface from "stopped" to "started". */ | EFI_STATUS EFIAPI VirtioNetStart(IN EFI_SIMPLE_NETWORK_PROTOCOL *This) | /* Changes the state of a network interface from "stopped" to "started". */
EFI_STATUS EFIAPI VirtioNetStart(IN EFI_SIMPLE_NETWORK_PROTOCOL *This) | {
VNET_DEV *Dev;
EFI_TPL OldTpl;
EFI_STATUS Status;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Dev = VIRTIO_NET_FROM_SNP (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (Dev->Snm.State != EfiSimpleNetworkStopped) {
Status = EFI_ALREADY_STARTED;
} else {
Dev->Snm.State = EfiSimpleNetworkStarted;
Status = EFI_SUCCESS;
}
gBS->RestoreTPL (OldTpl);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ | UINT8 EFIAPI MmioAndThenOr8(IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData) | /* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioAndThenOr8(IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData) | {
return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Make sure that delay_ms() is functional before calling this function! */ | void lcdInit() | /* Make sure that delay_ms() is functional before calling this function! */
void lcdInit() | {
lcdHardwareInit();
if (IS_LCD_RESET_NEEDED()) {
lcdReset();
}
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* AES initialization function.
Enables AES peripheral, clocks and initializes AES driver */ | void CRYPTOGRAPHY_0_init(void) | /* AES initialization function.
Enables AES peripheral, clocks and initializes AES driver */
void CRYPTOGRAPHY_0_init(void) | {
hri_mclk_set_APBCMASK_AES_bit(MCLK);
aes_sync_init(&CRYPTOGRAPHY_0, AES);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* matches two database records based on their MAC addresses */ | IX_ETH_DB_PUBLIC BOOL ixEthDBAddressRecordMatch(void *untypedReference, void *untypedEntry) | /* matches two database records based on their MAC addresses */
IX_ETH_DB_PUBLIC BOOL ixEthDBAddressRecordMatch(void *untypedReference, void *untypedEntry) | {
MacDescriptor *entry = (MacDescriptor *) untypedEntry;
MacDescriptor *reference = (MacDescriptor *) untypedReference;
if ((entry->type & reference->type) == 0) return FALSE;
return (ixEthDBAddressCompare((UINT8 *) entry->macAddress, (UINT8 *) reference->macAddress) == 0);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function looks for the highest region of memory lower than 4GB which has enough space for U-Boot where U-Boot is aligned on a page boundary. It overrides the default implementation found elsewhere which simply picks the end of ram, wherever that may be. The location of the stack, the relocation address, and how far U-Boot is moved by relocation are set in the global data structure. */ | ulong board_get_usable_ram_top(ulong total_size) | /* This function looks for the highest region of memory lower than 4GB which has enough space for U-Boot where U-Boot is aligned on a page boundary. It overrides the default implementation found elsewhere which simply picks the end of ram, wherever that may be. The location of the stack, the relocation address, and how far U-Boot is moved by relocation are set in the global data structure. */
ulong board_get_usable_ram_top(ulong total_size) | {
return qemu_get_low_memory_size();
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If we're using a userspace stack, mount should have passed a name that matches the disk. If not, mount should not have passed a stack. */ | static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, struct mount_options *mopt) | /* If we're using a userspace stack, mount should have passed a name that matches the disk. If not, mount should not have passed a stack. */
static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, struct mount_options *mopt) | {
if (!ocfs2_userspace_stack(osb) && mopt->cluster_stack[0]) {
mlog(ML_ERROR,
"cluster stack passed to mount, but this filesystem "
"does not support it\n");
return -EINVAL;
}
if (ocfs2_userspace_stack(osb) &&
strncmp(osb->osb_cluster_stack, mopt->cluster_stack,
OCFS2_STACK_LABEL_LEN)) {
mlog(ML_ERROR,
"cluster stack passed to mount (\"%s\") does not "
"match the filesystem (\"%s\")\n",
mopt->cluster_stack,
osb->osb_cluster_stack);
return -EINVAL;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Indicates whether or not the I2C bus is busy. This function returns an indication of whether or not the I2C bus is busy. This function can be used in a multi-master environment to determine if another master is currently using the bus. */ | xtBoolean xI2CMasterBusBusy(unsigned long ulBase) | /* Indicates whether or not the I2C bus is busy. This function returns an indication of whether or not the I2C bus is busy. This function can be used in a multi-master environment to determine if another master is currently using the bus. */
xtBoolean xI2CMasterBusBusy(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
return ((xHWREG(ulBase + I2C_STATUS)&0xF8) == 0xF8)? xfalse : xtrue;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Function for creating an AD structure with default configuration for an LE OOB record.
This function creates an AD structure and initializes its fields with default content for LE OOB record payload. */ | static void le_oob_specific_adv_data_create(ble_advdata_tk_value_t *const p_tk_value, ble_advdata_t *const p_le_adv_data) | /* Function for creating an AD structure with default configuration for an LE OOB record.
This function creates an AD structure and initializes its fields with default content for LE OOB record payload. */
static void le_oob_specific_adv_data_create(ble_advdata_tk_value_t *const p_tk_value, ble_advdata_t *const p_le_adv_data) | {
common_adv_data_create(p_tk_value, p_le_adv_data);
p_le_adv_data->include_ble_device_addr = true;
p_le_adv_data->le_role = BLE_ADVDATA_ROLE_ONLY_PERIPH;
p_le_adv_data->flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
} | labapart/polymcu | C++ | null | 201 |
/* Wake up port after congestion: Called with port locked, */ | static void port_wakeup_sh(unsigned long ref) | /* Wake up port after congestion: Called with port locked, */
static void port_wakeup_sh(unsigned long ref) | {
struct port *p_ptr;
struct user_port *up_ptr;
tipc_continue_event cb = NULL;
void *uh = NULL;
p_ptr = tipc_port_lock(ref);
if (p_ptr) {
up_ptr = p_ptr->user_port;
if (up_ptr) {
cb = up_ptr->continue_event_cb;
uh = up_ptr->usr_handle;
}
tipc_port_unlock(p_ptr);
}
if (cb)
cb(uh, ref);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Receive one byte from an SPI device using USART in SPI mode. */ | void usart_spi_read_single(volatile avr32_usart_t *p_usart, uint8_t *data) | /* Receive one byte from an SPI device using USART in SPI mode. */
void usart_spi_read_single(volatile avr32_usart_t *p_usart, uint8_t *data) | {
usart_putchar(p_usart, CONFIG_USART_SPI_DUMMY);
*data = usart_getchar(p_usart);
} | memfault/zero-to-main | C++ | null | 200 |
/* Add the length of the specified type to List. */ | VOID AddMemoryLength(LIST_ENTRY *List, UINT32 Type, UINT64 NumberOfPages) | /* Add the length of the specified type to List. */
VOID AddMemoryLength(LIST_ENTRY *List, UINT32 Type, UINT64 NumberOfPages) | {
MEMORY_LENGTH_ENTRY *Entry;
MEMORY_LENGTH_ENTRY *NewEntry;
LIST_ENTRY *Link;
Entry = NULL;
for (Link = GetFirstNode (List); !IsNull (List, Link); Link = GetNextNode (List, Link)) {
Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link);
if (Entry->Type >= Type) {
break;
}
}
if ((Entry != NULL) && (Entry->Type == Type)) {
NewEntry = Entry;
} else {
NewEntry = AllocatePool (sizeof (*NewEntry));
if (NewEntry == NULL) {
return;
}
NewEntry->Type = Type;
NewEntry->NumberOfPages = 0;
InsertTailList (Link, &NewEntry->Link);
}
NewEntry->NumberOfPages += NumberOfPages;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function for providing update status for the device identified by 'index'. */ | static __INLINE bool update_status_bit_is_set(uint32_t index) | /* Function for providing update status for the device identified by 'index'. */
static __INLINE bool update_status_bit_is_set(uint32_t index) | {
return ((m_peer_addr_update & (BIT_0 << index)) ? true : false);
} | labapart/polymcu | C++ | null | 201 |
/* This service enables PEI modules to discover additional firmware files. The FileHandle must be unique within the system. */ | EFI_STATUS EFIAPI PeiFfsFvPpiFindFileByType(IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE FvHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle) | /* This service enables PEI modules to discover additional firmware files. The FileHandle must be unique within the system. */
EFI_STATUS EFIAPI PeiFfsFvPpiFindFileByType(IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This, IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE FvHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle) | {
return FindFileEx (FvHandle, NULL, SearchType, FileHandle, NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable WDT Module. This function is used to Enable WDT module and start counter. */ | void WDTEnable(void) | /* Enable WDT Module. This function is used to Enable WDT module and start counter. */
void WDTEnable(void) | {
xHWREG(WDT_BASE + WDT_MOD) |= WDMOD_EN;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0xAA;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0x55;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.. */ | int32_t lis2mdl_mag_user_offset_set(stmdev_ctx_t *ctx, uint8_t *buff) | /* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.. */
int32_t lis2mdl_mag_user_offset_set(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lis2mdl_write_reg(ctx, LIS2MDL_OFFSET_X_REG_L, buff, 6);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* will register the notifier into a notification chain that gets called upon changes to the pm_qos_class target value. */ | int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier) | /* will register the notifier into a notification chain that gets called upon changes to the pm_qos_class target value. */
int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier) | {
int retval;
retval = blocking_notifier_chain_register(
pm_qos_array[pm_qos_class]->notifiers, notifier);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Do DAT for user address by page table walk, return kernel address. This function needs to be called with current->mm->page_table_lock held. */ | static __always_inline unsigned long __dat_user_addr(unsigned long uaddr) | /* Do DAT for user address by page table walk, return kernel address. This function needs to be called with current->mm->page_table_lock held. */
static __always_inline unsigned long __dat_user_addr(unsigned long uaddr) | {
struct mm_struct *mm = current->mm;
unsigned long pfn;
pte_t *pte;
int rc;
retry:
pte = follow_table(mm, uaddr);
if ((unsigned long) pte < 0x1000)
goto fault;
if (!pte_present(*pte)) {
pte = (pte_t *) 0x11;
goto fault;
}
pfn = pte_pfn(*pte);
return (pfn << PAGE_SHIFT) + (uaddr & (PAGE_SIZE - 1));
fault:
spin_unlock(&mm->page_table_lock);
rc = __handle_fault(uaddr, (unsigned long) pte, 0);
spin_lock(&mm->page_table_lock);
if (!rc)
goto retry;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the configuration and status of the IRQ signals */ | unsigned long LPCIRQGet(unsigned long ulBase) | /* Get the configuration and status of the IRQ signals */
unsigned long LPCIRQGet(unsigned long ulBase) | {
ASSERT(ulBase == LPC0_BASE);
return(HWREG(ulBase + LPC_O_IRQST));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function adds an entry in specified register table, with given register type, register index, bit section and value. */ | VOID EFIAPI CpuRegisterTableWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value) | /* This function adds an entry in specified register table, with given register type, register index, bit section and value. */
VOID EFIAPI CpuRegisterTableWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value) | {
UINT8 Start;
UINT8 End;
UINT8 Length;
Start = (UINT8)LowBitSet64 (ValueMask);
End = (UINT8)HighBitSet64 (ValueMask);
Length = End - Start + 1;
CpuRegisterTableWriteWorker (FALSE, ProcessorNumber, RegisterType, Index, Start, Length, Value, FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clear all content of the LCD glass.
This function clears all pixels and areas of the LCD glass XPRO_LCD. */ | void xpro_lcd_clear_all(void) | /* Clear all content of the LCD glass.
This function clears all pixels and areas of the LCD glass XPRO_LCD. */
void xpro_lcd_clear_all(void) | {
slcd_disable_blink();
slcd_disable_circular_shift();
slcd_clear_display_memory();
xpro_lcd_text_scrolling_stop();
xpro_lcd_text_bitmapping_stop();
dma_break = 0;
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns number of rules in the statement list. */ | gint cr_statement_nr_rules(CRStatement *a_this) | /* Returns number of rules in the statement list. */
gint cr_statement_nr_rules(CRStatement *a_this) | {
CRStatement *cur = NULL;
int nr = 0;
g_return_val_if_fail (a_this, -1);
for (cur = a_this; cur; cur = cur->next)
nr++;
return nr;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Locate the GTS structure for the current thread. */ | static struct gru_thread_state* gru_find_current_gts_nolock(struct gru_vma_data *vdata, int tsid) | /* Locate the GTS structure for the current thread. */
static struct gru_thread_state* gru_find_current_gts_nolock(struct gru_vma_data *vdata, int tsid) | {
struct gru_thread_state *gts;
list_for_each_entry(gts, &vdata->vd_head, ts_next)
if (gts->ts_tsid == tsid)
return gts;
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Locking Note: The lport lock is expected to be held before calling this routine. */ | static void fc_lport_enter_scr(struct fc_lport *) | /* Locking Note: The lport lock is expected to be held before calling this routine. */
static void fc_lport_enter_scr(struct fc_lport *) | {
struct fc_frame *fp;
FC_LPORT_DBG(lport, "Entered SCR state from %s state\n",
fc_lport_state(lport));
fc_lport_state_enter(lport, LPORT_ST_SCR);
fp = fc_frame_alloc(lport, sizeof(struct fc_els_scr));
if (!fp) {
fc_lport_error(lport, fp);
return;
}
if (!lport->tt.elsct_send(lport, FC_FID_FCTRL, fp, ELS_SCR,
fc_lport_scr_resp, lport,
2 * lport->r_a_tov))
fc_lport_error(lport, NULL);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: (type GObject.TypeInterface) (transfer none): the #GTypeInterface structure of @iface_type if implemented by @instance_class, NULL otherwise */ | gpointer g_type_interface_peek(gpointer instance_class, GType iface_type) | /* Returns: (type GObject.TypeInterface) (transfer none): the #GTypeInterface structure of @iface_type if implemented by @instance_class, NULL otherwise */
gpointer g_type_interface_peek(gpointer instance_class, GType iface_type) | {
TypeNode *node;
TypeNode *iface;
gpointer vtable = NULL;
GTypeClass *class = instance_class;
g_return_val_if_fail (instance_class != NULL, NULL);
node = lookup_type_node_I (class->g_type);
iface = lookup_type_node_I (iface_type);
if (node && node->is_instantiatable && iface)
type_lookup_iface_vtable_I (node, iface, &vtable);
else
g_warning (G_STRLOC ": invalid class pointer '%p'", class);
return vtable;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Unregisters an interrupt handler for the FAN module. */ | void FanIntUnregister(unsigned long ulBase) | /* Unregisters an interrupt handler for the FAN module. */
void FanIntUnregister(unsigned long ulBase) | {
ASSERT(ulBase == FAN0_BASE);
IntDisable(INT_FAN0);
IntUnregister(INT_FAN0);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read the tally counters to clear them. Called in response to a CNT interrupt. */ | static void dp83902a_ClearCounters(void) | /* Read the tally counters to clear them. Called in response to a CNT interrupt. */
static void dp83902a_ClearCounters(void) | {
struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
u8 *base = dp->base;
__maybe_unused u8 cnt1, cnt2, cnt3;
DP_IN(base, DP_FER, cnt1);
DP_IN(base, DP_CER, cnt2);
DP_IN(base, DP_MISSED, cnt3);
DP_OUT(base, DP_ISR, DP_ISR_CNT);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This routine returns the numbers of characters the tty driver will accept for queuing to be written. This number is subject to change as output buffers get emptied, or if the output flow control is acted. This is not an exact number because not every character needs the same space in the sccb. The worst case is a string of newlines. Every newlines creates a new mto which needs 8 bytes. */ | static int sclp_tty_write_room(struct tty_struct *tty) | /* This routine returns the numbers of characters the tty driver will accept for queuing to be written. This number is subject to change as output buffers get emptied, or if the output flow control is acted. This is not an exact number because not every character needs the same space in the sccb. The worst case is a string of newlines. Every newlines creates a new mto which needs 8 bytes. */
static int sclp_tty_write_room(struct tty_struct *tty) | {
unsigned long flags;
struct list_head *l;
int count;
spin_lock_irqsave(&sclp_tty_lock, flags);
count = 0;
if (sclp_ttybuf != NULL)
count = sclp_buffer_space(sclp_ttybuf) / sizeof(struct mto);
list_for_each(l, &sclp_tty_pages)
count += NR_EMPTY_MTO_PER_SCCB;
spin_unlock_irqrestore(&sclp_tty_lock, flags);
return count;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the Air Quality / Gas Sensor. */ | uint32_t BOARD_gasSensorEnable(bool enable) | /* Enables or disables the Air Quality / Gas Sensor. */
uint32_t BOARD_gasSensorEnable(bool enable) | {
uint32_t status;
if( enable ) {
status = BOARD_picWriteReg( BOARD_PIC_REG_CCS_CTRL, BOARD_PIC_REG_CCS_CTRL_EN );
}
else {
status = BOARD_picWriteReg( BOARD_PIC_REG_CCS_CTRL, 0 );
}
return status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Select the ACMP- input source of the comparator. */ | void ACMPConfigure(unsigned long ulBase, unsigned long ulCompID, unsigned long ulConfig) | /* Select the ACMP- input source of the comparator. */
void ACMPConfigure(unsigned long ulBase, unsigned long ulCompID, unsigned long ulConfig) | {
xASSERT(ulBase == ACMP_BASE);
xASSERT((ulCompID >= 0) && (ulCompID < 2));
xASSERT((((ulConfig & ACMP_POSITIVE_INPUT) == ACMP_POSITIVE_INPUT) ||
((ulConfig & ACMP_POSITIVE_INPUT) == ACMP_NEGATIVE_INPUT)) &&
(((ulConfig & ACMP_MODE_CMP) == ACMP_MODE_CMP) ||
((ulConfig & ACMP_MODE_CMP) == ACMP_MODE_OP)));
xHWREG(ulBase + ACMP_OPACR + ulCompID*0x100) &= ~ACMP_CONFIG_MASK;
xHWREG(ulBase + ACMP_OPACR + ulCompID*0x100) |= ulConfig;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Looks up and prints the string corresponding to the index. */ | STATIC VOID EFIAPI FormatByte(IN CONST CHAR16 *Table[], IN UINT8 Index, IN UINT8 NumEntries) | /* Looks up and prints the string corresponding to the index. */
STATIC VOID EFIAPI FormatByte(IN CONST CHAR16 *Table[], IN UINT8 Index, IN UINT8 NumEntries) | {
CONST CHAR16 *String;
if (Index < NumEntries) {
String = Table[Index];
} else {
String = L"**INVALID**";
}
Print (
L"0x%02x (%s)",
Index,
String
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ | enum isl_lp_result isl_tab_solve_lp(struct isl_basic_map *bmap, int maximize, isl_int *f, isl_int denom, isl_int *opt, isl_int *opt_denom, struct isl_vec **sol) | /* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
enum isl_lp_result isl_tab_solve_lp(struct isl_basic_map *bmap, int maximize, isl_int *f, isl_int denom, isl_int *opt, isl_int *opt_denom, struct isl_vec **sol) | {
struct isl_tab *tab;
enum isl_lp_result res;
unsigned dim = isl_basic_map_total_dim(bmap);
if (maximize)
isl_seq_neg(f, f, 1 + dim);
bmap = isl_basic_map_gauss(bmap, NULL);
tab = isl_tab_from_basic_map(bmap, 0);
res = isl_tab_min(tab, f, denom, opt, opt_denom, 0);
if (res == isl_lp_ok && sol) {
*sol = isl_tab_get_sample_value(tab);
if (!*sol)
res = isl_lp_error;
}
isl_tab_free(tab);
if (maximize)
isl_seq_neg(f, f, 1 + dim);
if (maximize && opt)
isl_int_neg(*opt, *opt);
return res;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Some paths became not operational (pno bit in scsw is set). */ | static void ccw_device_path_notoper(struct ccw_device *cdev) | /* Some paths became not operational (pno bit in scsw is set). */
static void ccw_device_path_notoper(struct ccw_device *cdev) | {
struct subchannel *sch;
sch = to_subchannel(cdev->dev.parent);
if (cio_update_schib(sch))
goto doverify;
CIO_MSG_EVENT(0, "%s(0.%x.%04x) - path(s) %02x are "
"not operational \n", __func__,
sch->schid.ssid, sch->schid.sch_no,
sch->schib.pmcw.pnom);
sch->lpm &= ~sch->schib.pmcw.pnom;
doverify:
cdev->private->flags.doverify = 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes a word in the specific LCD RAM. */ | void LCD_Write(uint32_t LCD_RAMRegister, uint32_t LCD_Data) | /* Writes a word in the specific LCD RAM. */
void LCD_Write(uint32_t LCD_RAMRegister, uint32_t LCD_Data) | {
assert_param(IS_LCD_RAM_REGISTER(LCD_RAMRegister));
LCD->RAM[LCD_RAMRegister] = (uint32_t)LCD_Data;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Set the interrupt type and Enable interrupt for the specified pin(s). This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. */ | void xGPIOPinIntEnable(unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType) | /* Set the interrupt type and Enable interrupt for the specified pin(s). This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. */
void xGPIOPinIntEnable(unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType) | {
GPIOPinIntEnable(ulPort, ulPins, ulIntType);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads and returns the current value of CS. This function is only available on IA-32 and x64. */ | UINT16 EFIAPI AsmReadCs(VOID) | /* Reads and returns the current value of CS. This function is only available on IA-32 and x64. */
UINT16 EFIAPI AsmReadCs(VOID) | {
__asm {
xor eax, eax
mov ax, cs
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read BMA150 acceleration data.
Along with the actual sensor data, the LSB byte contains a "new" flag indicating if the data for this axis has been updated since the last time the axis data was read. Reading either LSB or MSB data will clear this flag. */ | static bool bma150_get_accel(sensor_hal_t *hal, sensor_data_t *data) | /* Read BMA150 acceleration data.
Along with the actual sensor data, the LSB byte contains a "new" flag indicating if the data for this axis has been updated since the last time the axis data was read. Reading either LSB or MSB data will clear this flag. */
static bool bma150_get_accel(sensor_hal_t *hal, sensor_data_t *data) | {
size_t const count = sensor_bus_read(hal, hal->burst_addr,
event_regs.acc, sizeof(event_regs.acc));
format_axis_data(hal, event_regs.acc, data);
return (count == sizeof(event_regs.acc));
} | memfault/zero-to-main | C++ | null | 200 |
/* Locking Note: Called with the rport lock held */ | static void fc_rport_state_enter(struct fc_rport_priv *rdata, enum fc_rport_state new) | /* Locking Note: Called with the rport lock held */
static void fc_rport_state_enter(struct fc_rport_priv *rdata, enum fc_rport_state new) | {
if (rdata->rp_state != new)
rdata->retries = 0;
rdata->rp_state = new;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: (transfer none): the source, if one was found, otherwise NULL */ | GSource* g_main_context_find_source_by_user_data(GMainContext *context, gpointer user_data) | /* Returns: (transfer none): the source, if one was found, otherwise NULL */
GSource* g_main_context_find_source_by_user_data(GMainContext *context, gpointer user_data) | {
GSourceIter iter;
GSource *source;
if (context == NULL)
context = g_main_context_default ();
LOCK_CONTEXT (context);
g_source_iter_init (&iter, context, FALSE);
while (g_source_iter_next (&iter, &source))
{
if (!SOURCE_DESTROYED (source) &&
source->callback_funcs)
{
GSourceFunc callback;
gpointer callback_data = NULL;
source->callback_funcs->get (source->callback_data, source, &callback, &callback_data);
if (callback_data == user_data)
break;
}
}
g_source_iter_clear (&iter);
UNLOCK_CONTEXT (context);
return source;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciSegmentAnd32(IN UINT64 Address, IN UINT32 AndData) | /* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentAnd32(IN UINT64 Address, IN UINT32 AndData) | {
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Add constant 'v' to prototype's list of constants (field 'k'). Use scanner's table to cache position of constants in constant list and try to reuse constants. Because some values should not be used as keys (nil cannot be a key, integer keys can collapse with float keys), the caller must provide a useful 'key' for indexing the cache. */ | static int addk(FuncState *fs, TValue *key, TValue *v) | /* Add constant 'v' to prototype's list of constants (field 'k'). Use scanner's table to cache position of constants in constant list and try to reuse constants. Because some values should not be used as keys (nil cannot be a key, integer keys can collapse with float keys), the caller must provide a useful 'key' for indexing the cache. */
static int addk(FuncState *fs, TValue *key, TValue *v) | {
k = cast_int(ivalue(idx));
if (k < fs->nk && ttype(&f->k[k]) == ttype(v) &&
luaV_rawequalobj(&f->k[k], v))
return k;
}
oldsize = f->sizek;
k = fs->nk;
setivalue(idx, k);
luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants");
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
setobj(L, &f->k[k], v);
fs->nk++;
luaC_barrier(L, f, v);
return k;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Read data from Rx registers.
This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */ | unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount) | /* Read data from Rx registers.
This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount) | {
unsigned long i;
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
xASSERT(ulCount < 2);
for (i=0; i<ulCount; i++)
{
pulData[i] = xHWREG(ulBase + SPI_RX0 + 4*i);
}
return ulCount;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Resize an extent indirection array to new_size bytes. */ | STATIC void xfs_iext_realloc_indirect(xfs_ifork_t *ifp, int new_size) | /* Resize an extent indirection array to new_size bytes. */
STATIC void xfs_iext_realloc_indirect(xfs_ifork_t *ifp, int new_size) | {
int nlists;
int size;
ASSERT(ifp->if_flags & XFS_IFEXTIREC);
nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
size = nlists * sizeof(xfs_ext_irec_t);
ASSERT(ifp->if_real_bytes);
ASSERT((new_size >= 0) && (new_size != size));
if (new_size == 0) {
xfs_iext_destroy(ifp);
} else {
ifp->if_u1.if_ext_irec = (xfs_ext_irec_t *)
kmem_realloc(ifp->if_u1.if_ext_irec,
new_size, size, KM_NOFS);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base ENET peripheral base address. param mask ENET interrupts to disables. This is a logical OR of both enumeration :: enet_qos_dma_interrupt_enable_t and enet_qos_mac_interrupt_enable_t. */ | void ENET_QOS_DisableInterrupts(ENET_QOS_Type *base, uint32_t mask) | /* param base ENET peripheral base address. param mask ENET interrupts to disables. This is a logical OR of both enumeration :: enet_qos_dma_interrupt_enable_t and enet_qos_mac_interrupt_enable_t. */
void ENET_QOS_DisableInterrupts(ENET_QOS_Type *base, uint32_t mask) | {
uint32_t interrupt = mask & 0xFFFFU;
uint8_t index;
if (interrupt != 0U)
{
for (index = 0; index < ENET_QOS_RING_NUM_MAX; index++)
{
if ((ENET_QOS_ABNORM_INT_MASK & interrupt) != 0U)
{
interrupt |= ENET_QOS_DMA_CHX_INT_EN_AIE_MASK;
}
if ((ENET_QOS_NORM_INT_MASK & interrupt) != 0U)
{
interrupt |= ENET_QOS_DMA_CHX_INT_EN_NIE_MASK;
}
base->DMA_CH[index].DMA_CHX_INT_EN &= ~interrupt;
}
}
interrupt = mask >> ENET_QOS_MACINT_ENUM_OFFSET;
if (interrupt != 0U)
{
base->MAC_INTERRUPT_ENABLE &= ~interrupt;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Selects the GMII port. When called GMII (1000Mbps) port is selected (programmable only in 10/100/1000 Mbps configuration). */ | void synopGMAC_select_gmii(synopGMACdevice *gmacdev) | /* Selects the GMII port. When called GMII (1000Mbps) port is selected (programmable only in 10/100/1000 Mbps configuration). */
void synopGMAC_select_gmii(synopGMACdevice *gmacdev) | {
synopGMACClearBits(gmacdev -> MacBase, GmacConfig, GmacMiiGmii);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Called without lock held. This is invoked from user context and may be parallel to just about everything else. Its also fairly quick and not called too often. Must protect against both bh and irq users */ | static void __ei_set_multicast_list(struct net_device *dev) | /* Called without lock held. This is invoked from user context and may be parallel to just about everything else. Its also fairly quick and not called too often. Must protect against both bh and irq users */
static void __ei_set_multicast_list(struct net_device *dev) | {
unsigned long flags;
struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev);
spin_lock_irqsave(&ei_local->page_lock, flags);
do_set_multicast_list(dev);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads a byte from the I2C receive FIFO. */ | uint32_t I2CFIFODataGetNonBlocking(uint32_t ui32Base, uint8_t *pui8Data) | /* Reads a byte from the I2C receive FIFO. */
uint32_t I2CFIFODataGetNonBlocking(uint32_t ui32Base, uint8_t *pui8Data) | {
ASSERT(_I2CBaseValid(ui32Base));
if(HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_RXFE)
{
return(0);
}
else
{
*pui8Data = HWREG(ui32Base + I2C_O_FIFODATA);
return(1);
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Get the CRC32 check result with the expected value. */ | en_flag_status_t CRC_CRC32_GetCheckResult(uint32_t u32ExpectValue) | /* Get the CRC32 check result with the expected value. */
en_flag_status_t CRC_CRC32_GetCheckResult(uint32_t u32ExpectValue) | {
__IO uint32_t u32Count = CRC_CALC_CLK_COUNT;
en_flag_status_t enStatus;
uint32_t u32Expect_Value = u32ExpectValue;
(void)CRC_WriteData32(&u32Expect_Value, 1UL);
while (u32Count-- != 0UL) {
__NOP();
}
enStatus = CRC_GetResultStatus();
return enStatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* When traversing the driver model tree, perhaps using driver model iterators like @device_for_each_child(), you can't assume very much about the nodes you find. Use this function to avoid oopses caused by wrongly treating some non-I2C device as an i2c_client. */ | struct i2c_client* i2c_verify_client(struct device *dev) | /* When traversing the driver model tree, perhaps using driver model iterators like @device_for_each_child(), you can't assume very much about the nodes you find. Use this function to avoid oopses caused by wrongly treating some non-I2C device as an i2c_client. */
struct i2c_client* i2c_verify_client(struct device *dev) | {
return (dev->type == &i2c_client_type)
? to_i2c_client(dev)
: NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* g_menu_insert_section: @menu: a #GMenu @position: the position at which to insert the item @label: (allow-none): the section label, or NULL */ | void g_menu_insert_section(GMenu *menu, gint position, const gchar *label, GMenuModel *section) | /* g_menu_insert_section: @menu: a #GMenu @position: the position at which to insert the item @label: (allow-none): the section label, or NULL */
void g_menu_insert_section(GMenu *menu, gint position, const gchar *label, GMenuModel *section) | {
GMenuItem *menu_item;
menu_item = g_menu_item_new_section (label, section);
g_menu_insert_item (menu, position, menu_item);
g_object_unref (menu_item);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Return: 0 on success or a negative error code on failure. */ | int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi) | /* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi) | {
ssize_t err;
err = mipi_dsi_dcs_write(dsi, MIPI_DCS_NOP, NULL, 0);
if (err < 0)
return err;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Draws an array of consecutive RGB565 pixels (much faster than addressing each pixel individually) */ | void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len) | /* Draws an array of consecutive RGB565 pixels (much faster than addressing each pixel individually) */
void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len) | {
uint32_t i = 0;
ili9328SetCursor(x, y);
ili9328WriteCmd(ILI9328_COMMANDS_WRITEDATATOGRAM);
do
{
ili9328WriteData(data[i]);
i++;
} while (i<len);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Reads and returns the current value of DR4. 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 AsmReadDr4(VOID) | /* Reads and returns the current value of DR4. 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 AsmReadDr4(VOID) | {
UINTN Data;
__asm__ __volatile__ (
"mov %%dr4, %0"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Write a buffer of data to a selected endpoint. */ | uint32_t USB_SilRead(uint8_t bEpAddr, uint8_t *pBufferPointer) | /* Write a buffer of data to a selected endpoint. */
uint32_t USB_SilRead(uint8_t bEpAddr, uint8_t *pBufferPointer) | {
uint32_t DataLength = 0;
DataLength = USB_GetEpRxCnt(bEpAddr & 0x7F);
USB_CopyPMAToUserBuf(pBufferPointer, USB_GetEpRxAddr(bEpAddr & 0x7F), DataLength);
return DataLength;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function implements the API that's compatible with current GPIO API used in U-Boot. The request is forwarded to particular GPIO driver. Returns the value of the GPIO pin, or negative value on error. */ | int gpio_get_value(unsigned gpio) | /* This function implements the API that's compatible with current GPIO API used in U-Boot. The request is forwarded to particular GPIO driver. Returns the value of the GPIO pin, or negative value on error. */
int gpio_get_value(unsigned gpio) | {
int ret;
struct gpio_desc desc;
ret = gpio_to_device(gpio, &desc);
if (ret)
return ret;
return dm_gpio_get_value(&desc);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Command response callback function for sd_ble_gap_disconnect BLE command.
Callback for decoding the command response return code. */ | static uint32_t gap_disconnect_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gap_disconnect BLE command.
Callback for decoding the command response return code. */
static uint32_t gap_disconnect_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code = ble_gap_disconnect_rsp_dec(p_buffer, length, &result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Register the Service C.2 and all its Characteristics... */ | void service_c_2_1_init(void) | /* Register the Service C.2 and all its Characteristics... */
void service_c_2_1_init(void) | {
bt_gatt_service_register(&service_c_2_1_svc);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Get next language from language code list (with separator ';'). */ | VOID EFIAPI GetNextLanguage(IN OUT CHAR8 **LangCode, OUT CHAR8 *Lang) | /* Get next language from language code list (with separator ';'). */
VOID EFIAPI GetNextLanguage(IN OUT CHAR8 **LangCode, OUT CHAR8 *Lang) | {
UINTN Index;
CHAR8 *StringPtr;
if ((LangCode == NULL) || (*LangCode == NULL) || (Lang == NULL)) {
return;
}
Index = 0;
StringPtr = *LangCode;
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
Index++;
}
(VOID)CopyMem (Lang, StringPtr, Index);
Lang[Index] = 0;
if (StringPtr[Index] == ';') {
Index++;
}
*LangCode = StringPtr + Index;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */ | EFI_STATUS EFIAPI AhciBlockIoGetMediaInfo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo) | /* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */
EFI_STATUS EFIAPI AhciBlockIoGetMediaInfo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo) | {
PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private;
PEI_AHCI_ATA_DEVICE_DATA *DeviceData;
if ((This == NULL) || (MediaInfo == NULL)) {
return EFI_INVALID_PARAMETER;
}
Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);
DeviceData = SearchDeviceByIndex (Private, DeviceIndex);
if (DeviceData == NULL) {
return EFI_NOT_FOUND;
}
MediaInfo->DeviceType = (EFI_PEI_BLOCK_DEVICE_TYPE)EDKII_PEI_BLOCK_DEVICE_TYPE_ATA_HARD_DISK;
MediaInfo->MediaPresent = TRUE;
MediaInfo->LastBlock = (UINTN)DeviceData->Media.LastBlock;
MediaInfo->BlockSize = DeviceData->Media.BlockSize;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads the interrupt status flags from the interrupt controller. */ | uint32_t BOARD_picIntGet(uint8_t *flags) | /* Reads the interrupt status flags from the interrupt controller. */
uint32_t BOARD_picIntGet(uint8_t *flags) | {
uint32_t status;
status = BOARD_picReadReg( BOARD_PIC_REG_INT_FLAG, flags );
return status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* PCI_CAP_ID_PM Power Management PCI_CAP_ID_AGP Accelerated Graphics Port PCI_CAP_ID_VPD Vital Product Data PCI_CAP_ID_SLOTID Slot Identification PCI_CAP_ID_MSI Message Signalled Interrupts PCI_CAP_ID_CHSWP CompactPCI HotSwap PCI_CAP_ID_PCIX PCI-X PCI_CAP_ID_EXP PCI Express */ | int pci_find_capability(struct pci_dev *dev, int cap) | /* PCI_CAP_ID_PM Power Management PCI_CAP_ID_AGP Accelerated Graphics Port PCI_CAP_ID_VPD Vital Product Data PCI_CAP_ID_SLOTID Slot Identification PCI_CAP_ID_MSI Message Signalled Interrupts PCI_CAP_ID_CHSWP CompactPCI HotSwap PCI_CAP_ID_PCIX PCI-X PCI_CAP_ID_EXP PCI Express */
int pci_find_capability(struct pci_dev *dev, int cap) | {
int pos;
pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type);
if (pos)
pos = __pci_find_next_cap(dev->bus, dev->devfn, pos, cap);
return pos;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* get the clock stabilization interrupt and ckm flags */ | FlagStatus rcu_interrupt_flag_get(rcu_int_flag_enum int_flag) | /* get the clock stabilization interrupt and ckm flags */
FlagStatus rcu_interrupt_flag_get(rcu_int_flag_enum int_flag) | {
if(RESET != (RCU_REG_VAL(int_flag) & BIT(RCU_BIT_POS(int_flag)))) {
return SET;
} else {
return RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function handles External line 0 interrupt request. */ | void EXTI0_IRQHandler(void) | /* This function handles External line 0 interrupt request. */
void EXTI0_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(BUTTON_WAKEUP);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Polls the PHY status register for link, 'iterations' number of times. */ | s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success) | /* Polls the PHY status register for link, 'iterations' number of times. */
s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success) | {
s32 ret_val = 0;
u16 i, phy_status;
for (i = 0; i < iterations; i++) {
ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
if (ret_val)
udelay(usec_interval);
ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
if (ret_val)
break;
if (phy_status & MII_SR_LINK_STATUS)
break;
if (usec_interval >= 1000)
mdelay(usec_interval/1000);
else
udelay(usec_interval);
}
*success = (i < iterations);
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads relative humidity and temperature from a Si7013 sensor. */ | int32_t Si7013_MeasureV(I2C_TypeDef *i2c, uint8_t addr, int32_t *vData) | /* Reads relative humidity and temperature from a Si7013 sensor. */
int32_t Si7013_MeasureV(I2C_TypeDef *i2c, uint8_t addr, int32_t *vData) | {
int ret;
Si7013_WriteUserReg2(i2c, addr, 0x0e);
ret = Si7013_Measure(i2c, addr, (uint32_t *) vData, SI7013_READ_VIN);
Si7013_WriteUserReg2(i2c, addr, 0x09);
if (ret == 2)
{
}
else
{
return -1;
}
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Enables or disables the specified SPI peripheral (in I2S mode). */ | void I2S_Cmd(SPI_TypeDef *SPIx, FunctionalState NewState) | /* Enables or disables the specified SPI peripheral (in I2S mode). */
void I2S_Cmd(SPI_TypeDef *SPIx, FunctionalState NewState) | {
assert_param(IS_SPI_1_PERIPH(SPIx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
SPIx->I2SCFGR |= SPI_I2SCFGR_I2SE;
}
else
{
SPIx->I2SCFGR &= (uint16_t)~((uint16_t)SPI_I2SCFGR_I2SE);
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* To query the number of bytes available, call swb_inc_{u,i} with an increment of zero. */ | static __inline__ unsigned int __swb_inc_u(vwsnd_port_t *port, int inc) | /* To query the number of bytes available, call swb_inc_{u,i} with an increment of zero. */
static __inline__ unsigned int __swb_inc_u(vwsnd_port_t *port, int inc) | {
if (inc) {
port->swb_u_idx += inc;
port->swb_u_idx %= port->swbuf_size;
port->swb_u_avail -= inc;
port->swb_i_avail += inc;
}
return port->swb_u_avail;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the DAC peripheral registers to their default reset values. */ | void DAC_DeInit(void) | /* Deinitializes the DAC peripheral registers to their default reset values. */
void DAC_DeInit(void) | {
RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_DAC, ENABLE);
RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_DAC, DISABLE);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Sets requested gain for FF effects. Called with dev->event_lock held. */ | static void ml_ff_set_gain(struct input_dev *dev, u16 gain) | /* Sets requested gain for FF effects. Called with dev->event_lock held. */
static void ml_ff_set_gain(struct input_dev *dev, u16 gain) | {
struct ml_device *ml = dev->ff->private;
int i;
ml->gain = gain;
for (i = 0; i < FF_MEMLESS_EFFECTS; i++)
__clear_bit(FF_EFFECT_PLAYING, &ml->states[i].flags);
ml_play_effects(ml);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 32bits data to specified UFS MMIO register. */ | EFI_STATUS UfsMmioWrite32(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINTN Offset, IN UINT32 Value) | /* Write 32bits data to specified UFS MMIO register. */
EFI_STATUS UfsMmioWrite32(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINTN Offset, IN UINT32 Value) | {
EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
EFI_STATUS Status;
UfsHc = Private->UfsHostController;
Status = UfsHc->Write (UfsHc, EfiUfsHcWidthUint32, Offset, 1, &Value);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base The I3C peripheral base address. param data IBI data pointer param dataSize IBI data length */ | void I3C_SlaveRequestIBIWithData(I3C_Type *base, i3c_slave_handle_t *handle, uint8_t *data, size_t dataSize) | /* param base The I3C peripheral base address. param data IBI data pointer param dataSize IBI data length */
void I3C_SlaveRequestIBIWithData(I3C_Type *base, i3c_slave_handle_t *handle, uint8_t *data, size_t dataSize) | {
uint32_t ctrlValue = base->SCTRL;
ctrlValue &= ~(I3C_SCTRL_EVENT_MASK | I3C_SCTRL_IBIDATA_MASK);
ctrlValue |= I3C_SCTRL_EVENT(1U) | I3C_SCTRL_IBIDATA(*data);
if (dataSize > 1U)
{
handle->ibiData = &data[1];
handle->ibiDataSize = dataSize - 1U;
}
base->SCTRL = ctrlValue;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* uio_event_notify - trigger an interrupt event @info: UIO device capabilities */ | void uio_event_notify(struct uio_info *info) | /* uio_event_notify - trigger an interrupt event @info: UIO device capabilities */
void uio_event_notify(struct uio_info *info) | {
struct uio_device *idev = info->uio_dev;
atomic_inc(&idev->event);
wake_up_interruptible(&idev->wait);
kill_fasync(&idev->async_queue, SIGIO, POLL_IN);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* When a uDMA transfer is completed, the channel is automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer. */ | void uDMAChannelEnable(unsigned long ulChannelNum) | /* When a uDMA transfer is completed, the channel is automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer. */
void uDMAChannelEnable(unsigned long ulChannelNum) | {
ASSERT((ulChannelNum & 0xffff) < 32);
HWREG(UDMA_ENASET) = 1 << (ulChannelNum & 0x1f);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ | int serial_init(void) | /* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
int serial_init(void) | {
s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
uart->UFCON = 0xff;
uart->UMCON = 0;
uart->ULCON = 3;
uart->UCON = 5;
serial_setbrg();
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Set the contents of a G_TYPE_DOUBLE #GValue to @v_double. */ | void g_value_set_double(GValue *value, gdouble v_double) | /* Set the contents of a G_TYPE_DOUBLE #GValue to @v_double. */
void g_value_set_double(GValue *value, gdouble v_double) | {
g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value));
value->data[0].v_double = v_double;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Port A: Headphone jack Port B: MIC jack Port C: Internal MIC Port D: Dock Line Out (if enabled) Port E: Dock Line In (if enabled) Port F: Internal speakers */ | static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | /* Port A: Headphone jack Port B: MIC jack Port C: Internal MIC Port D: Dock Line Out (if enabled) Port E: Dock Line In (if enabled) Port F: Internal speakers */
static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | {
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
int ret = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
int mute = (!ucontrol->value.integer.value[0] &&
!ucontrol->value.integer.value[1]);
snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
mute ? 0x02 : 0x0);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the status of a device as a text string for each target. */ | static int table_status(struct dm_ioctl *param, size_t param_size) | /* Return the status of a device as a text string for each target. */
static int table_status(struct dm_ioctl *param, size_t param_size) | {
int r;
struct mapped_device *md;
struct dm_table *table;
md = find_device(param);
if (!md)
return -ENXIO;
r = __dev_status(md, param);
if (r)
goto out;
table = dm_get_live_or_inactive_table(md, param);
if (table) {
retrieve_status(table, param, param_size);
dm_table_put(table);
}
out:
dm_put(md);
return r;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function: MX25_WRSCUR Arguments: None. Description: The WRSCUR instruction is for changing the values of Security Register Bits. Return Message: FlashIsBusy, FlashOperationSuccess, FlashWriteRegFailed, FlashTimeOut */ | ReturnMsg MX25_WRSCUR(void) | /* Function: MX25_WRSCUR Arguments: None. Description: The WRSCUR instruction is for changing the values of Security Register Bits. Return Message: FlashIsBusy, FlashOperationSuccess, FlashWriteRegFailed, FlashTimeOut */
ReturnMsg MX25_WRSCUR(void) | {
uint8_t gDataBuffer;
if( IsFlashBusy() ) return FlashIsBusy;
MX25_WREN();
CS_Low();
SendByte( FLASH_CMD_WRSCUR, SIO );
CS_High();
if( WaitFlashReady( WriteSecuRegCycleTime ) ){
MX25_RDSCUR( &gDataBuffer );
if( (gDataBuffer & FLASH_LDSO_MASK) == FLASH_LDSO_MASK )
return FlashOperationSuccess;
else
return FlashWriteRegFailed;
}
else
return FlashTimeOut;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Registers an interrupt handler for a UART interrupt. */ | void UARTIntRegister(uint32_t ui32Base, void(*pfnHandler)(void)) | /* Registers an interrupt handler for a UART interrupt. */
void UARTIntRegister(uint32_t ui32Base, void(*pfnHandler)(void)) | {
uint32_t ui32Int;
ASSERT(_UARTBaseValid(ui32Base));
ui32Int = _UARTIntNumberGet(ui32Base);
ASSERT(ui32Int != 0);
IntRegister(ui32Int, pfnHandler);
IntEnable(ui32Int);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.