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
/* brief Return Frequency of OSTIMER return Frequency of OSTIMER */
uint32_t CLOCK_GetOstimerClkFreq(void)
/* brief Return Frequency of OSTIMER return Frequency of OSTIMER */ uint32_t CLOCK_GetOstimerClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->OSTIMERCLKSEL) { case 0U: freq = CLOCK_GetClk16KFreq((uint32_t)kCLOCK_Clk16KToWake); break; case 1U: freq = CLOCK_GetOsc32KFreq((uint32_t)kCLOCK_Osc32kToWake); break; case 2U: freq = CLOCK_GetClk1MFreq(); break; default: freq = 0U; break; } return freq; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* platform_begin - tell the platform driver that we're starting hibernation */
static int platform_begin(int platform_mode)
/* platform_begin - tell the platform driver that we're starting hibernation */ static int platform_begin(int platform_mode)
{ return (platform_mode && hibernation_ops) ? hibernation_ops->begin() : 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called directly from UDP. Put "WTP+WSP" into the "Protocol" column. */
static int dissect_wtp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* Called directly from UDP. Put "WTP+WSP" into the "Protocol" column. */ static int dissect_wtp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTP+WSP"); col_clear(pinfo->cinfo, COL_INFO); dissect_wtp_common(tvb, pinfo, tree); return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Poll the i2c status register until the specified bit is set. Returns 0 if timed out (100 msec). */
static short at91_poll_status(unsigned long bit)
/* Poll the i2c status register until the specified bit is set. Returns 0 if timed out (100 msec). */ static short at91_poll_status(unsigned long bit)
{ int loop_cntr = 10000; do { udelay(10); } while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0)); return (loop_cntr > 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads a register from the MII Management serial interface */
static int smc_phy_read(struct net_device *dev, int phyaddr, int phyreg)
/* Reads a register from the MII Management serial interface */ static int smc_phy_read(struct net_device *dev, int phyaddr, int phyreg)
{ struct smc_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp->base; unsigned int phydata; SMC_SELECT_BANK(lp, 3); smc_mii_out(dev, 0xffffffff, 32); smc_mii_out(dev, 6 << 10 | phyaddr << 5 | phyreg, 14); phydata = smc_mii_in(dev, 18); SMC_SET_MII(lp, SMC_GET_MII(lp) & ~(MII_MCLK|MII_MDOE|MII_MDO)); DBG(3, "%s: phyaddr=0x%x, phyreg=0x%x, phydata=0x%x\n", __func__, phyaddr, phyreg, phydata); SMC_SELECT_BANK(lp, 2); return phydata; }
robutest/uclinux
C++
GPL-2.0
60
/* Stops the desired oscillator(s) (OSC). Valid values for ui32OscFlags are: */
void am_hal_clkgen_osc_stop(uint32_t ui32OscFlags)
/* Stops the desired oscillator(s) (OSC). Valid values for ui32OscFlags are: */ void am_hal_clkgen_osc_stop(uint32_t ui32OscFlags)
{ if ( ui32OscFlags & (AM_HAL_CLKGEN_OSC_LFRC | AM_HAL_CLKGEN_OSC_XT) ) { AM_REG(CLKGEN, OCTRL) |= ui32OscFlags; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get rid of any references to a local port held by the given sock. */
static void __inet_put_port(struct sock *sk)
/* Get rid of any references to a local port held by the given sock. */ static void __inet_put_port(struct sock *sk)
{ struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; const int bhash = inet_bhashfn(sock_net(sk), inet_sk(sk)->inet_num, hashinfo->bhash_size); struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; struct inet_bind_bucket *tb; atomic_dec(&hashinfo->bsockets); spin_lock(&head->lock); tb = inet_csk(sk)->icsk_bind_hash; __sk_del_bind_node(sk); tb->num_owners--; inet_csk(sk)->icsk_bind_hash = NULL; inet_sk(sk)->inet_num = 0; inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb); spin_unlock(&head->lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Add a new tail to a linked list */
void* _lv_ll_ins_tail(lv_ll_t *ll_p)
/* Add a new tail to a linked list */ void* _lv_ll_ins_tail(lv_ll_t *ll_p)
{ lv_ll_node_t * n_new; n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); if(n_new != NULL) { node_set_next(ll_p, n_new, NULL); node_set_prev(ll_p, n_new, ll_p->tail); if(ll_p->tail != NULL) { node_set_next(ll_p, ll_p->tail, n_new); } ll_p->tail = n_new; if(ll_p->head == NULL) { ll_p->head = n_new; } } return n_new; }
pikasTech/PikaPython
C++
MIT License
1,403
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq)
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq)
{ (void)src; (void)freq; CCM->CCGR6 |= CCM_CCGR6_CG0_MASK; USB2->USBCMD |= USBHS_USBCMD_RST_MASK; for (volatile uint32_t i = 0; i < 400000; i++) { __ASM("nop"); } PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) | (PMU_REG_3P0_OUTPUT_TRG(0x17) | PMU_REG_3P0_ENABLE_LINREG_MASK); return true; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will make sure the PE/COFF image content read is within the image buffer. */
EFI_STATUS EFIAPI DxeTpm2MeasureBootLibImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will make sure the PE/COFF image content read is within the image buffer. */ EFI_STATUS EFIAPI DxeTpm2MeasureBootLibImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
{ UINTN EndPosition; if ((FileHandle == NULL) || (ReadSize == NULL) || (Buffer == NULL)) { return EFI_INVALID_PARAMETER; } if (MAX_ADDRESS - FileOffset < *ReadSize) { return EFI_INVALID_PARAMETER; } EndPosition = FileOffset + *ReadSize; if (EndPosition > mTcg2ImageSize) { *ReadSize = (UINT32)(mTcg2ImageSize - FileOffset); } if (FileOffset >= mTcg2ImageSize) { *ReadSize = 0; } CopyMem (Buffer, (UINT8 *)((UINTN)FileHandle + FileOffset), *ReadSize); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RsaCheckKey(IN VOID *RsaContext)
/* If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI RsaCheckKey(IN VOID *RsaContext)
{ CALL_CRYPTO_SERVICE (RsaCheckKey, (RsaContext), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Unprotected the contents of the serial flash device. */
uint8_t s25fl1xx_data_unprotect(struct qspid_t *qspid)
/* Unprotected the contents of the serial flash device. */ uint8_t s25fl1xx_data_unprotect(struct qspid_t *qspid)
{ uint8_t status[3]; status[0]= s25fl1xx_read_status1(qspid); status[1]= s25fl1xx_read_status2(qspid); status[2]= s25fl1xx_read_status3(qspid); if (!(status[0] & S25FL1XX_CHIP_PROTECT_Msk)) { return 0; } status[0] &= (~S25FL1XX_CHIP_PROTECT_Msk); s25fl1xx_write_status(qspid, status); status[0] = s25fl1xx_read_status(qspid); if (status[0] & S25FL1XX_CHIP_PROTECT_Msk) { return S25FL1XX_ERROR_PROTECTED; } else { return 0; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the total number of logical processors in the platform. */
UINT32 CpuCacheInfoGetNumberOfProcessors(IN MP_SERVICES MpServices)
/* Get the total number of logical processors in the platform. */ UINT32 CpuCacheInfoGetNumberOfProcessors(IN MP_SERVICES MpServices)
{ EFI_STATUS Status; UINTN NumberOfProcessor; UINTN NumberOfEnabledProcessor; Status = MpServices.Ppi->GetNumberOfProcessors (MpServices.Ppi, &NumberOfProcessor, &NumberOfEnabledProcessor); ASSERT_EFI_ERROR (Status); return (UINT32)NumberOfProcessor; }
tianocore/edk2
C++
Other
4,240
/* If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() should be used to enable DES interrupts on the interrupt controller. */
void DESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() should be used to enable DES interrupts on the interrupt controller. */ void DESIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ ASSERT(ui32Base == DES_BASE); IntRegister(INT_DES0, pfnHandler); IntEnable(INT_DES0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is used to configure the SMTP module with an SMTP server and the hostname of the host. */
void smtp_configure(char *lhostname, void *server)
/* This function is used to configure the SMTP module with an SMTP server and the hostname of the host. */ void smtp_configure(char *lhostname, void *server)
{ localhostname = lhostname; uip_ipaddr_copy(smtpserver, server); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This is nasty, to use the MISR command you have to wait for 6 memory locations to be zero. This is the way the driver does on other OS'es so we should be ok with the empty loop. */
static void xl_wait_misr_flags(struct net_device *dev)
/* This is nasty, to use the MISR command you have to wait for 6 memory locations to be zero. This is the way the driver does on other OS'es so we should be ok with the empty loop. */ static void xl_wait_misr_flags(struct net_device *dev)
{ struct xl_private *xl_priv = netdev_priv(dev); u8 __iomem * xl_mmio = xl_priv->xl_mmio ; int i ; writel(MMIO_BYTE_READ | MISR_RW, xl_mmio + MMIO_MAC_ACCESS_CMD) ; if (readb(xl_mmio + MMIO_MACDATA) != 0) { for (i=0; i<6; i++) { writel(MEM_BYTE_READ | 0xDFFE0 | i, xl_mmio + MMIO_MAC_ACCESS_CMD) ; while (readb(xl_mmio + MMIO_MACDATA) != 0 ) {} ; } } writel(MMIO_BYTE_WRITE | MISR_AND, xl_mmio + MMIO_MAC_ACCESS_CMD) ; writeb(0x80, xl_mmio + MMIO_MACDATA) ; return ; }
robutest/uclinux
C++
GPL-2.0
60
/* Called when truncating a buffer on a page completely. */
static void discard_buffer(struct buffer_head *bh)
/* Called when truncating a buffer on a page completely. */ static void discard_buffer(struct buffer_head *bh)
{ lock_buffer(bh); clear_buffer_dirty(bh); bh->b_bdev = NULL; clear_buffer_mapped(bh); clear_buffer_req(bh); clear_buffer_new(bh); clear_buffer_delay(bh); clear_buffer_unwritten(bh); unlock_buffer(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* If this function returns, it means that the system does not support warm reset. */
VOID EFIAPI ResetWarm(VOID)
/* If this function returns, it means that the system does not support warm reset. */ VOID EFIAPI ResetWarm(VOID)
{ gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); }
tianocore/edk2
C++
Other
4,240
/* If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildResourceDescriptorHob(IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes)
/* If there is no additional space for HOB creation, then ASSERT(). */ VOID EFIAPI BuildResourceDescriptorHob(IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes)
{ EFI_HOB_RESOURCE_DESCRIPTOR *Hob; Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16)sizeof (EFI_HOB_RESOURCE_DESCRIPTOR)); if (Hob == NULL) { return; } Hob->ResourceType = ResourceType; Hob->ResourceAttribute = ResourceAttribute; Hob->PhysicalStart = PhysicalStart; Hob->ResourceLength = NumberOfBytes; ZeroMem (&(Hob->Owner), sizeof (EFI_GUID)); }
tianocore/edk2
C++
Other
4,240
/* This is simple translation function, suitable for the most 1:1 mapped gpio chips. This function performs only one sanity check: whether gpio is less than ngpios (that is specified in the gpio_chip). */
int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np, const void *gpio_spec, enum of_gpio_flags *flags)
/* This is simple translation function, suitable for the most 1:1 mapped gpio chips. This function performs only one sanity check: whether gpio is less than ngpios (that is specified in the gpio_chip). */ int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np, const void *gpio_spec, enum of_gpio_flags *flags)
{ const u32 *gpio = gpio_spec; if (of_gc->gpio_cells < 2) { WARN_ON(1); return -EINVAL; } if (*gpio > of_gc->gc.ngpio) return -EINVAL; if (flags) *flags = gpio[1]; return *gpio; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Queue an RCU for invocation after a quicker grace period. */
void call_rcu_bh(struct rcu_head *head, void(*func)(struct rcu_head *rcu))
/* Queue an RCU for invocation after a quicker grace period. */ void call_rcu_bh(struct rcu_head *head, void(*func)(struct rcu_head *rcu))
{ __call_rcu(head, func, &rcu_bh_state); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Fills each i2sConfig member with its default value. */
void I2S_ConfigStructInit(I2S_Config_T *i2sConfig)
/* Fills each i2sConfig member with its default value. */ void I2S_ConfigStructInit(I2S_Config_T *i2sConfig)
{ i2sConfig->mode = I2S_MODE_SLAVER_TX; i2sConfig->standard = I2S_STANDARD_PHILIPS; i2sConfig->length = I2S_DATA_LENGTH_16B; i2sConfig->MCLKOutput = I2S_MCLK_OUTPUT_DISABLE; i2sConfig->audioDiv = I2S_AUDIO_DIV_DEFAULT; i2sConfig->polarity = I2S_CLKPOL_LOW; }
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. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */
status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */ status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count)
{ assert(handle != NULL); assert(count != NULL); if ((uint8_t)kFLEXIO_UART_TxIdle == handle->txState) { return kStatus_NoTransferInProgress; } *count = handle->txDataSizeAll - handle->txDataSize; return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* Examples: 01 0102 010203 01020304 0102030405 010203040506 010203...050607 010203...060708 etc. */
static void iso_print_data(uint8_t *data, size_t data_len)
/* Examples: 01 0102 010203 01020304 0102030405 010203040506 010203...050607 010203...060708 etc. */ static void iso_print_data(uint8_t *data, size_t data_len)
{ const uint8_t max_octets = 3; char data_str[35]; size_t str_len; str_len = bin2hex(data, MIN(max_octets, data_len), data_str, sizeof(data_str)); if (data_len > max_octets) { if (data_len > (max_octets * 2)) { static const char dots[] = "..."; strcat(&data_str[str_len], dots); str_len += strlen(dots); } str_len += bin2hex(data + (data_len - MIN(max_octets, data_len - max_octets)), MIN(max_octets, data_len - max_octets), data_str + str_len, sizeof(data_str) - str_len); } printk("\t %s\n", data_str); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The OLED_write_string function displays the input string to the OLED panel. */
void OLED_write_string(const char *string)
/* The OLED_write_string function displays the input string to the OLED panel. */ void OLED_write_string(const char *string)
{ while (*string != 0) { OLED_write_char( *string ); ++string; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* When writing 8 bits of data, ensure the data is in the least significant byte position. The remaining bytes should be written with zero. For example, when writing 0xAB, */
void CRCDataWrite(uint32_t ui32Base, uint32_t ui32Data)
/* When writing 8 bits of data, ensure the data is in the least significant byte position. The remaining bytes should be written with zero. For example, when writing 0xAB, */ void CRCDataWrite(uint32_t ui32Base, uint32_t ui32Data)
{ ASSERT(ui32Base == CCM0_BASE); HWREG(ui32Base + CCM_O_CRCDIN) = ui32Data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the newest character in the CLI FIFO. */
void cli_set_last_character(struct cli_desc *dev, uint8_t new_char)
/* Set the newest character in the CLI FIFO. */ void cli_set_last_character(struct cli_desc *dev, uint8_t new_char)
{ if (uart_line_index >= CLI_WIDTH) return; uart_current_line[(uart_line_index - 1)] = new_char; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Returns: (transfer full): #GIcon corresponding to the content type. Free the returned object with g_object_unref() */
GIcon* g_content_type_get_icon(const gchar *type)
/* Returns: (transfer full): #GIcon corresponding to the content type. Free the returned object with g_object_unref() */ GIcon* g_content_type_get_icon(const gchar *type)
{ return g_content_type_get_icon_internal (type, FALSE); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base ENET peripheral base address. param phyAddr The PHY address. param phyReg The PHY register. Range from 0 ~ 31. param operation The read operation. */
void ENET_StartSMIRead(ENET_Type *base, uint32_t phyAddr, uint32_t phyReg, enet_mii_read_t operation)
/* param base ENET peripheral base address. param phyAddr The PHY address. param phyReg The PHY register. Range from 0 ~ 31. param operation The read operation. */ void ENET_StartSMIRead(ENET_Type *base, uint32_t phyAddr, uint32_t phyReg, enet_mii_read_t operation)
{ uint32_t mmfr = 0; mmfr = ENET_MMFR_ST(1) | ENET_MMFR_OP(operation) | ENET_MMFR_PA(phyAddr) | ENET_MMFR_RA(phyReg) | ENET_MMFR_TA(2); base->MMFR = mmfr; }
nanoframework/nf-interpreter
C++
MIT License
293
/* For trigger consumers the current_trigger interface allows the trigger used for this device to be specified at run time based on the triggers name. */
static ssize_t iio_trigger_write_current(struct device *dev, struct device_attribute *attr, const char *buf, size_t len)
/* For trigger consumers the current_trigger interface allows the trigger used for this device to be specified at run time based on the triggers name. */ static ssize_t iio_trigger_write_current(struct device *dev, struct device_attribute *attr, const char *buf, size_t len)
{ struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_trigger *oldtrig = dev_info->trig; mutex_lock(&dev_info->mlock); if (dev_info->currentmode == INDIO_RING_TRIGGERED) { mutex_unlock(&dev_info->mlock); return -EBUSY; } mutex_unlock(&dev_info->mlock); len = len < IIO_TRIGGER_NAME_LENGTH ? len : IIO_TRIGGER_NAME_LENGTH; dev_info->trig = iio_trigger_find_by_name(buf, len); if (oldtrig && dev_info->trig != oldtrig) iio_put_trigger(oldtrig); if (dev_info->trig) iio_get_trigger(dev_info->trig); return len; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is to convert UINTN to ASCII string with the required formatting. */
VOID PxeBcUintnToAscDecWithFormat(IN UINTN Number, IN UINT8 *Buffer, IN INTN Length)
/* This function is to convert UINTN to ASCII string with the required formatting. */ VOID PxeBcUintnToAscDecWithFormat(IN UINTN Number, IN UINT8 *Buffer, IN INTN Length)
{ UINTN Remainder; for ( ; Length > 0; Length--) { Remainder = Number % 10; Number /= 10; Buffer[Length - 1] = (UINT8)('0' + Remainder); } }
tianocore/edk2
C++
Other
4,240
/* Get Adapter status for channel with handle h. */
static int32_t CanUsbLibFuncStatus(CANHANDLE h)
/* Get Adapter status for channel with handle h. */ static int32_t CanUsbLibFuncStatus(CANHANDLE h)
{ int32_t result = 0; assert(canUsbLibFuncStatusPtr != NULL); assert(canUsbDllHandle != NULL); if ((canUsbLibFuncStatusPtr != NULL) && (canUsbDllHandle != NULL)) { result = canUsbLibFuncStatusPtr(h); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Send a bare OKAY fastboot response. This is used where the command is valid, but all the work is done after the response has been sent (e.g. boot, reboot etc.) */
static void okay(char *, char *)
/* Send a bare OKAY fastboot response. This is used where the command is valid, but all the work is done after the response has been sent (e.g. boot, reboot etc.) */ static void okay(char *, char *)
{ fastboot_okay(NULL, response); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Forces the output 1 waveform to active or inactive level. */
void TMR_ConfigForcedOC1(TMR_T *tmr, TMR_FORCED_ACTION_T forcesAction)
/* Forces the output 1 waveform to active or inactive level. */ void TMR_ConfigForcedOC1(TMR_T *tmr, TMR_FORCED_ACTION_T forcesAction)
{ tmr->CCM1_COMPARE_B.OC1MOD = BIT_RESET; tmr->CCM1_COMPARE_B.OC1MOD = forcesAction; }
pikasTech/PikaPython
C++
MIT License
1,403
/* It is common only one intr URB is scheduled on one qh, and given complete() is run in tasklet context, introduce a bit delay to avoid unlink qh too early. */
static void start_unlink_intr_wait(struct ehci_hcd *ehci, struct ehci_qh *qh)
/* It is common only one intr URB is scheduled on one qh, and given complete() is run in tasklet context, introduce a bit delay to avoid unlink qh too early. */ static void start_unlink_intr_wait(struct ehci_hcd *ehci, struct ehci_qh *qh)
{ qh->unlink_cycle = ehci->intr_unlink_wait_cycle; list_add_tail(&qh->unlink_node, &ehci->intr_unlink_wait); if (ehci->rh_state < EHCI_RH_RUNNING) ehci_handle_start_intr_unlinks(ehci); else if (ehci->intr_unlink_wait.next == &qh->unlink_node) { ehci_enable_event(ehci, EHCI_HRTIMER_START_UNLINK_INTR, true); ++ehci->intr_unlink_wait_cycle; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get 32-bit endpoint bitmask from index. In the returned 32-bit word, the bit positions in the lower 16 bits indicate OUT endpoints, while the upper 16 bits indicate IN endpoints */
static uint32_t get_ep_bm_from_addr(uint8_t ep)
/* Get 32-bit endpoint bitmask from index. In the returned 32-bit word, the bit positions in the lower 16 bits indicate OUT endpoints, while the upper 16 bits indicate IN endpoints */ static uint32_t get_ep_bm_from_addr(uint8_t ep)
{ uint32_t ep_bm = 0; uint8_t ep_idx; ep_idx = ep & (~USB_EP_DIR_IN); if (ep_idx > 15) { LOG_ERR("Endpoint 0x%02x is invalid", ep); goto done; } if (ep & USB_EP_DIR_IN) { ep_bm = BIT(ep_idx + 16); } else { ep_bm = BIT(ep_idx); } done: return ep_bm; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function reserves a range of kernel address space, and allocates pagetables to map that range. No actual mappings are created. If the kernel address space is not shared between processes, it syncs the pagetable across all processes. */
struct vm_struct* alloc_vm_area(size_t size)
/* This function reserves a range of kernel address space, and allocates pagetables to map that range. No actual mappings are created. If the kernel address space is not shared between processes, it syncs the pagetable across all processes. */ struct vm_struct* alloc_vm_area(size_t size)
{ struct vm_struct *area; area = get_vm_area_caller(size, VM_IOREMAP, __builtin_return_address(0)); if (area == NULL) return NULL; if (apply_to_page_range(&init_mm, (unsigned long)area->addr, area->size, f, NULL)) { free_vm_area(area); return NULL; } vmalloc_sync_all(); return area; }
robutest/uclinux
C++
GPL-2.0
60
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI MmioBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI MmioBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
{ return MmioWrite16 ( Address, BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData) ); }
tianocore/edk2
C++
Other
4,240
/* Check if the dentry or any of it's aliases is acceptable. */
static struct dentry* find_acceptable_alias(struct dentry *result, int(*acceptable)(void *context, struct dentry *dentry), void *context)
/* Check if the dentry or any of it's aliases is acceptable. */ static struct dentry* find_acceptable_alias(struct dentry *result, int(*acceptable)(void *context, struct dentry *dentry), void *context)
{ struct dentry *dentry, *toput = NULL; if (acceptable(context, result)) return result; spin_lock(&dcache_lock); list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) { dget_locked(dentry); spin_unlock(&dcache_lock); if (toput) dput(toput); if (dentry != result && acceptable(context, dentry)) { dput(result); return dentry; } spin_lock(&dcache_lock); toput = dentry; } spin_unlock(&dcache_lock); if (toput) dput(toput); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* This is run from a interrupt handler normally and the unmap needs process context so we must queue */
static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd)
/* This is run from a interrupt handler normally and the unmap needs process context so we must queue */ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd)
{ struct scsi_tgt_cmd *tcmd = cmd->request->end_io_data; dprintk("cmd %p %u\n", cmd, rq_data_dir(cmd->request)); scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); scsi_release_buffers(cmd); queue_work(scsi_tgtd, &tcmd->work); }
robutest/uclinux
C++
GPL-2.0
60
/* This function clears only the FAULT0 interrupt and is retained for backwards compatibility. It is recommended that */
void PWMFaultIntClear(unsigned long ulBase)
/* This function clears only the FAULT0 interrupt and is retained for backwards compatibility. It is recommended that */ void PWMFaultIntClear(unsigned long ulBase)
{ ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE)); HWREG(ulBase + PWM_O_ISC) = PWM_ISC_INTFAULT0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads and returns the current value of MM1. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm1(VOID)
/* Reads and returns the current value of MM1. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadMm1(VOID)
{ UINT64 Data; __asm__ __volatile__ ( "movd %%mm1, %0 \n\t" : "=r" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* Finish delay accounting for a statistic using its timestamps (@start, @end), accumalator (@total) and @count */
static void delayacct_end(struct timespec *start, struct timespec *end, u64 *total, u32 *count)
/* Finish delay accounting for a statistic using its timestamps (@start, @end), accumalator (@total) and @count */ static void delayacct_end(struct timespec *start, struct timespec *end, u64 *total, u32 *count)
{ struct timespec ts; s64 ns; unsigned long flags; do_posix_clock_monotonic_gettime(end); ts = timespec_sub(*end, *start); ns = timespec_to_ns(&ts); if (ns < 0) return; spin_lock_irqsave(&current->delays->lock, flags); *total += ns; (*count)++; spin_unlock_irqrestore(&current->delays->lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable I2C master module of the specified I2C port. The */
void xI2CMasterEnable(unsigned long ulBase)
/* Enable I2C master module of the specified I2C port. The */ void xI2CMasterEnable(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_CON) |= I2C_CON_ENS1; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */
EFI_STATUS EFIAPI CryptoServiceTlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */ EFI_STATUS EFIAPI CryptoServiceTlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
{ return CALL_BASECRYPTLIB (TlsSet.Services.SessionId, TlsSetSessionId, (Tls, SessionId, SessionIdLen), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* If 16-bit I/O port operations are not supported, then ASSERT(). */
UINT16 EFIAPI IoRead16(IN UINTN Port)
/* If 16-bit I/O port operations are not supported, then ASSERT(). */ UINT16 EFIAPI IoRead16(IN UINTN Port)
{ ASSERT ((Port & 1) == 0); return (UINT16)IoReadWorker (Port, SMM_IO_UINT16); }
tianocore/edk2
C++
Other
4,240
/* If Count is greater than 31, then ASSERT(). */
UINT32 EFIAPI LRotU32(IN UINT32 Operand, IN UINTN Count)
/* If Count is greater than 31, then ASSERT(). */ UINT32 EFIAPI LRotU32(IN UINT32 Operand, IN UINTN Count)
{ ASSERT (Count < 32); return (Operand << Count) | (Operand >> (32 - Count)); }
tianocore/edk2
C++
Other
4,240
/* Disable the Capture input of the PWM module. The */
void PWMCAPInputDisable(unsigned long ulBase, unsigned long ulChannel)
/* Disable the Capture input of the PWM module. The */ void PWMCAPInputDisable(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_CAPENR) &= ~(PWM_CAPENR_CAPIE_0 << (ulChannelTemp)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set Redfish value with the given Schema and Configure Language. */
EFI_STATUS RedfishPlatformConfigSetValue(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING ConfigureLang, IN EDKII_REDFISH_VALUE Value)
/* Set Redfish value with the given Schema and Configure Language. */ EFI_STATUS RedfishPlatformConfigSetValue(IN CHAR8 *Schema, IN CHAR8 *Version, IN EFI_STRING ConfigureLang, IN EDKII_REDFISH_VALUE Value)
{ if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) { return EFI_NOT_READY; } return mRedfishPlatformConfigLibPrivate.Protocol->SetValue ( mRedfishPlatformConfigLibPrivate.Protocol, Schema, Version, ConfigureLang, Value ); }
tianocore/edk2
C++
Other
4,240
/* Upon reception of first fragment with respective of size and tag create a new cache. If number of unused cache are out then discard the fragments. */
static struct frag_cache* set_reass_cache(struct net_pkt *pkt, uint16_t size, uint16_t tag)
/* Upon reception of first fragment with respective of size and tag create a new cache. If number of unused cache are out then discard the fragments. */ static struct frag_cache* set_reass_cache(struct net_pkt *pkt, uint16_t size, uint16_t tag)
{ int i; for (i = 0; i < REASS_CACHE_SIZE; i++) { if (cache[i].used) { continue; } cache[i].pkt = pkt; cache[i].size = size; cache[i].tag = tag; cache[i].used = true; k_work_init_delayable(&cache[i].timer, reass_timeout); k_work_reschedule(&cache[i].timer, FRAG_REASSEMBLY_TIMEOUT); return &cache[i]; } return NULL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Reads new measurement data and processes a new sample. This function should be called every time an interrupt for a new sample is received. */
gesture_t Si1147_NewSample(I2C_TypeDef *i2c, uint8_t addr, uint32_t timestamp)
/* Reads new measurement data and processes a new sample. This function should be called every time an interrupt for a new sample is received. */ gesture_t Si1147_NewSample(I2C_TypeDef *i2c, uint8_t addr, uint32_t timestamp)
{ Si114x_Sample_TypeDef sample; si114x_handle->addr = addr; si114x_handle->i2c = i2c; sample.timestamp = timestamp; readPSData(si114x_handle, &sample); Si114xWriteToRegister(si114x_handle, REG_IRQ_STATUS, Si114xReadFromRegister(si114x_handle, REG_IRQ_STATUS)); return ProcessSi1147Samples(&sample); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Count the children of an object (only children directly on 'obj') */
uint16_t lv_obj_count_children(const lv_obj_t *obj)
/* Count the children of an object (only children directly on 'obj') */ uint16_t lv_obj_count_children(const lv_obj_t *obj)
{ lv_obj_t * i; uint16_t cnt = 0; LV_LL_READ(obj->child_ll, i) cnt++; return cnt; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* brief Return Frequency of SDIO Clock return Frequency of SDIO Clock. */
uint32_t CLOCK_GetSdioClkFreq(void)
/* brief Return Frequency of SDIO Clock return Frequency of SDIO Clock. */ uint32_t CLOCK_GetSdioClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->SDIOCLKSEL) { case 0U: freq = CLOCK_GetCoreSysClkFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq(); break; case 7U: freq = 0U; break; default: assert(false); break; } return freq / ((SYSCON->SDIOCLKDIV & 0xffU) + 1U); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Read level of a group of Pins. Read the level of a group of Pins for the given port. */
uint32_t gpio_get(uint32_t gpioport, uint32_t gpios)
/* Read level of a group of Pins. Read the level of a group of Pins for the given port. */ uint32_t gpio_get(uint32_t gpioport, uint32_t gpios)
{ return PORT_IN(gpioport) & gpios; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Enable the DMA of the specified SPI port. The */
void xSPIDMAEnable(unsigned long ulBase, unsigned long ulDmaMode)
/* Enable the DMA of the specified SPI port. The */ void xSPIDMAEnable(unsigned long ulBase, unsigned long ulDmaMode)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xHWREG(ulBase + SPI_DMACTL) |= ulDmaMode; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Clear All Status Flags. Program error, end of operation, write protect error, busy. */
void flash_clear_status_flags(void)
/* Clear All Status Flags. Program error, end of operation, write protect error, busy. */ void flash_clear_status_flags(void)
{ flash_clear_pgerr_flag(); flash_clear_eop_flag(); flash_clear_wrprterr_flag(); flash_clear_bsy_flag(); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { HID_Device_USBTask(&Device_HID_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This API configures the power mode, range and bandwidth of sensor. */
int8_t bmi160_set_sens_conf(struct bmi160_dev *dev)
/* This API configures the power mode, range and bandwidth of sensor. */ int8_t bmi160_set_sens_conf(struct bmi160_dev *dev)
{ int8_t rslt = BMI160_OK; if ((dev == NULL) || (dev->delay_ms == NULL)) { rslt = BMI160_E_NULL_PTR; } else { rslt = set_accel_conf(dev); if (rslt == BMI160_OK) { rslt = set_gyro_conf(dev); if (rslt == BMI160_OK) { rslt = bmi160_set_power_mode(dev); if (rslt == BMI160_OK) { rslt = check_invalid_settg(dev); } } } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Set the state of a GPIO output pin */
static void kinetis_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
/* Set the state of a GPIO output pin */ static void kinetis_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
{ if (value) { KINETIS_GPIO(KINETIS_GPIO_GETPORT(gpio))->psor = (1 << KINETIS_GPIO_GETPIN(gpio)); } else { KINETIS_GPIO(KINETIS_GPIO_GETPORT(gpio))->pcor = (1 << KINETIS_GPIO_GETPIN(gpio)); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Schedule switch for execution. We need to throttle requests, otherwise keyboard may become unresponsive. */
static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit)
/* Schedule switch for execution. We need to throttle requests, otherwise keyboard may become unresponsive. */ static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit)
{ unsigned long delay = msecs_to_jiffies(50); if (time_after(jiffies, atkbd->event_jiffies + delay)) delay = 0; atkbd->event_jiffies = jiffies; set_bit(event_bit, &atkbd->event_mask); mb(); schedule_delayed_work(&atkbd->event_work, delay); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the number of bytes of data in the device private output queue. If no private method is supplied there is assumed to be no queue on the device. */
int tty_chars_in_buffer(struct tty_struct *tty)
/* Return the number of bytes of data in the device private output queue. If no private method is supplied there is assumed to be no queue on the device. */ int tty_chars_in_buffer(struct tty_struct *tty)
{ if (tty->ops->chars_in_buffer) return tty->ops->chars_in_buffer(tty); else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Synchronizes the counters in one or multiple PWM generator blocks. */
void PWMSyncTimeBase(uint32_t ui32Base, uint32_t ui32GenBits)
/* Synchronizes the counters in one or multiple PWM generator blocks. */ void PWMSyncTimeBase(uint32_t ui32Base, uint32_t ui32GenBits)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(!(ui32GenBits & ~(PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT | PWM_GEN_3_BIT))); HWREG(ui32Base + PWM_O_SYNC) = ui32GenBits; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns zero if the default is POLL, 1 if the default is SLEEP. */
static int get_linkdowndefaultstate(struct ipath_devdata *dd)
/* Returns zero if the default is POLL, 1 if the default is SLEEP. */ static int get_linkdowndefaultstate(struct ipath_devdata *dd)
{ return !!(dd->ipath_ibcctrl & INFINIPATH_IBCC_LINKDOWNDEFAULTSTATE); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the values present of the specified Port. */
long GPIOPortRead(unsigned long ulPort)
/* Reads the values present of the specified Port. */ long GPIOPortRead(unsigned long ulPort)
{ xASSERT(GPIOBaseValid(ulPort)); return(xHWREG(ulPort +GPIO_IDR )); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Description: For journalled file systems, doing ordered writes on a commit block instead of explicitly doing wait_on_buffer (which is bad for performance) can be a big win. Block drivers supporting this feature should call this function and indicate so. */
int blk_queue_ordered(struct request_queue *q, unsigned ordered, prepare_flush_fn *prepare_flush_fn)
/* Description: For journalled file systems, doing ordered writes on a commit block instead of explicitly doing wait_on_buffer (which is bad for performance) can be a big win. Block drivers supporting this feature should call this function and indicate so. */ int blk_queue_ordered(struct request_queue *q, unsigned ordered, prepare_flush_fn *prepare_flush_fn)
{ if (!prepare_flush_fn && (ordered & (QUEUE_ORDERED_DO_PREFLUSH | QUEUE_ORDERED_DO_POSTFLUSH))) { printk(KERN_ERR "%s: prepare_flush_fn required\n", __func__); return -EINVAL; } if (ordered != QUEUE_ORDERED_NONE && ordered != QUEUE_ORDERED_DRAIN && ordered != QUEUE_ORDERED_DRAIN_FLUSH && ordered != QUEUE_ORDERED_DRAIN_FUA && ordered != QUEUE_ORDERED_TAG && ordered != QUEUE_ORDERED_TAG_FLUSH && ordered != QUEUE_ORDERED_TAG_FUA) { printk(KERN_ERR "blk_queue_ordered: bad value %d\n", ordered); return -EINVAL; } q->ordered = ordered; q->next_ordered = ordered; q->prepare_flush_fn = prepare_flush_fn; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* __agg_ports_are_ready - check if all ports in an aggregator are ready @aggregator: the aggregator we're looking at */
static int __agg_ports_are_ready(struct aggregator *aggregator)
/* __agg_ports_are_ready - check if all ports in an aggregator are ready @aggregator: the aggregator we're looking at */ static int __agg_ports_are_ready(struct aggregator *aggregator)
{ struct port *port; int retval = 1; if (aggregator) { for (port=aggregator->lag_ports; port; port=port->next_port_in_aggregator) { if (!(port->sm_vars & AD_PORT_READY_N)) { retval = 0; break; } } } return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* A disconnect IRQ has been received, meaning that the host has lost contact with the bus. Remove all current transactions and signal the gadget driver that this has happened. */
static void s3c_hsotg_disconnect_irq(struct s3c_hsotg *hsotg)
/* A disconnect IRQ has been received, meaning that the host has lost contact with the bus. Remove all current transactions and signal the gadget driver that this has happened. */ static void s3c_hsotg_disconnect_irq(struct s3c_hsotg *hsotg)
{ unsigned ep; for (ep = 0; ep < S3C_HSOTG_EPS; ep++) kill_all_requests(hsotg, &hsotg->eps[ep], -ESHUTDOWN, true); call_gadget(hsotg, disconnect); }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves the current year, month and day from the RTC. Month, day and week values are numbered starting at 1. */
void RTC_GetDate(unsigned short *pYear, unsigned char *pMonth, unsigned char *pDay, unsigned char *pWeek)
/* Retrieves the current year, month and day from the RTC. Month, day and week values are numbered starting at 1. */ void RTC_GetDate(unsigned short *pYear, unsigned char *pMonth, unsigned char *pDay, unsigned char *pWeek)
{ unsigned int date; do { date = AT91C_BASE_RTC->RTC_CALR; } while (date != AT91C_BASE_RTC->RTC_CALR); if (pYear) { *pYear = (((date >> 4) & 0x7) * 1000) + ((date & 0xF) * 100) + (((date >> 12) & 0xF) * 10) + ((date >> 8) & 0xF); } if (pMonth) { *pMonth = (((date >> 20) & 1) * 10) + ((date >> 16) & 0xF); } if (pDay) { *pDay = (((date >> 28) & 0x3) * 10) + ((date >> 24) & 0xF); } if (pWeek) { *pWeek = ((date >> 21) & 0x7); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* CLI command to set the sampling rate of the device. */
int32_t ad7124_8pmdz_odr_set(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
/* CLI command to set the sampling rate of the device. */ int32_t ad7124_8pmdz_odr_set(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
{ int32_t ret; float odr; uint8_t *err_ptr; if (!arg || *arg == 0) { cli_write_string(dev->cli_handler, (uint8_t *)"ERROR: Incorrect parameters.\n\r"); return FAILURE; } odr = strtod((char *)arg, (char **)&err_ptr); if (err_ptr == arg) { cli_write_string(dev->cli_handler, (uint8_t *)"ERROR: Incorrect parameters.\n\r"); return FAILURE; } ret = ad7124_8pmdz_odr_logic_set(dev, odr); if (ret != SUCCESS) { cli_write_string(dev->cli_handler, (uint8_t *)"ERROR: Can't set ODR."); return FAILURE; } return ad7124_8pmdz_odr_get(dev, NULL); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function will set network interface device DNS server address. @NOTE it can only be called in the network interface device driver. */
void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server)
/* This function will set network interface device DNS server address. @NOTE it can only be called in the network interface device driver. */ void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server)
{ unsigned int index; RT_ASSERT(dns_server); if (netdev == RT_NULL) { return; } for (index = 0; index < NETDEV_DNS_SERVERS_NUM; index++) { if (ip_addr_cmp(&(netdev->dns_servers[index]), dns_server)) { return; } } if (dns_num < NETDEV_DNS_SERVERS_NUM) { ip_addr_copy(netdev->dns_servers[dns_num], *dns_server); if (netdev->addr_callback) { netdev->addr_callback(netdev, NETDEV_CB_ADDR_DNS_SERVER); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This page is about to be returned from the page allocator */
static int check_new_page(struct page *page)
/* This page is about to be returned from the page allocator */ static int check_new_page(struct page *page)
{ if (unlikely(page_mapcount(page) | (page->mapping != NULL) | (atomic_read(&page->_count) != 0) | (page->flags & PAGE_FLAGS_CHECK_AT_PREP))) { bad_page(page); return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable SDIO SD I/O Mode suspend command sending. */
void SDIO_EnableTxSDIOSuspend(void)
/* Enable SDIO SD I/O Mode suspend command sending. */ void SDIO_EnableTxSDIOSuspend(void)
{ *(__IO uint32_t*) CMD_SDIOSC_BB = (uint32_t)SET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* API to send pullup command to card before using DAT line 3(using 4-bit bus) */
s32 XSdPs_Pullup(XSdPs *InstancePtr)
/* API to send pullup command to card before using DAT line 3(using 4-bit bus) */ s32 XSdPs_Pullup(XSdPs *InstancePtr)
{ s32 Status; Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); Status = XSdPs_CmdTransfer(InstancePtr, CMD55, InstancePtr->RelCardAddr, 0U); if (Status != XST_SUCCESS) { Status = XST_FAILURE; goto RETURN_PATH; } Status = XSdPs_CmdTransfer(InstancePtr, ACMD42, 0U, 0U); if (Status != XST_SUCCESS) { Status = XST_FAILURE; goto RETURN_PATH; } Status = XST_SUCCESS; RETURN_PATH: return Status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wait for a new message to arrive in the mbox */
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
/* Wait for a new message to arrive in the mbox */ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
{ int ret; ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, 0); if(ret == -RT_ETIMEOUT) return SYS_ARCH_TIMEOUT; else { if (ret == RT_EOK) ret = 1; } return ret; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Processor specific hook point each time a CPU enters System Management Mode. */
VOID EFIAPI SmmCpuFeaturesRendezvousEntry(IN UINTN CpuIndex)
/* Processor specific hook point each time a CPU enters System Management Mode. */ VOID EFIAPI SmmCpuFeaturesRendezvousEntry(IN UINTN CpuIndex)
{ if (FeaturePcdGet (PcdSmrrEnable) && !mSmrrEnabled[CpuIndex]) { AsmWriteMsr64 (mSmrrPhysMaskMsr, AsmReadMsr64 (mSmrrPhysMaskMsr) | EFI_MSR_SMRR_PHYS_MASK_VALID); mSmrrEnabled[CpuIndex] = TRUE; } }
tianocore/edk2
C++
Other
4,240
/* Setup the peripherals required to communicate with the LCD. */
static void prvSetupLCD(void)
/* Setup the peripherals required to communicate with the LCD. */ static void prvSetupLCD(void)
{ PMCON = 0x83BF; PMMODE = 0x3FF; PMAEN = 1; PMADDR = 0x0000; vTaskDelay( lcdSHORT_DELAY ); PMDIN1 = lcdDEFAULT_FUNCTION; vTaskDelay( lcdSHORT_DELAY ); PMDIN1 = lcdDISPLAY_CONTROL; vTaskDelay( lcdSHORT_DELAY ); PMDIN1 = lcdCLEAR_DISPLAY; vTaskDelay( lcdSHORT_DELAY ); PMDIN1 = lcdENTRY_MODE; vTaskDelay( lcdSHORT_DELAY ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Released under the terms of the GNU GPL v2.0. */
struct file* file_lookup(const char *name)
/* Released under the terms of the GNU GPL v2.0. */ struct file* file_lookup(const char *name)
{ struct file *file; const char *file_name = sym_expand_string_value(name); for (file = file_list; file; file = file->next) { if (!strcmp(name, file->name)) { free((void *)file_name); return file; } } file = xmalloc(sizeof(*file)); memset(file, 0, sizeof(*file)); file->name = file_name; file->next = file_list; file_list = file; return file; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Returns success (0) or appropriate error code (none as of now) */
static void emac_set_type0addr(struct emac_priv *priv, rt_uint32_t ch, char *mac_addr)
/* Returns success (0) or appropriate error code (none as of now) */ static void emac_set_type0addr(struct emac_priv *priv, rt_uint32_t ch, char *mac_addr)
{ rt_uint32_t val; val = ((mac_addr[5] << 8) | (mac_addr[4])); emac_write(EMAC_MACSRCADDRLO, val); val = ((mac_addr[3] << 24) | (mac_addr[2] << 16) | \ (mac_addr[1] << 8) | (mac_addr[0])); emac_write(EMAC_MACSRCADDRHI, val); val = emac_read(EMAC_RXUNICASTSET); val |= BIT(ch); emac_write(EMAC_RXUNICASTSET, val); val = emac_read(EMAC_RXUNICASTCLEAR); val &= ~BIT(ch); emac_write(EMAC_RXUNICASTCLEAR, val); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Update or split memory allocation HOB for memory pages allocate and free. */
VOID UpdateOrSplitMemoryAllocationHob(IN OUT EFI_HOB_MEMORY_ALLOCATION *MemoryAllocationHob, IN EFI_PHYSICAL_ADDRESS Memory, IN UINT64 Bytes, IN EFI_MEMORY_TYPE MemoryType)
/* Update or split memory allocation HOB for memory pages allocate and free. */ VOID UpdateOrSplitMemoryAllocationHob(IN OUT EFI_HOB_MEMORY_ALLOCATION *MemoryAllocationHob, IN EFI_PHYSICAL_ADDRESS Memory, IN UINT64 Bytes, IN EFI_MEMORY_TYPE MemoryType)
{ if ((Memory + Bytes) < (MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress + MemoryAllocationHob->AllocDescriptor.MemoryLength)) { InternalBuildMemoryAllocationHob ( Memory + Bytes, (MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress + MemoryAllocationHob->AllocDescriptor.MemoryLength) - (Memory + Bytes), MemoryAllocationHob->AllocDescriptor.MemoryType ); } if (Memory > MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress) { InternalBuildMemoryAllocationHob ( MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress, Memory - MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress, MemoryAllocationHob->AllocDescriptor.MemoryType ); } MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress = Memory; MemoryAllocationHob->AllocDescriptor.MemoryLength = Bytes; MemoryAllocationHob->AllocDescriptor.MemoryType = MemoryType; }
tianocore/edk2
C++
Other
4,240
/* param negHysteresis The negative hysteresis value for the turned clock, this value in number of clock cycles of the fast clock param posHysteresis The positive hysteresis value for the turned clock, this value in number of clock cycles of the fast clock */
void CLOCK_OSC_SetOscRc400MHysteresisValue(uint8_t negHysteresis, uint8_t posHysteresis)
/* param negHysteresis The negative hysteresis value for the turned clock, this value in number of clock cycles of the fast clock param posHysteresis The positive hysteresis value for the turned clock, this value in number of clock cycles of the fast clock */ void CLOCK_OSC_SetOscRc400MHysteresisValue(uint8_t negHysteresis, uint8_t posHysteresis)
{ uint32_t tmp32; tmp32 = ANATOP_AI_Read(kAI_Itf_400m, kAI_RCOSC400M_CTRL1); tmp32 = ((tmp32 & ~(AI_RCOSC400M_CTRL1_HYST_PLUS_MASK | AI_RCOSC400M_CTRL1_HYST_MINUS_MASK)) | (AI_RCOSC400M_CTRL1_HYST_PLUS(posHysteresis) | AI_RCOSC400M_CTRL1_HYST_MINUS(negHysteresis))); ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL1, tmp32); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* zfcp_sg_free_table - free memory used by scatterlists @sg: pointer to scatterlist @count: number of scatterlist which are to be free'ed the scatterlist are expected to reference pages always */
void zfcp_sg_free_table(struct scatterlist *sg, int count)
/* zfcp_sg_free_table - free memory used by scatterlists @sg: pointer to scatterlist @count: number of scatterlist which are to be free'ed the scatterlist are expected to reference pages always */ void zfcp_sg_free_table(struct scatterlist *sg, int count)
{ int i; for (i = 0; i < count; i++, sg++) if (sg) free_page((unsigned long) sg_virt(sg)); else break; }
robutest/uclinux
C++
GPL-2.0
60
/* Callback functions that enumerate, mark, and collect dirty blocks */
static int nilfs_collect_file_data(struct nilfs_sc_info *sci, struct buffer_head *bh, struct inode *inode)
/* Callback functions that enumerate, mark, and collect dirty blocks */ static int nilfs_collect_file_data(struct nilfs_sc_info *sci, struct buffer_head *bh, struct inode *inode)
{ int err; err = nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); if (unlikely(err < 0)) return nilfs_handle_bmap_error(err, __func__, inode, sci->sc_super); err = nilfs_segctor_add_file_block(sci, bh, inode, sizeof(struct nilfs_binfo_v)); if (!err) sci->sc_datablk_cnt++; return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Wait for the initialization of devices to finish, to make sure we are done with our setup if the search for the root device starts. */
static int __init channel_subsystem_init_sync(void)
/* Wait for the initialization of devices to finish, to make sure we are done with our setup if the search for the root device starts. */ static int __init channel_subsystem_init_sync(void)
{ css_schedule_eval_all(); wait_event(css_eval_wq, atomic_read(&css_eval_scheduled) == 0); return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified CAN flag is set or not. */
FlagStatus CAN_GetFlagStatus(CAN_TypeDef *can, u32 flag)
/* Checks whether the specified CAN flag is set or not. */ FlagStatus CAN_GetFlagStatus(CAN_TypeDef *can, u32 flag)
{ return (FlagStatus)(((can->SR & flag) == flag) ? SET : RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */
unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */ unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); return (xHWREG(ulBase + SPI_CNTRL2) & SPI_CNTRL2_SLV_START_INTSTS); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns information for an available text mode that the output device(s) supports. */
EFI_STATUS EFIAPI FileBasedSimpleTextOutQueryMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows)
/* Returns information for an available text mode that the output device(s) supports. */ EFI_STATUS EFIAPI FileBasedSimpleTextOutQueryMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber, OUT UINTN *Columns, OUT UINTN *Rows)
{ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol; PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut; return (PassThruProtocol->QueryMode ( PassThruProtocol, ModeNumber, Columns, Rows )); }
tianocore/edk2
C++
Other
4,240
/* Returns a negative error code on failure, zero on success. */
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine)
/* Returns a negative error code on failure, zero on success. */ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine)
{ resource_size_t offset = ((resource_size_t)vma->vm_pgoff) << PAGE_SHIFT; struct resource *rp; int ret; rp = __pci_mmap_make_offset(dev, &offset, mmap_state); if (rp == NULL) return -EINVAL; vma->vm_pgoff = offset >> PAGE_SHIFT; vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp, vma->vm_page_prot, mmap_state, write_combine); ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This file is part of the Simba project. */
static struct hash_map_entry_t* entry_alloc(struct hash_map_t *self_p)
/* This file is part of the Simba project. */ static struct hash_map_entry_t* entry_alloc(struct hash_map_t *self_p)
{ struct hash_map_entry_t *entry_p; entry_p = self_p->entries_p; if (entry_p != NULL) { self_p->entries_p = entry_p->next_p; } return (entry_p); }
eerimoq/simba
C++
Other
337
/* Return the console tty driver structure and its associated index */
struct tty_driver* console_device(int *index)
/* Return the console tty driver structure and its associated index */ struct tty_driver* console_device(int *index)
{ struct console *c; struct tty_driver *driver = NULL; acquire_console_sem(); for_each_console(c) { if (!c->device) continue; driver = c->device(c, index); if (driver) break; } release_console_sem(); return driver; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* brief Initialize the external osc clock to given frequency. param iFreq : Desired frequency (must be equal to exact rate in Hz) return returns success or fail status. */
status_t CLOCK_SetupExtClocking(uint32_t iFreq)
/* brief Initialize the external osc clock to given frequency. param iFreq : Desired frequency (must be equal to exact rate in Hz) return returns success or fail status. */ status_t CLOCK_SetupExtClocking(uint32_t iFreq)
{ if (iFreq >= 32000000U) { return kStatus_Fail; } POWER_DisablePD(kPDRUNCFG_PD_XTAL32M); POWER_DisablePD(kPDRUNCFG_PD_LDOXO32M); SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK; s_Ext_Clk_Freq = iFreq; return kStatus_Success; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Configures the TIMx Output Compare 4 Fast feature. */
void TIM_ConfigOc4Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 4 Fast feature. */ void TIM_ConfigOc4Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr2 = 0; assert_param(IsTimList3Module(TIMx)); assert_param(IsTimOcFastState(TIM_OCFast)); tmpccmr2 = TIMx->CCMOD2; tmpccmr2 &= (uint16_t) ~((uint16_t)TIM_CCMOD2_OC4FEN); tmpccmr2 |= (uint16_t)(TIM_OCFast << 8); TIMx->CCMOD2 = tmpccmr2; }
pikasTech/PikaPython
C++
MIT License
1,403
/* get a block from the ring block buffer object */
rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
/* get a block from the ring block buffer object */ rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
{ rt_base_t level; rt_rbb_blk_t block = RT_NULL; rt_slist_t *node; RT_ASSERT(rbb); if (rt_slist_isempty(&rbb->blk_list)) return 0; level = rt_spin_lock_irqsave(&(rbb->spinlock)); for (node = rt_slist_first(&rbb->blk_list); node; node = rt_slist_next(node)) { block = rt_slist_entry(node, struct rt_rbb_blk, list); if (block->status == RT_RBB_BLK_PUT) { block->status = RT_RBB_BLK_GET; goto __exit; } } block = RT_NULL; __exit: rt_spin_unlock_irqrestore(&(rbb->spinlock), level); return block; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Put a byte into the ring buffer. If ring buffer is full, it will discard an old data and put into a new data. */
rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t ch)
/* Put a byte into the ring buffer. If ring buffer is full, it will discard an old data and put into a new data. */ rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t ch)
{ enum rt_ringbuffer_state old_state; RT_ASSERT(rb != RT_NULL); old_state = rt_ringbuffer_status(rb); rb->buffer_ptr[rb->write_index] = ch; if (rb->write_index == rb->buffer_size-1) { rb->write_mirror = ~rb->write_mirror; rb->write_index = 0; if (old_state == RT_RINGBUFFER_FULL) { rb->read_mirror = ~rb->read_mirror; rb->read_index = rb->write_index; } } else { rb->write_index++; if (old_state == RT_RINGBUFFER_FULL) rb->read_index = rb->write_index; } return 1; }
pikasTech/PikaPython
C++
MIT License
1,403
/* pdcs_unregister_pathentries - Routine called when unregistering the module. */
static void pdcs_unregister_pathentries(void)
/* pdcs_unregister_pathentries - Routine called when unregistering the module. */ static void pdcs_unregister_pathentries(void)
{ unsigned short i; struct pdcspath_entry *entry; for (i = 0; (entry = pdcspath_entries[i]); i++) { read_lock(&entry->rw_lock); if (entry->ready >= 2) kobject_put(&entry->kobj); read_unlock(&entry->rw_lock); } }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
/* Initializes the Low Level portion of the Host driver. */ USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost)
{ hhcd.Instance = USB_OTG_HS; hhcd.Init.Host_channels = 11; hhcd.Init.dma_enable = 0; hhcd.Init.low_power_enable = 0; hhcd.Init.phy_itface = HCD_PHY_EMBEDDED; hhcd.Init.Sof_enable = 0; hhcd.Init.speed = HCD_SPEED_HIGH; hhcd.Init.use_external_vbus = 1; hhcd.pData = phost; phost->pData = &hhcd; if (HAL_HCD_Init(&hhcd) != HAL_OK) { return USBH_FAIL; } USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd)); return USBH_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Marks the buffer finalized and restores the default callbacks. The channel buffer and channel buffer data structure are then freed automatically when the last reference is given up. */
static void relay_close_buf(struct rchan_buf *buf)
/* Marks the buffer finalized and restores the default callbacks. The channel buffer and channel buffer data structure are then freed automatically when the last reference is given up. */ static void relay_close_buf(struct rchan_buf *buf)
{ buf->finalized = 1; del_timer_sync(&buf->timer); kref_put(&buf->kref, relay_remove_buf); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Loops through present saa7134 cards, and assigns an ALSA device to each one */
static int cx25821_alsa_init(void)
/* Loops through present saa7134 cards, and assigns an ALSA device to each one */ static int cx25821_alsa_init(void)
{ struct cx25821_dev *dev = NULL; struct list_head *list; list_for_each(list, &cx25821_devlist) { dev = list_entry(list, struct cx25821_dev, devlist); cx25821_audio_initdev(dev); } if (dev == NULL) printk(KERN_INFO "cx25821 ERROR ALSA: no cx25821 cards found\n"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* load the RSA ASN1 private key into SSL context */
int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len)
/* load the RSA ASN1 private key into SSL context */ int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len)
{ return SSL_CTX_use_PrivateKey_ASN1(0, ctx, d, len); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Reset and initialize USB OTG peripheral to specified speed mode. */
static void main_otg_init(void)
/* Reset and initialize USB OTG peripheral to specified speed mode. */ static void main_otg_init(void)
{ otg_disable(); delay_ms(10); otg_enable(); otg_disable_id_pin(); otg_force_device_mode(); otg_enable_pad(); otg_enable(); switch (speed) { case 0: udd_low_speed_enable(); udd_high_speed_disable(); break; case 1: udd_low_speed_disable(); udd_high_speed_disable(); break; case 2: udd_low_speed_disable(); udd_high_speed_enable(); break; default: Assert(false); break; } otg_unfreeze_clock(); (void)Is_otg_clock_frozen(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Airpcap wrapper, used to get the frequency of an airpcap adapter */
gboolean airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannelInfo)
/* Airpcap wrapper, used to get the frequency of an airpcap adapter */ gboolean airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannelInfo)
{ if (!AirpcapLoaded) return FALSE; pChannelInfo->Frequency = 0; pChannelInfo->ExtChannel = 0; pChannelInfo->Reserved[0] = 0; pChannelInfo->Reserved[1] = 0; pChannelInfo->Reserved[2] = 0; if (airpcap_get_dll_state() == AIRPCAP_DLL_OLD){ guint channel = 0; guint chan_freq = 0; if (!airpcap_if_get_device_channel(ah, &channel)) return FALSE; chan_freq = ieee80211_chan_to_mhz(channel, TRUE); if (chan_freq == 0) return FALSE; pChannelInfo->Frequency = chan_freq; return TRUE; } else if (airpcap_get_dll_state() == AIRPCAP_DLL_OK){ return g_PAirpcapGetDeviceChannelEx (ah, pChannelInfo); } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330