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
/* Read extra bytes of information from a spare area, using the given scheme. */
void nand_flash_spare_scheme_read_extra(const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, void *extra, uint8_t size, uint8_t offset)
/* Read extra bytes of information from a spare area, using the given scheme. */ void nand_flash_spare_scheme_read_extra(const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, void *extra, uint8_t size, uint8_t offset)
{ Assert((size + offset) < scheme->extra_byte_number); uint32_t i; for (i = 0; i < size; i++) { ((uint8_t *)extra)[i] = spare[scheme->extra_bytes_positions[i + offset]]; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get IT status from SX8651 interrupt status registers. */
int32_t SX8651_ITStatus(SX8651_Object_t *pObj)
/* Get IT status from SX8651 interrupt status registers. */ int32_t SX8651_ITStatus(SX8651_Object_t *pObj)
{ (void)(pObj); return SX8651_OK; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns: 0, Otherwise, VXGE_HW_ERR_WRONG_IRQ if the msix index is out of range status. See also: */
void vxge_hw_vpath_msix_mask(struct __vxge_hw_vpath_handle *vp, int msix_id)
/* Returns: 0, Otherwise, VXGE_HW_ERR_WRONG_IRQ if the msix index is out of range status. See also: */ void vxge_hw_vpath_msix_mask(struct __vxge_hw_vpath_handle *vp, int msix_id)
{ struct __vxge_hw_device *hldev = vp->vpath->hldev; __vxge_hw_pio_mem_write32_upper( (u32) vxge_bVALn(vxge_mBIT(hldev->first_vp_id + (msix_id / 4)), 0, 32), &hldev->common_reg->set_msix_mask_vect[msix_id % 4]); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Free an allocated Tx Buffer. ptr must be correct position. */
static void wl3501_free_tx_buffer(struct wl3501_card *this, u16 ptr)
/* Free an allocated Tx Buffer. ptr must be correct position. */ static void wl3501_free_tx_buffer(struct wl3501_card *this, u16 ptr)
{ if (!this->tx_buffer_head) this->tx_buffer_head = ptr; else wl3501_set_to_wla(this, this->tx_buffer_tail, &ptr, sizeof(ptr)); while (ptr) { u16 next; this->tx_buffer_cnt++; wl3501_get_from_wla(this, ptr, &next, sizeof(next)); this->tx_buffer_tail = ptr; ptr = next; } }
robutest/uclinux
C++
GPL-2.0
60
/* Called with the journal locked. Called with j_list_lock held. */
void __journal_insert_checkpoint(struct journal_head *jh, transaction_t *transaction)
/* Called with the journal locked. Called with j_list_lock held. */ void __journal_insert_checkpoint(struct journal_head *jh, transaction_t *transaction)
{ JBUFFER_TRACE(jh, "entry"); J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); jh->b_cp_transaction = transaction; if (!transaction->t_checkpoint_list) { jh->b_cpnext = jh->b_cpprev = jh; } else { jh->b_cpnext = transaction->t_checkpoint_list; jh->b_cpprev = transaction->t_checkpoint_list->b_cpprev; jh->b_cpprev->b_cpnext = jh; jh->b_cpnext->b_cpprev = jh; } transaction->t_checkpoint_list = jh; }
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
/* Event handler for the library USB Connection event. */ void EVENT_USB_Device_Connect(void)
{ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); DDRC |= (1 << 6); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* The return value is the number of characters written into @buf not including the trailing '\0'. If @size is <= 0 the function returns 0. */
int scnprintf(char *buf, size_t size, const char *fmt,...)
/* The return value is the number of characters written into @buf not including the trailing '\0'. If @size is <= 0 the function returns 0. */ int scnprintf(char *buf, size_t size, const char *fmt,...)
{ va_list args; int i; va_start(args, fmt); i = vsnprintf(buf, size, fmt, args); va_end(args); return (i >= size) ? (size - 1) : i; }
robutest/uclinux
C++
GPL-2.0
60
/* qt2_boxunsetsw_flowctl - Turn software (XON/XOFF) flow control off for a hardware UART. */
static int qt2_boxunsetsw_flowctl(struct usb_serial *serial, __u16 UartNumber)
/* qt2_boxunsetsw_flowctl - Turn software (XON/XOFF) flow control off for a hardware UART. */ static int qt2_boxunsetsw_flowctl(struct usb_serial *serial, __u16 UartNumber)
{ return usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), QT2_SW_FLOW_CONTROL_DISABLE, 0x40, 0, UartNumber, NULL, 0, 300); }
robutest/uclinux
C++
GPL-2.0
60
/* mux the pin to the gpio controller (instead of "A" or "B" peripheral), and configure it for an output. */
int at91_set_pio_output(unsigned port, u32 pin, int value)
/* mux the pin to the gpio controller (instead of "A" or "B" peripheral), and configure it for an output. */ int at91_set_pio_output(unsigned port, u32 pin, int value)
{ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; u32 mask; if ((port < AT91_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; writel(mask, &pio->port[port].idr); writel(mask, &pio->port[port].pudr); if (value) writel(mask, &pio->port[port].sodr); else writel(mask, &pio->port[port].codr); writel(mask, &pio->port[port].oer); writel(mask, &pio->port[port].per); } return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Sets the sort order attribute in the file info structure. See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. */
void g_file_info_set_sort_order(GFileInfo *info, gint32 sort_order)
/* Sets the sort order attribute in the file info structure. See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. */ void g_file_info_set_sort_order(GFileInfo *info, gint32 sort_order)
{ static guint32 attr = 0; GFileAttributeValue *value; g_return_if_fail (G_IS_FILE_INFO (info)); if (attr == 0) attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER); value = g_file_info_create_value (info, attr); if (value) _g_file_attribute_value_set_int32 (value, sort_order); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* NOTE: the phy has been disabled as well as the wfr timer before this is called. */
void ble_ll_conn_event_halt(void)
/* NOTE: the phy has been disabled as well as the wfr timer before this is called. */ void ble_ll_conn_event_halt(void)
{ ble_ll_state_set(BLE_LL_STATE_STANDBY); if (g_ble_ll_conn_cur_sm) { g_ble_ll_conn_cur_sm->csmflags.cfbit.pkt_rxd = 0; ble_ll_event_send(&g_ble_ll_conn_cur_sm->conn_ev_end); g_ble_ll_conn_cur_sm = NULL; } }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* sn_sal_module_exit - When we're unloaded, remove the driver/port */
static void __exit sn_sal_module_exit(void)
/* sn_sal_module_exit - When we're unloaded, remove the driver/port */ static void __exit sn_sal_module_exit(void)
{ del_timer_sync(&sal_console_port.sc_timer); uart_remove_one_port(&sal_console_uart, &sal_console_port.sc_port); uart_unregister_driver(&sal_console_uart); misc_deregister(&misc); }
robutest/uclinux
C++
GPL-2.0
60
/* Allocate a frame intended to be sent via fcoe_xmit. Get an sk_buff for the frame and set the length. */
struct fc_frame* _fc_frame_alloc(size_t len)
/* Allocate a frame intended to be sent via fcoe_xmit. Get an sk_buff for the frame and set the length. */ struct fc_frame* _fc_frame_alloc(size_t len)
{ struct fc_frame *fp; struct sk_buff *skb; WARN_ON((len % sizeof(u32)) != 0); len += sizeof(struct fc_frame_header); skb = alloc_skb_fclone(len + FC_FRAME_HEADROOM + FC_FRAME_TAILROOM + NET_SKB_PAD, GFP_ATOMIC); if (!skb) return NULL; skb_reserve(skb, NET_SKB_PAD + FC_FRAME_HEADROOM); fp = (struct fc_frame *) skb; fc_frame_init(fp); skb_put(skb, len); return fp; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC0 Interrupt Handler. If users want to user the ADC0 Callback feature, Users should promise that the ADC0 Handle in the vector table is ADCIntHandler. */
void ADCIntHandler(void)
/* ADC0 Interrupt Handler. If users want to user the ADC0 Callback feature, Users should promise that the ADC0 Handle in the vector table is ADCIntHandler. */ void ADCIntHandler(void)
{ unsigned long ulEventFlags = 0; g_pfnADCHandlerCallbacks[0](0, ulEventFlags, 0, 0); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check if all memory in this vector is sector aligned. */
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
/* Check if all memory in this vector is sector aligned. */ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
{ int i; size_t alignment = bdrv_opt_mem_align(bs); for (i = 0; i < qiov->niov; i++) { if ((uintptr_t) qiov->iov[i].iov_base % alignment) { return false; } if (qiov->iov[i].iov_len % alignment) { return false; } } return true; }
ve3wwg/teensy3_qemu
C
Other
15
/* Config the ETH DMA Rx Desc Own bit. */
void ETH_ConfigDMARxDescOwnBit(ETH_DMADescConfig_T *DMARxDesc)
/* Config the ETH DMA Rx Desc Own bit. */ void ETH_ConfigDMARxDescOwnBit(ETH_DMADescConfig_T *DMARxDesc)
{ DMARxDesc->Status |= ETH_DMARXDESC_OWN; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base FLEXSPI peripheral base address. param handle Pointer to flexspi_dma_handle_t structure */
void FLEXSPI_TransferAbortDMA(FLEXSPI_Type *base, flexspi_dma_handle_t *handle)
/* param base FLEXSPI peripheral base address. param handle Pointer to flexspi_dma_handle_t structure */ void FLEXSPI_TransferAbortDMA(FLEXSPI_Type *base, flexspi_dma_handle_t *handle)
{ assert(handle != NULL); if ((base->IPTXFCR & FLEXSPI_IPTXFCR_TXDMAEN_MASK) != 0x00U) { FLEXSPI_EnableTxDMA(base, false); DMA_AbortTransfer(handle->txDmaHandle); } if ((base->IPRXFCR & FLEXSPI_IPRXFCR_RXDMAEN_MASK) != 0x00U) { FLEXSPI_EnableRxDMA(base, false); DMA_AbortTransfer(handle->rxDmaHandle); } handle->state = kFLEXSPI_Idle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* I2C MSP Initialization This function configures the hardware resources used in this example. */
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP Initialization This function configures the hardware resources used in this example. */ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hi2c->Instance==I2C2) { __HAL_RCC_GPIOF_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF4_I2C2; HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); __HAL_RCC_I2C2_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Light Sleep Pros: Fast wake response: Cons: Higher power dissipation, 48MHz PLL remains on. */
static void z_power_soc_sleep(void)
/* Light Sleep Pros: Fast wake response: Cons: Higher power dissipation, 48MHz PLL remains on. */ static void z_power_soc_sleep(void)
{ __set_PRIMASK(1); soc_lite_sleep_enable(); __set_BASEPRI(0); barrier_dsync_fence_full(); __WFI(); __NOP(); __NOP(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Determines the flash page number that the specified address belongs to. */
static blt_int32u FlashGetPage(blt_addr address)
/* Determines the flash page number that the specified address belongs to. */ static blt_int32u FlashGetPage(blt_addr address)
{ blt_int32u result; if (FlashGetBank(address) == FLASH_BANK_1) { ASSERT_RT(address >= FLASH_BASE); result = (address - FLASH_BASE) / FLASH_ERASE_PAGE_SIZE; } else { ASSERT_RT(address >= (FLASH_BASE + FLASH_BANK_SIZE)); result = (address - (FLASH_BASE + FLASH_BANK_SIZE)) / FLASH_ERASE_PAGE_SIZE; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Start or stop the calibration of selected OPAMP peripheral. */
void OPAMP_StartCalibration(uint32_t OPAMP_Selection, FunctionalState NewState)
/* Start or stop the calibration of selected OPAMP peripheral. */ void OPAMP_StartCalibration(uint32_t OPAMP_Selection, FunctionalState NewState)
{ assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { *(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection) |= (uint32_t) (OPAMP_CSR_CALON); } else { *(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection) &= (uint32_t)(~OPAMP_CSR_CALON); } }
ajhc/demo-cortex-m3
C++
null
38
/* GetEventInformation-ACK ::= SEQUENCE { listOfEventSummaries listOfEventSummaries, moreEvents BOOLEAN } */
static guint fGetEventInformationACK(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* GetEventInformation-ACK ::= SEQUENCE { listOfEventSummaries listOfEventSummaries, moreEvents BOOLEAN } */ static guint fGetEventInformationACK(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ guint lastoffset = 0; guint8 tag_no, tag_info; guint32 lvt; while (tvb_reported_length_remaining(tvb, offset) > 0) { lastoffset = offset; switch (fTagNo(tvb, offset)) { case 0: offset += fTagHeaderTree(tvb, pinfo, tree, offset, &tag_no, &tag_info, &lvt); offset = flistOfEventSummaries(tvb, pinfo, tree, offset); offset += fTagHeaderTree(tvb, pinfo, tree, offset, &tag_no, &tag_info, &lvt); break; case 1: offset = fBooleanTag(tvb, pinfo, tree, offset, "more Events: "); break; default: return offset; } if (offset == lastoffset) break; } return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Internal adapter pointer to RAM data are copied from adapter into host system. */
static int tms380tr_read_ptr(struct net_device *dev)
/* Internal adapter pointer to RAM data are copied from adapter into host system. */ static int tms380tr_read_ptr(struct net_device *dev)
{ struct net_local *tp = netdev_priv(dev); unsigned short adapterram; tms380tr_read_ram(dev, (unsigned char *)&tp->intptrs.BurnedInAddrPtr, ADAPTER_INT_PTRS, 16); tms380tr_read_ram(dev, (unsigned char *)&adapterram, cpu_to_be16((unsigned short)tp->intptrs.AdapterRAMPtr), 2); return be16_to_cpu(adapterram); }
robutest/uclinux
C++
GPL-2.0
60
/* Set up the SPI controller for a specified SPI slave device @dev SPI slave */
static int spi_m2s_setup(struct spi_device *dev)
/* Set up the SPI controller for a specified SPI slave device @dev SPI slave */ static int spi_m2s_setup(struct spi_device *dev)
{ struct m2s_spi_dsc *s = spi_master_get_devdata(dev->master); int ret = 0; if (s->stopping) { ret = -ESHUTDOWN; goto done; } if (spi_m2s_hw_bt_check(s, dev->bits_per_word)) { dev_err(&dev->dev, "unsupported bits per word %d\n", dev->bits_per_word); ret = -EINVAL; goto done; } s->slave = NULL; done: return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* The macro is used to set STOP condition of I2C Bus. */
void I2C_STOP(I2C_T *i2c)
/* The macro is used to set STOP condition of I2C Bus. */ void I2C_STOP(I2C_T *i2c)
{ (i2c)->CTL0 |= (I2C_CTL0_SI_Msk | I2C_CTL0_STO_Msk); while (i2c->CTL0 & I2C_CTL0_STO_Msk) { } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT64 EFIAPI IoBitFieldRead64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT64 EFIAPI IoBitFieldRead64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit)
{ return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit); }
tianocore/edk2
C++
Other
4,240
/* Just like with the cs5535-gpio driver, we can't use the standard PCI driver registration stuff. It only allows only one driver to bind to each PCI device, and we want the GPIO and MFGPT drivers to be able to share a PCI device. Instead, we manually scan for the PCI device, request a single region, and keep track of the devices that we're using. */
static int __init cs5535_mfgpt_scan_pci(void)
/* Just like with the cs5535-gpio driver, we can't use the standard PCI driver registration stuff. It only allows only one driver to bind to each PCI device, and we want the GPIO and MFGPT drivers to be able to share a PCI device. Instead, we manually scan for the PCI device, request a single region, and keep track of the devices that we're using. */ static int __init cs5535_mfgpt_scan_pci(void)
{ struct pci_dev *pdev; int err = -ENODEV; int i; for (i = 0; i < ARRAY_SIZE(cs5535_mfgpt_pci_tbl); i++) { pdev = pci_get_device(cs5535_mfgpt_pci_tbl[i].vendor, cs5535_mfgpt_pci_tbl[i].device, NULL); if (pdev) { err = cs5535_mfgpt_probe(pdev, &cs5535_mfgpt_pci_tbl[i]); if (err) pci_dev_put(pdev); break; } } return err; }
robutest/uclinux
C++
GPL-2.0
60
/* param base GDET peripheral base address. return GDET instance. */
static uint32_t GDET_GetInstance(GDET_Type *base)
/* param base GDET peripheral base address. return GDET instance. */ static uint32_t GDET_GetInstance(GDET_Type *base)
{ uint32_t instance; for (instance = 0U; instance < ARRAY_SIZE(s_gdetBases); instance++) { if (s_gdetBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_gdetBases)); return instance; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check whether the input key option is valid. */
BOOLEAN BmIsKeyOptionValid(IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption, IN UINTN KeyOptionSize)
/* Check whether the input key option is valid. */ BOOLEAN BmIsKeyOptionValid(IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption, IN UINTN KeyOptionSize)
{ UINT16 OptionName[BM_OPTION_NAME_LEN]; UINT8 *BootOption; UINTN BootOptionSize; UINT32 Crc; if (BmSizeOfKeyOption (KeyOption) != KeyOptionSize) { return FALSE; } UnicodeSPrint ( OptionName, sizeof (OptionName), L"%s%04x", mBmLoadOptionName[LoadOptionTypeBoot], KeyOption->BootOption ); GetEfiGlobalVariable2 (OptionName, (VOID **)&BootOption, &BootOptionSize); if (BootOption == NULL) { return FALSE; } gBS->CalculateCrc32 (BootOption, BootOptionSize, &Crc); FreePool (BootOption); return (BOOLEAN)(KeyOption->BootOptionCrc == Crc); }
tianocore/edk2
C++
Other
4,240
/* Set the fields of structure stc_tmr4_evt_init_t to default values. */
int32_t TMR4_EVT_StructInit(stc_tmr4_evt_init_t *pstcTmr4EventInit)
/* Set the fields of structure stc_tmr4_evt_init_t to default values. */ int32_t TMR4_EVT_StructInit(stc_tmr4_evt_init_t *pstcTmr4EventInit)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcTmr4EventInit) { pstcTmr4EventInit->u16Mode = TMR4_EVT_MD_CMP; pstcTmr4EventInit->u16CompareValue = 0U; pstcTmr4EventInit->u16OutputEvent = TMR4_EVT_OUTPUT_EVT0; pstcTmr4EventInit->u16MatchCond = 0U; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check whether 'status' is not OK and, if so, prints the error message on the top of the stack. It assumes that the error object is a string, as it was either generated by Lua or by 'msghandler'. */
static int report(lua_State *L, int status)
/* Check whether 'status' is not OK and, if so, prints the error message on the top of the stack. It assumes that the error object is a string, as it was either generated by Lua or by 'msghandler'. */ static int report(lua_State *L, int status)
{ const char *msg = lua_tostring(L, -1); l_message(progname, msg); lua_pop(L, 1); } return status; }
Nicholas3388/LuaNode
C++
Other
1,055
/* llatob(vp,p,base) converts p to binary result in vp, rtn 1 on success */
int llatob(u_quad_t *vp, char *p, int base)
/* llatob(vp,p,base) converts p to binary result in vp, rtn 1 on success */ int llatob(u_quad_t *vp, char *p, int base)
{ if (base == 0) p = _getbase (p, &base); return _atob(vp, p, base); }
Nicholas3388/LuaNode
C++
Other
1,055
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */
void rt_hw_trap_dabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */ void rt_hw_trap_dabt(struct rt_hw_register *regs)
{ rt_kprintf("Data Abort "); rt_hw_show_register(regs); if (rt_thread_self() != RT_NULL) rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name); rt_hw_cpu_shutdown(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully enumerated by the host and is now ready to be used by the application. */
void EVENT_USB_Host_DeviceEnumerationComplete(void)
/* Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully enumerated by the host and is now ready to be used by the application. */ void EVENT_USB_Host_DeviceEnumerationComplete(void)
{ uint16_t ConfigDescriptorSize; uint8_t ConfigDescriptorData[512]; if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) { return; } if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) { return; } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* If it happened, the negative dentry isn't actually negative anymore. So, drop it. */
static int vfat_revalidate_shortname(struct dentry *dentry)
/* If it happened, the negative dentry isn't actually negative anymore. So, drop it. */ static int vfat_revalidate_shortname(struct dentry *dentry)
{ int ret = 1; spin_lock(&dentry->d_lock); if (dentry->d_time != dentry->d_parent->d_inode->i_version) ret = 0; spin_unlock(&dentry->d_lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Start SysTick timer and initialize core and peripheral clocks. */
int32_t timer_start(void)
/* Start SysTick timer and initialize core and peripheral clocks. */ int32_t timer_start(void)
{ if(adi_pwr_Init()!= ADI_PWR_SUCCESS) { printf("\n Failed to initialize the power service \n"); return -1; } if(ADI_PWR_SUCCESS != adi_pwr_SetClockDivider(ADI_CLOCK_HCLK,1)) { printf("Failed to set clock divider for HCLK\n"); return -1; } if(ADI_PWR_SUCCESS != adi_pwr_SetClockDivider(ADI_CLOCK_PCLK,1)) { printf("Failed to set clock divider for PCLK\n"); return -1; } SysTick_Config(26000); return 0; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Configures the TIMx event to be generate by software. */
void RTIM_GenerateEvent(RTIM_TypeDef *TIMx, u32 TIM_EventSource)
/* Configures the TIMx event to be generate by software. */ void RTIM_GenerateEvent(RTIM_TypeDef *TIMx, u32 TIM_EventSource)
{ assert_param(IS_TIM_ALL_TIM(TIMx)); assert_param((IS_HP_TIM_EVENT_SOURCE(TIM_EventSource) || IS_LP_TIM_EVENT_SOURCE(TIM_EventSource))); TIMx->EGR = TIM_EventSource; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* show_bus() - Show devices on a single AXI bus @bus: The AXI bus device to printt information for */
static void show_bus(struct udevice *bus)
/* show_bus() - Show devices on a single AXI bus @bus: The AXI bus device to printt information for */ static void show_bus(struct udevice *bus)
{ struct udevice *dev; printf("Bus %d:\t%s", bus->req_seq, bus->name); if (device_active(bus)) printf(" (active %d)", bus->seq); printf("\n"); for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) printf(" %s\n", dev->name); }
4ms/stm32mp1-baremetal
C++
Other
137
/* open "/proc/fs/afs/cells" which provides a summary of extant cells */
static int afs_proc_cells_open(struct inode *inode, struct file *file)
/* open "/proc/fs/afs/cells" which provides a summary of extant cells */ static int afs_proc_cells_open(struct inode *inode, struct file *file)
{ struct seq_file *m; int ret; ret = seq_open(file, &afs_proc_cells_ops); if (ret < 0) return ret; m = file->private_data; m->private = PDE(inode)->data; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Can be used to emulate code execution time. */
void posix_cpu_hold(uint32_t usec_to_waste)
/* Can be used to emulate code execution time. */ void posix_cpu_hold(uint32_t usec_to_waste)
{ uint64_t time_start; int64_t to_wait = usec_to_waste; while (to_wait > 0) { time_start = hwm_get_time(); hwtimer_wake_in_time(time_start + to_wait); posix_change_cpu_state_and_wait(true); to_wait -= hwm_get_time() - time_start; posix_irq_handler(); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function returns the split between preemptable priority levels and sub-priority levels in the interrupt priority specification. */
uint32_t IntPriorityGroupingGet(void)
/* This function returns the split between preemptable priority levels and sub-priority levels in the interrupt priority specification. */ uint32_t IntPriorityGroupingGet(void)
{ uint32_t ui32Loop, ui32Value; ui32Value = HWREG(NVIC_APINT) & NVIC_APINT_PRIGROUP_M; for(ui32Loop = 0; ui32Loop < NUM_PRIORITY; ui32Loop++) { if(ui32Value == g_pui32Priority[ui32Loop]) { break; } } return(ui32Loop); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read doesn't do much either. (pppd poll us, but ultimately reads through /dev/ppp) */
static ssize_t dev_irnet_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
/* Read doesn't do much either. (pppd poll us, but ultimately reads through /dev/ppp) */ static ssize_t dev_irnet_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{ irnet_socket * ap = (struct irnet_socket *) file->private_data; DPASS(FS_TRACE, "(file=0x%p, ap=0x%p, count=%Zd)\n", file, ap, count); DABORT(ap == NULL, -ENXIO, FS_ERROR, "ap is NULL !!!\n"); if(ap->ppp_open) return -EAGAIN; else return irnet_ctrl_read(ap, file, buf, count); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API is used to calculate the power of given base value. This API is used to calculate the power of 2. */
static int32_t power(int16_t base, uint8_t resolution)
/* This API is used to calculate the power of given base value. This API is used to calculate the power of 2. */ static int32_t power(int16_t base, uint8_t resolution)
{ uint8_t i = 1; int32_t value = 1; for (; i <= resolution; i++) value = (int32_t)(value * base); return value; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* @frba: Flash region list @region_type: Type of region (0..MAX_REGIONS-1) @region: Region information is written here */
static int get_region(struct frba_t *frba, int region_type, struct region_t *region)
/* @frba: Flash region list @region_type: Type of region (0..MAX_REGIONS-1) @region: Region information is written here */ static int get_region(struct frba_t *frba, int region_type, struct region_t *region)
{ if (region_type >= MAX_REGIONS) { fprintf(stderr, "Invalid region type.\n"); return -1; } region->base = FLREG_BASE(frba->flreg[region_type]); region->limit = FLREG_LIMIT(frba->flreg[region_type]); region->size = region->limit - region->base + 1; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Empty queue by removing and destroying all BD's. Free all buffers. 0-fill, but do not free "txq" descriptor structure. */
void iwl_cmd_queue_free(struct iwl_priv *priv)
/* Empty queue by removing and destroying all BD's. Free all buffers. 0-fill, but do not free "txq" descriptor structure. */ void iwl_cmd_queue_free(struct iwl_priv *priv)
{ struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; struct iwl_queue *q = &txq->q; struct pci_dev *dev = priv->pci_dev; int i; if (q->n_bd == 0) return; for (i = 0; i <= TFD_CMD_SLOTS; i++) kfree(txq->cmd[i]); if (txq->q.n_bd) pci_free_consistent(dev, priv->hw_params.tfd_size * txq->q.n_bd, txq->tfds, txq->q.dma_addr); kfree(txq->cmd); kfree(txq->meta); txq->cmd = NULL; txq->meta = NULL; memset(txq, 0, sizeof(*txq)); }
robutest/uclinux
C++
GPL-2.0
60
/* We enforce only one user at a time here with the open/close. Also clear the previous interrupt data on an open, and clean up things on a close. */
static int rtc_open(struct inode *inode, struct file *file)
/* We enforce only one user at a time here with the open/close. Also clear the previous interrupt data on an open, and clean up things on a close. */ static int rtc_open(struct inode *inode, struct file *file)
{ spin_lock_irq(&rtc_lock); if (rtc_status & RTC_IS_OPEN) goto out_busy; rtc_status |= RTC_IS_OPEN; rtc_irq_data = 0; spin_unlock_irq(&rtc_lock); return 0; out_busy: spin_unlock_irq(&rtc_lock); return -EBUSY; }
robutest/uclinux
C++
GPL-2.0
60
/* Search global device list and return pointer to the device of type and num specified. */
struct mtd_device* device_find(u8 type, u8 num)
/* Search global device list and return pointer to the device of type and num specified. */ struct mtd_device* device_find(u8 type, u8 num)
{ struct list_head *entry; struct mtd_device *dev_tmp; list_for_each(entry, &devices) { dev_tmp = list_entry(entry, struct mtd_device, link); if ((dev_tmp->id->type == type) && (dev_tmp->id->num == num)) return dev_tmp; } return NULL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function reads from a local APIC register either in xAPIC or x2APIC mode. It is required that in xAPIC mode wider registers (64-bit or 256-bit) must be accessed using multiple 32-bit loads or stores, so this function only performs 32-bit read. */
UINT32 EFIAPI ReadLocalApicReg(IN UINTN MmioOffset)
/* This function reads from a local APIC register either in xAPIC or x2APIC mode. It is required that in xAPIC mode wider registers (64-bit or 256-bit) must be accessed using multiple 32-bit loads or stores, so this function only performs 32-bit read. */ UINT32 EFIAPI ReadLocalApicReg(IN UINTN MmioOffset)
{ ASSERT ((MmioOffset & 0xf) == 0); ASSERT (GetApicMode () == LOCAL_APIC_MODE_XAPIC); return MmioRead32 (GetLocalApicBaseAddress () + MmioOffset); }
tianocore/edk2
C++
Other
4,240
/* returns: 0 on success Negative error code on failure */
static int overlay_merge(void *fdt, void *fdto)
/* returns: 0 on success Negative error code on failure */ static int overlay_merge(void *fdt, void *fdto)
{ int fragment; fdt_for_each_subnode(fragment, fdto, 0) { int overlay; int target; int ret; overlay = fdt_subnode_offset(fdto, fragment, "__overlay__"); if (overlay == -FDT_ERR_NOTFOUND) continue; if (overlay < 0) return overlay; target = overlay_get_target(fdt, fdto, fragment, NULL); if (target < 0) return target; ret = overlay_apply_node(fdt, target, fdto, overlay); if (ret) return ret; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function relies on all ring buffer implementations having an iio_ring_buffer as their first element. */
int iio_ring_release(struct inode *inode, struct file *filp)
/* This function relies on all ring buffer implementations having an iio_ring_buffer as their first element. */ int iio_ring_release(struct inode *inode, struct file *filp)
{ struct cdev *cd = inode->i_cdev; struct iio_handler *hand = iio_cdev_to_handler(cd); struct iio_ring_buffer *rb = hand->private; clear_bit(IIO_BUSY_BIT_POS, &rb->access_handler.flags); if (rb->access.unmark_in_use) rb->access.unmark_in_use(rb); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function invoked by Systick ISR each 1ms. */
__isr__ void ald_inc_tick(void)
/* This function invoked by Systick ISR each 1ms. */ __isr__ void ald_inc_tick(void)
{ ald_inc_tick_weak(); ald_systick_irq_cbk(); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disable the High Speed APB (APB2) peripheral clock. */
void RCM_DisableAPB2PeriphClock(uint32_t APB2Periph)
/* Disable the High Speed APB (APB2) peripheral clock. */ void RCM_DisableAPB2PeriphClock(uint32_t APB2Periph)
{ RCM->APBCLKEN2 &= (uint32_t)~APB2Periph; }
pikasTech/PikaPython
C++
MIT License
1,403
/* XXX This functionality is not exposed up though API. */
static u32 tsi148_MB_irqhandler(u32 stat)
/* XXX This functionality is not exposed up though API. */ static u32 tsi148_MB_irqhandler(u32 stat)
{ int i; u32 val; u32 serviced = 0; for (i = 0; i < 4; i++) { if(stat & TSI148_LCSR_INTS_MBS[i]) { val = ioread32be(tsi148_bridge->base + TSI148_GCSR_MBOX[i]); printk("VME Mailbox %d received: 0x%x\n", i, val); serviced |= TSI148_LCSR_INTC_MBC[i]; } } return serviced; }
robutest/uclinux
C++
GPL-2.0
60
/* hash_nt_password_hash - HashNtPasswordHash() - RFC 2759, Sect. 8.4 @password_hash: 16-octet PasswordHash (IN) @password_hash_hash: 16-octet PasswordHashHash (OUT) Returns: 0 on success, -1 on failure */
int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash)
/* hash_nt_password_hash - HashNtPasswordHash() - RFC 2759, Sect. 8.4 @password_hash: 16-octet PasswordHash (IN) @password_hash_hash: 16-octet PasswordHashHash (OUT) Returns: 0 on success, -1 on failure */ int hash_nt_password_hash(const u8 *password_hash, u8 *password_hash_hash)
{ size_t len = 16; return md4_vector(1, &password_hash, &len, password_hash_hash); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */
UINT8* GetBufferForValue(IN EFI_HII_VALUE *Value)
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */ UINT8* GetBufferForValue(IN EFI_HII_VALUE *Value)
{ if (Value == NULL) { return NULL; } switch (Value->Type) { case EFI_IFR_TYPE_BUFFER: return Value->Buffer; case EFI_IFR_TYPE_DATE: return (UINT8 *)(&Value->Value.date); case EFI_IFR_TYPE_TIME: return (UINT8 *)(&Value->Value.time); case EFI_IFR_TYPE_REF: return (UINT8 *)(&Value->Value.ref); default: return NULL; } }
tianocore/edk2
C++
Other
4,240
/* Deinitializes the SPIx peripheral registers to their default reset values . */
void SPI_DeInit(SPI_TypeDef *SPIx)
/* Deinitializes the SPIx peripheral registers to their default reset values . */ void SPI_DeInit(SPI_TypeDef *SPIx)
{ assert_param(IS_SPI_ALL_PERIPH(SPIx)); switch (*(uint32_t*)&SPIx) { case SPI1_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE); break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT64 EFIAPI IoBitFieldWrite64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT64 EFIAPI IoBitFieldWrite64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
{ return IoWrite64 ( Port, BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value) ); }
tianocore/edk2
C++
Other
4,240
/* Get capabilities function usually called by Zephyr Ethernet stack. */
static enum ethernet_hw_caps eth_cyclonev_caps(const struct device *dev)
/* Get capabilities function usually called by Zephyr Ethernet stack. */ static enum ethernet_hw_caps eth_cyclonev_caps(const struct device *dev)
{ struct eth_cyclonev_priv *p = dev->data; enum ethernet_hw_caps caps = 0; if (p->feature & EMAC_DMA_HW_FEATURE_MIISEL) { caps |= ETHERNET_LINK_10BASE_T; caps |= ETHERNET_LINK_100BASE_T; } if (p->feature & EMAC_DMA_HW_FEATURE_GMIISEL) { caps |= ETHERNET_LINK_1000BASE_T; } if (p->feature & EMAC_DMA_HW_FEATURE_RXTYP2COE) { caps |= ETHERNET_HW_RX_CHKSUM_OFFLOAD; } if (p->feature & EMAC_DMA_HW_FEATURE_RXTYP1COE) { caps |= ETHERNET_HW_RX_CHKSUM_OFFLOAD; } caps |= ETHERNET_PROMISC_MODE; return caps; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The board info passed can safely be __initdata ... but be careful of any embedded pointers (platform_data, etc), they're copied as-is. */
int __init spi_register_board_info(struct spi_board_info const *info, unsigned n)
/* The board info passed can safely be __initdata ... but be careful of any embedded pointers (platform_data, etc), they're copied as-is. */ int __init spi_register_board_info(struct spi_board_info const *info, unsigned n)
{ struct boardinfo *bi; bi = kmalloc(sizeof(*bi) + n * sizeof *info, GFP_KERNEL); if (!bi) return -ENOMEM; bi->n_board_info = n; memcpy(bi->board_info, info, n * sizeof *info); mutex_lock(&board_lock); list_add_tail(&bi->list, &board_list); mutex_unlock(&board_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* For example: SupportedLang = "engfraengfra" Index = "1" Iso639Language = TRUE The return value is "fra". Another example: SupportedLang = "en;fr;en-US;fr-FR" Index = "1" Iso639Language = FALSE The return value is "fr". */
CHAR8* GetLangFromSupportedLangCodes(IN CHAR8 *SupportedLang, IN UINTN Index, IN BOOLEAN Iso639Language)
/* For example: SupportedLang = "engfraengfra" Index = "1" Iso639Language = TRUE The return value is "fra". Another example: SupportedLang = "en;fr;en-US;fr-FR" Index = "1" Iso639Language = FALSE The return value is "fr". */ CHAR8* GetLangFromSupportedLangCodes(IN CHAR8 *SupportedLang, IN UINTN Index, IN BOOLEAN Iso639Language)
{ UINTN SubIndex; UINTN CompareLength; CHAR8 *Supported; SubIndex = 0; Supported = SupportedLang; if (Iso639Language) { CompareLength = ISO_639_2_ENTRY_SIZE; mVariableModuleGlobal->Lang[CompareLength] = '\0'; return CopyMem (mVariableModuleGlobal->Lang, SupportedLang + Index * CompareLength, CompareLength); } else { while (TRUE) { for (CompareLength = 0; *Supported != ';' && *Supported != '\0'; CompareLength++) { Supported++; } if ((*Supported == '\0') && (SubIndex != Index)) { ASSERT (FALSE); return NULL; } if (SubIndex == Index) { mVariableModuleGlobal->PlatformLang[CompareLength] = '\0'; return CopyMem (mVariableModuleGlobal->PlatformLang, Supported - CompareLength, CompareLength); } SubIndex++; for ( ; *Supported != '\0' && *Supported == ';'; Supported++) { } } } }
tianocore/edk2
C++
Other
4,240
/* Load SERCOM registers to init for SPI slave mode The settings will be applied with default slave mode, unsupported things are ignored. */
static void _spi_load_regs_slave(void *const hw, const struct sercomspi_regs_cfg *regs)
/* Load SERCOM registers to init for SPI slave mode The settings will be applied with default slave mode, unsupported things are ignored. */ static void _spi_load_regs_slave(void *const hw, const struct sercomspi_regs_cfg *regs)
{ ASSERT(hw && regs); hri_sercomspi_write_CTRLA_reg( hw, regs->ctrla & ~(SERCOM_SPI_CTRLA_IBON | SERCOM_SPI_CTRLA_ENABLE | SERCOM_SPI_CTRLA_SWRST)); hri_sercomspi_write_CTRLB_reg(hw, (regs->ctrlb & ~(SERCOM_SPI_CTRLB_MSSEN)) | (SERCOM_SPI_CTRLB_RXEN | SERCOM_SPI_CTRLB_SSDE | SERCOM_SPI_CTRLB_PLOADEN)); hri_sercomspi_write_ADDR_reg(hw, regs->addr); hri_sercomspi_write_DBGCTRL_reg(hw, regs->dbgctrl); while (hri_sercomspi_is_syncing(hw, 0xFFFFFFFF)) ; }
eclipse-threadx/getting-started
C++
Other
310
/* Check that the last event is equal to the last passed event. */
uint8_t I2C_ReadEventStatus(I2C_T *i2c, I2C_EVENT_T i2cEvent)
/* Check that the last event is equal to the last passed event. */ uint8_t I2C_ReadEventStatus(I2C_T *i2c, I2C_EVENT_T i2cEvent)
{ uint32_t lastevent = 0; uint32_t flag1 = 0, flag2 = 0; flag1 = i2c->STS1 & 0x0000FFFF; flag2 = i2c->STS2 & 0x0000FFFF; flag2 = flag2 << 16; lastevent = (flag1 | flag2) & 0x00FFFFFF; if((lastevent & i2cEvent) == i2cEvent) { return SUCCESS; } return ERROR; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Setup the driver for use and register it with the eth layer */
int ne2k_register(void)
/* Setup the driver for use and register it with the eth layer */ int ne2k_register(void)
{ struct eth_device *dev; dev = calloc(sizeof(*dev), 1); if (dev == NULL) return -1; if (ne2k_setup_driver(dev)) return -1; dev->init = ne2k_init; dev->halt = ne2k_halt; dev->send = ne2k_send; dev->recv = ne2k_recv; strcpy(dev->name, "NE2000"); return eth_register(dev); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enable or disable write protect of MATRIX registers. */
void matrix_set_writeprotect(uint32_t ul_enable)
/* Enable or disable write protect of MATRIX registers. */ void matrix_set_writeprotect(uint32_t ul_enable)
{ Matrix *p_matrix = MATRIX; if (ul_enable) { p_matrix->MATRIX_WPMR = MATRIX_WPMR_WPKEY_PASSWD | MATRIX_WPMR_WPEN; } else { p_matrix->MATRIX_WPMR = MATRIX_WPMR_WPKEY_PASSWD; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Initialization function for the floating-point transposed direct form II Biquad cascade filter. Then, the initialization can be done with: */
void arm_biquad_cascade_df2T_init_f32(arm_biquad_cascade_df2T_instance_f32 *S, uint8_t numStages, const float32_t *pCoeffs, float32_t *pState)
/* Initialization function for the floating-point transposed direct form II Biquad cascade filter. Then, the initialization can be done with: */ void arm_biquad_cascade_df2T_init_f32(arm_biquad_cascade_df2T_instance_f32 *S, uint8_t numStages, const float32_t *pCoeffs, float32_t *pState)
{ S->numStages = numStages; S->pCoeffs = pCoeffs; memset(pState, 0, (2U * (uint32_t) numStages) * sizeof(float32_t)); S->pState = pState; }
pikasTech/PikaPython
C++
MIT License
1,403
/* During taskmangement request, we need to freeze the device queue. */
void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
/* During taskmangement request, we need to freeze the device queue. */ void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
{ struct MPT2SAS_DEVICE *sas_device_priv_data; struct scsi_device *sdev; u8 skip = 0; shost_for_each_device(sdev, ioc->shost) { if (skip) continue; sas_device_priv_data = sdev->hostdata; if (!sas_device_priv_data) continue; if (sas_device_priv_data->sas_target->handle == handle) { sas_device_priv_data->sas_target->tm_busy = 0; skip = 1; ioc->ignore_loginfos = 0; } } }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is called to allocate an "extent free done" log item that will hold nextents worth of extents. The caller must use all nextents extents, because we are not flexible about this at all. */
xfs_efd_log_item_t* xfs_trans_get_efd(xfs_trans_t *tp, xfs_efi_log_item_t *efip, uint nextents)
/* This routine is called to allocate an "extent free done" log item that will hold nextents worth of extents. The caller must use all nextents extents, because we are not flexible about this at all. */ xfs_efd_log_item_t* xfs_trans_get_efd(xfs_trans_t *tp, xfs_efi_log_item_t *efip, uint nextents)
{ xfs_efd_log_item_t *efdp; ASSERT(tp != NULL); ASSERT(nextents > 0); efdp = xfs_efd_init(tp->t_mountp, efip, nextents); ASSERT(efdp != NULL); (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efdp); return (efdp); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if we should update i_disksize when write to the end of file but not require block allocation */
static int ext4_da_should_update_i_disksize(struct page *page, unsigned long offset)
/* Check if we should update i_disksize when write to the end of file but not require block allocation */ static int ext4_da_should_update_i_disksize(struct page *page, unsigned long offset)
{ struct buffer_head *bh; struct inode *inode = page->mapping->host; unsigned int idx; int i; bh = page_buffers(page); idx = offset >> inode->i_blkbits; for (i = 0; i < idx; i++) bh = bh->b_this_page; if (!buffer_mapped(bh) || (buffer_delay(bh)) || buffer_unwritten(bh)) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* handle HDIO_SET_PIO_MODE ioctl abusers here, eventually it will go away */
static int set_pio_mode_abuse(ide_hwif_t *hwif, u8 req_pio)
/* handle HDIO_SET_PIO_MODE ioctl abusers here, eventually it will go away */ static int set_pio_mode_abuse(ide_hwif_t *hwif, u8 req_pio)
{ switch (req_pio) { case 202: case 201: case 200: case 102: case 101: case 100: return (hwif->host_flags & IDE_HFLAG_ABUSE_DMA_MODES) ? 1 : 0; case 9: case 8: return (hwif->host_flags & IDE_HFLAG_ABUSE_PREFETCH) ? 1 : 0; case 7: case 6: return (hwif->host_flags & IDE_HFLAG_ABUSE_FAST_DEVSEL) ? 1 : 0; default: return 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Writes firmware data to the specified file using the firmware file parser that was specified during the initialization of this module. */
LIBOPENBLT_EXPORT uint32_t BltFirmwareSaveToFile(char const *firmwareFile)
/* Writes firmware data to the specified file using the firmware file parser that was specified during the initialization of this module. */ LIBOPENBLT_EXPORT uint32_t BltFirmwareSaveToFile(char const *firmwareFile)
{ uint32_t result = BLT_RESULT_ERROR_GENERIC; assert(firmwareFile != NULL); if (firmwareFile != NULL) { if (FirmwareSaveToFile(firmwareFile)) { result = BLT_RESULT_OK; } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns 0 on success, -1 in error cases */
int set_option_parameter_int(QEMUOptionParameter *list, const char *name, uint64_t value)
/* Returns 0 on success, -1 in error cases */ int set_option_parameter_int(QEMUOptionParameter *list, const char *name, uint64_t value)
{ list = get_option_parameter(list, name); if (list == NULL) { fprintf(stderr, "Unknown option '%s'\n", name); return -1; } switch (list->type) { case OPT_FLAG: case OPT_NUMBER: case OPT_SIZE: list->value.n = value; break; default: return -1; } list->assigned = true; return 0; }
ve3wwg/teensy3_qemu
C++
Other
15
/* brief Reusable routine to handle master interrupts. note This function does not need to be called unless you are reimplementing the nonblocking API's interrupt handler routines to add special functionality. param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. */
void I2C_MasterTransferHandleIRQ(I2C_Type *base, i2c_master_handle_t *handle)
/* brief Reusable routine to handle master interrupts. note This function does not need to be called unless you are reimplementing the nonblocking API's interrupt handler routines to add special functionality. param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. */ void I2C_MasterTransferHandleIRQ(I2C_Type *base, i2c_master_handle_t *handle)
{ bool isDone; status_t result; if (NULL == handle) { return; } result = I2C_RunTransferStateMachine(base, handle, &isDone); if ((result != kStatus_Success) || isDone) { handle->state = (uint8_t)kIdleState; I2C_DisableInterrupts(base, (uint32_t)kI2C_MasterIrqFlags); if (handle->completionCallback != NULL) { handle->completionCallback(base, handle, result, handle->userData); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the WINC3400 device name which is used as P2P device name. */
NMI_API sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength)
/* Set the WINC3400 device name which is used as P2P device name. */ NMI_API sint8 m2m_wifi_set_device_name(uint8 *pu8DeviceName, uint8 u8DeviceNameLength)
{ tstrM2MDeviceNameConfig strDeviceName; if(u8DeviceNameLength >= M2M_DEVICE_NAME_MAX) { u8DeviceNameLength = M2M_DEVICE_NAME_MAX; } u8DeviceNameLength ++; m2m_memcpy(strDeviceName.au8DeviceName, pu8DeviceName, u8DeviceNameLength); return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_DEVICE_NAME, (uint8*)&strDeviceName, sizeof(tstrM2MDeviceNameConfig), NULL, 0,0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Draws a string located in program memory to the display. Using program memory for constant strings will reduce the applications need for RAM, and thus lower the overall size footprint. */
void gfx_mono_draw_progmem_string(char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font)
/* Draws a string located in program memory to the display. Using program memory for constant strings will reduce the applications need for RAM, and thus lower the overall size footprint. */ void gfx_mono_draw_progmem_string(char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font)
{ char temp_char; Assert(str != NULL); Assert(font != NULL); const gfx_coord_t start_of_string_position_x = x; temp_char = PROGMEM_READ_BYTE((uint8_t PROGMEM_PTR_T)str); while (temp_char) { if (temp_char == '\n') { x = start_of_string_position_x; y += font->height + 1; } else if (temp_char == '\r') { } else { gfx_mono_draw_char(temp_char, x, y, font); x += font->width; } temp_char = PROGMEM_READ_BYTE((uint8_t PROGMEM_PTR_T)(++str)); } }
memfault/zero-to-main
C++
null
200
/* Attribute read call back for the Value V2 attribute. */
static ssize_t read_value_v2_5(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 V2 attribute. */ static ssize_t read_value_v2_5(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_v2_5_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Create a TCP segment usable for passing to tcp_input */
struct pbuf* tcp_create_segment(ip_addr_t *src_ip, ip_addr_t *dst_ip, u16_t src_port, u16_t dst_port, void *data, size_t data_len, u32_t seqno, u32_t ackno, u8_t headerflags)
/* Create a TCP segment usable for passing to tcp_input */ struct pbuf* tcp_create_segment(ip_addr_t *src_ip, ip_addr_t *dst_ip, u16_t src_port, u16_t dst_port, void *data, size_t data_len, u32_t seqno, u32_t ackno, u8_t headerflags)
{ return tcp_create_segment_wnd(src_ip, dst_ip, src_port, dst_port, data, data_len, seqno, ackno, headerflags, TCP_WND); }
ua1arn/hftrx
C++
null
69
/* This function is called to determine whether the BSP is compatible with the supplied device-tree, which is assumed to be the correct one for the actual board. It is expected thati, in the future, a kernel may support multiple boards. */
static int __init gef_ppc9a_probe(void)
/* This function is called to determine whether the BSP is compatible with the supplied device-tree, which is assumed to be the correct one for the actual board. It is expected thati, in the future, a kernel may support multiple boards. */ static int __init gef_ppc9a_probe(void)
{ unsigned long root = of_get_flat_dt_root(); if (of_flat_dt_is_compatible(root, "gef,ppc9a")) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads and returns the current value of performance counter specified by Index. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadPmc(IN UINT32 Index)
/* Reads and returns the current value of performance counter specified by Index. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadPmc(IN UINT32 Index)
{ UINT64 Data; __asm__ __volatile__ ( "rdpmc" : "=A" (Data) : "c" (Index) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure. */
void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
/* This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure. */ void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
{ assert(slaveConfig != NULL); (void)memset(slaveConfig, 0, sizeof(*slaveConfig)); slaveConfig->bitsPerFrame = 8; slaveConfig->cpol = kLPSPI_ClockPolarityActiveHigh; slaveConfig->cpha = kLPSPI_ClockPhaseFirstEdge; slaveConfig->direction = kLPSPI_MsbFirst; slaveConfig->whichPcs = kLPSPI_Pcs0; slaveConfig->pcsActiveHighOrLow = kLPSPI_PcsActiveLow; slaveConfig->pinCfg = kLPSPI_SdiInSdoOut; slaveConfig->dataOutConfig = kLpspiDataOutRetained; }
eclipse-threadx/getting-started
C++
Other
310
/* s e t u p Q P d a t a */
returnValue QProblem_setupQPdata(QProblem *_THIS, real_t *const _H, const real_t *const _g, real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA)
/* s e t u p Q P d a t a */ returnValue QProblem_setupQPdata(QProblem *_THIS, real_t *const _H, const real_t *const _g, real_t *const _A, const real_t *const _lb, const real_t *const _ub, const real_t *const _lbA, const real_t *const _ubA)
{ int nC = QProblem_getNC( _THIS ); if ( QProblemBCPY_setupQPdata( _THIS,_H,_g,_lb,_ub ) != SUCCESSFUL_RETURN ) return THROWERROR( RET_INVALID_ARGUMENTS ); if ( ( nC > 0 ) && ( _A == 0 ) ) return THROWERROR( RET_INVALID_ARGUMENTS ); if ( nC > 0 ) { QProblem_setLBA( _THIS,_lbA ); QProblem_setUBA( _THIS,_ubA ); QProblem_setA( _THIS,_A ); } else { DenseMatrixCON( _THIS->A, 0,0,0, 0 ); } return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* The WatchDog Timer(WDT) default IRQ, declared in start up code. */
void WDTIntHandler(void)
/* The WatchDog Timer(WDT) default IRQ, declared in start up code. */ void WDTIntHandler(void)
{ xHWREG(WDT_WTCR) |= WDT_WTCR_WTIF; if (g_pfnWATCHDOGHandlerCallbacks[0] != 0) { g_pfnWATCHDOGHandlerCallbacks[0](0, 0, 0, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to the device from the USB host before passing along unhandled control requests to the library for processing internally. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to the device from the USB host before passing along unhandled control requests to the library for processing internally. */ void EVENT_USB_Device_ControlRequest(void)
{ switch (USB_ControlRequest.bRequest) { case HID_REQ_GetReport: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { USB_JoystickReport_Data_t JoystickReportData; GetNextReport(&JoystickReportData); Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData)); Endpoint_ClearOUT(); } break; } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return values: 0 No character received 1 Character has been received */
int uart_getchar_present(UART_MemMapPtr channel)
/* Return values: 0 No character received 1 Character has been received */ int uart_getchar_present(UART_MemMapPtr channel)
{ return (UART_S1_REG(channel) & UART_S1_RDRF_MASK); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Find image record according to image base and size. */
IMAGE_PROPERTIES_RECORD* EFIAPI FindImageRecord(IN EFI_PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize, IN LIST_ENTRY *ImageRecordList)
/* Find image record according to image base and size. */ IMAGE_PROPERTIES_RECORD* EFIAPI FindImageRecord(IN EFI_PHYSICAL_ADDRESS ImageBase, IN UINT64 ImageSize, IN LIST_ENTRY *ImageRecordList)
{ IMAGE_PROPERTIES_RECORD *ImageRecord; LIST_ENTRY *ImageRecordLink; if (ImageRecordList == NULL) { return NULL; } for (ImageRecordLink = ImageRecordList->ForwardLink; ImageRecordLink != ImageRecordList; ImageRecordLink = ImageRecordLink->ForwardLink) { ImageRecord = CR ( ImageRecordLink, IMAGE_PROPERTIES_RECORD, Link, IMAGE_PROPERTIES_RECORD_SIGNATURE ); if ((ImageBase == ImageRecord->ImageBase) && (ImageSize == ImageRecord->ImageSize)) { return ImageRecord; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* For IRQ based systems these callbacks can be used */
int notifier_add_irq(struct hvc_struct *hp, int irq)
/* For IRQ based systems these callbacks can be used */ int notifier_add_irq(struct hvc_struct *hp, int irq)
{ int rc; if (!irq) { hp->irq_requested = 0; return 0; } rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp); if (!rc) hp->irq_requested = 1; return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the initialization flag. Requires unlocking backup domain write protection (PWR_CR_DBP) */
void rtc_set_init_flag(void)
/* Sets the initialization flag. Requires unlocking backup domain write protection (PWR_CR_DBP) */ void rtc_set_init_flag(void)
{ RTC_ISR |= RTC_ISR_INIT; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* (From original checkin message: The funneled GUI mini API. A very reduced set of gui ops (by now just a text window) that can be funneled to dissectors (even plugins) via epan. */
void register_tap_listener_gtkfunnel(void)
/* (From original checkin message: The funneled GUI mini API. A very reduced set of gui ops (by now just a text window) that can be funneled to dissectors (even plugins) via epan. */ void register_tap_listener_gtkfunnel(void)
{ funnel_register_all_menus(register_menu_cb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This service enables PEIMs to ascertain the present value of the boot mode. */
EFI_STATUS EFIAPI PeiServicesGetBootMode(OUT EFI_BOOT_MODE *BootMode)
/* This service enables PEIMs to ascertain the present value of the boot mode. */ EFI_STATUS EFIAPI PeiServicesGetBootMode(OUT EFI_BOOT_MODE *BootMode)
{ CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->GetBootMode (PeiServices, BootMode); }
tianocore/edk2
C++
Other
4,240
/* Disable all the interrupts. Disables all DMA interrupts. */
void synopGMAC_disable_interrupt_all(synopGMACdevice *gmacdev)
/* Disable all the interrupts. Disables all DMA interrupts. */ void synopGMAC_disable_interrupt_all(synopGMACdevice *gmacdev)
{ synopGMACWriteReg(gmacdev->DmaBase, DmaInterrupt, DmaIntDisable); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* During commit, the orphans being committed cannot be deleted, so they are marked for deletion and deleted by this function. Also, the recovery adds killed orphans to the deletion list, and therefore they are deleted here too. */
static void erase_deleted(struct ubifs_info *c)
/* During commit, the orphans being committed cannot be deleted, so they are marked for deletion and deleted by this function. Also, the recovery adds killed orphans to the deletion list, and therefore they are deleted here too. */ static void erase_deleted(struct ubifs_info *c)
{ struct ubifs_orphan *orphan, *dnext; spin_lock(&c->orphan_lock); dnext = c->orph_dnext; while (dnext) { orphan = dnext; dnext = orphan->dnext; ubifs_assert(!orphan->new); rb_erase(&orphan->rb, &c->orph_tree); list_del(&orphan->list); c->tot_orphans -= 1; dbg_gen("deleting orphan ino %lu", (unsigned long)orphan->inum); kfree(orphan); } c->orph_dnext = NULL; spin_unlock(&c->orphan_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Direct Addressing - the slave address forms the control information (command type, bank, block, and page address). The slave data is the actual data to be transferred. This mode requires 28 bits of address region allocated. */
static u32 denali_direct_read(struct denali_nand_info *denali, u32 addr)
/* Direct Addressing - the slave address forms the control information (command type, bank, block, and page address). The slave data is the actual data to be transferred. This mode requires 28 bits of address region allocated. */ static u32 denali_direct_read(struct denali_nand_info *denali, u32 addr)
{ return ioread32(denali->host + addr); }
4ms/stm32mp1-baremetal
C++
Other
137
/* USB Device HID Get Protocol Request Callback Called automatically on USB Device HID Get Protocol Request Parameters: None Return Value: TRUE - Success, FALSE - Error */
BOOL USBD_HID_GetProtocol(void)
/* USB Device HID Get Protocol Request Callback Called automatically on USB Device HID Get Protocol Request Parameters: None Return Value: TRUE - Success, FALSE - Error */ BOOL USBD_HID_GetProtocol(void)
{ USBD_EP0Buf[0] = usbd_hid_get_protocol(); return (__TRUE); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Requests a uDMA channel to start a transfer. */
void uDMAChannelRequest(uint32_t ui32ChannelNum)
/* Requests a uDMA channel to start a transfer. */ void uDMAChannelRequest(uint32_t ui32ChannelNum)
{ ASSERT((ui32ChannelNum & 0xffff) < 32); HWREG(UDMA_SWREQ) = 1 << (ui32ChannelNum & 0x1f); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Reenable CMCI on this CPU in case a CPU down failed. */
void cmci_reenable(void)
/* Reenable CMCI on this CPU in case a CPU down failed. */ void cmci_reenable(void)
{ int banks; if (cmci_supported(&banks)) cmci_discover(banks, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 0 if current has the requested access, error code otherwise */
static int smack_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg, int msqflg)
/* Returns 0 if current has the requested access, error code otherwise */ static int smack_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg, int msqflg)
{ int may; may = smack_flags_to_may(msqflg); return smk_curacc_msq(msq, may); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Send packet for the registered interface Called by oonf_api to send packet over the configured socket */
static void write_packet(struct rfc5444_writer *wr __attribute__((unused)), struct rfc5444_writer_target *iface __attribute__((unused)), void *buffer, size_t length)
/* Send packet for the registered interface Called by oonf_api to send packet over the configured socket */ static void write_packet(struct rfc5444_writer *wr __attribute__((unused)), struct rfc5444_writer_target *iface __attribute__((unused)), void *buffer, size_t length)
{ ipv6_addr_t src, dst = IPV6_ADDR_ALL_NODES_LINK_LOCAL; uint16_t sport, dport = MANET_PORT; conn_udp_getlocaladdr(&conn, &src, &sport); conn_udp_sendto(buffer, length, &src, sizeof(src), &dst, sizeof(dst), AF_INET, sport, dport); }
labapart/polymcu
C++
null
201
/* Wake the queue up after commonly encountered transmit failure conditions are hopefully over. Currently only tlabel exhaustion is accounted for. */
static void ether1394_wake_queue(struct work_struct *work)
/* Wake the queue up after commonly encountered transmit failure conditions are hopefully over. Currently only tlabel exhaustion is accounted for. */ static void ether1394_wake_queue(struct work_struct *work)
{ struct eth1394_priv *priv; struct hpsb_packet *packet; priv = container_of(work, struct eth1394_priv, wake); packet = hpsb_alloc_packet(0); if (!packet) goto out; packet->host = priv->host; packet->node_id = priv->wake_node; if (hpsb_get_tlabel(packet) == 0) hpsb_free_tlabel(packet); hpsb_free_packet(packet); out: netif_wake_queue(priv->wake_dev); }
robutest/uclinux
C++
GPL-2.0
60
/* deinitialize interface by freeing host channels allocated to interface */
void usbh_msc_itf_deinit(usbh_host *uhost)
/* deinitialize interface by freeing host channels allocated to interface */ void usbh_msc_itf_deinit(usbh_host *uhost)
{ usbh_msc_handler *msc = (usbh_msc_handler *)uhost->active_class->class_data; if (msc->pipe_out) { usb_pipe_halt (uhost->data, msc->pipe_out); usbh_pipe_free (uhost->data, msc->pipe_out); msc->pipe_out = 0U; } if (msc->pipe_in) { usb_pipe_halt (uhost->data, msc->pipe_in); usbh_pipe_free (uhost->data, msc->pipe_in); msc->pipe_in = 0U; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Do the capability checks, and require read and write. */
static int smack_ptrace_traceme(struct task_struct *ptp)
/* Do the capability checks, and require read and write. */ static int smack_ptrace_traceme(struct task_struct *ptp)
{ int rc; struct smk_audit_info ad; char *sp, *tsp; rc = cap_ptrace_traceme(ptp); if (rc != 0) return rc; smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK); smk_ad_setfield_u_tsk(&ad, ptp); sp = current_security(); tsp = task_security(ptp); rc = smk_access(tsp, sp, MAY_READWRITE, NULL); if (rc != 0 && has_capability(ptp, CAP_MAC_OVERRIDE)) rc = 0; smack_log(tsp, sp, MAY_READWRITE, rc, &ad); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base PDM base pointer param handle Pointer to the pdm_handle_t structure which stores the transfer state. param xfer Pointer to the pdm_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_PDM_Busy Previous receive still not finished. */
status_t PDM_TransferReceiveNonBlocking(PDM_Type *base, pdm_handle_t *handle, pdm_transfer_t *xfer)
/* param base PDM base pointer param handle Pointer to the pdm_handle_t structure which stores the transfer state. param xfer Pointer to the pdm_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_PDM_Busy Previous receive still not finished. */ status_t PDM_TransferReceiveNonBlocking(PDM_Type *base, pdm_handle_t *handle, pdm_transfer_t *xfer)
{ assert(handle != NULL); if (handle->pdmQueue[handle->queueUser].data != NULL) { return kStatus_PDM_QueueFull; } handle->transferSize[handle->queueUser] = xfer->dataSize; handle->pdmQueue[handle->queueUser].data = xfer->data; handle->pdmQueue[handle->queueUser].dataSize = xfer->dataSize; handle->queueUser = (handle->queueUser + 1U) % PDM_XFER_QUEUE_SIZE; handle->state = kStatus_PDM_Busy; PDM_EnableInterrupts(base, (uint32_t)kPDM_FIFOInterruptEnable); PDM_Enable(base, true); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535