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
/* Configures the clock dividers. This is used to derive the best DAI bit and frame clocks from the system or master clock. It's best to set the DAI bit and frame clocks as low as possible to save system power. */
int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div)
/* Configures the clock dividers. This is used to derive the best DAI bit and frame clocks from the system or master clock. It's best to set the DAI bit and frame clocks as low as possible to save system power. */ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div)
{ if (dai->ops && dai->ops->set_clkdiv) return dai->ops->set_clkdiv(dai, div_id, div); else return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* nt_challenge_response - NtChallengeResponse() - RFC 2433, Sect. A.5 @challenge: 8-octet Challenge (IN) @password: 0-to-256-unicode-char Password (IN; UTF-8) @password_len: Length of password @response: 24-octet Response (OUT) Returns: 0 on success, -1 on failure */
int nt_challenge_response(const u8 *challenge, const u8 *password, size_t password_len, u8 *response)
/* nt_challenge_response - NtChallengeResponse() - RFC 2433, Sect. A.5 @challenge: 8-octet Challenge (IN) @password: 0-to-256-unicode-char Password (IN; UTF-8) @password_len: Length of password @response: 24-octet Response (OUT) Returns: 0 on success, -1 on failure */ int nt_challenge_response(const u8 *challenge, const u8 *password, size_t password_len, u8 *response)
{ u8 password_hash[16]; if (nt_password_hash(password, password_len, password_hash)) return -1; challenge_response(challenge, password_hash, response); return 0; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Application initialization: at startup the application run in full demo mode (all features on, includes QTouch and segment LCD). Initialize the board IO configuration, clocks, QTouch library, xternal interrupts, NVIC and UI. SAM4L is running at 12 MHz from internal RCFAST (configured at 12MHz). Support and FAQ: visit */
void app_init(void)
/* Application initialization: at startup the application run in full demo mode (all features on, includes QTouch and segment LCD). Initialize the board IO configuration, clocks, QTouch library, xternal interrupts, NVIC and UI. SAM4L is running at 12 MHz from internal RCFAST (configured at 12MHz). Support and FAQ: visit */ void app_init(void)
{ board_init(); sysclk_init(); event_button_init(); event_qtouch_init(); ui_set_mcu_status(POWER_SCALING_PS1, SLEEP_MODE_RUN, 12000000, CPU_SRC_RC4M); ui_bm_init(); ioport_set_pin_level(LCD_BL_GPIO, IOPORT_PIN_LEVEL_HIGH); ui_lcd_init(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Computes the CRC checksum for a data buffer. */
uint8_t AD717X_ComputeCRC8(uint8_t *pBuf, uint8_t bufSize)
/* Computes the CRC checksum for a data buffer. */ uint8_t AD717X_ComputeCRC8(uint8_t *pBuf, uint8_t bufSize)
{ uint8_t i = 0; uint8_t crc = 0; while(bufSize) { for(i = 0x80; i != 0; i >>= 1) { if(((crc & 0x80) != 0) != ((*pBuf & i) != 0)) { crc <<= 1; crc ^= AD717X_CRC8_POLYNOMIAL_REPRESENTATION; } else { crc <<= 1; } } pBuf++; bufSize--; } return crc; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Enable direction change to down interrupt (DOWNIE). @rmtoll IER DOWNIE LPTIM_EnableIT_DOWN. */
void LPTIM_EnableIT_DOWN(LPTIM_Module *LPTIMx)
/* Enable direction change to down interrupt (DOWNIE). @rmtoll IER DOWNIE LPTIM_EnableIT_DOWN. */ void LPTIM_EnableIT_DOWN(LPTIM_Module *LPTIMx)
{ SET_BIT(LPTIMx->INTEN, LPTIM_INTEN_DOWNIE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Count the number of differing bytes and bits and return the first differing offset. */
static int countdiffs(unsigned char *buf, unsigned char *check_buf, unsigned offset, unsigned len, unsigned *bytesp, unsigned *bitsp)
/* Count the number of differing bytes and bits and return the first differing offset. */ static int countdiffs(unsigned char *buf, unsigned char *check_buf, unsigned offset, unsigned len, unsigned *bytesp, unsigned *bitsp)
{ unsigned i, bit; int first = -1; for (i = offset; i < offset + len; i++) if (buf[i] != check_buf[i]) { first = i; break; } while (i < offset + len) { if (buf[i] != check_buf[i]) { (*bytesp)++; bit = 1; while (bit < 256) { if ((buf[i] & bit) != (check_buf[i] & bit)) (*bitsp)++; bit <<= 1; } } i++; } return first; }
robutest/uclinux
C++
GPL-2.0
60
/* SVM sigmoid instance init function. Classes are integer used as output of the function (instead of having -1,1 as class values). */
void arm_svm_sigmoid_init_f32(arm_svm_sigmoid_instance_f32 *S, uint32_t nbOfSupportVectors, uint32_t vectorDimension, float32_t intercept, const float32_t *dualCoefficients, const float32_t *supportVectors, const int32_t *classes, float32_t coef0, float32_t gamma)
/* SVM sigmoid instance init function. Classes are integer used as output of the function (instead of having -1,1 as class values). */ void arm_svm_sigmoid_init_f32(arm_svm_sigmoid_instance_f32 *S, uint32_t nbOfSupportVectors, uint32_t vectorDimension, float32_t intercept, const float32_t *dualCoefficients, const float32_t *supportVectors, const int32_t *classes, float32_t coef0, float32_t gamma)
{ S->nbOfSupportVectors = nbOfSupportVectors; S->vectorDimension = vectorDimension; S->intercept = intercept; S->dualCoefficients = dualCoefficients; S->supportVectors = supportVectors; S->classes = classes; S->coef0 = coef0; S->gamma = gamma; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Writeback is about to end against a page which has been marked for immediate reclaim. If it still appears to be reclaimable, move it to the tail of the inactive list. */
void rotate_reclaimable_page(struct page *page)
/* Writeback is about to end against a page which has been marked for immediate reclaim. If it still appears to be reclaimable, move it to the tail of the inactive list. */ void rotate_reclaimable_page(struct page *page)
{ if (!PageLocked(page) && !PageDirty(page) && !PageActive(page) && !PageUnevictable(page) && PageLRU(page)) { struct pagevec *pvec; unsigned long flags; page_cache_get(page); local_irq_save(flags); pvec = &__get_cpu_var(lru_rotate_pvecs); if (!pagevec_add(pvec, page)) pagevec_move_tail(pvec); local_irq_restore(flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. */
UINTN EFIAPI CryptoServiceSha256GetContextSize(VOID)
/* Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations. */ UINTN EFIAPI CryptoServiceSha256GetContextSize(VOID)
{ return CALL_BASECRYPTLIB (Sha256.Services.GetContextSize, Sha256GetContextSize, (), 0); }
tianocore/edk2
C++
Other
4,240
/* Finds image given version number. Returns the slot number image is in, or -1 if not found. */
int img_mgmt_find_by_ver(struct image_version *find, uint8_t *hash)
/* Finds image given version number. Returns the slot number image is in, or -1 if not found. */ int img_mgmt_find_by_ver(struct image_version *find, uint8_t *hash)
{ int i; struct image_version ver; for (i = 0; i < 2 * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) { if (img_mgmt_read_info(i, &ver, hash, NULL) != 0) { continue; } if (!memcmp(find, &ver, sizeof(ver))) { return i; } } return -1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3IoBitFieldAnd32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI S3IoBitFieldAnd32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
{ return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldAnd32 (Port, StartBit, EndBit, AndData)); }
tianocore/edk2
C++
Other
4,240
/* param base eDMA peripheral base address. param channel eDMA channel number. param srcModulo A source modulo value. param destModulo A destination modulo value. */
void EDMA_SetModulo(DMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo)
/* param base eDMA peripheral base address. param channel eDMA channel number. param srcModulo A source modulo value. param destModulo A destination modulo value. */ void EDMA_SetModulo(DMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo)
{ assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL); uint32_t tmpreg; tmpreg = base->TCD[channel].ATTR & (~(DMA_ATTR_SMOD_MASK | DMA_ATTR_DMOD_MASK)); base->TCD[channel].ATTR = tmpreg | DMA_ATTR_DMOD(destModulo) | DMA_ATTR_SMOD(srcModulo); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Enables the packet output hardware. It must already be configured. */
void cvmx_pko_enable(void)
/* Enables the packet output hardware. It must already be configured. */ void cvmx_pko_enable(void)
{ union cvmx_pko_reg_flags flags; flags.u64 = cvmx_read_csr(CVMX_PKO_REG_FLAGS); if (flags.s.ena_pko) cvmx_dprintf ("Warning: Enabling PKO when PKO already enabled.\n"); flags.s.ena_dwb = 1; flags.s.ena_pko = 1; flags.s.store_be = 1; cvmx_write_csr(CVMX_PKO_REG_FLAGS, flags.u64); }
robutest/uclinux
C++
GPL-2.0
60
/* check whether new label 'lb' matches any pending gotos in current block; solves forward jumps */
static void findgotos(LexState *ls, Labeldesc *lb)
/* check whether new label 'lb' matches any pending gotos in current block; solves forward jumps */ static void findgotos(LexState *ls, Labeldesc *lb)
{ if (eqstr(gl->arr[i].name, lb->name)) closegoto(ls, i, lb); else i++; } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* check for address/control field and skip if allowed retval != 0 -> discard packet silently */
static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
/* check for address/control field and skip if allowed retval != 0 -> discard packet silently */ static int isdn_ppp_skip_ac(struct ippp_struct *is, struct sk_buff *skb)
{ if (skb->len < 1) return -1; if (skb->data[0] == 0xff) { if (skb->len < 2) return -1; if (skb->data[1] != 0x03) return -1; skb_pull(skb, 2); } else { if (is->pppcfg & SC_REJ_COMP_AC) return -1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Write buffer management. All of these assume proper locks taken by the caller. */
static int acm_wb_alloc(struct acm *acm)
/* Write buffer management. All of these assume proper locks taken by the caller. */ static int acm_wb_alloc(struct acm *acm)
{ int i, wbn; struct acm_wb *wb; wbn = 0; i = 0; for (;;) { wb = &acm->wb[wbn]; if (!wb->use) { wb->use = 1; return wbn; } wbn = (wbn + 1) % ACM_NW; if (++i >= ACM_NW) return -1; } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: TRUE on success, FALSE if error is set */
gboolean g_spawn_command_line_async(const gchar *command_line, GError **error)
/* Returns: TRUE on success, FALSE if error is set */ gboolean g_spawn_command_line_async(const gchar *command_line, GError **error)
{ gboolean retval; gchar **argv = NULL; g_return_val_if_fail (command_line != NULL, FALSE); if (!g_shell_parse_argv (command_line, NULL, &argv, error)) return FALSE; retval = g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, error); g_strfreev (argv); return retval; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Non-FMP instance to unregister Esrt Entry from ESRT Cache. */
EFI_STATUS EFIAPI EsrtDxeUnRegisterEsrtEntry(IN EFI_GUID *FwClass)
/* Non-FMP instance to unregister Esrt Entry from ESRT Cache. */ EFI_STATUS EFIAPI EsrtDxeUnRegisterEsrtEntry(IN EFI_GUID *FwClass)
{ EFI_STATUS Status; if (FwClass == NULL) { return EFI_INVALID_PARAMETER; } Status = EfiAcquireLockOrFail (&mPrivate.NonFmpLock); if (EFI_ERROR (Status)) { return Status; } Status = DeleteEsrtEntry (FwClass, ESRT_FROM_NONFMP); EfiReleaseLock (&mPrivate.NonFmpLock); return Status; }
tianocore/edk2
C++
Other
4,240
/* DAC Channel Enable. Enable a digital to analog converter channel. After setting this enable, the DAC requires a t */
void dac_enable(uint32_t dac, int channel)
/* DAC Channel Enable. Enable a digital to analog converter channel. After setting this enable, the DAC requires a t */ void dac_enable(uint32_t dac, int channel)
{ switch (channel) { case DAC_CHANNEL1: DAC_CR(dac) |= DAC_CR_EN1; break; case DAC_CHANNEL2: DAC_CR(dac) |= DAC_CR_EN2; break; case DAC_CHANNEL_BOTH: DAC_CR(dac) |= (DAC_CR_EN1 | DAC_CR_EN2); break; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* To remove a packet from the receive queue you clear its PKT_IN_USE bit, and then bump the pointers. Once the pointers get to the end, they must be wrapped back to the start. */
void remove_receive(struct Port *PortP)
/* To remove a packet from the receive queue you clear its PKT_IN_USE bit, and then bump the pointers. Once the pointers get to the end, they must be wrapped back to the start. */ void remove_receive(struct Port *PortP)
{ writew(readw(PortP->RxRemove) & ~PKT_IN_USE, PortP->RxRemove); PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1; writew(RIO_OFF(PortP->Caddr, PortP->RxRemove), &PortP->PhbP->rx_remove); }
robutest/uclinux
C++
GPL-2.0
60
/* Installs driver module protocols and. Creates virtual device handles for ConIn, ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol, Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers. Installs Graphics Output protocol and/or UGA Draw protocol if needed. */
EFI_STATUS EFIAPI PciBusEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Installs driver module protocols and. Creates virtual device handles for ConIn, ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol, Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers. Installs Graphics Output protocol and/or UGA Draw protocol if needed. */ EFI_STATUS EFIAPI PciBusEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_HANDLE Handle; InitializePciDevicePool (); Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gPciBusDriverBinding, ImageHandle, &gPciBusComponentName, &gPciBusComponentName2 ); ASSERT_EFI_ERROR (Status); if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) { Handle = NULL; Status = gBS->InstallProtocolInterface ( &Handle, &gEfiPciHotPlugRequestProtocolGuid, EFI_NATIVE_INTERFACE, &mPciHotPlugRequest ); } return Status; }
tianocore/edk2
C++
Other
4,240
/* Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
/* Event handler for the USB device Start Of Frame event. */ void EVENT_USB_Device_StartOfFrame(void)
{ if (IdleMSRemaining) IdleMSRemaining--; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Description: Remove an IP address entry from the list pointed to by @head. Returns the entry on success, NULL on failure. The caller is responsible for calling the necessary locking functions. */
struct netlbl_af4list* netlbl_af4list_remove(__be32 addr, __be32 mask, struct list_head *head)
/* Description: Remove an IP address entry from the list pointed to by @head. Returns the entry on success, NULL on failure. The caller is responsible for calling the necessary locking functions. */ struct netlbl_af4list* netlbl_af4list_remove(__be32 addr, __be32 mask, struct list_head *head)
{ struct netlbl_af4list *entry; entry = netlbl_af4list_search_exact(addr, mask, head); if (entry == NULL) return NULL; netlbl_af4list_remove_entry(entry); return entry; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */
void Reset_Handler(void)
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */ void Reset_Handler(void)
{ uint32_t *pSrc, *pDest; pSrc = &_etext; pDest = &_srelocate; if (pSrc != pDest) { for (; pDest < &_erelocate;) { *pDest++ = *pSrc++; } } for (pDest = &_szero; pDest < &_ezero;) { *pDest++ = 0; } pSrc = (uint32_t *) & _sfixed; SCB->VTOR = ((uint32_t) pSrc & SCB_VTOR_TBLOFF_Msk); if (((uint32_t) pSrc >= IRAM_ADDR) && ((uint32_t) pSrc < IRAM_ADDR + IRAM_SIZE)) { SCB->VTOR |= 1 << SCB_VTOR_TBLBASE_Pos; } __libc_init_array(); main(); while (1); }
remotemcu/remcu-chip-sdks
C++
null
436
/* ixgbe_clean_tx_ring - Free Tx Buffers @adapter: board private structure @tx_ring: ring to be cleaned */
static void ixgbe_clean_tx_ring(struct ixgbe_adapter *adapter, struct ixgbe_ring *tx_ring)
/* ixgbe_clean_tx_ring - Free Tx Buffers @adapter: board private structure @tx_ring: ring to be cleaned */ static void ixgbe_clean_tx_ring(struct ixgbe_adapter *adapter, struct ixgbe_ring *tx_ring)
{ struct ixgbe_tx_buffer *tx_buffer_info; unsigned long size; unsigned int i; for (i = 0; i < tx_ring->count; i++) { tx_buffer_info = &tx_ring->tx_buffer_info[i]; ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info); } size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; memset(tx_ring->tx_buffer_info, 0, size); memset(tx_ring->desc, 0, tx_ring->size); tx_ring->next_to_use = 0; tx_ring->next_to_clean = 0; if (tx_ring->head) writel(0, adapter->hw.hw_addr + tx_ring->head); if (tx_ring->tail) writel(0, adapter->hw.hw_addr + tx_ring->tail); }
robutest/uclinux
C++
GPL-2.0
60
/* Delay loop to delay at least n number of microseconds. */
void delay_cycles_us(uint32_t n)
/* Delay loop to delay at least n number of microseconds. */ void delay_cycles_us(uint32_t n)
{ while (n--) { delay_cycles(cycles_per_us); } }
memfault/zero-to-main
C++
null
200
/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read. */
void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read. */ void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
{ assert(buffer); assert(size / 6U == 0U); uint32_t i = 0, j = 0, data = 0; while (i < size) { while ((SPDIF_GetStatusFlag(base) & kSPDIF_RxFIFOFull) == 0U) { } data = SPDIF_ReadLeftData(base); for (j = 0; j < 3U; j++) { *buffer = ((data >> (j * 8U)) & 0xFFU); buffer++; } data = SPDIF_ReadRightData(base); for (j = 0; j < 3U; j++) { *buffer = ((data >> (j * 8U)) & 0xFFU); buffer++; } i += 6U; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Indicate to the mid and upper layers that an ATA command has completed. To be used from EH. */
void ata_eh_qc_complete(struct ata_queued_cmd *qc)
/* Indicate to the mid and upper layers that an ATA command has completed. To be used from EH. */ void ata_eh_qc_complete(struct ata_queued_cmd *qc)
{ struct scsi_cmnd *scmd = qc->scsicmd; scmd->retries = scmd->allowed; __ata_eh_qc_complete(qc); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Output a single byte to the serial port. */
void serial_putc(const char c)
/* Output a single byte to the serial port. */ void serial_putc(const char c)
{ while(!(UTRSTAT0 & 0x02)); UTXH0 = (unsigned char)c; if (c=='\n') serial_putc('\r'); }
EmcraftSystems/u-boot
C++
Other
181
/* USART check if Received Data Available. Check if data buffer holds a valid received data word. */
bool usart_is_recv_ready(uint32_t usart)
/* USART check if Received Data Available. Check if data buffer holds a valid received data word. */ bool usart_is_recv_ready(uint32_t usart)
{ return (USART_SR(usart) & USART_SR_RXNE); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Get the PWM duty of the PWM module. The */
unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the PWM duty of the PWM module. The */ unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulCMRData; unsigned long ulCNRData; xASSERT(PWMBaseValid(ulBase)); xASSERT((ulChannel >= 0) || (ulChannel <= 3)); ulCNRData = PWMARRGet(ulBase); ulCMRData = xHWREG(ulBase + TIMER_CCR1 + ulChannel * 4); ulChannel = (ulCMRData + 1) * 100 / (ulCNRData + 1); return ulChannel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_hello_sync(_GFreedesktopDBus *proxy, gchar **out_assigned_name, GCancellable *cancellable, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_hello_sync(_GFreedesktopDBus *proxy, gchar **out_assigned_name, GCancellable *cancellable, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "Hello", g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(s)", out_assigned_name); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* During the early booting, GuestType is set in the work area. Verify that it is an SEV guest. */
BOOLEAN IsSevGuest(VOID)
/* During the early booting, GuestType is set in the work area. Verify that it is an SEV guest. */ BOOLEAN IsSevGuest(VOID)
{ OVMF_WORK_AREA *WorkArea; ASSERT ( (UINTN)FixedPcdGet32 (PcdOvmfConfidentialComputingWorkAreaHeader) == sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER) ); WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase); return ((WorkArea != NULL) && (WorkArea->Header.GuestType == CcGuestTypeAmdSev)); }
tianocore/edk2
C++
Other
4,240
/* Increments OperationComplete variable and return its value before increment operation. */
uint32_t IncrementVar_OperationComplete(void)
/* Increments OperationComplete variable and return its value before increment operation. */ uint32_t IncrementVar_OperationComplete(void)
{ OperationComplete++; return (uint32_t)(OperationComplete -1); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Description: Removes the CIPSO option from a request socket, if present. */
void cipso_v4_req_delattr(struct request_sock *req)
/* Description: Removes the CIPSO option from a request socket, if present. */ void cipso_v4_req_delattr(struct request_sock *req)
{ struct ip_options *opt; struct inet_request_sock *req_inet; req_inet = inet_rsk(req); opt = req_inet->opt; if (opt == NULL || opt->cipso == 0) return; cipso_v4_delopt(&req_inet->opt); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base GPC CPU module base address. param mode CPU mode. Refer to "gpc_cpu_mode_t". param map Map value of the set point. Refer to "_gpc_setpoint_map". */
void GPC_CM_SetCpuModeSetPointMapping(GPC_CPU_MODE_CTRL_Type *base, gpc_cpu_mode_t mode, uint32_t map)
/* param base GPC CPU module base address. param mode CPU mode. Refer to "gpc_cpu_mode_t". param map Map value of the set point. Refer to "_gpc_setpoint_map". */ void GPC_CM_SetCpuModeSetPointMapping(GPC_CPU_MODE_CTRL_Type *base, gpc_cpu_mode_t mode, uint32_t map)
{ map = map & 0xFFFFUL; switch (mode) { case kGPC_RunMode: base->CM_RUN_MODE_MAPPING = map; break; case kGPC_WaitMode: base->CM_WAIT_MODE_MAPPING = map; break; case kGPC_StopMode: base->CM_STOP_MODE_MAPPING = map; break; case kGPC_SuspendMode: base->CM_SUSPEND_MODE_MAPPING = map; break; default: assert(false); break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write a command value to the SIFCMD register */
static void tms380tr_exec_sifcmd(struct net_device *dev, unsigned int WriteValue)
/* Write a command value to the SIFCMD register */ static void tms380tr_exec_sifcmd(struct net_device *dev, unsigned int WriteValue)
{ unsigned short cmd; unsigned short SifStsValue; unsigned long loop_counter; WriteValue = ((WriteValue ^ CMD_SYSTEM_IRQ) | CMD_INTERRUPT_ADAPTER); cmd = (unsigned short)WriteValue; loop_counter = 0,5 * 800000; do { SifStsValue = SIFREADW(SIFSTS); } while((SifStsValue & CMD_INTERRUPT_ADAPTER) && loop_counter--); SIFWRITEW(cmd, SIFCMD); return; }
robutest/uclinux
C++
GPL-2.0
60
/* no_tty - Ensure the current process does not have a controlling tty */
void no_tty(void)
/* no_tty - Ensure the current process does not have a controlling tty */ void no_tty(void)
{ struct task_struct *tsk = current; lock_kernel(); disassociate_ctty(0); unlock_kernel(); proc_clear_tty(tsk); }
robutest/uclinux
C++
GPL-2.0
60
/* Cancel the I/O request specified by cdev->req. Return non-zero if request has already finished, zero otherwise. */
int ccw_request_cancel(struct ccw_device *cdev)
/* Cancel the I/O request specified by cdev->req. Return non-zero if request has already finished, zero otherwise. */ int ccw_request_cancel(struct ccw_device *cdev)
{ struct subchannel *sch = to_subchannel(cdev->dev.parent); struct ccw_request *req = &cdev->private->req; int rc; if (req->done) return 1; req->cancel = 1; rc = cio_clear(sch); if (rc) ccwreq_stop(cdev, rc); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name. */
VOID FatCloneDirEnt(IN FAT_DIRENT *DirEnt1, IN FAT_DIRENT *DirEnt2)
/* Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name. */ VOID FatCloneDirEnt(IN FAT_DIRENT *DirEnt1, IN FAT_DIRENT *DirEnt2)
{ UINT8 *Entry1; UINT8 *Entry2; Entry1 = (UINT8 *)&DirEnt1->Entry; Entry2 = (UINT8 *)&DirEnt2->Entry; CopyMem ( Entry1 + FAT_ENTRY_INFO_OFFSET, Entry2 + FAT_ENTRY_INFO_OFFSET, sizeof (FAT_DIRECTORY_ENTRY) - FAT_ENTRY_INFO_OFFSET ); }
tianocore/edk2
C++
Other
4,240
/* This socket option is a boolean flag which turns on or off mapped V4 addresses. If this option is turned on and the socket is type PF_INET6, then IPv4 addresses will be mapped to V6 representation. If this option is turned off, then no mapping will be done of V4 addresses and a user will receive both PF_INET6 and PF_INET type addresses on the socket. */
static int sctp_getsockopt_mappedv4(struct sock *sk, int len, char __user *optval, int __user *optlen)
/* This socket option is a boolean flag which turns on or off mapped V4 addresses. If this option is turned on and the socket is type PF_INET6, then IPv4 addresses will be mapped to V6 representation. If this option is turned off, then no mapping will be done of V4 addresses and a user will receive both PF_INET6 and PF_INET type addresses on the socket. */ static int sctp_getsockopt_mappedv4(struct sock *sk, int len, char __user *optval, int __user *optlen)
{ int val; struct sctp_sock *sp = sctp_sk(sk); if (len < sizeof(int)) return -EINVAL; len = sizeof(int); val = sp->v4mapped; if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, &val, len)) return -EFAULT; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 1 if queue is unable to accept message, 0 otherwise */
static int rx_queue_full(struct tipc_msg *msg, u32 queue_size, u32 base)
/* Returns 1 if queue is unable to accept message, 0 otherwise */ static int rx_queue_full(struct tipc_msg *msg, u32 queue_size, u32 base)
{ u32 threshold; u32 imp = msg_importance(msg); if (imp == TIPC_LOW_IMPORTANCE) threshold = base; else if (imp == TIPC_MEDIUM_IMPORTANCE) threshold = base * 2; else if (imp == TIPC_HIGH_IMPORTANCE) threshold = base * 100; else return 0; if (msg_connected(msg)) threshold *= 4; return (queue_size >= threshold); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns non-zero if the value is changed, zero if not changed. */
void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, const struct snd_interval *b, struct snd_interval *c)
/* Returns non-zero if the value is changed, zero if not changed. */ void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, const struct snd_interval *b, struct snd_interval *c)
{ unsigned int r; if (a->empty || b->empty) { snd_interval_none(c); return; } c->empty = 0; c->min = muldiv32(a->min, k, b->max, &r); c->openmin = (r || a->openmin || b->openmax); if (b->min > 0) { c->max = muldiv32(a->max, k, b->min, &r); if (r) { c->max++; c->openmax = 1; } else c->openmax = (a->openmax || b->openmin); } else { c->max = UINT_MAX; c->openmax = 0; } c->integer = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* fc_linkdown() - Handler for transport linkdown events @lport: The local port whose link is down */
void fc_linkdown(struct fc_lport *lport)
/* fc_linkdown() - Handler for transport linkdown events @lport: The local port whose link is down */ void fc_linkdown(struct fc_lport *lport)
{ printk(KERN_INFO "host%d: libfc: Link down on port (%6x)\n", lport->host->host_no, fc_host_port_id(lport->host)); mutex_lock(&lport->lp_mutex); __fc_linkdown(lport); mutex_unlock(&lport->lp_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the driving current of specified GPIO pin(s). 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 GPIOPadConfigSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulStrength)
/* Selects the driving current of specified GPIO pin(s). 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 GPIOPadConfigSet(unsigned long ulPort, unsigned long ulPins, unsigned long ulStrength)
{ unsigned long ulPortBase; unsigned long ulBit; xASSERT(GPIOBaseValid(ulPort)); ulPortBase = GPIOToPortGet(ulPort); for(ulBit = 0; ulBit < 32; ulBit++) { if(((ulPins >> ulBit) & 1) != 0) { xHWREG(ulPortBase + PORT_PCR + ulBit * 4) &= ~PORT_PCR_DSE_HIGH ; xHWREG(ulPortBase + PORT_PCR + ulBit * 4) |= ulStrength ; } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Table 3, double precision floating-point comparison helper functions */
int __aeabi_dcmpeq(aeabi_double_t a, aeabi_double_t b)
/* Table 3, double precision floating-point comparison helper functions */ int __aeabi_dcmpeq(aeabi_double_t a, aeabi_double_t b)
{ return f64_eq (f64_from_d (a), f64_from_d (b)); }
tianocore/edk2
C++
Other
4,240
/* Application CLI prompt at the beginning of the program. */
int32_t cn0503_prompt(struct cn0503_dev *dev)
/* Application CLI prompt at the beginning of the program. */ int32_t cn0503_prompt(struct cn0503_dev *dev)
{ uint8_t buff[20]; int32_t ret; uint16_t data; ret = adpd410x_reg_read(dev->adpd4100_handler, ADPD410X_REG_CHIP_ID, &data); if(ret != SUCCESS) return FAILURE; data &= BITM_CHIP_ID; itoa(data, (char *)buff, 16); return cli_cmd_prompt(dev->cli_handler, buff); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* I2C communication The way we read a value is first writing the address we want to read and then wait for 2 bytes containing the data. */
int max17048_read_register(const struct device *dev, uint8_t registerId, uint16_t *response)
/* I2C communication The way we read a value is first writing the address we want to read and then wait for 2 bytes containing the data. */ int max17048_read_register(const struct device *dev, uint8_t registerId, uint16_t *response)
{ uint8_t max17048_buffer[2]; const struct max17048_config *cfg = dev->config; int rc = i2c_write_read_dt(&cfg->i2c, &registerId, sizeof(registerId), max17048_buffer, sizeof(max17048_buffer)); if (rc != 0) { LOG_ERR("Unable to read register, error %d", rc); return rc; } *response = sys_get_be16(max17048_buffer); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Function for processing the BLE_GAP_EVT_SEC_REQUEST event from the SoftDevice. */
static void sec_request_process(ble_gap_evt_t *p_gap_evt)
/* Function for processing the BLE_GAP_EVT_SEC_REQUEST event from the SoftDevice. */ static void sec_request_process(ble_gap_evt_t *p_gap_evt)
{ smd_evt_t evt = { .evt_id = SMD_EVT_SLAVE_SECURITY_REQ, .conn_handle = p_gap_evt->conn_handle, .params = { .slave_security_req = { .bond = p_gap_evt->params.sec_request.bond, .mitm = p_gap_evt->params.sec_request.mitm, } } }; evt_send(&evt); return; }
labapart/polymcu
C++
null
201
/* returns a pointer to a free area with at least 'sz' bytes */
LUALIB_API char* luaL_prepbuffsize(luaL_Buffer *B, size_t sz)
/* returns a pointer to a free area with at least 'sz' bytes */ LUALIB_API char* luaL_prepbuffsize(luaL_Buffer *B, size_t sz)
{ char *newbuff; size_t newsize = B->size * 2; if (newsize - B->n < sz) newsize = B->n + sz; if (newsize < B->n || newsize - B->n < sz) luaL_error(L, "buffer too large"); newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char)); memcpy(newbuff, B->b, B->n * sizeof(char)); if (buffonstack(B)) lua_remove(L, -2); B->b = newbuff; B->size = newsize; } return &B->b[B->n]; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* ZigBee Device Profile dissector for the extended active */
void dissect_zbee_zdp_req_ext_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the extended active */ void dissect_zbee_zdp_req_ext_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint16 device; device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Determines the flash page size for the specific EFM32 derivative. This is the minimum erase size. */
static blt_int32u FlashCalcPageSize(void)
/* Determines the flash page size for the specific EFM32 derivative. This is the minimum erase size. */ static blt_int32u FlashCalcPageSize(void)
{ blt_int8u family = *(blt_int8u *)0x0FE081FE; if ((family == 71) || (family == 73)) { return 512; } else if (family == 72) { return 4096; } else { return 2048; } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Interrupt handler routine This is not used in this version of the driver */
static irqreturn_t spi_a2f_irq(int irq, void *dev_id)
/* Interrupt handler routine This is not used in this version of the driver */ static irqreturn_t spi_a2f_irq(int irq, void *dev_id)
{ d_printk(1, "ok\n"); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* Function to check that PLL can be modified. */
static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLTypeDef *UTILS_PLLStruct)
/* Function to check that PLL can be modified. */ static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLTypeDef *UTILS_PLLStruct)
{ uint32_t pllfreq; UTILS_CheckPLLParameters(UTILS_PLLStruct); pllfreq = LL_RCC_CalcPLLClockFreq(PLL_InputFrequency, UTILS_PLLStruct->PLLM, UTILS_PLLStruct->PLLN, UTILS_PLLStruct->PLLFRACV, UTILS_PLLStruct->PLLP); return pllfreq; }
ua1arn/hftrx
C++
null
69
/* This API reads the mention no of byte of data from the given register address of auxiliary sensor. */
int8_t bmi160_aux_read(uint8_t reg_addr, uint8_t *aux_data, uint16_t len, const struct bmi160_dev *dev)
/* This API reads the mention no of byte of data from the given register address of auxiliary sensor. */ int8_t bmi160_aux_read(uint8_t reg_addr, uint8_t *aux_data, uint16_t len, const struct bmi160_dev *dev)
{ int8_t rslt = BMI160_OK; uint16_t map_len = 0; if ((dev == NULL) || (dev->read == NULL)) { rslt = BMI160_E_NULL_PTR; } else { if (dev->aux_cfg.aux_sensor_enable == BMI160_ENABLE) { rslt = map_read_len(&map_len, dev); if (rslt == BMI160_OK) { rslt = extract_aux_read(map_len, reg_addr, aux_data, len, dev); } } else { rslt = BMI160_E_INVALID_INPUT; } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* enable the SD I/O suspend operation(SD I/O only) */
void sdio_suspend_enable(void)
/* enable the SD I/O suspend operation(SD I/O only) */ void sdio_suspend_enable(void)
{ SDIO_CMDCTL |= SDIO_CMDCTL_SUSPEND; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 1 if the internal output buffer is empty, 0 if not. */
int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
/* Returns 1 if the internal output buffer is empty, 0 if not. */ int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
{ struct snd_rawmidi_runtime *runtime = substream->runtime; int result; unsigned long flags; if (runtime->buffer == NULL) { snd_printd("snd_rawmidi_transmit_empty: output is not active!!!\n"); return 1; } spin_lock_irqsave(&runtime->lock, flags); result = runtime->avail >= runtime->buffer_size; spin_unlock_irqrestore(&runtime->lock, flags); return result;}
robutest/uclinux
C++
GPL-2.0
60
/* Firmware is supposed to be responsible for this. If you are creating a new board port, do */
static void __init lite5200_fix_clock_config(void)
/* Firmware is supposed to be responsible for this. If you are creating a new board port, do */ static void __init lite5200_fix_clock_config(void)
{ struct device_node *np; struct mpc52xx_cdm __iomem *cdm; np = of_find_matching_node(NULL, mpc5200_cdm_ids); cdm = of_iomap(np, 0); of_node_put(np); if (!cdm) { printk(KERN_ERR "%s() failed; expect abnormal behaviour\n", __func__); return; } out_8(&cdm->ext_48mhz_en, 0x00); out_8(&cdm->fd_enable, 0x01); if (in_be32(&cdm->rstcfg) & 0x40) out_be16(&cdm->fd_counters, 0x0001); else out_be16(&cdm->fd_counters, 0x5555); iounmap(cdm); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* rb_set_list_to_head - set a list_head to be pointing to head. */
static void rb_set_list_to_head(struct ring_buffer_per_cpu *cpu_buffer, struct list_head *list)
/* rb_set_list_to_head - set a list_head to be pointing to head. */ static void rb_set_list_to_head(struct ring_buffer_per_cpu *cpu_buffer, struct list_head *list)
{ unsigned long *ptr; ptr = (unsigned long *)&list->next; *ptr |= RB_PAGE_HEAD; *ptr &= ~RB_PAGE_UPDATE; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determine the correct return code. Bytes Xferred No Wait Wait >= Minimum 0 0 < Minimum -EIO* -EAGAIN */
static int pipe_return_code(size_t min_xfer, size_t bytes_remaining, size_t bytes_requested)
/* Determine the correct return code. Bytes Xferred No Wait Wait >= Minimum 0 0 < Minimum -EIO* -EAGAIN */ static int pipe_return_code(size_t min_xfer, size_t bytes_remaining, size_t bytes_requested)
{ if (bytes_requested - bytes_remaining >= min_xfer) { return 0; } return -EAGAIN; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Decrement reference counter for data buffer. If it has been marked 'BH_Freed', release it and the page to which it belongs if possible. */
static void release_data_buffer(struct buffer_head *bh)
/* Decrement reference counter for data buffer. If it has been marked 'BH_Freed', release it and the page to which it belongs if possible. */ static void release_data_buffer(struct buffer_head *bh)
{ if (buffer_freed(bh)) { clear_buffer_freed(bh); release_buffer_page(bh); } else put_bh(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* param base SNVS peripheral base address param datetime Pointer to the structure where the alarm date and time details are stored. */
void SNVS_HP_RTC_GetAlarm(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
/* param base SNVS peripheral base address param datetime Pointer to the structure where the alarm date and time details are stored. */ void SNVS_HP_RTC_GetAlarm(SNVS_Type *base, snvs_hp_rtc_datetime_t *datetime)
{ assert(datetime); uint32_t alarmSeconds = 0U; alarmSeconds = (base->HPTAMR << 17U) | (base->HPTALR >> 15U); SNVS_HP_ConvertSecondsToDatetime(alarmSeconds, datetime); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks whether the specified SPI/I2S flag is set or not. */
FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG)
/* Checks whether the specified SPI/I2S flag is set or not. */ FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_I2S_GET_FLAG(SPI_I2S_FLAG)); if ((SPIx->SR & SPI_I2S_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* inactive,unreferenced -> inactive,referenced inactive,referenced -> active,unreferenced active,unreferenced -> active,referenced */
void mark_page_accessed(struct page *page)
/* inactive,unreferenced -> inactive,referenced inactive,referenced -> active,unreferenced active,unreferenced -> active,referenced */ void mark_page_accessed(struct page *page)
{ if (!PageActive(page) && !PageUnevictable(page) && PageReferenced(page) && PageLRU(page)) { activate_page(page); ClearPageReferenced(page); } else if (!PageReferenced(page)) { SetPageReferenced(page); } }
robutest/uclinux
C++
GPL-2.0
60
/* It does work common to all Bluetooth encapsulations, and then calls the dissector registered in the bluetooth.encap table to handle the metadata header in the packet. */
static gint dissect_bluetooth_btmon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* It does work common to all Bluetooth encapsulations, and then calls the dissector registered in the bluetooth.encap table to handle the metadata header in the packet. */ static gint dissect_bluetooth_btmon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{ bluetooth_data_t *bluetooth_data; bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree); bluetooth_data->previous_protocol_data_type = BT_PD_BTMON; bluetooth_data->previous_protocol_data.btmon = (struct btmon_phdr *)data; if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) { call_data_dissector(tvb, pinfo, tree); } return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Code to run on secondary just after probing the CPU */
static void __cpuinit bcm1480_init_secondary(void)
/* Code to run on secondary just after probing the CPU */ static void __cpuinit bcm1480_init_secondary(void)
{ extern void bcm1480_smp_init(void); bcm1480_smp_init(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Callers must own the device lock, so driver probe() entries don't need extra locking, but other call contexts may need to explicitly claim that lock. */
int usb_driver_claim_interface(struct usb_driver *driver, struct usb_interface *iface, void *priv)
/* Callers must own the device lock, so driver probe() entries don't need extra locking, but other call contexts may need to explicitly claim that lock. */ int usb_driver_claim_interface(struct usb_driver *driver, struct usb_interface *iface, void *priv)
{ struct device *dev = &iface->dev; struct usb_device *udev = interface_to_usbdev(iface); int retval = 0; if (dev->driver) return -EBUSY; dev->driver = &driver->drvwrap.driver; usb_set_intfdata(iface, priv); iface->needs_binding = 0; usb_pm_lock(udev); iface->condition = USB_INTERFACE_BOUND; mark_active(iface); atomic_set(&iface->pm_usage_cnt, !driver->supports_autosuspend); usb_pm_unlock(udev); if (device_is_registered(dev)) retval = device_bind_driver(dev); return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* The problem is that nUnits does not include this end-marker. It's quite difficult to discriminate whether the following 0xFFFF comes from the end-marker or some next data. */
static void gxv_LookupTable_fmt2_skip_endmarkers(FT_Bytes table, FT_UShort unitSize, GXV_Validator valid)
/* The problem is that nUnits does not include this end-marker. It's quite difficult to discriminate whether the following 0xFFFF comes from the end-marker or some next data. */ static void gxv_LookupTable_fmt2_skip_endmarkers(FT_Bytes table, FT_UShort unitSize, GXV_Validator valid)
{ FT_Bytes p = table; while ( ( p + 4 ) < valid->root->limit ) { if ( p[0] != 0xFF || p[1] != 0xFF || p[2] != 0xFF || p[3] != 0xFF ) break; p += unitSize; } valid->subtable_length = p - table; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param handle codec handle. return kStatus_Success is success, else de-initial failed. */
status_t HAL_CODEC_Deinit(void *handle)
/* param handle codec handle. return kStatus_Success is success, else de-initial failed. */ status_t HAL_CODEC_Deinit(void *handle)
{ assert(handle != NULL); return CS42888_Deinit((cs42888_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle))); }
eclipse-threadx/getting-started
C++
Other
310
/* Configures external clock mode of the GPTM. Used ETI as the clock source. The */
void TimerETIConfigure(unsigned long ulBase, unsigned long ulEXIPrescale, unsigned long ulEXIPolarity, unsigned char ucFilter)
/* Configures external clock mode of the GPTM. Used ETI as the clock source. The */ void TimerETIConfigure(unsigned long ulBase, unsigned long ulEXIPrescale, unsigned long ulEXIPolarity, unsigned char ucFilter)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulEXIPrescale == TIMER_ETIPSC_OFF) || (ulEXIPrescale == TIMER_ETIPSC_2) || (ulEXIPrescale == TIMER_ETIPSC_4) || (ulEXIPrescale == TIMER_ETIPSC_8)); xASSERT((ulEXIPolarity == TIMER_ETIPOL_NONINVERTED) || (ulEXIPolarity == TIMER_ETIPOL_INVERTED)); xASSERT((ucFilter >= 0) && (ucFilter <= 0x0F)); xHWREG(ulBase + TIMER_TRCFR) &= ~(TIMER_TRCFR_ETIPOL | TIMER_TRCFR_ETIPSC_M | TIMER_TRCFR_ETF_M); xHWREG(ulBase + TIMER_TRCFR) |= (ulEXIPrescale | ulEXIPolarity | ((unsigned long)ucFilter << 8)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The computation of z with magnitude of x and sign of y: z = (-1)^signbit(y) * abs(x), i.e. with the same sign bit as y, even if z is a NaN. Note: This function implements copysign from the IEEE-754 standard when no rounding occurs (e.g. if PREC(z) >= PREC(x)). */
int mpfr_copysign(mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
/* The computation of z with magnitude of x and sign of y: z = (-1)^signbit(y) * abs(x), i.e. with the same sign bit as y, even if z is a NaN. Note: This function implements copysign from the IEEE-754 standard when no rounding occurs (e.g. if PREC(z) >= PREC(x)). */ int mpfr_copysign(mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
{ return mpfr_set4 (z, x, rnd_mode, MPFR_SIGN (y)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read current logic level of all IO pins */
int pca953x_get_val(uint8_t chip)
/* Read current logic level of all IO pins */ int pca953x_get_val(uint8_t chip)
{ uint val; if (pca953x_reg_read(chip, PCA953X_IN, &val) < 0) return -1; return (int)val; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Deletes all entries from the store that are attached to the specified peer address. This function deletes security entries and CCCD records. */
int ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
/* Deletes all entries from the store that are attached to the specified peer address. This function deletes security entries and CCCD records. */ int ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
{ union ble_store_key key; int rc; memset(&key, 0, sizeof key); key.sec.peer_addr = *peer_id_addr; rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_OUR_SEC, &key); if (rc != 0) { return rc; } rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_PEER_SEC, &key); if (rc != 0) { return rc; } memset(&key, 0, sizeof key); key.cccd.peer_addr = *peer_id_addr; rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_CCCD, &key); if (rc != 0) { return rc; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Called on connect timeout and more. The PCB has been released when this function is called. */
static void on_tcp_err(void *arg_p, err_t err)
/* Called on connect timeout and more. The PCB has been released when this function is called. */ static void on_tcp_err(void *arg_p, err_t err)
{ struct socket_t *socket_p = arg_p; socket_p->pcb_p = NULL; if (socket_p->output.cb.state == STATE_CONNECT) { socket_p->output.cb.state = STATE_CLOSED; resume_thrd(socket_p->input.cb.thrd_p, -1); } }
eerimoq/simba
C++
Other
337
/* Description: Enables a low level driver to set an upper limit on the size of received requests. */
void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors)
/* Description: Enables a low level driver to set an upper limit on the size of received requests. */ void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors)
{ if ((max_sectors << 9) < PAGE_CACHE_SIZE) { max_sectors = 1 << (PAGE_CACHE_SHIFT - 9); printk(KERN_INFO "%s: set to minimum %d\n", __func__, max_sectors); } if (BLK_DEF_MAX_SECTORS > max_sectors) q->limits.max_hw_sectors = q->limits.max_sectors = max_sectors; else { q->limits.max_sectors = BLK_DEF_MAX_SECTORS; q->limits.max_hw_sectors = max_sectors; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Free-fall duration event. 1LSb = 1 / ODR. */
int32_t lsm6dsl_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Free-fall duration event. 1LSb = 1 / ODR. */ int32_t lsm6dsl_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lsm6dsl_wake_up_dur_t wake_up_dur; lsm6dsl_free_fall_t free_fall; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_WAKE_UP_DUR, (uint8_t*)&wake_up_dur, 1); if(ret == 0){ ret = lsm6dsl_read_reg(ctx, LSM6DSL_FREE_FALL, (uint8_t*)&free_fall, 1); } *val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. param xfer LPUART eDMA transfer structure, see #lpuart_transfer_t. retval kStatus_Success if succeed, others fail. retval kStatus_LPUART_RxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument. */
status_t LPUART_ReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. param xfer LPUART eDMA transfer structure, see #lpuart_transfer_t. retval kStatus_Success if succeed, others fail. retval kStatus_LPUART_RxBusy Previous transfer ongoing. retval kStatus_InvalidArgument Invalid argument. */ status_t LPUART_ReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer)
{ assert(handle); assert(handle->rxEdmaHandle); assert(xfer); assert(xfer->data); assert(xfer->dataSize); edma_transfer_config_t xferConfig; status_t status; if (kLPUART_RxBusy == handle->rxState) { status = kStatus_LPUART_RxBusy; } else { handle->rxState = kLPUART_RxBusy; handle->rxDataSizeAll = xfer->dataSize; EDMA_PrepareTransfer(&xferConfig, (void *)LPUART_GetDataRegisterAddress(base), sizeof(uint8_t), xfer->data, sizeof(uint8_t), sizeof(uint8_t), xfer->dataSize, kEDMA_PeripheralToMemory); handle->nbytes = sizeof(uint8_t); EDMA_SubmitTransfer(handle->rxEdmaHandle, &xferConfig); EDMA_StartTransfer(handle->rxEdmaHandle); LPUART_EnableRxDMA(base, true); status = kStatus_Success; } return status; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Invalidates range in all levels of D-cache/unified cache used: Affects the range */
void invalidate_dcache_range(unsigned long start, unsigned long stop)
/* Invalidates range in all levels of D-cache/unified cache used: Affects the range */ void invalidate_dcache_range(unsigned long start, unsigned long stop)
{ check_cache_range(start, stop); v7_dcache_maint_range(start, stop, ARMV7_DCACHE_INVAL_RANGE); v7_outer_cache_inval_range(start, stop); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Retrieve IRQ number for the given hardware instance. */
static uint8_t _adc_get_irq_num(const struct _adc_async_device *const device)
/* Retrieve IRQ number for the given hardware instance. */ static uint8_t _adc_get_irq_num(const struct _adc_async_device *const device)
{ return ADC0_IRQn + _adc_get_hardware_index(device->hw); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get flag bits of status register in the RTC. */
unsigned int RTC_GetSR(unsigned int mask)
/* Get flag bits of status register in the RTC. */ unsigned int RTC_GetSR(unsigned int mask)
{ unsigned int event; event = AT91C_BASE_RTC->RTC_SR; return (event & mask); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Cause or clear CIA interrupts, return old interrupt status. */
unsigned char cia_set_irq(struct ciabase *base, unsigned char mask)
/* Cause or clear CIA interrupts, return old interrupt status. */ unsigned char cia_set_irq(struct ciabase *base, unsigned char mask)
{ unsigned char old; old = (base->icr_data |= base->cia->icr); if (mask & CIA_ICR_SETCLR) base->icr_data |= mask; else base->icr_data &= ~mask; if (base->icr_data & base->icr_mask) amiga_custom.intreq = IF_SETCLR | base->int_mask; return old & base->icr_mask; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Calculate the checksum of a disk block and store it at the indicated position. */
void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh)
/* Calculate the checksum of a disk block and store it at the indicated position. */ void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh)
{ int cnt = sb->s_blocksize / sizeof(__be32); __be32 *ptr = (__be32 *)bh->b_data; u32 checksum; __be32 *checksumptr; checksumptr = ptr + 5; *checksumptr = 0; for (checksum = 0; cnt > 0; ptr++, cnt--) checksum += be32_to_cpu(*ptr); *checksumptr = cpu_to_be32(-checksum); }
robutest/uclinux
C++
GPL-2.0
60
/* function: nstime_to_msec converts nstime to double, time base is milli seconds */
double nstime_to_msec(const nstime_t *nstime)
/* function: nstime_to_msec converts nstime to double, time base is milli seconds */ double nstime_to_msec(const nstime_t *nstime)
{ return ((double)nstime->secs*1000 + (double)nstime->nsecs/1000000); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */
struct win_window* wtk_check_box_as_child(struct wtk_check_box *check_box)
/* This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. */ struct win_window* wtk_check_box_as_child(struct wtk_check_box *check_box)
{ Assert(check_box); return check_box->container; }
memfault/zero-to-main
C++
null
200
/* We are reconnecting to the backend, due to a suspend/resume, or a backend driver restart. We tear down our blkif structure and recreate it, but leave the device-layer structures intact so that this is transparent to the rest of the kernel. */
static int blkfront_resume(struct xenbus_device *dev)
/* We are reconnecting to the backend, due to a suspend/resume, or a backend driver restart. We tear down our blkif structure and recreate it, but leave the device-layer structures intact so that this is transparent to the rest of the kernel. */ static int blkfront_resume(struct xenbus_device *dev)
{ struct blkfront_info *info = dev_get_drvdata(&dev->dev); int err; dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename); blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); err = talk_to_backend(dev, info); if (info->connected == BLKIF_STATE_SUSPENDED && !err) err = blkif_recover(info); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* i2c_ackrcv - see if ack following write is true @dd: the infinipath device */
static int i2c_ackrcv(struct ipath_devdata *dd)
/* i2c_ackrcv - see if ack following write is true @dd: the infinipath device */ static int i2c_ackrcv(struct ipath_devdata *dd)
{ u8 ack_received; ack_received = sda_in(dd, 1); scl_out(dd, i2c_line_high); ack_received = sda_in(dd, 1) == 0; scl_out(dd, i2c_line_low); return ack_received; }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles External line 15_10 interrupt request. */
void EXTI15_10_IRQHandler(void)
/* This function handles External line 15_10 interrupt request. */ void EXTI15_10_IRQHandler(void)
{ *(__IO uint32_t *) 0xA0003000 = 0xFF; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Allow the host MCU app to configure auto TX rate selection algorithm. The application can use this API to tweak the algorithm performance. Moreover, it allows the application to force a specific WLAN PHY rate for transmitted data packets to favor range vs. throughput needs. */
NMI_API sint8 m2m_wifi_conf_auto_rate(tstrConfAutoRate *pstrConfAutoRate)
/* Allow the host MCU app to configure auto TX rate selection algorithm. The application can use this API to tweak the algorithm performance. Moreover, it allows the application to force a specific WLAN PHY rate for transmitted data packets to favor range vs. throughput needs. */ NMI_API sint8 m2m_wifi_conf_auto_rate(tstrConfAutoRate *pstrConfAutoRate)
{ sint8 s8ret = M2M_ERR_FAIL; s8ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CONG_AUTO_RATE, (uint8 *)pstrConfAutoRate,sizeof(tstrConfAutoRate),NULL,0,0); return s8ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Performs an atomic compare exchange operation on the 16-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. */
UINT16 EFIAPI InternalSyncCompareExchange16(IN OUT volatile UINT16 *Value, IN UINT16 CompareValue, IN UINT16 ExchangeValue)
/* Performs an atomic compare exchange operation on the 16-bit unsigned integer specified by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue, then Value is returned. The compare exchange operation must be performed using MP safe mechanisms. */ UINT16 EFIAPI InternalSyncCompareExchange16(IN OUT volatile UINT16 *Value, IN UINT16 CompareValue, IN UINT16 ExchangeValue)
{ __asm__ __volatile__ ( "lock \n\t" "cmpxchgw %2, %1 \n\t" : "+a" (CompareValue), "+m" (*Value) : "q" (ExchangeValue) : "memory", "cc" ); return CompareValue; }
tianocore/edk2
C++
Other
4,240
/* This function stop all smartcard timer of specified smartcard module. */
void SC_StopAllTimer(SC_T *sc)
/* This function stop all smartcard timer of specified smartcard module. */ void SC_StopAllTimer(SC_T *sc)
{ while (sc->ALTCTL & SC_ALTCTL_SYNC_Msk) { ; } sc->ALTCTL &= ~(SC_ALTCTL_CNTEN0_Msk | SC_ALTCTL_CNTEN1_Msk | SC_ALTCTL_CNTEN2_Msk); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Lock SMI in this SMM ready to lock event. */
EFI_STATUS EFIAPI BlSupportSmmReadyToLockCallback(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
/* Lock SMI in this SMM ready to lock event. */ EFI_STATUS EFIAPI BlSupportSmmReadyToLockCallback(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
{ LockSmiGlobalEn (); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns the serialized form of #CRFontSize. The returned string has to bee freed using g_free(). */
gchar* cr_font_size_to_string(CRFontSize *a_this)
/* Returns the serialized form of #CRFontSize. The returned string has to bee freed using g_free(). */ gchar* cr_font_size_to_string(CRFontSize *a_this)
{ gchar *str = NULL; if (!a_this) { str = g_strdup ("NULL"); g_return_val_if_fail (str, NULL); return str; } switch (a_this->type) { case PREDEFINED_ABSOLUTE_FONT_SIZE: str = g_strdup (cr_predefined_absolute_font_size_to_string (a_this->value.predefined)); break; case ABSOLUTE_FONT_SIZE: str = cr_num_to_string (&a_this->value.absolute); break; case RELATIVE_FONT_SIZE: str = g_strdup (cr_relative_font_size_to_string (a_this->value.relative)); break; case INHERITED_FONT_SIZE: str = g_strdup ("inherit"); break; default: break; } return str; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables the specified I2C DMA requests. */
void I2C_EnableDMA(I2C_Module *I2Cx, FunctionalState Cmd)
/* Enables or disables the specified I2C DMA requests. */ void I2C_EnableDMA(I2C_Module *I2Cx, FunctionalState Cmd)
{ assert_param(IS_I2C_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { I2Cx->CTRL2 |= CTRL2_DMAEN_SET; } else { I2Cx->CTRL2 &= CTRL2_DMAEN_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Since: 2.40 Returns: (transfer full): A new #GSubprocess, or NULL on error (and @error will be set) */
GSubprocess* g_subprocess_launcher_spawn(GSubprocessLauncher *launcher, GError **error, const gchar *argv0,...)
/* Since: 2.40 Returns: (transfer full): A new #GSubprocess, or NULL on error (and @error will be set) */ GSubprocess* g_subprocess_launcher_spawn(GSubprocessLauncher *launcher, GError **error, const gchar *argv0,...)
{ GSubprocess *result; GPtrArray *args; const gchar *arg; va_list ap; g_return_val_if_fail (argv0 != NULL && argv0[0] != '\0', NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); args = g_ptr_array_new (); va_start (ap, argv0); g_ptr_array_add (args, (gchar *) argv0); while ((arg = va_arg (ap, const gchar *))) g_ptr_array_add (args, (gchar *) arg); g_ptr_array_add (args, NULL); va_end (ap); result = g_subprocess_launcher_spawnv (launcher, (const gchar * const *) args->pdata, error); g_ptr_array_free (args, TRUE); return result; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ADC Software Triggered Conversion on Regular Channels. This starts conversion on a set of defined regular channels. Depending on the configuration bits EXTEN, a conversion will start immediately (software trigger configuration) or once a regular hardware trigger event occurs (hardware trigger configuration) */
void adc_start_conversion_regular(uint32_t adc)
/* ADC Software Triggered Conversion on Regular Channels. This starts conversion on a set of defined regular channels. Depending on the configuration bits EXTEN, a conversion will start immediately (software trigger configuration) or once a regular hardware trigger event occurs (hardware trigger configuration) */ void adc_start_conversion_regular(uint32_t adc)
{ ADC_CR(adc) |= ADC_CR_ADSTART; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* this function is a POSIX compliant version, which will get file information. */
int stat(const char *file, struct stat *buf)
/* this function is a POSIX compliant version, which will get file information. */ int stat(const char *file, struct stat *buf)
{ int result; if (file == NULL || buf == NULL) { rt_set_errno(EBADF); return -1; } result = dfs_file_stat(file, buf); if (result < 0) { rt_set_errno(-result); } return result; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Only data is little endian, addr has cpu endianess */
static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, __le16 *data, u16 count)
/* Only data is little endian, addr has cpu endianess */ static void hpi_write_words_le16(struct c67x00_device *dev, u16 addr, __le16 *data, u16 count)
{ unsigned long flags; int i; spin_lock_irqsave(&dev->hpi.lock, flags); hpi_write_reg(dev, HPI_ADDR, addr); for (i = 0; i < count; i++) hpi_write_reg(dev, HPI_DATA, le16_to_cpu(*data++)); spin_unlock_irqrestore(&dev->hpi.lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16* EFIAPI MmioWriteBuffer16(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT16 *Buffer)
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16* EFIAPI MmioWriteBuffer16(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT16 *Buffer)
{ UINT16 *ReturnBuffer; ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0); ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); ASSERT ((Length & (sizeof (UINT16) - 1)) == 0); ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0); ReturnBuffer = (UINT16 *)Buffer; while (Length > 0) { MmioWrite16 (StartAddress, *(Buffer++)); StartAddress += sizeof (UINT16); Length -= sizeof (UINT16); } return ReturnBuffer; }
tianocore/edk2
C++
Other
4,240
/* This function set the IECDPCTGTPERF register out of the performance level (4 - 128). */
static void set_performance(u32 perf)
/* This function set the IECDPCTGTPERF register out of the performance level (4 - 128). */ static void set_performance(u32 perf)
{ if(perf > 0x80) perf = 0x80; if(perf < 4) perf = 4; writel(perf, iec_base + IEC_DPCTGTPERF_OFFSET); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* GetResources() returns a list of resources currently consumed by the device. The ResourceList is a pointer to the buffer containing resource descriptors for the device. The descriptors are in the format of Small or Large ACPI resource descriptor as defined by ACPI specification (2.0 & 3.0). The buffer of resource descriptors is terminated with the 'End tag' resource descriptor. */
EFI_STATUS EFIAPI SioGetResources(IN CONST EFI_SIO_PROTOCOL *This, OUT ACPI_RESOURCE_HEADER_PTR *ResourceList)
/* GetResources() returns a list of resources currently consumed by the device. The ResourceList is a pointer to the buffer containing resource descriptors for the device. The descriptors are in the format of Small or Large ACPI resource descriptor as defined by ACPI specification (2.0 & 3.0). The buffer of resource descriptors is terminated with the 'End tag' resource descriptor. */ EFI_STATUS EFIAPI SioGetResources(IN CONST EFI_SIO_PROTOCOL *This, OUT ACPI_RESOURCE_HEADER_PTR *ResourceList)
{ SIO_DEV *SioDevice; if (ResourceList == NULL) { return EFI_INVALID_PARAMETER; } SioDevice = SIO_DEV_FROM_SIO (This); if (SioDevice->DeviceIndex < ARRAY_SIZE (mDevicesInfo)) { *ResourceList = mDevicesInfo[SioDevice->DeviceIndex].Resources; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240