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
/* RETURNS: Negative if @lh_a is better than @lh_b, zero if they're equivalent, or positive if @lh_b is better than @lh_a. */
static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b)
/* RETURNS: Negative if @lh_a is better than @lh_b, zero if they're equivalent, or positive if @lh_b is better than @lh_a. */ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b)
{ struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); int diff; diff = ((b->type & DRM_MODE_TYPE_PREFERRED) != 0) - ((a->type & DRM_MODE_TYPE_PREFERRED) != 0); if (diff) return diff; diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay; if (diff) return diff; diff = b->clock - a->clock; return diff; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the boot bank to the default bank */
void cpld_set_defbank(void)
/* Set the boot bank to the default bank */ void cpld_set_defbank(void)
{ u8 reg = CPLD_READ(flash_csr); reg = (reg & ~CPLD_BANK_SEL_MASK) | CPLD_LBMAP_DFLTBANK; CPLD_WRITE(flash_csr, reg); CPLD_WRITE(reset_ctl1, CPLD_LBMAP_RESET); }
4ms/stm32mp1-baremetal
C++
Other
137
/* If the necessary clocks for the OMAP hardware IP block that corresponds to clock @clk are enabled, then wait for the module to indicate readiness (i.e., to leave IDLE). This code does not belong in the clock code and will be moved in the medium term to module-dependent code. No return value. */
static void omap2_module_wait_ready(struct clk *clk)
/* If the necessary clocks for the OMAP hardware IP block that corresponds to clock @clk are enabled, then wait for the module to indicate readiness (i.e., to leave IDLE). This code does not belong in the clock code and will be moved in the medium term to module-dependent code. No return value. */ static void omap2_module_wait_ready(struct clk *clk)
{ void __iomem *companion_reg, *idlest_reg; u8 other_bit, idlest_bit; if (clk->ops->find_companion) { clk->ops->find_companion(clk, &companion_reg, &other_bit); if (!(__raw_readl(companion_reg) & (1 << other_bit))) return; } clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit); omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), clk->name); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* translate ns.ns/10 coding of SPD timing values into 10 ps unit values */
unsigned short NS10to10PS(unsigned char spd_byte, unsigned char spd_version)
/* translate ns.ns/10 coding of SPD timing values into 10 ps unit values */ unsigned short NS10to10PS(unsigned char spd_byte, unsigned char spd_version)
{ unsigned short ns, ns10; ns = (spd_byte >> 4) & 0x0F; ns10 = (spd_byte & 0x0F); return (ns * 100 + ns10 * 10); }
EmcraftSystems/u-boot
C++
Other
181
/* Read a filesystem table (uncompressed sequence of bytes) from disk */
int squashfs_read_table(struct super_block *sb, void *buffer, u64 block, int length)
/* Read a filesystem table (uncompressed sequence of bytes) from disk */ int squashfs_read_table(struct super_block *sb, void *buffer, u64 block, int length)
{ int pages = (length + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; int i, res; void **data = kcalloc(pages, sizeof(void *), GFP_KERNEL); if (data == NULL) return -ENOMEM; for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE) data[i] = buffer; res = squashfs_read_data(sb, data, block, length | SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length, pages); kfree(data); return res; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the clock system and output the CPU clock on pin PCK0 (please refer to datasheet for PIN number). */
int main(void)
/* Initialize the clock system and output the CPU clock on pin PCK0 (please refer to datasheet for PIN number). */ int main(void)
{ struct genclk_config gcfg; sysclk_init(); board_init(); ioport_set_pin_mode(GCLK_PIN, GCLK_PIN_MUX); ioport_disable_pin(GCLK_PIN); genclk_config_defaults(&gcfg, GCLK_ID); genclk_config_set_source(&gcfg, GCLK_SOURCE); genclk_config_set_divider(&gcfg, GCLK_DIV); genclk_enable(&gcfg, GCLK_ID); while (1) { } }
memfault/zero-to-main
C++
null
200
/* Switch the clock source to 1GHz PLL from 33.333MHz oscillator on the HiFive Unleashed board. */
static int fu540_clock_init(void)
/* Switch the clock source to 1GHz PLL from 33.333MHz oscillator on the HiFive Unleashed board. */ static int fu540_clock_init(void)
{ PRCI_REG(PRCI_COREPLLCFG0) = PLL_R(0) | PLL_F(59) | PLL_Q(2) | PLL_RANGE(PLL_RANGE_33MHZ) | PLL_BYPASS(PLL_BYPASS_DISABLE) | PLL_FSE(PLL_FSE_INTERNAL); while ((PRCI_REG(PRCI_COREPLLCFG0) & PLL_LOCK(1)) == 0) ; PRCI_REG(PRCI_CORECLKSEL) = CORECLKSEL_CORECLKSEL(CORECLKSEL_CORE_PLL); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Callback function for password phrase conversion used for retrieving the encrypted PEM. */
INTN PasswordCallback(OUT CHAR8 *Buf, IN INTN Size, IN INTN Flag, IN VOID *Key)
/* Callback function for password phrase conversion used for retrieving the encrypted PEM. */ INTN PasswordCallback(OUT CHAR8 *Buf, IN INTN Size, IN INTN Flag, IN VOID *Key)
{ INTN KeyLength; ZeroMem ((VOID *)Buf, (UINTN)Size); if (Key != NULL) { KeyLength = (INTN)AsciiStrLen ((CHAR8 *)Key); KeyLength = (KeyLength > Size) ? Size : KeyLength; CopyMem (Buf, Key, (UINTN)KeyLength); return KeyLength; } else { return 0; } }
tianocore/edk2
C++
Other
4,240
/* socrates_nand_write_buf - write buffer to chip @mtd: MTD device structure @buf: data buffer @len: number of bytes to write */
static void socrates_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
/* socrates_nand_write_buf - write buffer to chip @mtd: MTD device structure @buf: data buffer @len: number of bytes to write */ static void socrates_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ int i; struct nand_chip *this = mtd->priv; struct socrates_nand_host *host = this->priv; for (i = 0; i < len; i++) { out_be32(host->io_base, FPGA_NAND_ENABLE | FPGA_NAND_CMD_WRITE | (buf[i] << FPGA_NAND_DATA_SHIFT)); } }
robutest/uclinux
C++
GPL-2.0
60
/* A task that simply scrolls a string from left to right, then back from the right to the left. This is done on the first line of the display. */
static void prvLCDTaskLine1(void *pvParameters)
/* A task that simply scrolls a string from left to right, then back from the right to the left. This is done on the first line of the display. */ static void prvLCDTaskLine1(void *pvParameters)
{ struct _LCD_Params *pxLCDParamaters = ( struct _LCD_Params * ) pvParameters; unsigned short usPosition = 0U; unsigned char ucDirection = lcdRIGHT_TO_LEFT; for( ;; ) { vTaskDelay( pxLCDParamaters->Speed / portTICK_RATE_MS ); prvDisplayNextString( pxLCDParamaters->Line, &( pxLCDParamaters->ptr_str[ usPosition ] ) ); prvScrollString( &ucDirection, &usPosition, strlen( pxLCDParamaters->ptr_str ) ); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Block UDMA on devices that cause trouble with this controller. */
static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long mask)
/* Block UDMA on devices that cause trouble with this controller. */ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long mask)
{ unsigned char model_num[ATA_ID_PROD_LEN + 1]; struct ata_device *pair = ata_dev_pair(adev); if (adev->class != ATA_DEV_ATA || adev->devno == 0 || pair == NULL) return ata_bmdma_mode_filter(adev, mask); ata_id_c_string(pair->id, model_num, ATA_ID_PROD, ATA_ID_PROD_LEN + 1); if (strstr(model_num, "Maxtor") == NULL && pair->dma_mode == XFER_UDMA_6) mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); return ata_bmdma_mode_filter(adev, mask); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
{ assert(handle != NULL); return DA7212_SetChannelVolume((da7212_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), playChannel, volume); }
eclipse-threadx/getting-started
C++
Other
310
/* Each option to be added is described in one entry of the input <args> This input must be terminated with an entry containing ARG_TABLE_ENDMARKER. */
void native_add_command_line_opts(struct args_struct_t *args)
/* Each option to be added is described in one entry of the input <args> This input must be terminated with an entry containing ARG_TABLE_ENDMARKER. */ void native_add_command_line_opts(struct args_struct_t *args)
{ int count = 0; while (args[count].option != NULL) { count++; } count++; if (used_args + count >= args_aval) { int growby = count; if (growby < ARGS_ALLOC_CHUNK_SIZE) { growby = ARGS_ALLOC_CHUNK_SIZE; } struct args_struct_t *new_args_struct = realloc(args_struct, (args_aval + growby)* sizeof(struct args_struct_t)); args_aval += growby; if (new_args_struct == NULL) { posix_print_error_and_exit("Could not allocate memory"); } else { args_struct = new_args_struct; } } memcpy(&args_struct[used_args], args, count*sizeof(struct args_struct_t)); used_args += count - 1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* netxen_nic_close - Disables a network interface entry point */
static int netxen_nic_close(struct net_device *netdev)
/* netxen_nic_close - Disables a network interface entry point */ static int netxen_nic_close(struct net_device *netdev)
{ struct netxen_adapter *adapter = netdev_priv(netdev); __netxen_nic_down(adapter, netdev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is called each second during the boot manager waits the timeout. */
VOID EFIAPI PlatformBootManagerWaitCallback(UINT16 TimeoutRemain)
/* This function is called each second during the boot manager waits the timeout. */ VOID EFIAPI PlatformBootManagerWaitCallback(UINT16 TimeoutRemain)
{ EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black; EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White; UINT16 TimeoutInitial; TimeoutInitial = PcdGet16 (PcdPlatformBootTimeOut); if (TimeoutInitial == 0) { return; } Black.Raw = 0x00000000; White.Raw = 0x00FFFFFF; BootLogoUpdateProgress ( White.Pixel, Black.Pixel, L"Start boot option", White.Pixel, (TimeoutInitial - TimeoutRemain) * 100 / TimeoutInitial, 0 ); }
tianocore/edk2
C++
Other
4,240
/* Write buf to the FCM Controller Data Buffer */
static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
/* Write buf to the FCM Controller Data Buffer */ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
{ struct nand_chip *chip = mtd->priv; struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_ctrl *ctrl = priv->ctrl; unsigned int bufsize = mtd->writesize + mtd->oobsize; if (len <= 0) { printf("write_buf of %d bytes", len); ctrl->status = 0; return; } if ((unsigned int)len > bufsize - ctrl->index) { printf("write_buf beyond end of buffer " "(%d requested, %u available)\n", len, bufsize - ctrl->index); len = bufsize - ctrl->index; } memcpy_toio(&ctrl->addr[ctrl->index], buf, len); in_8(&ctrl->addr[ctrl->index] + len - 1); ctrl->index += len; }
EmcraftSystems/u-boot
C++
Other
181
/* Returns 0 on success, -ENOMEM is there's no memory */
static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags)
/* Returns 0 on success, -ENOMEM is there's no memory */ static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags)
{ char *csp = current_security(); struct socket_smack *ssp; ssp = kzalloc(sizeof(struct socket_smack), gfp_flags); if (ssp == NULL) return -ENOMEM; ssp->smk_in = csp; ssp->smk_out = csp; ssp->smk_packet[0] = '\0'; sk->sk_security = ssp; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is the inode flushing I/O completion routine. It is called from interrupt level when the buffer containing the inode is flushed to disk. It is responsible for removing the inode item from the AIL if it has not been re-logged, and unlocking the inode's flush lock. */
void xfs_iflush_done(xfs_buf_t *bp, xfs_inode_log_item_t *iip)
/* This is the inode flushing I/O completion routine. It is called from interrupt level when the buffer containing the inode is flushed to disk. It is responsible for removing the inode item from the AIL if it has not been re-logged, and unlocking the inode's flush lock. */ void xfs_iflush_done(xfs_buf_t *bp, xfs_inode_log_item_t *iip)
{ xfs_inode_t *ip = iip->ili_inode; struct xfs_ail *ailp = iip->ili_item.li_ailp; if (iip->ili_logged && (iip->ili_item.li_lsn == iip->ili_flush_lsn)) { spin_lock(&ailp->xa_lock); if (iip->ili_item.li_lsn == iip->ili_flush_lsn) { xfs_trans_ail_delete(ailp, (xfs_log_item_t*)iip); } else { spin_unlock(&ailp->xa_lock); } } iip->ili_logged = 0; iip->ili_last_fields = 0; xfs_ifunlock(ip); return; }
robutest/uclinux
C++
GPL-2.0
60
/* Handle D+ pullup resistor, make the device visible to the usb bus, and declare it as a full speed usb device */
static void dplus_pullup(struct pxa_udc *udc, int on)
/* Handle D+ pullup resistor, make the device visible to the usb bus, and declare it as a full speed usb device */ static void dplus_pullup(struct pxa_udc *udc, int on)
{ if (on) { if (gpio_is_valid(udc->mach->gpio_pullup)) gpio_set_value(udc->mach->gpio_pullup, !udc->mach->gpio_pullup_inverted); if (udc->mach->udc_command) udc->mach->udc_command(PXA2XX_UDC_CMD_CONNECT); } else { if (gpio_is_valid(udc->mach->gpio_pullup)) gpio_set_value(udc->mach->gpio_pullup, udc->mach->gpio_pullup_inverted); if (udc->mach->udc_command) udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); } udc->pullup_on = on; }
robutest/uclinux
C++
GPL-2.0
60
/* Given the logitem, this writes the corresponding dquot entry to disk asynchronously. This is called with the dquot entry securely locked; we simply get xfs_qm_dqflush() to do the work, and unlock the dquot at the end. */
STATIC void xfs_qm_dquot_logitem_push(xfs_dq_logitem_t *logitem)
/* Given the logitem, this writes the corresponding dquot entry to disk asynchronously. This is called with the dquot entry securely locked; we simply get xfs_qm_dqflush() to do the work, and unlock the dquot at the end. */ STATIC void xfs_qm_dquot_logitem_push(xfs_dq_logitem_t *logitem)
{ xfs_dquot_t *dqp; int error; dqp = logitem->qli_dquot; ASSERT(XFS_DQ_IS_LOCKED(dqp)); ASSERT(!completion_done(&dqp->q_flush)); error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI); if (error) xfs_fs_cmn_err(CE_WARN, dqp->q_mount, "xfs_qm_dquot_logitem_push: push error %d on dqp %p", error, dqp); xfs_dqunlock(dqp); }
robutest/uclinux
C++
GPL-2.0
60
/* img_update_free: Frees the buffer allocated for storing BIOS image Always called with lock held and returned with lock held */
static void img_update_free(void)
/* img_update_free: Frees the buffer allocated for storing BIOS image Always called with lock held and returned with lock held */ static void img_update_free(void)
{ if (!rbu_data.image_update_buffer) return; memset(rbu_data.image_update_buffer, 0, rbu_data.image_update_buffer_size); if (rbu_data.dma_alloc == 1) dma_free_coherent(NULL, rbu_data.bios_image_size, rbu_data.image_update_buffer, dell_rbu_dmaaddr); else free_pages((unsigned long) rbu_data.image_update_buffer, rbu_data.image_update_ordernum); rbu_data.image_update_ordernum = -1; rbu_data.image_update_buffer = NULL; rbu_data.image_update_buffer_size = 0; rbu_data.bios_image_size = 0; rbu_data.dma_alloc = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */
UINT8* GetBufferForValue(IN EFI_HII_VALUE *Value)
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */ UINT8* GetBufferForValue(IN EFI_HII_VALUE *Value)
{ switch (Value->Type) { case EFI_IFR_TYPE_BUFFER: return Value->Buffer; case EFI_IFR_TYPE_DATE: return (UINT8 *)(&Value->Value.date); case EFI_IFR_TYPE_TIME: return (UINT8 *)(&Value->Value.time); case EFI_IFR_TYPE_REF: return (UINT8 *)(&Value->Value.ref); default: return NULL; } }
tianocore/edk2
C++
Other
4,240
/* Add a group address to the array of group addresses. The caller should make sure that no duplicated address existed in the array. */
EFI_STATUS Ip6CombineGroups(IN OUT IP6_PROTOCOL *IpInstance, IN EFI_IPv6_ADDRESS *Group)
/* Add a group address to the array of group addresses. The caller should make sure that no duplicated address existed in the array. */ EFI_STATUS Ip6CombineGroups(IN OUT IP6_PROTOCOL *IpInstance, IN EFI_IPv6_ADDRESS *Group)
{ EFI_IPv6_ADDRESS *GroupList; NET_CHECK_SIGNATURE (IpInstance, IP6_PROTOCOL_SIGNATURE); ASSERT (Group != NULL && IP6_IS_MULTICAST (Group)); IpInstance->GroupCount++; GroupList = AllocatePool (IpInstance->GroupCount * sizeof (EFI_IPv6_ADDRESS)); if (GroupList == NULL) { return EFI_OUT_OF_RESOURCES; } if (IpInstance->GroupCount > 1) { ASSERT (IpInstance->GroupList != NULL); CopyMem ( GroupList, IpInstance->GroupList, (IpInstance->GroupCount - 1) * sizeof (EFI_IPv6_ADDRESS) ); FreePool (IpInstance->GroupList); } IP6_COPY_ADDRESS (GroupList + (IpInstance->GroupCount - 1), Group); IpInstance->GroupList = GroupList; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if true, 0 if not and -1 in case of error */
int xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID)
/* Returns 1 if true, 0 if not and -1 in case of error */ int xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID)
{ if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1); if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1); if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1); } if (systemID != NULL) { if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1); if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1); if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1); } return(0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI FvSimpleFileSystemComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI FvSimpleFileSystemComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mFvSimpleFileSystemDriverNameTable, DriverName, (BOOLEAN)(This == &gFvSimpleFileSystemComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Function to do a move across file systems. */
EFI_STATUS MoveBetweenFileSystems(IN EFI_SHELL_FILE_INFO *Node, IN CONST CHAR16 *DestPath, OUT VOID **Resp)
/* Function to do a move across file systems. */ EFI_STATUS MoveBetweenFileSystems(IN EFI_SHELL_FILE_INFO *Node, IN CONST CHAR16 *DestPath, OUT VOID **Resp)
{ SHELL_STATUS ShellStatus; ShellStatus = CopySingleFile (Node->FullName, DestPath, Resp, TRUE, L"mv"); if (ShellStatus == SHELL_SUCCESS) { CascadeDelete (Node, TRUE); Node->Handle = NULL; } else if (ShellStatus == SHELL_ABORTED) { return EFI_ABORTED; } else if (ShellStatus == SHELL_ACCESS_DENIED) { return EFI_ACCESS_DENIED; } else if (ShellStatus == SHELL_VOLUME_FULL) { return EFI_VOLUME_FULL; } else { return EFI_UNSUPPORTED; } return (EFI_SUCCESS); }
tianocore/edk2
C++
Other
4,240
/* rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey @adapter: pointer to _adapter structure */
void rtw_scan_timeout_handler(_adapter *adapter)
/* rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey @adapter: pointer to _adapter structure */ void rtw_scan_timeout_handler(_adapter *adapter)
{ _irqL irqL; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; DBG_871X(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); _enter_critical_bh(&pmlmepriv->lock, &irqL); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); _exit_critical_bh(&pmlmepriv->lock, &irqL); rtw_indicate_scan_done(adapter, _TRUE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function parses the endpoint descriptor from the received buffer. */
void usb_host_parseepdesc(USB_HOST_EPDesc_TypeDef *ep_descriptor, uint8_t *buf)
/* This function parses the endpoint descriptor from the received buffer. */ void usb_host_parseepdesc(USB_HOST_EPDesc_TypeDef *ep_descriptor, uint8_t *buf)
{ ep_descriptor->bLength = buf[0]; ep_descriptor->bDescriptorType = buf[1]; ep_descriptor->bEndpointAddress = buf[2]; ep_descriptor->bmAttributes = buf[3]; ep_descriptor->wMaxPacketSize = SMALL_END(&buf[4]); ep_descriptor->bInterval = buf[6]; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 6.. FMS Generic Initiate Download Sequence (Confirmed Service Id = 31) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_generic_init_download_sequence_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Generic Initiate Download Sequence (Confirmed Service Id = 31) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_generic_init_download_sequence_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Generic Initiate Download Sequence Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_gen_init_download_seq_req, NULL, "FMS Generic Initiate Download Sequence Request"); proto_tree_add_item(sub_tree, hf_ff_fms_gen_init_download_seq_req_idx, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; if (length) { proto_tree_add_item(sub_tree, hf_ff_unknown_data, tvb, offset, length, ENC_NA); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeEthernetMII(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeEthernetMII(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Retrieve HII package list from ImageHandle and publish to HII database. */
STATIC EFI_HII_HANDLE InitializeHiiPackage(EFI_HANDLE ImageHandle)
/* Retrieve HII package list from ImageHandle and publish to HII database. */ STATIC EFI_HII_HANDLE InitializeHiiPackage(EFI_HANDLE ImageHandle)
{ EFI_STATUS Status; EFI_HII_PACKAGE_LIST_HEADER *PackageList; EFI_HII_HANDLE HiiHandle; Status = gBS->OpenProtocol ( ImageHandle, &gEfiHiiPackageListProtocolGuid, (VOID **)&PackageList, ImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { return NULL; } Status = gHiiDatabase->NewPackageList ( gHiiDatabase, PackageList, NULL, &HiiHandle ); ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) { return NULL; } return HiiHandle; }
tianocore/edk2
C++
Other
4,240
/* \method period() Get or set the period of the timer. */
STATIC mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args)
/* \method period() Get or set the period of the timer. */ STATIC mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args)
{ return mp_obj_new_int(__HAL_TIM_GET_AUTORELOAD(&self->tim) & TIMER_CNT_MASK(self)); } else { __HAL_TIM_SET_AUTORELOAD(&self->tim, mp_obj_get_int(args[1]) & TIMER_CNT_MASK(self)); return mp_const_none; } }
micropython/micropython
C++
Other
18,334
/* Converts a text device path node to USB Print device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbPrinter(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB Print device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbPrinter(IN CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_PRINTER; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* tipc_nametbl_withdraw - withdraw name publication from network name tables */
int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
/* tipc_nametbl_withdraw - withdraw name publication from network name tables */ int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
{ struct publication *publ; dbg("tipc_nametbl_withdraw: {%u,%u}, key=%u\n", type, lower, key); write_lock_bh(&tipc_nametbl_lock); publ = tipc_nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); if (likely(publ)) { table.local_publ_count--; if (publ->scope != TIPC_NODE_SCOPE) tipc_named_withdraw(publ); write_unlock_bh(&tipc_nametbl_lock); list_del_init(&publ->pport_list); kfree(publ); return 1; } write_unlock_bh(&tipc_nametbl_lock); err("Unable to remove local publication\n" "(type=%u, lower=%u, ref=%u, key=%u)\n", type, lower, ref, key); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function runs background commit if it is needed. Returns zero in case of success and a negative error code in case of failure. */
static int run_bg_commit(struct ubifs_info *c)
/* This function runs background commit if it is needed. Returns zero in case of success and a negative error code in case of failure. */ static int run_bg_commit(struct ubifs_info *c)
{ spin_lock(&c->cs_lock); if (c->cmt_state != COMMIT_BACKGROUND && c->cmt_state != COMMIT_REQUIRED) goto out; spin_unlock(&c->cs_lock); down_write(&c->commit_sem); spin_lock(&c->cs_lock); if (c->cmt_state == COMMIT_REQUIRED) c->cmt_state = COMMIT_RUNNING_REQUIRED; else if (c->cmt_state == COMMIT_BACKGROUND) c->cmt_state = COMMIT_RUNNING_BACKGROUND; else goto out_cmt_unlock; spin_unlock(&c->cs_lock); return do_commit(c); out_cmt_unlock: up_write(&c->commit_sem); out: spin_unlock(&c->cs_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* spider_net_enable_rxdmac enables the DMA controller by setting RX_DMA_EN in the GDADMACCNTR register */
static void spider_net_enable_rxdmac(struct spider_net_card *card)
/* spider_net_enable_rxdmac enables the DMA controller by setting RX_DMA_EN in the GDADMACCNTR register */ static void spider_net_enable_rxdmac(struct spider_net_card *card)
{ wmb(); spider_net_write_reg(card, SPIDER_NET_GDADMACCNTR, SPIDER_NET_DMA_RX_VALUE); }
robutest/uclinux
C++
GPL-2.0
60
/* The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec value to a scaled second value. */
unsigned long timespec_to_jiffies(const struct timespec *value)
/* The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec value to a scaled second value. */ unsigned long timespec_to_jiffies(const struct timespec *value)
{ unsigned long sec = value->tv_sec; long nsec = value->tv_nsec + TICK_NSEC - 1; if (sec >= MAX_SEC_IN_JIFFIES){ sec = MAX_SEC_IN_JIFFIES; nsec = 0; } return (((u64)sec * SEC_CONVERSION) + (((u64)nsec * NSEC_CONVERSION) >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TLB invalidation function which is called from the mapping functions. It invalidates a single PTE if the range to flush is within a single page. Otherwise it flushes the whole TLB of the IOMMU. */
static void __iommu_flush_pages(struct protection_domain *domain, u64 address, size_t size, int pde)
/* TLB invalidation function which is called from the mapping functions. It invalidates a single PTE if the range to flush is within a single page. Otherwise it flushes the whole TLB of the IOMMU. */ static void __iommu_flush_pages(struct protection_domain *domain, u64 address, size_t size, int pde)
{ int s = 0, i; unsigned long pages = iommu_num_pages(address, size, PAGE_SIZE); address &= PAGE_MASK; if (pages > 1) { address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS; s = 1; } for (i = 0; i < amd_iommus_present; ++i) { if (!domain->dev_iommu[i]) continue; iommu_queue_inv_iommu_pages(amd_iommus[i], address, domain->id, pde, s); } return; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handles speed and duplex options on fiber adapters */
static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter)
/* Handles speed and duplex options on fiber adapters */ static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter)
{ int bd = adapter->bd_number; if (num_Speed > bd) { DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " "parameter ignored\n"); } if (num_Duplex > bd) { DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " "parameter ignored\n"); } if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " "not valid for fiber adapters, " "parameter ignored\n"); } }
robutest/uclinux
C++
GPL-2.0
60
/* Drive the slave select line NSS (RTS pin) to 0 in SPI master mode. */
void usart_spi_force_chip_select(Usart *p_usart)
/* Drive the slave select line NSS (RTS pin) to 0 in SPI master mode. */ void usart_spi_force_chip_select(Usart *p_usart)
{ p_usart->US_CR = US_CR_FCS; }
remotemcu/remcu-chip-sdks
C++
null
436
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciSegmentBitFieldAndThenOr8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciSegmentBitFieldAndThenOr8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
{ return PciSegmentWrite8 ( Address, BitFieldAndThenOr8 (PciSegmentRead8 (Address), StartBit, EndBit, AndData, OrData) ); }
tianocore/edk2
C++
Other
4,240
/* Erase All FLASH This performs all operations necessary to erase all sectors in the FLASH memory. */
void flash_erase_all_sectors(void)
/* Erase All FLASH This performs all operations necessary to erase all sectors in the FLASH memory. */ void flash_erase_all_sectors(void)
{ flash_wait_for_last_operation(); FLASH_CR |= FLASH_CR_MER1 | FLASH_CR_MER2; FLASH_CR |= FLASH_CR_START; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_MER1 & ~FLASH_CR_MER2; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Inform application whether a autoreload match interrupt has occured. @rmtoll ISR ARRM LPTIM_IsActiveFlag_ARRM. */
uint32_t LPTIM_IsActiveFlag_ARRM(LPTIM_Module *LPTIMx)
/* Inform application whether a autoreload match interrupt has occured. @rmtoll ISR ARRM LPTIM_IsActiveFlag_ARRM. */ uint32_t LPTIM_IsActiveFlag_ARRM(LPTIM_Module *LPTIMx)
{ return (((READ_BIT(LPTIMx->INTSTS,LPTIM_INTSTS_ARRM) ==LPTIM_INTSTS_ARRM)? 1UL : 0UL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Reads one byte from the supplied address. This function will read one byte starting at the supplied address. */
mcp24aaError_e mcp24aaReadByte(uint16_t address, uint8_t *buffer)
/* Reads one byte from the supplied address. This function will read one byte starting at the supplied address. */ mcp24aaError_e mcp24aaReadByte(uint16_t address, uint8_t *buffer)
{ if (!_mcp24aaInitialised) mcp24aaInit(); return mcp24aaReadBuffer(address, buffer, 1); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Receive a sequence of bytes from USART device. */
status_code_t usart_serial_read_packet(usart_if usart, uint8_t *data, size_t len)
/* Receive a sequence of bytes from USART device. */ status_code_t usart_serial_read_packet(usart_if usart, uint8_t *data, size_t len)
{ while (len) { usart_serial_getchar(usart, data); len--; data++; } return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Returns the index of the first menuitem that starts with the key parameter. */
static int menu_key_find_first(const menu_t *menu, const char *key)
/* Returns the index of the first menuitem that starts with the key parameter. */ static int menu_key_find_first(const menu_t *menu, const char *key)
{ int menuitem_found = MenuKeyFindNone; int menu_size = menu_get_size(menu); int index = 0; for (index = 0; index < menu_size; ++index) { if (menu->menuitems[index].key == NULL) continue; if (strncasecmp(key, menu->menuitems[index].key, strlen(key)) == 0) { menuitem_found = index; break; } } return menuitem_found; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note that this filter uses CRC16 rather than CRC32 as used in frame checksums. */
void EMACRemoteWakeUpFrameFilterGet(uint32_t ui32Base, tEMACWakeUpFrameFilter *pFilter)
/* Note that this filter uses CRC16 rather than CRC32 as used in frame checksums. */ void EMACRemoteWakeUpFrameFilterGet(uint32_t ui32Base, tEMACWakeUpFrameFilter *pFilter)
{ uint32_t *pui32Data; uint32_t ui32Loop; ASSERT(ui32Base == EMAC0_BASE); ASSERT(pFilter); HWREG(ui32Base + EMAC_O_PMTCTLSTAT) |= EMAC_PMTCTLSTAT_WUPFRRST; pui32Data = (uint32_t *)pFilter; for (ui32Loop = 0; ui32Loop < 8; ui32Loop++) { pui32Data[ui32Loop] = HWREG(ui32Base + EMAC_O_RWUFF); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the number of words already pushed into the IN FIFO. */
uint8_t HASH_GetInFIFOWordsNbr(void)
/* Returns the number of words already pushed into the IN FIFO. */ uint8_t HASH_GetInFIFOWordsNbr(void)
{ return ((HASH->CR & HASH_CR_NBW) >> 8); }
MaJerle/stm32f429
C++
null
2,036
/* Converts a text device path node to USB IRDA bridge device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbIrdaBridge(CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB IRDA bridge device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbIrdaBridge(CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_RESERVE; UsbClassText.SubClassExist = FALSE; UsbClassText.SubClass = USB_SUBCLASS_IRDA_BRIDGE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* restore_time_delta - Restore the current system time @delta: delta returned by save_time_delta() @rtc: pointer to timespec for current RTC time */
void restore_time_delta(struct timespec *delta, struct timespec *rtc)
/* restore_time_delta - Restore the current system time @delta: delta returned by save_time_delta() @rtc: pointer to timespec for current RTC time */ void restore_time_delta(struct timespec *delta, struct timespec *rtc)
{ struct timespec ts; set_normalized_timespec(&ts, delta->tv_sec + rtc->tv_sec, delta->tv_nsec + rtc->tv_nsec); do_settimeofday(&ts); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns zero in case of success and a negative error code in case of failure. */
int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum)
/* This function returns zero in case of success and a negative error code in case of failure. */ int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum)
{ int err; struct mtd_info *mtd = ubi->mtd; ubi_assert(pnum >= 0 && pnum < ubi->peb_count); if (ubi->ro_mode) { ubi_err(ubi, "read-only mode"); return -EROFS; } if (!ubi->bad_allowed) return 0; err = mtd_block_markbad(mtd, (loff_t)pnum * ubi->peb_size); if (err) ubi_err(ubi, "cannot mark PEB %d bad, error %d", pnum, err); return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configures polarity of the Timer channel x. The */
void TimerCHPolarityConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulPolarity)
/* Configures polarity of the Timer channel x. The */ void TimerCHPolarityConfigure(unsigned long ulBase, unsigned long ulChannel, unsigned long ulPolarity)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulChannel == TIMER_CH_0) || (ulChannel == TIMER_CH_1) || (ulChannel == TIMER_CH_2) || (ulChannel == TIMER_CH_3)); xASSERT((ulPolarity == TIMER_CHP_NONINVERTED) || (ulPolarity == TIMER_CHP_INVERTED)); xHWREG(ulBase + TIMER_CHPOLR) &= ~(1 << (ulChannel * 2) ); xHWREG(ulBase + TIMER_CHPOLR) |= ulPolarity << (ulChannel * 2); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function handles DMA2 Stream 6 interrupt request. */
void DMA2_Stream6_IRQHandler(void)
/* This function handles DMA2 Stream 6 interrupt request. */ void DMA2_Stream6_IRQHandler(void)
{ HAL_DMA_IRQHandler(uSdHandle.hdmatx); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_get_connection_unix_process_id(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint pid)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_get_connection_unix_process_id(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, guint pid)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", pid)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped. */
STATIC EFI_STATUS EFIAPI FdtGetNextCondNode(IN CONST VOID *Fdt, IN OUT INT32 *Node, IN OUT INT32 *Depth, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context)
/* The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped. */ STATIC EFI_STATUS EFIAPI FdtGetNextCondNode(IN CONST VOID *Fdt, IN OUT INT32 *Node, IN OUT INT32 *Depth, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context)
{ INT32 CurrNode; if ((Fdt == NULL) || (Node == NULL) || (Depth == NULL) || (NodeChecker == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } CurrNode = *Node; do { CurrNode = fdt_next_node (Fdt, CurrNode, Depth); if ((CurrNode == -FDT_ERR_NOTFOUND) || (*Depth < 0)) { return EFI_NOT_FOUND; } else if (CurrNode < 0) { ASSERT (0); return EFI_ABORTED; } } while (!NodeChecker (Fdt, CurrNode, Context)); *Node = CurrNode; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns: TRUE if the mounts have changed since @time. */
gboolean g_unix_mounts_changed_since(guint64 time)
/* Returns: TRUE if the mounts have changed since @time. */ gboolean g_unix_mounts_changed_since(guint64 time)
{ return get_mounts_timestamp () != time; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base SPC peripheral base address. param config Pointer to spc_core_voltage_detect_config_t structure. */
void SPC_SetCoreVoltageDetectConfig(SPC_Type *base, const spc_core_voltage_detect_config_t *config)
/* param base SPC peripheral base address. param config Pointer to spc_core_voltage_detect_config_t structure. */ void SPC_SetCoreVoltageDetectConfig(SPC_Type *base, const spc_core_voltage_detect_config_t *config)
{ assert(config != NULL); uint32_t reg = 0UL; reg |= (config->option.HVDInterruptEnable) ? SPC_VD_CORE_CFG_HVDIE(1U) : SPC_VD_CORE_CFG_HVDIE(0U); reg |= (config->option.LVDInterruptEnable) ? SPC_VD_CORE_CFG_LVDIE(1U) : SPC_VD_CORE_CFG_LVDIE(0U); reg |= (config->option.HVDResetEnable) ? SPC_VD_CORE_CFG_HVDRE(1U) : SPC_VD_CORE_CFG_HVDRE(0U); reg |= (config->option.LVDResetEnable) ? SPC_VD_CORE_CFG_LVDRE(1U) : SPC_VD_CORE_CFG_LVDRE(0U); base->VD_CORE_CFG = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Output: void, but we will add to proto tree if !NULL. */
static void dissect_lsp_mt_reachable_IPv4_prefx_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
/* Output: void, but we will add to proto tree if !NULL. */ static void dissect_lsp_mt_reachable_IPv4_prefx_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
{ if (length < 2) { proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_packet, tvb, offset, -1, "short lsp multi-topology reachable IPv4 prefixes(%d vs %d)", length, 2 ); return; } dissect_lsp_mt_id(tvb, tree, offset); dissect_lsp_ext_ip_reachability_clv(tvb, pinfo, tree, offset+2, 0, length-2); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disable the Low Speed APB (APB1) peripheral clock. */
void RCM_DisableAPB1PeriphClock(uint32_t APB1Periph)
/* Disable the Low Speed APB (APB1) peripheral clock. */ void RCM_DisableAPB1PeriphClock(uint32_t APB1Periph)
{ RCM->APBCLKEN1 &= (uint32_t)~APB1Periph; }
pikasTech/PikaPython
C++
MIT License
1,403
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */
void FLEXIO_UART_TransferStopRingBuffer(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */ void FLEXIO_UART_TransferStopRingBuffer(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle)
{ assert(handle != NULL); if (handle->rxState == (uint8_t)kFLEXIO_UART_RxIdle) { FLEXIO_UART_DisableInterrupts(base, (uint32_t)kFLEXIO_UART_RxDataRegFullInterruptEnable); } handle->rxRingBuffer = NULL; handle->rxRingBufferSize = 0U; handle->rxRingBufferHead = 0U; handle->rxRingBufferTail = 0U; }
eclipse-threadx/getting-started
C++
Other
310
/* Assumes that SGE is stopped and all interrupts are disabled. */
static void free_tx_resources(struct sge *sge)
/* Assumes that SGE is stopped and all interrupts are disabled. */ static void free_tx_resources(struct sge *sge)
{ struct pci_dev *pdev = sge->adapter->pdev; unsigned int size, i; for (i = 0; i < SGE_CMDQ_N; i++) { struct cmdQ *q = &sge->cmdQ[i]; if (q->centries) { if (q->in_use) free_cmdQ_buffers(sge, q, q->in_use); kfree(q->centries); } if (q->entries) { size = sizeof(struct cmdQ_e) * q->size; pci_free_consistent(pdev, size, q->entries, q->dma_addr); } } }
robutest/uclinux
C++
GPL-2.0
60
/* Remove a Radio Controller; stop beaconing/scanning, disconnect all children */
void uwb_rc_rm(struct uwb_rc *rc)
/* Remove a Radio Controller; stop beaconing/scanning, disconnect all children */ void uwb_rc_rm(struct uwb_rc *rc)
{ rc->ready = 0; uwb_dbg_del_rc(rc); uwb_rsv_remove_all(rc); uwb_radio_shutdown(rc); rc->stop(rc); uwbd_stop(rc); uwb_rc_neh_destroy(rc); uwb_dev_lock(&rc->uwb_dev); rc->priv = NULL; rc->cmd = NULL; uwb_dev_unlock(&rc->uwb_dev); mutex_lock(&rc->uwb_beca.mutex); uwb_dev_for_each(rc, uwb_dev_offair_helper, NULL); __uwb_rc_sys_rm(rc); mutex_unlock(&rc->uwb_beca.mutex); uwb_rsv_cleanup(rc); uwb_beca_release(rc); uwb_dev_rm(&rc->uwb_dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the TIMx's Hall sensor interface. */
void TIM_SelectHallSensor(TIM_Module *TIMx, FunctionalState Cmd)
/* Enables or disables the TIMx's Hall sensor interface. */ void TIM_SelectHallSensor(TIM_Module *TIMx, FunctionalState Cmd)
{ assert_param(IsTimList6Module(TIMx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { TIMx->CTRL2 |= TIM_CTRL2_TI1SEL; } else { TIMx->CTRL2 &= (uint32_t) ~((uint32_t)TIM_CTRL2_TI1SEL); } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Wait for PXP controller IRQ interrupt inside timeout time. */
static void pxp_proc_timeout(int time)
/* Wait for PXP controller IRQ interrupt inside timeout time. */ static void pxp_proc_timeout(int time)
{ while (HW_PXP_STAT.B.IRQ == 0) { time--; if (time == 0) break; }; HW_PXP_STAT.B.IRQ = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Start the PWM of the PWM module. The */
void PWMStart(unsigned long ulBase, unsigned long ulChannel)
/* Start the PWM of the PWM module. The */ void PWMStart(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT(ulBase == PWMA_BASE); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_PCR) |= (PWM_PCR_CH0EN << (ulChannelTemp << 3)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns: Current state of the device according to its driver. */
enum wimax_st wimax_state_get(struct wimax_dev *wimax_dev)
/* Returns: Current state of the device according to its driver. */ enum wimax_st wimax_state_get(struct wimax_dev *wimax_dev)
{ enum wimax_st state; mutex_lock(&wimax_dev->mutex); state = wimax_dev->state; mutex_unlock(&wimax_dev->mutex); return state; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* We only cache a small number of extents stored directly on the inode, so linear order operations are acceptable. If we ever want to increase the size of the extent map, then these algorithms must get smarter. */
void ocfs2_extent_map_init(struct inode *inode)
/* We only cache a small number of extents stored directly on the inode, so linear order operations are acceptable. If we ever want to increase the size of the extent map, then these algorithms must get smarter. */ void ocfs2_extent_map_init(struct inode *inode)
{ struct ocfs2_inode_info *oi = OCFS2_I(inode); oi->ip_extent_map.em_num_items = 0; INIT_LIST_HEAD(&oi->ip_extent_map.em_list); }
robutest/uclinux
C++
GPL-2.0
60
/* Check whether the EFI key buffer is empty. */
BOOLEAN IsEfikeyBufEmpty(IN EFI_KEY_QUEUE *Queue)
/* Check whether the EFI key buffer is empty. */ BOOLEAN IsEfikeyBufEmpty(IN EFI_KEY_QUEUE *Queue)
{ return (BOOLEAN)(Queue->Head == Queue->Tail); }
tianocore/edk2
C++
Other
4,240
/* Function called from USART IRQ Handler when RXNE flag is set Function is in charge of reading character received on USART RX line. */
void USART_CharReception_Callback(void)
/* Function called from USART IRQ Handler when RXNE flag is set Function is in charge of reading character received on USART RX line. */ void USART_CharReception_Callback(void)
{ uint8_t *ptemp; pBufferReadyForReception[uwNbReceivedChars++] = LL_USART_ReceiveData8(USARTx_INSTANCE); if (uwNbReceivedChars >= RX_BUFFER_SIZE) { uwBufferReadyIndication = 1; ptemp = pBufferReadyForUser; pBufferReadyForUser = pBufferReadyForReception; pBufferReadyForReception = ptemp; uwNbReceivedChars = 0; } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Enable I2C interrupt of the specified I2C port. The */
void xI2CMasterIntEnable(unsigned long ulBase, unsigned long ulIntType)
/* Enable I2C interrupt of the specified I2C port. The */ void xI2CMasterIntEnable(unsigned long ulBase, unsigned long ulIntType)
{ xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_CON) |= I2C_CON_EI; xIntEnable(xINT_I2C0); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Retrieve a frame from the receive FIFO TO-DO: support frames of size != 8 */
static void spi_a2f_hw_rxfifo_get(struct spi_a2f *c, unsigned int wb, void *rx, int i)
/* Retrieve a frame from the receive FIFO TO-DO: support frames of size != 8 */ static void spi_a2f_hw_rxfifo_get(struct spi_a2f *c, unsigned int wb, void *rx, int i)
{ int j; unsigned int d = readl(&MSS_SPI(c)->spi_rx_data); unsigned char *p = (unsigned char *)rx; if (p) { for (j = wb-1; j >= 0; j--) { p[i*wb + j] = d & 0xFF; d >>= 8; } } }
robutest/uclinux
C++
GPL-2.0
60
/* This function will init led on the board */
static void rt_hw_board_led_init(void)
/* This function will init led on the board */ static void rt_hw_board_led_init(void)
{ *(RP)GPIO_PORTE_SEL |=0x38; *(RP)GPIO_PORTE_DIR &= ~0x38; *(RP)GPIO_PORTE_DATA &= ~0x38; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Resume a socket. If a card is present, verify its CIS against our cached copy. If they are different, the card has been replaced, and we need to tell the drivers. */
static int socket_resume(struct pcmcia_socket *skt)
/* Resume a socket. If a card is present, verify its CIS against our cached copy. If they are different, the card has been replaced, and we need to tell the drivers. */ static int socket_resume(struct pcmcia_socket *skt)
{ if (!(skt->state & SOCKET_SUSPEND)) return -EBUSY; socket_early_resume(skt); return socket_late_resume(skt); }
robutest/uclinux
C++
GPL-2.0
60
/* Map errors cl_cons_state errors to EPROTONOSUPPORT to indicate other versions of NFS can be tried. */
int nfs4_check_client_ready(struct nfs_client *clp)
/* Map errors cl_cons_state errors to EPROTONOSUPPORT to indicate other versions of NFS can be tried. */ int nfs4_check_client_ready(struct nfs_client *clp)
{ if (!nfs4_has_session(clp)) return 0; if (clp->cl_cons_state < NFS_CS_READY) return -EPROTONOSUPPORT; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from */
UINT64 EFIAPI GetPerformanceCounter(VOID)
/* The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from */ UINT64 EFIAPI GetPerformanceCounter(VOID)
{ EMU_THUNK_PPI *ThunkPpi; EFI_STATUS Status; EMU_THUNK_PROTOCOL *Thunk; Status = PeiServicesLocatePpi ( &gEmuThunkPpiGuid, 0, NULL, (VOID **)&ThunkPpi ); if (!EFI_ERROR (Status)) { Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk (); return Thunk->QueryPerformanceCounter (); } return 0; }
tianocore/edk2
C++
Other
4,240
/* HID class driver callback function for the processing of HID reports from the host. */
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize)
/* HID class driver callback function for the processing of HID reports from the host. */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize)
{ uint8_t LEDMask = LEDS_NO_LEDS; uint8_t* LEDReport = (uint8_t*)ReportData; if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK) LEDMask |= LEDS_LED1; if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK) LEDMask |= LEDS_LED3; if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK) LEDMask |= LEDS_LED4; LEDs_SetAllLEDs(LEDMask); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Dissects an SMB_FILE_ATTRIBUTES, to use the term given to it by section 2.2.1.2.4 of , in cases where it's just file attributes, not search attributes. */
static int dissect_file_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
/* Dissects an SMB_FILE_ATTRIBUTES, to use the term given to it by section 2.2.1.2.4 of , in cases where it's just file attributes, not search attributes. */ static int dissect_file_attributes(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{ static const int * flags[] = { &hf_smb_file_attr_archive_16bit, &hf_smb_file_attr_directory_16bit, &hf_smb_file_attr_volume_16bit, &hf_smb_file_attr_system_16bit, &hf_smb_file_attr_hidden_16bit, &hf_smb_file_attr_read_only_16bit, NULL }; proto_tree_add_bitmask(parent_tree, tvb, offset, hf_smb_file_attr_16bit, ett_smb_file_attributes, flags, ENC_LITTLE_ENDIAN); offset += 2; return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Convert a signed 32-bit integer to a signed n-bit integer. */
static u32 s32ton(__s32 value, unsigned n)
/* Convert a signed 32-bit integer to a signed n-bit integer. */ static u32 s32ton(__s32 value, unsigned n)
{ s32 a = value >> (n - 1); if (a && a != -1) return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1; return value & ((1 << n) - 1); }
robutest/uclinux
C++
GPL-2.0
60
/* find an head entry based on bytenr. This returns the delayed ref head if it was able to find one, or NULL if nothing was in that spot */
static struct btrfs_delayed_ref_node* find_ref_head(struct rb_root *root, u64 bytenr, struct btrfs_delayed_ref_node **last)
/* find an head entry based on bytenr. This returns the delayed ref head if it was able to find one, or NULL if nothing was in that spot */ static struct btrfs_delayed_ref_node* find_ref_head(struct rb_root *root, u64 bytenr, struct btrfs_delayed_ref_node **last)
{ struct rb_node *n = root->rb_node; struct btrfs_delayed_ref_node *entry; int cmp; while (n) { entry = rb_entry(n, struct btrfs_delayed_ref_node, rb_node); WARN_ON(!entry->in_tree); if (last) *last = entry; if (bytenr < entry->bytenr) cmp = -1; else if (bytenr > entry->bytenr) cmp = 1; else if (!btrfs_delayed_ref_is_head(entry)) cmp = 1; else cmp = 0; if (cmp < 0) n = n->rb_left; else if (cmp > 0) n = n->rb_right; else return entry; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* program a half word at the corresponding address */
fmc_state_enum fmc_halfword_program(uint32_t address, uint16_t data)
/* program a half word at the corresponding address */ fmc_state_enum fmc_halfword_program(uint32_t address, uint16_t data)
{ fmc_state_enum fmc_state = fmc_ready_wait(FMC_TIMEOUT_COUNT); if(FMC_READY == fmc_state){ FMC_CTL |= FMC_CTL_PG; REG16(address) = data; fmc_state = fmc_ready_wait(FMC_TIMEOUT_COUNT); FMC_CTL &= ~FMC_CTL_PG; } return fmc_state; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Returns third word of the unique device identifier (UID based on 96 bits) */
uint32_t HAL_GetUIDw2(void)
/* Returns third word of the unique device identifier (UID based on 96 bits) */ uint32_t HAL_GetUIDw2(void)
{ return (READ_REG(*((uint32_t *)(UID_BASE + 8U)))); }
ua1arn/hftrx
C++
null
69
/* Output an ACK to the NVRAM after reading, change GPIO0 to output and when done back to an input */
static void S24C16_write_ack(struct sym_device *np, u_char write_bit, u_char *gpreg, u_char *gpcntl)
/* Output an ACK to the NVRAM after reading, change GPIO0 to output and when done back to an input */ static void S24C16_write_ack(struct sym_device *np, u_char write_bit, u_char *gpreg, u_char *gpcntl)
{ OUTB(np, nc_gpcntl, *gpcntl & 0xfe); S24C16_do_bit(np, NULL, write_bit, gpreg); OUTB(np, nc_gpcntl, *gpcntl); }
robutest/uclinux
C++
GPL-2.0
60
/* How many bytes of buffer space are used. Needs to be called with bufferlock held. */
static int dasd_eer_get_filled_bytes(struct eerbuffer *eerb)
/* How many bytes of buffer space are used. Needs to be called with bufferlock held. */ static int dasd_eer_get_filled_bytes(struct eerbuffer *eerb)
{ if (eerb->head >= eerb->tail) return eerb->head - eerb->tail; return eerb->buffersize - eerb->tail + eerb->head; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified USART flag is set or not. */
FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint16_t USART_FLAG)
/* Checks whether the specified USART flag is set or not. */ FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint16_t USART_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_USART_FLAG(USART_FLAG)); if (USART_FLAG == USART_FLAG_CTS) { assert_param(IS_USART_1236_PERIPH(USARTx)); } if ((USARTx->SR & USART_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
MaJerle/stm32f429
C++
null
2,036
/* Parameter: card = pointer to card struct. loc = location: 0 = local, 1 = remote. cau = cause: 1 = busy, 2 = nonexistent callerid, 3 = no user responding. Return: Pointer to buffer containing the assembled message. */
static char* isdnloop_unicause(isdnloop_card *card, int loc, int cau)
/* Parameter: card = pointer to card struct. loc = location: 0 = local, 1 = remote. cau = cause: 1 = busy, 2 = nonexistent callerid, 3 = no user responding. Return: Pointer to buffer containing the assembled message. */ static char* isdnloop_unicause(isdnloop_card *card, int loc, int cau)
{ static char buf[6]; switch (card->ptype) { case ISDN_PTYPE_EURO: sprintf(buf, "E%02X%02X", (loc) ? 4 : 2, ctable_eu[cau]); break; case ISDN_PTYPE_1TR6: sprintf(buf, "%02X44", ctable_1t[cau]); break; default: return ("0000"); } return (buf); }
robutest/uclinux
C++
GPL-2.0
60
/* If Sha256Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
/* If Sha256Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
{ CALL_CRYPTO_SERVICE (Sha256Final, (Sha256Context, HashValue), FALSE); }
tianocore/edk2
C++
Other
4,240
/* If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT8* EFIAPI S3MmioReadBuffer8(IN UINTN StartAddress, IN UINTN Length, OUT UINT8 *Buffer)
/* If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ UINT8* EFIAPI S3MmioReadBuffer8(IN UINTN StartAddress, IN UINTN Length, OUT UINT8 *Buffer)
{ UINT8 *ReturnBuffer; RETURN_STATUS Status; ReturnBuffer = MmioReadBuffer8 (StartAddress, Length, Buffer); Status = S3BootScriptSaveMemWrite ( S3BootScriptWidthUint8, StartAddress, Length / sizeof (UINT8), ReturnBuffer ); ASSERT (Status == RETURN_SUCCESS); return ReturnBuffer; }
tianocore/edk2
C++
Other
4,240
/* Determines whether the UART transmitter is busy or not. */
tBoolean UARTBusy(unsigned long ulBase)
/* Determines whether the UART transmitter is busy or not. */ tBoolean UARTBusy(unsigned long ulBase)
{ ASSERT(UARTBaseValid(ulBase)); return((HWREG(ulBase + UART_O_FR) & UART_FR_BUSY) ? true : false); }
watterott/WebRadio
C++
null
71
/* Allocate a RDS message containing a congestion update. */
struct rds_message* rds_cong_update_alloc(struct rds_connection *conn)
/* Allocate a RDS message containing a congestion update. */ struct rds_message* rds_cong_update_alloc(struct rds_connection *conn)
{ struct rds_cong_map *map = conn->c_lcong; struct rds_message *rm; rm = rds_message_map_pages(map->m_page_addrs, RDS_CONG_MAP_BYTES); if (!IS_ERR(rm)) rm->m_inc.i_hdr.h_flags = RDS_FLAG_CONG_BITMAP; return rm; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable the SPI interrupt of the specified SPI port. */
void SPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
/* Enable the SPI interrupt of the specified SPI port. */ void SPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_IE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check if DMA channel is the flow controller. */
static int DmaIsFlowController(void *pDescriptor)
/* Check if DMA channel is the flow controller. */ static int DmaIsFlowController(void *pDescriptor)
{ uint32_t ttfc = (dmacHw_GET_DESC_RING(pDescriptor))->pTail->ctl. lo & dmacHw_REG_CTL_TTFC_MASK; switch (ttfc) { case dmacHw_REG_CTL_TTFC_MM_DMAC: case dmacHw_REG_CTL_TTFC_MP_DMAC: case dmacHw_REG_CTL_TTFC_PM_DMAC: case dmacHw_REG_CTL_TTFC_PP_DMAC: return 1; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the data size for the selected SPI. */
void SPI_ConfigDataLen(SPI_Module *SPIx, uint16_t DataLen)
/* Configures the data size for the selected SPI. */ void SPI_ConfigDataLen(SPI_Module *SPIx, uint16_t DataLen)
{ assert_param(IS_SPI_PERIPH(SPIx)); assert_param(IS_SPI_DATASIZE(DataLen)); SPIx->CTRL1 &= (uint16_t)~SPI_DATA_SIZE_16BITS; SPIx->CTRL1 |= DataLen; }
pikasTech/PikaPython
C++
MIT License
1,403
/* initialize TIMER channel output parameter struct with a default value */
void timer_channel_output_struct_para_init(timer_oc_parameter_struct *ocpara)
/* initialize TIMER channel output parameter struct with a default value */ void timer_channel_output_struct_para_init(timer_oc_parameter_struct *ocpara)
{ ocpara->outputstate = (uint16_t)TIMER_CCX_DISABLE; ocpara->outputnstate = TIMER_CCXN_DISABLE; ocpara->ocpolarity = TIMER_OC_POLARITY_HIGH; ocpara->ocnpolarity = TIMER_OCN_POLARITY_HIGH; ocpara->ocidlestate = TIMER_OC_IDLE_STATE_LOW; ocpara->ocnidlestate = TIMER_OCN_IDLE_STATE_LOW; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Scheduler clock - returns current time in nanosec units. */
u64 native_sched_clock(void)
/* Scheduler clock - returns current time in nanosec units. */ u64 native_sched_clock(void)
{ u64 this_offset; if (unlikely(tsc_disabled)) { return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); } rdtscll(this_offset); return __cycles_2_ns(this_offset); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set a default value for TMR2 initialization structure. */
int32_t TMR2_StructInit(stc_tmr2_init_t *pstcTmr2Init)
/* Set a default value for TMR2 initialization structure. */ int32_t TMR2_StructInit(stc_tmr2_init_t *pstcTmr2Init)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (pstcTmr2Init != NULL) { pstcTmr2Init->u32ClockSrc = TMR2_CLK_PCLK1; pstcTmr2Init->u32ClockDiv = TMR2_CLK_DIV1; pstcTmr2Init->u32Func = TMR2_FUNC_CMP; pstcTmr2Init->u32CompareValue = 0xFFFFUL; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called by ZCL foundation dissector in order to decode */
static void dissect_zcl_ias_zone_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
/* This function is called by ZCL foundation dissector in order to decode */ static void dissect_zcl_ias_zone_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
{ switch (attr_id) { case ZBEE_ZCL_ATTR_ID_IAS_ZONE_STATE: proto_tree_add_item(tree, hf_zbee_zcl_ias_zone_state, tvb, *offset, 1, ENC_NA); *offset += 1; break; case ZBEE_ZCL_ATTR_ID_IAS_ZONE_TYPE: proto_tree_add_item(tree, hf_zbee_zcl_ias_zone_type, tvb, *offset, 2, ENC_LITTLE_ENDIAN); *offset += 2; break; case ZBEE_ZCL_ATTR_ID_IAS_ZONE_STATUS: dissect_zcl_ias_zone_status(tree, tvb, *offset); *offset += 2; break; case ZBEE_ZCL_ATTR_ID_IAS_CIE_ADDRESS: default: dissect_zcl_attr_data(tvb, tree, offset, data_type); break; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables ISO7816 smart card mode on the specified UART. */
void UARTSmartCardEnable(unsigned long ulBase)
/* Enables ISO7816 smart card mode on the specified UART. */ void UARTSmartCardEnable(unsigned long ulBase)
{ unsigned long ulVal; ASSERT(!CLASS_IS_SANDSTORM && !CLASS_IS_FURY && !CLASS_IS_DUSTDEVIL); ASSERT(UARTBaseValid(ulBase)); ulVal = HWREG(ulBase + UART_O_LCRH); ulVal &= ~(UART_LCRH_SPS | UART_LCRH_EPS | UART_LCRH_PEN | UART_LCRH_WLEN_M); ulVal |= UART_LCRH_WLEN_8 | UART_LCRH_PEN | UART_LCRH_EPS | UART_LCRH_STP2; HWREG(ulBase + UART_O_LCRH) = ulVal; HWREG(ulBase + UART_O_CTL) |= UART_CTL_SMART; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* getref: calculate reference image pointer the decision to use interpolation h/v/hv or the normal image is based on dx & dy. */
static __inline const uint8_t* get_ref(const uint8_t *const refn, const uint8_t *const refh, const uint8_t *const refv, const uint8_t *const refhv, const uint32_t x, const uint32_t y, const uint32_t block, const int32_t dx, const int32_t dy, const int32_t stride)
/* getref: calculate reference image pointer the decision to use interpolation h/v/hv or the normal image is based on dx & dy. */ static __inline const uint8_t* get_ref(const uint8_t *const refn, const uint8_t *const refh, const uint8_t *const refv, const uint8_t *const refhv, const uint32_t x, const uint32_t y, const uint32_t block, const int32_t dx, const int32_t dy, const int32_t stride)
{ switch (((dx & 1) << 1) + (dy & 1)) { case 0: return refn + (int) (((int)x * (int)block + dx / 2) + ((int)y * (int)block + dy / 2) * (int)stride); case 1: return refv + (int) (((int)x * (int)block + dx / 2) + ((int)y * (int)block + (dy - 1) / 2) * (int)stride); case 2: return refh + (int) (((int)x * (int)block + (dx - 1) / 2) + ((int)y * (int)block + dy / 2) * (int)stride); default: return refhv + (int) (((int)x * (int)block + (dx - 1) / 2) + ((int)y * (int)block + (dy - 1) / 2) * (int)stride); } }
DC-SWAT/DreamShell
C++
null
404
/* Returns the peer resolvable private address of last device connecting to us */
uint8_t* ble_ll_scan_get_peer_rpa(void)
/* Returns the peer resolvable private address of last device connecting to us */ uint8_t* ble_ll_scan_get_peer_rpa(void)
{ struct ble_ll_scan_sm *scansm; scansm = &g_ble_ll_scan_sm; return scansm->scan_peer_rpa; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Set up a read request that reads up to 160 byte from the 3215 device. If there is a queued read request it is used, but that shouldn't happen because a 3215 terminal won't accept a new read before the old one is completed. */
static void raw3215_mk_read_req(struct raw3215_info *raw)
/* Set up a read request that reads up to 160 byte from the 3215 device. If there is a queued read request it is used, but that shouldn't happen because a 3215 terminal won't accept a new read before the old one is completed. */ static void raw3215_mk_read_req(struct raw3215_info *raw)
{ struct raw3215_req *req; struct ccw1 *ccw; req = raw->queued_read; if (req == NULL) { req = raw3215_alloc_req(); req->type = RAW3215_READ; req->info = raw; raw->queued_read = req; } ccw = req->ccws; ccw->cmd_code = 0x0A; ccw->flags = 0x20; ccw->count = 160; ccw->cda = (__u32) __pa(raw->inbuf); }
robutest/uclinux
C++
GPL-2.0
60