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
/* fc_rport_init() - Initialize the remote port layer for a local port @lport: The local port to initialize the remote port layer for */
int fc_rport_init(struct fc_lport *lport)
/* fc_rport_init() - Initialize the remote port layer for a local port @lport: The local port to initialize the remote port layer for */ int fc_rport_init(struct fc_lport *lport)
{ if (!lport->tt.rport_lookup) lport->tt.rport_lookup = fc_rport_lookup; if (!lport->tt.rport_create) lport->tt.rport_create = fc_rport_create; if (!lport->tt.rport_login) lport->tt.rport_login = fc_rport_login; if (!lport->tt.rport_logoff) lport->tt.rport_logoff = fc_rport_logoff; if (!lport->tt.rport_recv_req) lport->tt.rport_recv_req = fc_rport_recv_req; if (!lport->tt.rport_flush_queue) lport->tt.rport_flush_queue = fc_rport_flush_queue; if (!lport->tt.rport_destroy) lport->tt.rport_destroy = fc_rport_destroy; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* To really, really be sure that nothing is being done by other TCs, halt them all. This code assumes that a DVPE has already been done, so while their Halted state is theoretically architecturally unstable, in practice, it's not going to change while we're looking at it. */
void smtc_cflush_lockdown(void)
/* To really, really be sure that nothing is being done by other TCs, halt them all. This code assumes that a DVPE has already been done, so while their Halted state is theoretically architecturally unstable, in practice, it's not going to change while we're looking at it. */ void smtc_cflush_lockdown(void)
{ int cpu; for_each_online_cpu(cpu) { if (cpu != smp_processor_id()) { settc(cpu_data[cpu].tc_id); halt_state_save[cpu] = read_tc_c0_tchalt(); write_tc_c0_tchalt(TCHALT_H); } } mips_ihb(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function provides accurate delay (in milliseconds) based on SysTick counter flag. */
void LL_mDelay(uint32_t Delay)
/* This function provides accurate delay (in milliseconds) based on SysTick counter flag. */ void LL_mDelay(uint32_t Delay)
{ __IO uint32_t tmp = SysTick->CTRL; uint32_t tmpDelay = Delay; ((void)tmp); if (tmpDelay < LL_MAX_DELAY) { tmpDelay++; } while (tmpDelay != 0U) { if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U) { tmpDelay--; } } }
eclipse-threadx/getting-started
C++
Other
310
/* Set the number of Device Notification Time Slots (DNTS) and enable device notifications. */
int whc_set_num_dnts(struct wusbhc *wusbhc, u8 interval, u8 slots)
/* Set the number of Device Notification Time Slots (DNTS) and enable device notifications. */ int whc_set_num_dnts(struct wusbhc *wusbhc, u8 interval, u8 slots)
{ struct whc *whc = wusbhc_to_whc(wusbhc); u32 dntsctrl; dntsctrl = WUSBDNTSCTRL_ACTIVE | WUSBDNTSCTRL_INTERVAL(interval) | WUSBDNTSCTRL_SLOTS(slots); le_writel(dntsctrl, whc->base + WUSBDNTSCTRL); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This PDC call returns the number of bytes in the processor's Stable Storage, which is the number of contiguous bytes implemented in Stable Storage starting from staddr=0. size in an unsigned 64-bit integer which is a multiple of four. */
int pdc_stable_get_size(unsigned long *size)
/* This PDC call returns the number of bytes in the processor's Stable Storage, which is the number of contiguous bytes implemented in Stable Storage starting from staddr=0. size in an unsigned 64-bit integer which is a multiple of four. */ int pdc_stable_get_size(unsigned long *size)
{ int retval; unsigned long flags; spin_lock_irqsave(&pdc_lock, flags); retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_RETURN_SIZE, __pa(pdc_result)); *size = pdc_result[0]; spin_unlock_irqrestore(&pdc_lock, flags); return retval; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* enable high-driver mode this bit set by software only when IRC16M or HXTAL used as system clock */
void pmu_highdriver_mode_enable(void)
/* enable high-driver mode this bit set by software only when IRC16M or HXTAL used as system clock */ void pmu_highdriver_mode_enable(void)
{ PMU_CTL |= PMU_CTL_HDEN; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return code for board revision and network speed */
int checkboard(void)
/* Return code for board revision and network speed */ int checkboard(void)
{ char *s = getenv ("serial#"); char *e; puts ("Board: "); if (!s || strncmp (s, "HERMES", 6)) { puts ("### No HW ID - assuming HERMES-PRO"); } else { for (e = s; *e; ++e) { if (*e == ' ') break; } for (; s < e; ++s) { putc (*s); } } gd->board_type = board_init (); printf (" Rev. %ld.x\n", (gd->board_type >> 16)); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* Based on: xt_NFLOG.c, (C) 2006 by Patrick McHardy */
static unsigned int ebt_nflog_tg(struct sk_buff *skb, const struct xt_target_param *par)
/* Based on: xt_NFLOG.c, (C) 2006 by Patrick McHardy */ static unsigned int ebt_nflog_tg(struct sk_buff *skb, const struct xt_target_param *par)
{ const struct ebt_nflog_info *info = par->targinfo; struct nf_loginfo li; li.type = NF_LOG_TYPE_ULOG; li.u.ulog.copy_len = info->len; li.u.ulog.group = info->group; li.u.ulog.qthreshold = info->threshold; nf_log_packet(PF_BRIDGE, par->hooknum, skb, par->in, par->out, &li, "%s", info->prefix); return EBT_CONTINUE; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function time stamp the buffer and mark it as DONE. It also wake up any process waiting on the QUEUE and set the next buffer as current */
static void vpif_process_buffer_complete(struct common_obj *common)
/* This function time stamp the buffer and mark it as DONE. It also wake up any process waiting on the QUEUE and set the next buffer as current */ static void vpif_process_buffer_complete(struct common_obj *common)
{ do_gettimeofday(&common->cur_frm->ts); common->cur_frm->state = VIDEOBUF_DONE; wake_up_interruptible(&common->cur_frm->done); common->cur_frm = common->next_frm; }
robutest/uclinux
C++
GPL-2.0
60
/* Find in between all timers which is the next one and update next_timer_* accordingly */
void hwm_find_next_timer(void)
/* Find in between all timers which is the next one and update next_timer_* accordingly */ void hwm_find_next_timer(void)
{ next_timer_index = 0; next_timer_time = *Timer_list[0]; for (unsigned int i = 1; i < NUMBER_OF_TIMERS ; i++) { if (next_timer_time > *Timer_list[i]) { next_timer_index = i; next_timer_time = *Timer_list[i]; } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns the position of first occurrence of the pattern or UINT_MAX if no occurrence was found. */
unsigned int textsearch_find_continuous(struct ts_config *conf, struct ts_state *state, const void *data, unsigned int len)
/* Returns the position of first occurrence of the pattern or UINT_MAX if no occurrence was found. */ unsigned int textsearch_find_continuous(struct ts_config *conf, struct ts_state *state, const void *data, unsigned int len)
{ struct ts_linear_state *st = (struct ts_linear_state *) state->cb; conf->get_next_block = get_linear_data; st->data = data; st->len = len; return textsearch_find(conf, state); }
robutest/uclinux
C++
GPL-2.0
60
/* Profiling data for this node has been loaded again. Add profiling data from previous instantiation and turn this node into a regular node. */
static void revive_node(struct gcov_node *node, struct gcov_info *info)
/* Profiling data for this node has been loaded again. Add profiling data from previous instantiation and turn this node into a regular node. */ static void revive_node(struct gcov_node *node, struct gcov_info *info)
{ if (gcov_info_is_compatible(node->ghost, info)) gcov_info_add(info, node->ghost); else { pr_warning("discarding saved data for '%s' (version changed)\n", info->filename); } gcov_info_free(node->ghost); node->ghost = NULL; node->info = info; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* After a "read attention message" request there are two possible results: */
static int tape_3590_read_attmsg(struct tape_device *device)
/* After a "read attention message" request there are two possible results: */ static int tape_3590_read_attmsg(struct tape_device *device)
{ struct tape_request *request; char *buf; request = tape_alloc_request(3, 4096); if (IS_ERR(request)) return PTR_ERR(request); request->op = TO_READ_ATTMSG; buf = request->cpdata; buf[0] = PREP_RD_SS_DATA; buf[6] = RD_ATTMSG; tape_ccw_cc(request->cpaddr, PERFORM_SS_FUNC, 12, buf); tape_ccw_cc(request->cpaddr + 1, READ_SS_DATA, 4096 - 12, buf + 12); tape_ccw_end(request->cpaddr + 2, NOP, 0, NULL); return tape_do_io_free(device, request); }
robutest/uclinux
C++
GPL-2.0
60
/* reset the state of the low power mode */
void NVIC_ResetystemLowPower(NVIC_LOWPOWER_T lowPowerMode)
/* reset the state of the low power mode */ void NVIC_ResetystemLowPower(NVIC_LOWPOWER_T lowPowerMode)
{ SCB->SCR &= (uint32_t)(~(uint32_t)lowPowerMode); }
pikasTech/PikaPython
C++
MIT License
1,403
/* set the incoming packet structure to default state */
void rc5_reset_packet(void)
/* set the incoming packet structure to default state */ void rc5_reset_packet(void)
{ rc5_tmp_packet.data = 0; rc5_tmp_packet.bit_count = RC5_PACKET_BIT_COUNT - 1; rc5_tmp_packet.last_bit = RC5_ONE; rc5_tmp_packet.status = RC5_PACKET_STATUS_EMPTY; }
liuxuming/trochili
C++
Apache License 2.0
132
/* IDL long NetrLogonControl2( IDL wchar_t *logonserver, IDL long function_code, IDL long level, IDL CONTROL_DATA_INFORMATION *data, IDL CONTROL_QUERY_INFORMATION *query IDL ); */
static int netlogon_dissect_netrlogoncontrol2_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL long NetrLogonControl2( IDL wchar_t *logonserver, IDL long function_code, IDL long level, IDL CONTROL_DATA_INFORMATION *data, IDL CONTROL_QUERY_INFORMATION *query IDL ); */ static int netlogon_dissect_netrlogoncontrol2_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset, pinfo, tree, di, drep); offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_netlogon_code, NULL); offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_netlogon_level, NULL); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, netlogon_dissect_CONTROL_DATA_INFORMATION, NDR_POINTER_REF, "CONTROL_DATA_INFORMATION: ", -1); return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return the buffer size of the EFI_BOOT_MANAGER_KEY_OPTION data. */
UINTN BmSizeOfKeyOption(IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption)
/* Return the buffer size of the EFI_BOOT_MANAGER_KEY_OPTION data. */ UINTN BmSizeOfKeyOption(IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption)
{ return OFFSET_OF (EFI_BOOT_MANAGER_KEY_OPTION, Keys) + KeyOption->KeyData.Options.InputKeyCount * sizeof (EFI_INPUT_KEY); }
tianocore/edk2
C++
Other
4,240
/* Wait for all URBs to the endpoint to be completed, then delete the qset. */
static void whc_endpoint_disable(struct usb_hcd *usb_hcd, struct usb_host_endpoint *ep)
/* Wait for all URBs to the endpoint to be completed, then delete the qset. */ static void whc_endpoint_disable(struct usb_hcd *usb_hcd, struct usb_host_endpoint *ep)
{ struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); struct whc *whc = wusbhc_to_whc(wusbhc); struct whc_qset *qset; qset = ep->hcpriv; if (qset) { ep->hcpriv = NULL; if (usb_endpoint_xfer_bulk(&ep->desc) || usb_endpoint_xfer_control(&ep->desc)) asl_qset_delete(whc, qset); else pzl_qset_delete(whc, qset); } }
robutest/uclinux
C++
GPL-2.0
60
/* Get maximum number of messages in a Message Queue. */
uint32_t osMessageQueueGetCapacity(osMessageQueueId_t mq_id)
/* Get maximum number of messages in a Message Queue. */ uint32_t osMessageQueueGetCapacity(osMessageQueueId_t mq_id)
{ capacity = svcRtxMessageQueueGetCapacity(mq_id); } else { capacity = __svcMessageQueueGetCapacity(mq_id); } return capacity; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Return request in fuse_file->reserved_req. However that may currently be in use. If that is the case, wait for it to become available. */
static struct fuse_req* get_reserved_req(struct fuse_conn *fc, struct file *file)
/* Return request in fuse_file->reserved_req. However that may currently be in use. If that is the case, wait for it to become available. */ static struct fuse_req* get_reserved_req(struct fuse_conn *fc, struct file *file)
{ struct fuse_req *req = NULL; struct fuse_file *ff = file->private_data; do { wait_event(fc->reserved_req_waitq, ff->reserved_req); spin_lock(&fc->lock); if (ff->reserved_req) { req = ff->reserved_req; ff->reserved_req = NULL; get_file(file); req->stolen_file = file; } spin_unlock(&fc->lock); } while (!req); return req; }
robutest/uclinux
C++
GPL-2.0
60
/* Note that this will only take effect when the link state changes. */
static int set_overrunthreshold(struct ipath_devdata *dd, unsigned n)
/* Note that this will only take effect when the link state changes. */ static int set_overrunthreshold(struct ipath_devdata *dd, unsigned n)
{ unsigned v; v = (dd->ipath_ibcctrl >> INFINIPATH_IBCC_OVERRUNTHRESHOLD_SHIFT) & INFINIPATH_IBCC_OVERRUNTHRESHOLD_MASK; if (v != n) { dd->ipath_ibcctrl &= ~(INFINIPATH_IBCC_OVERRUNTHRESHOLD_MASK << INFINIPATH_IBCC_OVERRUNTHRESHOLD_SHIFT); dd->ipath_ibcctrl |= (u64) n << INFINIPATH_IBCC_OVERRUNTHRESHOLD_SHIFT; ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, dd->ipath_ibcctrl); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param base pointer to FLEXIO_I2S_Type structure param mask interrupt source */
void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask)
/* param base pointer to FLEXIO_I2S_Type structure param mask interrupt source */ void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask)
{ if ((mask & (uint32_t)kFLEXIO_I2S_TxDataRegEmptyInterruptEnable) != 0UL) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1UL << base->txShifterIndex); } if ((mask & (uint32_t)kFLEXIO_I2S_RxDataRegFullInterruptEnable) != 0UL) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1UL << base->rxShifterIndex); } }
eclipse-threadx/getting-started
C++
Other
310
/* Initialize GPIO config structure. Fill each pstcGpioInit with default value. */
int32_t GPIO_StructInit(stc_gpio_init_t *pstcGpioInit)
/* Initialize GPIO config structure. Fill each pstcGpioInit with default value. */ int32_t GPIO_StructInit(stc_gpio_init_t *pstcGpioInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcGpioInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcGpioInit->u16PinState = PIN_STAT_RST; pstcGpioInit->u16PinDir = PIN_DIR_IN; pstcGpioInit->u16PinDrv = PIN_LOW_DRV; pstcGpioInit->u16PinAttr = PIN_ATTR_DIGITAL; pstcGpioInit->u16Latch = PIN_LATCH_OFF; pstcGpioInit->u16PullUp = PIN_PU_OFF; pstcGpioInit->u16Invert = PIN_INVT_OFF; pstcGpioInit->u16ExtInt = PIN_EXTINT_OFF; pstcGpioInit->u16PinOutputType = PIN_OUT_TYPE_CMOS; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USB Device Endpoint 0 Event Callback - WinUSB specific handling (Setup Request To Device) Parameters: none Return Value: TRUE - Setup vendor request ok, FALSE - Setup vendor request not supported */
__WEAK BOOL USBD_EndPoint0_Setup_WinUSB_ReqToDevice(void)
/* USB Device Endpoint 0 Event Callback - WinUSB specific handling (Setup Request To Device) Parameters: none Return Value: TRUE - Setup vendor request ok, FALSE - Setup vendor request not supported */ __WEAK BOOL USBD_EndPoint0_Setup_WinUSB_ReqToDevice(void)
{ U8 *pD; U32 len; BOOL success = (__FALSE); if (USBD_SetupPacket.bRequest == usbd_winusb_vendor_code) { switch (USBD_SetupPacket.wIndex) { case WINUSB_REQUEST_GET_DESCRIPTOR_SET: pD = (U8 *)USBD_WinUSBDescriptorSetDescriptor; USBD_EP0Data.pData = pD; len = ((WINUSB_DESCRIPTOR_SET_HEADER *)pD)->wTotalLength; success = (__TRUE); break; default: break; } } if (success) { if (len < USBD_SetupPacket.wLength) { USBD_EP0Data.Count = len; if (!(len & (usbd_max_packet0 - 1))) { USBD_ZLP = 1; } } else { USBD_EP0Data.Count = USBD_SetupPacket.wLength; } USBD_DataInStage(); } return success; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Reschedule call back. Nothing to do, all the work is done automatically when we return from the interrupt. */
static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
/* Reschedule call back. Nothing to do, all the work is done automatically when we return from the interrupt. */ static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
{ inc_irq_stat(irq_resched_count); return IRQ_HANDLED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the specified ETHERNET DMA Rx Desc buffer size. */
uint32_t ETH_GetDmaRxDescBufSize(ETH_DMADescType *DMARxDesc, uint32_t DMARxDesc_Buffer)
/* Returns the specified ETHERNET DMA Rx Desc buffer size. */ uint32_t ETH_GetDmaRxDescBufSize(ETH_DMADescType *DMARxDesc, uint32_t DMARxDesc_Buffer)
{ assert_param(IS_ETH_DMA_RXDESC_BUFFER(DMARxDesc_Buffer)); if (DMARxDesc_Buffer != ETH_DMA_RX_DESC_BUFFER1) { return ((DMARxDesc->CtrlOrBufSize & ETH_DMA_RX_DESC_RBS2) >> ETH_DMA_RX_DESC_BUF2_SIZE_SHIFT); } else { return (DMARxDesc->CtrlOrBufSize & ETH_DMA_RX_DESC_RBS1); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* configure the GPIO ports , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void gpio_configuration(void)
/* configure the GPIO ports , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void gpio_configuration(void)
{ rcu_periph_clock_enable(RCU_GPIOB); gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_4); gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_4); gpio_af_set(GPIOB, GPIO_AF_1, GPIO_PIN_4); }
liuxuming/trochili
C++
Apache License 2.0
132
/* 7.3.2.9.2 Slice data partition B RBSP syntax slice_data_partition_b_layer_rbsp( */
static void dissect_h264_slice_data_partition_b_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
/* 7.3.2.9.2 Slice data partition B RBSP syntax slice_data_partition_b_layer_rbsp( */ static void dissect_h264_slice_data_partition_b_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
/* Acquires semaphore, if necessary, then reads the PHY register at offset and storing the retrieved information in data. Release any acquired semaphores before exiting. */
s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
/* Acquires semaphore, if necessary, then reads the PHY register at offset and storing the retrieved information in data. Release any acquired semaphores before exiting. */ s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
{ s32 ret_val = 0; if (!(hw->phy.ops.acquire)) goto out; ret_val = hw->phy.ops.acquire(hw); if (ret_val) goto out; if (offset > MAX_PHY_MULTI_PAGE_REG) { ret_val = igb_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, (u16)offset); if (ret_val) { hw->phy.ops.release(hw); goto out; } } ret_val = igb_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, data); hw->phy.ops.release(hw); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear TIMER0 module interrupt status. Clear the TIMER0 module interrupt status */
void timer_clear_interrupt_status(void)
/* Clear TIMER0 module interrupt status. Clear the TIMER0 module interrupt status */ void timer_clear_interrupt_status(void)
{ TIMER0->INTSTATUSCLEAR.reg = 1; while (TIMER0->INTSTATUSCLEAR.reg); }
memfault/zero-to-main
C++
null
200
/* Print out a null-padded filename (or other ascii string). If ep is NULL, assume no truncation check is needed. Return true if truncated. Stop at ep (if given) or after n bytes or before the null char, whichever is first. */
int fn_printzp(netdissect_options *ndo, register const u_char *s, register u_int n, register const u_char *ep)
/* Print out a null-padded filename (or other ascii string). If ep is NULL, assume no truncation check is needed. Return true if truncated. Stop at ep (if given) or after n bytes or before the null char, whichever is first. */ int fn_printzp(netdissect_options *ndo, register const u_char *s, register u_int n, register const u_char *ep)
{ register int ret; register u_char c; ret = 1; while (n > 0 && (ep == NULL || s < ep)) { n--; c = *s++; if (c == '\0') { ret = 0; break; } if (!ND_ISASCII(c)) { c = ND_TOASCII(c); ND_PRINT((ndo, "M-")); } if (!ND_ISPRINT(c)) { c ^= 0x40; ND_PRINT((ndo, "^")); } ND_PRINT((ndo, "%c", c)); } return (n == 0) ? 0 : ret; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* strrchr - Find the last occurrence of a character in a string @s: The string to be searched */
char* strrchr(const char *s, int c)
/* strrchr - Find the last occurrence of a character in a string @s: The string to be searched */ char* strrchr(const char *s, int c)
{ size_t len = __strend(s) - s; if (len) do { if (s[len] == (char) c) return (char *) s + len; } while (--len > 0); return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Allocate a MTFTP4 block range, then init it to the range of */
MTFTP4_BLOCK_RANGE* Mtftp4AllocateRange(IN UINT16 Start, IN UINT16 End)
/* Allocate a MTFTP4 block range, then init it to the range of */ MTFTP4_BLOCK_RANGE* Mtftp4AllocateRange(IN UINT16 Start, IN UINT16 End)
{ MTFTP4_BLOCK_RANGE *Range; Range = AllocateZeroPool (sizeof (MTFTP4_BLOCK_RANGE)); if (Range == NULL) { return NULL; } InitializeListHead (&Range->Link); Range->Start = Start; Range->End = End; Range->Bound = End; return Range; }
tianocore/edk2
C++
Other
4,240
/* Submits register request to kseriod for subsequent execution. Note that port registration is always asynchronous. */
void __serio_register_port(struct serio *serio, struct module *owner)
/* Submits register request to kseriod for subsequent execution. Note that port registration is always asynchronous. */ void __serio_register_port(struct serio *serio, struct module *owner)
{ serio_init_port(serio); serio_queue_event(serio, owner, SERIO_REGISTER_PORT); }
robutest/uclinux
C++
GPL-2.0
60
/* Writes the 64-bit value specified by Value to the MSR specified by Index. The 64-bit value written to the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
/* Writes the 64-bit value specified by Value to the MSR specified by Index. The 64-bit value written to the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
{ UINT32 LowData; UINT32 HighData; BOOLEAN Flag; Flag = FilterBeforeMsrWrite (Index, &Value); if (Flag) { LowData = (UINT32)(Value); HighData = (UINT32)(Value >> 32); __asm__ __volatile__ ( "wrmsr" : : "c" (Index), "a" (LowData), "d" (HighData) ); } FilterAfterMsrWrite (Index, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* In xAPIC mode, the initial local APIC ID may be different from current APIC ID. In x2APIC mode, the local APIC ID can't be changed and there is no concept of initial APIC ID. In this case, the 32-bit local APIC ID is returned as initial APIC ID. */
UINT32 EFIAPI GetInitialApicId(VOID)
/* In xAPIC mode, the initial local APIC ID may be different from current APIC ID. In x2APIC mode, the local APIC ID can't be changed and there is no concept of initial APIC ID. In this case, the 32-bit local APIC ID is returned as initial APIC ID. */ UINT32 EFIAPI GetInitialApicId(VOID)
{ UINT32 ApicId; UINT32 MaxCpuIdIndex; UINT32 RegEbx; if (GetApicMode () == LOCAL_APIC_MODE_XAPIC) { AsmCpuid (CPUID_SIGNATURE, &MaxCpuIdIndex, NULL, NULL, NULL); if (MaxCpuIdIndex >= CPUID_EXTENDED_TOPOLOGY) { AsmCpuidEx (CPUID_EXTENDED_TOPOLOGY, 0, NULL, &RegEbx, NULL, &ApicId); if ((RegEbx & (BIT16 - 1)) != 0) { return ApicId; } } AsmCpuid (CPUID_VERSION_INFO, NULL, &RegEbx, NULL, NULL); return RegEbx >> 24; } else { return GetApicId (); } }
tianocore/edk2
C++
Other
4,240
/* EFI_SUCCESS - GPIO set as requested EFI_UNSUPPORTED - Mode is not supported EFI_INVALID_PARAMETER - Gpio pin is out of range */
EFI_STATUS EFIAPI Set(IN EMBEDDED_GPIO *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_MODE Mode)
/* EFI_SUCCESS - GPIO set as requested EFI_UNSUPPORTED - Mode is not supported EFI_INVALID_PARAMETER - Gpio pin is out of range */ EFI_STATUS EFIAPI Set(IN EMBEDDED_GPIO *This, IN EMBEDDED_GPIO_PIN Gpio, IN EMBEDDED_GPIO_MODE Mode)
{ EFI_STATUS Status; UINTN Index, Offset, RegisterBase; Status = PL061Locate (Gpio, &Index, &Offset, &RegisterBase); ASSERT_EFI_ERROR (Status); switch (Mode) { case GPIO_MODE_INPUT: MmioAnd8 ( RegisterBase + PL061_GPIO_DIR_REG, ~GPIO_PIN_MASK(Offset) & 0xFF ); break; case GPIO_MODE_OUTPUT_0: MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK (Offset)); PL061SetPins (RegisterBase, GPIO_PIN_MASK (Offset), 0); break; case GPIO_MODE_OUTPUT_1: MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK (Offset)); PL061SetPins (RegisterBase, GPIO_PIN_MASK (Offset), 0xff); break; default: return EFI_UNSUPPORTED; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This code deviates from the documented sequence in the following aspects: */
int main()
/* This code deviates from the documented sequence in the following aspects: */ int main()
{ addr64 lscsa_ea; lscsa_ea.ui[0] = spu_readch(SPU_RdSigNotify1); lscsa_ea.ui[1] = spu_readch(SPU_RdSigNotify2); fetch_regs_from_mem(lscsa_ea); set_event_mask(); set_tag_mask(); build_dma_list(lscsa_ea); restore_upper_240kb(lscsa_ea); enqueue_putllc(lscsa_ea); set_tag_update(); read_tag_status(); restore_decr(); read_llar_status(); write_ppu_mb(); write_ppuint_mb(); restore_fpcr(); restore_srr0(); restore_event_mask(); restore_tag_mask(); restore_complete(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the selected DAC channel software trigger. */
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
/* Enables or disables the selected DAC channel software trigger. */ void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
{ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DAC->SWTRIGR |= SWTRIGR_SWTRIG_Set << (DAC_Channel >> 4); } else { DAC->SWTRIGR &= ~(SWTRIGR_SWTRIG_Set << (DAC_Channel >> 4)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reverses the effect of usb_hcd_lh7a404_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */
void usb_hcd_lpc178x_remove(struct usb_hcd *hcd, struct platform_device *dev)
/* Reverses the effect of usb_hcd_lh7a404_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */ void usb_hcd_lpc178x_remove(struct usb_hcd *hcd, struct platform_device *dev)
{ usb_remove_hcd(hcd); lpc178x_hc_stop(); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); }
robutest/uclinux
C++
GPL-2.0
60
/* Convert a UEFI memory type to SMM pool type. */
SMM_POOL_TYPE UefiMemoryTypeToSmmPoolType(IN EFI_MEMORY_TYPE MemoryType)
/* Convert a UEFI memory type to SMM pool type. */ SMM_POOL_TYPE UefiMemoryTypeToSmmPoolType(IN EFI_MEMORY_TYPE MemoryType)
{ ASSERT ((MemoryType == EfiRuntimeServicesCode) || (MemoryType == EfiRuntimeServicesData)); switch (MemoryType) { case EfiRuntimeServicesCode: return SmmPoolTypeCode; case EfiRuntimeServicesData: return SmmPoolTypeData; default: return SmmPoolTypeMax; } }
tianocore/edk2
C++
Other
4,240
/* qla2x00_get_flash_manufacturer() - Read manufacturer ID from flash chip. @man_id: Flash manufacturer ID @flash_id: Flash ID */
static void qla2x00_get_flash_manufacturer(struct qla_hw_data *ha, uint8_t *man_id, uint8_t *flash_id)
/* qla2x00_get_flash_manufacturer() - Read manufacturer ID from flash chip. @man_id: Flash manufacturer ID @flash_id: Flash ID */ static void qla2x00_get_flash_manufacturer(struct qla_hw_data *ha, uint8_t *man_id, uint8_t *flash_id)
{ qla2x00_write_flash_byte(ha, 0x5555, 0xaa); qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); qla2x00_write_flash_byte(ha, 0x5555, 0x90); *man_id = qla2x00_read_flash_byte(ha, 0x0000); *flash_id = qla2x00_read_flash_byte(ha, 0x0001); qla2x00_write_flash_byte(ha, 0x5555, 0xaa); qla2x00_write_flash_byte(ha, 0x2aaa, 0x55); qla2x00_write_flash_byte(ha, 0x5555, 0xf0); }
robutest/uclinux
C++
GPL-2.0
60
/* Invoked by Port Bus driver during nonfatal recovery. */
static void aer_error_resume(struct pci_dev *dev)
/* Invoked by Port Bus driver during nonfatal recovery. */ static void aer_error_resume(struct pci_dev *dev)
{ int pos; u32 status, mask; u16 reg16; pos = pci_pcie_cap(dev); pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &reg16); pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, reg16); pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask); if (dev->error_state == pci_channel_io_normal) status &= ~mask; else status &= mask; pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); }
robutest/uclinux
C++
GPL-2.0
60
/* Iterates through the list of known PCI busses. A new search is initiated by passing NULL as the @from argument. Otherwise if @from is not NULL, searches continue from next device on the global list. */
struct pci_bus* pci_find_next_bus(const struct pci_bus *from)
/* Iterates through the list of known PCI busses. A new search is initiated by passing NULL as the @from argument. Otherwise if @from is not NULL, searches continue from next device on the global list. */ struct pci_bus* pci_find_next_bus(const struct pci_bus *from)
{ struct list_head *n; struct pci_bus *b = NULL; WARN_ON(in_interrupt()); down_read(&pci_bus_sem); n = from ? from->node.next : pci_root_buses.next; if (n != &pci_root_buses) b = pci_bus_b(n); up_read(&pci_bus_sem); return b; }
robutest/uclinux
C++
GPL-2.0
60
/* Free the UHCI device and release its associated resources. */
VOID UhciFreeDev(IN USB_HC_DEV *Uhc)
/* Free the UHCI device and release its associated resources. */ VOID UhciFreeDev(IN USB_HC_DEV *Uhc)
{ if (Uhc->AsyncIntMonitor != NULL) { gBS->CloseEvent (Uhc->AsyncIntMonitor); } if (Uhc->ExitBootServiceEvent != NULL) { gBS->CloseEvent (Uhc->ExitBootServiceEvent); } if (Uhc->MemPool != NULL) { UsbHcFreeMemPool (Uhc->MemPool); } if (Uhc->CtrlNameTable != NULL) { FreeUnicodeStringTable (Uhc->CtrlNameTable); } FreePool (Uhc); }
tianocore/edk2
C++
Other
4,240
/* SimpleLinkGeneralEventHandler. This handler gets called whenever a general error is reported by the NWP / Host driver. Since these errors are not fatal, the application can handle them. */
void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *dev_event)
/* SimpleLinkGeneralEventHandler. This handler gets called whenever a general error is reported by the NWP / Host driver. Since these errors are not fatal, the application can handle them. */ void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *dev_event)
{ if (!dev_event) { return; } LOG_INF("[GENERAL EVENT] - ID=[%d] Sender=[%d]", dev_event->Data.Error.Code, dev_event->Data.Error.Source); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns zero on success otherwise an error code. */
static int sep_open(struct inode *inode, struct file *filp)
/* Returns zero on success otherwise an error code. */ static int sep_open(struct inode *inode, struct file *filp)
{ if (sep_dev == NULL) return -ENODEV; if (filp->f_flags & O_NDELAY) { if (sep_try_open(sep_dev) == 0) return -EAGAIN; } else if (wait_event_interruptible(sep_event, sep_try_open(sep_dev)) < 0) return -EINTR; filp->private_data = sep_dev; sep_dev->data_pool_bytes_allocated = 0; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ while(1) { BSP_LED_Toggle(LED4); HAL_Delay(500); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Queries the current Ethernet MAC remote wake-up status. */
uint32_t EMACPowerManagementStatusGet(uint32_t ui32Base)
/* Queries the current Ethernet MAC remote wake-up status. */ uint32_t EMACPowerManagementStatusGet(uint32_t ui32Base)
{ ASSERT(ui32Base == EMAC0_BASE); return (HWREG(ui32Base + EMAC_O_PMTCTLSTAT) & (EMAC_PMTCTLSTAT_WUPRX | EMAC_PMTCTLSTAT_MGKPRX | EMAC_PMTCTLSTAT_PWRDWN)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* might_sleep (); if (hcd->driver->endpoint_disable){ hcd->driver->endpoint_disable (hcd, ep); } } */
int usb_hcd_link_urb_to_ep(struct hc_gen_dev *hcd, struct urb *urb)
/* might_sleep (); if (hcd->driver->endpoint_disable){ hcd->driver->endpoint_disable (hcd, ep); } } */ int usb_hcd_link_urb_to_ep(struct hc_gen_dev *hcd, struct urb *urb)
{ int rc = 0; int flags; flags = hal_spin_lock_irqsave(&gen_hcd_lock); if (HC_GEN_DEV_IS_RUNNING(hcd->state)) { list_add_tail(&(urb->urb_list), &(urb->ep->urb_list)); } else { rc = -1; } hal_spin_unlock_irqrestore(&gen_hcd_lock, flags); return rc; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disable the AF for the selected IO pin(s). */
void stmpe811_IO_DisableAF(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Disable the AF for the selected IO pin(s). */ void stmpe811_IO_DisableAF(uint16_t DeviceAddr, uint32_t IO_Pin)
{ uint8_t tmp = 0; tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_AF); tmp |= (uint8_t)IO_Pin; IOE_Write(DeviceAddr, STMPE811_REG_IO_AF, tmp); }
eclipse-threadx/getting-started
C++
Other
310
/* Called by the PCI code when it finds a Jmicron controller. We then use the IDE PCI generic helper to do most of the work. */
static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* Called by the PCI code when it finds a Jmicron controller. We then use the IDE PCI generic helper to do most of the work. */ static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ return ide_pci_init_one(dev, &jmicron_chipset, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Resets the endpoint state if asked, and sets dev->ep_{in,out} pointers. For control endpoints, both the input and output sides are handled. */
void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, bool reset_ep)
/* Resets the endpoint state if asked, and sets dev->ep_{in,out} pointers. For control endpoints, both the input and output sides are handled. */ void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, bool reset_ep)
{ int epnum = usb_endpoint_num(&ep->desc); int is_out = usb_endpoint_dir_out(&ep->desc); int is_control = usb_endpoint_xfer_control(&ep->desc); if (reset_ep) usb_hcd_reset_endpoint(dev, ep); if (is_out || is_control) dev->ep_out[epnum] = ep; if (!is_out || is_control) dev->ep_in[epnum] = ep; ep->enabled = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Fix an expression to return one result. If expression is not a multi-ret expression (function call or vararg), it already returns one result, so nothing needs to be done. Function calls become VNONRELOC expressions (as its result comes fixed in the base register of the call), while vararg expressions become VRELOCABLE (as OP_VARARG puts its results where it wants). (Calls are created returning one result, so that does not need to be fixed.) */
void luaK_setoneret(FuncState *fs, expdesc *e)
/* Fix an expression to return one result. If expression is not a multi-ret expression (function call or vararg), it already returns one result, so nothing needs to be done. Function calls become VNONRELOC expressions (as its result comes fixed in the base register of the call), while vararg expressions become VRELOCABLE (as OP_VARARG puts its results where it wants). (Calls are created returning one result, so that does not need to be fixed.) */ void luaK_setoneret(FuncState *fs, expdesc *e)
{ lua_assert(GETARG_C(getinstruction(fs, e)) == 2); e->k = VNONRELOC; e->u.info = GETARG_A(getinstruction(fs, e)); } else if (e->k == VVARARG) { SETARG_B(getinstruction(fs, e), 2); e->k = VRELOCABLE; } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Disable the board, and put back into power-up state. */
static void madgemc_chipset_close(struct net_device *dev)
/* Disable the board, and put back into power-up state. */ static void madgemc_chipset_close(struct net_device *dev)
{ madgemc_setint(dev, 0); madgemc_setsifsel(dev, 0); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Receives a byte that has been sent to the I2C Slave. */
unsigned long I2CSlaveDataGet(unsigned long ulBase)
/* Receives a byte that has been sent to the I2C Slave. */ unsigned long I2CSlaveDataGet(unsigned long ulBase)
{ ASSERT(I2CSlaveBaseValid(ulBase)); return(HWREG(ulBase + I2C_O_SDR)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calls the function @func when the task is currently running. This might be on the current CPU, which just calls the function directly */
void task_oncpu_function_call(struct task_struct *p, void(*func)(void *info), void *info)
/* Calls the function @func when the task is currently running. This might be on the current CPU, which just calls the function directly */ void task_oncpu_function_call(struct task_struct *p, void(*func)(void *info), void *info)
{ int cpu; preempt_disable(); cpu = task_cpu(p); if (task_curr(p)) smp_call_function_single(cpu, func, info, 1); preempt_enable(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If we have a symbol_name argument, look it up and add the offset field to it. This way, we can specify a relative address to a symbol. */
static kprobe_opcode_t __kprobes* kprobe_addr(struct kprobe *p)
/* If we have a symbol_name argument, look it up and add the offset field to it. This way, we can specify a relative address to a symbol. */ static kprobe_opcode_t __kprobes* kprobe_addr(struct kprobe *p)
{ kprobe_opcode_t *addr = p->addr; if (p->symbol_name) { if (addr) return NULL; kprobe_lookup_name(p->symbol_name, addr); } if (!addr) return NULL; return (kprobe_opcode_t *)(((char *)addr) + p->offset); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SMM Non-Volatile variable write service is ready notify event handler. */
VOID EFIAPI SmmVariableWriteReady(IN EFI_EVENT Event, IN VOID *Context)
/* SMM Non-Volatile variable write service is ready notify event handler. */ VOID EFIAPI SmmVariableWriteReady(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; VOID *ProtocolOps; Status = gBS->LocateProtocol (&gSmmVariableWriteGuid, NULL, (VOID **)&ProtocolOps); if (EFI_ERROR (Status)) { return; } RecordSecureBootPolicyVarData (); Status = gBS->InstallProtocolInterface ( &mHandle, &gEfiVariableWriteArchProtocolGuid, EFI_NATIVE_INTERFACE, NULL ); ASSERT_EFI_ERROR (Status); gBS->CloseEvent (Event); }
tianocore/edk2
C++
Other
4,240
/* Pop a message referring to the currently-selected field off the statusbar. */
void statusbar_pop_field_msg(void)
/* Pop a message referring to the currently-selected field off the statusbar. */ void statusbar_pop_field_msg(void)
{ if (status_levels[STATUS_LEVEL_HELP] > 0) { status_levels[STATUS_LEVEL_HELP]--; } gtk_statusbar_pop(GTK_STATUSBAR(info_bar), help_ctx); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Calculated from the receive time of the device's beacon and it's slot number. */
static ssize_t uwb_dev_BPST_show(struct device *dev, struct device_attribute *attr, char *buf)
/* Calculated from the receive time of the device's beacon and it's slot number. */ static ssize_t uwb_dev_BPST_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct uwb_dev *uwb_dev = to_uwb_dev(dev); struct uwb_beca_e *bce; struct uwb_beacon_frame *bf; u16 bpst; bce = uwb_dev->bce; mutex_lock(&bce->mutex); bf = (struct uwb_beacon_frame *)bce->be->BeaconInfo; bpst = bce->be->wBPSTOffset - (u16)(bf->Beacon_Slot_Number * UWB_BEACON_SLOT_LENGTH_US); mutex_unlock(&bce->mutex); return sprintf(buf, "%d\n", bpst); }
robutest/uclinux
C++
GPL-2.0
60
/* The default values are as follows. code config->rtccalenable = false; config->rtccalvalue = 0U; config->PIFreq = 0U; endcode param config Pointer to the user's SNVS configuration structure. */
void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config)
/* The default values are as follows. code config->rtccalenable = false; config->rtccalvalue = 0U; config->PIFreq = 0U; endcode param config Pointer to the user's SNVS configuration structure. */ void SNVS_HP_RTC_GetDefaultConfig(snvs_hp_rtc_config_t *config)
{ assert(config); memset(config, 0, sizeof(*config)); config->rtcCalEnable = false; config->rtcCalValue = 0U; config->periodicInterruptFreq = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The function returns an integer less than, equal to, or greater than zero if @s1 (or the first */
int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n)
/* The function returns an integer less than, equal to, or greater than zero if @s1 (or the first */ int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n)
{ u16 c1, c2; size_t i; for (i = 0; i < n; ++i) { c1 = le16_to_cpu(s1[i]); c2 = le16_to_cpu(s2[i]); if (c1 < c2) return -1; if (c1 > c2) return 1; if (!c1) break; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve IRQ number for the given hardware instance. */
static uint8_t _adc_get_irq_num(const struct _adc_async_device *const device)
/* Retrieve IRQ number for the given hardware instance. */ static uint8_t _adc_get_irq_num(const struct _adc_async_device *const device)
{ (void)device; return ADC_OTHER_IRQn; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Hash for the output device based upon layer 3 and layer 4 data. If the packet is a frag or not TCP or UDP, just use layer 3 data. If it is altogether not IP, mimic bond_xmit_hash_policy_l2() */
static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
/* Hash for the output device based upon layer 3 and layer 4 data. If the packet is a frag or not TCP or UDP, just use layer 3 data. If it is altogether not IP, mimic bond_xmit_hash_policy_l2() */ static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
{ struct ethhdr *data = (struct ethhdr *)skb->data; struct iphdr *iph = ip_hdr(skb); __be16 *layer4hdr = (__be16 *)((u32 *)iph + iph->ihl); int layer4_xor = 0; if (skb->protocol == htons(ETH_P_IP)) { if (!(iph->frag_off & htons(IP_MF|IP_OFFSET)) && (iph->protocol == IPPROTO_TCP || iph->protocol == IPPROTO_UDP)) { layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1))); } return (layer4_xor ^ ((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count; } return (data->h_dest[5] ^ data->h_source[5]) % count; }
robutest/uclinux
C++
GPL-2.0
60
/* RTC MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
/* RTC MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc)
{ __HAL_RCC_RTC_DISABLE(); HAL_PWR_DisableBkUpAccess(); __HAL_RCC_PWR_CLK_DISABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* diagnose code 0x14 subcode 0x0fff - retrieve next file descriptor cc=0 normal completion cc=1 no files on reader queue or no subsequent file cc=2 spid specified is invalid */
static int diag_read_next_file_info(struct file_control_block *buf, int spid)
/* diagnose code 0x14 subcode 0x0fff - retrieve next file descriptor cc=0 normal completion cc=1 no files on reader queue or no subsequent file cc=2 spid specified is invalid */ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
{ int cc; cc = diag14((unsigned long) buf, spid, 0xfff); switch (cc) { case 0: return 0; default: return -ENODATA; } }
robutest/uclinux
C++
GPL-2.0
60
/* configure temperature sensor and internal reference voltage channel or VBAT channel function */
void adc_channel_16_to_18(uint32_t function, ControlStatus newvalue)
/* configure temperature sensor and internal reference voltage channel or VBAT channel function */ void adc_channel_16_to_18(uint32_t function, ControlStatus newvalue)
{ if(newvalue) { if(RESET != (function & ADC_VBAT_CHANNEL_SWITCH)) { ADC_SYNCCTL |= ADC_VBAT_CHANNEL_SWITCH; } if(RESET != (function & ADC_TEMP_VREF_CHANNEL_SWITCH)) { ADC_SYNCCTL |= ADC_TEMP_VREF_CHANNEL_SWITCH; } } else { if(RESET != (function & ADC_VBAT_CHANNEL_SWITCH)) { ADC_SYNCCTL &= ~ADC_VBAT_CHANNEL_SWITCH; } if(RESET != (function & ADC_TEMP_VREF_CHANNEL_SWITCH)) { ADC_SYNCCTL &= ~ADC_TEMP_VREF_CHANNEL_SWITCH; } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* dwarf_free_frame - free the memory allocated for @frame @frame: the frame to free */
void dwarf_free_frame(struct dwarf_frame *frame)
/* dwarf_free_frame - free the memory allocated for @frame @frame: the frame to free */ void dwarf_free_frame(struct dwarf_frame *frame)
{ dwarf_frame_free_regs(frame); mempool_free(frame, dwarf_frame_pool); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Converts a text device path node to USB HID device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbHID(CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB HID device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbHID(CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_HID; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* By default we select char/ for new entries. Setting class->dev_obj to NULL prevents an entry from being created. class->dev_kobj must be set (or cleared) before any devices are registered to the class otherwise device_create_sys_dev_entry() and device_remove_sys_dev_entry() will disagree about the the presence of the link. */
static struct kobject* device_to_dev_kobj(struct device *dev)
/* By default we select char/ for new entries. Setting class->dev_obj to NULL prevents an entry from being created. class->dev_kobj must be set (or cleared) before any devices are registered to the class otherwise device_create_sys_dev_entry() and device_remove_sys_dev_entry() will disagree about the the presence of the link. */ static struct kobject* device_to_dev_kobj(struct device *dev)
{ struct kobject *kobj; if (dev->class) kobj = dev->class->dev_kobj; else kobj = sysfs_dev_char_kobj; return kobj; }
robutest/uclinux
C++
GPL-2.0
60
/* Setup the microcontroller system. Initialize the Embedded Flash Interface, the PLL and update the SystemCoreClock variable. */
void SystemInit(void)
/* Setup the microcontroller system. Initialize the Embedded Flash Interface, the PLL and update the SystemCoreClock variable. */ void SystemInit(void)
{ RCC->CR |= (uint32_t)0x00000001; RCC->CFGR &= (uint32_t)0xF8FFB80C; RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CFGR &= (uint32_t)0xFFC0FFFF; RCC->CFGR2 &= (uint32_t)0xFFFFFFF0; RCC->CFGR3 &= (uint32_t)0xFFFFFEAC; RCC->CR2 &= (uint32_t)0xFFFFFFFE; RCC->CIR = 0x00000000; SetSysClock(); }
ajhc/demo-cortex-m3
C++
null
38
/* Start a DHCP client, and wait for a lease to be acquired. */
void app_dhcpv4_startup(void)
/* Start a DHCP client, and wait for a lease to be acquired. */ void app_dhcpv4_startup(void)
{ LOG_INF("starting DHCPv4"); net_mgmt_init_event_callback(&mgmt_cb, handler, NET_EVENT_IPV4_ADDR_ADD); net_mgmt_add_event_callback(&mgmt_cb); net_dhcpv4_start(net_if_get_default()); k_sem_take(&got_address, K_FOREVER); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the DMA control B of the specified DMA Channel. */
void dmac_channel_set_ctrlB(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_ctrlB)
/* Set the DMA control B of the specified DMA Channel. */ void dmac_channel_set_ctrlB(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_ctrlB)
{ Assert(p_dmac); Assert(ul_num<=3); p_dmac->DMAC_CH_NUM[ul_num].DMAC_CTRLB = ul_ctrlB; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the peripheral interrupt number through peripheral base. */
unsigned long xSysCtlPeripheralIntNumGet(unsigned long ulPeripheralBase)
/* Get the peripheral interrupt number through peripheral base. */ unsigned long xSysCtlPeripheralIntNumGet(unsigned long ulPeripheralBase)
{ unsigned long i; xASSERT((ulPeripheralBase == xGPIO_PORTA_BASE) ); for(i=0; g_pPeripherals[i].ulPeripheralBase != 0; i++) { if(ulPeripheralBase == g_pPeripherals[i].ulPeripheralBase) { break; } } return g_pPeripherals[i].ulPeripheralIntNum; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Configures external clock mode of the GPTM. Used ITIx as the clock source. */
void TimerITIExtClkConfigure(unsigned long ulBase, unsigned long ulTriggerSource)
/* Configures external clock mode of the GPTM. Used ITIx as the clock source. */ void TimerITIExtClkConfigure(unsigned long ulBase, unsigned long ulTriggerSource)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulTriggerSource == TIMER_TRSEL_ITI0)); TimerSTIConfigure(ulBase, ulTriggerSource); xHWREG(ulBase + TIMER_MDCFR) |= TIMER_MDCFR_SMSEL_STIED; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read the rest of the sentence (until linefeed). */
static int read_until_sentence_end(struct gnss_driver_t *self_p)
/* Read the rest of the sentence (until linefeed). */ static int read_until_sentence_end(struct gnss_driver_t *self_p)
{ int res; char byte; while (1) { res = read_byte(self_p, &byte); if (res != sizeof(byte)) { return (res); } if ((self_p->nmea.input.size + 1) == sizeof(self_p->nmea.input.buf)) { self_p->nmea.input.size = 0; return (-ENOMEM); } self_p->nmea.input.buf[self_p->nmea.input.size] = byte; self_p->nmea.input.size++; if (byte == '\n') { self_p->nmea.input.buf[self_p->nmea.input.size] = '\0'; break; } } return (0); }
eerimoq/simba
C++
Other
337
/* Returns the newly built parser, or NULL if an error arises. */
CRParser* cr_parser_new_from_buf(guchar *a_buf, gulong a_len, enum CREncoding a_enc, gboolean a_free_buf)
/* Returns the newly built parser, or NULL if an error arises. */ CRParser* cr_parser_new_from_buf(guchar *a_buf, gulong a_len, enum CREncoding a_enc, gboolean a_free_buf)
{ CRParser *result = NULL; CRInput *input = NULL; g_return_val_if_fail (a_buf && a_len, NULL); input = cr_input_new_from_buf (a_buf, a_len, a_enc, a_free_buf); g_return_val_if_fail (input, NULL); result = cr_parser_new_from_input (input); if (!result) { cr_input_destroy (input); input = NULL; return NULL; } return result; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* waits until rx ep is ready. Returns 1 when ep is ready and 0 on error. */
static u8 wait_until_rxep_ready(struct usb_device *dev, u8 ep)
/* waits until rx ep is ready. Returns 1 when ep is ready and 0 on error. */ static u8 wait_until_rxep_ready(struct usb_device *dev, u8 ep)
{ u16 csr; int timeout = CONFIG_MUSB_TIMEOUT; do { if (check_stall(ep, 0)) { dev->status = USB_ST_STALLED; return 0; } csr = readw(&musbr->rxcsr); if (csr & MUSB_RXCSR_H_ERROR) { dev->status = USB_ST_CRC_ERR; return 0; } if (--timeout) udelay(1); else { dev->status = USB_ST_CRC_ERR; return -1; } } while (!(csr & MUSB_RXCSR_RXPKTRDY)); return 1; }
EmcraftSystems/u-boot
C++
Other
181
/* Return: 0 if all went ok, else return appropriate error */
static int k3_arm64_init(struct udevice *dev)
/* Return: 0 if all went ok, else return appropriate error */ static int k3_arm64_init(struct udevice *dev)
{ dev_dbg(dev, "%s\n", __func__); dev_dbg(dev, "%s: rproc successfully initialized\n", __func__); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function return first node of LinkList queue. */
LIST_ENTRY* InternalInitLinkDxe(IN LIST_ENTRY *LinkList)
/* This function return first node of LinkList queue. */ LIST_ENTRY* InternalInitLinkDxe(IN LIST_ENTRY *LinkList)
{ if ((sizeof (UINTN) == sizeof (UINT32)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) { return (LIST_ENTRY *)(((LIST_ENTRY64 *)LinkList)->ForwardLink); } else { return LinkList->ForwardLink; } }
tianocore/edk2
C++
Other
4,240
/* Path all jumps in 'list' to close upvalues up to given 'level' (The assertion checks that jumps either were closing nothing or were closing higher levels, from inner blocks.) */
void luaK_patchclose(FuncState *fs, int list, int level)
/* Path all jumps in 'list' to close upvalues up to given 'level' (The assertion checks that jumps either were closing nothing or were closing higher levels, from inner blocks.) */ void luaK_patchclose(FuncState *fs, int list, int level)
{ lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && (GETARG_A(fs->f->code[list]) == 0 || GETARG_A(fs->f->code[list]) >= level)); SETARG_A(fs->f->code[list], level); } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Returns: (nullable): string with the relative path from @descendant to @parent, or NULL if @descendant doesn't have @parent as prefix. The returned string should be freed with g_free() when no longer needed. */
char* g_file_get_relative_path(GFile *parent, GFile *descendant)
/* Returns: (nullable): string with the relative path from @descendant to @parent, or NULL if @descendant doesn't have @parent as prefix. The returned string should be freed with g_free() when no longer needed. */ char* g_file_get_relative_path(GFile *parent, GFile *descendant)
{ GFileIface *iface; g_return_val_if_fail (G_IS_FILE (parent), NULL); g_return_val_if_fail (G_IS_FILE (descendant), NULL); if (G_TYPE_FROM_INSTANCE (parent) != G_TYPE_FROM_INSTANCE (descendant)) return NULL; iface = G_FILE_GET_IFACE (parent); return (* iface->get_relative_path) (parent, descendant); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART3; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function looks for a wear leveling entry with medium erase counter, but not greater or equivalent than the lowest erase counter plus WL_FREE_MAX_DIFF/2. */
static struct ubi_wl_entry* find_mean_wl_entry(struct ubi_device *ubi, struct rb_root *root)
/* This function looks for a wear leveling entry with medium erase counter, but not greater or equivalent than the lowest erase counter plus WL_FREE_MAX_DIFF/2. */ static struct ubi_wl_entry* find_mean_wl_entry(struct ubi_device *ubi, struct rb_root *root)
{ struct ubi_wl_entry *e, *first, *last; first = rb_entry(rb_first(root), struct ubi_wl_entry, u.rb); last = rb_entry(rb_last(root), struct ubi_wl_entry, u.rb); if (last->ec - first->ec < WL_FREE_MAX_DIFF) { e = rb_entry(root->rb_node, struct ubi_wl_entry, u.rb); e = may_reserve_for_fm(ubi, e, root); } else e = find_wl_entry(ubi, root, WL_FREE_MAX_DIFF/2); return e; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Alignments up to the page size are the same for physical and virtual addresses of the nocache area. */
static pte_t* srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
/* Alignments up to the page size are the same for physical and virtual addresses of the nocache area. */ static pte_t* srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
{ return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set up the duplex state on the PHY */
static void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, u16 duplex)
/* Set up the duplex state on the PHY */ static void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, u16 duplex)
{ u16 data; MiRead(etdev, PHY_CONTROL, &data); data &= ~0x100; if (duplex == TRUEPHY_DUPLEX_FULL) data |= 0x100; MiWrite(etdev, PHY_CONTROL, data); }
robutest/uclinux
C++
GPL-2.0
60
/* Turns off the supply to SPI_Flash Core. This functions turns off the supply to SPI_Flash core. Since SPI_Flash won't be used on every wakeup it is safe to disable the power to SPI_Flash core and enable it when required. */
void spi_flash_turn_off(void)
/* Turns off the supply to SPI_Flash Core. This functions turns off the supply to SPI_Flash core. Since SPI_Flash won't be used on every wakeup it is safe to disable the power to SPI_Flash core and enable it when required. */ void spi_flash_turn_off(void)
{ LPMCU_MISC_REGS0->PULL_ENABLE.reg &= ~LPMCU_MISC_REGS_PULL_ENABLE_LP_SIP__Msk; LPMCU_MISC_REGS0->SPIFLASH_VDDIO_CTRL.reg = 0x0; }
memfault/zero-to-main
C++
null
200
/* Returns TRUE if the given device is hidden */
gboolean prefs_is_capture_device_hidden(const char *name)
/* Returns TRUE if the given device is hidden */ gboolean prefs_is_capture_device_hidden(const char *name)
{ gchar *tok, *devices; size_t len; if (prefs.capture_devices_hide && name) { devices = g_strdup (prefs.capture_devices_hide); len = strlen (name); for (tok = strtok (devices, ","); tok; tok = strtok(NULL, ",")) { if (strlen (tok) == len && strcmp (name, tok) == 0) { g_free (devices); return TRUE; } } g_free (devices); } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI AsmMsrBitFieldAndThenOr32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData)
/* If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI AsmMsrBitFieldAndThenOr32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData)
{ ASSERT (EndBit < sizeof (AndData) * 8); ASSERT (StartBit <= EndBit); return (UINT32)AsmMsrBitFieldAndThenOr64 ( Index, StartBit, EndBit, AndData, OrData ); }
tianocore/edk2
C++
Other
4,240
/* If the accounting is turned on for a file in the subtree pointed to to by m, turn accounting off. Done when m is about to die. */
void acct_auto_close_mnt(struct vfsmount *m)
/* If the accounting is turned on for a file in the subtree pointed to to by m, turn accounting off. Done when m is about to die. */ void acct_auto_close_mnt(struct vfsmount *m)
{ struct bsd_acct_struct *acct; spin_lock(&acct_lock); restart: list_for_each_entry(acct, &acct_list, list) if (acct->file && acct->file->f_path.mnt == m) { acct_file_reopen(acct, NULL, NULL); goto restart; } spin_unlock(&acct_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handle Bulk Out Endpoint Events. The function handles Bulk Out endpoint events. It calls USBD_CDC_ACM_EP_BULKOUT_HandleData function to handle received data unless data was being accessed in which case function just acknowledges that there is data to be handled later. */
void USBD_CDC_ACM_EP_BULKOUT_Event(uint32_t event)
/* Handle Bulk Out Endpoint Events. The function handles Bulk Out endpoint events. It calls USBD_CDC_ACM_EP_BULKOUT_HandleData function to handle received data unless data was being accessed in which case function just acknowledges that there is data to be handled later. */ void USBD_CDC_ACM_EP_BULKOUT_Event(uint32_t event)
{ if (data_read_access) { data_received_pending_pckts++; return; } data_read_access = 1; data_receive_int_access = 1; USBD_CDC_ACM_EP_BULKOUT_HandleData(); data_receive_int_access = 0; data_read_access = 0; if (ptr_data_received != ptr_data_read) { USBD_CDC_ACM_DataReceived(ptr_data_received - ptr_data_read); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* This function returns the CA certificate for the chosen TLS connection. */
EFI_STATUS EFIAPI TlsGetCaCertificate(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
/* This function returns the CA certificate for the chosen TLS connection. */ EFI_STATUS EFIAPI TlsGetCaCertificate(IN VOID *Tls, OUT VOID *Data, IN OUT UINTN *DataSize)
{ CALL_CRYPTO_SERVICE (TlsGetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Do the full static ECDH key exchange. When this function is called, it has already been verified that the cipher suite uses ECDH (not ECDHE), and the client's public key (from its certificate) has type EC and is apt for key exchange. */
static void do_static_ecdh(br_ssl_server_context *ctx, int prf_id)
/* Do the full static ECDH key exchange. When this function is called, it has already been verified that the cipher suite uses ECDH (not ECDHE), and the client's public key (from its certificate) has type EC and is apt for key exchange. */ static void do_static_ecdh(br_ssl_server_context *ctx, int prf_id)
{ unsigned char cpoint[133]; size_t cpoint_len; const br_x509_class **xc; const br_x509_pkey *pk; xc = ctx->eng.x509ctx; pk = (*xc)->get_pkey(xc, NULL); cpoint_len = pk->key.ec.qlen; if (cpoint_len > sizeof cpoint) { cpoint_len = 2; } memcpy(cpoint, pk->key.ec.q, cpoint_len); do_ecdh(ctx, prf_id, cpoint, cpoint_len); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* It accepts all printable ASCII chars except for '#' which opens a comment. Please note that ' ' (space) while accepted is not a valid key name char. */
static bool is_nvram_char(char c)
/* It accepts all printable ASCII chars except for '#' which opens a comment. Please note that ' ' (space) while accepted is not a valid key name char. */ static bool is_nvram_char(char c)
{ if (c == '#') return false; return (c >= 0x20 && c < 0x7f); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Audio Output Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { Audio_Host_USBTask(&Speaker_Audio_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return value: 0 on success / other on failure */
static int cmm_sysfs_register(struct sys_device *sysdev)
/* Return value: 0 on success / other on failure */ static int cmm_sysfs_register(struct sys_device *sysdev)
{ int i, rc; if ((rc = sysdev_class_register(&cmm_sysdev_class))) return rc; sysdev->id = 0; sysdev->cls = &cmm_sysdev_class; if ((rc = sysdev_register(sysdev))) goto class_unregister; for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) { if ((rc = sysdev_create_file(sysdev, cmm_attrs[i]))) goto fail; } return 0; fail: while (--i >= 0) sysdev_remove_file(sysdev, cmm_attrs[i]); sysdev_unregister(sysdev); class_unregister: sysdev_class_unregister(&cmm_sysdev_class); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* returns SUCCESS if it successfully copied message into the buffer and received an ack to that message within delay * timeout period */
static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
/* returns SUCCESS if it successfully copied message into the buffer and received an ack to that message within delay * timeout period */ static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
{ struct e1000_mbx_info *mbx = &hw->mbx; s32 ret_val = -E1000_ERR_MBX; if (!mbx->ops.write || !mbx->timeout) goto out; ret_val = mbx->ops.write(hw, msg, size, mbx_id); if (!ret_val) ret_val = igb_poll_for_ack(hw, mbx_id); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Display a register value by reading a sysfs entry */
static ssize_t elantech_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
/* Display a register value by reading a sysfs entry */ static ssize_t elantech_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
{ struct elantech_data *etd = psmouse->private; struct elantech_attr_data *attr = data; unsigned char *reg = (unsigned char *) etd + attr->field_offset; int rc = 0; if (attr->reg) rc = elantech_read_reg(psmouse, attr->reg, reg); return sprintf(buf, "0x%02x\n", (attr->reg && rc) ? -1 : *reg); }
robutest/uclinux
C++
GPL-2.0
60