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
|
|---|---|---|---|---|---|---|---|
/* This function returns the PRCM interrupt status of interrupts that are allowed to reflect to the processor. The interrupts are cleared on read. */
|
unsigned long PRCMIntStatus(void)
|
/* This function returns the PRCM interrupt status of interrupts that are allowed to reflect to the processor. The interrupts are cleared on read. */
unsigned long PRCMIntStatus(void)
|
{
return HWREG(ARCM_BASE + APPS_RCM_O_APPS_RCM_INTERRUPT_STATUS);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Checks whether this rx descriptor is in chain mode. This returns true if it is this descriptor is in chain mode. */
|
bool synopGMAC_is_rx_desc_chained(DmaDesc *desc)
|
/* Checks whether this rx descriptor is in chain mode. This returns true if it is this descriptor is in chain mode. */
bool synopGMAC_is_rx_desc_chained(DmaDesc *desc)
|
{
return ((desc -> length & RxDescChain) == RxDescChain);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Driver done interrupt service routine for channel 5. We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC */
|
void XDmaPs_DoneISR_5(XDmaPs *InstPtr)
|
/* Driver done interrupt service routine for channel 5. We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC */
void XDmaPs_DoneISR_5(XDmaPs *InstPtr)
|
{
XDmaPs_DoneISR_n(InstPtr, 5);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Initialize in place a remote heap info block. This is needed to support operation very early in the startup of the kernel, when it is not yet safe to call kmalloc. */
|
void rh_init(rh_info_t *info, unsigned int alignment, int max_blocks, rh_block_t *block)
|
/* Initialize in place a remote heap info block. This is needed to support operation very early in the startup of the kernel, when it is not yet safe to call kmalloc. */
void rh_init(rh_info_t *info, unsigned int alignment, int max_blocks, rh_block_t *block)
|
{
int i;
rh_block_t *blk;
if ((alignment & (alignment - 1)) != 0)
return;
info->alignment = alignment;
info->block = block;
info->max_blocks = max_blocks;
info->empty_slots = max_blocks;
info->flags = RHIF_STATIC_INFO | RHIF_STATIC_BLOCK;
INIT_LIST_HEAD(&info->empty_list);
INIT_LIST_HEAD(&info->free_list);
INIT_LIST_HEAD(&info->taken_list);
for (i = 0, blk = block; i < max_blocks; i++, blk++)
list_add(&blk->list, &info->empty_list);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group. */
|
unsigned long ext3_bg_num_gdb(struct super_block *sb, int group)
|
/* Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group. */
unsigned long ext3_bg_num_gdb(struct super_block *sb, int group)
|
{
unsigned long first_meta_bg =
le32_to_cpu(EXT3_SB(sb)->s_es->s_first_meta_bg);
unsigned long metagroup = group / EXT3_DESC_PER_BLOCK(sb);
if (!EXT3_HAS_INCOMPAT_FEATURE(sb,EXT3_FEATURE_INCOMPAT_META_BG) ||
metagroup < first_meta_bg)
return ext3_bg_num_gdb_nometa(sb,group);
return ext3_bg_num_gdb_meta(sb,group);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: (element-type GAppInfo) (transfer full): a newly allocated #GList of references to #GAppInfos. */
|
GList* g_app_info_get_all(void)
|
/* Returns: (element-type GAppInfo) (transfer full): a newly allocated #GList of references to #GAppInfos. */
GList* g_app_info_get_all(void)
|
{
GHashTable *apps;
GHashTableIter iter;
gpointer value;
int i;
GList *infos;
apps = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
desktop_file_dirs_lock ();
for (i = 0; i < n_desktop_file_dirs; i++)
desktop_file_dir_get_all (&desktop_file_dirs[i], apps);
desktop_file_dirs_unlock ();
infos = NULL;
g_hash_table_iter_init (&iter, apps);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
if (value)
infos = g_list_prepend (infos, value);
}
g_hash_table_destroy (apps);
return infos;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Removes Protocol from the protocol list (but not the handle list). */
|
PROTOCOL_INTERFACE* SmmRemoveInterfaceFromProtocol(IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
|
/* Removes Protocol from the protocol list (but not the handle list). */
PROTOCOL_INTERFACE* SmmRemoveInterfaceFromProtocol(IN IHANDLE *Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
|
{
PROTOCOL_INTERFACE *Prot;
PROTOCOL_NOTIFY *ProtNotify;
PROTOCOL_ENTRY *ProtEntry;
LIST_ENTRY *Link;
Prot = SmmFindProtocolInterface (Handle, Protocol, Interface);
if (Prot != NULL) {
ProtEntry = Prot->Protocol;
for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {
ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
if (ProtNotify->Position == &Prot->ByProtocol) {
ProtNotify->Position = Prot->ByProtocol.BackLink;
}
}
RemoveEntryList (&Prot->ByProtocol);
}
return Prot;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* For each cpu, unmap pages [@page_start,@page_end) out of @chunk. Corresponding elements in @pages were cleared by the caller and can be used to carry information to pcpu_free_pages() which will be called after all unmaps are finished. The caller should call proper pre/post flush functions. */
|
static void pcpu_unmap_pages(struct pcpu_chunk *chunk, struct page **pages, unsigned long *populated, int page_start, int page_end)
|
/* For each cpu, unmap pages [@page_start,@page_end) out of @chunk. Corresponding elements in @pages were cleared by the caller and can be used to carry information to pcpu_free_pages() which will be called after all unmaps are finished. The caller should call proper pre/post flush functions. */
static void pcpu_unmap_pages(struct pcpu_chunk *chunk, struct page **pages, unsigned long *populated, int page_start, int page_end)
|
{
unsigned int cpu;
int i;
for_each_possible_cpu(cpu) {
for (i = page_start; i < page_end; i++) {
struct page *page;
page = pcpu_chunk_page(chunk, cpu, i);
WARN_ON(!page);
pages[pcpu_page_idx(cpu, i)] = page;
}
__pcpu_unmap_pages(pcpu_chunk_addr(chunk, cpu, page_start),
page_end - page_start);
}
for (i = page_start; i < page_end; i++)
__clear_bit(i, populated);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Yes, this forcably breaks the klist abstraction temporarily. It just wants to sort the klist, not change reference counts and take/drop locks rapidly in the process. It does all this while holding the lock for the list, so objects can't otherwise be added/removed while we're swizzling. */
|
static void device_insertion_sort_klist(struct device *a, struct list_head *list, int(*compare)(const struct device *a, const struct device *b))
|
/* Yes, this forcably breaks the klist abstraction temporarily. It just wants to sort the klist, not change reference counts and take/drop locks rapidly in the process. It does all this while holding the lock for the list, so objects can't otherwise be added/removed while we're swizzling. */
static void device_insertion_sort_klist(struct device *a, struct list_head *list, int(*compare)(const struct device *a, const struct device *b))
|
{
struct list_head *pos;
struct klist_node *n;
struct device_private *dev_prv;
struct device *b;
list_for_each(pos, list) {
n = container_of(pos, struct klist_node, n_node);
dev_prv = to_device_private_bus(n);
b = dev_prv->device;
if (compare(a, b) <= 0) {
list_move_tail(&a->p->knode_bus.n_node,
&b->p->knode_bus.n_node);
return;
}
}
list_move_tail(&a->p->knode_bus.n_node, list);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* SATA interface between low level driver and command layer */
|
ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer)
|
/* SATA interface between low level driver and command layer */
ulong sata_read(int dev, ulong blknr, lbaint_t blkcnt, void *buffer)
|
{
struct ahci_uc_priv *uc_priv = sata_dev_desc[dev].priv;
return sata_read_common(uc_priv, &sata_dev_desc[dev], blknr, blkcnt,
buffer);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This is done in say, try_explicit_dissector for example. */
|
static void add_sub_handle_repoid_to_comp_req_list(guint32 fn, giop_sub_handle_t *sh, gchar *repoid)
|
/* This is done in say, try_explicit_dissector for example. */
static void add_sub_handle_repoid_to_comp_req_list(guint32 fn, giop_sub_handle_t *sh, gchar *repoid)
|
{
entry->subh = sh;
entry->repoid = g_strdup(repoid);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* The following *_index functions are used to define the val_to_name and val_to_struct arrays in a policy database structure. The val_to_name arrays are used when converting security context structures into string representations. The val_to_struct arrays are used when the attributes of a class, role, or user are needed. */
|
static int common_index(void *key, void *datum, void *datap)
|
/* The following *_index functions are used to define the val_to_name and val_to_struct arrays in a policy database structure. The val_to_name arrays are used when converting security context structures into string representations. The val_to_struct arrays are used when the attributes of a class, role, or user are needed. */
static int common_index(void *key, void *datum, void *datap)
|
{
struct policydb *p;
struct common_datum *comdatum;
comdatum = datum;
p = datap;
if (!comdatum->value || comdatum->value > p->p_commons.nprim)
return -EINVAL;
p->p_common_val_to_name[comdatum->value - 1] = key;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Add DAMA slave timeout timer to timer list. Unlike the connection based timers the timeout function gets triggered every second. Please note that NET_AX25_DAMA_SLAVE_TIMEOUT (aka /proc/sys/net/ax25/{dev}/dama_slave_timeout) is still in 1/10th of a second. */
|
void ax25_ds_setup_timer(ax25_dev *ax25_dev)
|
/* Add DAMA slave timeout timer to timer list. Unlike the connection based timers the timeout function gets triggered every second. Please note that NET_AX25_DAMA_SLAVE_TIMEOUT (aka /proc/sys/net/ax25/{dev}/dama_slave_timeout) is still in 1/10th of a second. */
void ax25_ds_setup_timer(ax25_dev *ax25_dev)
|
{
setup_timer(&ax25_dev->dama.slave_timer, ax25_ds_timeout,
(unsigned long)ax25_dev);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* generate the pause frame, ENET will send pause frame after enable transmit flow control this function only use in full-dulex mode */
|
ErrStatus enet_pauseframe_generate(void)
|
/* generate the pause frame, ENET will send pause frame after enable transmit flow control this function only use in full-dulex mode */
ErrStatus enet_pauseframe_generate(void)
|
{
ErrStatus enet_state = ERROR;
uint32_t temp = 0U;
temp = ENET_MAC_FCTL & ENET_MAC_FCTL_FLCBBKPA;
if(RESET == temp) {
ENET_MAC_FCTL |= ENET_MAC_FCTL_FLCBBKPA;
enet_state = SUCCESS;
}
return enet_state;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Purpose: The interrupt routine for the ST-DMA. It calls the isr registered by stdma_lock(). */
|
static irqreturn_t stdma_int(int irq, void *dummy)
|
/* Purpose: The interrupt routine for the ST-DMA. It calls the isr registered by stdma_lock(). */
static irqreturn_t stdma_int(int irq, void *dummy)
|
{
if (stdma_isr)
(*stdma_isr)(irq, stdma_isr_data);
return IRQ_HANDLED;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Write a byte (8 bits) to a memory location. */
|
void mpc824x_mpc107_write8(unsigned int addr, unsigned char data)
|
/* Write a byte (8 bits) to a memory location. */
void mpc824x_mpc107_write8(unsigned int addr, unsigned char data)
|
{
*(unsigned char *) addr = data;
__asm__ ("sync");
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Set the TSC peripheral registers to their default reset values. */
|
void TSC_Reset(void)
|
/* Set the TSC peripheral registers to their default reset values. */
void TSC_Reset(void)
|
{
RCM_EnableAHBPeriphReset(RCM_AHB_PERIPH_TSC);
RCM_DisableAHBPeriphReset(RCM_AHB_PERIPH_TSC);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* 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 GPIOPinTypeGPIOInput(uint32_t ui32Port, uint8_t ui8Pins)
|
/* 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 GPIOPinTypeGPIOInput(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* To disable the receive interrupt watchdog function, set */
|
void EMACRxWatchdogTimerSet(uint32_t ui32Base, uint8_t ui8Timeout)
|
/* To disable the receive interrupt watchdog function, set */
void EMACRxWatchdogTimerSet(uint32_t ui32Base, uint8_t ui8Timeout)
|
{
HWREG(ui32Base + EMAC_O_RXINTWDT) = (uint32_t)ui8Timeout;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns 0 on success or -1 if the room in the socket buffer was not sufficient. */
|
int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock, struct gnet_dump *d)
|
/* Returns 0 on success or -1 if the room in the socket buffer was not sufficient. */
int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock, struct gnet_dump *d)
|
{
return gnet_stats_start_copy_compat(skb, type, 0, 0, lock, d);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* s2io_ethtol_gset - Return link specific information. @sp : private member of the device structure, pointer to the s2io_nic structure. @info : pointer to the structure with parameters given by ethtool to return link information. Description: Returns link specific information like speed, duplex etc.. to ethtool. Return value : return 0 on success. */
|
static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
|
/* s2io_ethtol_gset - Return link specific information. @sp : private member of the device structure, pointer to the s2io_nic structure. @info : pointer to the structure with parameters given by ethtool to return link information. Description: Returns link specific information like speed, duplex etc.. to ethtool. Return value : return 0 on success. */
static int s2io_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
|
{
struct s2io_nic *sp = netdev_priv(dev);
info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
info->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
info->port = PORT_FIBRE;
info->transceiver = XCVR_EXTERNAL;
if (netif_carrier_ok(sp->dev)) {
info->speed = 10000;
info->duplex = DUPLEX_FULL;
} else {
info->speed = -1;
info->duplex = -1;
}
info->autoneg = AUTONEG_DISABLE;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts a text device path node to USB smart card device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbSmartCard(CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to USB smart card device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbSmartCard(CHAR16 *TextDeviceNode)
|
{
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_SMART_CARD;
UsbClassText.SubClassExist = TRUE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enable the AF for the selected IO pin(s). */
|
void stmpe811_IO_EnableAF(uint16_t DeviceAddr, uint32_t IO_Pin)
|
/* Enable the AF for the selected IO pin(s). */
void stmpe811_IO_EnableAF(uint16_t DeviceAddr, uint32_t IO_Pin)
|
{
uint8_t tmp = 0;
tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_AF);
tmp &= ~(uint8_t)IO_Pin;
IOE_Write(DeviceAddr, STMPE811_REG_IO_AF, tmp);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Command response callback function for sd_ble_gap_conn_param_update BLE command.
Callback for decoding the command response return code. */
|
static uint32_t gap_conn_param_update_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
/* Command response callback function for sd_ble_gap_conn_param_update BLE command.
Callback for decoding the command response return code. */
static uint32_t gap_conn_param_update_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
{
uint32_t result_code;
const uint32_t err_code = ble_gap_conn_param_update_rsp_dec(p_buffer, length, &result_code);
APP_ERROR_CHECK(err_code);
return result_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* return kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect */
|
status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
|
/* return kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect */
status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
|
{
assert(datetime != NULL);
uint32_t seconds = 0U;
uint32_t tmp = base->HPCR;
SNVS_HP_RTC_StopTimer(base);
if (!(SNVS_HP_CheckDatetimeFormat(datetime)))
{
return kStatus_InvalidArgument;
}
seconds = SNVS_HP_ConvertDatetimeToSeconds(datetime);
base->HPRTCMR = (uint32_t)(seconds >> 17U);
base->HPRTCLR = (uint32_t)(seconds << 15U);
if ((tmp & SNVS_HPCR_RTC_EN_MASK) != 0U)
{
SNVS_HP_RTC_StartTimer(base);
}
return kStatus_Success;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* adds a VLAN to a port's VLAN membership table */
|
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID)
|
/* adds a VLAN to a port's VLAN membership table */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID)
|
{
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
IX_ETH_DB_CHECK_VLAN_ID(vlanID);
IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* smc911x_init - get the MAC/EEPROM up and ready for use */
|
static int smc911x_init(struct eth_device *dev)
|
/* smc911x_init - get the MAC/EEPROM up and ready for use */
static int smc911x_init(struct eth_device *dev)
|
{
if (smc911x_detect_chip(dev))
return 1;
smc911x_reset(dev);
if (smc911x_reg_read(dev, GPIO_CFG) & GPIO_CFG_EEPR_EN) {
while (smc911x_reg_read(dev, E2P_CMD) & E2P_CMD_EPC_BUSY)
if (smsc_ctrlc()) {
printf("init: timeout (E2P_CMD = 0x%08x)\n",
smc911x_reg_read(dev, E2P_CMD));
return 1;
}
smc911x_reg_write(dev, GPIO_CFG,
smc911x_reg_read(dev, GPIO_CFG) & ~GPIO_CFG_EEPR_EN);
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* How many 1 bits are there in the Uint32. Low performance, do not call often. */
|
static int number_of_bits_set(Uint32 a)
|
/* How many 1 bits are there in the Uint32. Low performance, do not call often. */
static int number_of_bits_set(Uint32 a)
|
{
if(!a) return 0;
if(a & 1) return 1 + number_of_bits_set(a >> 1);
return(number_of_bits_set(a >> 1));
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Calculate wrap around when reading beyond the end of the RX buffer */
|
static u16 rx_packet_start(u16 ptr)
|
/* Calculate wrap around when reading beyond the end of the RX buffer */
static u16 rx_packet_start(u16 ptr)
|
{
if (ptr + RSV_SIZE > RXEND_INIT)
return (ptr + RSV_SIZE) - (RXEND_INIT - RXSTART_INIT + 1);
else
return ptr + RSV_SIZE;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Write corresponds to send data from device to memory */
|
int XAxiVdma_StartWriteFrame(XAxiVdma *InstancePtr, XAxiVdma_DmaSetup *DmaConfigPtr)
|
/* Write corresponds to send data from device to memory */
int XAxiVdma_StartWriteFrame(XAxiVdma *InstancePtr, XAxiVdma_DmaSetup *DmaConfigPtr)
|
{
XAxiVdma_Channel *Channel;
Channel = XAxiVdma_GetChannel(InstancePtr, XAXIVDMA_WRITE);
if (Channel->IsValid) {
return XAxiVdma_ChannelStartTransfer(Channel,
(XAxiVdma_ChannelSetup *)DmaConfigPtr);
}
else {
return XST_DEVICE_NOT_FOUND;
}
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Indicates error in rx frame length. Retruns true if received frame length doesnot match with the length field */
|
bool synopGMAC_is_rx_frame_length_errors(u32 status)
|
/* Indicates error in rx frame length. Retruns true if received frame length doesnot match with the length field */
bool synopGMAC_is_rx_frame_length_errors(u32 status)
|
{
return ((status & DescRxLengthError) == DescRxLengthError);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* phy_stop - Bring down the PHY link, and stop checking the status @phydev: target phy_device struct */
|
void phy_stop(struct phy_device *phydev)
|
/* phy_stop - Bring down the PHY link, and stop checking the status @phydev: target phy_device struct */
void phy_stop(struct phy_device *phydev)
|
{
mutex_lock(&phydev->lock);
if (PHY_HALTED == phydev->state)
goto out_unlock;
if (phydev->irq != PHY_POLL) {
phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
phy_clear_interrupt(phydev);
}
phydev->state = PHY_HALTED;
out_unlock:
mutex_unlock(&phydev->lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* BusLogic_WriteOutgoingMailbox places CCB and Action Code into an Outgoing Mailbox for execution by Host Adapter. The Host Adapter's Lock should already have been acquired by the caller. */
|
static bool BusLogic_WriteOutgoingMailbox(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_ActionCode ActionCode, struct BusLogic_CCB *CCB)
|
/* BusLogic_WriteOutgoingMailbox places CCB and Action Code into an Outgoing Mailbox for execution by Host Adapter. The Host Adapter's Lock should already have been acquired by the caller. */
static bool BusLogic_WriteOutgoingMailbox(struct BusLogic_HostAdapter *HostAdapter, enum BusLogic_ActionCode ActionCode, struct BusLogic_CCB *CCB)
|
{
struct BusLogic_OutgoingMailbox *NextOutgoingMailbox;
NextOutgoingMailbox = HostAdapter->NextOutgoingMailbox;
if (NextOutgoingMailbox->ActionCode == BusLogic_OutgoingMailboxFree) {
CCB->Status = BusLogic_CCB_Active;
NextOutgoingMailbox->CCB = CCB->DMA_Handle;
NextOutgoingMailbox->ActionCode = ActionCode;
BusLogic_StartMailboxCommand(HostAdapter);
if (++NextOutgoingMailbox > HostAdapter->LastOutgoingMailbox)
NextOutgoingMailbox = HostAdapter->FirstOutgoingMailbox;
HostAdapter->NextOutgoingMailbox = NextOutgoingMailbox;
if (ActionCode == BusLogic_MailboxStartCommand) {
HostAdapter->ActiveCommands[CCB->TargetID]++;
if (CCB->Opcode != BusLogic_BusDeviceReset)
HostAdapter->TargetStatistics[CCB->TargetID].CommandsAttempted++;
}
return true;
}
return false;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* simple commit_write call, set_range_dirty is used to mark both the pages and the extent records as dirty */
|
int extent_commit_write(struct extent_io_tree *tree, struct inode *inode, struct page *page, unsigned from, unsigned to)
|
/* simple commit_write call, set_range_dirty is used to mark both the pages and the extent records as dirty */
int extent_commit_write(struct extent_io_tree *tree, struct inode *inode, struct page *page, unsigned from, unsigned to)
|
{
loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
set_page_extent_mapped(page);
set_page_dirty(page);
if (pos > inode->i_size) {
i_size_write(inode, pos);
mark_inode_dirty(inode);
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* __vxge_hw_verify_pci_e_info - Validate the pci-e link parameters such as link width and signalling rate. */
|
static enum vxge_hw_status __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev)
|
/* __vxge_hw_verify_pci_e_info - Validate the pci-e link parameters such as link width and signalling rate. */
static enum vxge_hw_status __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev)
|
{
int exp_cap;
u16 lnk;
exp_cap = pci_find_capability(hldev->pdev, PCI_CAP_ID_EXP);
pci_read_config_word(hldev->pdev, exp_cap + PCI_EXP_LNKSTA, &lnk);
if ((lnk & PCI_EXP_LNKSTA_CLS) != 1)
return VXGE_HW_ERR_INVALID_PCI_INFO;
switch ((lnk & PCI_EXP_LNKSTA_NLW) >> 4) {
case PCIE_LNK_WIDTH_RESRV:
case PCIE_LNK_X1:
case PCIE_LNK_X2:
case PCIE_LNK_X4:
case PCIE_LNK_X8:
break;
default:
return VXGE_HW_ERR_INVALID_PCI_INFO;
}
return VXGE_HW_OK;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* enable or disable the monitor function in Low Power Rx Path. */
|
void USI_UARTLPRxMonitorCmd(USI_TypeDef *USIx, u32 NewState)
|
/* enable or disable the monitor function in Low Power Rx Path. */
void USI_UARTLPRxMonitorCmd(USI_TypeDef *USIx, u32 NewState)
|
{
assert_param(IS_ALL_USI_LP_PERIPH(USIx));
if(NewState != DISABLE ){
USIx->UART_BAUD_MON_CTRL |= USI_UART_LP_RX_MON_ENABLE;
} else {
USIx->UART_BAUD_MON_CTRL &= (~ USI_UART_LP_RX_MON_ENABLE);
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Error alert box, taking a format and a list of arguments. */
|
void simple_error_message_box(const char *msg_format,...)
|
/* Error alert box, taking a format and a list of arguments. */
void simple_error_message_box(const char *msg_format,...)
|
{
va_list ap;
va_start(ap, msg_format);
do_simple_message_box(ESD_TYPE_ERROR, NULL, NULL, msg_format, ap);
va_end(ap);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Private function to read luminosity on both channels. */
|
err_t tsl2561GetData(uint16_t *broadband, uint16_t *ir)
|
/* Private function to read luminosity on both channels. */
err_t tsl2561GetData(uint16_t *broadband, uint16_t *ir)
|
{
ASSERT_STATUS(tsl2561Enable());
switch (_tsl2561IntegrationTime)
{
case TSL2561_INTEGRATIONTIME_13MS:
delay(14);
break;
case TSL2561_INTEGRATIONTIME_101MS:
delay(102);
break;
default:
delay(403);
break;
}
ASSERT_STATUS(tsl2561Read16(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN0_LOW, broadband));
ASSERT_STATUS(tsl2561Read16(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN1_LOW, ir));
ASSERT_STATUS(tsl2561Disable());
return ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Using different timers for retransmit, delayed acks and probes We may wish use just one timer maintaining a list of expire jiffies to optimize. */
|
void inet_csk_init_xmit_timers(struct sock *sk, void(*retransmit_handler)(unsigned long), void(*delack_handler)(unsigned long), void(*keepalive_handler)(unsigned long))
|
/* Using different timers for retransmit, delayed acks and probes We may wish use just one timer maintaining a list of expire jiffies to optimize. */
void inet_csk_init_xmit_timers(struct sock *sk, void(*retransmit_handler)(unsigned long), void(*delack_handler)(unsigned long), void(*keepalive_handler)(unsigned long))
|
{
struct inet_connection_sock *icsk = inet_csk(sk);
setup_timer(&icsk->icsk_retransmit_timer, retransmit_handler,
(unsigned long)sk);
setup_timer(&icsk->icsk_delack_timer, delack_handler,
(unsigned long)sk);
setup_timer(&sk->sk_timer, keepalive_handler, (unsigned long)sk);
icsk->icsk_pending = icsk->icsk_ack.pending = 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* get the clock stabilization and periphral reset flags */
|
FlagStatus rcu_flag_get(rcu_flag_enum flag)
|
/* get the clock stabilization and periphral reset flags */
FlagStatus rcu_flag_get(rcu_flag_enum flag)
|
{
if(RESET != (RCU_REG_VAL(flag) & BIT(RCU_BIT_POS(flag)))) {
return SET;
} else {
return RESET;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This comment was here before, but I do not know what it means :( -RB id: 0 = cpu revision, 1 = boot-rom-version */
|
int pdc_model_versions(unsigned long *versions, int id)
|
/* This comment was here before, but I do not know what it means :( -RB id: 0 = cpu revision, 1 = boot-rom-version */
int pdc_model_versions(unsigned long *versions, int id)
|
{
int retval;
unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_VERSIONS, __pa(pdc_result), id);
convert_to_wide(pdc_result);
*versions = pdc_result[0];
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* DViCO has shipped two devices with the same USB ID, but only one of them needs a firmware download. Check the device class details to see if they have non-default values to decide whether the device is actually cold or not, and forget a match if it turns out we selected the wrong device. */
|
static int bluebird_fx2_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, int *cold)
|
/* DViCO has shipped two devices with the same USB ID, but only one of them needs a firmware download. Check the device class details to see if they have non-default values to decide whether the device is actually cold or not, and forget a match if it turns out we selected the wrong device. */
static int bluebird_fx2_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, int *cold)
|
{
int wascold = *cold;
*cold = udev->descriptor.bDeviceClass == 0xff &&
udev->descriptor.bDeviceSubClass == 0xff &&
udev->descriptor.bDeviceProtocol == 0xff;
if (*cold && !wascold)
*desc = NULL;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called upon match with an escc node in the devive-tree. */
|
static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
|
/* Called upon match with an escc node in the devive-tree. */
static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
|
{
int i;
for (i = 0; i < MAX_ZS_PORTS; i++)
if (pmz_ports[i].node == mdev->ofdev.node) {
struct uart_pmac_port *uap = &pmz_ports[i];
uap->dev = mdev;
dev_set_drvdata(&mdev->ofdev.dev, uap);
if (macio_request_resources(uap->dev, "pmac_zilog"))
printk(KERN_WARNING "%s: Failed to request resource"
", port still active\n",
uap->node->name);
else
uap->flags |= PMACZILOG_FLAG_RSRC_REQUESTED; return 0;
}
return -ENODEV;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Serializes the supplied unsubscribe data into the supplied buffer, ready for sending */
|
int MQTTSerialize_unsubscribe(unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid, int count, MQTTString topicFilters[])
|
/* Serializes the supplied unsubscribe data into the supplied buffer, ready for sending */
int MQTTSerialize_unsubscribe(unsigned char *buf, int buflen, unsigned char dup, unsigned short packetid, int count, MQTTString topicFilters[])
|
{
unsigned char* ptr = buf;
MQTTHeader header = {0};
int rem_len = 0;
int rc = -1;
int i = 0;
FUNC_ENTRY;
if (MQTTPacket_len(rem_len = MQTTSerialize_unsubscribeLength(
count, topicFilters)) > buflen) {
rc = MQTTPACKET_BUFFER_TOO_SHORT;
goto exit;
}
header.byte = 0;
header.bits.type = UNSUBSCRIBE;
header.bits.dup = dup;
header.bits.qos = 1;
writeChar(&ptr, header.byte);
ptr += MQTTPacket_encode(ptr, rem_len);
;
writeInt(&ptr, packetid);
for (i = 0; i < count; ++i)
writeMQTTString(&ptr, topicFilters[i]);
rc = ptr - buf;
exit:
FUNC_EXIT_RC(rc);
return rc;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData)
|
{
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT32)-1;
}
return MmioOr32 (GetPciExpressAddress (Address), OrData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.6 and SD Host Controller Simplified Spec 3.0 section Figure 3-3 for details. */
|
EFI_STATUS EmmcPeimSwitchClockFreq(IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN UINT8 HsTiming, IN UINT32 ClockFreq)
|
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.6 and SD Host Controller Simplified Spec 3.0 section Figure 3-3 for details. */
EFI_STATUS EmmcPeimSwitchClockFreq(IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, IN UINT8 HsTiming, IN UINT32 ClockFreq)
|
{
EFI_STATUS Status;
UINT8 Access;
UINT8 Index;
UINT8 Value;
UINT8 CmdSet;
UINT32 DevStatus;
Access = 0x03;
Index = OFFSET_OF (EMMC_EXT_CSD, HsTiming);
Value = HsTiming;
CmdSet = 0;
Status = EmmcPeimSwitch (Slot, Access, Index, Value, CmdSet);
if (EFI_ERROR (Status)) {
return Status;
}
Status = EmmcPeimSendStatus (Slot, Rca, &DevStatus);
if (EFI_ERROR (Status)) {
return Status;
}
if ((DevStatus & BIT7) != 0) {
return EFI_DEVICE_ERROR;
}
Status = EmmcPeimHcClockSupply (Slot->EmmcHcBase, ClockFreq * 1000);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This initialization function contains common functionality shared betwen all library instance constructors. */
|
VOID CpuFeaturesLibInitialization(VOID)
|
/* This initialization function contains common functionality shared betwen all library instance constructors. */
VOID CpuFeaturesLibInitialization(VOID)
|
{
UINT32 LMAValue;
LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA;
mSmmSaveStateRegisterLma = EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT;
if (LMAValue) {
mSmmSaveStateRegisterLma = EFI_SMM_SAVE_STATE_REGISTER_LMA_64BIT;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Called when a group is being torn down to clean up any outstanding event notifications. */
|
void fsnotify_flush_notify(struct fsnotify_group *group)
|
/* Called when a group is being torn down to clean up any outstanding event notifications. */
void fsnotify_flush_notify(struct fsnotify_group *group)
|
{
struct fsnotify_event *event;
struct fsnotify_event_private_data *priv;
mutex_lock(&group->notification_mutex);
while (!fsnotify_notify_queue_is_empty(group)) {
event = fsnotify_remove_notify_event(group);
if (group->ops->free_event_priv) {
spin_lock(&event->lock);
priv = fsnotify_remove_priv_from_event(group, event);
spin_unlock(&event->lock);
if (priv)
group->ops->free_event_priv(priv);
}
fsnotify_put_event(event);
}
mutex_unlock(&group->notification_mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialise the string table and allocate memory for the string elements. */
|
EFI_STATUS EFIAPI StringTableInitialize(IN STRING_TABLE *CONST StrTable, IN UINTN MaxStringElements)
|
/* Initialise the string table and allocate memory for the string elements. */
EFI_STATUS EFIAPI StringTableInitialize(IN STRING_TABLE *CONST StrTable, IN UINTN MaxStringElements)
|
{
STRING_ELEMENT *Elements;
if ((StrTable == NULL) || (MaxStringElements > MAX_UINT8)) {
return EFI_INVALID_PARAMETER;
}
ZeroMem (StrTable, sizeof (STRING_TABLE));
Elements = (STRING_ELEMENT *)AllocateZeroPool (
sizeof (STRING_ELEMENT) * MaxStringElements
);
if (Elements == NULL) {
return EFI_OUT_OF_RESOURCES;
}
StrTable->Elements = Elements;
StrTable->MaxStringElements = (UINT8)MaxStringElements;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configures system clock after wake-up from STOP: enable HSE, PLL and select PLL as system clock source. */
|
static void SYSCLKConfig_STOP(void)
|
/* Configures system clock after wake-up from STOP: enable HSE, PLL and select PLL as system clock source. */
static void SYSCLKConfig_STOP(void)
|
{
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
uint32_t pFLatency = 0;
HAL_RCC_GetOscConfig(&RCC_OscInitStruct);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &pFLatency);
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, pFLatency) != HAL_OK)
{
Error_Handler();
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Note ntohs() and ntohl() are merely references to the htonx counterparts. Convert an u16_t from host- to network byte order. */
|
u16_t lwip_htons(u16_t n)
|
/* Note ntohs() and ntohl() are merely references to the htonx counterparts. Convert an u16_t from host- to network byte order. */
u16_t lwip_htons(u16_t n)
|
{
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* For example, lets say that @old has bits 4 through 7 set, and @new has bits 12 through 15 set. This defines the mapping of bit position 4 to 12, 5 to 13, 6 to 14 and 7 to 15, and of all other bit positions unchanged. So if say @oldbit is 5, then this routine returns 13. */
|
int bitmap_bitremap(int oldbit, const unsigned long *old, const unsigned long *new, int bits)
|
/* For example, lets say that @old has bits 4 through 7 set, and @new has bits 12 through 15 set. This defines the mapping of bit position 4 to 12, 5 to 13, 6 to 14 and 7 to 15, and of all other bit positions unchanged. So if say @oldbit is 5, then this routine returns 13. */
int bitmap_bitremap(int oldbit, const unsigned long *old, const unsigned long *new, int bits)
|
{
int w = bitmap_weight(new, bits);
int n = bitmap_pos_to_ord(old, oldbit, bits);
if (n < 0 || w == 0)
return oldbit;
else
return bitmap_ord_to_pos(new, n % w, bits);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The clock_cpu_microsecond() fucntion shall return the microsecond according to cpu_tick parameter. */
|
uint64_t clock_cpu_microsecond(uint64_t cpu_tick)
|
/* The clock_cpu_microsecond() fucntion shall return the microsecond according to cpu_tick parameter. */
uint64_t clock_cpu_microsecond(uint64_t cpu_tick)
|
{
uint64_t unit = clock_cpu_getres();
return (uint64_t)(((cpu_tick * unit) / (1000UL * 1000)) / 1000);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Reset control endpoint management.
Called after a USB line reset or at the end of SETUP request (after ZLP) */
|
static void udd_ctrl_init(void)
|
/* Reset control endpoint management.
Called after a USB line reset or at the end of SETUP request (after ZLP) */
static void udd_ctrl_init(void)
|
{
irqflags_t flags;
flags = cpu_irq_save();
udd_disable_in_send_interrupt(0);
cpu_irq_restore(flags);
udd_ack_out_received(0);
udd_g_ctrlreq.callback = NULL;
udd_g_ctrlreq.over_under_run = NULL;
udd_g_ctrlreq.payload_size = 0;
udd_ep_control_state = UDD_EPCTRL_SETUP;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Note, that this routine does not check for buffer overflow, it's the caller who must assure enough space. */
|
static void memsize_format(char *buf, u32 size)
|
/* Note, that this routine does not check for buffer overflow, it's the caller who must assure enough space. */
static void memsize_format(char *buf, u32 size)
|
{
#define SIZE_GB ((u32)1024*1024*1024)
#define SIZE_MB ((u32)1024*1024)
#define SIZE_KB ((u32)1024)
if ((size % SIZE_GB) == 0)
sprintf(buf, "%ug", size/SIZE_GB);
else if ((size % SIZE_MB) == 0)
sprintf(buf, "%um", size/SIZE_MB);
else if (size % SIZE_KB == 0)
sprintf(buf, "%uk", size/SIZE_KB);
else
sprintf(buf, "%u", size);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Unsigned 64bit divide with 64bit divisor and remainder */
|
uint64_t div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
|
/* Unsigned 64bit divide with 64bit divisor and remainder */
uint64_t div64_u64_rem(uint64_t dividend, uint64_t divisor, uint64_t *remainder)
|
{
*remainder = dividend % divisor;
return dividend / divisor;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Message: StopToneMessage Opcode: 0x0083 Type: MediaControl Direction: pbx2dev VarLength: no */
|
static void handle_StopToneMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: StopToneMessage Opcode: 0x0083 Type: MediaControl Direction: pbx2dev VarLength: no */
static void handle_StopToneMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
guint32 hdr_version = tvb_get_letohl(ptvcursor_tvbuff(cursor), 4);
si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
if (hdr_version >= V11_MSG_TYPE) {
ptvcursor_add(cursor, hf_skinny_tone, 4, ENC_LITTLE_ENDIAN);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* From known use-cases we expect about 10 entries in a receive list to be printed in the proc_fs. So PAGE_SIZE is definitely enough space here. */
|
static void can_print_rcvlist(struct seq_file *m, struct hlist_head *rx_list, struct net_device *dev)
|
/* From known use-cases we expect about 10 entries in a receive list to be printed in the proc_fs. So PAGE_SIZE is definitely enough space here. */
static void can_print_rcvlist(struct seq_file *m, struct hlist_head *rx_list, struct net_device *dev)
|
{
struct receiver *r;
struct hlist_node *n;
rcu_read_lock();
hlist_for_each_entry_rcu(r, n, rx_list, list) {
char *fmt = (r->can_id & CAN_EFF_FLAG)?
" %-5s %08X %08x %08x %08x %8ld %s\n" :
" %-5s %03X %08x %08lx %08lx %8ld %s\n";
seq_printf(m, fmt, DNAME(dev), r->can_id, r->mask,
(unsigned long)r->func, (unsigned long)r->data,
r->matches, r->ident);
}
rcu_read_unlock();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Translates address/size access of a nand_flash_model to block, page and offset values. */
|
uint32_t nand_flash_model_translate_access(const struct nand_flash_model *model, uint32_t address, uint32_t size, uint16_t *block, uint16_t *page, uint16_t *offset)
|
/* Translates address/size access of a nand_flash_model to block, page and offset values. */
uint32_t nand_flash_model_translate_access(const struct nand_flash_model *model, uint32_t address, uint32_t size, uint16_t *block, uint16_t *page, uint16_t *offset)
|
{
if ((address + size) > nand_flash_model_get_device_size_in_bytes(model)) {
return NAND_COMMON_ERROR_OUTOFBOUNDS;
}
uint32_t block_size = nand_flash_model_get_block_size_in_bytes(model);
uint32_t page_size = nand_flash_model_get_page_data_size(model);
uint16_t temp_block = address / block_size;
address -= (temp_block * block_size);
uint16_t temp_page = address / page_size;
address -= (temp_page * page_size);
uint16_t temp_Offset = address;
if (block) {
*block = temp_block;
}
if (page) {
*page = temp_page;
}
if (offset) {
*offset = temp_Offset;
}
return 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* driver_remove_file - remove sysfs file for driver. @drv: driver. @attr: driver attribute descriptor. */
|
void driver_remove_file(struct device_driver *drv, const struct driver_attribute *attr)
|
/* driver_remove_file - remove sysfs file for driver. @drv: driver. @attr: driver attribute descriptor. */
void driver_remove_file(struct device_driver *drv, const struct driver_attribute *attr)
|
{
if (drv)
sysfs_remove_file(&drv->p->kobj, &attr->attr);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Setup the HCI transport, which usually means to reset the Bluetooth IC */
|
int __weak bt_hci_transport_setup(const struct device *dev)
|
/* Setup the HCI transport, which usually means to reset the Bluetooth IC */
int __weak bt_hci_transport_setup(const struct device *dev)
|
{
h4_discard(h4_dev, 32);
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Enables or disables the specified USART peripheral in STOP Mode. */
|
void USART_STOPModeCmd(USART_TypeDef *USARTx, FunctionalState NewState)
|
/* Enables or disables the specified USART peripheral in STOP Mode. */
void USART_STOPModeCmd(USART_TypeDef *USARTx, FunctionalState NewState)
|
{
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR1 |= USART_CR1_UESM;
}
else
{
USARTx->CR1 &= (uint32_t)~((uint32_t)USART_CR1_UESM);
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* This function can be called from a telnet command parser in order to print out a string of text on the connection. The two strings given as arguments to the function will be concatenated, a carrige return and a new line character will be added, and the line is sent. */
|
void telnetd_output(struct telnetd_state *s, char *str1, char *str2)
|
/* This function can be called from a telnet command parser in order to print out a string of text on the connection. The two strings given as arguments to the function will be concatenated, a carrige return and a new line character will be added, and the line is sent. */
void telnetd_output(struct telnetd_state *s, char *str1, char *str2)
|
{
static unsigned len;
char *line;
line = alloc_line();
if(line != NULL) {
len = strlen(str1);
strncpy(line, str1, TELNETD_LINELEN);
if(len < TELNETD_LINELEN) {
strncpy(line + len, str2, TELNETD_LINELEN - len);
}
len = strlen(line);
if(len < TELNETD_LINELEN - 2) {
line[len] = ISO_cr;
line[len+1] = ISO_nl;
line[len+2] = 0;
}
sendline(s, line);
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* This function is executed in case of error occurrence. */
|
static void Error_Handler(void)
|
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
|
{
BSP_LCD_DisplayOn();
BSP_LED_On(LED3);
while(1)
{
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* This routine is called by the kernel to write a series of characters to the tty device. The characters may come from user space or kernel space. This routine will return the number of characters actually accepted for writing. */
|
static int sclp_vt220_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
/* This routine is called by the kernel to write a series of characters to the tty device. The characters may come from user space or kernel space. This routine will return the number of characters actually accepted for writing. */
static int sclp_vt220_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
{
return __sclp_vt220_write(buf, count, 1, 0, 1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function replaces the original CANGetBitTiming() API and performs the same actions. A macro is provided in */
|
void CANBitTimingGet(unsigned long ulBase, tCANBitClkParms *pClkParms)
|
/* This function replaces the original CANGetBitTiming() API and performs the same actions. A macro is provided in */
void CANBitTimingGet(unsigned long ulBase, tCANBitClkParms *pClkParms)
|
{
unsigned int uBitReg;
ASSERT(CANBaseValid(ulBase));
ASSERT(pClkParms != 0);
uBitReg = CANRegRead(ulBase + CAN_O_BIT);
pClkParms->uPhase2Seg =
((uBitReg & CAN_BIT_TSEG2_M) >> CAN_BIT_TSEG2_S) + 1;
pClkParms->uSyncPropPhase1Seg =
((uBitReg & CAN_BIT_TSEG1_M) >> CAN_BIT_TSEG1_S) + 1;
pClkParms->uSJW = ((uBitReg & CAN_BIT_SJW_M) >> CAN_BIT_SJW_S) + 1;
pClkParms->uQuantumPrescaler =
((uBitReg & CAN_BIT_BRP_M) |
((CANRegRead(ulBase + CAN_O_BRPE) & CAN_BRPE_BRPE_M) << 6)) + 1;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* igb_setup_tctl - configure the transmit control registers @adapter: Board private structure */
|
void igb_setup_tctl(struct igb_adapter *adapter)
|
/* igb_setup_tctl - configure the transmit control registers @adapter: Board private structure */
void igb_setup_tctl(struct igb_adapter *adapter)
|
{
struct e1000_hw *hw = &adapter->hw;
u32 tctl;
wr32(E1000_TXDCTL(0), 0);
tctl = rd32(E1000_TCTL);
tctl &= ~E1000_TCTL_CT;
tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC |
(E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT);
igb_config_collision_dist(hw);
tctl |= E1000_TCTL_EN;
wr32(E1000_TCTL, tctl);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fill the LCD buffer with the specified color. */
|
void ili93xx_fill(ili93xx_color_t ul_color)
|
/* Fill the LCD buffer with the specified color. */
void ili93xx_fill(ili93xx_color_t ul_color)
|
{
uint32_t dw;
if (g_uc_device_type == DEVICE_TYPE_ILI9325) {
ili93xx_set_cursor_position(0, 0);
} else if (g_uc_device_type == DEVICE_TYPE_ILI9341) {
ili93xx_set_window(0, 0, g_ul_lcd_x_length, g_ul_lcd_y_length);
}
ili93xx_write_ram_prepare();
for (dw = ILI93XX_LCD_WIDTH * ILI93XX_LCD_HEIGHT; dw > 0; dw--) {
ili93xx_write_ram(ul_color);
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* phy_enable_interrupts - Enable the interrupts from the PHY side @phydev: target phy_device struct */
|
int phy_enable_interrupts(struct phy_device *phydev)
|
/* phy_enable_interrupts - Enable the interrupts from the PHY side @phydev: target phy_device struct */
int phy_enable_interrupts(struct phy_device *phydev)
|
{
int err;
err = phy_clear_interrupt(phydev);
if (err < 0)
return err;
err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Number of unread sensor data(TAG + 6 bytes) stored in FIFO.. */
|
int32_t lsm6dso_fifo_data_level_get(stmdev_ctx_t *ctx, uint16_t *val)
|
/* Number of unread sensor data(TAG + 6 bytes) stored in FIFO.. */
int32_t lsm6dso_fifo_data_level_get(stmdev_ctx_t *ctx, uint16_t *val)
|
{
lsm6dso_fifo_status1_t fifo_status1;
lsm6dso_fifo_status2_t fifo_status2;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_STATUS1,
(uint8_t *)&fifo_status1, 1);
if (ret == 0) {
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_STATUS2,
(uint8_t *)&fifo_status2, 1);
*val = ((uint16_t)fifo_status2.diff_fifo << 8) +
(uint16_t)fifo_status1.diff_fifo;
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Change Logs: Date Author Notes airm2m first version */
|
int w5500_spi_device_init(void)
|
/* Change Logs: Date Author Notes airm2m first version */
int w5500_spi_device_init(void)
|
{
return rt_hw_spi_device_attach(WIZ_SPI_BUS,WIZ_SPI_DEVICE, WIZ_SPI_CS);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* CLI command used to call the CAN receive routine. */
|
int32_t cn0401_can_get_rec(struct cn0401_dev *dev, uint8_t *arg)
|
/* CLI command used to call the CAN receive routine. */
int32_t cn0401_can_get_rec(struct cn0401_dev *dev, uint8_t *arg)
|
{
bool rec;
return cn0401_process_rec_routine(dev, &rec);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Parameters: irq irq number to be disabled (the irq number NOT the vector number) */
|
void disable_irq(int irq)
|
/* Parameters: irq irq number to be disabled (the irq number NOT the vector number) */
void disable_irq(int irq)
|
{
int div;
div = irq/32;
switch (div)
{
case 0x0:
NVICICER0 = 1 << (irq%32);
break;
case 0x1:
NVICICER1 = 1 << (irq%32);
break;
case 0x2:
NVICICER2 = 1 << (irq%32);
break;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Duration to go in sleep mode. 1 LSb = 512 / ODR. */
|
int32_t lsm6dso_act_sleep_dur_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* Duration to go in sleep mode. 1 LSb = 512 / ODR. */
int32_t lsm6dso_act_sleep_dur_set(stmdev_ctx_t *ctx, uint8_t val)
|
{
lsm6dso_wake_up_dur_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t *)®, 1);
if (ret == 0) {
reg.sleep_dur = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t *)®, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Enable the PWM output of the PWM module.
The */
|
void PWMOutputEnable(unsigned long ulBase, unsigned long ulChannel)
|
/* Enable the PWM output of the PWM module.
The */
void PWMOutputEnable(unsigned long ulBase, unsigned long ulChannel)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xHWREG(ulBase + PWM_POE) |= (PWM_POE_PWM0 << (ulChannelTemp));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* To trigger the function that to export the Hii Configuration setting. */
|
VOID EFIAPI OnReadyToBoot(IN EFI_EVENT Event, IN VOID *Context)
|
/* To trigger the function that to export the Hii Configuration setting. */
VOID EFIAPI OnReadyToBoot(IN EFI_EVENT Event, IN VOID *Context)
|
{
HiiGetDatabaseInfo (&mPrivate.HiiDatabase);
HiiGetConfigRespInfo (&mPrivate.HiiDatabase);
gExportAfterReadyToBoot = TRUE;
gBS->CloseEvent (Event);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function initializes clock module used for card clock generation. */
|
static uint32_t smartcard_phy_emvsim_InterfaceClockInit(EMVSIM_Type *base, const smartcard_interface_config_t *config, uint32_t srcClock_Hz)
|
/* This function initializes clock module used for card clock generation. */
static uint32_t smartcard_phy_emvsim_InterfaceClockInit(EMVSIM_Type *base, const smartcard_interface_config_t *config, uint32_t srcClock_Hz)
|
{
assert((NULL != config) && (0u != srcClock_Hz));
uint32_t emvsimClkMhz = 0u;
uint8_t emvsimPRSCValue;
emvsimClkMhz = srcClock_Hz / 1000000u;
emvsimPRSCValue = (uint8_t)((emvsimClkMhz * 1000u) / (config->smartCardClock / 1000u));
base->CLKCFG = (base->CLKCFG & ~EMVSIM_CLKCFG_CLK_PRSC_MASK) | EMVSIM_CLKCFG_CLK_PRSC(emvsimPRSCValue);
return config->smartCardClock;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This set of routines implements the rpc message definition, its serializer and some common rpc utility routines. The routines are meant for various implementations of rpc - they are NOT for the rpc client or rpc service implementations! Because authentication stuff is easy and is part of rpc, the opaque routines are also in this program. XDR an opaque authentication struct (see auth.h) */
|
bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
|
/* This set of routines implements the rpc message definition, its serializer and some common rpc utility routines. The routines are meant for various implementations of rpc - they are NOT for the rpc client or rpc service implementations! Because authentication stuff is easy and is part of rpc, the opaque routines are also in this program. XDR an opaque authentication struct (see auth.h) */
bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
|
{
if (xdr_enum(xdrs, &(ap->oa_flavor)))
return (xdr_bytes(xdrs, &ap->oa_base,
&ap->oa_length, MAX_AUTH_BYTES));
return (FALSE);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Schedules a call to dasd_tasklet over the device tasklet. */
|
void dasd_schedule_device_bh(struct dasd_device *device)
|
/* Schedules a call to dasd_tasklet over the device tasklet. */
void dasd_schedule_device_bh(struct dasd_device *device)
|
{
if (atomic_cmpxchg (&device->tasklet_scheduled, 0, 1) != 0)
return;
dasd_get_device(device);
tasklet_hi_schedule(&device->tasklet);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The function is used to return if the provided JSON value contains a JSON NULL. */
|
BOOLEAN EFIAPI JsonValueIsNull(IN EDKII_JSON_VALUE Json)
|
/* The function is used to return if the provided JSON value contains a JSON NULL. */
BOOLEAN EFIAPI JsonValueIsNull(IN EDKII_JSON_VALUE Json)
|
{
return json_is_null ((json_t *)Json);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Writes the current value of MM3. This function is only available on IA32 and X64. */
|
VOID EFIAPI AsmWriteMm3(IN UINT64 Value)
|
/* Writes the current value of MM3. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm3(IN UINT64 Value)
|
{
__asm__ __volatile__ (
"movq %0, %%mm3"
:
: "m" (Value)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function will run an usb class driver. */
|
rt_err_t rt_usb_class_driver_run(ucd_t drv, void *args)
|
/* This function will run an usb class driver. */
rt_err_t rt_usb_class_driver_run(ucd_t drv, void *args)
|
{
RT_ASSERT(drv != RT_NULL);
if(drv->run != RT_NULL)
drv->run(args);
return RT_EOK;
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* function to decode operator in BGP flow spec NLRI when it address a bitmask values (TCP flags, fragmentation flags,...) */
|
static void decode_bgp_flow_spec_bitmask_operator(proto_tree *tree, tvbuff_t *tvb, gint offset)
|
/* function to decode operator in BGP flow spec NLRI when it address a bitmask values (TCP flags, fragmentation flags,...) */
static void decode_bgp_flow_spec_bitmask_operator(proto_tree *tree, tvbuff_t *tvb, gint offset)
|
{
static const int * flags[] = {
&hf_bgp_flowspec_nlri_op_eol,
&hf_bgp_flowspec_nlri_op_and,
&hf_bgp_flowspec_nlri_op_val_len,
&hf_bgp_flowspec_nlri_op_un_bit4,
&hf_bgp_flowspec_nlri_op_un_bit5,
&hf_bgp_flowspec_nlri_op_flg_not,
&hf_bgp_flowspec_nlri_op_flg_match,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Determines the index into the flashLayout array of the flash sector that the specified address is in. */
|
static blt_int8u FlashGetSectorIdx(blt_addr address)
|
/* Determines the index into the flashLayout array of the flash sector that the specified address is in. */
static blt_int8u FlashGetSectorIdx(blt_addr address)
|
{
blt_int8u result = FLASH_INVALID_SECTOR_IDX;
blt_int8u sectorIdx;
for (sectorIdx = 0; sectorIdx < FLASH_TOTAL_SECTORS; sectorIdx++)
{
CopService();
if ((address >= flashLayout[sectorIdx].sector_start) && \
(address < (flashLayout[sectorIdx].sector_start + \
flashLayout[sectorIdx].sector_size)))
{
result = sectorIdx;
break;
}
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Converts a text device path node to firmware volume device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFv(CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to firmware volume device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFv(CHAR16 *TextDeviceNode)
|
{
CHAR16 *GuidStr;
MEDIA_FW_VOL_DEVICE_PATH *Fv;
GuidStr = GetNextParamStr (&TextDeviceNode);
Fv = (MEDIA_FW_VOL_DEVICE_PATH *) CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PIWG_FW_VOL_DP,
(UINT16) sizeof (MEDIA_FW_VOL_DEVICE_PATH)
);
StrToGuid (GuidStr, &Fv->FvName);
return (EFI_DEVICE_PATH_PROTOCOL *) Fv;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* SYSCTRL CAN Bus&Function Clock Enable and Reset Release. */
|
void LL_SYSCTRL_CAN_ClkEnRstRelease(void)
|
/* SYSCTRL CAN Bus&Function Clock Enable and Reset Release. */
void LL_SYSCTRL_CAN_ClkEnRstRelease(void)
|
{
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_CANBusClk_En(SYSCTRL);
__LL_SYSCTRL_CANFunClk_En(SYSCTRL);
__LL_SYSCTRL_CANSoftRst_Release(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param pfd PFD control name return PFD bypass status. */
|
bool CLOCK_IsSysPll2PfdEnabled(clock_pfd_t pfd)
|
/* param pfd PFD control name return PFD bypass status. */
bool CLOCK_IsSysPll2PfdEnabled(clock_pfd_t pfd)
|
{
return ((ANADIG_PLL->SYS_PLL2_PFD & (uint32_t)ANADIG_PLL_SYS_PLL2_PFD_PFD0_DIV1_CLKGATE_MASK
<< (8UL * (uint8_t)pfd)) == 0U);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Negotiate the maximum turnaround time. This is a type 1 parameter and will be negotiated independently for each station */
|
static int irlap_param_max_turn_time(void *instance, irda_param_t *param, int get)
|
/* Negotiate the maximum turnaround time. This is a type 1 parameter and will be negotiated independently for each station */
static int irlap_param_max_turn_time(void *instance, irda_param_t *param, int get)
|
{
struct irlap_cb *self = (struct irlap_cb *) instance;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == LAP_MAGIC, return -1;);
if (get)
param->pv.i = self->qos_rx.max_turn_time.bits;
else
self->qos_tx.max_turn_time.bits = (__u8) param->pv.i;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Check the parameters passed to thread entry function.
Create an user thread and pass 2 variables and a semaphore to a thread entry function. Check for the correctness of the parameters passed. */
|
ZTEST_USER(threads_lifecycle, test_threads_spawn_params)
|
/* Check the parameters passed to thread entry function.
Create an user thread and pass 2 variables and a semaphore to a thread entry function. Check for the correctness of the parameters passed. */
ZTEST_USER(threads_lifecycle, test_threads_spawn_params)
|
{
k_thread_create(&tdata, tstack, STACK_SIZE, thread_entry_params,
tp1, INT_TO_POINTER(tp2), tp3, 0,
K_USER, K_NO_WAIT);
k_msleep(100);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Get the peripheral clock speed for the Timer at base specified. */
|
uint32_t rcc_get_timer_clk_freq(uint32_t timer __attribute__((unused)))
|
/* Get the peripheral clock speed for the Timer at base specified. */
uint32_t rcc_get_timer_clk_freq(uint32_t timer __attribute__((unused)))
|
{
uint8_t ppre = (RCC_CFGR >> RCC_CFGR_PPRE_SHIFT) & RCC_CFGR_PPRE_MASK;
return (ppre == RCC_CFGR_PPRE_NODIV) ? rcc_apb1_frequency
: 2 * rcc_apb1_frequency;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Enables forwarding of control frames. When set forwards all the control frames (incl. unicast and multicast PAUSE frames). */
|
void synopGMAC_set_pass_control(synopGMACdevice *gmacdev, u32 passcontrol)
|
/* Enables forwarding of control frames. When set forwards all the control frames (incl. unicast and multicast PAUSE frames). */
void synopGMAC_set_pass_control(synopGMACdevice *gmacdev, u32 passcontrol)
|
{
u32 data;
data = synopGMACReadReg(gmacdev->MacBase, GmacFrameFilter);
data &= (~GmacPassControl);
data |= passcontrol;
synopGMACWriteReg(gmacdev->MacBase,GmacFrameFilter,data);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Optimised routine to draw a horizontal line faster than setting individual pixels. */
|
void lcdDrawHLine(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color)
|
/* Optimised routine to draw a horizontal line faster than setting individual pixels. */
void lcdDrawHLine(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color)
|
{
if (x1 < x0)
{
uint16_t x;
x = x1;
x1 = x0;
x0 = x;
}
if(x0 >= hx8347dProperties.width)
{
x0 = hx8347dProperties.width-1;
}
if(x1 >= hx8347dProperties.width)
{
x1 = hx8347dProperties.width-1;
}
if(y >= hx8347dProperties.height)
{
y = hx8347dProperties.height-1;
}
fillRect(x0, y, x1, y, color);
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
|
UINT64 EFIAPI CalculateCheckSum64(IN CONST UINT64 *Buffer, IN UINTN Length)
|
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT64 EFIAPI CalculateCheckSum64(IN CONST UINT64 *Buffer, IN UINTN Length)
|
{
UINT64 CheckSum;
CheckSum = CalculateSum64 (Buffer, Length);
return (UINT64)((UINT64)(-1) - CheckSum + 1);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables Receive Own bit (Only in Half Duplex Mode). When enaled GMAC receives all the packets given by phy while transmitting. */
|
void synopGMAC_rx_own_enable(synopGMACdevice *gmacdev)
|
/* Enables Receive Own bit (Only in Half Duplex Mode). When enaled GMAC receives all the packets given by phy while transmitting. */
void synopGMAC_rx_own_enable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRxOwn);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns zero on no match, or the cipher code on match */
|
u8 ecryptfs_code_for_cipher_string(char *cipher_name, size_t key_bytes)
|
/* Returns zero on no match, or the cipher code on match */
u8 ecryptfs_code_for_cipher_string(char *cipher_name, size_t key_bytes)
|
{
int i;
u8 code = 0;
struct ecryptfs_cipher_code_str_map_elem *map =
ecryptfs_cipher_code_str_map;
if (strcmp(cipher_name, "aes") == 0) {
switch (key_bytes) {
case 16:
code = RFC2440_CIPHER_AES_128;
break;
case 24:
code = RFC2440_CIPHER_AES_192;
break;
case 32:
code = RFC2440_CIPHER_AES_256;
}
} else {
for (i = 0; i < ARRAY_SIZE(ecryptfs_cipher_code_str_map); i++)
if (strcmp(cipher_name, map[i].cipher_str) == 0) {
code = map[i].cipher_code;
break;
}
}
return code;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function prints a formatted Unicode string to the console output device specified by Console and returns the number of Unicode characters that printed to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console. If Format is NULL, then ASSERT(). If Format is not aligned on a 16-bit boundary, then ASSERT(). */
|
UINTN InternalPrint(IN CONST CHAR16 *Format, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, IN VA_LIST Marker)
|
/* This function prints a formatted Unicode string to the console output device specified by Console and returns the number of Unicode characters that printed to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize, then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console. If Format is NULL, then ASSERT(). If Format is not aligned on a 16-bit boundary, then ASSERT(). */
UINTN InternalPrint(IN CONST CHAR16 *Format, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, IN VA_LIST Marker)
|
{
EFI_STATUS Status;
UINTN Return;
CHAR16 *Buffer;
UINTN BufferSize;
ASSERT (Format != NULL);
ASSERT (((UINTN)Format & BIT0) == 0);
ASSERT (Console != NULL);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
Buffer = (CHAR16 *)AllocatePool (BufferSize);
ASSERT (Buffer != NULL);
Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
if ((Console != NULL) && (Return > 0)) {
Status = Console->OutputString (Console, Buffer);
if (EFI_ERROR (Status)) {
Return = 0;
}
}
FreePool (Buffer);
return Return;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Create a child for a parent. If inherit_children, then the new child will become the new parent of it's parent children */
|
static struct callchain_node* create_child(struct callchain_node *parent, bool inherit_children)
|
/* Create a child for a parent. If inherit_children, then the new child will become the new parent of it's parent children */
static struct callchain_node* create_child(struct callchain_node *parent, bool inherit_children)
|
{
struct callchain_node *new;
new = malloc(sizeof(*new));
if (!new) {
perror("not enough memory to create child for code path tree");
return NULL;
}
new->parent = parent;
INIT_LIST_HEAD(&new->children);
INIT_LIST_HEAD(&new->val);
if (inherit_children) {
struct callchain_node *next;
list_splice(&parent->children, &new->children);
INIT_LIST_HEAD(&parent->children);
chain_for_each_child(next, new)
next->parent = new;
}
list_add_tail(&new->brothers, &parent->children);
return new;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Airpcap wrapper, used to get the fcs presence of an airpcap adapter */
|
gboolean airpcap_if_get_fcs_presence(PAirpcapHandle ah, gboolean *fcs)
|
/* Airpcap wrapper, used to get the fcs presence of an airpcap adapter */
gboolean airpcap_if_get_fcs_presence(PAirpcapHandle ah, gboolean *fcs)
|
{
if (!AirpcapLoaded) return FALSE;
return g_PAirpcapGetFcsPresence(ah,fcs);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Frees all of the nodes in a linked list. */
|
VOID EFIAPI FreeList(IN LIST_ENTRY *ListHead)
|
/* Frees all of the nodes in a linked list. */
VOID EFIAPI FreeList(IN LIST_ENTRY *ListHead)
|
{
LIST_ENTRY *Link;
LIST_ENTRY *NextLink;
PRM_HANDLER_CONTEXT_LIST_ENTRY *ListEntry;
if (ListHead == NULL) {
return;
}
Link = GetFirstNode (&mPrmHandlerList);
while (!IsNull (&mPrmHandlerList, Link)) {
ListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
NextLink = GetNextNode (&mPrmHandlerList, Link);
RemoveEntryList (Link);
FreePool (ListEntry);
Link = NextLink;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* mpc52xx_spi_wq - Workqueue function for polling the state machine */
|
static void mpc52xx_spi_wq(struct work_struct *work)
|
/* mpc52xx_spi_wq - Workqueue function for polling the state machine */
static void mpc52xx_spi_wq(struct work_struct *work)
|
{
struct mpc52xx_spi *ms = container_of(work, struct mpc52xx_spi, work);
unsigned long flags;
spin_lock_irqsave(&ms->lock, flags);
mpc52xx_spi_fsm_process(0, ms);
spin_unlock_irqrestore(&ms->lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.