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
|
|---|---|---|---|---|---|---|---|
/* The enqueue_task method is called before nr_running is increased. Here we update the fair scheduling stats and then put the task into the rbtree: */
|
static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
|
/* The enqueue_task method is called before nr_running is increased. Here we update the fair scheduling stats and then put the task into the rbtree: */
static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
|
{
struct cfs_rq *cfs_rq;
struct sched_entity *se = &p->se;
int flags = 0;
if (wakeup)
flags |= ENQUEUE_WAKEUP;
if (p->state == TASK_WAKING)
flags |= ENQUEUE_MIGRATE;
for_each_sched_entity(se) {
if (se->on_rq)
break;
cfs_rq = cfs_rq_of(se);
enqueue_entity(cfs_rq, se, flags);
flags = ENQUEUE_WAKEUP;
}
hrtick_update(rq);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Function for calculating storage offset for receiving SoftDevice image.
When a new SoftDevice is received it will be temporary stored in flash before moved to address 0x0. In order to succesfully validate transfer and relocation it is important that temporary image and final installed image does not ovwerlap hence an offset must be calculated in case new image is larger than currently installed SoftDevice. */
|
uint32_t offset_calculate(uint32_t sd_image_size)
|
/* Function for calculating storage offset for receiving SoftDevice image.
When a new SoftDevice is received it will be temporary stored in flash before moved to address 0x0. In order to succesfully validate transfer and relocation it is important that temporary image and final installed image does not ovwerlap hence an offset must be calculated in case new image is larger than currently installed SoftDevice. */
uint32_t offset_calculate(uint32_t sd_image_size)
|
{
uint32_t offset = 0;
if (m_start_packet.sd_image_size > DFU_BANK_0_REGION_START)
{
uint32_t page_mask = (CODE_PAGE_SIZE - 1);
uint32_t diff = m_start_packet.sd_image_size - DFU_BANK_0_REGION_START;
offset = diff & ~page_mask;
if ((diff & page_mask) > 0)
{
offset += CODE_PAGE_SIZE;
}
}
return offset;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Get the SPI interrupt flag of the specified SPI port. */
|
xtBoolean SPIIntFlagGet(unsigned long ulBase, unsigned long ulIntFlags)
|
/* Get the SPI interrupt flag of the specified SPI port. */
xtBoolean SPIIntFlagGet(unsigned long ulBase, unsigned long ulIntFlags)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
return ((xHWREG(ulBase + SPI_STATUS) & ulIntFlags) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Invalidate current channel, i.e., set "dump in progress" flag. Reading from the "dump" special file blocks until dump is completed. */
|
void line6_invalidate_current(struct line6_dump_request *l6dr)
|
/* Invalidate current channel, i.e., set "dump in progress" flag. Reading from the "dump" special file blocks until dump is completed. */
void line6_invalidate_current(struct line6_dump_request *l6dr)
|
{
line6_dump_started(l6dr, LINE6_DUMP_CURRENT);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented. */
|
EFI_STATUS EFIAPI VariableCleanupHiiRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
|
/* This function applies changes in a driver's configuration. Input is a Configuration, which has the routing data for this driver followed by name / value configuration pairs. The driver must apply those pairs to its configurable storage. If the driver's configuration is stored in a linear block of data and the driver's name / value pairs are in <BlockConfig> format, it may use the ConfigToBlock helper function (above) to simplify the job. Currently not implemented. */
EFI_STATUS EFIAPI VariableCleanupHiiRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
|
{
EFI_STATUS Status;
VARIABLE_CLEANUP_HII_PRIVATE_DATA *Private;
UINTN BufferSize;
if (Progress == NULL) {
return EFI_INVALID_PARAMETER;
}
*Progress = Configuration;
if (Configuration == NULL) {
return EFI_INVALID_PARAMETER;
}
if (!HiiIsConfigHdrMatch (Configuration, &mVariableCleanupHiiGuid, mVarStoreName)) {
return EFI_NOT_FOUND;
}
Private = VARIABLE_CLEANUP_HII_PRIVATE_FROM_THIS (This);
BufferSize = sizeof (VARIABLE_CLEANUP_DATA);
Status = Private->ConfigRouting->ConfigToBlock (
Private->ConfigRouting,
Configuration,
(UINT8 *)&Private->VariableCleanupData,
&BufferSize,
Progress
);
ASSERT_EFI_ERROR (Status);
DeleteUserVariable (FALSE, &Private->VariableCleanupData);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Wait for main PLL to lock.
Waits until the LOCK bit in SYSCTL_PLLSTAT is set. This guarantees that the PLL is locked, and ready to use. */
|
void rcc_wait_for_pll_ready(void)
|
/* Wait for main PLL to lock.
Waits until the LOCK bit in SYSCTL_PLLSTAT is set. This guarantees that the PLL is locked, and ready to use. */
void rcc_wait_for_pll_ready(void)
|
{
while (!(SYSCTL_PLLSTAT & SYSCTL_PLLSTAT_LOCK));
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Description: Returns the nodemask_t mems_allowed of the cpuset attached to the specified @tsk. Guaranteed to return some non-empty subset of node_states, even if this means going outside the tasks cpuset. */
|
nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
|
/* Description: Returns the nodemask_t mems_allowed of the cpuset attached to the specified @tsk. Guaranteed to return some non-empty subset of node_states, even if this means going outside the tasks cpuset. */
nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
|
{
nodemask_t mask;
mutex_lock(&callback_mutex);
task_lock(tsk);
guarantee_online_mems(task_cs(tsk), &mask);
task_unlock(tsk);
mutex_unlock(&callback_mutex);
return mask;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Generally the counter will reset across mode sets. If interrupts are enabled around this call, we don't have to do anything since the counter will have already been incremented. */
|
int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
/* Generally the counter will reset across mode sets. If interrupts are enabled around this call, we don't have to do anything since the counter will have already been incremented. */
int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
{
struct drm_modeset_ctl *modeset = data;
int crtc, ret = 0;
if (!dev->num_crtcs)
goto out;
crtc = modeset->crtc;
if (crtc >= dev->num_crtcs) {
ret = -EINVAL;
goto out;
}
switch (modeset->cmd) {
case _DRM_PRE_MODESET:
drm_vblank_pre_modeset(dev, crtc);
break;
case _DRM_POST_MODESET:
drm_vblank_post_modeset(dev, crtc);
break;
default:
ret = -EINVAL;
break;
}
out:
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read an (unaligned) value of length 1..4 bytes */
|
static unsigned int adfs_readval(unsigned char *p, int len)
|
/* Read an (unaligned) value of length 1..4 bytes */
static unsigned int adfs_readval(unsigned char *p, int len)
|
{
unsigned int val = 0;
switch (len) {
case 4: val |= p[3] << 24;
case 3: val |= p[2] << 16;
case 2: val |= p[1] << 8;
default: val |= p[0];
}
return val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disables the Hibernation module for operation. After this function is called, none of the Hibernation module features are available. */
|
void HibernateDisable(void)
|
/* Disables the Hibernation module for operation. After this function is called, none of the Hibernation module features are available. */
void HibernateDisable(void)
|
{
HWREG(HIB_CTL) &= ~HIB_CTL_CLK32EN;
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* This method returns the STM32L475E IOT01 BSP Driver revision. */
|
uint32_t BSP_GetVersion(void)
|
/* This method returns the STM32L475E IOT01 BSP Driver revision. */
uint32_t BSP_GetVersion(void)
|
{
return __STM32L475E_IOT01_BSP_VERSION;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Returns: TRUE if the strings are the same length and contain the same bytes */
|
gboolean g_string_equal(const GString *v, const GString *v2)
|
/* Returns: TRUE if the strings are the same length and contain the same bytes */
gboolean g_string_equal(const GString *v, const GString *v2)
|
{
gchar *p, *q;
GString *string1 = (GString *) v;
GString *string2 = (GString *) v2;
gsize i = string1->len;
if (i != string2->len)
return FALSE;
p = string1->str;
q = string2->str;
while (i)
{
if (*p != *q)
return FALSE;
p++;
q++;
i--;
}
return TRUE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Process all pending events from the internal queue.
This function processes all pending events from the internal queue. In order for the window system to work properly, this function should be called as often as possible, to process new events. In this implementation, whenever a new event is added to the queue, the system automatically adds a work item to the main application work queue. This work item refers to win_event_worker() which in turn will call this function to process all pending events. */
|
void win_process_events(void)
|
/* Process all pending events from the internal queue.
This function processes all pending events from the internal queue. In order for the window system to work properly, this function should be called as often as possible, to process new events. In this implementation, whenever a new event is added to the queue, the system automatically adds a work item to the main application work queue. This work item refers to win_event_worker() which in turn will call this function to process all pending events. */
void win_process_events(void)
|
{
while (win_are_events_pending()) {
struct win_event *event = win_event_queue.front;
switch (event->type) {
case WIN_EVENT_POINTER:
win_process_pointer_event(&event->pointer);
break;
case WIN_EVENT_KEYBOARD:
win_process_keyboard_event(&event->keyboard);
break;
case WIN_EVENT_COMMAND:
win_process_command_event(&event->command);
break;
default:
Assert(event->type);
break;
}
win_pop_front_event();
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */
|
EFI_STATUS EFIAPI DnsComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */
EFI_STATUS EFIAPI DnsComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mDnsDriverNameTable,
DriverName,
(BOOLEAN)(This == &gDnsComponentName)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT32 EFIAPI S3MmioRead32(IN UINTN Address)
|
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI S3MmioRead32(IN UINTN Address)
|
{
return InternalSaveMmioWrite32ValueToBootScript (Address, MmioRead32 (Address));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Swap MSR entry in host/guest MSR entry array. */
|
static void move_msr_up(struct vcpu_vmx *vmx, int from, int to)
|
/* Swap MSR entry in host/guest MSR entry array. */
static void move_msr_up(struct vcpu_vmx *vmx, int from, int to)
|
{
struct shared_msr_entry tmp;
tmp = vmx->guest_msrs[to];
vmx->guest_msrs[to] = vmx->guest_msrs[from];
vmx->guest_msrs[from] = tmp;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* hmac_md5 - HMAC-MD5 over data buffer (RFC 2104) @key: Key for HMAC operations @key_len: Length of the key in bytes @data: Pointers to the data area @data_len: Length of the data area @mac: Buffer for the hash (16 bytes) Returns: 0 on success, -1 on failure */
|
int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, u8 *mac)
|
/* hmac_md5 - HMAC-MD5 over data buffer (RFC 2104) @key: Key for HMAC operations @key_len: Length of the key in bytes @data: Pointers to the data area @data_len: Length of the data area @mac: Buffer for the hash (16 bytes) Returns: 0 on success, -1 on failure */
int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, u8 *mac)
|
{
return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Some of this is x86 specific, and the rest of it is generic. Right now, since we only support x86, we'll avoid trying to make lots of infrastructure we don't need. If in the future, we want to use coreboot on some other architecture, then take out the generic parsing code and move it elsewhere. */
|
static void cb_parse_memory(unsigned char *ptr, struct sysinfo_t *info)
|
/* Some of this is x86 specific, and the rest of it is generic. Right now, since we only support x86, we'll avoid trying to make lots of infrastructure we don't need. If in the future, we want to use coreboot on some other architecture, then take out the generic parsing code and move it elsewhere. */
static void cb_parse_memory(unsigned char *ptr, struct sysinfo_t *info)
|
{
struct cb_memory *mem = (struct cb_memory *)ptr;
int count = MEM_RANGE_COUNT(mem);
int i;
if (count > SYSINFO_MAX_MEM_RANGES)
count = SYSINFO_MAX_MEM_RANGES;
info->n_memranges = 0;
for (i = 0; i < count; i++) {
struct cb_memory_range *range =
(struct cb_memory_range *)MEM_RANGE_PTR(mem, i);
info->memrange[info->n_memranges].base =
UNPACK_CB64(range->start);
info->memrange[info->n_memranges].size =
UNPACK_CB64(range->size);
info->memrange[info->n_memranges].type = range->type;
info->n_memranges++;
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Message: CallHistoryInfoMessage Opcode: 0x0156 Type: CallControl Direction: pbx2dev VarLength: no */
|
static void handle_CallHistoryInfoMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: CallHistoryInfoMessage Opcode: 0x0156 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_CallHistoryInfoMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_callHistoryDisposition, 4, ENC_LITTLE_ENDIAN);
si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Frees the iommu virtually contiguous memory area starting at @da, which was passed to and was returned by'iommu_kmap()'. */
|
void iommu_kunmap(struct iommu *obj, u32 da)
|
/* Frees the iommu virtually contiguous memory area starting at @da, which was passed to and was returned by'iommu_kmap()'. */
void iommu_kunmap(struct iommu *obj, u32 da)
|
{
struct sg_table *sgt;
typedef void (*func_t)(const void *);
sgt = unmap_vm_area(obj, da, (func_t)__iounmap,
IOVMF_LINEAR | IOVMF_MMIO);
if (!sgt)
dev_dbg(obj->dev, "%s: No sgt\n", __func__);
sgtable_free(sgt);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If any reserved bits in Address are set, then ASSERT(). */
|
UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
|
/* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
|
{
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* disable the oscillator bypass mode, HXTALEN or LXTALEN must be reset before it */
|
void rcu_osci_bypass_mode_disable(rcu_osci_type_enum osci)
|
/* disable the oscillator bypass mode, HXTALEN or LXTALEN must be reset before it */
void rcu_osci_bypass_mode_disable(rcu_osci_type_enum osci)
|
{
uint32_t reg;
switch(osci){
case RCU_HXTAL:
reg = RCU_CTL;
RCU_CTL &= ~RCU_CTL_HXTALEN;
RCU_CTL = (reg & ~RCU_CTL_HXTALBPS);
break;
case RCU_LXTAL:
reg = RCU_BDCTL;
RCU_BDCTL &= ~RCU_BDCTL_LXTALEN;
RCU_BDCTL = (reg & ~RCU_BDCTL_LXTALBPS);
break;
case RCU_IRC8M:
case RCU_IRC40K:
case RCU_PLL_CK:
case RCU_PLL1_CK:
case RCU_PLL2_CK:
break;
default:
break;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* These allocate and release file read/write context information. */
|
int nfs_open(struct inode *inode, struct file *filp)
|
/* These allocate and release file read/write context information. */
int nfs_open(struct inode *inode, struct file *filp)
|
{
struct nfs_open_context *ctx;
struct rpc_cred *cred;
cred = rpc_lookup_cred();
if (IS_ERR(cred))
return PTR_ERR(cred);
ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred);
put_rpccred(cred);
if (ctx == NULL)
return -ENOMEM;
ctx->mode = filp->f_mode;
nfs_file_set_open_context(filp, ctx);
put_nfs_open_context(ctx);
nfs_fscache_set_inode_cookie(inode, filp);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base SNVS peripheral base address param datetime Pointer to the structure where the date and time details are stored. */
|
void SNVS_LP_SRTC_GetDatetime(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
|
/* param base SNVS peripheral base address param datetime Pointer to the structure where the date and time details are stored. */
void SNVS_LP_SRTC_GetDatetime(SNVS_Type *base, snvs_lp_srtc_datetime_t *datetime)
|
{
assert(datetime);
SNVS_LP_ConvertSecondsToDatetime(SNVS_LP_SRTC_GetSeconds(base), datetime);
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Write the value to output the stream as a sequence of characters, while escaping those which have special meaning in the XML attribute's value context: & and ". */
|
static void _cairo_svg_surface_emit_attr_value(cairo_output_stream_t *stream, const unsigned char *value, unsigned int length)
|
/* Write the value to output the stream as a sequence of characters, while escaping those which have special meaning in the XML attribute's value context: & and ". */
static void _cairo_svg_surface_emit_attr_value(cairo_output_stream_t *stream, const unsigned char *value, unsigned int length)
|
{
const unsigned char *p;
const unsigned char *q;
unsigned int i;
p = value;
q = p;
for (i = 0; i < length; i++, p++) {
if (*p == '&' || *p == '"') {
if (p != q) {
_cairo_output_stream_write (stream, q, p - q);
q = p + 1;
}
if (*p == '&')
_cairo_output_stream_printf (stream, "&");
else
_cairo_output_stream_printf (stream, """);
}
}
if (p != q)
_cairo_output_stream_write (stream, q, p - q);
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* This function is used to enable the Timer frequency counter function. */
|
void TIMER_EnableFreqCounter(TIMER_T *timer, uint32_t u32DropCount, uint32_t u32Timeout, uint32_t u32EnableInt)
|
/* This function is used to enable the Timer frequency counter function. */
void TIMER_EnableFreqCounter(TIMER_T *timer, uint32_t u32DropCount, uint32_t u32Timeout, uint32_t u32EnableInt)
|
{
TIMER_T *t = NULL;
if (timer == TIMER0)
t = TIMER1;
else if (timer == TIMER2)
t = TIMER3;
else if (timer == TIMER4)
t = TIMER5;
else if (timer == TIMER6)
t = TIMER7;
else if (timer == TIMER8)
t = TIMER9;
else if (timer == TIMER10)
t = TIMER11;
else
return;
t->CMP = 0xFFFFFFUL;
t->EXTCTL = u32EnableInt ? TIMER_EXTCTL_CAPIEN_Msk : 0UL;
timer->CTL = TIMER_CTL_INTRGEN_Msk | TIMER_CTL_CNTEN_Msk;
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Gets a reference to the ide_drive_t and increments the use count of the underlying LLDD module. */
|
int ide_device_get(ide_drive_t *drive)
|
/* Gets a reference to the ide_drive_t and increments the use count of the underlying LLDD module. */
int ide_device_get(ide_drive_t *drive)
|
{
struct device *host_dev;
struct module *module;
if (!get_device(&drive->gendev))
return -ENXIO;
host_dev = drive->hwif->host->dev[0];
module = host_dev ? host_dev->driver->owner : NULL;
if (module && !try_module_get(module)) {
put_device(&drive->gendev);
return -ENXIO;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The ValidBitmap area represents the areas of the GHCB that have been marked valid. Set the bit in ValidBitmap for the input offset. */
|
VOID EFIAPI CcExitVmgSetOffsetValid(IN OUT GHCB *Ghcb, IN GHCB_REGISTER Offset)
|
/* The ValidBitmap area represents the areas of the GHCB that have been marked valid. Set the bit in ValidBitmap for the input offset. */
VOID EFIAPI CcExitVmgSetOffsetValid(IN OUT GHCB *Ghcb, IN GHCB_REGISTER Offset)
|
{
UINT32 OffsetIndex;
UINT32 OffsetBit;
OffsetIndex = Offset / 8;
OffsetBit = Offset % 8;
Ghcb->SaveArea.ValidBitmap[OffsetIndex] |= (1 << OffsetBit);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. param callback FlexIO I2S callback function, which is called while finished a block. param userData User parameter for the FlexIO I2S callback. */
|
void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)
|
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. param callback FlexIO I2S callback function, which is called while finished a block. param userData User parameter for the FlexIO I2S callback. */
void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)
|
{
assert(handle);
IRQn_Type flexio_irqs[] = FLEXIO_IRQS;
memset(handle, 0, sizeof(*handle));
handle->callback = callback;
handle->userData = userData;
FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_I2S_TransferRxHandleIRQ);
handle->state = kFLEXIO_I2S_Idle;
EnableIRQ(flexio_irqs[FLEXIO_I2S_GetInstance(base)]);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function serves as the default handler for the sli4 unsolicited abort event. It shall be invoked when there is no application interface registered unsolicited abort handler. This handler does nothing but just simply releases the dma buffer used by the unsol abort event. */
|
void lpfc_sli4_ct_abort_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocbq)
|
/* This function serves as the default handler for the sli4 unsolicited abort event. It shall be invoked when there is no application interface registered unsolicited abort handler. This handler does nothing but just simply releases the dma buffer used by the unsol abort event. */
void lpfc_sli4_ct_abort_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocbq)
|
{
IOCB_t *icmd = &piocbq->iocb;
struct lpfc_dmabuf *bdeBuf;
uint32_t size;
lpfc_bsg_ct_unsol_event(phba, pring, piocbq);
if (icmd->ulpBdeCount == 0)
return;
bdeBuf = piocbq->context2;
piocbq->context2 = NULL;
size = icmd->un.cont64[0].tus.f.bdeSize;
lpfc_ct_unsol_buffer(phba, piocbq, bdeBuf, size);
lpfc_in_buf_free(phba, bdeBuf);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return 0 on success, -1 if the discard mode was invalid. */
|
int bdrv_parse_discard_flags(const char *mode, int *flags)
|
/* Return 0 on success, -1 if the discard mode was invalid. */
int bdrv_parse_discard_flags(const char *mode, int *flags)
|
{
*flags &= ~BDRV_O_UNMAP;
if (!strcmp(mode, "off") || !strcmp(mode, "ignore")) {
} else if (!strcmp(mode, "on") || !strcmp(mode, "unmap")) {
*flags |= BDRV_O_UNMAP;
} else {
return -1;
}
return 0;
}
|
ve3wwg/teensy3_qemu
|
C
|
Other
| 15
|
/* Simple comparison function used to sort backlight levels. */
|
static int acpi_video_cmp_level(const void *a, const void *b)
|
/* Simple comparison function used to sort backlight levels. */
static int acpi_video_cmp_level(const void *a, const void *b)
|
{
return *(int *)a - *(int *)b;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Allocate a root ("/") dentry for the inode given. The inode is instantiated and returned. NULL is returned if there is insufficient memory or the inode passed is NULL. */
|
struct dentry* d_alloc_root(struct inode *root_inode)
|
/* Allocate a root ("/") dentry for the inode given. The inode is instantiated and returned. NULL is returned if there is insufficient memory or the inode passed is NULL. */
struct dentry* d_alloc_root(struct inode *root_inode)
|
{
struct dentry *res = NULL;
if (root_inode) {
static const struct qstr name = { .name = "/", .len = 1 };
res = d_alloc(NULL, &name);
if (res) {
res->d_sb = root_inode->i_sb;
res->d_parent = res;
d_instantiate(res, root_inode);
}
}
return res;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Wake up duration event.1LSb = 1 / ODR. */
|
int32_t lsm6dsl_wkup_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
|
/* Wake up duration event.1LSb = 1 / ODR. */
int32_t lsm6dsl_wkup_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
|
{
lsm6dsl_wake_up_dur_t wake_up_dur;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_WAKE_UP_DUR, (uint8_t*)&wake_up_dur, 1);
*val = wake_up_dur.wake_dur;
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* untrack_pfn_vma is called while unmapping a pfnmap for a region. untrack can be called for a specific region indicated by pfn and size or can be for the entire vma (in which case size can be zero). */
|
void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, unsigned long size)
|
/* untrack_pfn_vma is called while unmapping a pfnmap for a region. untrack can be called for a specific region indicated by pfn and size or can be for the entire vma (in which case size can be zero). */
void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, unsigned long size)
|
{
resource_size_t paddr;
unsigned long vma_size = vma->vm_end - vma->vm_start;
if (is_linear_pfn_mapping(vma)) {
paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
free_pfn_range(paddr, vma_size);
return;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* NOTICE: PCI2 is not supported. There is only one physical PCI slot on the board. */
|
void pci_init_board(void)
|
/* NOTICE: PCI2 is not supported. There is only one physical PCI slot on the board. */
void pci_init_board(void)
|
{
volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
struct pci_region *reg[] = { pci1_regions };
clk->occr = 0xff000000;
udelay(2000);
pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
udelay(2000);
mpc83xx_pci_init(1, reg, 0);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Configures the SSI advanced mode to hold the SSIFss signal during the full transfer. */
|
void SSIAdvFrameHoldEnable(uint32_t ui32Base)
|
/* Configures the SSI advanced mode to hold the SSIFss signal during the full transfer. */
void SSIAdvFrameHoldEnable(uint32_t ui32Base)
|
{
ASSERT(_SSIBaseValid(ui32Base));
HWREG(ui32Base + SSI_O_CR1) |= SSI_CR1_FSSHLDFRM;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FTYPE in CTRL6_C (15h).. */
|
int32_t lsm6dso_gy_filter_lp1_set(stmdev_ctx_t *ctx, uint8_t val)
|
/* Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FTYPE in CTRL6_C (15h).. */
int32_t lsm6dso_gy_filter_lp1_set(stmdev_ctx_t *ctx, uint8_t val)
|
{
lsm6dso_ctrl4_c_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL4_C, (uint8_t *)®, 1);
if (ret == 0) {
reg.lpf1_sel_g = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL4_C, (uint8_t *)®, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Selects the clock source to output on MCO pin. */
|
void CLK_MCOConfig(uint8_t u8Ch, uint8_t u8Src, uint8_t u8Div)
|
/* Selects the clock source to output on MCO pin. */
void CLK_MCOConfig(uint8_t u8Ch, uint8_t u8Src, uint8_t u8Div)
|
{
__IO uint8_t *MCOCFGRx;
DDL_ASSERT(IS_CLK_MCO_SRC(u8Src));
DDL_ASSERT(IS_CLK_MCO_DIV(u8Div));
DDL_ASSERT(IS_CLK_MCO_CH(u8Ch));
DDL_ASSERT(IS_CLK_UNLOCKED());
MCOCFGRx = &(*(__IO uint8_t *)((uint32_t)&CM_CMU->MCO1CFGR + u8Ch));
MODIFY_REG8(*MCOCFGRx, (CMU_MCOCFGR_MCOSEL | CMU_MCOCFGR_MCODIV), (u8Src | u8Div));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function parses all dissectors associated with a table to find the one whose protocol has the specified filter name. It is called as a reference function in a call to dissector_table_foreach_handle. The name we are looking for, as well as the results, are stored in the */
|
static void find_protocol_name_func(const gchar *table _U_, gpointer handle, gpointer user_data)
|
/* This function parses all dissectors associated with a table to find the one whose protocol has the specified filter name. It is called as a reference function in a call to dissector_table_foreach_handle. The name we are looking for, as well as the results, are stored in the */
static void find_protocol_name_func(const gchar *table _U_, gpointer handle, gpointer user_data)
|
{
int proto_id;
const gchar *protocol_filter_name;
protocol_name_search_t search_info;
g_assert(handle);
search_info = (protocol_name_search_t)user_data;
proto_id = dissector_handle_get_protocol_index((dissector_handle_t)handle);
if (proto_id != -1) {
protocol_filter_name = proto_get_protocol_filter_name(proto_id);
g_assert(protocol_filter_name != NULL);
if (strcmp(protocol_filter_name, search_info->searched_name) == 0) {
if (search_info->nb_match == 0) {
search_info->matched_handle = (dissector_handle_t)handle;
}
search_info->nb_match++;
}
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Disable the voltage comparator.
This function powers down the voltage comparator. */
|
void am_hal_vcomp_disable(void)
|
/* Disable the voltage comparator.
This function powers down the voltage comparator. */
void am_hal_vcomp_disable(void)
|
{
AM_REG(VCOMP, PWDKEY) = AM_REG_VCOMP_PWDKEY_KEYVAL;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* skip_space - find first non-whitespace in given pointer */
|
static char* skip_space(char *buf)
|
/* skip_space - find first non-whitespace in given pointer */
static char* skip_space(char *buf)
|
{
while (isblank(buf[0]))
++buf;
return buf;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Patch by Polystar (Peter Vestman, Petter Edblom): Corrected rfci handling in rate control messages Added crc6 and crc10 checks for header and payload */
|
void proto_reg_handoff_iuup(void)
|
/* Patch by Polystar (Peter Vestman, Petter Edblom): Corrected rfci handling in rate control messages Added crc6 and crc10 checks for header and payload */
void proto_reg_handoff_iuup(void)
|
{
iuup_handle = find_dissector("iuup");
dissector_add_string("rtp_dyn_payload_type","VND.3GPP.IUFP", iuup_handle);
iuup_prefs_initialized = TRUE;
} else {
if ( saved_dynamic_payload_type > 95 ) {
dissector_delete_uint("rtp.pt", saved_dynamic_payload_type, iuup_handle);
}
}
saved_dynamic_payload_type = global_dynamic_payload_type;
if ( global_dynamic_payload_type > 95 ) {
dissector_add_uint("rtp.pt", global_dynamic_payload_type, iuup_handle);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Reads/writes to various problem and priv2 registers require state changes, i.e. generate SPU events, modify channel counts, etc. */
|
static void gen_spu_event(struct spu_context *ctx, u32 event)
|
/* Reads/writes to various problem and priv2 registers require state changes, i.e. generate SPU events, modify channel counts, etc. */
static void gen_spu_event(struct spu_context *ctx, u32 event)
|
{
u64 ch0_cnt;
u64 ch0_data;
u64 ch1_data;
ch0_cnt = ctx->csa.spu_chnlcnt_RW[0];
ch0_data = ctx->csa.spu_chnldata_RW[0];
ch1_data = ctx->csa.spu_chnldata_RW[1];
ctx->csa.spu_chnldata_RW[0] |= event;
if ((ch0_cnt == 0) && !(ch0_data & event) && (ch1_data & event)) {
ctx->csa.spu_chnlcnt_RW[0] = 1;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Retrieve the value of one of the IDT77105's counters. */
|
static u16 get_counter(struct atm_dev *dev, int counter)
|
/* Retrieve the value of one of the IDT77105's counters. */
static u16 get_counter(struct atm_dev *dev, int counter)
|
{
u16 val;
PUT(counter, CTRSEL);
val = GET(CTRLO);
val |= GET(CTRHI)<<8;
return val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read number of consecutive blocks with null DC or AC. This value is < 74. */
|
static unsigned vp6_get_nb_null(VP56Context *s)
|
/* Read number of consecutive blocks with null DC or AC. This value is < 74. */
static unsigned vp6_get_nb_null(VP56Context *s)
|
{
unsigned val = get_bits(&s->gb, 2);
if (val == 2)
val += get_bits(&s->gb, 2);
else if (val == 3) {
val = get_bits1(&s->gb) << 2;
val = 6+val + get_bits(&s->gb, 2+val);
}
return val;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Function to read the GMAC IP Version and populates the same in device data structure. */
|
s32 synopGMAC_read_version(synopGMACdevice *gmacdev)
|
/* Function to read the GMAC IP Version and populates the same in device data structure. */
s32 synopGMAC_read_version(synopGMACdevice *gmacdev)
|
{
u32 data = 0;
data = synopGMACReadReg(gmacdev->MacBase, GmacVersion);
gmacdev->Version = data;
TR("The data read from %08x is %08x\n", (gmacdev->MacBase + GmacVersion), data);
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Function for checking if data in an iOS notification is out of bounds. */
|
static uint32_t ble_ancs_verify_notification_format(const ble_ancs_c_evt_notif_t *notif)
|
/* Function for checking if data in an iOS notification is out of bounds. */
static uint32_t ble_ancs_verify_notification_format(const ble_ancs_c_evt_notif_t *notif)
|
{
if( (notif->evt_id >= BLE_ANCS_NB_OF_EVT_ID)
|| (notif->category_id >= BLE_ANCS_NB_OF_CATEGORY_ID))
{
return NRF_ERROR_INVALID_PARAM;
}
return NRF_SUCCESS;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* If packet has no security mark, and the connection does, restore the security mark from the connection to the packet. */
|
static void secmark_restore(struct sk_buff *skb)
|
/* If packet has no security mark, and the connection does, restore the security mark from the connection to the packet. */
static void secmark_restore(struct sk_buff *skb)
|
{
if (!skb->secmark) {
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
ct = nf_ct_get(skb, &ctinfo);
if (ct && ct->secmark)
skb->secmark = ct->secmark;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Initialize the boards on-board LEDs (LD3 and LD4)
The LEDs are connected to the following pins: */
|
void leds_init(void)
|
/* Initialize the boards on-board LEDs (LD3 and LD4)
The LEDs are connected to the following pins: */
void leds_init(void)
|
{
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
LED_PORT->OSPEEDR |= 0x000f0000;
LED_PORT->OTYPER &= ~(0x00000300);
LED_PORT->MODER &= ~(0x000f0000);
LED_PORT->MODER |= 0x00050000;
LED_PORT->PUPDR &= ~(0x000f0000);
LED_PORT->BRR = 0x0300;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Open a TCP socket from the lwip thread. */
|
static void tcp_open_cb(void *ctx_p)
|
/* Open a TCP socket from the lwip thread. */
static void tcp_open_cb(void *ctx_p)
|
{
struct socket_t *socket_p = ctx_p;
void *pcb_p;
pcb_p = tcp_new();
tcp_arg(pcb_p, socket_p);
tcp_recv(pcb_p, on_tcp_recv);
tcp_sent(pcb_p, on_tcp_sent);
tcp_err(pcb_p, on_tcp_err);
init(socket_p, SOCKET_TYPE_STREAM, pcb_p);
resume_thrd(socket_p->input.cb.thrd_p, 0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Returns the number of scatterlist structs in array used */
|
int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, int sg_size)
|
/* Returns the number of scatterlist structs in array used */
int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg, int sg_size)
|
{
int i = 0;
struct page *pg;
int offset;
int remainder_of_page;
sg_init_table(sg, sg_size);
while (size > 0 && i < sg_size) {
pg = virt_to_page(addr);
offset = offset_in_page(addr);
if (sg)
sg_set_page(&sg[i], pg, 0, offset);
remainder_of_page = PAGE_CACHE_SIZE - offset;
if (size >= remainder_of_page) {
if (sg)
sg[i].length = remainder_of_page;
addr += remainder_of_page;
size -= remainder_of_page;
} else {
if (sg)
sg[i].length = size;
addr += size;
size = 0;
}
i++;
}
if (size > 0)
return -ENOMEM;
return i;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts a ZigBee 2003 & earlier cluster ID to a 2006 */
|
static guint16 zdp_convert_2003cluster(guint8 cluster)
|
/* Converts a ZigBee 2003 & earlier cluster ID to a 2006 */
static guint16 zdp_convert_2003cluster(guint8 cluster)
|
{
guint16 cluster16 = (guint16)cluster;
if (cluster16 & ZBEE_ZDP_MSG_RESPONSE_BIT_2003) {
cluster16 &= ~(ZBEE_ZDP_MSG_RESPONSE_BIT_2003);
cluster16 |= (ZBEE_ZDP_MSG_RESPONSE_BIT);
}
return cluster16;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Calculates raw SHA1 hash of input string. Input is arbitrary string, output is raw 20-byte hash as string. */
|
static int crypto_sha1(lua_State *L)
|
/* Calculates raw SHA1 hash of input string. Input is arbitrary string, output is raw 20-byte hash as string. */
static int crypto_sha1(lua_State *L)
|
{
SHA1_CTX ctx;
uint8_t digest[20];
int len;
const char* msg = luaL_checklstring(L, 1, &len);
SHA1Init(&ctx);
SHA1Update(&ctx, msg, len);
SHA1Final(digest, &ctx);
lua_pushlstring(L, digest, 20);
return 1;
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* Enables or disables access to the RTC and backup registers. */
|
void PWR_BackupAccessCmd(FunctionalState NewState)
|
/* Enables or disables access to the RTC and backup registers. */
void PWR_BackupAccessCmd(FunctionalState NewState)
|
{
assert_param(IS_FUNCTIONAL_STATE(NewState));
*(__IO uint32_t *) CR_DBP_BB = (uint32_t)NewState;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* XDR an indirect pointer xdr_reference is for recursively translating a structure that is referenced by a pointer inside the structure that is currently being translated. pp references a pointer to storage. If *pp is null the necessary storage is allocated. size is the sizeof the referneced structure. proc is the routine to handle the referenced structure. */
|
bool_t xdr_reference(XDR *xdrs, char **pp, unsigned int size, xdrproc_t proc)
|
/* XDR an indirect pointer xdr_reference is for recursively translating a structure that is referenced by a pointer inside the structure that is currently being translated. pp references a pointer to storage. If *pp is null the necessary storage is allocated. size is the sizeof the referneced structure. proc is the routine to handle the referenced structure. */
bool_t xdr_reference(XDR *xdrs, char **pp, unsigned int size, xdrproc_t proc)
|
{
register char* loc = *pp;
register bool_t stat;
if (loc == NULL)
switch (xdrs->x_op) {
case XDR_FREE:
return (TRUE);
case XDR_DECODE:
*pp = loc = (char*) rt_malloc(size);
if (loc == NULL) {
rt_kprintf("xdr_reference: out of memory\n");
return (FALSE);
}
memset(loc, 0, (int) size);
break;
}
stat = (*proc) (xdrs, loc, LASTUNSIGNED);
if (xdrs->x_op == XDR_FREE) {
rt_free(loc);
*pp = NULL;
}
return (stat);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Returns CR_OK upon sucessful completion, an error code otherwise. */
|
enum CRStatus cr_font_family_set_name(CRFontFamily *a_this, guchar *a_name)
|
/* Returns CR_OK upon sucessful completion, an error code otherwise. */
enum CRStatus cr_font_family_set_name(CRFontFamily *a_this, guchar *a_name)
|
{
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
if (a_this->type != FONT_FAMILY_NON_GENERIC) {
return CR_BAD_PARAM_ERROR;
}
if (a_this->name) {
g_free (a_this->name);
a_this->name = NULL;
}
a_this->name = a_name;
return CR_OK;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function initializes the memory map. It is called during the system startup to create static physical to virtual memory map for the IO modules. */
|
void __init mxc91231_map_io(void)
|
/* This function initializes the memory map. It is called during the system startup to create static physical to virtual memory map for the IO modules. */
void __init mxc91231_map_io(void)
|
{
mxc_set_cpu_type(MXC_CPU_MXC91231);
iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function removes the system exception interrupt handler from the vector table in SRAM. This function also masks off the system exception interrupt in the interrupt controller so that the interrupt handler is no longer called. */
|
void SysExcIntUnregister(void)
|
/* This function removes the system exception interrupt handler from the vector table in SRAM. This function also masks off the system exception interrupt in the interrupt controller so that the interrupt handler is no longer called. */
void SysExcIntUnregister(void)
|
{
uint32_t ui32Int;
ui32Int = _SysExcIntNumberGet();
ASSERT(ui32Int != 0);
IntDisable(ui32Int);
IntUnregister(ui32Int);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Timestamp binary rollover When set the timestamp low register rolls over after 0x7FFF_FFFF value. */
|
void synopGMAC_TS_binary_rollover_enable(synopGMACdevice *gmacdev)
|
/* Timestamp binary rollover When set the timestamp low register rolls over after 0x7FFF_FFFF value. */
void synopGMAC_TS_binary_rollover_enable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSCTRLSSR);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read-ahead the block, don't wait for it, don't return a buffer. Short-form addressing. */
|
void xfs_btree_reada_bufs(xfs_mount_t *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t count)
|
/* Read-ahead the block, don't wait for it, don't return a buffer. Short-form addressing. */
void xfs_btree_reada_bufs(xfs_mount_t *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_extlen_t count)
|
{
xfs_daddr_t d;
ASSERT(agno != NULLAGNUMBER);
ASSERT(agbno != NULLAGBLOCK);
d = XFS_AGB_TO_DADDR(mp, agno, agbno);
xfs_baread(mp->m_ddev_targp, d, mp->m_bsize * count);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ether3 read/write. Slow things down a bit... The SEEQ8005 doesn't like us writing to its registers too quickly. */
|
static void ether3_outb(int v, const void __iomem *r)
|
/* ether3 read/write. Slow things down a bit... The SEEQ8005 doesn't like us writing to its registers too quickly. */
static void ether3_outb(int v, const void __iomem *r)
|
{
writeb(v, r);
udelay(1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Builds a pdu frame as an SABME command. */
|
void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit)
|
/* Builds a pdu frame as an SABME command. */
void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit)
|
{
struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_CMD_SABME;
pdu->ctrl_1 |= ((p_bit & 1) << 4) & LLC_U_PF_BIT_MASK;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Retrieves one of the device's identity addresses. The device can have two identity addresses: one public and one random. The id_addr_type argument specifies which of these two addresses to retrieve. */
|
int ble_hs_id_addr(uint8_t id_addr_type, const uint8_t **out_id_addr, int *out_is_nrpa)
|
/* Retrieves one of the device's identity addresses. The device can have two identity addresses: one public and one random. The id_addr_type argument specifies which of these two addresses to retrieve. */
int ble_hs_id_addr(uint8_t id_addr_type, const uint8_t **out_id_addr, int *out_is_nrpa)
|
{
const uint8_t *id_addr;
int nrpa;
BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
switch (id_addr_type) {
case BLE_ADDR_PUBLIC:
id_addr = ble_hs_id_pub;
nrpa = 0;
break;
case BLE_ADDR_RANDOM:
id_addr = ble_hs_id_rnd;
nrpa = (ble_hs_id_rnd[5] & 0xc0) == 0;
break;
default:
return BLE_HS_EINVAL;
}
if (memcmp(id_addr, ble_hs_misc_null_addr, 6) == 0) {
return BLE_HS_ENOADDR;
}
if (out_id_addr != NULL) {
*out_id_addr = id_addr;
}
if (out_is_nrpa != NULL) {
*out_is_nrpa = nrpa;
}
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This is the RFC2938 variant of base32, not RFC3548, Crockford's, or other newer variant. It produces an 8-byte encoded character string (plus trailing null) from a 32-bit integer input. */
|
int u32_to_base32(UINT32 input, char *output)
|
/* This is the RFC2938 variant of base32, not RFC3548, Crockford's, or other newer variant. It produces an 8-byte encoded character string (plus trailing null) from a 32-bit integer input. */
int u32_to_base32(UINT32 input, char *output)
|
{
static const char base32hex_table[32] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v'
};
int i;
for (i = 0; i < 7; i++) {
output[6 - i] = base32hex_table[input & 0x1f];
input >>= 5;
}
output[7] = '$';
output[8] = '\0';
return 0;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Helper - belongs in the PCI layer somewhere eventually */
|
static int is_pci_dev(struct device *dev)
|
/* Helper - belongs in the PCI layer somewhere eventually */
static int is_pci_dev(struct device *dev)
|
{
return (dev->bus == &pci_bus_type);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Decrease the reference count of the net buffer queue by one. The real resource free operation isn't performed until the reference count of the net buffer queue is decreased to 0. */
|
VOID EFIAPI NetbufQueFree(IN NET_BUF_QUEUE *NbufQue)
|
/* Decrease the reference count of the net buffer queue by one. The real resource free operation isn't performed until the reference count of the net buffer queue is decreased to 0. */
VOID EFIAPI NetbufQueFree(IN NET_BUF_QUEUE *NbufQue)
|
{
ASSERT (NbufQue != NULL);
NET_CHECK_SIGNATURE (NbufQue, NET_QUE_SIGNATURE);
NbufQue->RefCnt--;
if (NbufQue->RefCnt == 0) {
NetbufQueFlush (NbufQue);
FreePool (NbufQue);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Flushes an endpoint of the Low Level Driver. */
|
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
/* Flushes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
{
HAL_PCD_EP_Flush(pdev->pData, ep_addr);
return USBD_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Get LL hardware flow control define from Zephyr hardware flow control option. */
|
static uint32_t uart_stm32_cfg2ll_hwctrl(enum uart_config_flow_control fc)
|
/* Get LL hardware flow control define from Zephyr hardware flow control option. */
static uint32_t uart_stm32_cfg2ll_hwctrl(enum uart_config_flow_control fc)
|
{
if (fc == UART_CFG_FLOW_CTRL_RTS_CTS) {
return LL_USART_HWCONTROL_RTS_CTS;
} else if (fc == UART_CFG_FLOW_CTRL_RS485) {
return LL_USART_HWCONTROL_NONE;
}
return LL_USART_HWCONTROL_NONE;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* imx_ddr_size - return size in bytes of DRAM according MMDC config The MMDC MDCTL register holds the number of bits for row, col, and data width and the MMDC MDMISC register holds the number of banks. Combine all these bits to determine the meme size the MMDC has been configured for */
|
unsigned int imx_ddr_size(void)
|
/* imx_ddr_size - return size in bytes of DRAM according MMDC config The MMDC MDCTL register holds the number of bits for row, col, and data width and the MMDC MDMISC register holds the number of banks. Combine all these bits to determine the meme size the MMDC has been configured for */
unsigned int imx_ddr_size(void)
|
{
struct esd_mmdc_regs *mem = (struct esd_mmdc_regs *)MEMCTL_BASE;
unsigned int ctl = readl(&mem->ctl);
unsigned int misc = readl(&mem->misc);
int bits = 11 + 0 + 0 + 1;
bits += ESD_MMDC_CTL_GET_ROW(ctl);
bits += col_lookup[ESD_MMDC_CTL_GET_COLUMN(ctl)];
bits += bank_lookup[ESD_MMDC_MISC_GET_BANK(misc)];
bits += ESD_MMDC_CTL_GET_WIDTH(ctl);
bits += ESD_MMDC_CTL_GET_CS1(ctl);
if (bits == 32)
return 0xf0000000;
return 1 << bits;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* in dram_init we are here executing from flash case 1: is with no ACR/flash cache enabled nop = 40ns (scope measured) */
|
void fudelay(int usec)
|
/* in dram_init we are here executing from flash case 1: is with no ACR/flash cache enabled nop = 40ns (scope measured) */
void fudelay(int usec)
|
{
while (usec--)
asm volatile ("nop");
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* sht15_wait_for_response() - checks for ack from device @data: device state */
|
static int sht15_wait_for_response(struct sht15_data *data)
|
/* sht15_wait_for_response() - checks for ack from device @data: device state */
static int sht15_wait_for_response(struct sht15_data *data)
|
{
gpio_direction_input(data->pdata->gpio_data);
gpio_set_value(data->pdata->gpio_sck, 1);
ndelay(SHT15_TSCKH);
if (gpio_get_value(data->pdata->gpio_data)) {
gpio_set_value(data->pdata->gpio_sck, 0);
dev_err(data->dev, "Command not acknowledged\n");
sht15_connection_reset(data);
return -EIO;
}
gpio_set_value(data->pdata->gpio_sck, 0);
ndelay(SHT15_TSCKL);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function sets the SCC Manager (Scan Chain Control Manager) register. */
|
static void scc_mgr_set(u32 off, u32 grp, u32 val)
|
/* This function sets the SCC Manager (Scan Chain Control Manager) register. */
static void scc_mgr_set(u32 off, u32 grp, u32 val)
|
{
writel(val, SDR_PHYGRP_SCCGRP_ADDRESS | off | (grp << 2));
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Note, if the speaker amp is muted, then we do not set a gain value as at-least one of the ICs that is fitted will try and power up even if the main control is set to off. */
|
static int speaker_gain_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
/* Note, if the speaker amp is muted, then we do not set a gain value as at-least one of the ICs that is fitted will try and power up even if the main control is set to off. */
static int speaker_gain_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
{
int value = ucontrol->value.integer.value[0];
spk_gain = value;
if (!spk_unmute)
speaker_gain_set(value);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified SPI interrupt has occurred or not. */
|
ITStatus SPI_GetITStatus(SPI_TypeDef *SPIx, uint8_t SPI_IT)
|
/* Checks whether the specified SPI interrupt has occurred or not. */
ITStatus SPI_GetITStatus(SPI_TypeDef *SPIx, uint8_t SPI_IT)
|
{
ITStatus bitstatus = RESET;
uint16_t itpos = 0, itmask = 0, enablestatus = 0;
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_GET_IT(SPI_IT));
itpos = 0x01 << (SPI_IT & 0x0F);
itmask = SPI_IT >> 4;
itmask = 0x01 << itmask;
enablestatus = (SPIx->CR2 & itmask) ;
if (((SPIx->SR & itpos) != (uint16_t)RESET) && enablestatus)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* This function waits until the SDIO DMA data transfer is finished. This function should be called after SDIO_ReadMultiBlocks() function to insure that all data sent by the card are already transferred by the DMA controller. */
|
SD_Error SD_WaitReadOperation(void)
|
/* This function waits until the SDIO DMA data transfer is finished. This function should be called after SDIO_ReadMultiBlocks() function to insure that all data sent by the card are already transferred by the DMA controller. */
SD_Error SD_WaitReadOperation(void)
|
{
SD_Error errorstatus = SD_OK;
volatile uint32_t timeout;
timeout = SD_DATATIMEOUT;
while ((DMAEndOfTransfer == 0x00) && (TransferEnd == 0) && (TransferError == SD_OK) && (timeout > 0)) {
timeout--;
}
DMAEndOfTransfer = 0x00;
timeout = SD_DATATIMEOUT;
while (((SDIO ->STA & SDIO_FLAG_RXACT)) && (timeout > 0)) {
timeout--;
}
if (StopCondition == 1) {
errorstatus = SD_StopTransfer ();
StopCondition = 0;
}
if ((timeout == 0) && (errorstatus == SD_OK)) {
errorstatus = SD_DATA_TIMEOUT;
}
SDIO->ICR = (SDIO_STATIC_FLAGS);
if (TransferError != SD_OK) {
return (TransferError);
}
return (errorstatus);
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Write Status Register.
The WRSR instruction is for changing the values of Status Register Bits (and configuration register). */
|
enum status_code mx25l_write_status(uint8_t value)
|
/* Write Status Register.
The WRSR instruction is for changing the values of Status Register Bits (and configuration register). */
enum status_code mx25l_write_status(uint8_t value)
|
{
enum status_code status;
uint8_t tx_buf[2] = {MX25L_CMD_WRSR, value};
if (_mx25l_is_flash_busy()) {
return STATUS_BUSY;
}
_mx25l_send_cmd_write_latch(MX25L_CMD_WREN);
_mx25l_chip_select();
status = spi_write_buffer_wait(&_mx25l_spi, tx_buf, 2);
if (status != STATUS_OK) {
return STATUS_ERR_IO;
}
_mx25l_chip_deselect();
if (!_mx25l_wait_flash_ready(MX25L_WAIT_TIMEOUT)) {
return STATUS_ERR_IO;
}
return STATUS_OK;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Appends a new declaration to the current declarations list. Returns the declaration list with a_new appended to it, or NULL in case of error. */
|
CRDeclaration* cr_declaration_append(CRDeclaration *a_this, CRDeclaration *a_new)
|
/* Appends a new declaration to the current declarations list. Returns the declaration list with a_new appended to it, or NULL in case of error. */
CRDeclaration* cr_declaration_append(CRDeclaration *a_this, CRDeclaration *a_new)
|
{
CRDeclaration *cur = NULL;
g_return_val_if_fail (a_new, NULL);
if (!a_this)
return a_new;
for (cur = a_this; cur && cur->next; cur = cur->next) ;
cur->next = a_new;
a_new->prev = cur;
return a_this;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* close - we don't have to do special.. */
|
static int snd_nm256_playback_close(struct snd_pcm_substream *substream)
|
/* close - we don't have to do special.. */
static int snd_nm256_playback_close(struct snd_pcm_substream *substream)
|
{
struct nm256 *chip = snd_pcm_substream_chip(substream);
snd_nm256_release_irq(chip);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set DMA destination PIP configuration used by a HDMA channel. */
|
void DMA_DPIPconfiguration(unsigned char channel, unsigned int pipHole, unsigned int pipBoundary)
|
/* Set DMA destination PIP configuration used by a HDMA channel. */
void DMA_DPIPconfiguration(unsigned char channel, unsigned int pipHole, unsigned int pipBoundary)
|
{
unsigned int value;
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB;
value &= ~ (AT91C_DST_PIP);
value |= AT91C_DST_PIP;
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB = value;
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_DPIP = (pipHole + 1) | pipBoundary <<16;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
|
EFI_STATUS SdPeimSelect(IN SD_PEIM_HC_SLOT *Slot, IN UINT16 Rca)
|
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
EFI_STATUS SdPeimSelect(IN SD_PEIM_HC_SLOT *Slot, IN UINT16 Rca)
|
{
SD_COMMAND_BLOCK SdCmdBlk;
SD_STATUS_BLOCK SdStatusBlk;
SD_COMMAND_PACKET Packet;
EFI_STATUS Status;
ZeroMem (&SdCmdBlk, sizeof (SdCmdBlk));
ZeroMem (&SdStatusBlk, sizeof (SdStatusBlk));
ZeroMem (&Packet, sizeof (Packet));
Packet.SdCmdBlk = &SdCmdBlk;
Packet.SdStatusBlk = &SdStatusBlk;
Packet.Timeout = SD_TIMEOUT;
SdCmdBlk.CommandIndex = SD_SELECT_DESELECT_CARD;
SdCmdBlk.CommandType = SdCommandTypeAc;
SdCmdBlk.ResponseType = SdResponseTypeR1b;
SdCmdBlk.CommandArgument = (UINT32)Rca << 16;
Status = SdPeimExecCmd (Slot, &Packet);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* read an array from tvb and add it to tree */
|
static void read_array(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
|
/* read an array from tvb and add it to tree */
static void read_array(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
|
{
int length;
read_type(offset, tvb, etch_tree);
read_array_type(offset, tvb, etch_tree);
proto_tree_add_item(etch_tree, hf_etch_dim, tvb, *offset, 1, ENC_BIG_ENDIAN);
(*offset)++;
length = read_length(offset, tvb, etch_tree);
for (; length > 0; length--) {
read_value(offset, tvb, etch_tree, hf_etch_value);
}
read_type(offset, tvb, etch_tree);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* It returns 0 if the packet was removed by us. */
|
int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags)
|
/* It returns 0 if the packet was removed by us. */
int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags)
|
{
int err = 0;
if (flags & MSG_PEEK) {
err = -ENOENT;
spin_lock_bh(&sk->sk_receive_queue.lock);
if (skb == skb_peek(&sk->sk_receive_queue)) {
__skb_unlink(skb, &sk->sk_receive_queue);
atomic_dec(&skb->users);
err = 0;
}
spin_unlock_bh(&sk->sk_receive_queue.lock);
}
kfree_skb(skb);
atomic_inc(&sk->sk_drops);
sk_mem_reclaim_partial(sk);
return err;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* stripped-down 'require'. Calls 'openf' to open a module, registers the result in 'package.loaded' table and, if 'glb' is true, also registers the result in the global table. Leaves resulting module on the top. */
|
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
|
/* stripped-down 'require'. Calls 'openf' to open a module, registers the result in 'package.loaded' table and, if 'glb' is true, also registers the result in the global table. Leaves resulting module on the top. */
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
|
{
lua_pushcfunction(L, openf);
lua_pushstring(L, modname);
lua_call(L, 1, 1);
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
lua_pushvalue(L, -2);
lua_setfield(L, -2, modname);
lua_pop(L, 1);
if (glb) {
lua_pushvalue(L, -1);
lua_setglobal(L, modname);
}
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Record an rcu quiescent state. And an rcu_bh quiescent state while we are at it, given that any rcu quiescent state is also an rcu_bh quiescent state. Use "+" instead of "||" to defeat short circuiting. */
|
void rcu_sched_qs(int cpu)
|
/* Record an rcu quiescent state. And an rcu_bh quiescent state while we are at it, given that any rcu quiescent state is also an rcu_bh quiescent state. Use "+" instead of "||" to defeat short circuiting. */
void rcu_sched_qs(int cpu)
|
{
if (rcu_qsctr_help(&rcu_ctrlblk) + rcu_qsctr_help(&rcu_bh_ctrlblk))
raise_softirq(RCU_SOFTIRQ);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable/Disable the interrupt of a User Reset (USRTS bit in RSTC_RST). */
|
void RSTC_SetUserResetInterruptEnable(AT91PS_RSTC rstc, unsigned char enable)
|
/* Enable/Disable the interrupt of a User Reset (USRTS bit in RSTC_RST). */
void RSTC_SetUserResetInterruptEnable(AT91PS_RSTC rstc, unsigned char enable)
|
{
unsigned int rmr = READ_RSTC(rstc, RSTC_RMR) & (~AT91C_RSTC_KEY);
if (enable) {
rmr |= AT91C_RSTC_URSTIEN;
}
else {
rmr &= ~AT91C_RSTC_URSTIEN;
}
WRITE_RSTC(rstc, RSTC_RMR, rmr | RSTC_KEY_PASSWORD);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* This function will return the name of the specified object container. */
|
rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size)
|
/* This function will return the name of the specified object container. */
rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size)
|
{
rt_err_t result = -RT_EINVAL;
if ((object != RT_NULL) && (name != RT_NULL) && (name_size != 0U))
{
const char *obj_name = object->name;
(void) rt_strncpy(name, obj_name, (rt_size_t)name_size);
result = RT_EOK;
}
return result;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called at the end of a mmu_gather operation to make sure the TLB flush is completely done. */
|
void tlb_flush(struct mmu_gather *tlb)
|
/* Called at the end of a mmu_gather operation to make sure the TLB flush is completely done. */
void tlb_flush(struct mmu_gather *tlb)
|
{
if (Hash == 0) {
_tlbia();
}
pte_free_finish();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Virtual COM Port set control line state.
The function sets control line state on the port used as the Virtual COM Port. */
|
int32_t USBD_CDC_ACM_PortSetControlLineState(uint16_t ctrl_bmp)
|
/* Virtual COM Port set control line state.
The function sets control line state on the port used as the Virtual COM Port. */
int32_t USBD_CDC_ACM_PortSetControlLineState(uint16_t ctrl_bmp)
|
{
uart_set_control_line_state(ctrl_bmp);
return (1);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Initializes FLL of the UCS and wait till settled */
|
void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio)
|
/* Initializes FLL of the UCS and wait till settled */
void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio)
|
{
volatile uint16_t x = ratio * 32;
uint16_t globalInterruptState = __get_SR_register() & SCG0;
__bic_SR_register(SCG0);
Init_FLL(fsystem, ratio);
while(x--)
{
__delay_cycles(30);
}
__bis_SR_register(globalInterruptState);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Turn the array A with the size 1 x length, into a hankel matrix H with the size length x length Argument step is how the shift of hankel matrix should be. Normaly, you want shift = 0. */
|
void hankel(double *A, double *H, int length, int step)
|
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Turn the array A with the size 1 x length, into a hankel matrix H with the size length x length Argument step is how the shift of hankel matrix should be. Normaly, you want shift = 0. */
void hankel(double *A, double *H, int length, int step)
|
{
for(int j = 0; j < length; j++){
if(j+i+step >= length){
*((H + i*length) + j) = 0;
}else{
*((H + i*length) + j) = A[j+i+step];
}
}
}
}
|
DanielMartensson/EmbeddedLapack
|
C++
|
MIT License
| 129
|
/* Spec. Release 1.3, section 4.5.2.2.6 UnattachedWait.SRC State.
3: The port shall provide an Rdch termination on the CC pin being discharged. NOTE: Implemented in tc_unattached_wait_src_entry */
|
void tc_unattached_wait_src_entry(void *obj)
|
/* Spec. Release 1.3, section 4.5.2.2.6 UnattachedWait.SRC State.
3: The port shall provide an Rdch termination on the CC pin being discharged. NOTE: Implemented in tc_unattached_wait_src_entry */
void tc_unattached_wait_src_entry(void *obj)
|
{
struct tc_sm_t *tc = (struct tc_sm_t *)obj;
const struct device *dev = tc->dev;
struct usbc_port_data *data = dev->data;
const struct device *tcpc = data->tcpc;
LOG_INF("UnattachedWait.SRC");
tcpc_vconn_discharge(tcpc, true);
usbc_timer_start(&tc->tc_t_vconn_off);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* mux the pin to the "B" internal peripheral role. */
|
int at91_set_b_periph(unsigned port, unsigned pin, int use_pullup)
|
/* mux the pin to the "B" internal peripheral role. */
int at91_set_b_periph(unsigned port, unsigned pin, int use_pullup)
|
{
at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
u32 mask;
if ((port < AT91_PIO_PORTS) && (pin < 32)) {
mask = 1 << pin;
writel(mask, &pio->port[port].idr);
at91_set_pio_pullup(port, pin, use_pullup);
writel(mask, &pio->port[port].bsr);
writel(mask, &pio->port[port].pdr);
}
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* USART Clock initialization function.
Enables register interface and peripheral clock */
|
void TARGET_IO_CLOCK_init()
|
/* USART Clock initialization function.
Enables register interface and peripheral clock */
void TARGET_IO_CLOCK_init()
|
{
hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM2_GCLK_ID_CORE, CONF_GCLK_SERCOM2_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM2_GCLK_ID_SLOW, CONF_GCLK_SERCOM2_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
hri_mclk_set_APBBMASK_SERCOM2_bit(MCLK);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* De-Initializes the Low Level portion of the Host driver. */
|
USBH_StatusTypeDef USBH_LL_DeInit(USBH_HandleTypeDef *phost)
|
/* De-Initializes the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_DeInit(USBH_HandleTypeDef *phost)
|
{
HAL_HCD_DeInit(phost->pData);
return USBH_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Check sense key to find if media presents. */
|
BOOLEAN ScsiDiskIsNoMedia(IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts)
|
/* Check sense key to find if media presents. */
BOOLEAN ScsiDiskIsNoMedia(IN EFI_SCSI_SENSE_DATA *SenseData, IN UINTN SenseCounts)
|
{
EFI_SCSI_SENSE_DATA *SensePtr;
UINTN Index;
BOOLEAN IsNoMedia;
IsNoMedia = FALSE;
SensePtr = SenseData;
for (Index = 0; Index < SenseCounts; Index++) {
if ((SensePtr->Sense_Key == EFI_SCSI_SK_NOT_READY) &&
(SensePtr->Addnl_Sense_Code == EFI_SCSI_ASC_NO_MEDIA))
{
IsNoMedia = TRUE;
}
SensePtr++;
}
return IsNoMedia;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Synchronous forces are implemented with a signal variable. All callers to force a given lsn to disk will wait on a the sv attached to the specific in-core log. When given in-core log finally completes its write to disk, that thread will wake up all threads waiting on the sv. */
|
int _xfs_log_force(xfs_mount_t *mp, xfs_lsn_t lsn, uint flags, int *log_flushed)
|
/* Synchronous forces are implemented with a signal variable. All callers to force a given lsn to disk will wait on a the sv attached to the specific in-core log. When given in-core log finally completes its write to disk, that thread will wake up all threads waiting on the sv. */
int _xfs_log_force(xfs_mount_t *mp, xfs_lsn_t lsn, uint flags, int *log_flushed)
|
{
xlog_t *log = mp->m_log;
int dummy;
if (!log_flushed)
log_flushed = &dummy;
ASSERT(flags & XFS_LOG_FORCE);
XFS_STATS_INC(xs_log_force);
if (log->l_flags & XLOG_IO_ERROR)
return XFS_ERROR(EIO);
if (lsn == 0)
return xlog_state_sync_all(log, flags, log_flushed);
else
return xlog_state_sync(log, lsn, flags, log_flushed);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: This routine is called to tell us that the PCI bus is down. Can't do anything here, except put the device driver into a holding pattern, waiting for the PCI bus to come back. */
|
static void ipr_pci_frozen(struct pci_dev *pdev)
|
/* Description: This routine is called to tell us that the PCI bus is down. Can't do anything here, except put the device driver into a holding pattern, waiting for the PCI bus to come back. */
static void ipr_pci_frozen(struct pci_dev *pdev)
|
{
unsigned long flags = 0;
struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
spin_lock_irqsave(ioa_cfg->host->host_lock, flags);
_ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_freeze, IPR_SHUTDOWN_NONE);
spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable DPLL automatic idle control. No return value. */
|
void omap3_dpll_deny_idle(struct clk *clk)
|
/* Disable DPLL automatic idle control. No return value. */
void omap3_dpll_deny_idle(struct clk *clk)
|
{
const struct dpll_data *dd;
u32 v;
if (!clk || !clk->dpll_data)
return;
dd = clk->dpll_data;
v = __raw_readl(dd->autoidle_reg);
v &= ~dd->autoidle_mask;
v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
__raw_writel(v, dd->autoidle_reg);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* show_cpuinfo_cur_freq - current CPU frequency as detected by hardware */
|
static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, char *buf)
|
/* show_cpuinfo_cur_freq - current CPU frequency as detected by hardware */
static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, char *buf)
|
{
unsigned int cur_freq = __cpufreq_get(policy->cpu);
if (!cur_freq)
return sprintf(buf, "<unknown>");
return sprintf(buf, "%u\n", cur_freq);
}
|
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.