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
/* Find a snap client by matching the 5 bytes. */
static struct datalink_proto* find_snap_client(const unsigned char *desc)
/* Find a snap client by matching the 5 bytes. */ static struct datalink_proto* find_snap_client(const unsigned char *desc)
{ struct datalink_proto *proto = NULL, *p; list_for_each_entry_rcu(p, &snap_list, node) { if (!memcmp(p->type, desc, 5)) { proto = p; break; } } return proto; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The function is NOT SCHEDULE-SAFE! It might unlock the write lock if we needed to wait for a block to be read. Note that in this case it won't recover the lock to avoid high contention resulting from too much lock requests, especially the caller (search_by_key) will perform other schedule-unsafe operations just after calling this function. */
static bool search_by_key_reada(struct super_block *s, struct buffer_head **bh, b_blocknr_t *b, int num)
/* The function is NOT SCHEDULE-SAFE! It might unlock the write lock if we needed to wait for a block to be read. Note that in this case it won't recover the lock to avoid high contention resulting from too much lock requests, especially the caller (search_by_key) will perform other schedule-unsafe operations just after calling this function. */ static bool search_by_key_reada(struct super_block *s, struct buffer_head **bh, b_blocknr_t *b, int num)
{ int i, j; bool unlocked = false; for (i = 0; i < num; i++) { bh[i] = sb_getblk(s, b[i]); } for (j = 0; j < i; j++) { if (!buffer_uptodate(bh[j])) { if (!unlocked) { reiserfs_write_unlock(s); unlocked = true; } ll_rw_block(READA, 1, bh + j); } brelse(bh[j]); } return unlocked; }
robutest/uclinux
C++
GPL-2.0
60
/* p_{j} = x_{j} / (period/2 + t % period/2) */
void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, long *numerator, long *denominator)
/* p_{j} = x_{j} / (period/2 + t % period/2) */ void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, long *numerator, long *denominator)
{ struct prop_global *pg = prop_get_global(pd); unsigned long period_2 = 1UL << (pg->shift - 1); unsigned long counter_mask = period_2 - 1; unsigned long global_count; prop_norm_percpu(pg, pl); *numerator = percpu_counter_read_positive(&pl->events); global_count = percpu_counter_read(&pg->events); *denominator = period_2 + (global_count & counter_mask); prop_put_global(pd, pg); }
robutest/uclinux
C++
GPL-2.0
60
/* snd_hda_ctl_add() checks the control subdev id field whether #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower bits value is taken as the NID to assign. */
int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, struct snd_kcontrol *kctl)
/* snd_hda_ctl_add() checks the control subdev id field whether #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower bits value is taken as the NID to assign. */ int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, struct snd_kcontrol *kctl)
{ int err; struct hda_nid_item *item; if (kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) { if (nid == 0) nid = kctl->id.subdevice & 0xffff; kctl->id.subdevice = 0; } err = snd_ctl_add(codec->bus->card, kctl); if (err < 0) return err; item = snd_array_new(&codec->mixers); if (!item) return -ENOMEM; item->kctl = kctl; item->nid = nid; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector46_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector46_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (46 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Get detailed information of the requested logical processor. */
VOID CpuCacheInfoGetProcessorInfo(IN MP_SERVICES MpServices, IN UINTN ProcessorNum, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo)
/* Get detailed information of the requested logical processor. */ VOID CpuCacheInfoGetProcessorInfo(IN MP_SERVICES MpServices, IN UINTN ProcessorNum, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo)
{ EFI_STATUS Status; Status = MpServices.Ppi->GetProcessorInfo (MpServices.Ppi, ProcessorNum, ProcessorInfo); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* Gets the type of chassis for the system. */
MISC_CHASSIS_TYPE EFIAPI OemGetChassisType(VOID)
/* Gets the type of chassis for the system. */ MISC_CHASSIS_TYPE EFIAPI OemGetChassisType(VOID)
{ ASSERT (FALSE); return MiscChassisTypeUnknown; }
tianocore/edk2
C++
Other
4,240
/* param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API. */
void ENET_GetMacAddr(ENET_Type *base, uint8_t *macAddr)
/* param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API. */ void ENET_GetMacAddr(ENET_Type *base, uint8_t *macAddr)
{ assert(macAddr); uint32_t address; address = base->PALR; macAddr[0] = 0xFFU & (address >> 24U); macAddr[1] = 0xFFU & (address >> 16U); macAddr[2] = 0xFFU & (address >> 8U); macAddr[3] = 0xFFU & address; address = (base->PAUR & ENET_PAUR_PADDR2_MASK) >> ENET_PAUR_PADDR2_SHIFT; macAddr[4] = 0xFFU & (address >> 8U); macAddr[5] = 0xFFU & address; }
nanoframework/nf-interpreter
C++
MIT License
293
/* This function is used to deliver incoming packets to network taps. It should be used when the normal netif_receive_skb path is bypassed, for example because of VLAN acceleration. */
void netif_nit_deliver(struct sk_buff *skb)
/* This function is used to deliver incoming packets to network taps. It should be used when the normal netif_receive_skb path is bypassed, for example because of VLAN acceleration. */ void netif_nit_deliver(struct sk_buff *skb)
{ struct packet_type *ptype; if (list_empty(&ptype_all)) return; skb_reset_network_header(skb); skb_reset_transport_header(skb); skb->mac_len = skb->network_header - skb->mac_header; rcu_read_lock(); list_for_each_entry_rcu(ptype, &ptype_all, list) { if (!ptype->dev || ptype->dev == skb->dev) deliver_skb(skb, ptype, skb->dev); } rcu_read_unlock(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Notifies the USB reset bus events to the device stack */
sl_status_t sli_usbd_core_reset_event(void)
/* Notifies the USB reset bus events to the device stack */ sl_status_t sli_usbd_core_reset_event(void)
{ usbd_core_set_event(SLI_USBD_EVENT_BUS_RESET); return SL_STATUS_OK; }
nanoframework/nf-interpreter
C++
MIT License
293
/* The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are called by the interpreter with Character Space (CS) coordinates. Each path element is placed into a queue of length one to await the calculation of the following element. At that time, the darkening offset of the following element is known and joins can be computed, including possible modification of this element, before mapping to Device Space (DS) and passing it on to the outline consumer. */
cf2_glyphpath_moveTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
/* The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are called by the interpreter with Character Space (CS) coordinates. Each path element is placed into a queue of length one to await the calculation of the following element. At that time, the darkening offset of the following element is known and joins can be computed, including possible modification of this element, before mapping to Device Space (DS) and passing it on to the outline consumer. */ cf2_glyphpath_moveTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
{ cf2_glyphpath_closeOpenPath( glyphpath ); glyphpath->currentCS.x = glyphpath->start.x = x; glyphpath->currentCS.y = glyphpath->start.y = y; glyphpath->moveIsPending = TRUE; if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) || cf2_hintmask_isNew( glyphpath->hintMask ) ) cf2_hintmap_build( &glyphpath->hintMap, glyphpath->hStemHintArray, glyphpath->vStemHintArray, glyphpath->hintMask, glyphpath->hintOriginY, FALSE ); glyphpath->firstHintMap = glyphpath->hintMap; }
pikasTech/PikaPython
C++
MIT License
1,403
/* barrier for prototypes. When creating first closure (cache is NULL), use a forward barrier; this may be the only closure of the prototype (if it is a "regular" function, with a single instance) and the prototype may be big, so it is better to avoid traversing it again. Otherwise, use a backward barrier, to avoid marking all possible instances. */
LUAI_FUNC void luaC_barrierproto_(lua_State *L, Proto *p, Closure *c)
/* barrier for prototypes. When creating first closure (cache is NULL), use a forward barrier; this may be the only closure of the prototype (if it is a "regular" function, with a single instance) and the prototype may be big, so it is better to avoid traversing it again. Otherwise, use a backward barrier, to avoid marking all possible instances. */ LUAI_FUNC void luaC_barrierproto_(lua_State *L, Proto *p, Closure *c)
{ luaC_objbarrier(L, p, c); } else { black2gray(obj2gco(p)); p->gclist = g->grayagain; g->grayagain = obj2gco(p); } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* this function will fetch directory entries from a directory descriptor. */
int dfs_file_getdents(struct dfs_file *fd, struct dirent *dirp, size_t nbytes)
/* this function will fetch directory entries from a directory descriptor. */ int dfs_file_getdents(struct dfs_file *fd, struct dirent *dirp, size_t nbytes)
{ if (fd == NULL) { return -EINVAL; } if (fd->vnode->type != FT_DIRECTORY) { return -EINVAL; } if (fd->vnode->fops->getdents != NULL) { return fd->vnode->fops->getdents(fd, dirp, nbytes); } return -ENOSYS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* N.B. The value read will not be valid if the DAC channel has never been written successfully since the device was attached or since the channel has been used by an AO streaming write command. */
static int pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
/* N.B. The value read will not be valid if the DAC channel has never been written successfully since the device was attached or since the channel has been used by an AO streaming write command. */ static int pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ int i; int chan; chan = CR_CHAN(insn->chanspec); for (i = 0; i < insn->n; i++) { data[i] = devpriv->ao_readback[chan]; } return i; }
robutest/uclinux
C++
GPL-2.0
60
/* Main clock source selection between DFLL and OSC16M. */
static void main_clock_select(const enum system_clock_source clock_source)
/* Main clock source selection between DFLL and OSC16M. */ static void main_clock_select(const enum system_clock_source clock_source)
{ if (clock_source == SYSTEM_CLOCK_SOURCE_DFLL) { main_clock_select_dfll(); system_clock_source_disable(SYSTEM_CLOCK_SOURCE_OSC16M); } else if (clock_source == SYSTEM_CLOCK_SOURCE_OSC16M) { main_clock_select_osc16m(); system_clock_source_disable(SYSTEM_CLOCK_SOURCE_DFLL); system_gclk_chan_disable(OSCCTRL_GCLK_ID_DFLL48); system_gclk_gen_disable(GCLK_GENERATOR_1); } else { return ; } }
memfault/zero-to-main
C++
null
200
/* Boards that are compatible with this generic platform support are listed in a 'board' table. Setup the architecture */
static void __init mpc5200_simple_setup_arch(void)
/* Boards that are compatible with this generic platform support are listed in a 'board' table. Setup the architecture */ static void __init mpc5200_simple_setup_arch(void)
{ if (ppc_md.progress) ppc_md.progress("mpc5200_simple_setup_arch()", 0); mpc52xx_map_common_devices(); mpc5200_setup_xlb_arbiter(); mpc52xx_setup_pci(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The XPS TFT Controller can be accessed through PLB or DCR interface. To perform the read/write on the registers we need to check on which bus its connected and call the appropriate write API. */
static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset, u32 val)
/* The XPS TFT Controller can be accessed through PLB or DCR interface. To perform the read/write on the registers we need to check on which bus its connected and call the appropriate write API. */ static void xilinx_fb_out_be32(struct xilinxfb_drvdata *drvdata, u32 offset, u32 val)
{ if (drvdata->flags & PLB_ACCESS_FLAG) out_be32(drvdata->regs + (offset << 2), val); else dcr_write(drvdata->dcr_host, offset, val); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int main()
/* This file is part of the Simba project. */ int main()
{ sys_start(); esp_wifi_set_op_mode(esp_wifi_op_mode_softap_t); if (esp_wifi_softap_init("Simba", NULL) != 0) { std_printf(FSTR("Failed to configure the Soft AP.\r\n")); } while (1) { esp_wifi_print(sys_get_stdout()); thrd_sleep(2); } return (0); }
eerimoq/simba
C++
Other
337
/* Data received over USB OUT endpoint are sent over CDC interface through this function. */
static int8_t CDC_Receive_FS(uint8_t *Buf, uint32_t *Len)
/* Data received over USB OUT endpoint are sent over CDC interface through this function. */ static int8_t CDC_Receive_FS(uint8_t *Buf, uint32_t *Len)
{ USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]); USBD_CDC_ReceivePacket(&hUsbDeviceFS); return (USBD_OK); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Register the Baboon interrupt dispatcher on nubus slot $C. */
void __init baboon_register_interrupts(void)
/* Register the Baboon interrupt dispatcher on nubus slot $C. */ void __init baboon_register_interrupts(void)
{ baboon_disabled = 0; if (request_irq(IRQ_NUBUS_C, baboon_irq, 0, "baboon", (void *)baboon)) pr_err("Couldn't register baboon interrupt\n"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base MCAN peripheral base address. param handle MCAN handle pointer. param bufferIdx The MCAN Buffer index. */
void MCAN_TransferAbortSend(CAN_Type *base, mcan_handle_t *handle, uint8_t bufferIdx)
/* param base MCAN peripheral base address. param handle MCAN handle pointer. param bufferIdx The MCAN Buffer index. */ void MCAN_TransferAbortSend(CAN_Type *base, mcan_handle_t *handle, uint8_t bufferIdx)
{ assert(NULL != handle); assert(bufferIdx <= 63U); MCAN_DisableTransmitBufferInterrupts(base, bufferIdx); MCAN_DisableInterrupts(base, CAN_IE_TCE_MASK); MCAN_TransmitCancelRequest(base, bufferIdx); handle->bufferFrameBuf[bufferIdx] = NULL; handle->bufferState[bufferIdx] = (uint8_t)kMCAN_StateIdle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get to know the Tx FIFO is Empty or not from the specified port. */
xtBoolean UARTFIFOTxIsEmpty(unsigned long ulBase)
/* Get to know the Tx FIFO is Empty or not from the specified port. */ xtBoolean UARTFIFOTxIsEmpty(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); return((xHWREG(ulBase + USART_LSR) & USART_LSR_TX_FIFO_EMPTY) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Description: Linux uses plugging to build bigger requests queues before letting the device have at them. If a queue is plugged, the I/O scheduler is still adding and merging requests on the queue. Once the queue gets unplugged, the request_fn defined for the queue is invoked and transfers started. */
void generic_unplug_device(struct request_queue *q)
/* Description: Linux uses plugging to build bigger requests queues before letting the device have at them. If a queue is plugged, the I/O scheduler is still adding and merging requests on the queue. Once the queue gets unplugged, the request_fn defined for the queue is invoked and transfers started. */ void generic_unplug_device(struct request_queue *q)
{ if (blk_queue_plugged(q)) { spin_lock_irq(q->queue_lock); __generic_unplug_device(q); spin_unlock_irq(q->queue_lock); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* fb_register_client - register a client notifier @nb: notifier block to callback on events */
int fb_register_client(struct notifier_block *nb)
/* fb_register_client - register a client notifier @nb: notifier block to callback on events */ int fb_register_client(struct notifier_block *nb)
{ return blocking_notifier_chain_register(&fb_notifier_list, nb); }
robutest/uclinux
C++
GPL-2.0
60
/* retval kStatus_Success Started successfully. retval kStatus_CSI_QueueFull Could not submit because there is no room in queue. */
status_t CSI_TransferSubmitEmptyBuffer(CSI_Type *base, csi_handle_t *handle, uint32_t frameBuffer)
/* retval kStatus_Success Started successfully. retval kStatus_CSI_QueueFull Could not submit because there is no room in queue. */ status_t CSI_TransferSubmitEmptyBuffer(CSI_Type *base, csi_handle_t *handle, uint32_t frameBuffer)
{ uint32_t csicr1; csicr1 = CSI_REG_CR1(base); CSI_REG_CR1(base) = (csicr1 & ~(CSI_CR1_FB2_DMA_DONE_INTEN_MASK | CSI_CR1_FB1_DMA_DONE_INTEN_MASK)); CSI_TransferPutEmptyBuffer(handle, frameBuffer); CSI_REG_CR1(base) = csicr1; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* IO bfa callback is pending. IO resource cannot be freed. */
static void bfa_ioim_sm_hcb_free(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
/* IO bfa callback is pending. IO resource cannot be freed. */ static void bfa_ioim_sm_hcb_free(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
{ bfa_trc(ioim->bfa, ioim->iotag); bfa_trc(ioim->bfa, event); switch (event) { case BFA_IOIM_SM_HCB: bfa_sm_set_state(ioim, bfa_ioim_sm_resfree); list_del(&ioim->qe); list_add_tail(&ioim->qe, &ioim->fcpim->ioim_resfree_q); break; case BFA_IOIM_SM_FREE: bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); break; case BFA_IOIM_SM_CLEANUP: bfa_ioim_notify_cleanup(ioim); break; case BFA_IOIM_SM_HWFAIL: bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); break; default: bfa_assert(0); } }
robutest/uclinux
C++
GPL-2.0
60
/* USART Receiver DMA Enable. DMA is available on: */
void usart_enable_rx_dma(uint32_t usart)
/* USART Receiver DMA Enable. DMA is available on: */ void usart_enable_rx_dma(uint32_t usart)
{ USART_CR3(usart) |= USART_CR3_DMAR; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume location server */
static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
/* open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume location server */ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
{ struct afs_cell *cell; struct seq_file *m; int ret; cell = PDE(inode)->data; if (!cell) return -ENOENT; ret = seq_open(file, &afs_proc_cell_vlservers_ops); if (ret<0) return ret; m = file->private_data; m->private = cell; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Setup CS4 to enable the Board Control/Status registers. Otherwise the smcs won't work. */
int board_early_init_f(void)
/* Setup CS4 to enable the Board Control/Status registers. Otherwise the smcs won't work. */ int board_early_init_f(void)
{ volatile t_ep_regs *regs = (t_ep_regs *) CONFIG_SYS_REGS_BASE; volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; volatile memctl8260_t *memctl = &immap->im_memctl; memctl->memc_br4 = CONFIG_SYS_BR4_PRELIM; memctl->memc_or4 = CONFIG_SYS_OR4_PRELIM; regs->bcsr1 = 0x62; regs->bcsr2 = 0x30; return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* This function decodes the Get Zone Information Response payload. */
static void dissect_zcl_ias_ace_get_zone_info_res(tvbuff_t *tvb, proto_tree *tree, guint *offset)
/* This function decodes the Get Zone Information Response payload. */ static void dissect_zcl_ias_ace_get_zone_info_res(tvbuff_t *tvb, proto_tree *tree, guint *offset)
{ proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_id, tvb, *offset, 1, ENC_LITTLE_ENDIAN); *offset += 1; proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_zone_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; proto_tree_add_item(tree, hf_zbee_zcl_ias_ace_ieee_add, tvb, *offset, 8, ENC_NA); *offset += 8; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This routine just returns the corresponding bus address. Actual mapping occurs in dma_region_create_linear(). */
static int dma_sb_map_area_linear(struct ps3_dma_region *r, unsigned long virt_addr, unsigned long len, dma_addr_t *bus_addr, u64 iopte_flag)
/* This routine just returns the corresponding bus address. Actual mapping occurs in dma_region_create_linear(). */ static int dma_sb_map_area_linear(struct ps3_dma_region *r, unsigned long virt_addr, unsigned long len, dma_addr_t *bus_addr, u64 iopte_flag)
{ unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr) : virt_addr; *bus_addr = dma_sb_lpar_to_bus(r, ps3_mm_phys_to_lpar(phys_addr)); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* RSWDT interrupt handler.RSWDT and WDT are the same as the interrupt number. */
void WDT_Handler(void)
/* RSWDT interrupt handler.RSWDT and WDT are the same as the interrupt number. */ void WDT_Handler(void)
{ RSWDT->RSWDT_SR; gs_rswdt_triggered = 1; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Routine used to register frame end routine. The routine should only be registered when the dissector is used in the frame, not in the proto_register_XXX function. */
void register_frame_end_routine(packet_info *pinfo, void(*func)(void))
/* Routine used to register frame end routine. The routine should only be registered when the dissector is used in the frame, not in the proto_register_XXX function. */ void register_frame_end_routine(packet_info *pinfo, void(*func)(void))
{ pinfo->frame_end_routines = g_slist_append(pinfo->frame_end_routines, (gpointer)func); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Arguments to a READ call. Since we read data directly into the page cache, we also set up the reply iovec here so that iov points exactly to the page we want to fetch. */
static int nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
/* Arguments to a READ call. Since we read data directly into the page cache, we also set up the reply iovec here so that iov points exactly to the page we want to fetch. */ static int nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
{ struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; unsigned int replen; u32 offset = (u32)args->offset; u32 count = args->count; p = xdr_encode_fhandle(p, args->fh); *p++ = htonl(offset); *p++ = htonl(count); *p++ = htonl(count); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS_readres_sz) << 2; xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, args->pgbase, count); req->rq_rcv_buf.flags |= XDRBUF_READ; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is like krealloc() except it never frees the originally allocated buffer. Use this if you don't want to free the buffer immediately like, for example, with RCU. */
void* __krealloc(const void *p, size_t new_size, gfp_t flags)
/* This function is like krealloc() except it never frees the originally allocated buffer. Use this if you don't want to free the buffer immediately like, for example, with RCU. */ void* __krealloc(const void *p, size_t new_size, gfp_t flags)
{ void *ret; size_t ks = 0; if (unlikely(!new_size)) return ZERO_SIZE_PTR; if (p) ks = ksize(p); if (ks >= new_size) return (void *)p; ret = kmalloc_track_caller(new_size, flags); if (ret && p) memcpy(ret, p, ks); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* psmouse_poll() - default poll hanlder. Everyone except for ALPS uses it. */
static int psmouse_poll(struct psmouse *psmouse)
/* psmouse_poll() - default poll hanlder. Everyone except for ALPS uses it. */ static int psmouse_poll(struct psmouse *psmouse)
{ return ps2_command(&psmouse->ps2dev, psmouse->packet, PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); }
robutest/uclinux
C++
GPL-2.0
60
/* ZSTD_getcBlockSize() : Provides the size of compressed block from block header */
size_t ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProperties_t *bpPtr)
/* ZSTD_getcBlockSize() : Provides the size of compressed block from block header */ size_t ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProperties_t *bpPtr)
{ if (srcSize < ZSTD_blockHeaderSize) return ERROR(srcSize_wrong); { U32 const cBlockHeader = ZSTD_readLE24(src); U32 const cSize = cBlockHeader >> 3; bpPtr->lastBlock = cBlockHeader & 1; bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3); bpPtr->origSize = cSize; if (bpPtr->blockType == bt_rle) return 1; if (bpPtr->blockType == bt_reserved) return ERROR(corruption_detected); return cSize; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Schedules a request for an IN transaction on an endpoint in host mode. */
void USBHostRequestIN(uint32_t ui32Base, uint32_t ui32Endpoint)
/* Schedules a request for an IN transaction on an endpoint in host mode. */ void USBHostRequestIN(uint32_t ui32Base, uint32_t ui32Endpoint)
{ uint32_t ui32Register; ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7)); if (ui32Endpoint == USB_EP_0) { ui32Register = USB_O_CSRL0; } else { ui32Register = USB_O_RXCSRL1 + EP_OFFSET(ui32Endpoint); } HWREGB(ui32Base + ui32Register) = USB_RXCSRL1_REQPKT; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns zero in case of success, %-EBADF if the volume is damaged because of an interrupted update, %-EBADMSG if the logical eraseblock is already mapped, and other negative error codes in case of other failures. */
int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype)
/* This function returns zero in case of success, %-EBADF if the volume is damaged because of an interrupted update, %-EBADMSG if the logical eraseblock is already mapped, and other negative error codes in case of other failures. */ int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype)
{ struct ubi_volume *vol = desc->vol; struct ubi_device *ubi = vol->ubi; dbg_msg("unmap LEB %d:%d", vol->vol_id, lnum); if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) return -EROFS; if (lnum < 0 || lnum >= vol->reserved_pebs) return -EINVAL; if (dtype != UBI_LONGTERM && dtype != UBI_SHORTTERM && dtype != UBI_UNKNOWN) return -EINVAL; if (vol->upd_marker) return -EBADF; if (vol->eba_tbl[lnum] >= 0) return -EBADMSG; return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0, dtype); }
EmcraftSystems/u-boot
C++
Other
181
/* brief Return PLL0 input clock rate return PLL0 input clock rate */
uint32_t CLOCK_GetPLL0InClockRate(void)
/* brief Return PLL0 input clock rate return PLL0 input clock rate */ uint32_t CLOCK_GetPLL0InClockRate(void)
{ uint32_t clkRate = 0U; switch ((SYSCON->PLL0CLKSEL & SYSCON_PLL0CLKSEL_SEL_MASK)) { case 0x00U: clkRate = CLK_FRO_12MHZ; break; case 0x01U: clkRate = CLOCK_GetExtClkFreq(); break; case 0x02U: clkRate = CLOCK_GetFro1MFreq(); break; case 0x03U: clkRate = CLOCK_GetOsc32KFreq(); break; default: clkRate = 0U; break; } return clkRate; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Return an allocated memory block back to a Memory Pool. */
__STATIC_INLINE osStatus_t isrRtxMemoryPoolFree(osMemoryPoolId_t mp_id, void *block)
/* Return an allocated memory block back to a Memory Pool. */ __STATIC_INLINE osStatus_t isrRtxMemoryPoolFree(osMemoryPoolId_t mp_id, void *block)
{ EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter); return osErrorParameter; } status = osRtxMemoryPoolFree(&mp->mp_info, block); if (status == osOK) { osRtxPostProcess(osRtxObject(mp)); EvrRtxMemoryPoolDeallocated(mp, block); } else { EvrRtxMemoryPoolFreeFailed(mp, block); } return status; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient. */
int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient. */ int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
{ if (d->compat_xstats) { d->xstats = st; d->xstats_len = len; } if (d->tail) return gnet_stats_copy(d, TCA_STATS_APP, st, len); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USBH_AUDIO_SOFProcess The function is for managing the SOF callback. */
static USBH_StatusTypeDef USBH_AUDIO_SOFProcess(USBH_HandleTypeDef *phost)
/* USBH_AUDIO_SOFProcess The function is for managing the SOF callback. */ static USBH_StatusTypeDef USBH_AUDIO_SOFProcess(USBH_HandleTypeDef *phost)
{ UNUSED(phost); return USBH_OK; }
ua1arn/hftrx
C++
null
69
/* Command response callback function for sd_ble_gap_appearance_set BLE command. Callback for decoding the command response return code. */
static uint32_t gap_appearance_set_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_appearance_set BLE command. Callback for decoding the command response return code. */ static uint32_t gap_appearance_set_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_gap_appearance_set_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Get the active VGA device on the specified Host Bridge. */
PCI_IO_DEVICE* LocateVgaDeviceOnHostBridge(IN EFI_HANDLE HostBridgeHandle)
/* Get the active VGA device on the specified Host Bridge. */ PCI_IO_DEVICE* LocateVgaDeviceOnHostBridge(IN EFI_HANDLE HostBridgeHandle)
{ LIST_ENTRY *CurrentLink; PCI_IO_DEVICE *PciIoDevice; CurrentLink = mPciDevicePool.ForwardLink; while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) { PciIoDevice = PCI_IO_DEVICE_FROM_LINK (CurrentLink); if (PciIoDevice->PciRootBridgeIo->ParentHandle == HostBridgeHandle) { PciIoDevice = LocateVgaDevice (PciIoDevice); if (PciIoDevice != NULL) { return PciIoDevice; } } CurrentLink = CurrentLink->ForwardLink; } return NULL; }
tianocore/edk2
C++
Other
4,240
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */
status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */ status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
{ assert(handle); assert(count); if (kFLEXIO_UART_TxIdle == handle->txState) { return kStatus_NoTransferInProgress; } *count = handle->txDataSizeAll - handle->txDataSize; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Sha1Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue)
/* If Sha1Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue)
{ CALL_CRYPTO_SERVICE (Sha1Final, (Sha1Context, HashValue), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Start the PHY. Returns 0 on success, or a negative error code. */
int phy_startup(struct phy_device *phydev)
/* Start the PHY. Returns 0 on success, or a negative error code. */ int phy_startup(struct phy_device *phydev)
{ if (phydev->drv->startup) return phydev->drv->startup(phydev); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will set an interface to the usb device. */
rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
/* This function will set an interface to the usb device. */ rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
{ struct urequest setup; int timeout = USB_TIMEOUT_BASIC; RT_ASSERT(device != RT_NULL); setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_INTERFACE; setup.bRequest = USB_REQ_SET_INTERFACE; setup.wIndex = 0; setup.wLength = 0; setup.wValue = intf; if(rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) != 8) { return RT_ERROR; } return RT_EOK; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI SdDxeComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI SdDxeComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mSdDxeDriverNameTable, DriverName, (BOOLEAN)(This == &gSdDxeComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Strictly speaking, for a somewhat constant set of clients where each client gets a constant bandwidth and is just enabled or disabled (somewhat dynamically), no action is necessary here to avoid starvation for non-zero-allocation clients, as the allocated slots will just be unused. However, handing out those unused slots to active clients avoids needless latency if the "fixed scheme" would give unclaimed slots to an eager low-index client. */
void crisv32_arbiter_deallocate_bandwidth(int client, int region)
/* Strictly speaking, for a somewhat constant set of clients where each client gets a constant bandwidth and is just enabled or disabled (somewhat dynamically), no action is necessary here to avoid starvation for non-zero-allocation clients, as the allocated slots will just be unused. However, handing out those unused slots to active clients avoids needless latency if the "fixed scheme" would give unclaimed slots to an eager low-index client. */ void crisv32_arbiter_deallocate_bandwidth(int client, int region)
{ int i; int total_assigned = 0; requested_slots[region][client] = 0; active_clients[region][client] = 0; for (i = 0; i < NBR_OF_CLIENTS; i++) total_assigned += requested_slots[region][i]; crisv32_arbiter_config(region, NBR_OF_SLOTS - total_assigned); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function calculates and returns current UBIFS liability, i.e. the amount of bytes UBIFS has "promised" to write to the media. */
static long long get_liability(struct ubifs_info *c)
/* This function calculates and returns current UBIFS liability, i.e. the amount of bytes UBIFS has "promised" to write to the media. */ static long long get_liability(struct ubifs_info *c)
{ long long liab; spin_lock(&c->space_lock); liab = c->budg_idx_growth + c->budg_data_growth + c->budg_dd_growth; spin_unlock(&c->space_lock); return liab; }
robutest/uclinux
C++
GPL-2.0
60
/* Note: The caller must have first initialized the iterator with the AmlInitializeIterator () function. */
EFI_STATUS EFIAPI AmlDeleteIterator(IN AML_TREE_ITERATOR *Iterator)
/* Note: The caller must have first initialized the iterator with the AmlInitializeIterator () function. */ EFI_STATUS EFIAPI AmlDeleteIterator(IN AML_TREE_ITERATOR *Iterator)
{ if (Iterator == NULL) { ASSERT (0); return EFI_INVALID_PARAMETER; } FreePool (Iterator); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Unregister the ISR. Use this function to unregister a ISR to the RAM table. */
void system_unregister_isr(enum ram_isr_table_index isr_index)
/* Unregister the ISR. Use this function to unregister a ISR to the RAM table. */ void system_unregister_isr(enum ram_isr_table_index isr_index)
{ uint32_t *temp; temp = (uint32_t *)(isr_index * 4 + ISR_RAM_MAP_START_ADDRESS); *temp = 0; }
memfault/zero-to-main
C++
null
200
/* This function returns pointer to next command iocb entry in the command ring. The caller must hold hbalock to prevent other threads consume the next command iocb. SLI-2/SLI-3 provide different sized iocbs. */
static IOCB_t* lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
/* This function returns pointer to next command iocb entry in the command ring. The caller must hold hbalock to prevent other threads consume the next command iocb. SLI-2/SLI-3 provide different sized iocbs. */ static IOCB_t* lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{ return (IOCB_t *) (((char *) pring->cmdringaddr) + pring->cmdidx * phba->iocb_cmd_size); }
robutest/uclinux
C++
GPL-2.0
60
/* ixgb_rx_checksum - Receive Checksum Offload for 82597. @adapter: board private structure @rx_desc: receive descriptor @sk_buff: socket buffer with received data */
static void ixgb_rx_checksum(struct ixgb_adapter *adapter, struct ixgb_rx_desc *rx_desc, struct sk_buff *skb)
/* ixgb_rx_checksum - Receive Checksum Offload for 82597. @adapter: board private structure @rx_desc: receive descriptor @sk_buff: socket buffer with received data */ static void ixgb_rx_checksum(struct ixgb_adapter *adapter, struct ixgb_rx_desc *rx_desc, struct sk_buff *skb)
{ if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) || (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) { skb->ip_summed = CHECKSUM_NONE; return; } if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) { skb->ip_summed = CHECKSUM_NONE; adapter->hw_csum_rx_error++; } else { skb->ip_summed = CHECKSUM_UNNECESSARY; adapter->hw_csum_rx_good++; } }
robutest/uclinux
C++
GPL-2.0
60
/* If Name is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). If Value is NULL, then ASSERT(). */
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
/* If Name is NULL, then ASSERT(). If Guid is NULL, then ASSERT(). If Value is NULL, then ASSERT(). */ EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
{ EFI_STATUS Status; UINTN BufferSize; ASSERT (Name != NULL && Guid != NULL && Value != NULL); BufferSize = 0; *Value = NULL; if (Size != NULL) { *Size = 0; } Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value); if (Status != EFI_BUFFER_TOO_SMALL) { return Status; } *Value = AllocatePool (BufferSize); ASSERT (*Value != NULL); if (*Value == NULL) { return EFI_OUT_OF_RESOURCES; } Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value); if (EFI_ERROR (Status)) { FreePool (*Value); *Value = NULL; } if (Size != NULL) { *Size = BufferSize; } return Status; }
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciRead32(IN UINTN Address)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciRead32(IN UINTN Address)
{ ASSERT_INVALID_PCI_ADDRESS (Address, 3); return DxePciLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint32); }
tianocore/edk2
C++
Other
4,240
/* Enqueue a received packet to all the IP children that share the same interface. */
INTN Ip6InterfaceEnquePacket(IN IP6_SERVICE *IpSb, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet, IN IP6_INTERFACE *IpIf)
/* Enqueue a received packet to all the IP children that share the same interface. */ INTN Ip6InterfaceEnquePacket(IN IP6_SERVICE *IpSb, IN EFI_IP6_HEADER *Head, IN NET_BUF *Packet, IN IP6_INTERFACE *IpIf)
{ IP6_PROTOCOL *IpInstance; IP6_CLIP_INFO *Info; LIST_ENTRY *Entry; INTN Enqueued; INTN LocalType; INTN SavedType; LocalType = 0; Info = IP6_GET_CLIP_INFO (Packet); if (IpIf->PromiscRecv) { LocalType = Ip6Promiscuous; } else { LocalType = Info->CastType; } SavedType = Info->CastType; Info->CastType = (UINT32)LocalType; Enqueued = 0; NET_LIST_FOR_EACH (Entry, &IpIf->IpInstances) { IpInstance = NET_LIST_USER_STRUCT (Entry, IP6_PROTOCOL, AddrLink); NET_CHECK_SIGNATURE (IpInstance, IP6_PROTOCOL_SIGNATURE); if (Ip6InstanceEnquePacket (IpInstance, Head, Packet) == EFI_SUCCESS) { Enqueued++; } } Info->CastType = (UINT32)SavedType; return Enqueued; }
tianocore/edk2
C++
Other
4,240
/* Set the Number of Wait States. Used to match the system clock to the FLASH memory access time. See the programming manual for more information on clock speed ranges. The latency must be changed to the appropriate value */
void flash_set_ws(uint32_t ws)
/* Set the Number of Wait States. Used to match the system clock to the FLASH memory access time. See the programming manual for more information on clock speed ranges. The latency must be changed to the appropriate value */ void flash_set_ws(uint32_t ws)
{ uint32_t reg32; reg32 = FLASH_ACR; reg32 &= ~((1 << 0) | (1 << 1) | (1 << 2)); reg32 |= ws; FLASH_ACR = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* 3. LCLS-Break-Request No data 3. CSFB Indication No data 3. Source eNB to target eNB transparent information (E-UTRAN) 3. CS to PS SRVCC Indication 3. CN to MS transparent information 3. Selected PLMN ID */
static guint16 be_selected_plmn_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3. LCLS-Break-Request No data 3. CSFB Indication No data 3. Source eNB to target eNB transparent information (E-UTRAN) 3. CS to PS SRVCC Indication 3. CN to MS transparent information 3. Selected PLMN ID */ static guint16 be_selected_plmn_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ proto_tree_add_string(tree, hf_gsm_a_bssmap_selected_plmn_id, tvb, offset, 3, dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, TRUE)); return 3; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Do OR operation with the value of the specified SD host controller mmio register. */
EFI_STATUS EFIAPI SdPeimHcOrMmio(IN UINTN Address, IN UINT8 Count, IN VOID *OrData)
/* Do OR operation with the value of the specified SD host controller mmio register. */ EFI_STATUS EFIAPI SdPeimHcOrMmio(IN UINTN Address, IN UINT8 Count, IN VOID *OrData)
{ EFI_STATUS Status; UINT64 Data; UINT64 Or; Status = SdPeimHcRwMmio (Address, TRUE, Count, &Data); if (EFI_ERROR (Status)) { return Status; } if (Count == 1) { Or = *(UINT8 *)OrData; } else if (Count == 2) { Or = *(UINT16 *)OrData; } else if (Count == 4) { Or = *(UINT32 *)OrData; } else if (Count == 8) { Or = *(UINT64 *)OrData; } else { return EFI_INVALID_PARAMETER; } Data |= Or; Status = SdPeimHcRwMmio (Address, FALSE, Count, &Data); return Status; }
tianocore/edk2
C++
Other
4,240
/* If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI HmacSha384All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
/* If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI HmacSha384All(IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
{ return HmacMdAll (EVP_sha384 (), Data, DataSize, Key, KeySize, HmacValue); }
tianocore/edk2
C++
Other
4,240
/* audit_ipc_obj - record audit data for ipc object @ipcp: ipc permissions */
void __audit_ipc_obj(struct kern_ipc_perm *ipcp)
/* audit_ipc_obj - record audit data for ipc object @ipcp: ipc permissions */ void __audit_ipc_obj(struct kern_ipc_perm *ipcp)
{ struct audit_context *context = current->audit_context; context->ipc.uid = ipcp->uid; context->ipc.gid = ipcp->gid; context->ipc.mode = ipcp->mode; context->ipc.has_perm = 0; security_ipc_getsecid(ipcp, &context->ipc.osid); context->type = AUDIT_IPC; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get the LPS22HH temperature sensor output data rate. */
int32_t LPS22HH_TEMP_GetOutputDataRate(LPS22HH_Object_t *pObj, float *Odr)
/* Get the LPS22HH temperature sensor output data rate. */ int32_t LPS22HH_TEMP_GetOutputDataRate(LPS22HH_Object_t *pObj, float *Odr)
{ return LPS22HH_GetOutputDataRate(pObj, Odr); }
eclipse-threadx/getting-started
C++
Other
310
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */
void LedBlinkExit(void)
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */ void LedBlinkExit(void)
{ PTE->PCOR |= GPIO_PSOR_PTSO(1 << 8U); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns whether we are currently executing in SMM mode. */
STATIC BOOLEAN IsInSmm(VOID)
/* Returns whether we are currently executing in SMM mode. */ STATIC BOOLEAN IsInSmm(VOID)
{ BOOLEAN InSmm; InSmm = FALSE; if (gSmmBase2 != NULL) { gSmmBase2->InSmm (gSmmBase2, &InSmm); } return InSmm; }
tianocore/edk2
C++
Other
4,240
/* Read RTC content through its registers using MMIO access. */
STATIC UINT8 MmioRtcRead(IN UINTN Address)
/* Read RTC content through its registers using MMIO access. */ STATIC UINT8 MmioRtcRead(IN UINTN Address)
{ MmioWrite8 ( mRtcIndexRegister, (UINT8)(Address | (UINT8)(MmioRead8 (mRtcIndexRegister) & 0x80)) ); return MmioRead8 (mRtcTargetRegister); }
tianocore/edk2
C++
Other
4,240
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 |GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables or disables the specified DAC channel DMA request. When enabled DMA1 is generated when an external trigger (EXTI Line9, TIM2, TIM3, TIM6 or TIM15 but not a software trigger) occurs. */
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
/* Enables or disables the specified DAC channel DMA request. When enabled DMA1 is generated when an external trigger (EXTI Line9, TIM2, TIM3, TIM6 or TIM15 but not a software trigger) occurs. */ void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
{ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DAC->CR |= (DAC_CR_DMAEN1 << DAC_Channel); } else { DAC->CR &= (~(DAC_CR_DMAEN1 << DAC_Channel)); } }
ajhc/demo-cortex-m3
C++
null
38
/* Reads from an extended PHY register in MMD address space. */
uint16_t EMACPHYMMDRead(uint32_t ui32Base, uint8_t ui8PhyAddr, uint16_t ui16RegAddr)
/* Reads from an extended PHY register in MMD address space. */ uint16_t EMACPHYMMDRead(uint32_t ui32Base, uint8_t ui8PhyAddr, uint16_t ui16RegAddr)
{ ASSERT(ui8PhyAddr < 32); EMACPHYWrite(ui32Base, ui8PhyAddr, EPHY_REGCTL, DEV_ADDR(ui16RegAddr)); EMACPHYWrite(ui32Base, ui8PhyAddr, EPHY_ADDAR, REG_ADDR(ui16RegAddr)); EMACPHYWrite(ui32Base, ui8PhyAddr, EPHY_REGCTL, (0x4000 | DEV_ADDR(ui16RegAddr))); return (EMACPHYRead(ui32Base, ui8PhyAddr, EPHY_ADDAR)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* enable the DSM(data state machine) for data transfer */
void sdio_dsm_enable(void)
/* enable the DSM(data state machine) for data transfer */ void sdio_dsm_enable(void)
{ SDIO_DATACTL |= SDIO_DATACTL_DATAEN; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Makes the native window associated with the given SDL window invisible. */
static void hideWindow(_THIS, SDL_Window *window)
/* Makes the native window associated with the given SDL window invisible. */ static void hideWindow(_THIS, SDL_Window *window)
{ window_impl_t *impl = (window_impl_t *)window->driverdata; const int visible = 0; screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, &visible); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Append the MTRR setting to MTRR setting array. */
RETURN_STATUS MtrrLibAppendVariableMtrr(IN OUT MTRR_MEMORY_RANGE *Mtrrs, IN UINT32 MtrrCapacity, IN OUT UINT32 *MtrrCount, IN UINT64 BaseAddress, IN UINT64 Length, IN MTRR_MEMORY_CACHE_TYPE Type)
/* Append the MTRR setting to MTRR setting array. */ RETURN_STATUS MtrrLibAppendVariableMtrr(IN OUT MTRR_MEMORY_RANGE *Mtrrs, IN UINT32 MtrrCapacity, IN OUT UINT32 *MtrrCount, IN UINT64 BaseAddress, IN UINT64 Length, IN MTRR_MEMORY_CACHE_TYPE Type)
{ if (*MtrrCount == MtrrCapacity) { return RETURN_OUT_OF_RESOURCES; } Mtrrs[*MtrrCount].BaseAddress = BaseAddress; Mtrrs[*MtrrCount].Length = Length; Mtrrs[*MtrrCount].Type = Type; (*MtrrCount)++; return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* set the TSYNC register of the FORMAC to regulate synchronous transmission */
void set_formac_tsync(struct s_smc *smc, long sync_bw)
/* set the TSYNC register of the FORMAC to regulate synchronous transmission */ void set_formac_tsync(struct s_smc *smc, long sync_bw)
{ outpw(FM_A(FM_TSYNC),(unsigned int) (((-sync_bw) >> 5) & 0xffff) ) ; }
robutest/uclinux
C++
GPL-2.0
60
/* Check for a pattern at the given place. Used to search bad block tables and good / bad block identifiers. If the SCAN_EMPTY option is set then check, if all bytes except the pattern area contain 0xff */
static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
/* Check for a pattern at the given place. Used to search bad block tables and good / bad block identifiers. If the SCAN_EMPTY option is set then check, if all bytes except the pattern area contain 0xff */ static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
{ int i, end = 0; uint8_t *p = buf; end = paglen + td->offs; if (td->options & NAND_BBT_SCANEMPTY) { for (i = 0; i < end; i++) { if (p[i] != 0xff) return -1; } } p += end; for (i = 0; i < td->len; i++) { if (p[i] != td->pattern[i]) return -1; } if (td->options & NAND_BBT_SCANEMPTY) { p += td->len; end += td->len; for (i = end; i < len; i++) { if (*p++ != 0xff) return -1; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* We always return the lock_depth we had before calling this function. */
int reiserfs_write_lock_once(struct super_block *s)
/* We always return the lock_depth we had before calling this function. */ int reiserfs_write_lock_once(struct super_block *s)
{ struct reiserfs_sb_info *sb_i = REISERFS_SB(s); if (sb_i->lock_owner != current) { mutex_lock(&sb_i->lock); sb_i->lock_owner = current; return sb_i->lock_depth++; } return sb_i->lock_depth; }
robutest/uclinux
C++
GPL-2.0
60
/* Hint point in y-direction and apply outerTransform. Input */
static void cf2_glyphpath_hintPoint(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *ppt, CF2_Fixed x, CF2_Fixed y)
/* Hint point in y-direction and apply outerTransform. Input */ static void cf2_glyphpath_hintPoint(CF2_GlyphPath glyphpath, CF2_HintMap hintmap, FT_Vector *ppt, CF2_Fixed x, CF2_Fixed y)
{ FT_Vector pt; pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ), FT_MulFix( glyphpath->scaleC, y ) ); pt.y = cf2_hintmap_map( hintmap, y ); ppt->x = ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.a, pt.x ), ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.c, pt.y ), glyphpath->fractionalTranslation.x ) ); ppt->y = ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.b, pt.x ), ADD_INT32( FT_MulFix( glyphpath->font->outerTransform.d, pt.y ), glyphpath->fractionalTranslation.y ) ); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Set the fields of structure stc_tmr6_deadtime_config_t to default values. */
int32_t TMR6_DeadTimeStructInit(stc_tmr6_deadtime_config_t *pstcDeadTimeConfig)
/* Set the fields of structure stc_tmr6_deadtime_config_t to default values. */ int32_t TMR6_DeadTimeStructInit(stc_tmr6_deadtime_config_t *pstcDeadTimeConfig)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcDeadTimeConfig) { pstcDeadTimeConfig->u32EqualUpDown = TMR6_DEADTIME_EQUAL_OFF; pstcDeadTimeConfig->u32BufUp = TMR6_DEADTIME_CNT_UP_BUF_OFF; pstcDeadTimeConfig->u32BufDown = TMR6_DEADTIME_CNT_DOWN_BUF_OFF; pstcDeadTimeConfig->u32BufTransCond = TMR6_DEADTIME_BUF_COND_INVD; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: a value <= 0 if the id of @sibling is >= the id of @new_hook */
gint g_hook_compare_ids(GHook *new_hook, GHook *sibling)
/* Returns: a value <= 0 if the id of @sibling is >= the id of @new_hook */ gint g_hook_compare_ids(GHook *new_hook, GHook *sibling)
{ if (new_hook->hook_id < sibling->hook_id) return -1; else if (new_hook->hook_id > sibling->hook_id) return 1; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* @ec: The error class of the error (enum mvtwsi_error_class). @lc: The last value of the control register. @ls: The last value of the status register. @es: The expected value of the status register. */
uint mvtwsi_error(uint ec, uint lc, uint ls, uint es)
/* @ec: The error class of the error (enum mvtwsi_error_class). @lc: The last value of the control register. @ls: The last value of the status register. @es: The expected value of the status register. */ uint mvtwsi_error(uint ec, uint lc, uint ls, uint es)
{ return ((ec << 24) & 0xFF000000) | ((lc << 16) & 0x00FF0000) | ((ls << 8) & 0x0000FF00) | (es & 0xFF); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns the set of fault triggers currently configured for a given PWM generator. */
uint32_t PWMGenFaultTriggerGet(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Group)
/* Returns the set of fault triggers currently configured for a given PWM generator. */ uint32_t PWMGenFaultTriggerGet(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32Group)
{ ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE)); ASSERT(_PWMGenValid(ui32Gen)); ASSERT((ui32Group == PWM_FAULT_GROUP_0) || (ui32Group == PWM_FAULT_GROUP_1)); if(ui32Group == PWM_FAULT_GROUP_0) { return(HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_FLTSRC0)); } else { return(HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_FLTSRC1)); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function loads znode pointed to by @zbr into the TNC cache and returns pointer to it in case of success and a negative error code in case of failure. */
struct ubifs_znode* ubifs_load_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr, struct ubifs_znode *parent, int iip)
/* This function loads znode pointed to by @zbr into the TNC cache and returns pointer to it in case of success and a negative error code in case of failure. */ struct ubifs_znode* ubifs_load_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr, struct ubifs_znode *parent, int iip)
{ int err; struct ubifs_znode *znode; ubifs_assert(!zbr->znode); znode = kzalloc(c->max_znode_sz, GFP_NOFS); if (!znode) return ERR_PTR(-ENOMEM); err = read_znode(c, zbr->lnum, zbr->offs, zbr->len, znode); if (err) goto out; zbr->znode = znode; znode->parent = parent; znode->time = get_seconds(); znode->iip = iip; return znode; out: kfree(znode); return ERR_PTR(err); }
EmcraftSystems/u-boot
C++
Other
181
/* Sets the value of an SMM register on a specified CPU. If the SMM register is not supported, then no action is performed. */
VOID EFIAPI SmmCpuFeaturesSetSmmRegister(IN UINTN CpuIndex, IN SMM_REG_NAME RegName, IN UINT64 Value)
/* Sets the value of an SMM register on a specified CPU. If the SMM register is not supported, then no action is performed. */ VOID EFIAPI SmmCpuFeaturesSetSmmRegister(IN UINTN CpuIndex, IN SMM_REG_NAME RegName, IN UINT64 Value)
{ if (FeaturePcdGet (PcdSmmFeatureControlEnable) && (RegName == SmmRegFeatureControl)) { AsmWriteMsr64 (SMM_FEATURES_LIB_SMM_FEATURE_CONTROL, Value); } }
tianocore/edk2
C++
Other
4,240
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
{ if(hpcd->Instance==USB_DRD_FS) { __HAL_RCC_USB_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, USB_FS_DN_Pin|USB_FS_DP_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set integral constant, Ki, for the PID controller. */
int32_t cn0415_pid_set_ki(struct cn0415_dev *dev, uint8_t *args)
/* Set integral constant, Ki, for the PID controller. */ int32_t cn0415_pid_set_ki(struct cn0415_dev *dev, uint8_t *args)
{ float kp, ki, kd; ki = atof((char *)args); kp = dev->controller->kp; kd = dev->controller->kd / dev->controller->f_loop; pid_set_constants(dev->controller, kp, ki, kd); dev->param_array[PID_KI_INT] = dev->controller->ki; dev->param_array[PID_KI_DEC] = (uint32_t)(dev->controller->ki * 10000) % 10000; return flash_write(dev->param_array, FLASH_PARAM_SIZE); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Convert double to (signed) quad. We clamp anything that is out of range. */
quad_t __fixdfdi(double x)
/* Convert double to (signed) quad. We clamp anything that is out of range. */ quad_t __fixdfdi(double x)
{ if (x < 0) { if (x <= QUAD_MIN) { return QUAD_MIN; } else { return (quad_t) -(u_quad_t) -x; } } else { if (x >= QUAD_MAX) { return QUAD_MAX; } else { return (quad_t) (u_quad_t) x; } } }
labapart/polymcu
C++
null
201
/* This routine deallocates and removes all devices on the sppecified adapter. */
void qla4xxx_free_ddb_list(struct scsi_qla_host *ha)
/* This routine deallocates and removes all devices on the sppecified adapter. */ void qla4xxx_free_ddb_list(struct scsi_qla_host *ha)
{ struct list_head *ptr; struct ddb_entry *ddb_entry; while (!list_empty(&ha->ddb_list)) { ptr = ha->ddb_list.next; ddb_entry = list_entry(ptr, struct ddb_entry, list); qla4xxx_free_ddb(ha, ddb_entry); } }
robutest/uclinux
C++
GPL-2.0
60
/* When the operation is finished, @callback will be called. You can then call g_drive_poll_for_media_finish() to obtain the result of the operation. */
void g_drive_poll_for_media(GDrive *drive, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* When the operation is finished, @callback will be called. You can then call g_drive_poll_for_media_finish() to obtain the result of the operation. */ void g_drive_poll_for_media(GDrive *drive, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ GDriveIface *iface; g_return_if_fail (G_IS_DRIVE (drive)); iface = G_DRIVE_GET_IFACE (drive); if (iface->poll_for_media == NULL) { g_task_report_new_error (drive, callback, user_data, g_drive_poll_for_media, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("drive doesn't implement polling for media")); return; } (* iface->poll_for_media) (drive, cancellable, callback, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Process the next pending data packet - if there is one */
static int gsp_next_packet(struct garmin_data *garmin_data_p)
/* Process the next pending data packet - if there is one */ static int gsp_next_packet(struct garmin_data *garmin_data_p)
{ int result = 0; struct garmin_packet *pkt = NULL; while ((pkt = pkt_pop(garmin_data_p)) != NULL) { dbg("%s - next pkt: %d", __func__, pkt->seq); result = gsp_send(garmin_data_p, pkt->data, pkt->size); if (result > 0) { kfree(pkt); return result; } kfree(pkt); } return result; }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. */
void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. */ void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)
{ assert(handle != NULL); EDMA_StopTransfer(handle->txHandle); EDMA_StopTransfer(handle->rxHandle); FLEXIO_SPI_EnableDMA(base, (uint32_t)kFLEXIO_SPI_DmaAllEnable, false); handle->txInProgress = false; handle->rxInProgress = false; }
eclipse-threadx/getting-started
C++
Other
310
/* Associate the port and tty pair. Manages any internal refcounts. Pass NULL to deassociate a port */
void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty)
/* Associate the port and tty pair. Manages any internal refcounts. Pass NULL to deassociate a port */ void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty)
{ unsigned long flags; spin_lock_irqsave(&port->lock, flags); if (port->tty) tty_kref_put(port->tty); port->tty = tty_kref_get(tty); spin_unlock_irqrestore(&port->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Find the channel frequency power info with specific frequency. */
static struct chan_freq_power* find_cfp_by_band_and_freq(struct lbs_private *priv, u8 band, u32 freq)
/* Find the channel frequency power info with specific frequency. */ static struct chan_freq_power* find_cfp_by_band_and_freq(struct lbs_private *priv, u8 band, u32 freq)
{ struct chan_freq_power *cfp = NULL; struct region_channel *rc; int i, j; for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { rc = &priv->region_channel[j]; if (!rc->valid || !rc->CFP) continue; if (rc->band != band) continue; for (i = 0; i < rc->nrcfp; i++) { if (rc->CFP[i].freq == freq) { cfp = &rc->CFP[i]; break; } } } if (!cfp && freq) lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by " "band %d / freq %d\n", band, freq); return cfp; }
robutest/uclinux
C++
GPL-2.0
60
/* Used to authenticate blocks of data by generating a hash tag. */
bool AESDataAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t ui32Length, uint32_t *pui32Tag)
/* Used to authenticate blocks of data by generating a hash tag. */ bool AESDataAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t ui32Length, uint32_t *pui32Tag)
{ uint32_t ui32Count; ASSERT(ui32Base == AES_BASE); AESLengthSet(ui32Base, (uint64_t)ui32Length); for(ui32Count = 0; ui32Count < ui32Length; ui32Count += 16) { AESDataWrite(ui32Base, pui32Src + (ui32Count / 4)); } AESTagRead(ui32Base, pui32Tag); return(true); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* First we output enable the LED, then we set the source to be an external module. */
void asd_control_led(struct asd_ha_struct *asd_ha, int phy_id, int op)
/* First we output enable the LED, then we set the source to be an external module. */ void asd_control_led(struct asd_ha_struct *asd_ha, int phy_id, int op)
{ if (phy_id < ASD_MAX_PHYS) { u32 v; v = asd_read_reg_dword(asd_ha, GPIOOER); if (op) v |= (1 << phy_id); else v &= ~(1 << phy_id); asd_write_reg_dword(asd_ha, GPIOOER, v); v = asd_read_reg_dword(asd_ha, GPIOCNFGR); if (op) v |= (1 << phy_id); else v &= ~(1 << phy_id); asd_write_reg_dword(asd_ha, GPIOCNFGR, v); } }
robutest/uclinux
C++
GPL-2.0
60
/* This callback is called after the PCI buss has been reset. Basically, this tries to restart the card from scratch. This is a shortened version of the device probe/discovery code, it resembles the first-half of the () routine. */
static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev)
/* This callback is called after the PCI buss has been reset. Basically, this tries to restart the card from scratch. This is a shortened version of the device probe/discovery code, it resembles the first-half of the () routine. */ static pci_ers_result_t qlge_io_slot_reset(struct pci_dev *pdev)
{ struct net_device *ndev = pci_get_drvdata(pdev); struct ql_adapter *qdev = netdev_priv(ndev); pdev->error_state = pci_channel_io_normal; pci_restore_state(pdev); if (pci_enable_device(pdev)) { QPRINTK(qdev, IFUP, ERR, "Cannot re-enable PCI device after reset.\n"); return PCI_ERS_RESULT_DISCONNECT; } pci_set_master(pdev); return PCI_ERS_RESULT_RECOVERED; }
robutest/uclinux
C++
GPL-2.0
60
/* Set Address USB Request Parameters: None (global SetupPacket) Return Value: TRUE - Success, FALSE - Error */
static uint32_t USB_ReqSetAddress(void)
/* Set Address USB Request Parameters: None (global SetupPacket) Return Value: TRUE - Success, FALSE - Error */ static uint32_t USB_ReqSetAddress(void)
{ case REQUEST_TO_DEVICE: USB_DeviceAddress = 0x80 | SetupPacket.wValue.WB.L; break; default: return (FALSE); } return (TRUE); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Active the Calibration operation for the selected ADC. */
uint32_t ADC_GetCalibrationFactor(ADC_TypeDef *ADCx)
/* Active the Calibration operation for the selected ADC. */ uint32_t ADC_GetCalibrationFactor(ADC_TypeDef *ADCx)
{ uint32_t tmpreg = 0, calibrationcounter = 0, calibrationstatus = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); ADCx->CR |= (uint32_t)ADC_CR_ADCAL; do { calibrationstatus = ADCx->CR & ADC_CR_ADCAL; calibrationcounter++; } while((calibrationcounter != CALIBRATION_TIMEOUT) && (calibrationstatus != 0x00)); if((uint32_t)(ADCx->CR & ADC_CR_ADCAL) == RESET) { tmpreg = ADCx->DR; } else { tmpreg = 0x00000000; } return tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
/* Event handler for the library USB Disconnection event. */ void EVENT_USB_Device_Disconnect(void)
{ LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Configures the wake conditions for the Hibernation module. */
void HibernateWakeSet(unsigned long ulWakeFlags)
/* Configures the wake conditions for the Hibernation module. */ void HibernateWakeSet(unsigned long ulWakeFlags)
{ ASSERT(!(ulWakeFlags & ~(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC))); HWREG(HIB_CTL) = (ulWakeFlags | (HWREG(HIB_CTL) & ~(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC))); }
watterott/WebRadio
C++
null
71