docstring stringlengths 22 576 | signature stringlengths 9 317 | prompt stringlengths 57 886 | code stringlengths 20 1.36k | repository stringclasses 49 values | language stringclasses 2 values | license stringclasses 9 values | stars int64 15 21.3k |
|---|---|---|---|---|---|---|---|
/* This function is added in order to simulate arduino delay() function */ | void __msleep(int milisec) | /* This function is added in order to simulate arduino delay() function */
void __msleep(int milisec) | {
struct timespec req;
req.tv_sec = (time_t) milisec / 1000;
req.tv_nsec = (milisec % 1000 ) * 1000000L;
clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL);
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Execute ISP FMC_ISPCMD_PROGRAM_64 to program a double-word to flash. */ | int32_t FMC_Write8Bytes(uint32_t u32addr, uint32_t u32data0, uint32_t u32data1) | /* Execute ISP FMC_ISPCMD_PROGRAM_64 to program a double-word to flash. */
int32_t FMC_Write8Bytes(uint32_t u32addr, uint32_t u32data0, uint32_t u32data1) | {
int32_t ret = 0;
FMC->ISPCMD = FMC_ISPCMD_PROGRAM_64;
FMC->ISPADDR = u32addr;
FMC->MPDAT0 = u32data0;
FMC->MPDAT1 = u32data1;
FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk;
while (FMC->ISPSTS & FMC_ISPSTS_ISPBUSY_Msk) { }
if (FMC->ISPSTS & FMC_ISPSTS_ISPFF_Msk) {
FMC->ISPSTS |= FMC_ISPSTS_ISPFF_Msk;
ret = -1;
}
return ret;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Changes the CRB window to the specified window. */ | static void netxen_nic_pci_set_crbwindow_128M(struct netxen_adapter *adapter, u32 window) | /* Changes the CRB window to the specified window. */
static void netxen_nic_pci_set_crbwindow_128M(struct netxen_adapter *adapter, u32 window) | {
void __iomem *offset;
int count = 10;
u8 func = adapter->ahw.pci_func;
if (adapter->ahw.crb_win == window)
return;
offset = PCI_OFFSET_SECOND_RANGE(adapter,
NETXEN_PCIX_PH_REG(PCIE_CRB_WINDOW_REG(func)));
writel(window, offset);
do {
if (window == readl(offset))
break;
if (printk_ratelimit())
dev_warn(&adapter->pdev->dev,
"failed to set CRB window to %d\n",
(window == NETXEN_WINDOW_ONE));
udelay(1);
} while (--count > 0);
if (count > 0)
adapter->ahw.crb_win = window;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) | /* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hspi->Instance==SPI1)
{
__HAL_RCC_SPI1_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_4;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
__HAL_AFIO_REMAP_SPI1_ENABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check, whether MC's (virtual) DMA address caused the bus error. See "Virtual DMA Specification", Draft 1.5, Feb 13 1992, SGI */ | static int addr_is_ram(unsigned long addr, unsigned sz) | /* Check, whether MC's (virtual) DMA address caused the bus error. See "Virtual DMA Specification", Draft 1.5, Feb 13 1992, SGI */
static int addr_is_ram(unsigned long addr, unsigned sz) | {
int i;
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long a = boot_mem_map.map[i].addr;
if (a <= addr && addr+sz <= a+boot_mem_map.map[i].size)
return 1;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* common portion: create a unix date from a dos date */ | static time_t int_unix_date(uint32_t dos_date) | /* common portion: create a unix date from a dos date */
static time_t int_unix_date(uint32_t dos_date) | {
struct tm t;
if (dos_date == 0)
return(0);
interpret_dos_date(dos_date, &t);
t.tm_wday = 1;
t.tm_yday = 1;
t.tm_isdst = 0;
return (mktime(&t));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* libc/string/strlcat.c A variant of strcat that truncates the result to fit in the destination buffer */ | size_t strlcat(char *dest, const char *src, size_t n) | /* libc/string/strlcat.c A variant of strcat that truncates the result to fit in the destination buffer */
size_t strlcat(char *dest, const char *src, size_t n) | {
size_t dsize = strlen(dest);
size_t len = strlen(src);
size_t res = dsize + len;
dest += dsize;
n -= dsize;
if (len >= n)
len = n-1;
memcpy(dest, src, len);
dest[len] = 0;
return res;
} | xboot/xboot | C++ | MIT License | 779 |
/* pwm_auto_point_temp mapping table: Note that there is only a single set of temp auto points that controls both PWM controllers. We still create 2 sets of sysfs files to make it look more consistent even though they map to the same registers. */ | static ssize_t show_pwm_auto_point_temp(struct device *dev, struct device_attribute *attr, char *buf) | /* pwm_auto_point_temp mapping table: Note that there is only a single set of temp auto points that controls both PWM controllers. We still create 2 sets of sysfs files to make it look more consistent even though they map to the same registers. */
static ssize_t show_pwm_auto_point_temp(struct device *dev, struct device_attribute *attr, char *buf) | {
struct vt1211_data *data = vt1211_update_device(dev);
struct sensor_device_attribute_2 *sensor_attr_2 =
to_sensor_dev_attr_2(attr);
int ix = sensor_attr_2->index;
int ap = sensor_attr_2->nr;
return sprintf(buf, "%d\n", TEMP_FROM_REG(data->pwm_ctl[ix] & 7,
data->pwm_auto_temp[ap]));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* s e t I n f e a s i b i l i t y F l a g */ | returnValue QProblem_setInfeasibilityFlag(QProblem *_THIS, returnValue returnvalue, BooleanType doThrowError) | /* s e t I n f e a s i b i l i t y F l a g */
returnValue QProblem_setInfeasibilityFlag(QProblem *_THIS, returnValue returnvalue, BooleanType doThrowError) | {
_THIS->infeasible = BT_TRUE;
if ( _THIS->options.enableFarBounds == BT_FALSE )
THROWERROR( returnvalue );
return returnvalue;
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* The tree locks are not taken by this function. They need to be held by the caller. */ | static int split_state(struct extent_io_tree *tree, struct extent_state *orig, struct extent_state *prealloc, u64 split) | /* The tree locks are not taken by this function. They need to be held by the caller. */
static int split_state(struct extent_io_tree *tree, struct extent_state *orig, struct extent_state *prealloc, u64 split) | {
struct rb_node *node;
split_cb(tree, orig, split);
prealloc->start = orig->start;
prealloc->end = split - 1;
prealloc->state = orig->state;
orig->start = split;
node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node);
if (node) {
free_extent_state(prealloc);
return -EEXIST;
}
prealloc->tree = tree;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified DMAy Channelx flag is set or not. */ | FlagStatus DMA_GetFlagStatus(uint32_t DMA_FLAG) | /* Checks whether the specified DMAy Channelx flag is set or not. */
FlagStatus DMA_GetFlagStatus(uint32_t DMA_FLAG) | {
FlagStatus bitstatus = RESET;
uint32_t tmpreg = 0;
assert_param(IS_DMA_GET_FLAG(DMA_FLAG));
tmpreg = DMA1->ISR ;
if ((tmpreg & DMA_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Retrieve the Signature Algorithm from one X.509 certificate. */ | BOOLEAN EFIAPI CryptoServiceX509GetSignatureAlgorithm(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *Oid, OPTIONAL IN OUT UINTN *OidSize) | /* Retrieve the Signature Algorithm from one X.509 certificate. */
BOOLEAN EFIAPI CryptoServiceX509GetSignatureAlgorithm(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *Oid, OPTIONAL IN OUT UINTN *OidSize) | {
return CALL_BASECRYPTLIB (X509.Services.GetSignatureAlgorithm, X509GetSignatureAlgorithm, (Cert, CertSize, Oid, OidSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the PLL1 monitor mode.
This function sets the PLL1 monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */ | void CLOCK_SetPll1MonitorMode(scg_pll1_monitor_mode_t mode) | /* Sets the PLL1 monitor mode.
This function sets the PLL1 monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */
void CLOCK_SetPll1MonitorMode(scg_pll1_monitor_mode_t mode) | {
uint32_t reg = SCG0->SPLLCSR;
reg &= ~(SCG_SPLLCSR_SPLLCM_MASK | SCG_SPLLCSR_SPLLCMRE_MASK);
reg |= (uint32_t)mode;
SCG0->SPLLCSR = reg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Stops a timer.
This function stops a running timer */ | int tmrHw_stopTimer(tmrHw_ID_t timerId) | /* Stops a timer.
This function stops a running timer */
int tmrHw_stopTimer(tmrHw_ID_t timerId) | {
pTmrHw[timerId].Control &= ~tmrHw_CONTROL_TIMER_ENABLE;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* returns 0 on success, -ERRNO on failure. (Never fails.) */ | int ctcm_close(struct net_device *dev) | /* returns 0 on success, -ERRNO on failure. (Never fails.) */
int ctcm_close(struct net_device *dev) | {
struct ctcm_priv *priv = dev->ml_priv;
CTCMY_DBF_DEV_NAME(SETUP, dev, "");
if (!IS_MPC(priv))
fsm_event(priv->fsm, DEV_EVENT_STOP, dev);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disables the timer/counter for a PWM generator block. */ | void PWMGenDisable(uint32_t ui32Base, uint32_t ui32Gen) | /* Disables the timer/counter for a PWM generator block. */
void PWMGenDisable(uint32_t ui32Base, uint32_t ui32Gen) | {
ASSERT(ui32Base == PWM0_BASE);
ASSERT(_PWMGenValid(ui32Gen));
HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_CTL) &=
~(PWM_X_CTL_ENABLE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @discussion This function sets the fill rule of an elementary object. Avaliable quality setting contains: ELM_EVO_EO, ELM_EVO_NZ. It only applies to evo object. */ | BOOL ElmSetFill(ElmVecObj evo, ELM_EVO_FILL fill) | /* @discussion This function sets the fill rule of an elementary object. Avaliable quality setting contains: ELM_EVO_EO, ELM_EVO_NZ. It only applies to evo object. */
BOOL ElmSetFill(ElmVecObj evo, ELM_EVO_FILL fill) | {
return _set_fill(evo, fill);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Indicates whether or not the I2C bus is busy. */ | tBoolean I2CMasterBusBusy(unsigned long ulBase) | /* Indicates whether or not the I2C bus is busy. */
tBoolean I2CMasterBusBusy(unsigned long ulBase) | {
ASSERT(I2CMasterBaseValid(ulBase));
if(HWREG(ulBase + I2C_O_MCS) & I2C_MCS_BUSBSY)
{
return(true);
}
else
{
return(false);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the Nic handle using any child handle in the IPv6 stack. */ | EFI_HANDLE PxeBcGetNicByIp6Children(IN EFI_HANDLE ControllerHandle) | /* Get the Nic handle using any child handle in the IPv6 stack. */
EFI_HANDLE PxeBcGetNicByIp6Children(IN EFI_HANDLE ControllerHandle) | {
EFI_HANDLE NicHandle;
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiIp6ProtocolGuid);
if (NicHandle == NULL) {
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp6ProtocolGuid);
if (NicHandle == NULL) {
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);
if (NicHandle == NULL) {
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiMtftp6ProtocolGuid);
if (NicHandle == NULL) {
return NULL;
}
}
}
}
return NicHandle;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* brief Gets the slave transfer status during a non-blocking transfer. param base The LPI2C peripheral base address. param handle Pointer to i2c_slave_handle_t structure. param count Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. retval #kStatus_Success retval #kStatus_NoTransferInProgress */ | status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count) | /* brief Gets the slave transfer status during a non-blocking transfer. param base The LPI2C peripheral base address. param handle Pointer to i2c_slave_handle_t structure. param count Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. retval #kStatus_Success retval #kStatus_NoTransferInProgress */
status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count) | {
assert(NULL != handle);
if (count == NULL)
{
return kStatus_InvalidArgument;
}
if (!handle->isBusy)
{
*count = 0;
return kStatus_NoTransferInProgress;
}
*count = handle->transferredCount;
return kStatus_Success;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Description: This does WB_SYNC_ALL data integrity writeback and waits for the IO to complete. Callers must hold the sb s_umount semaphore for reading, to avoid having the super disappear before we are done. */ | static void bdi_sync_writeback(struct backing_dev_info *bdi, struct super_block *sb) | /* Description: This does WB_SYNC_ALL data integrity writeback and waits for the IO to complete. Callers must hold the sb s_umount semaphore for reading, to avoid having the super disappear before we are done. */
static void bdi_sync_writeback(struct backing_dev_info *bdi, struct super_block *sb) | {
struct wb_writeback_args args = {
.sb = sb,
.sync_mode = WB_SYNC_ALL,
.nr_pages = LONG_MAX,
.range_cyclic = 0,
};
struct bdi_work work;
bdi_work_init(&work, &args);
work.state |= WS_ONSTACK;
bdi_queue_work(bdi, &work);
bdi_wait_on_work_clear(&work);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the bit in the multicast table corresponding to the hash value. hw - Struct containing variables accessed by shared code hash_value - Multicast address hash value */ | void atl1e_hash_set(struct atl1e_hw *hw, u32 hash_value) | /* Sets the bit in the multicast table corresponding to the hash value. hw - Struct containing variables accessed by shared code hash_value - Multicast address hash value */
void atl1e_hash_set(struct atl1e_hw *hw, u32 hash_value) | {
u32 hash_bit, hash_reg;
u32 mta;
hash_reg = (hash_value >> 31) & 0x1;
hash_bit = (hash_value >> 26) & 0x1F;
mta = AT_READ_REG_ARRAY(hw, REG_RX_HASH_TABLE, hash_reg);
mta |= (1 << hash_bit);
AT_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, hash_reg, mta);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables the given PWM channel. This does NOT enable the corresponding pin; this must be done in the user code. */ | void PWMC_EnableChannel(unsigned char channel) | /* Enables the given PWM channel. This does NOT enable the corresponding pin; this must be done in the user code. */
void PWMC_EnableChannel(unsigned char channel) | {
AT91C_BASE_PWMC->PWMC_ENA = 1 << channel;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Enables an External Interrupt event output.
Enables one or more output events from the External Interrupt module. See here for a list of events this module supports. */ | void extint_enable_events(struct extint_events *const events) | /* Enables an External Interrupt event output.
Enables one or more output events from the External Interrupt module. See here for a list of events this module supports. */
void extint_enable_events(struct extint_events *const events) | {
Assert(events);
Eic *const eics[EIC_INST_NUM] = EIC_INSTS;
_extint_disable();
for (uint32_t i = 0; i < EIC_INST_NUM; i++) {
uint32_t event_mask = 0;
for (uint32_t j = 0; j < 32; j++) {
if (events->generate_event_on_detect[(32 * i) + j]) {
event_mask |= (1UL << j);
}
}
eics[i]->EVCTRL.reg |= event_mask;
}
_extint_enable();
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns: a pointer to a created subscription object. */ | kqueue_sub* _kh_sub_new(const gchar *filename, gboolean pair_moves, gpointer user_data) | /* Returns: a pointer to a created subscription object. */
kqueue_sub* _kh_sub_new(const gchar *filename, gboolean pair_moves, gpointer user_data) | {
kqueue_sub *sub = g_slice_new (kqueue_sub);
g_assert (sub != NULL);
sub->filename = g_strdup (filename);
sub->pair_moves = pair_moves;
sub->user_data = user_data;
sub->fd = -1;
sub->deps = NULL;
sub->is_dir = 0;
KS_W ("new subscription for %s being setup\n", sub->filename);
return sub;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base ENET peripheral base address. param srcClock_Hz This is the ENET module clock frequency. See clock distribution. param isPreambleDisabled The preamble disable flag. */ | void ENET_SetSMI(ENET_Type *base, uint32_t srcClock_Hz, bool isPreambleDisabled) | /* param base ENET peripheral base address. param srcClock_Hz This is the ENET module clock frequency. See clock distribution. param isPreambleDisabled The preamble disable flag. */
void ENET_SetSMI(ENET_Type *base, uint32_t srcClock_Hz, bool isPreambleDisabled) | {
assert((srcClock_Hz != 0U) && (srcClock_Hz <= 320000000U));
uint32_t clkCycle = 0;
uint32_t speed = 0;
uint32_t mscr = 0;
speed = (srcClock_Hz + 2U * ENET_MDC_FREQUENCY - 1U) / (2U * ENET_MDC_FREQUENCY) - 1U;
clkCycle = (10U + ENET_NANOSECOND_ONE_SECOND / srcClock_Hz - 1U) / (ENET_NANOSECOND_ONE_SECOND / srcClock_Hz) - 1U;
mscr =
ENET_MSCR_MII_SPEED(speed) | ENET_MSCR_HOLDTIME(clkCycle) | (isPreambleDisabled ? ENET_MSCR_DIS_PRE_MASK : 0U);
base->MSCR = mscr;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a non-blocking transaction currently in progress. */ | void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle) | /* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval #kStatus_Success A transaction was successfully aborted. retval #kStatus_LPI2C_Idle There is not a non-blocking transaction currently in progress. */
void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle) | {
if (handle->state != kIdleState)
{
LPI2C_MasterDisableInterrupts(base, kMasterIrqFlags);
base->MCR |= LPI2C_MCR_RRF_MASK | LPI2C_MCR_RTF_MASK;
base->MTDR = kStopCmd;
handle->state = kIdleState;
}
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Checks if a command is already on the internal command list. */ | BOOLEAN ShellCommandIsCommandOnInternalList(IN CONST CHAR16 *CommandString) | /* Checks if a command is already on the internal command list. */
BOOLEAN ShellCommandIsCommandOnInternalList(IN CONST CHAR16 *CommandString) | {
SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
ASSERT (CommandString != NULL);
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
; !IsNull (&mCommandList.Link, &Node->Link)
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
)
{
ASSERT (Node->CommandString != NULL);
if (gUnicodeCollation->StriColl (
gUnicodeCollation,
(CHAR16 *)CommandString,
Node->CommandString
) == 0
)
{
return (TRUE);
}
}
return (FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The radio controller is reset to ensure it's in a known state before it's used. */ | int uwb_radio_setup(struct uwb_rc *rc) | /* The radio controller is reset to ensure it's in a known state before it's used. */
int uwb_radio_setup(struct uwb_rc *rc) | {
return uwb_rc_reset(rc);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified UART flag is set or not. */ | FlagStatus UART_GetFlagStatus(UART_TypeDef *UARTx, uint16_t UART_FLAG) | /* Checks whether the specified UART flag is set or not. */
FlagStatus UART_GetFlagStatus(UART_TypeDef *UARTx, uint16_t UART_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_FLAG(UART_FLAG));
if ((UARTx->CSR & UART_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return a buffer to the list of free buffers. */ | static void prvReturnBuffer(unsigned char *pucBuffer) | /* Return a buffer to the list of free buffers. */
static void prvReturnBuffer(unsigned char *pucBuffer) | {
unsigned long ul;
for( ul = 0; ul < emacNUM_BUFFERS; ul++ )
{
if( &( xEthernetBuffers.cBuffer[ ul ][ 0 ] ) == ( void * ) pucBuffer )
{
ucBufferInUse[ ul ] = pdFALSE;
break;
}
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Called to put a packet on the Link Layer receive packet queue. */ | void ble_ll_rx_pdu_in(struct os_mbuf *rxpdu) | /* Called to put a packet on the Link Layer receive packet queue. */
void ble_ll_rx_pdu_in(struct os_mbuf *rxpdu) | {
struct os_mbuf_pkthdr *pkthdr;
pkthdr = OS_MBUF_PKTHDR(rxpdu);
STAILQ_INSERT_TAIL(&g_ble_ll_data.ll_rx_pkt_q, pkthdr, omp_next);
ble_npl_eventq_put(&g_ble_ll_data.ll_evq, &g_ble_ll_data.ll_rx_pkt_ev);
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Enable/Disable vport Write "1" to disable, write "0" to enable */ | static ssize_t store_fc_vport_disable(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | /* Enable/Disable vport Write "1" to disable, write "0" to enable */
static ssize_t store_fc_vport_disable(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | {
struct fc_vport *vport = transport_class_to_vport(dev);
struct Scsi_Host *shost = vport_to_shost(vport);
struct fc_internal *i = to_fc_internal(shost->transportt);
int stat;
if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING))
return -EBUSY;
if (*buf == '0') {
if (vport->vport_state != FC_VPORT_DISABLED)
return -EALREADY;
} else if (*buf == '1') {
if (vport->vport_state == FC_VPORT_DISABLED)
return -EALREADY;
} else
return -EINVAL;
stat = i->f->vport_disable(vport, ((*buf == '0') ? false : true));
return stat ? stat : count;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @chip: address of the chip which is searched for */ | int i2c_probe(uchar chip) | /* @chip: address of the chip which is searched for */
int i2c_probe(uchar chip) | {
return __i2c_probe_chip(base_glob, chip);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Sets the Smart Card number of retries in transmit and receive. */ | void USART_SetAutoRetryCount(USART_TypeDef *USARTx, uint8_t USART_AutoCount) | /* Sets the Smart Card number of retries in transmit and receive. */
void USART_SetAutoRetryCount(USART_TypeDef *USARTx, uint8_t USART_AutoCount) | {
assert_param(IS_USART_1_PERIPH(USARTx));
assert_param(IS_USART_AUTO_RETRY_COUNTER(USART_AutoCount));
USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_SCARCNT);
USARTx->CR3 |= (uint32_t)((uint32_t)USART_AutoCount << 0x11);
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Disable SWPMI transceiver ready interrupt @rmtoll IER RDYIE LL_SWPMI_DisableIT_RDY. */ | void LL_SWPMI_DisableIT_RDY(SWPMI_TypeDef *SWPMIx) | /* Disable SWPMI transceiver ready interrupt @rmtoll IER RDYIE LL_SWPMI_DisableIT_RDY. */
void LL_SWPMI_DisableIT_RDY(SWPMI_TypeDef *SWPMIx) | {
CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RDYIE);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Clear a group of Pins.
Clear a group of Pins for the given port. */ | void gpio_clear(uint32_t gpioport, uint32_t gpios) | /* Clear a group of Pins.
Clear a group of Pins for the given port. */
void gpio_clear(uint32_t gpioport, uint32_t gpios) | {
PORT_OUTCLR(gpioport) = gpios;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* This stops a request after it has been started by usb_sg_wait(). It can also prevents one initialized by usb_sg_init() from starting, so that call just frees resources allocated to the request. */ | void usb_sg_cancel(struct usb_sg_request *io) | /* This stops a request after it has been started by usb_sg_wait(). It can also prevents one initialized by usb_sg_init() from starting, so that call just frees resources allocated to the request. */
void usb_sg_cancel(struct usb_sg_request *io) | {
unsigned long flags;
spin_lock_irqsave(&io->lock, flags);
if (!io->status) {
int i;
io->status = -ECONNRESET;
spin_unlock(&io->lock);
for (i = 0; i < io->entries; i++) {
int retval;
if (!io->urbs [i]->dev)
continue;
retval = usb_unlink_urb(io->urbs [i]);
if (retval != -EINPROGRESS && retval != -EBUSY)
dev_warn(&io->dev->dev, "%s, unlink --> %d\n",
__func__, retval);
}
spin_lock(&io->lock);
}
spin_unlock_irqrestore(&io->lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Subtle, we encode the real pfn into the mem_map such that the identity pfn - section_mem_map will return the actual physical page frame number. */ | static unsigned long sparse_encode_mem_map(struct page *mem_map, unsigned long pnum) | /* Subtle, we encode the real pfn into the mem_map such that the identity pfn - section_mem_map will return the actual physical page frame number. */
static unsigned long sparse_encode_mem_map(struct page *mem_map, unsigned long pnum) | {
return (unsigned long)(mem_map - (section_nr_to_pfn(pnum)));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function commands the reception of a LIN response, SLAVE task of MASTER or SLAVE node. */ | static uint8_t lin_rx_response(uint8_t uc_node, uint8_t uc_len) | /* This function commands the reception of a LIN response, SLAVE task of MASTER or SLAVE node. */
static uint8_t lin_rx_response(uint8_t uc_node, uint8_t uc_len) | {
g_st_packet[uc_node].ul_addr = (uint32_t)&lin_rx_buffer_node;
g_st_packet[uc_node].ul_size = uc_len;
pdc_rx_init(g_p_pdc[uc_node], &g_st_packet[uc_node], NULL);
usart_enable_interrupt(USART0, US_IER_ENDRX);
return PASS;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function finishes journal space reservation. It must be called after 'make_reservation()'. */ | static void finish_reservation(struct ubifs_info *c) | /* This function finishes journal space reservation. It must be called after 'make_reservation()'. */
static void finish_reservation(struct ubifs_info *c) | {
up_read(&c->commit_sem);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* release all the mappings made in a process's VM space */ | void exit_mmap(struct mm_struct *mm) | /* release all the mappings made in a process's VM space */
void exit_mmap(struct mm_struct *mm) | {
struct vm_area_struct *vma;
if (!mm)
return;
kenter("");
mm->total_vm = 0;
while ((vma = mm->mmap)) {
mm->mmap = vma->vm_next;
delete_vma_from_mm(vma);
delete_vma(mm, vma);
}
kleave("");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the write would block (CURLE_AGAIN), we return CURLE_OK and (*written == 0). Otherwise we return regular CURLcode value. */ | CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, const void *mem, size_t len, ssize_t *written) | /* If the write would block (CURLE_AGAIN), we return CURLE_OK and (*written == 0). Otherwise we return regular CURLcode value. */
CURLcode Curl_write(struct connectdata *conn, curl_socket_t sockfd, const void *mem, size_t len, ssize_t *written) | {
ssize_t bytes_written;
CURLcode result = CURLE_OK;
int num = (sockfd == conn->sock[SECONDARYSOCKET]);
bytes_written = conn->send[num](conn, num, mem, len, &result);
*written = bytes_written;
if(bytes_written >= 0)
return CURLE_OK;
switch(result) {
case CURLE_AGAIN:
*written = 0;
return CURLE_OK;
case CURLE_OK:
return CURLE_SEND_ERROR;
default:
return result;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* create and register a new timer. if queue is not started yet, start it. */ | struct seq_oss_timer* snd_seq_oss_timer_new(struct seq_oss_devinfo *dp) | /* create and register a new timer. if queue is not started yet, start it. */
struct seq_oss_timer* snd_seq_oss_timer_new(struct seq_oss_devinfo *dp) | {
struct seq_oss_timer *rec;
rec = kzalloc(sizeof(*rec), GFP_KERNEL);
if (rec == NULL)
return NULL;
rec->dp = dp;
rec->cur_tick = 0;
rec->realtime = 0;
rec->running = 0;
rec->oss_tempo = 60;
rec->oss_timebase = 100;
calc_alsa_tempo(rec);
return rec;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add two timespec values and do a safety check for overflow. It's assumed that both values are valid (>= 0) */ | struct timespec timespec_add_safe(const struct timespec lhs, const struct timespec rhs) | /* Add two timespec values and do a safety check for overflow. It's assumed that both values are valid (>= 0) */
struct timespec timespec_add_safe(const struct timespec lhs, const struct timespec rhs) | {
struct timespec res;
set_normalized_timespec(&res, lhs.tv_sec + rhs.tv_sec,
lhs.tv_nsec + rhs.tv_nsec);
if (res.tv_sec < lhs.tv_sec || res.tv_sec < rhs.tv_sec)
res.tv_sec = TIME_T_MAX;
return res;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* By integer node we mean an object node having one of the following opcode: */ | BOOLEAN EFIAPI IsIntegerNode(IN AML_OBJECT_NODE *Node) | /* By integer node we mean an object node having one of the following opcode: */
BOOLEAN EFIAPI IsIntegerNode(IN AML_OBJECT_NODE *Node) | {
UINT8 OpCode;
if (!IS_AML_OBJECT_NODE (Node) ||
(Node->AmlByteEncoding == NULL))
{
return FALSE;
}
OpCode = Node->AmlByteEncoding->OpCode;
if ((OpCode != AML_BYTE_PREFIX) &&
(OpCode != AML_WORD_PREFIX) &&
(OpCode != AML_DWORD_PREFIX) &&
(OpCode != AML_QWORD_PREFIX))
{
return FALSE;
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Retrieve the status of the control bits on a serial device. */ | RETURN_STATUS EFIAPI SerialPortGetControl(OUT UINT32 *Control) | /* Retrieve the status of the control bits on a serial device. */
RETURN_STATUS EFIAPI SerialPortGetControl(OUT UINT32 *Control) | {
return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Removes the Handler for a specific exception Id. The stub Handler is then registered for this exception Id. */ | void Xil_ExceptionRemoveHandler(u32 Exception_id) | /* Removes the Handler for a specific exception Id. The stub Handler is then registered for this exception Id. */
void Xil_ExceptionRemoveHandler(u32 Exception_id) | {
Xil_ExceptionRegisterHandler(Exception_id,
Xil_ExceptionNullHandler,
NULL);
} | ua1arn/hftrx | C++ | null | 69 |
/* returns: 1 if spec is a valid configuration string, addr and conf_name are set accordingly 0 otherwise */ | int fit_parse_conf(const char *spec, ulong addr_curr, ulong *addr, const char **conf_name) | /* returns: 1 if spec is a valid configuration string, addr and conf_name are set accordingly 0 otherwise */
int fit_parse_conf(const char *spec, ulong addr_curr, ulong *addr, const char **conf_name) | {
return fit_parse_spec(spec, '#', addr_curr, addr, conf_name);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The function is used to Write the data to the Backup register. */ | void SysCtlBackupRegWrite(unsigned long ulIndex, unsigned long ulData) | /* The function is used to Write the data to the Backup register. */
void SysCtlBackupRegWrite(unsigned long ulIndex, unsigned long ulData) | {
xASSERT((ulIndex >= 0 && ulIndex <= 9));
xASSERT(ulData <= 0xFFFFFFFF);
xHWREG(PWRCU_BAKREG0 + ulIndex*4) |= ulData;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reallocates more global memory to store the registered Securit2Handler list. */ | RETURN_STATUS EFIAPI ReallocateSecurity2HandlerTable(VOID) | /* Reallocates more global memory to store the registered Securit2Handler list. */
RETURN_STATUS EFIAPI ReallocateSecurity2HandlerTable(VOID) | {
mSecurity2Table = ReallocatePool (
mMaxNumberOfSecurity2Handler * sizeof (SECURITY2_INFO),
(mMaxNumberOfSecurity2Handler + SECURITY_HANDLER_TABLE_SIZE) * sizeof (SECURITY2_INFO),
mSecurity2Table
);
if (mSecurity2Table == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
mMaxNumberOfSecurity2Handler = mMaxNumberOfSecurity2Handler + SECURITY_HANDLER_TABLE_SIZE;
return RETURN_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* SYSCTRL ADC Bus&Function Clock Disable and Reset Assert. */ | void LL_SYSCTRL_ADC_ClkDisRstAssert(void) | /* SYSCTRL ADC Bus&Function Clock Disable and Reset Assert. */
void LL_SYSCTRL_ADC_ClkDisRstAssert(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_ADCBusClk_Dis(SYSCTRL);
__LL_SYSCTRL_ADCFunClk_Dis(SYSCTRL);
__LL_SYSCTRL_ADCSoftRst_Assert(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* this function will perform a io control on a file descriptor. */ | int dfs_file_ioctl(struct dfs_fd *fd, int cmd, void *args) | /* this function will perform a io control on a file descriptor. */
int dfs_file_ioctl(struct dfs_fd *fd, int cmd, void *args) | {
if (fd == NULL)
return -EINVAL;
if (fd->type == FT_REGULAR)
{
switch (cmd)
{
case F_GETFL:
return fd->flags;
case F_SETFL:
{
int flags = (int)(rt_base_t)args;
int mask = O_NONBLOCK | O_APPEND;
flags &= mask;
fd->flags &= ~mask;
fd->flags |= flags;
}
return 0;
}
}
if (fd->fops->ioctl != NULL)
return fd->fops->ioctl(fd, cmd, args);
return -ENOSYS;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Compute window position on root window.
This function calculates the position of a window on the root window. It traverses all parent windows and adds their position to get the position of the given window. */ | void win_translate_win_to_root(struct win_window const *start_win, struct win_point *return_pos) | /* Compute window position on root window.
This function calculates the position of a window on the root window. It traverses all parent windows and adds their position to get the position of the given window. */
void win_translate_win_to_root(struct win_window const *start_win, struct win_point *return_pos) | {
struct win_window *win;
Assert(start_win);
Assert(return_pos);
return_pos->x = start_win->attributes.area.pos.x;
return_pos->y = start_win->attributes.area.pos.y;
win = start_win->parent;
while (win) {
return_pos->x += win->attributes.area.pos.x;
return_pos->y += win->attributes.area.pos.y;
win = win->parent;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns non-zero if the value is changed, zero if not changed. */ | void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c) | /* Returns non-zero if the value is changed, zero if not changed. */
void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c) | {
unsigned int r;
if (a->empty || b->empty) {
snd_interval_none(c);
return;
}
c->empty = 0;
c->min = div32(a->min, b->max, &r);
c->openmin = (r || a->openmin || b->openmax);
if (b->min > 0) {
c->max = div32(a->max, b->min, &r);
if (r) {
c->max++;
c->openmax = 1;
} else
c->openmax = (a->openmax || b->openmin);
} else {
c->max = UINT_MAX;
c->openmax = 0;
}
c->integer = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @msg: Pointer to a message created with wimax_msg_alloc() */ | const void* wimax_msg_data(struct sk_buff *msg) | /* @msg: Pointer to a message created with wimax_msg_alloc() */
const void* wimax_msg_data(struct sk_buff *msg) | {
struct nlmsghdr *nlh = (void *) msg->head;
struct nlattr *nla;
nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
WIMAX_GNL_MSG_DATA);
if (nla == NULL) {
printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
return NULL;
}
return nla_data(nla);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clear the fifo read and write pointers and set the length to zero. */ | void cdcBufferClearFIFO() | /* Clear the fifo read and write pointers and set the length to zero. */
void cdcBufferClearFIFO() | {
cdcfifo.rd_ptr = 0;
cdcfifo.wr_ptr = 0;
cdcfifo.len = 0;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Dissect a Packet layer window size information element. */ | static void dissect_q931_pl_window_size_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) | /* Dissect a Packet layer window size information element. */
static void dissect_q931_pl_window_size_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) | {
if (len == 0)
return;
proto_tree_add_item(tree, hf_q931_pl_window_size_forward_value, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
len -= 1;
if (len == 0)
return;
proto_tree_add_item(tree, hf_q931_pl_window_size_backward_value, tvb, offset, 1, ENC_BIG_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* General Purpose Input/Outputs Set Alternate Function Selection.
Because AF0 is not used on the MSP432E4, passing GPIO_AF_DISABLE as the alt_func_num parameter will disable the alternate function of the given pins. */ | void gpio_set_af(uint32_t gpioport, uint8_t alt_func_num, uint8_t gpios) | /* General Purpose Input/Outputs Set Alternate Function Selection.
Because AF0 is not used on the MSP432E4, passing GPIO_AF_DISABLE as the alt_func_num parameter will disable the alternate function of the given pins. */
void gpio_set_af(uint32_t gpioport, uint8_t alt_func_num, uint8_t gpios) | {
uint32_t pctl32;
uint8_t pin_mask;
uint8_t i;
if (alt_func_num == 0) {
GPIO_AFSEL(gpioport) &= ~gpios;
return;
}
GPIO_AFSEL(gpioport) |= gpios;
pctl32 = GPIO_PCTL(gpioport);
for (i = 0; i < 8; i++) {
pin_mask = (1 << i);
if (!(gpios & pin_mask)) {
continue;
}
pctl32 &= ~GPIO_PCTL_MASK(i);
pctl32 |= GPIO_PCTL_AF(i, (alt_func_num & 0xf));
}
GPIO_PCTL(gpioport) = pctl32;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Return accounted runtime for the task. In case the task is currently running, return the runtime plus current's pending runtime that have not been accounted yet. */ | unsigned long long task_sched_runtime(struct task_struct *p) | /* Return accounted runtime for the task. In case the task is currently running, return the runtime plus current's pending runtime that have not been accounted yet. */
unsigned long long task_sched_runtime(struct task_struct *p) | {
unsigned long flags;
struct rq *rq;
u64 ns = 0;
rq = task_rq_lock(p, &flags);
ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq);
task_rq_unlock(rq, &flags);
return ns;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function make EADC_module be ready to convert. */ | void EADC_Open(EADC_T *eadc, uint32_t u32InputMode) | /* This function make EADC_module be ready to convert. */
void EADC_Open(EADC_T *eadc, uint32_t u32InputMode) | {
eadc->CTL &= (~(EADC_CTL_DIFFEN_Msk));
eadc->CTL |= (u32InputMode | EADC_CTL_ADCEN_Msk);
while(!(eadc->PWRM & EADC_PWRM_PWUPRDY_Msk)) {}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Process pending SMI transaction and wait to be done. */ | static void eth_smi_transact(void) | /* Process pending SMI transaction and wait to be done. */
static void eth_smi_transact(void) | {
ETH_MACMIIAR |= ETH_MACMIIAR_MB;
while (ETH_MACMIIAR & ETH_MACMIIAR_MB);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Fills each UART_InitStruct member with its default value. */ | void UART_StructInit(UART_InitTypeDef *UART_InitStruct) | /* Fills each UART_InitStruct member with its default value. */
void UART_StructInit(UART_InitTypeDef *UART_InitStruct) | {
UART_InitStruct->UART_BaudRate = 9600;
UART_InitStruct->UART_WordLength = UART_WordLength_8b;
UART_InitStruct->UART_StopBits = UART_StopBits_1;
UART_InitStruct->UART_Parity = UART_Parity_No ;
UART_InitStruct->UART_Mode = UART_Mode_Rx | UART_Mode_Tx;
UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The function is used to adjust the AU9110 master oscillator frequency. */ | void SysCtlRCAdjValueSet(unsigned long ulAdj) | /* The function is used to adjust the AU9110 master oscillator frequency. */
void SysCtlRCAdjValueSet(unsigned long ulAdj) | {
unsigned long ulRegData;
if((xHWREG(SYSCLK_CLKSEL0) & 0X01) == 0)
{
ulRegData = xHWREG(GCR_OSCTRIM);
ulRegData &= ~GCR_OSCTRIM_OSCTRIM0TRIM_M;
ulRegData |= (ulAdj & 0x000000FF);
xHWREG(GCR_OSCTRIM) = ulRegData;
}
else
{
ulRegData = xHWREG(GCR_OSCTRIM);
ulRegData &= ~GCR_OSCTRIM_OSCTRIM1TRIM_M;
ulRegData |= (ulAdj & 0x00FF0000);
xHWREG(GCR_OSCTRIM) = ulRegData;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enables or Disables the one pulse immediate active function. */ | void TimerUpdateConfigure(unsigned long ulBase, unsigned long ulUpdate) | /* Enables or Disables the one pulse immediate active function. */
void TimerUpdateConfigure(unsigned long ulBase, unsigned long ulUpdate) | {
xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE));
xASSERT((ulUpdate == TIMER_UPDATE_EVENT_EN) ||
(ulUpdate == TIMER_UPDATE_EVENT_DIS));
if(ulUpdate == TIMER_UPDATE_EVENT_EN)
{
xHWREG(ulBase + TIMER_CNTCFR) &= ~TIMER_CNTCFR_UEVDIS;
}
else
{
xHWREG(ulBase + TIMER_CNTCFR) |= TIMER_CNTCFR_UEVDIS;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads flash at locations passed in through parameters.
This function read the flash memory from a given flash area as determined by the start address and the length. */ | status_t FLASH_Read(flash_config_t *config, uint32_t start, uint8_t *dest, uint32_t lengthInBytes) | /* Reads flash at locations passed in through parameters.
This function read the flash memory from a given flash area as determined by the start address and the length. */
status_t FLASH_Read(flash_config_t *config, uint32_t start, uint8_t *dest, uint32_t lengthInBytes) | {
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->flashDriver->flash_read(config, start, dest, lengthInBytes);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Our own version of log2(). Same thing as highbit()-1. */ | static int zfs_log2(uint64_t num) | /* Our own version of log2(). Same thing as highbit()-1. */
static int zfs_log2(uint64_t num) | {
int i = 0;
while (num > 1) {
i++;
num = num >> 1;
}
return i;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function converts a zephyr endpoint address into a bit mask that can be used with registers: */ | static uint32_t udc_rpi_endpoint_mask(const uint8_t ep) | /* This function converts a zephyr endpoint address into a bit mask that can be used with registers: */
static uint32_t udc_rpi_endpoint_mask(const uint8_t ep) | {
const int bit_index = (USB_EP_GET_IDX(ep) << 1) | !!USB_EP_DIR_IS_OUT(ep);
return BIT(bit_index);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Pattern 4: Some symbols belong to init section but still it is ok to reference these from non-init sections as these symbols don't have any memory allocated for them and symbol address and value are same. So even if init section is freed, its ok to reference those symbols. For ex. symbols marking the init section boundaries. This pattern is identified by refsymname = __init_begin, _sinittext, _einittext */ | static int secref_whitelist(const char *fromsec, const char *fromsym, const char *tosec, const char *tosym) | /* Pattern 4: Some symbols belong to init section but still it is ok to reference these from non-init sections as these symbols don't have any memory allocated for them and symbol address and value are same. So even if init section is freed, its ok to reference those symbols. For ex. symbols marking the init section boundaries. This pattern is identified by refsymname = __init_begin, _sinittext, _einittext */
static int secref_whitelist(const char *fromsec, const char *fromsym, const char *tosec, const char *tosym) | {
if (match(tosec, init_data_sections) &&
match(fromsec, data_sections) &&
(strncmp(fromsym, "__param", strlen("__param")) == 0))
return 0;
if (match(tosec, init_exit_sections) &&
match(fromsec, data_sections) &&
match(fromsym, symbol_white_list))
return 0;
if (match(fromsec, head_sections) &&
match(tosec, init_sections))
return 0;
if (match(tosym, linker_symbols))
return 0;
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */ | void cpu_idle(void) | /* The idle thread. There's no useful work to be done, so just try to conserve power and have a low exit latency (ie sit in a loop waiting for somebody to say that they'd like to reschedule) */
void cpu_idle(void) | {
while (1) {
while (!need_resched()) {
void (*idle)(void) = pm_idle;
if (!idle)
idle = default_idle;
idle();
}
preempt_enable_no_resched();
schedule();
preempt_disable();
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* You really shouldn't be using read() or write() on /dev/mem. This might go away in the future. */ | int valid_phys_addr_range(unsigned long addr, size_t size) | /* You really shouldn't be using read() or write() on /dev/mem. This might go away in the future. */
int valid_phys_addr_range(unsigned long addr, size_t size) | {
if (addr < PHYS_OFFSET)
return 0;
if (addr + size > __pa(high_memory - 1) + 1)
return 0;
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The WatchDog Timer(WDT) default IRQ, declared in StartUp code. */ | void WDT_IRQHandler(void) | /* The WatchDog Timer(WDT) default IRQ, declared in StartUp code. */
void WDT_IRQHandler(void) | {
xHWREG(WDT_WTCR) |= WDT_WTCR_WTIF;
if (g_pfnWATCHDOGHandlerCallbacks[0] != 0)
{
g_pfnWATCHDOGHandlerCallbacks[0](0, 0, 0, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Set the I2C bus speed in conjunction with the clock frequency. */ | uint32_t twi_set_speed(Twi *p_twi, uint32_t ul_speed, uint32_t ul_mck) | /* Set the I2C bus speed in conjunction with the clock frequency. */
uint32_t twi_set_speed(Twi *p_twi, uint32_t ul_speed, uint32_t ul_mck) | {
uint32_t ckdiv = 0;
uint32_t c_lh_div;
if (ul_speed > I2C_FAST_MODE_SPEED) {
return FAIL;
}
c_lh_div = ul_mck / (ul_speed * TWI_CLK_DIVIDER) - TWI_CLK_CALC_ARGU;
while ((c_lh_div > TWI_CLK_DIV_MAX) && (ckdiv < TWI_CLK_DIV_MIN)) {
ckdiv++;
c_lh_div /= TWI_CLK_DIVIDER;
}
p_twi->TWI_CWGR =
TWI_CWGR_CLDIV(c_lh_div) | TWI_CWGR_CHDIV(c_lh_div) |
TWI_CWGR_CKDIV(ckdiv);
return PASS;
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ | SWIGRUNTIME swig_cast_info* SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) | /* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */
SWIGRUNTIME swig_cast_info* SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) | {
swig_cast_info *iter = ty->cast;
while (iter) {
if (iter->type == from) {
if (iter == ty->cast)
return iter;
iter->prev->next = iter->next;
if (iter->next)
iter->next->prev = iter->prev;
iter->next = ty->cast;
iter->prev = 0;
if (ty->cast) ty->cast->prev = iter;
ty->cast = iter;
return iter;
}
iter = iter->next;
}
}
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Classes that implement #GFileIface will create a #GFileAttributeInfoList and install default keys and values for their given file system, architecture, and other possible implementation details (e.g., on a UNIX system, a file attribute key will be registered for the user id for a given file). */ | void _g_file_attribute_value_free(GFileAttributeValue *attr) | /* Classes that implement #GFileIface will create a #GFileAttributeInfoList and install default keys and values for their given file system, architecture, and other possible implementation details (e.g., on a UNIX system, a file attribute key will be registered for the user id for a given file). */
void _g_file_attribute_value_free(GFileAttributeValue *attr) | {
g_return_if_fail (attr != NULL);
_g_file_attribute_value_clear (attr);
g_free (attr);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns: (array zero-terminated=1) (transfer full): array of strings with possible completions for @initial_text. This array must be freed by g_strfreev() when finished. */ | char** g_filename_completer_get_completions(GFilenameCompleter *completer, const char *initial_text) | /* Returns: (array zero-terminated=1) (transfer full): array of strings with possible completions for @initial_text. This array must be freed by g_strfreev() when finished. */
char** g_filename_completer_get_completions(GFilenameCompleter *completer, const char *initial_text) | {
GList *possible_matches, *l;
char *prefix;
char *possible_match;
GPtrArray *res;
g_return_val_if_fail (G_IS_FILENAME_COMPLETER (completer), NULL);
g_return_val_if_fail (initial_text != NULL, NULL);
possible_matches = init_completion (completer, initial_text, &prefix);
res = g_ptr_array_new ();
for (l = possible_matches; l != NULL; l = l->next)
{
possible_match = l->data;
if (g_str_has_prefix (possible_match, prefix))
g_ptr_array_add (res,
g_strconcat (initial_text, possible_match + strlen (prefix), NULL));
}
g_free (prefix);
g_ptr_array_add (res, NULL);
return (char**)g_ptr_array_free (res, FALSE);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */ | void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle) | /* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */
void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle) | {
FLEXIO_UART_DisableInterrupts(base, kFLEXIO_UART_TxDataRegEmptyInterruptEnable);
handle->txDataSize = 0;
handle->txState = kFLEXIO_UART_TxIdle;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialize system.
Currently the following initialization functions are supported: */ | void system_init(void) | /* Initialize system.
Currently the following initialization functions are supported: */
void system_init(void) | {
system_clock_init();
system_board_init();
_system_events_init();
_system_extint_init();
_system_divas_init();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Message: SetSpeakerModeMessage Opcode: 0x0088 Type: CallControl Direction: pbx2dev VarLength: no */ | static void handle_SetSpeakerModeMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: SetSpeakerModeMessage Opcode: 0x0088 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_SetSpeakerModeMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_speakerMode, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function destroys the volume RB-tree (@sv->root) and the scanning volume information. */ | static void destroy_sv(struct ubi_scan_volume *sv) | /* This function destroys the volume RB-tree (@sv->root) and the scanning volume information. */
static void destroy_sv(struct ubi_scan_volume *sv) | {
struct ubi_scan_leb *seb;
struct rb_node *this = sv->root.rb_node;
while (this) {
if (this->rb_left)
this = this->rb_left;
else if (this->rb_right)
this = this->rb_right;
else {
seb = rb_entry(this, struct ubi_scan_leb, u.rb);
this = rb_parent(this);
if (this) {
if (this->rb_left == &seb->u.rb)
this->rb_left = NULL;
else
this->rb_right = NULL;
}
kfree(seb);
}
}
kfree(sv);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* @src1 1st device path @src2 2nd device path */ | static struct efi_device_path* EFIAPI append_device_path(const struct efi_device_path *src1, const struct efi_device_path *src2) | /* @src1 1st device path @src2 2nd device path */
static struct efi_device_path* EFIAPI append_device_path(const struct efi_device_path *src1, const struct efi_device_path *src2) | {
EFI_ENTRY("%pD, %pD", src1, src2);
return EFI_EXIT(efi_dp_append(src1, src2));
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* So a Legacy PA I/O device on a PA 2.0 box can't use all the bits supported by the processor...and the N/L-class I/O subsystem supports more bits than PA2.0 has. The first case is the problem. */ | int txn_alloc_irq(unsigned int bits_wide) | /* So a Legacy PA I/O device on a PA 2.0 box can't use all the bits supported by the processor...and the N/L-class I/O subsystem supports more bits than PA2.0 has. The first case is the problem. */
int txn_alloc_irq(unsigned int bits_wide) | {
int irq;
for (irq = CPU_IRQ_BASE + 1; irq <= CPU_IRQ_MAX; irq++) {
if (cpu_claim_irq(irq, NULL, NULL) < 0)
continue;
if ((irq - CPU_IRQ_BASE) >= (1 << bits_wide))
continue;
return irq;
}
return -1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ | static int stm32g0_init(void) | /* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int stm32g0_init(void) | {
SystemCoreClock = 16000000;
stm32g0_disable_dead_battery();
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Function for dispatching a BLE stack event to all modules with a BLE stack event handler.
This function is called from the scheduler in the main loop after a BLE stack event has been received. */ | static void ble_evt_dispatch(ble_evt_t *p_ble_evt) | /* Function for dispatching a BLE stack event to all modules with a BLE stack event handler.
This function is called from the scheduler in the main loop after a BLE stack event has been received. */
static void ble_evt_dispatch(ble_evt_t *p_ble_evt) | {
dm_ble_evt_handler(p_ble_evt);
ble_db_discovery_on_ble_evt(&m_ble_db_discovery, p_ble_evt);
ble_hrs_c_on_ble_evt(&m_ble_hrs_c, p_ble_evt);
ble_bas_c_on_ble_evt(&m_ble_bas_c, p_ble_evt);
bsp_btn_ble_on_ble_evt(p_ble_evt);
on_ble_evt(p_ble_evt);
} | labapart/polymcu | C++ | null | 201 |
/* Read the tally counters to clear them. Called in response to a CNT interrupt. */ | static void dp83902a_ClearCounters(void) | /* Read the tally counters to clear them. Called in response to a CNT interrupt. */
static void dp83902a_ClearCounters(void) | {
struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
u8 *base = dp->base;
u8 cnt1, cnt2, cnt3;
DP_IN(base, DP_FER, cnt1);
DP_IN(base, DP_CER, cnt2);
DP_IN(base, DP_MISSED, cnt3);
DP_OUT(base, DP_ISR, DP_ISR_CNT);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Dumps the contents of a HW descriptor of an SGE queue. Returns the size of the descriptor. */ | int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, unsigned char *data) | /* Dumps the contents of a HW descriptor of an SGE queue. Returns the size of the descriptor. */
int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, unsigned char *data) | {
if (qnum >= 6)
return -EINVAL;
if (qnum < 3) {
if (!qs->txq[qnum].desc || idx >= qs->txq[qnum].size)
return -EINVAL;
memcpy(data, &qs->txq[qnum].desc[idx], sizeof(struct tx_desc));
return sizeof(struct tx_desc);
}
if (qnum == 3) {
if (!qs->rspq.desc || idx >= qs->rspq.size)
return -EINVAL;
memcpy(data, &qs->rspq.desc[idx], sizeof(struct rsp_desc));
return sizeof(struct rsp_desc);
}
qnum -= 4;
if (!qs->fl[qnum].desc || idx >= qs->fl[qnum].size)
return -EINVAL;
memcpy(data, &qs->fl[qnum].desc[idx], sizeof(struct rx_desc));
return sizeof(struct rx_desc);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable AHB2 peripheral clock during Low Power (Sleep) mode. */ | void RCM_DisableAHB2PeriphClockLPMode(uint32_t AHB2Periph) | /* Disable AHB2 peripheral clock during Low Power (Sleep) mode. */
void RCM_DisableAHB2PeriphClockLPMode(uint32_t AHB2Periph) | {
RCM->LPAHB2CLKEN &= (uint32_t)~AHB2Periph;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Prepends a list to the current list Returns the new properties list. */ | CRPropList* cr_prop_list_prepend(CRPropList *a_this, CRPropList *a_to_prepend) | /* Prepends a list to the current list Returns the new properties list. */
CRPropList* cr_prop_list_prepend(CRPropList *a_this, CRPropList *a_to_prepend) | {
CRPropList *cur = NULL;
g_return_val_if_fail (a_to_prepend, NULL);
if (!a_this)
return a_to_prepend;
for (cur = a_to_prepend; cur && PRIVATE (cur)->next;
cur = PRIVATE (cur)->next) ;
g_return_val_if_fail (cur, NULL);
PRIVATE (cur)->next = a_this;
PRIVATE (a_this)->prev = cur;
return a_to_prepend;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Unregisters a callback.
Unregisters a callback function implemented by the user. */ | enum status_code ac_unregister_callback(struct ac_module *const module, const enum ac_callback callback_type) | /* Unregisters a callback.
Unregisters a callback function implemented by the user. */
enum status_code ac_unregister_callback(struct ac_module *const module, const enum ac_callback callback_type) | {
Assert(module);
module->callback[callback_type] = NULL;
module->register_callback_mask &= ~(1 << callback_type);
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* Acknowledge an expanded io pin's interrupt by clearing the bit in the isr. */ | static void expio_ack_irq(u32 irq) | /* Acknowledge an expanded io pin's interrupt by clearing the bit in the isr. */
static void expio_ack_irq(u32 irq) | {
u32 expio = MXC_IRQ_TO_EXPIO(irq);
__raw_writew(1 << expio, PBC_INTSTATUS_REG);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* In Lua 5.3 luac.cross generates a top level Proto for each source file with one upvalue that must be the set to the _ENV variable when its closure is created, and as such this parallels some ldo.c processing. */ | LUA_API int() lua_pushlfsfunc(lua_State *L) | /* In Lua 5.3 luac.cross generates a top level Proto for each source file with one upvalue that must be the set to the _ENV variable when its closure is created, and as such this parallels some ldo.c processing. */
LUA_API int() lua_pushlfsfunc(lua_State *L) | {
const TValue *v = luaH_getstr (hvalue(t), tsvalue(L->top-1));
if (ttislightuserdata(v)) {
Proto *f = pvalue(v);
LClosure *cl = luaF_newLclosure(L, f->sizeupvalues);
setclLvalue(L, L->top-1, cl);
luaF_initupvals(L, cl);
cl->p = f;
if (cl->nupvalues >= 1) {
UpVal *uv1 = cl->upvals[0];
TValue *val = uv1->v;
setobj(L, val, luaH_getint(hvalue(&G(L)->l_registry), LUA_RIDX_GLOBALS));
luaC_upvalbarrier(L, uv1);
}
return 1;
}
}
setnilvalue(L->top-1);
lua_unlock(L);
return 0;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Configures the TIMx Output Compare 2 Fast feature. */ | void TIM_ConfigOc2Fast(TIM_Module *TIMx, uint16_t TIM_OCFast) | /* Configures the TIMx Output Compare 2 Fast feature. */
void TIM_ConfigOc2Fast(TIM_Module *TIMx, uint16_t TIM_OCFast) | {
uint16_t tmpccmr1 = 0;
assert_param(IsTimList6Module(TIMx));
assert_param(IsTimOcFastState(TIM_OCFast));
tmpccmr1 = TIMx->CCMOD1;
tmpccmr1 &= (uint16_t) ~((uint16_t)TIM_CCMOD1_OC2FEN);
tmpccmr1 |= (uint16_t)(TIM_OCFast << 8);
TIMx->CCMOD1 = tmpccmr1;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Map Alternate Function Port Bits (Secondary Set)
The AFIO remapping feature is used only with the STM32F10x series. */ | void gpio_secondary_remap(uint32_t maps) | /* Map Alternate Function Port Bits (Secondary Set)
The AFIO remapping feature is used only with the STM32F10x series. */
void gpio_secondary_remap(uint32_t maps) | {
AFIO_MAPR2 |= maps;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Helper function to unregister port, unit from system */ | void zfcp_device_unregister(struct device *dev, const struct attribute_group *grp) | /* Helper function to unregister port, unit from system */
void zfcp_device_unregister(struct device *dev, const struct attribute_group *grp) | {
sysfs_remove_group(&dev->kobj, grp);
device_unregister(dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Detect best pool mapping mode heuristically, according to the machine's topology. */ | static int svc_pool_map_choose_mode(void) | /* Detect best pool mapping mode heuristically, according to the machine's topology. */
static int svc_pool_map_choose_mode(void) | {
unsigned int node;
if (nr_online_nodes > 1) {
return SVC_POOL_PERNODE;
}
node = any_online_node(node_online_map);
if (nr_cpus_node(node) > 2) {
return SVC_POOL_PERCPU;
}
return SVC_POOL_GLOBAL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This call sleeps to guarantee that no CPU is looking at the packet type after return. */ | void dev_remove_pack(struct packet_type *pt) | /* This call sleeps to guarantee that no CPU is looking at the packet type after return. */
void dev_remove_pack(struct packet_type *pt) | {
__dev_remove_pack(pt);
synchronize_net();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* PCM section pointer callback simplly reads XXX_DMA_DT_CUR register as the current position. when SG-buffer is implemented, the offset must be calculated correctly... */ | static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream) | /* PCM section pointer callback simplly reads XXX_DMA_DT_CUR register as the current position. when SG-buffer is implemented, the offset must be calculated correctly... */
static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream) | {
struct atiixp *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct atiixp_dma *dma = runtime->private_data;
unsigned int curptr;
int timeout = 1000;
while (timeout--) {
curptr = readl(chip->remap_addr + dma->ops->dt_cur);
if (curptr < dma->buf_addr)
continue;
curptr -= dma->buf_addr;
if (curptr >= dma->buf_bytes)
continue;
return bytes_to_frames(runtime, curptr);
}
snd_printd("atiixp: invalid DMA pointer read 0x%x (buf=%x)\n",
readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Release all the fragments of the packet. This is the callback for the assembled packet's OnFree. It will free the assemble entry, which in turn will free all the fragments of the packet. */ | VOID EFIAPI Ip4OnFreeFragments(IN VOID *Arg) | /* Release all the fragments of the packet. This is the callback for the assembled packet's OnFree. It will free the assemble entry, which in turn will free all the fragments of the packet. */
VOID EFIAPI Ip4OnFreeFragments(IN VOID *Arg) | {
Ip4FreeAssembleEntry ((IP4_ASSEMBLE_ENTRY *)Arg);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Causes a processor trigger for a sample sequence. */ | void ADCProcessorTrigger(uint32_t ui32Base, uint32_t ui32SequenceNum) | /* Causes a processor trigger for a sample sequence. */
void ADCProcessorTrigger(uint32_t ui32Base, uint32_t ui32SequenceNum) | {
ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
ASSERT(ui32SequenceNum < 4);
HWREG(ui32Base + ADC_O_PSSI) |= ((ui32SequenceNum & 0xffff0000) |
(1 << (ui32SequenceNum & 0xf)));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Difference in percentage of the effective ODR(and timestamp rate) with respect to the typical. Step: 0.15%. 8-bit format, 2's complement.. */ | int32_t lsm6dso_odr_cal_reg_get(stmdev_ctx_t *ctx, uint8_t *val) | /* Difference in percentage of the effective ODR(and timestamp rate) with respect to the typical. Step: 0.15%. 8-bit format, 2's complement.. */
int32_t lsm6dso_odr_cal_reg_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lsm6dso_internal_freq_fine_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_INTERNAL_FREQ_FINE,
(uint8_t *)®, 1);
*val = reg.freq_fine;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.