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 |
|---|---|---|---|---|---|---|---|
/* Update process times based on virtual cpu times stored by entry.S to the lowcore fields user_timer, system_timer & steal_clock. */ | void account_system_vtime(struct task_struct *tsk) | /* Update process times based on virtual cpu times stored by entry.S to the lowcore fields user_timer, system_timer & steal_clock. */
void account_system_vtime(struct task_struct *tsk) | {
struct thread_info *ti = task_thread_info(tsk);
__u64 timer, system;
timer = S390_lowcore.last_update_timer;
S390_lowcore.last_update_timer = get_vtimer();
S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
system = S390_lowcore.system_timer - ti->system_timer;
S390_lowcore.steal_timer -= sys... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Compose a 32bit command word to be sent to the HD-audio controller */ | static unsigned int make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, unsigned int verb, unsigned int parm) | /* Compose a 32bit command word to be sent to the HD-audio controller */
static unsigned int make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, unsigned int verb, unsigned int parm) | {
u32 val;
if ((codec->addr & ~0xf) || (direct & ~1) || (nid & ~0x7f) ||
(verb & ~0xfff) || (parm & ~0xffff)) {
printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x:%x\n",
codec->addr, direct, nid, verb, parm);
return ~0;
}
val = (u32)codec->addr << 28;
val |= (u32)direct << 27;
val |= (u32)... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Extract a 16-bit fixed-point value and convert it to a float. */ | static gfloat tvb_get_fixed_point(tvbuff_t *, int, gint) | /* Extract a 16-bit fixed-point value and convert it to a float. */
static gfloat tvb_get_fixed_point(tvbuff_t *, int, gint) | {
gint16 fixed;
if (rep & ENC_LITTLE_ENDIAN)
fixed = tvb_get_letohs(tvb, offset);
else
fixed = tvb_get_ntohs(tvb, offset);
return fixed / 128.0F;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Init the ADC with the corresponding configuration in the LPR5150AL_Configure gorup. */ | void LPR5150ALInit() | /* Init the ADC with the corresponding configuration in the LPR5150AL_Configure gorup. */
void LPR5150ALInit() | {
xSysCtlPeripheralClockSourceSet(xSYSCTL_ADC0_HCLK, 3);
xSysCtlPeripheralEnable2(LPR5150AL_ADC_BASE);
XAXIS_PIN_IN_CFG();
YAXIS_PIN_IN_CFG();
xADCEnable(LPR5150AL_ADC_BASE);
xADCConfigure(LPR5150AL_ADC_BASE, xADC_MODE_SCAN_CONTINUOUS, ADC_TRIGGER_PROCESSOR);
xADCStepConfigure(LPR5150AL_ADC_... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns the specified ETHERNET DMA Tx Desc collision count. */ | uint32_t ETH_GetDmaTxDescCollisionCount(ETH_DMADescType *DMATxDesc) | /* Returns the specified ETHERNET DMA Tx Desc collision count. */
uint32_t ETH_GetDmaTxDescCollisionCount(ETH_DMADescType *DMATxDesc) | {
return ((DMATxDesc->Status & ETH_DMA_TX_DESC_CC) >> ETH_DMA_TX_DESC_COLLISION_COUNTER_SHIFT);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */ | void LedBlinkExit(void) | /* Cleans up the LED blink driver. This is intended to be used upon program exit. */
void LedBlinkExit(void) | {
LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_5);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Removes the file from the fileystem, which also frees the rchan_buf_struct and the channel buffer. Should only be called from kref_put(). */ | static void relay_remove_buf(struct kref *kref) | /* Removes the file from the fileystem, which also frees the rchan_buf_struct and the channel buffer. Should only be called from kref_put(). */
static void relay_remove_buf(struct kref *kref) | {
struct rchan_buf *buf = container_of(kref, struct rchan_buf, kref);
buf->chan->cb->remove_buf_file(buf->dentry);
relay_destroy_buf(buf);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return : TRUE if put into rx reordering buffer, shouldn't indicaterxhere. */ | void ORIBATimerTimeout(struct rt_rtmp_adapter *pAd) | /* Return : TRUE if put into rx reordering buffer, shouldn't indicaterxhere. */
void ORIBATimerTimeout(struct rt_rtmp_adapter *pAd) | {
struct rt_mac_table_entry *pEntry;
int i, total;
u8 TID;
total = pAd->MacTab.Size * NUM_OF_TID;
for (i = 1; ((i < MAX_LEN_OF_BA_ORI_TABLE) && (total > 0)); i++) {
if (pAd->BATable.BAOriEntry[i].ORI_BA_Status == Originator_Done) {
pEntry =
&pAd->MacTab.Content[pAd->BATable.BAOriEntry[i].
Wcid];... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets the instance from the base address to be used to gate or ungate the module clock. */ | static uint32_t FLEXRAM_GetInstance(FLEXRAM_Type *base) | /* Gets the instance from the base address to be used to gate or ungate the module clock. */
static uint32_t FLEXRAM_GetInstance(FLEXRAM_Type *base) | {
uint32_t instance;
for (instance = 0; instance < ARRAY_SIZE(s_flexramBases); instance++)
{
if (s_flexramBases[instance] == base)
{
break;
}
}
assert(instance < ARRAY_SIZE(s_flexramBases));
return instance;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Called by Address Resolution module to notify changes in address. */ | void eth_header_cache_update(struct hh_cache *hh, const struct net_device *dev, const unsigned char *haddr) | /* Called by Address Resolution module to notify changes in address. */
void eth_header_cache_update(struct hh_cache *hh, const struct net_device *dev, const unsigned char *haddr) | {
memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
haddr, ETH_ALEN);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read and write a data element from and to the SPI interface. */ | unsigned long xSPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData) | /* Read and write a data element from and to the SPI interface. */
unsigned long xSPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData) | {
unsigned long ulReadTemp;
xASSERT(ulBase == SPI0_BASE);
while(xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)
{
}
xHWREG(ulBase + SPI_TX0) = ulWData;
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY;
while(xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)
{
}
ulReadTemp = xHWR... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Configures the number of data to transfer type(Even/Odd) for the DMA last transfers and for the selected SPI. */ | void SPI_LastDMATransferCmd(SPI_TypeDef *SPIx, uint16_t SPI_LastDMATransfer) | /* Configures the number of data to transfer type(Even/Odd) for the DMA last transfers and for the selected SPI. */
void SPI_LastDMATransferCmd(SPI_TypeDef *SPIx, uint16_t SPI_LastDMATransfer) | {
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_LAST_DMA_TRANSFER(SPI_LastDMATransfer));
SPIx->CR2 &= CR2_LDMA_MASK;
SPIx->CR2 |= SPI_LastDMATransfer;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We need a callback because we cannot invoked device_unregister() inside vmbus_probe() since vmbus_probe() may be invoked inside device_register() i.e. we cannot call device_unregister() inside device_register() */ | static void vmbus_probe_failed_cb(struct work_struct *context) | /* We need a callback because we cannot invoked device_unregister() inside vmbus_probe() since vmbus_probe() may be invoked inside device_register() i.e. we cannot call device_unregister() inside device_register() */
static void vmbus_probe_failed_cb(struct work_struct *context) | {
struct device_context *device_ctx = (struct device_context *)context;
DPRINT_ENTER(VMBUS_DRV);
device_unregister(&device_ctx->device);
DPRINT_EXIT(VMBUS_DRV);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check that k_thread_suspend() cancels a preexisting thread timeout.
Suspended threads should not wake up unexpectedly if they happened to have been sleeping when suspended. */ | ZTEST(threads_lifecycle, test_threads_suspend_timeout) | /* Check that k_thread_suspend() cancels a preexisting thread timeout.
Suspended threads should not wake up unexpectedly if they happened to have been sleeping when suspended. */
ZTEST(threads_lifecycle, test_threads_suspend_timeout) | {
after_suspend = false;
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
sleep_suspended, NULL, NULL, NULL,
0, K_USER, K_NO_WAIT);
k_msleep(50);
k_thread_suspend(tid);
k_msleep(200);
zassert_false(after_suspend, "thread woke up unexpectedly");
k_thread_abort(tid);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Isochronous bus resource management (channels, bandwidth), client side */ | static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, int bandwidth, bool allocate, __be32 data[2]) | /* Isochronous bus resource management (channels, bandwidth), client side */
static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, int bandwidth, bool allocate, __be32 data[2]) | {
int try, new, old = allocate ? BANDWIDTH_AVAILABLE_INITIAL : 0;
for (try = 0; try < 5; try++) {
new = allocate ? old - bandwidth : old + bandwidth;
if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
break;
data[0] = cpu_to_be32(old);
data[1] = cpu_to_be32(new);
switch (fw_run_transaction(card, TCODE_LOC... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* enable/disable the multi-driver. This is only valid for output and allows the output pin to run as an open collector output. */ | int at91_set_pio_multi_drive(unsigned port, unsigned pin, int is_on) | /* enable/disable the multi-driver. This is only valid for output and allows the output pin to run as an open collector output. */
int at91_set_pio_multi_drive(unsigned port, unsigned pin, int is_on) | {
at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
u32 mask;
if ((port < AT91_PIO_PORTS) && (pin < 32)) {
mask = 1 << pin;
if (is_on)
writel(mask, &pio->port[port].mder);
else
writel(mask, &pio->port[port].mddr);
}
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Return the number of nodes reachable by 'p'. All nodes should be initially unmarked. */ | static int count_blocks(struct icode *ic, struct block *p) | /* Return the number of nodes reachable by 'p'. All nodes should be initially unmarked. */
static int count_blocks(struct icode *ic, struct block *p) | {
if (p == 0 || isMarked(ic, p))
return 0;
Mark(ic, p);
return count_blocks(ic, JT(p)) + count_blocks(ic, JF(p)) + 1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). */ | UINT64 EFIAPI MmioAnd64(IN UINTN Address, IN UINT64 AndData) | /* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64 EFIAPI MmioAnd64(IN UINTN Address, IN UINT64 AndData) | {
return MmioWrite64 (Address, MmioRead64 (Address) & AndData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Change Logs: Date Author Notes RT-Thread the first version */ | rt_weak void machine_reset(void) | /* Change Logs: Date Author Notes RT-Thread the first version */
rt_weak void machine_reset(void) | {
rt_kprintf("reboot system...\n");
rt_hw_interrupt_disable();
while (1);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Please consult the Tiva data sheet for a table showing all the possible peripheral assignments for the uDMA channels for a particular device. */ | void uDMAChannelAssign(uint32_t ui32Mapping) | /* Please consult the Tiva data sheet for a table showing all the possible peripheral assignments for the uDMA channels for a particular device. */
void uDMAChannelAssign(uint32_t ui32Mapping) | {
uint32_t ui32MapReg;
uint_fast8_t ui8MapShift;
uint_fast8_t ui8ChannelNum;
ASSERT((ui32Mapping & 0xffffff00) < 0x00090000);
ui8ChannelNum = ui32Mapping & 0xff;
ui32Mapping = ui32Mapping >> 16;
ui32MapReg = UDMA_CHMAP0 + (uint32_t)((ui8ChannelNum / 8) * 4);
ui8MapShift = (ui8ChannelNum ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Wakes up the CAN peripheral from sleep mode . */ | uint8_t CAN_WakeUp(CAN_TypeDef *CANx) | /* Wakes up the CAN peripheral from sleep mode . */
uint8_t CAN_WakeUp(CAN_TypeDef *CANx) | {
uint32_t wait_slak = SLAK_TIMEOUT;
uint8_t wakeupstatus = CAN_WakeUp_Failed;
assert_param(IS_CAN_ALL_PERIPH(CANx));
CANx->MCR &= ~(uint32_t)CAN_MCR_SLEEP;
while(((CANx->MSR & CAN_MSR_SLAK) == CAN_MSR_SLAK)&&(wait_slak!=0x00))
{
wait_slak--;
}
if((CANx->MSR & CAN_MSR_SLAK) != CAN_MSR_SLAK)
{
w... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Enables the Flash Power Down in STOP mode. */ | void PMU_EnableFlashPowerDown(void) | /* Enables the Flash Power Down in STOP mode. */
void PMU_EnableFlashPowerDown(void) | {
PMU->CTRL_B.FPDSM = ENABLE ;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read the NIC (Number-In-a-Can) device used to store the MAC address on SN0 / SN00 nodeboards and PCI cards. */ | static void ioc3_get_eaddr_nic(struct ioc3_private *ip) | /* Read the NIC (Number-In-a-Can) device used to store the MAC address on SN0 / SN00 nodeboards and PCI cards. */
static void ioc3_get_eaddr_nic(struct ioc3_private *ip) | {
struct ioc3 *ioc3 = ip->regs;
u8 nic[14];
int tries = 2;
int i;
ioc3_w_gpcr_s(1 << 21);
while (tries--) {
if (!nic_init(ioc3))
break;
udelay(500);
}
if (tries < 0) {
printk("Failed to read MAC address\n");
return;
}
nic_write_byte(ioc3, 0xf0);
nic_write_byte(ioc3, 0x00);
nic_write_byte(ioc3, 0x... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Does the final reference drop on our dentry lock. Right now this happens in the downconvert thread, but we could choose to simplify the dlmglue API and push these off to the ocfs2_wq in the future. */ | static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres) | /* Does the final reference drop on our dentry lock. Right now this happens in the downconvert thread, but we could choose to simplify the dlmglue API and push these off to the ocfs2_wq in the future. */
static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres) | {
struct ocfs2_dentry_lock *dl = ocfs2_lock_res_dl(lockres);
ocfs2_dentry_lock_put(osb, dl);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the Early Wakeup interrupt flag is set or not. */ | uint8_t WWDT_ReadFlag(void) | /* Checks whether the Early Wakeup interrupt flag is set or not. */
uint8_t WWDT_ReadFlag(void) | {
return (WWDT->STS_B.EWIFLG);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Serializes the ack packet into the supplied buffer. */ | int mqtt_serialize_ack(unsigned char *buf, int buflen, unsigned char packettype, unsigned char dup, unsigned short packetid) | /* Serializes the ack packet into the supplied buffer. */
int mqtt_serialize_ack(unsigned char *buf, int buflen, unsigned char packettype, unsigned char dup, unsigned short packetid) | {
mqtt_header_t header = {0};
int rc = 0;
unsigned char *ptr = buf;
FUNC_ENTRY;
if (buflen < 4)
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
goto exit;
}
header.bits.type = packettype;
header.bits.dup = dup;
header.bits.qos = (packettype == MQTTPACKET_PUBREL) ? 1 : 0;
mqtt_write_char(&ptr, header.byte);
ptr += m... | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer PRESS event is sent to the container window. This function prepares a drag operation. */ | static void wtk_handle_frame_press(struct wtk_frame *frame, struct win_pointer_event const *event) | /* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer PRESS event is sent to the container window. This function prepares a drag operation. */
static void wtk_handle_frame_press(struct wtk_frame *frame, struct win_pointer_event const *event) | {
switch (frame->state) {
case WTK_FRAME_NORMAL:
wtk_prepare_drag(&(event->pos));
win_grab_pointer(frame->container);
frame->state = WTK_FRAME_AWAITING_MOVE;
break;
default:
break;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_input_set_end_of_line(CRInput *a_this, gboolean a_eol) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_set_end_of_line(CRInput *a_this, gboolean a_eol) | {
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
PRIVATE (a_this)->end_of_line = a_eol;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The set destination address hold transfer size. The destination address hold or loop transfer size is when the DMA transfer data to destination address (TA), if the loop size is 4, the DMA will write data to TA, TA + 1, TA + 2, TA + 3, then loop back to TA, TA + 1 ... and so on. */ | static void fsl_chan_set_dest_loop_size(struct fsl_dma_chan *fsl_chan, int size) | /* The set destination address hold transfer size. The destination address hold or loop transfer size is when the DMA transfer data to destination address (TA), if the loop size is 4, the DMA will write data to TA, TA + 1, TA + 2, TA + 3, then loop back to TA, TA + 1 ... and so on. */
static void fsl_chan_set_dest_loo... | {
switch (size) {
case 0:
DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) &
(~FSL_DMA_MR_DAHE), 32);
break;
case 1:
case 2:
case 4:
case 8:
DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) |
FSL_DMA_MR_DAHE | (__ilo... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the temperature sensor and Vrefint channel. */ | void ADC_EnableTempSensorVrefint(FunctionalState Cmd) | /* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_EnableTempSensorVrefint(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
ADC1->CTRL2 |= CTRL2_TSVREFE_SET;
_EnVref1p2()
}
else
{
ADC1->CTRL2 &= CTRL2_TSVREFE_RESET;
_DisVref1p2()
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Callback routine called in the ISR/tasklet context for get ldmap call */ | static void megaraid_sysfs_get_ldmap_done(uioc_t *uioc) | /* Callback routine called in the ISR/tasklet context for get ldmap call */
static void megaraid_sysfs_get_ldmap_done(uioc_t *uioc) | {
adapter_t *adapter = (adapter_t *)uioc->buf_vaddr;
mraid_device_t *raid_dev = ADAP2RAIDDEV(adapter);
uioc->status = 0;
wake_up(&raid_dev->sysfs_wait_q);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the Multi Speed oscillator (MSI). */ | void RCC_EnableMsi(FunctionalState Cmd) | /* Enables or disables the Multi Speed oscillator (MSI). */
void RCC_EnableMsi(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
*(__IO uint32_t*)CTRLSTS_MSIEN_BB = (uint32_t)Cmd;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Hint point in y-direction and apply outerTransform. Input */ | static void cf2_glyphpath_hintPoint(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *ppt, CF2_Fixed x, CF2_Fixed y) | /* Hint point in y-direction and apply outerTransform. Input */
static void cf2_glyphpath_hintPoint(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *ppt, CF2_Fixed x, CF2_Fixed y) | {
FT_Vector pt;
pt.x = FT_MulFix( glyphpath->scaleX, x ) +
FT_MulFix( glyphpath->scaleC, y );
pt.y = cf2_hintmap_map( hintmap, y );
ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) +
FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) +
glyphpa... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* LPUART DMA send finished callback function.
This function is called when LPUART DMA send finished. It disables the LPUART TX DMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */ | static void LPUART_TransferSendDMACallback(dma_handle_t *handle, void *param) | /* LPUART DMA send finished callback function.
This function is called when LPUART DMA send finished. It disables the LPUART TX DMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */
static void LPUART_TransferSendDMACallback(dma_handle_t *handle, void *param) | {
lpuart_dma_private_handle_t *lpuartPrivateHandle = (lpuart_dma_private_handle_t *)param;
LPUART_EnableTxDMA(lpuartPrivateHandle->base, false);
DMA_DisableInterrupts(lpuartPrivateHandle->handle->txDmaHandle->base,
lpuartPrivateHandle->handle->txDmaHandle->channel);
lpuartPriva... | labapart/polymcu | C++ | null | 201 |
/* Initialization of STUSB1602 GPIO pins status after reset. */ | void HW_IF_STUSB16xx_Reset(uint8_t PortNum) | /* Initialization of STUSB1602 GPIO pins status after reset. */
void HW_IF_STUSB16xx_Reset(uint8_t PortNum) | {
HW_IF_RESET_Assert(PortNum);
for(uint16_t i=0;i<120;i++)
__NOP();
HW_IF_RESET_Deassert(PortNum);
STUSB16xx_HW_IF_TX_EN_Status(PortNum, GPIO_PIN_RESET);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* In a single threaded sys_arch implementation, this function will simply return a pointer to a global sys_timeouts variable stored in the sys_arch module. */ | struct sys_timeouts* sys_arch_timeouts(void) | /* In a single threaded sys_arch implementation, this function will simply return a pointer to a global sys_timeouts variable stored in the sys_arch module. */
struct sys_timeouts* sys_arch_timeouts(void) | {
int i;
xTaskHandle pid;
struct timeoutlist *tl;
pid = xTaskGetCurrentTaskHandle( );
for(i = 0; i < nextthread; i++)
{
tl = &(timeoutlist[i]);
if(tl->pid == pid)
{
return &(tl->timeouts);
}
}
return( &( timeoutlist[nextthread].timeouts ) );
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* SPI Set the Clock Phase to Capture on Trailing Edge. */ | void spi_set_clock_phase_1(uint32_t spi) | /* SPI Set the Clock Phase to Capture on Trailing Edge. */
void spi_set_clock_phase_1(uint32_t spi) | {
SPI_CR1(spi) |= SPI_CR1_CPHA;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Waits until the RTC Time and Date registers (RTC_TSH and RTC_DATE) are synchronized with RTC APB clock. */ | ErrorStatus RTC_WaitForSynchro(void) | /* Waits until the RTC Time and Date registers (RTC_TSH and RTC_DATE) are synchronized with RTC APB clock. */
ErrorStatus RTC_WaitForSynchro(void) | {
__IO uint32_t synchrocounter = 0;
ErrorStatus status = ERROR;
uint32_t synchrostatus = 0x00;
RTC->WRP = 0xCA;
RTC->WRP = 0x53;
RTC->INITSTS &= (uint32_t)RTC_RSF_MASK;
do
{
synchrostatus = RTC->INITSTS & RTC_INITSTS_RSYF;
synchrocounter++;
} while ((syn... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the TIMx Autoreload Register(TIMx_ARR) value to change period. */ | void RTIM_ChangePeriodImmediate(RTIM_TypeDef *TIMx, u32 Autoreload) | /* Sets the TIMx Autoreload Register(TIMx_ARR) value to change period. */
void RTIM_ChangePeriodImmediate(RTIM_TypeDef *TIMx, u32 Autoreload) | {
assert_param(IS_TIM_ALL_TIM(TIMx));
TIMx->CR &= ~TIM_CR_ARPE;
TIMx->ARR = Autoreload;
TIMx->EGR = TIM_PSCReloadMode_Immediate;
while (1) {
if (TIMx->SR & TIM_SR_UG_DONE)
break;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* A zero BufferSize doesn't seem to be prohibited, so do nothing in that case, successfully. */ | EFI_STATUS EFIAPI VirtioBlkReadBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer) | /* A zero BufferSize doesn't seem to be prohibited, so do nothing in that case, successfully. */
EFI_STATUS EFIAPI VirtioBlkReadBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer) | {
VBLK_DEV *Dev;
EFI_STATUS Status;
if (BufferSize == 0) {
return EFI_SUCCESS;
}
Dev = VIRTIO_BLK_FROM_BLOCK_IO (This);
Status = VerifyReadWriteRequest (
&Dev->BlockIoMedia,
Lba,
BufferSize,
FALSE
);
if (EFI_ERROR (Status)) {
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the thread control block for the currently active task. In case of an error the functions returns NULL. */ | sys_thread_t sys_arch_thread_current(void) | /* Returns the thread control block for the currently active task. In case of an error the functions returns NULL. */
sys_thread_t sys_arch_thread_current(void) | {
sys_tcb_t *p = tasks;
xTaskHandle pid = xTaskGetCurrentTaskHandle( );
vPortEnterCritical( );
while( ( p != NULL ) && ( p->pid != pid ) )
{
p = p->next;
}
vPortExitCritical( );
return p;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Serial gets a char.
This function will get a char from the UART */ | static int serial_getc(struct rt_serial_device *serial) | /* Serial gets a char.
This function will get a char from the UART */
static int serial_getc(struct rt_serial_device *serial) | {
char c;
int ch;
struct usart_async_descriptor* desc;
RT_ASSERT(serial != RT_NULL);
desc = (struct usart_async_descriptor *)serial->parent.user_data;
RT_ASSERT(desc != RT_NULL);
ch = -1;
if (usart_async_is_rx_not_empty(desc))
{
io_read(&desc->io, (uint8_t *)&c, 1);
c... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* this function will return the mounted path for specified device. */ | const char* dfs_filesystem_get_mounted_path(struct rt_device *device) | /* this function will return the mounted path for specified device. */
const char* dfs_filesystem_get_mounted_path(struct rt_device *device) | {
const char *path = NULL;
return path;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param handle WM8904 handle structure to be filled with default values. */ | void WM8904_GetDefaultConfig(wm8904_config_t *config) | /* param handle WM8904 handle structure to be filled with default values. */
void WM8904_GetDefaultConfig(wm8904_config_t *config) | {
memset(config, 0, sizeof(wm8904_config_t));
config->master = false;
config->protocol = kWM8904_ProtocolI2S;
config->format.sampleRate = kWM8904_SampleRate48kHz;
config->format.bitWidth = kWM8904_BitWidth16;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Write two datas element to the SPI interface. */ | void SPIBurstDataWrite(unsigned long ulBase, unsigned long *pulData) | /* Write two datas element to the SPI interface. */
void SPIBurstDataWrite(unsigned long ulBase, unsigned long *pulData) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY))
{
}
xHWREG(ulBase + SPI_TX0) = pulData[0];
xHWREG(ulBase + SPI_TX1) = pulData[1];
xHWREG(ulBase + SPI_CNTRL) |= SPI_C... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* do final setup of a 'bc' and submit the matching 'rq' to the block layer for io */ | static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, struct bsg_command *bc, struct request *rq) | /* do final setup of a 'bc' and submit the matching 'rq' to the block layer for io */
static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, struct bsg_command *bc, struct request *rq) | {
int at_head = (0 == (bc->hdr.flags & BSG_FLAG_Q_AT_TAIL));
bc->rq = rq;
bc->bio = rq->bio;
if (rq->next_rq)
bc->bidi_bio = rq->next_rq->bio;
bc->hdr.duration = jiffies;
spin_lock_irq(&bd->lock);
list_add_tail(&bc->list, &bd->busy_list);
spin_unlock_irq(&bd->lock);
dprintk("%s: queueing rq %p, bc %p\n", bd-... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* No need to abort pipes, as when this is called, all the children has been disconnected and that has done it . */ | static void hwahc_op_stop(struct usb_hcd *usb_hcd) | /* No need to abort pipes, as when this is called, all the children has been disconnected and that has done it . */
static void hwahc_op_stop(struct usb_hcd *usb_hcd) | {
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
mutex_lock(&wusbhc->mutex);
wusb_cluster_id_put(wusbhc->cluster_id);
mutex_unlock(&wusbhc->mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Receives a character. It fails if the RX fifo is not ready after a number of retries. */ | static int ug_getc(void) | /* Receives a character. It fails if the RX fifo is not ready after a number of retries. */
static int ug_getc(void) | {
int count = UG_READ_ATTEMPTS;
if (!ug_io_base)
return -1;
while (!ug_is_rxfifo_ready() && count--)
barrier();
return ug_raw_getc();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Gets the 3x3 compass transform matrix in 32 bit floating point format. */ | void inv_get_compass_soft_iron_matrix_f(float *matrix) | /* Gets the 3x3 compass transform matrix in 32 bit floating point format. */
void inv_get_compass_soft_iron_matrix_f(float *matrix) | {
matrix[i] = sensors.soft_iron.matrix_f[i];
}
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* DeInitializes peripherals used by the I2C EEPROM driver. */ | void sEE_DeInit(void) | /* DeInitializes peripherals used by the I2C EEPROM driver. */
void sEE_DeInit(void) | {
sEE_I2C_LowLevel_DeInit();
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Create "." and ".." directory entries in the newly-created parent OFile. */ | EFI_STATUS FatCreateDotDirEnts(IN FAT_OFILE *OFile) | /* Create "." and ".." directory entries in the newly-created parent OFile. */
EFI_STATUS FatCreateDotDirEnts(IN FAT_OFILE *OFile) | {
EFI_STATUS Status;
FAT_DIRENT *DirEnt;
Status = FatExpandODir (OFile);
if (EFI_ERROR (Status)) {
return Status;
}
FatSetDirEntCluster (OFile);
Status = FatCreateDirEnt (OFile, L".", FAT_ATTRIBUTE_DIRECTORY, &DirEnt);
if (EFI_ERROR (Status)) {
return Status;
}
Status = FatCreateDirEnt (OF... | tianocore/edk2 | C++ | Other | 4,240 |
/* Stop the execution of the program of the given engine. */ | static int lp5562_stop_program_exec(const struct device *dev, enum lp5562_led_sources engine) | /* Stop the execution of the program of the given engine. */
static int lp5562_stop_program_exec(const struct device *dev, enum lp5562_led_sources engine) | {
if (lp5562_set_engine_op_mode(dev, engine, LP5562_OP_MODE_DISABLED)) {
return -EIO;
}
return lp5562_set_engine_exec_state(dev, engine,
LP5562_ENGINE_MODE_HOLD);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Applies any changes that have been made to the settings. This function does nothing unless @settings is in 'delay-apply' mode; see g_settings_delay(). In the normal case settings are always applied immediately. */ | void g_settings_apply(GSettings *settings) | /* Applies any changes that have been made to the settings. This function does nothing unless @settings is in 'delay-apply' mode; see g_settings_delay(). In the normal case settings are always applied immediately. */
void g_settings_apply(GSettings *settings) | {
if (settings->priv->delayed)
{
GDelayedSettingsBackend *delayed;
delayed = G_DELAYED_SETTINGS_BACKEND (settings->priv->backend);
g_delayed_settings_backend_apply (delayed);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Simple write access callback for the alert level characteristic. */ | static int ble_svc_ias_access(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) | /* Simple write access callback for the alert level characteristic. */
static int ble_svc_ias_access(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) | {
int rc;
assert(ctxt->chr == &ble_svc_ias_defs[0].characteristics[0]);
switch (ctxt->op) {
case BLE_GATT_ACCESS_OP_WRITE_CHR:
rc = ble_svc_ias_chr_write(ctxt->om,
sizeof ble_svc_ias_alert_level,
sizeof ble_svc_ias_alert_level... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Initializes the HID Joystick device driver.
Callback function when new request receivce from host */ | void HIDDJoystickDriver_Initialize() | /* Initializes the HID Joystick device driver.
Callback function when new request receivce from host */
void HIDDJoystickDriver_Initialize() | {
hiddJoystickDriver.inputReportIdleRate = 0;
HIDDJoystickInputReport_Initialize(&(hiddJoystickDriver.inputReport));
USBDDriver_Initialize(&(hiddJoystickDriver.usbdDriver),
&hiddJoystickDriverDescriptors,
0);
USBD_Init();
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* Check if there is a destination for the connection, if so bind the connection to the destination. */ | struct ip_vs_dest* ip_vs_try_bind_dest(struct ip_vs_conn *cp) | /* Check if there is a destination for the connection, if so bind the connection to the destination. */
struct ip_vs_dest* ip_vs_try_bind_dest(struct ip_vs_conn *cp) | {
struct ip_vs_dest *dest;
if ((cp) && (!cp->dest)) {
dest = ip_vs_find_dest(cp->af, &cp->daddr, cp->dport,
&cp->vaddr, cp->vport,
cp->protocol);
ip_vs_bind_dest(cp, dest);
return dest;
} else
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check sense key to find if media has changed. */ | BOOLEAN ScsiDiskIsMediaChange(IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts) | /* Check sense key to find if media has changed. */
BOOLEAN ScsiDiskIsMediaChange(IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts) | {
EFI_SCSI_SENSE_DATA *SensePtr;
UINTN Index;
BOOLEAN IsMediaChanged;
IsMediaChanged = FALSE;
SensePtr = SenseData;
for (Index = 0; Index < SenseCounts; Index++) {
if ((SensePtr->Sense_Key == EFI_SCSI_SK_UNIT_ATTENTION) &&
(SensePtr->Addnl_Sense_Code == EFI_SCS... | tianocore/edk2 | C++ | Other | 4,240 |
/* The user Entry Point for module CpuIo2Dxe. The user code starts with this function. */ | EFI_STATUS EFIAPI ArmPciCpuIo2Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module CpuIo2Dxe. The user code starts with this function. */
EFI_STATUS EFIAPI ArmPciCpuIo2Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiCpuIo2ProtocolGuid);
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEfiCpuIo2ProtocolGuid,
&mCpuIo2,
NULL
);
ASSERT_EFI_ERROR (Status);
r... | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure SMM Code Access Check feature on an AP. SMM Feature Control MSR will be locked after configuration. */ | VOID EFIAPI ConfigSmmCodeAccessCheckOnCurrentProcessor(IN OUT VOID *Buffer) | /* Configure SMM Code Access Check feature on an AP. SMM Feature Control MSR will be locked after configuration. */
VOID EFIAPI ConfigSmmCodeAccessCheckOnCurrentProcessor(IN OUT VOID *Buffer) | {
UINTN CpuIndex;
UINT64 SmmFeatureControlMsr;
UINT64 NewSmmFeatureControlMsr;
CpuIndex = *(UINTN *)Buffer;
SmmFeatureControlMsr = SmmCpuFeaturesGetSmmRegister (CpuIndex, SmmRegFeatureControl);
NewSmmFeatureControlMsr = SmmFeatureControlMsr;
if (mSmmCodeAccessCheckEnable) {
NewSmmFeatureControlMsr... | tianocore/edk2 | C++ | Other | 4,240 |
/* Return the aggregator of the slave that is next in line of @aggregator's slave in the bond, or NULL if it can't be found. */ | static struct aggregator* __get_next_agg(struct aggregator *aggregator) | /* Return the aggregator of the slave that is next in line of @aggregator's slave in the bond, or NULL if it can't be found. */
static struct aggregator* __get_next_agg(struct aggregator *aggregator) | {
struct slave *slave = aggregator->slave;
struct bonding *bond = bond_get_bond_by_slave(slave);
if ((bond == NULL) || (slave->next == bond->first_slave)) {
return NULL;
}
return &(SLAVE_AD_INFO(slave->next).aggregator);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Software SMI callback for restoring SMRR base and mask in S3 path. */ | EFI_STATUS EFIAPI BlSwSmiHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize) | /* Software SMI callback for restoring SMRR base and mask in S3 path. */
EFI_STATUS EFIAPI BlSwSmiHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize) | {
SetSmrrOnS3 ();
SmmFeatureLockOnS3 ();
LockSmiGlobalEn ();
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the captured data from a sample sequence. */ | unsigned long ADCDataGet(unsigned long ulBase, unsigned long *pulBuffer) | /* Get the captured data from a sample sequence. */
unsigned long ADCDataGet(unsigned long ulBase, unsigned long *pulBuffer) | {
unsigned long i, j;
unsigned long ulSeqLen,ulChannelNo[16];
unsigned long ulWrite;
xASSERT(ulBase == ADC_BASE);
xASSERT(pulBuffer != 0);
ulSeqLen = ((xHWREG(ulBase + ADC_CONV) & ADC_CONV_SEQL_M) >> ADC_CONV_SEQL_S) + 1;
for(i = 0; i < ulSeqLen; i++)
{
ulChannelNo[i] = (xHWREG(u... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Wait for the env to be ready for execute specified TRB. */ | EFI_STATUS SdPeimWaitTrbEnv(IN UINTN Bar, IN SD_TRB *Trb) | /* Wait for the env to be ready for execute specified TRB. */
EFI_STATUS SdPeimWaitTrbEnv(IN UINTN Bar, IN SD_TRB *Trb) | {
EFI_STATUS Status;
SD_COMMAND_PACKET *Packet;
UINT64 Timeout;
BOOLEAN InfiniteWait;
Packet = Trb->Packet;
Timeout = Packet->Timeout;
if (Timeout == 0) {
InfiniteWait = TRUE;
} else {
InfiniteWait = FALSE;
}
while (InfiniteWait || (Timeout > 0)) {
Status... | tianocore/edk2 | C++ | Other | 4,240 |
/* Make sure the single step bit is not set. */ | void ptrace_disable(struct task_struct *child) | /* Make sure the single step bit is not set. */
void ptrace_disable(struct task_struct *child) | {
unsigned long tmp;
tmp = get_reg(child, PT_SYSCFG) & ~TRACE_BITS;
put_reg(child, PT_SYSCFG, tmp);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Init interrupts callback for the specified SPI Port. */ | void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback) | /* Init interrupts callback for the specified SPI Port. */
void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
switch(ulBase)
{
case SPI0_BASE:
{
g_pfnSPIHandlerCallbacks[0] = xtSPICallback;
break;
}
case SPI1_BASE:
{
g_pfnSPIHandlerCallbacks[1] =... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Calculate the first channel that we should advertise upon when we start an advertising event. */ | static uint8_t ble_ll_adv_first_chan(struct ble_ll_adv_sm *advsm) | /* Calculate the first channel that we should advertise upon when we start an advertising event. */
static uint8_t ble_ll_adv_first_chan(struct ble_ll_adv_sm *advsm) | {
uint8_t adv_chan;
if (advsm->adv_chanmask & 0x01) {
adv_chan = BLE_PHY_ADV_CHAN_START;
} else if (advsm->adv_chanmask & 0x02) {
adv_chan = BLE_PHY_ADV_CHAN_START + 1;
} else {
adv_chan = BLE_PHY_ADV_CHAN_START + 2;
}
return adv_chan;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Event notification function for EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey event Signal the event if there is key available */ | VOID EFIAPI TerminalConInWaitForKey(IN EFI_EVENT Event, IN VOID *Context) | /* Event notification function for EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey event Signal the event if there is key available */
VOID EFIAPI TerminalConInWaitForKey(IN EFI_EVENT Event, IN VOID *Context) | {
if (!IsEfiKeyFiFoEmpty ((TERMINAL_DEV *)Context)) {
gBS->SignalEvent (Event);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The set will be rejected if the last BD of the set does not mark the end of a packet (see XEmacPs_BdSetLast()). */ | LONG XEmacPs_BdRingToHw(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd *BdSetPtr) | /* The set will be rejected if the last BD of the set does not mark the end of a packet (see XEmacPs_BdSetLast()). */
LONG XEmacPs_BdRingToHw(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd *BdSetPtr) | {
XEmacPs_Bd *CurBdPtr;
u32 i;
LONG Status;
if (0U == NumBd){
Status = (LONG)(XST_SUCCESS);
} else {
if ((RingPtr->PreCnt < NumBd) || (RingPtr->PreHead != BdSetPtr)) {
Status = (LONG)(XST_DMA_SG_LIST_ERROR);
} else {
CurBdPtr = BdSetPtr;
for (i = 0U; i < NumBd; i++) {
CurBdPtr = (XEmacPs_Bd *)((voi... | ua1arn/hftrx | C++ | null | 69 |
/* twidjoy_interrupt() is called by the low level driver when characters are ready for us. We then buffer them for further processing, or call the packet processing routine. */ | static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags) | /* twidjoy_interrupt() is called by the low level driver when characters are ready for us. We then buffer them for further processing, or call the packet processing routine. */
static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags) | {
struct twidjoy *twidjoy = serio_get_drvdata(serio);
if ((data & 0x80) == 0)
twidjoy->idx = 0;
else if (twidjoy->idx == 0)
return IRQ_HANDLED;
if (twidjoy->idx < TWIDJOY_MAX_LENGTH)
twidjoy->data[twidjoy->idx++] = data;
if (twidjoy->idx == TWIDJOY_MAX_LENGTH) {
twidjoy_process_packet(twidjoy);
twidjoy->... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Look for an active local variable with the name 'n' in the function 'fs'. If found, initialize 'var' with it and return its expression kind; otherwise return -1. */ | static int searchvar(FuncState *fs, TString *n, expdesc *var) | /* Look for an active local variable with the name 'n' in the function 'fs'. If found, initialize 'var' with it and return its expression kind; otherwise return -1. */
static int searchvar(FuncState *fs, TString *n, expdesc *var) | {
Vardesc *vd = getlocalvardesc(fs, i);
if (eqstr(n, vd->vd.name)) {
if (vd->vd.kind == RDKCTC)
init_exp(var, VCONST, fs->firstlocal + i);
else
init_var(fs, var, i);
return var->k;
}
}
return -1;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* The functions reads the contents of the Miscellaneous control register. */ | u32 XAdcPs_GetMiscCtrlRegister(XAdcPs *InstancePtr) | /* The functions reads the contents of the Miscellaneous control register. */
u32 XAdcPs_GetMiscCtrlRegister(XAdcPs *InstancePtr) | {
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
return XAdcPs_ReadReg((InstancePtr)->Config.BaseAddress,
XADCPS_MCTL_OFFSET);
} | ua1arn/hftrx | C++ | null | 69 |
/* Helper to read internal registers from card logic (not CAN) */ | static u8 ems_pci_v1_readb(struct ems_pci_card *card, unsigned int port) | /* Helper to read internal registers from card logic (not CAN) */
static u8 ems_pci_v1_readb(struct ems_pci_card *card, unsigned int port) | {
return readb(card->base_addr + (port * 4));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write two datas element to the SPI interface. */ | void SPIBurstDataWrite(unsigned long ulBase, unsigned long *pulData) | /* Write two datas element to the SPI interface. */
void SPIBurstDataWrite(unsigned long ulBase, unsigned long *pulData) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY))
{
}
xHWREG(ulBase + SPI_TX0) = pulData[0];
xHWREG(ulBase + SPI_TX1) = pulData[1];
xHWREG(ulBase + SPI_CNTRL) |= SPI_... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This might be called early when some more specific ways to detect revision are not yet available. */ | void set_board_type(void) | /* This might be called early when some more specific ways to detect revision are not yet available. */
void set_board_type(void) | {
const struct udevice_id *of_match = board_ids;
int ret;
gd->board_type = EXYNOS5_BOARD_GENERIC;
while (of_match->compatible) {
ret = fdt_node_check_compatible(gd->fdt_blob, 0,
of_match->compatible);
if (ret)
of_match++;
gd->board_type = of_match->data;
break;
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Print all connected members of this WSS The EDA cache contains all members of WSS neighborhood. */ | static ssize_t wlp_wss_members_show(struct wlp_wss *wss, char *buf) | /* Print all connected members of this WSS The EDA cache contains all members of WSS neighborhood. */
static ssize_t wlp_wss_members_show(struct wlp_wss *wss, char *buf) | {
struct wlp *wlp = container_of(wss, struct wlp, wss);
return wlp_eda_show(wlp, buf);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified SDADC flag is set or not. */ | FlagStatus SDADC_GetFlagStatus(SDADC_TypeDef *SDADCx, uint32_t SDADC_FLAG) | /* Checks whether the specified SDADC flag is set or not. */
FlagStatus SDADC_GetFlagStatus(SDADC_TypeDef *SDADCx, uint32_t SDADC_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_SDADC_ALL_PERIPH(SDADCx));
assert_param(IS_SDADC_GET_FLAG(SDADC_FLAG));
if ((SDADCx->ISR & SDADC_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Return 1 if one or more PIOs of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead. */ | uint32_t pio_get_output_data_status(const Pio *p_pio, const uint32_t ul_mask) | /* Return 1 if one or more PIOs of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead. */
uint32_t pio_get_output_data_status(const Pio *p_pio, const uint32_t ul_mask) | {
if ((p_pio->PIO_ODSR & ul_mask) == 0) {
return 0;
} else {
return 1;
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function returns zero in case of success, %-EBADF if the volume is damaged because of an interrupted update, %-EBADMSG if the logical eraseblock is already mapped, and other negative error codes in case of other failures. */ | int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype) | /* This function returns zero in case of success, %-EBADF if the volume is damaged because of an interrupted update, %-EBADMSG if the logical eraseblock is already mapped, and other negative error codes in case of other failures. */
int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype) | {
struct ubi_volume *vol = desc->vol;
struct ubi_device *ubi = vol->ubi;
dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum);
if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
return -EROFS;
if (lnum < 0 || lnum >= vol->reserved_pebs)
return -EINVAL;
if (dtype != UBI_LONGTERM && dtype != UBI_SHO... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Change Logs: Date Author Notes Zero-Free first version */ | static void uart_console_reconfig(void) | /* Change Logs: Date Author Notes Zero-Free first version */
static void uart_console_reconfig(void) | {
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
rt_device_control(rt_console_get_device(), RT_DEVICE_CTRL_CONFIG, &config);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Free the route table entry. It is reference counted. */ | VOID Ip4FreeRouteEntry(IN IP4_ROUTE_ENTRY *RtEntry) | /* Free the route table entry. It is reference counted. */
VOID Ip4FreeRouteEntry(IN IP4_ROUTE_ENTRY *RtEntry) | {
ASSERT (RtEntry->RefCnt > 0);
if (--RtEntry->RefCnt == 0) {
FreePool (RtEntry);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */ | void rt_hw_trap_udef(struct rt_hw_register *regs) | /* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_register *regs) | {
rt_hw_show_register(regs);
rt_kprintf("undefined instruction\n");
rt_kprintf("thread - %s stack:\n", rt_current_thread->name);
rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry);
rt_hw_cpu_shutdown();
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Special-case - softirqs can safely be enabled in cond_resched_softirq(), or by __do_softirq(), without processing still-pending softirqs: */ | void _local_bh_enable(void) | /* Special-case - softirqs can safely be enabled in cond_resched_softirq(), or by __do_softirq(), without processing still-pending softirqs: */
void _local_bh_enable(void) | {
WARN_ON_ONCE(in_irq());
WARN_ON_ONCE(!irqs_disabled());
if (softirq_count() == SOFTIRQ_OFFSET)
trace_softirqs_on((unsigned long)__builtin_return_address(0));
sub_preempt_count(SOFTIRQ_OFFSET);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Derive SHA256 HMAC-based Expand Key Derivation Function (HKDF). */ | BOOLEAN EFIAPI CryptoServiceHkdfSha256Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize) | /* Derive SHA256 HMAC-based Expand Key Derivation Function (HKDF). */
BOOLEAN EFIAPI CryptoServiceHkdfSha256Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize) | {
return CALL_BASECRYPTLIB (Hkdf.Services.Sha256Expand, HkdfSha256Expand, (Prk, PrkSize, Info, InfoSize, Out, OutSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Application entry point for IPC example on core 1. */ | int main(void) | /* Application entry point for IPC example on core 1. */
int main(void) | {
*cnt = 0;
configure_ipc();
configure_console();
usart_write_line(CONF_UART, STRING_HEADER);
ipc_set_command(IPC0, IPC_INTERRUPT_SRC_IRQ0);
while (1) {
if (is_core0_signal == true) {
is_core0_signal = false;
LED_On(LED0);
usart_write_line(CONF_UART, "Got IRQ signal from core0\r\n\0");
delay_s(2);
... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* DMAbuf_start_devices() is called by the /dev/music driver to start one or more audio devices at desired moment. */ | void DMAbuf_start_devices(unsigned int devmask) | /* DMAbuf_start_devices() is called by the /dev/music driver to start one or more audio devices at desired moment. */
void DMAbuf_start_devices(unsigned int devmask) | {
struct audio_operations *adev;
int dev;
for (dev = 0; dev < num_audiodevs; dev++) {
if (!(devmask & (1 << dev)))
continue;
if (!(adev = audio_devs[dev]))
continue;
if (adev->open_mode == 0)
continue;
if (adev->go)
continue;
adev->go = 1;
if (adev->d->trigger)
adev->d->trigger(dev,adev->e... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Block input and output are easy on shared memory ethercards, the only complication is when the ring buffer wraps. The count will already be rounded up to a doubleword value via ne3210_get_8390_hdr() above. */ | static void ne3210_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) | /* Block input and output are easy on shared memory ethercards, the only complication is when the ring buffer wraps. The count will already be rounded up to a doubleword value via ne3210_get_8390_hdr() above. */
static void ne3210_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) | {
void __iomem *start = ei_status.mem + ring_offset - NE3210_START_PG*256;
if (ring_offset + count > NE3210_STOP_PG*256) {
int semi_count = NE3210_STOP_PG*256 - ring_offset;
memcpy_fromio(skb->data, start, semi_count);
count -= semi_count;
memcpy_fromio(skb->data + semi_count,
ei_status.mem + TX_PAGES*256... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read or write a metadata area. Remembering to skip the first chunk which holds the header. */ | static int area_io(struct pstore *ps, int rw) | /* Read or write a metadata area. Remembering to skip the first chunk which holds the header. */
static int area_io(struct pstore *ps, int rw) | {
int r;
chunk_t chunk;
chunk = area_location(ps, ps->current_area);
r = chunk_io(ps, ps->area, chunk, rw, 0);
if (r)
return r;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initialize the I2C controller. This function initializes operation of the I2C Master block. Upon successful initialization of the I2C block, this function will have set the bus speed for the master, and will have enabled the I2C Master block. */ | void xI2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk) | /* Initialize the I2C controller. This function initializes operation of the I2C Master block. Upon successful initialization of the I2C block, this function will have set the bus speed for the master, and will have enabled the I2C Master block. */
void xI2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk) | {
I2CMasterInit(ulBase, ulI2CClk);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* param base Pointer to FLEXIO_I2C_Type structure. param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully return th... | status_t FLEXIO_I2C_MasterTransferGetCount(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, size_t *count) | /* param base Pointer to FLEXIO_I2C_Type structure. param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully return th... | {
if (!count)
{
return kStatus_InvalidArgument;
}
*count = handle->transferSize - handle->transfer.dataSize;
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This can be both boosting and unboosting. task->pi_lock must be held. */ | static void __rt_mutex_adjust_prio(struct task_struct *task) | /* This can be both boosting and unboosting. task->pi_lock must be held. */
static void __rt_mutex_adjust_prio(struct task_struct *task) | {
int prio = rt_mutex_getprio(task);
if (task->prio != prio)
rt_mutex_setprio(task, prio);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Stop specified slot in transfer list of a UFS device. */ | VOID UfsStopExecCmd(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Slot) | /* Stop specified slot in transfer list of a UFS device. */
VOID UfsStopExecCmd(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 Slot) | {
UINTN UfsHcBase;
UINTN Address;
UINT32 Data;
UfsHcBase = Private->UfsHcBase;
Address = UfsHcBase + UFS_HC_UTRLDBR_OFFSET;
Data = MmioRead32 (Address);
if ((Data & (BIT0 << Slot)) != 0) {
Address = UfsHcBase + UFS_HC_UTRLCLR_OFFSET;
Data = MmioRead32 (Address);
MmioWrite32 (Address... | tianocore/edk2 | C++ | Other | 4,240 |
/* Deinitializes COMP peripheral registers to their default reset values. */ | void COMP_DeInit(void) | /* Deinitializes COMP peripheral registers to their default reset values. */
void COMP_DeInit(void) | {
COMP->CSR = ((uint32_t)0x00000000);
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* report_return_code() - Report any error and return failure or success */ | int report_return_code(int return_code) | /* report_return_code() - Report any error and return failure or success */
int report_return_code(int return_code) | {
if (return_code) {
printf("Error: %d\n", return_code);
return CMD_RET_FAILURE;
} else {
return CMD_RET_SUCCESS;
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function unregisters volume notifier @nm and returns zero in case of success and a negative error code in case of failure. */ | int ubi_unregister_volume_notifier(struct notifier_block *nb) | /* This function unregisters volume notifier @nm and returns zero in case of success and a negative error code in case of failure. */
int ubi_unregister_volume_notifier(struct notifier_block *nb) | {
return blocking_notifier_chain_unregister(&ubi_notifiers, nb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @pointer: mac address @buf: pointer to buffer address on return position of terminating zero word */ | static void mac(void *pointer, u16 **buf) | /* @pointer: mac address @buf: pointer to buffer address on return position of terminating zero word */
static void mac(void *pointer, u16 **buf) | {
int i, j;
u16 c;
u8 *p = (u8 *)pointer;
u8 byte;
u16 *pos = *buf;
for (i = 0; i < ARP_HLEN; ++i) {
if (i)
*pos++ = ':';
byte = p[i];
for (j = 4; j >= 0; j -= 4) {
c = (byte >> j) & 0x0f;
c += '0';
if (c > '9')
c += 'a' - '9' - 1;
*pos++ = c;
}
}
*pos = 0;
*buf = pos;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Add/remove the given breakpoint in our constraint table */ | static void toggle_bp_slot(struct perf_event *bp, bool enable) | /* Add/remove the given breakpoint in our constraint table */
static void toggle_bp_slot(struct perf_event *bp, bool enable) | {
int cpu = bp->cpu;
struct task_struct *tsk = bp->ctx->task;
if (tsk) {
if (cpu >= 0) {
toggle_bp_task_slot(tsk, cpu, enable);
return;
}
for_each_online_cpu(cpu)
toggle_bp_task_slot(tsk, cpu, enable);
return;
}
if (enable)
per_cpu(nr_cpu_bp_pinned, bp->cpu)++;
else
per_cpu(nr_cpu_bp_pinned, ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Search socket list of the SAP and finds connections with same sap. Deliver clone to each. */ | static void llc_sap_mcast(struct llc_sap *sap, const struct llc_addr *laddr, struct sk_buff *skb) | /* Search socket list of the SAP and finds connections with same sap. Deliver clone to each. */
static void llc_sap_mcast(struct llc_sap *sap, const struct llc_addr *laddr, struct sk_buff *skb) | {
struct sock *sk;
struct hlist_node *node;
read_lock_bh(&sap->sk_list.lock);
sk_for_each(sk, node, &sap->sk_list.list) {
struct llc_sock *llc = llc_sk(sk);
struct sk_buff *skb1;
if (sk->sk_type != SOCK_DGRAM)
continue;
if (llc->laddr.lsap != laddr->lsap)
continue;
if (llc->dev != skb->dev)
conti... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check whether a transfer complete for PIO operation in the Cadence controller has finished. */ | static int cdns_pio_transfer_complete(uintptr_t base_address, uint8_t thread) | /* Check whether a transfer complete for PIO operation in the Cadence controller has finished. */
static int cdns_pio_transfer_complete(uintptr_t base_address, uint8_t thread) | {
uint32_t status;
status = WAIT_FOR(((cdns_nand_get_thrd_status(base_address, thread)) != 0), IDLE_TIME_OUT,
k_msleep(1));
if (status == 0) {
LOG_ERR("Timed out waiting for thread status response");
return -ETIMEDOUT;
}
if ((status & (BIT(F_CSTAT_COMP)))) {
if ((status & (BIT(F_CSTAT_FAIL)))) {
LOG_... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Signal the registered event. It is the callback routine for NetMapIterate. */ | EFI_STATUS EFIAPI Ip4Config2SignalEvent(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg) | /* Signal the registered event. It is the callback routine for NetMapIterate. */
EFI_STATUS EFIAPI Ip4Config2SignalEvent(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg) | {
gBS->SignalEvent ((EFI_EVENT)Item->Key);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the UART hardware flow control mode currently in use. */ | unsigned long UARTFlowControlGet(unsigned long ulBase) | /* Returns the UART hardware flow control mode currently in use. */
unsigned long UARTFlowControlGet(unsigned long ulBase) | {
ASSERT(UARTBaseValid(ulBase));
return(HWREG(ulBase + UART_O_CTL) & (UART_FLOWCONTROL_TX |
UART_FLOWCONTROL_RX));
} | micropython/micropython | C++ | Other | 18,334 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.