docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
ulong get_tbclk(void)
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */ ulong get_tbclk(void)
{ return mxc_get_clock(MXC_IPG_CLK); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Virtual: read_nonblocking Returns: the number of bytes read, or -1 on error (including G_IO_ERROR_WOULD_BLOCK). */
gssize g_pollable_input_stream_read_nonblocking(GPollableInputStream *stream, void *buffer, gsize count, GCancellable *cancellable, GError **error)
/* Virtual: read_nonblocking Returns: the number of bytes read, or -1 on error (including G_IO_ERROR_WOULD_BLOCK). */ gssize g_pollable_input_stream_read_nonblocking(GPollableInputStream *stream, void *buffer, gsize count, GCancellable *cancellable, GError **error)
{ gssize res; g_return_val_if_fail (G_IS_POLLABLE_INPUT_STREAM (stream), -1); g_return_val_if_fail (buffer != NULL, 0); if (g_cancellable_set_error_if_cancelled (cancellable, error)) return -1; if (count == 0) return 0; if (((gssize) count) < 0) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to %s"), G_STRFUNC); return -1; } if (cancellable) g_cancellable_push_current (cancellable); res = G_POLLABLE_INPUT_STREAM_GET_INTERFACE (stream)-> read_nonblocking (stream, buffer, count, error); if (cancellable) g_cancellable_pop_current (cancellable); return res; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is ISR for inputcapture interrupt. level: RT_TRUE denotes high level pulse, and RT_FALSE denotes low level pulse. */
void rt_hw_inputcapture_isr(struct rt_inputcapture_device *inputcapture, rt_bool_t level)
/* This function is ISR for inputcapture interrupt. level: RT_TRUE denotes high level pulse, and RT_FALSE denotes low level pulse. */ void rt_hw_inputcapture_isr(struct rt_inputcapture_device *inputcapture, rt_bool_t level)
{ struct rt_inputcapture_data data; rt_size_t receive_size; if (inputcapture->ops->get_pulsewidth(inputcapture, &data.pulsewidth_us) != RT_EOK) { return; } data.is_high = level; if (rt_ringbuffer_put(inputcapture->ringbuff, (rt_uint8_t *)&data, sizeof(struct rt_inputcapture_data)) == 0) { LOG_W("inputcapture ringbuffer doesn't have enough space."); } receive_size = rt_ringbuffer_data_len(inputcapture->ringbuff) / sizeof(struct rt_inputcapture_data); if (receive_size >= inputcapture->watermark) { if (inputcapture->parent.rx_indicate != RT_NULL) inputcapture->parent.rx_indicate(&inputcapture->parent, receive_size); } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Encodes the message length according to the MQTT algorithm */
int mqtt_packet_encode(unsigned char *buf, int length)
/* Encodes the message length according to the MQTT algorithm */ int mqtt_packet_encode(unsigned char *buf, int length)
{ int rc = 0; FUNC_ENTRY; do { char d = length % 128; length /= 128; if (length > 0) d |= 0x80; buf[rc++] = d; } while (length > 0); FUNC_EXIT_RC(rc); return rc; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Determines if the hardware module(s) are currently synchronizing to the bus. Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready, to prevent blocking delays for synchronization in the user application. */
static bool extint_is_syncing(void)
/* Determines if the hardware module(s) are currently synchronizing to the bus. Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready, to prevent blocking delays for synchronization in the user application. */ static bool extint_is_syncing(void)
{ Eic *const eics[EIC_INST_NUM] = EIC_INSTS; for (uint32_t i = 0; i < EIC_INST_NUM; i++) { if (eics[i]->STATUS.reg & EIC_STATUS_SYNCBUSY) { return true; } } return false; }
memfault/zero-to-main
C++
null
200
/* Send an Error Message to the TFTP Server. */
static int send_err(int sock, struct tftpc *client, int err_code, char *err_msg)
/* Send an Error Message to the TFTP Server. */ static int send_err(int sock, struct tftpc *client, int err_code, char *err_msg)
{ uint32_t req_size; LOG_DBG("Client sending error code: %d", err_code); sys_put_be16(ERROR_OPCODE, client->tftp_buf); sys_put_be16(err_code, client->tftp_buf + 2); req_size = 4; if (err_msg != NULL) { size_t copy_len = strlen(err_msg); if (copy_len > sizeof(client->tftp_buf) - req_size) { copy_len = sizeof(client->tftp_buf) - req_size; } memcpy(client->tftp_buf + req_size, err_msg, copy_len); req_size += copy_len; } return send(sock, client->tftp_buf, req_size, 0); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* returns the content of the specified SMMIO register. */
static u32 spider_net_read_reg(struct spider_net_card *card, u32 reg)
/* returns the content of the specified SMMIO register. */ static u32 spider_net_read_reg(struct spider_net_card *card, u32 reg)
{ return in_be32(card->regs + reg); }
robutest/uclinux
C++
GPL-2.0
60
/* We set the PCIE flag because the lower bandwidth on PCIe vs HyperTransport can affect some user packet algorithims. */
static int ipath_7220_get_base_info(struct ipath_portdata *pd, void *kbase)
/* We set the PCIE flag because the lower bandwidth on PCIe vs HyperTransport can affect some user packet algorithims. */ static int ipath_7220_get_base_info(struct ipath_portdata *pd, void *kbase)
{ struct ipath_base_info *kinfo = kbase; kinfo->spi_runtime_flags |= IPATH_RUNTIME_PCIE | IPATH_RUNTIME_NODMA_RTAIL | IPATH_RUNTIME_SDMA; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* So, we only need to register outer cache operations here if we're being used on a pre-v7 CPU, and we only need to build support for outer cache operations into the kernel image if the kernel has been configured to support a pre-v7 CPU. Low-level cache maintenance operations. */
static void tauros2_clean_pa(unsigned long addr)
/* So, we only need to register outer cache operations here if we're being used on a pre-v7 CPU, and we only need to build support for outer cache operations into the kernel image if the kernel has been configured to support a pre-v7 CPU. Low-level cache maintenance operations. */ static void tauros2_clean_pa(unsigned long addr)
{ __asm__("mcr p15, 1, %0, c7, c11, 3" : : "r" (addr)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns pointer to the next descriptor for the pack of USB descriptors located in continues memory segment */
BOOLEAN NextDescriptor(IN EFI_USB_CONFIG_DESCRIPTOR *Desc, IN OUT UINTN *Offset)
/* Returns pointer to the next descriptor for the pack of USB descriptors located in continues memory segment */ BOOLEAN NextDescriptor(IN EFI_USB_CONFIG_DESCRIPTOR *Desc, IN OUT UINTN *Offset)
{ if ((Desc == NULL) || (*Offset >= Desc->TotalLength)) { return FALSE; } if (((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))->Length == 0) { return FALSE; } *Offset += ((EFI_USB_CONFIG_DESCRIPTOR *)((char *)Desc+*Offset))->Length; if ( *Offset >= Desc->TotalLength ) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Checks that all the demo application tasks are still executing without error */
static long prvCheckOtherTasksAreStillRunning(void)
/* Checks that all the demo application tasks are still executing without error */ static long prvCheckOtherTasksAreStillRunning(void)
{ long lReturn = ( long ) pdPASS; if( xArePollingQueuesStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { lReturn = ( long ) pdFAIL; } return lReturn; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Checks whether the specified EXTI line is asserted or not. */
ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
/* Checks whether the specified EXTI line is asserted or not. */ ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
{ ITStatus bitstatus = RESET; assert_param(IS_GET_EXTI_LINE(EXTI_Line)); if ((EXTI->PR & EXTI_Line) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Mistreating the watchdog is the only way to perform a software reset of the system on EMP platforms. So we implement this and export a symbol for it. */
void coh901327_watchdog_reset(void)
/* Mistreating the watchdog is the only way to perform a software reset of the system on EMP platforms. So we implement this and export a symbol for it. */ void coh901327_watchdog_reset(void)
{ writew(U300_WDOG_JOR_JTAG_WATCHDOG_ENABLE, virtbase + U300_WDOG_JOR); coh901327_enable(500); }
robutest/uclinux
C++
GPL-2.0
60
/* This function also needs to know which DMA device this transfer will be destined for, so that the appropriate DMA configuration can be retrieved. DMA parameters such as transfer width, and whether this is a memory-to-memory or memory-to-peripheral, etc can all affect the actual number of descriptors required. */
int dma_calculate_descriptor_count(DMA_Device_t device, dma_addr_t srcData, dma_addr_t dstData, size_t numBytes)
/* This function also needs to know which DMA device this transfer will be destined for, so that the appropriate DMA configuration can be retrieved. DMA parameters such as transfer width, and whether this is a memory-to-memory or memory-to-peripheral, etc can all affect the actual number of descriptors required. */ int dma_calculate_descriptor_count(DMA_Device_t device, dma_addr_t srcData, dma_addr_t dstData, size_t numBytes)
{ int numDescriptors; DMA_DeviceAttribute_t *devAttr; if (!IsDeviceValid(device)) { return -ENODEV; } devAttr = &DMA_gDeviceAttribute[device]; numDescriptors = dmacHw_calculateDescriptorCount(&devAttr->config, (void *)srcData, (void *)dstData, numBytes); if (numDescriptors < 0) { printk(KERN_ERR "dma_calculate_descriptor_count: dmacHw_calculateDescriptorCount failed\n"); return -EINVAL; } return numDescriptors; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Used for emergencies. Currently only used if an HPMC occurs. If an HPMC occurs, it is possible that the current console may not be properly initialised after the PDC IO reset. This routine unregisters all of the current consoles, reinitializes the pdc console and registers it. */
void pdc_console_restart(void)
/* Used for emergencies. Currently only used if an HPMC occurs. If an HPMC occurs, it is possible that the current console may not be properly initialised after the PDC IO reset. This routine unregisters all of the current consoles, reinitializes the pdc console and registers it. */ void pdc_console_restart(void)
{ struct console *console; if (pdc_console_initialized) return; if (console_drivers != NULL) pdc_cons.flags &= ~CON_PRINTBUFFER; while ((console = console_drivers) != NULL) unregister_console(console_drivers); pdc_console_init_force(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get AON Sleep Timer module instance current value. */
uint32_t aon_sleep_timer_get_current_value(void)
/* Get AON Sleep Timer module instance current value. */ uint32_t aon_sleep_timer_get_current_value(void)
{ return AON_SLEEP_TIMER0->CURRENT_COUNT_VALUE.reg; }
memfault/zero-to-main
C++
null
200
/* Flushes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Flushes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_Flush(pdev->pData, ep_addr); return USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* All pwm signals generated from the same ctimer must have same period. To avoid this, we check if the new parameters will NOT change the period for a ctimer with active pulse channels */
static bool mcux_ctimer_pwm_is_period_valid(struct pwm_mcux_ctimer_data *data, uint32_t new_pulse_channel, uint32_t new_period_cycles, uint32_t current_period_channel)
/* All pwm signals generated from the same ctimer must have same period. To avoid this, we check if the new parameters will NOT change the period for a ctimer with active pulse channels */ static bool mcux_ctimer_pwm_is_period_valid(struct pwm_mcux_ctimer_data *data, uint32_t new_pulse_channel, uint32_t new_period_cycles, uint32_t current_period_channel)
{ if (data->channel_states[current_period_channel].cycles == new_period_cycles) { return true; } if (data->num_active_pulse_chans == 0) { return true; } if (data->num_active_pulse_chans > 1) { return false; } if (data->channel_states[new_pulse_channel].role != PWM_CTIMER_CHANNEL_ROLE_PULSE) { return false; } return true; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* ADC MSP initialization This function configures the hardware resources used in this example: */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP initialization This function configures the hardware resources used in this example: */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct; ADCx_CHANNELa_GPIO_CLK_ENABLE(); ADCx_CLK_ENABLE(); GPIO_InitStruct.Pin = ADCx_CHANNELa_PIN; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(ADCx_CHANNELa_GPIO_PORT, &GPIO_InitStruct); HAL_NVIC_SetPriority(ADCx_IRQn, 0, 0); HAL_NVIC_EnableIRQ(ADCx_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Given a wmem scope, a pointer, and a length, and a translation table, treat the string of bytes referred to by the pointer and length as a string encoded in EBCDIC using one octet per character, and return a pointer to a UTF-8 string, allocated using the wmem scope. */
guint8* get_ebcdic_string(wmem_allocator_t *scope, const guint8 *ptr, gint length)
/* Given a wmem scope, a pointer, and a length, and a translation table, treat the string of bytes referred to by the pointer and length as a string encoded in EBCDIC using one octet per character, and return a pointer to a UTF-8 string, allocated using the wmem scope. */ guint8* get_ebcdic_string(wmem_allocator_t *scope, const guint8 *ptr, gint length)
{ wmem_strbuf_t *str; str = wmem_strbuf_sized_new(scope, length+1, 0); while (length > 0) { guint8 ch = *ptr; wmem_strbuf_append_unichar(str, EBCDIC_translate_ASCII[ch]); ptr++; length--; } return (guint8 *) wmem_strbuf_finalize(str); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If module is marked as SWSUP_SIDLE, force the module into slave idle; otherwise, configure it for smart-idle. If module is marked as SWSUP_MSUSPEND, force the module into master standby; otherwise, configure it for smart-standby. No return value. */
static void _sysc_idle(struct omap_hwmod *oh)
/* If module is marked as SWSUP_SIDLE, force the module into slave idle; otherwise, configure it for smart-idle. If module is marked as SWSUP_MSUSPEND, force the module into master standby; otherwise, configure it for smart-standby. No return value. */ static void _sysc_idle(struct omap_hwmod *oh)
{ u8 idlemode; u32 v; if (!oh->sysconfig) return; v = oh->_sysc_cache; if (oh->sysconfig->sysc_flags & SYSC_HAS_SIDLEMODE) { idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ? HWMOD_IDLEMODE_FORCE : HWMOD_IDLEMODE_SMART; _set_slave_idlemode(oh, idlemode, &v); } if (oh->sysconfig->sysc_flags & SYSC_HAS_MIDLEMODE) { idlemode = (oh->flags & HWMOD_SWSUP_MSTANDBY) ? HWMOD_IDLEMODE_FORCE : HWMOD_IDLEMODE_SMART; _set_master_standbymode(oh, idlemode, &v); } _write_sysconfig(v, oh); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* We don't need to re-check for the cgroup/cpuset membership, since we're holding cgroup_lock() at this point. */
static void cpuset_change_cpumask(struct task_struct *tsk, struct cgroup_scanner *scan)
/* We don't need to re-check for the cgroup/cpuset membership, since we're holding cgroup_lock() at this point. */ static void cpuset_change_cpumask(struct task_struct *tsk, struct cgroup_scanner *scan)
{ set_cpus_allowed_ptr(tsk, ((cgroup_cs(scan->cg))->cpus_allowed)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the size in pixel of the LCD display. */
void LCD_SetSize(unsigned int width, unsigned int height)
/* Sets the size in pixel of the LCD display. */ void LCD_SetSize(unsigned int width, unsigned int height)
{ ASSERT(((width - 1) & 0xFFFFF800) == 0, "LCD_SetSize: Wrong width value.\n\r"); ASSERT(((height - 1) & 0xFFFFF800) == 0, "LCD_SetSize: Wrong height value.\n\r"); AT91C_BASE_LCDC->LCDC_LCDFRCFG = ((width - 1) << 21) | (height - 1); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables gyroscope digital high-pass filter. The filter is enabled only if the gyro is in HP mode.. */
int32_t lsm6dso_gy_hp_path_internal_set(stmdev_ctx_t *ctx, lsm6dso_hpm_g_t val)
/* Enables gyroscope digital high-pass filter. The filter is enabled only if the gyro is in HP mode.. */ int32_t lsm6dso_gy_hp_path_internal_set(stmdev_ctx_t *ctx, lsm6dso_hpm_g_t val)
{ lsm6dso_ctrl7_g_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t *)&reg, 1); if (ret == 0) { reg.hp_en_g = ((uint8_t)val & 0x80U) >> 7; reg.hpm_g = (uint8_t)val & 0x03U; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Message: FeatureStatMessage Opcode: 0x011f Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_FeatureStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: FeatureStatMessage Opcode: 0x011f Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ static void handle_FeatureStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_featureIndex, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_featureID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_featureTextLabel, 40, ENC_ASCII|ENC_NA); ptvcursor_add(cursor, hf_skinny_featureStatus, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciCf8BitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciCf8BitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
{ BOOLEAN InterruptState; UINT32 AddressPort; UINT8 Result; ASSERT_INVALID_PCI_ADDRESS (Address, 0); InterruptState = SaveAndDisableInterrupts (); AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); Result = IoBitFieldOr8 ( PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3), StartBit, EndBit, OrData ); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); SetInterruptState (InterruptState); return Result; }
tianocore/edk2
C++
Other
4,240
/* Calculate the quotient and the remainder of an integer division. */
uint64_t do_div(uint64_t *n, uint64_t base)
/* Calculate the quotient and the remainder of an integer division. */ uint64_t do_div(uint64_t *n, uint64_t base)
{ uint64_t mod = 0; mod = *n % base; *n = *n / base; return mod; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Replacing the cpuid so we can turn features off is great for the kernel, but anyone (including userspace) can just use the raw "cpuid" instruction and the Host won't even notice since it isn't privileged. So we try not to get too worked up about it. */
static void lguest_cpuid(unsigned int *ax, unsigned int *bx, unsigned int *cx, unsigned int *dx)
/* Replacing the cpuid so we can turn features off is great for the kernel, but anyone (including userspace) can just use the raw "cpuid" instruction and the Host won't even notice since it isn't privileged. So we try not to get too worked up about it. */ static void lguest_cpuid(unsigned int *ax, unsigned int *bx, unsigned int *cx, unsigned int *dx)
{ int function = *ax; native_cpuid(ax, bx, cx, dx); switch (function) { case 0: if (*ax > 5) *ax = 5; break; case 1: *cx &= 0x00002201; *dx &= 0x07808151; *dx |= 0x00002000; *ax &= 0xFFFFF0FF; *ax |= 0x00000500; break; case 0x80000000: if (*ax > 0x80000008) *ax = 0x80000008; break; case 0x80000001: *dx &= ~(1 << 20); break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi)
/* Return: 0 on success or a negative error code on failure. */ int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi)
{ struct mipi_dsi_msg msg = { .channel = dsi->channel, .type = MIPI_DSI_TURN_ON_PERIPHERAL, .tx_buf = (u8 [2]) { 0, 0 }, .tx_len = 2, }; int ret = mipi_dsi_device_transfer(dsi, &msg); return (ret < 0) ? ret : 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* 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 GPIOPinTypeI2CSCL(unsigned long ulPort, unsigned char ucPins)
/* 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 GPIOPinTypeI2CSCL(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW); if(CLASS_IS_SANDSTORM || CLASS_IS_FURY || CLASS_IS_DUSTDEVIL || CLASS_IS_TEMPEST || CLASS_IS_FIRESTORM) { GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD); } else { GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Add a usb device path into the DEVICE_PATH_LIST_ITEM list. */
EFI_STATUS EFIAPI AddUsbDPToList(IN EFI_DEVICE_PATH_PROTOCOL *UsbDP, IN LIST_ENTRY *UsbIoDPList)
/* Add a usb device path into the DEVICE_PATH_LIST_ITEM list. */ EFI_STATUS EFIAPI AddUsbDPToList(IN EFI_DEVICE_PATH_PROTOCOL *UsbDP, IN LIST_ENTRY *UsbIoDPList)
{ DEVICE_PATH_LIST_ITEM *ListItem; if ((UsbIoDPList == NULL) || (UsbDP == NULL)) { return EFI_INVALID_PARAMETER; } if (SearchUsbDPInList (UsbDP, UsbIoDPList)) { return EFI_SUCCESS; } ListItem = AllocateZeroPool (sizeof (DEVICE_PATH_LIST_ITEM)); ASSERT (ListItem != NULL); ListItem->Signature = DEVICE_PATH_LIST_ITEM_SIGNATURE; ListItem->DevicePath = DuplicateDevicePath (UsbDP); InsertTailList (UsbIoDPList, &ListItem->Link); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* ADC Set Resolution. ADC Resolution can be reduced from 12 bits to 10, 8 or 6 bits for a corresponding reduction in conversion time (resolution + 3 ADC clock cycles). */
void adc_set_resolution(uint32_t adc, uint32_t resolution)
/* ADC Set Resolution. ADC Resolution can be reduced from 12 bits to 10, 8 or 6 bits for a corresponding reduction in conversion time (resolution + 3 ADC clock cycles). */ void adc_set_resolution(uint32_t adc, uint32_t resolution)
{ uint32_t reg32 = ADC_CR1(adc); reg32 &= ~ADC_CR1_RES_MASK; reg32 |= resolution; ADC_CR1(adc) = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Return protocol attributes from SCP for a given protocol ID. */
EFI_STATUS ScmiGetProtocolAttributes(IN SCMI_PROTOCOL_ID ProtocolId, OUT UINT32 **ReturnValues)
/* Return protocol attributes from SCP for a given protocol ID. */ EFI_STATUS ScmiGetProtocolAttributes(IN SCMI_PROTOCOL_ID ProtocolId, OUT UINT32 **ReturnValues)
{ return ScmiProtocolDiscoveryCommon ( ProtocolId, ScmiMessageIdProtocolAttributes, ReturnValues ); }
tianocore/edk2
C++
Other
4,240
/* beiscsi_get_host_param - get the iscsi parameter @shost: pointer to scsi_host structure */
int beiscsi_get_host_param(struct Scsi_Host *shost, enum iscsi_host_param param, char *buf)
/* beiscsi_get_host_param - get the iscsi parameter @shost: pointer to scsi_host structure */ int beiscsi_get_host_param(struct Scsi_Host *shost, enum iscsi_host_param param, char *buf)
{ struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost); int len = 0; switch (param) { case ISCSI_HOST_PARAM_HWADDRESS: be_cmd_get_mac_addr(phba, phba->mac_address); len = sysfs_format_mac(buf, phba->mac_address, ETH_ALEN); break; default: return iscsi_host_get_param(shost, param, buf); } return len; }
robutest/uclinux
C++
GPL-2.0
60
/* Subtracts t1 from t2 and assigns the difference (positive or negative) to timespan. */
err_t timespanDifference(timespan_t *t1, timespan_t *t2, timespan_t *timespan)
/* Subtracts t1 from t2 and assigns the difference (positive or negative) to timespan. */ err_t timespanDifference(timespan_t *t1, timespan_t *t2, timespan_t *timespan)
{ if ((t1 == NULL) || (t2 == NULL) || (timespan == NULL)) { return ERROR_INVALIDPARAMETER; } return timespanCreate(t2->__ticks - t1->__ticks, timespan); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Toggle level of a group of Pins. Toggle one or more pins of the givent port. */
void gpio_toggle(uint32_t gpioport, uint32_t gpios)
/* Toggle level of a group of Pins. Toggle one or more pins of the givent port. */ void gpio_toggle(uint32_t gpioport, uint32_t gpios)
{ PORT_OUTTGL(gpioport) = gpios; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* We're currently switching the port group to be activated only and let the array figure out the rest. There may be other arrays which require us to switch all port groups based on a certain policy. But until we actually encounter them it should be okay. */
static int alua_activate(struct scsi_device *sdev, activate_complete fn, void *data)
/* We're currently switching the port group to be activated only and let the array figure out the rest. There may be other arrays which require us to switch all port groups based on a certain policy. But until we actually encounter them it should be okay. */ static int alua_activate(struct scsi_device *sdev, activate_complete fn, void *data)
{ struct alua_dh_data *h = get_alua_data(sdev); int err = SCSI_DH_OK; if (h->group_id != -1) { err = alua_rtpg(sdev, h); if (err != SCSI_DH_OK) goto out; } if (h->tpgs & TPGS_MODE_EXPLICIT && h->state != TPGS_STATE_OPTIMIZED) { h->callback_fn = fn; h->callback_data = data; err = submit_stpg(h); if (err == SCSI_DH_OK) return 0; h->callback_fn = h->callback_data = NULL; } out: if (fn) fn(data, err); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clears a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Clears a Stall condition on an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Send a master data receive request when the master have obtained control of the bus.(Write Step2) For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterReadRequestS2(unsigned long ulBase, xtBoolean bEndTransmition)
/* Send a master data receive request when the master have obtained control of the bus.(Write Step2) For this function returns immediately, it is always using in the interrupt hander. */ void xI2CMasterReadRequestS2(unsigned long ulBase, xtBoolean bEndTransmition)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); if(bEndTransmition) { xHWREG(ulBase + I2C_O_CON) &= ~I2C_CON_AA; I2CStopSend(ulBase); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* PC300 TTY reset var routine This routine is called by pc300driver to init the TTY area. */
void cpc_tty_reset_var(void)
/* PC300 TTY reset var routine This routine is called by pc300driver to init the TTY area. */ void cpc_tty_reset_var(void)
{ int i ; CPC_TTY_DBG("hdlcX-tty: reset variables\n"); memset(&serial_drv, 0, sizeof(struct tty_driver)); for (i=0; i < CPC_TTY_NPORTS; i++){ memset(&cpc_tty_area[i],0, sizeof(st_cpc_tty_area)); } }
robutest/uclinux
C++
GPL-2.0
60
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint32ToUint16(IN UINT32 Operand, OUT UINT16 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint32ToUint16(IN UINT32 Operand, OUT UINT16 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_UINT16) { *Result = (UINT16)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT16_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the tim's Hall sensor interface. */
void TIM_SelectHallSensor(TIM_TypeDef *tim, FunctionalState state)
/* Enables or disables the tim's Hall sensor interface. */ void TIM_SelectHallSensor(TIM_TypeDef *tim, FunctionalState state)
{ (state) ? SET_BIT(tim->CR2, TIM_CR2_TI1S) : CLEAR_BIT(tim->CR2, TIM_CR2_TI1S); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Controls peripheral clock gating in sleep and deep-sleep mode. */
void SysCtlPeripheralClockGating(tBoolean bEnable)
/* Controls peripheral clock gating in sleep and deep-sleep mode. */ void SysCtlPeripheralClockGating(tBoolean bEnable)
{ if(bEnable) { HWREG(SYSCTL_RCC) |= SYSCTL_RCC_ACG; } else { HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_ACG); } }
watterott/WebRadio
C++
null
71
/* Enables or disables the specified SRAM1/2 parity error reset. */
void RCC_ConfigSRAMParityErrorRESET(uint32_t SramErrorReset, FunctionalState Cmd)
/* Enables or disables the specified SRAM1/2 parity error reset. */ void RCC_ConfigSRAMParityErrorRESET(uint32_t SramErrorReset, FunctionalState Cmd)
{ assert_param(IS_RCC_SRAMERRORRESET(SramErrorReset)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RCC->SRAM_CTRLSTS |= SramErrorReset; } else { RCC->SRAM_CTRLSTS &= (~SramErrorReset); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read COUNT 32-bit words from port PORT into memory starting at SRC. Now works with any alignment in SRC. Performance is important, but the interfaces seems to be slow: just using the inlined version of the inl() breaks things. */
void ioread32_rep(void __iomem *port, void *dst, unsigned long count)
/* Read COUNT 32-bit words from port PORT into memory starting at SRC. Now works with any alignment in SRC. Performance is important, but the interfaces seems to be slow: just using the inlined version of the inl() breaks things. */ void ioread32_rep(void __iomem *port, void *dst, unsigned long count)
{ if (unlikely((unsigned long)dst & 0x3)) { while (count--) { struct S { int x __attribute__((packed)); }; ((struct S *)dst)->x = ioread32(port); dst += 4; } } else { while (count--) { *(unsigned int *)dst = ioread32(port); dst += 4; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: whether @value contains the canonical default for this @pspec */
gboolean g_param_value_defaults(GParamSpec *pspec, GValue *value)
/* Returns: whether @value contains the canonical default for this @pspec */ gboolean g_param_value_defaults(GParamSpec *pspec, GValue *value)
{ GValue dflt_value = G_VALUE_INIT; gboolean defaults; g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE); g_return_val_if_fail (G_IS_VALUE (value), FALSE); g_return_val_if_fail (PSPEC_APPLIES_TO_VALUE (pspec, value), FALSE); g_value_init (&dflt_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_PARAM_SPEC_GET_CLASS (pspec)->value_set_default (pspec, &dflt_value); defaults = G_PARAM_SPEC_GET_CLASS (pspec)->values_cmp (pspec, value, &dflt_value) == 0; g_value_unset (&dflt_value); return defaults; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Instanciates a #CRString from an instance of GString. */
CRString* cr_string_new_from_gstring(GString *a_string)
/* Instanciates a #CRString from an instance of GString. */ CRString* cr_string_new_from_gstring(GString *a_string)
{ CRString *result = NULL ; result = cr_string_new () ; if (!result) { cr_utils_trace_info ("Out of memory") ; return NULL ; } if (a_string) { result->stryng = g_string_new_len (a_string->str, a_string->len) ; } else { result->stryng = g_string_new (NULL) ; } return result ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI MmioRead64(IN UINTN Address)
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */ UINT64 EFIAPI MmioRead64(IN UINTN Address)
{ BOOLEAN Flag; UINT64 Value; ASSERT ((Address & 7) == 0); Flag = FilterBeforeMmIoRead (FilterWidth64, Address, &Value); if (Flag) { Value = MmioRead64Internal (Address); } FilterAfterMmIoRead (FilterWidth64, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */
UINTN UefiDevicePathLibGetDevicePathSize(CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */ UINTN UefiDevicePathLibGetDevicePathSize(CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ CONST EFI_DEVICE_PATH_PROTOCOL *Start; if (DevicePath == NULL) { return 0; } if (!IsDevicePathValid (DevicePath, 0)) { return 0; } Start = DevicePath; while (!IsDevicePathEnd (DevicePath)) { DevicePath = NextDevicePathNode (DevicePath); } return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath); }
tianocore/edk2
C++
Other
4,240
/* Disable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_DisableEP(U32 EPNum)
/* Disable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_DisableEP(U32 EPNum)
{ U32 *ptr; ptr = GetEpCmdStatPtr(EPNum); *ptr = EP_DISABLED; if (EPNum & 0x80) { EPNum &= ~0x80; LPC_USB->INTEN &= ~(1 << EP_IN_IDX(EPNum)); } else { LPC_USB->INTEN &= ~(1 << EP_OUT_IDX(EPNum)); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Put one byte to the specified position in a pbuf WARNING: silently ignores offset >= p->tot_len */
void pbuf_put_at(struct pbuf *p, u16_t offset, u8_t data)
/* Put one byte to the specified position in a pbuf WARNING: silently ignores offset >= p->tot_len */ void pbuf_put_at(struct pbuf *p, u16_t offset, u8_t data)
{ u16_t q_idx; struct pbuf *q = pbuf_skip(p, offset, &q_idx); if ((q != NULL) && (q->len > q_idx)) { ((u8_t *)q->payload)[q_idx] = data; } }
ua1arn/hftrx
C++
null
69
/* Frees allocated memory, unload the DLLs canlib32.dll has loaded and de- initializes data structures. */
static canStatus LeafLightLibFuncUnloadLibrary(void)
/* Frees allocated memory, unload the DLLs canlib32.dll has loaded and de- initializes data structures. */ static canStatus LeafLightLibFuncUnloadLibrary(void)
{ canStatus result = canERR_NOTINITIALIZED; assert(leafLightLibFuncUnloadLibraryPtr != NULL); assert(leafLightDllHandle != NULL); if ((leafLightLibFuncUnloadLibraryPtr != NULL) && (leafLightDllHandle != NULL)) { result = leafLightLibFuncUnloadLibraryPtr(); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Change Logs: Date Author Notes GuEe-GUI the first version */
static int console_init()
/* Change Logs: Date Author Notes GuEe-GUI the first version */ static int console_init()
{ rt_err_t status = RT_EOK; rt_device_t device = rt_device_find("virtio-console0"); if (device != RT_NULL && rt_device_open(device, 0) == RT_EOK) { status = rt_device_control(device, VIRTIO_DEVICE_CTRL_CONSOLE_PORT_CREATE, RT_NULL); } if (device != RT_NULL) { rt_device_close(device); } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate new answer and add it to answer list (destination) */
static bool _mdns_alloc_answer(mdns_out_answer_t **destnation, uint16_t type, mdns_service_t *service, bool flush, bool bye)
/* Allocate new answer and add it to answer list (destination) */ static bool _mdns_alloc_answer(mdns_out_answer_t **destnation, uint16_t type, mdns_service_t *service, bool flush, bool bye)
{ mdns_out_answer_t * d = *destnation; while (d) { if (d->type == type && d->service == service) { return true; } d = d->next; } mdns_out_answer_t * a = (mdns_out_answer_t *)malloc(sizeof(mdns_out_answer_t)); if (!a) { HOOK_MALLOC_FAILED; return false; } a->type = type; a->service = service; a->bye = bye; a->flush = flush; a->next = NULL; queueToEnd(mdns_out_answer_t, *destnation, a); return true; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* @client: the i2c client @dim: either LP3944_DIM0 or LP3944_DIM1 @period: period of a blink, that is a on/off cycle, expressed in ms. */
static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period)
/* @client: the i2c client @dim: either LP3944_DIM0 or LP3944_DIM1 @period: period of a blink, that is a on/off cycle, expressed in ms. */ static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period)
{ u8 psc_reg; u8 psc_value; int err; if (dim == LP3944_DIM0) psc_reg = LP3944_REG_PSC0; else if (dim == LP3944_DIM1) psc_reg = LP3944_REG_PSC1; else return -EINVAL; if (period > LP3944_PERIOD_MAX) return -EINVAL; psc_value = (period * 255) / LP3944_PERIOD_MAX; err = lp3944_reg_write(client, psc_reg, psc_value); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable/Disable wake up events for this serial port. Obviously, we only support this on the normal COM port. */
static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
/* Enable/Disable wake up events for this serial port. Obviously, we only support this on the normal COM port. */ static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
{ int err = -EINVAL; if (port->mapbase == _Ser3UTCR0) { if (enable) PWER |= PWER_GPIO23 | PWER_GPIO25; else PWER &= ~(PWER_GPIO23 | PWER_GPIO25); err = 0; } return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* g e t W o r k i n g S e t C o n s t r a i n t s */
returnValue QProblemB_getWorkingSetConstraints(QProblemB *_THIS, real_t *workingSetC)
/* g e t W o r k i n g S e t C o n s t r a i n t s */ returnValue QProblemB_getWorkingSetConstraints(QProblemB *_THIS, real_t *workingSetC)
{ if ( workingSetC == 0 ) return THROWERROR( RET_INVALID_ARGUMENTS ); else return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Created on: 9 feb. 2019 Author: Daniel Mårtensson Create a diagonal matrix B with the size row x column, of a vector A. Notice that the row of vector A need to be the same length as the column of matrix B. */
void diag(double *A, double *B, int row_b, int column_b)
/* Created on: 9 feb. 2019 Author: Daniel Mårtensson Create a diagonal matrix B with the size row x column, of a vector A. Notice that the row of vector A need to be the same length as the column of matrix B. */ void diag(double *A, double *B, int row_b, int column_b)
{ for (int j = 0; j < column_b; j++) { if (j == i) { *B = A[i]; B += column_b + 1; } } } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* CAN MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
/* CAN MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
{ if(hcan->Instance==CAN) { __HAL_RCC_CAN1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routine configures FDCAN to enable certain IRQ. Each FDCAN block supports two IRQs. */
void fdcan_enable_irq(uint32_t canport, uint32_t irq)
/* This routine configures FDCAN to enable certain IRQ. Each FDCAN block supports two IRQs. */ void fdcan_enable_irq(uint32_t canport, uint32_t irq)
{ FDCAN_ILE(canport) |= irq & (FDCAN_ILE_INT0 | FDCAN_ILE_INT1); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* This function must be called with IRQs disabled. */
void mthca_free_srq_wqe(struct mthca_srq *srq, u32 wqe_addr)
/* This function must be called with IRQs disabled. */ void mthca_free_srq_wqe(struct mthca_srq *srq, u32 wqe_addr)
{ int ind; struct mthca_next_seg *last_free; ind = wqe_addr >> srq->wqe_shift; spin_lock(&srq->lock); last_free = get_wqe(srq, srq->last_free); *wqe_to_link(last_free) = ind; last_free->nda_op = htonl((ind << srq->wqe_shift) | 1); *wqe_to_link(get_wqe(srq, ind)) = -1; srq->last_free = ind; spin_unlock(&srq->lock); }
robutest/uclinux
C++
GPL-2.0
60
/* This function commands the sending of a LIN response, SLAVE task of MASTER or SLAVE node. */
static uint8_t lin_tx_response(uint8_t uc_node, uint8_t *p_data, uint8_t uc_len)
/* This function commands the sending of a LIN response, SLAVE task of MASTER or SLAVE node. */ static uint8_t lin_tx_response(uint8_t uc_node, uint8_t *p_data, uint8_t uc_len)
{ memcpy(&lin_tx_buffer_node[uc_node][0], p_data, uc_len + 1); g_st_packet[uc_node].ul_addr = (uint32_t)lin_tx_buffer_node[uc_node]; g_st_packet[uc_node].ul_size = uc_len; pdc_tx_init(g_p_pdc[uc_node], &g_st_packet[uc_node], NULL); pdc_enable_transfer(g_p_pdc[uc_node], PERIPH_PTCR_TXTEN); return PASS; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Description: Set the value of the unlabeled accept flag to @value. */
static void netlbl_unlabel_acceptflg_set(u8 value, struct netlbl_audit *audit_info)
/* Description: Set the value of the unlabeled accept flag to @value. */ static void netlbl_unlabel_acceptflg_set(u8 value, struct netlbl_audit *audit_info)
{ struct audit_buffer *audit_buf; u8 old_val; old_val = netlabel_unlabel_acceptflg; netlabel_unlabel_acceptflg = value; audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_ALLOW, audit_info); if (audit_buf != NULL) { audit_log_format(audit_buf, " unlbl_accept=%u old=%u", value, old_val); audit_log_end(audit_buf); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets a general-purpose fuse bit-field with the appropriate erase and write operations. */
void flashcalw_set_gp_fuse_bitfield(uint32_t pos, uint32_t width, uint64_t value)
/* Sets a general-purpose fuse bit-field with the appropriate erase and write operations. */ void flashcalw_set_gp_fuse_bitfield(uint32_t pos, uint32_t width, uint64_t value)
{ uint32_t error_status = 0; uint32_t gp_fuse_bit; pos &= 0x3F; width = Min(width, 64); for (gp_fuse_bit = pos; gp_fuse_bit < pos + width; gp_fuse_bit++, value >>= 1) { flashcalw_set_gp_fuse_bit(gp_fuse_bit, value & 0x01); error_status |= flashcalw_error_status; } flashcalw_error_status = error_status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Gets a data element from the SPI receive FIFO. This function replaces the original SPIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
long SPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SPI receive FIFO. This function replaces the original SPIDataNonBlockingGet() API and performs the same actions. A macro is provided in */ long SPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); if(xHWREG(ulBase + SPI_SR) & SPI_SR_RXNE) { *pulData = xHWREG(ulBase + SPI_DR); return(1); } else { return(0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* We can't use pci_find_device() here since we are called from interrupt context. */
static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn)
/* We can't use pci_find_device() here since we are called from interrupt context. */ static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn)
{ struct pci_dev *dev; list_for_each_entry(dev, &bus->devices, bus_list) { u16 status; if (dev->bus->number == 0 && dev->devfn == 0) continue; pci_read_config_word(dev, PCI_STATUS, &status); if (status == 0xffff) continue; if ((status & status_mask) == 0) continue; pci_write_config_word(dev, PCI_STATUS, status & status_mask); if (warn) printk("(%s: %04X) ", pci_name(dev), status); } list_for_each_entry(dev, &bus->devices, bus_list) if (dev->subordinate) pcibios_bus_report_status(dev->subordinate, status_mask, warn); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Erase SPI Flash sector. Erases SPI Flash Sector */
unsigned char spi_flash_erase(uint32_t start_offset, uint32_t size)
/* Erase SPI Flash sector. Erases SPI Flash Sector */ unsigned char spi_flash_erase(uint32_t start_offset, uint32_t size)
{ unsigned long end_offset = start_offset + size; if (end_offset > FLASH_MEMORY_SIZE) { return 1; } start_offset = start_offset & FLASH_SECT_MASK; spi_flash_write_enable(); while(start_offset < end_offset) { spi_flash_sector_erase(start_offset); while(spi_flash_read_status_reg() & 0x01) { } start_offset += FLASH_SECTOR_SIZE; } spi_flash_write_disable(); return 0; }
memfault/zero-to-main
C++
null
200
/* Disable source repeat function of the specified dma channel. */
en_result_t Dma_DisableContinusTranfer(en_dma_channel_t enCh)
/* Disable source repeat function of the specified dma channel. */ en_result_t Dma_DisableContinusTranfer(en_dma_channel_t enCh)
{ ASSERT(IS_VALID_CH(enCh)); if(!IS_VALID_CH(enCh)) { return ErrorInvalidParameter; } if(enCh == DmaCh0) { M0P_DMAC->CONFB0_f.MSK = 0; } else{ M0P_DMAC->CONFB1_f.MSK = 0; } return Ok; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Forces or releases High Speed AHB (AHB1) peripheral reset. */
void RCC_AHBPeriphReset(u32 ahb1_periph)
/* Forces or releases High Speed AHB (AHB1) peripheral reset. */ void RCC_AHBPeriphReset(u32 ahb1_periph)
{ RCC->AHBRSTR |= ahb1_periph; RCC->AHBRSTR &= ~ahb1_periph; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called when we receive a feature request or a slave initiated feature request. */
static int ble_ll_ctrl_rx_feature_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr, uint8_t *rspbuf, uint8_t opcode)
/* Called when we receive a feature request or a slave initiated feature request. */ static int ble_ll_ctrl_rx_feature_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr, uint8_t *rspbuf, uint8_t opcode)
{ uint8_t rsp_opcode; uint64_t our_feat; if (opcode == BLE_LL_CTRL_SLAVE_FEATURE_REQ) { if (connsm->conn_role != BLE_LL_CONN_ROLE_MASTER) { return BLE_LL_CTRL_UNKNOWN_RSP; } } else { if (connsm->conn_role != BLE_LL_CONN_ROLE_SLAVE) { return BLE_LL_CTRL_UNKNOWN_RSP; } } our_feat = ble_ll_read_supp_features(); rsp_opcode = BLE_LL_CTRL_FEATURE_RSP; ble_ll_ctrl_update_features(connsm, dptr); connsm->conn_features &= our_feat; put_le64(rspbuf + 1, our_feat); rspbuf[1] = connsm->conn_features; return rsp_opcode; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Reads the sensor and returns the data as a sensors_event_t. */
err_t lm75bGetSensorEvent(sensors_event_t *event)
/* Reads the sensor and returns the data as a sensors_event_t. */ err_t lm75bGetSensorEvent(sensors_event_t *event)
{ int32_t temp; memset(event, 0, sizeof(sensors_event_t)); event->version = sizeof(sensors_event_t); event->sensor_id = _lm75bSensorID; event->type = SENSOR_TYPE_AMBIENT_TEMPERATURE; event->timestamp = delayGetTicks(); ASSERT_STATUS(lm75bGetTemperature(&temp)); event->temperature = temp * 0.125F; return ERROR_NONE; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* A pointer to the interface with the incremented reference counter is returned. */
struct usb_interface* usb_get_intf(struct usb_interface *intf)
/* A pointer to the interface with the incremented reference counter is returned. */ struct usb_interface* usb_get_intf(struct usb_interface *intf)
{ if (intf) get_device(&intf->dev); return intf; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the counter direction change to up interrupt flag (UPCF). @rmtoll ICR UPCF LPTIM_ClearFlag_UP. */
void LPTIM_ClearFlag_UP(LPTIM_Module *LPTIMx)
/* Clear the counter direction change to up interrupt flag (UPCF). @rmtoll ICR UPCF LPTIM_ClearFlag_UP. */ void LPTIM_ClearFlag_UP(LPTIM_Module *LPTIMx)
{ SET_BIT(LPTIMx->INTCLR, LPTIM_INTCLR_UPCF); }
pikasTech/PikaPython
C++
MIT License
1,403
/* These functions are implemented according to the AGPv3 spec, which covers implementation details that had previously been left open. */
int agp3_generic_fetch_size(void)
/* These functions are implemented according to the AGPv3 spec, which covers implementation details that had previously been left open. */ int agp3_generic_fetch_size(void)
{ u16 temp_size; int i; struct aper_size_info_16 *values; pci_read_config_word(agp_bridge->dev, agp_bridge->capndx+AGPAPSIZE, &temp_size); values = A_SIZE_16(agp_bridge->driver->aperture_sizes); for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { if (temp_size == values[i].size_value) { agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + i); agp_bridge->aperture_size_idx = i; return values[i].size; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClrStallEP(U32 EPNum)
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ClrStallEP(U32 EPNum)
{ USBD_ResetEP(EPNum); MXC_USB->ep[EPNum & EPNUM_MASK] &= ~MXC_F_USB_EP_STALL; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This comparator searches for the next bulk Endpoint descriptor inside the current interface descriptor, aborting the search if another interface descriptor is found before the required endpoint. */
uint8_t DCOMP_NextInterfaceBulkEndpoint(void *const CurrentDescriptor)
/* This comparator searches for the next bulk Endpoint descriptor inside the current interface descriptor, aborting the search if another interface descriptor is found before the required endpoint. */ uint8_t DCOMP_NextInterfaceBulkEndpoint(void *const CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Endpoint) { USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))) return DESCRIPTOR_SEARCH_Found; } else if (Header->Type == DTYPE_Interface) { return DESCRIPTOR_SEARCH_Fail; } return DESCRIPTOR_SEARCH_NotFound; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Manual context switch called by portYIELD or taskYIELD. */
void vPortYield(void)
/* Manual context switch called by portYIELD or taskYIELD. */ void vPortYield(void)
{ extern void VPortYieldASM( void ); portENTER_CRITICAL(); { asm volatile ( "bralid r14, VPortYieldASM \n\t" \ "or r0, r0, r0 \n\t" ); } portEXIT_CRITICAL(); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* create a host-wide workqueue for issuing deferred shutdown requests aggregated from all vm* instances. We need our own isolated single-thread queue to prevent deadlock against flushing the normal work-queue. */
static int __init irqfd_module_init(void)
/* create a host-wide workqueue for issuing deferred shutdown requests aggregated from all vm* instances. We need our own isolated single-thread queue to prevent deadlock against flushing the normal work-queue. */ static int __init irqfd_module_init(void)
{ irqfd_cleanup_wq = create_singlethread_workqueue("kvm-irqfd-cleanup"); if (!irqfd_cleanup_wq) return -ENOMEM; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Look up class by its handle in the provided cache */
struct rtnl_class* rtnl_class_get(struct nl_cache *cache, int ifindex, uint32_t handle)
/* Look up class by its handle in the provided cache */ struct rtnl_class* rtnl_class_get(struct nl_cache *cache, int ifindex, uint32_t handle)
{ struct rtnl_class *class; if (cache->c_ops != &rtnl_class_ops) return NULL; nl_list_for_each_entry(class, &cache->c_items, ce_list) { if (class->c_handle == handle && class->c_ifindex == ifindex) { nl_object_get((struct nl_object *) class); return class; } } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Locking Note: The lport lock is expected to be held before calling this routine. */
static void fc_lport_enter_logo(struct fc_lport *)
/* Locking Note: The lport lock is expected to be held before calling this routine. */ static void fc_lport_enter_logo(struct fc_lport *)
{ struct fc_frame *fp; struct fc_els_logo *logo; FC_LPORT_DBG(lport, "Entered LOGO state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_LOGO); fc_vports_linkchange(lport); fp = fc_frame_alloc(lport, sizeof(*logo)); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_LOGO, fc_lport_logo_resp, lport, 2 * lport->r_a_tov)) fc_lport_error(lport, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes Machine Check Exception feature to specific state. */
RETURN_STATUS EFIAPI MceInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
/* Initializes Machine Check Exception feature to specific state. */ RETURN_STATUS EFIAPI MceInitialize(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL, IN BOOLEAN State)
{ CPU_REGISTER_TABLE_WRITE_FIELD ( ProcessorNumber, ControlRegister, 4, IA32_CR4, Bits.MCE, (State) ? 1 : 0 ); return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* If a timeout is specified in StartupAllAps(), a timer is set, which invokes this procedure periodically to check whether all APs have finished. */
STATIC VOID EFIAPI CheckAllAPsStatus(IN EFI_EVENT Event, IN VOID *Context)
/* If a timeout is specified in StartupAllAps(), a timer is set, which invokes this procedure periodically to check whether all APs have finished. */ STATIC VOID EFIAPI CheckAllAPsStatus(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; UINTN Index; mCpuMpData.AllTimeTaken += POLL_INTERVAL_US; for (Index = 0; Index < mCpuMpData.NumberOfProcessors; Index++) { UpdateApStatus (Index); } if (mCpuMpData.AllTimeoutActive && (mCpuMpData.AllTimeTaken > mCpuMpData.AllTimeout)) { ProcessStartupAllAPsTimeout (); mCpuMpData.FinishCount = mCpuMpData.StartCount; } if (mCpuMpData.FinishCount != mCpuMpData.StartCount) { return; } gBS->SetTimer ( mCpuMpData.CheckAllAPsEvent, TimerCancel, 0 ); if (mCpuMpData.FailedListIndex == 0) { if (mCpuMpData.FailedList != NULL) { } } Status = gBS->SignalEvent (mCpuMpData.AllWaitEvent); ASSERT_EFI_ERROR (Status); mCpuMpData.AllWaitEvent = NULL; }
tianocore/edk2
C++
Other
4,240
/* Causes a processor trigger for a sample sequence. */
void ADCProcessorTrigger(unsigned long ulBase, unsigned long ulSequenceNum)
/* Causes a processor trigger for a sample sequence. */ void ADCProcessorTrigger(unsigned long ulBase, unsigned long ulSequenceNum)
{ ASSERT((ulBase == ADC0_BASE) || (ulBase == ADC1_BASE)); ASSERT((ulSequenceNum & 0xf) < 4); HWREG(ulBase + ADC_O_PSSI) = ((ulSequenceNum & 0xffff0000) | (1 << (ulSequenceNum & 0xf))); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Return a pointer to an array of available screen dimensions for the given format, sorted largest to smallest. Returns NULL if there are no dimensions available for a particular format, or (SDL_Rect **)-1 if any dimension is okay for the given format. If 'format' is NULL, the mode list will be for the format given by SDL_GetVideoInfo()->vfmt */
SDL_Rect** SDL_ListModes(SDL_PixelFormat *format, Uint32 flags)
/* Return a pointer to an array of available screen dimensions for the given format, sorted largest to smallest. Returns NULL if there are no dimensions available for a particular format, or (SDL_Rect **)-1 if any dimension is okay for the given format. If 'format' is NULL, the mode list will be for the format given by SDL_GetVideoInfo()->vfmt */ SDL_Rect** SDL_ListModes(SDL_PixelFormat *format, Uint32 flags)
{ SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; SDL_Rect **modes; modes = NULL; if ( SDL_VideoSurface ) { if ( format == NULL ) { format = SDL_VideoSurface->format; } modes = video->ListModes(this, format, flags); } return(modes); }
DC-SWAT/DreamShell
C++
null
404
/* This function disables the uDMA controller. Once disabled, the uDMA controller will not operate until re-enabled with */
void uDMADisable(void)
/* This function disables the uDMA controller. Once disabled, the uDMA controller will not operate until re-enabled with */ void uDMADisable(void)
{ HWREG(UDMA_CFG) = 0; }
watterott/WebRadio
C++
null
71
/* Insert the memory block to the pool's list of the blocks. */
VOID UsbHcInsertMemBlockToPool(IN USBHC_MEM_BLOCK *Head, IN USBHC_MEM_BLOCK *Block)
/* Insert the memory block to the pool's list of the blocks. */ VOID UsbHcInsertMemBlockToPool(IN USBHC_MEM_BLOCK *Head, IN USBHC_MEM_BLOCK *Block)
{ ASSERT ((Head != NULL) && (Block != NULL)); Block->Next = Head->Next; Head->Next = Block; }
tianocore/edk2
C++
Other
4,240
/* Return value: 0 on success / -EIO on failure */
static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
/* Return value: 0 on success / -EIO on failure */ static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
{ int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX); if (pcix_cmd_reg == 0) return 0; if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD, &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) { dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n"); return -EIO; } ioa_cfg->saved_pcix_cmd_reg |= PCI_X_CMD_DPERR_E | PCI_X_CMD_ERO; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi)
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi)
{ if(hqspi->Instance==QUADSPI) { __HAL_RCC_QSPI_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOE, GPIO_PIN_2); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_2); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_11); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* pmcraid_ioasc_logger - log IOASC information based user-settings @ioasc: ioasc code @cmd: pointer to command that resulted in 'ioasc' */
void pmcraid_ioasc_logger(u32 ioasc, struct pmcraid_cmd *cmd)
/* pmcraid_ioasc_logger - log IOASC information based user-settings @ioasc: ioasc code @cmd: pointer to command that resulted in 'ioasc' */ void pmcraid_ioasc_logger(u32 ioasc, struct pmcraid_cmd *cmd)
{ struct pmcraid_ioasc_error *error_info = pmcraid_get_error_info(ioasc); if (error_info == NULL || cmd->drv_inst->current_log_level < error_info->log_level) return; pmcraid_err("cmd [%d] for resource %x failed with %x(%s)\n", cmd->ioa_cb->ioarcb.cdb[0], cmd->ioa_cb->ioarcb.resource_handle, le32_to_cpu(ioasc), error_info->error_string); }
robutest/uclinux
C++
GPL-2.0
60
/* Callers must hold ih->mutex. This function can sleep. */
static int inotify_handle_get_wd(struct inotify_handle *ih, struct inotify_watch *watch)
/* Callers must hold ih->mutex. This function can sleep. */ static int inotify_handle_get_wd(struct inotify_handle *ih, struct inotify_watch *watch)
{ int ret; do { if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS))) return -ENOSPC; ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); } while (ret == -EAGAIN); if (likely(!ret)) ih->last_wd = watch->wd; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Calculates the CRC32c checksum of the given buffer. */
UINT32 EFIAPI CalculateCrc32c(IN CONST VOID *Buffer, IN UINTN Length, IN UINT32 InitialValue)
/* Calculates the CRC32c checksum of the given buffer. */ UINT32 EFIAPI CalculateCrc32c(IN CONST VOID *Buffer, IN UINTN Length, IN UINT32 InitialValue)
{ CONST UINT8 *Buf; UINT32 Crc; Buf = Buffer; Crc = ~InitialValue; while (Length-- != 0) { Crc = mCrc32cLookupTable[(Crc & 0xFF) ^ *(Buf++)] ^ (Crc >> 8); } return ~Crc; }
tianocore/edk2
C++
Other
4,240
/* Add multicast addresses to the internal multicast-hash table. */
static void macb_sethashtable(struct net_device *dev)
/* Add multicast addresses to the internal multicast-hash table. */ static void macb_sethashtable(struct net_device *dev)
{ struct dev_mc_list *curr; unsigned long mc_filter[2]; unsigned int i, bitnr; struct macb *bp = netdev_priv(dev); mc_filter[0] = mc_filter[1] = 0; curr = dev->mc_list; for (i = 0; i < dev->mc_count; i++, curr = curr->next) { if (!curr) break; bitnr = hash_get_index(curr->dmi_addr); mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); } macb_writel(bp, HRB, mc_filter[0]); macb_writel(bp, HRT, mc_filter[1]); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns all IOC Doorbell register bits if cooked==0, else just the Doorbell bits in MPI_IOC_STATE_MASK. */
u32 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked)
/* Returns all IOC Doorbell register bits if cooked==0, else just the Doorbell bits in MPI_IOC_STATE_MASK. */ u32 mpt_GetIocState(MPT_ADAPTER *ioc, int cooked)
{ u32 s, sc; s = CHIPREG_READ32(&ioc->chip->Doorbell); sc = s & MPI_IOC_STATE_MASK; ioc->last_state = sc; return cooked ? sc : s; }
robutest/uclinux
C++
GPL-2.0
60
/* Delete a Mutex that was created by osMutexCreate. */
osStatus_t osMutexDelete(osMutexId_t mutex_id)
/* Delete a Mutex that was created by osMutexCreate. */ osStatus_t osMutexDelete(osMutexId_t mutex_id)
{ struct cv2_mutex *mutex = (struct cv2_mutex *)mutex_id; if (mutex_id == NULL) { return osErrorParameter; } if (k_is_in_isr()) { return osErrorISR; } k_mem_slab_free(&cv2_mutex_slab, (void *)mutex); return osOK; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Configures the Internal High Speed oscillator to program/erase FLASH. */
FLASH_HSICLOCK FLASH_ClockInit(void)
/* Configures the Internal High Speed oscillator to program/erase FLASH. */ FLASH_HSICLOCK FLASH_ClockInit(void)
{ bool HSIStatus = 0; __IO uint32_t StartUpCounter = 0; FLASH_HSICLOCK hsiclock_status = FLASH_HSICLOCK_ENABLE; if ((RCC->CTRL & RCC_CTRL_HSIRDF) == RESET) { RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN); do { HSIStatus = RCC->CTRL & RCC_CTRL_HSIRDF; StartUpCounter++; } while ((HSIStatus == 0) && (StartUpCounter != HSI_STARTUP_TIMEOUT)); HSIStatus = ((RCC->CTRL & RCC_CTRL_HSIRDF) != RESET); if (!HSIStatus) { hsiclock_status = FLASH_HSICLOCK_DISABLE; } } return hsiclock_status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* DMA2D MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
/* DMA2D MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
{ __HAL_RCC_DMA2D_FORCE_RESET(); __HAL_RCC_DMA2D_RELEASE_RESET(); __HAL_RCC_DMA2D_CLK_DISABLE(); HAL_NVIC_DisableIRQ(DMA2D_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Writes a data in a specified RTC Backup data register. */
void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
/* Writes a data in a specified RTC Backup data register. */ void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data)
{ __IO uint32_t tmp = 0; assert_param(IS_RTC_BKP(RTC_BKP_DR)); tmp = RTC_BASE + 0x50; tmp += (RTC_BKP_DR * 4); *(__IO uint32_t *)tmp = (uint32_t)Data; }
MaJerle/stm32f429
C++
null
2,036
/* @fh: file handle Return: true if file handle points to a directory */
static int is_dir(struct file_handle *fh)
/* @fh: file handle Return: true if file handle points to a directory */ static int is_dir(struct file_handle *fh)
{ struct fs_dir_stream *dirs; dirs = fs_opendir(fh->path); if (!dirs) return 0; fs_closedir(dirs); return 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Initialize the input modules to read a scan of compressed data. The first call to this is done by jdmaster.c after initializing the entire decompressor (during jpeg_start_decompress). Subsequent calls come from consume_markers, below. */
start_input_pass(j_decompress_ptr cinfo)
/* Initialize the input modules to read a scan of compressed data. The first call to this is done by jdmaster.c after initializing the entire decompressor (during jpeg_start_decompress). Subsequent calls come from consume_markers, below. */ start_input_pass(j_decompress_ptr cinfo)
{ per_scan_setup(cinfo); latch_quant_tables(cinfo); (*cinfo->entropy->start_pass) (cinfo); (*cinfo->coef->start_input_pass) (cinfo); cinfo->inputctl->consume_input = cinfo->coef->consume_data; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Returns: (transfer full): a #GInputStream to read the icon from. */
GInputStream* g_loadable_icon_load_finish(GLoadableIcon *icon, GAsyncResult *res, char **type, GError **error)
/* Returns: (transfer full): a #GInputStream to read the icon from. */ GInputStream* g_loadable_icon_load_finish(GLoadableIcon *icon, GAsyncResult *res, char **type, GError **error)
{ GLoadableIconIface *iface; g_return_val_if_fail (G_IS_LOADABLE_ICON (icon), NULL); g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL); if (g_async_result_legacy_propagate_error (res, error)) return NULL; iface = G_LOADABLE_ICON_GET_IFACE (icon); return (* iface->load_finish) (icon, res, type, error); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330