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
/* This function should be called during kernel startup to initialize the IRQ handling routines. */
void __init init_IRQ(void)
/* This function should be called during kernel startup to initialize the IRQ handling routines. */ void __init init_IRQ(void)
{ int i; if (HARDIRQ_MASK != 0x00ff0000) { extern void hardirq_mask_is_broken(void); hardirq_mask_is_broken(); } for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++) irq_controller[i] = &auto_irq_controller; mach_init_IRQ(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Allocates both RX and TX resources and configures the SGE. However, the hardware is not enabled yet. */
int t1_sge_configure(struct sge *sge, struct sge_params *p)
/* Allocates both RX and TX resources and configures the SGE. However, the hardware is not enabled yet. */ int t1_sge_configure(struct sge *sge, struct sge_params *p)
{ if (alloc_rx_resources(sge, p)) return -ENOMEM; if (alloc_tx_resources(sge, p)) { free_rx_resources(sge); return -ENOMEM; } configure_sge(sge, p); p->large_buf_capacity = jumbo_payload_capacity(sge); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Remove all the cache entries bearing the Tag. When a route cache entry is created, it is tagged with the address of route entry from which it is spawned. When a route entry is deleted, the cache entries spawned from it are also deleted. */
VOID Ip6PurgeRouteCache(IN IP6_ROUTE_CACHE *RtCache, IN UINTN Tag)
/* Remove all the cache entries bearing the Tag. When a route cache entry is created, it is tagged with the address of route entry from which it is spawned. When a route entry is deleted, the cache entries spawned from it are also deleted. */ VOID Ip6PurgeRouteCache(IN IP6_ROUTE_CACHE *RtCache, IN UINTN Tag)
{ LIST_ENTRY *Entry; LIST_ENTRY *Next; IP6_ROUTE_CACHE_ENTRY *RtCacheEntry; UINT32 Index; for (Index = 0; Index < IP6_ROUTE_CACHE_HASH_SIZE; Index++) { NET_LIST_FOR_EACH_SAFE (Entry, Next, &RtCache->CacheBucket[Index]) { RtCacheEntry = NET_LIST_USER_STRUCT (Entry, IP6_ROUTE_CACHE_ENTRY, Link); if (RtCacheEntry->Tag == Tag) { RemoveEntryList (Entry); Ip6FreeRouteCacheEntry (RtCacheEntry); } } } }
tianocore/edk2
C++
Other
4,240
/* Request the memory region(s) being used by 'port'. */
static int sa1100_request_port(struct uart_port *port)
/* Request the memory region(s) being used by 'port'. */ static int sa1100_request_port(struct uart_port *port)
{ struct sa1100_port *sport = (struct sa1100_port *)port; return request_mem_region(sport->port.mapbase, UART_PORT_SIZE, "sa11x0-uart") != NULL ? 0 : -EBUSY; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear Reference and delta on all channels of a Block. */
void TSC_acq_ClearBlockData(TSC_tIndex_T idxBlock)
/* Clear Reference and delta on all channels of a Block. */ void TSC_acq_ClearBlockData(TSC_tIndex_T idxBlock)
{ TSC_tIndex_T idxChannel; TSC_tIndexDest_T idx_Dest; CONST TSC_Block_T* block = &(TSC_Globals.Block_Array[idxBlock]); CONST TSC_Channel_Dest_T* pchDest = block->p_chDest; for (idxChannel = 0; idxChannel < block->NumChannel; idxChannel++) { idx_Dest = pchDest->IdxDest; block->p_chData[idx_Dest].Refer = 0; block->p_chData[idx_Dest].Delta = 0; pchDest++; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the NAND memory status using the Read status command. */
uint32_t NAND_ReadStatus(void)
/* Reads the NAND memory status using the Read status command. */ uint32_t NAND_ReadStatus(void)
{ uint32_t data = 0x00, status = NAND_BUSY; *(__IO uint8_t *)(Bank_NAND_ADDR | CMD_AREA) = NAND_CMD_STATUS; data = *(__IO uint8_t *)(Bank_NAND_ADDR); if((data & NAND_ERROR) == NAND_ERROR) { status = NAND_ERROR; } else if((data & NAND_READY) == NAND_READY) { status = NAND_READY; } else { status = NAND_BUSY; } return (status); }
avem-labs/Avem
C++
MIT License
1,752
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT64 EFIAPI BitFieldRead64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit)
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT64 EFIAPI BitFieldRead64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit)
{ ASSERT (EndBit < 64); ASSERT (StartBit <= EndBit); return RShiftU64 (Operand & ~LShiftU64 ((UINT64)-2, EndBit), StartBit); }
tianocore/edk2
C++
Other
4,240
/* This function gets the HW spec from the firmware and sets some basic parameters. */
static int lbs_setup_firmware(struct lbs_private *priv)
/* This function gets the HW spec from the firmware and sets some basic parameters. */ static int lbs_setup_firmware(struct lbs_private *priv)
{ int ret = -1; s16 curlevel = 0, minlevel = 0, maxlevel = 0; lbs_deb_enter(LBS_DEB_FW); memset(priv->current_addr, 0xff, ETH_ALEN); ret = lbs_update_hw_spec(priv); if (ret) goto done; ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel); if (ret == 0) { priv->txpower_cur = curlevel; priv->txpower_min = minlevel; priv->txpower_max = maxlevel; } lbs_set_mac_control(priv); done: lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* asymmetric_key_id_partial - Return true if two asymmetric keys IDs partially match @kid_1, @kid_2: The key IDs to compare */
bool asymmetric_key_id_partial(const struct asymmetric_key_id *kid1, const struct asymmetric_key_id *kid2)
/* asymmetric_key_id_partial - Return true if two asymmetric keys IDs partially match @kid_1, @kid_2: The key IDs to compare */ bool asymmetric_key_id_partial(const struct asymmetric_key_id *kid1, const struct asymmetric_key_id *kid2)
{ if (!kid1 || !kid2) return false; if (kid1->len < kid2->len) return false; return memcmp(kid1->data + (kid1->len - kid2->len), kid2->data, kid2->len) == 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns pointer to "struct tomoyo_profile" on success, NULL otherwise. */
static struct tomoyo_profile* tomoyo_find_or_assign_new_profile(const unsigned int profile)
/* Returns pointer to "struct tomoyo_profile" on success, NULL otherwise. */ static struct tomoyo_profile* tomoyo_find_or_assign_new_profile(const unsigned int profile)
{ static DEFINE_MUTEX(lock); struct tomoyo_profile *ptr = NULL; int i; if (profile >= TOMOYO_MAX_PROFILES) return NULL; mutex_lock(&lock); ptr = tomoyo_profile_ptr[profile]; if (ptr) goto ok; ptr = tomoyo_alloc_element(sizeof(*ptr)); if (!ptr) goto ok; for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++) ptr->value[i] = tomoyo_control_array[i].current_value; mb(); tomoyo_profile_ptr[profile] = ptr; ok: mutex_unlock(&lock); return ptr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* I just deleted auto_irq.c, since it was never built... */
static int __devinit smc_findirq(struct smc_local *lp)
/* I just deleted auto_irq.c, since it was never built... */ static int __devinit smc_findirq(struct smc_local *lp)
{ void __iomem *ioaddr = lp->base; int timeout = 20; unsigned long cookie; DBG(2, "%s: %s\n", CARDNAME, __func__); cookie = probe_irq_on(); SMC_SELECT_BANK(lp, 2); SMC_SET_INT_MASK(lp, IM_ALLOC_INT); SMC_SET_MMU_CMD(lp, MC_ALLOC | 1); do { int int_status; udelay(10); int_status = SMC_GET_INT(lp); if (int_status & IM_ALLOC_INT) break; } while (--timeout); SMC_SET_INT_MASK(lp, 0); return probe_irq_off(cookie); }
robutest/uclinux
C++
GPL-2.0
60
/* param base AIPSTZ peripheral base pointer param master Peripheral for AIPSTZ. param accessControl Configuration is ORed from aipstz_peripheral_access_control_t. */
void AIPSTZ_SetPeripheralAccessControl(AIPSTZ_Type *base, aipstz_peripheral_t peripheral, uint32_t accessControl)
/* param base AIPSTZ peripheral base pointer param master Peripheral for AIPSTZ. param accessControl Configuration is ORed from aipstz_peripheral_access_control_t. */ void AIPSTZ_SetPeripheralAccessControl(AIPSTZ_Type *base, aipstz_peripheral_t peripheral, uint32_t accessControl)
{ volatile uint32_t *reg = (uint32_t *)((uint32_t)base + ((uint32_t)peripheral >> 16)); uint32_t mask = (((uint32_t)peripheral & 0xFF00U) >> 8) - 1; uint32_t shift = (uint32_t)peripheral & 0xFF; *reg = (*reg & (~(mask << shift))) | ((accessControl & mask) << shift); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Continuation function for 'pcall' and 'xpcall'. Both functions already pushed a 'true' before doing the call, so in case of success 'finishpcall' only has to return everything in the stack minus 'extra' values (where 'extra' is exactly the number of items to be ignored). */
static int finishpcall(lua_State *L, int status, lua_KContext extra)
/* Continuation function for 'pcall' and 'xpcall'. Both functions already pushed a 'true' before doing the call, so in case of success 'finishpcall' only has to return everything in the stack minus 'extra' values (where 'extra' is exactly the number of items to be ignored). */ static int finishpcall(lua_State *L, int status, lua_KContext extra)
{ lua_pushboolean(L, 0); lua_pushvalue(L, -2); return 2; } else return lua_gettop(L) - (int)extra; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Change Logs: Date Author Notes xqyjlj The first version. */
rt_weak unsigned long rt_ktime_cputimer_getres(void)
/* Change Logs: Date Author Notes xqyjlj The first version. */ rt_weak unsigned long rt_ktime_cputimer_getres(void)
{ return ((1000UL * 1000 * 1000) * RT_KTIME_RESMUL) / RT_TICK_PER_SECOND; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This call is exclusively for use by transceiver drivers, which coordinate the activities of drivers for host and peripheral controllers, and in some cases for VBUS current regulation. */
int otg_set_transceiver(struct otg_transceiver *x)
/* This call is exclusively for use by transceiver drivers, which coordinate the activities of drivers for host and peripheral controllers, and in some cases for VBUS current regulation. */ int otg_set_transceiver(struct otg_transceiver *x)
{ if (xceiv && x) return -EBUSY; xceiv = x; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Add the dependent device to the dock's dependent device list. */
static int add_dock_dependent_device(struct dock_station *ds, acpi_handle handle)
/* Add the dependent device to the dock's dependent device list. */ static int add_dock_dependent_device(struct dock_station *ds, acpi_handle handle)
{ struct dock_dependent_device *dd; dd = kzalloc(sizeof(*dd), GFP_KERNEL); if (!dd) return -ENOMEM; dd->handle = handle; INIT_LIST_HEAD(&dd->list); INIT_LIST_HEAD(&dd->hotplug_list); spin_lock(&ds->dd_lock); list_add_tail(&dd->list, &ds->dependent_devices); spin_unlock(&ds->dd_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Construction function for DMALPEND instruction. This function fills the program buffer with the constructed instruction. */
static INLINE int XDmaPs_Instr_DMALPEND(char *DmaProg, char *BodyStart, unsigned Lc)
/* Construction function for DMALPEND instruction. This function fills the program buffer with the constructed instruction. */ static INLINE int XDmaPs_Instr_DMALPEND(char *DmaProg, char *BodyStart, unsigned Lc)
{ *DmaProg = 0x38 | ((Lc & 1) << 2); *(DmaProg + 1) = (u8)(DmaProg - BodyStart); return 2; }
ua1arn/hftrx
C++
null
69
/* ipc_update_perm - update the permissions of an IPC. @in: the permission given as input. @out: the permission of the ipc to set. */
void ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out)
/* ipc_update_perm - update the permissions of an IPC. @in: the permission given as input. @out: the permission of the ipc to set. */ void ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out)
{ out->uid = in->uid; out->gid = in->gid; out->mode = (out->mode & ~S_IRWXUGO) | (in->mode & S_IRWXUGO); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The returned pointer is to the msg contents and it remains valid only as long as the msg buffer is valid. */
const u8* wps_get_uuid_e(const struct wpabuf *msg)
/* The returned pointer is to the msg contents and it remains valid only as long as the msg buffer is valid. */ const u8* wps_get_uuid_e(const struct wpabuf *msg)
{ struct wps_parse_attr *attr; const u8 *uuid_e; attr = (struct wps_parse_attr *)os_zalloc(sizeof(struct wps_parse_attr)); if (attr == NULL) return NULL; if (wps_parse_msg(msg, attr) < 0) { uuid_e = NULL; } else { uuid_e = attr->uuid_e; } os_free(attr); return uuid_e; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Return the number of bytes of space available in the circular buffer. */
static unsigned int cypress_buf_space_avail(struct cypress_buf *cb)
/* Return the number of bytes of space available in the circular buffer. */ static unsigned int cypress_buf_space_avail(struct cypress_buf *cb)
{ if (cb != NULL) return (cb->buf_size + cb->buf_get - cb->buf_put - 1) % cb->buf_size; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is to convert UINTN to ASCII string with the required formatting. */
VOID HttpBootUintnToAscDecWithFormat(IN UINTN Number, IN UINT8 *Buffer, IN INTN Length)
/* This function is to convert UINTN to ASCII string with the required formatting. */ VOID HttpBootUintnToAscDecWithFormat(IN UINTN Number, IN UINT8 *Buffer, IN INTN Length)
{ UINTN Remainder; for ( ; Length > 0; Length--) { Remainder = Number % 10; Number /= 10; Buffer[Length - 1] = (UINT8)('0' + Remainder); } }
tianocore/edk2
C++
Other
4,240
/* The tty buffers allow 64K but we sneak a peak and clip at 8K this allows a lot of overspill room for echo and other fun messes to be handled properly */
static int pty_space(struct tty_struct *to)
/* The tty buffers allow 64K but we sneak a peak and clip at 8K this allows a lot of overspill room for echo and other fun messes to be handled properly */ static int pty_space(struct tty_struct *to)
{ int n = 8192 - to->buf.memory_used; if (n < 0) return 0; return n; }
robutest/uclinux
C++
GPL-2.0
60
/* Write an UDS response on the output channel. */
static int write_response(struct upgrade_uds_t *self_p, int32_t length, uint8_t code)
/* Write an UDS response on the output channel. */ static int write_response(struct upgrade_uds_t *self_p, int32_t length, uint8_t code)
{ length = htonl(length + 1); chan_write(self_p->chout_p, &length, sizeof(length)); chan_write(self_p->chout_p, &code, sizeof(code)); return (0); }
eerimoq/simba
C++
Other
337
/* Return with area of an area (x * y) */
uint32_t lv_area_get_size(const lv_area_t *area_p)
/* Return with area of an area (x * y) */ uint32_t lv_area_get_size(const lv_area_t *area_p)
{ uint32_t size; size = (uint32_t)(area_p->x2 - area_p->x1 + 1) * (area_p->y2 - area_p->y1 + 1); return size; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Parse from stream, collect comments and capture error info. Example Usage: $g++ readFromStream.cpp -ljsoncpp -std=c++11 -o readFromStream $./readFromStream // comment head { // comment before "key" : "value" } // comment after // comment tail. */
int main(int argc, char *argv[])
/* Parse from stream, collect comments and capture error info. Example Usage: $g++ readFromStream.cpp -ljsoncpp -std=c++11 -o readFromStream $./readFromStream // comment head { // comment before "key" : "value" } // comment after // comment tail. */ int main(int argc, char *argv[])
{ std::cout << errs << std::endl; return EXIT_FAILURE; } std::cout << root << std::endl; return EXIT_SUCCESS; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* We are called with the page locked and we unlock it when done. */
static int smb_readpage(struct file *file, struct page *page)
/* We are called with the page locked and we unlock it when done. */ static int smb_readpage(struct file *file, struct page *page)
{ int error; struct dentry *dentry = file->f_path.dentry; page_cache_get(page); error = smb_readpage_sync(dentry, page); page_cache_release(page); return error; }
robutest/uclinux
C++
GPL-2.0
60
/* Write back all requests on one page - we do this before reading it. */
int nfs_wb_page(struct inode *inode, struct page *page)
/* Write back all requests on one page - we do this before reading it. */ int nfs_wb_page(struct inode *inode, struct page *page)
{ return nfs_wb_page_priority(inode, page, FLUSH_STABLE); }
robutest/uclinux
C++
GPL-2.0
60
/* Most of the Z8530 registers are indexed off the control registers. A read is done by writing to the control register and reading the register back. The caller must hold the lock */
static u8 read_zsreg(struct z8530_channel *c, u8 reg)
/* Most of the Z8530 registers are indexed off the control registers. A read is done by writing to the control register and reading the register back. The caller must hold the lock */ static u8 read_zsreg(struct z8530_channel *c, u8 reg)
{ if(reg) z8530_write_port(c->ctrlio, reg); return z8530_read_port(c->ctrlio); }
robutest/uclinux
C++
GPL-2.0
60
/* failure => all reset bets are off, nfserr_no_grace... */
int nfs4_client_to_reclaim(const char *name)
/* failure => all reset bets are off, nfserr_no_grace... */ int nfs4_client_to_reclaim(const char *name)
{ unsigned int strhashval; struct nfs4_client_reclaim *crp = NULL; dprintk("NFSD nfs4_client_to_reclaim NAME: %.*s\n", HEXDIR_LEN, name); crp = alloc_reclaim(); if (!crp) return 0; strhashval = clientstr_hashval(name); INIT_LIST_HEAD(&crp->cr_strhash); list_add(&crp->cr_strhash, &reclaim_str_hashtbl[strhashval]); memcpy(crp->cr_recdir, name, HEXDIR_LEN); reclaim_str_hashtbl_size++; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* find_anchor_wl_entry - find wear-leveling entry to used as anchor PEB. @root: the RB-tree where to look for */
static struct ubi_wl_entry* find_anchor_wl_entry(struct rb_root *root)
/* find_anchor_wl_entry - find wear-leveling entry to used as anchor PEB. @root: the RB-tree where to look for */ static struct ubi_wl_entry* find_anchor_wl_entry(struct rb_root *root)
{ struct rb_node *p; struct ubi_wl_entry *e, *victim = NULL; int max_ec = UBI_MAX_ERASECOUNTER; ubi_rb_for_each_entry(p, e, root, u.rb) { if (e->pnum < UBI_FM_MAX_START && e->ec < max_ec) { victim = e; max_ec = e->ec; } } return victim; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Most of the SCSI commands are supported directly by ATAPI devices. This transform handles the few exceptions. */
static int ide_cdrom_prep_pc(struct request *rq)
/* Most of the SCSI commands are supported directly by ATAPI devices. This transform handles the few exceptions. */ static int ide_cdrom_prep_pc(struct request *rq)
{ u8 *c = rq->cmd; if (c[0] == READ_6 || c[0] == WRITE_6) { c[8] = c[4]; c[5] = c[3]; c[4] = c[2]; c[3] = c[1] & 0x1f; c[2] = 0; c[1] &= 0xe0; c[0] += (READ_10 - READ_6); rq->cmd_len = 10; return BLKPREP_OK; } if (c[0] == MODE_SENSE || c[0] == MODE_SELECT) { rq->errors = ILLEGAL_REQUEST; return BLKPREP_KILL; } return BLKPREP_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is entry point of ScriptSave driver. */
EFI_STATUS EFIAPI InitializeS3SaveState(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This routine is entry point of ScriptSave driver. */ EFI_STATUS EFIAPI InitializeS3SaveState(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_EVENT EndOfDxeEvent; if (!PcdGetBool (PcdAcpiS3Enable)) { return EFI_UNSUPPORTED; } Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, AcpiS3ContextSaveOnEndOfDxe, NULL, &gEfiEndOfDxeEventGroupGuid, &EndOfDxeEvent ); ASSERT_EFI_ERROR (Status); return gBS->InstallProtocolInterface ( &mHandle, &gEfiS3SaveStateProtocolGuid, EFI_NATIVE_INTERFACE, &mS3SaveState ); }
tianocore/edk2
C++
Other
4,240
/* Initialize performance management protocol and install on a given Handle. */
EFI_STATUS ScmiPerformanceProtocolInit(IN EFI_HANDLE *Handle)
/* Initialize performance management protocol and install on a given Handle. */ EFI_STATUS ScmiPerformanceProtocolInit(IN EFI_HANDLE *Handle)
{ return gBS->InstallMultipleProtocolInterfaces ( Handle, &gArmScmiPerformanceProtocolGuid, &PerformanceProtocol, NULL ); }
tianocore/edk2
C++
Other
4,240
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */
status_t HAL_CODEC_Init(void *handle, void *config)
/* param handle codec handle. param config codec configuration. return kStatus_Success is success, else initial failed. */ status_t HAL_CODEC_Init(void *handle, void *config)
{ assert((config != NULL) && (handle != NULL)); codec_config_t *codecConfig = (codec_config_t *)config; sgtl_config_t *sgtlConfig = (sgtl_config_t *)(codecConfig->codecDevConfig); sgtl_handle_t *sgtlHandle = (sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)); ((codec_handle_t *)handle)->codecCapability = &s_sgtl5000_capability; return SGTL_Init(sgtlHandle, sgtlConfig); }
eclipse-threadx/getting-started
C++
Other
310
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_cross_type(char *buf, guint32 value)
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ static void format_cross_type(char *buf, guint32 value)
{ g_snprintf(buf, ITEM_LABEL_LENGTH, "%s (%c)", val_to_str_const(value, ouch_cross_type_val, "Unknown"), value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Puts a data element into the SSI transmit FIFO as the end of a frame. */
int32_t SSIAdvDataPutFrameEndNonBlocking(uint32_t ui32Base, uint32_t ui32Data)
/* Puts a data element into the SSI transmit FIFO as the end of a frame. */ int32_t SSIAdvDataPutFrameEndNonBlocking(uint32_t ui32Base, uint32_t ui32Data)
{ ASSERT(_SSIBaseValid(ui32Base)); ASSERT((ui32Data & 0xffffff00) == 0); if(HWREG(ui32Base + SSI_O_SR) & SSI_SR_TNF) { HWREG(ui32Base + SSI_O_CR1) |= SSI_CR1_EOM; HWREG(ui32Base + SSI_O_DR) = ui32Data; return(1); } else { return(0); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the time stamp higher sec value to respective pointers */
void synopGMAC_TS_read_timestamp_higher_val(synopGMACdevice *gmacdev, u16 *higher_sec_val)
/* Reads the time stamp higher sec value to respective pointers */ void synopGMAC_TS_read_timestamp_higher_val(synopGMACdevice *gmacdev, u16 *higher_sec_val)
{ * higher_sec_val = (u16)(synopGMACReadReg(gmacdev->MacBase,GmacTSHighWord) & GmacTSHighWordMask); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wait for the transfer complete. It covers the interrupt mode, DMA mode and PIO mode. */
int card_wait_xfer_done(uint32_t instance)
/* Wait for the transfer complete. It covers the interrupt mode, DMA mode and PIO mode. */ int card_wait_xfer_done(uint32_t instance)
{ int usdhc_status = 0; int timeout = 0x40000000; if(SDHC_INTR_mode) { while (timeout--) { card_xfer_result(instance, &usdhc_status); if (usdhc_status == 1) return SUCCESS; } } else { return SUCCESS; } return FAIL; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* There can be several possible malformed requests and we attempt to capture all of them. We enumerate some of the rules */
static int parse_ksym_trace_str(char *input_string, char **ksymname, unsigned long *addr)
/* There can be several possible malformed requests and we attempt to capture all of them. We enumerate some of the rules */ static int parse_ksym_trace_str(char *input_string, char **ksymname, unsigned long *addr)
{ int ret; *ksymname = strsep(&input_string, ":"); *addr = kallsyms_lookup_name(*ksymname); if ((!input_string) || (strlen(input_string) != KSYM_TRACER_OP_LEN) || (*addr == 0)) return -EINVAL;; ret = ksym_trace_get_access_type(input_string); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns first word of the unique device identifier (UID based on 96 bits) */
uint32_t HAL_GetUIDw0(void)
/* Returns first word of the unique device identifier (UID based on 96 bits) */ uint32_t HAL_GetUIDw0(void)
{ return (READ_REG(*((uint32_t *)UID_BASE))); }
ua1arn/hftrx
C++
null
69
/* Allocate an object from this cache. The flags are only relevant if the cache has no available objects. */
void* kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
/* Allocate an object from this cache. The flags are only relevant if the cache has no available objects. */ void* kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
{ void *ret = __cache_alloc(cachep, flags, __builtin_return_address(0)); trace_kmem_cache_alloc(_RET_IP_, ret, obj_size(cachep), cachep->buffer_size, flags); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This function get and set the inheritsched attribute in the attr argument. PTHREAD_EXPLICIT_SCHED Specifies that the scheduling policy and associated attributes are to be set to the corresponding values from this attribute object. */
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
/* This function get and set the inheritsched attribute in the attr argument. PTHREAD_EXPLICIT_SCHED Specifies that the scheduling policy and associated attributes are to be set to the corresponding values from this attribute object. */ int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
{ RT_ASSERT(attr != RT_NULL); *inheritsched = attr->inheritsched; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will register hub class driver to the usb class driver manager. and it should be invoked in the usb system initialization. */
ucd_t rt_usb_class_driver_hub(void)
/* This function will register hub class driver to the usb class driver manager. and it should be invoked in the usb system initialization. */ ucd_t rt_usb_class_driver_hub(void)
{ hub_driver.class_code = USB_CLASS_HUB; hub_driver.run = rt_usb_hub_run; hub_driver.stop = rt_usb_hub_stop; return &hub_driver; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Find the point in the ConfigResp string for this question. */
CHAR16* GetOffsetFromConfigResp(IN FORM_BROWSER_STATEMENT *Question, IN CHAR16 *ConfigResp)
/* Find the point in the ConfigResp string for this question. */ CHAR16* GetOffsetFromConfigResp(IN FORM_BROWSER_STATEMENT *Question, IN CHAR16 *ConfigResp)
{ CHAR16 *RequestElement; CHAR16 *BlockData; if (Question->Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) { RequestElement = StrStr (ConfigResp, Question->VariableName); if (RequestElement != NULL) { RequestElement += StrLen (Question->VariableName) + 1; } return RequestElement; } HiiToLower (ConfigResp); RequestElement = StrStr (ConfigResp, Question->BlockName); if (RequestElement != NULL) { RequestElement += StrLen (Question->BlockName) + StrLen (L"&VALUE="); return RequestElement; } BlockData = AllocateCopyPool (StrSize (Question->BlockName), Question->BlockName); ASSERT (BlockData != NULL); HiiToLower (BlockData); RequestElement = StrStr (ConfigResp, BlockData); FreePool (BlockData); if (RequestElement != NULL) { RequestElement += StrLen (Question->BlockName) + StrLen (L"&VALUE="); } return RequestElement; }
tianocore/edk2
C++
Other
4,240
/* Sleep for a specified number of seconds. See IEEE 1003.1 */
unsigned sleep(unsigned int seconds)
/* Sleep for a specified number of seconds. See IEEE 1003.1 */ unsigned sleep(unsigned int seconds)
{ int rem; rem = k_sleep(K_SECONDS(seconds)); __ASSERT_NO_MSG(rem >= 0); return rem / MSEC_PER_SEC; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set the period of the specified channel in microseconds. */
void pwmout_period_us(pwmout_t *obj, int us)
/* Set the period of the specified channel in microseconds. */ void pwmout_period_us(pwmout_t *obj, int us)
{ u32 arr; float dc = pwmout_read(obj); u32 tmp = us * 40 / (prescaler + 1); if(tmp > 0x10000){ prescaler = us * 40 / 0x10000; RTIM_PrescalerConfig(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], prescaler, TIM_PSCReloadMode_Update); } obj->period = us; arr = us * 40 / (prescaler + 1) - 1; RTIM_ChangePeriod(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], arr); pwmout_write(obj, dc); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Function for handling the Sensor Contact Detected timer timeout. This function will be called each time the Sensor Contact Detected timer expires. */
static void sensor_contact_detected_timeout_handler(void *p_context)
/* Function for handling the Sensor Contact Detected timer timeout. This function will be called each time the Sensor Contact Detected timer expires. */ static void sensor_contact_detected_timeout_handler(void *p_context)
{ static bool sensor_contact_detected = false; UNUSED_PARAMETER(p_context); sensor_contact_detected = !sensor_contact_detected; ble_hrs_sensor_contact_detected_update(&m_hrs, sensor_contact_detected); }
labapart/polymcu
C++
null
201
/* Calculates a scaled and compensated pressure value from raw data raw: raw pressure value read from Dps310 returns: pressure value in Pa */
int32_t calcPressure(int32_t raw)
/* Calculates a scaled and compensated pressure value from raw data raw: raw pressure value read from Dps310 returns: pressure value in Pa */ int32_t calcPressure(int32_t raw)
{ double prs = raw; prs /= scaling_facts[dps310_ctx.m_prsOsr]; prs = dps310_ctx.m_c00 + prs * (dps310_ctx.m_c10 + prs * (dps310_ctx.m_c20 + prs * dps310_ctx.m_c30)) + dps310_ctx.m_lastTempScal * (dps310_ctx.m_c01 + prs * (dps310_ctx.m_c11 + prs * dps310_ctx.m_c21)); return (int32_t)prs; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Write a big-endian word to an internal address of an I2C slave. */
static int i2c_reg_write_word_be(const struct i2c_dt_spec *bus, uint8_t reg_addr, uint16_t value)
/* Write a big-endian word to an internal address of an I2C slave. */ static int i2c_reg_write_word_be(const struct i2c_dt_spec *bus, uint8_t reg_addr, uint16_t value)
{ uint8_t tx_buf[3] = { reg_addr, value >> 8, value & 0xff }; return i2c_write_dt(bus, tx_buf, 3); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Fetch AUX CH registers 0x202 - 0x207 which contain link status information */
static bool intel_dp_get_link_status(struct intel_output *intel_output, uint8_t link_status[DP_LINK_STATUS_SIZE])
/* Fetch AUX CH registers 0x202 - 0x207 which contain link status information */ static bool intel_dp_get_link_status(struct intel_output *intel_output, uint8_t link_status[DP_LINK_STATUS_SIZE])
{ int ret; ret = intel_dp_aux_native_read(intel_output, DP_LANE0_1_STATUS, link_status, DP_LINK_STATUS_SIZE); if (ret != DP_LINK_STATUS_SIZE) return false; return true; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used to calculate day of week according to date. */
static void rtc_calculate_wday(int year, int mon, int mday, int *wday)
/* This function is used to calculate day of week according to date. */ static void rtc_calculate_wday(int year, int mon, int mday, int *wday)
{ int t_year = year + 1900, t_mon = mon + 1; if(t_mon == 1 || t_mon == 2){ t_year --; t_mon += 12; } int c = t_year / 100; int y = t_year % 100; int week = (c / 4) - 2 * c + (y + y / 4) + (26 * (t_mon + 1) / 10) + mday -1; while(week < 0){ week += 7; } week %= 7; *wday = week; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64* EFIAPI MmioWriteBuffer64(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT64 *Buffer)
/* If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */ UINT64* EFIAPI MmioWriteBuffer64(IN UINTN StartAddress, IN UINTN Length, IN CONST UINT64 *Buffer)
{ UINT64 *ReturnBuffer; ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0); ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress)); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); ASSERT ((Length & (sizeof (UINT64) - 1)) == 0); ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0); ReturnBuffer = (UINT64 *)Buffer; while (Length > 0) { MmioWrite64 (StartAddress, *(Buffer++)); StartAddress += sizeof (UINT64); Length -= sizeof (UINT64); } return ReturnBuffer; }
tianocore/edk2
C++
Other
4,240
/* device_remove_bin_file - remove sysfs binary attribute file @dev: device. @attr: device binary attribute descriptor. */
void device_remove_bin_file(struct device *dev, const struct bin_attribute *attr)
/* device_remove_bin_file - remove sysfs binary attribute file @dev: device. @attr: device binary attribute descriptor. */ void device_remove_bin_file(struct device *dev, const struct bin_attribute *attr)
{ if (dev) sysfs_remove_bin_file(&dev->kobj, attr); }
robutest/uclinux
C++
GPL-2.0
60
/* 6.. FMS Kill (Confirmed Service Id = 23) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_kill_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Kill (Confirmed Service Id = 23) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_kill_pi_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Kill Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_kill_req, NULL, "FMS Kill Request"); proto_tree_add_item(sub_tree, hf_ff_fms_kill_req_idx, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; if (length) { proto_tree_add_item(sub_tree, hf_ff_unknown_data, tvb, offset, length, ENC_NA); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ZigBee ZCL Pump Configuration and Control cluster dissector for wireshark. */
static int dissect_zbee_zcl_pump_config_control(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
/* ZigBee ZCL Pump Configuration and Control cluster dissector for wireshark. */ static int dissect_zbee_zcl_pump_config_control(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
{ return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Compute BnA to the BnP-th power modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to */
BOOLEAN EFIAPI BigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
/* Compute BnA to the BnP-th power modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to */ BOOLEAN EFIAPI BigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
{ CALL_CRYPTO_SERVICE (BigNumExpMod, (BnA, BnP, BnM, BnRes), FALSE); }
tianocore/edk2
C++
Other
4,240
/* This function stores the backup copy of meta data in RAM journal_buffer */
int ext4fs_log_journal(char *journal_buffer, uint32_t blknr)
/* This function stores the backup copy of meta data in RAM journal_buffer */ int ext4fs_log_journal(char *journal_buffer, uint32_t blknr)
{ struct ext_filesystem *fs = get_fs(); short i; if (!journal_buffer) { printf("Invalid input arguments %s\n", __func__); return -EINVAL; } for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) { if (journal_ptr[i]->blknr == -1) break; if (journal_ptr[i]->blknr == blknr) return 0; } journal_ptr[gindex]->buf = zalloc(fs->blksz); if (!journal_ptr[gindex]->buf) return -ENOMEM; memcpy(journal_ptr[gindex]->buf, journal_buffer, fs->blksz); journal_ptr[gindex++]->blknr = blknr; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This API is used to get the nvm program mode(nvm_prog_mode)in the register 0x33 bit 0. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_nvmprog_mode(u8 *nvmprog_mode_u8)
/* This API is used to get the nvm program mode(nvm_prog_mode)in the register 0x33 bit 0. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_nvmprog_mode(u8 *nvmprog_mode_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { com_rslt = E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_UNLOCK_EE_PROG_MODE_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *nvmprog_mode_u8 = BMA2x2_GET_BITSLICE (data_u8, BMA2x2_UNLOCK_EE_PROG_MODE); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We additionally set the priority in the interrupt controller at runtime. */
void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(const void *), const void *isr_param_p)
/* We additionally set the priority in the interrupt controller at runtime. */ void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(const void *), const void *isr_param_p)
{ irq_vector_table[irq_p].irq = irq_p; irq_vector_table[irq_p].func = isr_p; irq_vector_table[irq_p].param = isr_param_p; irq_vector_table[irq_p].flags = flags; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function always passes NULL for the hash argument, because when this function is called we do not yet know the final size of the header and want to delay the digest processing until we know that. */
void iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
/* This function always passes NULL for the hash argument, because when this function is called we do not yet know the final size of the header and want to delay the digest processing until we know that. */ void iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
{ ISCSI_DBG_TCP(tcp_conn->iscsi_conn, "(%s)\n", tcp_conn->iscsi_conn->hdrdgst_en ? "digest enabled" : "digest disabled"); iscsi_segment_init_linear(&tcp_conn->in.segment, tcp_conn->in.hdr_buf, sizeof(struct iscsi_hdr), iscsi_tcp_hdr_recv_done, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the current state of an axis control on a joystick */
Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
/* Get the current state of an axis control on a joystick */ Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
{ Sint16 state; if ( ! ValidJoystick(&joystick) ) { return(0); } if ( axis < joystick->naxes ) { state = joystick->axes[axis]; } else { SDL_SetError("Joystick only has %d axes", joystick->naxes); state = 0; } return(state); }
DC-SWAT/DreamShell
C++
null
404
/* Attribute write call back for the Long descriptor V2D2 attribute. */
static ssize_t write_long_des_v2d2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Long descriptor V2D2 attribute. */ static ssize_t write_long_des_v2d2(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ uint8_t *value = attr->user_data; if (offset >= sizeof(long_des_v2d2_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(long_des_v2d2_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Since DMA is i-cache coherent, any (complete) pages that were written via DMA can be marked as "clean" so that lazy_mmu_prot_update() doesn't have to flush them when they get mapped into an executable vm-area. */
void dma_mark_clean(void *addr, size_t size)
/* Since DMA is i-cache coherent, any (complete) pages that were written via DMA can be marked as "clean" so that lazy_mmu_prot_update() doesn't have to flush them when they get mapped into an executable vm-area. */ void dma_mark_clean(void *addr, size_t size)
{ unsigned long pg_addr, end; pg_addr = PAGE_ALIGN((unsigned long) addr); end = (unsigned long) addr + size; while (pg_addr + PAGE_SIZE <= end) { struct page *page = virt_to_page(pg_addr); set_bit(PG_arch_1, &page->flags); pg_addr += PAGE_SIZE; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the opa scale enable parameter (required to set opa_scale with */
void lv_obj_set_opa_scale_enable(lv_obj_t *obj, bool en)
/* Set the opa scale enable parameter (required to set opa_scale with */ void lv_obj_set_opa_scale_enable(lv_obj_t *obj, bool en)
{ obj->opa_scale_en = en ? 1 : 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* r e m o v e I n d e x */
returnValue Bounds_removeIndex(Bounds *_THIS, Indexlist *const indexlist, int removenumber)
/* r e m o v e I n d e x */ returnValue Bounds_removeIndex(Bounds *_THIS, Indexlist *const indexlist, int removenumber)
{ if ( _THIS->status != 0 ) _THIS->status[removenumber] = ST_UNDEFINED; else return THROWERROR( RET_REMOVEINDEX_FAILED ); if ( indexlist != 0 ) { if ( Indexlist_removeNumber( indexlist,removenumber ) != SUCCESSFUL_RETURN ) return THROWERROR( RET_REMOVEINDEX_FAILED ); } else return THROWERROR( RET_INVALID_ARGUMENTS ); return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* It will remove all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as for WRQ. When it gets the last block number, it will call this function to set the last block number. */
VOID Mtftp4SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
/* It will remove all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as for WRQ. When it gets the last block number, it will call this function to set the last block number. */ VOID Mtftp4SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
{ MTFTP4_BLOCK_RANGE *Range; while (!IsListEmpty (Head)) { Range = NET_LIST_TAIL (Head, MTFTP4_BLOCK_RANGE, Link); if (Range->Start > Last) { RemoveEntryList (&Range->Link); FreePool (Range); continue; } if (Range->End > Last) { Range->End = Last; } return; } }
tianocore/edk2
C++
Other
4,240
/* Implement G/S_PARM. There is a "high quality" mode we could try to do someday; for now, we just do the frame rate tweak. */
static int ov7670_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms)
/* Implement G/S_PARM. There is a "high quality" mode we could try to do someday; for now, we just do the frame rate tweak. */ static int ov7670_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms)
{ struct v4l2_captureparm *cp = &parms->parm.capture; unsigned char clkrc; int ret; if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; ret = ov7670_read(sd, REG_CLKRC, &clkrc); if (ret < 0) return ret; memset(cp, 0, sizeof(struct v4l2_captureparm)); cp->capability = V4L2_CAP_TIMEPERFRAME; cp->timeperframe.numerator = 1; cp->timeperframe.denominator = OV7670_FRAME_RATE; if ((clkrc & CLK_EXT) == 0 && (clkrc & CLK_SCALE) > 1) cp->timeperframe.denominator /= (clkrc & CLK_SCALE); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* 2) The second call must be after EndOfDxe and after ConnectAll, so that all device capsule FMP protocols are exposed. The system capsules are skipped. If the device capsules are NOT processed in first call, they are processed here. Each individual capsule result is recorded in capsule record variable. System may reset in this function, if reset is required by capsule processed in first call and second call. */
EFI_STATUS EFIAPI ProcessCapsules(VOID)
/* 2) The second call must be after EndOfDxe and after ConnectAll, so that all device capsule FMP protocols are exposed. The system capsules are skipped. If the device capsules are NOT processed in first call, they are processed here. Each individual capsule result is recorded in capsule record variable. System may reset in this function, if reset is required by capsule processed in first call and second call. */ EFI_STATUS EFIAPI ProcessCapsules(VOID)
{ EFI_STATUS Status; if (!mDxeCapsuleLibEndOfDxe) { Status = ProcessTheseCapsules (TRUE); if (mNeedReset && AreAllImagesProcessed ()) { DoResetSystem (); } } else { Status = ProcessTheseCapsules (FALSE); if (mNeedReset) { DoResetSystem (); } } return Status; }
tianocore/edk2
C++
Other
4,240
/* Helper function for the cn0415_status_pid(). Display the frequency of the update for the PID controller. */
static void cn0415_status_pid_frequency(struct cn0415_dev *dev)
/* Helper function for the cn0415_status_pid(). Display the frequency of the update for the PID controller. */ static void cn0415_status_pid_frequency(struct cn0415_dev *dev)
{ uint8_t buffer[20]; itoa(dev->controller->f_loop, (char *)buffer, 10); usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)" PID loop frequency: "); usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)buffer); usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)"Hz\n"); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Configures the double buffer mode and the current memory target. */
void DMA_ConfigBufferMode(DMA_Stream_T *stream, uint32_t memory1BaseAddr, DMA_MEMORY_T currentMemory)
/* Configures the double buffer mode and the current memory target. */ void DMA_ConfigBufferMode(DMA_Stream_T *stream, uint32_t memory1BaseAddr, DMA_MEMORY_T currentMemory)
{ stream->SCFG_B.CTARG = currentMemory; stream->M1ADDR = memory1BaseAddr; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector6_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector6_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (6 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Fills each SPI_Config_T member with its default value. */
void SPI_ConfigStructInit(SPI_Config_T *spiConfig)
/* Fills each SPI_Config_T member with its default value. */ void SPI_ConfigStructInit(SPI_Config_T *spiConfig)
{ spiConfig->direction = SPI_DIRECTION_2LINES_FULLDUPLEX; spiConfig->mode = SPI_MODE_SLAVE; spiConfig->length = SPI_DATA_LENGTH_8B; spiConfig->polarity = SPI_CLKPOL_LOW; spiConfig->phase = SPI_CLKPHA_1EDGE; spiConfig->nss = SPI_NSS_HARD; spiConfig->baudrateDiv = SPI_BAUDRATE_DIV_2; spiConfig->firstBit = SPI_FIRSTBIT_MSB; spiConfig->crcPolynomial = 7; }
pikasTech/PikaPython
C++
MIT License
1,403
/* The following functions are defined for xscale (deviceid : 1064R, PERC5) controllers megasas_enable_intr_xscale - Enables interrupts @regs: MFI register set */
static void megasas_enable_intr_xscale(struct megasas_register_set __iomem *regs)
/* The following functions are defined for xscale (deviceid : 1064R, PERC5) controllers megasas_enable_intr_xscale - Enables interrupts @regs: MFI register set */ static void megasas_enable_intr_xscale(struct megasas_register_set __iomem *regs)
{ writel(1, &(regs)->outbound_intr_mask); readl(&regs->outbound_intr_mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Find the frame interval closest to the requested frame interval for the given frame format and size. This should be done by the device as part of the Video Probe and Commit negotiation, but some hardware don't implement that feature. */
static __u32 uvc_try_frame_interval(struct uvc_frame *frame, __u32 interval)
/* Find the frame interval closest to the requested frame interval for the given frame format and size. This should be done by the device as part of the Video Probe and Commit negotiation, but some hardware don't implement that feature. */ static __u32 uvc_try_frame_interval(struct uvc_frame *frame, __u32 interval)
{ unsigned int i; if (frame->bFrameIntervalType) { __u32 best = -1, dist; for (i = 0; i < frame->bFrameIntervalType; ++i) { dist = interval > frame->dwFrameInterval[i] ? interval - frame->dwFrameInterval[i] : frame->dwFrameInterval[i] - interval; if (dist > best) break; best = dist; } interval = frame->dwFrameInterval[i-1]; } else { const __u32 min = frame->dwFrameInterval[0]; const __u32 max = frame->dwFrameInterval[1]; const __u32 step = frame->dwFrameInterval[2]; interval = min + (interval - min + step/2) / step * step; if (interval > max) interval = max; } return interval; }
robutest/uclinux
C++
GPL-2.0
60
/* Get minimum widget size. This function returns the minimum size that is required for showing the full widget and the caption. */
void wtk_radio_button_size_hint(struct win_point *size, const char *caption)
/* Get minimum widget size. This function returns the minimum size that is required for showing the full widget and the caption. */ void wtk_radio_button_size_hint(struct win_point *size, const char *caption)
{ Assert(size); Assert(caption); gfx_get_string_bounding_box(caption, &sysfont, &size->x, &size->y); size->x += WTK_RADIOBUTTON_CAPTION_X + 2; size->y += WTK_RADIOBUTTON_CAPTION_Y + 2; if (size->y < (WTK_RADIOBUTTON_BUTTON_Y + WTK_RADIOBUTTON_RADIUS + 2)) { size->y = WTK_RADIOBUTTON_BUTTON_Y + WTK_RADIOBUTTON_RADIUS + 2; } }
memfault/zero-to-main
C++
null
200
/* Airpcap wrapper, used to load the driver's set of keys */
gboolean airpcap_if_get_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint *PKeysCollectionSize)
/* Airpcap wrapper, used to load the driver's set of keys */ gboolean airpcap_if_get_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint *PKeysCollectionSize)
{ if (!AirpcapLoaded || (g_PAirpcapGetDriverKeys==NULL)) return FALSE; return g_PAirpcapGetDriverKeys(AdapterHandle,KeysCollection,PKeysCollectionSize); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix is not required for a match. */
SQLITE_API int sqlite3_compileoption_used(const char *zOptName)
/* The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix is not required for a match. */ SQLITE_API int sqlite3_compileoption_used(const char *zOptName)
{ int i, n; if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7; n = sqlite3Strlen30(zOptName); for(i=0; i<ArraySize(azCompileOpt); i++){ if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0 && sqlite3CtypeMap[(unsigned char)azCompileOpt[i][n]]==0 ){ return 1; } } return 0; }
DC-SWAT/DreamShell
C++
null
404
/* Check if sg_io_v4 from user is allowed and valid */
static int bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
/* Check if sg_io_v4 from user is allowed and valid */ static int bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
{ int ret = 0; if (hdr->guard != 'Q') return -EINVAL; switch (hdr->protocol) { case BSG_PROTOCOL_SCSI: switch (hdr->subprotocol) { case BSG_SUB_PROTOCOL_SCSI_CMD: case BSG_SUB_PROTOCOL_SCSI_TRANSPORT: break; default: ret = -EINVAL; } break; default: ret = -EINVAL; } *rw = hdr->dout_xfer_len ? WRITE : READ; return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* brief Return Frequency of DAC Clock return Frequency of DAC. */
uint32_t CLOCK_GetDacClkFreq(uint32_t id)
/* brief Return Frequency of DAC Clock return Frequency of DAC. */ uint32_t CLOCK_GetDacClkFreq(uint32_t id)
{ uint32_t freq = 0U; switch (SYSCON->DAC[id].CLKSEL) { case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 2U: freq = CLOCK_GetExtClkFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 4U: freq = CLOCK_GetFro12MFreq(); break; case 5U: freq = CLOCK_GetPll1OutFreq() / (((SYSCON->PLL1CLK0DIV) & 0xffU) + 1U); break; default: freq = 0U; break; } return freq / ((SYSCON->DAC[id].CLKDIV & SYSCON_DAC_CLKDIV_DIV_MASK) + 1U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* It is only meaningful to flush output, not input. */
static void pcm_flush_frag(vwsnd_dev_t *devc)
/* It is only meaningful to flush output, not input. */ static void pcm_flush_frag(vwsnd_dev_t *devc)
{ vwsnd_port_t *wport = &devc->wport; DBGPV("swstate = %d\n", wport->swstate); if (wport->swstate == SW_RUN) { int idx = wport->swb_u_idx; int end = (idx + wport->hw_fragsize - 1) >> wport->hw_fragshift << wport->hw_fragshift; int nb = end - idx; DBGPV("clearing %d bytes\n", nb); if (nb) memset(wport->swbuf + idx, (char) wport->zero_word, nb); wport->swstate = SW_DRAIN; pcm_output(devc, 0, nb); } DBGRV(); }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to FLEXIO_I2C_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_I2C_RxFullFlag arg kFLEXIO_I2C_ReceiveNakFlag */
void FLEXIO_I2C_MasterClearStatusFlags(FLEXIO_I2C_Type *base, uint32_t mask)
/* param base Pointer to FLEXIO_I2C_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_I2C_RxFullFlag arg kFLEXIO_I2C_ReceiveNakFlag */ void FLEXIO_I2C_MasterClearStatusFlags(FLEXIO_I2C_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_I2C_TxEmptyFlag) { FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1U << base->shifterIndex[0]); } if (mask & kFLEXIO_I2C_RxFullFlag) { FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1U << base->shifterIndex[1]); } if (mask & kFLEXIO_I2C_ReceiveNakFlag) { FLEXIO_ClearShifterErrorFlags(base->flexioBase, 1U << base->shifterIndex[1]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Finalizes the flash driver operations. There could still be data in the currently active block that needs to be flashed. */
blt_bool FlashDone(void)
/* Finalizes the flash driver operations. There could still be data in the currently active block that needs to be flashed. */ blt_bool FlashDone(void)
{ blt_bool result = BLT_TRUE; if (bootBlockInfo.base_addr != FLASH_INVALID_ADDRESS) { if (FlashWriteBlock(&bootBlockInfo) == BLT_FALSE) { result = BLT_FALSE; } } if (result == BLT_TRUE) { if (blockInfo.base_addr != FLASH_INVALID_ADDRESS) { if (FlashWriteBlock(&blockInfo) == BLT_FALSE) { result = BLT_FALSE; } } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Given a period in ns and frequency in khz, calculate the number of cycles of frequency in period. Note that we round up to the next cycle, even if we are only slightly over. */
static u_int ns_to_cycles(u_int ns, u_int khz)
/* Given a period in ns and frequency in khz, calculate the number of cycles of frequency in period. Note that we round up to the next cycle, even if we are only slightly over. */ static u_int ns_to_cycles(u_int ns, u_int khz)
{ return (ns * khz + 999999) / 1000000; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The user entry point for the I2C bus module. The user code starts with this function. */
EFI_STATUS EFIAPI InitializeI2cBus(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The user entry point for the I2C bus module. The user code starts with this function. */ EFI_STATUS EFIAPI InitializeI2cBus(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gI2cBusDriverBinding, NULL, &gI2cBusComponentName, &gI2cBusComponentName2 ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Registers a function to be called from the CPU interrupt handler. */
EFI_STATUS EFIAPI CpuRegisterInterruptHandler(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
/* Registers a function to be called from the CPU interrupt handler. */ EFI_STATUS EFIAPI CpuRegisterInterruptHandler(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
{ return RegisterCpuInterruptHandler (InterruptType, InterruptHandler); }
tianocore/edk2
C++
Other
4,240
/* Configures the number of bytes to be transmitted/received. */
void I2C_NumberOfBytesConfig(I2C_TypeDef *I2Cx, uint8_t Number_Bytes)
/* Configures the number of bytes to be transmitted/received. */ void I2C_NumberOfBytesConfig(I2C_TypeDef *I2Cx, uint8_t Number_Bytes)
{ uint32_t tmpreg = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); tmpreg = I2Cx->CR2; tmpreg &= (uint32_t)~((uint32_t)I2C_CR2_NBYTES); tmpreg |= (uint32_t)(((uint32_t)Number_Bytes << 16) & I2C_CR2_NBYTES); I2Cx->CR2 = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Timer Enable the Output Compare Slow Mode. This disables the fast compare mode and the output compare depends on the counter and compare register values. */
void timer_set_oc_slow_mode(uint32_t timer_peripheral, enum tim_oc_id oc_id)
/* Timer Enable the Output Compare Slow Mode. This disables the fast compare mode and the output compare depends on the counter and compare register values. */ void timer_set_oc_slow_mode(uint32_t timer_peripheral, enum tim_oc_id oc_id)
{ switch (oc_id) { case TIM_OC1: TIM_CCMR1(timer_peripheral) &= ~TIM_CCMR1_OC1FE; break; case TIM_OC2: TIM_CCMR1(timer_peripheral) &= ~TIM_CCMR1_OC2FE; break; case TIM_OC3: TIM_CCMR2(timer_peripheral) &= ~TIM_CCMR2_OC3FE; break; case TIM_OC4: TIM_CCMR2(timer_peripheral) &= ~TIM_CCMR2_OC4FE; break; case TIM_OC1N: case TIM_OC2N: case TIM_OC3N: break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* OIS chain on aux interface power on mode.. */
int32_t lsm6dso_aux_pw_on_ctrl_set(lsm6dso_ctx_t *ctx, lsm6dso_ois_on_t val)
/* OIS chain on aux interface power on mode.. */ int32_t lsm6dso_aux_pw_on_ctrl_set(lsm6dso_ctx_t *ctx, lsm6dso_ois_on_t val)
{ lsm6dso_ctrl7_g_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t*)&reg, 1); if (ret == 0) { reg.ois_on_en = (uint8_t)val & 0x01U; reg.ois_on = (uint8_t)val & 0x01U; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* For the data=writeback case we can already ignore buffer heads and write whole extents at once. This is a big reduction in the number of I/O requests we send and the bmap calls we make in this case. */
static int gfs2_writeback_writepages(struct address_space *mapping, struct writeback_control *wbc)
/* For the data=writeback case we can already ignore buffer heads and write whole extents at once. This is a big reduction in the number of I/O requests we send and the bmap calls we make in this case. */ static int gfs2_writeback_writepages(struct address_space *mapping, struct writeback_control *wbc)
{ return mpage_writepages(mapping, wbc, gfs2_get_block_noalloc); }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT8 EFIAPI PciExpressBitFieldRead8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
{ if (Address >= mSmmPciExpressLibPciExpressBaseSize) { return (UINT8)-1; } return MmioBitFieldRead8 ( GetPciExpressAddress (Address), StartBit, EndBit ); }
tianocore/edk2
C++
Other
4,240
/* Informs the Policy Engine that a soft reset was received. */
void pe_got_soft_reset(const struct device *dev)
/* Informs the Policy Engine that a soft reset was received. */ void pe_got_soft_reset(const struct device *dev)
{ pe_set_state(dev, PE_SOFT_RESET); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* scsi_eh_flush_done_q - finish processed commands or retry them. @done_q: list_head of processed commands. */
void scsi_eh_flush_done_q(struct list_head *done_q)
/* scsi_eh_flush_done_q - finish processed commands or retry them. @done_q: list_head of processed commands. */ void scsi_eh_flush_done_q(struct list_head *done_q)
{ struct scsi_cmnd *scmd, *next; list_for_each_entry_safe(scmd, next, done_q, eh_entry) { list_del_init(&scmd->eh_entry); if (scsi_device_online(scmd->device) && !scsi_noretry_cmd(scmd) && (++scmd->retries <= scmd->allowed)) { SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush" " retry cmd: %p\n", current->comm, scmd)); scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); } else { if (!scmd->result) scmd->result |= (DRIVER_TIMEOUT << 24); SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish" " cmd: %p\n", current->comm, scmd)); scsi_finish_command(scmd); } } }
robutest/uclinux
C++
GPL-2.0
60
/* To clear the timer without scheduling a timer event, set Time to a practically infinite value or mask the timer interrupt by clearing sie.STIE. */
VOID EFIAPI SbiSetTimer(IN UINT64 Time)
/* To clear the timer without scheduling a timer event, set Time to a practically infinite value or mask the timer interrupt by clearing sie.STIE. */ VOID EFIAPI SbiSetTimer(IN UINT64 Time)
{ SbiCall (SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, 1, Time); }
tianocore/edk2
C++
Other
4,240
/* matches two database records based on their MAC addresses and port IDs */
IX_ETH_DB_PUBLIC BOOL ixEthDBPortRecordMatch(void *untypedReference, void *untypedEntry)
/* matches two database records based on their MAC addresses and port IDs */ IX_ETH_DB_PUBLIC BOOL ixEthDBPortRecordMatch(void *untypedReference, void *untypedEntry)
{ MacDescriptor *entry = (MacDescriptor *) untypedEntry; MacDescriptor *reference = (MacDescriptor *) untypedReference; if ((entry->type & reference->type) == 0) return FALSE; return (entry->portID == reference->portID) && (ixEthDBAddressCompare(entry->macAddress, reference->macAddress) == 0); }
EmcraftSystems/u-boot
C++
Other
181
/* Return the status of I2C was initialized or not. */
static uint8_t cy8c4014lqi_Get_I2C_InitializedStatus(void)
/* Return the status of I2C was initialized or not. */ static uint8_t cy8c4014lqi_Get_I2C_InitializedStatus(void)
{ return(cy8c4014lqi_handle.i2cInitialized); }
eclipse-threadx/getting-started
C++
Other
310
/* by Richard Frowijn : first release. by Frank Denis : basic optimisations. by Frank Denis : qnx4_is_free, qnx4_set_bitmap, qnx4_bmap . by Frank Denis : qnx4_free_inode (to be fixed) . */
static void count_bits(register const char *bmPart, register int size, int *const tf)
/* by Richard Frowijn : first release. by Frank Denis : basic optimisations. by Frank Denis : qnx4_is_free, qnx4_set_bitmap, qnx4_bmap . by Frank Denis : qnx4_free_inode (to be fixed) . */ static void count_bits(register const char *bmPart, register int size, int *const tf)
{ char b; int tot = *tf; if (size > QNX4_BLOCK_SIZE) { size = QNX4_BLOCK_SIZE; } do { b = *bmPart++; tot += 8 - hweight8(b); size--; } while (size != 0); *tf = tot; }
robutest/uclinux
C++
GPL-2.0
60
/* Configure the internal OSC16M oscillator clock source. Configures the 16MHz (nominal) internal RC oscillator with the given configuration settings. */
void system_clock_source_osc16m_set_config(struct system_clock_source_osc16m_config *const config)
/* Configure the internal OSC16M oscillator clock source. Configures the 16MHz (nominal) internal RC oscillator with the given configuration settings. */ void system_clock_source_osc16m_set_config(struct system_clock_source_osc16m_config *const config)
{ OSCCTRL_OSC16MCTRL_Type temp = OSCCTRL->OSC16MCTRL; temp.bit.FSEL = config->fsel; temp.bit.ONDEMAND = config->on_demand; temp.bit.RUNSTDBY = config->run_in_standby; OSCCTRL->OSC16MCTRL = temp; }
memfault/zero-to-main
C++
null
200
/* FMC Prefetch Buffer status is set or not. */
uint8_t FMC_ReadPrefetchBufferStatus(void)
/* FMC Prefetch Buffer status is set or not. */ uint8_t FMC_ReadPrefetchBufferStatus(void)
{ return FMC->CTRL1_B.PBSF; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Remove and free all elements from a linked list. The list remain valid but become empty. */
void lv_ll_clear(lv_ll_t *ll_p)
/* Remove and free all elements from a linked list. The list remain valid but become empty. */ void lv_ll_clear(lv_ll_t *ll_p)
{ void * i; void * i_next; i = lv_ll_get_head(ll_p); i_next = NULL; while(i != NULL) { i_next = lv_ll_get_next(ll_p, i); lv_ll_rem(ll_p, i); lv_mem_free(i); i = i_next; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function returns the output voltage of the LDO when the device is in deep-sleep mode, as specified by the control register. */
uint32_t SysCtlLDODeepSleepGet(void)
/* This function returns the output voltage of the LDO when the device is in deep-sleep mode, as specified by the control register. */ uint32_t SysCtlLDODeepSleepGet(void)
{ return (HWREG(SYSCTL_LDODPCTL)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535