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
|
|---|---|---|---|---|---|---|---|
/* Abort any transmit and receive operations and put DMA in idle state. AT and AR bits are cleared upon entering in IDLE state. So poll those bits to verify operation. */
|
static void abortdma(struct eth_device *dev)
|
/* Abort any transmit and receive operations and put DMA in idle state. AT and AR bits are cleared upon entering in IDLE state. So poll those bits to verify operation. */
static void abortdma(struct eth_device *dev)
|
{
struct armdfec_device *darmdfec = to_darmdfec(dev);
struct armdfec_reg *regs = darmdfec->regs;
int delay;
int maxretries = 40;
u32 tmp;
while (--maxretries) {
writel(SDMA_CMD_AR | SDMA_CMD_AT, ®s->sdma_cmd);
udelay(100);
delay = 10;
while (--delay) {
tmp = readl(®s->sdma_cmd);
if (!(tmp & (SDMA_CMD_AR | SDMA_CMD_AT)))
break;
udelay(10);
}
if (delay)
break;
}
if (!maxretries)
printf("ARMD100 FEC: (%s) DMA Stuck\n", __func__);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function is called in order to decode the EventNotification payload */
|
static void dissect_zcl_appl_evtalt_event_notif(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
/* This function is called in order to decode the EventNotification payload */
static void dissect_zcl_appl_evtalt_event_notif(tvbuff_t *tvb, proto_tree *tree, guint *offset)
|
{
proto_tree_add_item(tree, hf_zbee_zcl_appl_evtalt_event_hdr, tvb, *offset, 1, ENC_NA);
*offset += 1;
proto_tree_add_item(tree, hf_zbee_zcl_appl_evtalt_event_id, tvb, *offset, 1, ENC_NA);
*offset += 1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Deinitializes the FSMC NOR/SRAM Banks registers to their default reset values. */
|
void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank)
|
/* Deinitializes the FSMC NOR/SRAM Banks registers to their default reset values. */
void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank)
|
{
assert_param(IS_FSMC_NORSRAM_BANK(FSMC_Bank));
if(FSMC_Bank == FSMC_Bank1_NORSRAM1)
{
FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030DB;
}
else
{
FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030D2;
}
FSMC_Bank1->BTCR[FSMC_Bank + 1] = 0x0FFFFFFF;
FSMC_Bank1E->BWTR[FSMC_Bank] = 0x0FFFFFFF;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Returns 0 if success, error code on error */
|
static int cdns3_req_ep0_handle_feature(struct cdns3_device *priv_dev, struct usb_ctrlrequest *ctrl, int set)
|
/* Returns 0 if success, error code on error */
static int cdns3_req_ep0_handle_feature(struct cdns3_device *priv_dev, struct usb_ctrlrequest *ctrl, int set)
|
{
int ret = 0;
u32 recip;
recip = ctrl->bRequestType & USB_RECIP_MASK;
switch (recip) {
case USB_RECIP_DEVICE:
ret = cdns3_ep0_feature_handle_device(priv_dev, ctrl, set);
break;
case USB_RECIP_INTERFACE:
ret = cdns3_ep0_feature_handle_intf(priv_dev, ctrl, set);
break;
case USB_RECIP_ENDPOINT:
ret = cdns3_ep0_feature_handle_endpoint(priv_dev, ctrl, set);
break;
default:
return -EINVAL;
}
return ret;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Called very early, MMU is off, device-tree isn't unflattened */
|
static int __init mpc834x_itx_probe(void)
|
/* Called very early, MMU is off, device-tree isn't unflattened */
static int __init mpc834x_itx_probe(void)
|
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "MPC834xMITX");
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This is just the sdbm hash function with a user-supplied seed and final size parameter. */
|
static unsigned int hash_string(unsigned int seed, const char *data, unsigned int mod)
|
/* This is just the sdbm hash function with a user-supplied seed and final size parameter. */
static unsigned int hash_string(unsigned int seed, const char *data, unsigned int mod)
|
{
unsigned char c;
while ((c = *data++) != 0) {
seed = (seed << 16) + (seed << 6) - seed + c;
}
return seed % mod;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* interface function to delete all the snapshots we have scheduled for deletion */
|
int btrfs_clean_old_snapshots(struct btrfs_root *root)
|
/* interface function to delete all the snapshots we have scheduled for deletion */
int btrfs_clean_old_snapshots(struct btrfs_root *root)
|
{
LIST_HEAD(list);
struct btrfs_fs_info *fs_info = root->fs_info;
mutex_lock(&fs_info->trans_mutex);
list_splice_init(&fs_info->dead_roots, &list);
mutex_unlock(&fs_info->trans_mutex);
while (!list_empty(&list)) {
root = list_entry(list.next, struct btrfs_root, root_list);
list_del(&root->root_list);
if (btrfs_header_backref_rev(root->node) <
BTRFS_MIXED_BACKREF_REV)
btrfs_drop_snapshot(root, 0);
else
btrfs_drop_snapshot(root, 1);
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if question is already in the list. */
|
static bool _mdns_question_exists(mdns_out_question_t *needle, mdns_out_question_t *haystack)
|
/* Check if question is already in the list. */
static bool _mdns_question_exists(mdns_out_question_t *needle, mdns_out_question_t *haystack)
|
{
while (haystack) {
if (haystack->type == needle->type
&& haystack->host == needle->host
&& haystack->service == needle->service
&& haystack->proto == needle->proto) {
return true;
}
haystack = haystack->next;
}
return false;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Calling this on a board that does not support it can be a very dangerous thing. The Madge board, for instance, will lock your machine hard when this is called. Luckily, its supported in a separate driver. */
|
static void tms_pci_read_eeprom(struct net_device *dev)
|
/* Calling this on a board that does not support it can be a very dangerous thing. The Madge board, for instance, will lock your machine hard when this is called. Luckily, its supported in a separate driver. */
static void tms_pci_read_eeprom(struct net_device *dev)
|
{
int i;
tms_pci_sifwritew(dev, 0, SIFADX);
tms_pci_sifwritew(dev, 0, SIFADR);
dev->addr_len = 6;
for(i = 0; i < 6; i++)
dev->dev_addr[i] = tms_pci_sifreadw(dev, SIFINC) >> 8;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI PciExpressBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
|
{
ASSERT_INVALID_PCI_ADDRESS (Address);
if (Address >= PcdPciExpressBaseSize ()) {
return (UINT16)-1;
}
return MmioBitFieldOr16 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT16 EFIAPI MmioRead16(IN UINTN Address)
|
/* If 16-bit MMIO register operations are not supported, then ASSERT(). */
UINT16 EFIAPI MmioRead16(IN UINTN Address)
|
{
UINT16 Value;
BOOLEAN Flag;
ASSERT ((Address & 1) == 0);
Flag = FilterBeforeMmIoRead (FilterWidth16, Address, &Value);
if (Flag) {
Value = *(volatile UINT16 *)Address;
}
FilterAfterMmIoRead (FilterWidth16, Address, &Value);
return Value;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function will do some clean up after programming MTRRs: Flush all TLBs, re-enable caching, restore CR4. */
|
VOID MtrrLibPostMtrrChangeEnableCache(IN MTRR_CONTEXT *MtrrContext)
|
/* This function will do some clean up after programming MTRRs: Flush all TLBs, re-enable caching, restore CR4. */
VOID MtrrLibPostMtrrChangeEnableCache(IN MTRR_CONTEXT *MtrrContext)
|
{
CpuFlushTlb ();
AsmEnableCache ();
AsmWriteCr4 (MtrrContext->Cr4);
SetInterruptState (MtrrContext->InterruptState);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Verify that a register read works. Given the custom nature of SDIO devices, we just read from the card common I/O area. */
|
ZTEST(sd_stack, test_read)
|
/* Verify that a register read works. Given the custom nature of SDIO devices, we just read from the card common I/O area. */
ZTEST(sd_stack, test_read)
|
{
int ret;
uint8_t reg = 0xFF;
ret = sdio_read_byte(&card.func0, SDIO_CCCR_CCCR, ®);
zassert_equal(ret, 0, "SD card read failed");
zassert_not_equal(reg, 0xFF, "CCCR read returned invalid data");
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Disables multicast hash filtering. When disabled GMAC performs perfect destination address filtering for multicast frames, it compares DA field with the value programmed in DA register. */
|
void synopGMAC_multicast_hash_filter_disable(synopGMACdevice *gmacdev)
|
/* Disables multicast hash filtering. When disabled GMAC performs perfect destination address filtering for multicast frames, it compares DA field with the value programmed in DA register. */
void synopGMAC_multicast_hash_filter_disable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev -> MacBase, GmacFrameFilter, GmacMcastHashFilter);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set all the fields in a bmap extent record from the uncompressed form. */
|
void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s)
|
/* Set all the fields in a bmap extent record from the uncompressed form. */
void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s)
|
{
xfs_bmbt_disk_set_allf(r, s->br_startoff, s->br_startblock,
s->br_blockcount, s->br_state);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* "id" is the POSIX thread ID. We use the files pointer for this.. */
|
int filp_close(struct file *filp, fl_owner_t id)
|
/* "id" is the POSIX thread ID. We use the files pointer for this.. */
int filp_close(struct file *filp, fl_owner_t id)
|
{
int retval = 0;
if (!file_count(filp)) {
printk(KERN_ERR "VFS: Close: file count is 0\n");
return 0;
}
if (filp->f_op && filp->f_op->flush)
retval = filp->f_op->flush(filp, id);
dnotify_flush(filp, id);
locks_remove_posix(filp, id);
fput(filp);
return retval;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function returns zero in case of success and a negative error code in case of failure. */
|
int ubi_wl_flush(struct ubi_device *ubi)
|
/* This function returns zero in case of success and a negative error code in case of failure. */
int ubi_wl_flush(struct ubi_device *ubi)
|
{
int err;
dbg_wl("flush (%d pending works)", ubi->works_count);
while (ubi->works_count) {
err = do_work(ubi);
if (err)
return err;
}
down_write(&ubi->work_sem);
up_write(&ubi->work_sem);
while (ubi->works_count) {
dbg_wl("flush more (%d pending works)", ubi->works_count);
err = do_work(ubi);
if (err)
return err;
}
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* n_hdlc_buf_put - add specified HDLC buffer to tail of specified list @list - pointer to buffer list @buf - pointer to buffer */
|
static void n_hdlc_buf_put(struct n_hdlc_buf_list *list, struct n_hdlc_buf *buf)
|
/* n_hdlc_buf_put - add specified HDLC buffer to tail of specified list @list - pointer to buffer list @buf - pointer to buffer */
static void n_hdlc_buf_put(struct n_hdlc_buf_list *list, struct n_hdlc_buf *buf)
|
{
unsigned long flags;
spin_lock_irqsave(&list->spinlock,flags);
buf->link=NULL;
if (list->tail)
list->tail->link = buf;
else
list->head = buf;
list->tail = buf;
(list->count)++;
spin_unlock_irqrestore(&list->spinlock,flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads the specified SPI transmit CRC register value. */
|
uint16_t SPI_ReadTxCRC(SPI_T *spi)
|
/* Reads the specified SPI transmit CRC register value. */
uint16_t SPI_ReadTxCRC(SPI_T *spi)
|
{
return spi->TXCRC_B.TXCRC;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Software reset. Restore the default values in user registers. */
|
int32_t lps22hb_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
|
/* Software reset. Restore the default values in user registers. */
int32_t lps22hb_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
|
{
lps22hb_ctrl_reg2_t ctrl_reg2;
int32_t ret;
ret = lps22hb_read_reg(ctx, LPS22HB_CTRL_REG2, (uint8_t*)&ctrl_reg2, 1);
*val = ctrl_reg2.swreset;
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Draws a string using the supplied font data. */
|
void st7565DrawString(uint16_t x, uint16_t y, char *text, struct FONT_DEF font)
|
/* Draws a string using the supplied font data. */
void st7565DrawString(uint16_t x, uint16_t y, char *text, struct FONT_DEF font)
|
{
uint8_t l;
for (l = 0; l < strlen(text); l++)
{
drawChar(x + (l * (font.u8Width + 1)), y, text[l], font);
}
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* i2c_write - write data to an i2c device @chip: i2c chip addr @addr: memory (register) address in the chip @alen: byte size of address @buffer: buffer holding data to write to chip @len: how many bytes to write */
|
int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
|
/* i2c_write - write data to an i2c device @chip: i2c chip addr @addr: memory (register) address in the chip @alen: byte size of address @buffer: buffer holding data to write to chip @len: how many bytes to write */
int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
|
{
return i2c_transfer(chip, addr, alen, buffer, len, 0);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* G2D IRQ query funct if the mission finish IRQ flag was set to 1, then clear the flag and return 1 if the IRQ was set to 0, then return 0 */
|
__s32 g2d_rot_irq_query(void)
|
/* G2D IRQ query funct if the mission finish IRQ flag was set to 1, then clear the flag and return 1 if the IRQ was set to 0, then return 0 */
__s32 g2d_rot_irq_query(void)
|
{
__u32 tmp;
tmp = read_wvalue(ROT_INT);
if (tmp & 0x1) {
write_wvalue(ROT_INT, tmp);
return 1;
}
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Handle set address request.
This function is used to handle set address request. */
|
static usb_status_t USB_DeviceCh9SetAddress(usb_device_handle handle, usb_setup_struct_t *setup, uint8_t **buffer, uint32_t *length)
|
/* Handle set address request.
This function is used to handle set address request. */
static usb_status_t USB_DeviceCh9SetAddress(usb_device_handle handle, usb_setup_struct_t *setup, uint8_t **buffer, uint32_t *length)
|
{
usb_status_t error = kStatus_USB_InvalidRequest;
uint8_t state;
USB_DeviceGetStatus(handle, kUSB_DeviceStatusDeviceState, &state);
if ((kUSB_DeviceStateAddressing != state) && (kUSB_DeviceStateAddress != state) &&
(kUSB_DeviceStateDefault != state))
{
return error;
}
if (kUSB_DeviceStateAddressing != state)
{
state = setup->wValue & 0xFFU;
error = USB_DeviceSetStatus(handle, kUSB_DeviceStatusAddress, &state);
}
else
{
error = USB_DeviceSetStatus(handle, kUSB_DeviceStatusAddress, NULL);
if (kStatus_USB_Success == error)
{
state = kUSB_DeviceStateAddress;
error = USB_DeviceSetStatus(handle, kUSB_DeviceStatusDeviceState, &state);
}
}
return error;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function handles continuation of sending data. It is invoked from interrupt handler. */
|
void MasterSendData(XIicPs *InstancePtr)
|
/* This function handles continuation of sending data. It is invoked from interrupt handler. */
void MasterSendData(XIicPs *InstancePtr)
|
{
(void)TransmitFifoFill(InstancePtr);
if (InstancePtr->SendByteCount == 0) {
if (InstancePtr->IsRepeatedStart == 0) {
XIicPs_WriteReg(InstancePtr->Config.BaseAddress,
(u32)XIICPS_CR_OFFSET,
XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
(u32)XIICPS_CR_OFFSET) & (u32)(~ XIICPS_CR_HOLD_MASK));
}
}
return;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* This function retrieves the WiFi interface's IP address. */
|
WIFI_Status_t WIFI_GetIP_Address(uint8_t *ipaddr)
|
/* This function retrieves the WiFi interface's IP address. */
WIFI_Status_t WIFI_GetIP_Address(uint8_t *ipaddr)
|
{
WIFI_Status_t ret = WIFI_STATUS_ERROR;
if(EsWifiObj.NetSettings.IsConnected)
{
memcpy(ipaddr, EsWifiObj.NetSettings.IP_Addr, 4);
ret = WIFI_STATUS_OK;
}
return ret;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* This API is only invoked in boot time. It may NOT be invoked at runtime. */
|
EFI_STATUS InternalGetVariable(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size)
|
/* This API is only invoked in boot time. It may NOT be invoked at runtime. */
EFI_STATUS InternalGetVariable(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size)
|
{
EFI_STATUS Status;
UINTN BufferSize;
BufferSize = 0;
*Value = NULL;
if (Size != NULL) {
*Size = 0;
}
Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value);
if (Status != EFI_BUFFER_TOO_SMALL) {
return Status;
}
*Value = AllocatePool (BufferSize);
ASSERT (*Value != NULL);
if (*Value == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value);
if (EFI_ERROR (Status)) {
FreePool (*Value);
*Value = NULL;
}
if (Size != NULL) {
*Size = BufferSize;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* phy_device_register - Register the phy device on the MDIO bus @phydev: phy_device structure to be added to the MDIO bus */
|
int phy_device_register(struct phy_device *phydev)
|
/* phy_device_register - Register the phy device on the MDIO bus @phydev: phy_device structure to be added to the MDIO bus */
int phy_device_register(struct phy_device *phydev)
|
{
int err;
if (phydev->bus->phy_map[phydev->addr])
return -EINVAL;
phydev->bus->phy_map[phydev->addr] = phydev;
phy_scan_fixups(phydev);
err = device_register(&phydev->dev);
if (err) {
pr_err("phy %d failed to register\n", phydev->addr);
goto out;
}
return 0;
out:
phydev->bus->phy_map[phydev->addr] = NULL;
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Count the number of nodes in a branch with the input name. */
|
EFI_STATUS EFIAPI FdtCountNamedNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *NodeName, OUT UINT32 *NodeCount)
|
/* Count the number of nodes in a branch with the input name. */
EFI_STATUS EFIAPI FdtCountNamedNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *NodeName, OUT UINT32 *NodeCount)
|
{
return FdtCountCondNodeInBranch (
Fdt,
FdtBranch,
FdtNodeHasName,
NodeName,
NodeCount
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Given a UWB device descriptor, validate and refcount it */
|
struct uwb_dev* uwb_dev_try_get(struct uwb_rc *rc, struct uwb_dev *uwb_dev)
|
/* Given a UWB device descriptor, validate and refcount it */
struct uwb_dev* uwb_dev_try_get(struct uwb_rc *rc, struct uwb_dev *uwb_dev)
|
{
if (uwb_dev_for_each(rc, __uwb_dev_try_get, uwb_dev))
return uwb_dev;
else
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This program can be distributed under the terms of the GNU GPL. See the file COPYING. On 32 bit archs store the high 32 bits of time in d_fsdata */
|
static void fuse_dentry_settime(struct dentry *entry, u64 time)
|
/* This program can be distributed under the terms of the GNU GPL. See the file COPYING. On 32 bit archs store the high 32 bits of time in d_fsdata */
static void fuse_dentry_settime(struct dentry *entry, u64 time)
|
{
entry->d_time = time;
entry->d_fsdata = (void *) (unsigned long) (time >> 32);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each timeConfig member with its default value. */
|
void RTC_ConfigTimeStructInit(RTC_TimeConfig_T *timeConfig)
|
/* Fills each timeConfig member with its default value. */
void RTC_ConfigTimeStructInit(RTC_TimeConfig_T *timeConfig)
|
{
timeConfig->hours = 0;
timeConfig->minutes = 0;
timeConfig->seconds = 0;
timeConfig->h12 = RTC_H12_AM;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called by bond_set_carrier(). Return zero if carrier state does not change, nonzero if it does. */
|
int bond_3ad_set_carrier(struct bonding *bond)
|
/* Called by bond_set_carrier(). Return zero if carrier state does not change, nonzero if it does. */
int bond_3ad_set_carrier(struct bonding *bond)
|
{
if (__get_active_agg(&(SLAVE_AD_INFO(bond->first_slave).aggregator))) {
if (!netif_carrier_ok(bond->dev)) {
netif_carrier_on(bond->dev);
return 1;
}
return 0;
}
if (netif_carrier_ok(bond->dev)) {
netif_carrier_off(bond->dev);
return 1;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called when the capture device is released or the buffer overflows */
|
static void saa7134_dma_stop(struct saa7134_dev *dev)
|
/* Called when the capture device is released or the buffer overflows */
static void saa7134_dma_stop(struct saa7134_dev *dev)
|
{
dev->dmasound.dma_blk = -1;
dev->dmasound.dma_running = 0;
saa7134_set_dmabits(dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
|
int32_t lsm6dso_tap_quiet_get(stmdev_ctx_t *ctx, uint8_t *val)
|
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
int32_t lsm6dso_tap_quiet_get(stmdev_ctx_t *ctx, uint8_t *val)
|
{
lsm6dso_int_dur2_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t *)®, 1);
*val = reg.quiet;
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Write RTC through its registers using IO access. */
|
STATIC VOID IoRtcWrite(IN UINTN Address, IN UINT8 Data)
|
/* Write RTC through its registers using IO access. */
STATIC VOID IoRtcWrite(IN UINTN Address, IN UINT8 Data)
|
{
IoWrite8 (
mRtcIndexRegister,
(UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
);
IoWrite8 (mRtcTargetRegister, Data);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Stops the counter of the designated timer(s) operating in waveform mode Timers can be combined (ORed) to allow for simultaneous counter stop. */
|
void HRTIM_WaveformCounterStop(HRTIM_TypeDef *HRTIMx, uint32_t TimersToStop)
|
/* Stops the counter of the designated timer(s) operating in waveform mode Timers can be combined (ORed) to allow for simultaneous counter stop. */
void HRTIM_WaveformCounterStop(HRTIM_TypeDef *HRTIMx, uint32_t TimersToStop)
|
{
HRTIMx->HRTIM_MASTER.MCR &= ~TimersToStop;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* If this function returns TRUE, the local shadow copy of the configuration is also updated. If the device function is currently disabled, only the local shadow copy is updated and the actual device function will be updated if/when it is enabled. */
|
unsigned int __init SMC37c669_configure_device(unsigned int func, int port, int irq, int drq)
|
/* If this function returns TRUE, the local shadow copy of the configuration is also updated. If the device function is currently disabled, only the local shadow copy is updated and the actual device function will be updated if/when it is enabled. */
unsigned int __init SMC37c669_configure_device(unsigned int func, int port, int irq, int drq)
|
{
struct DEVICE_CONFIG *cp;
if ( ( cp = SMC37c669_get_config ( func ) ) != NULL ) {
if ( ( drq & ~0xFF ) == 0 ) {
cp->drq = drq;
}
if ( ( irq & ~0xFF ) == 0 ) {
cp->irq = irq;
}
if ( ( port & ~0xFFFF ) == 0 ) {
cp->port1 = port;
}
if ( SMC37c669_is_device_enabled( func ) ) {
SMC37c669_enable_device( func );
}
return TRUE;
}
return FALSE;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Configures the high and low thresholds of the analog watchdog. */
|
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
|
/* Configures the high and low thresholds of the analog watchdog. */
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
|
{
uint32_t tempThreshold;
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_THRESHOLD(HighThreshold));
assert_param(IS_ADC_THRESHOLD(LowThreshold));
tempThreshold = HighThreshold;
ADCx->ADCMPR = (tempThreshold << 16) | LowThreshold;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called when a cpu comes up after the system has finished booting, i.e. as a result of a hotplug cpu action. */
|
void snapshot_timebase(void)
|
/* Called when a cpu comes up after the system has finished booting, i.e. as a result of a hotplug cpu action. */
void snapshot_timebase(void)
|
{
__get_cpu_var(last_jiffy) = get_tb_or_rtc();
snapshot_purr();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Change Logs: Date Author Notes wanghaijing the first version */
|
static int rt_flash_init(void)
|
/* Change Logs: Date Author Notes wanghaijing the first version */
static int rt_flash_init(void)
|
{
extern rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name);
extern int fal_init(void);
rt_hw_spi_device_attach("spi1", "spi10", GET_PIN(A, 4));
rt_sfud_flash_probe("norflash0", "spi10");
fal_init();
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Deallocates source or destination memory, allocated.
This function can be called to deallocate data memory that was DMAed successfully */
|
int dmacHw_freeMem(dmacHw_CONFIG_t *pConfig, void *pDescriptor, void(*fpFree)(void *))
|
/* Deallocates source or destination memory, allocated.
This function can be called to deallocate data memory that was DMAed successfully */
int dmacHw_freeMem(dmacHw_CONFIG_t *pConfig, void *pDescriptor, void(*fpFree)(void *))
|
{
dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor);
uint32_t count = 0;
if (fpFree == NULL) {
return -1;
}
while ((pRing->pFree != pRing->pTail)
&& (pRing->pFree->ctl.lo & dmacHw_DESC_FREE)) {
if (pRing->pFree->devCtl == dmacHw_FREE_USER_MEMORY) {
if (dmacHw_DST_IS_MEMORY(pConfig->transferType)) {
(*fpFree) ((void *)pRing->pFree->dar);
} else {
(*fpFree) ((void *)pRing->pFree->sar);
}
pRing->pFree->devCtl = ~dmacHw_FREE_USER_MEMORY;
}
dmacHw_NEXT_DESC(pRing, pFree);
count++;
}
return count;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* dbg_is_node_dirty - determine if a node is dirty. */
|
static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum, int offs)
|
/* dbg_is_node_dirty - determine if a node is dirty. */
static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum, int offs)
|
{
switch (node_type) {
case UBIFS_LPT_NNODE:
return dbg_is_nnode_dirty(c, lnum, offs);
case UBIFS_LPT_PNODE:
return dbg_is_pnode_dirty(c, lnum, offs);
case UBIFS_LPT_LTAB:
return dbg_is_ltab_dirty(c, lnum, offs);
case UBIFS_LPT_LSAVE:
return dbg_is_lsave_dirty(c, lnum, offs);
}
return 1;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* We implement the delay by converting the delay (the number of microseconds to wait) into a number of time base ticks; then we watch the time base until it has incremented by that amount. */
|
void __udelay(unsigned long usec)
|
/* We implement the delay by converting the delay (the number of microseconds to wait) into a number of time base ticks; then we watch the time base until it has incremented by that amount. */
void __udelay(unsigned long usec)
|
{
ulong ticks = usec2ticks (usec);
wait_ticks (ticks);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* param base ENET peripheral base address. param addend The addend value to be set in the fine method note Should take refer to the chapter "System time correction" and see the description for the "fine correction method". */
|
status_t ENET_QOS_Ptp1588CorrectTimerInFine(ENET_QOS_Type *base, uint32_t addend)
|
/* param base ENET peripheral base address. param addend The addend value to be set in the fine method note Should take refer to the chapter "System time correction" and see the description for the "fine correction method". */
status_t ENET_QOS_Ptp1588CorrectTimerInFine(ENET_QOS_Type *base, uint32_t addend)
|
{
status_t result = kStatus_Success;
base->MAC_TIMESTAMP_ADDEND = addend;
base->MAC_TIMESTAMP_CONTROL |= ENET_QOS_MAC_TIMESTAMP_CONTROL_TSADDREG_MASK;
result = ENET_QOS_PollStatusFlag(&(base->MAC_TIMESTAMP_CONTROL), ENET_QOS_MAC_TIMESTAMP_CONTROL_TSADDREG_MASK, 0U);
return result;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base SAI base pointer param resetType Reset type, FIFO reset or software reset */
|
void SAI_RxSoftwareReset(I2S_Type *base, sai_reset_type_t resetType)
|
/* param base SAI base pointer param resetType Reset type, FIFO reset or software reset */
void SAI_RxSoftwareReset(I2S_Type *base, sai_reset_type_t resetType)
|
{
base->RCSR |= (uint32_t)resetType;
base->RCSR &= ~I2S_RCSR_SR_MASK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initialize TP state. tp_params contains initial settings for some TP parameters, particularly the one-time PM and CM settings. */
|
int t1_tp_reset(struct petp *tp, struct tp_params *p, unsigned int tp_clk)
|
/* Initialize TP state. tp_params contains initial settings for some TP parameters, particularly the one-time PM and CM settings. */
int t1_tp_reset(struct petp *tp, struct tp_params *p, unsigned int tp_clk)
|
{
adapter_t *adapter = tp->adapter;
tp_init(adapter, p, tp_clk);
writel(F_TP_RESET, adapter->regs + A_TP_RESET);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This method gets called from a work queue so that the driver private cleanup ops can sleep (needed for USB at least) */
|
static void release_one_tty(struct work_struct *work)
|
/* This method gets called from a work queue so that the driver private cleanup ops can sleep (needed for USB at least) */
static void release_one_tty(struct work_struct *work)
|
{
struct tty_struct *tty =
container_of(work, struct tty_struct, hangup_work);
struct tty_driver *driver = tty->driver;
if (tty->ops->cleanup)
tty->ops->cleanup(tty);
tty->magic = 0;
tty_driver_kref_put(driver);
module_put(driver->owner);
file_list_lock();
list_del_init(&tty->tty_files);
file_list_unlock();
free_tty_struct(tty);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable USB Endpoint Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
|
void USBD_DisableEP(uint32_t EPNum)
|
/* Disable USB Endpoint Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_DisableEP(uint32_t EPNum)
|
{
if (EPNum & 0x80) {
EPNum &= 0x0F;
USB0->ENDPOINT[EPNum].ENDPT &= ~(USB_ENDPT_EPHSHK_MASK |
USB_ENDPT_EPTXEN_MASK);
} else {
USB0->ENDPOINT[EPNum].ENDPT &= ~(USB_ENDPT_EPHSHK_MASK |
USB_ENDPT_EPRXEN_MASK);
}
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* These functions get/set/update the registers of the cd1400 UARTs. Access to the cd1400 registers is via an address/data io port pair. (Maybe should make this inline...) */
|
static int stl_cd1400getreg(struct stlport *portp, int regnr)
|
/* These functions get/set/update the registers of the cd1400 UARTs. Access to the cd1400 registers is via an address/data io port pair. (Maybe should make this inline...) */
static int stl_cd1400getreg(struct stlport *portp, int regnr)
|
{
outb((regnr + portp->uartaddr), portp->ioaddr);
return inb(portp->ioaddr + EREG_DATA);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Creates an empty mailbox for maximum "size" elements. */
|
err_t sys_mbox_new(sys_mbox_t *mb, int size)
|
/* Creates an empty mailbox for maximum "size" elements. */
err_t sys_mbox_new(sys_mbox_t *mb, int size)
|
{
struct sys_mbox *mbox;
LWIP_UNUSED_ARG(size);
mbox = (struct sys_mbox *)malloc(sizeof(struct sys_mbox));
if (mbox == NULL) {
return ERR_MEM;
}
memset(mbox, 0, sizeof(struct sys_mbox));
mbox->first = mbox->last = 0;
sys_sem_new(&mbox->not_empty, 0);
sys_sem_new(&mbox->not_full, 0);
sys_sem_new(&mbox->mutex, 1);
mbox->wait_send = 0;
*mb = mbox;
return ERR_OK;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Retrieve corresponding bits in bitmap table according to given memory range. */
|
UINTN GetGuardedMemoryBits(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN NumberOfPages)
|
/* Retrieve corresponding bits in bitmap table according to given memory range. */
UINTN GetGuardedMemoryBits(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN NumberOfPages)
|
{
UINT64 *BitMap;
UINTN Bits;
UINTN Result;
UINTN Shift;
UINTN BitsToUnitEnd;
ASSERT (NumberOfPages <= GUARDED_HEAP_MAP_ENTRY_BITS);
Result = 0;
Shift = 0;
while (NumberOfPages > 0) {
BitsToUnitEnd = FindGuardedMemoryMap (Address, FALSE, &BitMap);
if (NumberOfPages > BitsToUnitEnd) {
Bits = BitsToUnitEnd;
} else {
Bits = NumberOfPages;
}
if (BitMap != NULL) {
Result |= LShiftU64 (GetBits (Address, Bits, BitMap), Shift);
}
Shift += Bits;
NumberOfPages -= Bits;
Address += EFI_PAGES_TO_SIZE (Bits);
}
return Result;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* DMAMUX Set Request Generator Input Trigger Signal.
Set DMAMUX Request Generator input signal id (dmamux_rgxcr_sig_id) for given Request Generator Channel. */
|
void dmamux_set_request_generator_trigger(uint32_t dmamux, uint8_t rg_channel, uint8_t sig_id)
|
/* DMAMUX Set Request Generator Input Trigger Signal.
Set DMAMUX Request Generator input signal id (dmamux_rgxcr_sig_id) for given Request Generator Channel. */
void dmamux_set_request_generator_trigger(uint32_t dmamux, uint8_t rg_channel, uint8_t sig_id)
|
{
uint32_t reg32 = DMAMUX_RGxCR(dmamux, rg_channel);
reg32 &= ~(DMAMUX_RGxCR_SIG_ID_MASK << DMAMUX_RGxCR_SIG_ID_SHIFT);
reg32 |= ((sig_id & DMAMUX_RGxCR_SIG_ID_MASK) << DMAMUX_RGxCR_SIG_ID_SHIFT);
DMAMUX_RGxCR(dmamux, rg_channel) = reg32;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Returns: pointer if quirk found, or NULL if no quirks found. */
|
static const struct hid_blacklist* usbhid_exists_squirk(const u16 idVendor, const u16 idProduct)
|
/* Returns: pointer if quirk found, or NULL if no quirks found. */
static const struct hid_blacklist* usbhid_exists_squirk(const u16 idVendor, const u16 idProduct)
|
{
const struct hid_blacklist *bl_entry = NULL;
int n = 0;
for (; hid_blacklist[n].idVendor; n++)
if (hid_blacklist[n].idVendor == idVendor &&
hid_blacklist[n].idProduct == idProduct)
bl_entry = &hid_blacklist[n];
if (bl_entry != NULL)
dbg_hid("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n",
bl_entry->quirks, bl_entry->idVendor,
bl_entry->idProduct);
return bl_entry;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check validity of algoritm.
This function checks the validity of input argument. */
|
static status_t cau3_hash_check_input_alg(cau3_hash_algo_t algo)
|
/* Check validity of algoritm.
This function checks the validity of input argument. */
static status_t cau3_hash_check_input_alg(cau3_hash_algo_t algo)
|
{
if ((algo != kCAU3_Sha256) && (algo != kCAU3_Sha1))
{
return kStatus_InvalidArgument;
}
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* 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 GPIOPinTypeUSBAnalog(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 GPIOPinTypeUSBAnalog(unsigned long ulPort, unsigned char ucPins)
|
{
ASSERT(GPIOBaseValid(ulPort));
GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_ANALOG);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
|
void Vector27_handler(void)
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector27_handler(void)
|
{
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (27 * 2))
JMP 0,X
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Updates the MAC registers in the KS8695 device from the address in the net_device structure associated with this interface. */
|
static void ks8695_update_mac(struct ks8695_priv *ksp)
|
/* Updates the MAC registers in the KS8695 device from the address in the net_device structure associated with this interface. */
static void ks8695_update_mac(struct ks8695_priv *ksp)
|
{
struct net_device *ndev = ksp->ndev;
u32 machigh, maclow;
maclow = ((ndev->dev_addr[2] << 24) | (ndev->dev_addr[3] << 16) |
(ndev->dev_addr[4] << 8) | (ndev->dev_addr[5] << 0));
machigh = ((ndev->dev_addr[0] << 8) | (ndev->dev_addr[1] << 0));
ks8695_writereg(ksp, KS8695_MAL, maclow);
ks8695_writereg(ksp, KS8695_MAH, machigh);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set card to max frequence in normal mode. */
|
static status_t SDSPI_SetMaxFrequencyNormalMode(sdspi_card_t *card)
|
/* Set card to max frequence in normal mode. */
static status_t SDSPI_SetMaxFrequencyNormalMode(sdspi_card_t *card)
|
{
uint32_t maxFrequency;
maxFrequency = g_transferSpeedRateUnit[SD_RD_TRANSFER_SPEED_RATE_UNIT(card->csd)] *
g_transferSpeedMultiplierFactor[SD_RD_TRANSFER_SPEED_TIME_VALUE(card->csd)];
if (maxFrequency > card->host->busBaudRate)
{
maxFrequency = card->host->busBaudRate;
}
if (kStatus_Success != card->host->setFrequency(maxFrequency))
{
return kStatus_SDSPI_SetFrequencyFailed;
}
return kStatus_Success;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Write the word at offset "off" into "struct user". We actually access the pt_regs stored on the kernel stack. */
|
static int ptrace_write_user(struct task_struct *tsk, unsigned long off, unsigned long val)
|
/* Write the word at offset "off" into "struct user". We actually access the pt_regs stored on the kernel stack. */
static int ptrace_write_user(struct task_struct *tsk, unsigned long off, unsigned long val)
|
{
if (off & 3 || off >= sizeof(struct user))
return -EIO;
if (off >= sizeof(struct pt_regs))
return 0;
return put_user_reg(tsk, off >> 2, val);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function gets the number of Virtual CPUs that are usable for Td Guest. */
|
UINT32 EFIAPI TdVCpuNum(VOID)
|
/* This function gets the number of Virtual CPUs that are usable for Td Guest. */
UINT32 EFIAPI TdVCpuNum(VOID)
|
{
if (mTdDataReturned) {
return mTdVCpuNum;
}
return GetTdInfo () ? mTdVCpuNum : 0;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* We may be able to do a better job with this if there were some way to declare that a file should be sparse. */
|
static int cifs_write_timeout(struct cifsInodeInfo *cifsi, loff_t offset)
|
/* We may be able to do a better job with this if there were some way to declare that a file should be sparse. */
static int cifs_write_timeout(struct cifsInodeInfo *cifsi, loff_t offset)
|
{
if (offset <= cifsi->server_eof)
return CIFS_STD_OP;
else if (offset > (cifsi->server_eof + (10 * 1024 * 1024)))
return CIFS_VLONG_OP;
else
return CIFS_LONG_OP;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI BitFieldWrite16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
/* If 16-bit operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI BitFieldWrite16(IN UINT16 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
{
ASSERT (EndBit < 16);
ASSERT (StartBit <= EndBit);
return BitFieldAndThenOr16 (Operand, StartBit, EndBit, 0, Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT32 EFIAPI PciBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI PciBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
|
{
return PciCf8BitFieldOr32 (Address, StartBit, EndBit, OrData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is the system call interface. This communicates with the user-level programs. Currently this only supports diskquota calls. Maybe we need to add the process quotas etc. in the future, but we probably should use rlimits for that. */
|
SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, qid_t, id, void __user *, addr)
|
/* This is the system call interface. This communicates with the user-level programs. Currently this only supports diskquota calls. Maybe we need to add the process quotas etc. in the future, but we probably should use rlimits for that. */
SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special, qid_t, id, void __user *, addr)
|
{
uint cmds, type;
struct super_block *sb = NULL;
int ret;
cmds = cmd >> SUBCMDSHIFT;
type = cmd & SUBCMDMASK;
if (cmds != Q_SYNC || special) {
sb = quotactl_block(special);
if (IS_ERR(sb))
return PTR_ERR(sb);
}
ret = check_quotactl_valid(sb, type, cmds, id);
if (ret >= 0)
ret = do_quotactl(sb, type, cmds, id, addr);
if (sb)
drop_super(sb);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 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)
: "q" (ExchangeValue)
: "memory",
"cc"
);
return CompareValue;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Convert the FlexIO shifter number to eDMA modulo. */
|
static bool FLEXIO_MCULCD_GetEDMAModulo(uint8_t shifterNum, edma_modulo_t *modulo)
|
/* Convert the FlexIO shifter number to eDMA modulo. */
static bool FLEXIO_MCULCD_GetEDMAModulo(uint8_t shifterNum, edma_modulo_t *modulo)
|
{
bool ret = true;
switch (shifterNum)
{
case 1U:
*modulo = kEDMA_Modulo4bytes;
break;
case 2U:
*modulo = kEDMA_Modulo8bytes;
break;
case 4U:
*modulo = kEDMA_Modulo16bytes;
break;
case 8U:
*modulo = kEDMA_Modulo32bytes;
break;
default:
ret = false;
break;
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* The control element is supposed to have the private_value field set up via HDA_BIND_VOL() or HDA_BIND_SW() macros. */
|
int snd_hda_mixer_bind_ctls_get(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_VOL() or HDA_BIND_SW() macros. */
int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct hda_bind_ctls *c;
int err;
mutex_lock(&codec->control_mutex);
c = (struct hda_bind_ctls *)kcontrol->private_value;
kcontrol->private_value = *c->values;
err = c->ops->get(kcontrol, ucontrol);
kcontrol->private_value = (long)c;
mutex_unlock(&codec->control_mutex);
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. */
|
int _write(int fd, const void *buf, size_t count)
|
/* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. */
int _write(int fd, const void *buf, size_t count)
|
{
(void)fd;
for (int i = 0; i < count; ++i)
{
XMC_UART_CH_Transmit(SERIAL_UART, *(const uint8_t *)buf);
buf++;
}
return count;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Function: MX25_SBL Arguments: burstconfig, burst length configuration Description: To set the Burst length Return Message: FlashOperationSuccess */
|
ReturnMsg MX25_SBL(uint8_t burstconfig)
|
/* Function: MX25_SBL Arguments: burstconfig, burst length configuration Description: To set the Burst length Return Message: FlashOperationSuccess */
ReturnMsg MX25_SBL(uint8_t burstconfig)
|
{
CS_Low();
SendByte( FLASH_CMD_SBL, SIO );
SendByte( burstconfig, SIO );
CS_High();
return FlashOperationSuccess;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* A transport listener is removed by writing a "-", it's transport name, and it's port number. */
|
static ssize_t __write_ports_delxprt(char *buf)
|
/* A transport listener is removed by writing a "-", it's transport name, and it's port number. */
static ssize_t __write_ports_delxprt(char *buf)
|
{
struct svc_xprt *xprt;
char transport[16];
int port;
if (sscanf(&buf[1], "%15s %4u", transport, &port) != 2)
return -EINVAL;
if (port < 1 || port > USHORT_MAX || nfsd_serv == NULL)
return -EINVAL;
xprt = svc_find_xprt(nfsd_serv, transport, AF_UNSPEC, port);
if (xprt == NULL)
return -ENOTCONN;
svc_close_xprt(xprt);
svc_xprt_put(xprt);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the current DMAy channelx FIFO filled level. */
|
uint32_t DMA_ReadFIFOFlag(DMA_Stream_T *stream)
|
/* Returns the current DMAy channelx FIFO filled level. */
uint32_t DMA_ReadFIFOFlag(DMA_Stream_T *stream)
|
{
return (uint32_t)(stream->FCTRL_B.FSTS);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enables or disables the low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This function is useful in this case if some additional power consumption can be tolerated. */
|
void LCD_HighDriveCmd(FunctionalState NewState)
|
/* Enables or disables the low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This function is useful in this case if some additional power consumption can be tolerated. */
void LCD_HighDriveCmd(FunctionalState NewState)
|
{
assert_param(IS_FUNCTIONAL_STATE(NewState));
*(__IO uint32_t *) FCR_HD_BB = (uint32_t)NewState;
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* set up the iterator to start reading from the first line */
|
static void* fscache_objlist_start(struct seq_file *m, loff_t *_pos) __acquires(&fscache_object_list_lock)
|
/* set up the iterator to start reading from the first line */
static void* fscache_objlist_start(struct seq_file *m, loff_t *_pos) __acquires(&fscache_object_list_lock)
|
{
read_lock(&fscache_object_list_lock);
return fscache_objlist_lookup(_pos);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check user specified FileCol is left to current screen. */
|
BOOLEAN LeftCurrentScreen(IN UINTN FileCol)
|
/* Check user specified FileCol is left to current screen. */
BOOLEAN LeftCurrentScreen(IN UINTN FileCol)
|
{
if (FileCol < FileBuffer.LowVisibleRange.Column) {
return TRUE;
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The transaction ID is defined in 9.3.1 and used in multiple message types. This method handles parsing the field and adding the value to the info column. */
|
void dissect_ptp_transactionID(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
|
/* The transaction ID is defined in 9.3.1 and used in multiple message types. This method handles parsing the field and adding the value to the info column. */
void dissect_ptp_transactionID(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset)
|
{
guint32 transactionID;
transactionID = tvb_get_letohl(tvb, *offset);
proto_tree_add_item(tree, hf_ptp_transactionID, tvb, *offset, 4, ENC_LITTLE_ENDIAN);
*offset += 4;
col_append_fstr(
pinfo->cinfo,
COL_INFO,
" Transaction ID: %d",
transactionID);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Extract the mask from the dcsb0 entry in a CPU revision-specific way. */
|
static u64 mask_from_dct_mask(struct amd64_pvt *pvt, int csrow)
|
/* Extract the mask from the dcsb0 entry in a CPU revision-specific way. */
static u64 mask_from_dct_mask(struct amd64_pvt *pvt, int csrow)
|
{
u64 dcsm_bits, other_bits;
u64 mask;
dcsm_bits = amd64_get_dct_mask(pvt, 0, csrow) & pvt->dcsm_mask;
other_bits = pvt->dcsm_mask;
other_bits = ~(other_bits << pvt->dcs_shift);
mask = (dcsm_bits << pvt->dcs_shift) | other_bits;
return mask;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Unhandled Exceptions. Kill user task or panic if in kernel space. */
|
void do_unhandled(struct pt_regs *regs, unsigned long exccause)
|
/* Unhandled Exceptions. Kill user task or panic if in kernel space. */
void do_unhandled(struct pt_regs *regs, unsigned long exccause)
|
{
__die_if_kernel("Caught unhandled exception - should not happen",
regs, SIGKILL);
printk("Caught unhandled exception in '%s' "
"(pid = %d, pc = %#010lx) - should not happen\n"
"\tEXCCAUSE is %ld\n",
current->comm, task_pid_nr(current), regs->pc, exccause);
force_sig(SIGILL, current);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* We are reconnecting to the backend, due to a suspend/resume, or a backend driver restart. We tear down our netif structure and recreate it, but leave the device-layer structures intact so that this is transparent to the rest of the kernel. */
|
static int netfront_resume(struct xenbus_device *dev)
|
/* We are reconnecting to the backend, due to a suspend/resume, or a backend driver restart. We tear down our netif structure and recreate it, but leave the device-layer structures intact so that this is transparent to the rest of the kernel. */
static int netfront_resume(struct xenbus_device *dev)
|
{
struct netfront_info *info = dev_get_drvdata(&dev->dev);
dev_dbg(&dev->dev, "%s\n", dev->nodename);
xennet_disconnect_backend(info);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return the MC boot timeout value in milliseconds */
|
static unsigned long get_mc_boot_timeout_ms(void)
|
/* Return the MC boot timeout value in milliseconds */
static unsigned long get_mc_boot_timeout_ms(void)
|
{
unsigned long timeout_ms = CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS;
char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
if (timeout_ms_env_var) {
timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
if (timeout_ms == 0) {
printf("fsl-mc: WARNING: Invalid value for \'"
MC_BOOT_TIMEOUT_ENV_VAR
"\' environment variable: %lu\n",
timeout_ms);
timeout_ms = CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS;
}
}
return timeout_ms;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This task is about to go to sleep on IO. Increment rq->nr_iowait so that process accounting knows that this is a task in IO wait state. */
|
void __sched io_schedule(void)
|
/* This task is about to go to sleep on IO. Increment rq->nr_iowait so that process accounting knows that this is a task in IO wait state. */
void __sched io_schedule(void)
|
{
struct rq *rq = raw_rq();
delayacct_blkio_start();
atomic_inc(&rq->nr_iowait);
current->in_iowait = 1;
schedule();
current->in_iowait = 0;
atomic_dec(&rq->nr_iowait);
delayacct_blkio_end();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Terminate execution of a thread and remove it from Active Threads. */
|
osStatus osThreadTerminate(osThreadId thread_id)
|
/* Terminate execution of a thread and remove it from Active Threads. */
osStatus osThreadTerminate(osThreadId thread_id)
|
{
if (thread->event_group != NULL) {
vEventGroupDelete(thread->event_group);
}
vTaskDelete(thread->handle);
thread->handle = NULL;
return osOK;
} else {
return osErrorParameter;
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Transfer control to a kernel image loaded with QemuLoadKernelImage () */
|
EFI_STATUS EFIAPI QemuStartKernelImage(IN OUT EFI_HANDLE *ImageHandle)
|
/* Transfer control to a kernel image loaded with QemuLoadKernelImage () */
EFI_STATUS EFIAPI QemuStartKernelImage(IN OUT EFI_HANDLE *ImageHandle)
|
{
return gBS->StartImage (
*ImageHandle,
NULL,
NULL
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Description: Copy the characters in &substring_t @src to the c-style string @dest. Copy no more than @size - 1 characters, plus the terminating NUL. Return length of @src. */
|
size_t match_strlcpy(char *dest, const substring_t *src, size_t size)
|
/* Description: Copy the characters in &substring_t @src to the c-style string @dest. Copy no more than @size - 1 characters, plus the terminating NUL. Return length of @src. */
size_t match_strlcpy(char *dest, const substring_t *src, size_t size)
|
{
size_t ret = src->to - src->from;
if (size) {
size_t len = ret >= size ? size - 1 : ret;
memcpy(dest, src->from, len);
dest[len] = '\0';
}
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Pick up the last hashvalue from a leaf block. */
|
xfs_dahash_t xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count)
|
/* Pick up the last hashvalue from a leaf block. */
xfs_dahash_t xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count)
|
{
xfs_attr_leafblock_t *leaf;
leaf = bp->data;
ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC);
if (count)
*count = be16_to_cpu(leaf->hdr.count);
if (!leaf->hdr.count)
return(0);
return be32_to_cpu(leaf->entries[be16_to_cpu(leaf->hdr.count)-1].hashval);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Checks the given level against the given DOI definition and returns a negative value if the level does not have a valid mapping and a zero value if the level is defined by the DOI. */
|
static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level)
|
/* Description: Checks the given level against the given DOI definition and returns a negative value if the level does not have a valid mapping and a zero value if the level is defined by the DOI. */
static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level)
|
{
switch (doi_def->type) {
case CIPSO_V4_MAP_PASS:
return 0;
case CIPSO_V4_MAP_TRANS:
if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)
return 0;
break;
}
return -EFAULT;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Walk the resources in @dev creating files for each resource available. */
|
int pci_create_resource_files(struct pci_dev *pdev)
|
/* Walk the resources in @dev creating files for each resource available. */
int pci_create_resource_files(struct pci_dev *pdev)
|
{
int i;
int retval;
for (i = 0; i < PCI_ROM_RESOURCE; i++) {
if (!pci_resource_len(pdev, i))
continue;
retval = pci_create_attr(pdev, i);
if (retval) {
pci_remove_resource_files(pdev);
return retval;
}
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Fetches the firmware ('BIOS') release date from the FirmwareVersionInfo HOB. */
|
CHAR16* GetBiosReleaseDate(VOID)
|
/* Fetches the firmware ('BIOS') release date from the FirmwareVersionInfo HOB. */
CHAR16* GetBiosReleaseDate(VOID)
|
{
CHAR16 *ReleaseDate;
EFI_TIME BuildTime;
ReleaseDate = AllocateZeroPool ((sizeof (CHAR16)) * SMBIOS_STRING_MAX_LENGTH);
if (ReleaseDate == NULL) {
return NULL;
}
GetReleaseTime (&BuildTime);
(VOID)UnicodeSPrintAsciiFormat (
ReleaseDate,
(sizeof (CHAR16)) * SMBIOS_STRING_MAX_LENGTH,
"%02d/%02d/%4d",
BuildTime.Month,
BuildTime.Day,
BuildTime.Year
);
return ReleaseDate;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Gets the number of bits transferred per frame. */
|
unsigned char SPIBitLengthGet(unsigned long ulBase)
|
/* Gets the number of bits transferred per frame. */
unsigned char SPIBitLengthGet(unsigned long ulBase)
|
{
xASSERT(ulBase == SPI0_BASE);
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_BIT_LEN_M)
>> SPI_CNTRL_TX_BIT_LEN_S);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Helper function called as part of the code needed to allocate the proper sized buffer for various EFI interfaces. */
|
BOOLEAN GrowBuffer(IN OUT EFI_STATUS *Status, IN OUT VOID **Buffer, IN UINTN BufferSize)
|
/* Helper function called as part of the code needed to allocate the proper sized buffer for various EFI interfaces. */
BOOLEAN GrowBuffer(IN OUT EFI_STATUS *Status, IN OUT VOID **Buffer, IN UINTN BufferSize)
|
{
BOOLEAN TryAgain;
if ((*Buffer == NULL) && (BufferSize != 0)) {
*Status = EFI_BUFFER_TOO_SMALL;
}
TryAgain = FALSE;
if (*Status == EFI_BUFFER_TOO_SMALL) {
if (*Buffer != NULL) {
FreePool (*Buffer);
}
*Buffer = AllocateZeroPool (BufferSize);
if (*Buffer != NULL) {
TryAgain = TRUE;
} else {
*Status = EFI_OUT_OF_RESOURCES;
}
}
if (!TryAgain && EFI_ERROR (*Status) && (*Buffer != NULL)) {
FreePool (*Buffer);
*Buffer = NULL;
}
return TryAgain;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base SNVS peripheral base address param datetime Pointer to the structure where the date and time details are stored. */
|
void SNVS_LP_SRTC_GetDatetime(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
|
/* param base SNVS peripheral base address param datetime Pointer to the structure where the date and time details are stored. */
void SNVS_LP_SRTC_GetDatetime(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
|
{
assert(datetime != NULL);
SNVS_LP_ConvertSecondsToDatetime(SNVS_LP_SRTC_GetSeconds(base), datetime);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask SPI DMA source. param enable True means enable DMA, false means disable DMA. */
|
void FLEXIO_SPI_EnableDMA(FLEXIO_SPI_Type *base, uint32_t mask, bool enable)
|
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask SPI DMA source. param enable True means enable DMA, false means disable DMA. */
void FLEXIO_SPI_EnableDMA(FLEXIO_SPI_Type *base, uint32_t mask, bool enable)
|
{
if ((mask & (uint32_t)kFLEXIO_SPI_TxDmaEnable) != 0U)
{
FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->shifterIndex[0], enable);
}
if ((mask & (uint32_t)kFLEXIO_SPI_RxDmaEnable) != 0U)
{
FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->shifterIndex[1], enable);
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* stmmac_mac_device_setup @dev : device pointer Description: select and initialise the mac device (mac100 or Gmac). */
|
static int stmmac_mac_device_setup(struct net_device *dev)
|
/* stmmac_mac_device_setup @dev : device pointer Description: select and initialise the mac device (mac100 or Gmac). */
static int stmmac_mac_device_setup(struct net_device *dev)
|
{
struct stmmac_priv *priv = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
struct mac_device_info *device;
if (priv->is_gmac)
device = gmac_setup(ioaddr);
else
device = mac100_setup(ioaddr);
if (!device)
return -ENOMEM;
priv->mac_type = device;
priv->wolenabled = priv->mac_type->hw.pmt;
if (priv->wolenabled == PMT_SUPPORTED)
priv->wolopts = WAKE_MAGIC;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 6.. FMS Delete Program Invocation (Confirmed Service Id = 18) 6..1. Request Message Parameters */
|
static void dissect_ff_msg_fms_del_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
|
/* 6.. FMS Delete Program Invocation (Confirmed Service Id = 18) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_del_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
|
{
proto_tree *sub_tree;
col_set_str(pinfo->cinfo, COL_INFO, "FMS Delete Program Invocation Request");
if (!tree) {
return;
}
sub_tree = proto_tree_add_subtree(tree, tvb, offset, length,
ett_ff_fms_del_pi_req, NULL, "FMS Delete Program Invocation Request");
proto_tree_add_item(sub_tree,
hf_ff_fms_del_pi_req_idx, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
length -= 4;
if (length) {
proto_tree_add_item(sub_tree, hf_ff_unknown_data, tvb, offset, length, ENC_NA);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* brief Return Frequency of Watchdog return Frequency of Watchdog */
|
uint32_t CLOCK_GetWdtClkFreq(void)
|
/* brief Return Frequency of Watchdog return Frequency of Watchdog */
uint32_t CLOCK_GetWdtClkFreq(void)
|
{
return CLOCK_GetFro1MFreq() / ((SYSCON->WDTCLKDIV & SYSCON_WDTCLKDIV_DIV_MASK) + 1U);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Set counter value for the specified TMR2 channel. */
|
void TMR2_SetCountValue(CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch, uint32_t u32Value)
|
/* Set counter value for the specified TMR2 channel. */
void TMR2_SetCountValue(CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch, uint32_t u32Value)
|
{
__IO uint32_t *reg32CNTR;
DDL_ASSERT(IS_TMR2_UNIT(TMR2x));
DDL_ASSERT(IS_TMR2_CH(u32Ch));
DDL_ASSERT(IS_TMR2_VALID_VAL(u32Value));
reg32CNTR = (__IO uint32_t *)((uint32_t)&TMR2x->CNTAR);
WRITE_REG32(reg32CNTR[u32Ch], u32Value);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Releases the dynamic preference value pointers. Must not be called before prefs_cleanup since these pointers could still be in use. */
|
void extcap_cleanup(void)
|
/* Releases the dynamic preference value pointers. Must not be called before prefs_cleanup since these pointers could still be in use. */
void extcap_cleanup(void)
|
{
if (extcap_prefs_dynamic_vals) {
g_hash_table_destroy(extcap_prefs_dynamic_vals);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* write a new value to an AD1843 bitfield and return the old value. */
|
static int ad1843_write_bits(lithium_t *lith, const ad1843_bitfield_t *field, int newval)
|
/* write a new value to an AD1843 bitfield and return the old value. */
static int ad1843_write_bits(lithium_t *lith, const ad1843_bitfield_t *field, int newval)
|
{
int w = li_read_ad1843_reg(lith, field->reg);
int mask = ((1 << field->nbits) - 1) << field->lo_bit;
int oldval = (w & mask) >> field->lo_bit;
int newbits = (newval << field->lo_bit) & mask;
w = (w & ~mask) | newbits;
(void) li_write_ad1843_reg(lith, field->reg, w);
DBGXV("ad1843_write_bits(lith=0x%p, field->{%d %d %d}, val=0x%x) "
"returns 0x%x\n",
lith, field->reg, field->lo_bit, field->nbits, newval,
oldval);
return oldval;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables ISO 7816 smart card mode on the specified UART. */
|
void UARTSmartCardEnable(unsigned long ulBase)
|
/* Enables ISO 7816 smart card mode on the specified UART. */
void UARTSmartCardEnable(unsigned long ulBase)
|
{
unsigned long ulVal;
ASSERT(!CLASS_IS_SANDSTORM && !CLASS_IS_FURY && !CLASS_IS_DUSTDEVIL);
ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) ||
(ulBase == UART2_BASE));
ulVal = HWREG(ulBase + UART_O_LCRH);
ulVal &= ~(UART_LCRH_SPS | UART_LCRH_EPS | UART_LCRH_PEN |
UART_LCRH_WLEN_M);
ulVal |= UART_LCRH_WLEN_8 | UART_LCRH_PEN | UART_LCRH_EPS | UART_LCRH_STP2;
HWREG(ulBase + UART_O_LCRH) = ulVal;
HWREG(ulBase + UART_O_CTL) |= UART_CTL_SMART;
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* This function initializes the comparator configuration structure to these default values: code config->enableStopMode = false; config->enableOutputPin = false; config->useUnfilteredOutput = false; config->enableInvertOutput = false; config->hysteresisMode = kHSCMP_HysteresisLevel0; config->powerMode = kHSCMP_LowSpeedPowerMode; endcode param config Pointer to "hscmp_config_t" structure. */
|
void HSCMP_GetDefaultConfig(hscmp_config_t *config)
|
/* This function initializes the comparator configuration structure to these default values: code config->enableStopMode = false; config->enableOutputPin = false; config->useUnfilteredOutput = false; config->enableInvertOutput = false; config->hysteresisMode = kHSCMP_HysteresisLevel0; config->powerMode = kHSCMP_LowSpeedPowerMode; endcode param config Pointer to "hscmp_config_t" structure. */
void HSCMP_GetDefaultConfig(hscmp_config_t *config)
|
{
(void)memset(config, 0, sizeof(*config));
config->enableStopMode = false;
config->enableOutputPin = false;
config->useUnfilteredOutput = false;
config->enableInvertOutput = false;
config->hysteresisMode = kHSCMP_HysteresisLevel0;
config->powerMode = kHSCMP_LowSpeedPowerMode;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.