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
|
|---|---|---|---|---|---|---|---|
/* IDL typedef struct { IDL char user_session_key; IDL } USER_SESSION_KEY; */
|
static int netlogon_dissect_USER_SESSION_KEY(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_)
|
/* IDL typedef struct { IDL char user_session_key; IDL } USER_SESSION_KEY; */
static int netlogon_dissect_USER_SESSION_KEY(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_)
|
{
if(di->conformant_run){
return offset;
}
proto_tree_add_item(tree, hf_netlogon_user_session_key, tvb, offset, 16,
ENC_NA);
offset += 16;
return offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Since each UCS2 character can be represented by 1-3 UTF8 encoded characters, this function is used to retrieve the UTF8 encoding size for a UCS2 character. */
|
UINT8 GetUTF8SizeForUCS2(IN CHAR8 *Utf8Buffer)
|
/* Since each UCS2 character can be represented by 1-3 UTF8 encoded characters, this function is used to retrieve the UTF8 encoding size for a UCS2 character. */
UINT8 GetUTF8SizeForUCS2(IN CHAR8 *Utf8Buffer)
|
{
CHAR8 TempChar;
UINT8 Utf8Size;
ASSERT (Utf8Buffer != NULL);
TempChar = *Utf8Buffer;
if ((TempChar & 0xF0) == 0xF0) {
return 0;
}
Utf8Size = 1;
if ((TempChar & 0x80) == 0x80) {
if ((TempChar & 0xC0) == 0xC0) {
Utf8Size++;
if ((TempChar & 0xE0) == 0xE0) {
Utf8Size++;
}
}
}
return Utf8Size;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function returns %0 on success and a negative error code on failure. */
|
static int make_tree_dirty(struct ubifs_info *c)
|
/* This function returns %0 on success and a negative error code on failure. */
static int make_tree_dirty(struct ubifs_info *c)
|
{
struct ubifs_pnode *pnode;
pnode = pnode_lookup(c, 0);
if (IS_ERR(pnode))
return PTR_ERR(pnode);
while (pnode) {
do_make_pnode_dirty(c, pnode);
pnode = next_pnode_to_dirty(c, pnode);
if (IS_ERR(pnode))
return PTR_ERR(pnode);
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* waits until tx ep is ready. Returns 1 when ep is ready and 0 on error. */
|
static u8 wait_until_txep_ready(struct usb_device *dev, u8 ep)
|
/* waits until tx ep is ready. Returns 1 when ep is ready and 0 on error. */
static u8 wait_until_txep_ready(struct usb_device *dev, u8 ep)
|
{
u16 csr;
int timeout = CONFIG_MUSB_TIMEOUT;
do {
if (check_stall(ep, 1)) {
dev->status = USB_ST_STALLED;
return 0;
}
csr = readw(&musbr->txcsr);
if (csr & MUSB_TXCSR_H_ERROR) {
dev->status = USB_ST_CRC_ERR;
return 0;
}
if (--timeout)
udelay(1);
else {
dev->status = USB_ST_CRC_ERR;
return -1;
}
} while (csr & MUSB_TXCSR_TXPKTRDY);
return 1;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Get the current group. String must be g_free()d after use. */
|
gchar* get_cur_groupname(void)
|
/* Get the current group. String must be g_free()d after use. */
gchar* get_cur_groupname(void)
|
{
groupname = g_strdup(gr->gr_name);
} else {
groupname = g_strdup("UNKNOWN");
}
endgrent();
return groupname;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* The init_mm pagetable is really pinned as soon as its created, but that's before we have page structures to store the bits. So do all the book-keeping now. */
|
static __init int xen_mark_pinned(struct mm_struct *mm, struct page *page, enum pt_level level)
|
/* The init_mm pagetable is really pinned as soon as its created, but that's before we have page structures to store the bits. So do all the book-keeping now. */
static __init int xen_mark_pinned(struct mm_struct *mm, struct page *page, enum pt_level level)
|
{
SetPagePinned(page);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If any reserved bits in Address are set, 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI PciSegmentBitFieldWrite16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
/* If any reserved bits in Address are set, 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciSegmentBitFieldWrite16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
{
return PciSegmentWrite16 (
Address,
BitFieldWrite16 (PciSegmentRead16 (Address), StartBit, EndBit, Value)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the length of data in the internal content */
|
size_t xmlBufLength(const xmlBufPtr buf)
|
/* Returns the length of data in the internal content */
size_t xmlBufLength(const xmlBufPtr buf)
|
{
if ((!buf) || (buf->error))
return 0;
CHECK_COMPAT(buf)
return(buf->use);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Integer modulus; return 'm % n'. (Assume that C '' with negative operands follows C99 behavior. See previous comment about luaV_idiv.) */
|
lua_Integer luaV_mod(lua_State *L, lua_Integer m, lua_Integer n)
|
/* Integer modulus; return 'm % n'. (Assume that C '' with negative operands follows C99 behavior. See previous comment about luaV_idiv.) */
lua_Integer luaV_mod(lua_State *L, lua_Integer m, lua_Integer n)
|
{
if (n == 0)
luaG_runerror(L, "attempt to perform 'n%%0'");
return 0;
}
else {
lua_Integer r = m % n;
if (r != 0 && (r ^ n) < 0)
r += n;
return r;
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Configure the controllers clock system.
| Core | 120 MHz | 4 MHz | | System | 120 MHz | 4 MHz | | Bus | 60 MHz | 4 MHz | | FlexBus | 50 MHz | 800 kHz | | Flash | 25 MHz | 4 MHz | */
|
static void cpu_clock_init(void)
|
/* Configure the controllers clock system.
| Core | 120 MHz | 4 MHz | | System | 120 MHz | 4 MHz | | Bus | 60 MHz | 4 MHz | | FlexBus | 50 MHz | 800 kHz | | Flash | 25 MHz | 4 MHz | */
static void cpu_clock_init(void)
|
{
SIM->CLKDIV1 = (uint32_t)SIM_CLKDIV1_60MHZ;
SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
PORTA->PCR[18] &= ~(PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x07));
kinetis_mcg_set_mode(KINETIS_MCG_PEE);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Returns TRUE if keys are equals, FALSE otherwise */
|
gboolean keys_are_equals(decryption_key_t *k1, decryption_key_t *k2)
|
/* Returns TRUE if keys are equals, FALSE otherwise */
gboolean keys_are_equals(decryption_key_t *k1, decryption_key_t *k2)
|
{
if ((k1==NULL) || (k2==NULL))
return FALSE;
if (g_string_equal(k1->key,k2->key) &&
(k1->bits == k2->bits) &&
(k1->type == k2->type))
{
if ((k1->ssid == NULL) && (k2->ssid == NULL))
return TRUE;
return byte_array_equal(k1->ssid,k2->ssid);
}
return FALSE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initialize the ft3x67 communication bus from MCU to FT3X67 : ie I2C channel initialization (if required). */
|
void ft3x67_Init(uint16_t DeviceAddr)
|
/* Initialize the ft3x67 communication bus from MCU to FT3X67 : ie I2C channel initialization (if required). */
void ft3x67_Init(uint16_t DeviceAddr)
|
{
ft3x67_I2C_InitializeIfRequired();
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* @ioc: Pointer to MPT_ADAPTER structure @i: index into the array @scmd: scsi_cmnd pointer */
|
static void mptscsih_set_scsi_lookup(MPT_ADAPTER *ioc, int i, struct scsi_cmnd *scmd)
|
/* @ioc: Pointer to MPT_ADAPTER structure @i: index into the array @scmd: scsi_cmnd pointer */
static void mptscsih_set_scsi_lookup(MPT_ADAPTER *ioc, int i, struct scsi_cmnd *scmd)
|
{
unsigned long flags;
spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
ioc->ScsiLookup[i] = scmd;
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return the n'th node of level l from table t. */
|
static sector_t* get_node(struct dm_table *t, unsigned int l, unsigned int n)
|
/* Return the n'th node of level l from table t. */
static sector_t* get_node(struct dm_table *t, unsigned int l, unsigned int n)
|
{
return t->index[l] + (n * KEYS_PER_NODE);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Writes the current value of MM0. This function is only available on IA32 and x64. */
|
VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
|
/* Writes the current value of MM0. This function is only available on IA32 and x64. */
VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
|
{
_asm {
movq mm0, qword ptr [Value]
emms
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The SetVirtualAddressMap() function is used by the OS loader. The function can only be called at runtime, and is called by the owner of the system's memory map. I.e., the component which called ExitBootServices(). All events of type EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE must be signaled before SetVirtualAddressMap() returns. */
|
EFI_STATUS EFIAPI EfiSetVirtualAddressMap(IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap)
|
/* The SetVirtualAddressMap() function is used by the OS loader. The function can only be called at runtime, and is called by the owner of the system's memory map. I.e., the component which called ExitBootServices(). All events of type EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE must be signaled before SetVirtualAddressMap() returns. */
EFI_STATUS EFIAPI EfiSetVirtualAddressMap(IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap)
|
{
return mInternalRT->SetVirtualAddressMap (
MemoryMapSize,
DescriptorSize,
DescriptorVersion,
(EFI_MEMORY_DESCRIPTOR *)VirtualMap
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* asymmetric_key_hex_to_key_id - Convert a hex string into a key ID. @id: The ID as a hex string. */
|
struct asymmetric_key_id* asymmetric_key_hex_to_key_id(const char *id)
|
/* asymmetric_key_hex_to_key_id - Convert a hex string into a key ID. @id: The ID as a hex string. */
struct asymmetric_key_id* asymmetric_key_hex_to_key_id(const char *id)
|
{
struct asymmetric_key_id *match_id;
size_t asciihexlen;
int ret;
if (!*id)
return ERR_PTR(-EINVAL);
asciihexlen = strlen(id);
if (asciihexlen & 1)
return ERR_PTR(-EINVAL);
match_id = kmalloc(sizeof(struct asymmetric_key_id) + asciihexlen / 2,
GFP_KERNEL);
if (!match_id)
return ERR_PTR(-ENOMEM);
ret = __asymmetric_key_hex_to_key_id(id, match_id, asciihexlen / 2);
if (ret < 0) {
kfree(match_id);
return ERR_PTR(-EINVAL);
}
return match_id;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns a pointer to the phy_device if successfull. NULL otherwise */
|
struct phy_device* of_phy_connect(struct net_device *dev, struct device_node *phy_np, void(*hndlr)(struct net_device *), u32 flags, phy_interface_t iface)
|
/* Returns a pointer to the phy_device if successfull. NULL otherwise */
struct phy_device* of_phy_connect(struct net_device *dev, struct device_node *phy_np, void(*hndlr)(struct net_device *), u32 flags, phy_interface_t iface)
|
{
struct phy_device *phy = of_phy_find_device(phy_np);
if (!phy)
return NULL;
return phy_connect_direct(dev, phy, hndlr, flags, iface) ? NULL : phy;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Do inverse transform on 4x8 parts of block */
|
static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
|
/* Do inverse transform on 4x8 parts of block */
static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
|
{
int i;
int dc = block[0];
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
dc = (17 * dc + 4) >> 3;
dc = (12 * dc + 64) >> 7;
for(i = 0; i < 8; i++){
dest[0] = cm[dest[0]+dc];
dest[1] = cm[dest[1]+dc];
dest[2] = cm[dest[2]+dc];
dest[3] = cm[dest[3]+dc];
dest += linesize;
}
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Return the forwarding port number from initial_path for outgoing SMP and from return_path for returning SMP */
|
int smi_get_fwd_port(struct ib_smp *smp)
|
/* Return the forwarding port number from initial_path for outgoing SMP and from return_path for returning SMP */
int smi_get_fwd_port(struct ib_smp *smp)
|
{
return (!ib_get_smp_direction(smp) ? smp->initial_path[smp->hop_ptr+1] :
smp->return_path[smp->hop_ptr-1]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function is called after a PCI bus error affecting this device has been detected. */
|
static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
|
/* This function is called after a PCI bus error affecting this device has been detected. */
static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
|
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev);
netif_device_detach(netdev);
if (state == pci_channel_io_perm_failure)
return PCI_ERS_RESULT_DISCONNECT;
if (netif_running(netdev))
e1000_down(adapter);
pci_disable_device(pdev);
return PCI_ERS_RESULT_NEED_RESET;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* si4713_update_tune_status - update properties from tx_tune_status command. Must be called with sdev->mutex held. @sdev: si4713_device structure for the device we are communicating */
|
static int si4713_update_tune_status(struct si4713_device *sdev)
|
/* si4713_update_tune_status - update properties from tx_tune_status command. Must be called with sdev->mutex held. @sdev: si4713_device structure for the device we are communicating */
static int si4713_update_tune_status(struct si4713_device *sdev)
|
{
int rval;
u16 f = 0;
u8 p = 0, a = 0, n = 0;
rval = si4713_tx_tune_status(sdev, 0x00, &f, &p, &a, &n);
if (rval < 0)
goto exit;
sdev->power_level = p;
sdev->antenna_capacitor = a;
sdev->tune_rnl = n;
exit:
return rval;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified EXTI line flag is set or not. */
|
FlagStatus EXTI_GetFlagStatus(u32 line)
|
/* Checks whether the specified EXTI line flag is set or not. */
FlagStatus EXTI_GetFlagStatus(u32 line)
|
{
return (EXTI->PR & line) ? SET : RESET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* check and, maybe, map an init- or "clock:"- argument. */
|
static uchar set_clk_freq(int freq, int *mhz)
|
/* check and, maybe, map an init- or "clock:"- argument. */
static uchar set_clk_freq(int freq, int *mhz)
|
{
int x = freq;
if (WD33C93_FS_8_10 == freq)
freq = 8;
else if (WD33C93_FS_12_15 == freq)
freq = 12;
else if (WD33C93_FS_16_20 == freq)
freq = 16;
else if (freq > 7 && freq < 11)
x = WD33C93_FS_8_10;
else if (freq > 11 && freq < 16)
x = WD33C93_FS_12_15;
else if (freq > 15 && freq < 21)
x = WD33C93_FS_16_20;
else {
x = WD33C93_FS_8_10;
freq = 8;
}
*mhz = freq;
return x;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Retrieves the data payload buffer from an already allocated struct dm_ioctl. */
|
static void* get_result_buffer(struct dm_ioctl *param, size_t param_size, size_t *len)
|
/* Retrieves the data payload buffer from an already allocated struct dm_ioctl. */
static void* get_result_buffer(struct dm_ioctl *param, size_t param_size, size_t *len)
|
{
param->data_start = align_ptr(param + 1) - (void *) param;
if (param->data_start < param_size)
*len = param_size - param->data_start;
else
*len = 0;
return ((void *) param) + param->data_start;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Color conversion for no colorspace change: just copy the data, converting from separate-planes to interleaved representation. */
|
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
|
/* Color conversion for no colorspace change: just copy the data, converting from separate-planes to interleaved representation. */
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
|
{
register JSAMPROW inptr, outptr;
register JDIMENSION count;
register int num_components = cinfo->num_components;
JDIMENSION num_cols = cinfo->output_width;
int ci;
while (--num_rows >= 0) {
for (ci = 0; ci < num_components; ci++) {
inptr = input_buf[ci][input_row];
outptr = output_buf[0] + ci;
for (count = num_cols; count > 0; count--) {
*outptr = *inptr++;
outptr += num_components;
}
}
input_row++;
output_buf++;
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Internal function to add PCI config poll opcode node to the table */
|
EFI_STATUS BootScriptWritePciConfigPoll(IN VA_LIST Marker)
|
/* Internal function to add PCI config poll opcode node to the table */
EFI_STATUS BootScriptWritePciConfigPoll(IN VA_LIST Marker)
|
{
S3_BOOT_SCRIPT_LIB_WIDTH Width;
UINT64 Address;
VOID *Data;
VOID *DataMask;
UINT64 Delay;
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Address = VA_ARG (Marker, UINT64);
Data = VA_ARG (Marker, VOID *);
DataMask = VA_ARG (Marker, VOID *);
Delay = (UINT64)VA_ARG (Marker, UINT64);
return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return the size of the file, as reported by the OS. (gint64, in case that's 64 bits.) */
|
gint64 wtap_file_size(wtap *wth, int *err)
|
/* Return the size of the file, as reported by the OS. (gint64, in case that's 64 bits.) */
gint64 wtap_file_size(wtap *wth, int *err)
|
{
ws_statb64 statb;
if (file_fstat((wth->fh == NULL) ? wth->random_fh : wth->fh,
&statb, err) == -1)
return -1;
return statb.st_size;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Writes a variable to indicate that the NV variables have been loaded from the file system. */
|
STATIC VOID SetNvVarsVariable(VOID)
|
/* Writes a variable to indicate that the NV variables have been loaded from the file system. */
STATIC VOID SetNvVarsVariable(VOID)
|
{
BOOLEAN VarData;
UINTN Size;
Size = sizeof (VarData);
VarData = TRUE;
gRT->SetVariable (
L"NvVars",
&gEfiSimpleFileSystemProtocolGuid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
Size,
(VOID *)&VarData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Music player callback to get the next song path. */
|
static const char* get_next_song_path(void *arg_p)
|
/* Music player callback to get the next song path. */
static const char* get_next_song_path(void *arg_p)
|
{
struct song_t *song_p;
sem_take(&sem, NULL);
if (repeat == 0) {
current_song++;
}
song_p = hash_map_get(&song_map, current_song);
sem_give(&sem, 1);
if (song_p != NULL) {
return (song_p->name);
} else {
current_song = FIRST_SONG_NUMBER;
return (NULL);
}
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Write both port 0 and port 1 registers of certain register function.
Given the register in reg, write the pair of port 0 and port 1. */
|
static int write_port_regs(const struct device *dev, uint8_t reg, uint16_t *cache, uint16_t value)
|
/* Write both port 0 and port 1 registers of certain register function.
Given the register in reg, write the pair of port 0 and port 1. */
static int write_port_regs(const struct device *dev, uint8_t reg, uint16_t *cache, uint16_t value)
|
{
const struct gpio_pca95xx_config * const config = dev->config;
uint8_t buf[3];
int ret;
LOG_DBG("PCA95XX[0x%X]: Write: REG[0x%X] = 0x%X, REG[0x%X] = "
"0x%X", config->bus.addr, reg, (value & 0xFF),
(reg + 1), (value >> 8));
buf[0] = reg;
sys_put_le16(value, &buf[1]);
ret = i2c_write_dt(&config->bus, buf, sizeof(buf));
if (ret == 0) {
*cache = value;
} else {
LOG_ERR("PCA95XX[0x%X]: error writing to register 0x%X "
"(%d)", config->bus.addr, reg, ret);
}
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Outputs the code length array for the Extra Set or the Position Set. */
|
STATIC VOID WritePTLen(IN INT32 n, IN INT32 nbit, IN INT32 Special)
|
/* Outputs the code length array for the Extra Set or the Position Set. */
STATIC VOID WritePTLen(IN INT32 n, IN INT32 nbit, IN INT32 Special)
|
{
INT32 i, k;
while (n > 0 && mPTLen[n - 1] == 0) {
n--;
}
PutBits(nbit, n);
i = 0;
while (i < n) {
k = mPTLen[i++];
if (k <= 6) {
PutBits(3, k);
} else {
PutBits(k - 3, (1U << (k - 3)) - 2);
}
if (i == Special) {
while (i < 6 && mPTLen[i] == 0) {
i++;
}
PutBits(2, (i - 3) & 3);
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read then Measure and log an EFI Secure variable, and extend the measurement result into PCR. */
|
EFI_STATUS ReadAndMeasureSecureVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
|
/* Read then Measure and log an EFI Secure variable, and extend the measurement result into PCR. */
EFI_STATUS ReadAndMeasureSecureVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
|
{
return ReadAndMeasureVariable (
MapPcrToMrIndex (7),
EV_EFI_VARIABLE_DRIVER_CONFIG,
VarName,
VendorGuid,
VarSize,
VarData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This is the reverse of s3c_hsotg_map_dma(), called for the completion of a request to ensure the buffer is ready for access by the caller. */
|
static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg, struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_req *hs_req)
|
/* This is the reverse of s3c_hsotg_map_dma(), called for the completion of a request to ensure the buffer is ready for access by the caller. */
static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg, struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_req *hs_req)
|
{
struct usb_request *req = &hs_req->req;
enum dma_data_direction dir;
dir = hs_ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
if (hs_req->req.length == 0)
return;
if (hs_req->mapped) {
dma_unmap_single(hsotg->dev, req->dma, req->length, dir);
req->dma = DMA_ADDR_INVALID;
hs_req->mapped = 0;
} else {
dma_sync_single(hsotg->dev, req->dma, req->length, dir);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Find the corresponding resource node for the Device in child list of BridgeResource. */
|
UINTN FindResourceNode(IN PCI_IO_DEVICE *Device, IN PCI_RESOURCE_NODE *BridgeResource, OUT PCI_RESOURCE_NODE **DeviceResources OPTIONAL)
|
/* Find the corresponding resource node for the Device in child list of BridgeResource. */
UINTN FindResourceNode(IN PCI_IO_DEVICE *Device, IN PCI_RESOURCE_NODE *BridgeResource, OUT PCI_RESOURCE_NODE **DeviceResources OPTIONAL)
|
{
LIST_ENTRY *Link;
PCI_RESOURCE_NODE *Resource;
UINTN Count;
Count = 0;
for ( Link = BridgeResource->ChildList.ForwardLink
; Link != &BridgeResource->ChildList
; Link = Link->ForwardLink
)
{
Resource = RESOURCE_NODE_FROM_LINK (Link);
if (Resource->PciDev == Device) {
if (DeviceResources != NULL) {
DeviceResources[Count] = Resource;
}
Count++;
}
}
return Count;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* introduce function I3C_SlaveTransferHandleReceivedCCC. This function was deal Received. */
|
static void I3C_SlaveTransferHandleReceivedCCC(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_t *xfer)
|
/* introduce function I3C_SlaveTransferHandleReceivedCCC. This function was deal Received. */
static void I3C_SlaveTransferHandleReceivedCCC(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_t *xfer)
|
{
handle->isBusy = true;
xfer->event = (uint32_t)kI3C_SlaveReceivedCCCEvent;
if ((0UL != (handle->eventMask & xfer->event)) && (NULL != handle->callback))
{
handle->callback(base, xfer, handle->userData);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The temporary storage will be removed after it has been used (eg. displayed to user), the wssid element will be removed from the list when the neighbor is rediscovered or when it disappears. */
|
static struct wlp_wssid_e* wlp_create_wssid_e(struct wlp *wlp, struct wlp_neighbor_e *neighbor)
|
/* The temporary storage will be removed after it has been used (eg. displayed to user), the wssid element will be removed from the list when the neighbor is rediscovered or when it disappears. */
static struct wlp_wssid_e* wlp_create_wssid_e(struct wlp *wlp, struct wlp_neighbor_e *neighbor)
|
{
struct device *dev = &wlp->rc->uwb_dev.dev;
struct wlp_wssid_e *wssid_e;
wssid_e = kzalloc(sizeof(*wssid_e), GFP_KERNEL);
if (wssid_e == NULL) {
dev_err(dev, "WLP: unable to allocate memory "
"for WSS information.\n");
goto error_alloc;
}
wssid_e->info = kzalloc(sizeof(struct wlp_wss_tmp_info), GFP_KERNEL);
if (wssid_e->info == NULL) {
dev_err(dev, "WLP: unable to allocate memory "
"for temporary WSS information.\n");
kfree(wssid_e);
wssid_e = NULL;
goto error_alloc;
}
list_add(&wssid_e->node, &neighbor->wssid);
error_alloc:
return wssid_e;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* SPU syscall restarting is tricky because we violate the basic assumption that the signal handler is running on the interrupted thread. Here instead, the handler runs on PowerPC user space code, while the syscall was called from the SPU. This means we can only do a very rough approximation of POSIX signal semantics. */
|
static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret, unsigned int *npc)
|
/* SPU syscall restarting is tricky because we violate the basic assumption that the signal handler is running on the interrupted thread. Here instead, the handler runs on PowerPC user space code, while the syscall was called from the SPU. This means we can only do a very rough approximation of POSIX signal semantics. */
static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret, unsigned int *npc)
|
{
int ret;
switch (*spu_ret) {
case -ERESTARTSYS:
case -ERESTARTNOINTR:
*npc -= 8;
ret = -ERESTARTSYS;
break;
case -ERESTARTNOHAND:
case -ERESTART_RESTARTBLOCK:
*spu_ret = -EINTR;
ret = -ERESTARTSYS;
break;
default:
printk(KERN_WARNING "%s: unexpected return code %ld\n",
__func__, *spu_ret);
ret = 0;
}
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* See _g_freedesktop_dbus_call_get_connection_unix_user_sync() for the synchronous, blocking version of this method. */
|
void _g_freedesktop_dbus_call_get_connection_unix_user(_GFreedesktopDBus *proxy, const gchar *arg_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
/* See _g_freedesktop_dbus_call_get_connection_unix_user_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_get_connection_unix_user(_GFreedesktopDBus *proxy, const gchar *arg_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
{
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
"GetConnectionUnixUser",
g_variant_new ("(s)",
arg_name),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
callback,
user_data);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* convert a sampling rate into USB high speed format (fs/8000 in Q16.16) this will overflow at approx 4 MHz */
|
static unsigned get_usb_high_speed_rate(unsigned int rate)
|
/* convert a sampling rate into USB high speed format (fs/8000 in Q16.16) this will overflow at approx 4 MHz */
static unsigned get_usb_high_speed_rate(unsigned int rate)
|
{
return ((rate << 10) + 62) / 125;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* VmbusGetChannelOffers - Retrieve the channel offers from the parent partition */
|
static void VmbusGetChannelOffers(void)
|
/* VmbusGetChannelOffers - Retrieve the channel offers from the parent partition */
static void VmbusGetChannelOffers(void)
|
{
DPRINT_ENTER(VMBUS);
VmbusChannelRequestOffers();
DPRINT_EXIT(VMBUS);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Nothing to initialize at the moment. Turns the red LED on and the green LED off. */
|
void board_init(void)
|
/* Nothing to initialize at the moment. Turns the red LED on and the green LED off. */
void board_init(void)
|
{
LED_GREEN_OFF;
LED_RED_ON;
puts("RIOT native board initialized.");
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Returns the number of pages in one single block of a device. */
|
uint32_t nand_flash_model_get_block_size_in_pages(const struct nand_flash_model *model)
|
/* Returns the number of pages in one single block of a device. */
uint32_t nand_flash_model_get_block_size_in_pages(const struct nand_flash_model *model)
|
{
return (model->block_size_in_kilobytes * 1024) /
model->page_size_in_bytes;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Initialize the menu handling. Clear screen and draw menu. */
|
void gfx_mono_menu_init(struct gfx_mono_menu *menu)
|
/* Initialize the menu handling. Clear screen and draw menu. */
void gfx_mono_menu_init(struct gfx_mono_menu *menu)
|
{
gfx_mono_draw_filled_rect(0, 0,
GFX_MONO_LCD_WIDTH, GFX_MONO_LCD_HEIGHT, GFX_PIXEL_CLR);
gfx_mono_draw_progmem_string((char PROGMEM_PTR_T)menu->title,
0, 0, &sysfont);
menu_draw(menu, true);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Registers an interrupt handler for the specified PWM generator block. */
|
void PWMGenIntRegister(uint32_t ui32Base, uint32_t ui32Gen, void(*pfnIntHandler)(void))
|
/* Registers an interrupt handler for the specified PWM generator block. */
void PWMGenIntRegister(uint32_t ui32Base, uint32_t ui32Gen, void(*pfnIntHandler)(void))
|
{
uint32_t ui32Int;
ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE));
ASSERT(_PWMGenValid(ui32Gen));
ui32Int = _PWMGenIntNumberGet(ui32Base, ui32Gen);
ASSERT(ui32Int != 0);
IntRegister(ui32Int, pfnIntHandler);
IntEnable(ui32Int);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Directory block splitting, compacting Create map of hash values, offsets, and sizes, stored at end of block. Returns number of entries mapped. */
|
static int dx_make_map(struct ext4_dir_entry_2 *de, unsigned blocksize, struct dx_hash_info *hinfo, struct dx_map_entry *map_tail)
|
/* Directory block splitting, compacting Create map of hash values, offsets, and sizes, stored at end of block. Returns number of entries mapped. */
static int dx_make_map(struct ext4_dir_entry_2 *de, unsigned blocksize, struct dx_hash_info *hinfo, struct dx_map_entry *map_tail)
|
{
int count = 0;
char *base = (char *) de;
struct dx_hash_info h = *hinfo;
while ((char *) de < base + blocksize) {
if (de->name_len && de->inode) {
ext4fs_dirhash(de->name, de->name_len, &h);
map_tail--;
map_tail->hash = h.hash;
map_tail->offs = ((char *) de - base)>>2;
map_tail->size = le16_to_cpu(de->rec_len);
count++;
cond_resched();
}
de = ext4_next_entry(de, blocksize);
}
return count;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* general buffer to hold results from APDU calls */
|
VCardResponse* vcard_response_new(VCard *card, unsigned char *buf, int len, int Le, vcard_7816_status_t status)
|
/* general buffer to hold results from APDU calls */
VCardResponse* vcard_response_new(VCard *card, unsigned char *buf, int len, int Le, vcard_7816_status_t status)
|
{
VCardResponse *new_response;
if (len > Le) {
return vcard_init_buffer_response(card, buf, len);
}
new_response = vcard_response_new_data(buf, len);
if (new_response == NULL) {
return NULL;
}
vcard_response_set_status(new_response, status);
return new_response;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Return: false - we are done with this request true - still buffers pending for this request */
|
bool __blk_end_request_cur(struct request *rq, int error)
|
/* Return: false - we are done with this request true - still buffers pending for this request */
bool __blk_end_request_cur(struct request *rq, int error)
|
{
return __blk_end_request(rq, error, blk_rq_cur_bytes(rq));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Function to append a 64 bit number onto the mapping info. */
|
EFI_STATUS AppendCSDNum(IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN UINT64 Num)
|
/* Function to append a 64 bit number onto the mapping info. */
EFI_STATUS AppendCSDNum(IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN UINT64 Num)
|
{
EFI_STATUS Status;
ASSERT (MappingItem != NULL);
if (MappingItem->Digital) {
Status = CatPrint (&MappingItem->Csd, L"%ld", Num);
} else {
Status = AppendCSDNum2 (&MappingItem->Csd, Num);
}
if (!EFI_ERROR (Status)) {
MappingItem->Digital = (BOOLEAN) !(MappingItem->Digital);
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Checks whether the DCMI interface flag is set or not. */
|
FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG)
|
/* Checks whether the DCMI interface flag is set or not. */
FlagStatus DCMI_GetFlagStatus(uint16_t DCMI_FLAG)
|
{
FlagStatus bitstatus = RESET;
uint32_t dcmireg, tempreg = 0;
assert_param(IS_DCMI_GET_FLAG(DCMI_FLAG));
dcmireg = (((uint16_t)DCMI_FLAG) >> 12);
if (dcmireg == 0x01)
{
tempreg= DCMI->RISR;
}
else if (dcmireg == 0x02)
{
tempreg = DCMI->SR;
}
else
{
tempreg = DCMI->MISR;
}
if ((tempreg & DCMI_FLAG) != (uint16_t)RESET )
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Returns the current status register of the given TWI peripheral. This resets the internal value of the status register, so further read may yield different values. */
|
unsigned int TWI_GetStatus(AT91S_TWI *pTwi)
|
/* Returns the current status register of the given TWI peripheral. This resets the internal value of the status register, so further read may yield different values. */
unsigned int TWI_GetStatus(AT91S_TWI *pTwi)
|
{
SANITY_CHECK(pTwi);
return pTwi->TWI_SR;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Description: When a packet is dropped due to a call to avc_has_perm() pass the error code to the NetLabel subsystem so any protocol specific processing can be done. This is safe to call even if you are unsure if NetLabel labeling is present on the packet, NetLabel is smart enough to only act when it should. */
|
void selinux_netlbl_err(struct sk_buff *skb, int error, int gateway)
|
/* Description: When a packet is dropped due to a call to avc_has_perm() pass the error code to the NetLabel subsystem so any protocol specific processing can be done. This is safe to call even if you are unsure if NetLabel labeling is present on the packet, NetLabel is smart enough to only act when it should. */
void selinux_netlbl_err(struct sk_buff *skb, int error, int gateway)
|
{
netlbl_skbuff_err(skb, error, gateway);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Converts a text device path node to Vendor Hardware device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenHw(IN CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to Vendor Hardware device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenHw(IN CHAR16 *TextDeviceNode)
|
{
return ConvertFromTextVendor (
TextDeviceNode,
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Registers an interrupt handler for an Ethernet interrupt. */
|
void EMACIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
|
/* Registers an interrupt handler for an Ethernet interrupt. */
void EMACIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
|
{
ASSERT(pfnHandler != 0);
IntRegister(INT_EMAC0_TM4C129, pfnHandler);
IntEnable(INT_EMAC0_TM4C129);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Waits to send a character from the specified port. */
|
void UARTCharPut(unsigned long ulBase, unsigned char ucData)
|
/* Waits to send a character from the specified port. */
void UARTCharPut(unsigned long ulBase, unsigned char ucData)
|
{
xASSERT(UARTBaseValid(ulBase));
while(!(xHWREG(ulBase + USART_LSR) & USART_LSR_TX_FIFO_EMPTY))
{
}
xHWREG(ulBase + USART_THR) = ucData;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Functions for accessing PCI configuration space with MMCONFIG accesses */
|
static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
|
/* Functions for accessing PCI configuration space with MMCONFIG accesses */
static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
|
{
struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus);
if (cfg)
return cfg->address;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Disbles or disables the EMMC NAND ECC feature. */
|
void EMMC_DisableNANDECC(EMMC_BANK_NAND_T bank)
|
/* Disbles or disables the EMMC NAND ECC feature. */
void EMMC_DisableNANDECC(EMMC_BANK_NAND_T bank)
|
{
if (bank == EMMC_BANK2_NAND)
{
EMMC_Bank2->CTRL2 &= 0x000FFFBF;
}
else
{
EMMC_Bank3->CTRL3 &= 0x000FFFBF;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base ACMP peripheral base address. param mask Mask of channel index. Available range is channel0:0x01 to channel7:0x80. */
|
void ACMP_ClearRoundRobinStatusFlags(CMP_Type *base, uint32_t mask)
|
/* param base ACMP peripheral base address. param mask Mask of channel index. Available range is channel0:0x01 to channel7:0x80. */
void ACMP_ClearRoundRobinStatusFlags(CMP_Type *base, uint32_t mask)
|
{
uint32_t tmp32 = (base->C2 & (~CMP_C2_CHnF_MASK));
tmp32 |= (mask << CMP_C2_CH0F_SHIFT);
base->C2 = tmp32;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This routine supplies the Guest with time: it's used for wallclock time at initial boot and as a rough time source if the TSC isn't available. */
|
void write_timestamp(struct lg_cpu *cpu)
|
/* This routine supplies the Guest with time: it's used for wallclock time at initial boot and as a rough time source if the TSC isn't available. */
void write_timestamp(struct lg_cpu *cpu)
|
{
struct timespec now;
ktime_get_real_ts(&now);
if (copy_to_user(&cpu->lg->lguest_data->time,
&now, sizeof(struct timespec)))
kill_guest(cpu, "Writing timestamp");
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
|
void TIM0_Init(void)
|
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
void TIM0_Init(void)
|
{
htim0.Instance = TIM0;
htim0.Init.Unit = TIM_UNIT_US;
htim0.Init.Period = 1000000;
htim0.Init.AutoReload = TIM_AUTORELOAD_PRELOAD_ENABLE;
if (HAL_TIM_Base_Init(&htim0) != HAL_OK)
{
Error_Handler();
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* brief DMA instance 0, channel 6 IRQ handler. */
|
void EDMA_0_CH6_DriverIRQHandler(void)
|
/* brief DMA instance 0, channel 6 IRQ handler. */
void EDMA_0_CH6_DriverIRQHandler(void)
|
{
EDMA_DriverIRQHandler(0U, 6U);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Sets the output device(s) to a specified mode. */
|
EFI_STATUS EFIAPI ConsoleLoggerSetMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber)
|
/* Sets the output device(s) to a specified mode. */
EFI_STATUS EFIAPI ConsoleLoggerSetMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber)
|
{
EFI_STATUS Status;
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
Status = ConsoleInfo->OldConOut->SetMode (ConsoleInfo->OldConOut, ModeNumber);
if (!EFI_ERROR (Status)) {
ConsoleInfo->OurConOut.Mode = ConsoleInfo->OldConOut->Mode;
ConsoleLoggerResetBuffers (ConsoleInfo);
ConsoleInfo->OriginalStartRow = 0;
ConsoleInfo->CurrentStartRow = 0;
ConsoleInfo->OurConOut.ClearScreen (&ConsoleInfo->OurConOut);
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return value: 0 if the pmcraid_event_family is successfully registered with netlink generic, non-zero otherwise */
|
static int pmcraid_netlink_init(void)
|
/* Return value: 0 if the pmcraid_event_family is successfully registered with netlink generic, non-zero otherwise */
static int pmcraid_netlink_init(void)
|
{
int result;
result = genl_register_family(&pmcraid_event_family);
if (result)
return result;
pmcraid_info("registered NETLINK GENERIC group: %d\n",
pmcraid_event_family.id);
return result;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param bypassXtalOsc Pass in true to bypass the external crystal oscillator. note This device does not support bypass external crystal oscillator, so the input parameter should always be false. */
|
void CLOCK_InitExternalClk(bool bypassXtalOsc)
|
/* param bypassXtalOsc Pass in true to bypass the external crystal oscillator. note This device does not support bypass external crystal oscillator, so the input parameter should always be false. */
void CLOCK_InitExternalClk(bool bypassXtalOsc)
|
{
assert(!bypassXtalOsc);
CCM_ANALOG->MISC0_CLR = CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK;
while ((XTALOSC24M->LOWPWR_CTRL & XTALOSC24M_LOWPWR_CTRL_XTALOSC_PWRUP_STAT_MASK) == 0U)
{
}
CCM_ANALOG->MISC0_SET = CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK;
while ((CCM_ANALOG->MISC0 & CCM_ANALOG_MISC0_OSC_XTALOK_MASK) == 0UL)
{
}
CCM_ANALOG->MISC0_CLR = CCM_ANALOG_MISC0_OSC_XTALOK_EN_MASK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* @i: index of the table entry to be removed */
|
static void efi_remove_configuration_table(int i)
|
/* @i: index of the table entry to be removed */
static void efi_remove_configuration_table(int i)
|
{
struct efi_configuration_table *this = &systab.tables[i];
struct efi_configuration_table *next = &systab.tables[i + 1];
struct efi_configuration_table *end = &systab.tables[systab.nr_tables];
memmove(this, next, (ulong)end - (ulong)next);
systab.nr_tables--;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Retrieves this PCI controller's current PCI bus number, device number, and function number. */
|
EFI_STATUS EFIAPI PciIoGetLocation(IN EFI_PCI_IO_PROTOCOL *This, OUT UINTN *Segment, OUT UINTN *Bus, OUT UINTN *Device, OUT UINTN *Function)
|
/* Retrieves this PCI controller's current PCI bus number, device number, and function number. */
EFI_STATUS EFIAPI PciIoGetLocation(IN EFI_PCI_IO_PROTOCOL *This, OUT UINTN *Segment, OUT UINTN *Bus, OUT UINTN *Device, OUT UINTN *Function)
|
{
PCI_IO_DEVICE *PciIoDevice;
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
if ((Segment == NULL) || (Bus == NULL) || (Device == NULL) || (Function == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Segment = PciIoDevice->PciRootBridgeIo->SegmentNumber;
*Bus = PciIoDevice->BusNumber;
*Device = PciIoDevice->DeviceNumber;
*Function = PciIoDevice->FunctionNumber;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* walk down backref nodes to find start of next reference path */
|
static struct backref_node* walk_down_backref(struct backref_edge *edges[], int *index)
|
/* walk down backref nodes to find start of next reference path */
static struct backref_node* walk_down_backref(struct backref_edge *edges[], int *index)
|
{
struct backref_edge *edge;
struct backref_node *lower;
int idx = *index;
while (idx > 0) {
edge = edges[idx - 1];
lower = edge->node[LOWER];
if (list_is_last(&edge->list[LOWER], &lower->upper)) {
idx--;
continue;
}
edge = list_entry(edge->list[LOWER].next,
struct backref_edge, list[LOWER]);
edges[idx - 1] = edge;
*index = idx;
return edge->node[UPPER];
}
*index = 0;
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables callback.
Enables the callback function registered by the */
|
void tcc_enable_callback(struct tcc_module *const module, const enum tcc_callback callback_type)
|
/* Enables callback.
Enables the callback function registered by the */
void tcc_enable_callback(struct tcc_module *const module, const enum tcc_callback callback_type)
|
{
Assert(module);
Assert(module->hw);
system_interrupt_enable(_tcc_interrupt_get_interrupt_vector(
_tcc_get_inst_index(module->hw)));
module->enable_callback_mask |= _tcc_intflag[callback_type];
module->hw->INTENSET.reg = _tcc_intflag[callback_type];
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* The PWMA default IRQ, declared in StartUp code. */
|
void PWM0CH2_IRQHandler(void)
|
/* The PWMA default IRQ, declared in StartUp code. */
void PWM0CH2_IRQHandler(void)
|
{
unsigned long ulPWMStastus;
unsigned long ulBase = PWMA_BASE;
ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0x04040404;
xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus;
if (g_pfnPWMHandlerCallbacks[0] != 0)
{
if(ulPWMStastus & 0x0404)
{
g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_PWM, ulPWMStastus, 0);
}
if((ulPWMStastus & 0x04040000))
{
g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_CAP, (1 << PWM_CHANNEL2), 0);
}
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Get the PWM duty of the PWM module.
The */
|
unsigned long xPWMDutyGet(unsigned long ulBase, unsigned long ulChannel)
|
/* Get the PWM duty of the PWM module.
The */
unsigned long xPWMDutyGet(unsigned long ulBase, unsigned long ulChannel)
|
{
unsigned long ulCMRData;
unsigned long ulCNRData;
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannel >= 0) || (ulChannel <= 1)));
ulCNRData = (xHWREG(ulBase + PWM_CNR0 +(ulChannel * 12)));
ulCMRData = (xHWREG(ulBase + PWM_CMR0 +(ulChannel * 12)));
ulChannel = (ulCMRData + 1) * 100 / (ulCNRData + 1);
return ulChannel;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* The constructor function gets the start address of HOB list from system configuration table. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */
|
EFI_STATUS EFIAPI HobLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_MM_SYSTEM_TABLE *MmSystemTable)
|
/* The constructor function gets the start address of HOB list from system configuration table. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI HobLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_MM_SYSTEM_TABLE *MmSystemTable)
|
{
UINTN Index;
for (Index = 0; Index < gMmst->NumberOfTableEntries; Index++) {
if (CompareGuid (&gEfiHobListGuid, &gMmst->MmConfigurationTable[Index].VendorGuid)) {
gHobList = gMmst->MmConfigurationTable[Index].VendorTable;
break;
}
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function returns a pointer to the corresponding &struct ubi_ltree_entry object if the logical eraseblock is locked and NULL if it is not. @ubi->ltree_lock has to be locked. */
|
static struct ubi_ltree_entry* ltree_lookup(struct ubi_device *ubi, int vol_id, int lnum)
|
/* This function returns a pointer to the corresponding &struct ubi_ltree_entry object if the logical eraseblock is locked and NULL if it is not. @ubi->ltree_lock has to be locked. */
static struct ubi_ltree_entry* ltree_lookup(struct ubi_device *ubi, int vol_id, int lnum)
|
{
struct rb_node *p;
p = ubi->ltree.rb_node;
while (p) {
struct ubi_ltree_entry *le;
le = rb_entry(p, struct ubi_ltree_entry, rb);
if (vol_id < le->vol_id)
p = p->rb_left;
else if (vol_id > le->vol_id)
p = p->rb_right;
else {
if (lnum < le->lnum)
p = p->rb_left;
else if (lnum > le->lnum)
p = p->rb_right;
else
return le;
}
}
return NULL;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter. */
|
void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData)
|
/* param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter. */
void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData)
|
{
assert(handle != NULL);
lpspi_to_lpflexcomm_t handler;
handler.lpspi_slave_handler = LPSPI_SlaveTransferHandleIRQ;
(void)memset(handle, 0, sizeof(*handle));
handle->callback = callback;
handle->userData = userData;
LP_FLEXCOMM_SetIRQHandler(LPSPI_GetInstance(base), handler.lpflexcomm_handler, handle, LP_FLEXCOMM_PERIPH_LPSPI);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Buffer allocation/deallocation routines. The buffer descriptor returned has the virtual and dma address of a buffer suitable for both, receive and transmit operations. */
|
static db_dest_t* GetFreeDB(struct au1k_private *aup)
|
/* Buffer allocation/deallocation routines. The buffer descriptor returned has the virtual and dma address of a buffer suitable for both, receive and transmit operations. */
static db_dest_t* GetFreeDB(struct au1k_private *aup)
|
{
db_dest_t *pDB;
pDB = aup->pDBfree;
if (pDB) {
aup->pDBfree = pDB->pnext;
}
return pDB;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables or disables the selected DAC channel wave generation. */
|
void DAC_WaveGenerationEnable(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState Cmd)
|
/* Enables or disables the selected DAC channel wave generation. */
void DAC_WaveGenerationEnable(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState Cmd)
|
{
__IO uint32_t tmp = 0;
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_DAC_WAVE(DAC_Wave));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
tmp=DAC->CTRL;
tmp&=~(3<<(DAC_Channel+6));
if (Cmd != DISABLE)
{
tmp |= DAC_Wave << DAC_Channel;
}
else
{
tmp &=~(3<<(DAC_Channel+6));
}
DAC->CTRL = tmp;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* edma3_read_slot - read parameter RAM data from slot @base: base address of edma @slot: number of parameter RAM slot being copied */
|
void edma3_read_slot(u32 base, int slot, struct edma3_slot_layout *param)
|
/* edma3_read_slot - read parameter RAM data from slot @base: base address of edma @slot: number of parameter RAM slot being copied */
void edma3_read_slot(u32 base, int slot, struct edma3_slot_layout *param)
|
{
int i;
u32 *p = (u32 *)param;
u32 *addr = (u32 *)(base + EDMA3_SL_BASE(slot));
for (i = 0; i < sizeof(struct edma3_slot_layout)/4; i += 4)
*p++ = __raw_readl(addr++);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Delay number of tick Systicks (happens every 1 ms). */
|
static __INLINE void delay_ms(uint32_t ul_dly_ticks)
|
/* Delay number of tick Systicks (happens every 1 ms). */
static __INLINE void delay_ms(uint32_t ul_dly_ticks)
|
{
uint32_t ul_cur_ticks;
ul_cur_ticks = g_ul_ms_ticks;
while ((g_ul_ms_ticks - ul_cur_ticks) < ul_dly_ticks);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Poll to update MediaPresent field in SNP ModeData by Snp->GetStatus(). */
|
VOID EFIAPI MnpCheckMediaStatus(IN EFI_EVENT Event, IN VOID *Context)
|
/* Poll to update MediaPresent field in SNP ModeData by Snp->GetStatus(). */
VOID EFIAPI MnpCheckMediaStatus(IN EFI_EVENT Event, IN VOID *Context)
|
{
MNP_DEVICE_DATA *MnpDeviceData;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
UINT32 InterruptStatus;
MnpDeviceData = (MNP_DEVICE_DATA *)Context;
NET_CHECK_SIGNATURE (MnpDeviceData, MNP_DEVICE_DATA_SIGNATURE);
Snp = MnpDeviceData->Snp;
if (Snp->Mode->MediaPresentSupported) {
Snp->GetStatus (Snp, &InterruptStatus, NULL);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Check if a Resume by slave state has been detected during the SWP bus SUSPENDED state @rmtoll ISR SRF LL_SWPMI_IsActiveFlag_SR. */
|
uint32_t LL_SWPMI_IsActiveFlag_SR(SWPMI_TypeDef *SWPMIx)
|
/* Check if a Resume by slave state has been detected during the SWP bus SUSPENDED state @rmtoll ISR SRF LL_SWPMI_IsActiveFlag_SR. */
uint32_t LL_SWPMI_IsActiveFlag_SR(SWPMI_TypeDef *SWPMIx)
|
{
return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SRF) == (SWPMI_ISR_SRF)) ? 1UL : 0UL);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* The stream current position is moved when reading. */
|
EFI_STATUS EFIAPI AmlStreamReadByte(IN AML_STREAM *Stream, OUT UINT8 *OutByte)
|
/* The stream current position is moved when reading. */
EFI_STATUS EFIAPI AmlStreamReadByte(IN AML_STREAM *Stream, OUT UINT8 *OutByte)
|
{
EFI_STATUS Status;
if (!IS_STREAM (Stream) ||
IS_END_OF_STREAM (Stream) ||
(OutByte == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status = AmlStreamPeekByte (Stream, OutByte);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;
}
Status = AmlStreamProgress (Stream, 1);
ASSERT_EFI_ERROR (Status);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the peripheral Preload register on CCM3. */
|
void TMR_ConfigOC3Preload(TMR_T *tmr, TMR_OC_PRELOAD_T OCPreload)
|
/* Enables or disables the peripheral Preload register on CCM3. */
void TMR_ConfigOC3Preload(TMR_T *tmr, TMR_OC_PRELOAD_T OCPreload)
|
{
tmr->CCM2_COMPARE_B.OC3PEN = OCPreload;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Following this call, any data read from this item will start from the beginning of the configuration item's data. */
|
VOID EFIAPI QemuFwCfgSelectItem(IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem)
|
/* Following this call, any data read from this item will start from the beginning of the configuration item's data. */
VOID EFIAPI QemuFwCfgSelectItem(IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem)
|
{
if (QemuFwCfgIsAvailable ()) {
MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem));
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* pzl_init - initialize the periodic zone list @whc: the WHCI host controller */
|
int pzl_init(struct whc *whc)
|
/* pzl_init - initialize the periodic zone list @whc: the WHCI host controller */
int pzl_init(struct whc *whc)
|
{
int i;
whc->pz_list = dma_alloc_coherent(&whc->umc->dev, sizeof(u64) * 16,
&whc->pz_list_dma, GFP_KERNEL);
if (whc->pz_list == NULL)
return -ENOMEM;
for (i = 0; i < 16; i++)
whc->pz_list[i] = cpu_to_le64(QH_LINK_NTDS(8) | QH_LINK_T);
le_writeq(whc->pz_list_dma, whc->base + WUSBPERIODICLISTBASE);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the value of the auto-incrementing timer counter(s) */
|
uint32_t timer32GetCount(uint8_t timerNum)
|
/* Returns the value of the auto-incrementing timer counter(s) */
uint32_t timer32GetCount(uint8_t timerNum)
|
{
if (0 == timerNum)
{
return timer32_0_counter;
}
else
{
return timer32_1_counter;
}
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* Set up the IFC hardware block and page address fields, and the ifc nand structure addr field to point to the correct IFC buffer in memory */
|
static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
|
/* Set up the IFC hardware block and page address fields, and the ifc nand structure addr field to point to the correct IFC buffer in memory */
static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
|
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
struct fsl_ifc_runtime *ifc = ctrl->regs.rregs;
int buf_num;
ctrl->page = page_addr;
ifc_out32(&ifc->ifc_nand.row0, page_addr);
ifc_out32(&ifc->ifc_nand.col0, (oob ? IFC_NAND_COL_MS : 0) | column);
buf_num = page_addr & priv->bufnum_mask;
ctrl->addr = priv->vbase + buf_num * (mtd->writesize * 2);
ctrl->index = column;
if (oob)
ctrl->index += mtd->writesize;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */
|
__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */
__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
{
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0);
return HAL_OK;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Atomic bitwise inclusive OR primitive.
is atomically bitwise OR'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
|
atomic_val_t atomic_or(atomic_t *target, atomic_val_t value)
|
/* Atomic bitwise inclusive OR primitive.
is atomically bitwise OR'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
atomic_val_t atomic_or(atomic_t *target, atomic_val_t value)
|
{
unsigned int key;
atomic_val_t ret;
key = irq_lock();
ret = *target;
*target |= value;
irq_unlock(key);
return ret;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Configures the TMRx Internal Trigger as External Clock. */
|
void TMR_ConfigIntTrigExternalClock(TMR_T *tmr, TMR_TRIGGER_SOURCE_T triggerSource)
|
/* Configures the TMRx Internal Trigger as External Clock. */
void TMR_ConfigIntTrigExternalClock(TMR_T *tmr, TMR_TRIGGER_SOURCE_T triggerSource)
|
{
TMR_SelectInputTrigger(tmr, triggerSource);
tmr->SMCTRL_B.SMFSEL = 0x07;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* ubi_calculate_rsvd_pool - calculate how many PEBs must be reserved for bad eraseblock handling. @ubi: UBI device description object */
|
void ubi_calculate_reserved(struct ubi_device *ubi)
|
/* ubi_calculate_rsvd_pool - calculate how many PEBs must be reserved for bad eraseblock handling. @ubi: UBI device description object */
void ubi_calculate_reserved(struct ubi_device *ubi)
|
{
ubi->beb_rsvd_level = ubi->good_peb_count/100;
ubi->beb_rsvd_level *= CONFIG_MTD_UBI_BEB_RESERVE;
if (ubi->beb_rsvd_level < MIN_RESEVED_PEBS)
ubi->beb_rsvd_level = MIN_RESEVED_PEBS;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* 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 Vector50_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 Vector50_handler(void)
|
{
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (50 * 2))
JMP 0,X
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* The constructor function initializes memory profile for SMM phase. */
|
EFI_STATUS EFIAPI PiSmmCoreMemoryProfileLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* The constructor function initializes memory profile for SMM phase. */
EFI_STATUS EFIAPI PiSmmCoreMemoryProfileLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEdkiiMemoryProfileGuid,
NULL,
(VOID **)&mLibProfileProtocol
);
if (EFI_ERROR (Status)) {
mLibProfileProtocol = NULL;
}
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function releases budget corresponding to a dirty inode. It is usually called when after the inode has been written to the media and marked as clean. It also causes the "no space" flags to be cleared. */
|
void ubifs_release_dirty_inode_budget(struct ubifs_info *c, struct ubifs_inode *ui)
|
/* This function releases budget corresponding to a dirty inode. It is usually called when after the inode has been written to the media and marked as clean. It also causes the "no space" flags to be cleared. */
void ubifs_release_dirty_inode_budget(struct ubifs_info *c, struct ubifs_inode *ui)
|
{
struct ubifs_budget_req req;
memset(&req, 0, sizeof(struct ubifs_budget_req));
req.dd_growth = c->inode_budget + ALIGN(ui->data_len, 8);
ubifs_release_budget(c, &req);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Handle an input data byte in normal state. */
|
static int state_normal_input(struct network_interface_slip_t *self_p, uint8_t data)
|
/* Handle an input data byte in normal state. */
static int state_normal_input(struct network_interface_slip_t *self_p, uint8_t data)
|
{
int res = 1;
switch (data) {
case SLIP_END:
if (self_p->frame.size > 0) {
tcpip_input(self_p->frame.pbuf_p,
self_p->network_interface.netif_p);
self_p->frame.pbuf_p = pbuf_alloc(PBUF_LINK,
(PBUF_POOL_BUFSIZE
- PBUF_LINK_HLEN),
PBUF_POOL);
self_p->frame.buf_p = self_p->frame.pbuf_p->payload;
self_p->frame.size = 0;
}
res = 0;
break;
case SLIP_ESC:
self_p->state = NETWORK_INTERFACE_SLIP_STATE_ESCAPE;
res = 0;
break;
default:
break;
}
return (res);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* We need to be careful here, as dequeue() could be called in the middle. That's why we do the whole thing under the wa->xfer_list_lock. If dequeue() jumps in, it first locks urb->lock and then checks the list */
|
void wa_urb_enqueue_run(struct work_struct *ws)
|
/* We need to be careful here, as dequeue() could be called in the middle. That's why we do the whole thing under the wa->xfer_list_lock. If dequeue() jumps in, it first locks urb->lock and then checks the list */
void wa_urb_enqueue_run(struct work_struct *ws)
|
{
struct wahc *wa = container_of(ws, struct wahc, xfer_work);
struct wa_xfer *xfer, *next;
struct urb *urb;
spin_lock_irq(&wa->xfer_list_lock);
list_for_each_entry_safe(xfer, next, &wa->xfer_delayed_list,
list_node) {
list_del_init(&xfer->list_node);
spin_unlock_irq(&wa->xfer_list_lock);
urb = xfer->urb;
wa_urb_enqueue_b(xfer);
usb_put_urb(urb);
spin_lock_irq(&wa->xfer_list_lock);
}
spin_unlock_irq(&wa->xfer_list_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* RTC Seconds interrupt handler. Clear the RTC interrupt flag and */
|
void RTCSIntHandler(void)
|
/* RTC Seconds interrupt handler. Clear the RTC interrupt flag and */
void RTCSIntHandler(void)
|
{
unsigned long ulEventFlags;
ulEventFlags = (xHWREG(RTC_SR) & (RTC_SR_TOF | RTC_SR_TIF));
if(ulEventFlags)
{
xHWREG(RTC_SR) &= ~RTC_SR_TCE;
xHWREG(RTC_TSR) = 0x00000000;
}
if(g_pfnRTCHandlerCallbacks[1] != 0)
{
g_pfnRTCHandlerCallbacks[1](0, 0, ulEventFlags, 0);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* The task that is woken by the ISR that processes GPIO interrupts originating from the push button. */
|
static void vButtonHandlerTask(void *pvParameters)
|
/* The task that is woken by the ISR that processes GPIO interrupts originating from the push button. */
static void vButtonHandlerTask(void *pvParameters)
|
{
const portCHAR *pcInterruptMessage = "Int";
for( ;; )
{
while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS );
UARTIntDisable( UART0_BASE, UART_INT_TX );
{
pcNextChar = cMessage;
if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) )
{
HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar;
}
pcNextChar++;
}
UARTIntEnable(UART0_BASE, UART_INT_TX);
xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY );
vTaskDelay( mainDEBOUNCE_DELAY );
xSemaphoreTake( xButtonSemaphore, mainNO_DELAY );
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Converts a multicast IP address to a multicast HW MAC address. */
|
EFI_STATUS WinNtSnpMCastIpToMac(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC)
|
/* Converts a multicast IP address to a multicast HW MAC address. */
EFI_STATUS WinNtSnpMCastIpToMac(IN EMU_SNP_PROTOCOL *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC)
|
{
WIN_NT_SNP_PRIVATE *Private;
Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);
return EFI_UNSUPPORTED;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Write to register 'reg' of PM3386 device 'pm', and perform a readback from the identification register. */
|
static void pm3386_reg_write(int pm, int reg, u16 value)
|
/* Write to register 'reg' of PM3386 device 'pm', and perform a readback from the identification register. */
static void pm3386_reg_write(int pm, int reg, u16 value)
|
{
void *_reg;
u16 dummy;
_reg = (void *)ENP2611_PM3386_0_VIRT_BASE;
if (pm == 1)
_reg = (void *)ENP2611_PM3386_1_VIRT_BASE;
*((volatile u16 *)(_reg + (reg << 1))) = value;
dummy = *((volatile u16 *)_reg);
__asm__ __volatile__("mov %0, %0" : "+r" (dummy));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified TIM flag is set or not. */
|
FlagStatus TIM_GetCCENStatus(TIM_Module *TIMx, uint32_t TIM_CCEN)
|
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetCCENStatus(TIM_Module *TIMx, uint32_t TIM_CCEN)
|
{
INTStatus bitstatus = RESET;
assert_param(IsTimList3Module(TIMx));
if(TIMx==TIM1 || TIMx==TIM8)
{
assert_param(IsAdvancedTimCCENFlag(TIM_CCEN));
if ((TIMx->CCEN & TIM_CCEN) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
}
else if(TIMx==TIM2 || TIMx==TIM3 || TIMx==TIM4 || TIMx==TIM5 )
{
assert_param(IsGeneralTimCCENFlag(TIM_CCEN));
if ((TIMx->CCEN & TIM_CCEN) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This routine is invoked to disable device interrupt and disassociate the driver's interrupt handler(s) from interrupt vector(s) to device with SLI-3 interface spec. Depending on the interrupt mode, the driver will release the interrupt vector(s) for the message signaled interrupt. */
|
static void lpfc_sli_disable_intr(struct lpfc_hba *phba)
|
/* This routine is invoked to disable device interrupt and disassociate the driver's interrupt handler(s) from interrupt vector(s) to device with SLI-3 interface spec. Depending on the interrupt mode, the driver will release the interrupt vector(s) for the message signaled interrupt. */
static void lpfc_sli_disable_intr(struct lpfc_hba *phba)
|
{
if (phba->intr_type == MSIX)
lpfc_sli_disable_msix(phba);
else if (phba->intr_type == MSI)
lpfc_sli_disable_msi(phba);
else if (phba->intr_type == INTx)
free_irq(phba->pcidev->irq, phba);
phba->intr_type = NONE;
phba->sli.slistat.sli_intr = 0;
return;
}
|
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.