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
/* Enable I2C DMA of the specified I2C port. The */
void I2CDMAEnable(unsigned long ulBase)
/* Enable I2C DMA of the specified I2C port. The */ void I2CDMAEnable(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_CON1) |= I2C_CON1_DMAEN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Print the command line with a carrot pointing to the k-th character of the n-th field. */
static void errline(int n, int k, FILE *err)
/* Print the command line with a carrot pointing to the k-th character of the n-th field. */ static void errline(int n, int k, FILE *err)
{ int spcnt, i; if( argv[0] ) fprintf(err,"%s",argv[0]); spcnt = lemonStrlen(argv[0]) + 1; for(i=1; i<n && argv[i]; i++){ fprintf(err," %s",argv[i]); spcnt += lemonStrlen(argv[i])+1; } spcnt += k; for(; argv[i]; i++) fprintf(err," %s",argv[i]); if( spcnt<20 ){ fprintf(err,"\n%*s^-- here\n",s...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Like env_get, but prints an error if envvar isn't defined in the environment. It always returns what env_get does, so it can be used in place of env_get without changing error handling otherwise. */
char* from_env(const char *envvar)
/* Like env_get, but prints an error if envvar isn't defined in the environment. It always returns what env_get does, so it can be used in place of env_get without changing error handling otherwise. */ char* from_env(const char *envvar)
{ char *ret; ret = env_get(envvar); if (!ret) printf("missing environment variable: %s\n", envvar); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function gets the status of acquisition from the ADC Channel Acquisition Time Sequencer Registers. */
u32 XAdcPs_GetSeqAcqTime(XAdcPs *InstancePtr)
/* This function gets the status of acquisition from the ADC Channel Acquisition Time Sequencer Registers. */ u32 XAdcPs_GetSeqAcqTime(XAdcPs *InstancePtr)
{ u32 RegValAcq; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); RegValAcq = XAdcPs_ReadInternalReg(InstancePtr, XADCPS_SEQ06_OFFSET) & XADCPS_SEQ06_CH_VALID_MASK; RegValAcq |= (XAdcPs_ReadInternalReg(InstancePtr, XADCPS_SEQ07_OFFSET) & XAD...
ua1arn/hftrx
C++
null
69
/* The constructor function checks whether or not RNDR instruction is supported. It will ASSERT() if RNDR instruction is not supported. It will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI BaseRngLibConstructor(VOID)
/* The constructor function checks whether or not RNDR instruction is supported. It will ASSERT() if RNDR instruction is not supported. It will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI BaseRngLibConstructor(VOID)
{ UINT64 Isar0; Isar0 = ArmReadIdIsar0 (); ASSERT ((Isar0 & RNDR_MASK) != 0); mRndrSupported = ((Isar0 & RNDR_MASK) != 0); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* AK4528 on VX442 to choose the chip mask */
static void vx442_ak4524_lock(struct snd_akm4xxx *ak, int chip)
/* AK4528 on VX442 to choose the chip mask */ static void vx442_ak4524_lock(struct snd_akm4xxx *ak, int chip)
{ struct snd_ak4xxx_private *priv = (void *)ak->private_value[0]; struct snd_ice1712 *ice = ak->private_data[0]; snd_ice1712_save_gpio_status(ice); priv->cs_mask = priv->cs_addr = chip == 0 ? ICE1712_VX442_CODEC_CHIP_A : ICE1712_VX442_CODEC_CHIP_B; }
robutest/uclinux
C++
GPL-2.0
60
/* the main MDNS service task. Packets are received and parsed here */
static void _mdns_service_task(void *pvParameters)
/* the main MDNS service task. Packets are received and parsed here */ static void _mdns_service_task(void *pvParameters)
{ mdns_action_t * a = NULL; for (;;) { if (_mdns_server && _mdns_server->action_queue) { if (xQueueReceive(_mdns_server->action_queue, &a, portMAX_DELAY) == pdTRUE) { if (a->type == ACTION_TASK_STOP) { break; } MDNS_SERVICE_...
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Check whether there is any data pending on the RX buffer. */
uint8_t cdcBufferDataPending()
/* Check whether there is any data pending on the RX buffer. */ uint8_t cdcBufferDataPending()
{ if (cdcfifo.len != 0) { return 1; } return 0; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Populate back untouched region of new data cluster */
static void qed_aio_write_postfill(void *opaque, int ret)
/* Populate back untouched region of new data cluster */ static void qed_aio_write_postfill(void *opaque, int ret)
{ QEDAIOCB *acb = opaque; BDRVQEDState *s = acb_to_s(acb); uint64_t start = acb->cur_pos + acb->cur_qiov.size; uint64_t len = qed_start_of_cluster(s, start + s->header.cluster_size - 1) - start; uint64_t offset = acb->cur_cluster + qed_offset_into_cluster(s, acb->cur_po...
ve3wwg/teensy3_qemu
C++
Other
15
/* param base Pointer to the FLEXIO_UART_Type structure. param mask Interrupt source. */
void FLEXIO_UART_DisableInterrupts(FLEXIO_UART_Type *base, uint32_t mask)
/* param base Pointer to the FLEXIO_UART_Type structure. param mask Interrupt source. */ void FLEXIO_UART_DisableInterrupts(FLEXIO_UART_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_UART_TxDataRegEmptyInterruptEnable) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[0]); } if (mask & kFLEXIO_UART_RxDataRegFullInterruptEnable) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create a thread and add it to Active Threads and set it to state READY. */
osThreadId osThreadCreate(osThreadDef_t *thread_def, void *argument)
/* Create a thread and add it to Active Threads and set it to state READY. */ osThreadId osThreadCreate(osThreadDef_t *thread_def, void *argument)
{ osThreadId thread; thread = rt_thread_create(thread_def->name, thread_def->entry, argument, thread_def->stack_size, thread_def->priority, thread_def->tick); if (thread != RT_NULL) rt_thread_startup(thread); return thread; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* e1000_clear_vfta - Clears the VLAN filer table @hw: Struct containing variables accessed by shared code */
static void e1000_clear_vfta(struct e1000_hw *hw)
/* e1000_clear_vfta - Clears the VLAN filer table @hw: Struct containing variables accessed by shared code */ static void e1000_clear_vfta(struct e1000_hw *hw)
{ u32 offset; u32 vfta_value = 0; u32 vfta_offset = 0; u32 vfta_bit_in_reg = 0; for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); E1000_WRITE_FLUSH(); } }
robutest/uclinux
C++
GPL-2.0
60
/* USBH_CtlReceiveData Receives the Device Response to the Setup Packet. */
USBH_StatusTypeDef USBH_CtlReceiveData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t pipe_num)
/* USBH_CtlReceiveData Receives the Device Response to the Setup Packet. */ USBH_StatusTypeDef USBH_CtlReceiveData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t pipe_num)
{ USBH_LL_SubmitURB (phost, pipe_num, 1, USBH_EP_CONTROL, USBH_PID_DATA, buff, length, 0); return USBH_OK; ...
micropython/micropython
C++
Other
18,334
/* Set the block size and count for data transfer */
void SDHostBlockCountSet(unsigned long ulBase, unsigned short ulBlkCount)
/* Set the block size and count for data transfer */ void SDHostBlockCountSet(unsigned long ulBase, unsigned short ulBlkCount)
{ unsigned long ulRegVal; ulRegVal = HWREG(ulBase + MMCHS_O_BLK); HWREG(ulBase + MMCHS_O_BLK) = ((ulRegVal & 0x0000FFFF)| (ulBlkCount << 16)); }
micropython/micropython
C++
Other
18,334
/* Read the ft6x06 device ID, pre initialize I2C in case of need to be able to read the FT6206 device ID, and verify this is a FT6206. */
uint16_t ft6x06_ReadID(uint16_t DeviceAddr)
/* Read the ft6x06 device ID, pre initialize I2C in case of need to be able to read the FT6206 device ID, and verify this is a FT6206. */ uint16_t ft6x06_ReadID(uint16_t DeviceAddr)
{ TS_IO_Init(); return (TS_IO_Read(DeviceAddr, FT6206_CHIP_ID_REG)); }
eclipse-threadx/getting-started
C++
Other
310
/* Poll all AP devices on the bus in a round robin fashion. Continue polling until bit 2^0 of the control flags is not set. If bit 2^1 of the control flags has been set arm the poll timer. */
static void ap_poll_all(unsigned long)
/* Poll all AP devices on the bus in a round robin fashion. Continue polling until bit 2^0 of the control flags is not set. If bit 2^1 of the control flags has been set arm the poll timer. */ static void ap_poll_all(unsigned long)
{ unsigned long flags; struct ap_device *ap_dev; if (ap_using_interrupts()) xchg((u8 *)ap_interrupt_indicator, 0); do { flags = 0; spin_lock(&ap_device_list_lock); list_for_each_entry(ap_dev, &ap_device_list, list) { spin_lock(&ap_dev->lock); __ap_poll_device(ap_dev, &flags); spin_unlock(&ap_dev->l...
robutest/uclinux
C++
GPL-2.0
60
/* Allocate a structure for a static callback message and initialize it. This is intended to be used to send "static" messages from interrupt context. */
struct tcpip_callback_msg* tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx)
/* Allocate a structure for a static callback message and initialize it. This is intended to be used to send "static" messages from interrupt context. */ struct tcpip_callback_msg* tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx)
{ struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { return NULL; } msg->type = TCPIP_MSG_CALLBACK_STATIC; msg->msg.cb.function = function; msg->msg.cb.ctx = ctx; return (struct tcpip_callback_msg*)msg; }
Nicholas3388/LuaNode
C++
Other
1,055
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit an...
UINT32 EFIAPI PciExpressBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit an...
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT32)-1; } return MmioBitFieldAnd32 ( (UINTN)GetPciExpressBaseAddress () + Address, StartBit, EndBit, AndData ); }
tianocore/edk2
C++
Other
4,240
/* The usage description of udp server on rt-Thread. */
static void usage(void)
/* The usage description of udp server on rt-Thread. */ static void usage(void)
{ rt_kprintf("Usage: udpserver -p <port>\n"); rt_kprintf(" udpserver --stop\n"); rt_kprintf(" udpserver --help\n"); rt_kprintf("\n"); rt_kprintf("Miscellaneous:\n"); rt_kprintf(" -p Specify the host port number\n"); rt_kprintf(" --stop Stop udpserver program\n")...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* igbvf_exit_module is called just before the driver is removed from memory. */
static void __exit igbvf_exit_module(void)
/* igbvf_exit_module is called just before the driver is removed from memory. */ static void __exit igbvf_exit_module(void)
{ pci_unregister_driver(&igbvf_driver); pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, igbvf_driver_name); }
robutest/uclinux
C++
GPL-2.0
60
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. */
void FLEXIO_MCULCD_TransferAbortEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle)
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. */ void FLEXIO_MCULCD_TransferAbortEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle)
{ assert(handle); if (handle->txDmaHandle) { EDMA_AbortTransfer(handle->txDmaHandle); } if (handle->rxDmaHandle) { EDMA_AbortTransfer(handle->rxDmaHandle); } FLEXIO_MCULCD_EnableTxDMA(handle->base, false); FLEXIO_MCULCD_EnableRxDMA(handle->base, false); handle->st...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return: true if @op is supported, false otherwise. */
bool spi_mem_supports_op(struct spi_slave *slave, const struct spi_mem_op *op)
/* Return: true if @op is supported, false otherwise. */ bool spi_mem_supports_op(struct spi_slave *slave, const struct spi_mem_op *op)
{ struct udevice *bus = slave->dev->parent; struct dm_spi_ops *ops = spi_get_ops(bus); if (ops->mem_ops && ops->mem_ops->supports_op) return ops->mem_ops->supports_op(slave, op); return spi_mem_default_supports_op(slave, op); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Read next Long Allocation Descriptor from a given file's data. */
EFI_STATUS GetLongAdFromAds(IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT UDF_LONG_ALLOCATION_DESCRIPTOR **FoundLongAd)
/* Read next Long Allocation Descriptor from a given file's data. */ EFI_STATUS GetLongAdFromAds(IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT UDF_LONG_ALLOCATION_DESCRIPTOR **FoundLongAd)
{ UDF_LONG_ALLOCATION_DESCRIPTOR *LongAd; UDF_EXTENT_FLAGS ExtentFlags; for ( ; ;) { if (*Offset >= Length) { return EFI_DEVICE_ERROR; } LongAd = (UDF_LONG_ALLOCATION_DESCRIPTOR *)((UINT8 *)Data + *Offset); ExtentFlags = GET_EXTENT_FLAGS (LongAdsSequence, LongAd); i...
tianocore/edk2
C++
Other
4,240
/* Outputs a formatted string on the DBGU stream, using a variable number of arguments. */
signed int printf(const char *pFormat,...)
/* Outputs a formatted string on the DBGU stream, using a variable number of arguments. */ signed int printf(const char *pFormat,...)
{ va_list ap; signed int result; va_start(ap, pFormat); result = vprintf(pFormat, ap); va_end(ap); return result; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressAnd32(IN UINTN Address, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciExpressAnd32(IN UINTN Address, IN UINT32 AndData)
{ ASSERT_INVALID_PCI_ADDRESS (Address); if (Address >= PcdPciExpressBaseSize ()) { return (UINT32)-1; } return MmioAnd32 ((UINTN)GetPciExpressBaseAddress () + Address, AndData); }
tianocore/edk2
C++
Other
4,240
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_get_line_num(CRInput *a_this, glong *a_line_num)
/* Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_get_line_num(CRInput *a_this, glong *a_line_num)
{ g_return_val_if_fail (a_this && PRIVATE (a_this) && a_line_num, CR_BAD_PARAM_ERROR); *a_line_num = PRIVATE (a_this)->line; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Accelerometer analog chain bandwidth selection (only for accelerometer ODR ≥ 1.67 kHz).. */
int32_t lsm6dsl_xl_filter_analog_set(stmdev_ctx_t *ctx, lsm6dsl_bw0_xl_t val)
/* Accelerometer analog chain bandwidth selection (only for accelerometer ODR ≥ 1.67 kHz).. */ int32_t lsm6dsl_xl_filter_analog_set(stmdev_ctx_t *ctx, lsm6dsl_bw0_xl_t val)
{ lsm6dsl_ctrl1_xl_t ctrl1_xl; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_CTRL1_XL, (uint8_t*)&ctrl1_xl, 1); if(ret == 0){ ctrl1_xl.bw0_xl = (uint8_t) val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_CTRL1_XL, (uint8_t*)&ctrl1_xl, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
{ CONST EFI_PEI_SERVICES **PeiServices; EFI_PEI_CPU_IO_PPI *CpuIo; PeiServices = GetPeiServicesTablePointer (); CpuIo = (*PeiServices)->CpuIo; ASSERT (CpuIo != NULL); ASSERT ((Port & 3) == 0); CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64)Port, Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different shift from the CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg and @idlest_bit. No return value. */
static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit)
/* The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different shift from the CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg and @idlest_bit. No return value. */ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit)
{ u32 r; r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); *idlest_reg = (__force void __iomem *)r; *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* MSS_GPIO_clear_irq See "mss_gpio.h" for details of how to use this function. */
void MSS_GPIO_clear_irq(mss_gpio_id_t port_id)
/* MSS_GPIO_clear_irq See "mss_gpio.h" for details of how to use this function. */ void MSS_GPIO_clear_irq(mss_gpio_id_t port_id)
{ uint32_t gpio_idx = (uint32_t)port_id; ASSERT( gpio_idx < NB_OF_GPIO ); if ( gpio_idx < NB_OF_GPIO ) { GPIO->GPIO_IRQ = ((uint32_t)1) << gpio_idx; NVIC_ClearPendingIRQ( g_gpio_irqn_lut[gpio_idx] ); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Returns: (transfer none): pointer to the stream's data, or NULL if the data has been stolen */
gpointer g_memory_output_stream_get_data(GMemoryOutputStream *ostream)
/* Returns: (transfer none): pointer to the stream's data, or NULL if the data has been stolen */ gpointer g_memory_output_stream_get_data(GMemoryOutputStream *ostream)
{ g_return_val_if_fail (G_IS_MEMORY_OUTPUT_STREAM (ostream), NULL); return ostream->priv->data; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the interface is not supported, then ASSERT(). */
VOID EFIAPI X509Free(IN VOID *X509Cert)
/* If the interface is not supported, then ASSERT(). */ VOID EFIAPI X509Free(IN VOID *X509Cert)
{ CALL_VOID_CRYPTO_SERVICE (X509Free, (X509Cert)); }
tianocore/edk2
C++
Other
4,240
/* Given the ID of the parent and the name build a search key. */
void hfs_cat_build_key(struct super_block *sb, btree_key *key, u32 parent, struct qstr *name)
/* Given the ID of the parent and the name build a search key. */ void hfs_cat_build_key(struct super_block *sb, btree_key *key, u32 parent, struct qstr *name)
{ key->cat.reserved = 0; key->cat.ParID = cpu_to_be32(parent); if (name) { hfs_asc2mac(sb, &key->cat.CName, name); key->key_len = 6 + key->cat.CName.len; } else { memset(&key->cat.CName, 0, sizeof(struct hfs_name)); key->key_len = 6; } }
robutest/uclinux
C++
GPL-2.0
60
/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */
EFI_STATUS VmWriteMem64(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT64 Data)
/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */ EFI_STATUS VmWriteMem64(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT64 Data)
{ EFI_STATUS Status; Addr = ConvertStackAddr (VmPtr, Addr); if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) { *(UINT64 *)Addr = Data; } else { MemoryFence (); if ((Status = VmWriteMem32 (VmPtr, Addr, (UINT32)Data)) != EFI_SUCCESS) { return Status; } MemoryFence (); if ((Status = V...
tianocore/edk2
C++
Other
4,240
/* Enables HFRC auto-adjustment at the specified interval. ui32Warmup should be one of the following values: */
void am_hal_clkgen_hfrc_adjust_enable(uint32_t ui32Warmup, uint32_t ui32Frequency)
/* Enables HFRC auto-adjustment at the specified interval. ui32Warmup should be one of the following values: */ void am_hal_clkgen_hfrc_adjust_enable(uint32_t ui32Warmup, uint32_t ui32Frequency)
{ AM_REG(CLKGEN, HFADJ) = AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_2 | ui32Warmup | AM_REG_CLKGEN_HFADJ_HFXTADJ(AM_REG_CLKGEN_HFADJ_HFXTADJ_DEFAULT) | ui32Frequency ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Math helper, returns latch value converted to nanoseconds (bound checked) */
u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt)
/* Math helper, returns latch value converted to nanoseconds (bound checked) */ u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt)
{ u64 clc = (u64) latch << evt->shift; if (unlikely(!evt->mult)) { evt->mult = 1; WARN_ON(1); } do_div(clc, evt->mult); if (clc < 1000) clc = 1000; if (clc > KTIME_MAX) clc = KTIME_MAX; return clc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Indicates whether the root node has a given value in its compatible property. */
int machine_is_compatible(const char *compat)
/* Indicates whether the root node has a given value in its compatible property. */ int machine_is_compatible(const char *compat)
{ struct device_node *root; int rc = 0; root = of_find_node_by_path("/"); if (root) { rc = of_device_is_compatible(root, compat); of_node_put(root); } return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read the state or data from the HD44780. */
unsigned char HD44780Read(unsigned char ucRS)
/* Read the state or data from the HD44780. */ unsigned char HD44780Read(unsigned char ucRS)
{ unsigned char ucData = 0; xASSERT((ucRS == HD44780_RS_COMMAND) || (ucRS == HD44780_RS_DATA)); return ucData; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get a pointer to the indev read task to modify its parameters with */
lv_task_t* lv_indev_get_read_task(lv_disp_t *indev)
/* Get a pointer to the indev read task to modify its parameters with */ lv_task_t* lv_indev_get_read_task(lv_disp_t *indev)
{ if(!indev) { LV_LOG_WARN("lv_indev_get_read_task: indev was NULL"); return NULL; } return indev->refr_task; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Setup SNVS interrupt. Enables or disables the related HW module interrupt, and attached the related sub-routine into the vector table. */
void snvs_srtc_setup_interrupt(void(*irq_subroutine)(void), uint8_t state)
/* Setup SNVS interrupt. Enables or disables the related HW module interrupt, and attached the related sub-routine into the vector table. */ void snvs_srtc_setup_interrupt(void(*irq_subroutine)(void), uint8_t state)
{ uint32_t irq_id = IMX_INT_SNVS; if (state) { register_interrupt_routine(irq_id, irq_subroutine); enable_interrupt(irq_id, CPU_0, 0); } else { disable_interrupt(irq_id, CPU_0); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Over-ride default table to reserve additional IRQs for use by ISA e.g. acpi_irq_isa=5 Useful for telling ACPI how not to interfere with your ISA sound card. */
static int __init acpi_irq_isa(char *str)
/* Over-ride default table to reserve additional IRQs for use by ISA e.g. acpi_irq_isa=5 Useful for telling ACPI how not to interfere with your ISA sound card. */ static int __init acpi_irq_isa(char *str)
{ return acpi_irq_penalty_update(str, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_enable_afm(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_enable_afm(mss_uart_instance_t *this_uart)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { set_bit_reg8(&this_uart->hw_reg->MM2,EAFM); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* All the driver's attach() and detach() calls are guaranteed to have finished by the time this function returns. */
void parport_unregister_driver(struct parport_driver *drv)
/* All the driver's attach() and detach() calls are guaranteed to have finished by the time this function returns. */ void parport_unregister_driver(struct parport_driver *drv)
{ struct parport *port; mutex_lock(&registration_lock); list_del_init(&drv->list); list_for_each_entry(port, &portlist, list) drv->detach(port); mutex_unlock(&registration_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the specified ADC injected channel conversion value offset. */
void ADC_ConfigInjectedOffset(ADC_T *adc, ADC_INJEC_CHANNEL_T channel, uint16_t offset)
/* Configures the specified ADC injected channel conversion value offset. */ void ADC_ConfigInjectedOffset(ADC_T *adc, ADC_INJEC_CHANNEL_T channel, uint16_t offset)
{ switch ((uint8_t)channel) { case 0x01: adc->INJDOF1_B.INJDOF1 = offset; break; case 0x02: adc->INJDOF2_B.INJDOF2 = offset; break; case 0x03: adc->INJDOF3_B.INJDOF3 = offset; break; case 0x04: adc->INJDOF4_B.INJDOF4 = offset; break...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CRC algorithm parameters were taken from the "Checksum Calculation" section of the datasheet. */
static uint8_t sht3xd_compute_crc(uint16_t value)
/* CRC algorithm parameters were taken from the "Checksum Calculation" section of the datasheet. */ static uint8_t sht3xd_compute_crc(uint16_t value)
{ uint8_t buf[2]; sys_put_be16(value, buf); return crc8(buf, 2, 0x31, 0xFF, false); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns 0 if successful, anything else for an error. */
int __must_check pci_hp_change_slot_info(struct hotplug_slot *hotplug, struct hotplug_slot_info *info)
/* Returns 0 if successful, anything else for an error. */ int __must_check pci_hp_change_slot_info(struct hotplug_slot *hotplug, struct hotplug_slot_info *info)
{ struct pci_slot *slot; if (!hotplug || !info) return -ENODEV; slot = hotplug->pci_slot; memcpy(hotplug->info, info, sizeof(struct hotplug_slot_info)); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the ADC window mode. Sets the ADC window mode to a given mode and value range. */
void adc_set_window_mode(struct adc_module *const module_inst, const enum adc_window_mode window_mode, const int16_t window_lower_value, const int16_t window_upper_value)
/* Sets the ADC window mode. Sets the ADC window mode to a given mode and value range. */ void adc_set_window_mode(struct adc_module *const module_inst, const enum adc_window_mode window_mode, const int16_t window_lower_value, const int16_t window_upper_value)
{ Assert(module_inst); Assert(module_inst->hw); Adc *const adc_module = module_inst->hw; while (adc_is_syncing(module_inst)) { } uint32_t ctrlc = adc_module->CTRLC.reg; ctrlc = (ctrlc & (~ADC_CTRLC_WINMODE_Msk)) | window_mode; adc_module->CTRLC.reg = ctrlc; while (adc_is_syncing(module_inst)) { } adc_module-...
remotemcu/remcu-chip-sdks
C++
null
436
/* ks8851_done_tx - update and then free skbuff after transmitting @ks: The device state @txb: The buffer transmitted */
static void ks8851_done_tx(struct ks8851_net *ks, struct sk_buff *txb)
/* ks8851_done_tx - update and then free skbuff after transmitting @ks: The device state @txb: The buffer transmitted */ static void ks8851_done_tx(struct ks8851_net *ks, struct sk_buff *txb)
{ struct net_device *dev = ks->netdev; dev->stats.tx_bytes += txb->len; dev->stats.tx_packets++; dev_kfree_skb(txb); }
robutest/uclinux
C++
GPL-2.0
60
/* So what we do is to rely on the fact that journal_stop/journal_start will */
static int do_journal_get_write_access(handle_t *handle, struct buffer_head *bh)
/* So what we do is to rely on the fact that journal_stop/journal_start will */ static int do_journal_get_write_access(handle_t *handle, struct buffer_head *bh)
{ if (!buffer_mapped(bh) || buffer_freed(bh)) return 0; return ext3_journal_get_write_access(handle, bh); }
robutest/uclinux
C++
GPL-2.0
60
/* Inform application whether a compare match interrupt has occurred. @rmtoll ISR CMPM LPTIM_IsActiveFlag_CMPM. */
uint32_t LPTIM_IsActiveFlag_CMPM(LPTIM_Module *LPTIMx)
/* Inform application whether a compare match interrupt has occurred. @rmtoll ISR CMPM LPTIM_IsActiveFlag_CMPM. */ uint32_t LPTIM_IsActiveFlag_CMPM(LPTIM_Module *LPTIMx)
{ return (((READ_BIT(LPTIMx->INTSTS,LPTIM_INTSTS_CMPM) ==LPTIM_INTSTS_CMPM)? 1UL : 0UL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Configures the CRC calculation length for the selected SPI. */
void SPI_CRCLengthConfig(SPI_TypeDef *SPIx, uint16_t SPI_CRCLength)
/* Configures the CRC calculation length for the selected SPI. */ void SPI_CRCLengthConfig(SPI_TypeDef *SPIx, uint16_t SPI_CRCLength)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_CRC_LENGTH(SPI_CRCLength)); SPIx->CR1 &= (uint16_t)~((uint16_t)SPI_CR1_CRCL); SPIx->CR1 |= SPI_CRCLength; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Ethernet frame processing task. This task checks to see if a frame has been received, and if so hands off the processing of the frame to the Ethernet processing routines. */
void Ethernet_Task(void)
/* Ethernet frame processing task. This task checks to see if a frame has been received, and if so hands off the processing of the frame to the Ethernet processing routines. */ void Ethernet_Task(void)
{ if (USB_DeviceState != DEVICE_STATE_Configured) return; if (FrameIN.FrameLength) { LEDs_SetAllLEDs(LEDMASK_USB_BUSY); Ethernet_ProcessPacket(); LEDs_SetAllLEDs(LEDMASK_USB_READY); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* It allows us to boot all slots in order from the first one. This value should be used when the bootloader message is corrupted, but not when a valid message indicates that all slots are unbootable. */
static int ab_control_default(struct bootloader_control *abc)
/* It allows us to boot all slots in order from the first one. This value should be used when the bootloader message is corrupted, but not when a valid message indicates that all slots are unbootable. */ static int ab_control_default(struct bootloader_control *abc)
{ int i; const struct slot_metadata metadata = { .priority = 15, .tries_remaining = 7, .successful_boot = 0, .verity_corrupted = 0, .reserved = 0 }; if (!abc) return -EFAULT; memcpy(abc->slot_suffix, "a\0\0\0", 4); abc->magic = BOOT_CTRL_MAGIC; abc->version = BOOT_CTRL_VERSION; abc->nb_slot = NUM_SL...
4ms/stm32mp1-baremetal
C++
Other
137
/* Notice that lwIP implements a function with a similar name, sys_sem_wait(), that uses the sys_arch_sem_wait() function. */
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
/* Notice that lwIP implements a function with a similar name, sys_sem_wait(), that uses the sys_arch_sem_wait() function. */ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
{ u32_t begin_ms, end_ms, elapsed_ms; u32_t ret; if (sem == NULL) return SYS_ARCH_TIMEOUT; begin_ms = sys_now(); if( timeout != 0UL ) { ret = aos_sem_wait(sem,timeout); if(ret == 0) { end_ms = sys_now(); elapsed_ms = end_ms - begin_ms; ret ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_get_connection_unix_user(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint uid)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_get_connection_unix_user(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint uid)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", uid)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* hashes a mac address Used by the hash table to search and remove entries based solely on their keys (mac addresses). */
UINT32 ixEthDBKeyXORHash(void *key)
/* hashes a mac address Used by the hash table to search and remove entries based solely on their keys (mac addresses). */ UINT32 ixEthDBKeyXORHash(void *key)
{ UINT32 hashValue; UINT8 *value = (UINT8 *) key; hashValue = (value[5] << 8) | value[4]; hashValue ^= (value[3] << 8) | value[2]; hashValue ^= (value[1] << 8) | value[0]; return hashValue; }
EmcraftSystems/u-boot
C++
Other
181
/* Attribute read call back for the Descriptor V5D4 (128-bit UUID) attribute. */
static ssize_t read_des_v5d4__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Descriptor V5D4 (128-bit UUID) attribute. */ static ssize_t read_des_v5d4__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(des_v5d4__128_bit_uuid_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function validates the ID Mapping array offset for the ITS node. */
STATIC VOID EFIAPI ValidateItsIdArrayReference(IN UINT8 *Ptr, IN VOID *Context)
/* This function validates the ID Mapping array offset for the ITS node. */ STATIC VOID EFIAPI ValidateItsIdArrayReference(IN UINT8 *Ptr, IN VOID *Context)
{ if (*(UINT32 *)Ptr != 0) { IncrementErrorCount (); Print (L"\nERROR: IORT ID Mapping offset must be zero."); } }
tianocore/edk2
C++
Other
4,240
/* Called by macro WATCHDOG_RESET Get timebase clock frequency */
unsigned long get_tbclk(void)
/* Called by macro WATCHDOG_RESET Get timebase clock frequency */ unsigned long get_tbclk(void)
{ volatile immap_t *immr = (volatile immap_t *) CONFIG_SYS_IMMR; ulong oscclk, factor; if (immr->im_clkrst.car_sccr & SCCR_TBS) { return (gd->cpu_clk / 16); } factor = (((CONFIG_SYS_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1; oscclk = gd->cpu_clk / factor; if ((immr->im_clkrst.car_sccr & SCCR_RTSEL) == 0...
EmcraftSystems/u-boot
C++
Other
181
/* tower_abort_transfers aborts transfers and frees associated data structures */
static void tower_abort_transfers(struct lego_usb_tower *dev)
/* tower_abort_transfers aborts transfers and frees associated data structures */ static void tower_abort_transfers(struct lego_usb_tower *dev)
{ dbg(2, "%s: enter", __func__); if (dev == NULL) { dbg(1, "%s: dev is null", __func__); goto exit; } if (dev->interrupt_in_running) { dev->interrupt_in_running = 0; mb(); if (dev->udev) usb_kill_urb (dev->interrupt_in_urb); } if (dev->interrupt_out_busy && dev->udev) usb_kill_urb(dev->interrupt_ou...
robutest/uclinux
C++
GPL-2.0
60
/* Set the VIS_RANGE bit of the optical sensor Si114x. */
int Si114x_EnableVisRange(int vis_range_bit)
/* Set the VIS_RANGE bit of the optical sensor Si114x. */ int Si114x_EnableVisRange(int vis_range_bit)
{ s16 retval = 0; if( vis_range_bit == 1 ) retval += Si114xParamSet(si114x_handle, PARAM_ALSVIS_ADC_MISC, RANGE_EN); else retval += Si114xParamSet(si114x_handle, PARAM_ALSVIS_ADC_MISC, 0); return retval; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Called from functions that handle requests; functions that do work on behalf of mountd are passed a single client name to use, and should use exp_get_by_name() or exp_find(). */
struct svc_export* rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
/* Called from functions that handle requests; functions that do work on behalf of mountd are passed a single client name to use, and should use exp_get_by_name() or exp_find(). */ struct svc_export* rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
{ struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT); if (rqstp->rq_client == NULL) goto gss; exp = exp_get_by_name(rqstp->rq_client, path, &rqstp->rq_chandle); if (PTR_ERR(exp) == -ENOENT) goto gss; if (IS_ERR(exp)) return exp; if (exp->ex_nflavors > 0) return exp; gss: if (rqstp->rq_gssclient == NULL) ...
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables tim peripheral Preload register on ARR. */
void TIM_ARRPreloadConfig(TIM_TypeDef *tim, FunctionalState state)
/* Enables or disables tim peripheral Preload register on ARR. */ void TIM_ARRPreloadConfig(TIM_TypeDef *tim, FunctionalState state)
{ (state) ? SET_BIT(tim->CR1, TIM_CR1_ARPEN) : CLEAR_BIT(tim->CR1, TIM_CR1_ARPEN); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wait for User push-button press to start transfer. */
void WaitForUserButtonPress(void)
/* Wait for User push-button press to start transfer. */ void WaitForUserButtonPress(void)
{ while (ubButtonPress == 0) { LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN); LL_mDelay(LED_BLINK_FAST); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* param base USDHC peripheral base address. param handle USDHC handle pointer. param callback Structure pointer to contain all callback functions. param userData Callback function parameter. */
void USDHC_TransferCreateHandle(USDHC_Type *base, usdhc_handle_t *handle, const usdhc_transfer_callback_t *callback, void *userData)
/* param base USDHC peripheral base address. param handle USDHC handle pointer. param callback Structure pointer to contain all callback functions. param userData Callback function parameter. */ void USDHC_TransferCreateHandle(USDHC_Type *base, usdhc_handle_t *handle, const usdhc_transfer_callback_t *callback, void *u...
{ assert(handle); assert(callback); memset(handle, 0, sizeof(*handle)); handle->callback.CardInserted = callback->CardInserted; handle->callback.CardRemoved = callback->CardRemoved; handle->callback.SdioInterrupt = callback->SdioInterrupt; handle->callback.BlockGap = callback->BlockGap; ...
nanoframework/nf-interpreter
C++
MIT License
293
/* Checks if the SPI module is ready to write data. This function will check if the SPI module is ready to write data. */
static bool _spi_is_ready_to_write(Spi *const spi_module)
/* Checks if the SPI module is ready to write data. This function will check if the SPI module is ready to write data. */ static bool _spi_is_ready_to_write(Spi *const spi_module)
{ Assert(spi_module); return (spi_module->TRANSMIT_STATUS.bit.TX_FIFO_NOT_FULL); }
memfault/zero-to-main
C++
null
200
/* Initializes the device stack and load the class driver. */
void usb_dev_init(usb_core_instance *pdev, stc_usb_port_identify *pstcPortIdentify, usb_dev_desc_func *pdesc, usb_dev_class_func *class_cb, usb_dev_user_func *usr_cb)
/* Initializes the device stack and load the class driver. */ void usb_dev_init(usb_core_instance *pdev, stc_usb_port_identify *pstcPortIdentify, usb_dev_desc_func *pdesc, usb_dev_class_func *class_cb, usb_dev_user_func *usr_cb)
{ usb_bsp_init(pdev, pstcPortIdentify); pdev->dev.class_callback = class_cb; pdev->dev.user_callback = usr_cb; pdev->dev.desc_callback = pdesc; usb_initdev(pdev, pstcPortIdentify); pdev->dev.user_callback->user_init(); pdev->dev.device_state = USB_EP0_IDLE; usb_bsp_nvicconfig(pdev); ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the ADC window mode. Sets the ADC window mode to a given mode and value range. */
void adc_set_window_mode(struct adc_module *const module_inst, const enum adc_window_mode window_mode, const int16_t window_lower_value, const int16_t window_upper_value)
/* Sets the ADC window mode. Sets the ADC window mode to a given mode and value range. */ void adc_set_window_mode(struct adc_module *const module_inst, const enum adc_window_mode window_mode, const int16_t window_lower_value, const int16_t window_upper_value)
{ Assert(module_inst); Assert(module_inst->hw); Adc *const adc_module = module_inst->hw; while (adc_is_syncing(module_inst)) { } adc_module->WINCTRL.reg = window_mode << ADC_WINCTRL_WINMODE_Pos; while (adc_is_syncing(module_inst)) { } adc_module->WINLT.reg = window_lower_value << ADC_WINLT_WINLT_Pos; while (a...
memfault/zero-to-main
C++
null
200
/* Function for idle state entry actions. Function for idle state entry actions, which include resetting relevant state data and scheduling any possible queued flash access operation. */
static void state_idle_entry_run(void)
/* Function for idle state entry actions. Function for idle state entry actions, which include resetting relevant state data and scheduling any possible queued flash access operation. */ static void state_idle_entry_run(void)
{ m_num_of_command_retries = 0; m_num_of_bytes_written = 0; cmd_queue_dequeue(); }
labapart/polymcu
C++
null
201
/* Set up the line discipline objects for a newly allocated tty. Note that the tty structure is not completely set up when this call is made. */
void tty_ldisc_init(struct tty_struct *tty)
/* Set up the line discipline objects for a newly allocated tty. Note that the tty structure is not completely set up when this call is made. */ void tty_ldisc_init(struct tty_struct *tty)
{ struct tty_ldisc *ld = tty_ldisc_get(N_TTY); if (IS_ERR(ld)) panic("n_tty: init_tty"); tty_ldisc_assign(tty, ld); }
robutest/uclinux
C++
GPL-2.0
60
/* apply and load a particular input delay for the DQ pins in a group group_bgn is the index of the first dq pin (in the write group) */
static void scc_mgr_apply_group_dq_in_delay(struct socfpga_sdrseq *seq, u32 group_bgn, u32 delay)
/* apply and load a particular input delay for the DQ pins in a group group_bgn is the index of the first dq pin (in the write group) */ static void scc_mgr_apply_group_dq_in_delay(struct socfpga_sdrseq *seq, u32 group_bgn, u32 delay)
{ u32 i, p; for (i = 0, p = group_bgn; i < seq->rwcfg->mem_dq_per_read_dqs; i++, p++) { scc_mgr_set_dq_in_delay(p, delay); scc_mgr_load_dq(p); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* It is required to run memory_bm_position_reset() before the first call to this function. */
static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
/* It is required to run memory_bm_position_reset() before the first call to this function. */ static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
{ struct bm_block *bb; int bit; bb = bm->cur.block; do { bit = bm->cur.bit; bit = find_next_bit(bb->data, bm_block_bits(bb), bit); if (bit < bm_block_bits(bb)) goto Return_pfn; bb = list_entry(bb->hook.next, struct bm_block, hook); bm->cur.block = bb; bm->cur.bit = 0; } while (&bb->hook != &bm->bloc...
EmcraftSystems/linux-emcraft
C++
Other
266
/* The control element is supposed to have the private_value field set up via HDA_COMPOSE_AMP_VAL*() or related macros. */
int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
/* The control element is supposed to have the private_value field set up via HDA_COMPOSE_AMP_VAL*() or related macros. */ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); hda_nid_t nid = get_amp_nid(kcontrol); int chs = get_amp_channels(kcontrol); int dir = get_amp_direction(kcontrol); int idx = get_amp_index(kcontrol); unsigned int ofs = get_amp_offset(kcontrol); long *valp = ucontrol->value.integer.value; if (chs & 1) ...
robutest/uclinux
C++
GPL-2.0
60
/* Returns whether an ABORT_REQ_RSS message is a negative advice. */
static int is_neg_adv_abort(unsigned int status)
/* Returns whether an ABORT_REQ_RSS message is a negative advice. */ static int is_neg_adv_abort(unsigned int status)
{ return status == CPL_ERR_RTX_NEG_ADVICE || status == CPL_ERR_PERSIST_NEG_ADVICE; }
robutest/uclinux
C++
GPL-2.0
60
/* Record the aguments userspace sent to sys_capset for later printing by the audit system if applicable */
void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old)
/* Record the aguments userspace sent to sys_capset for later printing by the audit system if applicable */ void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old)
{ struct audit_context *context = current->audit_context; context->capset.pid = pid; context->capset.cap.effective = new->cap_effective; context->capset.cap.inheritable = new->cap_effective; context->capset.cap.permitted = new->cap_permitted; context->type = AUDIT_CAPSET; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Copy arg vector into a new buffer, concatenating arguments with spaces. */
static char* copy_argv(register char **argv)
/* Copy arg vector into a new buffer, concatenating arguments with spaces. */ static char* copy_argv(register char **argv)
{ register char **p; register u_int len = 0; char *buf; char *src, *dst; p = argv; if (*p == 0) return 0; while (*p) len += strlen(*p++) + 1; buf = (char *)malloc(len); if (buf == NULL) error("copy_argv: malloc"); p = argv; dst = buf; while ((src = *p++) != NULL) { while ((*dst++ = *src++) != '\0') ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Transmit-side routines. Called to do any work queued up on the transmit side that can now be done. */
static void ppp_xmit_process(struct ppp *ppp)
/* Transmit-side routines. Called to do any work queued up on the transmit side that can now be done. */ static void ppp_xmit_process(struct ppp *ppp)
{ struct sk_buff *skb; ppp_xmit_lock(ppp); if (!ppp->closing) { ppp_push(ppp); while (!ppp->xmit_pending && (skb = skb_dequeue(&ppp->file.xq))) ppp_send_frame(ppp, skb); if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) netif_wake_queue(ppp->dev); } ppp_xmit_unlock(ppp); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if this is a suitable place to put a breakpoint. */
static long check_bp_loc(unsigned long addr)
/* Check if this is a suitable place to put a breakpoint. */ static long check_bp_loc(unsigned long addr)
{ unsigned int instr; addr &= ~3; if (!is_kernel_addr(addr)) { printf("Breakpoints may only be placed at kernel addresses\n"); return 0; } if (!mread(addr, &instr, sizeof(instr))) { printf("Can't read instruction at address %lx\n", addr); return 0; } if (IS_MTMSRD(instr) || IS_RFID(instr)) { printf("Br...
EmcraftSystems/linux-emcraft
C++
Other
266
/* RETURN VALUES: largest binary buddy of free bits within a dmap word. */
static int dbMaxBud(u8 *cp)
/* RETURN VALUES: largest binary buddy of free bits within a dmap word. */ static int dbMaxBud(u8 *cp)
{ signed char tmp1, tmp2; if (*((uint *) cp) == 0) return (BUDMIN); if (*((u16 *) cp) == 0 || *((u16 *) cp + 1) == 0) return (BUDMIN - 1); tmp1 = max(budtab[cp[2]], budtab[cp[3]]); tmp2 = max(budtab[cp[0]], budtab[cp[1]]); return (max(tmp1, tmp2)); }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute read call back for the Value V5 attribute. */
static ssize_t read_value_v5(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Value V5 attribute. */ static ssize_t read_value_v5(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(value_v5_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function resets the device so that it has 0 rx queues, tx queues, and MSI-X interrupts allocated. */
static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
/* This function resets the device so that it has 0 rx queues, tx queues, and MSI-X interrupts allocated. */ static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
{ igb_free_queues(adapter); igb_free_q_vectors(adapter); igb_reset_interrupt_capability(adapter); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the DMA Current Byte Count of a channel. */
unsigned long DMARemainTransferCountGet(unsigned long ulChannelID)
/* Get the DMA Current Byte Count of a channel. */ unsigned long DMARemainTransferCountGet(unsigned long ulChannelID)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); return (xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DSR_BCR) & DMA_DSR_BCR_BCR_M); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The precision internal oscillator can be powered down in deep-sleep mode by specifying */
void SysCtlDeepSleepClockSet(uint32_t ui32Config)
/* The precision internal oscillator can be powered down in deep-sleep mode by specifying */ void SysCtlDeepSleepClockSet(uint32_t ui32Config)
{ HWREG(SYSCTL_DSLPCLKCFG) = ui32Config; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Convert a signed n-bit integer to signed 32-bit integer. Common cases are done through the compiler, the screwed things has to be done by hand. */
static s32 snto32(__u32 value, unsigned n)
/* Convert a signed n-bit integer to signed 32-bit integer. Common cases are done through the compiler, the screwed things has to be done by hand. */ static s32 snto32(__u32 value, unsigned n)
{ switch (n) { case 8: return ((__s8)value); case 16: return ((__s16)value); case 32: return ((__s32)value); } return value & (1 << (n - 1)) ? value | (-1 << n) : value; }
robutest/uclinux
C++
GPL-2.0
60
/* One DWord (32 bit) configuration read on PSII. Currently fixes destination PCI bus to PCI2, onboard pci. */
static int psII_read_config_dword(struct pci_controller *hose, pci_dev_t dev, int reg, u32 *val)
/* One DWord (32 bit) configuration read on PSII. Currently fixes destination PCI bus to PCI2, onboard pci. */ static int psII_read_config_dword(struct pci_controller *hose, pci_dev_t dev, int reg, u32 *val)
{ write4be (PSII_CONFIG_ADDR, PSII_CONFIG_DEST_PCI2 | (PCI_BUS (dev) << 16) | (PCI_DEV (dev) << 11) | (PCI_FUNC (dev) << 8) | ((reg & 0xFF) & ~3)); *val = read4 (PSII_CONFIG_DATA); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* Clear address list of a Neighbor Tuple and add Lost Neighbor Tuple for addresses no longer used by this neighbor */
static void clear_nb_addresses(nib_entry_t *nib_entry, timex_t *now)
/* Clear address list of a Neighbor Tuple and add Lost Neighbor Tuple for addresses no longer used by this neighbor */ static void clear_nb_addresses(nib_entry_t *nib_entry, timex_t *now)
{ nhdp_addr_entry_t *nib_elt, *nib_tmp; LL_FOREACH_SAFE(nib_entry->address_list_head, nib_elt, nib_tmp) { if (!NHDP_ADDR_TMP_IN_NB_LIST(nib_elt->address)) { nib_elt->address->in_tmp_table |= NHDP_ADDR_TMP_REM_LIST; nib_elt->address->usg_count++; if (nib_entry->symmetr...
labapart/polymcu
C++
null
201
/* Allocate and initialise an IO completion structure. We need to track unwritten extent write completion here initially. We'll need to extend this for updating the ondisk inode size later (vs. incore size). */
STATIC xfs_ioend_t* xfs_alloc_ioend(struct inode *inode, unsigned int type)
/* Allocate and initialise an IO completion structure. We need to track unwritten extent write completion here initially. We'll need to extend this for updating the ondisk inode size later (vs. incore size). */ STATIC xfs_ioend_t* xfs_alloc_ioend(struct inode *inode, unsigned int type)
{ xfs_ioend_t *ioend; ioend = mempool_alloc(xfs_ioend_pool, GFP_NOFS); atomic_set(&ioend->io_remaining, 1); ioend->io_error = 0; ioend->io_list = NULL; ioend->io_type = type; ioend->io_inode = inode; ioend->io_buffer_head = NULL; ioend->io_buffer_tail = NULL; atomic_inc(&XFS_I(ioend->io_inode)->i_iocount); ...
robutest/uclinux
C++
GPL-2.0
60
/* Obtains the item that is located one position before in the list, relative to the item given in the parameter. Note that the item is just read, not removed. */
void* TbxListGetPreviousItem(tTbxList const *list, void const *itemRef)
/* Obtains the item that is located one position before in the list, relative to the item given in the parameter. Note that the item is just read, not removed. */ void* TbxListGetPreviousItem(tTbxList const *list, void const *itemRef)
{ void * result = NULL; tTbxListNode const * listNodePtr; TBX_ASSERT(list != NULL); TBX_ASSERT(itemRef != NULL); if ( (list != NULL) && (itemRef != NULL) ) { TbxCriticalSectionEnter(); listNodePtr = TbxListFindListNode(list, itemRef); if (listNodePtr != NULL) { listNodePt...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Check if Receive interrupt is enabled @rmtoll IER RIE LL_SWPMI_IsEnabledIT_RX. */
uint32_t LL_SWPMI_IsEnabledIT_RX(SWPMI_TypeDef *SWPMIx)
/* Check if Receive interrupt is enabled @rmtoll IER RIE LL_SWPMI_IsEnabledIT_RX. */ uint32_t LL_SWPMI_IsEnabledIT_RX(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->IER, SWPMI_IER_RIE) == (SWPMI_IER_RIE)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */ void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
{ uint32_t tmpreg = 0; assert_param(IS_RCC_CALIBRATION_VALUE(HSICalibrationValue)); tmpreg = RCC->CR; tmpreg &= CR_HSITRIM_Mask; tmpreg |= (uint32_t)HSICalibrationValue << 3; RCC->CR = tmpreg; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { HID_Device_USBTask(&Mouse_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Switch tuner to other mode. If tuner support both tv and radio, set another frequency to some value (This is needed for some pal tuners to avoid locking). Otherwise, just put second tuner in standby mode. */
static int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
/* Switch tuner to other mode. If tuner support both tv and radio, set another frequency to some value (This is needed for some pal tuners to avoid locking). Otherwise, just put second tuner in standby mode. */ static int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
{ struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; if (mode == t->mode) return 0; t->mode = mode; if (check_mode(t, cmd) == -EINVAL) { tuner_dbg("Tuner doesn't support this mode. " "Putting tuner to sleep\n"); t->mode = T_STANDBY; if (analog_ops->standby) analog_ops->standby(&t->fe); r...
robutest/uclinux
C++
GPL-2.0
60
/* this function will be called when dma transferring is completed or error happened */
static void dma_handler(sedi_dma_t dma_device, int channel, int event_id, void *args)
/* this function will be called when dma transferring is completed or error happened */ static void dma_handler(sedi_dma_t dma_device, int channel, int event_id, void *args)
{ ARG_UNUSED(args); const struct device *dev = (const struct device *)args; struct dma_sedi_driver_data *const data = DEV_DATA(dev); struct dma_config *config = &(data->dma_configs[channel]); if (config->dma_callback) { if ((event_id == SEDI_DMA_EVENT_TRANSFER_DONE) && (config->complete_callback_en)) { ...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Read humidity from the daughter board's on-board T&RH sensor. */
void CN0429_RdHum(uint8_t *args)
/* Read humidity from the daughter board's on-board T&RH sensor. */ void CN0429_RdHum(uint8_t *args)
{ int16_t humidity = 0; eSensorResult = pGasSensor->open(uiDefaultAddress); flushBuff(TXbuff, sizeof(TXbuff)); eSensorResult = pGasSensor->ReadHumidity(&humidity); if (eSensorResult != SENSOR_ERROR_NONE) { UART_TX("ERROR!" _EOS); } else { snprintf((char*) TXbuff, 256, "Humidity = %2.1f %%RH%s", (humidity /...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Fast approximation to the trigonometric sine function for Q15 data. */
q15_t arm_sin_q15(q15_t x)
/* Fast approximation to the trigonometric sine function for Q15 data. */ q15_t arm_sin_q15(q15_t x)
{ q15_t sinVal; int32_t index; q15_t a, b; q15_t fract; index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; a = sinTable_q15[index]; b = sinTable_q15[index+1]; sinVal = (q31_t) (0x8000 - fract) * a >> 16; sinVal = (q15_t) ((((q31_t) sinVal << 16) + ((q31_t)...
pikasTech/PikaPython
C++
MIT License
1,403
/* Starts the low level portion of the device driver. */
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
/* Starts the low level portion of the device driver. */ USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_Start(pdev->pData); usb_status = USBD_Get_USB_Status(hal_status); return usb_status; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Check memory executing write/read/verify of many data patterns at the specified address. Bits in the result indicate failure on specific byte lane. */
uint32_t check_bls_ex(struct mrc_params *mrc_params, uint32_t address)
/* Check memory executing write/read/verify of many data patterns at the specified address. Bits in the result indicate failure on specific byte lane. */ uint32_t check_bls_ex(struct mrc_params *mrc_params, uint32_t address)
{ uint32_t result; uint8_t first_run = 0; if (mrc_params->hte_setup) { mrc_params->hte_setup = 0; first_run = 1; select_hte(); } result = hte_write_stress_bit_lanes(mrc_params, address, first_run); DPF(D_TRN, "check_bls_ex result is %x\n", result); return result; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns the link containing the data or NULL */
static xmlLinkPtr xmlListLinkSearch(xmlListPtr l, void *data)
/* Returns the link containing the data or NULL */ static xmlLinkPtr xmlListLinkSearch(xmlListPtr l, void *data)
{ xmlLinkPtr lk; if (l == NULL) return(NULL); lk = xmlListLowerSearch(l, data); if (lk == l->sentinel) return NULL; else { if (l->linkCompare(lk->data, data) ==0) return lk; return NULL; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Allocate a writecombining region, in much the same way as dma_alloc_coherent above. */
void* dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
/* Allocate a writecombining region, in much the same way as dma_alloc_coherent above. */ void* dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
{ return __dma_alloc(dev, size, handle, gfp, pgprot_writecombine(pgprot_kernel)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Converts a text device path node to SCSI device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextScsi(CHAR16 *TextDeviceNode)
/* Converts a text device path node to SCSI device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextScsi(CHAR16 *TextDeviceNode)
{ CHAR16 *PunStr; CHAR16 *LunStr; SCSI_DEVICE_PATH *Scsi; PunStr = GetNextParamStr (&TextDeviceNode); LunStr = GetNextParamStr (&TextDeviceNode); Scsi = (SCSI_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, ...
tianocore/edk2
C++
Other
4,240