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
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */
STATIC EFI_STATUS EFIAPI VirtioNetGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */ STATIC EFI_STATUS EFIAPI VirtioNetGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return (Language == NULL || DriverName == NULL) ? EFI_INVALID_PARAMETER : LookupUnicodeString2 ( Language, This->SupportedLanguages, mVirtioNetDriverNameTable, DriverName, (BOOLEAN)(This == &gVirtioNetComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Function for decoding a received SLIP escape byte. It will ensure correct decoding of the byte following the SLIP escape byte. */
static void handle_rx_byte_esc(uint8_t byte)
/* Function for decoding a received SLIP escape byte. It will ensure correct decoding of the byte following the SLIP escape byte. */ static void handle_rx_byte_esc(uint8_t byte)
{ switch (byte) { case APP_SLIP_END: handle_slip_end(); break; case APP_SLIP_ESC_END: mp_rx_buffer[m_rx_received_count++] = APP_SLIP_END; break; case APP_SLIP_ESC_ESC: mp_rx_buffer[m_rx_received_count++] = APP_SLIP_ESC; break; default: mp_rx_buffer[m_rx_received_count++] = byte; break; } handle_rx_byte = handle_rx_byte_default; }
labapart/polymcu
C++
null
201
/* Flush all transmitted packets from BDs This routine is called when disabling the USB port to flush all transmissions that are allready scheduled in the BDs */
void fhci_flush_all_transmissions(struct fhci_usb *usb)
/* Flush all transmitted packets from BDs This routine is called when disabling the USB port to flush all transmissions that are allready scheduled in the BDs */ void fhci_flush_all_transmissions(struct fhci_usb *usb)
{ u8 mode; struct td *td; mode = in_8(&usb->fhci->regs->usb_mod); clrbits8(&usb->fhci->regs->usb_mod, USB_MODE_EN); fhci_flush_bds(usb); while ((td = fhci_peek_td_from_frame(usb->actual_frame)) != NULL) { struct packet *pkt = td->pkt; pkt->status = USB_TD_TX_ER_TIMEOUT; fhci_transaction_confirm(usb, pkt); } usb->actual_frame->frame_status = FRAME_END_TRANSMISSION; out_be16(&usb->fhci->regs->usb_event, 0xffff); out_8(&usb->fhci->regs->usb_mod, mode | USB_MODE_EN); }
robutest/uclinux
C++
GPL-2.0
60
/* See _g_freedesktop_dbus_call_get_id_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_get_id(_GFreedesktopDBus *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* See _g_freedesktop_dbus_call_get_id_sync() for the synchronous, blocking version of this method. */ void _g_freedesktop_dbus_call_get_id(_GFreedesktopDBus *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ g_dbus_proxy_call (G_DBUS_PROXY (proxy), "GetId", g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* get the number of remaining data to be transferred by the DMA */
uint32_t dma_transfer_number_get(uint32_t dma_periph, dma_channel_enum channelx)
/* get the number of remaining data to be transferred by the DMA */ uint32_t dma_transfer_number_get(uint32_t dma_periph, dma_channel_enum channelx)
{ if(ERROR == dma_periph_and_channel_check(dma_periph, channelx)){ DMA_WRONG_HANDLE } return (uint32_t)DMA_CHCNT(dma_periph, channelx); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for performing the Local DB apply procedure if it is pending on any connections. */
static void apply_pending_flags_check(void)
/* Function for performing the Local DB apply procedure if it is pending on any connections. */ static void apply_pending_flags_check(void)
{ sdk_mapped_flags_t apply_pending_flags; apply_pending_flags = ble_conn_state_user_flag_collection(m_gcm.flag_id_local_db_apply_pending); if (sdk_mapped_flags_any_set(apply_pending_flags)) { sdk_mapped_flags_key_list_t conn_handle_list; conn_handle_list = ble_conn_state_conn_handles(); for (uint32_t i = 0; i < conn_handle_list.len; i++) { if (ble_conn_state_user_flag_get(conn_handle_list.flag_keys[i], m_gcm.flag_id_local_db_apply_pending)) { local_db_apply_in_evt(conn_handle_list.flag_keys[i]); } } } }
labapart/polymcu
C++
null
201
/* Enable the DAC module. Enables the DAC interface and the selected output. If any internal reference is selected it will be enabled. */
void dac_enable(struct dac_module *const module_inst)
/* Enable the DAC module. Enables the DAC interface and the selected output. If any internal reference is selected it will be enabled. */ void dac_enable(struct dac_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); Dac *const dac_module = module_inst->hw; while (dac_is_syncing(module_inst)) { } dac_module->CTRLA.reg |= DAC_CTRLA_ENABLE; if (module_inst->reference == DAC_REFERENCE_INTREF) { system_voltage_reference_enable(SYSTEM_VOLTAGE_REFERENCE_OUTPUT); } if(dac_module->DACCTRL[DAC_CHANNEL_0].reg & DAC_DACCTRL_ENABLE) { while(! (dac_module->STATUS.reg & DAC_STATUS_READY(DAC_CHANNEL_0 + 1))) { }; } else if(dac_module->DACCTRL[DAC_CHANNEL_1].reg & DAC_DACCTRL_ENABLE) { while(! (dac_module->STATUS.reg & DAC_STATUS_READY(DAC_CHANNEL_1 + 1))) { }; } }
memfault/zero-to-main
C++
null
200
/* If this service is called from an AP, then EFI_DEVICE_ERROR is returned. If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors is returned in NumberOfProcessors, the number of currently enabled processor is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned. */
STATIC EFI_STATUS EFIAPI GetNumberOfProcessors(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
/* If this service is called from an AP, then EFI_DEVICE_ERROR is returned. If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors is returned in NumberOfProcessors, the number of currently enabled processor is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned. */ STATIC EFI_STATUS EFIAPI GetNumberOfProcessors(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
{ if ((NumberOfProcessors == NULL) || (NumberOfEnabledProcessors == NULL)) { return EFI_INVALID_PARAMETER; } if (!IsCurrentProcessorBSP ()) { return EFI_DEVICE_ERROR; } *NumberOfProcessors = mCpuMpData.NumberOfProcessors; *NumberOfEnabledProcessors = mCpuMpData.NumberOfEnabledProcessors; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Destroy child windows, freeing allocated memory. This function is a helper function for the */
static void win_destroy_children(struct win_window *win)
/* Destroy child windows, freeing allocated memory. This function is a helper function for the */ static void win_destroy_children(struct win_window *win)
{ struct win_window *next_sibling; struct win_window *child = win->top_child; if (child != NULL) { do { win_destroy_children(child); win_handle_event(child, WIN_EVENT_DESTROY, NULL); next_sibling = child->next_sibling; membag_free(child); child = next_sibling; } while (child != win->top_child); win->top_child = NULL; } }
memfault/zero-to-main
C++
null
200
/* stmmac_ioctl - Entry point for the Ioctl @dev: Device pointer. @rq: An IOCTL specefic structure, that can contain a pointer to a proprietary structure used to pass information to the driver. @cmd: IOCTL command Description: Currently there are no special functionality supported in IOCTL, just the phy_mii_ioctl(...) can be invoked. */
static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
/* stmmac_ioctl - Entry point for the Ioctl @dev: Device pointer. @rq: An IOCTL specefic structure, that can contain a pointer to a proprietary structure used to pass information to the driver. @cmd: IOCTL command Description: Currently there are no special functionality supported in IOCTL, just the phy_mii_ioctl(...) can be invoked. */ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ struct stmmac_priv *priv = netdev_priv(dev); int ret = -EOPNOTSUPP; if (!netif_running(dev)) return -EINVAL; switch (cmd) { case SIOCGMIIPHY: case SIOCGMIIREG: case SIOCSMIIREG: if (!priv->phydev) return -EINVAL; spin_lock(&priv->lock); ret = phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); spin_unlock(&priv->lock); default: break; } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Writing a 0 deauthorizes the device, writing a 1 authorizes it. */
static ssize_t usb_dev_authorized_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
/* Writing a 0 deauthorizes the device, writing a 1 authorizes it. */ static ssize_t usb_dev_authorized_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{ ssize_t result; struct usb_device *usb_dev = to_usb_device(dev); unsigned val; result = sscanf(buf, "%u\n", &val); if (result != 1) result = -EINVAL; else if (val == 0) result = usb_deauthorize_device(usb_dev); else result = usb_authorize_device(usb_dev); return result < 0? result : size; }
robutest/uclinux
C++
GPL-2.0
60
/* This turns the IRDA power on or off on the Compaq H3100 */
static int h3100_irda_set_power(struct device *dev, unsigned int state)
/* This turns the IRDA power on or off on the Compaq H3100 */ static int h3100_irda_set_power(struct device *dev, unsigned int state)
{ gpio_set_value(H3100_GPIO_IR_ON, state); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* fc_bsg_jobdone - completion routine for bsg requests that the LLD has completed @job: fc_bsg_job that is complete */
static void fc_bsg_jobdone(struct fc_bsg_job *job)
/* fc_bsg_jobdone - completion routine for bsg requests that the LLD has completed @job: fc_bsg_job that is complete */ static void fc_bsg_jobdone(struct fc_bsg_job *job)
{ struct request *req = job->req; struct request *rsp = req->next_rq; int err; err = job->req->errors = job->reply->result; if (err < 0) job->req->sense_len = sizeof(uint32_t); else job->req->sense_len = job->reply_len; req->resid_len = 0; if (rsp) { WARN_ON(job->reply->reply_payload_rcv_len > rsp->resid_len); rsp->resid_len -= min(job->reply->reply_payload_rcv_len, rsp->resid_len); } blk_complete_request(req); }
robutest/uclinux
C++
GPL-2.0
60
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI S3MmioAndThenOr8(IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData)
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ UINT8 EFIAPI S3MmioAndThenOr8(IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData)
{ return InternalSaveMmioWrite8ValueToBootScript (Address, MmioAndThenOr8 (Address, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Determine Refresh Rate. Ignore self refresh bit on DDR I. Table from SPD Spec, Byte 12, converted to picoseconds and filled in with "default" normal values. */
static unsigned int determine_refresh_rate_ps(const unsigned int spd_refresh)
/* Determine Refresh Rate. Ignore self refresh bit on DDR I. Table from SPD Spec, Byte 12, converted to picoseconds and filled in with "default" normal values. */ static unsigned int determine_refresh_rate_ps(const unsigned int spd_refresh)
{ unsigned int refresh_time_ps[8] = { 15625000, 3900000, 7800000, 31300000, 62500000, 125000000, 15625000, 15625000, }; return refresh_time_ps[spd_refresh & 0x7]; }
EmcraftSystems/u-boot
C++
Other
181
/* This function returns the current PWM clock configuration. */
uint32_t SysCtlPWMClockGet(void)
/* This function returns the current PWM clock configuration. */ uint32_t SysCtlPWMClockGet(void)
{ ASSERT(HWREG(SYSCTL_DC1) & (SYSCTL_DC1_PWM0 | SYSCTL_DC1_PWM1)); if(!(HWREG(SYSCTL_RCC) & SYSCTL_RCC_USEPWMDIV)) { return(SYSCTL_PWMDIV_1); } else { return(HWREG(SYSCTL_RCC) & (SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M)); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function does some common audit and permissions check for some IPC_XXX cmd and is called from semctl_down, shmctl_down and msgctl_down. It must be called without any lock held and */
struct kern_ipc_perm* ipcctl_pre_down(struct ipc_ids *ids, int id, int cmd, struct ipc64_perm *perm, int extra_perm)
/* This function does some common audit and permissions check for some IPC_XXX cmd and is called from semctl_down, shmctl_down and msgctl_down. It must be called without any lock held and */ struct kern_ipc_perm* ipcctl_pre_down(struct ipc_ids *ids, int id, int cmd, struct ipc64_perm *perm, int extra_perm)
{ struct kern_ipc_perm *ipcp; uid_t euid; int err; down_write(&ids->rw_mutex); ipcp = ipc_lock_check(ids, id); if (IS_ERR(ipcp)) { err = PTR_ERR(ipcp); goto out_up; } audit_ipc_obj(ipcp); if (cmd == IPC_SET) audit_ipc_set_perm(extra_perm, perm->uid, perm->gid, perm->mode); euid = current_euid(); if (euid == ipcp->cuid || euid == ipcp->uid || capable(CAP_SYS_ADMIN)) return ipcp; err = -EPERM; ipc_unlock(ipcp); out_up: up_write(&ids->rw_mutex); return ERR_PTR(err); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* control the bus. This function control the host bus. */
static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType)
/* control the bus. This function control the host bus. */ static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType)
{ usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if (hostHandle == NULL) { return kStatus_USB_InvalidHandle; } status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &controlType); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns hash value of fwmark for virtual service lookup */
static __inline__ unsigned ip_vs_svc_fwm_hashkey(__u32 fwmark)
/* Returns hash value of fwmark for virtual service lookup */ static __inline__ unsigned ip_vs_svc_fwm_hashkey(__u32 fwmark)
{ return fwmark & IP_VS_SVC_TAB_MASK; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USBH_FindInterface Find the interface index for a specific class. */
uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
/* USBH_FindInterface Find the interface index for a specific class. */ uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
{ USBH_InterfaceDescTypeDef *pif ; USBH_CfgDescTypeDef *pcfg ; int8_t if_ix = 0; pif = (USBH_InterfaceDescTypeDef *)0; pcfg = &phost->device.CfgDesc; while (if_ix < USBH_MAX_NUM_INTERFACES) { pif = &pcfg->Itf_Desc[if_ix]; if(((pif->bInterfaceClass == Class) || (Class == 0xFF))&& ((pif->bInterfaceSubClass == SubClass) || (SubClass == 0xFF))&& ((pif->bInterfaceProtocol == Protocol) || (Protocol == 0xFF))) { return if_ix; } if_ix++; } return 0xFF; }
labapart/polymcu
C++
null
201
/* ADC Enable Analog Watchdog for a Selected Channel. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */
void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t channel)
/* ADC Enable Analog Watchdog for a Selected Channel. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */ void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t channel)
{ uint32_t reg32; reg32 = (ADC_CR1(adc) & ~ADC_CR1_AWDCH_MASK); if (channel <= ADC_CR1_AWDCH_MAX) { reg32 |= channel; } ADC_CR1(adc) = reg32; ADC_CR1(adc) |= ADC_CR1_AWDSGL; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* onenand_block_isbad - Check whether the block at the given offset is bad */
static int onenand_block_isbad(struct mtd_info *mtd, loff_t ofs)
/* onenand_block_isbad - Check whether the block at the given offset is bad */ static int onenand_block_isbad(struct mtd_info *mtd, loff_t ofs)
{ int ret; if (ofs > mtd->size) return -EINVAL; onenand_get_device(mtd, FL_READING); ret = onenand_block_isbad_nolock(mtd, ofs, 0); onenand_release_device(mtd); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). 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(). */
UINT32 EFIAPI PciBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). 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(). */ UINT32 EFIAPI PciBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
{ return PciWrite32 ( Address, BitFieldAnd32 (PciRead32 (Address), StartBit, EndBit, AndData) ); }
tianocore/edk2
C++
Other
4,240
/* This function allows a caller to extract the current configuration for one or more named elements from the target driver. */
EFI_STATUS EFIAPI DriverHealthManagerFakeExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
/* This function allows a caller to extract the current configuration for one or more named elements from the target driver. */ EFI_STATUS EFIAPI DriverHealthManagerFakeExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
{ if ((Progress == NULL) || (Results == NULL)) { return EFI_INVALID_PARAMETER; } *Progress = Request; return EFI_NOT_FOUND; }
tianocore/edk2
C++
Other
4,240
/* This function divides the 64-bit unsigned value Dividend by the 32-bit unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder is not NULL, then the 32-bit unsigned remainder is returned in Remainder. This function returns the 64-bit unsigned quotient. */
UINT64 EFIAPI InternalMathDivRemU64x32(IN UINT64 Dividend, IN UINT32 Divisor, OUT UINT32 *Remainder)
/* This function divides the 64-bit unsigned value Dividend by the 32-bit unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder is not NULL, then the 32-bit unsigned remainder is returned in Remainder. This function returns the 64-bit unsigned quotient. */ UINT64 EFIAPI InternalMathDivRemU64x32(IN UINT64 Dividend, IN UINT32 Divisor, OUT UINT32 *Remainder)
{ _asm { mov ecx, Divisor mov eax, dword ptr [Dividend + 4] xor edx, edx div ecx push eax mov eax, dword ptr [Dividend + 0] div ecx mov ecx, Remainder jecxz RemainderNull mov [ecx], edx RemainderNull: pop edx } }
tianocore/edk2
C++
Other
4,240
/* Set an entry to be a valid pte. */
STATIC UINTN SetValidPte(IN UINTN Entry)
/* Set an entry to be a valid pte. */ STATIC UINTN SetValidPte(IN UINTN Entry)
{ return Entry | RISCV_PG_G | RISCV_PG_V; }
tianocore/edk2
C++
Other
4,240
/* param base ITRC peripheral base address param word 32bit word represent corresponding event/action in STATUS register to be cleared (see ITRC_STATUS_INx/OUTx_STATUS) return kStatus_Success if success, kStatus_InvalidArgument otherwise */
status_t ITRC_ClearStatus(ITRC_Type *base, uint32_t word)
/* param base ITRC peripheral base address param word 32bit word represent corresponding event/action in STATUS register to be cleared (see ITRC_STATUS_INx/OUTx_STATUS) return kStatus_Success if success, kStatus_InvalidArgument otherwise */ status_t ITRC_ClearStatus(ITRC_Type *base, uint32_t word)
{ if ((word & ~(IN_0_15_EVENTS_MASK | OUT_ACTIONS_MASK)) != 0u) { return kStatus_InvalidArgument; } base->STATUS |= word; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write all geometry values of all windows to the recent file. Will call write_recent_geom() for every existing window type. */
static void window_geom_recent_write_all(FILE *rf)
/* Write all geometry values of all windows to the recent file. Will call write_recent_geom() for every existing window type. */ static void window_geom_recent_write_all(FILE *rf)
{ if (!window_geom_hash) { window_geom_hash = g_hash_table_new(g_str_hash, g_str_equal); } g_hash_table_foreach(window_geom_hash, write_recent_geom, rf); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return: The number of bytes successfully read or a negative error code on failure. */
ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size)
/* Return: The number of bytes successfully read or a negative error code on failure. */ ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size)
{ struct mipi_dsi_msg msg = { .channel = dsi->channel, .tx_len = num_params, .tx_buf = params, .rx_len = size, .rx_buf = data }; switch (num_params) { case 0: msg.type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM; break; case 1: msg.type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM; break; case 2: msg.type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM; break; default: return -EINVAL; } return mipi_dsi_device_transfer(dsi, &msg); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This TAP enables extraction of most important diameter fields in text format. */
void register_tap_listener_diameteravp(void)
/* This TAP enables extraction of most important diameter fields in text format. */ void register_tap_listener_diameteravp(void)
{ register_stat_tap_ui(&diameteravp_ui, NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* xdr_init_decode - Initialize an xdr_stream for decoding data. @xdr: pointer to xdr_stream struct @buf: pointer to XDR buffer from which to decode data */
void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
/* xdr_init_decode - Initialize an xdr_stream for decoding data. @xdr: pointer to xdr_stream struct @buf: pointer to XDR buffer from which to decode data */ void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
{ struct kvec *iov = buf->head; unsigned int len = iov->iov_len; if (len > buf->len) len = buf->len; xdr->buf = buf; xdr->iov = iov; xdr->p = p; xdr->end = (__be32 *)((char *)iov->iov_base + len); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: Zero on success, else a negative error code. */
static void * vxfs_immed_follow_link(struct dentry *, struct nameidata *)
/* Returns: Zero on success, else a negative error code. */ static void * vxfs_immed_follow_link(struct dentry *, struct nameidata *)
{ struct vxfs_inode_info *vip = VXFS_INO(dp->d_inode); nd_set_link(np, vip->vii_immed.vi_immed); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the touch screen X and Y positions values. */
int32_t SX8651_GetState(SX8651_Object_t *pObj, SX8651_State_t *State)
/* Get the touch screen X and Y positions values. */ int32_t SX8651_GetState(SX8651_Object_t *pObj, SX8651_State_t *State)
{ int32_t ret = SX8651_OK; uint8_t data[4]; State->TouchDetected = 0; State->TouchX = 0; State->TouchY = 0; if (SX8651_DetectTouch(pObj) == 1) { State->TouchDetected = 1; if (sx8651_read_data(&pObj->Ctx, data, (uint16_t)sizeof(data)) != SX8651_OK) { ret = SX8651_ERROR; } else { State->TouchX = ((data[0] & 0xF) << 8) | data[1]; State->TouchY = ((data[2] & 0xF) << 8) | data[3]; } } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector13_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector13_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (13 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* send_msg - send a TIPC message out over an Ethernet interface */
static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, struct tipc_media_addr *dest)
/* send_msg - send a TIPC message out over an Ethernet interface */ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, struct tipc_media_addr *dest)
{ struct sk_buff *clone; struct net_device *dev; clone = skb_clone(buf, GFP_ATOMIC); if (clone) { skb_reset_network_header(clone); dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; clone->dev = dev; dev_hard_header(clone, dev, ETH_P_TIPC, &dest->dev_addr.eth_addr, dev->dev_addr, clone->len); dev_queue_xmit(clone); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialises an ADC interface, Prepares an ADC hardware interface for sampling */
int32_t hal_adc_init(adc_dev_t *adc)
/* Initialises an ADC interface, Prepares an ADC hardware interface for sampling */ int32_t hal_adc_init(adc_dev_t *adc)
{ adc->priv = &hal_adc[adc->port]; analogin_init(adc->priv, adc_pin2chan[adc->port][0]); return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param base WUU peripheral base address. param pinIndex A pin index, which starts from 0. */
void WUU_ClearExternalWakeupPinFlag(WUU_Type *base, uint32_t pinIndex)
/* param base WUU peripheral base address. param pinIndex A pin index, which starts from 0. */ void WUU_ClearExternalWakeupPinFlag(WUU_Type *base, uint32_t pinIndex)
{ base->PF = (1UL << pinIndex); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the callback for checking if the Present Contract is still valid. */
void usbc_set_policy_cb_present_contract_is_valid(const struct device *dev, const policy_cb_present_contract_is_valid_t cb)
/* Set the callback for checking if the Present Contract is still valid. */ void usbc_set_policy_cb_present_contract_is_valid(const struct device *dev, const policy_cb_present_contract_is_valid_t cb)
{ struct usbc_port_data *data = dev->data; data->policy_present_contract_is_valid = cb; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* 3.d (void) 3.e Cell Identifier List Segment for released cells - no user present */
static guint16 be_cell_id_lst_seg_f_rel_cell(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3.d (void) 3.e Cell Identifier List Segment for released cells - no user present */ static guint16 be_cell_id_lst_seg_f_rel_cell(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_bits_item(tree, hf_gsm_a_bssmap_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gsm_a_bssap_cell_id_list_seg_cell_id_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_not_decoded_yet, tvb, curr_offset, len-1); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called by rport module when new rports are discovered. */
void bfa_fcs_port_add_rport(struct bfa_fcs_port_s *port, struct bfa_fcs_rport_s *rport)
/* Called by rport module when new rports are discovered. */ void bfa_fcs_port_add_rport(struct bfa_fcs_port_s *port, struct bfa_fcs_rport_s *rport)
{ list_add_tail(&rport->qe, &port->rport_q); port->num_rports++; }
robutest/uclinux
C++
GPL-2.0
60
/* This API reads the SPI interface mode which is set for primary interface. */
uint16_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev)
/* This API reads the SPI interface mode which is set for primary interface. */ uint16_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_IF_CONFIG_ADDR, &data, 1, dev); if (rslt == BMA4_OK) *spi = BMA4_GET_BITS_POS_0(data, BMA4_CONFIG_SPI3); } return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Convert the decimal dotted IPv4 address into the binary IPv4 address. */
EFI_STATUS Ip4Config2StrToIp(IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip)
/* Convert the decimal dotted IPv4 address into the binary IPv4 address. */ EFI_STATUS Ip4Config2StrToIp(IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip)
{ UINTN Index; UINTN Number; Index = 0; while (*Str != L'\0') { if (Index > 3) { return EFI_INVALID_PARAMETER; } Number = 0; while ((*Str >= L'0') && (*Str <= L'9')) { Number = Number * 10 + (*Str - L'0'); Str++; } if (Number > 0xFF) { return EFI_INVALID_PARAMETER; } Ip->Addr[Index] = (UINT8)Number; if ((*Str != L'\0') && (*Str != L'.')) { return EFI_INVALID_PARAMETER; } if (*Str == L'.') { Str++; } Index++; } if (Index != 4) { return EFI_INVALID_PARAMETER; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Get the player index of an opened joystick, or -1 if it's not available */
int SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick)
/* Get the player index of an opened joystick, or -1 if it's not available */ int SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick)
{ int player_index; if (!SDL_PrivateJoystickValid(joystick)) { return -1; } SDL_LockJoysticks(); player_index = SDL_GetPlayerIndexForJoystickID(joystick->instance_id); SDL_UnlockJoysticks(); return player_index; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* zfcp_erp_wait - wait for completion of error recovery on an adapter @adapter: adapter for which to wait for completion of its error recovery */
void zfcp_erp_wait(struct zfcp_adapter *adapter)
/* zfcp_erp_wait - wait for completion of error recovery on an adapter @adapter: adapter for which to wait for completion of its error recovery */ void zfcp_erp_wait(struct zfcp_adapter *adapter)
{ wait_event(adapter->erp_done_wqh, !(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_ERP_PENDING)); }
robutest/uclinux
C++
GPL-2.0
60
/* DAC960_V2_ClearCommand clears critical fields of Command for DAC960 V2 Firmware Controllers. */
static void DAC960_V2_ClearCommand(DAC960_Command_T *Command)
/* DAC960_V2_ClearCommand clears critical fields of Command for DAC960 V2 Firmware Controllers. */ static void DAC960_V2_ClearCommand(DAC960_Command_T *Command)
{ DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox; memset(CommandMailbox, 0, sizeof(DAC960_V2_CommandMailbox_T)); Command->V2.CommandStatus = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* set up the iterator to start reading from the first line */
static void* fscache_histogram_start(struct seq_file *m, loff_t *_pos)
/* set up the iterator to start reading from the first line */ static void* fscache_histogram_start(struct seq_file *m, loff_t *_pos)
{ if ((unsigned long long)*_pos >= HZ + 2) return NULL; if (*_pos == 0) *_pos = 1; return (void *)(unsigned long) *_pos; }
robutest/uclinux
C++
GPL-2.0
60
/* Look for an empty spot in the ID table; if none found, double the table's size and get the first spot. */
void wimax_id_table_add(struct wimax_dev *wimax_dev)
/* Look for an empty spot in the ID table; if none found, double the table's size and get the first spot. */ void wimax_id_table_add(struct wimax_dev *wimax_dev)
{ d_fnstart(3, NULL, "(wimax_dev %p)\n", wimax_dev); spin_lock(&wimax_id_table_lock); list_add(&wimax_dev->id_table_node, &wimax_id_table); spin_unlock(&wimax_id_table_lock); d_fnend(3, NULL, "(wimax_dev %p)\n", wimax_dev); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* return The status flags. This is the logical OR of members of the enumeration ::pwm_status_flags_t */
uint32_t PWM_GetStatusFlags(PWM_Type *base, pwm_submodule_t subModule)
/* return The status flags. This is the logical OR of members of the enumeration ::pwm_status_flags_t */ uint32_t PWM_GetStatusFlags(PWM_Type *base, pwm_submodule_t subModule)
{ uint32_t statusFlags; statusFlags = base->SM[subModule].STS; statusFlags |= (((uint32_t)base->FSTS & PWM_FSTS_FFLAG_MASK) << 16UL); return statusFlags; }
eclipse-threadx/getting-started
C++
Other
310
/* Interrupt service. This function is called by all interrupts runtime for instances enabled in this library. */
static void nrf_drv_twis_on_ISR(uint8_t instNr)
/* Interrupt service. This function is called by all interrupts runtime for instances enabled in this library. */ static void nrf_drv_twis_on_ISR(uint8_t instNr)
{ nrf_drv_twis_state_machine(instNr); }
labapart/polymcu
C++
null
201
/* Writes a byte or word to the NVM using the flash access registers. */
static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
/* Writes a byte or word to the NVM using the flash access registers. */ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
{ struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; u16 i; if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || (words == 0)) { e_dbg("nvm parameter(s) out of bounds\n"); return -E1000_ERR_NVM; } nvm->ops.acquire(hw); for (i = 0; i < words; i++) { dev_spec->shadow_ram[offset+i].modified = true; dev_spec->shadow_ram[offset+i].value = data[i]; } nvm->ops.release(hw); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Reset the GPIO bit data(status) for bit. @method GPIO_ResetBits */
void GPIO_ResetBits(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin)
/* Reset the GPIO bit data(status) for bit. @method GPIO_ResetBits */ void GPIO_ResetBits(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin)
{ _ASSERT(IS_GPIO_PORT(GPIOx)); _ASSERT(IS_GPIO_PIN(GPIO_Pin)); for(uint8_t i = 0; i < GPIO_PIN_NUM; i++) { if(GPIO_Pin & (BIT0<<i)) { MGPIO->CTRL.reg[GPIO_GetNum(GPIOx, (BIT0<<i))] = OUTPUT_LOW; } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables the basic one pulse signal generation on the designed output. */
void HRTIM_SimpleOnePulseStart(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t OnePulseChannel)
/* Enables the basic one pulse signal generation on the designed output. */ void HRTIM_SimpleOnePulseStart(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t OnePulseChannel)
{ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); HRTIMx->HRTIM_COMMON.OENR |= OnePulseChannel; __HRTIM_ENABLE(HRTIMx, TimerIdxToTimerId[TimerIdx]); }
remotemcu/remcu-chip-sdks
C++
null
436
/* The function is used to configure a receive message object. */
int32_t CAN_SetRxMsgAndMsk(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID, uint32_t u32IDMask)
/* The function is used to configure a receive message object. */ int32_t CAN_SetRxMsgAndMsk(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID, uint32_t u32IDMask)
{ uint32_t u32TimeOutCount = 0UL; while(CAN_SetRxMsgObjAndMsk(tCAN, (uint8_t)u32MsgNum, (uint8_t)u32IDType, u32ID, u32IDMask, (uint8_t)TRUE) == (int32_t)FALSE) { if(++u32TimeOutCount >= RETRY_COUNTS) { return (int32_t)FALSE; } } return (int32_t)TRUE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. */
status_t FLEXIO_SPI_SlaveTransferCreateHandle(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_slave_transfer_callback_t callback, void *userData)
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. */ status_t FLEXIO_SPI_SlaveTransferCreateHandle(FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_slave_transfer_callback_t callback, void *userData)
{ assert(handle); IRQn_Type flexio_irqs[] = FLEXIO_IRQS; memset(handle, 0, sizeof(*handle)); handle->callback = callback; handle->userData = userData; EnableIRQ(flexio_irqs[FLEXIO_SPI_GetInstance(base)]); return FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_SPI_SlaveTransferHandleIRQ); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sflash enable RCV mode to recovery for erase while power drop need lock. */
__WEAK int ATTR_TCM_SECTION bflb_xip_sflash_rcv_enable_need_lock(spi_flash_cfg_type *p_flash_cfg, uint8_t r_cmd, uint8_t w_cmd, uint8_t bit_pos, uint8_t group, uint8_t bank)
/* Sflash enable RCV mode to recovery for erase while power drop need lock. */ __WEAK int ATTR_TCM_SECTION bflb_xip_sflash_rcv_enable_need_lock(spi_flash_cfg_type *p_flash_cfg, uint8_t r_cmd, uint8_t w_cmd, uint8_t bit_pos, uint8_t group, uint8_t bank)
{ int stat = -1; uint32_t offset; uint8_t io_mode = p_flash_cfg->io_mode & 0xf; stat = bflb_xip_sflash_state_save(p_flash_cfg, &offset, group, bank); if (stat != 0) { bflb_sflash_set_xip_cfg(p_flash_cfg, io_mode, 1, 0, 32 , bank); } else { stat = bflb_sflash_rcv_enable(p_flash_cfg, r_cmd, w_cmd, bit_pos); bflb_xip_sflash_state_restore_ext(p_flash_cfg, offset, group, bank); } return stat; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* lpc32xx_cmd_ctrl - write command to either cmd or data register */
static void lpc32xx_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
/* lpc32xx_cmd_ctrl - write command to either cmd or data register */ static void lpc32xx_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ if (cmd == NAND_CMD_NONE) return; if (ctrl & NAND_CLE) writeb(cmd & 0Xff, &lpc32xx_nand_mlc_registers->cmd); else if (ctrl & NAND_ALE) writeb(cmd & 0Xff, &lpc32xx_nand_mlc_registers->addr); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the number of valid entries in transmit FIFO. */
u32 USI_SSI_GetTxCount(USI_TypeDef *usi_dev)
/* Get the number of valid entries in transmit FIFO. */ u32 USI_SSI_GetTxCount(USI_TypeDef *usi_dev)
{ u32 empty_cnt = (USI_SSI_GetTxFIFOStatus(usi_dev) & USI_TXFIFO_EMPTY_SPACE) >> 8; return USI_SPI_TX_FIFO_DEPTH - empty_cnt; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If FormatString is NULL, then ASSERT() and 0 is returned. If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then ASSERT() and 0 is returned. */
UINTN EFIAPI SPrintLengthAsciiFormat(IN CONST CHAR8 *FormatString, IN VA_LIST Marker)
/* If FormatString is NULL, then ASSERT() and 0 is returned. If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then ASSERT() and 0 is returned. */ UINTN EFIAPI SPrintLengthAsciiFormat(IN CONST CHAR8 *FormatString, IN VA_LIST Marker)
{ return InternalPrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL); }
tianocore/edk2
C++
Other
4,240
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, LPUART1_TX_Pin|LPUART1_RX_Pin); } else if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_4|GPIO_PIN_5); } else if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_15); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_5); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_11); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __vxge_hw_ring_reset - Resets the ring This function resets the ring during vpath reset operation */
enum vxge_hw_status __vxge_hw_ring_reset(struct __vxge_hw_ring *ring)
/* __vxge_hw_ring_reset - Resets the ring This function resets the ring during vpath reset operation */ enum vxge_hw_status __vxge_hw_ring_reset(struct __vxge_hw_ring *ring)
{ enum vxge_hw_status status = VXGE_HW_OK; struct __vxge_hw_channel *channel; channel = &ring->channel; __vxge_hw_ring_abort(ring); status = __vxge_hw_channel_reset(channel); if (status != VXGE_HW_OK) goto exit; if (ring->rxd_init) { status = vxge_hw_ring_replenish(ring, 1); if (status != VXGE_HW_OK) goto exit; } exit: return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Example of using FLASH_0 to read and write Flash RWWEE array. */
void RWW_FLASH_0_example(void)
/* Example of using FLASH_0 to read and write Flash RWWEE array. */ void RWW_FLASH_0_example(void)
{ uint32_t page_size; uint16_t i; page_size = _rww_flash_get_page_size(&FLASH_0.dev); for (i = 0; i < page_size; i++) { src_data[i] = i; } if (_rww_flash_write(&FLASH_0.dev, NVMCTRL_RWW_EEPROM_ADDR, src_data, page_size) != ERR_NONE) { while (1) ; } if (_rww_flash_read(&FLASH_0.dev, NVMCTRL_RWW_EEPROM_ADDR, chk_data, page_size) != ERR_NONE) { while (1) ; } for (i = 0; i < page_size; i++) { if (src_data[i] != chk_data[i]) { while (1) ; } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USBH_Alloc_Channel Allocate a new channel for the pipe. */
uint8_t USBH_Alloc_Channel(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr)
/* USBH_Alloc_Channel Allocate a new channel for the pipe. */ uint8_t USBH_Alloc_Channel(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr)
{ uint16_t hc_num; hc_num = USBH_GetFreeChannel(pdev); if (hc_num != HC_ERROR) { pdev->host.channel[hc_num] = HC_USED | ep_addr; } return hc_num; }
MaJerle/stm32f429
C++
null
2,036
/* Enables or disables the TIM Capture Compare Channel xN. */
void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
/* Enables or disables the TIM Capture Compare Channel xN. */ void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
{ assert_param(IS_TIM_18_PERIPH(TIMx)); assert_param(IS_TIM_COMPLEMENTARY_CHANNEL(TIM_Channel)); assert_param(IS_TIM_CCXN(TIM_CCxN)); TIMx->CCER &= (uint16_t)(~((uint16_t)(CCER_CCNE_Set << TIM_Channel))); TIMx->CCER |= (uint16_t)(TIM_CCxN << TIM_Channel); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure USART operating in synchronous mode to use a given baudrate (or as close as possible to specified baudrate). Fractional clock division is suppressed, although the HW design allows it. It could cause half clock cycles to exceed specified limit, and thus potentially violate specifications for the slave device. In some special situations fractional clock division may be useful even in synchronous mode, but in those cases it must be directly adjusted, possibly assisted by */
void USART_BaudrateSyncSet(USART_TypeDef *usart, uint32_t refFreq, uint32_t baudrate)
/* Configure USART operating in synchronous mode to use a given baudrate (or as close as possible to specified baudrate). Fractional clock division is suppressed, although the HW design allows it. It could cause half clock cycles to exceed specified limit, and thus potentially violate specifications for the slave device. In some special situations fractional clock division may be useful even in synchronous mode, but in those cases it must be directly adjusted, possibly assisted by */ void USART_BaudrateSyncSet(USART_TypeDef *usart, uint32_t refFreq, uint32_t baudrate)
{ uint32_t clkdiv; EFM_ASSERT(baudrate); if (!refFreq) { refFreq = CMU_ClockFreqGet(cmuClock_HFPER); } clkdiv = 2 * refFreq; clkdiv /= baudrate; clkdiv -= 4; clkdiv *= 64; clkdiv += 0xc0; clkdiv &= 0xffffff00; clkdiv &= _USART_CLKDIV_DIV_MASK; usart->CLKDIV = clkdiv; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Description: This function frees all memory used by the block integrity profile. To be called at device teardown. */
void blk_integrity_unregister(struct gendisk *disk)
/* Description: This function frees all memory used by the block integrity profile. To be called at device teardown. */ void blk_integrity_unregister(struct gendisk *disk)
{ struct blk_integrity *bi; if (!disk || !disk->integrity) return; bi = disk->integrity; kobject_uevent(&bi->kobj, KOBJ_REMOVE); kobject_del(&bi->kobj); kobject_put(&bi->kobj); kmem_cache_free(integrity_cachep, bi); disk->integrity = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Wait for command done. This is a helper function for nand_wait used when we are in interrupt context. May happen when in panic and trying to write an oops trough mtdoops. */
static void panic_nand_wait(struct mtd_info *mtd, struct nand_chip *chip, unsigned long timeo)
/* Wait for command done. This is a helper function for nand_wait used when we are in interrupt context. May happen when in panic and trying to write an oops trough mtdoops. */ static void panic_nand_wait(struct mtd_info *mtd, struct nand_chip *chip, unsigned long timeo)
{ int i; for (i = 0; i < timeo; i++) { if (chip->dev_ready) { if (chip->dev_ready(mtd)) break; } else { if (chip->read_byte(mtd) & NAND_STATUS_READY) break; } mdelay(1); } }
robutest/uclinux
C++
GPL-2.0
60
/* The match criteria is: vendor, ec and bios much match. */
static unsigned long __init tpacpi_check_quirks(const struct tpacpi_quirk *qlist, unsigned int qlist_size)
/* The match criteria is: vendor, ec and bios much match. */ static unsigned long __init tpacpi_check_quirks(const struct tpacpi_quirk *qlist, unsigned int qlist_size)
{ while (qlist_size) { if ((qlist->vendor == thinkpad_id.vendor || qlist->vendor == TPACPI_MATCH_ANY) && (qlist->bios == thinkpad_id.bios_model || qlist->bios == TPACPI_MATCH_ANY) && (qlist->ec == thinkpad_id.ec_model || qlist->ec == TPACPI_MATCH_ANY)) return qlist->quirks; qlist_size--; qlist++; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* On devices that support the VBUS glitch filter, the */
void USBHostPwrConfig(unsigned long ulBase, unsigned long ulFlags)
/* On devices that support the VBUS glitch filter, the */ void USBHostPwrConfig(unsigned long ulBase, unsigned long ulFlags)
{ ASSERT(ulBase == USB0_BASE); ASSERT((ulFlags & ~(USB_EPC_PFLTACT_M | USB_EPC_PFLTAEN | USB_EPC_PFLTSEN_HIGH | USB_EPC_EPEN_M)) == 0); HWREG(ulBase + USB_O_VDC) = ulFlags >> 16; HWREGH(ulBase + USB_O_EPC) = (ulFlags | (HWREGH(ulBase + USB_O_EPC) & ~(USB_EPC_PFLTACT_M | USB_EPC_PFLTAEN | USB_EPC_PFLTSEN_HIGH | USB_EPC_EPEN_M))); }
watterott/WebRadio
C++
null
71
/* If val does not need to be represented by a named entity, NULL is returned. */
const char* mxmlEntityGetName(int val)
/* If val does not need to be represented by a named entity, NULL is returned. */ const char* mxmlEntityGetName(int val)
{ switch (val) { case '&' : return ("amp"); case '<' : return ("lt"); case '>' : return ("gt"); case '\"' : return ("quot"); default : return (NULL); } }
DC-SWAT/DreamShell
C++
null
404
/* Enables or disables the RTC day over threshold interrupt. */
u32 RTC_DayIntCmd(u32 NewState)
/* Enables or disables the RTC day over threshold interrupt. */ u32 RTC_DayIntCmd(u32 NewState)
{ RTC_TypeDef* RTC = ((RTC_TypeDef *) RTC_BASE); u32 status = 0; RTC->WPR = 0xCA; RTC->WPR = 0x53; if (RTC_EnterInitMode()) { RTC_DayIntClear(); if (NewState != DISABLE) { RTC->CR |= (u32)(RTC_CR_DOVTHIE); } else { RTC->CR &= (u32)~(RTC_CR_DOVTHIE); } RTC_ExitInitMode(); if (RTC_WaitForSynchro()) { status = 1; } else { status = 0; } } else { status = 0; } RTC->WPR = 0xFF; return status; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Disables callback. Disables the callback function registered by the */
void tcc_disable_callback(struct tcc_module *const module, const enum tcc_callback callback_type)
/* Disables callback. Disables the callback function registered by the */ void tcc_disable_callback(struct tcc_module *const module, const enum tcc_callback callback_type)
{ Assert(module); Assert(module->hw); system_interrupt_disable(_tcc_interrupt_get_interrupt_vector( _tcc_get_inst_index(module->hw))); module->enable_callback_mask &= ~_tcc_intflag[callback_type]; module->hw->INTENCLR.reg = _tcc_intflag[callback_type]; }
memfault/zero-to-main
C++
null
200
/* read_oob_from_regs - read data from OOB registers @ctrl: NAND controller @i: sub-page sector index @oob: buffer to read to @sas: spare area sector size (i.e., OOB size per FLASH_CACHE) @sector_1k: 1 for 1KiB sectors, 0 for 512B, other values are illegal */
static int read_oob_from_regs(struct brcmnand_controller *ctrl, int i, u8 *oob, int sas, int sector_1k)
/* read_oob_from_regs - read data from OOB registers @ctrl: NAND controller @i: sub-page sector index @oob: buffer to read to @sas: spare area sector size (i.e., OOB size per FLASH_CACHE) @sector_1k: 1 for 1KiB sectors, 0 for 512B, other values are illegal */ static int read_oob_from_regs(struct brcmnand_controller *ctrl, int i, u8 *oob, int sas, int sector_1k)
{ int tbytes = sas << sector_1k; int j; if (sector_1k && (i & 0x01)) tbytes = max(0, tbytes - (int)ctrl->max_oob); tbytes = min_t(int, tbytes, ctrl->max_oob); for (j = 0; j < tbytes; j++) oob[j] = oob_reg_read(ctrl, j); return tbytes; }
4ms/stm32mp1-baremetal
C++
Other
137
/* SMM Firmware Volume Block Protocol notification event handler. */
EFI_STATUS EFIAPI FvbNotificationEvent(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
/* SMM Firmware Volume Block Protocol notification event handler. */ EFI_STATUS EFIAPI FvbNotificationEvent(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
{ EFI_STATUS Status; EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol; EFI_HANDLE SmmFtwHandle; Status = gMmst->MmLocateProtocol ( &gEfiSmmFaultTolerantWriteProtocolGuid, NULL, (VOID **)&FtwProtocol ); if (!EFI_ERROR (Status)) { return EFI_SUCCESS; } Status = InitFtwProtocol (mFtwDevice); if (EFI_ERROR (Status)) { return Status; } Status = gMmst->MmInstallProtocolInterface ( &mFtwDevice->Handle, &gEfiSmmFaultTolerantWriteProtocolGuid, EFI_NATIVE_INTERFACE, &mFtwDevice->FtwInstance ); ASSERT_EFI_ERROR (Status); Status = gMmst->MmiHandlerRegister (SmmFaultTolerantWriteHandler, &gEfiSmmFaultTolerantWriteProtocolGuid, &SmmFtwHandle); ASSERT_EFI_ERROR (Status); FtwNotifySmmReady (); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* It is the caller's responsibility to check the ObjectNode has been removed from the tree and is not referencing any other node in the tree. */
STATIC EFI_STATUS EFIAPI AmlDeleteObjectNode(IN AML_OBJECT_NODE *ObjectNode)
/* It is the caller's responsibility to check the ObjectNode has been removed from the tree and is not referencing any other node in the tree. */ STATIC EFI_STATUS EFIAPI AmlDeleteObjectNode(IN AML_OBJECT_NODE *ObjectNode)
{ if (!IS_AML_OBJECT_NODE (ObjectNode)) { ASSERT (0); return EFI_INVALID_PARAMETER; } FreePool (ObjectNode); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Get the status of the Low Power Rx Monitoring. */
u32 UART_RxMonitorSatusGet(UART_TypeDef *UARTx)
/* Get the status of the Low Power Rx Monitoring. */ u32 UART_RxMonitorSatusGet(UART_TypeDef *UARTx)
{ return UARTx->MON_BAUD_STS; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Check if the Trb is a transaction of the URBs in XHCI's asynchronous transfer list. */
BOOLEAN IsAsyncIntTrb(IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, OUT URB **Urb)
/* Check if the Trb is a transaction of the URBs in XHCI's asynchronous transfer list. */ BOOLEAN IsAsyncIntTrb(IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, OUT URB **Urb)
{ LIST_ENTRY *Entry; LIST_ENTRY *Next; URB *CheckedUrb; BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) { CheckedUrb = EFI_LIST_CONTAINER (Entry, URB, UrbList); if (IsTransferRingTrb (Xhc, Trb, CheckedUrb)) { *Urb = CheckedUrb; return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Get actual waveform shape @rmtoll CFG WAVE LPTIM_GetWaveform. */
uint32_t LPTIM_GetWaveform(LPTIM_Module *LPTIMx)
/* Get actual waveform shape @rmtoll CFG WAVE LPTIM_GetWaveform. */ uint32_t LPTIM_GetWaveform(LPTIM_Module *LPTIMx)
{ return (uint32_t)(READ_BIT(LPTIMx->CFG, LPTIM_CFG_WAVE)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Stop the PWM of the PWM module. The */
void xPWMStop(unsigned long ulBase, unsigned long ulChannel)
/* Stop the PWM of the PWM module. The */ void xPWMStop(unsigned long ulBase, unsigned long ulChannel)
{ xASSERT(ulBase == PWMA_BASE); xASSERT(((ulChannel >= 0) || (ulChannel <= 1))); xHWREG(ulBase + PWM_PCR) &= ~(PWM_PCR_CH0EN << (ulChannel << 3)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function is to display the IPv4 address. */
VOID HttpBootShowIp4Addr(IN EFI_IPv4_ADDRESS *Ip)
/* This function is to display the IPv4 address. */ VOID HttpBootShowIp4Addr(IN EFI_IPv4_ADDRESS *Ip)
{ UINTN Index; for (Index = 0; Index < 4; Index++) { AsciiPrint ("%d", Ip->Addr[Index]); if (Index < 3) { AsciiPrint ("."); } } }
tianocore/edk2
C++
Other
4,240
/* This function is used by the IDE bus driver to get controller information. */
EFI_STATUS EFIAPI ScsiDiskInfoWhichIde(IN EFI_DISK_INFO_PROTOCOL *This, OUT UINT32 *IdeChannel, OUT UINT32 *IdeDevice)
/* This function is used by the IDE bus driver to get controller information. */ EFI_STATUS EFIAPI ScsiDiskInfoWhichIde(IN EFI_DISK_INFO_PROTOCOL *This, OUT UINT32 *IdeChannel, OUT UINT32 *IdeDevice)
{ SCSI_DISK_DEV *ScsiDiskDevice; if (CompareGuid (&This->Interface, &gEfiDiskInfoScsiInterfaceGuid) || CompareGuid (&This->Interface, &gEfiDiskInfoUfsInterfaceGuid)) { return EFI_UNSUPPORTED; } ScsiDiskDevice = SCSI_DISK_DEV_FROM_DISKINFO (This); *IdeChannel = ScsiDiskDevice->Channel; *IdeDevice = ScsiDiskDevice->Device; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Register the Service A and all its Characteristics... */
void service_a_1_init(void)
/* Register the Service A and all its Characteristics... */ void service_a_1_init(void)
{ bt_gatt_service_register(&service_a_1_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This API is used to reset the FIFO related configurations in the fifo_frame structure. */
static void reset_fifo_data_structure(const struct bmi160_dev *dev)
/* This API is used to reset the FIFO related configurations in the fifo_frame structure. */ static void reset_fifo_data_structure(const struct bmi160_dev *dev)
{ dev->fifo->accel_byte_start_idx = 0; dev->fifo->gyro_byte_start_idx = 0; dev->fifo->aux_byte_start_idx = 0; dev->fifo->sensor_time = 0; dev->fifo->skipped_frame_count = 0; }
eclipse-threadx/getting-started
C++
Other
310
/* ib_set_client_data() sets client context that can be retrieved with ib_get_client_data(). */
void ib_set_client_data(struct ib_device *device, struct ib_client *client, void *data)
/* ib_set_client_data() sets client context that can be retrieved with ib_get_client_data(). */ void ib_set_client_data(struct ib_device *device, struct ib_client *client, void *data)
{ struct ib_client_data *context; unsigned long flags; spin_lock_irqsave(&device->client_data_lock, flags); list_for_each_entry(context, &device->client_data_list, list) if (context->client == client) { context->data = data; goto out; } printk(KERN_WARNING "No client context found for %s/%s\n", device->name, client->name); out: spin_unlock_irqrestore(&device->client_data_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* The status line is the last line of the screen. It shows the string "Running"/"Holding" in the lower right corner of the screen. */
static void tty3270_update_status(struct tty3270 *tp)
/* The status line is the last line of the screen. It shows the string "Running"/"Holding" in the lower right corner of the screen. */ static void tty3270_update_status(struct tty3270 *tp)
{ char *str; str = (tp->nr_up != 0) ? "History" : "Running"; memcpy(tp->status->string + 8, str, 7); codepage_convert(tp->view.ascebc, tp->status->string + 8, 7); tp->update_flags |= TTY_UPDATE_STATUS; }
robutest/uclinux
C++
GPL-2.0
60
/* Manages the multicast receive filters of a network interface. */
EFI_STATUS EmuSnpReceiveFilters(IN EMU_SNP_PROTOCOL *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL)
/* Manages the multicast receive filters of a network interface. */ EFI_STATUS EmuSnpReceiveFilters(IN EMU_SNP_PROTOCOL *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL)
{ EMU_SNP_PRIVATE *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This); return EFI_UNSUPPORTED; }
tianocore/edk2
C++
Other
4,240
/* This function returns current finsh shell input device. */
const char* finsh_get_device()
/* This function returns current finsh shell input device. */ const char* finsh_get_device()
{ RT_ASSERT(shell != RT_NULL); return shell->device->parent.name; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Returns the ETH DMA Rx Desc buffer size. */
uint32_t ETH_ReadDMARxDescBufferSize(ETH_DMADescConfig_T *DMARxDesc, ETH_DMARXDESC_BUFFER_T buffer)
/* Returns the ETH DMA Rx Desc buffer size. */ uint32_t ETH_ReadDMARxDescBufferSize(ETH_DMADescConfig_T *DMARxDesc, ETH_DMARXDESC_BUFFER_T buffer)
{ if(buffer == ETH_DMARXDESC_BUFFER1) { return (DMARxDesc->ControlBufferSize & ETH_DMARXDESC_RXBS1); } else { return ((DMARxDesc->ControlBufferSize & ETH_DMARXDESC_RXBS2) >> ETH_DMARXDESC_BUFFER2_SIZESHIFT); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function gets the channel enable bits status from the ADC Channel Selection Sequencer Registers. */
u32 XAdcPs_GetSeqChEnables(XAdcPs *InstancePtr)
/* This function gets the channel enable bits status from the ADC Channel Selection Sequencer Registers. */ u32 XAdcPs_GetSeqChEnables(XAdcPs *InstancePtr)
{ u32 RegValEnable; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); RegValEnable = XAdcPs_ReadInternalReg(InstancePtr, XADCPS_SEQ00_OFFSET) & XADCPS_SEQ00_CH_VALID_MASK; RegValEnable |= (XAdcPs_ReadInternalReg(InstancePtr, XADCPS_SEQ01_OFFSET) & XADCPS_SEQ01_CH_VALID_MASK) << XADCPS_SEQ_CH_AUX_SHIFT; return RegValEnable; }
ua1arn/hftrx
C++
null
69
/* Remove route from x25_route_list. If it was there. Caller must hold x25_route_list_lock. */
static void __x25_remove_route(struct x25_route *rt)
/* Remove route from x25_route_list. If it was there. Caller must hold x25_route_list_lock. */ static void __x25_remove_route(struct x25_route *rt)
{ if (rt->node.next) { list_del(&rt->node); x25_route_put(rt); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note that doing so invalidates the hash computed by prior calls to g_icon_hash(). */
void g_themed_icon_append_name(GThemedIcon *icon, const char *iconname)
/* Note that doing so invalidates the hash computed by prior calls to g_icon_hash(). */ void g_themed_icon_append_name(GThemedIcon *icon, const char *iconname)
{ guint num_names; g_return_if_fail (G_IS_THEMED_ICON (icon)); g_return_if_fail (iconname != NULL); num_names = g_strv_length (icon->names); icon->names = g_realloc (icon->names, sizeof (char*) * (num_names + 2)); icon->names[num_names] = g_strdup (iconname); icon->names[num_names + 1] = NULL; g_object_notify (G_OBJECT (icon), "names"); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Emit code for order comparisons. When using an immediate operand, 'isfloat' tells whether the original value was a float. */
static void codeorder(FuncState *fs, OpCode op, expdesc *e1, expdesc *e2)
/* Emit code for order comparisons. When using an immediate operand, 'isfloat' tells whether the original value was a float. */ static void codeorder(FuncState *fs, OpCode op, expdesc *e1, expdesc *e2)
{ r1 = luaK_exp2anyreg(fs, e1); r2 = im; op = cast(OpCode, (op - OP_LT) + OP_LTI); } else if (isSCnumber(e1, &im, &isfloat)) { r1 = luaK_exp2anyreg(fs, e2); r2 = im; op = (op == OP_LT) ? OP_GTI : OP_GEI; } else { r1 = luaK_exp2anyreg(fs, e1); r2 = luaK_exp2anyreg(fs, e2); } freeexps(fs, e1, e2); e1->u.info = condjump(fs, op, r1, r2, isfloat, 1); e1->k = VJMP; }
Nicholas3388/LuaNode
C++
Other
1,055
/* NOTE: For the power LED, use the LED_POWER_* macros since they differ */
static void set_led(struct cardinfo *card, int shift, unsigned char state)
/* NOTE: For the power LED, use the LED_POWER_* macros since they differ */ static void set_led(struct cardinfo *card, int shift, unsigned char state)
{ unsigned char led; led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL); if (state == LED_FLIP) led ^= (1<<shift); else { led &= ~(0x03 << shift); led |= (state << shift); } writeb(led, card->csr_remap + MEMCTRLCMD_LEDCTRL); }
robutest/uclinux
C++
GPL-2.0
60
/* If no devices were found -ENODEV is returned which does not mean that this is a real error, there just have been no suitable ACPI objects in the table trunk from which the kernel could create a device and add/start an appropriate driver. */
int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, acpi_handle handle, int type)
/* If no devices were found -ENODEV is returned which does not mean that this is a real error, there just have been no suitable ACPI objects in the table trunk from which the kernel could create a device and add/start an appropriate driver. */ int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, acpi_handle handle, int type)
{ struct acpi_bus_ops ops; memset(&ops, 0, sizeof(ops)); ops.acpi_op_add = 1; return acpi_bus_scan(handle, &ops, child); }
robutest/uclinux
C++
GPL-2.0
60
/* Compare the code in the shared RAM of an IOP with a copy in system memory and return 0 on match or the first nonmatching system memory address on failure. */
__u8* iop_compare_code(uint iop_num, __u8 *code_start, uint code_len, __u16 shared_ram_start)
/* Compare the code in the shared RAM of an IOP with a copy in system memory and return 0 on match or the first nonmatching system memory address on failure. */ __u8* iop_compare_code(uint iop_num, __u8 *code_start, uint code_len, __u16 shared_ram_start)
{ if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return code_start; iop_loadaddr(iop_base[iop_num], shared_ram_start); while (code_len--) { if (*code_start != iop_base[iop_num]->ram_data) { return code_start; } code_start++; } return (__u8 *) 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the interrupt type and Enable interrupt for the specified pin(s). This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. */
void xGPIOPinIntEnable(unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType)
/* Set the interrupt type and Enable interrupt for the specified pin(s). This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. */ void xGPIOPinIntEnable(unsigned long ulPort, unsigned long ulPins, unsigned long ulIntType)
{ unsigned long i = 0; for(i = 0; i < 32; i++) { if(ulPins & (0x01 << i)) { GPIOPinIntCfg(ulPort, (0x01 << i), ulIntType); GPIOPinIntEnable(ulPort, (0x01 << i)); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Retrieve the Prefix address according to the PrefixLength by clear the useless bits. */
VOID Ip6GetPrefix(IN UINT8 PrefixLength, IN OUT EFI_IPv6_ADDRESS *Prefix)
/* Retrieve the Prefix address according to the PrefixLength by clear the useless bits. */ VOID Ip6GetPrefix(IN UINT8 PrefixLength, IN OUT EFI_IPv6_ADDRESS *Prefix)
{ UINT8 Byte; UINT8 Bit; UINT8 Mask; UINT8 Value; ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_MAX)); if (PrefixLength == 0) { ZeroMem (Prefix, sizeof (EFI_IPv6_ADDRESS)); return; } if (PrefixLength >= IP6_PREFIX_MAX) { return; } Byte = (UINT8)(PrefixLength / 8); Bit = (UINT8)(PrefixLength % 8); Value = Prefix->Addr[Byte]; if (Byte > 0) { ZeroMem (Prefix->Addr + Byte, 16 - Byte); } if (Bit > 0) { Mask = (UINT8)(0xFF << (8 - Bit)); Prefix->Addr[Byte] = (UINT8)(Value & Mask); } }
tianocore/edk2
C++
Other
4,240
/* Calculates the maximum fragment size to use when sending the specified response packet. */
static uint16_t smp_bt_get_mtu(const struct net_buf *nb)
/* Calculates the maximum fragment size to use when sending the specified response packet. */ static uint16_t smp_bt_get_mtu(const struct net_buf *nb)
{ struct bt_conn *conn; uint16_t mtu; conn = smp_bt_conn_from_pkt(nb); if (conn == NULL) { return 0; } mtu = bt_gatt_get_mtu(conn); return mtu - 3; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* switch high-driver mode this bit set by software only when IRC16M or HXTAL used as system clock */
void pmu_highdriver_switch_select(uint32_t highdr_switch)
/* switch high-driver mode this bit set by software only when IRC16M or HXTAL used as system clock */ void pmu_highdriver_switch_select(uint32_t highdr_switch)
{ while(SET != pmu_flag_get(PMU_FLAG_HDRF)) { } PMU_CTL &= ~PMU_CTL_HDS; PMU_CTL |= highdr_switch; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure RS485 function. This function configure uart rs485. */
void UARTRS485Cfg(unsigned long ulBase, unsigned long ulCfg)
/* Configure RS485 function. This function configure uart rs485. */ void UARTRS485Cfg(unsigned long ulBase, unsigned long ulCfg)
{ unsigned long ulTmpReg = 0; xASSERT(ulBase == UART1_BASE); xASSERT( (ulCfg & ~( RS485_NMM_DIS | RS485_NMM_EN | RS485_RX_EN | RS485_RX_DIS | RS485_AUTO_ADDR_EN | RS485_AUTO_ADDR_DIS | RS485_AUTO_DIR_DIS | RS485_AUTO_DIR_RTS | RS485_AUTO_DIR_DTR | RS485_AUTO_DIR_INV_EN | RS485_AUTO_DIR_INV_DIS ) ) == 0); ulTmpReg = xHWREG(ulBase + RS485CTRL); ulTmpReg &= ((~ulCfg) >> 16); ulTmpReg |= (ulCfg & 0xFFFF); xHWREG(ulBase + RS485CTRL) = ulTmpReg; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Try to assign allocate the endpoint for the URB */
static bool try_alloc_ep_for_urb(usbd_device *dev, usbd_urb *urb)
/* Try to assign allocate the endpoint for the URB */ static bool try_alloc_ep_for_urb(usbd_device *dev, usbd_urb *urb)
{ uint8_t addr = urb->transfer.ep_addr; if (is_ep_free(dev, addr)) { mark_ep_as_free(dev, addr, false); return true; } return false; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50