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
|
|---|---|---|---|---|---|---|---|
/* Checks if a clock failure is detected.
Checks if a given clock failure is detected or not. */
|
bool system_clock_source_failure_is_detect(const enum system_clock_source clock_source)
|
/* Checks if a clock failure is detected.
Checks if a given clock failure is detected or not. */
bool system_clock_source_failure_is_detect(const enum system_clock_source clock_source)
|
{
uint32_t mask = 0;
switch (clock_source) {
case SYSTEM_CLOCK_SOURCE_XOSC:
mask = OSCCTRL_STATUS_XOSCFAIL;
return ((OSCCTRL->STATUS.reg & mask) == mask);
case SYSTEM_CLOCK_SOURCE_XOSC32K:
mask = OSC32KCTRL_STATUS_CLKFAIL;
return ((OSC32KCTRL->STATUS.reg & mask) == mask);
default:
return false;
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Fills a memory zone with a given constant byte, returns pointer to the memory zone. */
|
void* ixOsalMemSet(void *ptr, UINT8 filler, UINT32 count)
|
/* Fills a memory zone with a given constant byte, returns pointer to the memory zone. */
void* ixOsalMemSet(void *ptr, UINT8 filler, UINT32 count)
|
{
IX_OSAL_ASSERT (ptr != NULL);
return (memset (ptr, filler, count));
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* When the virtio_ring code wants to notify the Host, it calls us here and we make a hypercall. We hand the address of the virtqueue so the Host knows which virtqueue we're talking about. */
|
static void kvm_notify(struct virtqueue *vq)
|
/* When the virtio_ring code wants to notify the Host, it calls us here and we make a hypercall. We hand the address of the virtqueue so the Host knows which virtqueue we're talking about. */
static void kvm_notify(struct virtqueue *vq)
|
{
struct kvm_vqconfig *config = vq->priv;
kvm_hypercall1(KVM_S390_VIRTIO_NOTIFY, config->address);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Message: DisplayNotifyV2Message Opcode: 0x0143 Type: RegistrationAndManagement Direction: pbx2dev VarLength: yes */
|
static void handle_DisplayNotifyV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: DisplayNotifyV2Message Opcode: 0x0143 Type: RegistrationAndManagement Direction: pbx2dev VarLength: yes */
static void handle_DisplayNotifyV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function converts a multicast IP address to a multicast HW MAC address for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will be returned. */
|
EFI_STATUS EFIAPI SnpUndi32McastIpToMac(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC)
|
/* This function converts a multicast IP address to a multicast HW MAC address for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will be returned. */
EFI_STATUS EFIAPI SnpUndi32McastIpToMac(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC)
|
{
SNP_DRIVER *Snp;
EFI_TPL OldTpl;
EFI_STATUS Status;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
if ((IP == NULL) || (MAC == NULL)) {
return EFI_INVALID_PARAMETER;
}
Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
switch (Snp->Mode.State) {
case EfiSimpleNetworkInitialized:
break;
case EfiSimpleNetworkStopped:
Status = EFI_NOT_STARTED;
goto ON_EXIT;
default:
Status = EFI_DEVICE_ERROR;
goto ON_EXIT;
}
Status = PxeIp2Mac (Snp, IPv6, IP, MAC);
ON_EXIT:
gBS->RestoreTPL (OldTpl);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Find a socket that wants to accept the Call Request we just received. */
|
static struct sock* rose_find_listener(rose_address *addr, ax25_address *call)
|
/* Find a socket that wants to accept the Call Request we just received. */
static struct sock* rose_find_listener(rose_address *addr, ax25_address *call)
|
{
struct sock *s;
struct hlist_node *node;
spin_lock_bh(&rose_list_lock);
sk_for_each(s, node, &rose_list) {
struct rose_sock *rose = rose_sk(s);
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, call) &&
!rose->source_ndigis && s->sk_state == TCP_LISTEN)
goto found;
}
sk_for_each(s, node, &rose_list) {
struct rose_sock *rose = rose_sk(s);
if (!rosecmp(&rose->source_addr, addr) &&
!ax25cmp(&rose->source_call, &null_ax25_address) &&
s->sk_state == TCP_LISTEN)
goto found;
}
s = NULL;
found:
spin_unlock_bh(&rose_list_lock);
return s;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Add a socket to the bound sockets list. */
|
static void x25_insert_socket(struct sock *sk)
|
/* Add a socket to the bound sockets list. */
static void x25_insert_socket(struct sock *sk)
|
{
write_lock_bh(&x25_list_lock);
sk_add_node(sk, &x25_list);
write_unlock_bh(&x25_list_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return -1, 0 or 1 depending on the relative slopes of two lines. */
|
static int _cairo_slope_compare_sgn(double dx1, double dy1, double dx2, double dy2)
|
/* Return -1, 0 or 1 depending on the relative slopes of two lines. */
static int _cairo_slope_compare_sgn(double dx1, double dy1, double dx2, double dy2)
|
{
double c = (dx1 * dy2 - dx2 * dy1);
if (c > 0) return 1;
if (c < 0) return -1;
return 0;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* display the MMU context currently a process is currently using (un)pin a process's mm_struct's MMU context ID */
|
int cxn_pin_by_pid(pid_t pid)
|
/* display the MMU context currently a process is currently using (un)pin a process's mm_struct's MMU context ID */
int cxn_pin_by_pid(pid_t pid)
|
{
struct task_struct *tsk;
struct mm_struct *mm = NULL;
int ret;
if (pid == 0) {
cxn_pinned = -1;
return 0;
}
ret = -ESRCH;
read_lock(&tasklist_lock);
tsk = find_task_by_vpid(pid);
if (tsk) {
ret = -EINVAL;
task_lock(tsk);
if (tsk->mm) {
mm = tsk->mm;
atomic_inc(&mm->mm_users);
ret = 0;
}
task_unlock(tsk);
}
read_unlock(&tasklist_lock);
if (ret < 0)
return ret;
spin_lock(&cxn_owners_lock);
cxn_pinned = get_cxn(&mm->context);
spin_unlock(&cxn_owners_lock);
mmput(mm);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enables a Generic Clock that was previously configured.
Starts the clock generation of a Generic Clock that was previously configured via a call to */
|
void system_gclk_chan_enable(const uint8_t channel)
|
/* Enables a Generic Clock that was previously configured.
Starts the clock generation of a Generic Clock that was previously configured via a call to */
void system_gclk_chan_enable(const uint8_t channel)
|
{
system_interrupt_enter_critical_section();
GCLK->PCHCTRL[channel].reg |= GCLK_PCHCTRL_CHEN;
while (!(GCLK->PCHCTRL[channel].reg & GCLK_PCHCTRL_CHEN)) {
}
system_interrupt_leave_critical_section();
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Prepends a #GHook on the start of a #GHookList. */
|
void g_hook_prepend(GHookList *hook_list, GHook *hook)
|
/* Prepends a #GHook on the start of a #GHookList. */
void g_hook_prepend(GHookList *hook_list, GHook *hook)
|
{
g_return_if_fail (hook_list != NULL);
g_hook_insert_before (hook_list, hook_list->hooks, hook);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Set up the initial velocity_info struct for the device that has been discovered. */
|
static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, const struct velocity_info_tbl *info)
|
/* Set up the initial velocity_info struct for the device that has been discovered. */
static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, const struct velocity_info_tbl *info)
|
{
memset(vptr, 0, sizeof(struct velocity_info));
vptr->pdev = pdev;
vptr->chip_id = info->chip_id;
vptr->tx.numq = info->txqueue;
vptr->multicast_limit = MCAM_SIZE;
spin_lock_init(&vptr->lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the last ADC1 and ADC2 conversion result data in dual mode. */
|
uint32_t ADC_GetDualModeConversionDat(ADC_Module *ADCx)
|
/* Returns the last ADC1 and ADC2 conversion result data in dual mode. */
uint32_t ADC_GetDualModeConversionDat(ADC_Module *ADCx)
|
{
assert_param(IsAdcModule(ADCx));
if ((ADCx==ADC1) | (ADCx==ADC2))
return (uint32_t)ADC1->DAT;
else
return (uint32_t)ADC1->DAT;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This requires setting the bit in the chunk's free mask corresponding to the given slot. */
|
void xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
|
/* This requires setting the bit in the chunk's free mask corresponding to the given slot. */
void xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
|
{
uint slot;
xfs_log_item_chunk_t *licp;
xfs_log_item_chunk_t **licpp;
slot = xfs_lic_desc_to_slot(lidp);
licp = xfs_lic_desc_to_chunk(lidp);
xfs_lic_relse(licp, slot);
lidp->lid_item->li_desc = NULL;
tp->t_items_free++;
if (xfs_lic_are_all_free(licp) && (licp != &(tp->t_items))) {
licpp = &(tp->t_items.lic_next);
while (*licpp != licp) {
ASSERT(*licpp != NULL);
licpp = &((*licpp)->lic_next);
}
*licpp = licp->lic_next;
kmem_free(licp);
tp->t_items_free -= XFS_LIC_NUM_SLOTS;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* initialize the parameters of TLI layer LUT structure with the default values, it is suggested that call this function after a tli_layer_lut_parameter_struct structure is defined */
|
void tli_lut_struct_para_init(tli_layer_lut_parameter_struct *lut_struct)
|
/* initialize the parameters of TLI layer LUT structure with the default values, it is suggested that call this function after a tli_layer_lut_parameter_struct structure is defined */
void tli_lut_struct_para_init(tli_layer_lut_parameter_struct *lut_struct)
|
{
lut_struct->layer_table_addr = TLI_DEFAULT_VALUE;
lut_struct->layer_lut_channel_red = TLI_DEFAULT_VALUE;
lut_struct->layer_lut_channel_green = TLI_DEFAULT_VALUE;
lut_struct->layer_lut_channel_blue = TLI_DEFAULT_VALUE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* returns the clock source used as system clock */
|
RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
|
/* returns the clock source used as system clock */
RCM_SYSCLK_SEL_T RCM_ReadSYSCLKSource(void)
|
{
RCM_SYSCLK_SEL_T sysClock;
sysClock = (RCM_SYSCLK_SEL_T)RCM->CFG1_B.SCLKSWSTS;
return sysClock;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* brief Exit Limp mode warning The PLL should be set and locked prior to exiting Limp mode */
|
void clock_exit_limp(void)
|
/* brief Exit Limp mode warning The PLL should be set and locked prior to exiting Limp mode */
void clock_exit_limp(void)
|
{
volatile ccm_t *ccm = (volatile ccm_t *)MMAP_CCM;
volatile pll_t *pll = (volatile pll_t *)MMAP_PLL;
ccm->misccr &= ~CCM_MISCCR_LIMP;
while (!(pll->psr & PLL_PSR_LOCK)) ;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeInt64ToUintn(IN INT64 Operand, OUT UINTN *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToUintn(IN INT64 Operand, OUT UINTN *Result)
|
{
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeInt64ToUint32 (Operand, (UINT32 *)Result);
}
return SafeInt64ToUint64 (Operand, (UINT64 *)Result);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return: 0 on success, else -ENODEV or -EINVAL */
|
static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size)
|
/* Return: 0 on success, else -ENODEV or -EINVAL */
static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size)
|
{
return pci_generic_mmap_read_config(bus, pcie_xilinx_config_address,
bdf, offset, valuep, size);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This is a little worse than the above because it's "chunked copy_to_user". The return value is an error code, not an offset. */
|
static int copy_from_buf(const struct mon_reader_bin *this, unsigned int off, char __user *to, int length)
|
/* This is a little worse than the above because it's "chunked copy_to_user". The return value is an error code, not an offset. */
static int copy_from_buf(const struct mon_reader_bin *this, unsigned int off, char __user *to, int length)
|
{
unsigned int step_len;
unsigned char *buf;
unsigned int in_page;
while (length) {
step_len = length;
in_page = CHUNK_SIZE - (off & (CHUNK_SIZE-1));
if (in_page < step_len)
step_len = in_page;
buf = this->b_vec[off / CHUNK_SIZE].ptr + off % CHUNK_SIZE;
if (copy_to_user(to, buf, step_len))
return -EINVAL;
if ((off += step_len) >= this->b_size) off = 0;
to += step_len;
length -= step_len;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function make SPI module be ready to transfer. */
|
uint32_t SPI_Open(SPI_T *spi, uint32_t u32MasterSlave, uint32_t u32SPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
|
/* This function make SPI module be ready to transfer. */
uint32_t SPI_Open(SPI_T *spi, uint32_t u32MasterSlave, uint32_t u32SPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
|
{
uint32_t u32RetValue = 0U;
if (u32DataWidth == 32U)
{
u32DataWidth = 0U;
}
if (u32MasterSlave == SPI_MASTER)
{
spi->SSCTL = SPI_SS_ACTIVE_LOW;
spi->CTL = u32MasterSlave | (u32DataWidth << SPI_CTL_DWIDTH_Pos) | (u32SPIMode) | SPI_CTL_SPIEN_Msk;
spi->CLKDIV = (150000000U / u32BusClock) - 1U;
}
else
{
spi->SSCTL = SPI_SS_ACTIVE_LOW;
spi->CTL = u32MasterSlave | (u32DataWidth << SPI_CTL_DWIDTH_Pos) | (u32SPIMode) | SPI_CTL_SPIEN_Msk;
spi->CLKDIV = 1U;
}
return u32RetValue;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Parses T0SZ to determine the level and number of entries at the root of the translation table. */
|
STATIC VOID GetRootTranslationTableInfo(IN UINTN T0SZ, OUT UINTN *RootTableLevel, OUT UINTN *RootTableEntryCount)
|
/* Parses T0SZ to determine the level and number of entries at the root of the translation table. */
STATIC VOID GetRootTranslationTableInfo(IN UINTN T0SZ, OUT UINTN *RootTableLevel, OUT UINTN *RootTableEntryCount)
|
{
*RootTableLevel = (T0SZ - MIN_T0SZ) / BITS_PER_LEVEL;
*RootTableEntryCount = TT_ENTRY_COUNT >> (T0SZ - MIN_T0SZ) % BITS_PER_LEVEL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Marks a mapping record associated with device with short_addr as invalid at a certain frame number, typically when a disassociation occurs. */
|
gboolean ieee802154_short_addr_invalidate(guint16 short_addr, guint16 pan, guint fnum)
|
/* Marks a mapping record associated with device with short_addr as invalid at a certain frame number, typically when a disassociation occurs. */
gboolean ieee802154_short_addr_invalidate(guint16 short_addr, guint16 pan, guint fnum)
|
{
ieee802154_short_addr addr16;
ieee802154_map_rec *map_rec;
addr16.pan = pan;
addr16.addr = short_addr;
map_rec = (ieee802154_map_rec *)g_hash_table_lookup(ieee802154_map.short_table, &addr16);
if ( map_rec ) {
map_rec->end_fnum = fnum;
return TRUE;
}
return FALSE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Open 485 mode on the specified UART.
The */
|
void UART485Config(unsigned long ulBase, unsigned long ulBaud, unsigned long ul485Config, unsigned long ulUARTConfig)
|
/* Open 485 mode on the specified UART.
The */
void UART485Config(unsigned long ulBase, unsigned long ulBaud, unsigned long ul485Config, unsigned long ulUARTConfig)
|
{
xASSERT(UARTBaseValid(ulBase));
UARTConfigSetExpClk(ulBase, ulBaud, ulUARTConfig);
UARTModeSet(ulBase, USART_FUN_SEL_RS485_EN);
xHWREG(ulBase + USART_RS485CR) &= 0xFFFFFFF0;
xHWREG(ulBase + USART_RS485CR) |= ul485Config;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* param base eDMA peripheral base address. param channel eDMA channel number. note This function must not be called while the channel transfer is ongoing or it causes unpredictable results. note This function enables the auto stop request feature. */
|
void EDMA_ResetChannel(DMA_Type *base, uint32_t channel)
|
/* param base eDMA peripheral base address. param channel eDMA channel number. note This function must not be called while the channel transfer is ongoing or it causes unpredictable results. note This function enables the auto stop request feature. */
void EDMA_ResetChannel(DMA_Type *base, uint32_t channel)
|
{
assert(channel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL);
EDMA_TcdReset((edma_tcd_t *)(uint32_t)&base->TCD[channel]);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Set the display bottom right drawing limit.
Use this function to set the bottom right corner of the drawing limit box. */
|
void hx8347a_set_bottom_right_limit(hx8347a_coord_t x, hx8347a_coord_t y)
|
/* Set the display bottom right drawing limit.
Use this function to set the bottom right corner of the drawing limit box. */
void hx8347a_set_bottom_right_limit(hx8347a_coord_t x, hx8347a_coord_t y)
|
{
hx8347a_write_register(HX8347A_COLENDHIGH, (x >> 8));
hx8347a_write_register(HX8347A_COLENDLOW, (x & 0xff));
hx8347a_write_register(HX8347A_ROWENDHIGH, (y >> 8));
hx8347a_write_register(HX8347A_ROWENDLOW, (y & 0xff));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. */
|
void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)
|
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. */
void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)
|
{
assert(handle != NULL);
EDMA_AbortTransfer(handle->txHandle);
EDMA_AbortTransfer(handle->rxHandle);
FLEXIO_SPI_EnableDMA(base, (uint32_t)kFLEXIO_SPI_DmaAllEnable, false);
handle->txInProgress = false;
handle->rxInProgress = false;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calculate timebase value in order to get a timebase providing at least 1us. */
|
uint8_t ADC_TimebaseCalc(uint32_t hfperFreq)
|
/* Calculate timebase value in order to get a timebase providing at least 1us. */
uint8_t ADC_TimebaseCalc(uint32_t hfperFreq)
|
{
if (!hfperFreq)
{
hfperFreq = CMU_ClockFreqGet(cmuClock_HFPER);
if (!hfperFreq)
{
hfperFreq = 1;
}
}
hfperFreq += 999999;
hfperFreq /= 1000000;
return (uint8_t)(hfperFreq - 1);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Extract the pin's port base address from the given pin identifier. */
|
static GPIO_TypeDef* _port(gpio_t pin)
|
/* Extract the pin's port base address from the given pin identifier. */
static GPIO_TypeDef* _port(gpio_t pin)
|
{
return (GPIO_TypeDef *)(pin & ~(0x0f));
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Internal function. Used by the pool functions to allocate pages to back pool allocation requests. */
|
STATIC VOID* CoreAllocatePoolPagesI(IN EFI_MEMORY_TYPE PoolType, IN UINTN NoPages, IN UINTN Granularity, IN BOOLEAN NeedGuard)
|
/* Internal function. Used by the pool functions to allocate pages to back pool allocation requests. */
STATIC VOID* CoreAllocatePoolPagesI(IN EFI_MEMORY_TYPE PoolType, IN UINTN NoPages, IN UINTN Granularity, IN BOOLEAN NeedGuard)
|
{
VOID *Buffer;
EFI_STATUS Status;
Status = CoreAcquireLockOrFail (&gMemoryLock);
if (EFI_ERROR (Status)) {
return NULL;
}
Buffer = CoreAllocatePoolPages (PoolType, NoPages, Granularity, NeedGuard);
CoreReleaseMemoryLock ();
if (Buffer != NULL) {
if (NeedGuard) {
SetGuardForMemory ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, NoPages);
}
ApplyMemoryProtectionPolicy (
EfiConventionalMemory,
PoolType,
(EFI_PHYSICAL_ADDRESS)(UINTN)Buffer,
EFI_PAGES_TO_SIZE (NoPages)
);
}
return Buffer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function returns the size of the EEPROM in bytes. */
|
unsigned long EEPROMSizeGet(void)
|
/* This function returns the size of the EEPROM in bytes. */
unsigned long EEPROMSizeGet(void)
|
{
return(SIZE_FROM_EESIZE(HWREG(EEPROM_EESIZE)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The function is used to Enable BOD low power mode. */
|
void SysCtlBODLowPowerModeEnable(xtBoolean bEnable)
|
/* The function is used to Enable BOD low power mode. */
void SysCtlBODLowPowerModeEnable(xtBoolean bEnable)
|
{
SysCtlKeyAddrUnlock();
if(bEnable)
{
xHWREG(GCR_BODCR) |= GCR_BODCR_BOD_LPM;
}
else
{
xHWREG(GCR_BODCR) &= ~GCR_BODCR_BOD_LPM;
}
SysCtlKeyAddrLock();
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Dumps an @media rule statement to a file. */
|
void cr_statement_dump_media_rule(CRStatement *a_this, FILE *a_fp, gulong a_indent)
|
/* Dumps an @media rule statement to a file. */
void cr_statement_dump_media_rule(CRStatement *a_this, FILE *a_fp, gulong a_indent)
|
{
gchar *str = NULL ;
g_return_if_fail (a_this->type == AT_MEDIA_RULE_STMT);
str = cr_statement_media_rule_to_string (a_this, a_indent) ;
if (str) {
fprintf (a_fp, str) ;
g_free (str) ;
str = NULL ;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* fc_fcp_pkt_hold() - Hold a fcp_pkt @fsp: The FCP packet to be held */
|
static void fc_fcp_pkt_hold(struct fc_fcp_pkt *fsp)
|
/* fc_fcp_pkt_hold() - Hold a fcp_pkt @fsp: The FCP packet to be held */
static void fc_fcp_pkt_hold(struct fc_fcp_pkt *fsp)
|
{
atomic_inc(&fsp->ref_cnt);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Maximum duration is the maximum time of an overthreshold signal detection to be recognized as a tap event. The default value of these bits is 00b which corresponds to 4*ODR_XL time. If the SHOCK bits are set to a different value, 1LSB corresponds to 8*ODR_XL time.. */
|
int32_t lsm6dsl_tap_shock_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* Maximum duration is the maximum time of an overthreshold signal detection to be recognized as a tap event. The default value of these bits is 00b which corresponds to 4*ODR_XL time. If the SHOCK bits are set to a different value, 1LSB corresponds to 8*ODR_XL time.. */
int32_t lsm6dsl_tap_shock_set(stmdev_ctx_t *ctx, uint8_t val)
|
{
lsm6dsl_int_dur2_t int_dur2;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_INT_DUR2, (uint8_t*)&int_dur2, 1);
if(ret == 0){
int_dur2.shock = val;
ret = lsm6dsl_write_reg(ctx, LSM6DSL_INT_DUR2, (uint8_t*)&int_dur2, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Enable autoreload match interrupt (ARRMIE). @rmtoll IER ARRMIE LPTIM_EnableIT_ARRM. */
|
void LPTIM_EnableIT_ARRM(LPTIM_Module *LPTIMx)
|
/* Enable autoreload match interrupt (ARRMIE). @rmtoll IER ARRMIE LPTIM_EnableIT_ARRM. */
void LPTIM_EnableIT_ARRM(LPTIM_Module *LPTIMx)
|
{
SET_BIT(LPTIMx->INTEN, LPTIM_INTEN_ARRMIE);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Message: DisplayPriNotifyV2Message Opcode: 0x0144 Type: RegistrationAndManagement Direction: pbx2dev VarLength: yes */
|
static void handle_DisplayPriNotifyV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: DisplayPriNotifyV2Message Opcode: 0x0144 Type: RegistrationAndManagement Direction: pbx2dev VarLength: yes */
static void handle_DisplayPriNotifyV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_priority, 4, ENC_LITTLE_ENDIAN);
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns CR_OK upon successfull completion, an error code otherwise. */
|
enum CRStatus cr_statement_at_import_rule_set_url(CRStatement *a_this, CRString *a_url)
|
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_statement_at_import_rule_set_url(CRStatement *a_this, CRString *a_url)
|
{
g_return_val_if_fail (a_this
&& a_this->type == AT_IMPORT_RULE_STMT
&& a_this->kind.import_rule,
CR_BAD_PARAM_ERROR);
if (a_this->kind.import_rule->url) {
cr_string_destroy (a_this->kind.import_rule->url);
}
a_this->kind.import_rule->url = a_url;
return CR_OK;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Get register value according to the system context, and register index. */
|
UINT64 GetRegisterValue(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINT8 Index)
|
/* Get register value according to the system context, and register index. */
UINT64 GetRegisterValue(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINT8 Index)
|
{
switch (Index) {
case 0:
return SystemContext.SystemContextEbc->R0;
case 1:
return SystemContext.SystemContextEbc->R1;
case 2:
return SystemContext.SystemContextEbc->R2;
case 3:
return SystemContext.SystemContextEbc->R3;
case 4:
return SystemContext.SystemContextEbc->R4;
case 5:
return SystemContext.SystemContextEbc->R5;
case 6:
return SystemContext.SystemContextEbc->R6;
case 7:
return SystemContext.SystemContextEbc->R7;
default:
ASSERT (FALSE);
break;
}
return 0;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Accelerometer axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C. The value must be in the range .. */
|
int32_t lsm6dsl_xl_usr_offset_set(stmdev_ctx_t *ctx, uint8_t *buff)
|
/* Accelerometer axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C. The value must be in the range .. */
int32_t lsm6dsl_xl_usr_offset_set(stmdev_ctx_t *ctx, uint8_t *buff)
|
{
int32_t ret;
ret = lsm6dsl_write_reg(ctx, LSM6DSL_X_OFS_USR, buff, 3);
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
|
SDL_mutex* SDL_CreateMutex(void)
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
SDL_mutex* SDL_CreateMutex(void)
|
{
try {
SDL_mutex * mutex = new SDL_mutex;
return mutex;
} catch (std::system_error & ex) {
SDL_SetError("unable to create a C++ mutex: code=%d; %s", ex.code(), ex.what());
return NULL;
} catch (std::bad_alloc &) {
SDL_OutOfMemory();
return NULL;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* RTC Configuration RTC Clocked by LSI (see HAL_RTC_MspInit) */
|
static void RTC_Config(void)
|
/* RTC Configuration RTC Clocked by LSI (see HAL_RTC_MspInit) */
static void RTC_Config(void)
|
{
RTCHandle.Instance = RTC;
RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24;
RTCHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV;
RTCHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV;
RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if(HAL_RTC_Init(&RTCHandle) != HAL_OK)
{
Error_Handler();
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Wrapper for dissect_spdy_frame, sets fencing and desegments as necessary. */
|
static int dissect_spdy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
/* Wrapper for dissect_spdy_frame, sets fencing and desegments as necessary. */
static int dissect_spdy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
{
col_clear(pinfo->cinfo, COL_INFO);
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_spdy_message_len, dissect_spdy_frame, data);
return tvb_captured_length(tvb);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Fills each SDIO_CmdInitStruct member with its default value. */
|
void SDIO_CmdStructInit(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
|
/* Fills each SDIO_CmdInitStruct member with its default value. */
void SDIO_CmdStructInit(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)
|
{
SDIO_CmdInitStruct->SDIO_Argument = 0x00;
SDIO_CmdInitStruct->SDIO_CmdIndex = 0x00;
SDIO_CmdInitStruct->SDIO_Response = SDIO_Response_No;
SDIO_CmdInitStruct->SDIO_Wait = SDIO_Wait_No;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get the capture value from OSTIMER.
This function will get a capture decimal-value from OSTIMER. The RAW value of timer capture is gray code format, will be translated to decimal data internally. */
|
uint64_t OSTIMER_GetCaptureValue(OSTIMER_Type *base)
|
/* Get the capture value from OSTIMER.
This function will get a capture decimal-value from OSTIMER. The RAW value of timer capture is gray code format, will be translated to decimal data internally. */
uint64_t OSTIMER_GetCaptureValue(OSTIMER_Type *base)
|
{
uint64_t tmp = 0U;
tmp = OSTIMER_GetCaptureRawValue(base);
return OSTIMER_GrayToDecimal(tmp);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns: a string containing the value of the "etag:value" attribute. */
|
const char* g_file_info_get_etag(GFileInfo *info)
|
/* Returns: a string containing the value of the "etag:value" attribute. */
const char* g_file_info_get_etag(GFileInfo *info)
|
{
static guint32 attr = 0;
GFileAttributeValue *value;
g_return_val_if_fail (G_IS_FILE_INFO (info), NULL);
if (attr == 0)
attr = lookup_attribute (G_FILE_ATTRIBUTE_ETAG_VALUE);
value = g_file_info_find_value (info, attr);
return _g_file_attribute_value_get_string (value);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* param base PXP peripheral base address. param commandAddr Address of the new command. */
|
void PXP_SetNextCommand(PXP_Type *base, void *commandAddr)
|
/* param base PXP peripheral base address. param commandAddr Address of the new command. */
void PXP_SetNextCommand(PXP_Type *base, void *commandAddr)
|
{
pxp_pvoid_u32_t addr;
__DSB();
addr.pvoid = commandAddr;
base->NEXT = addr.u32 & PXP_NEXT_POINTER_MASK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* param handle WM8904 handle structure. param reg register address. oaram mask register bits mask. param value value to write. return kStatus_Success, else failed. */
|
status_t WM8904_ModifyRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t mask, uint16_t value)
|
/* param handle WM8904 handle structure. param reg register address. oaram mask register bits mask. param value value to write. return kStatus_Success, else failed. */
status_t WM8904_ModifyRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t mask, uint16_t value)
|
{
status_t result = kStatus_Success;
uint16_t regValue;
result = WM8904_ReadRegister(handle, reg, ®Value);
if (result != kStatus_WM8904_Success)
{
return result;
}
regValue &= (uint16_t)~mask;
regValue |= value;
return WM8904_WriteRegister(handle, reg, regValue);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
|
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
|
{
if(heth->Instance==ETH)
{
__HAL_RCC_ETH_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_14|GPIO_PIN_13|GPIO_PIN_11);
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable all interrupts on the CPU.
The "interrupt disable state" is an attribute of a thread. Thus, if a fiber or task disables interrupts and subsequently invokes a kernel routine that causes the calling thread to block, the interrupt disable state will be restored when the thread is later rescheduled for execution. */
|
unsigned int posix_irq_lock(void)
|
/* Disable all interrupts on the CPU.
The "interrupt disable state" is an attribute of a thread. Thus, if a fiber or task disables interrupts and subsequently invokes a kernel routine that causes the calling thread to block, the interrupt disable state will be restored when the thread is later rescheduled for execution. */
unsigned int posix_irq_lock(void)
|
{
return hw_irq_ctrl_change_lock(true);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Receive a piece of data for SPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
|
static void FLEXIO_SPI_TransferReceiveTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
|
/* Receive a piece of data for SPI master.
This function computes the number of data to receive from D register or Rx FIFO, and write the data to destination address. At the same time, this function updates the values in master handle structure. */
static void FLEXIO_SPI_TransferReceiveTransaction(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
|
{
uint16_t tmpData;
tmpData = FLEXIO_SPI_ReadData(base, handle->direction);
if (handle->rxData != NULL)
{
if (handle->bytePerFrame == 1U)
{
*handle->rxData = tmpData;
handle->rxData++;
}
else
{
*((uint16_t *)(handle->rxData)) = tmpData;
handle->rxData += 2U;
}
}
handle->rxRemainingBytes -= handle->bytePerFrame;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Set up the timer pin, possibly with the 8259A-master behind. */
|
static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin, int vector)
|
/* Set up the timer pin, possibly with the 8259A-master behind. */
static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin, int vector)
|
{
struct IO_APIC_route_entry entry;
if (intr_remapping_enabled)
return;
memset(&entry, 0, sizeof(entry));
entry.dest_mode = apic->irq_dest_mode;
entry.mask = 0;
entry.dest = apic->cpu_mask_to_apicid(apic->target_cpus());
entry.delivery_mode = apic->irq_delivery_mode;
entry.polarity = 0;
entry.trigger = 0;
entry.vector = vector;
set_irq_chip_and_handler_name(0, &ioapic_chip, handle_edge_irq, "edge");
ioapic_write_entry(apic_id, pin, entry);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Fill in columns if we got an error reading the packet. We set most columns to "???", fill in columns that don't need data read from the file, and set the Info column to an error message. */
|
void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
|
/* Fill in columns if we got an error reading the packet. We set most columns to "???", fill in columns that don't need data read from the file, and set the Info column to an error message. */
void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
|
{
int i;
col_item_t* col_item;
if (!cinfo)
return;
for (i = 0; i < cinfo->num_cols; i++) {
col_item = &cinfo->columns[i];
if (col_based_on_frame_data(cinfo, i)) {
if (fill_fd_colums)
col_fill_in_frame_data(fdata, cinfo, i, fill_col_exprs);
} else if (col_item->col_fmt == COL_INFO) {
col_item->col_data = "Read error";
} else {
if (col_item->col_fmt >= NUM_COL_FMTS) {
g_assert_not_reached();
}
col_item->col_data = "???";
break;
}
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Write a value to the specified pin(s). Write the corresponding bit values to the output pin(s) specified by */
|
void xGPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned long ulVal)
|
/* Write a value to the specified pin(s). Write the corresponding bit values to the output pin(s) specified by */
void xGPIOPinWrite(unsigned long ulPort, unsigned long ulPins, unsigned long ulVal)
|
{
xHWREG(ulPort + FIOMASK) = ~ulPins;
xHWREG(ulPort + FIOPIN) = ulVal;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Sets the state of a port pin that is configured as an output.
Sets the current output level of a port pin to a given logic level. */
|
void port_pin_set_output_level(const uint8_t gpio_pin, const bool level)
|
/* Sets the state of a port pin that is configured as an output.
Sets the current output level of a port pin to a given logic level. */
void port_pin_set_output_level(const uint8_t gpio_pin, const bool level)
|
{
PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin);
uint32_t pin_mask = (1UL << (gpio_pin % 32));
if (level) {
port_base->OUTSET.reg = pin_mask;
} else {
port_base->OUTCLR.reg = pin_mask;
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Reset the device Often needed on media change. */
|
static int usbat_device_reset(struct us_data *us)
|
/* Reset the device Often needed on media change. */
static int usbat_device_reset(struct us_data *us)
|
{
int rc;
rc = usbat_write_user_io(us,
USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0,
USBAT_UIO_EPAD | USBAT_UIO_1);
if (rc != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
rc = usbat_write_user_io(us,
USBAT_UIO_OE1 | USBAT_UIO_OE0,
USBAT_UIO_EPAD | USBAT_UIO_1);
if (rc != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
return USB_STOR_TRANSPORT_GOOD;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USB device mode management task. This function manages the Mass Storage Device class driver when the device is initialized in USB device mode. */
|
void USBDeviceMode_USBTask(void)
|
/* USB device mode management task. This function manages the Mass Storage Device class driver when the device is initialized in USB device mode. */
void USBDeviceMode_USBTask(void)
|
{
if (USB_CurrentMode != USB_MODE_Device)
return;
uIPManagement_ManageNetwork();
RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface_Device);
MS_Device_USBTask(&Disk_MS_Interface);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Note: This routine adjusts max_hw_segments to make room for appending the drain buffer. If you call blk_queue_max_hw_segments() or blk_queue_max_phys_segments() after calling this routine, you must set the limit to one fewer than your device can support otherwise there won't be room for the drain buffer. */
|
int blk_queue_dma_drain(struct request_queue *q, dma_drain_needed_fn *dma_drain_needed, void *buf, unsigned int size)
|
/* Note: This routine adjusts max_hw_segments to make room for appending the drain buffer. If you call blk_queue_max_hw_segments() or blk_queue_max_phys_segments() after calling this routine, you must set the limit to one fewer than your device can support otherwise there won't be room for the drain buffer. */
int blk_queue_dma_drain(struct request_queue *q, dma_drain_needed_fn *dma_drain_needed, void *buf, unsigned int size)
|
{
if (queue_max_hw_segments(q) < 2 || queue_max_phys_segments(q) < 2)
return -EINVAL;
blk_queue_max_hw_segments(q, queue_max_hw_segments(q) - 1);
blk_queue_max_phys_segments(q, queue_max_phys_segments(q) - 1);
q->dma_drain_needed = dma_drain_needed;
q->dma_drain_buffer = buf;
q->dma_drain_size = size;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* applesmc_get_fan_count - get the number of fans. Callers must NOT hold applesmc_lock. */
|
static int applesmc_get_fan_count(void)
|
/* applesmc_get_fan_count - get the number of fans. Callers must NOT hold applesmc_lock. */
static int applesmc_get_fan_count(void)
|
{
int ret;
u8 buffer[1];
mutex_lock(&applesmc_lock);
ret = applesmc_read_key(FANS_COUNT, buffer, 1);
mutex_unlock(&applesmc_lock);
if (ret)
return ret;
else
return buffer[0];
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function: MX25_RST Arguments: fsptr, pointer of flash status structure Description: The RST instruction is used as a system (software) reset that puts the device in normal operating Ready mode. Return Message: FlashOperationSuccess */
|
ReturnMsg MX25_RST(FlashStatus *fsptr)
|
/* Function: MX25_RST Arguments: fsptr, pointer of flash status structure Description: The RST instruction is used as a system (software) reset that puts the device in normal operating Ready mode. Return Message: FlashOperationSuccess */
ReturnMsg MX25_RST(FlashStatus *fsptr)
|
{
CS_Low();
SendByte( FLASH_CMD_RST, SIO );
CS_High();
fsptr->ArrangeOpt = FALSE;
fsptr->ModeReg = 0x00;
return FlashOperationSuccess;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* USBD_CtlSendStatus send zero lzngth packet on the ctl pipe. */
|
USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev)
|
/* USBD_CtlSendStatus send zero lzngth packet on the ctl pipe. */
USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev)
|
{
pdev->ep0_state = USBD_EP0_STATUS_IN;
(void)USBD_LL_Transmit(pdev, 0x00U, NULL, 0U);
return USBD_OK;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* configure the different system clocks
, V1.0.0, platform GD32F1x0(x=3,5) , V2.0.0, platform GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
|
void rcu_config(void)
|
/* configure the different system clocks
, V1.0.0, platform GD32F1x0(x=3,5) , V2.0.0, platform GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void rcu_config(void)
|
{
rcu_periph_clock_enable(RCU_ADC);
rcu_adc_clock_config(RCU_ADCCK_APB2_DIV6);
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* If a local timer interrupt has occurred, acknowledge and return 1. Otherwise, return 0. */
|
int twd_timer_ack(void)
|
/* If a local timer interrupt has occurred, acknowledge and return 1. Otherwise, return 0. */
int twd_timer_ack(void)
|
{
if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) {
__raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
return 1;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Calculates the improved timing values by specific baudrates for classical CAN. */
|
bool FLEXCAN_CalculateImprovedTimingValues(uint32_t baudRate, uint32_t sourceClock_Hz, flexcan_timing_config_t *pTimingConfig)
|
/* Calculates the improved timing values by specific baudrates for classical CAN. */
bool FLEXCAN_CalculateImprovedTimingValues(uint32_t baudRate, uint32_t sourceClock_Hz, flexcan_timing_config_t *pTimingConfig)
|
{
assert(baudRate <= MAX_CAN_BAUDRATE);
uint32_t clk;
uint32_t tqNum;
bool fgRet = false;
tqNum = CTRL1_MAX_TIME_QUANTA;
do
{
clk = baudRate * tqNum;
if (clk > sourceClock_Hz)
{
continue;
}
if ((sourceClock_Hz / clk * clk) != sourceClock_Hz)
{
continue;
}
pTimingConfig->preDivider = (uint16_t)(sourceClock_Hz / clk) - 1U;
if (pTimingConfig->preDivider > MAX_PRESDIV)
{
break;
}
if (FLEXCAN_GetSegments(baudRate, tqNum, pTimingConfig))
{
fgRet = true;
break;
}
} while (--tqNum >= CTRL1_MIN_TIME_QUANTA);
return fgRet;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Description: gets memory layout from the quad config table. This function also updates node_online_map with the nodes (quads) present. */
|
static void __init smp_dump_qct(void)
|
/* Description: gets memory layout from the quad config table. This function also updates node_online_map with the nodes (quads) present. */
static void __init smp_dump_qct(void)
|
{
struct sys_cfg_data *scd;
int node;
scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR);
nodes_clear(node_online_map);
for_each_node(node) {
if (scd->quads_present31_0 & (1 << node))
numaq_register_node(node, scd);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The tracer may use either sequence operations or its own copy to user routines. To simplify formating of a trace trace_seq_printf is used to store strings into a special buffer (@s). Then the output may be either used by the sequencer or pulled into another buffer. */
|
int trace_seq_printf(struct trace_seq *s, const char *fmt,...)
|
/* The tracer may use either sequence operations or its own copy to user routines. To simplify formating of a trace trace_seq_printf is used to store strings into a special buffer (@s). Then the output may be either used by the sequencer or pulled into another buffer. */
int trace_seq_printf(struct trace_seq *s, const char *fmt,...)
|
{
int len = (PAGE_SIZE - 1) - s->len;
va_list ap;
int ret;
if (s->full || !len)
return 0;
va_start(ap, fmt);
ret = vsnprintf(s->buffer + s->len, len, fmt, ap);
va_end(ap);
if (ret >= len) {
s->full = 1;
return 0;
}
s->len += ret;
return 1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* usbip_status shows status of usbip as long as this driver is bound to the target device. */
|
static ssize_t show_status(struct device *dev, struct device_attribute *attr, char *buf)
|
/* usbip_status shows status of usbip as long as this driver is bound to the target device. */
static ssize_t show_status(struct device *dev, struct device_attribute *attr, char *buf)
|
{
struct stub_device *sdev = dev_get_drvdata(dev);
int status;
if (!sdev) {
dev_err(dev, "sdev is null\n");
return -ENODEV;
}
spin_lock(&sdev->ud.lock);
status = sdev->ud.status;
spin_unlock(&sdev->ud.lock);
return snprintf(buf, PAGE_SIZE, "%d\n", status);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Receive a set of message from a netlink socket using handlers in nl_sock. */
|
int nl_recvmsgs_default(struct nl_sock *sk)
|
/* Receive a set of message from a netlink socket using handlers in nl_sock. */
int nl_recvmsgs_default(struct nl_sock *sk)
|
{
return nl_recvmsgs(sk, sk->s_cb);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Move the device towards the head of the device list. Need to be called while holding the zcrypt device list lock. Note: cards with speed_rating of 0 are kept at the end of the list. */
|
static void __zcrypt_increase_preference(struct zcrypt_device *zdev)
|
/* Move the device towards the head of the device list. Need to be called while holding the zcrypt device list lock. Note: cards with speed_rating of 0 are kept at the end of the list. */
static void __zcrypt_increase_preference(struct zcrypt_device *zdev)
|
{
struct zcrypt_device *tmp;
struct list_head *l;
if (zdev->speed_rating == 0)
return;
for (l = zdev->list.prev; l != &zcrypt_device_list; l = l->prev) {
tmp = list_entry(l, struct zcrypt_device, list);
if ((tmp->request_count + 1) * tmp->speed_rating <=
(zdev->request_count + 1) * zdev->speed_rating &&
tmp->speed_rating != 0)
break;
}
if (l == zdev->list.prev)
return;
list_move(&zdev->list, l);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if the socket ID and status are valid and set accordingly the global socket status.
set_socket_active_status */
|
void set_socket_active_status(INT32 Sd, INT32 Status)
|
/* Check if the socket ID and status are valid and set accordingly the global socket status.
set_socket_active_status */
void set_socket_active_status(INT32 Sd, INT32 Status)
|
{
if(M_IS_VALID_SD(Sd) && M_IS_VALID_STATUS(Status))
{
socket_active_status &= ~(1 << Sd);
socket_active_status |= (Status << Sd);
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* This service enables PEIMs to update the boot mode variable. */
|
EFI_STATUS EFIAPI PeiServicesSetBootMode(IN EFI_BOOT_MODE BootMode)
|
/* This service enables PEIMs to update the boot mode variable. */
EFI_STATUS EFIAPI PeiServicesSetBootMode(IN EFI_BOOT_MODE BootMode)
|
{
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
|
status_t SPDIF_TransferGetReceiveCount(SPDIF_Type *base, spdif_handle_t *handle, size_t *count)
|
/* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
status_t SPDIF_TransferGetReceiveCount(SPDIF_Type *base, spdif_handle_t *handle, size_t *count)
|
{
assert(handle);
status_t status = kStatus_Success;
if (handle->state != kSPDIF_Busy)
{
status = kStatus_NoTransferInProgress;
}
else
{
*count = (handle->transferSize[handle->queueDriver] - handle->spdifQueue[handle->queueDriver].dataSize);
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* the frequency of the profiling timer can be changed by writing a multiplier value into /proc/profile. */
|
int setup_profiling_timer(unsigned int)
|
/* the frequency of the profiling timer can be changed by writing a multiplier value into /proc/profile. */
int setup_profiling_timer(unsigned int)
|
{
int i;
if ( (!multiplier) || (calibration_result / multiplier < 500))
return -EINVAL;
for_each_possible_cpu(i)
per_cpu(prof_multiplier, i) = multiplier;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function initializes a packet FIFO. Initialization resets the FIFO such that it's empty and ready to use. */
|
XStatus XPacketFifoV100b_Initialize(XPacketFifoV100b *InstancePtr, u32 RegBaseAddress, u32 DataBaseAddress)
|
/* This function initializes a packet FIFO. Initialization resets the FIFO such that it's empty and ready to use. */
XStatus XPacketFifoV100b_Initialize(XPacketFifoV100b *InstancePtr, u32 RegBaseAddress, u32 DataBaseAddress)
|
{
XASSERT_NONVOID(InstancePtr != NULL);
InstancePtr->RegBaseAddress = RegBaseAddress;
InstancePtr->DataBaseAddress = DataBaseAddress;
InstancePtr->IsReady = XCOMPONENT_IS_READY;
XPF_V100B_RESET(InstancePtr);
return XST_SUCCESS;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Get to know the Rx FIFO is full or not from the specified port. */
|
xtBoolean UARTFIFORxIsFull(unsigned long ulBase)
|
/* Get to know the Rx FIFO is full or not from the specified port. */
xtBoolean UARTFIFORxIsFull(unsigned long ulBase)
|
{
xASSERT(UARTBaseValid(ulBase));
return((xHWREG(ulBase + UART_FSR) & UART_FSR_RX_FF) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* eeh_disable_irq - disable interrupt for the recovering device */
|
static void eeh_disable_irq(struct pci_dev *dev)
|
/* eeh_disable_irq - disable interrupt for the recovering device */
static void eeh_disable_irq(struct pci_dev *dev)
|
{
struct device_node *dn = pci_device_to_OF_node(dev);
if (dev->msi_enabled || dev->msix_enabled)
return;
if (!irq_has_action(dev->irq))
return;
PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;
disable_irq_nosync(dev->irq);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enables or disables the ADC DMA request after last transfer (Single-ADC mode) */
|
void ADC_DMARequestModeConfig(ADC_TypeDef *ADCx, uint32_t ADC_DMARequestMode)
|
/* Enables or disables the ADC DMA request after last transfer (Single-ADC mode) */
void ADC_DMARequestModeConfig(ADC_TypeDef *ADCx, uint32_t ADC_DMARequestMode)
|
{
assert_param(IS_ADC_ALL_PERIPH(ADCx));
ADCx->CFGR1 &= (uint32_t)~ADC_CFGR1_DMACFG;
ADCx->CFGR1 |= (uint32_t)ADC_DMARequestMode;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* \classmethod \constructor(id, ...) Create a new Pin object associated with the id. If additional arguments are given, they are used to initialise the pin. See */
|
STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)
|
/* \classmethod \constructor(id, ...) Create a new Pin object associated with the id. If additional arguments are given, they are used to initialise the pin. See */
STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)
|
{
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args);
pin_obj_init_helper(pin, n_args - 1, args + 1, &kw_args);
}
return (mp_obj_t)pin;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */
|
EFI_STATUS EFIAPI UfsBlockIoPeimGetDeviceNo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)
|
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */
EFI_STATUS EFIAPI UfsBlockIoPeimGetDeviceNo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)
|
{
*NumberBlockDevices = UFS_PEIM_MAX_LUNS;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This API writes the mention no of byte of data to the given register address of auxiliary sensor. */
|
int8_t bmi160_aux_write(uint8_t reg_addr, uint8_t *aux_data, uint16_t len, const struct bmi160_dev *dev)
|
/* This API writes the mention no of byte of data to the given register address of auxiliary sensor. */
int8_t bmi160_aux_write(uint8_t reg_addr, uint8_t *aux_data, uint16_t len, const struct bmi160_dev *dev)
|
{
int8_t rslt = BMI160_OK;
uint8_t count = 0;
if ((dev == NULL) || (dev->write == NULL))
{
rslt = BMI160_E_NULL_PTR;
}
else
{
for (; count < len; count++)
{
rslt = bmi160_set_regs(BMI160_AUX_IF_4_ADDR, aux_data, 1, dev);
dev->delay_ms(BMI160_AUX_COM_DELAY);
if (rslt == BMI160_OK)
{
rslt = bmi160_set_regs(BMI160_AUX_IF_3_ADDR, ®_addr, 1, dev);
dev->delay_ms(BMI160_AUX_COM_DELAY);
if (rslt == BMI160_OK && (count < len - 1))
{
aux_data++;
reg_addr++;
}
}
}
}
return rslt;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Disable AON Sleep Timer module instance.
AON Sleep Timer module instance disable. */
|
void aon_sleep_timer_disable(void)
|
/* Disable AON Sleep Timer module instance.
AON Sleep Timer module instance disable. */
void aon_sleep_timer_disable(void)
|
{
uint32_t regval;
AON_SLEEP_TIMER0->SINGLE_COUNT_DURATION.reg = 0;
regval = AON_SLEEP_TIMER0->CONTROL.reg;
regval &= ~AON_SLEEP_TIMER_CONTROL_RELOAD_ENABLE;
regval &= ~AON_SLEEP_TIMER_CONTROL_SINGLE_COUNT_ENABLE;
AON_SLEEP_TIMER0->CONTROL.reg = regval;
while (AON_SLEEP_TIMER0->CONTROL.reg & (1 << 14)) {
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* If you're not already dealing with a va_list consider using sprintf(). */
|
int vsprintf(char *buf, const char *fmt, va_list args)
|
/* If you're not already dealing with a va_list consider using sprintf(). */
int vsprintf(char *buf, const char *fmt, va_list args)
|
{
return vsnprintf_internal(buf, INT_MAX, fmt, args);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Factorization helper for the command state machine: Submit a CSW read and go to STAT state with counter (along path). */
|
static void ub_state_stat_counted(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
|
/* Factorization helper for the command state machine: Submit a CSW read and go to STAT state with counter (along path). */
static void ub_state_stat_counted(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
|
{
if (++cmd->stat_count >= 4) {
ub_state_sense(sc, cmd);
return;
}
if (__ub_state_stat(sc, cmd) != 0)
return;
cmd->state = UB_CMDST_STAT;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Performs a basic incremental step. The debt and step size are converted from bytes to "units of work"; then the function loops running single steps until adding that many units of work or finishing a cycle (pause state). Finally, it sets the debt that controls when next step will be performed. */
|
static void incstep(lua_State *L, global_State *g)
|
/* Performs a basic incremental step. The debt and step size are converted from bytes to "units of work"; then the function loops running single steps until adding that many units of work or finishing a cycle (pause state). Finally, it sets the debt that controls when next step will be performed. */
static void incstep(lua_State *L, global_State *g)
|
{
lu_mem work = singlestep(L);
debt -= work;
} while (debt > -stepsize && g->gcstate != GCSpause);
if (g->gcstate == GCSpause)
setpause(g);
else {
debt = (debt / stepmul) * WORK2MEM;
luaE_setdebt(g, debt);
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Receive single data through the USARTx peripheral.
@method UART_ReceiveData */
|
uint8_t UART_ReceiveData(UART_TypeDef *UARTx)
|
/* Receive single data through the USARTx peripheral.
@method UART_ReceiveData */
uint8_t UART_ReceiveData(UART_TypeDef *UARTx)
|
{
_ASSERT(IS_UART(UARTx));
return UARTx->RX_DATA.bit.VAL;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Retrieves the state of a port pin that is configured as an input.
Reads the current logic level of a port pin and returns the current level as a Boolean value. */
|
bool port_pin_get_input_level(const uint8_t gpio_pin)
|
/* Retrieves the state of a port pin that is configured as an input.
Reads the current logic level of a port pin and returns the current level as a Boolean value. */
bool port_pin_get_input_level(const uint8_t gpio_pin)
|
{
PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin);
uint32_t pin_mask = (1UL << (gpio_pin % 32));
return (port_base->IN.reg & pin_mask);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Sets the operating mode for the UART transmit interrupt. */
|
void UARTTxIntModeSet(uint32_t ui32Base, uint32_t ui32Mode)
|
/* Sets the operating mode for the UART transmit interrupt. */
void UARTTxIntModeSet(uint32_t ui32Base, uint32_t ui32Mode)
|
{
ASSERT(_UARTBaseValid(ui32Base));
ASSERT((ui32Mode == UART_TXINT_MODE_EOT) ||
(ui32Mode == UART_TXINT_MODE_FIFO));
HWREG(ui32Base + UART_O_CTL) = ((HWREG(ui32Base + UART_O_CTL) &
~(UART_TXINT_MODE_EOT |
UART_TXINT_MODE_FIFO)) | ui32Mode);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Open LIN mode on the specified UART.
The */
|
void UARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig)
|
/* Open LIN mode on the specified UART.
The */
void UARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig)
|
{
xASSERT(UARTBaseValid(ulBase));
xASSERT((ulConfig&UART_CONFIG_BKFL_MASK)<16);
UARTConfigSetExpClk(ulBase, ulBaud,
UART_CONFIG_WLEN_8 |
UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE);
UARTEnableLIN(ulBase);
xHWREG(ulBase + UART_LIN_BCNT) = (ulConfig);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Execute task if its the priority is appropriate */
|
static bool lv_task_exec(lv_task_t *lv_task_p)
|
/* Execute task if its the priority is appropriate */
static bool lv_task_exec(lv_task_t *lv_task_p)
|
{
bool exec = false;
uint32_t elp = lv_tick_elaps(lv_task_p->last_run);
if(elp >= lv_task_p->period) {
lv_task_p->last_run = lv_tick_get();
lv_task_p->task(lv_task_p->param);
if(lv_task_p->once != 0) lv_task_del(lv_task_p);
exec = true;
}
return exec;
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* This routine is to free all the pending completion-queue events to the back into the free pool for device reset. */
|
static void lpfc_sli4_cq_event_release_all(struct lpfc_hba *)
|
/* This routine is to free all the pending completion-queue events to the back into the free pool for device reset. */
static void lpfc_sli4_cq_event_release_all(struct lpfc_hba *)
|
{
LIST_HEAD(cqelist);
struct lpfc_cq_event *cqe;
unsigned long iflags;
spin_lock_irqsave(&phba->hbalock, iflags);
list_splice_init(&phba->sli4_hba.sp_fcp_xri_aborted_work_queue,
&cqelist);
list_splice_init(&phba->sli4_hba.sp_els_xri_aborted_work_queue,
&cqelist);
list_splice_init(&phba->sli4_hba.sp_asynce_work_queue,
&cqelist);
spin_unlock_irqrestore(&phba->hbalock, iflags);
while (!list_empty(&cqelist)) {
list_remove_head(&cqelist, cqe, struct lpfc_cq_event, list);
lpfc_sli4_cq_event_release(phba, cqe);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Add the SCB as selected by SCBPTR onto the on chip list of free hardware SCBs. This list is empty/unused if we are not performing SCB paging. */
|
static void ahc_add_curscb_to_free_list(struct ahc_softc *ahc)
|
/* Add the SCB as selected by SCBPTR onto the on chip list of free hardware SCBs. This list is empty/unused if we are not performing SCB paging. */
static void ahc_add_curscb_to_free_list(struct ahc_softc *ahc)
|
{
ahc_outb(ahc, SCB_TAG, SCB_LIST_NULL);
if ((ahc->flags & AHC_PAGESCBS) != 0) {
ahc_outb(ahc, SCB_NEXT, ahc_inb(ahc, FREE_SCBH));
ahc_outb(ahc, FREE_SCBH, ahc_inb(ahc, SCBPTR));
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function causes a systemwide reset. The exact type of the reset is defined by the EFI_GUID that follows the Null-terminated Unicode string passed into ResetData. If the platform does not recognize the EFI_GUID in ResetData the platform must pick a supported reset type to perform.The platform may optionally log the parameters from any non-normal reset that occurs. */
|
VOID EFIAPI ResetPlatformSpecific(IN UINTN DataSize, IN VOID *ResetData)
|
/* This function causes a systemwide reset. The exact type of the reset is defined by the EFI_GUID that follows the Null-terminated Unicode string passed into ResetData. If the platform does not recognize the EFI_GUID in ResetData the platform must pick a supported reset type to perform.The platform may optionally log the parameters from any non-normal reset that occurs. */
VOID EFIAPI ResetPlatformSpecific(IN UINTN DataSize, IN VOID *ResetData)
|
{
mInternalRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Check if USART is ready to send next byte. */
|
bool _usart_sync_is_ready_to_send(const struct _usart_sync_device *const device)
|
/* Check if USART is ready to send next byte. */
bool _usart_sync_is_ready_to_send(const struct _usart_sync_device *const device)
|
{
return hri_sercomusart_get_interrupt_DRE_bit(device->hw);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* ENET Tx function enable (include MAC and DMA module) */
|
void enet_tx_enable(void)
|
/* ENET Tx function enable (include MAC and DMA module) */
void enet_tx_enable(void)
|
{
ENET_MAC_CFG |= ENET_MAC_CFG_TEN;
enet_txfifo_flush();
ENET_DMA_CTL |= ENET_DMA_CTL_STE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* USB Device Configure Function Parameters: cfg: Device Configure/Deconfigure Return Value: None */
|
void USBD_Configure(BOOL cfg)
|
/* USB Device Configure Function Parameters: cfg: Device Configure/Deconfigure Return Value: None */
void USBD_Configure(BOOL cfg)
|
{
addr = 3 * 64 + EP_BUF_BASE;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Sets blocksize based on samplerate Chooses the closest predefined blocksize >= BLOCK_TIME_MS milliseconds */
|
static int select_blocksize(int samplerate, int block_time_ms)
|
/* Sets blocksize based on samplerate Chooses the closest predefined blocksize >= BLOCK_TIME_MS milliseconds */
static int select_blocksize(int samplerate, int block_time_ms)
|
{
int i;
int target;
int blocksize;
assert(samplerate > 0);
blocksize = ff_flac_blocksize_table[1];
target = (samplerate * block_time_ms) / 1000;
for(i=0; i<16; i++) {
if(target >= ff_flac_blocksize_table[i] && ff_flac_blocksize_table[i] > blocksize) {
blocksize = ff_flac_blocksize_table[i];
}
}
return blocksize;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Reads N bytes of data from the Mailbox, starting at the specified byte offset. */
|
int32_t ST25DV_ReadMailboxData(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t Offset, const uint16_t NbByte)
|
/* Reads N bytes of data from the Mailbox, starting at the specified byte offset. */
int32_t ST25DV_ReadMailboxData(ST25DV_Object_t *pObj, uint8_t *const pData, const uint16_t Offset, const uint16_t NbByte)
|
{
int32_t status = ST25DV_ERROR;
if( Offset <= ST25DV_MAX_MAILBOX_LENGTH )
{
status = pObj->IO.Read( ST25DV_ADDR_DATA_I2C, ST25DV_MAILBOX_RAM_REG + Offset, pData, NbByte );
}
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Checks if a Tx buffer transmission has occurred or not. */
|
uint32_t CANFD_IsTxBufTransmitOccur(CANFD_T *psCanfd, uint32_t u32TxBufIdx)
|
/* Checks if a Tx buffer transmission has occurred or not. */
uint32_t CANFD_IsTxBufTransmitOccur(CANFD_T *psCanfd, uint32_t u32TxBufIdx)
|
{
return ((CANFD_ReadReg(&psCanfd->TXBTO) & (0x1ul << u32TxBufIdx)) >> u32TxBufIdx);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ioc3_cb_output_lowat - called when the output low water mark is hit @port: port to output */
|
static void ioc3_cb_output_lowat(struct ioc3_port *port)
|
/* ioc3_cb_output_lowat - called when the output low water mark is hit @port: port to output */
static void ioc3_cb_output_lowat(struct ioc3_port *port)
|
{
unsigned long pflags;
if (port->ip_port) {
spin_lock_irqsave(&port->ip_port->lock, pflags);
transmit_chars(port->ip_port);
spin_unlock_irqrestore(&port->ip_port->lock, pflags);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Address > 0x0FFFFFFF, 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(). */
|
UINT16 EFIAPI PciExpressBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
/* If Address > 0x0FFFFFFF, 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(). */
UINT16 EFIAPI PciExpressBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
|
{
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT16)-1;
}
return MmioBitFieldRead16 (
GetPciExpressAddress (Address),
StartBit,
EndBit
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.