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 |
|---|---|---|---|---|---|---|---|
/* The default values are as follows. code config->srtccalenable = false; config->srtccalvalue = 0U; endcode param config Pointer to the user's SNVS configuration structure. */ | void SNVS_LP_SRTC_GetDefaultConfig(snvs_lp_srtc_config_t *config) | /* The default values are as follows. code config->srtccalenable = false; config->srtccalvalue = 0U; endcode param config Pointer to the user's SNVS configuration structure. */
void SNVS_LP_SRTC_GetDefaultConfig(snvs_lp_srtc_config_t *config) | {
assert(config);
memset(config, 0, sizeof(*config));
config->srtcCalEnable = false;
config->srtcCalValue = 0U;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Fills each dmcConfig member with its default value. */ | void DMC_ConfigStructInit(DMC_Config_T *dmcConfig) | /* Fills each dmcConfig member with its default value. */
void DMC_ConfigStructInit(DMC_Config_T *dmcConfig) | {
dmcConfig->bankWidth = DMC_BANK_WIDTH_2;
dmcConfig->clkPhase = DMC_CLK_PHASE_REVERSE;
dmcConfig->colWidth = DMC_COL_WIDTH_10;
dmcConfig->rowWidth = DMC_ROW_WIDTH_13;
DMC_ConfigTimingStructInit(&dmcConfig->timing);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_WM8960_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) | /* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8960_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) | {
assert(handle != NULL);
return WM8960_ConfigDataFormat((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), mclk,
sampleRate, bitWidth);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Writes a 16 bit integer to the address space of a given SDIO function. @err_ret will contain the status of the actual transfer. */ | void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret) | /* Writes a 16 bit integer to the address space of a given SDIO function. @err_ret will contain the status of the actual transfer. */
void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret) | {
int ret;
*(__le16 *)func->tmpbuf = cpu_to_le16(b);
ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2);
if (err_ret)
*err_ret = ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This API sets the FIFO self wake up functionality in the sensor. */ | uint16_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev) | /* This API sets the FIFO self wake up functionality in the sensor. */
uint16_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_POWER_CONF_ADDR, &data, 1, dev);
if (rslt == BMA4_OK) {
data = BMA4_SET_BITSLICE(data, BMA4_FIFO_SELF_WAKE_UP, fifo_self_wakeup);
rslt |... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* If ‘1’ indicates that the Boot (Reboot) phase is running.. */ | int32_t lps22hb_boot_status_get(stmdev_ctx_t *ctx, uint8_t *val) | /* If ‘1’ indicates that the Boot (Reboot) phase is running.. */
int32_t lps22hb_boot_status_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lps22hb_int_source_t int_source;
int32_t ret;
ret = lps22hb_read_reg(ctx, LPS22HB_INT_SOURCE, (uint8_t*)&int_source, 1);
*val = int_source.boot_status;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If a runtime driver exits with an error, it must call this routine to free the allocated resource before the exiting. It will ASSERT() if gBS is NULL. It will ASSERT() if that operation fails. */ | EFI_STATUS EFIAPI RuntimeDriverLibDeconstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* If a runtime driver exits with an error, it must call this routine to free the allocated resource before the exiting. It will ASSERT() if gBS is NULL. It will ASSERT() if that operation fails. */
EFI_STATUS EFIAPI RuntimeDriverLibDeconstruct(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
ASSERT (gBS != NULL);
Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
ASSERT_EFI_ERROR (Status);
Status = gBS->CloseEvent (mEfiExitBootServicesEvent);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Build the header of a MODBUS message using the function and the slave ID. */ | int32_t modbus_build_header(struct modbus_slave *dev, uint8_t function, uint8_t *rsp) | /* Build the header of a MODBUS message using the function and the slave ID. */
int32_t modbus_build_header(struct modbus_slave *dev, uint8_t function, uint8_t *rsp) | {
rsp[0] = dev->slave_id;
rsp[1] = function;
return MODBUS_HEADER_LENGTH;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Clears the interrupt for the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinIntClear(unsigned long ulPort, unsigned long ulPins) | /* Clears the interrupt for the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinIntClear(unsigned long ulPort, unsigned l... | {
unsigned long ulPortBase;
xASSERT(GPIOBaseValid(ulPort));
ulPortBase = GPIOToPortGet(ulPort);
xHWREG(ulPortBase + PORT_ISFR) |= ulPins;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Set the TD is isochronous transfer type or not. */ | VOID SetTDControlIsochronousorNot(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsIsochronous) | /* Set the TD is isochronous transfer type or not. */
VOID SetTDControlIsochronousorNot(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsIsochronous) | {
PtrTDStruct->TDData.TDStatusIOS = (IsIsochronous ? 1 : 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the DMA Edge for the specified pin(s). */ | void GPIODMAEdgeSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulDMAEdge) | /* Sets the DMA Edge for the specified pin(s). */
void GPIODMAEdgeSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulDMAEdge) | {
unsigned long ulPortBase;
unsigned long ulBit;
xASSERT(GPIOBaseValid(ulPort));
ulPortBase = GPIOToPortGet(ulPort);
for(ulBit = 0; ulBit < 32; ulBit++)
{
if(((ulPins >> ulBit) & 1) != 0)
{
xHWREG(ulPortBase + PORT_PCR + ulBit * 4) &= ~PORT_PCR_IRQC_M;
xHWREG(ulPor... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* param base UART peripheral base address. param data Start address of the data to write. param length Size of the data to write. */ | void UART_WriteBlocking(UART_Type *base, const uint8_t *data, size_t length) | /* param base UART peripheral base address. param data Start address of the data to write. param length Size of the data to write. */
void UART_WriteBlocking(UART_Type *base, const uint8_t *data, size_t length) | {
while (length--)
{
while (!(base->S1 & UART_S1_TDRE_MASK))
{
}
base->D = *(data++);
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* param base The I3C peripheral base address. param count The pointer to store the available device count. return Pointer to the i3c_device_info_t array. */ | i3c_device_info_t* I3C_MasterGetDeviceListAfterDAA(I3C_Type *base, uint8_t *count) | /* param base The I3C peripheral base address. param count The pointer to store the available device count. return Pointer to the i3c_device_info_t array. */
i3c_device_info_t* I3C_MasterGetDeviceListAfterDAA(I3C_Type *base, uint8_t *count) | {
assert(NULL != count);
*count = usedDevCount;
return devList;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* write field of ipu registers, without affecting other bits. */ | void ipu_write(int32_t ipu_index, uint32_t ID_addr, uint32_t data) | /* write field of ipu registers, without affecting other bits. */
void ipu_write(int32_t ipu_index, uint32_t ID_addr, uint32_t data) | {
ID_addr += REGS_IPU_BASE(ipu_index);
writel(data, ID_addr);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base I2S base pointer. param config pointer to I2S configuration structure. */ | void I2S_TxInit(I2S_Type *base, const i2s_config_t *config) | /* param base I2S base pointer. param config pointer to I2S configuration structure. */
void I2S_TxInit(I2S_Type *base, const i2s_config_t *config) | {
uint32_t cfg = 0U;
uint32_t trig = 0U;
(void)FLEXCOMM_Init(base, FLEXCOMM_PERIPH_I2S_TX);
I2S_Config(base, config);
cfg |= I2S_FIFOCFG_ENABLETX(1U);
cfg |= I2S_FIFOCFG_EMPTYTX(1U);
cfg |= I2S_FIFOCFG_TXI2SE0(config->txEmptyZero);
cfg |= I2S_FIFOCFG_PACK48(config->pack48);
trig |= ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Attempts to acquire the semaphore. If no more tasks are allowed to acquire the semaphore, calling this function will put the task to sleep. If the sleep is interrupted by a signal, this function will return -EINTR. If the semaphore is successfully acquired, this function returns 0. */ | int down_interruptible(struct semaphore *sem) | /* Attempts to acquire the semaphore. If no more tasks are allowed to acquire the semaphore, calling this function will put the task to sleep. If the sleep is interrupted by a signal, this function will return -EINTR. If the semaphore is successfully acquired, this function returns 0. */
int down_interruptible(struct ... | {
unsigned long flags;
int result = 0;
spin_lock_irqsave(&sem->lock, flags);
if (likely(sem->count > 0))
sem->count--;
else
result = __down_interruptible(sem);
spin_unlock_irqrestore(&sem->lock, flags);
return result;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 10.a (void) 10.b (void) 10.c (void) 10.d (void) 10. NCC Permitted */ | static guint16 de_rr_ncc_perm(tvbuff_t *tvb, proto_tree *subtree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) | /* 10.a (void) 10.b (void) 10.c (void) 10.d (void) 10. NCC Permitted */
static guint16 de_rr_ncc_perm(tvbuff_t *tvb, proto_tree *subtree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) | {
guint32 curr_offset;
curr_offset = offset;
proto_tree_add_item(subtree, hf_gsm_a_rr_ncc_permitted, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
curr_offset = curr_offset + 1;
return(curr_offset - offset);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value) | {
CONST EFI_PEI_SERVICES **PeiServices;
EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64)Port, Value);
return Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns the transmit or the receive CRC register value. */ | uint8_t SPI_GetCRC(SPI_TypeDef *SPIx, SPI_CRC_TypeDef SPI_CRC) | /* Returns the transmit or the receive CRC register value. */
uint8_t SPI_GetCRC(SPI_TypeDef *SPIx, SPI_CRC_TypeDef SPI_CRC) | {
uint8_t crcreg = 0;
assert_param(IS_SPI_CRC(SPI_CRC));
if (SPI_CRC != SPI_CRC_RX)
{
crcreg = SPIx->TXCRCR;
}
else
{
crcreg = SPIx->RXCRCR;
}
return crcreg;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* I2C Disable dual addressing mode for the Peripheral.
Only OAR1 is recognised in 7-bit addressing mode. */ | void i2c_disable_dual_addressing_mode(uint32_t i2c) | /* I2C Disable dual addressing mode for the Peripheral.
Only OAR1 is recognised in 7-bit addressing mode. */
void i2c_disable_dual_addressing_mode(uint32_t i2c) | {
I2C_OAR2(i2c) &= ~(I2C_OAR2_ENDUAL);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Routine: get_expansion_id Description: This function checks for expansion board by checking I2C bus 2 for the availability of an AT24C01B serial EEPROM. returns the device_vendor field from the EEPROM */ | unsigned int get_expansion_id(void) | /* Routine: get_expansion_id Description: This function checks for expansion board by checking I2C bus 2 for the availability of an AT24C01B serial EEPROM. returns the device_vendor field from the EEPROM */
unsigned int get_expansion_id(void) | {
if (expansion_config.device_vendor != 0x0)
return expansion_config.device_vendor;
i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
i2c_set_bus_num(TWL4030_I2C_BUS);
return GUMSTIX_NO_EEPROM;
}
i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Bind a port for a connect operation and hash it. */ | int inet_hash_connect(struct inet_timewait_death_row *death_row, struct sock *sk) | /* Bind a port for a connect operation and hash it. */
int inet_hash_connect(struct inet_timewait_death_row *death_row, struct sock *sk) | {
return __inet_hash_connect(death_row, sk, inet_sk_port_offset(sk),
__inet_check_established, __inet_hash_nolisten);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reads the I2C register and returns its value. */ | uint16_t I2C_ReadRegister(I2C_T *i2c, I2C_REGISTER_T i2cRegister) | /* Reads the I2C register and returns its value. */
uint16_t I2C_ReadRegister(I2C_T *i2c, I2C_REGISTER_T i2cRegister) | {
switch (i2cRegister)
{
case I2C_REGISTER_CTRL1:
return i2c->CTRL1;
case I2C_REGISTER_CTRL2:
return i2c->CTRL2;
case I2C_REGISTER_SADDR1:
return i2c->SADDR1;
case I2C_REGISTER_SADDR2:
return i2c->SADDR2;
case I2C_REGISTER_DATA:
return i2c->DATA;
c... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Select the stack unwinder with the best rating. This is useful for setting up curr_unwinder. */ | static struct unwinder* select_unwinder(void) | /* Select the stack unwinder with the best rating. This is useful for setting up curr_unwinder. */
static struct unwinder* select_unwinder(void) | {
struct unwinder *best;
if (list_empty(&unwinder_list))
return NULL;
best = list_entry(unwinder_list.next, struct unwinder, list);
if (best == curr_unwinder)
return NULL;
return best;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The controller should generate 2 frames before preparing the peripheral. */ | static void dw_mipi_dsi_wait_for_two_frames(struct display_timing *timings) | /* The controller should generate 2 frames before preparing the peripheral. */
static void dw_mipi_dsi_wait_for_two_frames(struct display_timing *timings) | {
int refresh, two_frames;
refresh = dsi_mode_vrefresh(timings);
two_frames = DIV_ROUND_UP(MSEC_PER_SEC, refresh) * 2;
mdelay(two_frames);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Search a Question in Form scope using its QuestionId. */ | HII_STATEMENT* QuestionIdInForm(IN HII_FORM *Form, IN UINT16 QuestionId) | /* Search a Question in Form scope using its QuestionId. */
HII_STATEMENT* QuestionIdInForm(IN HII_FORM *Form, IN UINT16 QuestionId) | {
LIST_ENTRY *Link;
HII_STATEMENT *Question;
if ((QuestionId == 0) || (Form == NULL)) {
return NULL;
}
Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Form->StatementListHead, Link)) {
Question = HII_STATEMENT_FROM_LINK (Link);
if (Question->QuestionId == QuestionId) {
... | tianocore/edk2 | C++ | Other | 4,240 |
/* dn_return_short - Return a short packet to its sender @skb: The packet to return */ | static int dn_return_short(struct sk_buff *skb) | /* dn_return_short - Return a short packet to its sender @skb: The packet to return */
static int dn_return_short(struct sk_buff *skb) | {
struct dn_skb_cb *cb;
unsigned char *ptr;
__le16 *src;
__le16 *dst;
skb_push(skb, skb->data - skb_network_header(skb));
if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL)
return NET_RX_DROP;
cb = DN_SKB_CB(skb);
ptr = skb->data + 2;
*ptr++ = (cb->rt_flags & ~DN_RT_F_RQR) | DN_RT_F_RTS;
dst = (__le16 *)ptr;... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* llist_del - deletes entry from llist. @entry: the element to delete from the llist. Note: llist_empty on entry does not return true after this, the entry is in an undefined state. */ | void llist_del(llist_head *entry) | /* llist_del - deletes entry from llist. @entry: the element to delete from the llist. Note: llist_empty on entry does not return true after this, the entry is in an undefined state. */
void llist_del(llist_head *entry) | {
if (entry->prev && entry->next)
{
__llist_del(entry->prev, entry->next);
}
entry->next = LLIST_POISON1;
entry->prev = LLIST_POISON2;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* FLEXIO UART DMA send finished callback function.
This function is called when FLEXIO UART DMA send finished. It disables the UART TX DMA request and sends kStatus_FLEXIO_UART_TxIdle to FLEXIO UART callback. */ | static void FLEXIO_UART_TransferSendDMACallback(dma_handle_t *handle, void *param) | /* FLEXIO UART DMA send finished callback function.
This function is called when FLEXIO UART DMA send finished. It disables the UART TX DMA request and sends kStatus_FLEXIO_UART_TxIdle to FLEXIO UART callback. */
static void FLEXIO_UART_TransferSendDMACallback(dma_handle_t *handle, void *param) | {
flexio_uart_dma_private_handle_t *uartPrivateHandle = (flexio_uart_dma_private_handle_t *)param;
FLEXIO_UART_EnableTxDMA(uartPrivateHandle->base, false);
DMA_DisableInterrupts(handle->base, handle->channel);
uartPrivateHandle->handle->txState = kFLEXIO_UART_TxIdle;
if (uartPrivateHandle->handle->c... | labapart/polymcu | C++ | null | 201 |
/* pci_hose_phys_to_bus(): Convert physical address to bus address @hose: PCI hose of the root PCI controller @phys_addr: physical address to convert @flags: flags of pci regions */ | pci_addr_t pci_hose_phys_to_bus(struct pci_controller *hose, phys_addr_t phys_addr, unsigned long flags) | /* pci_hose_phys_to_bus(): Convert physical address to bus address @hose: PCI hose of the root PCI controller @phys_addr: physical address to convert @flags: flags of pci regions */
pci_addr_t pci_hose_phys_to_bus(struct pci_controller *hose, phys_addr_t phys_addr, unsigned long flags) | {
pci_addr_t bus_addr = 0;
int ret;
if (!hose) {
puts("pci_hose_phys_to_bus: invalid hose\n");
return bus_addr;
}
if ((flags & PCI_REGION_TYPE) == PCI_REGION_MEM) {
ret = __pci_hose_phys_to_bus(hose, phys_addr,
flags, PCI_REGION_SYS_MEMORY, &bus_addr);
if (!ret)
return bus_addr;
}
ret = __pci_hose... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* D E B U G F U N C T I O N S yaffs_n_handles() Returns number of handles attached to the object */ | int yaffs_n_handles(const YCHAR *path) | /* D E B U G F U N C T I O N S yaffs_n_handles() Returns number of handles attached to the object */
int yaffs_n_handles(const YCHAR *path) | {
struct yaffs_obj *obj;
if (!path) {
yaffsfs_SetError(-EFAULT);
return -1;
}
if (yaffsfs_CheckPath(path) < 0) {
yaffsfs_SetError(-ENAMETOOLONG);
return -1;
}
obj = yaffsfs_FindObject(NULL, path, 0, 1, NULL, NULL, NULL);
if (obj)
return yaffsfs_CountHandles(obj);
else
return -1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function takes a byte length and a delta unit of time to compute the approximate bytes per second */ | static ulong bytes_per_second(unsigned int len, ulong start_ms) | /* This function takes a byte length and a delta unit of time to compute the approximate bytes per second */
static ulong bytes_per_second(unsigned int len, ulong start_ms) | {
if (len >= ((unsigned int) -1) / 1024)
return len / (max(get_timer(start_ms) / 1024, 1UL));
else
return 1024 * len / max(get_timer(start_ms), 1UL);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This routine is called by the upper-layer tty layer to signal that */ | static void rs_throttle(struct tty_struct *tty) | /* This routine is called by the upper-layer tty layer to signal that */
static void rs_throttle(struct tty_struct *tty) | {
if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty));
printk(KERN_INFO "simrs_throttle called\n");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Performs write operation to Atlas analog register specified. */ | static s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val) | /* Performs write operation to Atlas analog register specified. */
static s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val) | {
u32 atlas_ctl;
atlas_ctl = (reg << 8) | val;
IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL, atlas_ctl);
IXGBE_WRITE_FLUSH(hw);
udelay(10);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Insert minimum turnaround time and speed information into the skb. We need to do this since it's per packet relevant information. Safe to have this function inlined since it's only called from one place */ | static void irlap_insert_info(struct irlap_cb *self, struct sk_buff *skb) | /* Insert minimum turnaround time and speed information into the skb. We need to do this since it's per packet relevant information. Safe to have this function inlined since it's only called from one place */
static void irlap_insert_info(struct irlap_cb *self, struct sk_buff *skb) | {
struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
cb->magic = LAP_MAGIC;
cb->mtt = self->mtt_required;
cb->next_speed = self->speed;
self->mtt_required = 0;
cb->xbofs = self->bofs_count;
cb->next_xbofs = self->next_bofs;
cb->xbofs_delay = self->xbofs_delay;
self->xbofs_delay = 0;
self->bofs_count = s... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* After chip reset, the PIO timings are set to 0x00009172, which is not valid. */ | static void sc1200_tunepio(ide_drive_t *drive, u8 pio) | /* After chip reset, the PIO timings are set to 0x00009172, which is not valid. */
static void sc1200_tunepio(ide_drive_t *drive, u8 pio) | {
ide_hwif_t *hwif = drive->hwif;
struct pci_dev *pdev = to_pci_dev(hwif->dev);
unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0;
pci_read_config_dword(pdev, basereg + 4, &format);
format = (format >> 31) & 1;
if (format)
format += sc1200_get_pci_clock();
pci_write_config_dword(pdev, basereg + ((... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Turn the component into low power mode, listening only. */ | void sn65hvd234_enable_low_power(sn65hvd234_ctrl_t *p_component) | /* Turn the component into low power mode, listening only. */
void sn65hvd234_enable_low_power(sn65hvd234_ctrl_t *p_component) | {
ioport_set_pin_level(p_component->pio_rs_idx, CAN_RS_HIGH);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* brief DMA instance 1, channel 9 IRQ handler. */ | void EDMA_1_CH9_DriverIRQHandler(void) | /* brief DMA instance 1, channel 9 IRQ handler. */
void EDMA_1_CH9_DriverIRQHandler(void) | {
EDMA_DriverIRQHandler(1U, 9U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @this: pointer to the BLOCK_IO_PROTOCOL @extended_verification: extended verification Return: status code */ | static efi_status_t EFIAPI efi_disk_reset(struct efi_block_io *this, char extended_verification) | /* @this: pointer to the BLOCK_IO_PROTOCOL @extended_verification: extended verification Return: status code */
static efi_status_t EFIAPI efi_disk_reset(struct efi_block_io *this, char extended_verification) | {
EFI_ENTRY("%p, %x", this, extended_verification);
return EFI_EXIT(EFI_SUCCESS);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* DMA receive done process. This need add to DMA receive done ISR. */ | static void dma_rx_done_isr(struct rt_serial_device *serial) | /* DMA receive done process. This need add to DMA receive done ISR. */
static void dma_rx_done_isr(struct rt_serial_device *serial) | {
struct n32_uart *uart = (struct n32_uart *) serial->parent.user_data;
rt_size_t recv_len;
rt_base_t level;
level = rt_hw_interrupt_disable();
recv_len = uart->dma.setting_recv_len - uart->dma.last_recv_index;
uart->dma.last_recv_index = 0;
rt_hw_interrupt_enable(level);
if (recv_len)
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Note: we cannot allow this function to be inlined, because that would give us more than 1 exception table entry. This in turn would break the assumptions above. */ | static noinline int test_address(void *address) | /* Note: we cannot allow this function to be inlined, because that would give us more than 1 exception table entry. This in turn would break the assumptions above. */
static noinline int test_address(void *address) | {
unsigned long result;
fudze_exception_table(&foo_label, address);
result = 1;
asm volatile(
"foo_label:\n"
"0: call *%[fake_code]\n"
"1:\n"
".section .fixup,\"ax\"\n"
"2: mov %[zero], %[rslt]\n"
" ret\n"
".previous\n"
_ASM_EXTABLE(0b,2b)
: [rslt] "=r" (result)
: [fake_code] "r" (address), [zer... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: immediate child of @root_type and anchestor of @leaf_type */ | GType g_type_next_base(GType type, GType base_type) | /* Returns: immediate child of @root_type and anchestor of @leaf_type */
GType g_type_next_base(GType type, GType base_type) | {
GType atype = 0;
TypeNode *node;
node = lookup_type_node_I (type);
if (node)
{
TypeNode *base_node = lookup_type_node_I (base_type);
if (base_node && base_node->n_supers < node->n_supers)
{
guint n = node->n_supers - base_node->n_supers;
if (node->supers[n] == base_type)
atype = no... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* ReadPropertyMultiple-Request ::= SEQUENCE { listOfReadAccessSpecs SEQUENCE OF ReadAccessSpecification } */ | static guint fReadPropertyMultipleRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, guint offset) | /* ReadPropertyMultiple-Request ::= SEQUENCE { listOfReadAccessSpecs SEQUENCE OF ReadAccessSpecification } */
static guint fReadPropertyMultipleRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, guint offset) | {
col_set_writable(pinfo->cinfo, COL_INFO, FALSE);
return fReadAccessSpecification(tvb, pinfo, subtree, offset);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Setup the timer to generate the tick interrupts. Configure a number of standard MPU regions that are used by all tasks.
Setup the timer to generate the tick interrupts. */ | static void prvSetupTimerInterrupt(static void prvSetupMPU void) | /* Setup the timer to generate the tick interrupts. Configure a number of standard MPU regions that are used by all tasks.
Setup the timer to generate the tick interrupts. */
static void prvSetupTimerInterrupt(static void prvSetupMPU void) | {
pxTopOfStack--;
*pxTopOfStack = portINITIAL_XPSR;
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) pxCode;
pxTopOfStack--;
*pxTopOfStack = 0;
pxTopOfStack -= 5;
*pxTopOfStack = ( StackType_t ) pvParameters;
pxTopOfStack -= 9;
if( xRunPrivileged == pdTRUE )
{
*pxTopOfStack = portINITIAL_CONTROL_IF_PRIVILEG... | labapart/polymcu | C++ | null | 201 |
/* Start the automatic loading of the CLUT or abort the transfer. */ | void DMA2D_FGStart(FunctionalState NewState) | /* Start the automatic loading of the CLUT or abort the transfer. */
void DMA2D_FGStart(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DMA2D->FGPFCCR |= DMA2D_FGPFCCR_START;
}
else
{
DMA2D->FGPFCCR &= (uint32_t)~DMA2D_FGPFCCR_START;
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Change the PLL divisor.
The PLL is bypassed before modifying the divisor, and the function blocks until the PLL is locked, then the bypass is disabled, before returning. */ | void rcc_change_pll_divisor(uint8_t pll_div400) | /* Change the PLL divisor.
The PLL is bypassed before modifying the divisor, and the function blocks until the PLL is locked, then the bypass is disabled, before returning. */
void rcc_change_pll_divisor(uint8_t pll_div400) | {
rcc_pll_bypass_enable();
rcc_set_pll_divisor(pll_div400);
rcc_wait_for_pll_ready();
rcc_pll_bypass_disable();
lm4f_rcc_sysclk_freq = (uint32_t)400E6 / pll_div400;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* applesmc_get_key_at_index - get key at index, and put the result in key (char). Returns zero on success or a negative error on failure. Callers must hold applesmc_lock. */ | static int applesmc_get_key_at_index(int index, char *key) | /* applesmc_get_key_at_index - get key at index, and put the result in key (char). Returns zero on success or a negative error on failure. Callers must hold applesmc_lock. */
static int applesmc_get_key_at_index(int index, char *key) | {
int i;
u8 readkey[4];
readkey[0] = index >> 24;
readkey[1] = index >> 16;
readkey[2] = index >> 8;
readkey[3] = index;
if (send_command(APPLESMC_GET_KEY_BY_INDEX_CMD))
return -EIO;
for (i = 0; i < 4; i++) {
outb(readkey[i], APPLESMC_DATA_PORT);
if (__wait_status(0x04))
return -EIO;
}
outb(4, APPLES... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns the uDMA error status. It should be called from within the uDMA error interrupt handler to determine if a uDMA error occurred. */ | uint32_t uDMAErrorStatusGet(void) | /* This function returns the uDMA error status. It should be called from within the uDMA error interrupt handler to determine if a uDMA error occurred. */
uint32_t uDMAErrorStatusGet(void) | {
return (HWREG(UDMA_ERRCLR));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function reads a value from the connected device. */ | static int pcf857x_port_get_raw(const struct device *dev, gpio_port_value_t *value) | /* This function reads a value from the connected device. */
static int pcf857x_port_get_raw(const struct device *dev, gpio_port_value_t *value) | {
struct pcf857x_drv_data *drv_data = dev->data;
int rc;
if (k_is_in_isr()) {
return -EWOULDBLOCK;
}
if ((~drv_data->pins_cfg.configured_as_outputs & (uint16_t)*value) != (uint16_t)*value) {
LOG_ERR("Pin(s) is/are configured as output which should be input.");
return -EOPNOTSUPP;
}
k_sem_take(&drv_data->lo... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Note that the @destroy callback is not called if @data is NULL. */ | void g_object_set_data_full(GObject *object, const gchar *key, gpointer data, GDestroyNotify destroy) | /* Note that the @destroy callback is not called if @data is NULL. */
void g_object_set_data_full(GObject *object, const gchar *key, gpointer data, GDestroyNotify destroy) | {
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_datalist_id_set_data_full (&object->qdata, g_quark_from_string (key), data,
data ? destroy : (GDestroyNotify) NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* fc_fcp_srr_error() - Handler for SRR errors @fsp: The FCP packet that the SRR error is on @fp: The SRR frame */ | static void fc_fcp_srr_error(struct fc_fcp_pkt *, struct fc_frame *) | /* fc_fcp_srr_error() - Handler for SRR errors @fsp: The FCP packet that the SRR error is on @fp: The SRR frame */
static void fc_fcp_srr_error(struct fc_fcp_pkt *, struct fc_frame *) | {
if (fc_fcp_lock_pkt(fsp))
goto out;
fsp->lp->tt.exch_done(fsp->recov_seq);
fsp->recov_seq = NULL;
switch (PTR_ERR(fp)) {
case -FC_EX_TIMEOUT:
if (fsp->recov_retry++ < FC_MAX_RECOV_RETRY)
fc_fcp_rec(fsp);
else
fc_timeout_error(fsp);
break;
case -FC_EX_CLOSED:
default:
fc_fcp_retry_cmd(fsp);
br... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This service enables PEIMs to discover sections of a given type within a valid FFS file. */ | EFI_STATUS EFIAPI PeiServicesFfsFindSectionData(IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData) | /* This service enables PEIMs to discover sections of a given type within a valid FFS file. */
EFI_STATUS EFIAPI PeiServicesFfsFindSectionData(IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData) | {
return SecFfsFindSectionData (SectionType, FileHandle, SectionData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* \classmethod \constructor(id) Create an LED object associated with the given LED: */ | STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) | /* \classmethod \constructor(id) Create an LED object associated with the given LED: */
STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) | {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "LED(%d) does not exist", led_id));
}
return (mp_obj_t)&pyb_led_obj[led_id - 1];
} | labapart/polymcu | C++ | null | 201 |
/* This API sets the data ready interrupt for both accel and gyro. This interrupt occurs when new accel and gyro data come.
This API sets the data ready interrupt for both accel and gyro. This interrupt occurs when new accel and gyro data comes. */ | static int8_t set_accel_gyro_data_ready_int(const struct bmi160_int_settg *int_config, const struct bmi160_dev *dev) | /* This API sets the data ready interrupt for both accel and gyro. This interrupt occurs when new accel and gyro data come.
This API sets the data ready interrupt for both accel and gyro. This interrupt occurs when new accel and gyro data comes. */
static int8_t set_accel_gyro_data_ready_int(const struct bmi160_int_se... | {
int8_t rslt;
rslt = null_ptr_check(dev);
if ((rslt != BMI160_OK) || (int_config == NULL))
{
rslt = BMI160_E_NULL_PTR;
}
else
{
rslt = enable_data_ready_int(dev);
if (rslt == BMI160_OK)
{
rslt = set_intr_pin_config(int_config, dev);
if... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Check whether the specified SPI state flag is set or not. */ | flag_status_t spi_get_status(ald_spi_handle_t *hperh, ald_spi_status_t status) | /* Check whether the specified SPI state flag is set or not. */
flag_status_t spi_get_status(ald_spi_handle_t *hperh, ald_spi_status_t status) | {
assert_param(IS_SPI(hperh->perh));
assert_param(IS_SPI_STATUS(status));
if (hperh->perh->STAT & status)
return SET;
return RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Give the size of an UTF-8 coded character */ | static uint8_t lv_txt_utf8_size(const char *str) | /* Give the size of an UTF-8 coded character */
static uint8_t lv_txt_utf8_size(const char *str) | {
if((str[0] & 0x80) == 0)
return 1;
else if((str[0] & 0xE0) == 0xC0)
return 2;
else if((str[0] & 0xF0) == 0xE0)
return 3;
else if((str[0] & 0xF8) == 0xF0)
return 4;
return 1;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Called when an error was detected during the last packet command. We queue a request sense packet command at the head of the request queue. */ | void ide_retry_pc(ide_drive_t *drive) | /* Called when an error was detected during the last packet command. We queue a request sense packet command at the head of the request queue. */
void ide_retry_pc(ide_drive_t *drive) | {
struct request *failed_rq = drive->hwif->rq;
struct request *sense_rq = &drive->sense_rq;
struct ide_atapi_pc *pc = &drive->request_sense_pc;
(void)ide_read_error(drive);
ide_init_pc(pc);
memcpy(pc->c, sense_rq->cmd, 12);
if (drive->media == ide_tape)
drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC;
blk_requeue_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* (2) The timer ISR handler, rt_hw_timer_handler(), is placed into the vector table in vectors.s34. */ | static void timer_tick_init(void) | /* (2) The timer ISR handler, rt_hw_timer_handler(), is placed into the vector table in vectors.s34. */
static void timer_tick_init(void) | {
TB0MR.BYTE = 0x40;
TB0 = (CPU_CLK_FREQ / 8) / RT_TICK_PER_SECOND;
TB0IC.BYTE = 0x07;
TABSR.BYTE |= 0x20;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get USB Device Last Frame Number Parameters: None Return Value: Frame Number */ | uint32_t USBD_GetFrame(void) | /* Get USB Device Last Frame Number Parameters: None Return Value: Frame Number */
uint32_t USBD_GetFrame(void) | {
return ((USBHS->FRINDEX >> 3) & 0x0FFF);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* STEPS: 1.Create a joinable thread 2.Detach that thread 3.Verify that the thread did not terminate because of this */ | static void* a_thread_func() | /* STEPS: 1.Create a joinable thread 2.Detach that thread 3.Verify that the thread did not terminate because of this */
static void* a_thread_func() | {
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
sleep(10);
perror("Thread couldn't be canceled (at cleanup time), timing out\n");
pthread_exit(0);
return NULL;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Restart the card from scratch, as if from a cold-boot. */ | static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) | /* Restart the card from scratch, as if from a cold-boot. */
static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) | {
struct net_device *dev = pci_get_drvdata(pdev);
struct bnx2 *bp = netdev_priv(dev);
rtnl_lock();
if (pci_enable_device(pdev)) {
dev_err(&pdev->dev,
"Cannot re-enable PCI device after reset.\n");
rtnl_unlock();
return PCI_ERS_RESULT_DISCONNECT;
}
pci_set_master(pdev);
pci_restore_state(pdev);
pci_save... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Create a minimum of each frequency entry in the 'struct s3c_freq', unless the entry is zero when it is ignored and the non-zero argument used. */ | static void s3c_cpufreq_freq_min(struct s3c_freq *dst, struct s3c_freq *a, struct s3c_freq *b) | /* Create a minimum of each frequency entry in the 'struct s3c_freq', unless the entry is zero when it is ignored and the non-zero argument used. */
static void s3c_cpufreq_freq_min(struct s3c_freq *dst, struct s3c_freq *a, struct s3c_freq *b) | {
dst->fclk = do_min(a->fclk, b->fclk);
dst->hclk = do_min(a->hclk, b->hclk);
dst->pclk = do_min(a->pclk, b->pclk);
dst->armclk = do_min(a->armclk, b->armclk);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If FormatString is NULL, then ASSERT() and 0 is returned. If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then ASSERT() and 0 is returned. */ | UINTN EFIAPI SPrintLengthAsciiFormat(IN CONST CHAR8 *FormatString, IN VA_LIST Marker) | /* If FormatString is NULL, then ASSERT() and 0 is returned. If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then ASSERT() and 0 is returned. */
UINTN EFIAPI SPrintLengthAsciiFormat(IN CONST CHAR8 *FormatStri... | {
return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_SetStallEP(uint32_t EPNum) | /* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_SetStallEP(uint32_t EPNum) | {
EPNum &= 0x0F;
USB0->ENDPOINT[EPNum].ENDPT |= USB_ENDPT_EPSTALL_MASK;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Returns a offset of first property in the given node. */ | INT32 EFIAPI FdtFirstPropertyOffset(IN CONST VOID *Fdt, IN INT32 NodeOffset) | /* Returns a offset of first property in the given node. */
INT32 EFIAPI FdtFirstPropertyOffset(IN CONST VOID *Fdt, IN INT32 NodeOffset) | {
return fdt_first_property_offset (Fdt, NodeOffset);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The constructor function caches the pointer of Boot Services Table through System Table. It will ASSERT() if the pointer of System Table is NULL. It will ASSERT() if the pointer of Boot Services Table is NULL. It will always return EFI_SUCCESS. */ | EFI_STATUS EFIAPI UnitTestUefiBootServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The constructor function caches the pointer of Boot Services Table through System Table. It will ASSERT() if the pointer of System Table is NULL. It will ASSERT() if the pointer of Boot Services Table is NULL. It will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI UnitTestUefiBootServicesTableLibConstructor(IN EFI_... | {
gImageHandle = ImageHandle;
ASSERT (gImageHandle != NULL);
gST = NULL;
gBS = SystemTable->BootServices;
ASSERT (gBS != NULL);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets an opaque, named pointer on a #GParamSpec. The name is specified through a #GQuark (retrieved e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the @pspec with g_param_spec_get_qdata(). Setting a previously set user data pointer, overrides (frees) the old pointer set, using NULL as... | void g_param_spec_set_qdata(GParamSpec *pspec, GQuark quark, gpointer data) | /* Sets an opaque, named pointer on a #GParamSpec. The name is specified through a #GQuark (retrieved e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the @pspec with g_param_spec_get_qdata(). Setting a previously set user data pointer, overrides (frees) the old pointer set, using NULL as... | {
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (quark > 0);
g_datalist_id_set_data (&pspec->qdata, quark, data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base USART peripheral base address. param enable true to enable, false to disable. */ | void USART_Enable9bitMode(USART_Type *base, bool enable) | /* param base USART peripheral base address. param enable true to enable, false to disable. */
void USART_Enable9bitMode(USART_Type *base, bool enable) | {
assert(base != NULL);
uint32_t temp = 0U;
if (enable)
{
temp = base->CFG & ~((uint32_t)USART_CFG_DATALEN_MASK | (uint32_t)USART_CFG_PARITYSEL_MASK);
temp |= (uint32_t)USART_CFG_DATALEN(0x2U);
base->CFG = temp;
}
else
{
base->CFG &= ~((uint32_t)USART_CFG_DATA... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get a pointer to the first entry in a filter list. */ | GList* get_filter_list_first(filter_list_type_t list_type) | /* Get a pointer to the first entry in a filter list. */
GList* get_filter_list_first(filter_list_type_t list_type) | {
GList **flpp;
flpp = get_filter_list(list_type);
return g_list_first(*flpp);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Exit function for DMA.
This function isolates DMA from the system */ | void dmacHw_exitDma(void) | /* Exit function for DMA.
This function isolates DMA from the system */
void dmacHw_exitDma(void) | {
chipcHw_busInterfaceClockDisable(chipcHw_REG_BUS_CLOCK_DMAC0);
chipcHw_busInterfaceClockDisable(chipcHw_REG_BUS_CLOCK_DMAC1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: (transfer none): the #GEnumValue with nickname @nick, or NULL if the enumeration doesn't have a member with that nickname */ | GEnumValue* g_enum_get_value_by_nick(GEnumClass *enum_class, const gchar *nick) | /* Returns: (transfer none): the #GEnumValue with nickname @nick, or NULL if the enumeration doesn't have a member with that nickname */
GEnumValue* g_enum_get_value_by_nick(GEnumClass *enum_class, const gchar *nick) | {
g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), NULL);
g_return_val_if_fail (nick != NULL, NULL);
if (enum_class->n_values)
{
GEnumValue *enum_value;
for (enum_value = enum_class->values; enum_value->value_name; enum_value++)
if (enum_value->value_nick && strcmp (nick, enum_value->value_nic... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Performs the necessary processing to handle a #VE exception. */ | EFI_STATUS EFIAPI CcExitHandleVe(IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext) | /* Performs the necessary processing to handle a #VE exception. */
EFI_STATUS EFIAPI CcExitHandleVe(IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext) | {
*ExceptionType = VE_EXCEPTION;
return EFI_UNSUPPORTED;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ib_find_gid - Returns the port number and GID table index where a specified GID value occurs. @device: The device to query. @gid: The GID value to search for. @port_num: The port number of the device where the GID value was found. @index: The index into the GID table where the GID was found. This parameter may be NU... | int ib_find_gid(struct ib_device *device, union ib_gid *gid, u8 *port_num, u16 *index) | /* ib_find_gid - Returns the port number and GID table index where a specified GID value occurs. @device: The device to query. @gid: The GID value to search for. @port_num: The port number of the device where the GID value was found. @index: The index into the GID table where the GID was found. This parameter may be NU... | {
union ib_gid tmp_gid;
int ret, port, i;
for (port = start_port(device); port <= end_port(device); ++port) {
for (i = 0; i < device->gid_tbl_len[port - start_port(device)]; ++i) {
ret = ib_query_gid(device, port, i, &tmp_gid);
if (ret)
return ret;
if (!memcmp(&tmp_gid, gid, sizeof *gid)) {
*port_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the SysTick pending.
This function will Set the SysTick pending. */ | void xSysTickPendSet(void) | /* Set the SysTick pending.
This function will Set the SysTick pending. */
void xSysTickPendSet(void) | {
xHWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_PENDSTSET;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Allocate a memory block from a memory pool. */ | void* sysPoolAlloc(osPoolId pool_id, uint32_t clr) | /* Allocate a memory block from a memory pool. */
void* sysPoolAlloc(osPoolId pool_id, uint32_t clr) | {
rt_clr_box(pool_id, ptr);
}
return ptr;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* name->name holds ptr to start of block. name->len holds size of block. */ | static int gfs2_dirent_last(const struct gfs2_dirent *dent, const struct qstr *name, void *opaque) | /* name->name holds ptr to start of block. name->len holds size of block. */
static int gfs2_dirent_last(const struct gfs2_dirent *dent, const struct qstr *name, void *opaque) | {
const char *start = name->name;
const char *end = (const char *)dent + be16_to_cpu(dent->de_rec_len);
if (name->len == (end - start))
return 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Lookup the mii_dev struct by the registered device name. */ | struct mii_dev* miiphy_get_dev_by_name(const char *devname) | /* Lookup the mii_dev struct by the registered device name. */
struct mii_dev* miiphy_get_dev_by_name(const char *devname) | {
struct list_head *entry;
struct mii_dev *dev;
if (!devname) {
printf("NULL device name!\n");
return NULL;
}
list_for_each(entry, &mii_devs) {
dev = list_entry(entry, struct mii_dev, link);
if (strcmp(dev->name, devname) == 0)
return dev;
}
return NULL;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Return the ModHandle and delete the entry in the array. */ | VOID* RemoveModHandle(IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext) | /* Return the ModHandle and delete the entry in the array. */
VOID* RemoveModHandle(IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext) | {
UINTN Index;
PDB_NAME_TO_MOD_HANDLE *Array;
if (ImageContext->PdbPointer == NULL) {
return NULL;
}
Array = mPdbNameModHandleArray;
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
if ((Array->PdbPointer != NULL) && (AsciiStrCmp (Array->PdbPointer, ImageCon... | tianocore/edk2 | C++ | Other | 4,240 |
/* Releases any remaining references on objects by this filp. */ | void drm_gem_release(struct drm_device *dev, struct drm_file *file_private) | /* Releases any remaining references on objects by this filp. */
void drm_gem_release(struct drm_device *dev, struct drm_file *file_private) | {
mutex_lock(&dev->struct_mutex);
idr_for_each(&file_private->object_idr,
&drm_gem_object_release_handle, NULL);
idr_destroy(&file_private->object_idr);
mutex_unlock(&dev->struct_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This file is part of the Simba project. */ | int mock_write_uart_soft_init(struct pin_device_t *tx_dev_p, struct pin_device_t *rx_dev_p, struct exti_device_t *rx_exti_dev_p, int baudrate, void *rxbuf_p, size_t size, int res) | /* This file is part of the Simba project. */
int mock_write_uart_soft_init(struct pin_device_t *tx_dev_p, struct pin_device_t *rx_dev_p, struct exti_device_t *rx_exti_dev_p, int baudrate, void *rxbuf_p, size_t size, int res) | {
harness_mock_write("uart_soft_init(tx_dev_p)",
tx_dev_p,
sizeof(*tx_dev_p));
harness_mock_write("uart_soft_init(rx_dev_p)",
rx_dev_p,
sizeof(*rx_dev_p));
harness_mock_write("uart_soft_init(rx_exti_dev_p)",
... | eerimoq/simba | C++ | Other | 337 |
/* tipc_link_reset_fragments - purge link's inbound message fragments queue @l_ptr: pointer to link */ | void tipc_link_reset_fragments(struct link *l_ptr) | /* tipc_link_reset_fragments - purge link's inbound message fragments queue @l_ptr: pointer to link */
void tipc_link_reset_fragments(struct link *l_ptr) | {
struct sk_buff *buf = l_ptr->defragm_buf;
struct sk_buff *next;
while (buf) {
next = buf->next;
buf_discard(buf);
buf = next;
}
l_ptr->defragm_buf = NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get I2C status of the specified I2C port.
The */ | unsigned long I2CStatusGet(unsigned long ulBase) | /* Get I2C status of the specified I2C port.
The */
unsigned long I2CStatusGet(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE));
return (xHWREG(ulBase + I2C_O_STATUS) & I2C_STATUS_M);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Transmits packets that fit into TX descriptor (are <=120B) */ | static void meth_tx_short_prepare(struct meth_private *priv, struct sk_buff *skb) | /* Transmits packets that fit into TX descriptor (are <=120B) */
static void meth_tx_short_prepare(struct meth_private *priv, struct sk_buff *skb) | {
tx_packet *desc = &priv->tx_ring[priv->tx_write];
int len = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
desc->header.raw = METH_TX_CMD_INT_EN | (len-1) | ((128-len) << 16);
skb_copy_from_linear_data(skb, desc->data.dt + (120 - len), skb->len);
if (skb->len < len)
memset(desc->data.dt + 120 - len + skb->len, 0... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Search the environment for a variable. Return the value, if found, or NULL, if not found. */ | char* fw_getenv(char *name) | /* Search the environment for a variable. Return the value, if found, or NULL, if not found. */
char* fw_getenv(char *name) | {
char *env, *nxt;
for (env = environment.data; *env; env = nxt + 1) {
char *val;
for (nxt = env; *nxt; ++nxt) {
if (nxt >= &environment.data[ENV_SIZE]) {
fprintf(stderr, "## Error: "
"environment not terminated\n");
return NULL;
}
}
val = envmatch(name, env);
if (!val)
continue;
ret... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* snd_hda_ch_mode_put - Put callback helper for the channel mode enum */ | int snd_hda_ch_mode_put(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol, const struct hda_channel_mode *chmode, int num_chmodes, int *max_channelsp) | /* snd_hda_ch_mode_put - Put callback helper for the channel mode enum */
int snd_hda_ch_mode_put(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol, const struct hda_channel_mode *chmode, int num_chmodes, int *max_channelsp) | {
unsigned int mode;
mode = ucontrol->value.enumerated.item[0];
if (mode >= num_chmodes)
return -EINVAL;
if (*max_channelsp == chmode[mode].channels)
return 0;
*max_channelsp = chmode[mode].channels;
if (chmode[mode].sequence)
snd_hda_sequence_write_cache(codec, chmode[mode].sequence);
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Free and unmap a vmap area, caller ensuring flush_cache_vunmap had been called for the correct range previously. */ | static void free_unmap_vmap_area_noflush(struct vmap_area *va) | /* Free and unmap a vmap area, caller ensuring flush_cache_vunmap had been called for the correct range previously. */
static void free_unmap_vmap_area_noflush(struct vmap_area *va) | {
va->flags |= VM_LAZY_FREE;
atomic_add((va->va_end - va->va_start) >> PAGE_SHIFT, &vmap_lazy_nr);
if (unlikely(atomic_read(&vmap_lazy_nr) > lazy_max_pages()))
try_purge_vmap_area_lazy();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If any reserved bits in Address are set, then ASSERT(). */ | UINT8 EFIAPI S3PciSegmentRead8(IN UINT64 Address) | /* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI S3PciSegmentRead8(IN UINT64 Address) | {
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentRead8 (Address));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Worker function to do OR operation on CPU feature supported bits mask buffer. */ | VOID SupportedMaskOr(IN UINT8 *SupportedFeatureMask, IN UINT8 *OrFeatureBitMask, IN UINT32 BitMaskSize) | /* Worker function to do OR operation on CPU feature supported bits mask buffer. */
VOID SupportedMaskOr(IN UINT8 *SupportedFeatureMask, IN UINT8 *OrFeatureBitMask, IN UINT32 BitMaskSize) | {
UINTN Index;
UINT8 *Data1;
UINT8 *Data2;
Data1 = SupportedFeatureMask;
Data2 = OrFeatureBitMask;
for (Index = 0; Index < BitMaskSize; Index++) {
*(Data1++) |= *(Data2++);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 0 in case sectors are filled with 0, 1 if sectors contain non-zero data and negative value on error. */ | static int check_empty_sectors(BlockDriverState *bs, int64_t sect_num, int sect_count, const char *filename, uint8_t *buffer, bool quiet) | /* Returns 0 in case sectors are filled with 0, 1 if sectors contain non-zero data and negative value on error. */
static int check_empty_sectors(BlockDriverState *bs, int64_t sect_num, int sect_count, const char *filename, uint8_t *buffer, bool quiet) | {
int pnum, ret = 0;
ret = bdrv_read(bs, sect_num, buffer, sect_count);
if (ret < 0) {
error_report("Error while reading offset %" PRId64 " of %s: %s",
sectors_to_bytes(sect_num), filename, strerror(-ret));
return ret;
}
ret = is_allocated_sectors(buffer, sect_co... | ve3wwg/teensy3_qemu | C | Other | 15 |
/* em28xx_write_reg_bits() sets only some bits (specified by bitmask) of a register, by first reading the actual value */ | int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, u8 bitmask) | /* em28xx_write_reg_bits() sets only some bits (specified by bitmask) of a register, by first reading the actual value */
int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, u8 bitmask) | {
int oldval;
u8 newval;
if (reg == dev->reg_gpo_num)
oldval = dev->reg_gpo;
else if (reg == dev->reg_gpio_num)
oldval = dev->reg_gpio;
else
oldval = em28xx_read_reg(dev, reg);
if (oldval < 0)
return oldval;
newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
return em28xx_write_regs(dev, reg, &newva... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Associate a configuration with its alternative-speed counterpart Gets the current device state */ | sl_status_t sl_usbd_core_get_device_state(sl_usbd_device_state_t *p_dev_state) | /* Associate a configuration with its alternative-speed counterpart Gets the current device state */
sl_status_t sl_usbd_core_get_device_state(sl_usbd_device_state_t *p_dev_state) | {
sli_usbd_device_t *p_dev;
if (p_dev_state == NULL) {
return SL_STATUS_INVALID_PARAMETER;
}
p_dev = &usbd_ptr->device;
*p_dev_state = p_dev->state;
return SL_STATUS_OK;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Recover from PTC deadlocks conditions. Recovery requires stepping thru each TLB flush transaction. The recovery sequence is somewhat tricky & is coded in assembly language. */ | void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long) | /* Recover from PTC deadlocks conditions. Recovery requires stepping thru each TLB flush transaction. The recovery sequence is somewhat tricky & is coded in assembly language. */
void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long) | {
short nasid, i;
unsigned long *piows, zeroval, n;
__get_cpu_var(ptcstats).deadlocks++;
piows = (unsigned long *) pda->pio_write_status_addr;
zeroval = pda->pio_write_status_val;
for (i=ib; i <= ie; i++) {
nasid = nasids[i];
if (local_node_uses_ptc_ga(is_shub1()) && nasid == mynasid)
continue;
ptc0 = CH... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Advances *optp to next option if still in PDU. This function returns the number of bytes opt has been advanced or */ | static size_t next_option_safe(coap_opt_t **optp, size_t *length) | /* Advances *optp to next option if still in PDU. This function returns the number of bytes opt has been advanced or */
static size_t next_option_safe(coap_opt_t **optp, size_t *length) | {
assert(optsize <= *length);
*optp += optsize;
*length -= optsize;
}
return optsize;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Starts playing audio stream from a data buffer for a determined size. */ | uint32_t EVAL_AUDIO_Play(uint16_t *pBuffer, uint32_t Size) | /* Starts playing audio stream from a data buffer for a determined size. */
uint32_t EVAL_AUDIO_Play(uint16_t *pBuffer, uint32_t Size) | {
AudioTotalSize = Size/2;
Codec_Play();
Audio_MAL_Play((uint32_t)pBuffer, (uint32_t)(DMA_MAX(AudioTotalSize / 2)));
AudioRemSize = (Size/2) - DMA_MAX(AudioTotalSize);
CurrentPos = pBuffer + DMA_MAX(AudioTotalSize);
return 0;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Constructor function of VarCheckHiiLib to register var check HII handler. */ | EFI_STATUS EFIAPI VarCheckHiiLibNullClassConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* Constructor function of VarCheckHiiLib to register var check HII handler. */
EFI_STATUS EFIAPI VarCheckHiiLibNullClassConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
VarCheckLibRegisterEndOfDxeCallback (VarCheckHiiGen);
VarCheckLibRegisterAddressPointer ((VOID **)&mVarCheckHiiBin);
VarCheckLibRegisterSetVariableCheckHandler (SetVariableCheckHandlerHii);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Gets the data clock source for the specified SSI peripheral. */ | uint32_t SSIClockSourceGet(uint32_t ui32Base) | /* Gets the data clock source for the specified SSI peripheral. */
uint32_t SSIClockSourceGet(uint32_t ui32Base) | {
ASSERT(_SSIBaseValid(ui32Base));
return(HWREG(ui32Base + SSI_O_CC));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */ | struct net_device* alloc_fcdev(int sizeof_priv) | /* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */
struct net_device* alloc_fcdev(int sizeof_priv) | {
return alloc_netdev(sizeof_priv, "fc%d", fc_setup);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will compare two strings without specified length */ | rt_int32_t rt_strcmp(const char *cs, const char *ct) | /* This function will compare two strings without specified length */
rt_int32_t rt_strcmp(const char *cs, const char *ct) | {
while (*cs && *cs == *ct)
{
cs++;
ct++;
}
return (*cs - *ct);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* ima_measure points to either the measure_default_rules or the the new measure_policy_rules. */ | void __init ima_init_policy(void) | /* ima_measure points to either the measure_default_rules or the the new measure_policy_rules. */
void __init ima_init_policy(void) | {
int i, entries;
if (ima_use_tcb)
entries = ARRAY_SIZE(default_rules);
else
entries = 0;
for (i = 0; i < entries; i++)
list_add_tail(&default_rules[i].list, &measure_default_rules);
ima_measure = &measure_default_rules;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Gets the selected ADC Software start conversion Status. */ | FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef *ADCx) | /* Gets the selected ADC Software start conversion Status. */
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef *ADCx) | {
FlagStatus bitstatus = RESET;
assert_param(IS_ADC_ALL_PERIPH(ADCx));
if ((ADCx->CR2 & CR2_SWSTART_Set) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.