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
/* MSS_GPIO_clear_irq See "mss_gpio.h" for details of how to use this function. */
void MSS_GPIO_clear_irq(mss_gpio_id_t port_id)
/* MSS_GPIO_clear_irq See "mss_gpio.h" for details of how to use this function. */ void MSS_GPIO_clear_irq(mss_gpio_id_t port_id)
{ uint32_t gpio_idx = (uint32_t)port_id; ASSERT(gpio_idx < NB_OF_GPIO); if(gpio_idx < NB_OF_GPIO) { GPIO->GPIO_IRQ = ((uint32_t)1) << gpio_idx; } __ASM volatile ("dsb"); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called with cgroup_mutex held callback_mutex must not be held, as cpuset_attach() will take it. */
static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
/* Called with cgroup_mutex held callback_mutex must not be held, as cpuset_attach() will take it. */ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
{ struct cpuset *parent; if (list_empty(&cs->css.cgroup->css_sets)) return; parent = cs->parent; while (cpumask_empty(parent->cpus_allowed) || nodes_empty(parent->mems_allowed)) parent = parent->parent; move_member_tasks_to_cpuset(cs, parent); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field. */
s32 e1000_get_cable_length_82577(struct e1000_hw *hw)
/* Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field. */ s32 e1000_get_cable_length_82577(struct e1000_hw *hw)
{ struct e1000_phy_info *phy = &hw->phy; s32 ret_val; u16 phy_data, length; ret_val = phy->ops.read_reg(hw, I82577_PHY_DIAG_STATUS, &phy_data); if (ret_val) goto out; length = (phy_data & I82577_DSTATUS_CABLE_LENGTH) >> I82577_DSTATUS_CABLE_LENGTH_SHIFT; if (length == E1000_CABLE_LENGTH_UNDEFINED) ...
robutest/uclinux
C++
GPL-2.0
60
/* @handle: handle of the loaded image @systable: system table ReturnValue: EFI_ST_SUCCESS for success */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table ReturnValue: EFI_ST_SUCCESS for success */ static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
{ efi_status_t ret; boottime = systable->boottime; ret = boottime->locate_protocol(&unicode_collation_protocol_guid, NULL, (void **)&unicode_collation_protocol); if (ret != EFI_SUCCESS) { unicode_collation_protocol = NULL; efi_st_error("Unicode collation protocol is not available.\n"); return EFI_ST_FAIL...
4ms/stm32mp1-baremetal
C++
Other
137
/* Read one bit phy data from PHY controller */
static u16 phy_read_1bit(unsigned long, u32)
/* Read one bit phy data from PHY controller */ static u16 phy_read_1bit(unsigned long, u32)
{ u16 phy_data; outl(0x50000 , ioaddr); udelay(1); phy_data = (inl(ioaddr) >> 19) & 0x1; outl(0x40000 , ioaddr); udelay(1); return phy_data; }
EmcraftSystems/u-boot
C++
Other
181
/* Return 0 - pass the check, -ENODEV - fail the check */
int lpfc_mbox_cmd_check(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
/* Return 0 - pass the check, -ENODEV - fail the check */ int lpfc_mbox_cmd_check(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
{ if (mboxq->mbox_cmpl && mboxq->mbox_cmpl != lpfc_sli_def_mbox_cmpl && mboxq->mbox_cmpl != lpfc_sli_wake_mbox_wait) { if (!mboxq->vport) { lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT, "1814 Mbox x%x failed, no vport\n", mboxq->u.mb.mbxCommand); dump_stack(); return -ENODEV; } } ...
robutest/uclinux
C++
GPL-2.0
60
/* STUSB1602 sets the VBUS_VSAFE0V_Threshold (EN or DIS) (bit2:1 0x2E */
STUSB1602_StatusTypeDef STUSB1602_VBUS_VSAFE0V_Threshold_Set(uint8_t Addr, VBUS_VSAFE0V_Threshold_TypeDef st)
/* STUSB1602 sets the VBUS_VSAFE0V_Threshold (EN or DIS) (bit2:1 0x2E */ STUSB1602_StatusTypeDef STUSB1602_VBUS_VSAFE0V_Threshold_Set(uint8_t Addr, VBUS_VSAFE0V_Threshold_TypeDef st)
{ STUSB1602_StatusTypeDef status = STUSB1602_OK; STUSB1602_VBUS_MONITORING_CTRL_RegTypeDef reg; STUSB1602_ReadReg(&reg.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1); reg.b.VBUS_VSAFE0V_THRESHOLD = st; status = STUSB1602_WriteReg(&reg.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1); return s...
st-one/X-CUBE-USB-PD
C++
null
110
/* Used for clocks that have the same value as the parent clock, divided by some factor */
unsigned long omap2_fixed_divisor_recalc(struct clk *clk)
/* Used for clocks that have the same value as the parent clock, divided by some factor */ unsigned long omap2_fixed_divisor_recalc(struct clk *clk)
{ WARN_ON(!clk->fixed_div); return clk->parent->rate / clk->fixed_div; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get Protected mode code segment with 32-bit default addressing from current GDT table. */
STATIC UINT16 GetProtectedMode32CS(VOID)
/* Get Protected mode code segment with 32-bit default addressing from current GDT table. */ STATIC UINT16 GetProtectedMode32CS(VOID)
{ IA32_DESCRIPTOR GdtrDesc; IA32_SEGMENT_DESCRIPTOR *GdtEntry; UINTN GdtEntryCount; UINT16 Index; Index = (UINT16)-1; AsmReadGdtr (&GdtrDesc); GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR); GdtEntry = (IA32_SEGMENT_DESCRIPTOR ...
tianocore/edk2
C++
Other
4,240
/* copy TX descriptor to buffer mem append FC field and MAC frame if more bit is set in descr append pointer to descriptor (endless loop) else append 'end of chain' pointer */
static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac, unsigned off, int len)
/* copy TX descriptor to buffer mem append FC field and MAC frame if more bit is set in descr append pointer to descriptor (endless loop) else append 'end of chain' pointer */ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac, unsigned off, int len)
{ int i ; __le32 *p ; CHECK_NPP() ; MARW(off) ; p = (__le32 *) mac ; for (i = (len + 3)/4 ; i ; i--) { if (i == 1) { outpw(FM_A(FM_CMDREG2),FM_ISTTB) ; } write_mdr(smc,le32_to_cpu(*p)) ; p++ ; } outpw(FM_A(FM_CMDREG2),FM_ISTTB) ; write_mdr(smc,td) ; }
robutest/uclinux
C++
GPL-2.0
60
/* The number of bytes actually written to the SBI console is returned. If the return value is less than NumberOfBytes, then the write operation failed. */
UINTN SbiLegacyPutchar(IN UINT8 *Buffer, IN UINTN NumberOfBytes)
/* The number of bytes actually written to the SBI console is returned. If the return value is less than NumberOfBytes, then the write operation failed. */ UINTN SbiLegacyPutchar(IN UINT8 *Buffer, IN UINTN NumberOfBytes)
{ SBI_RET Ret; UINTN Index; for (Index = 0; Index < NumberOfBytes; Index++) { Ret = SbiCall (SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, 1, Buffer[Index]); if ((INT64)Ret.Error < 0) { break; } } return Index; }
tianocore/edk2
C++
Other
4,240
/* Input an ACK from NVRAM after writing, change GPIO0 to input and when done back to an output */
static void S24C16_read_ack(struct sym_device *np, u_char *read_bit, u_char *gpreg, u_char *gpcntl)
/* Input an ACK from NVRAM after writing, change GPIO0 to input and when done back to an output */ static void S24C16_read_ack(struct sym_device *np, u_char *read_bit, u_char *gpreg, u_char *gpcntl)
{ OUTB(np, nc_gpcntl, *gpcntl | 0x01); S24C16_do_bit(np, read_bit, 1, gpreg); OUTB(np, nc_gpcntl, *gpcntl); }
robutest/uclinux
C++
GPL-2.0
60
/* Set bits in the HMATRIX Special Function Register (SFR) used by the External Bus Interface (EBI). This can be used to enable special features like CompactFlash support, NAND Flash support, etc. on certain chipselects. */
static void set_ebi_sfr_bits(u32 mask)
/* Set bits in the HMATRIX Special Function Register (SFR) used by the External Bus Interface (EBI). This can be used to enable special features like CompactFlash support, NAND Flash support, etc. on certain chipselects. */ static void set_ebi_sfr_bits(u32 mask)
{ hmatrix_sfr_set_bits(HMATRIX_SLAVE_EBI, mask); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: nilfs_cpfile_put_checkpoint() releases the checkpoint specified by @cno. @bh must be the buffer head which has been returned by a previous call to nilfs_cpfile_get_checkpoint() with @cno. */
void nilfs_cpfile_put_checkpoint(struct inode *cpfile, __u64 cno, struct buffer_head *bh)
/* Description: nilfs_cpfile_put_checkpoint() releases the checkpoint specified by @cno. @bh must be the buffer head which has been returned by a previous call to nilfs_cpfile_get_checkpoint() with @cno. */ void nilfs_cpfile_put_checkpoint(struct inode *cpfile, __u64 cno, struct buffer_head *bh)
{ kunmap(bh->b_page); brelse(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* Set a value 1 to the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinSet(unsigned long ulPort, unsigned long ulPins)
/* Set a value 1 to the specified pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinSet(unsigned long ulPort, unsigned long ulPins)
{ xASSERT(GPIOBaseValid(ulPort)); xHWREG(ulPort + GPIO_BSRR) = ulPins; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Update the ReachableTime in IP6 service binding instance data, in milliseconds. */
VOID Ip6UpdateReachableTime(IN OUT IP6_SERVICE *IpSb)
/* Update the ReachableTime in IP6 service binding instance data, in milliseconds. */ VOID Ip6UpdateReachableTime(IN OUT IP6_SERVICE *IpSb)
{ UINT32 Random; Random = (NetRandomInitSeed () / 4294967295UL) * IP6_RANDOM_FACTOR_SCALE; Random = Random + IP6_MIN_RANDOM_FACTOR_SCALED; IpSb->ReachableTime = (IpSb->BaseReachableTime * Random) / IP6_RANDOM_FACTOR_SCALE; }
tianocore/edk2
C++
Other
4,240
/* Open the NvVars file for reading or writing */
EFI_STATUS FileHandleEmpty(IN EFI_FILE_HANDLE File)
/* Open the NvVars file for reading or writing */ EFI_STATUS FileHandleEmpty(IN EFI_FILE_HANDLE File)
{ EFI_STATUS Status; EFI_FILE_INFO *FileInfo; FileInfo = FileHandleGetInfo (File); if (FileInfo == NULL) { return EFI_INVALID_PARAMETER; } if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0) { FreePool (FileInfo); return EFI_INVALID_PARAMETER; } if (FileInfo->FileSize == 0) { FreeP...
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 PciAnd32(IN UINTN Address, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciAnd32(IN UINTN Address, IN UINT32 AndData)
{ return mRunningOnQ35 ? PciExpressAnd32 (Address, AndData) : PciCf8And32 (Address, AndData); }
tianocore/edk2
C++
Other
4,240
/* Event handler for the CCID_PC_to_RDR_GetSlotStatus. THis message is sent to the device whenever an application at the host wants to get the current slot status. */
uint8_t CCID_GetSlotStatus(uint8_t Slot, uint8_t *const Error)
/* Event handler for the CCID_PC_to_RDR_GetSlotStatus. THis message is sent to the device whenever an application at the host wants to get the current slot status. */ uint8_t CCID_GetSlotStatus(uint8_t Slot, uint8_t *const Error)
{ if (Slot == 0) { *Error = CCID_ERROR_NO_ERROR; return CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_PRESENTANDACTIVE; } else { *Error = CCID_ERROR_SLOT_NOT_FOUND; return CCID_COMMANDSTATUS_FAILED | CCID_ICCSTATUS_NOICCPRESENT; } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Wait for one or more Signal Flags to become signaled for the current RUNNING thread. */
os_InRegs osEvent_type svcSignalWait(int32_t signals, uint32_t millisec)
/* Wait for one or more Signal Flags to become signaled for the current RUNNING thread. */ os_InRegs osEvent_type svcSignalWait(int32_t signals, uint32_t millisec)
{ ret.status = osErrorValue; return osEvent_ret_status; } if (signals != 0) { res = rt_evt_wait((uint16_t)signals, rt_ms2tick(millisec), __TRUE); } else { res = rt_evt_wait(0xFFFFU, rt_ms2tick(millisec), __FALSE); } if (res == OS_R_EVT) { ret.status = osEventSignal; ret.value...
labapart/polymcu
C++
null
201
/* It is the caller's responsibility to check the DataNode has been removed from the tree and is not referencing any other node in the tree. */
STATIC EFI_STATUS EFIAPI AmlDeleteDataNode(IN AML_DATA_NODE *DataNode)
/* It is the caller's responsibility to check the DataNode has been removed from the tree and is not referencing any other node in the tree. */ STATIC EFI_STATUS EFIAPI AmlDeleteDataNode(IN AML_DATA_NODE *DataNode)
{ if (!IS_AML_DATA_NODE (DataNode)) { ASSERT (0); return EFI_INVALID_PARAMETER; } if (DataNode->Buffer != NULL) { FreePool (DataNode->Buffer); } else { ASSERT (0); return EFI_INVALID_PARAMETER; } FreePool (DataNode); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Check if the offset is at the expected location, otherwise warn about it. */
static gboolean c_warn_size(proto_tree *tree, tvbuff_t *tvb, guint act, guint exp, c_pkt_data *data)
/* Check if the offset is at the expected location, otherwise warn about it. */ static gboolean c_warn_size(proto_tree *tree, tvbuff_t *tvb, guint act, guint exp, c_pkt_data *data)
{ if (act < exp) return c_warn_unused (tree, tvb, act, exp, data); else return c_warn_overrun(tree, tvb, exp, act, data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Locking Note: This function is called from the EM and will lock the disc_mutex before calling the handler for the request. */
static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport)
/* Locking Note: This function is called from the EM and will lock the disc_mutex before calling the handler for the request. */ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp, struct fc_lport *lport)
{ u8 op; struct fc_disc *disc = &lport->disc; op = fc_frame_payload_op(fp); switch (op) { case ELS_RSCN: mutex_lock(&disc->disc_mutex); fc_disc_recv_rscn_req(sp, fp, disc); mutex_unlock(&disc->disc_mutex); break; default: FC_DISC_DBG(disc, "Received an unsupported request, " "the opcode is (%x)\n...
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_release_name_finish(_GFreedesktopDBus *proxy, guint *out_value, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_release_name_finish(_GFreedesktopDBus *proxy, guint *out_value, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(u)", out_value); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Writes and returns a new value to DR1. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmWriteDr1(IN UINTN Value)
/* Writes and returns a new value to DR1. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmWriteDr1(IN UINTN Value)
{ _asm { mov eax, Value mov dr1, eax } }
tianocore/edk2
C++
Other
4,240
/* hpsb_iso_n_ready - returns number of packets ready to send or receive */
int hpsb_iso_n_ready(struct hpsb_iso *iso)
/* hpsb_iso_n_ready - returns number of packets ready to send or receive */ int hpsb_iso_n_ready(struct hpsb_iso *iso)
{ unsigned long flags; int val; spin_lock_irqsave(&iso->lock, flags); val = iso->n_ready_packets; spin_unlock_irqrestore(&iso->lock, flags); return val; }
robutest/uclinux
C++
GPL-2.0
60
/* 7.3.2.9.3 Slice data partition C RBSP syntax slice_data_partition_c_layer_rbsp( ) */
static void dissect_h264_slice_data_partition_c_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
/* 7.3.2.9.3 Slice data partition C RBSP syntax slice_data_partition_c_layer_rbsp( ) */ static void dissect_h264_slice_data_partition_c_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
{ gint bit_offset; bit_offset = offset <<3; dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V); proto_tree_add_expert(tree, pinfo, &ei_h264_undecoded, tvb, bit_offset>>3, -1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* MW: OK its ugly, but tell me a better solution without copying the packet to a temporary buffer :-) */
static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc, int len)
/* MW: OK its ugly, but tell me a better solution without copying the packet to a temporary buffer :-) */ static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc, int len)
{ unsigned char *ptr = d; unsigned char c=0; *ptr++ = END; while (len > 0) { if (len > 2) c = *s++; else if (len > 1) c = crc >> 8; else if (len > 0) c = crc & 0xff; len--; switch (c) { case END: *ptr++ = ESC; *ptr++ = ESC_END; break; case ESC: *ptr++ = ESC; *ptr++ = ESC_ESC; ...
robutest/uclinux
C++
GPL-2.0
60
/* See also similar routines (i.e. wait_for_completion_timeout()) with timeout and interrupt capability. Also see complete(). */
void __sched wait_for_completion(struct completion *x)
/* See also similar routines (i.e. wait_for_completion_timeout()) with timeout and interrupt capability. Also see complete(). */ void __sched wait_for_completion(struct completion *x)
{ wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine is used to handle evdev EVIOCGKEY ioctl. If the key is not found, returns -EINVAL, otherwise, returns 0. */
static int ir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
/* This routine is used to handle evdev EVIOCGKEY ioctl. If the key is not found, returns -EINVAL, otherwise, returns 0. */ static int ir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
{ int elem; struct ir_input_dev *ir_dev = input_get_drvdata(dev); struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; elem = ir_seek_table(rc_tab, scancode); if (elem >= 0) { *keycode = rc_tab->scan[elem].keycode; return 0; } if (elem < 0 && rc_tab->size == IR_TAB_MAX_SIZE) return -EINVAL; *keycode = KEY_...
robutest/uclinux
C++
GPL-2.0
60
/* USART initialization function. Enables USART peripheral, clocks and initializes USART driver */
void TARGET_IO_init(void)
/* USART initialization function. Enables USART peripheral, clocks and initializes USART driver */ void TARGET_IO_init(void)
{ TARGET_IO_CLOCK_init(); TARGET_IO_PORT_init(); usart_async_init(&TARGET_IO, USART1, TARGET_IO_buffer, TARGET_IO_BUFFER_SIZE, _usart_get_usart_async()); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* sn_acpi_bus_fixup - Perform SN specific setup of software structs (pcibus_bussoft, pcidev_info) and hardware registers, for the specified bus and devices under it. */
void sn_acpi_bus_fixup(struct pci_bus *bus)
/* sn_acpi_bus_fixup - Perform SN specific setup of software structs (pcibus_bussoft, pcidev_info) and hardware registers, for the specified bus and devices under it. */ void sn_acpi_bus_fixup(struct pci_bus *bus)
{ struct pci_dev *pci_dev = NULL; struct pcibus_bussoft *prom_bussoft_ptr; if (!bus->parent) { prom_bussoft_ptr = sn_get_bussoft_ptr(bus); if (prom_bussoft_ptr == NULL) { printk(KERN_ERR "%s: 0x%04x:0x%02x Unable to " "obtain prom_bussoft_ptr\n", __func__, pci_domain_nr(bus), bus...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns length of print buffer data string (including trailing NUL) */
int tipc_printbuf_validate(struct print_buf *pb)
/* Returns length of print buffer data string (including trailing NUL) */ int tipc_printbuf_validate(struct print_buf *pb)
{ char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; char *cp_buf; struct print_buf cb; if (!pb->buf) return 0; if (pb->buf[pb->size - 1] == 0) { cp_buf = kmalloc(pb->size, GFP_ATOMIC); if (cp_buf) { tipc_printbuf_init(&cb, cp_buf, pb->size); tipc_printbuf_move(&cb, pb); tipc_printbuf_move(pb, &cb...
EmcraftSystems/linux-emcraft
C++
Other
266
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US...
static void zfAddFreqChangeReq(zdev_t *dev, u16_t frequency, u8_t bw40, u8_t extOffset, zfpFreqChangeCompleteCb cb)
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US...
{ zmw_get_wlan_dev(dev); wd->freqCtrl.freqReqQueue[wd->freqCtrl.freqReqQueueTail] = frequency; wd->freqCtrl.freqReqBw40[wd->freqCtrl.freqReqQueueTail] = bw40; wd->freqCtrl.freqReqExtOffset[wd->freqCtrl.freqReqQueueTail] = extOffset; wd->freqCtrl.freqChangeCompCb[wd->freqCtrl.freqReqQueueTail] = cb; ...
robutest/uclinux
C++
GPL-2.0
60
/* IDL long BrowserrResetStatistics( IDL wchar_t *element_49 IDL ); */
static int dissect_browser_browserr_reset_statistics_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL long BrowserrResetStatistics( IDL wchar_t *element_49 IDL ); */ static int dissect_browser_browserr_reset_statistics_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE, "unknown string", hf_browser_unknown_string, 0); return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA channels supported in hardware. */
int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
/* 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA channels supported in hardware. */ int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
{ int txq_id = txq->q.id; iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Search an Option of a Question by its value. */
DISPLAY_QUESTION_OPTION* ValueToOption(IN FORM_DISPLAY_ENGINE_STATEMENT *Question, IN EFI_HII_VALUE *OptionValue)
/* Search an Option of a Question by its value. */ DISPLAY_QUESTION_OPTION* ValueToOption(IN FORM_DISPLAY_ENGINE_STATEMENT *Question, IN EFI_HII_VALUE *OptionValue)
{ LIST_ENTRY *Link; DISPLAY_QUESTION_OPTION *Option; INTN Result; EFI_HII_VALUE Value; Link = GetFirstNode (&Question->OptionListHead); while (!IsNull (&Question->OptionListHead, Link)) { Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link); ZeroMem (&Value...
tianocore/edk2
C++
Other
4,240
/* Unregister a miscellaneous device that was previously successfully registered with misc_register(). Success is indicated by a zero return, a negative errno code indicates an error. */
int misc_deregister(struct miscdevice *misc)
/* Unregister a miscellaneous device that was previously successfully registered with misc_register(). Success is indicated by a zero return, a negative errno code indicates an error. */ int misc_deregister(struct miscdevice *misc)
{ int i = DYNAMIC_MINORS - misc->minor - 1; if (list_empty(&misc->list)) return -EINVAL; mutex_lock(&misc_mtx); list_del(&misc->list); device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); if (i < DYNAMIC_MINORS && i >= 0) clear_bit(i, misc_minors); mutex_unlock(&misc_mtx); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Message: FlowControlCommandMessage Opcode: 0x0135 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_FlowControlCommandMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: FlowControlCommandMessage Opcode: 0x0135 Type: CallControl Direction: pbx2dev VarLength: no */ static void handle_FlowControlCommandMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_passthruPartyID, 4, ENC_LITTLE_ENDIAN); si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN); ptvcurso...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Each passed coefficient array must be the right size for that coefficient: width_in_blocks wide and height_in_blocks high, with unitheight at least v_samp_factor. */
transencode_coef_controller(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
/* Each passed coefficient array must be the right size for that coefficient: width_in_blocks wide and height_in_blocks high, with unitheight at least v_samp_factor. */ transencode_coef_controller(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
{ my_coef_ptr coef; JBLOCKROW buffer; int i; coef = (my_coef_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_coef_controller)); cinfo->coef = &coef->pub; coef->pub.start_pass = start_pass_coef; coef->pub.compress_data = compress_output; coef->whole_image = coef_arra...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* gfs2_meta_check_ii - Flag a magic number consistency error and withdraw Returns: -1 if this call withdrew the machine, -2 if it was already withdrawn */
int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, const char *type, const char *function, char *file, unsigned int line)
/* gfs2_meta_check_ii - Flag a magic number consistency error and withdraw Returns: -1 if this call withdrew the machine, -2 if it was already withdrawn */ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, const char *type, const char *function, char *file, unsigned int line)
{ int me; me = gfs2_lm_withdraw(sdp, "GFS2: fsid=%s: fatal: invalid metadata block\n" "GFS2: fsid=%s: bh = %llu (%s)\n" "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", sdp->sd_fsname, sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, sdp->sd_fsname, function, file, line); return (me) ?...
robutest/uclinux
C++
GPL-2.0
60
/* If two MSI vector are allocated, Advanced Error Interrupt Message Number is 1. otherwise 0. 17. RPERRSTS, 32:27 bit Advanced Error Interrupt Message Number. */
static uint8_t ioh3420_aer_vector(const PCIDevice *d)
/* If two MSI vector are allocated, Advanced Error Interrupt Message Number is 1. otherwise 0. 17. RPERRSTS, 32:27 bit Advanced Error Interrupt Message Number. */ static uint8_t ioh3420_aer_vector(const PCIDevice *d)
{ switch (msi_nr_vectors_allocated(d)) { case 1: return 0; case 2: return 1; case 4: case 8: case 16: case 32: default: break; } abort(); return 0; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Start the reception of data on communication line. */
static bool ieee11073_enable_reception(void)
/* Start the reception of data on communication line. */ static bool ieee11073_enable_reception(void)
{ ieee11073_g_phdc_metadata_out.opaquedata = ieee11073_g_opaquedata_out; ieee11073_g_phdc_metadata_out.opaque_size = IEEE11073_LGT_OPAQUEDATA_OUT; ieee11073_g_phdc_metadata_out.metadata = ieee11073_g_metadata_out; ieee11073_g_phdc_metadata_out.metadata_size = IEEE11073_LGT_METADATA_OUT; if (!udi_phdc_waitdat...
remotemcu/remcu-chip-sdks
C++
null
436
/* Construction function for DMAEND instruction. This function fills the program buffer with the constructed instruction. */
static INLINE int XDmaPs_Instr_DMAEND(char *DmaProg)
/* Construction function for DMAEND instruction. This function fills the program buffer with the constructed instruction. */ static INLINE int XDmaPs_Instr_DMAEND(char *DmaProg)
{ *DmaProg = 0x0; return 1; }
ua1arn/hftrx
C++
null
69
/* This function reassembles TLS fragments. Caller must not free the returned data buffer since an internal pointer to it is maintained. */
static const struct wpabuf* eap_peer_tls_data_reassemble(struct eap_ssl_data *data, const struct wpabuf *in_data, int *need_more_input)
/* This function reassembles TLS fragments. Caller must not free the returned data buffer since an internal pointer to it is maintained. */ static const struct wpabuf* eap_peer_tls_data_reassemble(struct eap_ssl_data *data, const struct wpabuf *in_data, int *need_more_input)
{ *need_more_input = 0; if (data->tls_in_left > wpabuf_len(in_data) || data->tls_in) { int res = eap_peer_tls_reassemble_fragment(data, in_data); if (res) { if (res == 1) *need_more_input = 1; return NULL; } } else { data->tls_in_left = 0; data->tls_in = wpabuf_dup(in_data); if (data->tls_in ==...
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Escape and write given number of frame bytes to the transport channel. */
static ssize_t write_bytes(struct xbee_driver_t *self_p, const uint8_t *buf_p, size_t size)
/* Escape and write given number of frame bytes to the transport channel. */ static ssize_t write_bytes(struct xbee_driver_t *self_p, const uint8_t *buf_p, size_t size)
{ ssize_t res; size_t i; uint8_t chunk[2]; size_t chunk_size; for (i = 0; i < size; i++) { switch (buf_p[i]) { case FRAME_DELIMITER: case ESCAPE: case XON: case XOFF: chunk[0] = ESCAPE; chunk[1] = buf_p[i]; chunk[1] ^= 0x20;...
eerimoq/simba
C++
Other
337
/* hmatrix_sfr_set_bits - clear bits in a slave's Special Function Register @slave_id: operate on the SFR belonging to this slave @mask: mask of bits to be cleared in the SFR */
void hmatrix_sfr_clear_bits(unsigned int slave_id, u32 mask)
/* hmatrix_sfr_set_bits - clear bits in a slave's Special Function Register @slave_id: operate on the SFR belonging to this slave @mask: mask of bits to be cleared in the SFR */ void hmatrix_sfr_clear_bits(unsigned int slave_id, u32 mask)
{ u32 value; clk_enable(&at32_hmatrix_clk); value = __hmatrix_read_reg(HMATRIX_SFR(slave_id)); value &= ~mask; __hmatrix_write_reg(HMATRIX_SFR(slave_id), value); __hmatrix_read_reg(HMATRIX_SFR(slave_id)); clk_disable(&at32_hmatrix_clk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If ListHead is NULL, then ASSERT(). If Entry is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
LIST_ENTRY* EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
/* If ListHead is NULL, then ASSERT(). If Entry is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */ LIST_ENTRY* EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
{ ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE); Entry->ForwardLink = ListHead; Entry->BackLink = ListHead->BackLink; Entry->BackLink->ForwardLink = Entry; ListHead->BackLink = Entry; return ListHead; }
tianocore/edk2
C++
Other
4,240
/* Do a hash operation on a data buffer, extend a specific RTMR with the hash result, and add an entry to the Event Log. */
EFI_STATUS TdxDxeHashLogExtendEvent(IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
/* Do a hash operation on a data buffer, extend a specific RTMR with the hash result, and add an entry to the Event Log. */ EFI_STATUS TdxDxeHashLogExtendEvent(IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT CC_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
{ EFI_STATUS Status; TPML_DIGEST_VALUES DigestList; CC_EVENT_HDR NoActionEvent; if (NewEventHdr->EventType == EV_NO_ACTION) { Status = EFI_SUCCESS; InitNoActionEvent (&NoActionEvent, NewEventHdr->EventSize); if ((Flags & EFI_CC_FLAG_EXTEND_ONLY) == 0) { Status = TdxDxeLogHashE...
tianocore/edk2
C++
Other
4,240
/* ixgbe_atr_set_dst_ipv4_82599 - Sets the destination IPv4 address @input: input stream to modify @dst_addr: the IP address to load */
s32 ixgbe_atr_set_dst_ipv4_82599(struct ixgbe_atr_input *input, u32 dst_addr)
/* ixgbe_atr_set_dst_ipv4_82599 - Sets the destination IPv4 address @input: input stream to modify @dst_addr: the IP address to load */ s32 ixgbe_atr_set_dst_ipv4_82599(struct ixgbe_atr_input *input, u32 dst_addr)
{ input->byte_stream[IXGBE_ATR_DST_IPV4_OFFSET + 3] = dst_addr >> 24; input->byte_stream[IXGBE_ATR_DST_IPV4_OFFSET + 2] = (dst_addr >> 16) & 0xff; input->byte_stream[IXGBE_ATR_DST_IPV4_OFFSET + 1] = (dst_addr >> 8) & 0xf...
robutest/uclinux
C++
GPL-2.0
60
/* Disable an interrupt line. Disable an interrupt line. After this call, the CPU will stop receiving interrupts for the specified */
void arch_irq_disable(unsigned int irq)
/* Disable an interrupt line. Disable an interrupt line. After this call, the CPU will stop receiving interrupts for the specified */ void arch_irq_disable(unsigned int irq)
{ z_arc_v2_irq_unit_int_disable(irq); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This routine is called to prepare the SLI3 device for PCI slot permanently disabling. It blocks the SCSI transport layer traffic and flushes the FCP pending I/Os. */
static void lpfc_prep_dev_for_perm_failure(struct lpfc_hba *phba)
/* This routine is called to prepare the SLI3 device for PCI slot permanently disabling. It blocks the SCSI transport layer traffic and flushes the FCP pending I/Os. */ static void lpfc_prep_dev_for_perm_failure(struct lpfc_hba *phba)
{ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2711 PCI channel permanent disable for failure\n"); lpfc_sli_flush_fcp_rings(phba); }
robutest/uclinux
C++
GPL-2.0
60
/* DMA I2S transmit receive process half complete callback. */
static void I2S_TxRxDMAHalfCplt(DMA_HandleTypeDef *hdma)
/* DMA I2S transmit receive process half complete callback. */ static void I2S_TxRxDMAHalfCplt(DMA_HandleTypeDef *hdma)
{ I2S_HandleTypeDef *hi2s = (I2S_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent; HAL_I2S_TxRxHalfCpltCallback(hi2s); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns CR_OK upon succesful completion, an error code otherwise. */
enum CRStatus cr_parsing_location_init(CRParsingLocation *a_this)
/* Returns CR_OK upon succesful completion, an error code otherwise. */ enum CRStatus cr_parsing_location_init(CRParsingLocation *a_this)
{ g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; memset (a_this, 0, sizeof (CRParsingLocation)) ; return CR_OK ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns whether any script files are currently being processed. */
BOOLEAN EFIAPI EfiShellBatchIsActive(VOID)
/* Returns whether any script files are currently being processed. */ BOOLEAN EFIAPI EfiShellBatchIsActive(VOID)
{ if (ShellCommandGetCurrentScriptFile () == NULL) { return (FALSE); } return (TRUE); }
tianocore/edk2
C++
Other
4,240
/* Gets and status and verifies whether an error occurred. */
bool CCID_CheckStatusNoError(uint8_t Status)
/* Gets and status and verifies whether an error occurred. */ bool CCID_CheckStatusNoError(uint8_t Status)
{ return (Status & 0xC0) == 0x0; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Convert a hexadecimal characters to a number (0..15) */
static uint8_t hex_char_to_num(char hex)
/* Convert a hexadecimal characters to a number (0..15) */ static uint8_t hex_char_to_num(char hex)
{ uint8_t result = 0; if(hex >= '0' && hex <= '9') { result = hex - '0'; } else { if(hex >= 'a') hex -= 'a' - 'A'; switch(hex) { case 'A': result = 10; break; case 'B': result = 11; break; case 'C': result = 12; break; case 'D': result ...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Write USB Device Endpoint Data Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
/* Write USB Device Endpoint Data Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
{ return (cnt); } if (UDPHS->UDPHS_EPT[EPNum].UDPHS_EPTSTA & (0x1 << 11)) { return (0); } pEPFIFO = (uint8_t *)((uint32_t *)UDPHS_EPTFIFO_BASE + (16384*EPNum)); for (n = 0; n < cnt; n++) { *pEPFIFO++ = *pData++; } UDPHS->UDPHS_EPT[EPNum].UDPHS_EPTSETSTA = (0x1 << 11); return (cnt); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Function to manage CDC data transmission and reception to and from the host for the second CDC interface, which echoes back all data sent to it from the host. */
void CDC2_Task(void)
/* Function to manage CDC data transmission and reception to and from the host for the second CDC interface, which echoes back all data sent to it from the host. */ void CDC2_Task(void)
{ if (USB_DeviceState != DEVICE_STATE_Configured) return; Endpoint_SelectEndpoint(CDC2_RX_EPADDR); if (Endpoint_IsOUTReceived()) { uint8_t Buffer[Endpoint_BytesInEndpoint()]; uint16_t DataLength = Endpoint_BytesInEndpoint(); Endpoint_Read_Stream_LE(&Buffer, DataLength, NULL); Endpoint_ClearOUT(); Endp...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* WRITE a byte to the NVRAM and then get an ACK to see it was accepted OK, GPIO0 must already be set as an output */
static void S24C16_write_byte(struct sym_device *np, u_char *ack_data, u_char write_data, u_char *gpreg, u_char *gpcntl)
/* WRITE a byte to the NVRAM and then get an ACK to see it was accepted OK, GPIO0 must already be set as an output */ static void S24C16_write_byte(struct sym_device *np, u_char *ack_data, u_char write_data, u_char *gpreg, u_char *gpcntl)
{ int x; for (x = 0; x < 8; x++) S24C16_do_bit(np, NULL, (write_data >> (7 - x)) & 0x01, gpreg); S24C16_read_ack(np, ack_data, gpreg, gpcntl); }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes the SDADCx peripheral according to the specified parameters in the SDADC_InitStruct. */
void SDADC_Init(SDADC_TypeDef *SDADCx, SDADC_InitTypeDef *SDADC_InitStruct)
/* Initializes the SDADCx peripheral according to the specified parameters in the SDADC_InitStruct. */ void SDADC_Init(SDADC_TypeDef *SDADCx, SDADC_InitTypeDef *SDADC_InitStruct)
{ uint32_t tmpcr2 = 0; assert_param(IS_SDADC_ALL_PERIPH(SDADCx)); assert_param(IS_SDADC_REGULAR_CHANNEL(SDADC_InitStruct->SDADC_Channel)); assert_param(IS_FUNCTIONAL_STATE(SDADC_InitStruct->SDADC_ContinuousConvMode)); assert_param(IS_FUNCTIONAL_STATE(SDADC_InitStruct->SDADC_FastConversionMode)); tmpcr2 = ...
avem-labs/Avem
C++
MIT License
1,752
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US...
struct zsQueue* zfQueueCreate(zdev_t *dev, u16_t size)
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF US...
{ struct zsQueue* q; if ((q = (struct zsQueue*)zfwMemAllocate(dev, sizeof(struct zsQueue) + (sizeof(struct zsQueueCell)*(size-1)))) != NULL) { q->size = size; q->sizeMask = size-1; q->head = 0; q->tail = 0; } return q; }
robutest/uclinux
C++
GPL-2.0
60
/* set the SSL verifying of the SSL context */
void SSL_set_verify(SSL *ssl, int mode, int(*verify_callback)(int, X509_STORE_CTX *))
/* set the SSL verifying of the SSL context */ void SSL_set_verify(SSL *ssl, int mode, int(*verify_callback)(int, X509_STORE_CTX *))
{ SSL_ASSERT3(ssl); ssl->verify_mode = mode; ssl->verify_callback = verify_callback; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Init interrupts callback for the specified UART Port. */
void UARTIntCallbackInit(unsigned long ulBase, xtEventCallback xtUARTCallback)
/* Init interrupts callback for the specified UART Port. */ void UARTIntCallbackInit(unsigned long ulBase, xtEventCallback xtUARTCallback)
{ xASSERT(UARTBaseValid(ulBase)); if (ulBase == UART0_BASE) { g_pfnUARTHandlerCallbacks[0] = xtUARTCallback; } else if (ulBase == UART1_BASE) { g_pfnUARTHandlerCallbacks[1] = xtUARTCallback; } else { g_pfnUARTHandlerCallbacks[2] = xtUARTCallback; } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Measure and log an action string, and extend the measurement result into PCR. */
EFI_STATUS EFIAPI TcgMeasureAction(IN CHAR8 *String)
/* Measure and log an action string, and extend the measurement result into PCR. */ EFI_STATUS EFIAPI TcgMeasureAction(IN CHAR8 *String)
{ TCG_PCR_EVENT_HDR TcgEvent; TcgEvent.PCRIndex = 5; TcgEvent.EventType = EV_EFI_ACTION; TcgEvent.EventSize = (UINT32)AsciiStrLen (String); return TcgDxeHashLogExtendEventI ( &mTcgDxeData, (UINT8 *)String, TcgEvent.EventSize, &TcgEvent, (UINT8 *)String ...
tianocore/edk2
C++
Other
4,240
/* After we've done initial boot, this function is called to allow the board code to clean up state, if needed */
static void __cpuinit yos_init_secondary(void)
/* After we've done initial boot, this function is called to allow the board code to clean up state, if needed */ static void __cpuinit yos_init_secondary(void)
{ set_c0_status(ST0_CO | ST0_IE | ST0_IM); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* When the operation is finished @callback will be called. You can then call g_output_stream_flush_finish() to get the result of the operation. */
void g_output_stream_flush_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* When the operation is finished @callback will be called. You can then call g_output_stream_flush_finish() to get the result of the operation. */ void g_output_stream_flush_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ GOutputStreamClass *class; GTask *task; GError *error = NULL; g_return_if_fail (G_IS_OUTPUT_STREAM (stream)); task = g_task_new (stream, cancellable, callback, user_data); g_task_set_source_tag (task, g_output_stream_flush_async); g_task_set_priority (task, io_priority); if (!g_output_stream_set_pendi...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Compute edge dominators. Assumes graph has been leveled and predecessors established. */
static void find_edom(opt_state_t *opt_state, struct block *root)
/* Compute edge dominators. Assumes graph has been leveled and predecessors established. */ static void find_edom(opt_state_t *opt_state, struct block *root)
{ int i; uset x; struct block *b; x = opt_state->all_edge_sets; for (i = opt_state->n_edges * opt_state->edgewords; --i >= 0; ) x[i] = 0xFFFFFFFFU; memset(root->et.edom, 0, opt_state->edgewords * sizeof(*(uset)0)); memset(root->ef.edom, 0, opt_state->edgewords * sizeof(*(uset)0)); for (i = root->level; i >= 0...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Calls remote CPU function with 1 optional parameter . */
uint16_t IPCLtoRFunctionCall(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulParam, uint16_t bBlock)
/* Calls remote CPU function with 1 optional parameter . */ uint16_t IPCLtoRFunctionCall(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulParam, uint16_t bBlock)
{ uint16_t status; tIpcMessage sMessage; sMessage.ulcommand = IPC_FUNC_CALL; sMessage.uladdress = ulAddress; sMessage.uldataw1 = ulParam; status = IpcPut (psController, &sMessage, bBlock); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the NMI status for the system controller. The valid values for the */
uint32_t SysCtlNMIStatus(void)
/* This function returns the NMI status for the system controller. The valid values for the */ uint32_t SysCtlNMIStatus(void)
{ return (HWREG(SYSCTL_NMIC)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* From a security standpoint, we trust the card vendors. This may be a misplaced trust. */
static void ecard_task_reset(struct ecard_request *req)
/* From a security standpoint, we trust the card vendors. This may be a misplaced trust. */ static void ecard_task_reset(struct ecard_request *req)
{ struct expansion_card *ec = req->ec; struct resource *res; res = ec->slot_no == 8 ? &ec->resource[ECARD_RES_MEMC] : ec->easi ? &ec->resource[ECARD_RES_EASI] : &ec->resource[ECARD_RES_IOCSYNC]; ecard_loader_reset(res->start, ec->loader); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remove an active neh immediately instead of waiting for the event (or a time out). */
void uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
/* Remove an active neh immediately instead of waiting for the event (or a time out). */ void uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
{ unsigned long flags; spin_lock_irqsave(&rc->neh_lock, flags); __uwb_rc_neh_rm(rc, neh); spin_unlock_irqrestore(&rc->neh_lock, flags); del_timer_sync(&neh->timer); uwb_rc_neh_put(neh); }
robutest/uclinux
C++
GPL-2.0
60
/* Get minimum widget size. This function returns the minimum size that is required for showing the full widget and the caption. */
void wtk_check_box_size_hint(struct win_point *size, const char *caption)
/* Get minimum widget size. This function returns the minimum size that is required for showing the full widget and the caption. */ void wtk_check_box_size_hint(struct win_point *size, const char *caption)
{ Assert(size); Assert(caption); gfx_get_string_bounding_box(caption, &sysfont, &size->x, &size->y); size->x += WTK_CHECKBOX_CAPTION_X; size->y += WTK_CHECKBOX_CAPTION_Y; if (size->y < WTK_CHECKBOX_BOX_SIZE) { size->y = WTK_CHECKBOX_BOX_SIZE; } }
memfault/zero-to-main
C++
null
200
/* Returns whether an odd or even number of bits are on in pkt. */
static int bit_parity(u32 pkt)
/* Returns whether an odd or even number of bits are on in pkt. */ static int bit_parity(u32 pkt)
{ int x = pkt ^ (pkt >> 16); x ^= x >> 8; x ^= x >> 4; x ^= x >> 2; x ^= x >> 1; return x & 1; }
robutest/uclinux
C++
GPL-2.0
60
/* returns zero if a magic word is detected, or a negative error code. */
static int vx_check_magic(struct vx_core *chip)
/* returns zero if a magic word is detected, or a negative error code. */ static int vx_check_magic(struct vx_core *chip)
{ unsigned long end_time = jiffies + HZ / 5; int c; do { c = vx_inb(chip, CDSP); if (c == CDSP_MAGIC) return 0; msleep(10); } while (time_after_eq(end_time, jiffies)); snd_printk(KERN_ERR "cannot find xilinx magic word (%x)\n", c); return -EIO; }
robutest/uclinux
C++
GPL-2.0
60
/* This function use to enable smartcard module UART mode and set baudrate. HIDDEN_SYMBOLS */
uint32_t SCUART_Open(SC_T *sc, uint32_t u32baudrate)
/* This function use to enable smartcard module UART mode and set baudrate. HIDDEN_SYMBOLS */ uint32_t SCUART_Open(SC_T *sc, uint32_t u32baudrate)
{ uint32_t u32Clk = SCUART_GetClock(sc), u32Div; u32Div = (u32Clk + (u32baudrate >> 1) - 1UL) / u32baudrate - 1UL; sc->CTL = SC_CTL_SCEN_Msk | SC_CTL_NSB_Msk; sc->UARTCTL = SCUART_CHAR_LEN_8 | SCUART_PARITY_NONE | SC_UARTCTL_UARTEN_Msk; sc->ETUCTL = u32Div; return(u32Clk / (u32Div + 1UL)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the buffer does not yet have a buf log item associated with it, then allocate one for it. Then add the buf item to the transaction. */
void xfs_trans_bjoin(xfs_trans_t *tp, xfs_buf_t *bp)
/* If the buffer does not yet have a buf log item associated with it, then allocate one for it. Then add the buf item to the transaction. */ void xfs_trans_bjoin(xfs_trans_t *tp, xfs_buf_t *bp)
{ xfs_buf_log_item_t *bip; ASSERT(XFS_BUF_ISBUSY(bp)); ASSERT(XFS_BUF_FSPRIVATE2(bp, void *) == NULL); xfs_buf_item_init(bp, tp->t_mountp); bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); ASSERT(!(bip->bli_format.blf_flags & XFS_BLI_CANCEL)); ASSERT(!(bip->bli_flags...
robutest/uclinux
C++
GPL-2.0
60
/* Add current char to buffer (if not out of space) and read next one */
static int nextc(RN *rn)
/* Add current char to buffer (if not out of space) and read next one */ static int nextc(RN *rn)
{ rn->buff[0] = '\0'; return 0; } else { rn->buff[rn->n++] = rn->c; rn->c = l_getc(rn->f); return 1; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* How many references to page are currently swapped out? This does not give an exact answer when swap count is continued, but does include the high COUNT_CONTINUED flag to allow for that. */
static int page_swapcount(struct page *page)
/* How many references to page are currently swapped out? This does not give an exact answer when swap count is continued, but does include the high COUNT_CONTINUED flag to allow for that. */ static int page_swapcount(struct page *page)
{ int count = 0; struct swap_info_struct *p; swp_entry_t entry; entry.val = page_private(page); p = swap_info_get(entry); if (p) { count = swap_count(p->swap_map[swp_offset(entry)]); spin_unlock(&swap_lock); } return count; }
robutest/uclinux
C++
GPL-2.0
60
/* brief Gets the default configuration of FRO192M. The default values are: code config->enable12MHzClk = true; config->enable96MHzClk = false; endcode param config Pointer to FRO192M configuration structure. Refer to anactrl_fro192M_config_t structure. */
void ANACTRL_GetDefaultFro192MConfig(anactrl_fro192M_config_t *config)
/* brief Gets the default configuration of FRO192M. The default values are: code config->enable12MHzClk = true; config->enable96MHzClk = false; endcode param config Pointer to FRO192M configuration structure. Refer to anactrl_fro192M_config_t structure. */ void ANACTRL_GetDefaultFro192MConfig(anactrl_fro192M_config_t ...
{ assert(NULL != config); (void)memset(config, 0, sizeof(*config)); config->enable12MHzClk = true; config->enable96MHzClk = false; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration ::qtmr_dma_enable_t */
void QTMR_EnableDma(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration ::qtmr_dma_enable_t */ void QTMR_EnableDma(TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
{ uint16_t reg; reg = base->CHANNEL[channel].DMA; if (mask & kQTMR_InputEdgeFlagDmaEnable) { base->CHANNEL[channel].SCTRL &= ~TMR_SCTRL_IEFIE_MASK; reg |= TMR_DMA_IEFDE_MASK; } if (mask & kQTMR_ComparatorPreload1DmaEnable) { reg |= TMR_DMA_CMPLD1DE_MASK; } if ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert an NFS error code to a local one. This one is used jointly by NFSv2 and NFSv3. */
int nfs_stat_to_errno(int stat)
/* Convert an NFS error code to a local one. This one is used jointly by NFSv2 and NFSv3. */ int nfs_stat_to_errno(int stat)
{ int i; for (i = 0; nfs_errtbl[i].stat != -1; i++) { if (nfs_errtbl[i].stat == stat) return nfs_errtbl[i].errno; } dprintk("nfs_stat_to_errno: bad nfs status return value: %d\n", stat); return nfs_errtbl[i].errno; }
robutest/uclinux
C++
GPL-2.0
60
/* This function uses 'double' (instead of 'lua_Number') to ensure that all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' will keep full precision (ensuring that 'r' is always less than 1.0.) */
static int math_random(lua_State *L)
/* This function uses 'double' (instead of 'lua_Number') to ensure that all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' will keep full precision (ensuring that 'r' is always less than 1.0.) */ static int math_random(lua_State *L)
{ case 0: { lua_pushnumber(L, (lua_Number)r); return 1; } case 1: { low = 1; up = luaL_checkinteger(L, 1); break; } case 2: { low = luaL_checkinteger(L, 1); up = luaL_checkinteger(L, 2); break; } default: return luaL_error(L, "wrong number of a...
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Number of external sensors to be read by the sensor hub.. */
int32_t lsm6dso_sh_slave_connected_set(lsm6dso_ctx_t *ctx, lsm6dso_aux_sens_on_t val)
/* Number of external sensors to be read by the sensor hub.. */ int32_t lsm6dso_sh_slave_connected_set(lsm6dso_ctx_t *ctx, lsm6dso_aux_sens_on_t val)
{ lsm6dso_master_config_t reg; int32_t ret; ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_SENSOR_HUB_BANK); if (ret == 0) { ret = lsm6dso_read_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint8_t*)&reg, 1); } if (ret == 0) { reg.aux_sens_on = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint...
alexander-g-dean/ESF
C++
null
41
/* Returns the endpoint number targetted by a given request. */
unsigned char USBGenericRequest_GetEndpointNumber(const USBGenericRequest *request)
/* Returns the endpoint number targetted by a given request. */ unsigned char USBGenericRequest_GetEndpointNumber(const USBGenericRequest *request)
{ return USBGenericRequest_GetIndex(request) & 0xF; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* This function is used to clear all tamper events. This function always clears the tamper feature event state indicator along with all tamper log entries. Logged event data should be retrieved with */
void HibernateTamperEventsClear(void)
/* This function is used to clear all tamper events. This function always clears the tamper feature event state indicator along with all tamper log entries. Logged event data should be retrieved with */ void HibernateTamperEventsClear(void)
{ HWREG(HIB_LOCK) = HIB_LOCK_HIBLOCK_KEY; _HibernateWriteComplete(); HWREG(HIB_TPCTL) |= HIB_TPCTL_TPCLR; _HibernateWriteComplete(); HWREG(HIB_LOCK) = 0; _HibernateWriteComplete(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Extracts a parameter without a pv field (pl=0) */
static int irda_extract_no_value(void *self, __u8 *buf, int len, __u8 pi, PV_TYPE type, PI_HANDLER func)
/* Extracts a parameter without a pv field (pl=0) */ static int irda_extract_no_value(void *self, __u8 *buf, int len, __u8 pi, PV_TYPE type, PI_HANDLER func)
{ irda_param_t p; int ret; irda_param_unpack(buf, "bb", &p.pi, &p.pl); ret = (*func)(self, &p, PV_PUT); if (ret < 0) return ret; return 2; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* HCI read buffer size command. Returns the ACL data packet length and num data packets. */
static int ble_ll_hci_le_read_bufsize(uint8_t *rspbuf, uint8_t *rsplen)
/* HCI read buffer size command. Returns the ACL data packet length and num data packets. */ static int ble_ll_hci_le_read_bufsize(uint8_t *rspbuf, uint8_t *rsplen)
{ struct ble_hci_le_rd_buf_size_rp *rp = (void *) rspbuf; rp->data_len = htole16(g_ble_ll_data.ll_acl_pkt_size); rp->data_packets = g_ble_ll_data.ll_num_acl_pkts; *rsplen = sizeof(*rp); return BLE_ERR_SUCCESS; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Convert one Null-terminated ASCII string (decimal dotted) to EFI_IPv4_ADDRESS. */
EFI_STATUS EFIAPI NetLibAsciiStrToIp4(IN CONST CHAR8 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
/* Convert one Null-terminated ASCII string (decimal dotted) to EFI_IPv4_ADDRESS. */ EFI_STATUS EFIAPI NetLibAsciiStrToIp4(IN CONST CHAR8 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
{ RETURN_STATUS Status; CHAR8 *EndPointer; Status = AsciiStrToIpv4Address (String, &EndPointer, Ip4Address, NULL); if (RETURN_ERROR (Status) || (*EndPointer != '\0')) { return EFI_INVALID_PARAMETER; } else { return EFI_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* Change Logs: Date Author Notes This is the timer interrupt service routine. */
__interrupt void SysTick_Handler(void)
/* Change Logs: Date Author Notes This is the timer interrupt service routine. */ __interrupt void SysTick_Handler(void)
{ rt_interrupt_enter(); rt_tick_increase(); rt_interrupt_leave(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntEnable(unsigned long ulBase)
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */ void SPI3WireStartIntEnable(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SSTA_INTEN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* ubi_update_layout_vol - helper for updatting layout volumes on flash @ubi: UBI device description object */
static int ubi_update_layout_vol(struct ubi_device *ubi)
/* ubi_update_layout_vol - helper for updatting layout volumes on flash @ubi: UBI device description object */ static int ubi_update_layout_vol(struct ubi_device *ubi)
{ struct ubi_volume *layout_vol; int i, err; layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)]; for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) { err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl, ubi->vtbl_size); if (err) return err; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* The interrupt management utilities can only be called from ARM mode. When THUMB_INTERWORK is defined the utilities are defined as functions here to ensure a switch to ARM mode. When THUMB_INTERWORK is not defined then the utilities are defined as macros in portmacro.h - as per other ports. */
void vPortEnterCritical(void)
/* The interrupt management utilities can only be called from ARM mode. When THUMB_INTERWORK is defined the utilities are defined as functions here to ensure a switch to ARM mode. When THUMB_INTERWORK is not defined then the utilities are defined as macros in portmacro.h - as per other ports. */ void vPortEnterCritica...
{ __asm volatile ( "STMDB SP!, {R0} \n\t" "MRS R0, CPSR \n\t" "ORR R0, R0, #0xC0 \n\t" "MSR CPSR, R0 \n\t" "LDMIA SP!, {R0}" ); ulCriticalNesting++; }
labapart/polymcu
C++
null
201
/* Writes the current value of MM0. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
/* Writes the current value of MM0. This function is only available on IA32 and X64. */ VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
{ __asm__ __volatile__ ( "movq %0, %%mm0" : : "m" (Value) ); }
tianocore/edk2
C++
Other
4,240
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
{ EFI_STATUS Status; ASSERT (Pages != 0); Status = CoreFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* main function : do init and print the unique ID through the serial console. */
int main(void)
/* main function : do init and print the unique ID through the serial console. */ int main(void)
{ uint32_t i; volatile uint8_t* unique_id_addr = (volatile uint8_t*) UNIQUE_ID_ADDR; sysclk_init(); board_init(); configure_console(); printf("-- FLASHCALW Example2 --\r\n"); printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__); printf("ID: "); for (i=0; i<15; i++) { prin...
remotemcu/remcu-chip-sdks
C++
null
436
/* Teardown the channel structures that are sn2 specific. */
static void xpc_teardown_ch_structures_sn2(struct xpc_partition *part)
/* Teardown the channel structures that are sn2 specific. */ static void xpc_teardown_ch_structures_sn2(struct xpc_partition *part)
{ struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; short partid = XPC_PARTID(part); xpc_vars_part_sn2[partid].magic = 0; del_timer_sync(&part_sn2->dropped_notify_IRQ_timer); free_irq(SGI_XPC_NOTIFY, (void *)(u64)partid); kfree(part_sn2->local_openclose_args_base); part_sn2->local_openclose_args = NULL; kfree...
robutest/uclinux
C++
GPL-2.0
60
/* Virtual: hash Returns: a #guint containing a hash for the @icon, suitable for use in a #GHashTable or similar data structure. */
guint g_icon_hash(gconstpointer icon)
/* Virtual: hash Returns: a #guint containing a hash for the @icon, suitable for use in a #GHashTable or similar data structure. */ guint g_icon_hash(gconstpointer icon)
{ GIconIface *iface; g_return_val_if_fail (G_IS_ICON (icon), 0); iface = G_ICON_GET_IFACE (icon); return (* iface->hash) ((GIcon *)icon); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initialize the framerate manager. Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation. */
void SDL_initFramerate(FPSmanager *manager)
/* Initialize the framerate manager. Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation. */ void SDL_initFramerate(FPSmanager *manager)
{ manager->framecount = 0; manager->rate = FPS_DEFAULT; manager->rateticks = (1000.0f / (float) FPS_DEFAULT); manager->baseticks = _getTicks(); manager->lastticks = manager->baseticks; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* ADC Averaging mode configuration. This function configures ADC as Averaging mode with below Settings. GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND SAMPLES -> 1024 RESULT_DIV -> 16 */
void configure_adc_averaging(void)
/* ADC Averaging mode configuration. This function configures ADC as Averaging mode with below Settings. GLCK for ADC -> GCLK_GENERATOR_1 (8MHz) CLK_ADC -> 512 KHz REFERENCE -> 1/2 VDDANA (1.65V) POSITIVE INPUT -> PA02 NEGATIVE INPUT -> GND SAMPLES -> 1024 RESULT_DIV -> 16 */ void configure_adc_averaging(void)
{ struct adc_config conf_adc; adc_get_config_defaults(&conf_adc); conf_adc.clock_source = GCLK_GENERATOR_1; conf_adc.reference = ADC_REFERENCE_INTVCC1; conf_adc.clock_prescaler = ADC_CLOCK_PRESCALER_DIV16; conf_adc.positive_input = ADC_POSITIVE_INPUT_PIN0; conf_adc.negative_input = ADC_NEGATIVE_INPUT_GND; conf_...
memfault/zero-to-main
C++
null
200