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 |
|---|---|---|---|---|---|---|---|
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */ | static int cb_pcidda_detach(struct comedi_device *dev) | /* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */
static int cb_pcidda_detach(struct comedi_device *dev) | {
if (devpriv) {
if (devpriv->pci_dev) {
if (devpriv->dac) {
comedi_pci_disable(devpriv->pci_dev);
}
pci_dev_put(devpriv->pci_dev);
}
}
if (dev->subdevices) {
subdev_8255_cleanup(dev, dev->subdevices + 1);
subdev_8255_cleanup(dev, dev->subdevices + 2);
}
printk("comedi%d: cb_pcidda: remove\n", dev->minor);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Save/restore the "present" flag that is in the second line of 2-line messages */ | static int get_present2(void *p) | /* Save/restore the "present" flag that is in the second line of 2-line messages */
static int get_present2(void *p) | {
struct message_header *mhdr = p + GRU_CACHE_LINE_BYTES;
return mhdr->present;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Copy a string containing the peer's phone number of a connected interface to user space. */ | int isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer) | /* Copy a string containing the peer's phone number of a connected interface to user space. */
int isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer) | {
isdn_net_dev *p = isdn_net_findif(phone->name);
int ch, dv, idx;
if (!p)
return -ENODEV;
ch = p->local->isdn_channel;
dv = p->local->isdn_device;
if(ch < 0 && dv < 0)
return -ENOTCONN;
idx = isdn_dc2minor(dv, ch);
if (idx <0 )
return -ENODEV;
if (strncmp(dev->num[idx], "???", 3) == 0)
return -ENOTCONN;
strncpy(phone->phone, dev->num[idx], ISDN_MSNLEN);
phone->outgoing = USG_OUTGOING(dev->usage[idx]);
if (copy_to_user(peer, phone, sizeof(*peer)))
return -EFAULT;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DMA module initialization, this function is invoked by ald_cmu_init(). */ | void ald_dma_init(void) | /* DMA module initialization, this function is invoked by ald_cmu_init(). */
void ald_dma_init(void) | {
memset(dma_cbk, 0x0, sizeof(dma_cbk));
ald_dma_reset();
ald_mcu_irq_config(DMA_IRQn, 4, ENABLE);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Decrypts the len-bytes in the specified data-array, using the specified 256- bit (32 bytes) key. The results are written back into the same array. */ | LIBOPENBLT_EXPORT uint32_t BltUtilCryptoAes256Decrypt(uint8_t *data, uint32_t len, uint8_t const *key) | /* Decrypts the len-bytes in the specified data-array, using the specified 256- bit (32 bytes) key. The results are written back into the same array. */
LIBOPENBLT_EXPORT uint32_t BltUtilCryptoAes256Decrypt(uint8_t *data, uint32_t len, uint8_t const *key) | {
uint32_t result = BLT_RESULT_ERROR_GENERIC;
assert(data != NULL);
assert(key != NULL);
if ( (data != NULL) && (key != NULL) && ((len % 16u) == 0) )
{
if (UtilCryptoAes256Decrypt(data, len, key))
{
result = BLT_RESULT_OK;
}
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* STUSB1602 checks the VBUS_DISCHARGE_CTRL State (EN or DIS) (bit7 0x26 */ | VBUS_Discharge_State_TypeDef STUSB1602_VBUS_Discharge_State_Get(uint8_t Addr) | /* STUSB1602 checks the VBUS_DISCHARGE_CTRL State (EN or DIS) (bit7 0x26 */
VBUS_Discharge_State_TypeDef STUSB1602_VBUS_Discharge_State_Get(uint8_t Addr) | {
STUSB1602_VBUS_DISCHARGE_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_VBUS_DISCHARGE_CTRL_REG, 1);
return (VBUS_Discharge_State_TypeDef)(reg.b.VBUS_DISCHARGE_EN);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Attribute read call back for the Value V9 (128-bit UUID) attribute. */ | static ssize_t read_value_v9__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | /* Attribute read call back for the Value V9 (128-bit UUID) attribute. */
static ssize_t read_value_v9__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | {
const uint8_t *value = attr->user_data;
return bt_gatt_attr_read(conn, attr, buf, len, offset, value,
sizeof(value_v9__128_bit_uuid_value));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* r e m o v e N u m b e r */ | returnValue Indexlist_removeNumber(Indexlist *_THIS, int removenumber) | /* r e m o v e N u m b e r */
returnValue Indexlist_removeNumber(Indexlist *_THIS, int removenumber) | {
int i;
int idx = Indexlist_findInsert( _THIS,removenumber );
int iSidx = _THIS->iSort[idx];
if ( _THIS->number[iSidx] != removenumber )
return SUCCESSFUL_RETURN;
for (i = 0; i < _THIS->length; i++)
if (_THIS->iSort[i] > iSidx) _THIS->iSort[i]--;
for (i = idx+1; i < _THIS->length; i++)
_THIS->iSort[i-1] = _THIS->iSort[i];
for( i=iSidx; i<_THIS->length-1; ++i )
_THIS->number[i] = _THIS->number[i+1];
_THIS->number[_THIS->length-1] = -1;
--(_THIS->length);
return SUCCESSFUL_RETURN;
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* Queue a request to the tail of the device ccw_queue and wait for it's completion. */ | int dasd_sleep_on(struct dasd_ccw_req *cqr) | /* Queue a request to the tail of the device ccw_queue and wait for it's completion. */
int dasd_sleep_on(struct dasd_ccw_req *cqr) | {
return _dasd_sleep_on(cqr, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Specifies the counting mode for the specified TMRA unit. */ | void TMRA_SetCountMode(CM_TMRA_TypeDef *TMRAx, uint8_t u8Mode) | /* Specifies the counting mode for the specified TMRA unit. */
void TMRA_SetCountMode(CM_TMRA_TypeDef *TMRAx, uint8_t u8Mode) | {
DDL_ASSERT(IS_TMRA_UNIT(TMRAx));
DDL_ASSERT(IS_TMRA_MD(u8Mode));
MODIFY_REG8(TMRAx->BCSTRL, TMRA_BCSTRL_MODE, u8Mode);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the abort code from an RxRPC abort message. */ | u32 rxrpc_kernel_get_abort_code(struct sk_buff *skb) | /* Get the abort code from an RxRPC abort message. */
u32 rxrpc_kernel_get_abort_code(struct sk_buff *skb) | {
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
ASSERTCMP(skb->mark, ==, RXRPC_SKB_MARK_REMOTE_ABORT);
return sp->call->abort_code;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Offset for hard-iron compensation register(r/w). The value is expressed as a 16-bit word in two’s complement.. */ | int32_t lsm6dsl_mag_offset_get(stmdev_ctx_t *ctx, uint8_t *buff) | /* Offset for hard-iron compensation register(r/w). The value is expressed as a 16-bit word in two’s complement.. */
int32_t lsm6dsl_mag_offset_get(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_read_reg(ctx, LSM6DSL_MAG_OFFX_L, buff, 6);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Enqueue at the tail of the queue.
Enqueue is destructive so tail will change to new tail NOTE: The memory will not be associated with the link-element, but rather the second-to-last link-element. */ | memq_link_t* memq_enqueue(memq_link_t *link, void *mem, memq_link_t **tail) | /* Enqueue at the tail of the queue.
Enqueue is destructive so tail will change to new tail NOTE: The memory will not be associated with the link-element, but rather the second-to-last link-element. */
memq_link_t* memq_enqueue(memq_link_t *link, void *mem, memq_link_t **tail) | {
(*tail)->next = link;
(*tail)->mem = mem;
cpu_dmb();
*tail = link;
return link;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Get default master type of the specified slave. */ | defaut_master_t matrix_get_slave_default_master_type(uint32_t ul_id) | /* Get default master type of the specified slave. */
defaut_master_t matrix_get_slave_default_master_type(uint32_t ul_id) | {
Matrix *p_matrix = MATRIX;
volatile uint32_t ul_reg;
ul_reg = p_matrix->MATRIX_SCFG[ul_id] & (MATRIX_SCFG_DEFMSTR_TYPE_Msk);
return (defaut_master_t)ul_reg;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Allocate abstract data object based on netlink attribute. */ | struct nl_data* nl_data_alloc_attr(struct nlattr *nla) | /* Allocate abstract data object based on netlink attribute. */
struct nl_data* nl_data_alloc_attr(struct nlattr *nla) | {
return nl_data_alloc(nla_data(nla), nla_len(nla));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Note: it is possible that get_ksm_page() will return NULL one moment, then page the next, if the page is in between page_freeze_refs() and page_unfreeze_refs(): this shouldn't be a problem anywhere, the page is on its way to being freed; but it is an anomaly to bear in mind. */ | static struct page* get_ksm_page(struct stable_node *stable_node) | /* Note: it is possible that get_ksm_page() will return NULL one moment, then page the next, if the page is in between page_freeze_refs() and page_unfreeze_refs(): this shouldn't be a problem anywhere, the page is on its way to being freed; but it is an anomaly to bear in mind. */
static struct page* get_ksm_page(struct stable_node *stable_node) | {
struct page *page;
void *expected_mapping;
page = pfn_to_page(stable_node->kpfn);
expected_mapping = (void *)stable_node +
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
rcu_read_lock();
if (page->mapping != expected_mapping)
goto stale;
if (!get_page_unless_zero(page))
goto stale;
if (page->mapping != expected_mapping) {
put_page(page);
goto stale;
}
rcu_read_unlock();
return page;
stale:
rcu_read_unlock();
remove_node_from_stable_tree(stable_node);
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2)
This function is always used in thread mode. */ | unsigned long I2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | /* Write a data to the slave, when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Write Step2)
This function is always used in thread mode. */
unsigned long I2CMasterWriteS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xI2CMasterWriteRequestS2(ulBase, ucData, xfalse);
while (!(xHWREGB(ulBase + I2C_STATUS) & I2C_STATUS_IF));
ulStatus = xHWREGB(ulBase + I2C_STATUS);
if(!(ulStatus == I2C_MASTER_EVENT_TX))
{
ulStatus = xI2CMasterError(ulBase);
I2CStopSend(ulBase);
return ulStatus;
}
if(bEndTransmition)
{
I2CStopSend(ulBase);
}
return xI2C_MASTER_ERR_NONE;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Switches blocks by programming the current one and initializing the next. */ | static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr) | /* Switches blocks by programming the current one and initializing the next. */
static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr) | {
tFlashBlockInfo * result = BLT_NULL;
if (block == &bootBlockInfo)
{
block = &blockInfo;
result = block;
}
else if (base_addr == flashLayout[0].sector_start)
{
block = &bootBlockInfo;
base_addr = flashLayout[0].sector_start;
result = block;
}
else
{
result = block;
if (FlashWriteBlock(block) == BLT_FALSE)
{
result = BLT_NULL;
}
}
if (result != BLT_NULL)
{
if (FlashInitBlock(block, base_addr) == BLT_FALSE)
{
result = BLT_NULL;
}
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */ | void rt_hw_trap_dabt(struct rt_hw_register *regs) | /* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */
void rt_hw_trap_dabt(struct rt_hw_register *regs) | {
rt_hw_show_register(regs);
rt_kprintf("data abort\n");
rt_hw_cpu_shutdown();
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Function for disabling the IRQ for a given PWM instance. */ | __STATIC_INLINE void pwm_irq_disable(app_pwm_t const *const p_instance) | /* Function for disabling the IRQ for a given PWM instance. */
__STATIC_INLINE void pwm_irq_disable(app_pwm_t const *const p_instance) | {
nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
} | labapart/polymcu | C++ | null | 201 |
/* This comparator searches for the next Bulk Endpoint descriptor of the correct MSD interface, aborting the search if another interface descriptor is found before the next endpoint. */ | uint8_t DComp_NextMSInterfaceBulkDataEndpoint(void *CurrentDescriptor) | /* This comparator searches for the next Bulk Endpoint descriptor of the correct MSD interface, aborting the search if another interface descriptor is found before the next endpoint. */
uint8_t DComp_NextMSInterfaceBulkDataEndpoint(void *CurrentDescriptor) | {
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Endpoint)
{
USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t);
if ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK)
return DESCRIPTOR_SEARCH_Found;
}
else if (Header->Type == DTYPE_Interface)
{
return DESCRIPTOR_SEARCH_Fail;
}
return DESCRIPTOR_SEARCH_NotFound;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Command response callback function for sd_ble_gatts_value_set BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gatts_value_set_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gatts_value_set BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gatts_value_set_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code = ble_gatts_value_set_rsp_dec(
p_buffer,
length,
(ble_gatts_value_t *)mp_out_params[0],
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* kill_volumes - destroy all volumes. @ubi: UBI device description object */ | static void kill_volumes(struct ubi_device *ubi) | /* kill_volumes - destroy all volumes. @ubi: UBI device description object */
static void kill_volumes(struct ubi_device *ubi) | {
int i;
for (i = 0; i < ubi->vtbl_slots; i++)
if (ubi->volumes[i])
ubi_free_volume(ubi, ubi->volumes[i]);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Write() service. It writes the PCI configuration register specified by Address with the value specified by Data. The width of data is specifed by Width. Data is returned. */ | UINT32 DxePciSegmentLibPciRootBridgeIoWriteWorker(IN UINT64 Address, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT32 Data) | /* This function wraps EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Pci.Write() service. It writes the PCI configuration register specified by Address with the value specified by Data. The width of data is specifed by Width. Data is returned. */
UINT32 DxePciSegmentLibPciRootBridgeIoWriteWorker(IN UINT64 Address, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT32 Data) | {
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
PciRootBridgeIo = PciSegmentLibSearchForRootBridge (Address);
ASSERT (PciRootBridgeIo != NULL);
PciRootBridgeIo->Pci.Write (
PciRootBridgeIo,
Width,
PCI_TO_PCI_ROOT_BRIDGE_IO_ADDRESS (Address),
1,
&Data
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function checking the validity of an IRK.
@detail An all-zero IRK is not valid. This function will check if a given IRK is valid. */ | bool is_valid_irk(ble_gap_irk_t const *irk) | /* Function checking the validity of an IRK.
@detail An all-zero IRK is not valid. This function will check if a given IRK is valid. */
bool is_valid_irk(ble_gap_irk_t const *irk) | {
for (uint32_t i = 0; i < BLE_GAP_SEC_KEY_LEN; i++)
{
if (irk->irk[i] != 0)
{
return true;
}
}
return false;
} | labapart/polymcu | C++ | null | 201 |
/* Convert cacheattr to PAGE_{READ,WRITE,EXEC} mask. See ISA, A.2.14 The Cache Attribute Register */ | static unsigned cacheattr_attr_to_access(uint32_t attr) | /* Convert cacheattr to PAGE_{READ,WRITE,EXEC} mask. See ISA, A.2.14 The Cache Attribute Register */
static unsigned cacheattr_attr_to_access(uint32_t attr) | {
static const unsigned access[16] = {
[0] = PAGE_READ | PAGE_WRITE | PAGE_CACHE_WT,
[1] = PAGE_READ | PAGE_WRITE | PAGE_EXEC | PAGE_CACHE_WT,
[2] = PAGE_READ | PAGE_WRITE | PAGE_EXEC | PAGE_CACHE_BYPASS,
[3] = PAGE_EXEC | PAGE_CACHE_WB,
[4] = PAGE_READ | PAGE_WRITE | PAGE_EXEC | PAGE_CACHE_WB,
[14] = PAGE_READ | PAGE_WRITE | PAGE_CACHE_ISOLATE,
};
return access[attr & 0xf];
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Select the Watchdog timer reset delay period. This function is to select the Watchdog timer reset delay period. */ | void WDTRestartDelayPeriod(unsigned long ulBase, unsigned long ulPeriod) | /* Select the Watchdog timer reset delay period. This function is to select the Watchdog timer reset delay period. */
void WDTRestartDelayPeriod(unsigned long ulBase, unsigned long ulPeriod) | {
xASSERT(ulBase == xWDT_BASE);
SysCtlKeyAddrUnlock();
xHWREG(WDT_WTCRALT) &= ~WDT_WTCRALT_WTRDSEL_M;
xHWREG(WDT_WTCRALT) |= ulPeriod;
SysCtlKeyAddrLock();
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enables PDMA transfer of selected channel for EPWM capture. */ | void EPWM_EnablePDMA(EPWM_T *epwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode) | /* Enables PDMA transfer of selected channel for EPWM capture. */
void EPWM_EnablePDMA(EPWM_T *epwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode) | {
uint32_t u32IsOddCh;
u32IsOddCh = u32ChannelNum & 0x1U;
(epwm)->PDMACTL = ((epwm)->PDMACTL & ~((EPWM_PDMACTL_CHSEL0_1_Msk | EPWM_PDMACTL_CAPORD0_1_Msk | EPWM_PDMACTL_CAPMOD0_1_Msk) << ((u32ChannelNum >> 1U) << 3U))) | \
(((u32IsOddCh << EPWM_PDMACTL_CHSEL0_1_Pos) | (u32RisingFirst << EPWM_PDMACTL_CAPORD0_1_Pos) | \
u32Mode | EPWM_PDMACTL_CHEN0_1_Msk) << ((u32ChannelNum >> 1U) << 3U));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the sum of all elements in a buffer of 16-bit values. During calculation, the carry bits are also been added. */ | UINT16 CbCheckSum16(IN UINT16 *Buffer, IN UINTN Length) | /* Returns the sum of all elements in a buffer of 16-bit values. During calculation, the carry bits are also been added. */
UINT16 CbCheckSum16(IN UINT16 *Buffer, IN UINTN Length) | {
UINT32 Sum;
UINT32 TmpValue;
UINTN Idx;
UINT8 *TmpPtr;
Sum = 0;
TmpPtr = (UINT8 *)Buffer;
for (Idx = 0; Idx < Length; Idx++) {
TmpValue = TmpPtr[Idx];
if (Idx % 2 == 1) {
TmpValue <<= 8;
}
Sum += TmpValue;
if (Sum >= 0x10000) {
Sum = (Sum + (Sum >> 16)) & 0xFFFF;
}
}
return (UINT16)((~Sum) & 0xFFFF);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Here a Sysex-Common Realtime Device Control command is decoded. */ | static unsigned int decode_sysex_common_rt_dc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len) | /* Here a Sysex-Common Realtime Device Control command is decoded. */
static unsigned int decode_sysex_common_rt_dc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int offset, unsigned int data_len) | {
proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc_volume, tvb, offset, 2, ENC_BIG_ENDIAN );
offset += 2;
} else if ( sub_id == RTP_MIDI_SYSEX_COMMON_RT_DC_MASTER_BALANCE ) {
proto_tree_add_item( tree, hf_rtp_midi_sysex_common_rt_dc_balance, tvb, offset, 2, ENC_BIG_ENDIAN );
offset += 2;
}
return offset-start_offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Convert a byte index (in an UTF-8 text) to character index. E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long */ | static uint32_t lv_txt_utf8_get_char_id(const char *txt, uint32_t byte_id) | /* Convert a byte index (in an UTF-8 text) to character index. E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long */
static uint32_t lv_txt_utf8_get_char_id(const char *txt, uint32_t byte_id) | {
uint32_t i = 0;
uint32_t char_cnt = 0;
while(i < byte_id) {
_lv_txt_encoded_next(txt, &i);
char_cnt++;
}
return char_cnt;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* High when the gyroscope output is in the settling phase.. */ | int32_t lsm6dso_aux_gy_flag_settling_get(lsm6dso_ctx_t *ctx, uint8_t *val) | /* High when the gyroscope output is in the settling phase.. */
int32_t lsm6dso_aux_gy_flag_settling_get(lsm6dso_ctx_t *ctx, uint8_t *val) | {
lsm6dso_status_spiaux_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_STATUS_SPIAUX, (uint8_t*)®, 1);
*val = reg.gyro_settling;
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Some weird registers seem to store values in a sign/magnitude format! */ | static unsigned char ov7670_sm_to_abs(unsigned char v) | /* Some weird registers seem to store values in a sign/magnitude format! */
static unsigned char ov7670_sm_to_abs(unsigned char v) | {
if ((v & 0x80) == 0)
return v + 128;
return 128 - (v & 0x7f);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 1) frees all pointers (non-NULL) 2) Closes the SHELL_FILE_HANDLE */ | VOID InternalFreeShellFileInfoNode(IN EFI_SHELL_FILE_INFO *FileListNode) | /* 1) frees all pointers (non-NULL) 2) Closes the SHELL_FILE_HANDLE */
VOID InternalFreeShellFileInfoNode(IN EFI_SHELL_FILE_INFO *FileListNode) | {
if (FileListNode->Info != NULL) {
FreePool ((VOID *)FileListNode->Info);
}
if (FileListNode->FileName != NULL) {
FreePool ((VOID *)FileListNode->FileName);
}
if (FileListNode->FullName != NULL) {
FreePool ((VOID *)FileListNode->FullName);
}
if (FileListNode->Handle != NULL) {
ShellInfoObject.NewEfiShellProtocol->CloseFile (FileListNode->Handle);
}
FreePool (FileListNode);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* brief Return Frequency of Flexcomm 32kHz return Frequency of Flexcomm 32kHz */ | uint32_t CLOCK_GetFC32KFreq(void) | /* brief Return Frequency of Flexcomm 32kHz return Frequency of Flexcomm 32kHz */
uint32_t CLOCK_GetFC32KFreq(void) | {
return ((0UL == (PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_FRO32K_MASK)) &&
(0UL == (SYSCON->FC32KCLKSEL & SYSCON_FC32KCLKSEL_FC32KCLKSEL_MASK))) ?
CLK_RTC_32K_CLK :
((0UL == (PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_XTAL32K_MASK)) &&
((SYSCON->FC32KCLKSEL & SYSCON_FC32KCLKSEL_FC32KCLKSEL_MASK) != 0UL)) ?
CLK_RTC_32K_CLK :
0UL;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The entry point for IP4 config driver which install the driver binding and component name protocol on its image. */ | EFI_STATUS EFIAPI VlanConfigDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The entry point for IP4 config driver which install the driver binding and component name protocol on its image. */
EFI_STATUS EFIAPI VlanConfigDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gVlanConfigDriverBinding,
ImageHandle,
&gVlanConfigComponentName,
&gVlanConfigComponentName2
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable or disable the clicking of an object */ | void lv_obj_set_click(lv_obj_t *obj, bool en) | /* Enable or disable the clicking of an object */
void lv_obj_set_click(lv_obj_t *obj, bool en) | {
obj->click = (en == true ? 1 : 0);
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Send a master data transmit request when the master have obtained control of the bus.(Write Step2)
For this function returns immediately, it is always using in the interrupt hander. */ | void I2CMasterWriteRequestS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | /* Send a master data transmit request when the master have obtained control of the bus.(Write Step2)
For this function returns immediately, it is always using in the interrupt hander. */
void I2CMasterWriteRequestS2(unsigned long ulBase, unsigned char ucData, xtBoolean bEndTransmition) | {
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xHWREGB(ulBase + I2C_DAT) = ucData;
xHWREGB(ulBase + I2C_STATUS) |= I2C_STATUS_IF;
if(bEndTransmition)
{
I2CStopSend(ulBase);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* fc_fcp_error() - Handler for FCP layer errors @fsp: The FCP packet the error is on @fp: The frame that has errored */ | static void fc_fcp_error(struct fc_fcp_pkt *, struct fc_frame *) | /* fc_fcp_error() - Handler for FCP layer errors @fsp: The FCP packet the error is on @fp: The frame that has errored */
static void fc_fcp_error(struct fc_fcp_pkt *, struct fc_frame *) | {
int error = PTR_ERR(fp);
if (fc_fcp_lock_pkt(fsp))
return;
if (error == -FC_EX_CLOSED) {
fc_fcp_retry_cmd(fsp);
goto unlock;
}
fsp->state &= ~FC_SRB_ABORT_PENDING;
fsp->status_code = FC_CMD_PLOGO;
fc_fcp_complete_locked(fsp);
unlock:
fc_fcp_unlock_pkt(fsp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* scsi_host_get - inc a Scsi_Host ref count @shost: Pointer to Scsi_Host to inc. */ | struct Scsi_Host* scsi_host_get(struct Scsi_Host *shost) | /* scsi_host_get - inc a Scsi_Host ref count @shost: Pointer to Scsi_Host to inc. */
struct Scsi_Host* scsi_host_get(struct Scsi_Host *shost) | {
if ((shost->shost_state == SHOST_DEL) ||
!get_device(&shost->shost_gendev))
return NULL;
return shost;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable time stamp snapshot for IPV6 frames. When disabled, time stamp snapshot is not taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */ | void synopGMAC_TS_IPV6_disable(synopGMACdevice *gmacdev) | /* Disable time stamp snapshot for IPV6 frames. When disabled, time stamp snapshot is not taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_IPV6_disable(synopGMACdevice *gmacdev) | {
synopGMACClearBits(gmacdev->MacBase, GmacTSControl, GmacTSIPV6ENA);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Release all the fragments of the packet. This is the callback for the assembled packet's OnFree. It will free the assemble entry, which in turn frees all the fragments of the packet. */ | VOID EFIAPI Ip6OnFreeFragments(IN VOID *Arg) | /* Release all the fragments of the packet. This is the callback for the assembled packet's OnFree. It will free the assemble entry, which in turn frees all the fragments of the packet. */
VOID EFIAPI Ip6OnFreeFragments(IN VOID *Arg) | {
Ip6FreeAssembleEntry ((IP6_ASSEMBLE_ENTRY *)Arg);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Waits until a new conversion result is available. */ | int32_t AD717X_WaitForReady(ad717x_dev *device, uint32_t timeout) | /* Waits until a new conversion result is available. */
int32_t AD717X_WaitForReady(ad717x_dev *device, uint32_t timeout) | {
ad717x_st_reg *statusReg;
int32_t ret;
int8_t ready = 0;
if(!device || !device->regs)
return INVALID_VAL;
statusReg = AD717X_GetReg(device, AD717X_STATUS_REG);
if (!statusReg)
return INVALID_VAL;
while(!ready && --timeout) {
ret = AD717X_ReadRegister(device, AD717X_STATUS_REG);
if(ret < 0)
return ret;
ready = (statusReg->value & AD717X_STATUS_REG_RDY) == 0;
}
return timeout ? 0 : TIMEOUT;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* mkpath - ensure all directories in path exist Algorithm takes the pessimistic view and works top-down to ensure each directory in path exists, rather than optimistically creating the last element and working backwards. */ | int mkpath(const char *path) | /* mkpath - ensure all directories in path exist Algorithm takes the pessimistic view and works top-down to ensure each directory in path exists, rather than optimistically creating the last element and working backwards. */
int mkpath(const char *path) | {
if (sp != pp)
{
*sp = '\0';
status = do_mkdir(copypath);
*sp = '/';
}
pp = sp + 1;
}
if (status == 0)
status = do_mkdir(path);
free(copypath);
return (status);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Validate allocation and free from system heap memory pool in isr context.
When in isr context, the kernel will successfully alloc a block of memory because in this situation, the kernel will assign the heap memory as resource pool. */ | ZTEST(mheap_api, test_malloc_in_isr) | /* Validate allocation and free from system heap memory pool in isr context.
When in isr context, the kernel will successfully alloc a block of memory because in this situation, the kernel will assign the heap memory as resource pool. */
ZTEST(mheap_api, test_malloc_in_isr) | {
if (!IS_ENABLED(CONFIG_IRQ_OFFLOAD)) {
return;
}
irq_offload((irq_offload_routine_t)tIsr_malloc_and_free, NULL);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* The timer is automagically restarted, when interval != 0 */ | enum hrtimer_restart it_real_fn(struct hrtimer *timer) | /* The timer is automagically restarted, when interval != 0 */
enum hrtimer_restart it_real_fn(struct hrtimer *timer) | {
struct signal_struct *sig =
container_of(timer, struct signal_struct, real_timer);
trace_itimer_expire(ITIMER_REAL, sig->leader_pid, 0);
kill_pid_info(SIGALRM, SEND_SIG_PRIV, sig->leader_pid);
return HRTIMER_NORESTART;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT8 EFIAPI PciExpressBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData) | {
ASSERT_INVALID_PCI_ADDRESS (Address);
if (Address >= PcdPciExpressBaseSize ()) {
return (UINT8)-1;
}
return MmioBitFieldAnd8 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* retrn the IP address of the es module. */ | ES_WIFI_Status_t ES_WIFI_GetIPAddress(ES_WIFIObject_t *Obj, uint8_t *ipaddr) | /* retrn the IP address of the es module. */
ES_WIFI_Status_t ES_WIFI_GetIPAddress(ES_WIFIObject_t *Obj, uint8_t *ipaddr) | {
memcpy(ipaddr, Obj->NetSettings.IP_Addr, 4);
return ES_WIFI_STATUS_OK;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* DAC Channel Trigger Enable.
Enable a digital to analog converter channel external trigger mode. This allows an external trigger to initiate register transfers from the buffer register to the DAC output register, followed by a DMA transfer to the buffer register if DMA is enabled. The trigger source must also be selected. */ | void dac_trigger_enable(uint32_t dac, int channel) | /* DAC Channel Trigger Enable.
Enable a digital to analog converter channel external trigger mode. This allows an external trigger to initiate register transfers from the buffer register to the DAC output register, followed by a DMA transfer to the buffer register if DMA is enabled. The trigger source must also be selected. */
void dac_trigger_enable(uint32_t dac, int channel) | {
switch (channel) {
case DAC_CHANNEL1:
DAC_CR(dac) |= DAC_CR_TEN1;
break;
case DAC_CHANNEL2:
DAC_CR(dac) |= DAC_CR_TEN2;
break;
case DAC_CHANNEL_BOTH:
DAC_CR(dac) |= (DAC_CR_TEN1 | DAC_CR_TEN2);
break;
default:
break;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Called to return the currently running connection state machine end time. Always called when interrupts are disabled. */ | uint32_t ble_ll_conn_get_ce_end_time(void) | /* Called to return the currently running connection state machine end time. Always called when interrupts are disabled. */
uint32_t ble_ll_conn_get_ce_end_time(void) | {
uint32_t ce_end_time;
if (g_ble_ll_conn_cur_sm) {
ce_end_time = g_ble_ll_conn_cur_sm->ce_end_time;
} else {
ce_end_time = os_cputime_get32();
}
return ce_end_time;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Send a SYNCHRONIZE CACHE instruction down to the device through the normal SCSI command structure. Wait for the command to complete. */ | static void sd_shutdown(struct device *) | /* Send a SYNCHRONIZE CACHE instruction down to the device through the normal SCSI command structure. Wait for the command to complete. */
static void sd_shutdown(struct device *) | {
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
if (!sdkp)
return;
if (sdkp->WCE) {
sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
sd_sync_cache(sdkp);
}
if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
sd_start_stop_device(sdkp, 0);
}
scsi_disk_put(sdkp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each init_struct member with its default value. */ | void TIM_ICStructInit(TIM_ICInitTypeDef *init_struct) | /* Fills each init_struct member with its default value. */
void TIM_ICStructInit(TIM_ICInitTypeDef *init_struct) | {
init_struct->TIM_Channel = TIM_Channel_1;
init_struct->TIM_ICPolarity = TIM_ICPolarity_Rising;
init_struct->TIM_ICSelection = TIM_ICSelection_DirectTI;
init_struct->TIM_ICPrescaler = TIM_ICPSC_DIV1;
init_struct->TIM_ICFilter = 0x00;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Converts a Firmware Volume device path structure to its string representative. */ | VOID DevPathToTextFv(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | /* Converts a Firmware Volume device path structure to its string representative. */
VOID DevPathToTextFv(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts) | {
MEDIA_FW_VOL_DEVICE_PATH *Fv;
Fv = DevPath;
UefiDevicePathLibCatPrint (Str, L"Fv(%g)", &Fv->FvName);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The valid interrupt status bits when the USB controller is acting as a device are the following: */ | uint32_t USBLPMIntStatus(uint32_t ui32Base) | /* The valid interrupt status bits when the USB controller is acting as a device are the following: */
uint32_t USBLPMIntStatus(uint32_t ui32Base) | {
ASSERT(ui32Base == USB0_BASE);
return(HWREGB(ui32Base + USB_O_LPMRIS));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* release or recycle an object that the netfs has discarded */ | static void fscache_release_object(struct fscache_object *) | /* release or recycle an object that the netfs has discarded */
static void fscache_release_object(struct fscache_object *) | {
_enter("");
fscache_drop_object(object);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the watch dog timer's function. This function is to Enable the watch dog timer's function such as Interrupt reset. */ | void xWDTFunctionEnable(unsigned long ulBase, unsigned long ulFunction) | /* Enable the watch dog timer's function. This function is to Enable the watch dog timer's function such as Interrupt reset. */
void xWDTFunctionEnable(unsigned long ulBase, unsigned long ulFunction) | {
(void) ulBase;
if(_PreValue == 0)
{
while(1);
}
WDTCfg(ulFunction, _PreValue);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* param base PMU peripheral base address. param name The name of the body bias to be turned on/off, please refer to pmu_body_bias_name_t. param enable Used to turn on/off the specific body bias. */ | void PMU_GetWellBiasDefaultConfig(pmu_well_bias_config_t *config) | /* param base PMU peripheral base address. param name The name of the body bias to be turned on/off, please refer to pmu_body_bias_name_t. param enable Used to turn on/off the specific body bias. */
void PMU_GetWellBiasDefaultConfig(pmu_well_bias_config_t *config) | {
assert(config != NULL);
(void)memset(config, 0, sizeof(*config));
config->wellBiasOption.wellBiasData = 0U;
config->adjustment = kPMU_Cref0fFCspl0fFDeltaC0fF;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* load a patch record: call load_patch callback function */ | int snd_seq_oss_synth_load_patch(struct seq_oss_devinfo *dp, int dev, int fmt, const char __user *buf, int p, int c) | /* load a patch record: call load_patch callback function */
int snd_seq_oss_synth_load_patch(struct seq_oss_devinfo *dp, int dev, int fmt, const char __user *buf, int p, int c) | {
struct seq_oss_synth *rec;
int rc;
if (dev < 0 || dev >= dp->max_synthdev)
return -ENXIO;
if (is_midi_dev(dp, dev))
return 0;
if ((rec = get_synthdev(dp, dev)) == NULL)
return -ENXIO;
if (rec->oper.load_patch == NULL)
rc = -ENXIO;
else
rc = rec->oper.load_patch(&dp->synths[dev].arg, fmt, buf, p, c);
snd_use_lock_free(&rec->use_lock);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Ensables SDIO SD I/O Mode suspend command sending. */ | void SDIO_EnableTxSDIOSuspend(void) | /* Ensables SDIO SD I/O Mode suspend command sending. */
void SDIO_EnableTxSDIOSuspend(void) | {
*(__IO uint32_t *) CMD_SDIOSC_BB = (uint32_t)SET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This is the poor man's way to differentiate between a connection header packet and a message packet. */ | static gboolean is_connection_header(tvbuff_t *tvb, packet_info *pinfo _U_, guint offset) | /* This is the poor man's way to differentiate between a connection header packet and a message packet. */
static gboolean is_connection_header(tvbuff_t *tvb, packet_info *pinfo _U_, guint offset) | {
gboolean is_con_header = FALSE;
guint32 len1 = tvb_get_letohl(tvb, offset);
guint32 len2 = tvb_get_letohl(tvb, offset + SIZE_OF_LENGTH_FIELD);
if( len1 > len2 ) {
is_con_header = TRUE;
}
return is_con_header;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The function sets up the z/VM user ID filter specified as comma-separated list of user IDs in @val. Note: If it is called early in the boot process, @val is stored and parsed later in hvc_iucv_init(). */ | static int param_set_vmidfilter(const char *val, struct kernel_param *kp) | /* The function sets up the z/VM user ID filter specified as comma-separated list of user IDs in @val. Note: If it is called early in the boot process, @val is stored and parsed later in hvc_iucv_init(). */
static int param_set_vmidfilter(const char *val, struct kernel_param *kp) | {
int rc;
if (!MACHINE_IS_VM || !hvc_iucv_devices)
return -ENODEV;
if (!val)
return -EINVAL;
rc = 0;
if (slab_is_available())
rc = hvc_iucv_setup_filter(val);
else
hvc_iucv_filter_string = val;
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Don't call this function unless you are bound to the intf interface or you have locked the device! */ | struct usb_host_virt_interface* usb_altnum_to_altsetting(struct usb_interface *intf, s32 altnum) | /* Don't call this function unless you are bound to the intf interface or you have locked the device! */
struct usb_host_virt_interface* usb_altnum_to_altsetting(struct usb_interface *intf, s32 altnum) | {
int i;
for (i = 0; i < intf->num_altsetting; i++)
{
if (intf->altsetting[i].desc.bAlternateSetting == altnum)
{
return &intf->altsetting[i];
}
}
return NULL;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure EDBG USART for stdio function.
Function Prototypes */ | static void configure_usart(void) | /* Configure EDBG USART for stdio function.
Function Prototypes */
static void configure_usart(void) | {
struct usart_config config_usart;
usart_get_config_defaults(&config_usart);
config_usart.baudrate = 115200;
config_usart.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
config_usart.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
config_usart.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
config_usart.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
config_usart.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
stdio_serial_init(&usart_instance, EDBG_CDC_MODULE, &config_usart);
usart_enable(&usart_instance);
} | memfault/zero-to-main | C++ | null | 200 |
/* there are many ways the trans_start and trans_end ioctls can lead to deadlocks. They should only be used by applications that basically own the machine, and have a very in depth understanding of all the possible deadlocks and enospc problems. */ | long btrfs_ioctl_trans_end(struct file *file) | /* there are many ways the trans_start and trans_end ioctls can lead to deadlocks. They should only be used by applications that basically own the machine, and have a very in depth understanding of all the possible deadlocks and enospc problems. */
long btrfs_ioctl_trans_end(struct file *file) | {
struct inode *inode = fdentry(file)->d_inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
trans = file->private_data;
if (!trans)
return -EINVAL;
file->private_data = NULL;
btrfs_end_transaction(trans, root);
mutex_lock(&root->fs_info->trans_mutex);
root->fs_info->open_ioctl_trans--;
mutex_unlock(&root->fs_info->trans_mutex);
mnt_drop_write(file->f_path.mnt);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets all bits in the bitmap and writes the whole bitmap to stable storage. */ | int drbd_bmio_set_n_write(struct drbd_conf *mdev) | /* Sets all bits in the bitmap and writes the whole bitmap to stable storage. */
int drbd_bmio_set_n_write(struct drbd_conf *mdev) | {
int rv = -EIO;
if (get_ldev_if_state(mdev, D_ATTACHING)) {
drbd_md_set_flag(mdev, MDF_FULL_SYNC);
drbd_md_sync(mdev);
drbd_bm_set_all(mdev);
rv = drbd_bm_write(mdev);
if (!rv) {
drbd_md_clear_flag(mdev, MDF_FULL_SYNC);
drbd_md_sync(mdev);
}
put_ldev(mdev);
}
return rv;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Like @blk_plug_device(), but grabs the queue lock and disables interrupts. */ | void blk_plug_device_unlocked(struct request_queue *q) | /* Description: Like @blk_plug_device(), but grabs the queue lock and disables interrupts. */
void blk_plug_device_unlocked(struct request_queue *q) | {
unsigned long flags;
spin_lock_irqsave(q->queue_lock, flags);
blk_plug_device(q);
spin_unlock_irqrestore(q->queue_lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check if the security bit is set or not. */ | uint32_t flash_is_security_bit_enabled(void) | /* Check if the security bit is set or not. */
uint32_t flash_is_security_bit_enabled(void) | {
return flash_is_gpnvm_set(0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Reads the 8-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, and writes the result to the 8-bit PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI read and write operations are serialized. If any reserved bits in Address are set, then ASSERT(). */ | UINT8 EFIAPI PciSegmentAnd8(IN UINT64 Address, IN UINT8 AndData) | /* Reads the 8-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, and writes the result to the 8-bit PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI read and write operations are serialized. If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentAnd8(IN UINT64 Address, IN UINT8 AndData) | {
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* igb_clean_all_rx_rings - Free Rx Buffers for all queues @adapter: board private structure */ | static void igb_clean_all_rx_rings(struct igb_adapter *) | /* igb_clean_all_rx_rings - Free Rx Buffers for all queues @adapter: board private structure */
static void igb_clean_all_rx_rings(struct igb_adapter *) | {
int i;
for (i = 0; i < adapter->num_rx_queues; i++)
igb_clean_rx_ring(&adapter->rx_ring[i]);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function writes to the SoundScape's control registers, but doesn't do any locking. It's up to the caller to do that. This is why this function is "unsafe" ... */ | static void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsigned char val) | /* This function writes to the SoundScape's control registers, but doesn't do any locking. It's up to the caller to do that. This is why this function is "unsafe" ... */
static void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsigned char val) | {
outb(reg, ODIE_ADDR_IO(io_base));
outb(val, ODIE_DATA_IO(io_base));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If another thread is waiting for us using g_thread_join() then the waiting thread will be woken up and get */ | void g_thread_exit(gpointer retval) | /* If another thread is waiting for us using g_thread_join() then the waiting thread will be woken up and get */
void g_thread_exit(gpointer retval) | {
GRealThread* real = (GRealThread*) g_thread_self ();
if G_UNLIKELY (!real->ours)
g_error ("attempt to g_thread_exit() a thread not created by GLib");
real->retval = retval;
g_system_thread_exit ();
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set derivative constant, Kd, for the PID controller. */ | int32_t cn0415_pid_set_kd(struct cn0415_dev *dev, uint8_t *args) | /* Set derivative constant, Kd, for the PID controller. */
int32_t cn0415_pid_set_kd(struct cn0415_dev *dev, uint8_t *args) | {
float kp, ki, kd;
kd = atof((char *)args);
ki = dev->controller->ki * dev->controller->f_loop;
kp = dev->controller->kp;
pid_set_constants(dev->controller, kp, ki, kd);
dev->param_array[PID_KD_INT] = dev->controller->kd;
dev->param_array[PID_KD_DEC] =
(uint32_t)(dev->controller->kd * 10000) % 10000;
return flash_write(dev->param_array, FLASH_PARAM_SIZE);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This function removes a protection domain to the global protection domain list */ | static void del_domain_from_list(struct protection_domain *domain) | /* This function removes a protection domain to the global protection domain list */
static void del_domain_from_list(struct protection_domain *domain) | {
unsigned long flags;
spin_lock_irqsave(&amd_iommu_pd_lock, flags);
list_del(&domain->list);
spin_unlock_irqrestore(&amd_iommu_pd_lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* adds a new device and register it with virtio appropriate drivers are loaded by the device model */ | static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset) | /* adds a new device and register it with virtio appropriate drivers are loaded by the device model */
static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset) | {
struct kvm_device *kdev;
kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
if (!kdev) {
printk(KERN_EMERG "Cannot allocate kvm dev %u type %u\n",
offset, d->type);
return;
}
kdev->vdev.dev.parent = kvm_root;
kdev->vdev.id.device = d->type;
kdev->vdev.config = &kvm_vq_configspace_ops;
kdev->desc = d;
if (register_virtio_device(&kdev->vdev) != 0) {
printk(KERN_ERR "Failed to register kvm device %u type %u\n",
offset, d->type);
kfree(kdev);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */ | int main(void) | /* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
int main(void) | {
Init();
SharedParamsInit();
NetInit();
BootComInit();
SharedParamsWriteByIndex(0, 0);
while (1)
{
LedToggle();
NetTask();
BootComCheckActivationRequest();
}
return 0;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Set one bit of the runtime register while keeping other bits. */ | VOID XhcSetRuntimeRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit) | /* Set one bit of the runtime register while keeping other bits. */
VOID XhcSetRuntimeRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit) | {
UINT32 Data;
Data = XhcReadRuntimeReg (Xhc, Offset);
Data |= Bit;
XhcWriteRuntimeReg (Xhc, Offset, Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Free an existing event channel. Returns 0 on success or -errno on error. */ | int xenbus_free_evtchn(struct xenbus_device *dev, int port) | /* Free an existing event channel. Returns 0 on success or -errno on error. */
int xenbus_free_evtchn(struct xenbus_device *dev, int port) | {
struct evtchn_close close;
int err;
close.port = port;
err = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
if (err)
xenbus_dev_error(dev, err, "freeing event channel %d", port);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the input or output data address specified in the tcw depending on whether the r-bit or the w-bit is set. If neither bit is set, return NULL. */ | void* tcw_get_data(struct tcw *tcw) | /* Return the input or output data address specified in the tcw depending on whether the r-bit or the w-bit is set. If neither bit is set, return NULL. */
void* tcw_get_data(struct tcw *tcw) | {
if (tcw->r)
return (void *) ((addr_t) tcw->input);
if (tcw->w)
return (void *) ((addr_t) tcw->output);
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for waiting for events.
This function will place the chip in low power mode while waiting for events from the SoftDevice or other peripherals. When interrupted by an event, it will call the app_sched_execute function to process the received event. This function will return when the final state of the firmware update is reached OR when a tear down is in progress. */ | static void wait_for_events(void) | /* Function for waiting for events.
This function will place the chip in low power mode while waiting for events from the SoftDevice or other peripherals. When interrupted by an event, it will call the app_sched_execute function to process the received event. This function will return when the final state of the firmware update is reached OR when a tear down is in progress. */
static void wait_for_events(void) | {
for (;;)
{
uint32_t err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
app_sched_execute();
if ((m_update_status == BOOTLOADER_COMPLETE) ||
(m_update_status == BOOTLOADER_TIMEOUT) ||
(m_update_status == BOOTLOADER_RESET))
{
return;
}
}
} | labapart/polymcu | C++ | null | 201 |
/* Disable rng interrupt. The random number generator interrupt is disabled. */ | void rng_disable_interrupt(void) | /* Disable rng interrupt. The random number generator interrupt is disabled. */
void rng_disable_interrupt(void) | {
RNG_CR &= ~RNG_CR_IE;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* TIM_PWM MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim_pwm) | /* TIM_PWM MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim_pwm) | {
if(htim_pwm->Instance==TIM1)
{
__HAL_RCC_TIM1_CLK_DISABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* vpfe_get_subdev_input_index - Get subdev index and subdev input index for a given app input index */ | static int vpfe_get_subdev_input_index(struct vpfe_device *vpfe_dev, int *subdev_index, int *subdev_input_index, int app_input_index) | /* vpfe_get_subdev_input_index - Get subdev index and subdev input index for a given app input index */
static int vpfe_get_subdev_input_index(struct vpfe_device *vpfe_dev, int *subdev_index, int *subdev_input_index, int app_input_index) | {
struct vpfe_config *cfg = vpfe_dev->cfg;
struct vpfe_subdev_info *sdinfo;
int i, j = 0;
for (i = 0; i < cfg->num_subdevs; i++) {
sdinfo = &cfg->sub_devs[i];
if (app_input_index < (j + sdinfo->num_inputs)) {
*subdev_index = i;
*subdev_input_index = app_input_index - j;
return 0;
}
j += sdinfo->num_inputs;
}
return -EINVAL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | /* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
__HAL_RCC_RTC_ENABLE();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* sn udelay uses the RTC instead of the ITC because the ITC is not synchronized across all CPUs, and the thread may migrate to another CPU if preemption is enabled. */ | static void ia64_sn_udelay(unsigned long usecs) | /* sn udelay uses the RTC instead of the ITC because the ITC is not synchronized across all CPUs, and the thread may migrate to another CPU if preemption is enabled. */
static void ia64_sn_udelay(unsigned long usecs) | {
unsigned long start = rtc_time();
unsigned long end = start +
usecs * sn_rtc_cycles_per_second / 1000000;
while (time_before((unsigned long)rtc_time(), end))
cpu_relax();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: %1 if the device represents a SAS PHY, %0 else */ | int scsi_is_sas_phy(const struct device *dev) | /* Returns: %1 if the device represents a SAS PHY, %0 else */
int scsi_is_sas_phy(const struct device *dev) | {
return dev->release == sas_phy_release;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Accelerometer full-scale management between UI chain and OIS chain. When XL UI is on, the full scale is the same between UI/OIS and is chosen by the UI CTRL registers; when XL UI is in PD, the OIS can choose the FS. Full scales are independent between the UI/OIS chain but both bound to 8 g.. */ | int32_t lsm6dso_aux_xl_fs_mode_get(stmdev_ctx_t *ctx, lsm6dso_xl_fs_mode_t *val) | /* Accelerometer full-scale management between UI chain and OIS chain. When XL UI is on, the full scale is the same between UI/OIS and is chosen by the UI CTRL registers; when XL UI is in PD, the OIS can choose the FS. Full scales are independent between the UI/OIS chain but both bound to 8 g.. */
int32_t lsm6dso_aux_xl_fs_mode_get(stmdev_ctx_t *ctx, lsm6dso_xl_fs_mode_t *val) | {
lsm6dso_ctrl8_xl_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t *)®, 1);
switch (reg.xl_fs_mode) {
case LSM6DSO_USE_SAME_XL_FS:
*val = LSM6DSO_USE_SAME_XL_FS;
break;
case LSM6DSO_USE_DIFFERENT_XL_FS:
*val = LSM6DSO_USE_DIFFERENT_XL_FS;
break;
default:
*val = LSM6DSO_USE_SAME_XL_FS;
break;
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Timeout should work the same for blocking & non-blocking threads */ | static void test_socketpair_poll_timeout_common(struct net_socketpair_fixture *fixture) | /* Timeout should work the same for blocking & non-blocking threads */
static void test_socketpair_poll_timeout_common(struct net_socketpair_fixture *fixture) | {
int res;
struct pollfd fds[1];
memset(fds, 0, sizeof(fds));
fds[0].fd = fixture->sv[0];
fds[0].events |= POLLIN;
res = poll(fds, 1, 1);
zassert_equal(res, 0, "poll: expected: 0 actual: %d", res);
for (size_t i = 0; i < CONFIG_NET_SOCKETPAIR_BUFFER_SIZE; ++i) {
res = send(fixture->sv[0], "x", 1, 0);
zassert_equal(res, 1, "send() failed: %d", res);
}
memset(fds, 0, sizeof(fds));
fds[0].fd = fixture->sv[0];
fds[0].events |= POLLOUT;
res = poll(fds, 1, 1);
zassert_equal(res, 0, "poll: expected: 0 actual: %d", res);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Send SET_BLOCK_SIZE command to set the block length in bytes for MMC cards. */ | static status_t MMC_SetBlockSize(mmc_card_t *card, uint32_t blockSize) | /* Send SET_BLOCK_SIZE command to set the block length in bytes for MMC cards. */
static status_t MMC_SetBlockSize(mmc_card_t *card, uint32_t blockSize) | {
assert(card);
return SDMMC_SetBlockSize(card->host.base, card->host.transfer, blockSize);
} | labapart/polymcu | C++ | null | 201 |
/* return The SEMC clock frequency value in hertz. */ | uint32_t CLOCK_GetSemcFreq(void) | /* return The SEMC clock frequency value in hertz. */
uint32_t CLOCK_GetSemcFreq(void) | {
uint32_t freq;
if (CCM->CBCDR & CCM_CBCDR_SEMC_CLK_SEL_MASK)
{
if (CCM->CBCDR & CCM_CBCDR_SEMC_ALT_CLK_SEL_MASK)
{
freq = CLOCK_GetUsb1PfdFreq(kCLOCK_Pfd1);
}
else
{
freq = CLOCK_GetSysPfdFreq(kCLOCK_Pfd2);
}
}
else
{
freq = CLOCK_GetPeriphClkFreq();
}
freq /= (((CCM->CBCDR & CCM_CBCDR_SEMC_PODF_MASK) >> CCM_CBCDR_SEMC_PODF_SHIFT) + 1U);
return freq;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* This service enables PEIMs to register a given service to be invoked when another service is installed or reinstalled. */ | EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList) | /* This service enables PEIMs to register a given service to be invoked when another service is installed or reinstalled. */
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList) | {
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Caution: This function may receive untrusted input. So this function will do basic check for PKCS#7 data structure. */ | BOOLEAN EFIAPI Pkcs7GetAttachedContent(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT VOID **Content, OUT UINTN *ContentSize) | /* Caution: This function may receive untrusted input. So this function will do basic check for PKCS#7 data structure. */
BOOLEAN EFIAPI Pkcs7GetAttachedContent(IN CONST UINT8 *P7Data, IN UINTN P7Length, OUT VOID **Content, OUT UINTN *ContentSize) | {
CALL_CRYPTO_SERVICE (Pkcs7GetAttachedContent, (P7Data, P7Length, Content, ContentSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Ethernet initialisations Disk On Chip (NAND) Millenium initialization. The NAND lives in the CS2* space */ | int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | /* Ethernet initialisations Disk On Chip (NAND) Millenium initialization. The NAND lives in the CS2* space */
int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | {
int rcode = 0;
ulong side;
ulong bright;
switch (argc) {
case 3:
side = simple_strtoul(argv[1], NULL, 10);
bright = simple_strtoul(argv[2], NULL, 10);
if ((side >= 0) && (side <= 3) &&
(bright >= 0) && (bright <= 1000)) {
vcxk_setbrightness(side, bright);
rcode = 0;
} else {
printf("parameters out of range\n");
printf("Usage:\n%s\n", cmdtp->usage);
rcode = 1;
}
break;
default:
printf("Usage:\n%s\n", cmdtp->usage);
rcode = 1;
break;
}
return rcode;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This API is used to get the gyro bandwidth in the register 0x10 bits from 0 to 3. */ | BMG160_RETURN_FUNCTION_TYPE bmg160_get_bw(u8 *v_bw_u8) | /* This API is used to get the gyro bandwidth in the register 0x10 bits from 0 to 3. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_bw(u8 *v_bw_u8) | {
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC
(p_bmg160->dev_addr, BMG160_BW_ADDR__REG,
&v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH);
*v_bw_u8 = BMG160_GET_BITSLICE(v_data_u8,
BMG160_BW_ADDR);
}
return comres;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called in order to decode the GetAlertsRespose payload */ | static void dissect_zcl_appl_evtalt_get_alerts_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset) | /* This function is called in order to decode the GetAlertsRespose payload */
static void dissect_zcl_appl_evtalt_get_alerts_rsp(tvbuff_t *tvb, proto_tree *tree, guint *offset) | {
proto_tree *sub_tree = NULL;
guint i;
guint8 count;
count = tvb_get_guint8(tvb, *offset) & ZBEE_ZCL_APPL_EVTALT_COUNT_NUM_MASK;
proto_tree_add_item(tree, hf_zbee_zcl_appl_evtalt_count_num, tvb, *offset, 1, ENC_NA);
proto_tree_add_item(tree, hf_zbee_zcl_appl_evtalt_count_type, tvb, *offset, 1, ENC_NA);
*offset += 1;
for ( i=0 ; i<count ; i++)
{
sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1,
ett_zbee_zcl_appl_evtalt_alerts_struct[i], NULL, "Alerts Structure #%u", i);
dissect_zcl_appl_evtalt_alerts_struct(tvb, sub_tree, offset);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The caller must do a scsi_host_put() to drop the reference that scsi_host_get() took. The put_device() below dropped the reference from class_find_device(). */ | struct Scsi_Host* scsi_host_lookup(unsigned short hostnum) | /* The caller must do a scsi_host_put() to drop the reference that scsi_host_get() took. The put_device() below dropped the reference from class_find_device(). */
struct Scsi_Host* scsi_host_lookup(unsigned short hostnum) | {
struct device *cdev;
struct Scsi_Host *shost = NULL;
cdev = class_find_device(&shost_class, NULL, &hostnum,
__scsi_host_match);
if (cdev) {
shost = scsi_host_get(class_to_shost(cdev));
put_device(cdev);
}
return shost;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* returns false if we run out of data buffer */ | static int ike_show_somedata(netdissect_options *ndo, const u_char *cp, const u_char *ep) | /* returns false if we run out of data buffer */
static int ike_show_somedata(netdissect_options *ndo, const u_char *cp, const u_char *ep) | {
const u_char *end = ep - 20;
int elen = 20;
int len = ep - cp;
if(len > 10) {
len = 10;
}
if(end < cp + len) {
end = cp+len;
elen = ep - end;
}
ND_PRINT((ndo," data=("));
if(!rawprint(ndo, (const uint8_t *)(cp), len)) goto trunc;
ND_PRINT((ndo, "..."));
if(elen) {
if(!rawprint(ndo, (const uint8_t *)(end), elen)) goto trunc;
}
ND_PRINT((ndo,")"));
return 1;
trunc:
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If the create succeeds, we fill in the inode information with d_instantiate(). */ | static int ufs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | /* If the create succeeds, we fill in the inode information with d_instantiate(). */
static int ufs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | {
struct inode *inode;
int err;
UFSD("BEGIN\n");
inode = ufs_new_inode(dir, mode);
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
inode->i_op = &ufs_file_inode_operations;
inode->i_fop = &ufs_file_operations;
inode->i_mapping->a_ops = &ufs_aops;
mark_inode_dirty(inode);
lock_kernel();
err = ufs_add_nondir(dentry, inode);
unlock_kernel();
}
UFSD("END: err=%d\n", err);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* These are for backward compatibility with the rest of the kernel source. */ | int send_sig_info(int sig, struct siginfo *info, struct task_struct *p) | /* These are for backward compatibility with the rest of the kernel source. */
int send_sig_info(int sig, struct siginfo *info, struct task_struct *p) | {
if (!valid_signal(sig))
return -EINVAL;
return do_send_sig_info(sig, info, p, false);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. CHIP_EN and RESET_N are actually already set low by nm_bsp_init or */ | nm_bsp_reset(void) | /* Reset NMC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. CHIP_EN and RESET_N are actually already set low by nm_bsp_init or */
nm_bsp_reset(void) | {
port_pin_set_output_level(CONF_WINC_PIN_CHIP_ENABLE, true);
nm_bsp_sleep(5);
port_pin_set_output_level(CONF_WINC_PIN_RESET, true);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The default values are: code config->mode = kCTIMER_TimerMode; config->input = kCTIMER_Capture_0; config->prescale = 0; endcode param config Pointer to the user configuration structure. */ | void CTIMER_GetDefaultConfig(ctimer_config_t *config) | /* The default values are: code config->mode = kCTIMER_TimerMode; config->input = kCTIMER_Capture_0; config->prescale = 0; endcode param config Pointer to the user configuration structure. */
void CTIMER_GetDefaultConfig(ctimer_config_t *config) | {
assert(config != NULL);
(void)memset(config, 0, sizeof(*config));
config->mode = kCTIMER_TimerMode;
config->input = kCTIMER_Capture_0;
config->prescale = 0;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.