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 |
|---|---|---|---|---|---|---|---|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector43_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector43_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (43 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function is used to write to CLASS internal bus peripherals (ccu, pe-lem) from the host through indirect access registers. */ | static void class_bus_write(u32 val, u32 addr, u8 size) | /* This function is used to write to CLASS internal bus peripherals (ccu, pe-lem) from the host through indirect access registers. */
static void class_bus_write(u32 val, u32 addr, u8 size) | {
u32 offset = addr & 0x3;
writel((addr & CLASS_BUS_ACCESS_BASE_MASK), CLASS_BUS_ACCESS_BASE);
addr = (addr & ~CLASS_BUS_ACCESS_BASE_MASK) | PE_MEM_ACCESS_WRITE |
(size << 24);
writel(cpu_to_be32(val << (offset << 3)), CLASS_BUS_ACCESS_WDATA);
writel(addr, CLASS_BUS_ACCESS_ADDR);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Unsets the MSB on basic rates.
Scan through an array and unset the MSB for basic data rates. */ | static void lbs_unset_basic_rate_flags(u8 *rates, size_t len) | /* Unsets the MSB on basic rates.
Scan through an array and unset the MSB for basic data rates. */
static void lbs_unset_basic_rate_flags(u8 *rates, size_t len) | {
int i;
for (i = 0; i < len; i++)
rates[i] &= 0x7f;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the device configuration.
The function is used to get the device configuration. */ | usb_status_t USB_DeviceGetConfigure(usb_device_handle handle, uint8_t *configure) | /* Get the device configuration.
The function is used to get the device configuration. */
usb_status_t USB_DeviceGetConfigure(usb_device_handle handle, uint8_t *configure) | {
*configure = g_currentConfigure;
return kStatus_USB_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* meson_spifc_set_mode() - setups the SPI bus mode @dev: the SPI controller device @mode: desired mode bitfield Return: 0 on success, -ENODEV on error */ | static int meson_spifc_set_mode(struct udevice *dev, uint mode) | /* meson_spifc_set_mode() - setups the SPI bus mode @dev: the SPI controller device @mode: desired mode bitfield Return: 0 on success, -ENODEV on error */
static int meson_spifc_set_mode(struct udevice *dev, uint mode) | {
struct meson_spifc_priv *spifc = dev_get_priv(dev);
if (mode & (SPI_CPHA | SPI_RX_QUAD | SPI_RX_DUAL |
SPI_TX_QUAD | SPI_TX_DUAL))
return -ENODEV;
regmap_update_bits(spifc->regmap, REG_USER, USER_CLK_NOT_INV,
mode & SPI_CPOL ? USER_CLK_NOT_INV : 0);
regmap_update_bits(spifc->regmap, REG_USER4, USER4_CS_POL_HIGH,
mode & SPI_CS_HIGH ? USER4_CS_POL_HIGH : 0);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* param base eDMA peripheral base address. param channel eDMA channel number. return The mask of channel status flags. Users need to use the _edma_channel_status_flags type to decode the return variables. */ | uint32_t EDMA_GetChannelStatusFlags(DMA_Type *base, uint32_t channel) | /* param base eDMA peripheral base address. param channel eDMA channel number. return The mask of channel status flags. Users need to use the _edma_channel_status_flags type to decode the return variables. */
uint32_t EDMA_GetChannelStatusFlags(DMA_Type *base, uint32_t channel) | {
assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
uint32_t retval = 0;
retval |= ((base->TCD[channel].CSR & DMA_CSR_DONE_MASK) >> DMA_CSR_DONE_SHIFT);
retval |= (((base->ERR >> channel) & 0x1U) << 1U);
retval |= (((base->INT >> channel) & 0x1U) << 2U);
return retval;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Set or clear the multicast filter for this adapter. */ | static void set_multicast_list(struct net_device *dev) | /* Set or clear the multicast filter for this adapter. */
static void set_multicast_list(struct net_device *dev) | {
struct ewrk3_private *lp = netdev_priv(dev);
u_long iobase = dev->base_addr;
u_char csr;
csr = inb(EWRK3_CSR);
if (lp->shmem_length == IO_ONLY) {
lp->mctbl = NULL;
} else {
lp->mctbl = lp->shmem + PAGE0_HTE;
}
csr &= ~(CSR_PME | CSR_MCE);
if (dev->flags & IFF_PROMISC) {
csr |= CSR_PME;
outb(csr, EWRK3_CSR);
} else {
SetMulticastFilter(dev);
csr |= CSR_MCE;
outb(csr, EWRK3_CSR);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine finds (to an approximation) the first block in the physical log which contains the given cycle. It uses a binary search algorithm. Note that the algorithm can not be perfect because the disk will not necessarily be perfect. */ | STATIC int xlog_find_cycle_start(xlog_t *log, xfs_buf_t *bp, xfs_daddr_t first_blk, xfs_daddr_t *last_blk, uint cycle) | /* This routine finds (to an approximation) the first block in the physical log which contains the given cycle. It uses a binary search algorithm. Note that the algorithm can not be perfect because the disk will not necessarily be perfect. */
STATIC int xlog_find_cycle_start(xlog_t *log, xfs_buf_t *bp, xfs_daddr_t first_blk, xfs_daddr_t *last_blk, uint cycle) | {
xfs_caddr_t offset;
xfs_daddr_t mid_blk;
uint mid_cycle;
int error;
mid_blk = BLK_AVG(first_blk, *last_blk);
while (mid_blk != first_blk && mid_blk != *last_blk) {
error = xlog_bread(log, mid_blk, 1, bp, &offset);
if (error)
return error;
mid_cycle = xlog_get_cycle(offset);
if (mid_cycle == cycle) {
*last_blk = mid_blk;
} else {
first_blk = mid_blk;
}
mid_blk = BLK_AVG(first_blk, *last_blk);
}
ASSERT((mid_blk == first_blk && mid_blk+1 == *last_blk) ||
(mid_blk == *last_blk && mid_blk-1 == first_blk));
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns array of initialization states for all sensor locations. */ | bool any_sensor_inited() | /* Returns array of initialization states for all sensor locations. */
bool any_sensor_inited() | {
return !!memcmp(detected_sensors, no_sensors, NUM_SENSORS);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Function called in case of error detected in USART IT Handler. */ | void USART_TransferError_Callback(void) | /* Function called in case of error detected in USART IT Handler. */
void USART_TransferError_Callback(void) | {
LL_DMA_DisableStream(DMA1, LL_DMA_STREAM_6);
LL_DMA_DisableStream(DMA1, LL_DMA_STREAM_7);
LED_Blinking(LED_BLINK_ERROR);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* qedma3_start - start qdma on a channel @base: base address of edma @cfg: pinter to struct edma3_channel_config where you can set the slot number to associate with, the chnum, which corresponds your quick channel number 0-7, complete code - transfer complete code and trigger slot word - which has to correspond to the word number in edma3_slot_layout struct for generating event. */ | void qedma3_start(u32 base, struct edma3_channel_config *cfg) | /* qedma3_start - start qdma on a channel @base: base address of edma @cfg: pinter to struct edma3_channel_config where you can set the slot number to associate with, the chnum, which corresponds your quick channel number 0-7, complete code - transfer complete code and trigger slot word - which has to correspond to the word number in edma3_slot_layout struct for generating event. */
void qedma3_start(u32 base, struct edma3_channel_config *cfg) | {
u32 qchmap;
if (cfg->complete_code < 32)
__raw_writel(1 << cfg->complete_code, base + EDMA3_ICR);
else
__raw_writel(1 << cfg->complete_code, base + EDMA3_ICRH);
qchmap = ((EDMA3_CHMAP_PARSET_MASK & cfg->slot)
<< EDMA3_CHMAP_PARSET_SHIFT) |
(cfg->trigger_slot_word << EDMA3_CHMAP_TRIGWORD_SHIFT);
__raw_writel(qchmap, base + EDMA3_QCHMAP(cfg->chnum));
__raw_writel(1 << cfg->chnum, base + EDMA3_QSECR);
__raw_writel(1 << cfg->chnum, base + EDMA3_QEMCR);
__raw_writel(1 << cfg->chnum, base + EDMA3_QEESR);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* brief Return Frequency of SystickClock return Frequency of Systick Clock */ | uint32_t CLOCK_GetSystickClkFreq(uint32_t id) | /* brief Return Frequency of SystickClock return Frequency of Systick Clock */
uint32_t CLOCK_GetSystickClkFreq(uint32_t id) | {
uint32_t freq = 0U;
switch (SYSCON->SYSTICKCLKSELX[id])
{
case 0U:
freq = CLOCK_GetCoreSysClkFreq() / (((SYSCON->SYSTICKCLKDIV0) & 0xffU) + 1U);
break;
case 1U:
freq = CLOCK_GetFro1MFreq();
break;
case 2U:
freq = CLOCK_GetOsc32KFreq();
break;
case 7U:
freq = 0U;
break;
default:
freq = 0U;
break;
}
return freq;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* See mss_uart.h for details of how to use this function. */ | void MSS_UART_polled_tx_string(mss_uart_instance_t *this_uart, const uint8_t *p_sz_string) | /* See mss_uart.h for details of how to use this function. */
void MSS_UART_polled_tx_string(mss_uart_instance_t *this_uart, const uint8_t *p_sz_string) | {
uint32_t char_idx;
uint32_t status;
ASSERT( (this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1) );
char_idx = 0U;
while ( p_sz_string[char_idx] != 0U )
{
do {
status = this_uart->hw_reg_bit->LSR_THRE;
} while ( (status & TX_READY) == 0U);
this_uart->hw_reg->THR = p_sz_string[char_idx];
++char_idx;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Parse the NID and store the start NID of its sub-nodes. Returns the number of sub-nodes. */ | int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, hda_nid_t *start_id) | /* Parse the NID and store the start NID of its sub-nodes. Returns the number of sub-nodes. */
int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, hda_nid_t *start_id) | {
unsigned int parm;
parm = snd_hda_param_read(codec, nid, AC_PAR_NODE_COUNT);
if (parm == -1)
return 0;
*start_id = (parm >> 16) & 0x7fff;
return (int)(parm & 0x7fff);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This init function is called very early by atari/config.c It initializes some internal variables needed for stram_alloc() */ | void __init atari_stram_init(void) | /* This init function is called very early by atari/config.c It initializes some internal variables needed for stram_alloc() */
void __init atari_stram_init(void) | {
int i;
for( i = 0; i < N_STATIC_BLOCKS; ++i )
static_blocks[i].flags = BLOCK_FREE;
stram_start = phys_to_virt(0);
kernel_in_stram = (stram_start == 0);
for( i = 0; i < m68k_num_memory; ++i ) {
if (m68k_memory[i].addr == 0) {
stram_end = stram_start + m68k_memory[i].size;
return;
}
}
panic( "atari_stram_init: no ST-RAM found!" );
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Will send a fib, returning 0 if successful. */ | int aac_rx_deliver_producer(struct fib *fib) | /* Will send a fib, returning 0 if successful. */
int aac_rx_deliver_producer(struct fib *fib) | {
struct aac_dev *dev = fib->dev;
struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue];
unsigned long qflags;
u32 Index;
unsigned long nointr = 0;
spin_lock_irqsave(q->lock, qflags);
aac_queue_get( dev, &Index, AdapNormCmdQueue, fib->hw_fib_va, 1, fib, &nointr);
q->numpending++;
*(q->headers.producer) = cpu_to_le32(Index + 1);
spin_unlock_irqrestore(q->lock, qflags);
if (!(nointr & aac_config.irq_mod))
aac_adapter_notify(dev, AdapNormCmdQueue);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | /* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | {
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, USB_SOF_Pin|USB_ID_Pin|USB_DM_Pin|USB_DP_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the current state of an axis control on a joystick */ | Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis) | /* Get the current state of an axis control on a joystick */
Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis) | {
Sint16 state;
if (!SDL_PrivateJoystickValid(joystick)) {
return 0;
}
if (axis < joystick->naxes) {
state = joystick->axes[axis].value;
} else {
SDL_SetError("Joystick only has %d axes", joystick->naxes);
state = 0;
}
return state;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* retval kStatus_Success retval kStatus_NoTransferInProgress there is no non-blocking transaction currently in progress. */ | status_t I2S_TransferGetErrorCount(I2S_Type *base, i2s_handle_t *handle, size_t *count) | /* retval kStatus_Success retval kStatus_NoTransferInProgress there is no non-blocking transaction currently in progress. */
status_t I2S_TransferGetErrorCount(I2S_Type *base, i2s_handle_t *handle, size_t *count) | {
assert(handle != NULL);
assert(count != NULL);
if (NULL == handle)
{
return kStatus_InvalidArgument;
}
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if (handle->state == (uint32_t)kI2S_StateIdle)
{
return kStatus_NoTransferInProgress;
}
*count = handle->errorCount;
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Traversal func that looks for a <busno,devfcn> value. If found, the pci_dn is returned (thus terminating the traversal). */ | static void* is_devfn_node(struct device_node *dn, void *data) | /* Traversal func that looks for a <busno,devfcn> value. If found, the pci_dn is returned (thus terminating the traversal). */
static void* is_devfn_node(struct device_node *dn, void *data) | {
int busno = ((unsigned long)data >> 8) & 0xff;
int devfn = ((unsigned long)data) & 0xff;
struct pci_dn *pci = dn->data;
if (pci && (devfn == pci->devfn) && (busno == pci->busno))
return dn;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */ | VOID EFIAPI SwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack,...) | /* If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). */
VOID EFIAPI SwitchStack(IN SWITCH_STACK_ENTRY_POINT EntryPoint, IN VOID *Context1 OPTIONAL, IN VOID *Context2 OPTIONAL, IN VOID *NewStack,...) | {
VA_LIST Marker;
ASSERT (EntryPoint != NULL);
ASSERT (NewStack != NULL);
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
VA_START (Marker, NewStack);
InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
VA_END (Marker);
ASSERT (FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Load DAC Data Register.
Loads the appropriate digital to analog converter data register with 12 or 8 bit data to be converted on a channel. The data can be aligned as follows: */ | void dac_load_data_buffer_single(uint16_t dac_data, data_align dac_data_format, data_channel dac_channel) | /* Load DAC Data Register.
Loads the appropriate digital to analog converter data register with 12 or 8 bit data to be converted on a channel. The data can be aligned as follows: */
void dac_load_data_buffer_single(uint16_t dac_data, data_align dac_data_format, data_channel dac_channel) | {
if (dac_channel == CHANNEL_1) {
switch (dac_data_format) {
case RIGHT8:
DAC_DHR8R1 = dac_data;
break;
case RIGHT12:
DAC_DHR12R1 = dac_data;
break;
case LEFT12:
DAC_DHR12L1 = dac_data;
break;
}
} else if (dac_channel == CHANNEL_2) {
switch (dac_data_format) {
case RIGHT8:
DAC_DHR8R2 = dac_data;
break;
case RIGHT12:
DAC_DHR12R2 = dac_data;
break;
case LEFT12:
DAC_DHR12L2 = dac_data;
break;
}
}
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Tries to start B-device HNP negotiation if enabled via sysfs */ | static void musb_try_b_hnp_enable(struct musb *musb) | /* Tries to start B-device HNP negotiation if enabled via sysfs */
static void musb_try_b_hnp_enable(struct musb *musb) | {
void __iomem *mbase = musb->mregs;
u8 devctl;
dev_dbg(musb->controller, "HNP: Setting HR\n");
devctl = musb_readb(mbase, MUSB_DEVCTL);
musb_writeb(mbase, MUSB_DEVCTL, devctl | MUSB_DEVCTL_HR);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* returns SUCCESS if it successfully received a message acknowledgement */ | static s32 e1000_poll_for_ack(struct e1000_hw *hw) | /* returns SUCCESS if it successfully received a message acknowledgement */
static s32 e1000_poll_for_ack(struct e1000_hw *hw) | {
struct e1000_mbx_info *mbx = &hw->mbx;
int countdown = mbx->timeout;
if (!mbx->ops.check_for_ack)
goto out;
while (countdown && mbx->ops.check_for_ack(hw)) {
countdown--;
udelay(mbx->usec_delay);
}
if (!countdown)
mbx->timeout = 0;
out:
return countdown ? E1000_SUCCESS : -E1000_ERR_MBX;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeInt16ToUint32(IN INT16 Operand, OUT UINT32 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to UINT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt16ToUint32(IN INT16 Operand, OUT UINT32 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand >= 0) {
*Result = (UINT32)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = UINT32_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* bcm_rx_thr_handler - the time for blocked content updates is over now: Check for throttled data and send it to the userspace */ | static enum hrtimer_restart bcm_rx_thr_handler(struct hrtimer *hrtimer) | /* bcm_rx_thr_handler - the time for blocked content updates is over now: Check for throttled data and send it to the userspace */
static enum hrtimer_restart bcm_rx_thr_handler(struct hrtimer *hrtimer) | {
struct bcm_op *op = container_of(hrtimer, struct bcm_op, thrtimer);
tasklet_schedule(&op->thrtsklet);
if (bcm_rx_thr_flush(op, 0)) {
hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2);
return HRTIMER_RESTART;
} else {
op->kt_lastmsg = ktime_set(0, 0);
return HRTIMER_NORESTART;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the scan mode used by the LCD (either single scan or double-scan). */ | void LCD_SetScanMode(unsigned int scanMode) | /* Sets the scan mode used by the LCD (either single scan or double-scan). */
void LCD_SetScanMode(unsigned int scanMode) | {
unsigned int value;
ASSERT((scanMode & ~AT91C_LCDC_SCANMOD) == 0,
"LCD_SetScanMode: Wrong scan mode value.\n\r");
value = AT91C_BASE_LCDC->LCDC_LCDCON2;
value &= ~AT91C_LCDC_SCANMOD;
value |= scanMode;
AT91C_BASE_LCDC->LCDC_LCDCON2 = value;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* @ifp: ifp to use for iovars (primary). @p2p_mac: mac address to configure for p2p_da_override */ | static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) | /* @ifp: ifp to use for iovars (primary). @p2p_mac: mac address to configure for p2p_da_override */
static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) | {
s32 ret = 0;
brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
brcmf_fil_iovar_int_set(ifp, "apsta", 1);
brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
brcmf_fil_iovar_int_set(ifp, "p2p_disc", 0);
ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac,
ETH_ALEN);
if (ret)
brcmf_err("failed to update device address ret %d\n", ret);
return ret;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns 0 on success, a negative error code otherwise. */ | static int nand_get_features_op(struct nand_chip *chip, u8 feature, void *data) | /* Returns 0 on success, a negative error code otherwise. */
static int nand_get_features_op(struct nand_chip *chip, u8 feature, void *data) | {
struct mtd_info *mtd = nand_to_mtd(chip);
u8 *params = data;
int i;
chip->cmdfunc(mtd, NAND_CMD_GET_FEATURES, feature, -1);
for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
params[i] = chip->read_byte(mtd);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns: TRUE if the key did not exist yet */ | gboolean g_hash_table_replace(GHashTable *hash_table, gpointer key, gpointer value) | /* Returns: TRUE if the key did not exist yet */
gboolean g_hash_table_replace(GHashTable *hash_table, gpointer key, gpointer value) | {
return g_hash_table_insert_internal (hash_table, key, value, TRUE);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set the source oscillator for the specified programmable clock. */ | void pmc_pck_set_source(uint32_t ul_id, uint32_t ul_source) | /* Set the source oscillator for the specified programmable clock. */
void pmc_pck_set_source(uint32_t ul_id, uint32_t ul_source) | {
PMC->PMC_PCK[ul_id] =
(PMC->PMC_PCK[ul_id] & ~PMC_PCK_CSS_Msk) | ul_source;
while ((PMC->PMC_SCER & (PMC_SCER_PCK0 << ul_id))
&& !(PMC->PMC_SR & (PMC_SR_PCKRDY0 << ul_id)));
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Decodes the result of scsi READ CAPACITY command Launches MODE SENSE 6 command. */ | static void uhi_msc_scsi_read_capacity_done(bool b_cbw_succes) | /* Decodes the result of scsi READ CAPACITY command Launches MODE SENSE 6 command. */
static void uhi_msc_scsi_read_capacity_done(bool b_cbw_succes) | {
if ((!b_cbw_succes) || (uhi_msc_csw.bCSWStatus != USB_CSW_STATUS_PASS)
|| uhi_msc_csw.dCSWDataResidue) {
uhi_msc_lun_sel->status = LUN_FAIL;
uhi_msc_scsi_request_sense(uhi_msc_scsi_read_capacity_sense);
return;
}
uhi_msc_lun_sel->capacity.block_len =
be32_to_cpu(uhi_msc_capacity.block_len);
uhi_msc_lun_sel->capacity.max_lba =
be32_to_cpu(uhi_msc_capacity.max_lba);
uhi_msc_scsi_mode_sense6(uhi_msc_scsi_callback);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Computes the 32-bit CRC of a given data word(32-bit). */ | u32 CRC_CalcCRC(u32 data) | /* Computes the 32-bit CRC of a given data word(32-bit). */
u32 CRC_CalcCRC(u32 data) | {
CRC->DR = data;
return (CRC->DR);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Wrapper for usb_control_msg(). Allocates a temp buffer to prevent dmaing from/to the stack. */ | static int us122l_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout) | /* Wrapper for usb_control_msg(). Allocates a temp buffer to prevent dmaing from/to the stack. */
static int us122l_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout) | {
int err;
void *buf = NULL;
if (size > 0) {
buf = kmemdup(data, size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
}
err = usb_control_msg(dev, pipe, request, requesttype,
value, index, buf, size, timeout);
if (size > 0) {
memcpy(data, buf, size);
kfree(buf);
}
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to config and reset JPEG IP. */ | INT jpegOpen(void) | /* The function is used to config and reset JPEG IP. */
INT jpegOpen(void) | {
return (rt_device_open(&g_sNuJpeg.dev, RT_DEVICE_FLAG_RDWR) == RT_EOK) ? E_SUCCESS : E_FAIL;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* 6.. FMS Terminate Put OD (Confirmed Service Id = 30) 6..1. Request Message Parameters */ | static void dissect_ff_msg_fms_terminate_put_od_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | /* 6.. FMS Terminate Put OD (Confirmed Service Id = 30) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_terminate_put_od_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | {
proto_tree *sub_tree;
col_set_str(pinfo->cinfo, COL_INFO, "FMS Terminate Put OD Request");
if (!tree) {
return;
}
if (length) {
sub_tree = proto_tree_add_subtree(tree, tvb, offset, length,
ett_ff_fms_terminate_put_od_req, NULL, "FMS Terminate Put OD Request");
proto_tree_add_item(sub_tree, hf_ff_unknown_data, tvb, offset, length, ENC_NA);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Close the TLS connection and free any allocated resources. */ | void esp_tls_conn_delete(esp_tls_t *tls) | /* Close the TLS connection and free any allocated resources. */
void esp_tls_conn_delete(esp_tls_t *tls) | {
if (tls != NULL) {
mbedtls_cleanup(tls);
if (tls->sockfd) {
close(tls->sockfd);
}
free(tls);
}
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* This performs essentially the same function as device_add except for attribute containers, namely add the classdev to the system and then create the attribute files */ | int attribute_container_add_class_device(struct device *classdev) | /* This performs essentially the same function as device_add except for attribute containers, namely add the classdev to the system and then create the attribute files */
int attribute_container_add_class_device(struct device *classdev) | {
int error = device_add(classdev);
if (error)
return error;
return attribute_container_add_attrs(classdev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* To optimize the number of get_current() calls, this function only calls get_current() once and then directly accesses the putc() call of the &struct serial_device . */ | void default_serial_puts(const char *s) | /* To optimize the number of get_current() calls, this function only calls get_current() once and then directly accesses the putc() call of the &struct serial_device . */
void default_serial_puts(const char *s) | {
struct serial_device *dev = get_current();
while (*s)
dev->putc(*s++);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Description: Searches the unlabeled connection hash table and returns a pointer to the interface entry which matches @ifindex. If an exact match can not be found and there is a valid default entry, the default entry is returned, otherwise NULL is returned. The caller is responsible for calling the rcu_read_lock() functions. */ | static struct netlbl_unlhsh_iface* netlbl_unlhsh_search_iface_def(int ifindex) | /* Description: Searches the unlabeled connection hash table and returns a pointer to the interface entry which matches @ifindex. If an exact match can not be found and there is a valid default entry, the default entry is returned, otherwise NULL is returned. The caller is responsible for calling the rcu_read_lock() functions. */
static struct netlbl_unlhsh_iface* netlbl_unlhsh_search_iface_def(int ifindex) | {
struct netlbl_unlhsh_iface *entry;
entry = netlbl_unlhsh_search_iface(ifindex);
if (entry != NULL)
return entry;
entry = rcu_dereference(netlbl_unlhsh_def);
if (entry != NULL && entry->valid)
return entry;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables ODR CHANGE virtual sensor to be batched in FIFO.. */ | int32_t lsm6dso_fifo_virtual_sens_odr_chg_set(stmdev_ctx_t *ctx, uint8_t val) | /* Enables ODR CHANGE virtual sensor to be batched in FIFO.. */
int32_t lsm6dso_fifo_virtual_sens_odr_chg_set(stmdev_ctx_t *ctx, uint8_t val) | {
lsm6dso_fifo_ctrl2_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t *)®, 1);
if (ret == 0) {
reg.odrchg_en = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t *)®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* smack_sb_free_security - free a superblock blob @sb: the superblock getting the blob */ | static void smack_sb_free_security(struct super_block *sb) | /* smack_sb_free_security - free a superblock blob @sb: the superblock getting the blob */
static void smack_sb_free_security(struct super_block *sb) | {
kfree(sb->s_security);
sb->s_security = NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The default behaviour of sg_alloc_table() is to use these kmalloc/kfree helpers. */ | static struct scatterlist* sg_kmalloc(unsigned int nents, gfp_t gfp_mask) | /* The default behaviour of sg_alloc_table() is to use these kmalloc/kfree helpers. */
static struct scatterlist* sg_kmalloc(unsigned int nents, gfp_t gfp_mask) | {
if (nents == SG_MAX_SINGLE_ALLOC)
return (struct scatterlist *) __get_free_page(gfp_mask);
else
return kmalloc(nents * sizeof(struct scatterlist), gfp_mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ufshcd_get_upmcrs - Get the power mode change request status */ | static u8 ufshcd_get_upmcrs(struct ufs_hba *hba) | /* ufshcd_get_upmcrs - Get the power mode change request status */
static u8 ufshcd_get_upmcrs(struct ufs_hba *hba) | {
return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function returns the system boot mode information from the PHIT HOB in HOB list. */ | EFI_BOOT_MODE EFIAPI GetBootMode(VOID) | /* This function returns the system boot mode information from the PHIT HOB in HOB list. */
EFI_BOOT_MODE EFIAPI GetBootMode(VOID) | {
EFI_PEI_HOB_POINTERS Hob;
Hob.Raw = GetHobList ();
return Hob.HandoffInformationTable->BootMode;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Retrieve information about the manufacturer of the specified ISDN controller or (for @contr == 0) the driver itself. Return value: CAPI result code */ | u16 capi20_get_manufacturer(u32 contr, u8 *buf) | /* Retrieve information about the manufacturer of the specified ISDN controller or (for @contr == 0) the driver itself. Return value: CAPI result code */
u16 capi20_get_manufacturer(u32 contr, u8 *buf) | {
struct capi_ctr *card;
if (contr == 0) {
strlcpy(buf, capi_manufakturer, CAPI_MANUFACTURER_LEN);
return CAPI_NOERROR;
}
card = get_capi_ctr_by_nr(contr);
if (!card || card->cardstate != CARD_RUNNING)
return CAPI_REGNOTINSTALLED;
strlcpy(buf, card->manu, CAPI_MANUFACTURER_LEN);
return CAPI_NOERROR;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Ideally sets up per-cpu profiling hooks. Doesn't do much now... */ | static void __init smp_setup_percpu_timer(int cpuid) | /* Ideally sets up per-cpu profiling hooks. Doesn't do much now... */
static void __init smp_setup_percpu_timer(int cpuid) | {
cpu_data[cpuid].prof_counter = 1;
cpu_data[cpuid].prof_multiplier = 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* It calculates the passphrase-to-PSK mapping reccomanded for use with RSNAs. This implementation uses the PBKDF2 method defined in the RFC 2898. */ | static INT AirPDcapRsnaPwd2Psk(const CHAR *passphrase, const CHAR *ssid, const size_t ssidLength, UCHAR *output) | /* It calculates the passphrase-to-PSK mapping reccomanded for use with RSNAs. This implementation uses the PBKDF2 method defined in the RFC 2898. */
static INT AirPDcapRsnaPwd2Psk(const CHAR *passphrase, const CHAR *ssid, const size_t ssidLength, UCHAR *output) | {
UCHAR m_output[2*SHA1_DIGEST_LEN];
GByteArray *pp_ba = g_byte_array_new();
memset(m_output, 0, 2*SHA1_DIGEST_LEN);
if (!uri_str_to_bytes(passphrase, pp_ba)) {
g_byte_array_free(pp_ba, TRUE);
return 0;
}
AirPDcapRsnaPwd2PskStep(pp_ba->data, pp_ba->len, ssid, ssidLength, 4096, 1, m_output);
AirPDcapRsnaPwd2PskStep(pp_ba->data, pp_ba->len, ssid, ssidLength, 4096, 2, &m_output[SHA1_DIGEST_LEN]);
memcpy(output, m_output, AIRPDCAP_WPA_PSK_LEN);
g_byte_array_free(pp_ba, TRUE);
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Called by scsi stack when something has really gone wrong. */ | static int sbp2scsi_reset(struct scsi_cmnd *) | /* Called by scsi stack when something has really gone wrong. */
static int sbp2scsi_reset(struct scsi_cmnd *) | {
struct sbp2_lu *lu = (struct sbp2_lu *)SCpnt->device->host->hostdata[0];
SBP2_INFO("reset requested");
if (sbp2util_node_is_available(lu)) {
SBP2_INFO("generating sbp2 fetch agent reset");
sbp2_agent_reset(lu, 1);
}
return SUCCESS;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the DMA descriptor address of the specified DMA Channel. */ | void dmac_channel_set_descriptor_addr(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_desc) | /* Set the DMA descriptor address of the specified DMA Channel. */
void dmac_channel_set_descriptor_addr(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_desc) | {
Assert(p_dmac);
Assert(ul_num<=3);
p_dmac->DMAC_CH_NUM[ul_num].DMAC_DSCR = ul_desc;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function handles the control transfer out data phase */ | static int ctrlreq_out_data_phase(struct usb_device *dev, u32 len, void *buffer) | /* This function handles the control transfer out data phase */
static int ctrlreq_out_data_phase(struct usb_device *dev, u32 len, void *buffer) | {
u16 csr;
u32 txlen = 0;
u32 nextlen = 0;
u8 maxpktsize = (1 << dev->maxpacketsize) * 8;
u8 *txbuff = (u8 *)buffer;
int result = 0;
while (txlen < len) {
nextlen = ((len-txlen) > maxpktsize) ? maxpktsize : (len-txlen);
write_fifo(MUSB_CONTROL_EP, txlen, &txbuff[txlen]);
csr = readw(&musbr->txcsr);
writew(csr | MUSB_CSR0_H_DIS_PING | MUSB_CSR0_TXPKTRDY,
&musbr->txcsr);
result = wait_until_ep0_ready(dev, MUSB_CSR0_TXPKTRDY);
if (result < 0)
break;
txlen += nextlen;
dev->act_len = txlen;
}
return result;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* The node is not changed if it (or its first child) is not an integer node. */ | int mxmlSetInteger(mxml_node_t *node, int integer) | /* The node is not changed if it (or its first child) is not an integer node. */
int mxmlSetInteger(mxml_node_t *node, int integer) | {
if (node && node->type == MXML_ELEMENT &&
node->child && node->child->type == MXML_INTEGER)
node = node->child;
if (!node || node->type != MXML_INTEGER)
return (-1);
node->value.integer = integer;
return (0);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Description: Add this blk_iopoll structure to the pending poll list and trigger the raise of the blk iopoll softirq. The driver must already have gotten a successful return from blk_iopoll_sched_prep() before calling this. */ | void blk_iopoll_sched(struct blk_iopoll *iop) | /* Description: Add this blk_iopoll structure to the pending poll list and trigger the raise of the blk iopoll softirq. The driver must already have gotten a successful return from blk_iopoll_sched_prep() before calling this. */
void blk_iopoll_sched(struct blk_iopoll *iop) | {
unsigned long flags;
local_irq_save(flags);
list_add_tail(&iop->list, &__get_cpu_var(blk_cpu_iopoll));
__raise_softirq_irqoff(BLOCK_IOPOLL_SOFTIRQ);
local_irq_restore(flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes an USB host pipe configuration structure to defaults.
The default configuration is as follows: */ | void usb_host_pipe_get_config_defaults(struct usb_host_pipe_config *ep_config) | /* Initializes an USB host pipe configuration structure to defaults.
The default configuration is as follows: */
void usb_host_pipe_get_config_defaults(struct usb_host_pipe_config *ep_config) | {
Assert(ep_config);
ep_config->device_address = 0;
ep_config->endpoint_address = 0;
ep_config->pipe_type = USB_HOST_PIPE_TYPE_CONTROL;
ep_config->binterval = 0;
ep_config->size = 8;
} | memfault/zero-to-main | C++ | null | 200 |
/* Do the REPL: repeatedly read (load) a line, evaluate (call) it, and print any results. */ | static void doREPL(lua_State *L) | /* Do the REPL: repeatedly read (load) a line, evaluate (call) it, and print any results. */
static void doREPL(lua_State *L) | {
if (status == LUA_OK) {
status = docall(L, 0, LUA_MULTRET);
}
if (status == LUA_OK) {
l_print(L);
} else {
report(L, status);
}
}
lua_settop(L, 0);
lua_writeline();
progname = oldprogname;
const char *prmt = get_prompt(L, 1);
tls_uart_write(UART_NUM, prmt, strlen(prmt));
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Convert an s-floating point value in register format to the corresponding value in memory format. */ | static unsigned long s_reg_to_mem(unsigned long s_reg) | /* Convert an s-floating point value in register format to the corresponding value in memory format. */
static unsigned long s_reg_to_mem(unsigned long s_reg) | {
return ((s_reg >> 62) << 30) | ((s_reg << 5) >> 34);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* WARNING: this code looks "cleaner" than the PowerPC version, but has the disadvantage that you either get nothing, or everything. On PowerPC, you might see "DRAM: " before the system hangs - which gives a simple yet clear indication which part of the initialization if failing. */ | static int display_dram_config(void) | /* WARNING: this code looks "cleaner" than the PowerPC version, but has the disadvantage that you either get nothing, or everything. On PowerPC, you might see "DRAM: " before the system hangs - which gives a simple yet clear indication which part of the initialization if failing. */
static int display_dram_config(void) | {
int i;
puts ("DRAM Configuration:\n");
for (i=0; i<CONFIG_NR_DRAM_BANKS; i++) {
printf ("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
print_size (gd->bd->bi_dram[i].size, "\n");
}
return (0);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Abort processing of a JPEG compression operation, but don't destroy the object itself. */ | jpeg_abort_compress(j_compress_ptr cinfo) | /* Abort processing of a JPEG compression operation, but don't destroy the object itself. */
jpeg_abort_compress(j_compress_ptr cinfo) | {
jpeg_abort((j_common_ptr)cinfo);
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Create a lower triangular matrix L with size row x row from a symmetric real square matrix A with size row x row */ | void chol(double *A, double *L, int row) | /* Created on: 12 feb. 2019 Author: Daniel Mårtensson Create a lower triangular matrix L with size row x row from a symmetric real square matrix A with size row x row */
void chol(double *A, double *L, int row) | {
double sum = 0;
for (int k = 0; k < j; k++)
sum += L[i * row + k] * L[j * row + k];
L[i * row + j] = (i == j) ? sqrtf(A[i * row + i] - sum) : (1.0 / L[j * row + j] * (A[i * row + j] - sum));
}
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* Given a multicast ethernet address, this routine calculates the address's bit index in the logical address filter mask */ | static unsigned int ioc3_hash(const unsigned char *addr) | /* Given a multicast ethernet address, this routine calculates the address's bit index in the logical address filter mask */
static unsigned int ioc3_hash(const unsigned char *addr) | {
unsigned int temp = 0;
u32 crc;
int bits;
crc = ether_crc_le(ETH_ALEN, addr);
crc &= 0x3f;
for (bits = 6; --bits >= 0; ) {
temp <<= 1;
temp |= (crc & 0x1);
crc >>= 1;
}
return temp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is called from z_riscv_context_switch(). FPU access may be granted only if exception level is 0. If we switch to a thread that is still in some exception context then FPU access would be re-evaluated at exception exit time via z_riscv_fpu_exit_exc(). */ | void z_riscv_fpu_thread_context_switch(void) | /* This is called from z_riscv_context_switch(). FPU access may be granted only if exception level is 0. If we switch to a thread that is still in some exception context then FPU access would be re-evaluated at exception exit time via z_riscv_fpu_exit_exc(). */
void z_riscv_fpu_thread_context_switch(void) | {
if (fpu_access_allowed(0)) {
csr_clear(mstatus, MSTATUS_FS);
csr_set(mstatus, _current_cpu->arch.fpu_state);
} else {
z_riscv_fpu_disable();
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Flag the appropriate amo variable and send an IRQ to the specified node. */ | static void xpc_send_activate_IRQ_sn2(unsigned long amos_page_pa, int from_nasid, int to_nasid, int to_phys_cpuid) | /* Flag the appropriate amo variable and send an IRQ to the specified node. */
static void xpc_send_activate_IRQ_sn2(unsigned long amos_page_pa, int from_nasid, int to_nasid, int to_phys_cpuid) | {
struct amo *amos = (struct amo *)__va(amos_page_pa +
(XPC_ACTIVATE_IRQ_AMOS_SN2 *
sizeof(struct amo)));
(void)xpc_send_IRQ_sn2(&amos[BIT_WORD(from_nasid / 2)],
BIT_MASK(from_nasid / 2), to_nasid,
to_phys_cpuid, SGI_XPC_ACTIVATE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Report additional information for an error in command-line arguments. */ | static void mergecap_cmdarg_err_cont(const char *fmt, va_list ap) | /* Report additional information for an error in command-line arguments. */
static void mergecap_cmdarg_err_cont(const char *fmt, va_list ap) | {
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns whether the processor executing this function is the BSP. */ | STATIC BOOLEAN IsCurrentProcessorBSP(VOID) | /* Returns whether the processor executing this function is the BSP. */
STATIC BOOLEAN IsCurrentProcessorBSP(VOID) | {
EFI_STATUS Status;
UINTN ProcessorIndex;
Status = WhoAmI (&mMpServicesProtocol, &ProcessorIndex);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return FALSE;
}
return IsProcessorBSP (ProcessorIndex);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert bits-per-pixel to a hardware palette PBS value. */ | static u_int palette_pbs(struct fb_var_screeninfo *var) | /* Convert bits-per-pixel to a hardware palette PBS value. */
static u_int palette_pbs(struct fb_var_screeninfo *var) | {
int ret = 0;
switch (var->bits_per_pixel) {
case 4: ret = 0 << 12; break;
case 8: ret = 1 << 12; break;
case 16: ret = 2 << 12; break;
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Waits until the 1-wire interface is idle (not busy) */ | static int ds2482_wait_1wire_idle(struct ds2482_data *pdev) | /* Waits until the 1-wire interface is idle (not busy) */
static int ds2482_wait_1wire_idle(struct ds2482_data *pdev) | {
int temp = -1;
int retries = 0;
if (!ds2482_select_register(pdev, DS2482_PTR_CODE_STATUS)) {
do {
temp = i2c_smbus_read_byte(pdev->client);
} while ((temp >= 0) && (temp & DS2482_REG_STS_1WB) &&
(++retries < DS2482_WAIT_IDLE_TIMEOUT));
}
if (retries > DS2482_WAIT_IDLE_TIMEOUT)
printk(KERN_ERR "%s: timeout on channel %d\n",
__func__, pdev->channel);
return temp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return ~a. For some reason gcc calls this */ | quad_t __one_cmpldi2(quad_t a) | /* Return ~a. For some reason gcc calls this */
quad_t __one_cmpldi2(quad_t a) | {
union uu aa;
aa.q = a;
aa.ul[0] = ~aa.ul[0];
aa.ul[1] = ~aa.ul[1];
return aa.q;
} | labapart/polymcu | C++ | null | 201 |
/* Setting the seed allows arbitrary accumulators and flexible XOR policy If your algorithm starts with ~0, then XOR with ~0 before you set the seed. */ | static int chksum_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) | /* Setting the seed allows arbitrary accumulators and flexible XOR policy If your algorithm starts with ~0, then XOR with ~0 before you set the seed. */
static int chksum_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) | {
struct chksum_ctx *mctx = crypto_shash_ctx(tfm);
if (keylen != sizeof(mctx->key)) {
crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
return -EINVAL;
}
mctx->key = le32_to_cpu(*(__le32 *)key);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the MCG PLL/PLL0 reference clock frequency.
Get the current MCG PLL/PLL0 reference clock frequency in Hz. This is an internal function. */ | static uint32_t CLOCK_GetPll0RefFreq(void) | /* Get the MCG PLL/PLL0 reference clock frequency.
Get the current MCG PLL/PLL0 reference clock frequency in Hz. This is an internal function. */
static uint32_t CLOCK_GetPll0RefFreq(void) | {
return CLOCK_GetMcgExtClkFreq();
} | labapart/polymcu | C++ | null | 201 |
/* SPI1 Interrupt Handler.
If users want to user the SPI1 Callback feature, Users should promise that the SPI1 Handle in the vector table is SPI1IntHandler. */ | void SPI1IntHandler(void) | /* SPI1 Interrupt Handler.
If users want to user the SPI1 Callback feature, Users should promise that the SPI1 Handle in the vector table is SPI1IntHandler. */
void SPI1IntHandler(void) | {
unsigned long ulEventFlags;
unsigned long ulBase = SPI1_BASE;
ulEventFlags = xHWREGB(ulBase + SPI_S);
xHWREGB(ulBase + SPI_S) |= (unsigned char)ulEventFlags & 0x40;
if(g_pfnSPIHandlerCallbacks[1])
{
g_pfnSPIHandlerCallbacks[1](0, 0, ulEventFlags, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Probe the ConfidentialComputing Guest type. See defition of CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>. */ | UINT8 EFIAPI CcProbe(VOID) | /* Probe the ConfidentialComputing Guest type. See defition of CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>. */
UINT8 EFIAPI CcProbe(VOID) | {
OVMF_WORK_AREA *WorkArea;
WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase);
return WorkArea != NULL ? WorkArea->Header.GuestType : CcGuestTypeNonEncrypted;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Generates random values using the TF-M crypto service. */ | void crp_test_rng(void) | /* Generates random values using the TF-M crypto service. */
void crp_test_rng(void) | {
psa_status_t status;
uint8_t outbuf[256] = { 0 };
struct sf_hex_tbl_fmt fmt = {
.ascii = true,
.addr_label = true,
.addr = 0
};
status = al_psa_status(psa_generate_random(outbuf, 256), __func__);
LOG_INF("Generating 256 bytes of random data.");
al_dump_log();
sf_hex_tabulate_16(&fmt, outbuf, 256);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Install the health manager forms. One will be used by BDS core to configure the Configured Required driver health instances, the other will be automatically included by firmware setup (UI). */ | EFI_STATUS EFIAPI InitializeDriverHealthManager(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) | /* Install the health manager forms. One will be used by BDS core to configure the Configured Required driver health instances, the other will be automatically included by firmware setup (UI). */
EFI_STATUS EFIAPI InitializeDriverHealthManager(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
EFI_HANDLE Handle;
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
(VOID **)&mDriverHealthManagerDatabase
);
ASSERT_EFI_ERROR (Status);
Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiDevicePathProtocolGuid,
&mDriverHealthManagerFormDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
&mDriverHealthManagerConfigAccess,
NULL
);
ASSERT_EFI_ERROR (Status);
mDriverHealthManagerHiiHandle = HiiAddPackages (
&gEfiCallerIdGuid,
Handle,
DriverHealthManagerVfrBin,
DriverHealthConfigureVfrBin,
STRING_ARRAY_NAME,
NULL
);
ASSERT (mDriverHealthManagerHiiHandle != NULL);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Synchronous clocks are generated from the main clock. The clocks must satisfy the constraint fCPU >= fHSB >= fPB i.e. each clock must not be faster than its parent. */ | static unsigned long bus_clk_get_rate(struct clk *clk, unsigned int shift) | /* Synchronous clocks are generated from the main clock. The clocks must satisfy the constraint fCPU >= fHSB >= fPB i.e. each clock must not be faster than its parent. */
static unsigned long bus_clk_get_rate(struct clk *clk, unsigned int shift) | {
return main_clock->get_rate(main_clock) >> shift;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* create a unix date from a dos date in network byte order */ | static time_t make_unix_date(const u_char *date_ptr) | /* create a unix date from a dos date in network byte order */
static time_t make_unix_date(const u_char *date_ptr) | {
uint32_t dos_date = 0;
dos_date = EXTRACT_LE_32BITS(date_ptr);
return int_unix_date(dos_date);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Compute the hash for the vfat name corresponding to the dentry. Note: if the name is invalid, we leave the hash code unchanged so that the existing dentry can be used. The vfat fs routines will return ENOENT or EINVAL as appropriate. */ | static int vfat_hashi(struct dentry *dentry, struct qstr *qstr) | /* Compute the hash for the vfat name corresponding to the dentry. Note: if the name is invalid, we leave the hash code unchanged so that the existing dentry can be used. The vfat fs routines will return ENOENT or EINVAL as appropriate. */
static int vfat_hashi(struct dentry *dentry, struct qstr *qstr) | {
struct nls_table *t = MSDOS_SB(dentry->d_inode->i_sb)->nls_io;
const unsigned char *name;
unsigned int len;
unsigned long hash;
name = qstr->name;
len = vfat_striptail_len(qstr);
hash = init_name_hash();
while (len--)
hash = partial_name_hash(nls_tolower(t, *name++), hash);
qstr->hash = end_name_hash(hash);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */ | void insb(unsigned long port, void *dst, unsigned long count) | /* Read COUNT 8-bit bytes from port PORT into memory starting at SRC. */
void insb(unsigned long port, void *dst, unsigned long count) | {
unsigned char *p;
p = (unsigned char *)dst;
while (((unsigned long)p) & 0x3) {
if (!count)
return;
count--;
*p = inb(port);
p++;
}
while (count >= 4) {
unsigned int w;
count -= 4;
w = inb(port) << 24;
w |= inb(port) << 16;
w |= inb(port) << 8;
w |= inb(port);
*(unsigned int *) p = w;
p += 4;
}
while (count) {
--count;
*p = inb(port);
p++;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */ | EFI_STATUS SdPeimReset(IN SD_PEIM_HC_SLOT *Slot) | /* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
EFI_STATUS SdPeimReset(IN SD_PEIM_HC_SLOT *Slot) | {
SD_COMMAND_BLOCK SdCmdBlk;
SD_STATUS_BLOCK SdStatusBlk;
SD_COMMAND_PACKET Packet;
EFI_STATUS Status;
ZeroMem (&SdCmdBlk, sizeof (SdCmdBlk));
ZeroMem (&SdStatusBlk, sizeof (SdStatusBlk));
ZeroMem (&Packet, sizeof (Packet));
Packet.SdCmdBlk = &SdCmdBlk;
Packet.SdStatusBlk = &SdStatusBlk;
Packet.Timeout = SD_TIMEOUT;
SdCmdBlk.CommandIndex = SD_GO_IDLE_STATE;
SdCmdBlk.CommandType = SdCommandTypeBc;
SdCmdBlk.ResponseType = 0;
SdCmdBlk.CommandArgument = 0;
Status = SdPeimExecCmd (Slot, &Packet);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Retrieve the value of a 32-bit UEFI Variable specified by VariableName and a GUID of gEfiCallerIdGuid. */ | static VOID GetFmpVariable(IN CHAR16 *VariableName, OUT BOOLEAN *Valid, OUT UINT32 *Value) | /* Retrieve the value of a 32-bit UEFI Variable specified by VariableName and a GUID of gEfiCallerIdGuid. */
static VOID GetFmpVariable(IN CHAR16 *VariableName, OUT BOOLEAN *Valid, OUT UINT32 *Value) | {
EFI_STATUS Status;
UINTN Size;
UINT32 *Buffer;
*Valid = FALSE;
*Value = 0;
Size = 0;
Buffer = NULL;
Status = GetVariable2 (
VariableName,
&gEfiCallerIdGuid,
(VOID **)&Buffer,
&Size
);
if (!EFI_ERROR (Status) && (Size == sizeof (*Value)) && (Buffer != NULL)) {
*Valid = TRUE;
*Value = *Buffer;
}
if (Buffer != NULL) {
FreePool (Buffer);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns zero on success, or %-ENOENT on failure. */ | int unregister_reboot_notifier(struct notifier_block *nb) | /* Returns zero on success, or %-ENOENT on failure. */
int unregister_reboot_notifier(struct notifier_block *nb) | {
return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function handles External lines 15 to 10 interrupt request. */ | void EXTI15_10_IRQHandler(void) | /* This function handles External lines 15 to 10 interrupt request. */
void EXTI15_10_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(TAMPER_BUTTON_PIN | KEY_BUTTON_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_EnableEP(uint32_t EPNum) | /* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_EnableEP(uint32_t EPNum) | {
return;
}
if (ep_dir != 0U) {
NRF_USBD->EPINEN |= USBD_EPINEN_IN0_Msk << ep_num;
} else {
NRF_USBD->EPOUTEN |= USBD_EPOUTEN_OUT0_Msk << ep_num;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Sets or Resets the TIM peripheral Capture Compare Preload Control bit. */ | void TIM_CCPreloadControl(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Sets or Resets the TIM peripheral Capture Compare Preload Control bit. */
void TIM_CCPreloadControl(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST4_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->CR2 |= TIM_CR2_CCPC;
}
else
{
TIMx->CR2 &= (uint16_t)~TIM_CR2_CCPC;
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Set the fields of structure stc_tmr6_emb_config_t to default values. */ | int32_t TMR6_EMBConfigStructInit(stc_tmr6_emb_config_t *pstcEmbConfig) | /* Set the fields of structure stc_tmr6_emb_config_t to default values. */
int32_t TMR6_EMBConfigStructInit(stc_tmr6_emb_config_t *pstcEmbConfig) | {
int32_t i32Ret = LL_ERR_INVD_PARAM;
if (NULL != pstcEmbConfig) {
pstcEmbConfig->u32ValidCh = TMR6_EMB_EVT_CH0;
pstcEmbConfig->u32ReleaseMode = TMR6_EMB_RELEASE_IMMED;
pstcEmbConfig->u32PinStatus = TMR6_EMB_PIN_NORMAL;
i32Ret = LL_OK;
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This file contains the functions related to the extents B-tree. build_key */ | static void hfs_ext_build_key(hfs_btree_key *key, u32 cnid, u16 block, u8 type) | /* This file contains the functions related to the extents B-tree. build_key */
static void hfs_ext_build_key(hfs_btree_key *key, u32 cnid, u16 block, u8 type) | {
key->key_len = 7;
key->ext.FkType = type;
key->ext.FNum = cpu_to_be32(cnid);
key->ext.FABN = cpu_to_be16(block);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Validate allocation and free from system heap memory pool.
Set heap memory as resource pool. It will success when alloc a block of memory smaller than the pool and will fail when alloc a block of memory larger than the pool. */ | ZTEST(mheap_api, test_sys_heap_mem_pool_assign) | /* Validate allocation and free from system heap memory pool.
Set heap memory as resource pool. It will success when alloc a block of memory smaller than the pool and will fail when alloc a block of memory larger than the pool. */
ZTEST(mheap_api, test_sys_heap_mem_pool_assign) | {
if (!IS_ENABLED(CONFIG_MULTITHREADING)) {
return;
}
void *ptr;
k_thread_system_pool_assign(k_current_get());
ptr = (char *)z_thread_malloc(BLK_SIZE_MIN/2);
zassert_not_null(ptr, "bytes allocation failed from system pool");
k_free(ptr);
zassert_is_null((char *)z_thread_malloc(BLK_SIZE_MAX * 2),
"overflow check failed");
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Get the parent node of the input Node. */ | AML_NODE_HEADER* EFIAPI AmlGetParent(IN AML_NODE_HEADER *Node) | /* Get the parent node of the input Node. */
AML_NODE_HEADER* EFIAPI AmlGetParent(IN AML_NODE_HEADER *Node) | {
if (IS_AML_DATA_NODE (Node) ||
IS_AML_OBJECT_NODE (Node))
{
return Node->Parent;
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* De-initialize CRC Interface. stops operation and releases the software resources used by the interface. */ | int32_t csi_crc_uninitialize(crc_handle_t handle) | /* De-initialize CRC Interface. stops operation and releases the software resources used by the interface. */
int32_t csi_crc_uninitialize(crc_handle_t handle) | {
CRC_NULL_PARAM_CHK(handle);
ck_crc_priv_t *crc_priv = handle;
crc_priv->cb = NULL;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes a single character to the VFD display. */ | void samsungvfdWrite(uint8_t value) | /* Writes a single character to the VFD display. */
void samsungvfdWrite(uint8_t value) | {
gpioSetValue(SAMSUNGVFD_STB_PORT, SAMSUNGVFD_STB_PIN, 0);
samsungvfd_sendByte(SAMSUNGVFD_SPIDATA);
samsungvfd_sendByte(value);
gpioSetValue(SAMSUNGVFD_STB_PORT, SAMSUNGVFD_STB_PIN, 1);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* The status value returned from spu_run reflects the value of the spu_status register after the SPU has stopped. */ | static long do_spu_run(struct file *filp, __u32 __user *unpc, __u32 __user *ustatus) | /* The status value returned from spu_run reflects the value of the spu_status register after the SPU has stopped. */
static long do_spu_run(struct file *filp, __u32 __user *unpc, __u32 __user *ustatus) | {
long ret;
struct spufs_inode_info *i;
u32 npc, status;
ret = -EFAULT;
if (get_user(npc, unpc))
goto out;
ret = -EINVAL;
if (filp->f_op != &spufs_context_fops)
goto out;
i = SPUFS_I(filp->f_path.dentry->d_inode);
ret = spufs_run_spu(i->i_ctx, &npc, &status);
if (put_user(npc, unpc))
ret = -EFAULT;
if (ustatus && put_user(status, ustatus))
ret = -EFAULT;
out:
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* s3c_hsotg_ep_sethalt_lock - set halt on a given endpoint with lock held @ep: The endpoint to set halt. @value: Set or unset the halt. */ | static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) | /* s3c_hsotg_ep_sethalt_lock - set halt on a given endpoint with lock held @ep: The endpoint to set halt. @value: Set or unset the halt. */
static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) | {
struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent;
unsigned long flags = 0;
int ret = 0;
spin_lock_irqsave(&hs->lock, flags);
ret = s3c_hsotg_ep_sethalt(ep, value);
spin_unlock_irqrestore(&hs->lock, flags);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Open B channel Called by "do_action" in ev-layer.c */ | static int gigaset_init_bchannel(struct bc_state *bcs) | /* Open B channel Called by "do_action" in ev-layer.c */
static int gigaset_init_bchannel(struct bc_state *bcs) | {
gigaset_bchannel_up(bcs);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the maximum level of the backlight duty cycle field. */ | static u32 intel_lvds_get_max_backlight(struct drm_device *dev) | /* Returns the maximum level of the backlight duty cycle field. */
static u32 intel_lvds_get_max_backlight(struct drm_device *dev) | {
struct drm_i915_private *dev_priv = dev->dev_private;
u32 reg;
if (IS_IRONLAKE(dev))
reg = BLC_PWM_PCH_CTL2;
else
reg = BLC_PWM_CTL;
return ((I915_READ(reg) & BACKLIGHT_MODULATION_FREQ_MASK) >>
BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read the the ConfidentialComputing Guest type from Ovmf work-area. */ | STATIC UINT8 ReadCcGuestType(VOID) | /* Read the the ConfidentialComputing Guest type from Ovmf work-area. */
STATIC UINT8 ReadCcGuestType(VOID) | {
OVMF_WORK_AREA *WorkArea;
if (!mCcProbed) {
WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase);
mCcProbeGuestType = WorkArea != NULL ? WorkArea->Header.GuestType : CcGuestTypeNonEncrypted;
mCcProbed = TRUE;
}
return mCcProbeGuestType;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sends a command and data to the chip over the I2C bus. */ | uint32_t SI7021_cmdWrite(uint8_t *cmd, size_t cmdLen, uint8_t *data, size_t dataLen) | /* Sends a command and data to the chip over the I2C bus. */
uint32_t SI7021_cmdWrite(uint8_t *cmd, size_t cmdLen, uint8_t *data, size_t dataLen) | {
I2C_TransferSeq_TypeDef seq;
I2C_TransferReturn_TypeDef ret;
seq.addr = SI7021_I2C_BUS_ADDRESS << 1;
seq.buf[0].data = cmd;
seq.buf[0].len = cmdLen;
if( dataLen > 0 ) {
seq.flags = I2C_FLAG_WRITE_WRITE;
seq.buf[1].data = data;
seq.buf[1].len = dataLen;
}
else {
seq.flags = I2C_FLAG_WRITE;
}
ret = I2CSPM_Transfer( SI7021_I2C_DEVICE, &seq );
if( ret == i2cTransferNack ) {
return SI7021_ERROR_I2C_TRANSFER_NACK;
}
else if( ret != i2cTransferDone ) {
return SI7021_ERROR_I2C_TRANSFER_FAILED;
}
return SI7021_OK;
}
/** @} {end defgroup Si7021_Functions} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Save the values of the device bars. Unlike the restore routine, this routine is */ | static void eeh_save_bars(struct pci_dn *pdn) | /* Save the values of the device bars. Unlike the restore routine, this routine is */
static void eeh_save_bars(struct pci_dn *pdn) | {
int i;
if (!pdn )
return;
for (i = 0; i < 16; i++)
rtas_read_config(pdn, i * 4, 4, &pdn->config_space[i]);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function returns TRUE if the device path specified by DevicePath is multi-instance. Otherwise, FALSE is returned. If DevicePath is NULL or invalid, then FALSE is returned. */ | BOOLEAN EFIAPI IsDevicePathMultiInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | /* This function returns TRUE if the device path specified by DevicePath is multi-instance. Otherwise, FALSE is returned. If DevicePath is NULL or invalid, then FALSE is returned. */
BOOLEAN EFIAPI IsDevicePathMultiInstance(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | {
return mDevicePathLibDevicePathUtilities->IsDevicePathMultiInstance (DevicePath);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base SAI base pointer. param sourceClockHz, bit clock source frequency. param sampleRate audio data sample rate. param bitWidth, audio data bitWidth. param channelNumbers, audio channel numbers. */ | void I2S_SetBitClockRate(I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers) | /* param base SAI base pointer. param sourceClockHz, bit clock source frequency. param sampleRate audio data sample rate. param bitWidth, audio data bitWidth. param channelNumbers, audio channel numbers. */
void I2S_SetBitClockRate(I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers) | {
uint32_t bitClockDivider = sourceClockHz / sampleRate / bitWidth / channelNumbers;
assert(bitClockDivider >= 1U);
base->DIV = I2S_DIV_DIV(bitClockDivider - 1U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* qbool_destroy_obj(): Free all memory allocated by a QBool object */ | static void qbool_destroy_obj(QObject *obj) | /* qbool_destroy_obj(): Free all memory allocated by a QBool object */
static void qbool_destroy_obj(QObject *obj) | {
assert(obj != NULL);
g_free(qobject_to_qbool(obj));
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* This function is executed in case of error occurrence. */ | void Error_Handler(void) | /* This function is executed in case of error occurrence. */
void Error_Handler(void) | {
while(1)
{
BSP_LED_Toggle(LED4);
HAL_Delay(100);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.