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
/* Add a DMA transfer descriptor to a DMA resource. This function will add a DMA transfer descriptor to a DMA resource. If there was a transfer descriptor already allocated to the DMA resource, the descriptor will be linked to the next descriptor address. */
enum status_code dma_add_descriptor(struct dma_resource *resource, DmacDescriptor *descriptor)
/* Add a DMA transfer descriptor to a DMA resource. This function will add a DMA transfer descriptor to a DMA resource. If there was a transfer descriptor already allocated to the DMA resource, the descriptor will be linked to the next descriptor address. */ enum status_code dma_add_descriptor(struct dma_resource *res...
{ DmacDescriptor* desc = resource->descriptor; if (resource->job_status == STATUS_BUSY) { return STATUS_BUSY; } if (desc == NULL) { resource->descriptor = descriptor; } else { while(desc->DESCADDR.reg != 0) { desc = (DmacDescriptor*)(desc->DESCADDR.reg); } desc->DESCADDR.reg = (uint32_t)descriptor; }...
memfault/zero-to-main
C++
null
200
/* brief Initialize the SAI TX BCLK to given frequency. return Nothing */
void CLOCK_SetupSaiTxBclk(uint32_t id, uint32_t iFreq)
/* brief Initialize the SAI TX BCLK to given frequency. return Nothing */ void CLOCK_SetupSaiTxBclk(uint32_t id, uint32_t iFreq)
{ s_Sai_Tx_Bclk_Freq[id] = iFreq; return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: (transfer full): The newly allocated password object */
GTlsPassword* g_tls_password_new(GTlsPasswordFlags flags, const gchar *description)
/* Returns: (transfer full): The newly allocated password object */ GTlsPassword* g_tls_password_new(GTlsPasswordFlags flags, const gchar *description)
{ return g_object_new (G_TYPE_TLS_PASSWORD, "flags", flags, "description", description, NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Packs unsigned 8 bit value to the buffer at the offset requested. */
static int pack_uint8(uint8_t val, struct buf_ctx *buf)
/* Packs unsigned 8 bit value to the buffer at the offset requested. */ static int pack_uint8(uint8_t val, struct buf_ctx *buf)
{ if ((buf->end - buf->cur) < sizeof(uint8_t)) { return -ENOMEM; } NET_DBG(">> val:%02x cur:%p, end:%p", val, (void *)buf->cur, (void *)buf->end); *(buf->cur++) = val; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the minimum packet size used in rate computations of HTB class. */
void rtnl_htb_set_mpu(struct rtnl_class *class, uint8_t mpu)
/* Set the minimum packet size used in rate computations of HTB class. */ void rtnl_htb_set_mpu(struct rtnl_class *class, uint8_t mpu)
{ struct rtnl_htb_class *d = htb_class(class); if (d == NULL) return; d->ch_mpu = mpu; d->ch_mask |= SCH_HTB_HAS_MPU; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* finish the initialization of the per-blade control structures */
static void __init uv_table_bases_finish(int blade, struct bau_control *bau_tablesp, struct bau_desc *adp)
/* finish the initialization of the per-blade control structures */ static void __init uv_table_bases_finish(int blade, struct bau_control *bau_tablesp, struct bau_desc *adp)
{ struct bau_control *bcp; int cpu; for_each_present_cpu(cpu) { if (blade != uv_cpu_to_blade_id(cpu)) continue; bcp = (struct bau_control *)&per_cpu(bau_control, cpu); bcp->bau_msg_head = bau_tablesp->va_queue_first; bcp->va_queue_first = bau_tablesp->va_queue_first; bcp->va_queue_last = bau_tablesp->va...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Activate a resource after the hardware has been made aware of it. Set tye destroy function to @destroy. Typically this frees the resource and destroys the hardware resources associated with it. Activate basically means that the function vmw_resource_lookup will find it. */
static void vmw_resource_activate(struct vmw_resource *res, void(*hw_destroy)(struct vmw_resource *))
/* Activate a resource after the hardware has been made aware of it. Set tye destroy function to @destroy. Typically this frees the resource and destroys the hardware resources associated with it. Activate basically means that the function vmw_resource_lookup will find it. */ static void vmw_resource_activate(struct v...
{ struct vmw_private *dev_priv = res->dev_priv; write_lock(&dev_priv->resource_lock); res->avail = true; res->hw_destroy = hw_destroy; write_unlock(&dev_priv->resource_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the CPU implements the Trace Buffer Extension. */
BOOLEAN EFIAPI ArmHasTrbe(VOID)
/* Checks whether the CPU implements the Trace Buffer Extension. */ BOOLEAN EFIAPI ArmHasTrbe(VOID)
{ return ((ArmReadIdAA64Dfr0 () & AARCH64_DFR0_TRBE) != 0); }
tianocore/edk2
C++
Other
4,240
/* If ListHead is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
/* If ListHead is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */ BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
{ ASSERT (InternalBaseLibIsListValid (ListHead)); return (BOOLEAN)(ListHead->ForwardLink == ListHead); }
tianocore/edk2
C++
Other
4,240
/* Send data with special length in slave mode through the USIx peripheral. */
void USI_I2C_SlaveWrite(USI_TypeDef *USIx, u8 *pBuf, u8 len)
/* Send data with special length in slave mode through the USIx peripheral. */ void USI_I2C_SlaveWrite(USI_TypeDef *USIx, u8 *pBuf, u8 len)
{ u8 cnt = 0; assert_param(IS_USI_I2C_ALL_PERIPH(USIx)); for(cnt = 0; cnt < len; cnt++) { while((USI_I2C_GetRawINT(USIx) & USI_I2C_RD_REQ_RSTS) == 0); if (USI_I2C_SLAVEWRITE_PATCH) { USIx->INTERRUPT_STATUS_CLR = USI_I2C_RD_REQ_CLR; } while((USI_I2C_CheckTXFIFOState(USIx, USI_TXFIFO_ALMOST_EMPTY_COPY)) ==...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Calculates the bitpool size for a given frame length */
OI_UINT16 OI_CODEC_SBC_CalculateBitpool(OI_CODEC_SBC_FRAME_INFO *frame, OI_UINT16 frameLen)
/* Calculates the bitpool size for a given frame length */ OI_UINT16 OI_CODEC_SBC_CalculateBitpool(OI_CODEC_SBC_FRAME_INFO *frame, OI_UINT16 frameLen)
{ OI_UINT16 nrof_subbands = frame->nrof_subbands; OI_UINT16 nrof_blocks = frame->nrof_blocks; OI_UINT16 hdr; OI_UINT16 bits; if(frame->mode == SBC_JOINT_STEREO) { hdr = 9 * nrof_subbands; } else { if(frame->mode == SBC_MONO) { hdr = 4 * nrof_subban...
Nicholas3388/LuaNode
C++
Other
1,055
/* Name: ddr3_tip_a38x_get_freq_config. Desc: Args: Notes: Returns: MV_OK if success, other error code if fail. */
static int ddr3_tip_a38x_get_freq_config(u8 dev_num, enum mv_ddr_freq freq, struct hws_tip_freq_config_info *freq_config_info)
/* Name: ddr3_tip_a38x_get_freq_config. Desc: Args: Notes: Returns: MV_OK if success, other error code if fail. */ static int ddr3_tip_a38x_get_freq_config(u8 dev_num, enum mv_ddr_freq freq, struct hws_tip_freq_config_info *freq_config_info)
{ if (a38x_bw_per_freq[freq] == 0xff) return MV_NOT_SUPPORTED; if (freq_config_info == NULL) return MV_BAD_PARAM; freq_config_info->bw_per_freq = a38x_bw_per_freq[freq]; freq_config_info->rate_per_freq = a38x_rate_per_freq[freq]; freq_config_info->is_supported = 1; return MV_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Marvell Alaska PHY link status polling function Link status polling function for the Marvell Alaska PHY series. */
static uint8_t phy_xlnx_gem_marvell_alaska_poll_lsts(const struct device *dev)
/* Marvell Alaska PHY link status polling function Link status polling function for the Marvell Alaska PHY series. */ static uint8_t phy_xlnx_gem_marvell_alaska_poll_lsts(const struct device *dev)
{ const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config; struct eth_xlnx_gem_dev_data *dev_data = dev->data; uint16_t phy_data; phy_data = phy_xlnx_gem_mdio_read(dev_conf->base_addr, dev_data->phy_addr, PHY_MRVL_COPPER_STATUS_REGISTER); return ((phy_data >> PHY_MRVL_COPPER_LINK_STATUS_BIT_SHIFT) & 0x000...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Message: SetRingerMessage Opcode: 0x0085 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_SetRingerMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: SetRingerMessage Opcode: 0x0085 Type: CallControl Direction: pbx2dev VarLength: no */ static void handle_SetRingerMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_ringMode, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_ringDuration, 4, ENC_LITTLE_ENDIAN); si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN); si->callId = tvb...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 1 if a complete packet is available, 0 if not, -EOPNOTSUPP for IN ep. */
static int epout_has_pkt(struct pxa_ep *ep)
/* Returns 1 if a complete packet is available, 0 if not, -EOPNOTSUPP for IN ep. */ static int epout_has_pkt(struct pxa_ep *ep)
{ if (!is_ep0(ep) && ep->dir_in) return -EOPNOTSUPP; if (is_ep0(ep)) return (udc_ep_readl(ep, UDCCSR) & UDCCSR0_OPC); return (udc_ep_readl(ep, UDCCSR) & UDCCSR_PC); }
robutest/uclinux
C++
GPL-2.0
60
/* Send a set of bytes to the chip. We need to pulse the MODE line between each byte, but never at the start nor at the end of the transfer. */
static void sendbytes(struct l3_pins *adap, const u8 *buf, int len)
/* Send a set of bytes to the chip. We need to pulse the MODE line between each byte, but never at the start nor at the end of the transfer. */ static void sendbytes(struct l3_pins *adap, const u8 *buf, int len)
{ int i; for (i = 0; i < len; i++) { if (i) { udelay(adap->mode_hold); adap->setmode(0); udelay(adap->mode); } adap->setmode(1); udelay(adap->mode_setup); sendbyte(adap, buf[i]); } }
robutest/uclinux
C++
GPL-2.0
60
/* Get the current calendar value. Retrieves the current time of the calendar. */
void rtc_calendar_get_time(struct rtc_module *const module, struct rtc_calendar_time *const time)
/* Get the current calendar value. Retrieves the current time of the calendar. */ void rtc_calendar_get_time(struct rtc_module *const module, struct rtc_calendar_time *const time)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; while (rtc_calendar_is_syncing(module)) { } uint32_t register_value = rtc_module->MODE2.CLOCK.reg; rtc_calendar_register_value_to_time(module, register_value, time); }
memfault/zero-to-main
C++
null
200
/* Disable the time tick or alarm interrupt of RTC. The */
void RTCIntDisable(unsigned long ulIntType)
/* Disable the time tick or alarm interrupt of RTC. The */ void RTCIntDisable(unsigned long ulIntType)
{ xASSERT(((ulIntType & RTC_INT_TIME_TICK) == RTC_INT_TIME_TICK) || ((ulIntType & RTC_INT_ALARM) == RTC_INT_ALARM)); xHWREG(RTC_RIER) &= ~ulIntType; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* index = 0 gives default sti index > 0 gives other stis in detection order */
struct sti_struct* sti_get_rom(unsigned int index)
/* index = 0 gives default sti index > 0 gives other stis in detection order */ struct sti_struct* sti_get_rom(unsigned int index)
{ if (!sticore_initialized) sti_init_roms(); if (index == 0) return default_sti; if (index > num_sti_roms) return NULL; return sti_roms[index-1]; }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a 2 digit decimal to BCD format. */
static uint8_t RTC_ByteToBcd2(uint8_t Value)
/* Converts a 2 digit decimal to BCD format. */ static uint8_t RTC_ByteToBcd2(uint8_t Value)
{ uint8_t bcdhigh = 0; while (Value >= 10) { bcdhigh++; Value -= 10; } return ((uint8_t)(bcdhigh << 4) | Value); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Send and read data on one single stream. */
bool adp_transceive_single_stream(uint16_t stream_id, uint8_t *data, uint8_t data_size, uint8_t *protocol_buf)
/* Send and read data on one single stream. */ bool adp_transceive_single_stream(uint16_t stream_id, uint8_t *data, uint8_t data_size, uint8_t *protocol_buf)
{ struct adp_msg_data_stream data_stream; volatile uint8_t status; data_stream.number_of_streams = 1; data_stream.stream[0].stream_id = stream_id; data_stream.stream[0].data_size = data_size; data_stream.stream[0].data = data; status = adp_transceive_stream(&data_stream, protocol_buf); return status; }
memfault/zero-to-main
C++
null
200
/* Get SPIx the number of valid entries in transmit FIFO. */
u32 SSI_GetTxCount(SPI_TypeDef *spi_dev)
/* Get SPIx the number of valid entries in transmit FIFO. */ u32 SSI_GetTxCount(SPI_TypeDef *spi_dev)
{ return spi_dev->TXFLR & BIT_MASK_TXFLR_TXTFL; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Write to one of the locked raster registers. */
static void ep93xxfb_out_locked(struct ep93xx_fbi *fbi, unsigned int val, unsigned int reg)
/* Write to one of the locked raster registers. */ static void ep93xxfb_out_locked(struct ep93xx_fbi *fbi, unsigned int val, unsigned int reg)
{ ep93xxfb_writel(fbi, 0xaa, EP93XXFB_SWLOCK); ep93xxfb_writel(fbi, val, reg); }
robutest/uclinux
C++
GPL-2.0
60
/* @dev: device @blknr: first block to be read @blkcnt: number of blocks to read @buffer: output buffer Return: number of blocks transferred */
static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer)
/* @dev: device @blknr: first block to be read @blkcnt: number of blocks to read @buffer: output buffer Return: number of blocks transferred */ static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer)
{ struct efi_blk_platdata *platdata = dev_get_platdata(dev); struct efi_block_io *io = platdata->io; efi_status_t ret; EFI_PRINT("%s: read '%s', from block " LBAFU ", " LBAFU " blocks\n", __func__, dev->name, blknr, blkcnt); ret = EFI_CALL(io->read_blocks( io, io->media->media_id, (u64)blknr, (efi_uint...
4ms/stm32mp1-baremetal
C++
Other
137
/* Grab any resources needed for this port and start the mux timer. */
static int mux_startup(struct uart_port *port)
/* Grab any resources needed for this port and start the mux timer. */ static int mux_startup(struct uart_port *port)
{ mux_ports[port->line].enabled = 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* create_bm_block_list - create a list of block bitmap objects @pages - number of pages to track @list - list to put the allocated blocks into @ca - chain allocator to be used for allocating memory */
static int create_bm_block_list(unsigned long pages, struct list_head *list, struct chain_allocator *ca)
/* create_bm_block_list - create a list of block bitmap objects @pages - number of pages to track @list - list to put the allocated blocks into @ca - chain allocator to be used for allocating memory */ static int create_bm_block_list(unsigned long pages, struct list_head *list, struct chain_allocator *ca)
{ unsigned int nr_blocks = DIV_ROUND_UP(pages, BM_BITS_PER_BLOCK); while (nr_blocks-- > 0) { struct bm_block *bb; bb = chain_alloc(ca, sizeof(struct bm_block)); if (!bb) return -ENOMEM; list_add(&bb->hook, list); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Adds the given vlan id into the list for this vpath. see also: vxge_hw_vpath_vid_add, vxge_hw_vpath_vid_get and vxge_hw_vpath_vid_get_next */
enum vxge_hw_status vxge_hw_vpath_vid_delete(struct __vxge_hw_vpath_handle *vp, u64 vid)
/* Adds the given vlan id into the list for this vpath. see also: vxge_hw_vpath_vid_add, vxge_hw_vpath_vid_get and vxge_hw_vpath_vid_get_next */ enum vxge_hw_status vxge_hw_vpath_vid_delete(struct __vxge_hw_vpath_handle *vp, u64 vid)
{ enum vxge_hw_status status = VXGE_HW_OK; if (vp == NULL) { status = VXGE_HW_ERR_INVALID_HANDLE; goto exit; } status = __vxge_hw_vpath_rts_table_set(vp, VXGE_HW_RTS_ACCESS_STEER_CTRL_ACTION_DELETE_ENTRY, VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_VID, 0, VXGE_HW_RTS_ACCESS_STEER_DATA0_VLAN_ID(vid),...
robutest/uclinux
C++
GPL-2.0
60
/* Configure power supply for each peripheral according to NewState. */
void CLKPWR_ConfigPPWR(uint32_t PPType, FunctionalState NewState)
/* Configure power supply for each peripheral according to NewState. */ void CLKPWR_ConfigPPWR(uint32_t PPType, FunctionalState NewState)
{ if (NewState == ENABLE) { LPC_SC->PCONP |= PPType & CLKPWR_PCONP_BITMASK; } else if (NewState == DISABLE) { LPC_SC->PCONP &= (~PPType) & CLKPWR_PCONP_BITMASK; } }
ajhc/demo-cortex-m3
C++
null
38
/* Stop ULI526X board Free Tx/Rx allocated memory Init system variable */
static void uli526x_reset_prepare(struct net_device *dev)
/* Stop ULI526X board Free Tx/Rx allocated memory Init system variable */ static void uli526x_reset_prepare(struct net_device *dev)
{ struct uli526x_board_info *db = netdev_priv(dev); db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); update_cr6(db->cr6_data, dev->base_addr); outl(0, dev->base_addr + DCR7); outl(inl(dev->base_addr + DCR5), dev->base_addr + DCR5); netif_stop_queue(dev); uli526x_free_rxbuffer(db); db->tx_packet_cnt = 0; db->rx_avail_cn...
robutest/uclinux
C++
GPL-2.0
60
/* Event handler for events from the ID Manager module. */
static void im_evt_handler(im_evt_t const *p_im_evt)
/* Event handler for events from the ID Manager module. */ static void im_evt_handler(im_evt_t const *p_im_evt)
{ pm_evt_t pm_evt; ret_code_t err_code; switch (p_im_evt->evt_id) { case IM_EVT_DUPLICATE_ID: err_code = pm_peer_delete(p_im_evt->params.duplicate_id.peer_id_2); UNUSED_VARIABLE(err_code); break; case IM_EVT_BONDED_PEER_CONNECTED: ble_conn_...
labapart/polymcu
C++
null
201
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI MmioAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI MmioAndThenOr32(IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
{ return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData); }
tianocore/edk2
C++
Other
4,240
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */ UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
{ EMU_THUNK_PPI *ThunkPpi; EFI_STATUS Status; EMU_THUNK_PROTOCOL *Thunk; Status = PeiServicesLocatePpi ( &gEmuThunkPpiGuid, 0, NULL, (VOID **)&ThunkPpi ); if (!EFI_ERROR (Status)) { Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thu...
tianocore/edk2
C++
Other
4,240
/* Simply call tioce_do_dma_map() to create a map with the barrier bit clear in the address. */
static u64 tioce_dma(struct pci_dev *pdev, unsigned long paddr, size_t byte_count, int dma_flags)
/* Simply call tioce_do_dma_map() to create a map with the barrier bit clear in the address. */ static u64 tioce_dma(struct pci_dev *pdev, unsigned long paddr, size_t byte_count, int dma_flags)
{ return tioce_do_dma_map(pdev, paddr, byte_count, 0, dma_flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* These routines maintain argument size conversion between 32bit and 64bit environment. */
asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, compat_uptr_t tvp_x)
/* These routines maintain argument size conversion between 32bit and 64bit environment. */ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, compat_uptr_t tvp_x)
{ return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_SGTL5000_Init(void *handle, void *config)
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ status_t HAL_CODEC_SGTL5000_Init(void *handle, void *config)
{ assert((config != NULL) && (handle != NULL)); codec_config_t *codecConfig = (codec_config_t *)config; sgtl_config_t *sgtlConfig = (sgtl_config_t *)(codecConfig->codecDevConfig); sgtl_handle_t *sgtlHandle = (sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)); ((codec_handle_t ...
eclipse-threadx/getting-started
C++
Other
310
/* Calculate tcw input-/output-count and tccbl fields and add a tcat the tccb. In case input- or output-tida is used, the tidaw-list must be stored in continuous storage (no ttic). The tcal field in the tccb must be up-to-date. */
void itcw_finalize(struct itcw *itcw)
/* Calculate tcw input-/output-count and tccbl fields and add a tcat the tccb. In case input- or output-tida is used, the tidaw-list must be stored in continuous storage (no ttic). The tcal field in the tccb must be up-to-date. */ void itcw_finalize(struct itcw *itcw)
{ tcw_finalize(itcw->tcw, itcw->num_tidaws); }
robutest/uclinux
C++
GPL-2.0
60
/* ioat_dma_do_interrupt - handler used for single vector interrupt mode @irq: interrupt id @data: interrupt data */
static irqreturn_t ioat_dma_do_interrupt(int irq, void *data)
/* ioat_dma_do_interrupt - handler used for single vector interrupt mode @irq: interrupt id @data: interrupt data */ static irqreturn_t ioat_dma_do_interrupt(int irq, void *data)
{ struct ioatdma_device *instance = data; struct ioat_chan_common *chan; unsigned long attnstatus; int bit; u8 intrctrl; intrctrl = readb(instance->reg_base + IOAT_INTRCTRL_OFFSET); if (!(intrctrl & IOAT_INTRCTRL_MASTER_INT_EN)) return IRQ_NONE; if (!(intrctrl & IOAT_INTRCTRL_INT_STATUS)) { writeb(intrctrl,...
robutest/uclinux
C++
GPL-2.0
60
/* For use by UI code that sets preferences. */
gboolean prefs_set_range_value(pref_t *pref, const gchar *value, gboolean *changed)
/* For use by UI code that sets preferences. */ gboolean prefs_set_range_value(pref_t *pref, const gchar *value, gboolean *changed)
{ return prefs_set_range_value_work(pref, value, TRUE, changed); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Worker function to do AND operation on CPU feature supported bits mask buffer. */
VOID SupportedMaskAnd(IN UINT8 *SupportedFeatureMask, IN CONST UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
/* Worker function to do AND operation on CPU feature supported bits mask buffer. */ VOID SupportedMaskAnd(IN UINT8 *SupportedFeatureMask, IN CONST UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
{ UINTN Index; UINT8 *Data1; CONST UINT8 *Data2; Data1 = SupportedFeatureMask; Data2 = AndFeatureBitMask; for (Index = 0; Index < BitMaskSize; Index++) { *(Data1++) &= *(Data2++); } }
tianocore/edk2
C++
Other
4,240
/* mraid_mm_free_adp_resources - Free adapter softstate @adp : Adapter softstate */
static void mraid_mm_free_adp_resources(mraid_mmadp_t *)
/* mraid_mm_free_adp_resources - Free adapter softstate @adp : Adapter softstate */ static void mraid_mm_free_adp_resources(mraid_mmadp_t *)
{ uioc_t *kioc; int i; mraid_mm_teardown_dma_pools(adp); for (i = 0; i < adp->max_kioc; i++) { kioc = adp->kioc_list + i; pci_pool_free(adp->pthru_dma_pool, kioc->pthru32, kioc->pthru32_h); } kfree(adp->kioc_list); kfree(adp->mbox_list); pci_pool_destroy(adp->pthru_dma_pool); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Starts accepting slave transfers. Call this API after calling I2C_SlaveInit() and I2C_SlaveTransferCreateHandle() to start processing transactions driven by an I2C master. The slave monitors the I2C bus and pass events to the callback that was passed into the call to I2C_SlaveTransferCreateHandle(). The callback is...
static status_t I2C_SlaveTransferNonBlockingInternal(I2C_Type *base, i2c_slave_handle_t *handle, const void *txData, size_t txSize, void *rxData, size_t rxSize, uint32_t eventMask)
/* Starts accepting slave transfers. Call this API after calling I2C_SlaveInit() and I2C_SlaveTransferCreateHandle() to start processing transactions driven by an I2C master. The slave monitors the I2C bus and pass events to the callback that was passed into the call to I2C_SlaveTransferCreateHandle(). The callback is...
{ assert(handle != NULL); status_t status; status = kStatus_Success; I2C_DisableInterrupts(base, (uint32_t)kI2C_SlaveIrqFlags); if (handle->isBusy) { status = kStatus_I2C_Busy; } handle->transfer.txData = (const uint8_t *)txData; handle->transfer.txSize = ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clip the earned share of dirty pages to that which is actually available. This avoids exceeding the total dirty_limit when the floating averages fluctuate too quickly. */
static void clip_bdi_dirty_limit(struct backing_dev_info *bdi, unsigned long dirty, unsigned long *pbdi_dirty)
/* Clip the earned share of dirty pages to that which is actually available. This avoids exceeding the total dirty_limit when the floating averages fluctuate too quickly. */ static void clip_bdi_dirty_limit(struct backing_dev_info *bdi, unsigned long dirty, unsigned long *pbdi_dirty)
{ unsigned long avail_dirty; avail_dirty = global_page_state(NR_FILE_DIRTY) + global_page_state(NR_WRITEBACK) + global_page_state(NR_UNSTABLE_NFS) + global_page_state(NR_WRITEBACK_TEMP); if (avail_dirty < dirty) avail_dirty = dirty - avail_dirty; else avail_dirty = 0; avail_dirty += bdi_stat(bdi, BDI_...
robutest/uclinux
C++
GPL-2.0
60
/* mapping and unmapping functions for the IOMMU MMIO space. Each AMD IOMMU in the system has one. */
static u8* __init iommu_map_mmio_space(u64 address)
/* mapping and unmapping functions for the IOMMU MMIO space. Each AMD IOMMU in the system has one. */ static u8* __init iommu_map_mmio_space(u64 address)
{ u8 *ret; if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu")) return NULL; ret = ioremap_nocache(address, MMIO_REGION_LENGTH); if (ret != NULL) return ret; release_mem_region(address, MMIO_REGION_LENGTH); return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert one Null-terminated Unicode string (decimal dotted) to EFI_IPv4_ADDRESS. */
EFI_STATUS EFIAPI NetLibStrToIp4(IN CONST CHAR16 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
/* Convert one Null-terminated Unicode string (decimal dotted) to EFI_IPv4_ADDRESS. */ EFI_STATUS EFIAPI NetLibStrToIp4(IN CONST CHAR16 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
{ RETURN_STATUS Status; CHAR16 *EndPointer; Status = StrToIpv4Address (String, &EndPointer, Ip4Address, NULL); if (RETURN_ERROR (Status) || (*EndPointer != L'\0')) { return EFI_INVALID_PARAMETER; } else { return EFI_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* retval kStatus_Success Successfully send the stop signal. retval kStatus_I2C_Timeout Send stop signal failed, timeout. */
status_t I2C_MasterStop(I2C_Type *base)
/* retval kStatus_Success Successfully send the stop signal. retval kStatus_I2C_Timeout Send stop signal failed, timeout. */ status_t I2C_MasterStop(I2C_Type *base)
{ status_t result = I2C_PendingStatusWait(base); if (result != kStatus_Success) { return result; } base->MSTCTL = I2C_MSTCTL_MSTSTOP_MASK; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This file is generated automatically. You should not modify this source file, as your changes will be lost if this source file is re-generated. */
int32_t adi_initComponents(void)
/* This file is generated automatically. You should not modify this source file, as your changes will be lost if this source file is re-generated. */ int32_t adi_initComponents(void)
{ int32_t result = 0; return result; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* suspend_set_ops - Set the global suspend method table. @ops: Pointer to ops structure. */
void suspend_set_ops(struct platform_suspend_ops *ops)
/* suspend_set_ops - Set the global suspend method table. @ops: Pointer to ops structure. */ void suspend_set_ops(struct platform_suspend_ops *ops)
{ mutex_lock(&pm_mutex); suspend_ops = ops; mutex_unlock(&pm_mutex); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert the given wIndex into a pointer to an driver endpoint structure, or return NULL if it is not a valid endpoint. */
static struct s3c_hsotg_ep* ep_from_windex(struct s3c_hsotg *hsotg, u32 windex)
/* Convert the given wIndex into a pointer to an driver endpoint structure, or return NULL if it is not a valid endpoint. */ static struct s3c_hsotg_ep* ep_from_windex(struct s3c_hsotg *hsotg, u32 windex)
{ struct s3c_hsotg_ep *ep = &hsotg->eps[windex & 0x7F]; int dir = (windex & USB_DIR_IN) ? 1 : 0; int idx = windex & 0x7F; if (windex >= 0x100) return NULL; if (idx > S3C_HSOTG_EPS) return NULL; if (idx && ep->dir_in != dir) return NULL; return ep; }
robutest/uclinux
C++
GPL-2.0
60
/* fifo_icap_busy - Return true if the ICAP is still processing a transaction. @drvdata: a pointer to the drvdata. */
static u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
/* fifo_icap_busy - Return true if the ICAP is still processing a transaction. @drvdata: a pointer to the drvdata. */ static u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
{ u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET); return (status & XHI_SR_DONE_MASK) ? 0 : 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Check whether float 'f' is less than integer 'i'. See comments on previous function. */
l_sinline int LTfloatint(lua_Number f, lua_Integer i)
/* Check whether float 'f' is less than integer 'i'. See comments on previous function. */ l_sinline int LTfloatint(lua_Number f, lua_Integer i)
{ lua_Integer fi; if (luaV_flttointeger(f, &fi, F2Ifloor)) return fi < i; else return f < 0; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Enable or disable the hard trigger of the specified ADC sequence. */
void ADC_TriggerCmd(CM_ADC_TypeDef *ADCx, uint8_t u8Seq, en_functional_state_t enNewState)
/* Enable or disable the hard trigger of the specified ADC sequence. */ void ADC_TriggerCmd(CM_ADC_TypeDef *ADCx, uint8_t u8Seq, en_functional_state_t enNewState)
{ uint32_t u32Addr; DDL_ASSERT(IS_ADC_UNIT(ADCx)); DDL_ASSERT(IS_ADC_SEQ(u8Seq)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); u32Addr = (uint32_t)&ADCx->TRGSR; WRITE_REG32(PERIPH_BIT_BAND(u32Addr, (uint32_t)u8Seq * ADC_TRGSR_TRGSELB_POS + ADC_TRGSR_TRGENA_POS), enNewState); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* guillemot_close() is a callback from the input close routine. */
static void guillemot_close(struct input_dev *dev)
/* guillemot_close() is a callback from the input close routine. */ static void guillemot_close(struct input_dev *dev)
{ struct guillemot *guillemot = input_get_drvdata(dev); gameport_stop_polling(guillemot->gameport); }
robutest/uclinux
C++
GPL-2.0
60
/* Set up the clock source and clock events devices */
void __init realview_timer_init(unsigned int timer_irq)
/* Set up the clock source and clock events devices */ void __init realview_timer_init(unsigned int timer_irq)
{ u32 val; val = readl(__io_address(REALVIEW_SCTL_BASE)); writel((REALVIEW_TIMCLK << REALVIEW_TIMER1_EnSel) | (REALVIEW_TIMCLK << REALVIEW_TIMER2_EnSel) | (REALVIEW_TIMCLK << REALVIEW_TIMER3_EnSel) | (REALVIEW_TIMCLK << REALVIEW_TIMER4_EnSel) | val, __io_address(REALVIEW_SCTL_BASE));...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Send the received sink caps to the DPM. */
void policy_set_port_partner_snk_cap(const struct device *dev, const uint32_t *pdos, const int num_pdos)
/* Send the received sink caps to the DPM. */ void policy_set_port_partner_snk_cap(const struct device *dev, const uint32_t *pdos, const int num_pdos)
{ struct usbc_port_data *data = dev->data; if (data->policy_cb_set_port_partner_snk_cap) { data->policy_cb_set_port_partner_snk_cap(dev, pdos, num_pdos); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Temperature data output register (r). L and H registers together express a 16-bit word in two’s complement.. */
int32_t lsm6dso_temperature_raw_get(stmdev_ctx_t *ctx, int16_t *val)
/* Temperature data output register (r). L and H registers together express a 16-bit word in two’s complement.. */ int32_t lsm6dso_temperature_raw_get(stmdev_ctx_t *ctx, int16_t *val)
{ uint8_t buff[2]; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_OUT_TEMP_L, buff, 2); val[0] = (int16_t)buff[1]; val[0] = (val[0] * 256) + (int16_t)buff[0]; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Enable or disable the PWR fast wake up function. */
void PWR_FastWakeUpCmd(FunctionalState NewState)
/* Enable or disable the PWR fast wake up function. */ void PWR_FastWakeUpCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { PWR->CSR2 |= PWR_CSR2_FWU; } else { PWR->CSR2 &= (uint8_t)(~PWR_CSR2_FWU); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* rpc_free - free buffer allocated via rpc_malloc @buffer: buffer to free */
void rpc_free(void *buffer)
/* rpc_free - free buffer allocated via rpc_malloc @buffer: buffer to free */ void rpc_free(void *buffer)
{ size_t size; struct rpc_buffer *buf; if (!buffer) return; buf = container_of(buffer, struct rpc_buffer, data); size = buf->len; dprintk("RPC: freeing buffer of size %zu at %p\n", size, buf); if (size <= RPC_BUFFER_MAXSIZE) mempool_free(buf, rpc_buffer_mempool); else kfree(buf); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the DMA FIFO under flow interrupt count. */
void LCDC_GetDmaUnINTCnt(LCDC_TypeDef *LCDCx, u32 *DmaUnIntCnt)
/* Get the DMA FIFO under flow interrupt count. */ void LCDC_GetDmaUnINTCnt(LCDC_TypeDef *LCDCx, u32 *DmaUnIntCnt)
{ assert_param(IS_LCDC_ALL_PERIPH(LCDCx)); *DmaUnIntCnt = (LCDCx->LCDC_STATUS & LCDC_STATUS_DMAUNINTCNT); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Check the status of an IOS Access Interrupt. */
uint32_t am_hal_ios_access_int_status_get(bool bEnabledOnly)
/* Check the status of an IOS Access Interrupt. */ uint32_t am_hal_ios_access_int_status_get(bool bEnabledOnly)
{ if ( bEnabledOnly ) { uint32_t u32RetVal = AM_REG(IOSLAVE, REGACCINTSTAT); return u32RetVal & AM_REG(IOSLAVE, REGACCINTEN); } else { return AM_REG(IOSLAVE, REGACCINTSTAT); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Must NOT be called with the hw_lock held. */
int go7007_boot_encoder(struct go7007 *go, int init_i2c)
/* Must NOT be called with the hw_lock held. */ int go7007_boot_encoder(struct go7007 *go, int init_i2c)
{ int ret; mutex_lock(&go->hw_lock); ret = go7007_load_encoder(go); mutex_unlock(&go->hw_lock); if (ret < 0) return -1; if (!init_i2c) return 0; if (go7007_i2c_init(go) < 0) return -1; go->i2c_adapter_online = 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns a voltage that can be passed to @regulator_set_voltage(), zero if this selector code can't be used on this sytem, or a negative errno. */
int regulator_list_voltage(struct regulator *regulator, unsigned selector)
/* Returns a voltage that can be passed to @regulator_set_voltage(), zero if this selector code can't be used on this sytem, or a negative errno. */ int regulator_list_voltage(struct regulator *regulator, unsigned selector)
{ struct regulator_dev *rdev = regulator->rdev; struct regulator_ops *ops = rdev->desc->ops; int ret; if (!ops->list_voltage || selector >= rdev->desc->n_voltages) return -EINVAL; mutex_lock(&rdev->mutex); ret = ops->list_voltage(rdev, selector); mutex_unlock(&rdev->mutex); if (ret > 0) { if (ret < rdev->...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is the put_super() entry in the super_operations structure for HFS filesystems. The purpose is to release the resources associated with the superblock sb. */
static void hfs_put_super(struct super_block *sb)
/* This is the put_super() entry in the super_operations structure for HFS filesystems. The purpose is to release the resources associated with the superblock sb. */ static void hfs_put_super(struct super_block *sb)
{ lock_kernel(); if (sb->s_dirt) hfs_write_super(sb); hfs_mdb_close(sb); hfs_mdb_put(sb); unlock_kernel(); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads and returns the current value of CR2. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadCr2(VOID)
/* Reads and returns the current value of CR2. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ UINTN EFIAPI AsmReadCr2(VOID)
{ UINTN Data; __asm__ __volatile__ ( "movl %%cr2, %0" : "=r" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* brief Returns instance number for FLEXCOMM module with given base address. */
uint32_t FLEXCOMM_GetInstance(void *base)
/* brief Returns instance number for FLEXCOMM module with given base address. */ uint32_t FLEXCOMM_GetInstance(void *base)
{ uint32_t i; pvoid_to_u32_t BaseAddr; BaseAddr.pvoid = base; for (i = 0U; i < (uint32_t)FSL_FEATURE_SOC_FLEXCOMM_COUNT; i++) { if (BaseAddr.u32 == s_flexcommBaseAddrs[i]) { break; } } assert(i < FSL_FEATURE_SOC_FLEXCOMM_COUNT); return i; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* helper function to end page writeback if all the extents in the tree for that page are done with writeback */
static int check_page_writeback(struct extent_io_tree *tree, struct page *page)
/* helper function to end page writeback if all the extents in the tree for that page are done with writeback */ static int check_page_writeback(struct extent_io_tree *tree, struct page *page)
{ end_page_writeback(page); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* smack_inode_getsecid - Extract inode's security id @inode: inode to extract the info from @secid: where result will be saved */
static void smack_inode_getsecid(const struct inode *inode, u32 *secid)
/* smack_inode_getsecid - Extract inode's security id @inode: inode to extract the info from @secid: where result will be saved */ static void smack_inode_getsecid(const struct inode *inode, u32 *secid)
{ struct inode_smack *isp = inode->i_security; *secid = smack_to_secid(isp->smk_inode); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to long mode. */
EFI_STATUS Execute32BitCode(IN UINT64 Function, IN UINT64 Param1, IN UINT64 Param2)
/* Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to long mode. */ EFI_STATUS Execute32BitCode(IN UINT64 Function, IN UINT64 Param1, IN UINT64 Param2)
{ FSP_FUNCTION EntryFunc; EFI_STATUS Status; EntryFunc = (FSP_FUNCTION)(UINTN)(Function); Status = EntryFunc ((VOID *)(UINTN)Param1, (VOID *)(UINTN)Param2); return Status; }
tianocore/edk2
C++
Other
4,240
/* Get Voltage Detector Output. The voltage detector threshold must be set when the power voltage detector is enabled, see */
bool pwr_voltage_high(void)
/* Get Voltage Detector Output. The voltage detector threshold must be set when the power voltage detector is enabled, see */ bool pwr_voltage_high(void)
{ return PWR_CSR & PWR_CSR_PVDO; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Disable Output from ITM/SWO. Use this function to set the state of the 128 valid bits at the beginning of customer info space, if needed. Set the SWO disable bit to zero. */
int32_t am_hal_flash_swo_disable(void)
/* Disable Output from ITM/SWO. Use this function to set the state of the 128 valid bits at the beginning of customer info space, if needed. Set the SWO disable bit to zero. */ int32_t am_hal_flash_swo_disable(void)
{ int iRC; uint32_t ui32SecurityValue; iRC = customer_info_signature_set(); if ( iRC ) { return iRC; } ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) & ~AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_M; return g_am_hal_flash.flash_program_info( ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 on success, -EINVAL if MTU is out of valid range. (valid range is 576 .. NETIUCV_MTU_MAX). */
static int netiucv_change_mtu(struct net_device *dev, int new_mtu)
/* Returns 0 on success, -EINVAL if MTU is out of valid range. (valid range is 576 .. NETIUCV_MTU_MAX). */ static int netiucv_change_mtu(struct net_device *dev, int new_mtu)
{ IUCV_DBF_TEXT(trace, 3, __func__); if (new_mtu < 576 || new_mtu > NETIUCV_MTU_MAX) { IUCV_DBF_TEXT(setup, 2, "given MTU out of valid range\n"); return -EINVAL; } dev->mtu = new_mtu; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The function will check if Execute Disable Bit is available. */
BOOLEAN IsExecuteDisableBitAvailable(VOID)
/* The function will check if Execute Disable Bit is available. */ BOOLEAN IsExecuteDisableBitAvailable(VOID)
{ UINT32 RegEax; UINT32 RegEdx; BOOLEAN Available; Available = FALSE; AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); if (RegEax >= 0x80000001) { AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx); if ((RegEdx & BIT20) != 0) { Available = TRUE; } } return Available; }
tianocore/edk2
C++
Other
4,240
/* Close the cursor on top of the stack. Return 1 */
static int cur_close(lua_State *L)
/* Close the cursor on top of the stack. Return 1 */ static int cur_close(lua_State *L)
{ lua_pushboolean (L, 0); return 1; } cur->closed = 1; PQclear(cur->pg_res); luaL_unref (L, LUA_REGISTRYINDEX, cur->conn); luaL_unref (L, LUA_REGISTRYINDEX, cur->colnames); luaL_unref (L, LUA_REGISTRYINDEX, cur->coltypes); lua_pushboolean (L, 1); return 1; }
DC-SWAT/DreamShell
C++
null
404
/* Calibrate x position (to obtain X = calibrated(x)) */
uint16_t TouchScreen_Get_Calibrated_X(uint16_t x)
/* Calibrate x position (to obtain X = calibrated(x)) */ uint16_t TouchScreen_Get_Calibrated_X(uint16_t x)
{ return (((A1 * x) + B1) / 1000); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This comparator searches for the next Interface descriptor of the correct Audio Control Class, Subclass and Protocol values. */
uint8_t DComp_NextAudioControlInterface(void *CurrentDescriptor)
/* This comparator searches for the next Interface descriptor of the correct Audio Control Class, Subclass and Protocol values. */ uint8_t DComp_NextAudioControlInterface(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Interface) { USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); if ((Interface->Class == AUDIO_CSCP_AudioClass) && (Interface-...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* These three routines are used to recognize on-disk extended attributes that are in a recognized namespace. If the attribute is not recognized, "os2." is prepended to the name */
static int is_os2_xattr(struct jfs_ea *ea)
/* These three routines are used to recognize on-disk extended attributes that are in a recognized namespace. If the attribute is not recognized, "os2." is prepended to the name */ static int is_os2_xattr(struct jfs_ea *ea)
{ if ((ea->namelen >= XATTR_SYSTEM_PREFIX_LEN) && !strncmp(ea->name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) return false; if ((ea->namelen >= XATTR_USER_PREFIX_LEN) && !strncmp(ea->name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) return false; if ((ea->namelen >= XATTR_SECURITY_PREFIX_LEN) && ...
robutest/uclinux
C++
GPL-2.0
60
/* We prevent mucking around with the reserved area of trap which are used internally by the kernel. */
static int set_user_trap(struct task_struct *task, unsigned long trap)
/* We prevent mucking around with the reserved area of trap which are used internally by the kernel. */ static int set_user_trap(struct task_struct *task, unsigned long trap)
{ task->thread.regs->trap = trap & 0xfff0; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read from the ECR, mask out the bits in @mask, exclusive-or with the bits in @val, and write the result to the ECR. */
static void parport_ip32_frob_econtrol(struct parport *p, unsigned int mask, unsigned int val)
/* Read from the ECR, mask out the bits in @mask, exclusive-or with the bits in @val, and write the result to the ECR. */ static void parport_ip32_frob_econtrol(struct parport *p, unsigned int mask, unsigned int val)
{ unsigned int c; c = (parport_ip32_read_econtrol(p) & ~mask) ^ val; parport_ip32_write_econtrol(p, c); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int mock_write_binary_tree_init(int res)
/* This file is part of the Simba project. */ int mock_write_binary_tree_init(int res)
{ harness_mock_write("binary_tree_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* convert the rc5 frame from binary to manchester format */
static uint32_t rc5_manchester_convert(uint16_t rc5_binary_frame_format)
/* convert the rc5 frame from binary to manchester format */ static uint32_t rc5_manchester_convert(uint16_t rc5_binary_frame_format)
{ uint8_t i=0; uint16_t mask = 1; uint16_t bit_format = 0; uint32_t converted_msg =0; for(i = 0; i < rc5_real_frame_length; i++){ bit_format = ((((uint16_t)(rc5_binary_frame_format))>>i)& mask)<<i; converted_msg = converted_msg << 2; if(0 != bit_format){ converted...
liuxuming/trochili
C++
Apache License 2.0
132
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOG, STLK_RX_Pin|STLK_TX_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If we fail to allocate memory for the copy, fill in the "errbuf" member of the "pcap_t" with an error message, and return -1; otherwise, return 0. */
int install_bpf_program(pcap_t *p, struct bpf_program *fp)
/* If we fail to allocate memory for the copy, fill in the "errbuf" member of the "pcap_t" with an error message, and return -1; otherwise, return 0. */ int install_bpf_program(pcap_t *p, struct bpf_program *fp)
{ size_t prog_size; if (!bpf_validate(fp->bf_insns, fp->bf_len)) { pcap_snprintf(p->errbuf, sizeof(p->errbuf), "BPF program is not valid"); return (-1); } pcap_freecode(&p->fcode); prog_size = sizeof(*fp->bf_insns) * fp->bf_len; p->fcode.bf_len = fp->bf_len; p->fcode.bf_insns = (struct bpf_insn *)malloc(p...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get the AFEC channel default configurations. The default configuration is as follows: */
void afec_ch_get_config_defaults(struct afec_ch_config *const cfg)
/* Get the AFEC channel default configurations. The default configuration is as follows: */ void afec_ch_get_config_defaults(struct afec_ch_config *const cfg)
{ Assert(cfg); cfg->diff = false; cfg->gain = AFEC_GAINVALUE_1; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Handles an incoming "handles info" entry from a find-type-value response for the specified discover-service-by-uuid proc. */
static int ble_gattc_disc_svc_uuid_rx_hinfo(struct ble_gattc_proc *proc, struct ble_att_find_type_value_hinfo *hinfo)
/* Handles an incoming "handles info" entry from a find-type-value response for the specified discover-service-by-uuid proc. */ static int ble_gattc_disc_svc_uuid_rx_hinfo(struct ble_gattc_proc *proc, struct ble_att_find_type_value_hinfo *hinfo)
{ struct ble_gatt_svc service; int cbrc; int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); if (hinfo->group_end_handle <= proc->disc_svc_uuid.prev_handle) { rc = BLE_HS_EBADDATA; goto done; } proc->disc_svc_uuid.prev_handle = hinfo->group_end_handle; service.start_han...
Nicholas3388/LuaNode
C++
Other
1,055
/* Returns virtual address inside the shared area according to the bus address. */
static void* sep_shared_bus_to_virt(struct sep_device *sep, dma_addr_t bus_address)
/* Returns virtual address inside the shared area according to the bus address. */ static void* sep_shared_bus_to_virt(struct sep_device *sep, dma_addr_t bus_address)
{ return sep->shared_addr + (bus_address - sep->shared_bus); }
robutest/uclinux
C++
GPL-2.0
60
/* param base UTICK peripheral base address. return none */
void UTICK_ClearStatusFlags(UTICK_Type *base)
/* param base UTICK peripheral base address. return none */ void UTICK_ClearStatusFlags(UTICK_Type *base)
{ base->STAT = UTICK_STAT_INTR_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set EC point compressed coordinates. Points can be described in terms of their compressed coordinates. For a point (x, y), for any given value for x such that the point is on the curve there will only ever be two possible values for y. Therefore, a point can be set using this function where BnX is the x coordinate a...
BOOLEAN EFIAPI CryptoServiceEcPointSetCompressedCoordinates(IN CONST VOID *EcGroup, IN VOID *EcPoint, IN CONST VOID *BnX, IN UINT8 YBit, IN VOID *BnCtx)
/* Set EC point compressed coordinates. Points can be described in terms of their compressed coordinates. For a point (x, y), for any given value for x such that the point is on the curve there will only ever be two possible values for y. Therefore, a point can be set using this function where BnX is the x coordinate a...
{ return CALL_BASECRYPTLIB (Ec.Services.PointSetCompressedCoordinates, EcPointSetCompressedCoordinates, (EcGroup, EcPoint, BnX, YBit, BnCtx), FALSE); }
tianocore/edk2
C++
Other
4,240
/* The following group of functions deal with mapping and unmapping a temporary page into a DTLB slot that has been set aside for exclusive use. */
static void sh64_setup_dtlb_cache_slot(unsigned long eaddr, unsigned long asid, unsigned long paddr)
/* The following group of functions deal with mapping and unmapping a temporary page into a DTLB slot that has been set aside for exclusive use. */ static void sh64_setup_dtlb_cache_slot(unsigned long eaddr, unsigned long asid, unsigned long paddr)
{ local_irq_disable(); sh64_setup_tlb_slot(dtlb_cache_slot, eaddr, asid, paddr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* publ_to_item - add publication info to a publication message */
static void publ_to_item(struct distr_item *i, struct publication *p)
/* publ_to_item - add publication info to a publication message */ static void publ_to_item(struct distr_item *i, struct publication *p)
{ i->type = htonl(p->type); i->lower = htonl(p->lower); i->upper = htonl(p->upper); i->ref = htonl(p->ref); i->key = htonl(p->key); dbg("publ_to_item: %u, %u, %u\n", p->type, p->lower, p->upper); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* (See EFI_RSC_HANDLER_PROTOCOL in Volume 3 of the Platform Init spec.) */
STATIC VOID EFIAPI UnregisterAtExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
/* (See EFI_RSC_HANDLER_PROTOCOL in Volume 3 of the Platform Init spec.) */ STATIC VOID EFIAPI UnregisterAtExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter; StatusCodeRouter = Context; StatusCodeRouter->Unregister (HandleStatusCode); }
tianocore/edk2
C++
Other
4,240
/* Setup the input buffer state to scan a string. The next call to yylex() will scan from a */
YY_BUFFER_STATE yy_scan_string(const char *yy_str)
/* Setup the input buffer state to scan a string. The next call to yylex() will scan from a */ YY_BUFFER_STATE yy_scan_string(const char *yy_str)
{ return yy_scan_bytes( yystr, (int) strlen(yystr) ); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Return: 0 on success, else -ENODEV or -EINVAL */
static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong value, enum pci_size_t size)
/* Return: 0 on success, else -ENODEV or -EINVAL */ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong value, enum pci_size_t size)
{ return pci_generic_mmap_write_config(bus, pcie_xilinx_config_address, bdf, offset, value, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Fills each USART_InitStruct member with its default value. @method UART_StructInit */
void UART_StructInit(UART_InitTypeDef *UART_InitStruct)
/* Fills each USART_InitStruct member with its default value. @method UART_StructInit */ void UART_StructInit(UART_InitTypeDef *UART_InitStruct)
{ UART_InitStruct->BaudRate = 9600; UART_InitStruct->RxMode = MODE_RX_ENABLE; UART_InitStruct->Parity = YC_PARITY_NONE; UART_InitStruct->DataBits = DATABITS_8B; UART_InitStruct->StopBits = STOPBITS_1; UART_InitStruct->FlowCtrl = FLOWCTRL_NONE; UART_InitStruct->SmartCard = SMARTCARD...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: 0 on success / -ENXIO if device does not exist */
static int ibmvfc_slave_alloc(struct scsi_device *sdev)
/* Returns: 0 on success / -ENXIO if device does not exist */ static int ibmvfc_slave_alloc(struct scsi_device *sdev)
{ struct Scsi_Host *shost = sdev->host; struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); struct ibmvfc_host *vhost = shost_priv(shost); unsigned long flags = 0; if (!rport || fc_remote_port_chkready(rport)) return -ENXIO; spin_lock_irqsave(shost->host_lock, flags); sdev->hostdata = (void *)(unsign...
robutest/uclinux
C++
GPL-2.0
60
/* Message: NotifyDtmfToneMessage Opcode: 0x0127 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_NotifyDtmfToneMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: NotifyDtmfToneMessage Opcode: 0x0127 Type: CallControl Direction: pbx2dev VarLength: no */ static void handle_NotifyDtmfToneMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_tone, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_passthruPartyID, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* mac80211 - events Indicate a failed Michael MIC to userspace. If the caller knows the TSC of the frame that generated the MIC failure (i.e., if it was provided by the driver or is still in the frame), it should provide that information. */
void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, struct ieee80211_hdr *hdr, const u8 *tsc, gfp_t gfp)
/* mac80211 - events Indicate a failed Michael MIC to userspace. If the caller knows the TSC of the frame that generated the MIC failure (i.e., if it was provided by the driver or is still in the frame), it should provide that information. */ void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, in...
{ cfg80211_michael_mic_failure(sdata->dev, hdr->addr2, (hdr->addr1[0] & 0x01) ? NL80211_KEYTYPE_GROUP : NL80211_KEYTYPE_PAIRWISE, keyidx, tsc, gfp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* tipc_send2port - send message sections to port identity */
int tipc_send2port(u32 ref, struct tipc_portid const *dest, unsigned int num_sect, struct iovec const *msg_sect)
/* tipc_send2port - send message sections to port identity */ int tipc_send2port(u32 ref, struct tipc_portid const *dest, unsigned int num_sect, struct iovec const *msg_sect)
{ struct tipc_portid orig; orig.ref = ref; orig.node = tipc_own_addr; return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, TIPC_PORT_IMPORTANCE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Free up the resources associated with a mount structure. Assume that the structure was initially zeroed, so we can tell which fields got initialized. */
STATIC void xfs_free_perag(xfs_mount_t *mp)
/* Free up the resources associated with a mount structure. Assume that the structure was initially zeroed, so we can tell which fields got initialized. */ STATIC void xfs_free_perag(xfs_mount_t *mp)
{ if (mp->m_perag) { int agno; for (agno = 0; agno < mp->m_maxagi; agno++) if (mp->m_perag[agno].pagb_list) kmem_free(mp->m_perag[agno].pagb_list); kmem_free(mp->m_perag); } }
robutest/uclinux
C++
GPL-2.0
60
/* Turn a config register offset into the right address in either PCI space or MMIO space to access the control register in question including accounting for the unit shift. */
static unsigned long sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r)
/* Turn a config register offset into the right address in either PCI space or MMIO space to access the control register in question including accounting for the unit shift. */ static unsigned long sil680_seldev(struct ata_port *ap, struct ata_device *adev, int r)
{ unsigned long base = 0xA0 + r; base += (ap->port_no << 4); base |= adev->devno ? 2 : 0; return base; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* FLEXIO UART EDMA receive finished callback function. This function is called when FLEXIO UART EDMA receive finished. It disables the UART RX EDMA request and sends kStatus_FLEXIO_UART_RxIdle to UART callback. */
static void FLEXIO_UART_TransferReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* FLEXIO UART EDMA receive finished callback function. This function is called when FLEXIO UART EDMA receive finished. It disables the UART RX EDMA request and sends kStatus_FLEXIO_UART_RxIdle to UART callback. */ static void FLEXIO_UART_TransferReceiveEDMACallback(edma_handle_t *handle, void *param, bool transferDon...
{ flexio_uart_edma_private_handle_t *uartPrivateHandle = (flexio_uart_edma_private_handle_t *)param; assert(uartPrivateHandle->handle != NULL); handle = handle; tcds = tcds; if (transferDone) { FLEXIO_UART_TransferAbortReceiveEDMA(uartPrivateHandle->base, uartPrivateHandle->handle); ...
eclipse-threadx/getting-started
C++
Other
310
/* The protection flags indicate access permissions as follow: */
uint32_t EEPROMBlockProtectSet(uint32_t ui32Block, uint32_t ui32Protect)
/* The protection flags indicate access permissions as follow: */ uint32_t EEPROMBlockProtectSet(uint32_t ui32Block, uint32_t ui32Protect)
{ ASSERT(ui32Block < BLOCKS_FROM_EESIZE(HWREG(EEPROM_EESIZE))); HWREG(EEPROM_EEBLOCK) = ui32Block; HWREG(EEPROM_EEPROT) = ui32Protect; while(HWREG(EEPROM_EEDONE) & EEPROM_EEDONE_WORKING) { } return(HWREG(EEPROM_EEDONE)); }
feaser/openblt
C++
GNU General Public License v3.0
601