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
|
|---|---|---|---|---|---|---|---|
/* Sets current thread back to running state and removes the wait descriptor from the given waitqueue if still queued. */
|
void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
|
/* Sets current thread back to running state and removes the wait descriptor from the given waitqueue if still queued. */
void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
|
{
unsigned long flags;
__set_current_state(TASK_RUNNING);
if (!list_empty_careful(&wait->task_list)) {
spin_lock_irqsave(&q->lock, flags);
list_del_init(&wait->task_list);
spin_unlock_irqrestore(&q->lock, flags);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get one byte from the specified position in a pbuf */
|
int pbuf_try_get_at(const struct pbuf *p, u16_t offset)
|
/* Get one byte from the specified position in a pbuf */
int pbuf_try_get_at(const struct pbuf *p, u16_t offset)
|
{
u16_t q_idx;
const struct pbuf *q = pbuf_skip_const(p, offset, &q_idx);
if ((q != NULL) && (q->len > q_idx)) {
return ((u8_t *)q->payload)[q_idx];
}
return -1;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Disable port-specific (i.e., MAC and PHY) interrupts for the given adapter port. */
|
void t3_port_intr_disable(struct adapter *adapter, int idx)
|
/* Disable port-specific (i.e., MAC and PHY) interrupts for the given adapter port. */
void t3_port_intr_disable(struct adapter *adapter, int idx)
|
{
struct cphy *phy = &adap2pinfo(adapter, idx)->phy;
t3_write_reg(adapter, XGM_REG(A_XGM_INT_ENABLE, idx), 0);
t3_read_reg(adapter, XGM_REG(A_XGM_INT_ENABLE, idx));
phy->ops->intr_disable(phy);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Writes to the IOCON register of the mcp23xxx.
IOCON is the only register that is not 16 bits wide on 16-pin devices; instead, it is mirrored in two adjacent memory locations. Because the underlying */
|
static int write_iocon(const struct device *dev, uint8_t value)
|
/* Writes to the IOCON register of the mcp23xxx.
IOCON is the only register that is not 16 bits wide on 16-pin devices; instead, it is mirrored in two adjacent memory locations. Because the underlying */
static int write_iocon(const struct device *dev, uint8_t value)
|
{
struct mcp23xxx_drv_data *drv_data = dev->data;
uint16_t extended_value = value | (value << 8);
int ret = write_port_regs(dev, REG_IOCON, extended_value);
if (ret == 0) {
drv_data->reg_cache.iocon = extended_value;
}
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Restricted form of lookup. Doesn't follow links, single-component only, needs parent already locked. Doesn't follow mounts. SMP-safe. */
|
static struct dentry* lookup_hash(struct nameidata *nd)
|
/* Restricted form of lookup. Doesn't follow links, single-component only, needs parent already locked. Doesn't follow mounts. SMP-safe. */
static struct dentry* lookup_hash(struct nameidata *nd)
|
{
int err;
err = exec_permission(nd->path.dentry->d_inode);
if (err)
return ERR_PTR(err);
return __lookup_hash(&nd->last, nd->path.dentry, nd);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* On resume clear all MCE state. Don't want to see leftovers from the BIOS. Only one CPU is active at this time, the others get re-added later using CPU hotplug: */
|
static int mce_resume(struct sys_device *dev)
|
/* On resume clear all MCE state. Don't want to see leftovers from the BIOS. Only one CPU is active at this time, the others get re-added later using CPU hotplug: */
static int mce_resume(struct sys_device *dev)
|
{
__mcheck_cpu_init_generic();
__mcheck_cpu_init_vendor(¤t_cpu_data);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function checks the input Handle to see if it's one of these handles in ChildHandleBuffer. */
|
BOOLEAN EFIAPI NetIsInHandleBuffer(IN EFI_HANDLE Handle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
|
/* This function checks the input Handle to see if it's one of these handles in ChildHandleBuffer. */
BOOLEAN EFIAPI NetIsInHandleBuffer(IN EFI_HANDLE Handle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
|
{
UINTN Index;
if ((NumberOfChildren == 0) || (ChildHandleBuffer == NULL)) {
return FALSE;
}
for (Index = 0; Index < NumberOfChildren; Index++) {
if (Handle == ChildHandleBuffer[Index]) {
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
|
void SAI_TransferTerminateReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
|
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferTerminateReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle)
|
{
assert(handle != NULL);
SAI_TransferAbortReceiveEDMA(base, handle);
(void)memset(handle->tcd, 0, sizeof(handle->tcd));
(void)memset(handle->saiQueue, 0, sizeof(handle->saiQueue));
(void)memset(handle->transferSize, 0, sizeof(handle->transferSize));
handle->queueUser = 0U;
handle->queueDriver = 0U;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* The first tail page's ->lru.next holds the address of the compound page's put_page() function. Its ->lru.prev holds the order of allocation. This usage means that zero-order pages may not be compound. */
|
static void free_compound_page(struct page *page)
|
/* The first tail page's ->lru.next holds the address of the compound page's put_page() function. Its ->lru.prev holds the order of allocation. This usage means that zero-order pages may not be compound. */
static void free_compound_page(struct page *page)
|
{
__free_pages_ok(page, compound_order(page));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* NOTE! You cannot set background to 1 without setting temperature and pressure You cannot set both temperature and pressure when background mode is disabled */
|
int16_t setOpMode_3param(uint8_t background, uint8_t temperature, uint8_t pressure)
|
/* NOTE! You cannot set background to 1 without setting temperature and pressure You cannot set both temperature and pressure when background mode is disabled */
int16_t setOpMode_3param(uint8_t background, uint8_t temperature, uint8_t pressure)
|
{
uint8_t opMode = (background & DPS310__LSB) << 2U |
(temperature & DPS310__LSB) << 1U |
(pressure & DPS310__LSB);
return setOpMode(opMode);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Generate NEC data bit 0: positive 0.56ms + negative 0.56ms. */
|
static void fill_item_bit_zero(rmt_item32_t *item)
|
/* Generate NEC data bit 0: positive 0.56ms + negative 0.56ms. */
static void fill_item_bit_zero(rmt_item32_t *item)
|
{
fill_item_level(item, BIT_ZERO_HIGH_US, BIT_ZERO_LOW_US);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Invoked, as DPC, when root port records new detected error */
|
void aer_isr(struct work_struct *work)
|
/* Invoked, as DPC, when root port records new detected error */
void aer_isr(struct work_struct *work)
|
{
struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler);
struct pcie_device *p_device = rpc->rpd;
struct aer_err_source *e_src;
mutex_lock(&rpc->rpc_mutex);
e_src = get_e_source(rpc);
while (e_src) {
aer_isr_one_error(p_device, e_src);
e_src = get_e_source(rpc);
}
mutex_unlock(&rpc->rpc_mutex);
wake_up(&rpc->wait_release);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return: false - we are done with this request true - still buffers pending for this request */
|
bool blk_end_request_cur(struct request *rq, int error)
|
/* Return: false - we are done with this request true - still buffers pending for this request */
bool blk_end_request_cur(struct request *rq, int error)
|
{
return blk_end_request(rq, error, blk_rq_cur_bytes(rq));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get stack size attribute in thread attributes object.
See IEEE 1003.1 */
|
int pthread_attr_getstacksize(const pthread_attr_t *_attr, size_t *stacksize)
|
/* Get stack size attribute in thread attributes object.
See IEEE 1003.1 */
int pthread_attr_getstacksize(const pthread_attr_t *_attr, size_t *stacksize)
|
{
const struct posix_thread_attr *attr = (const struct posix_thread_attr *)_attr;
if (!__attr_is_initialized(attr) || (stacksize == NULL)) {
return EINVAL;
}
*stacksize = __get_attr_stacksize(attr);
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Check whether a reset is needed, and finish the reset reminder feature. If a reset is needed, Popup a menu to notice user, and finish the feature according to the user selection. */
|
VOID EFIAPI SetupResetReminder(VOID)
|
/* Check whether a reset is needed, and finish the reset reminder feature. If a reset is needed, Popup a menu to notice user, and finish the feature according to the user selection. */
VOID EFIAPI SetupResetReminder(VOID)
|
{
EFI_INPUT_KEY Key;
CHAR16 *StringBuffer1;
CHAR16 *StringBuffer2;
if (IsResetRequired ()) {
StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
ASSERT (StringBuffer1 != NULL);
StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
ASSERT (StringBuffer2 != NULL);
StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now.");
StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");
do {
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
FreePool (StringBuffer1);
FreePool (StringBuffer2);
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */
|
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
|
/* If String is NULL, then ASSERT(). If String is not aligned on a 16-bit boundary, then ASSERT(). If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
|
{
UINTN Length;
ASSERT (String != NULL);
ASSERT (((UINTN)String & BIT0) == 0);
for (Length = 0; *String != L'\0'; String++, Length++) {
if (PcdGet32 (PcdMaximumUnicodeStringLength) != 0) {
ASSERT (Length < PcdGet32 (PcdMaximumUnicodeStringLength));
}
}
return Length;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* configure the ETMx_SYNCONF register including SW and HW Sync selection. */
|
void ETM_SyncConfigActivate(ETM_Type *pETM, uint32_t u32ConfigValue)
|
/* configure the ETMx_SYNCONF register including SW and HW Sync selection. */
void ETM_SyncConfigActivate(ETM_Type *pETM, uint32_t u32ConfigValue)
|
{
ASSERT((ETM2 == pETM));
pETM->SYNCONF |= u32ConfigValue;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* access via i2c mode (for EWX 24/96, EWS 88MT&D) */
|
static void ewx_i2c_setlines(struct snd_i2c_bus *bus, int clk, int data)
|
/* access via i2c mode (for EWX 24/96, EWS 88MT&D) */
static void ewx_i2c_setlines(struct snd_i2c_bus *bus, int clk, int data)
|
{
struct snd_ice1712 *ice = bus->private_data;
unsigned char tmp = 0;
if (clk)
tmp |= ICE1712_EWX2496_SERIAL_CLOCK;
if (data)
tmp |= ICE1712_EWX2496_SERIAL_DATA;
snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
udelay(5);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Change Logs: Date Author Notes Please do not edit this file. It was generated using rpcgen. */
|
bool_t xdr_uint64(register XDR *xdrs, uint64 *objp)
|
/* Change Logs: Date Author Notes Please do not edit this file. It was generated using rpcgen. */
bool_t xdr_uint64(register XDR *xdrs, uint64 *objp)
|
{
if (!xdr_u_longlong_t(xdrs, objp))
return (FALSE);
return (TRUE);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Do a Channel Attention on the 3c523. This is extremely board dependent. */
|
static void elmc_do_attn586(int ioaddr, int ints)
|
/* Do a Channel Attention on the 3c523. This is extremely board dependent. */
static void elmc_do_attn586(int ioaddr, int ints)
|
{
outb(ELMC_CTRL_RST | 0x3 | ELMC_CTRL_CA | ints, ioaddr + ELMC_CTRL);
DELAY_16();
outb(ELMC_CTRL_RST | 0x3 | ints, ioaddr + ELMC_CTRL);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* CAN MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan)
|
/* CAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hcan->Instance==CAN)
{
__HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF9_CAN;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Switch the Self-refresh mode between normal and self-refresh mode. */
|
void EMC_DynCtrlSelfRefresh(uint32_t self_refresh_mode)
|
/* Switch the Self-refresh mode between normal and self-refresh mode. */
void EMC_DynCtrlSelfRefresh(uint32_t self_refresh_mode)
|
{
uint32_t mask = ~(uint32_t)(4);
LPC_EMC->DynamicControl = ((LPC_EMC->DynamicControl & mask) |self_refresh_mode);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Changelog: 24-Sep-1996 RMK Created 10-Oct-1996 RMK Brought up to date with arch-sa110eval 04-Dec-1997 RMK Updated for new arch/arm/time.c 13=Jun-2004 DS Moved to arch/arm/common b/c shared w/CLPS7500 */
|
unsigned long ioc_timer_gettimeoffset(void)
|
/* Changelog: 24-Sep-1996 RMK Created 10-Oct-1996 RMK Brought up to date with arch-sa110eval 04-Dec-1997 RMK Updated for new arch/arm/time.c 13=Jun-2004 DS Moved to arch/arm/common b/c shared w/CLPS7500 */
unsigned long ioc_timer_gettimeoffset(void)
|
{
unsigned int count1, count2, status;
long offset;
ioc_writeb (0, IOC_T0LATCH);
barrier ();
count1 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
barrier ();
status = ioc_readb(IOC_IRQREQA);
barrier ();
ioc_writeb (0, IOC_T0LATCH);
barrier ();
count2 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
offset = count2;
if (count2 < count1) {
if (status & (1 << 5))
offset -= LATCH;
} else if (count2 > count1) {
offset -= LATCH;
}
offset = (LATCH - offset) * (tick_nsec / 1000);
return (offset + LATCH/2) / LATCH;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function use to configure smartcard UART mode line setting. */
|
uint32_t SCUART_SetLineConfig(SC_T *sc, uint32_t u32Baudrate, uint32_t u32DataWidth, uint32_t u32Parity, uint32_t u32StopBits)
|
/* This function use to configure smartcard UART mode line setting. */
uint32_t SCUART_SetLineConfig(SC_T *sc, uint32_t u32Baudrate, uint32_t u32DataWidth, uint32_t u32Parity, uint32_t u32StopBits)
|
{
uint32_t u32Clk = SCUART_GetClock(sc), u32Div;
if (u32Baudrate == 0UL)
{
u32Div = sc->ETUCTL & SC_ETUCTL_ETURDIV_Msk;
}
else
{
u32Div = (u32Clk + (u32Baudrate >> 1) - 1UL) / u32Baudrate - 1UL;
sc->ETUCTL = u32Div;
}
sc->CTL = u32StopBits | SC_CTL_SCEN_Msk;
sc->UARTCTL = u32Parity | u32DataWidth | SC_UARTCTL_UARTEN_Msk;
return (u32Clk / (u32Div + 1UL));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Note that the source address is modified during the DMA transfer according to edma_set_src_index(). */
|
void edma_set_src(unsigned slot, rt_uint32_t src_port, enum address_mode mode, enum fifo_width width)
|
/* Note that the source address is modified during the DMA transfer according to edma_set_src_index(). */
void edma_set_src(unsigned slot, rt_uint32_t src_port, enum address_mode mode, enum fifo_width width)
|
{
unsigned ctlr;
ctlr = EDMA_CTLR(slot);
slot = EDMA_CHAN_SLOT(slot);
if (slot < edma_cc[ctlr]->num_slots) {
unsigned int i = edma_parm_read(ctlr, PARM_OPT, slot);
if (mode) {
i = (i & ~(EDMA_FWID)) | (SAM | ((width & 0x7) << 8));
} else {
i &= ~SAM;
}
edma_parm_write(ctlr, PARM_OPT, slot, i);
edma_parm_write(ctlr, PARM_SRC, slot, src_port);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Decrement the refcount, and if 0, call config_item_cleanup(). */
|
void config_item_put(struct config_item *item)
|
/* Decrement the refcount, and if 0, call config_item_cleanup(). */
void config_item_put(struct config_item *item)
|
{
if (item)
kref_put(&item->ci_kref, config_item_release);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Register protocol dependent address dumping routines. The handler that is passed must not be freed or reused until it has been replaced by another handler. */
|
int register_gifconf(unsigned int family, gifconf_func_t *gifconf)
|
/* Register protocol dependent address dumping routines. The handler that is passed must not be freed or reused until it has been replaced by another handler. */
int register_gifconf(unsigned int family, gifconf_func_t *gifconf)
|
{
if (family >= NPROTO)
return -EINVAL;
gifconf_list[family] = gifconf;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* RETURNS: Pointer to allocated memory on success, NULL on failure. */
|
void* dmam_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp)
|
/* RETURNS: Pointer to allocated memory on success, NULL on failure. */
void* dmam_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp)
|
{
struct dma_devres *dr;
void *vaddr;
dr = devres_alloc(dmam_noncoherent_release, sizeof(*dr), gfp);
if (!dr)
return NULL;
vaddr = dma_alloc_noncoherent(dev, size, dma_handle, gfp);
if (!vaddr) {
devres_free(dr);
return NULL;
}
dr->vaddr = vaddr;
dr->dma_handle = *dma_handle;
dr->size = size;
devres_add(dev, dr);
return vaddr;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* unlocks pages after btrfs_file_write is done with them */
|
static noinline void btrfs_drop_pages(struct page **pages, size_t num_pages)
|
/* unlocks pages after btrfs_file_write is done with them */
static noinline void btrfs_drop_pages(struct page **pages, size_t num_pages)
|
{
size_t i;
for (i = 0; i < num_pages; i++) {
if (!pages[i])
break;
ClearPageChecked(pages[i]);
unlock_page(pages[i]);
mark_page_accessed(pages[i]);
page_cache_release(pages[i]);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If BufferSize is 0, then no output buffer is produced and 0 is returned. */
|
UINTN EFIAPI AsciiVSPrintUnicodeFormat(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
|
/* If BufferSize is 0, then no output buffer is produced and 0 is returned. */
UINTN EFIAPI AsciiVSPrintUnicodeFormat(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
|
{
UINT64 BaseListMarker[256 / sizeof (UINT64)];
BOOLEAN Converted;
ASSERT_UNICODE_BUFFER (FormatString);
Converted = DxePrintLibPrint2ProtocolVaListToBaseList (
FALSE,
(CHAR8 *)FormatString,
Marker,
(BASE_LIST)BaseListMarker,
sizeof (BaseListMarker) - 8
);
if (!Converted) {
return 0;
}
return AsciiBSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, (BASE_LIST)BaseListMarker);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Polls a register every delay_usec microseconds. Returns 0 when the mask bits have the value done. Returns -ETIMEDOUT if this condition is not true after wait_usec microseconds have passed. */
|
static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait_usec, int delay_usec)
|
/* Polls a register every delay_usec microseconds. Returns 0 when the mask bits have the value done. Returns -ETIMEDOUT if this condition is not true after wait_usec microseconds have passed. */
static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait_usec, int delay_usec)
|
{
u32 result;
do {
result = readl(ptr);
result &= mask;
if (result == done)
return 0;
udelay(delay_usec);
wait_usec -= delay_usec;
} while (wait_usec > 0);
return -ETIMEDOUT;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* For now this is a #defined shift which could be under admin control in the future. */
|
static void set_max_drc(void)
|
/* For now this is a #defined shift which could be under admin control in the future. */
static void set_max_drc(void)
|
{
#define NFSD_DRC_SIZE_SHIFT 10
nfsd_drc_max_mem = (nr_free_buffer_pages()
>> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE;
nfsd_drc_mem_used = 0;
spin_lock_init(&nfsd_drc_lock);
dprintk("%s nfsd_drc_max_mem %u \n", __func__, nfsd_drc_max_mem);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ISR handler.
This function is called when data from MBX is received */
|
static void mbx_isr(void)
|
/* ISR handler.
This function is called when data from MBX is received */
static void mbx_isr(void)
|
{
uint32_t data;
hpm_stat_t state;
state = mbx_retrieve_message(HPM_MBX, &data);
if (state == status_success) {
ipc_event_handler(data);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Fills each RTC_TimeStruct member with its default value (Time = 00d:00h:00min:00sec). */
|
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
|
/* Fills each RTC_TimeStruct member with its default value (Time = 00d:00h:00min:00sec). */
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
|
{
RTC_TimeStruct->RTC_H12_PMAM = RTC_H12_AM;
RTC_TimeStruct->RTC_Hours = 0;
RTC_TimeStruct->RTC_Minutes = 0;
RTC_TimeStruct->RTC_Seconds = 0;
RTC_TimeStruct->RTC_Days = 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Ctrl+T Swap the last two characters before the cursor (typo). */
|
static int handle_ctrl_t(struct shell_t *self_p)
|
/* Ctrl+T Swap the last two characters before the cursor (typo). */
static int handle_ctrl_t(struct shell_t *self_p)
|
{
char c;
int cursor;
cursor = line_get_cursor(&self_p->line);
if (cursor == 0) {
return (-1);
}
if (line_get_length(&self_p->line) < 2) {
return (-1);
}
if (cursor == line_get_length(&self_p->line)) {
line_seek(&self_p->line, -1);
}
c = line_peek(&self_p->line);
line_delete(&self_p->line);
line_seek(&self_p->line, -1);
line_insert(&self_p->line, c);
line_seek(&self_p->line, 1);
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Message: SubscriptionStatMessage Opcode: 0x0152 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
|
static void handle_SubscriptionStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: SubscriptionStatMessage Opcode: 0x0152 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_SubscriptionStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_transactionID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_subscriptionoFeatureID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_timer, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_cause, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Convert an u32_t from host- to network byte order. */
|
u32_t lwip_htonl(u32_t n)
|
/* Convert an u32_t from host- to network byte order. */
u32_t lwip_htonl(u32_t n)
|
{
return ((n & 0xff) << 24) |
((n & 0xff00) << 8) |
((n & 0xff0000UL) >> 8) |
((n & 0xff000000UL) >> 24);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* At the point that cgroup_fork() is called, 'current' is the parent task, and the passed argument 'child' points to the child task. */
|
void cgroup_fork(struct task_struct *child)
|
/* At the point that cgroup_fork() is called, 'current' is the parent task, and the passed argument 'child' points to the child task. */
void cgroup_fork(struct task_struct *child)
|
{
task_lock(current);
child->cgroups = current->cgroups;
get_css_set(child->cgroups);
task_unlock(current);
INIT_LIST_HEAD(&child->cg_list);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Report physical address to all other devices thus allowing any device to create a map of the network. */
|
HDMI_CEC_Error HDMI_CEC_ReportPhysicalAddress(void)
|
/* Report physical address to all other devices thus allowing any device to create a map of the network. */
HDMI_CEC_Error HDMI_CEC_ReportPhysicalAddress(void)
|
{
HDMI_CEC_Error errorstatus = HDMI_CEC_OK;
HDMI_CEC_Message HDMI_CEC_TX_Message;
HDMI_CEC_TX_Message.Header = ((MyLogicalAddress << 4) | 0xF);
HDMI_CEC_TX_Message.Opcode = HDMI_CEC_OPCODE_REPORT_PHYSICAL_ADDRESS;
HDMI_CEC_TX_Message.Operande[0] = MyPhysicalAddress >> 8;
HDMI_CEC_TX_Message.Operande[1] = MyPhysicalAddress & 0xFF;
HDMI_CEC_TX_Message.Operande[2] = DeviceType;
HDMI_CEC_TX_Message.TxMessageLength = 0x03;
errorstatus = HDMI_CEC_TransmitMessage(&HDMI_CEC_TX_Message);
return errorstatus;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */
|
unsigned long HibernateWakeGet(void)
|
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */
unsigned long HibernateWakeGet(void)
|
{
return(HWREG(HIB_CTL) & (HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC
| HIBERNATE_WAKE_LOW_BAT));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Turn on/off any Nagle-like algorithm. This means that packets are generally sent as soon as possible and no unnecessary delays are introduced, at the cost of more packets in the network. Expects an integer boolean flag. */
|
static int sctp_getsockopt_nodelay(struct sock *sk, int len, char __user *optval, int __user *optlen)
|
/* Turn on/off any Nagle-like algorithm. This means that packets are generally sent as soon as possible and no unnecessary delays are introduced, at the cost of more packets in the network. Expects an integer boolean flag. */
static int sctp_getsockopt_nodelay(struct sock *sk, int len, char __user *optval, int __user *optlen)
|
{
int val;
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
val = (sctp_sk(sk)->nodelay == 1);
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, &val, len))
return -EFAULT;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Use SCU config register to count number of cores */
|
static unsigned int get_core_count(void)
|
/* Use SCU config register to count number of cores */
static unsigned int get_core_count(void)
|
{
if (scu_base)
return scu_get_core_count(scu_base);
return 1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* returns whether it has modified a pending timer (1) or not (0) */
|
int mod_virt_timer_periodic(struct vtimer_list *timer, __u64 expires)
|
/* returns whether it has modified a pending timer (1) or not (0) */
int mod_virt_timer_periodic(struct vtimer_list *timer, __u64 expires)
|
{
return __mod_vtimer(timer, expires, 1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */
|
FLASH_STS FLASH_WaitForLastOpt(uint32_t Timeout)
|
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */
FLASH_STS FLASH_WaitForLastOpt(uint32_t Timeout)
|
{
FLASH_STS status = FLASH_COMPL;
status = FLASH_GetSTS();
while ((status == FLASH_BUSY) && (Timeout != 0x00))
{
status = FLASH_GetSTS();
Timeout--;
}
if (Timeout == 0x00)
{
status = FLASH_TIMEOUT;
}
return status;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Lock managers call this function to determine when it is OK for them to answer ordinary lock requests, and when they should accept only lock reclaims. */
|
int locks_in_grace(void)
|
/* Lock managers call this function to determine when it is OK for them to answer ordinary lock requests, and when they should accept only lock reclaims. */
int locks_in_grace(void)
|
{
return !list_empty(&grace_list);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* lcdif pixel clock is derived from PLL3(480MHz) and set as 33.5MHz */
|
void lcdif_clock_enable(void)
|
/* lcdif pixel clock is derived from PLL3(480MHz) and set as 33.5MHz */
void lcdif_clock_enable(void)
|
{
HW_CCM_CSCDR2.B.LCDIF_PIX_CLK_SEL = 0x01;
HW_CCM_CSCDR2.B.LCDIF_PIX_PRED = 2 - 1;
HW_CCM_CSCMR1.B.LCDIF_PIX_PODF = (7 - 1) ^ 0x6;
HW_CCM_CCGR3.B.CG4 = 0x3;
HW_CCM_CCGR3.B.CG3 = 0x3;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set a "priority barrier" for the protection region for the specified barrier. Further MPU mappings will round-robin above that barrier but will not touch any mappings below it. */
|
static void mpu_page_barrier(struct mm_struct *mm, unsigned int barrier)
|
/* Set a "priority barrier" for the protection region for the specified barrier. Further MPU mappings will round-robin above that barrier but will not touch any mappings below it. */
static void mpu_page_barrier(struct mm_struct *mm, unsigned int barrier)
|
{
mpu_context_p(mm)->barrier = barrier;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The default time out value is 5 seconds. If IP has retrieved the default address, the UDP is reconfigured. */
|
BOOLEAN Dns4GetMapping(IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo, IN EFI_UDP4_CONFIG_DATA *UdpCfgData)
|
/* The default time out value is 5 seconds. If IP has retrieved the default address, the UDP is reconfigured. */
BOOLEAN Dns4GetMapping(IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo, IN EFI_UDP4_CONFIG_DATA *UdpCfgData)
|
{
DNS_SERVICE *Service;
EFI_IP4_MODE_DATA Ip4Mode;
EFI_UDP4_PROTOCOL *Udp;
EFI_STATUS Status;
ASSERT (Instance->Dns4CfgData.UseDefaultSetting);
Service = Instance->Service;
Udp = UdpIo->Protocol.Udp4;
Status = gBS->SetTimer (
Service->TimerToGetMap,
TimerRelative,
DNS_TIME_TO_GETMAP * TICKS_PER_SECOND
);
if (EFI_ERROR (Status)) {
return FALSE;
}
while (EFI_ERROR (gBS->CheckEvent (Service->TimerToGetMap))) {
Udp->Poll (Udp);
if (!EFI_ERROR (Udp->GetModeData (Udp, NULL, &Ip4Mode, NULL, NULL)) &&
Ip4Mode.IsConfigured)
{
Udp->Configure (Udp, NULL);
return (BOOLEAN)(Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS);
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configure the selected source to generate a global interrupt or not. */
|
void stmpe811_TS_EnableIT(uint16_t DeviceAddr)
|
/* Configure the selected source to generate a global interrupt or not. */
void stmpe811_TS_EnableIT(uint16_t DeviceAddr)
|
{
IOE_ITConfig();
stmpe811_EnableITSource(DeviceAddr, STMPE811_TS_IT);
stmpe811_EnableGlobalIT(DeviceAddr);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* iis2dlpc_set_range - set full scale range for acc @dev: Pointer to instance of struct device (I2C or SPI) @range: Full scale range (2, 4, 8 and 16 G) */
|
static int iis2dlpc_set_range(const struct device *dev, uint8_t fs)
|
/* iis2dlpc_set_range - set full scale range for acc @dev: Pointer to instance of struct device (I2C or SPI) @range: Full scale range (2, 4, 8 and 16 G) */
static int iis2dlpc_set_range(const struct device *dev, uint8_t fs)
|
{
int err;
struct iis2dlpc_data *iis2dlpc = dev->data;
const struct iis2dlpc_config *cfg = dev->config;
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
uint8_t shift_gain = 0U;
err = iis2dlpc_full_scale_set(ctx, fs);
if (cfg->pm == IIS2DLPC_CONT_LOW_PWR_12bit) {
shift_gain = IIS2DLPC_SHFT_GAIN_NOLP1;
}
if (!err) {
iis2dlpc->gain = IIS2DLPC_FS_TO_GAIN(fs, shift_gain);
}
return err;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* DMA request selects for peripherals will override either src_addr or dst_addr. In these cases, the overridden address is a don't care and may be 0. */
|
int DMA_SetSrcDstCnt(int ch, void *src_addr, void *dst_addr, unsigned int count)
|
/* DMA request selects for peripherals will override either src_addr or dst_addr. In these cases, the overridden address is a don't care and may be 0. */
int DMA_SetSrcDstCnt(int ch, void *src_addr, void *dst_addr, unsigned int count)
|
{
if (CHECK_HANDLE(ch)) {
dma_resource[ch].regs->src = (unsigned int)src_addr;
dma_resource[ch].regs->dst = (unsigned int)dst_addr;
dma_resource[ch].regs->cnt = count;
} else {
return E_BAD_PARAM;
}
return E_NO_ERROR;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calculate data strobe according to offset and size */
|
static uint pcie_calc_datastrobe(uint offset, enum pci_size_t size)
|
/* Calculate data strobe according to offset and size */
static uint pcie_calc_datastrobe(uint offset, enum pci_size_t size)
|
{
uint bytes, data_strobe;
switch (size) {
case PCI_SIZE_8:
bytes = 1;
break;
case PCI_SIZE_16:
bytes = 2;
break;
default:
bytes = 4;
}
data_strobe = GENMASK(bytes - 1, 0) << (offset & 0x3);
return data_strobe;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Top level i2d equivalents: the 'ndef' variant instructs the encoder to use indefinite length constructed encoding, where appropriate */
|
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
|
/* Top level i2d equivalents: the 'ndef' variant instructs the encoder to use indefinite length constructed encoding, where appropriate */
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
|
{
return asn1_item_flags_i2d(val, out, it, ASN1_TFLG_NDEF);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Checks whether the specified EXTI line flag is set or not. */
|
FlagStatus EXTI_GetStatusFlag(uint32_t EXTI_Line)
|
/* Checks whether the specified EXTI line flag is set or not. */
FlagStatus EXTI_GetStatusFlag(uint32_t EXTI_Line)
|
{
FlagStatus bitstatus = RESET;
assert_param(IS_GET_EXTI_LINE(EXTI_Line));
if ((EXTI->PEND & EXTI_Line) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Returns true if the xfrm contains a security blob for SELinux */
|
static int selinux_authorizable_xfrm(struct xfrm_state *x)
|
/* Returns true if the xfrm contains a security blob for SELinux */
static int selinux_authorizable_xfrm(struct xfrm_state *x)
|
{
return selinux_authorizable_ctx(x->security);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enables a GPIO pin as a trigger to start a DMA transaction. */
|
void GPIODMATriggerEnable(uint32_t ui32Port, uint8_t ui8Pins)
|
/* Enables a GPIO pin as a trigger to start a DMA transaction. */
void GPIODMATriggerEnable(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
HWREG(ui32Port + GPIO_O_DMACTL) |= ui8Pins;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* After we've used one of their buffers, we tell the Guest about it. Sometime later we'll want to send them an interrupt using trigger_irq(); note that wait_for_vq_desc() does that for us if it has to wait. */
|
static void add_used(struct virtqueue *vq, unsigned int head, int len)
|
/* After we've used one of their buffers, we tell the Guest about it. Sometime later we'll want to send them an interrupt using trigger_irq(); note that wait_for_vq_desc() does that for us if it has to wait. */
static void add_used(struct virtqueue *vq, unsigned int head, int len)
|
{
struct vring_used_elem *used;
used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num];
used->id = head;
used->len = len;
wmb();
vq->vring.used->idx++;
vq->pending_used++;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This will allocate the return buffer from boot services pool. */
|
CHAR16* ConvertDevicePathToShortText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath, IN CONST BOOLEAN Verbose, IN CONST UINTN Length)
|
/* This will allocate the return buffer from boot services pool. */
CHAR16* ConvertDevicePathToShortText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath, IN CONST BOOLEAN Verbose, IN CONST UINTN Length)
|
{
CHAR16 *Temp;
CHAR16 *Temp2;
UINTN Size;
Temp = ConvertDevicePathToText (DevPath, TRUE, TRUE);
if (!Verbose && (Temp != NULL) && (StrLen (Temp) > Length)) {
Temp2 = NULL;
Size = 0;
Temp2 = StrnCatGrow (&Temp2, &Size, L"..", 0);
Temp2 = StrnCatGrow (&Temp2, &Size, Temp+(StrLen (Temp) - (Length - 2)), 0);
FreePool (Temp);
Temp = Temp2;
}
return (Temp);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Selects the signal connected to the TI1 input: direct from CH1_input or a XOR combination between CH1_input, CH2_input & CH3_input. */
|
ald_status_t ald_timer_config_ti1_input(ald_timer_handle_t *hperh, uint32_t ti1_select)
|
/* Selects the signal connected to the TI1 input: direct from CH1_input or a XOR combination between CH1_input, CH2_input & CH3_input. */
ald_status_t ald_timer_config_ti1_input(ald_timer_handle_t *hperh, uint32_t ti1_select)
|
{
assert_param(IS_TIMER_INSTANCE(hperh->perh));
MODIFY_REG(hperh->perh->CON2, TIMER_CON2_I1FSEL_MSK, ti1_select << TIMER_CON2_I1FSEL_POS);
return ALD_OK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enables or disables the TIM Capture Compare Channel x. */
|
void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx)
|
/* Enables or disables the TIM Capture Compare Channel x. */
void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx)
|
{
uint16_t tmp = 0;
assert_param(IS_TIM_LIST8_PERIPH(TIMx));
assert_param(IS_TIM_CHANNEL(TIM_Channel));
assert_param(IS_TIM_CCX(TIM_CCx));
tmp = CCER_CCE_Set << TIM_Channel;
TIMx->CCER &= (uint16_t)~ tmp;
TIMx->CCER |= (uint16_t)(TIM_CCx << TIM_Channel);
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Description: This is the hashing function for the network interface table, it returns the bucket number for the given interface. */
|
static u32 sel_netif_hashfn(int ifindex)
|
/* Description: This is the hashing function for the network interface table, it returns the bucket number for the given interface. */
static u32 sel_netif_hashfn(int ifindex)
|
{
return (ifindex & (SEL_NETIF_HASH_SIZE - 1));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function sets memory encryption bit for the memory region specified by PhysicalAddress and Length from the current page table context. */
|
RETURN_STATUS EFIAPI InternalMemEncryptSevSetMemoryEncrypted(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS PhysicalAddress, IN UINTN Length)
|
/* This function sets memory encryption bit for the memory region specified by PhysicalAddress and Length from the current page table context. */
RETURN_STATUS EFIAPI InternalMemEncryptSevSetMemoryEncrypted(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS PhysicalAddress, IN UINTN Length)
|
{
return SetMemoryEncDec (
Cr3BaseAddress,
PhysicalAddress,
Length,
SetCBit,
TRUE,
FALSE
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is used to get the interrupt status of the uDMA controller. The returned value is a 32-bit bit mask that indicates which channels are requesting an interrupt. This function can be used from within an interrupt handler to determine or confirm which uDMA channel has requested an interrupt. */
|
uint32_t uDMAIntStatus(void)
|
/* This function is used to get the interrupt status of the uDMA controller. The returned value is a 32-bit bit mask that indicates which channels are requesting an interrupt. This function can be used from within an interrupt handler to determine or confirm which uDMA channel has requested an interrupt. */
uint32_t uDMAIntStatus(void)
|
{
return(HWREG(UDMA_CHIS));
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Send switch voltage command switch card voltage to 1.8v. */
|
static status_t SD_SwitchVoltage(sd_card_t *card)
|
/* Send switch voltage command switch card voltage to 1.8v. */
static status_t SD_SwitchVoltage(sd_card_t *card)
|
{
assert(card);
return SDMMC_SwitchVoltage(card->host.base, card->host.transfer);
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Start the PHY. Returns 0 on success, or a negative error code. */
|
int phy_startup(struct phy_device *phydev)
|
/* Start the PHY. Returns 0 on success, or a negative error code. */
int phy_startup(struct phy_device *phydev)
|
{
if (phydev->drv->startup)
return phydev->drv->startup(phydev);
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Sets the display name for the current #GFileInfo. See G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. */
|
void g_file_info_set_display_name(GFileInfo *info, const char *display_name)
|
/* Sets the display name for the current #GFileInfo. See G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. */
void g_file_info_set_display_name(GFileInfo *info, const char *display_name)
|
{
static guint32 attr = 0;
GFileAttributeValue *value;
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (display_name != NULL);
if (attr == 0)
attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
value = g_file_info_create_value (info, attr);
if (value)
_g_file_attribute_value_set_string (value, display_name);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Toggles the LED at a fixed time interval. */
|
void LedToggle(void)
|
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
|
{
static unsigned char led_toggle_state = 0;
static unsigned long timer_counter_last = 0;
unsigned long timer_counter_now;
timer_counter_now = TimerGet();
if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS)
{
return;
}
if (led_toggle_state == 0)
{
led_toggle_state = 1;
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_12, GPIO_PIN_RESET);
}
else
{
led_toggle_state = 0;
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_12, GPIO_PIN_SET);
}
timer_counter_last = timer_counter_now;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* This API checks the fifo read data as empty frame, if it is empty frame then moves the index to last byte. */
|
static void check_empty_fifo(uint16_t *data_index, const struct bma4_dev *dev)
|
/* This API checks the fifo read data as empty frame, if it is empty frame then moves the index to last byte. */
static void check_empty_fifo(uint16_t *data_index, const struct bma4_dev *dev)
|
{
if ((*data_index + 2) < dev->fifo->length) {
if ((dev->fifo->data[*data_index] == FIFO_MSB_CONFIG_CHECK)
&& (dev->fifo->data[*data_index + 1] == FIFO_LSB_CONFIG_CHECK)) {
*data_index = dev->fifo->length;
}
}
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Write one byte into the RX buffer. This function will write one byte into the array index specified by the write pointer and increment the write index. If the write index exceeds the max buffer size, then it will roll over to zero. */
|
void cdcBufferWrite(uint8_t data)
|
/* Write one byte into the RX buffer. This function will write one byte into the array index specified by the write pointer and increment the write index. If the write index exceeds the max buffer size, then it will roll over to zero. */
void cdcBufferWrite(uint8_t data)
|
{
cdcfifo.buf[cdcfifo.wr_ptr] = data;
cdcfifo.wr_ptr = (cdcfifo.wr_ptr + 1) % CFG_USBCDC_BUFFERSIZE;
cdcfifo.len++;
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* Converts a text device path node to UFS device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUfs(CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to UFS device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUfs(CHAR16 *TextDeviceNode)
|
{
CHAR16 *PunStr;
CHAR16 *LunStr;
UFS_DEVICE_PATH *Ufs;
PunStr = GetNextParamStr (&TextDeviceNode);
LunStr = GetNextParamStr (&TextDeviceNode);
Ufs = (UFS_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_UFS_DP,
(UINT16) sizeof (UFS_DEVICE_PATH)
);
Ufs->Pun = (UINT8) Strtoi (PunStr);
Ufs->Lun = (UINT8) Strtoi (LunStr);
return (EFI_DEVICE_PATH_PROTOCOL *) Ufs;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Given a shift value, try to populate memnodemap Returns : 1 if OK 0 if memnodmap too small (of shift too small) -1 if node overlap or lost ram (shift too big) */
|
static int __init populate_memnodemap(const struct bootnode *nodes, int numnodes, int shift, int *nodeids)
|
/* Given a shift value, try to populate memnodemap Returns : 1 if OK 0 if memnodmap too small (of shift too small) -1 if node overlap or lost ram (shift too big) */
static int __init populate_memnodemap(const struct bootnode *nodes, int numnodes, int shift, int *nodeids)
|
{
unsigned long addr, end;
int i, res = -1;
memset(memnodemap, 0xff, sizeof(s16)*memnodemapsize);
for (i = 0; i < numnodes; i++) {
addr = nodes[i].start;
end = nodes[i].end;
if (addr >= end)
continue;
if ((end >> shift) >= memnodemapsize)
return 0;
do {
if (memnodemap[addr >> shift] != NUMA_NO_NODE)
return -1;
if (!nodeids)
memnodemap[addr >> shift] = i;
else
memnodemap[addr >> shift] = nodeids[i];
addr += (1UL << shift);
} while (addr < end);
res = 1;
}
return res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Gets the 3x3 compass transform matrix in 32 bit Q30 fixed point format. */
|
void inv_get_compass_soft_iron_matrix_d(long *matrix)
|
/* Gets the 3x3 compass transform matrix in 32 bit Q30 fixed point format. */
void inv_get_compass_soft_iron_matrix_d(long *matrix)
|
{
matrix[i] = sensors.soft_iron.matrix_d[i];
}
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* This will optionally read in buffer data from disk (otherwise zero-fill), and then update the header checksum. Header is converted to proper endianness before being written to the specified file offset */
|
static int vhdx_write_header(BlockDriverState *bs_file, VHDXHeader *hdr, uint64_t offset, bool read)
|
/* This will optionally read in buffer data from disk (otherwise zero-fill), and then update the header checksum. Header is converted to proper endianness before being written to the specified file offset */
static int vhdx_write_header(BlockDriverState *bs_file, VHDXHeader *hdr, uint64_t offset, bool read)
|
{
uint8_t *buffer = NULL;
int ret;
VHDXHeader header_le;
assert(bs_file != NULL);
assert(hdr != NULL);
buffer = qemu_blockalign(bs_file, VHDX_HEADER_SIZE);
if (read) {
ret = bdrv_pread(bs_file, offset, buffer, VHDX_HEADER_SIZE);
if (ret < 0) {
goto exit;
}
} else {
memset(buffer, 0, VHDX_HEADER_SIZE);
}
memcpy(buffer, hdr, sizeof(VHDXHeader));
hdr->checksum = vhdx_update_checksum(buffer, VHDX_HEADER_SIZE,
offsetof(VHDXHeader, checksum));
vhdx_header_le_export(hdr, &header_le);
ret = bdrv_pwrite_sync(bs_file, offset, &header_le, sizeof(VHDXHeader));
exit:
qemu_vfree(buffer);
return ret;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* The resulting memory area is zeroed so it can be mapped to userspace without leaking data. */
|
void* vmalloc_user(unsigned long size)
|
/* The resulting memory area is zeroed so it can be mapped to userspace without leaking data. */
void* vmalloc_user(unsigned long size)
|
{
struct vm_struct *area;
void *ret;
ret = __vmalloc_node(size, SHMLBA,
GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
PAGE_KERNEL, -1, __builtin_return_address(0));
if (ret) {
area = find_vm_area(ret);
area->flags |= VM_USERMAP;
}
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* We set the PCIE flag because the lower bandwidth on PCIe vs HyperTransport can affect some user packet algorithms. */
|
static int ipath_pe_get_base_info(struct ipath_portdata *pd, void *kbase)
|
/* We set the PCIE flag because the lower bandwidth on PCIe vs HyperTransport can affect some user packet algorithms. */
static int ipath_pe_get_base_info(struct ipath_portdata *pd, void *kbase)
|
{
struct ipath_base_info *kinfo = kbase;
struct ipath_devdata *dd;
if (ipath_unordered_wc()) {
kinfo->spi_runtime_flags |= IPATH_RUNTIME_FORCE_WC_ORDER;
ipath_cdbg(PROC, "Intel processor, forcing WC order\n");
}
else
ipath_cdbg(PROC, "Not Intel processor, WC ordered\n");
if (pd == NULL)
goto done;
dd = pd->port_dd;
done:
kinfo->spi_runtime_flags |= IPATH_RUNTIME_PCIE |
IPATH_RUNTIME_FORCE_PIOAVAIL | IPATH_RUNTIME_PIO_REGSWAPPED;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Retrieve maximum EP size Function Called during EndPoint configuration Return Value: maximum size for given EP */
|
static int USBD_GetSizeEP(uint32_t EPNum)
|
/* Retrieve maximum EP size Function Called during EndPoint configuration Return Value: maximum size for given EP */
static int USBD_GetSizeEP(uint32_t EPNum)
|
{
switch (EPNum & 0x0F) {
case 0:
return (64);
case 1:
case 2:
return (512);
case 3:
case 4:
return (64);
case 5:
case 6:
return (1024);
default:
return (0);
}
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* This function will removes a previously registed usb class driver. */
|
rt_err_t rt_usbh_class_driver_unregister(ucd_t drv)
|
/* This function will removes a previously registed usb class driver. */
rt_err_t rt_usbh_class_driver_unregister(ucd_t drv)
|
{
RT_ASSERT(drv != RT_NULL);
rt_list_remove(&(drv->list));
return RT_EOK;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Walk all dissector tables calling a user supplied function on each table. */
|
void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
|
/* Walk all dissector tables calling a user supplied function on each table. */
void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
|
{
dissector_foreach_table_info_t info;
GList *list;
info.caller_data = user_data;
info.caller_func = func;
if (compare_key_func != NULL)
{
list = g_hash_table_get_keys(dissector_tables);
list = g_list_sort(list, compare_key_func);
g_list_foreach(list, dissector_all_tables_foreach_list_func, &info);
g_list_free(list);
}
else
{
g_hash_table_foreach(dissector_tables, dissector_all_tables_foreach_table_func, &info);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This functions sets the contents of the given Alarm Threshold Register. */
|
void XAdcPs_SetAlarmThreshold(XAdcPs *InstancePtr, u8 AlarmThrReg, u16 Value)
|
/* This functions sets the contents of the given Alarm Threshold Register. */
void XAdcPs_SetAlarmThreshold(XAdcPs *InstancePtr, u8 AlarmThrReg, u16 Value)
|
{
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertVoid(AlarmThrReg <= XADCPS_ATR_VCCPDRO_LOWER);
XAdcPs_WriteInternalReg(InstancePtr, (XADCPS_ATR_TEMP_UPPER_OFFSET +
(u32)AlarmThrReg), Value);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* ADC Read from an Injected Conversion Result Register.
The result read back from the selected injected result register (one of four) is 12 bits, right or left aligned within the first 16 bits. The result can have a negative value if the injected channel offset has been set */
|
uint32_t adc_read_injected(uint32_t adc, uint8_t reg)
|
/* ADC Read from an Injected Conversion Result Register.
The result read back from the selected injected result register (one of four) is 12 bits, right or left aligned within the first 16 bits. The result can have a negative value if the injected channel offset has been set */
uint32_t adc_read_injected(uint32_t adc, uint8_t reg)
|
{
switch (reg) {
case 1:
return ADC_JDR1(adc);
case 2:
return ADC_JDR2(adc);
case 3:
return ADC_JDR3(adc);
case 4:
return ADC_JDR4(adc);
}
return 0;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* When called from the interrupthandler only isp1362_hcd->irqenb is modified, since the interrupt handler will write isp1362_hcd->irqenb to HCuPINT upon completion. We don't need a 'disable' counterpart, since interrupts will be disabled only by the interrupt handler. */
|
static void isp1362_enable_int(struct isp1362_hcd *isp1362_hcd, u16 mask)
|
/* When called from the interrupthandler only isp1362_hcd->irqenb is modified, since the interrupt handler will write isp1362_hcd->irqenb to HCuPINT upon completion. We don't need a 'disable' counterpart, since interrupts will be disabled only by the interrupt handler. */
static void isp1362_enable_int(struct isp1362_hcd *isp1362_hcd, u16 mask)
|
{
if ((isp1362_hcd->irqenb | mask) == isp1362_hcd->irqenb)
return;
if (mask & ~isp1362_hcd->irqenb)
isp1362_write_reg16(isp1362_hcd, HCuPINT, mask & ~isp1362_hcd->irqenb);
isp1362_hcd->irqenb |= mask;
if (isp1362_hcd->irq_active)
return;
isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Init irq param with the given sercom hardware instance. */
|
static void _sercom_init_irq_param(const void *const hw, void *dev)
|
/* Init irq param with the given sercom hardware instance. */
static void _sercom_init_irq_param(const void *const hw, void *dev)
|
{
if (hw == SERCOM3) {
_sercom3_dev = (struct _usart_async_device *)dev;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* SHARE: create a DOS share or alter existing share. */
|
static __be32 nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_res *resp)
|
/* SHARE: create a DOS share or alter existing share. */
static __be32 nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_res *resp)
|
{
struct nlm_host *host;
struct nlm_file *file;
dprintk("lockd: SHARE called\n");
resp->cookie = argp->cookie;
if (locks_in_grace() && !argp->reclaim) {
resp->status = nlm_lck_denied_grace_period;
return rpc_success;
}
if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
resp->status = cast_status(nlmsvc_share_file(host, file, argp));
dprintk("lockd: SHARE status %d\n", ntohl(resp->status));
nlm_release_host(host);
nlm_release_file(file);
return rpc_success;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If the udc driver has bus reset handler, it needs to call this when the bus reset occurs, it notifies the gadget driver that the bus reset occurs as well as updates gadget state. */
|
void usb_gadget_udc_reset(struct usb_gadget *gadget, struct usb_gadget_driver *driver)
|
/* If the udc driver has bus reset handler, it needs to call this when the bus reset occurs, it notifies the gadget driver that the bus reset occurs as well as updates gadget state. */
void usb_gadget_udc_reset(struct usb_gadget *gadget, struct usb_gadget_driver *driver)
|
{
driver->reset(gadget);
usb_gadget_set_state(gadget, USB_STATE_DEFAULT);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Each AP perform the function called by BSP. */
|
VOID EFIAPI ParallelHashApExecute(IN VOID *ProcedureArgument)
|
/* Each AP perform the function called by BSP. */
VOID EFIAPI ParallelHashApExecute(IN VOID *ProcedureArgument)
|
{
UINTN Index;
BOOLEAN Status;
for (Index = 0; Index < mBlockNum; Index++) {
if (AcquireSpinLockOrFail (&mSpinLockList[Index])) {
if (mBlockIsCompleted[Index]) {
ReleaseSpinLock (&mSpinLockList[Index]);
continue;
}
Status = CShake256HashAll (
mInput + Index * mBlockSize,
(Index == (mBlockNum - 1)) ? mLastBlockSize : mBlockSize,
mBlockResultSize,
NULL,
0,
NULL,
0,
mBlockHashResult + Index * mBlockResultSize
);
if (!EFI_ERROR (Status)) {
mBlockIsCompleted[Index] = TRUE;
}
ReleaseSpinLock (&mSpinLockList[Index]);
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Parameters: irq irq number to be enabled (the irq number NOT the vector number) */
|
void enable_irq(int irq)
|
/* Parameters: irq irq number to be enabled (the irq number NOT the vector number) */
void enable_irq(int irq)
|
{
int div;
div = irq/32;
switch (div)
{
case 0x0:
NVICICPR0 = 1 << (irq%32);
NVICISER0 = 1 << (irq%32);
break;
case 0x1:
NVICICPR1 = 1 << (irq%32);
NVICISER1 = 1 << (irq%32);
break;
case 0x2:
NVICICPR2 = 1 << (irq%32);
NVICISER2 = 1 << (irq%32);
break;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* param base SRC peripheral base address. param resetSource The global system reset source. See src_global_system_reset_source_t for more details. param resetMode The reset mode of each reset source. See src_global_system_reset_mode_t for more details. */
|
void SRC_SetGlobalSystemResetMode(SRC_Type *base, src_global_system_reset_source_t resetSource, src_global_system_reset_mode_t resetMode)
|
/* param base SRC peripheral base address. param resetSource The global system reset source. See src_global_system_reset_source_t for more details. param resetMode The reset mode of each reset source. See src_global_system_reset_mode_t for more details. */
void SRC_SetGlobalSystemResetMode(SRC_Type *base, src_global_system_reset_source_t resetSource, src_global_system_reset_mode_t resetMode)
|
{
uint32_t regValue;
regValue = base->SRMR;
regValue &= ~SRC_GLOBAL_SYSTEM_RESET_BEHAVIOR_CONFIG(resetSource, SRC_GLOBAL_SYSTEM_RESET_BEHAVIOR_MASK);
regValue |= SRC_GLOBAL_SYSTEM_RESET_BEHAVIOR_CONFIG(resetSource, resetMode);
base->SRMR = regValue;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* linux/fs/ext4/xattr_security.c Handler for storing security labels as extended attributes. */
|
static size_t ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, const char *name, size_t name_len, int type)
|
/* linux/fs/ext4/xattr_security.c Handler for storing security labels as extended attributes. */
static size_t ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, const char *name, size_t name_len, int type)
|
{
const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
const size_t total_len = prefix_len + name_len + 1;
if (list && total_len <= list_size) {
memcpy(list, XATTR_SECURITY_PREFIX, prefix_len);
memcpy(list+prefix_len, name, name_len);
list[prefix_len + name_len] = '\0';
}
return total_len;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Required by the EBC compiler and identical in functionality to */
|
EFI_STATUS EFIAPI EfiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* Required by the EBC compiler and identical in functionality to */
EFI_STATUS EFIAPI EfiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
return _ModuleEntryPoint (ImageHandle, SystemTable);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Note that rtc_irq_set_state() is used to enable or disable the periodic IRQs. */
|
int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
|
/* Note that rtc_irq_set_state() is used to enable or disable the periodic IRQs. */
int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
|
{
int err = 0;
unsigned long flags;
if (rtc->ops->irq_set_freq == NULL)
return -ENXIO;
spin_lock_irqsave(&rtc->irq_task_lock, flags);
if (rtc->irq_task != NULL && task == NULL)
err = -EBUSY;
if (rtc->irq_task != task)
err = -EACCES;
spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
if (err == 0) {
err = rtc->ops->irq_set_freq(rtc->dev.parent, freq);
if (err == 0)
rtc->irq_freq = freq;
}
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable the Low Speed APB (APB1) peripheral clock. */
|
void RCM_EnableAPB1PeriphClock(uint32_t APB1Periph)
|
/* Enable the Low Speed APB (APB1) peripheral clock. */
void RCM_EnableAPB1PeriphClock(uint32_t APB1Periph)
|
{
RCM->APBCLKEN1 |= APB1Periph;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* LPUART EDMA send finished callback function.
This function is called when LPUART EDMA send finished. It disables the LPUART TX EDMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */
|
static void LPUART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
|
/* LPUART EDMA send finished callback function.
This function is called when LPUART EDMA send finished. It disables the LPUART TX EDMA request and sends kStatus_LPUART_TxIdle to LPUART callback. */
static void LPUART_SendEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
|
{
assert(NULL != param);
lpuart_edma_private_handle_t *lpuartPrivateHandle = (lpuart_edma_private_handle_t *)param;
handle = handle;
tcds = tcds;
if (transferDone)
{
LPUART_TransferAbortSendEDMA(lpuartPrivateHandle->base, lpuartPrivateHandle->handle);
while (0U == (lpuartPrivateHandle->base->STAT & LPUART_STAT_TC_MASK))
{
}
if (NULL != lpuartPrivateHandle->handle->callback)
{
lpuartPrivateHandle->handle->callback(lpuartPrivateHandle->base, lpuartPrivateHandle->handle,
kStatus_LPUART_TxIdle, lpuartPrivateHandle->handle->userData);
}
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Write bytes to SDIO fifo.
Writes bytes to SDIO register, treating it as a fifo. Writes will all be done to same address. */
|
int sdio_write_fifo(struct sdio_func *func, uint32_t reg, uint8_t *data, uint32_t len)
|
/* Write bytes to SDIO fifo.
Writes bytes to SDIO register, treating it as a fifo. Writes will all be done to same address. */
int sdio_write_fifo(struct sdio_func *func, uint32_t reg, uint8_t *data, uint32_t len)
|
{
int ret;
if ((func->card->type != CARD_SDIO) && (func->card->type != CARD_COMBO)) {
LOG_WRN("Card does not support SDIO commands");
return -ENOTSUP;
}
ret = k_mutex_lock(&func->card->lock, K_MSEC(CONFIG_SD_DATA_TIMEOUT));
if (ret) {
LOG_WRN("Could not get SD card mutex");
return -EBUSY;
}
ret = sdio_io_rw_extended_helper(func, SDIO_IO_WRITE, reg, false,
data, len);
k_mutex_unlock(&func->card->lock);
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Checks whether the specified DMA flag is set or not. */
|
uint8_t DMA_ReadStatusFlag(DMA_FLAG_T flag)
|
/* Checks whether the specified DMA flag is set or not. */
uint8_t DMA_ReadStatusFlag(DMA_FLAG_T flag)
|
{
uint32_t status;
if ((flag & 0x10000000) == SET)
{
status = DMA2->INTSTS & ((uint32_t)flag & 0x000FFFFF);
}
else
{
status = DMA1->INTSTS & ((uint32_t)flag & 0x0FFFFFFF);
}
if (status == flag)
{
return SET;
}
return RESET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* When forwarding bridge frames, we save a copy of the original header before processing. */
|
int nf_bridge_copy_header(struct sk_buff *skb)
|
/* When forwarding bridge frames, we save a copy of the original header before processing. */
int nf_bridge_copy_header(struct sk_buff *skb)
|
{
int err;
int header_size = ETH_HLEN + nf_bridge_encap_header_len(skb);
err = skb_cow_head(skb, header_size);
if (err)
return err;
skb_copy_to_linear_data_offset(skb, -header_size,
skb->nf_bridge->data, header_size);
__skb_push(skb, nf_bridge_encap_header_len(skb));
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Builds a pdu frame as a REJ response. */
|
void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
|
/* Builds a pdu frame as a REJ response. */
void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
|
{
struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_REJ;
pdu->ctrl_2 = 0;
pdu->ctrl_2 |= f_bit & LLC_S_PF_BIT_MASK;
pdu->ctrl_1 &= 0x0F;
pdu->ctrl_2 |= (nr << 1) & 0xFE;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set the SDMMC in power-cycle state. This will make that the SDMMC_D, SDMMC_CMD and SDMMC_CK are driven low, to prevent the card from being supplied through the signal lines. */
|
static void stm32_sdmmc2_pwrcycle(struct stm32_sdmmc2_priv *priv)
|
/* Set the SDMMC in power-cycle state. This will make that the SDMMC_D, SDMMC_CMD and SDMMC_CK are driven low, to prevent the card from being supplied through the signal lines. */
static void stm32_sdmmc2_pwrcycle(struct stm32_sdmmc2_priv *priv)
|
{
if ((readl(priv->base + SDMMC_POWER) & SDMMC_POWER_PWRCTRL_MASK) ==
SDMMC_POWER_PWRCTRL_CYCLE)
return;
stm32_sdmmc2_reset(priv);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* The check summ offload engine is enabled to do only IPV4 header checksum. IPV4 header Checksum is computed in the Hardware. */
|
void synopGMAC_tx_checksum_offload_ipv4hdr(synopGMACdevice *gmacdev, DmaDesc *desc)
|
/* The check summ offload engine is enabled to do only IPV4 header checksum. IPV4 header Checksum is computed in the Hardware. */
void synopGMAC_tx_checksum_offload_ipv4hdr(synopGMACdevice *gmacdev, DmaDesc *desc)
|
{
desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisIpv4HdrCs);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* RETURN VALUES erp pointer to new ERP-chain head */
|
static struct dasd_ccw_req* dasd_3990_erp_additional_erp(struct dasd_ccw_req *cqr)
|
/* RETURN VALUES erp pointer to new ERP-chain head */
static struct dasd_ccw_req* dasd_3990_erp_additional_erp(struct dasd_ccw_req *cqr)
|
{
struct dasd_ccw_req *erp = NULL;
erp = dasd_3990_erp_add_erp(cqr);
if (erp != cqr) {
erp = dasd_3990_erp_inspect(erp);
}
return erp;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Updates the Receive Address Registers and Multicast Table Array. The caller must have a packed mc_addr_list of multicast addresses. The parameter rar_count will usually be hw->mac.rar_entry_count unless there are workarounds that change this. Currently no func pointer exists and all implementations are handled in the generic version of this function. */
|
static void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count, u32 rar_used_count, u32 rar_count)
|
/* Updates the Receive Address Registers and Multicast Table Array. The caller must have a packed mc_addr_list of multicast addresses. The parameter rar_count will usually be hw->mac.rar_entry_count unless there are workarounds that change this. Currently no func pointer exists and all implementations are handled in the generic version of this function. */
static void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count, u32 rar_used_count, u32 rar_count)
|
{
hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, mc_addr_count,
rar_used_count, rar_count);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.