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
/* Cut the length of a buffer down by removing data from the tail. If the buffer is already under the length specified it is not modified. The skb must be linear. */
void skb_trim(struct sk_buff *skb, unsigned int len)
/* Cut the length of a buffer down by removing data from the tail. If the buffer is already under the length specified it is not modified. The skb must be linear. */ void skb_trim(struct sk_buff *skb, unsigned int len)
{ if (skb->len > len) __skb_trim(skb, len); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns a pointer to the label in the label list that matches the passed string, adding it if necessary. */
char* smk_import(const char *string, int len)
/* Returns a pointer to the label in the label list that matches the passed string, adding it if necessary. */ char* smk_import(const char *string, int len)
{ struct smack_known *skp; if (string[0] == '-') return NULL; skp = smk_import_entry(string, len); if (skp == NULL) return NULL; return skp->smk_known; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Pointer to image @size: Size of image in bytes */
static void unlock_descriptor(char *image, int size)
/* Pointer to image @size: Size of image in bytes */ static void unlock_descriptor(char *image, int size)
{ struct fdbar_t *fdb = find_fd(image, size); struct fmba_t *fmba; fmba = (struct fmba_t *)(image + (((fdb->flmap1) & 0xff) << 4)); fmba->flmstr1 = 0xffff0000; fmba->flmstr2 = 0xffff0000; fmba->flmstr3 = 0x08080118; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Sets the Status Block Address for the LPC peripheral. */
void LPCStatusBlockAddressSet(unsigned long ulBase, unsigned long ulAddress, tBoolean bEnabled)
/* Sets the Status Block Address for the LPC peripheral. */ void LPCStatusBlockAddressSet(unsigned long ulBase, unsigned long ulAddress, tBoolean bEnabled)
{ ASSERT(ulBase == LPC0_BASE); ASSERT((ulAddress & ~0xFFFFFFFE) == 0); HWREG(ulBase + LPC_O_STSADDR) = (ulAddress | (bEnabled ? 1 : 0)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handle hotplug events outside the interrupt handler proper. */
static void i915_hotplug_work_func(struct work_struct *work)
/* Handle hotplug events outside the interrupt handler proper. */ static void i915_hotplug_work_func(struct work_struct *work)
{ drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t, hotplug_work); struct drm_device *dev = dev_priv->dev; struct drm_mode_config *mode_config = &dev->mode_config; struct drm_connector *connector; if (mode_config->num_connector) { list_for_each_entry(connector, &mode_config->connector_list, head) { struct intel_output *intel_output = to_intel_output(connector); if (intel_output->hot_plug) (*intel_output->hot_plug) (intel_output); } } drm_sysfs_hotplug_event(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles USB OTG FS Wakeup IRQ Handler. */
void OTG_FS_WKUP_IRQHandler(void)
/* This function handles USB OTG FS Wakeup IRQ Handler. */ void OTG_FS_WKUP_IRQHandler(void)
{ if((&hpcd)->Init.low_power_enable) { SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); __HAL_RCC_HSE_CONFIG(RCC_HSE_ON); while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) {} __HAL_RCC_PLL_ENABLE(); while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) {} MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_SYSCLKSOURCE_PLLCLK); while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) {} __HAL_PCD_UNGATE_PHYCLOCK((&hpcd)); } __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Fills each GPIO_Config_T member with its default value. */
void GPIO_ConfigStructInit(GPIO_Config_T *gpioConfig)
/* Fills each GPIO_Config_T member with its default value. */ void GPIO_ConfigStructInit(GPIO_Config_T *gpioConfig)
{ gpioConfig->pin = GPIO_PIN_ALL; gpioConfig->mode = GPIO_MODE_IN; gpioConfig->outtype = GPIO_OUT_TYPE_PP; gpioConfig->speed = GPIO_SPEED_10MHz; gpioConfig->pupd = GPIO_PUPD_NO; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Fail or reinstate all paths that match the provided struct dm_dev. */
static int action_dev(struct multipath *m, struct dm_dev *dev, action_fn action)
/* Fail or reinstate all paths that match the provided struct dm_dev. */ static int action_dev(struct multipath *m, struct dm_dev *dev, action_fn action)
{ int r = 0; struct pgpath *pgpath; struct priority_group *pg; list_for_each_entry(pg, &m->priority_groups, list) { list_for_each_entry(pgpath, &pg->pgpaths, list) { if (pgpath->path.dev == dev) r = action(pgpath); } } return r; }
robutest/uclinux
C++
GPL-2.0
60
/* Evaluate an RTF control that needs special processing. */
int ecParseSpecialKeyword(RTF_Context *ctx, IPFN ipfn)
/* Evaluate an RTF control that needs special processing. */ int ecParseSpecialKeyword(RTF_Context *ctx, IPFN ipfn)
{ if (ctx->rds == rdsSkip && ipfn != ipfnBin) return ecOK; switch (ipfn) { case ipfnBin: ctx->ris = risBin; ctx->cbBin = ctx->lParam; break; case ipfnSkipDest: ctx->fSkipDestIfUnk = fTrue; break; case ipfnHex: ctx->ris = risHex; break; default: return ecBadTable; } return ecOK; }
DC-SWAT/DreamShell
C++
null
404
/* This function is used to build a response to a message processed by calling wps_process_msg(). The caller is responsible for freeing the buffer. */
struct wpabuf* wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code)
/* This function is used to build a response to a message processed by calling wps_process_msg(). The caller is responsible for freeing the buffer. */ struct wpabuf* wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code)
{ if (wps->registrar) return wps_registrar_get_msg(wps, op_code); else return wps_enrollee_get_msg(wps, op_code); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Configure the external oscillator clock failure detect. Configures the external oscillator clock failure detect with the given configuration settings. */
static void system_clock_source_xosc_set_failure_detect(struct system_clock_failure_detect *const config)
/* Configure the external oscillator clock failure detect. Configures the external oscillator clock failure detect with the given configuration settings. */ static void system_clock_source_xosc_set_failure_detect(struct system_clock_failure_detect *const config)
{ if (config->cfd_enable) { OSCCTRL->XOSCCTRL.reg |= OSCCTRL_XOSCCTRL_CFDEN; OSCCTRL->CFDPRESC.reg = config->cfd_divider; OSCCTRL->EVCTRL.reg = config->cfd_event_out; } else { OSCCTRL->XOSCCTRL.reg &= ~OSCCTRL_XOSCCTRL_CFDEN; } }
memfault/zero-to-main
C++
null
200
/* This routine is called to bring a SLI4 HBA offline when HBA hardware error other than Port Error 6 has been detected. */
static void lpfc_sli4_offline_eratt(struct lpfc_hba *phba)
/* This routine is called to bring a SLI4 HBA offline when HBA hardware error other than Port Error 6 has been detected. */ static void lpfc_sli4_offline_eratt(struct lpfc_hba *phba)
{ lpfc_offline_prep(phba); lpfc_offline(phba); lpfc_sli4_brdreset(phba); lpfc_hba_down_post(phba); lpfc_sli4_post_status_check(phba); lpfc_unblock_mgmt_io(phba); phba->link_state = LPFC_HBA_ERROR; }
robutest/uclinux
C++
GPL-2.0
60
/* Function: queue_remove_all_target(queue, target) Purpose : remove all SCSI commands from the queue for a specified target Params : queue - queue to remove command from target - target device id Returns : nothing */
void queue_remove_all_target(Queue_t *queue, int target)
/* Function: queue_remove_all_target(queue, target) Purpose : remove all SCSI commands from the queue for a specified target Params : queue - queue to remove command from target - target device id Returns : nothing */ void queue_remove_all_target(Queue_t *queue, int target)
{ unsigned long flags; struct list_head *l; spin_lock_irqsave(&queue->queue_lock, flags); list_for_each(l, &queue->head) { QE_t *q = list_entry(l, QE_t, list); if (q->SCpnt->device->id == target) __queue_remove(queue, l); } spin_unlock_irqrestore(&queue->queue_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Add a new mmtimer struct to the node's mmtimer list. This function assumes the struct */
static void mmtimer_add_list(struct mmtimer *n)
/* Add a new mmtimer struct to the node's mmtimer list. This function assumes the struct */ static void mmtimer_add_list(struct mmtimer *n)
{ int nodeid = n->timer->it.mmtimer.node; unsigned long expires = n->timer->it.mmtimer.expires; struct rb_node **link = &timers[nodeid].timer_head.rb_node; struct rb_node *parent = NULL; struct mmtimer *x; while (*link) { parent = *link; x = rb_entry(parent, struct mmtimer, list); if (expires < x->timer->it.mmtimer.expires) link = &(*link)->rb_left; else link = &(*link)->rb_right; } rb_link_node(&n->list, parent, link); rb_insert_color(&n->list, &timers[nodeid].timer_head); if (!timers[nodeid].next || expires < rb_entry(timers[nodeid].next, struct mmtimer, list)->timer->it.mmtimer.expires) timers[nodeid].next = &n->list; }
robutest/uclinux
C++
GPL-2.0
60
/* This function flushes all modified data associated with a file to a device. */
EFI_STATUS EFIAPI ShellFlushFile(IN SHELL_FILE_HANDLE FileHandle)
/* This function flushes all modified data associated with a file to a device. */ EFI_STATUS EFIAPI ShellFlushFile(IN SHELL_FILE_HANDLE FileHandle)
{ return (FileFunctionMap.FlushFile (FileHandle)); }
tianocore/edk2
C++
Other
4,240
/* This function clears the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */
EFI_STATUS SmmClearMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
/* This function clears the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */ EFI_STATUS SmmClearMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
{ EFI_STATUS Status; BOOLEAN IsModified; Status = ConvertMemoryPageAttributes (PageTableBase, PagingMode, BaseAddress, Length, Attributes, FALSE, &IsModified); if (!EFI_ERROR (Status)) { if (IsModified) { FlushTlbForAll (); } } return Status; }
tianocore/edk2
C++
Other
4,240
/* zfcp_fc_incoming_els - handle incoming ELS @fsf_req - request which contains incoming ELS */
void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req)
/* zfcp_fc_incoming_els - handle incoming ELS @fsf_req - request which contains incoming ELS */ void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req)
{ struct fsf_status_read_buffer *status_buffer = (struct fsf_status_read_buffer *) fsf_req->data; unsigned int els_type = status_buffer->payload.data[0]; zfcp_dbf_san_incoming_els(fsf_req); if (els_type == ELS_PLOGI) zfcp_fc_incoming_plogi(fsf_req); else if (els_type == ELS_LOGO) zfcp_fc_incoming_logo(fsf_req); else if (els_type == ELS_RSCN) zfcp_fc_incoming_rscn(fsf_req); }
robutest/uclinux
C++
GPL-2.0
60
/* Compute the hash for the vfat name corresponding to the dentry. Note: if the name is invalid, we leave the hash code unchanged so that the existing dentry can be used. The vfat fs routines will return ENOENT or EINVAL as appropriate. */
static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
/* Compute the hash for the vfat name corresponding to the dentry. Note: if the name is invalid, we leave the hash code unchanged so that the existing dentry can be used. The vfat fs routines will return ENOENT or EINVAL as appropriate. */ static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
{ qstr->hash = full_name_hash(qstr->name, vfat_striptail_len(qstr)); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Enable the Overrun Interrupt. The overrun interrupt is generated when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted. */
void adc_enable_overrun_interrupt(uint32_t adc)
/* ADC Enable the Overrun Interrupt. The overrun interrupt is generated when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted. */ void adc_enable_overrun_interrupt(uint32_t adc)
{ ADC_CR1(adc) |= ADC_CR1_OVRIE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Count the number of nodes in a branch having the PropName property. */
EFI_STATUS EFIAPI FdtCountPropNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *PropName, OUT UINT32 *NodeCount)
/* Count the number of nodes in a branch having the PropName property. */ EFI_STATUS EFIAPI FdtCountPropNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *PropName, OUT UINT32 *NodeCount)
{ return FdtCountCondNodeInBranch ( Fdt, FdtBranch, FdtNodeHasProperty, PropName, NodeCount ); }
tianocore/edk2
C++
Other
4,240
/* get the cycle number for group5 as soon as a charge-transfer sequence completes */
uint16_t tsi_group5_cycle_get(void)
/* get the cycle number for group5 as soon as a charge-transfer sequence completes */ uint16_t tsi_group5_cycle_get(void)
{ return (uint16_t)TSI_G5CYCN; }
liuxuming/trochili
C++
Apache License 2.0
132
/* checksum check on part of a romfs filesystem */
static __u32 romfs_checksum(const void *data, int size)
/* checksum check on part of a romfs filesystem */ static __u32 romfs_checksum(const void *data, int size)
{ const __be32 *ptr = data; __u32 sum; sum = 0; size >>= 2; while (size > 0) { sum += be32_to_cpu(*ptr++); size--; } return sum; }
robutest/uclinux
C++
GPL-2.0
60
/* Calls a find-included-services proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_find_inc_svcs_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_svc *service)
/* Calls a find-included-services proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */ static int ble_gattc_find_inc_svcs_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_svc *service)
{ int rc; BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task()); BLE_HS_DBG_ASSERT(service != NULL || status != 0); ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0 && status != BLE_HS_EDONE) { STATS_INC(ble_gattc_stats, find_inc_svcs_fail); } if (proc->find_inc_svcs.cb == NULL) { rc = 0; } else { rc = proc->find_inc_svcs.cb(proc->conn_handle, ble_gattc_error(status, att_handle), service, proc->find_inc_svcs.cb_arg); } return rc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Try to cancel an SA query. If the id and query don't match up or the query has already completed, nothing is done. Otherwise the query is canceled and will complete with a status of -EINTR. */
void ib_sa_cancel_query(int id, struct ib_sa_query *query)
/* Try to cancel an SA query. If the id and query don't match up or the query has already completed, nothing is done. Otherwise the query is canceled and will complete with a status of -EINTR. */ void ib_sa_cancel_query(int id, struct ib_sa_query *query)
{ unsigned long flags; struct ib_mad_agent *agent; struct ib_mad_send_buf *mad_buf; spin_lock_irqsave(&idr_lock, flags); if (idr_find(&query_idr, id) != query) { spin_unlock_irqrestore(&idr_lock, flags); return; } agent = query->port->agent; mad_buf = query->mad_buf; spin_unlock_irqrestore(&idr_lock, flags); ib_cancel_mad(agent, mad_buf); }
robutest/uclinux
C++
GPL-2.0
60
/* Given the source and destination available bus masks, select which will be routed to each port. We try to have source and destination on separate ports, but always respect the allowable settings. */
static u32 pl08x_select_bus(u8 src, u8 dst)
/* Given the source and destination available bus masks, select which will be routed to each port. We try to have source and destination on separate ports, but always respect the allowable settings. */ static u32 pl08x_select_bus(u8 src, u8 dst)
{ u32 cctl = 0; if (!(dst & PL08X_AHB1) || ((dst & PL08X_AHB2) && (src & PL08X_AHB1))) cctl |= PL080_CONTROL_DST_AHB2; if (!(src & PL08X_AHB1) || ((src & PL08X_AHB2) && !(dst & PL08X_AHB2))) cctl |= PL080_CONTROL_SRC_AHB2; return cctl; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Delete Specific from the list of maps for device Handle. */
EFI_STATUS PerformSingleMappingDelete(IN CONST CHAR16 *Specific, IN CONST EFI_HANDLE Handle)
/* Delete Specific from the list of maps for device Handle. */ EFI_STATUS PerformSingleMappingDelete(IN CONST CHAR16 *Specific, IN CONST EFI_HANDLE Handle)
{ EFI_DEVICE_PATH_PROTOCOL *DevPath; EFI_DEVICE_PATH_PROTOCOL *DevPathCopy; CONST CHAR16 *MapList; CHAR16 *CurrentName; DevPath = DevicePathFromHandle (Handle); DevPathCopy = DevPath; MapList = gEfiShellProtocol->GetMapFromDevicePath (&DevPathCopy); CurrentName = NULL; if (MapList == NULL) { return (EFI_NOT_FOUND); } if (!SearchList (MapList, Specific, &CurrentName, TRUE, FALSE, L";")) { return (EFI_NOT_FOUND); } return (gEfiShellProtocol->SetMap (NULL, CurrentName)); }
tianocore/edk2
C++
Other
4,240
/* Set interrupt vector priority level. Set the priority level of an external interrupt or exception. */
enum status_code system_interrupt_set_priority(const enum system_interrupt_vector vector, const enum system_interrupt_priority_level priority_level)
/* Set interrupt vector priority level. Set the priority level of an external interrupt or exception. */ enum status_code system_interrupt_set_priority(const enum system_interrupt_vector vector, const enum system_interrupt_priority_level priority_level)
{ enum status_code status = STATUS_OK; if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) { uint8_t register_num = vector / 4; uint8_t priority_pos = ((vector % 4) * 8) + (8 - __NVIC_PRIO_BITS); NVIC->IP[register_num] = (NVIC->IP[register_num] & ~(_SYSTEM_INTERRUPT_PRIORITY_MASK << priority_pos)) | (priority_level << priority_pos); } else if (vector == SYSTEM_INTERRUPT_SYSTICK) { SCB->SHP[1] = (priority_level << _SYSTEM_INTERRUPT_SYSTICK_PRI_POS); } else { Assert(false); status = STATUS_ERR_INVALID_ARG; } return status; }
memfault/zero-to-main
C++
null
200
/* Calculate size of SSI entry Size of SSI entry can be calculated as: sizeof(buddy name length field) = sizeof(guint16) = 2 */
static int calc_ssi_entry_size(tvbuff_t *tvb, int offset)
/* Calculate size of SSI entry Size of SSI entry can be calculated as: sizeof(buddy name length field) = sizeof(guint16) = 2 */ static int calc_ssi_entry_size(tvbuff_t *tvb, int offset)
{ gint ssi_entry_size = 2 + tvb_get_ntohs(tvb, offset) + 2 * 3; ssi_entry_size += tvb_get_ntohs(tvb, offset + ssi_entry_size) + 2; return ssi_entry_size; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function sets the indicated error response code into the response frame. Then the routine is called to calculate the error check value. */
static void mbs_exception_rsp(struct modbus_context *ctx, uint8_t excep_code)
/* This function sets the indicated error response code into the response frame. Then the routine is called to calculate the error check value. */ static void mbs_exception_rsp(struct modbus_context *ctx, uint8_t excep_code)
{ const uint8_t excep_bit = BIT(7); LOG_INF("FC 0x%02x Error 0x%02x", ctx->rx_adu.fc, excep_code); update_excep_ctr(ctx); ctx->tx_adu.fc |= excep_bit; ctx->tx_adu.data[0] = excep_code; ctx->tx_adu.length = 1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* UART EDMA send finished callback function. This function is called when UART EDMA send finished. It disables the UART TX EDMA request and sends kStatus_UART_TxIdle to UART callback. */
static void UART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* UART EDMA send finished callback function. This function is called when UART EDMA send finished. It disables the UART TX EDMA request and sends kStatus_UART_TxIdle to UART callback. */ static void UART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{ assert(param); uart_edma_private_handle_t *uartPrivateHandle = (uart_edma_private_handle_t *)param; handle = handle; tcds = tcds; if (transferDone) { UART_TransferAbortSendEDMA(uartPrivateHandle->base, uartPrivateHandle->handle); if (uartPrivateHandle->handle->callback) { uartPrivateHandle->handle->callback(uartPrivateHandle->base, uartPrivateHandle->handle, kStatus_UART_TxIdle, uartPrivateHandle->handle->userData); } } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Return value: number of bytes printed to buffer */
static ssize_t pmcraid_store_log_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
/* Return value: number of bytes printed to buffer */ static ssize_t pmcraid_store_log_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ struct Scsi_Host *shost; struct pmcraid_instance *pinstance; unsigned long val; if (strict_strtoul(buf, 10, &val)) return -EINVAL; if (val > 2) return -EINVAL; shost = class_to_shost(dev); pinstance = (struct pmcraid_instance *)shost->hostdata; pinstance->current_log_level = val; return strlen(buf); }
robutest/uclinux
C++
GPL-2.0
60
/* Remove serial ports registered against a platform device. */
static int __devexit serial_txx9_remove(struct platform_device *dev)
/* Remove serial ports registered against a platform device. */ static int __devexit serial_txx9_remove(struct platform_device *dev)
{ int i; for (i = 0; i < UART_NR; i++) { struct uart_txx9_port *up = &serial_txx9_ports[i]; if (up->port.dev == &dev->dev) serial_txx9_unregister_port(i); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq)
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq)
{ (void)src; (void)freq; CCM->CCGR6 |= CCM_CCGR6_CG0_MASK; USB1->USBCMD |= USBHS_USBCMD_RST_MASK; for (volatile uint32_t i = 0; i < 400000; i++) { __ASM("nop"); } PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) | (PMU_REG_3P0_OUTPUT_TRG(0x17) | PMU_REG_3P0_ENABLE_LINREG_MASK); return true; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Calculate EP size code Function Called during EndPoint configuration Return Value: EP size code for given EP size */
static int USBD_CalcSizeEP(uint32_t size)
/* Calculate EP size code Function Called during EndPoint configuration Return Value: EP size code for given EP size */ static int USBD_CalcSizeEP(uint32_t size)
{ return (0); } else if (size <= 16) { return (1); } else if (size <= 32) { return (2); } else if (size <= 64) { return (3); } else if (size <= 128) { return (4); } else if (size <= 256) { return (5); } else if (size <= 512) { return (6); } else if (size <= 1024) { return (7); } return (0); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* MTWEOF: Write 'count' file marks at the current position. */
int tape_std_mtweof(struct tape_device *device, int mt_count)
/* MTWEOF: Write 'count' file marks at the current position. */ int tape_std_mtweof(struct tape_device *device, int mt_count)
{ struct tape_request *request; struct ccw1 *ccw; request = tape_alloc_request(mt_count + 2, 0); if (IS_ERR(request)) return PTR_ERR(request); request->op = TO_WTM; ccw = tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1, device->modeset_byte); ccw = tape_ccw_repeat(ccw, WRITETAPEMARK, mt_count); ccw = tape_ccw_end(ccw, NOP, 0, NULL); return tape_do_io_free(device, request); }
robutest/uclinux
C++
GPL-2.0
60
/* Sends the current configuration number to the host. */
static void GetConfiguration(const USBDDriver *pDriver)
/* Sends the current configuration number to the host. */ static void GetConfiguration(const USBDDriver *pDriver)
{ USBD_Write(0, &(pDriver->cfgnum), 1, 0, 0); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Return number of modes added or 0 if we couldn't find any. */
int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay)
/* Return number of modes added or 0 if we couldn't find any. */ int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay)
{ int i, count, num_modes = 0; struct drm_display_mode *mode, *ptr; struct drm_device *dev = connector->dev; count = sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode); if (hdisplay < 0) hdisplay = 0; if (vdisplay < 0) vdisplay = 0; for (i = 0; i < count; i++) { ptr = &drm_dmt_modes[i]; if (hdisplay && vdisplay) { if (ptr->hdisplay > hdisplay || ptr->vdisplay > vdisplay) continue; } if (drm_mode_vrefresh(ptr) > 61) continue; mode = drm_mode_duplicate(dev, ptr); if (mode) { drm_mode_probed_add(connector, mode); num_modes++; } } return num_modes; }
robutest/uclinux
C++
GPL-2.0
60
/* USB_OTG_BSP_ConfigVBUS Configures the IO for the Vbus and OverCurrent. */
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
/* USB_OTG_BSP_ConfigVBUS Configures the IO for the Vbus and OverCurrent. */ void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
{ GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(HOST_POWERSW_PORT_RCC , ENABLE); GPIO_InitStructure.GPIO_Pin = HOST_POWERSW_VBUS; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(HOST_POWERSW_PORT,&GPIO_InitStructure); GPIO_SetBits(HOST_POWERSW_PORT, HOST_POWERSW_VBUS); USB_OTG_BSP_mDelay(200); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check for a valid incoming CAPI message. Return: 0 = Invalid message 1 = Valid message, no B-Channel-data 2 = Valid message, B-Channel-data */
int actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
/* Check for a valid incoming CAPI message. Return: 0 = Invalid message 1 = Valid message, no B-Channel-data 2 = Valid message, B-Channel-data */ int actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
{ int i; if (hdr->applicationID != 1) return 0; if (hdr->len < 9) return 0; for (i = 0; i < num_valid_imsg; i++) if ((hdr->cmd.cmd == valid_msg[i].cmd.cmd) && (hdr->cmd.subcmd == valid_msg[i].cmd.subcmd)) { return (i?1:2); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* returns: data address and size of the component, if idx is valid 0 in data and len, if idx is out of range */
void image_multi_getimg(const image_header_t *hdr, ulong idx, ulong *data, ulong *len)
/* returns: data address and size of the component, if idx is valid 0 in data and len, if idx is out of range */ void image_multi_getimg(const image_header_t *hdr, ulong idx, ulong *data, ulong *len)
{ int i; uint32_t *size; ulong offset, count, img_data; count = image_multi_count(hdr); size = (uint32_t *)image_get_data(hdr); img_data = image_get_data(hdr) + (count + 1) * sizeof(uint32_t); if (idx < count) { *len = uimage_to_cpu(size[idx]); offset = 0; for (i = 0; i < idx; i++) { offset += (uimage_to_cpu(size[i]) + 3) & ~3 ; } *data = img_data + offset; } else { *len = 0; *data = 0; } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Burgundy switch: 0/1, mono/stereo, byte reg, bit mask */
static int snd_pmac_burgundy_info_switch_b(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
/* Burgundy switch: 0/1, mono/stereo, byte reg, bit mask */ static int snd_pmac_burgundy_info_switch_b(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ int stereo = (kcontrol->private_value >> 24) & 1; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = stereo + 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Control the 42BYGH step motor roll direction and speed. */
void MSStepMotorRun(unsigned long ulDir, unsigned long ulSteps)
/* Control the 42BYGH step motor roll direction and speed. */ void MSStepMotorRun(unsigned long ulDir, unsigned long ulSteps)
{ unsigned long i, j; xASSERT((ulDir == MS_RUN_FORWARD) || (ulDir == MS_RUN_BACKWARD)); if(ulDir == MS_RUN_FORWARD) { for(j = 0; j < ulSteps; j++) { for(i = 0; i < 8; i++) { MS74HC595DataSend(g_ul42BYGHForward[g_ul42BYGHStepper][i]); MSDelay(g_ulStepsDelay); } } } else { for(j = 0; j < ulSteps; j++) { for(i = 0; i < 8; i++) { MS74HC595DataSend(g_ul42BYGHReversal[g_ul42BYGHStepper][i]); MSDelay(g_ulStepsDelay); } } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Add the NewNode to the tail of the variable list of arguments of the ParentNode. */
EFI_STATUS EFIAPI AmlVarListAddTail(IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
/* Add the NewNode to the tail of the variable list of arguments of the ParentNode. */ EFI_STATUS EFIAPI AmlVarListAddTail(IN AML_NODE_HEADER *ParentNode, IN AML_NODE_HEADER *NewNode)
{ EFI_STATUS Status; UINT32 NewSize; Status = AmlVarListAddTailInternal (ParentNode, NewNode); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } Status = AmlComputeSize (NewNode, &NewSize); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } Status = AmlPropagateInformation (ParentNode, TRUE, NewSize, 1); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* You must not call this function with disabled interrupts or from a hardware interrupt handler or from a bottom half handler. */
int smp_call_function(void(*func)(void *), void *info, int wait)
/* You must not call this function with disabled interrupts or from a hardware interrupt handler or from a bottom half handler. */ int smp_call_function(void(*func)(void *), void *info, int wait)
{ preempt_disable(); smp_call_function_many(cpu_online_mask, func, info, wait); preempt_enable(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for handling events from the BSP module. */
void bsp_event_handler(bsp_event_t event)
/* Function for handling events from the BSP module. */ void bsp_event_handler(bsp_event_t event)
{ uint32_t err_code; switch (event) { case BSP_EVENT_SLEEP: sleep_mode_enter(); break; case BSP_EVENT_DISCONNECT: err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); if (err_code != NRF_ERROR_INVALID_STATE) { APP_ERROR_CHECK(err_code); } break; case BSP_EVENT_WHITELIST_OFF: whitelist_disable(); break; default: break; } }
labapart/polymcu
C++
null
201
/* Returns: 0 on success, -ESTALE if the LVB is invalid */
static int statfs_slow_fill(struct gfs2_rgrpd *rgd, struct gfs2_statfs_change_host *sc)
/* Returns: 0 on success, -ESTALE if the LVB is invalid */ static int statfs_slow_fill(struct gfs2_rgrpd *rgd, struct gfs2_statfs_change_host *sc)
{ gfs2_rgrp_verify(rgd); sc->sc_total += rgd->rd_data; sc->sc_free += rgd->rd_free; sc->sc_dinodes += rgd->rd_dinodes; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function sets the global errno for the current thread. */
void rt_set_errno(rt_err_t error)
/* This function sets the global errno for the current thread. */ void rt_set_errno(rt_err_t error)
{ rt_thread_t tid = RT_NULL; if (rt_interrupt_get_nest() != 0) { __rt_errno = error; return; } tid = rt_thread_self(); if (tid == RT_NULL) { __rt_errno = error; return; } tid->error = error; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function resets the XADC Hard Macro in the device. */
void XAdcPs_Reset(XAdcPs *InstancePtr)
/* This function resets the XADC Hard Macro in the device. */ void XAdcPs_Reset(XAdcPs *InstancePtr)
{ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); XAdcPs_WriteReg((InstancePtr)->Config.BaseAddress, XADCPS_MCTL_OFFSET, 0x10); XAdcPs_WriteReg((InstancePtr)->Config.BaseAddress, XADCPS_MCTL_OFFSET, 0x00); }
ua1arn/hftrx
C++
null
69
/* Free any memory in @free but not in @dont. */
static void kvm_free_physmem_slot(struct kvm_memory_slot *free, struct kvm_memory_slot *dont)
/* Free any memory in @free but not in @dont. */ static void kvm_free_physmem_slot(struct kvm_memory_slot *free, struct kvm_memory_slot *dont)
{ int i; if (!dont || free->rmap != dont->rmap) vfree(free->rmap); if (!dont || free->dirty_bitmap != dont->dirty_bitmap) vfree(free->dirty_bitmap); for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { if (!dont || free->lpage_info[i] != dont->lpage_info[i]) { vfree(free->lpage_info[i]); free->lpage_info[i] = NULL; } } free->npages = 0; free->dirty_bitmap = NULL; free->rmap = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Checks whether the specified ADC flag is set or not. */
FlagStatus ADC_GetFlagStatus(ADC_Module *ADCx, uint8_t ADC_FLAG)
/* Checks whether the specified ADC flag is set or not. */ FlagStatus ADC_GetFlagStatus(ADC_Module *ADCx, uint8_t ADC_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IsAdcModule(ADCx)); assert_param(IsAdcGetFlag(ADC_FLAG)); if ((ADCx->STS & ADC_FLAG) != (uint8_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Invalidates the TLB Helper function which invalidates the entire TLB. This action is performed whenever the MMU is (re-)enabled or changes to the page tables are made at run-time, as the TLB might contain entries which are no longer valid once the changes are applied. */
static void invalidate_tlb_all(void)
/* Invalidates the TLB Helper function which invalidates the entire TLB. This action is performed whenever the MMU is (re-)enabled or changes to the page tables are made at run-time, as the TLB might contain entries which are no longer valid once the changes are applied. */ static void invalidate_tlb_all(void)
{ __set_TLBIALL(0); barrier_dsync_fence_full(); barrier_isync_fence_full(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param base PXP peripheral base address. param config Pointer to the configuration. */
void PXP_SetProcessSurfaceBufferConfig(PXP_Type *base, const pxp_ps_buffer_config_t *config)
/* param base PXP peripheral base address. param config Pointer to the configuration. */ void PXP_SetProcessSurfaceBufferConfig(PXP_Type *base, const pxp_ps_buffer_config_t *config)
{ assert(NULL != config); base->PS_CTRL = ((base->PS_CTRL & ~(PXP_PS_CTRL_FORMAT_MASK | PXP_PS_CTRL_WB_SWAP_MASK)) | PXP_PS_CTRL_FORMAT(config->pixelFormat) | PXP_PS_CTRL_WB_SWAP(config->swapByte)); base->PS_BUF = PXP_ADDR_CPU_2_IP(config->bufferAddr); base->PS_UBUF = PXP_ADDR_CPU_2_IP(config->bufferAddrU); base->PS_VBUF = PXP_ADDR_CPU_2_IP(config->bufferAddrV); base->PS_PITCH = config->pitchBytes; }
eclipse-threadx/getting-started
C++
Other
310
/* Write a register over the TPI interface (unlocked and locked versions). */
int __t1_tpi_write(adapter_t *adapter, u32 addr, u32 value)
/* Write a register over the TPI interface (unlocked and locked versions). */ int __t1_tpi_write(adapter_t *adapter, u32 addr, u32 value)
{ int tpi_busy; writel(addr, adapter->regs + A_TPI_ADDR); writel(value, adapter->regs + A_TPI_WR_DATA); writel(F_TPIWR, adapter->regs + A_TPI_CSR); tpi_busy = t1_wait_op_done(adapter, A_TPI_CSR, F_TPIRDY, 1, TPI_ATTEMPTS, 3); if (tpi_busy) CH_ALERT("%s: TPI write to 0x%x failed\n", adapter->name, addr); return tpi_busy; }
robutest/uclinux
C++
GPL-2.0
60
/* Get current value of Line Status register in UART peripheral. */
uint8_t UART_GetLineStatus(LPC_UART_TypeDef *UARTx)
/* Get current value of Line Status register in UART peripheral. */ uint8_t UART_GetLineStatus(LPC_UART_TypeDef *UARTx)
{ if (((LPC_UART1_TypeDef *)UARTx) == LPC_UART1) { return ((((LPC_UART1_TypeDef *)LPC_UART1)->LSR) & UART_LSR_BITMASK); } else { return ((UARTx->LSR) & UART_LSR_BITMASK); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup CS4 to enable the Board Control/Status registers. Otherwise the smcs won't work. */
int board_early_init_f(void)
/* Setup CS4 to enable the Board Control/Status registers. Otherwise the smcs won't work. */ int board_early_init_f(void)
{ volatile t_rpx_regs *regs = (t_rpx_regs*)CONFIG_SYS_REGS_BASE; volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; volatile memctl8260_t *memctl = &immap->im_memctl; memctl->memc_br4 = CONFIG_SYS_BR4_PRELIM; memctl->memc_or4 = CONFIG_SYS_OR4_PRELIM; regs->bcsr1 = 0x70; regs->bcsr2 = 0x20; return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Iterate over all IVHD entries in the ACPI table and find the highest device id which we need to handle. This is the first of three functions which parse the ACPI table. So we check the checksum here. */
static int __init find_last_devid_acpi(struct acpi_table_header *table)
/* Iterate over all IVHD entries in the ACPI table and find the highest device id which we need to handle. This is the first of three functions which parse the ACPI table. So we check the checksum here. */ static int __init find_last_devid_acpi(struct acpi_table_header *table)
{ int i; u8 checksum = 0, *p = (u8 *)table, *end = (u8 *)table; struct ivhd_header *h; for (i = 0; i < table->length; ++i) checksum += p[i]; if (checksum != 0) return -ENODEV; p += IVRS_HEADER_LENGTH; end += table->length; while (p < end) { h = (struct ivhd_header *)p; switch (h->type) { case ACPI_IVHD_TYPE: find_last_devid_from_ivhd(h); break; default: break; } p += h->length; } WARN_ON(p != end); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SYSCTRL IIR0 Bus&Function Clock Disable and Reset Assert. */
void LL_SYSCTRL_IIR0_ClkDisRstAssert(void)
/* SYSCTRL IIR0 Bus&Function Clock Disable and Reset Assert. */ void LL_SYSCTRL_IIR0_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_IIR0BusClk_Dis(SYSCTRL); __LL_SYSCTRL_IIR0FunClk_Dis(SYSCTRL); __LL_SYSCTRL_IIR0SoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the device code of the LCD controller DOESN'T WORK. */
uint16_t DMDIF_readDeviceCode(void)
/* Reads the device code of the LCD controller DOESN'T WORK. */ uint16_t DMDIF_readDeviceCode(void)
{ uint16_t readData; uint16_t deviceCode; setNextReg(DMD_SSD2119_DEVICE_CODE_READ); readData = DVK_readRegister( (uint16_t *) data_register ); deviceCode = ((readData >> 1) & 0x00ff) << 8; readData = DVK_readRegister( (uint16_t *) data_register ); deviceCode |= ((readData >> 1) & 0x00ff); return deviceCode; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* link_release_outqueue - purge link's outbound message queue @l_ptr: pointer to link */
static void link_release_outqueue(struct link *l_ptr)
/* link_release_outqueue - purge link's outbound message queue @l_ptr: pointer to link */ static void link_release_outqueue(struct link *l_ptr)
{ struct sk_buff *buf = l_ptr->first_out; struct sk_buff *next; while (buf) { next = buf->next; buf_discard(buf); buf = next; } l_ptr->first_out = NULL; l_ptr->out_queue_size = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API is used to compensate the pressure and/or temperature and/or humidity data according to the component selected by the user. */
int8_t bme280_compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data, struct bme280_data *comp_data, struct bme280_calib_data *calib_data)
/* This API is used to compensate the pressure and/or temperature and/or humidity data according to the component selected by the user. */ int8_t bme280_compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data, struct bme280_data *comp_data, struct bme280_calib_data *calib_data)
{ int8_t rslt = BME280_OK; if ((uncomp_data != NULL) && (comp_data != NULL) && (calib_data != NULL)) { comp_data->temperature = 0; comp_data->pressure = 0; comp_data->humidity = 0; if (sensor_comp & (BME280_PRESS | BME280_TEMP | BME280_HUM)) { comp_data->temperature = compensate_temperature(uncomp_data, calib_data); } if (sensor_comp & BME280_PRESS) { comp_data->pressure = compensate_pressure(uncomp_data, calib_data); } if (sensor_comp & BME280_HUM) { comp_data->humidity = compensate_humidity(uncomp_data, calib_data); } } else { rslt = BME280_E_NULL_PTR; } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* This service will invoke MP service to check CPU features' capabilities on BSP/APs. */
VOID EFIAPI CpuFeaturesDetect(VOID)
/* This service will invoke MP service to check CPU features' capabilities on BSP/APs. */ VOID EFIAPI CpuFeaturesDetect(VOID)
{ CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); CpuInitDataInitialize (); if (CpuFeaturesData->NumberOfCpus > 1) { StartupAllAPsWorker (CollectProcessorData, NULL); } CollectProcessorData (CpuFeaturesData); AnalysisProcessorFeatures (CpuFeaturesData->NumberOfCpus); }
tianocore/edk2
C++
Other
4,240
/* The data to be transmitted is buffered, the state variables are updated, then prvSendNextSegment() is called to start the transmission off. Once the first segment has been sent the remaining segments are transmitted in response to TXCOMP interrupts until the entire buffer has been sent. */
static void prvSendControlData(unsigned char *pucData, unsigned short usRequestedLength, unsigned long ulLengthLeftToSend, long lSendingDescriptor)
/* The data to be transmitted is buffered, the state variables are updated, then prvSendNextSegment() is called to start the transmission off. Once the first segment has been sent the remaining segments are transmitted in response to TXCOMP interrupts until the entire buffer has been sent. */ static void prvSendControlData(unsigned char *pucData, unsigned short usRequestedLength, unsigned long ulLengthLeftToSend, long lSendingDescriptor)
{ if( ( ( unsigned long ) usRequestedLength < ulLengthToSend ) ) { ulLengthToSend = ( unsigned short ) usRequestedLength; } else if( ( ulLengthToSend < ( unsigned long ) usRequestedLength ) && lSendingDescriptor ) { if( ( ulLengthToSend % usbFIFO_LENGTH ) == 0 ) { eDriverState = eSENDING_EVEN_DESCRIPTOR; } } memcpy( pxCharsForTx.ucTxBuffer, pucData, ulLengthToSend ); pxCharsForTx.ulTotalDataLength = ulLengthToSend; pxCharsForTx.ulNextCharIndex = ( unsigned long ) 0; prvSendNextSegment(); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Send STOP_TRANSMISSION command to card to stop ongoing data transferring. */
static status_t SDSPI_StopTransmission(sdspi_card_t *card)
/* Send STOP_TRANSMISSION command to card to stop ongoing data transferring. */ static status_t SDSPI_StopTransmission(sdspi_card_t *card)
{ sdspi_command_t command = {0}; sdspi_host_t *host; host = card->host; command.index = kSDMMC_StopTransmission; command.responseType = kSDSPI_ResponseTypeR1b; if (kStatus_Success != SDSPI_SendCommand(host, &command, FSL_SDSPI_TIMEOUT)) { return kStatus_SDSPI_SendCommandFailed; } return kStatus_Success; }
labapart/polymcu
C++
null
201
/* Writes a value to a control register in the LCD controller. */
EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data)
/* Writes a value to a control register in the LCD controller. */ EMSTATUS DMDIF_writeReg(uint8_t reg, uint16_t data)
{ setNextReg(reg); *data_register = data; return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* dispose of the data dangling from the corpse of a rxrpc key */
static void rxrpc_destroy_s(struct key *)
/* dispose of the data dangling from the corpse of a rxrpc key */ static void rxrpc_destroy_s(struct key *)
{ if (key->payload.data) { crypto_free_blkcipher(key->payload.data); key->payload.data = NULL; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Since to access LED register we need do switch the page, we do LED configuring in the miim_read-like function as follows */
static uint mii_88E1121_set_led(uint mii_reg, struct tsec_private *priv)
/* Since to access LED register we need do switch the page, we do LED configuring in the miim_read-like function as follows */ static uint mii_88E1121_set_led(uint mii_reg, struct tsec_private *priv)
{ uint pg; pg = read_phy_reg(priv, MIIM_88E1121_PHY_PAGE); write_phy_reg(priv, MIIM_88E1121_PHY_PAGE, MIIM_88E1121_PHY_LED_PAGE); write_phy_reg(priv, MIIM_88E1121_PHY_LED_CTRL, MIIM_88E1121_PHY_LED_DEF); write_phy_reg(priv, MIIM_88E1121_PHY_PAGE, pg); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Reset COMP peripheral registers to their default values. */
void COMP_Reset(void)
/* Reset COMP peripheral registers to their default values. */ void COMP_Reset(void)
{ COMP->CSTS = ((uint32_t)0x00000000); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This is needed to start limiting the number of frames to transfer so that software can check the data etc after hardware stops transfer. */
void XAxiVdma_StartFrmCntEnable(XAxiVdma *InstancePtr, u16 Direction)
/* This is needed to start limiting the number of frames to transfer so that software can check the data etc after hardware stops transfer. */ void XAxiVdma_StartFrmCntEnable(XAxiVdma *InstancePtr, u16 Direction)
{ XAxiVdma_Channel *Channel; Channel = XAxiVdma_GetChannel(InstancePtr, Direction); if (Channel->IsValid) { XAxiVdma_ChannelStartFrmCntEnable(Channel); } }
ua1arn/hftrx
C++
null
69
/* Return a PM message representing the resume event corresponding to given sleep state. */
static pm_message_t resume_event(pm_message_t sleep_state)
/* Return a PM message representing the resume event corresponding to given sleep state. */ static pm_message_t resume_event(pm_message_t sleep_state)
{ switch (sleep_state.event) { case PM_EVENT_SUSPEND: return PMSG_RESUME; case PM_EVENT_FREEZE: case PM_EVENT_QUIESCE: return PMSG_RECOVER; case PM_EVENT_HIBERNATE: return PMSG_RESTORE; } return PMSG_ON; }
robutest/uclinux
C++
GPL-2.0
60
/* 2*ADC 2*DAC no2 ringbuffer r/w on i2c bus */
static void stac9460_2_put(struct snd_ice1712 *ice, int reg, unsigned char val)
/* 2*ADC 2*DAC no2 ringbuffer r/w on i2c bus */ static void stac9460_2_put(struct snd_ice1712 *ice, int reg, unsigned char val)
{ snd_vt1724_write_i2c(ice, STAC9460_2_I2C_ADDR, reg, val); }
robutest/uclinux
C++
GPL-2.0
60
/* this used to be much more involved, and I'm keeping it just in case things get ugly again. it gets called by flush_commit_list, and cleans up any data stored about blocks freed during a transaction. */
static void cleanup_freed_for_journal_list(struct super_block *sb, struct reiserfs_journal_list *jl)
/* this used to be much more involved, and I'm keeping it just in case things get ugly again. it gets called by flush_commit_list, and cleans up any data stored about blocks freed during a transaction. */ static void cleanup_freed_for_journal_list(struct super_block *sb, struct reiserfs_journal_list *jl)
{ struct reiserfs_list_bitmap *jb = jl->j_list_bitmap; if (jb) { cleanup_bitmap_list(sb, jb); } jl->j_list_bitmap->journal_list = NULL; jl->j_list_bitmap = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Block Kernel (disable: thread switching, time tick, post ISR processing). */
static void KernelBlock(void)
/* Block Kernel (disable: thread switching, time tick, post ISR processing). */ static void KernelBlock(void)
{ ClrPendSV(); osRtxInfo.kernel.pendSV = 1U; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Dumps the current instance of #CRAttrSel to a file. */
void cr_attr_sel_dump(CRAttrSel *a_this, FILE *a_fp)
/* Dumps the current instance of #CRAttrSel to a file. */ void cr_attr_sel_dump(CRAttrSel *a_this, FILE *a_fp)
{ guchar *tmp_str = NULL; g_return_if_fail (a_this); tmp_str = cr_attr_sel_to_string (a_this); if (tmp_str) { fprintf (a_fp, "%s", tmp_str); g_free (tmp_str); tmp_str = NULL; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Create a thread and add it to Active Threads. */
osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
/* Create a thread and add it to Active Threads. */ osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
{ EvrRtxThreadError(NULL, (int32_t)osErrorISR); thread_id = NULL; } else { thread_id = __svcThreadNew(func, argument, attr); } return thread_id; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Check whether the args is already at the end. */
boolean Ifx_Shell_isEndOfLine(pchar args)
/* Check whether the args is already at the end. */ boolean Ifx_Shell_isEndOfLine(pchar args)
{ return ((args == NULL_PTR) || (*args == IFX_SHELL_NULL_CHAR)) ? TRUE : FALSE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* GRANTED: A server calls us to tell that a process' lock request was granted */
static __be32 nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_res *resp)
/* GRANTED: A server calls us to tell that a process' lock request was granted */ static __be32 nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_res *resp)
{ resp->cookie = argp->cookie; dprintk("lockd: GRANTED called\n"); resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock); dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); return rpc_success; }
robutest/uclinux
C++
GPL-2.0
60
/* ex: 0xab 0xcd - write oxcd into register 0xab */
static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, const char *buf, size_t count)
/* ex: 0xab 0xcd - write oxcd into register 0xab */ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, const char *buf, size_t count)
{ unsigned long reg, val; char *rest; ssize_t retval; reg = simple_strtoul(buf, &rest, 16); if (rest == buf || *rest != ' ' || reg > 0xff) return -EINVAL; if (strict_strtoul(rest + 1, 16, &val) || val > 0xff) return -EINVAL; if (fsp_reg_write_enable(psmouse, true)) return -EIO; retval = fsp_reg_write(psmouse, reg, val) < 0 ? -EIO : count; fsp_reg_write_enable(psmouse, false); return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Non bus mastering DMA interfaces for the Z8x30 devices. This is really pretty PC specific. The DMA mode means that most receive events are handled by the DMA hardware. We get a kick here only if a frame ended. */
static void z8530_dma_rx(struct z8530_channel *chan)
/* Non bus mastering DMA interfaces for the Z8x30 devices. This is really pretty PC specific. The DMA mode means that most receive events are handled by the DMA hardware. We get a kick here only if a frame ended. */ static void z8530_dma_rx(struct z8530_channel *chan)
{ if(chan->rxdma_on) { u8 status; read_zsreg(chan, R7); read_zsreg(chan, R6); status=read_zsreg(chan, R1); if(status&END_FR) { z8530_rx_done(chan); } write_zsctrl(chan, ERR_RES); write_zsctrl(chan, RES_H_IUS); } else { z8530_rx(chan); }}
robutest/uclinux
C++
GPL-2.0
60
/* Performs a clean & invalidation of the entire data cache at all levels */
void flush_dcache_all(void)
/* Performs a clean & invalidation of the entire data cache at all levels */ void flush_dcache_all(void)
{ v7_flush_dcache_all(); v7_outer_cache_flush_all(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Invalidate a level 1 instruction cache line. If the instruction specified by the address is cached by the instruction cache, the cacheline containing that instruction is invalidated. */
void Xil_L1ICacheInvalidateLine(u32 adr)
/* Invalidate a level 1 instruction cache line. If the instruction specified by the address is cached by the instruction cache, the cacheline containing that instruction is invalidated. */ void Xil_L1ICacheInvalidateLine(u32 adr)
{ mtcp(XREG_CP15_CACHE_SIZE_SEL, 1U); mtcp(XREG_CP15_INVAL_IC_LINE_MVA_POU, (adr & (~0x1FU))); dsb(); }
ua1arn/hftrx
C++
null
69
/* Sets the byte order of the data output stream to @order. */
void g_data_output_stream_set_byte_order(GDataOutputStream *stream, GDataStreamByteOrder order)
/* Sets the byte order of the data output stream to @order. */ void g_data_output_stream_set_byte_order(GDataOutputStream *stream, GDataStreamByteOrder order)
{ GDataOutputStreamPrivate *priv; g_return_if_fail (G_IS_DATA_OUTPUT_STREAM (stream)); priv = stream->priv; if (priv->byte_order != order) { priv->byte_order = order; g_object_notify (G_OBJECT (stream), "byte-order"); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* More details for reference count strategy can refer to the API description for */
EDKII_JSON_VALUE EFIAPI JsonValueInitAsciiString(IN CONST CHAR8 *String)
/* More details for reference count strategy can refer to the API description for */ EDKII_JSON_VALUE EFIAPI JsonValueInitAsciiString(IN CONST CHAR8 *String)
{ UINTN Index; if (String == NULL) { return NULL; } Index = 0; while (*(String + Index) != '\0') { if (((*(String + Index)) & 0x80) != 0x00) { return NULL; } Index++; } return (EDKII_JSON_VALUE)json_string (String); }
tianocore/edk2
C++
Other
4,240
/* Callback from the TPM to indicate that the response was received. */
static void tpm_tis_receive_cb(TPMState *s, uint8_t locty)
/* Callback from the TPM to indicate that the response was received. */ static void tpm_tis_receive_cb(TPMState *s, uint8_t locty)
{ TPMTISEmuState *tis = &s->s.tis; assert(s->locty_number == locty); qemu_bh_schedule(tis->bh); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Reset a Message Queue to initial empty state. */
osStatus_t osMessageQueueReset(osMessageQueueId_t msgq_id)
/* Reset a Message Queue to initial empty state. */ osStatus_t osMessageQueueReset(osMessageQueueId_t msgq_id)
{ struct cv2_msgq *msgq = (struct cv2_msgq *)msgq_id; if (msgq == NULL) { return osErrorParameter; } if (k_is_in_isr()) { return osErrorISR; } k_msgq_purge(&msgq->z_msgq); return osOK; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* A 'heuristic dissector' that attemtps to establish whether we have a genuine SMPP PDU here. Only works when: at least the fixed header is there it has a correct overall PDU length it is a 'well-known' operation has a 'well-known' or 'reserved' status */
static gboolean dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* A 'heuristic dissector' that attemtps to establish whether we have a genuine SMPP PDU here. Only works when: at least the fixed header is there it has a correct overall PDU length it is a 'well-known' operation has a 'well-known' or 'reserved' status */ static gboolean dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{ guint command_id; guint command_status; guint command_length; if (tvb_reported_length(tvb) < SMPP_MIN_LENGTH) return FALSE; command_length = tvb_get_ntohl(tvb, 0); if (command_length > 64 * 1024 || command_length < SMPP_MIN_LENGTH) return FALSE; command_id = tvb_get_ntohl(tvb, 4); if (try_val_to_str(command_id, vals_command_id) == NULL) return FALSE; command_status = tvb_get_ntohl(tvb, 8); if (try_val_to_str(command_status, vals_command_status) == NULL && try_rval_to_str(command_status, reserved_command_status) == NULL) return FALSE; dissect_smpp(tvb, pinfo, tree, data); return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Exchange the block from nonopt_start to nonopt_end with the block from nonopt_end to opt_end (keeping the same order of arguments in each block). */
static void permute_args(int, int, int, char *const *)
/* Exchange the block from nonopt_start to nonopt_end with the block from nonopt_end to opt_end (keeping the same order of arguments in each block). */ static void permute_args(int, int, int, char *const *)
{ int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; char *swap; nnonopts = panonopt_end - panonopt_start; nopts = opt_end - panonopt_end; ncycle = gcd(nnonopts, nopts); cyclelen = (opt_end - panonopt_start) / ncycle; for (i = 0; i < ncycle; i++) { cstart = panonopt_end+i; pos = cstart; for (j = 0; j < cyclelen; j++) { if (pos >= panonopt_end) pos -= nnonopts; else pos += nopts; swap = nargv[pos]; ((char **) nargv)[pos] = nargv[cstart]; ((char **)nargv)[cstart] = swap; } } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciSegmentBitFieldOr16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciSegmentBitFieldOr16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
{ UINTN Count; PCI_SEGMENT_INFO *SegmentInfo; SegmentInfo = GetPciSegmentInfo (&Count); return MmioBitFieldOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData); }
tianocore/edk2
C++
Other
4,240
/* one hundred, ten, one thousand megs How would you like to have your LAN accessed Can't you see that this code processed Phy power, phy power.. */
void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down)
/* one hundred, ten, one thousand megs How would you like to have your LAN accessed Can't you see that this code processed Phy power, phy power.. */ void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down)
{ u16 data; MiRead(etdev, PHY_CONTROL, &data); data &= ~0x0800; if (down) data |= 0x0800; MiWrite(etdev, PHY_CONTROL, data); }
robutest/uclinux
C++
GPL-2.0
60
/* Writes data in the nfctag at specific address. */
int32_t BSP_NFCTAG_WriteData(uint32_t Instance, const uint8_t *const pData, const uint16_t TarAddr, const uint16_t Size)
/* Writes data in the nfctag at specific address. */ int32_t BSP_NFCTAG_WriteData(uint32_t Instance, const uint8_t *const pData, const uint16_t TarAddr, const uint16_t Size)
{ UNUSED(Instance); if ( Nfctag_Drv->WriteData == NULL ) { return NFCTAG_ERROR; } return Nfctag_Drv->WriteData(&NfcTagObj, pData, TarAddr, Size ); }
eclipse-threadx/getting-started
C++
Other
310
/* param base eDMA peripheral base address. param channel eDMA channel number. param type A channel link type, which can be one of the following: arg kEDMA_LinkNone arg kEDMA_MinorLink arg kEDMA_MajorLink param linkedChannel The linked channel number. note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid. */
void EDMA_SetChannelLink(EDMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
/* param base eDMA peripheral base address. param channel eDMA channel number. param type A channel link type, which can be one of the following: arg kEDMA_LinkNone arg kEDMA_MinorLink arg kEDMA_MajorLink param linkedChannel The linked channel number. note Users should ensure that DONE flag is cleared before calling this interface, or the configuration is invalid. */ void EDMA_SetChannelLink(EDMA_Type *base, uint32_t channel, edma_channel_link_type_t type, uint32_t linkedChannel)
{ assert(channel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL(base)); assert(linkedChannel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL(base)); EDMA_TcdSetChannelLink(EDMA_TCD_BASE(base, channel), type, linkedChannel); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* eval_buffers Evaluate if two given buffers are equal */
static int eval_buffers(const struct buf_ctx *buf, const uint8_t *expected, uint16_t len)
/* eval_buffers Evaluate if two given buffers are equal */ static int eval_buffers(const struct buf_ctx *buf, const uint8_t *expected, uint16_t len)
{ if (buf->end - buf->cur != len) { goto exit_eval; } if (memcmp(expected, buf->cur, buf->end - buf->cur) != 0) { goto exit_eval; } return TC_PASS; exit_eval: TC_PRINT("FAIL\n"); TC_PRINT("Computed:"); print_array(buf->cur, buf->end - buf->cur); TC_PRINT("Expected:"); print_array(expected, len); return TC_FAIL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Put a single character to the serial port. */
void serial_putc(const char c)
/* Put a single character to the serial port. */ void serial_putc(const char c)
{ if (c == '\n') serial_putc('\r'); while (!(uart_regs->s1 & KINETIS_UART_S1_TDRE_MSK)); uart_regs->d = c; }
EmcraftSystems/u-boot
C++
Other
181
/* ZigBee Device Profile dissector for the IEEE Joining List Request. */
void dissect_zbee_zdp_req_mgmt_ieee_join_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the IEEE Joining List Request. */ void dissect_zbee_zdp_req_mgmt_ieee_join_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; zbee_parse_uint(tree, hf_zbee_zdp_ieee_join_start_index, tvb, &offset, 1, NULL); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Allocate device info data structure to contain device info. And insert the data structure to the tail of device list for tracing. */
EFI_STATUS EFIAPI CreateNewDeviceInfo(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT16 Port, IN UINT16 PortMultiplier, IN EFI_ATA_DEVICE_TYPE DeviceType, IN EFI_IDENTIFY_DATA *IdentifyData)
/* Allocate device info data structure to contain device info. And insert the data structure to the tail of device list for tracing. */ EFI_STATUS EFIAPI CreateNewDeviceInfo(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT16 Port, IN UINT16 PortMultiplier, IN EFI_ATA_DEVICE_TYPE DeviceType, IN EFI_IDENTIFY_DATA *IdentifyData)
{ EFI_ATA_DEVICE_INFO *DeviceInfo; DeviceInfo = AllocateZeroPool (sizeof (EFI_ATA_DEVICE_INFO)); if (DeviceInfo == NULL) { return EFI_OUT_OF_RESOURCES; } DeviceInfo->Signature = ATA_ATAPI_DEVICE_SIGNATURE; DeviceInfo->Port = Port; DeviceInfo->PortMultiplier = PortMultiplier; DeviceInfo->Type = DeviceType; if (IdentifyData != NULL) { DeviceInfo->IdentifyData = AllocateCopyPool (sizeof (EFI_IDENTIFY_DATA), IdentifyData); if (DeviceInfo->IdentifyData == NULL) { FreePool (DeviceInfo); return EFI_OUT_OF_RESOURCES; } } InsertTailList (&Instance->DeviceList, &DeviceInfo->Link); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns: 0 when the timer was not active 1 when the timer was active -1 when the timer is currently excuting the callback function and cannot be stopped */
int hrtimer_try_to_cancel(struct hrtimer *timer)
/* Returns: 0 when the timer was not active 1 when the timer was active -1 when the timer is currently excuting the callback function and cannot be stopped */ int hrtimer_try_to_cancel(struct hrtimer *timer)
{ struct hrtimer_clock_base *base; unsigned long flags; int ret = -1; base = lock_hrtimer_base(timer, &flags); if (!hrtimer_callback_running(timer)) ret = remove_hrtimer(timer, base); unlock_hrtimer_base(timer, &flags); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function frees all resources for volume @vol but does not remove it. Used only when the UBI device is detached. */
void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
/* This function frees all resources for volume @vol but does not remove it. Used only when the UBI device is detached. */ void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
{ dbg_gen("free volume %d", vol->vol_id); ubi->volumes[vol->vol_id] = NULL; cdev_del(&vol->cdev); device_unregister(&vol->dev); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Put interrupt request in netif queue for later processing. */
void os_hook_isr(void)
/* Put interrupt request in netif queue for later processing. */ void os_hook_isr(void)
{ signed portBASE_TYPE woken = pdFALSE; hif_msg_t msg; msg.id = MSG_RX; msg.pbuf = NULL; msg.payload_size = 0; msg.payload = NULL; if (xQueueSendFromISR(hif_queue, &msg, &woken) != pdTRUE) { osprintf("os_hook_isr: queue full error!\n"); } else { os_hif_task_msg_post_counter_rx++; portEND_SWITCHING_ISR(woken); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Function to compare 2 strings without regard to case of the characters. */
INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
/* Function to compare 2 strings without regard to case of the characters. */ INTN EFIAPI StringNoCaseCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
{ EFI_STATUS Status; if (mUnicodeCollation == NULL) { Status = gBS->LocateProtocol ( &gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID **)&mUnicodeCollation ); ASSERT_EFI_ERROR (Status); } return (mUnicodeCollation->StriColl ( mUnicodeCollation, *(CHAR16 **)Buffer1, *(CHAR16 **)Buffer2 )); }
tianocore/edk2
C++
Other
4,240
/* Set peer UART flow control state. Pause/resume transmit accordingly. Only for manual software flow control. */
Ecode_t UARTDRV_FlowControlSetPeerStatus(UARTDRV_Handle_t handle, UARTDRV_FlowControlState_t state)
/* Set peer UART flow control state. Pause/resume transmit accordingly. Only for manual software flow control. */ Ecode_t UARTDRV_FlowControlSetPeerStatus(UARTDRV_Handle_t handle, UARTDRV_FlowControlState_t state)
{ if ( (handle->fcType != uartdrvFlowControlSw) || (state == uartdrvFlowControlAuto) ) { return ECODE_EMDRV_UARTDRV_ILLEGAL_OPERATION; } if (handle->fcPeerState != state) { handle->fcPeerState = state; if (state == uartdrvFlowControlOn) { UARTDRV_ResumeTransmit(handle); } else if (state == uartdrvFlowControlOff) { UARTDRV_PauseTransmit(handle); } } return ECODE_EMDRV_UARTDRV_OK; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Reads and returns the 64-bit MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
/* Reads and returns the 64-bit MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
{ UINT32 LowData; UINT32 HighData; UINT64 Value; BOOLEAN Flag; Flag = FilterBeforeMsrRead (Index, &Value); if (Flag) { __asm__ __volatile__ ( "rdmsr" : "=a" (LowData), "=d" (HighData) : "c" (Index) ); Value = (((UINT64)HighData) << 32) | LowData; } FilterAfterMsrRead (Index, &Value); return Value; }
tianocore/edk2
C++
Other
4,240