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 |
|---|---|---|---|---|---|---|---|
/* If DhContext is NULL, then return FALSE. If PeerPublicKey is NULL, then return FALSE. If KeySize is NULL, then return FALSE. If Key is NULL, then return FALSE. If KeySize is not large enough, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI DhComputeKey(IN OUT VOID *DhContext, IN CONST UINT8 *PeerPublicKey, IN UINTN PeerPublicKeySize, OUT UINT8 *Key, IN OUT UINTN *KeySize) | /* If DhContext is NULL, then return FALSE. If PeerPublicKey is NULL, then return FALSE. If KeySize is NULL, then return FALSE. If Key is NULL, then return FALSE. If KeySize is not large enough, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI DhComputeKey(IN OUT VOID *DhContext, IN CONST UINT8 *PeerPublicKey, IN UINTN PeerPublicKeySize, OUT UINT8 *Key, IN OUT UINTN *KeySize) | {
CALL_CRYPTO_SERVICE (DhComputeKey, (DhContext, PeerPublicKey, PeerPublicKeySize, Key, KeySize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Insert a new entry after the specified head. This is good for implementing stacks. */ | void llist_add(llist_head *p, llist_head *head) | /* Insert a new entry after the specified head. This is good for implementing stacks. */
void llist_add(llist_head *p, llist_head *head) | {
__llist_add(p, head, head->next);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* kfifo_free - frees the FIFO internal buffer @fifo: the fifo to be freed. */ | void kfifo_free(struct kfifo *fifo) | /* kfifo_free - frees the FIFO internal buffer @fifo: the fifo to be freed. */
void kfifo_free(struct kfifo *fifo) | {
kfree(fifo->buffer);
_kfifo_init(fifo, NULL, 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* mapping structures to memory with some minimal checks */ | unsigned* hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh) | /* mapping structures to memory with some minimal checks */
unsigned* hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh) | {
return hpfs_map_4sectors(s, hpfs_sb(s)->sb_dmap, qbh, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SPI Data Write with Blocking.
Data is written to the SPI interface after the previous write transfer has finished. */ | void spi_send(uint32_t spi, uint16_t data) | /* SPI Data Write with Blocking.
Data is written to the SPI interface after the previous write transfer has finished. */
void spi_send(uint32_t spi, uint16_t data) | {
while (!(SPI_SR(spi) & SPI_SR_TXE));
SPI_DR(spi) = data;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Check for the present of 450NX errata #19 and errata #25. If they are found, disable use of DMA IDE */ | static void __devinit piix_check_450nx(void) | /* Check for the present of 450NX errata #19 and errata #25. If they are found, disable use of DMA IDE */
static void __devinit piix_check_450nx(void) | {
struct pci_dev *pdev = NULL;
u16 cfg;
while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
{
pci_read_config_word(pdev, 0x41, &cfg);
if (pdev->revision == 0x00)
no_piix_dma = 1;
else if (cfg & (1<<14) && pdev->revision < 5)
no_piix_dma = 2;
}
if(no_piix_dma)
printk(KERN_WARNING DRV_NAME ": 450NX errata present, disabling IDE DMA.\n");
if(no_piix_dma == 2)
printk(KERN_WARNING DRV_NAME ": A BIOS update may resolve this.\n");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ONLY when the feature before(or after) the find feature also has dependence with the find feature. In this case, driver need to base on dependce relationship to decide how to insert current feature and adjust the feature dependence. */ | BOOLEAN AdjustFeaturesDependence(IN OUT CPU_FEATURES_ENTRY *PreviousFeature, IN OUT CPU_FEATURES_ENTRY *CurrentFeature, IN CPU_FEATURES_ENTRY *FindFeature, IN BOOLEAN Before) | /* ONLY when the feature before(or after) the find feature also has dependence with the find feature. In this case, driver need to base on dependce relationship to decide how to insert current feature and adjust the feature dependence. */
BOOLEAN AdjustFeaturesDependence(IN OUT CPU_FEATURES_ENTRY *PreviousFeature, IN OUT CPU_FEATURES_ENTRY *CurrentFeature, IN CPU_FEATURES_ENTRY *FindFeature, IN BOOLEAN Before) | {
CPU_FEATURE_DEPENDENCE_TYPE PreDependType;
CPU_FEATURE_DEPENDENCE_TYPE CurrentDependType;
PreDependType = DetectFeatureScope (PreviousFeature, Before, FindFeature->FeatureMask);
CurrentDependType = DetectFeatureScope (CurrentFeature, Before, FindFeature->FeatureMask);
if (PreDependType == NoneDepType) {
return FALSE;
}
if (PreDependType >= CurrentDependType) {
return TRUE;
} else {
return FALSE;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the ADCx conversion through external trigger. */ | void ADC_EnableExternalTrigConv(ADC_Module *ADCx, FunctionalState Cmd) | /* Enables or disables the ADCx conversion through external trigger. */
void ADC_EnableExternalTrigConv(ADC_Module *ADCx, FunctionalState Cmd) | {
assert_param(IsAdcModule(ADCx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
ADCx->CTRL2 |= CTRL2_EXT_TRIG_SET;
}
else
{
ADCx->CTRL2 &= CTRL2_EXT_TRIG_RESET;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Function for checking if an address is non-zero. Used to determine if. */ | static bool peer_address_exists(uint8_t const *address) | /* Function for checking if an address is non-zero. Used to determine if. */
static bool peer_address_exists(uint8_t const *address) | {
uint32_t i;
for (i = 0; i < BLE_GAP_ADDR_LEN; i++)
{
if (address[i] != 0)
{
return true;
}
}
return false;
} | labapart/polymcu | C++ | null | 201 |
/* bad_rw_intr() now tries to be a bit smarter and does things according to the error returned by the controller. -Mika Liljeberg ( */ | static void bad_rw_intr(void) | /* bad_rw_intr() now tries to be a bit smarter and does things according to the error returned by the controller. -Mika Liljeberg ( */
static void bad_rw_intr(void) | {
struct request *req = hd_req;
if (req != NULL) {
struct hd_i_struct *disk = req->rq_disk->private_data;
if (++req->errors >= MAX_ERRORS || (hd_error & BBD_ERR)) {
hd_end_request_cur(-EIO);
disk->special_op = disk->recalibrate = 1;
} else if (req->errors % RESET_FREQ == 0)
reset = 1;
else if ((hd_error & TRK0_ERR) || req->errors % RECAL_FREQ == 0)
disk->special_op = disk->recalibrate = 1;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* dissect_knet_sctp is the dissector which is called by Wireshark when kNet STCP packets are captured. */ | static int dissect_knet_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) | /* dissect_knet_sctp is the dissector which is called by Wireshark when kNet STCP packets are captured. */
static int dissect_knet_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) | {
col_clear(pinfo->cinfo, COL_INFO);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "KNET");
dissect_knet(tvb, pinfo, tree, KNET_SCTP_PACKET);
return tvb_captured_length(tvb);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Add the resolved addresses that are in use to the list used to create the NRB */ | static void ipv6_hash_table_resolved_to_list(gpointer key _U_, gpointer value, gpointer user_data) | /* Add the resolved addresses that are in use to the list used to create the NRB */
static void ipv6_hash_table_resolved_to_list(gpointer key _U_, gpointer value, gpointer user_data) | {
addrinfo_lists_t *lists = (addrinfo_lists_t*)user_data;
hashipv6_t *ipv6_hash_table_entry = (hashipv6_t *)value;
if ((ipv6_hash_table_entry->flags & USED_AND_RESOLVED_MASK) == RESOLVED_ADDRESS_USED) {
lists->ipv6_addr_list = g_list_prepend (lists->ipv6_addr_list, ipv6_hash_table_entry);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Change Logs: Date Author Notes Bernard first version from QiuYi implementation */ | void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) | /* Change Logs: Date Author Notes Bernard first version from QiuYi implementation */
void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) | {
int i = 0, j =0;
RT_ASSERT(addr);
addr = addr & ~0xF;
size = 4*((size + 3)/4);
while(i < size)
{
rt_kprintf("0x%08x: ", addr );
for(j=0; j<4; j++)
{
rt_kprintf("0x%08x ", *(rt_uint32_t *)addr);
addr += 4;
i++;
}
rt_kprintf("\n");
}
return;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* leb_read_unlock - unlock logical eraseblock. @ubi: UBI device description object @vol_id: volume ID @lnum: logical eraseblock number */ | static void leb_read_unlock(struct ubi_device *ubi, int vol_id, int lnum) | /* leb_read_unlock - unlock logical eraseblock. @ubi: UBI device description object @vol_id: volume ID @lnum: logical eraseblock number */
static void leb_read_unlock(struct ubi_device *ubi, int vol_id, int lnum) | {
struct ubi_ltree_entry *le;
spin_lock(&ubi->ltree_lock);
le = ltree_lookup(ubi, vol_id, lnum);
le->users -= 1;
ubi_assert(le->users >= 0);
up_read(&le->mutex);
if (le->users == 0) {
rb_erase(&le->rb, &ubi->ltree);
kfree(le);
}
spin_unlock(&ubi->ltree_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note, the pointer to be destroyed must have been created with a call to class_create(). */ | void class_destroy(struct class *cls) | /* Note, the pointer to be destroyed must have been created with a call to class_create(). */
void class_destroy(struct class *cls) | {
if ((cls == NULL) || (IS_ERR(cls)))
return;
class_unregister(cls);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SPDIF base pointer. param handle SPDIF eDMA handle pointer. */ | void SPDIF_TransferAbortSendEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle) | /* param base SPDIF base pointer. param handle SPDIF eDMA handle pointer. */
void SPDIF_TransferAbortSendEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle) | {
assert(handle);
EDMA_AbortTransfer(handle->dmaLeftHandle);
EDMA_AbortTransfer(handle->dmaRightHandle);
SPDIF_EnableDMA(base, kSPDIF_TxDMAEnable, false);
memset(handle->spdifQueue, 0U, sizeof(handle->spdifQueue));
memset(handle->transferSize, 0U, sizeof(handle->transferSize));
handle->queueUser = 0U;
handle->queueDriver = 0U;
handle->state = kSPDIF_Idle;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Output: void, but we will add to proto tree if !NULL. */ | static void dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length) | /* Output: void, but we will add to proto tree if !NULL. */
static void dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length) | {
dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
length, id_length, TRUE, FALSE);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* ASUS P55T2P4D with CMD646 chipset revision 0x01 requires the old event order for DMA transfers. */ | static int cmd646_1_dma_end(ide_drive_t *drive) | /* ASUS P55T2P4D with CMD646 chipset revision 0x01 requires the old event order for DMA transfers. */
static int cmd646_1_dma_end(ide_drive_t *drive) | {
ide_hwif_t *hwif = drive->hwif;
u8 dma_stat = 0, dma_cmd = 0;
dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
return (dma_stat & 7) != 4;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified LPUART interrupt has occurred or not. */ | INTStatus LPUART_GetIntStatus(uint16_t LPUART_INT) | /* Checks whether the specified LPUART interrupt has occurred or not. */
INTStatus LPUART_GetIntStatus(uint16_t LPUART_INT) | {
uint32_t bitpos = 0x00, itmask = 0x00;
INTStatus bitstatus = RESET;
assert_param(IS_LPUART_GET_INT(LPUART_INT));
itmask = (uint8_t)(LPUART_INT >> 0x08) & INT_MASK;
itmask = (uint32_t)0x01 << itmask;
itmask &= LPUART->INTEN;
bitpos = ((uint8_t)LPUART_INT) & 0xFF;
bitpos &= LPUART->STS;
if ((itmask != (uint16_t)RESET) && (bitpos != (uint16_t)RESET))
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Process ethtool command such as "ehtool -i" to show information */ | static void sis900_get_drvinfo(struct net_device *net_dev, struct ethtool_drvinfo *info) | /* Process ethtool command such as "ehtool -i" to show information */
static void sis900_get_drvinfo(struct net_device *net_dev, struct ethtool_drvinfo *info) | {
struct sis900_private *sis_priv = netdev_priv(net_dev);
strcpy (info->driver, SIS900_MODULE_NAME);
strcpy (info->version, SIS900_DRV_VERSION);
strcpy (info->bus_info, pci_name(sis_priv->pci_dev));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If 8-bit MMIO register operations are not supported, 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(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT8 EFIAPI MmioBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData) | /* If 8-bit MMIO register operations are not supported, 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(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI MmioBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData) | {
return MmioWrite8 (
Address,
BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The name of a WSS may not be null teminated. It's max size is 64 bytes so we copy it to a larger array just to make sure we print sane data. */ | static ssize_t wlp_wss_properties_show(struct wlp_wss *wss, char *buf) | /* The name of a WSS may not be null teminated. It's max size is 64 bytes so we copy it to a larger array just to make sure we print sane data. */
static ssize_t wlp_wss_properties_show(struct wlp_wss *wss, char *buf) | {
int result = 0;
if (mutex_lock_interruptible(&wss->mutex))
goto out;
result = __wlp_wss_properties_show(wss, buf, PAGE_SIZE);
mutex_unlock(&wss->mutex);
out:
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciExpressRead16(IN UINTN Address) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciExpressRead16(IN UINTN Address) | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT16)-1;
}
return MmioRead16 (GetPciExpressAddress (Address));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* tracing_is_on - show state of ring buffers enabled */ | int tracing_is_on(void) | /* tracing_is_on - show state of ring buffers enabled */
int tracing_is_on(void) | {
return ring_buffer_flags == RB_BUFFERS_ON;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* DCMI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef *hdcmi) | /* DCMI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef *hdcmi) | {
if(hdcmi->Instance==DCMI)
{
__HAL_RCC_DCMI_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOH, DCMI_D4_Pin|DCMI_D3_Pin|DCMI_D0_Pin|DCMI_PIXCK_Pin
|DCMI_D1_Pin|DCMI_D2_Pin|DCMI_HSYNC_Pin);
HAL_GPIO_DeInit(GPIOI, DCMI_D7_Pin|DCMI_D5_Pin|DCMI_VSYNC_Pin);
HAL_GPIO_DeInit(DCMI_D6_GPIO_Port, DCMI_D6_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Description: get eink panel type, for example, 3 stands for ED060XC3(4-bit), 4 stands for ED060XD4(5-bit) Input: None Output: type */ | int get_eink_panel_type(EINK_PANEL_TYPE *type) | /* Description: get eink panel type, for example, 3 stands for ED060XC3(4-bit), 4 stands for ED060XD4(5-bit) Input: None Output: type */
int get_eink_panel_type(EINK_PANEL_TYPE *type) | {
if (g_waveform_file.load_flag != 1) {
WF_ERR("waveform hasn't init yet, pls init first\n");
return -EAGAIN;
}
if (type == NULL) {
WF_ERR("input param is null\n");
return -EINVAL;
}
*type = g_waveform_file.eink_panel_type;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* return Mask value for the asserted flags. See "_cmp_status_flags". */ | uint32_t CMP_GetStatusFlags(CMP_Type *base) | /* return Mask value for the asserted flags. See "_cmp_status_flags". */
uint32_t CMP_GetStatusFlags(CMP_Type *base) | {
uint32_t ret32 = 0U;
if (0U != (CMP_SCR_CFR_MASK & base->SCR))
{
ret32 |= kCMP_OutputRisingEventFlag;
}
if (0U != (CMP_SCR_CFF_MASK & base->SCR))
{
ret32 |= kCMP_OutputFallingEventFlag;
}
if (0U != (CMP_SCR_COUT_MASK & base->SCR))
{
ret32 |= kCMP_OutputAssertEventFlag;
}
return ret32;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Poll gameport; return true if all bits set in 'onbits' are on and all bits set in 'offbits' are off. */ | static int poll_until(u8 onbits, u8 offbits, int u_sec, struct gameport *gp, u8 *data) | /* Poll gameport; return true if all bits set in 'onbits' are on and all bits set in 'offbits' are off. */
static int poll_until(u8 onbits, u8 offbits, int u_sec, struct gameport *gp, u8 *data) | {
int i, nloops;
nloops = gameport_time(gp, u_sec);
for (i = 0; i < nloops; i++) {
*data = gameport_read(gp);
if ((*data & onbits) == onbits &&
(~(*data) & offbits) == offbits)
return 1;
}
dbg("gameport timed out after %d microseconds.\n", u_sec);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* dccp_feat_push_change - Add/overwrite a Change option in the list @fn_list: feature-negotiation list to update @feat: one of dccp_feature_numbers @local: whether local (1) or remote (0) @feat_num is meant @needs_mandatory: whether to use Mandatory feature negotiation options @fval: pointer to NN/SP value to be inserted (will be copied) */ | static int dccp_feat_push_change(struct list_head *fn_list, u8 feat, u8 local, u8 mandatory, dccp_feat_val *fval) | /* dccp_feat_push_change - Add/overwrite a Change option in the list @fn_list: feature-negotiation list to update @feat: one of dccp_feature_numbers @local: whether local (1) or remote (0) @feat_num is meant @needs_mandatory: whether to use Mandatory feature negotiation options @fval: pointer to NN/SP value to be inserted (will be copied) */
static int dccp_feat_push_change(struct list_head *fn_list, u8 feat, u8 local, u8 mandatory, dccp_feat_val *fval) | {
struct dccp_feat_entry *new = dccp_feat_entry_new(fn_list, feat, local);
if (new == NULL)
return -ENOMEM;
new->feat_num = feat;
new->is_local = local;
new->state = FEAT_INITIALISING;
new->needs_confirm = 0;
new->empty_confirm = 0;
new->val = *fval;
new->needs_mandatory = mandatory;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Split one subband into 2 subsubbands with a symmetric real filter. The filter must have its non-center even coefficients equal to zero. */ | static void hybrid2_re(float(*in)[2], float(*out)[32][2], const float filter[7], int len, int reverse) | /* Split one subband into 2 subsubbands with a symmetric real filter. The filter must have its non-center even coefficients equal to zero. */
static void hybrid2_re(float(*in)[2], float(*out)[32][2], const float filter[7], int len, int reverse) | {
int i, j;
for (i = 0; i < len; i++, in++) {
float re_in = filter[6] * in[6][0];
float re_op = 0.0f;
float im_in = filter[6] * in[6][1];
float im_op = 0.0f;
for (j = 0; j < 6; j += 2) {
re_op += filter[j+1] * (in[j+1][0] + in[12-j-1][0]);
im_op += filter[j+1] * (in[j+1][1] + in[12-j-1][1]);
}
out[ reverse][i][0] = re_in + re_op;
out[ reverse][i][1] = im_in + im_op;
out[!reverse][i][0] = re_in - re_op;
out[!reverse][i][1] = im_in - im_op;
}
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* This function is only for Micron 128MB flash to read from Extended Address Register, which shows the current segment. Please refer to flash datasheet for more information about memory mapping. */ | int flash_get_extend_addr(flash_t *obj) | /* This function is only for Micron 128MB flash to read from Extended Address Register, which shows the current segment. Please refer to flash datasheet for more information about memory mapping. */
int flash_get_extend_addr(flash_t *obj) | {
( void ) obj;
u8 temp = 0;
FLASH_Write_Lock();
FLASH_RxCmd(0xC8, 1, &temp);
FLASH_Write_Unlock();
return temp;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Flush all the entries of the specified table. */ | static void ip_vs_lblcr_flush(struct ip_vs_lblcr_table *tbl) | /* Flush all the entries of the specified table. */
static void ip_vs_lblcr_flush(struct ip_vs_lblcr_table *tbl) | {
int i;
struct ip_vs_lblcr_entry *en, *nxt;
for (i=0; i<IP_VS_LBLCR_TAB_SIZE; i++) {
list_for_each_entry_safe(en, nxt, &tbl->bucket[i], list) {
ip_vs_lblcr_free(en);
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* USBH_MSC_IsReady The function check if the MSC function is ready. */ | uint8_t USBH_MSC_IsReady(USBH_HandleTypeDef *phost) | /* USBH_MSC_IsReady The function check if the MSC function is ready. */
uint8_t USBH_MSC_IsReady(USBH_HandleTypeDef *phost) | {
MSC_HandleTypeDef *MSC_Handle = phost->pActiveClass->pData;
if(phost->gState == HOST_CLASS)
{
return (MSC_Handle->state == MSC_IDLE);
}
else
{
return 0;
}
} | micropython/micropython | C++ | Other | 18,334 |
/* This is an example for clearing the interrupt flag. code WDOG_ClearStatusFlags(wdog_base,KWDOG_InterruptFlag); endcode param base WDOG peripheral base address param mask The status flags to clear. The parameter could be any combination of the following values. kWDOG_TimeoutFlag */ | void WDOG_ClearInterruptStatus(WDOG_Type *base, uint16_t mask) | /* This is an example for clearing the interrupt flag. code WDOG_ClearStatusFlags(wdog_base,KWDOG_InterruptFlag); endcode param base WDOG peripheral base address param mask The status flags to clear. The parameter could be any combination of the following values. kWDOG_TimeoutFlag */
void WDOG_ClearInterruptStatus(WDOG_Type *base, uint16_t mask) | {
if (mask & kWDOG_InterruptFlag)
{
base->WICR |= WDOG_WICR_WTIS_MASK;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Add a mac address to the device blacklist. */ | sl_status_t sl_wfx_add_blacklist_address(const sl_wfx_mac_address_t *mac_address) | /* Add a mac address to the device blacklist. */
sl_status_t sl_wfx_add_blacklist_address(const sl_wfx_mac_address_t *mac_address) | {
sl_wfx_add_blacklist_addr_req_body_t payload;
memcpy(payload.mac, &mac_address->octet, sizeof(payload.mac));
return sl_wfx_send_command(SL_WFX_ADD_BLACKLIST_ADDR_REQ_ID, &payload, sizeof(payload), SL_WFX_SOFTAP_INTERFACE, NULL);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get maximum message size in a Message Queue. */ | uint32_t osMessageQueueGetMsgSize(osMessageQueueId_t msgq_id) | /* Get maximum message size in a Message Queue. */
uint32_t osMessageQueueGetMsgSize(osMessageQueueId_t msgq_id) | {
struct cv2_msgq *msgq = (struct cv2_msgq *)msgq_id;
if (msgq == NULL) {
return 0;
} else {
return msgq->z_msgq.msg_size;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns: TRUE if @cancellable was cancelled, FALSE if it was not */ | gboolean g_cancellable_set_error_if_cancelled(GCancellable *cancellable, GError **error) | /* Returns: TRUE if @cancellable was cancelled, FALSE if it was not */
gboolean g_cancellable_set_error_if_cancelled(GCancellable *cancellable, GError **error) | {
if (g_cancellable_is_cancelled (cancellable))
{
g_set_error_literal (error,
G_IO_ERROR,
G_IO_ERROR_CANCELLED,
_("Operation was cancelled"));
return TRUE;
}
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Reset CAN peripheral registers to their default values. */ | void CAN_Reset(void) | /* Reset CAN peripheral registers to their default values. */
void CAN_Reset(void) | {
RCM_EnableAPB1PeriphReset(RCM_APB1_PERIPH_CAN);
RCM_DisableAPB1PeriphReset(RCM_APB1_PERIPH_CAN);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Try to prune ancestors as well. This is necessary to prevent quadratic behavior of shrink_dcache_parent(), but is also expected to be beneficial in reducing dentry cache fragmentation. */ | static void prune_one_dentry(struct dentry *dentry) __releases(dentry -> d_lock) __releases(dcache_lock) __acquires(dcache_lock) | /* Try to prune ancestors as well. This is necessary to prevent quadratic behavior of shrink_dcache_parent(), but is also expected to be beneficial in reducing dentry cache fragmentation. */
static void prune_one_dentry(struct dentry *dentry) __releases(dentry -> d_lock) __releases(dcache_lock) __acquires(dcache_lock) | {
__d_drop(dentry);
dentry = d_kill(dentry);
spin_lock(&dcache_lock);
while (dentry) {
if (!atomic_dec_and_lock(&dentry->d_count, &dentry->d_lock))
return;
if (dentry->d_op && dentry->d_op->d_delete)
dentry->d_op->d_delete(dentry);
dentry_lru_del_init(dentry);
__d_drop(dentry);
dentry = d_kill(dentry);
spin_lock(&dcache_lock);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function both reads and writes data. For write operations, include data to be written as argument. For read ops, use dummy data as arg. Returned data is read byte val. */ | U8 chb_xfer_byte(U8 data) | /* This function both reads and writes data. For write operations, include data to be written as argument. For read ops, use dummy data as arg. Returned data is read byte val. */
U8 chb_xfer_byte(U8 data) | {
while ((SSP_SSP0SR & (SSP_SSP0SR_TNF_MASK | SSP_SSP0SR_BSY_MASK)) != SSP_SSP0SR_TNF_NOTFULL);
SSP_SSP0DR = data;
while ((SSP_SSP0SR & (SSP_SSP0SR_BSY_MASK | SSP_SSP0SR_RNE_MASK)) != SSP_SSP0SR_RNE_NOTEMPTY);
return SSP_SSP0DR;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Assuming the pin is muxed as a gpio output, set its output value. */ | static void davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | /* Assuming the pin is muxed as a gpio output, set its output value. */
static void davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | {
struct davinci_gpio *d = container_of(chip, struct davinci_gpio, chip);
struct gpio_controller *__iomem g = d->regs;
__raw_writel((1 << offset), value ? &g->set_data : &g->clr_data);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the GO_BUSY bit to trigger a SPI data transfer. */ | void SPIBitGoBusySet(unsigned long ulBase) | /* Set the GO_BUSY bit to trigger a SPI data transfer. */
void SPIBitGoBusySet(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function must not be called from interrupt context. */ | void free_irq(unsigned int irq, void *dev_id) | /* This function must not be called from interrupt context. */
void free_irq(unsigned int irq, void *dev_id) | {
struct irq_desc *desc = irq_to_desc(irq);
if (!desc)
return;
chip_bus_lock(irq, desc);
kfree(__free_irq(irq, dev_id));
chip_bus_sync_unlock(irq, desc);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */ | VOID EFIAPI InternalSwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack, IN VA_LIST Marker) | /* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */
VOID EFIAPI InternalSwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack, IN VA_LIST Marker) | {
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
JumpBuffer.RA = (UINTN)EntryPoint;
JumpBuffer.SP = (UINTN)NewStack - sizeof (VOID *);
JumpBuffer.SP -= sizeof (Context1) + sizeof (Context2);
((VOID **)(UINTN)JumpBuffer.SP)[0] = Context1;
((VOID **)(UINTN)JumpBuffer.SP)[1] = Context2;
InternalSwitchStackAsm (&JumpBuffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Give reset command to the CAN controller using SPI interface. */ | int32_t can_ctrl_reset(struct can_ctrl_dev *dev) | /* Give reset command to the CAN controller using SPI interface. */
int32_t can_ctrl_reset(struct can_ctrl_dev *dev) | {
uint8_t spi_msg[] = {0, 0, 0};
return spi_write_and_read(dev->can_ctrl_spi, spi_msg, 3);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Toggles the LED at a fixed time interval. */ | void LedToggle(void) | /* Toggles the LED at a fixed time interval. */
void LedToggle(void) | {
static unsigned char led_toggle_state = 0;
static unsigned long timer_counter_last = 0;
unsigned long timer_counter_now;
timer_counter_now = TimerGet();
if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS)
{
return;
}
if (led_toggle_state == 0)
{
led_toggle_state = 1;
IfxPort_setPinLow(&MODULE_P00, 5U);
}
else
{
led_toggle_state = 0;
IfxPort_setPinHigh(&MODULE_P00, 5U);
}
timer_counter_last = timer_counter_now;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Returns CR_OK upon succesful completion, an error code otherwise. */ | enum CRStatus cr_parser_parse(CRParser *a_this) | /* Returns CR_OK upon succesful completion, an error code otherwise. */
enum CRStatus cr_parser_parse(CRParser *a_this) | {
enum CRStatus status = CR_ERROR;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& PRIVATE (a_this)->tknzr, CR_BAD_PARAM_ERROR);
if (PRIVATE (a_this)->use_core_grammar == FALSE) {
status = cr_parser_parse_stylesheet (a_this);
} else {
status = cr_parser_parse_stylesheet_core (a_this);
}
return status;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ | static void swap_equality(struct isl_basic_map *bmap, int a, int b) | /* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
static void swap_equality(struct isl_basic_map *bmap, int a, int b) | {
isl_int *t = bmap->eq[a];
bmap->eq[a] = bmap->eq[b];
bmap->eq[b] = t;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_SetStallEP(U32 EPNum) | /* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_SetStallEP(U32 EPNum) | {
uint32_t u32Ep, u32Num;
u32Num = EPNum & 0x0F;
u32Ep = USBD_NUM_TO_EP(u32Num);
if (u32Ep == CEP) {
HSUSBD_SET_CEP_STATE(HSUSBD_CEPCTL_STALL);
} else {
HSUSBD->EP[u32Ep].EPRSPCTL = (HSUSBD->EP[u32Ep].EPRSPCTL & 0xF7UL) | HSUSBD_EP_RSPCTL_HALT;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Find variable with given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. */ | static void singlevaraux(FuncState *fs, TString *n, expdesc *var, int base) | /* Find variable with given name 'n'. If it is an upvalue, add this upvalue into all intermediate functions. */
static void singlevaraux(FuncState *fs, TString *n, expdesc *var, int base) | {
int v = searchvar(fs, n);
if (v >= 0) {
init_exp(var, VLOCAL, v);
if (!base)
markupval(fs, v);
}
else {
int idx = searchupvalue(fs, n);
if (idx < 0) {
singlevaraux(fs->prev, n, var, 0);
if (var->k == VVOID)
return;
idx = newupvalue(fs, n, var);
}
init_exp(var, VUPVAL, idx);
}
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Converts encoded control register address into a full address On error, the return value (parent_div) will be 0. */ | static u32 _omap2_clksel_get_src_field(struct clk *src_clk, struct clk *clk, u32 *field_val) | /* Converts encoded control register address into a full address On error, the return value (parent_div) will be 0. */
static u32 _omap2_clksel_get_src_field(struct clk *src_clk, struct clk *clk, u32 *field_val) | {
const struct clksel *clks;
const struct clksel_rate *clkr;
clks = omap2_get_clksel_by_parent(clk, src_clk);
if (!clks)
return 0;
for (clkr = clks->rates; clkr->div; clkr++) {
if (clkr->flags & cpu_mask && clkr->flags & DEFAULT_RATE)
break;
}
if (!clkr->div) {
printk(KERN_ERR "clock: Could not find default rate for "
"clock %s parent %s\n", clk->name,
src_clk->parent->name);
return 0;
}
WARN_ON(clk->clksel_mask == 0);
*field_val = clkr->val;
return clkr->div;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* DESCRIPTION: Get the mapping of Serdes Selector values according to the Serdes revision number INPUT: serdes_num - Serdes number serdes_type - Serdes type OUTPUT: None RETURN: Mapping of Serdes Selector values */ | u32 hws_serdes_get_phy_selector_val(int serdes_num, enum serdes_type serdes_type) | /* DESCRIPTION: Get the mapping of Serdes Selector values according to the Serdes revision number INPUT: serdes_num - Serdes number serdes_type - Serdes type OUTPUT: None RETURN: Mapping of Serdes Selector values */
u32 hws_serdes_get_phy_selector_val(int serdes_num, enum serdes_type serdes_type) | {
if (serdes_type >= LAST_SERDES_TYPE)
return 0xff;
if (hws_ctrl_serdes_rev_get() == MV_SERDES_REV_1_2) {
return selectors_serdes_rev1_map
[serdes_type][serdes_num];
} else
return selectors_serdes_rev2_map
[serdes_type][serdes_num];
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Set LED2 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */ | __STATIC_INLINE void LED_Blinking(uint32_t Period) | /* Set LED2 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */
__STATIC_INLINE void LED_Blinking(uint32_t Period) | {
while (1)
{
LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
LL_mDelay(Period);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function check if this is the formating string specifier. */ | BOOLEAN CheckFormatingString(IN CONST CHAR8 *FormatString, IN OUT UINTN *CurrentPosition, IN UINTN StrLength) | /* This function check if this is the formating string specifier. */
BOOLEAN CheckFormatingString(IN CONST CHAR8 *FormatString, IN OUT UINTN *CurrentPosition, IN UINTN StrLength) | {
CHAR8 FormatStringParamater;
while (*(FormatString + *CurrentPosition) != 's') {
FormatStringParamater = *(FormatString + *CurrentPosition);
if ((FormatStringParamater != '-') &&
(FormatStringParamater != '+') &&
(FormatStringParamater != '*') &&
(FormatStringParamater != '.') &&
!(((UINTN)FormatStringParamater >= (UINTN)'0') && ((UINTN)FormatStringParamater <= (UINTN)'9'))
)
{
return FALSE;
}
(*CurrentPosition)++;
if (*CurrentPosition >= StrLength) {
return FALSE;
}
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reset error state variables at start of a new image. This is called during compression startup to reset trace/error processing to default state, without losing any application-specific method pointers. An application might possibly want to override this method if it has additional error processing state. */ | reset_error_mgr(j_common_ptr cinfo) | /* Reset error state variables at start of a new image. This is called during compression startup to reset trace/error processing to default state, without losing any application-specific method pointers. An application might possibly want to override this method if it has additional error processing state. */
reset_error_mgr(j_common_ptr cinfo) | {
cinfo->err->num_warnings = 0;
cinfo->err->msg_code = 0;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5
|GPIO_PIN_6|GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0|GPIO_PIN_1);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Close down the device. Invalidate all cached blocks. */ | void ide_cdrom_release_real(struct cdrom_device_info *cdi) | /* Close down the device. Invalidate all cached blocks. */
void ide_cdrom_release_real(struct cdrom_device_info *cdi) | {
ide_drive_t *drive = cdi->handle;
if (!cdi->use_count)
drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the format of the frame buffer memory. */ | void LCD_SetMemoryFormat(unsigned int format) | /* Sets the format of the frame buffer memory. */
void LCD_SetMemoryFormat(unsigned int format) | {
unsigned int value;
ASSERT((format & ~AT91C_LCDC_MEMOR) == 0,
"LCD_SetMemoryFormat: Wrong memory format value.\n\r");
value = AT91C_BASE_LCDC->LCDC_LCDCON2;
value &= ~AT91C_LCDC_MEMOR;
value |= format;
AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function returns %1 if the LPT area is running out of free space and %0 if it is not. */ | static int need_write_all(struct ubifs_info *c) | /* This function returns %1 if the LPT area is running out of free space and %0 if it is not. */
static int need_write_all(struct ubifs_info *c) | {
long long free = 0;
int i;
for (i = 0; i < c->lpt_lebs; i++) {
if (i + c->lpt_first == c->nhead_lnum)
free += c->leb_size - c->nhead_offs;
else if (c->ltab[i].free == c->leb_size)
free += c->leb_size;
else if (c->ltab[i].free + c->ltab[i].dirty == c->leb_size)
free += c->leb_size;
}
if (free <= c->lpt_sz * 2)
return 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 7.3.2.1.2 Sequence parameter set extension RBSP syntax seq_parameter_set_extension_rbsp( ) */ | static void dissect_h264_seq_parameter_set_extension_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset) | /* 7.3.2.1.2 Sequence parameter set extension RBSP syntax seq_parameter_set_extension_rbsp( ) */
static void dissect_h264_seq_parameter_set_extension_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset) | {
proto_tree_add_expert(tree, pinfo, &ei_h264_undecoded, tvb, offset, -1);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function checks if the driver got a valid device from the caller to avoid dereferencing invalid pointers. */ | static bool check_device(struct device *dev) | /* This function checks if the driver got a valid device from the caller to avoid dereferencing invalid pointers. */
static bool check_device(struct device *dev) | {
u16 devid;
if (!dev || !dev->dma_mask)
return false;
if (!dev || dev->bus != &pci_bus_type)
return false;
devid = get_device_id(dev);
if (devid > amd_iommu_last_bdf)
return false;
if (amd_iommu_rlookup_table[devid] == NULL)
return false;
return true;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Output a single byte to the serial port. */ | void pxa_putc_dev(unsigned int uart_index, const char c) | /* Output a single byte to the serial port. */
void pxa_putc_dev(unsigned int uart_index, const char c) | {
struct pxa_uart_regs *uart_regs;
if (c == '\n')
pxa_putc_dev(uart_index, '\r');
uart_regs = pxa_uart_index_to_regs(uart_index);
if (!uart_regs)
hang();
while (!(readl(&uart_regs->lsr) & LSR_TEMT))
WATCHDOG_RESET();
writel(c, &uart_regs->thr);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Obtains value of FIFO entry length. This value covers both fixed-size frame header block and payload buffer. User can configure payload buffer size individually for each FIFO and designated RX buffer. */ | unsigned fdcan_get_fifo_element_size(uint32_t canport, unsigned fifo_id) | /* Obtains value of FIFO entry length. This value covers both fixed-size frame header block and payload buffer. User can configure payload buffer size individually for each FIFO and designated RX buffer. */
unsigned fdcan_get_fifo_element_size(uint32_t canport, unsigned fifo_id) | {
unsigned element_size;
if (fifo_id == 0) {
element_size = FDCAN_RXESC(canport) >> FDCAN_RXESC_F0DS_SHIFT;
} else {
element_size = FDCAN_RXESC(canport) >> FDCAN_RXESC_F1DS_SHIFT;
}
return 8 + fdcan_dlc_to_length((element_size & FDCAN_RXESC_F0DS_MASK) | 0x8);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Returns from the EBC stack associated with the Handle parameter. */ | EFI_STATUS ReturnEBCStackByHandle(IN EFI_HANDLE Handle) | /* Returns from the EBC stack associated with the Handle parameter. */
EFI_STATUS ReturnEBCStackByHandle(IN EFI_HANDLE Handle) | {
UINTN Index;
for (Index = 0; Index < mStackNum; Index++) {
if (mStackBufferIndex[Index] == Handle) {
break;
}
}
if (Index == mStackNum) {
return EFI_NOT_FOUND;
}
mStackBufferIndex[Index] = NULL;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set L3 Source address filter value of IPv4. */ | void ETH_MAC_SetIpv4SrcAddrFilterValue(uint32_t u32Addr) | /* Set L3 Source address filter value of IPv4. */
void ETH_MAC_SetIpv4SrcAddrFilterValue(uint32_t u32Addr) | {
WRITE_REG32(CM_ETH->MAC_L3ADDRR0, u32Addr);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Find a dhcp client node by ip address */ | static struct dhcp_client_node* dhcp_client_find_by_ip(struct dhcp_server *dhcpserver, const ip4_addr_t *ip) | /* Find a dhcp client node by ip address */
static struct dhcp_client_node* dhcp_client_find_by_ip(struct dhcp_server *dhcpserver, const ip4_addr_t *ip) | {
struct dhcp_client_node *node;
for (node = dhcpserver->node_list; node != NULL; node = node->next)
{
if (ip4_addr_cmp(&node->ipaddr, ip))
{
return node;
}
}
return NULL;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* ADC Disable an External Trigger for Regular Channels. */ | void adc_disable_external_trigger_regular(uint32_t adc) | /* ADC Disable an External Trigger for Regular Channels. */
void adc_disable_external_trigger_regular(uint32_t adc) | {
ADC_CR2(adc) &= ~ADC_CR2_EXTTRIG;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Reset RNG peripheral registers to their default reset values. */ | void RNG_Reset(void) | /* Reset RNG peripheral registers to their default reset values. */
void RNG_Reset(void) | {
RCM_EnableAHB2PeriphReset(RCM_AHB2_PERIPH_RNG);
RCM_DisableAHB2PeriphReset(RCM_AHB2_PERIPH_RNG);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function returns TRUE if the device path specified by DevicePath is multi-instance. Otherwise, FALSE is returned. If DevicePath is NULL or invalid, then FALSE is returned. */ | BOOLEAN EFIAPI UefiDevicePathLibIsDevicePathMultiInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | /* This function returns TRUE if the device path specified by DevicePath is multi-instance. Otherwise, FALSE is returned. If DevicePath is NULL or invalid, then FALSE is returned. */
BOOLEAN EFIAPI UefiDevicePathLibIsDevicePathMultiInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | {
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
if (DevicePath == NULL) {
return FALSE;
}
if (!IsDevicePathValid (DevicePath, 0)) {
return FALSE;
}
Node = DevicePath;
while (!IsDevicePathEnd (Node)) {
if (IsDevicePathEndInstance (Node)) {
return TRUE;
}
Node = NextDevicePathNode (Node);
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Timestamp binary rollover When set the timestamp low register rolls over after 0x7FFF_FFFF value. */ | void synopGMAC_TS_binary_rollover_enable(synopGMACdevice *gmacdev) | /* Timestamp binary rollover When set the timestamp low register rolls over after 0x7FFF_FFFF value. */
void synopGMAC_TS_binary_rollover_enable(synopGMACdevice *gmacdev) | {
synopGMACClearBits(gmacdev->MacBase, GmacTSControl, GmacTSCTRLSSR);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified DIV interrupt has occurred or not. */ | ITStatus DIV_GetITStatus(uint32_t DIV_IT) | /* Checks whether the specified DIV interrupt has occurred or not. */
ITStatus DIV_GetITStatus(uint32_t DIV_IT) | {
ITStatus bitstatus = RESET;
uint32_t enablestatus = 0;
assert_param(IS_DIV_GET_IT(DIV_IT));
enablestatus = (uint32_t)((DIV->SC>>1) & DIV_IT);
if (((uint32_t)(DIV->SC & DIV_IT) != (uint32_t)RESET) && (enablestatus != (uint32_t)RESET))
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* find_free_ate: Find the first free ate index starting from the given index for the desired consecutive count. */ | static int find_free_ate(struct ate_resource *ate_resource, int start, int count) | /* find_free_ate: Find the first free ate index starting from the given index for the desired consecutive count. */
static int find_free_ate(struct ate_resource *ate_resource, int start, int count) | {
u64 *ate = ate_resource->ate;
int index;
int start_free;
for (index = start; index < ate_resource->num_ate;) {
if (!ate[index]) {
int i;
int free;
free = 0;
start_free = index;
for (i = start_free; i < ate_resource->num_ate; i++) {
if (!ate[i]) {
if (++free == count)
return start_free;
} else {
index = i + 1;
break;
}
}
if (i >= ate_resource->num_ate)
return -1;
} else
index++;
}
return -1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* &result: reference to a 32-Bit signed Integer value where the result will be written It will not be written if result==NULL returns: 0 on success -4 if the DPS310 is could not finish its measurement in time -3 if the DPS310 is already busy -2 if the object initialization failed -1 on other fail */ | int16_t measureTempOnce_1param(int32_t *result) | /* &result: reference to a 32-Bit signed Integer value where the result will be written It will not be written if result==NULL returns: 0 on success -4 if the DPS310 is could not finish its measurement in time -3 if the DPS310 is already busy -2 if the object initialization failed -1 on other fail */
int16_t measureTempOnce_1param(int32_t *result) | {
return measureTempOnce(result, dps310_ctx.m_tempOsr);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Toggles the MMC slots between open-drain and push-pull mode. */ | int menelaus_set_mmc_opendrain(int slot, int enable) | /* Toggles the MMC slots between open-drain and push-pull mode. */
int menelaus_set_mmc_opendrain(int slot, int enable) | {
int ret, val;
if (slot != 1 && slot != 2)
return -EINVAL;
mutex_lock(&the_menelaus->lock);
ret = menelaus_read_reg(MENELAUS_MCT_CTRL1);
if (ret < 0) {
mutex_unlock(&the_menelaus->lock);
return ret;
}
val = ret;
if (slot == 1) {
if (enable)
val |= 1 << 2;
else
val &= ~(1 << 2);
} else {
if (enable)
val |= 1 << 3;
else
val &= ~(1 << 3);
}
ret = menelaus_write_reg(MENELAUS_MCT_CTRL1, val);
mutex_unlock(&the_menelaus->lock);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will compare two areas of memory */ | rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count) | /* This function will compare two areas of memory */
rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count) | {
const unsigned char *su1, *su2;
int res = 0;
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* History X.25 001 Jonathan Naylor Started coding. X.25 002 Jonathan Naylor New timer architecture. Henner Eisen Prevented x25_output() skb leakage. Henner Eisen MSG_DONTWAIT for fragment allocation. Henner Eisen x25_send_iframe(): re-queued frames needed cleaned seq-number fields. */ | static int x25_pacsize_to_bytes(unsigned int pacsize) | /* History X.25 001 Jonathan Naylor Started coding. X.25 002 Jonathan Naylor New timer architecture. Henner Eisen Prevented x25_output() skb leakage. Henner Eisen MSG_DONTWAIT for fragment allocation. Henner Eisen x25_send_iframe(): re-queued frames needed cleaned seq-number fields. */
static int x25_pacsize_to_bytes(unsigned int pacsize) | {
int bytes = 1;
if (!pacsize)
return 128;
while (pacsize-- > 0)
bytes *= 2;
return bytes;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Do a soft reset of the card using the Configuration Option Register */ | static int orinoco_plx_cor_reset(struct orinoco_private *priv) | /* Do a soft reset of the card using the Configuration Option Register */
static int orinoco_plx_cor_reset(struct orinoco_private *priv) | {
hermes_t *hw = &priv->hw;
struct orinoco_pci_card *card = priv->card;
unsigned long timeout;
u16 reg;
iowrite8(COR_VALUE | COR_RESET, card->attr_io + COR_OFFSET);
mdelay(1);
iowrite8(COR_VALUE, card->attr_io + COR_OFFSET);
mdelay(1);
timeout = jiffies + (PLX_RESET_TIME * HZ / 1000);
reg = hermes_read_regn(hw, CMD);
while (time_before(jiffies, timeout) && (reg & HERMES_CMD_BUSY)) {
mdelay(1);
reg = hermes_read_regn(hw, CMD);
}
if (reg & HERMES_CMD_BUSY) {
printk(KERN_ERR PFX "Busy timeout\n");
return -ETIMEDOUT;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get a Message or Wait for a Message from a Queue. */ | os_InRegs osEvent_type svcMessageGet(osMessageQId queue_id, uint32_t millisec) | /* Get a Message or Wait for a Message from a Queue. */
os_InRegs osEvent_type svcMessageGet(osMessageQId queue_id, uint32_t millisec) | {
ret.status = osErrorParameter;
return osEvent_ret_status;
}
if (((P_MCB)queue_id)->cb_type != MCB) {
ret.status = osErrorParameter;
return osEvent_ret_status;
}
res = rt_mbx_wait(queue_id, &ret.value.p, rt_ms2tick(millisec));
if (res == OS_R_TMO) {
ret.status = (millisec != 0U) ? osEventTimeout : osOK;
return osEvent_ret_value;
}
ret.status = osEventMessage;
return osEvent_ret_value;
} | labapart/polymcu | C++ | null | 201 |
/* NOTE: Mode 1 should be used for baudrates of 19200, and above, as it has a lower deviation error than Mode 0 for higher frequencies. Mode 0 should be used for all baudrates below 19200. */ | static int sti_asc_pending(struct udevice *dev, bool input) | /* NOTE: Mode 1 should be used for baudrates of 19200, and above, as it has a lower deviation error than Mode 0 for higher frequencies. Mode 0 should be used for all baudrates below 19200. */
static int sti_asc_pending(struct udevice *dev, bool input) | {
struct sti_asc_serial *priv = dev_get_priv(dev);
struct sti_asc_uart *const uart = priv->regs;
unsigned long status;
status = readl(&uart->status);
if (input)
return status & STA_RBF;
else
return status & STA_TF;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Initializes a pwm configuration structure to defaults.
The default configuration is as follows: */ | void pwm_get_config_defaults(struct pwm_config *const config) | /* Initializes a pwm configuration structure to defaults.
The default configuration is as follows: */
void pwm_get_config_defaults(struct pwm_config *const config) | {
config->output_polarity = false;
config->agcdata_format = false;
config->sample_method = PWM_SAMPLE_METHOD_0;
config->period = PWM_PERIOD_4;
config->duty_cycle = 50;
config->clock_select = PWM_CLOCK_SELECT_26_0;
config->pin_number_pad = 0;
config->pinmux_sel_pad = 0;
} | memfault/zero-to-main | C++ | null | 200 |
/* This function disconnects the cluster connection from ocfs2_control. Afterwards, userspace can't affect the cluster connection. */ | static void ocfs2_live_connection_drop(struct ocfs2_live_connection *c) | /* This function disconnects the cluster connection from ocfs2_control. Afterwards, userspace can't affect the cluster connection. */
static void ocfs2_live_connection_drop(struct ocfs2_live_connection *c) | {
mutex_lock(&ocfs2_control_lock);
list_del_init(&c->oc_list);
c->oc_conn = NULL;
mutex_unlock(&ocfs2_control_lock);
kfree(c);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DAC Channel Output Buffer Enable.
Enable a digital to analog converter channel output drive buffer. This is an optional amplifying buffer that provides additional drive for the output signal. The buffer is enabled by default after a reset and needs to be explicitly disabled if required. */ | void dac_buffer_enable(uint32_t dac, int channel) | /* DAC Channel Output Buffer Enable.
Enable a digital to analog converter channel output drive buffer. This is an optional amplifying buffer that provides additional drive for the output signal. The buffer is enabled by default after a reset and needs to be explicitly disabled if required. */
void dac_buffer_enable(uint32_t dac, int channel) | {
switch (channel) {
case DAC_CHANNEL1:
DAC_MCR(dac) &= ~DAC_MCR_MODE1_UNBUFFERED;
break;
case DAC_CHANNEL2:
DAC_MCR(dac) &= ~DAC_MCR_MODE2_UNBUFFERED;
break;
case DAC_CHANNEL_BOTH:
DAC_MCR(dac) &= ~(DAC_MCR_MODE1_UNBUFFERED |
DAC_MCR_MODE2_UNBUFFERED);
break;
default:
break;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Returns: the @channel that was passed in (since 2.6) */ | GIOChannel* g_io_channel_ref(GIOChannel *channel) | /* Returns: the @channel that was passed in (since 2.6) */
GIOChannel* g_io_channel_ref(GIOChannel *channel) | {
g_return_val_if_fail (channel != NULL, NULL);
g_atomic_int_inc (&channel->ref_count);
return channel;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Gets the current transfer size for a uDMA channel control structure. */ | unsigned long uDMAChannelSizeGet(unsigned long ulChannelStructIndex) | /* Gets the current transfer size for a uDMA channel control structure. */
unsigned long uDMAChannelSizeGet(unsigned long ulChannelStructIndex) | {
tDMAControlTable *pControlTable;
unsigned long ulControl;
ASSERT((ulChannelStructIndex & 0xffff) < 64);
ASSERT(HWREG(UDMA_CTLBASE) != 0);
ulChannelStructIndex &= 0x3f;
pControlTable = (tDMAControlTable *)HWREG(UDMA_CTLBASE);
ulControl = (pControlTable[ulChannelStructIndex].ulControl &
(UDMA_CHCTL_XFERSIZE_M | UDMA_CHCTL_XFERMODE_M));
if(ulControl == 0)
{
return(0);
}
else
{
return((ulControl >> 4) + 1);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Perform a multiply between a bigint an an (unsigned) integer */ | static bigint *ICACHE_FLASH_ATTR bi_int_multiply(BI_CTX *ctx, bigint *bi, comp i) | /* Perform a multiply between a bigint an an (unsigned) integer */
static bigint *ICACHE_FLASH_ATTR bi_int_multiply(BI_CTX *ctx, bigint *bi, comp i) | {
int j = 0, n = bia->size;
bigint *biR = alloc(ctx, n + 1);
comp carry = 0;
comp *r = biR->comps;
comp *a = bia->comps;
check(bia);
memset(r, 0, ((n+1)*COMP_BYTE_SIZE));
do
{
long_comp tmp = *r + (long_comp)a[j]*b + carry;
*r++ = (comp)tmp;
carry = (comp)(tmp >> COMP_BIT_SIZE);
} while (++j < n);
*r = carry;
bi_free(ctx, bia);
return trim(biR);
} | eerimoq/simba | C++ | Other | 337 |
/* Reads relative humidity and temperature from a Si7013 sensor. */ | int32_t Si7013_MeasureRHAndTemp(I2C_TypeDef *i2c, uint8_t addr, uint32_t *rhData, int32_t *tData) | /* Reads relative humidity and temperature from a Si7013 sensor. */
int32_t Si7013_MeasureRHAndTemp(I2C_TypeDef *i2c, uint8_t addr, uint32_t *rhData, int32_t *tData) | {
int ret = Si7013_Measure(i2c, addr, rhData, SI7013_READ_RH);
if (ret == 2)
{
*rhData = (((*rhData) * 15625L) >> 13) - 6000;
}
else
{
return -1;
}
ret = Si7013_Measure(i2c, addr, (uint32_t *) tData, SI7013_READ_TEMP);
if (ret == 2)
{
*tData = (((*tData) * 21965L) >> 13) - 46850;
}
else
{
return -1;
}
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This routine is the driver/module insertion entry point. It initializes the EDAC memory controller reporting state and registers the driver as an OpenFirmware device tree platform driver. */ | static int __init ppc4xx_edac_init(void) | /* This routine is the driver/module insertion entry point. It initializes the EDAC memory controller reporting state and registers the driver as an OpenFirmware device tree platform driver. */
static int __init ppc4xx_edac_init(void) | {
ppc4xx_edac_printk(KERN_INFO, PPC4XX_EDAC_MODULE_REVISION "\n");
ppc4xx_edac_opstate_init();
return of_register_platform_driver(&ppc4xx_edac_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the PDMA Internal Buffer Pointer of a channel. */ | unsigned long PDMAInternalBufPointerGet(unsigned long ulChannelID) | /* Get the PDMA Internal Buffer Pointer of a channel. */
unsigned long PDMAInternalBufPointerGet(unsigned long ulChannelID) | {
xASSERT(xDMAChannelIDValid(ulChannelID));
return xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CBCR);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Get the address which holds cursor pattern data. */ | static uint32_t get_hwc_address(SM501State *state, int crt) | /* Get the address which holds cursor pattern data. */
static uint32_t get_hwc_address(SM501State *state, int crt) | {
uint32_t addr = crt ? state->dc_crt_hwc_addr : state->dc_panel_hwc_addr;
return (addr & 0x03FFFFF0);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Read gyroscope device ID.
This function reads the gyroscope hardware identification registers and returns these values to the addresses specified in the function parameters. */ | static bool imu3000_device_id(sensor_hal_t *hal, sensor_data_t *data) | /* Read gyroscope device ID.
This function reads the gyroscope hardware identification registers and returns these values to the addresses specified in the function parameters. */
static bool imu3000_device_id(sensor_hal_t *hal, sensor_data_t *data) | {
data->device.id = sensor_bus_get(hal, IMU3000_WHO_AM_I);
data->device.version = 0;
return true;
} | memfault/zero-to-main | C++ | null | 200 |
/* Resets "Start Pulse" signal when the current row output is done. */ | static void IRAM_ATTR i2s_int_hdl(void *arg) | /* Resets "Start Pulse" signal when the current row output is done. */
static void IRAM_ATTR i2s_int_hdl(void *arg) | {
output_done = true;
}
dev->int_clr.val = dev->int_raw.val;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* USART Set Parity.
The parity bit can be selected as none, even or odd. */ | void usart_set_parity(uint32_t usart, uint32_t parity) | /* USART Set Parity.
The parity bit can be selected as none, even or odd. */
void usart_set_parity(uint32_t usart, uint32_t parity) | {
uint32_t reg32;
reg32 = USART_CR1(usart);
reg32 = (reg32 & ~USART_PARITY_MASK) | parity;
USART_CR1(usart) = reg32;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* terminate a voice if free flag is true, call free_voice after termination */ | static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free) | /* terminate a voice if free flag is true, call free_voice after termination */
static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free) | {
emu->ops.terminate(vp);
vp->time = emu->use_time++;
vp->chan = NULL;
vp->port = NULL;
vp->zone = NULL;
vp->block = NULL;
vp->state = SNDRV_EMUX_ST_OFF;
if (free && emu->ops.free_voice)
emu->ops.free_voice(vp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* remove zero-count source records from a source filter list */ | static void mld_clear_zeros(struct ip6_sf_list **ppsf) | /* remove zero-count source records from a source filter list */
static void mld_clear_zeros(struct ip6_sf_list **ppsf) | {
struct ip6_sf_list *psf_prev, *psf_next, *psf;
psf_prev = NULL;
for (psf=*ppsf; psf; psf = psf_next) {
psf_next = psf->sf_next;
if (psf->sf_crcount == 0) {
if (psf_prev)
psf_prev->sf_next = psf->sf_next;
else
*ppsf = psf->sf_next;
kfree(psf);
} else
psf_prev = psf;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* dmi_matches - check if dmi_system_id structure matches system DMI data @dmi: pointer to the dmi_system_id structure to check */ | static bool dmi_matches(const struct dmi_system_id *dmi) | /* dmi_matches - check if dmi_system_id structure matches system DMI data @dmi: pointer to the dmi_system_id structure to check */
static bool dmi_matches(const struct dmi_system_id *dmi) | {
int i;
WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n");
for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) {
int s = dmi->matches[i].slot;
if (s == DMI_NONE)
break;
if (dmi_ident[s]
&& strstr(dmi_ident[s], dmi->matches[i].substr))
continue;
return false;
}
return true;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 on success, or negative on failure. */ | static int disable_ecrc_checking(struct pci_dev *dev) | /* Returns 0 on success, or negative on failure. */
static int disable_ecrc_checking(struct pci_dev *dev) | {
int pos;
u32 reg32;
if (!pci_is_pcie(dev))
return -ENODEV;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
if (!pos)
return -ENODEV;
pci_read_config_dword(dev, pos + PCI_ERR_CAP, ®32);
reg32 &= ~(PCI_ERR_CAP_ECRC_GENE | PCI_ERR_CAP_ECRC_CHKE);
pci_write_config_dword(dev, pos + PCI_ERR_CAP, reg32);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Do acknowledge polling on EEPROM device.
When writing to an EEPROM, the EEPROM device will be busy for some time after issuing a (page) write. During this time, the EEPROM is not accessible, and will therefore not ACK any requests. This feature can be used to determine when the write is actually completed, and is denoted acknowledgement polling. */ | static int EEPROM_AckPoll(I2C_TypeDef *i2c, uint8_t addr) | /* Do acknowledge polling on EEPROM device.
When writing to an EEPROM, the EEPROM device will be busy for some time after issuing a (page) write. During this time, the EEPROM is not accessible, and will therefore not ACK any requests. This feature can be used to determine when the write is actually completed, and is denoted acknowledgement polling. */
static int EEPROM_AckPoll(I2C_TypeDef *i2c, uint8_t addr) | {
I2C_TransferSeq_TypeDef seq;
I2C_TransferReturn_TypeDef ret;
seq.addr = addr;
seq.flags = I2C_FLAG_WRITE;
seq.buf[0].data = NULL;
seq.buf[0].len = 0;
while (1)
{
ret = I2CSPM_Transfer(i2c, &seq);
if (ret == i2cTransferDone)
{
break;
}
else if (ret == i2cTransferNack)
{
continue;
}
else
{
return((int) ret);
}
}
return(0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Opens the fieldbus adapter with the specified device ID. */ | static HRESULT IxxatVciLibFuncVciDeviceOpen(REFVCIID rVciid, PHANDLE phDevice) | /* Opens the fieldbus adapter with the specified device ID. */
static HRESULT IxxatVciLibFuncVciDeviceOpen(REFVCIID rVciid, PHANDLE phDevice) | {
HRESULT result = VCI_E_UNEXPECTED;
assert(ixxatVciLibFuncVciDeviceOpenPtr != NULL);
assert(ixxatVciDllHandle != NULL);
if ((ixxatVciLibFuncVciDeviceOpenPtr != NULL) && (ixxatVciDllHandle != NULL))
{
result = ixxatVciLibFuncVciDeviceOpenPtr(rVciid, phDevice);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Wakeup the first suspened thread in the list. */ | rt_inline rt_err_t rt_channel_list_resume(rt_list_t *list) | /* Wakeup the first suspened thread in the list. */
rt_inline rt_err_t rt_channel_list_resume(rt_list_t *list) | {
struct rt_thread *thread;
thread = rt_list_entry(list->next, struct rt_thread, tlist);
rt_thread_resume(thread);
return RT_EOK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* xprt_destroy - destroy an RPC transport, killing off all requests. @kref: kref for the transport to destroy */ | static void xprt_destroy(struct kref *kref) | /* xprt_destroy - destroy an RPC transport, killing off all requests. @kref: kref for the transport to destroy */
static void xprt_destroy(struct kref *kref) | {
struct rpc_xprt *xprt = container_of(kref, struct rpc_xprt, kref);
dprintk("RPC: destroying transport %p\n", xprt);
xprt->shutdown = 1;
del_timer_sync(&xprt->timer);
rpc_destroy_wait_queue(&xprt->binding);
rpc_destroy_wait_queue(&xprt->pending);
rpc_destroy_wait_queue(&xprt->sending);
rpc_destroy_wait_queue(&xprt->resend);
rpc_destroy_wait_queue(&xprt->backlog);
xprt->ops->destroy(xprt);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.