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 gets back the FSP API second parameter passed by the bootloader. */
|
UINTN EFIAPI GetFspApiParameter2(VOID)
|
/* This function gets back the FSP API second parameter passed by the bootloader. */
UINTN EFIAPI GetFspApiParameter2(VOID)
|
{
FSP_GLOBAL_DATA *FspData;
FspData = GetFspGlobalDataPointer ();
return *(UINTN *)(FspData->CoreStack + CONTEXT_STACK_OFFSET (ApiParam[1]));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns: RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */
|
static int rec_rdelete(BTREE *t, recno_t nrec)
|
/* Returns: RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */
static int rec_rdelete(BTREE *t, recno_t nrec)
|
{
EPG *e;
PAGE *h;
int status;
if ((e = __rec_search(t, nrec, SDELETE)) == NULL)
return (RET_ERROR);
h = e->page;
status = __rec_dleaf(t, h, e->index);
if (status != RET_SUCCESS) {
mpool_put(t->bt_mp, h, 0);
return (status);
}
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
return (RET_SUCCESS);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Recalculate the mask of events relevant to a given inode locked. */
|
static void fsnotify_recalc_inode_mask_locked(struct inode *inode)
|
/* Recalculate the mask of events relevant to a given inode locked. */
static void fsnotify_recalc_inode_mask_locked(struct inode *inode)
|
{
struct fsnotify_mark_entry *entry;
struct hlist_node *pos;
__u32 new_mask = 0;
assert_spin_locked(&inode->i_lock);
hlist_for_each_entry(entry, pos, &inode->i_fsnotify_mark_entries, i_list)
new_mask |= entry->mask;
inode->i_fsnotify_mask = new_mask;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Unlike mutex_trylock, this function can be used from interrupt context, and the semaphore can be released by any task or interrupt. */
|
int down_trylock(struct semaphore *sem)
|
/* Unlike mutex_trylock, this function can be used from interrupt context, and the semaphore can be released by any task or interrupt. */
int down_trylock(struct semaphore *sem)
|
{
unsigned long flags;
int count;
spin_lock_irqsave(&sem->lock, flags);
count = sem->count - 1;
if (likely(count >= 0))
sem->count = count;
spin_unlock_irqrestore(&sem->lock, flags);
return (count < 0);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read Opposite Error Recovery Function: Used, when Read Forward does not work */
|
static void tape_3590_read_opposite(struct tape_device *device, struct tape_request *request)
|
/* Read Opposite Error Recovery Function: Used, when Read Forward does not work */
static void tape_3590_read_opposite(struct tape_device *device, struct tape_request *request)
|
{
struct tape_3590_disc_data *data;
request->op = TO_RBA;
tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1, device->modeset_byte);
data = device->discdata;
tape_ccw_cc_idal(request->cpaddr + 1, data->read_back_op,
device->char_data.idal_buf);
tape_ccw_cc(request->cpaddr + 2, FORSPACEBLOCK, 0, NULL);
tape_ccw_end(request->cpaddr + 3, NOP, 0, NULL);
DBF_EVENT(6, "xrop ccwg\n");
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Convert an lsf vector into an lsp vector. */
|
static void lsf2lsp(const float *lsf, double *lsp)
|
/* Convert an lsf vector into an lsp vector. */
static void lsf2lsp(const float *lsf, double *lsp)
|
{
int i;
for (i = 0; i < LP_FILTER_ORDER; i++)
lsp[i] = cos(2.0 * M_PI * lsf[i]);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Set the number of multicast probes of a neighbour table to the specified value */
|
void rtnl_neightbl_set_mcast_probes(struct rtnl_neightbl *ntbl, int probes)
|
/* Set the number of multicast probes of a neighbour table to the specified value */
void rtnl_neightbl_set_mcast_probes(struct rtnl_neightbl *ntbl, int probes)
|
{
ntbl->nt_parms.ntp_mcast_probes = probes;
ntbl->nt_parms.ntp_mask |= NEIGHTBLPARM_ATTR_MCAST_PROBES;
ntbl->ce_mask |= NEIGHTBL_ATTR_PARMS;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function calculates the gap between current number of PEBs reserved for bad eraseblock handling and the required level of PEBs that must be reserved, and if necessary, reserves more PEBs to fill that gap, according to availability. Should be called with ubi->volumes_lock held. */
|
void ubi_update_reserved(struct ubi_device *ubi)
|
/* This function calculates the gap between current number of PEBs reserved for bad eraseblock handling and the required level of PEBs that must be reserved, and if necessary, reserves more PEBs to fill that gap, according to availability. Should be called with ubi->volumes_lock held. */
void ubi_update_reserved(struct ubi_device *ubi)
|
{
int need = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs;
if (need <= 0 || ubi->avail_pebs == 0)
return;
need = min_t(int, need, ubi->avail_pebs);
ubi->avail_pebs -= need;
ubi->rsvd_pebs += need;
ubi->beb_rsvd_pebs += need;
ubi_msg(ubi, "reserved more %d PEBs for bad PEB handling", need);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Initialize the table of used registers and the current register. */
|
static void init_regs(compiler_state_t *)
|
/* Initialize the table of used registers and the current register. */
static void init_regs(compiler_state_t *)
|
{
cstate->curreg = 0;
memset(cstate->regused, 0, sizeof cstate->regused);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Wake up CPU 1 from another CPU, this is platform specific. */
|
void wakeup_cpu1(void)
|
/* Wake up CPU 1 from another CPU, this is platform specific. */
void wakeup_cpu1(void)
|
{
*(uint32_t *)(SSE_200_SYSTEM_CTRL_INITSVTOR1) =
(uint32_t)_vector_start +
NON_SECURE_FLASH_ADDRESS -
NON_SECURE_FLASH_OFFSET;
*(uint32_t *)(SSE_200_SYSTEM_CTRL_CPU_WAIT) = 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Verify a page of NAND flash, including the OOB. Reads page of NAND and verifies the contents and OOB against the values in ops. */
|
int nand_verify_page_oob(struct mtd_info *mtd, struct mtd_oob_ops *ops, loff_t ofs)
|
/* Verify a page of NAND flash, including the OOB. Reads page of NAND and verifies the contents and OOB against the values in ops. */
int nand_verify_page_oob(struct mtd_info *mtd, struct mtd_oob_ops *ops, loff_t ofs)
|
{
int rval;
struct mtd_oob_ops vops;
size_t verlen = mtd->writesize + mtd->oobsize;
memcpy(&vops, ops, sizeof(vops));
vops.datbuf = memalign(ARCH_DMA_MINALIGN, verlen);
if (!vops.datbuf)
return -ENOMEM;
vops.oobbuf = vops.datbuf + mtd->writesize;
rval = mtd_read_oob(mtd, ofs, &vops);
if (!rval)
rval = memcmp(ops->datbuf, vops.datbuf, vops.len);
if (!rval)
rval = memcmp(ops->oobbuf, vops.oobbuf, vops.ooblen);
free(vops.datbuf);
return rval ? -EIO : 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function will get the first network interface device with the flags in network interface device list. */
|
struct netdev* netdev_get_first_by_flags(uint16_t flags)
|
/* This function will get the first network interface device with the flags in network interface device list. */
struct netdev* netdev_get_first_by_flags(uint16_t flags)
|
{
slist_t *node = NULL;
struct netdev *netdev = NULL;
if (netdev_list == NULL)
{
return NULL;
}
CPSR_ALLOC();
RHINO_CPU_INTRPT_DISABLE();
slist_for_each_entry_safe(&(netdev_list->list), node, netdev, struct netdev, list)
{
if (netdev && (netdev->flags & flags) != 0)
{
RHINO_CPU_INTRPT_ENABLE();
return netdev;
}
}
RHINO_CPU_INTRPT_ENABLE();
return NULL;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Use 0 for success, EFOO otherwise. Note: this is the negative of conventional kernel error values because it's not being returned via syscall return mechanisms. */
|
static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
|
/* Use 0 for success, EFOO otherwise. Note: this is the negative of conventional kernel error values because it's not being returned via syscall return mechanisms. */
static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
|
{
struct cn_msg *msg;
struct proc_event *ev;
__u8 buffer[CN_PROC_MSG_SIZE];
struct timespec ts;
if (atomic_read(&proc_event_num_listeners) < 1)
return;
msg = (struct cn_msg*)buffer;
ev = (struct proc_event*)msg->data;
msg->seq = rcvd_seq;
ktime_get_ts(&ts);
put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
ev->cpu = -1;
ev->what = PROC_EVENT_NONE;
ev->event_data.ack.err = err;
memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
msg->ack = rcvd_ack + 1;
msg->len = sizeof(*ev);
cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the level-trigger transmission status of the specified SPI port. */
|
xtBoolean SPILevelTriggerStatusGet(unsigned long ulBase)
|
/* Get the level-trigger transmission status of the specified SPI port. */
xtBoolean SPILevelTriggerStatusGet(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
return ((xHWREG(ulBase + SPI_SSR) & SPI_LTRIG_FLAG) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Small utility to check that you got the colours right */
|
int drv_lcd_init(void)
|
/* Small utility to check that you got the colours right */
int drv_lcd_init(void)
|
{
struct stdio_dev lcddev;
int rc;
lcd_base = (void *)(gd->fb_base);
lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
lcd_init (lcd_base);
memset (&lcddev, 0, sizeof (lcddev));
strcpy (lcddev.name, "lcd");
lcddev.ext = 0;
lcddev.flags = DEV_FLAGS_OUTPUT;
lcddev.putc = lcd_putc;
lcddev.puts = lcd_puts;
rc = stdio_register (&lcddev);
return (rc == 0) ? 1 : rc;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Checks if the Backup DRx registers are reset or not. */
|
uint32_t IsBackupRegReset(void)
|
/* Checks if the Backup DRx registers are reset or not. */
uint32_t IsBackupRegReset(void)
|
{
uint32_t index = 0;
for (index = 0; index < BKP_DR_NUMBER; index++)
{
if (BKP_ReadBackupRegister(BKPDataReg[index]) != 0x0000)
{
return (index + 1);
}
}
return 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Change Logs: Date Author Notes ShichengChu first version */
|
void setup(void)
|
/* Change Logs: Date Author Notes ShichengChu first version */
void setup(void)
|
{
Serial2.begin();
Serial2.println("Hello RTduino!");
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initialize the trigger timer when in Comparator Timer-Trigger Mode. */
|
void CMP_TimerTrigCmd(u8 Tim_Idx, u32 PeriodMs, u32 NewState)
|
/* Initialize the trigger timer when in Comparator Timer-Trigger Mode. */
void CMP_TimerTrigCmd(u8 Tim_Idx, u32 PeriodMs, u32 NewState)
|
{
CMP_TypeDef *comparator = COMPARATOR;
RTIM_TimeBaseInitTypeDef TIM_InitStruct;
comparator->COMP_EXT_TRIG_TIMER_SEL = Tim_Idx;
if(NewState != DISABLE) {
RTIM_TimeBaseStructInit(&TIM_InitStruct);
TIM_InitStruct.TIM_Idx = Tim_Idx;
TIM_InitStruct.TIM_Period = (PeriodMs *32768)/1000/2;
RTIM_TimeBaseInit(TIMx_LP[Tim_Idx], &TIM_InitStruct, TIMx_irq_LP[Tim_Idx], (IRQ_FUN)NULL, (u32)NULL);
RTIM_Cmd(TIMx_LP[Tim_Idx], ENABLE);
comparator->COMP_EXT_TRIG_CTRL = BIT_COMP_EXT_WK_TIMER;
} else {
RTIM_Cmd(TIMx_LP[Tim_Idx], DISABLE);
comparator->COMP_EXT_TRIG_CTRL = 0;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Returns: the number of elements in the #GList */
|
guint g_list_length(GList *list)
|
/* Returns: the number of elements in the #GList */
guint g_list_length(GList *list)
|
{
guint length;
length = 0;
while (list)
{
length++;
list = list->next;
}
return length;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Init interrupts callback for the specified SPI Port. */
|
void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
|
/* Init interrupts callback for the specified SPI Port. */
void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
switch(ulBase)
{
case SPI0_BASE:
{
g_pfnSPIHandlerCallbacks[0] = xtSPICallback;
break;
}
case SPI1_BASE:
{
g_pfnSPIHandlerCallbacks[1] = xtSPICallback;
break;
}
case SPI2_BASE:
{
g_pfnSPIHandlerCallbacks[2] = xtSPICallback;
break;
}
case SPI3_BASE:
{
g_pfnSPIHandlerCallbacks[3] = xtSPICallback;
break;
}
default:
break;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* memstick_new_req - notify the host that some requests are pending @host - host to use */
|
void memstick_new_req(struct memstick_host *host)
|
/* memstick_new_req - notify the host that some requests are pending @host - host to use */
void memstick_new_req(struct memstick_host *host)
|
{
if (host->card) {
host->retries = cmd_retries;
INIT_COMPLETION(host->card->mrq_complete);
host->request(host);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* wait for the read lock to be granted */
|
asmregparm struct rw_semaphore __sched* rwsem_down_read_failed(struct rw_semaphore *sem)
|
/* wait for the read lock to be granted */
asmregparm struct rw_semaphore __sched* rwsem_down_read_failed(struct rw_semaphore *sem)
|
{
struct rwsem_waiter waiter;
waiter.flags = RWSEM_WAITING_FOR_READ;
rwsem_down_failed_common(sem, &waiter,
RWSEM_WAITING_BIAS - RWSEM_ACTIVE_BIAS);
return sem;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables or disables the Internal High Speed oscillator for ADC (HSI14). */
|
void RCC_HSI14Cmd(FunctionalState NewState)
|
/* Enables or disables the Internal High Speed oscillator for ADC (HSI14). */
void RCC_HSI14Cmd(FunctionalState NewState)
|
{
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->CR2 |= RCC_CR2_HSI14ON;
}
else
{
RCC->CR2 &= ~RCC_CR2_HSI14ON;
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* How many 0 bits are there at least significant end of Uint32. Low performance, do not call often. */
|
static int free_bits_at_bottom(Uint32 a)
|
/* How many 0 bits are there at least significant end of Uint32. Low performance, do not call often. */
static int free_bits_at_bottom(Uint32 a)
|
{
if(!a) return sizeof(Uint32) * 8;
if(((Sint32)a) & 1l) return 0;
return 1 + free_bits_at_bottom ( a >> 1);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI PciExpressBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
{
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT16)-1;
}
return MmioBitFieldWrite16 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
Value
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configures the minimum fault period and fault pin senses for a given PWM generator. */
|
void PWMGenFaultConfigure(unsigned long ulBase, unsigned long ulGen, unsigned long ulMinFaultPeriod, unsigned long ulFaultSenses)
|
/* Configures the minimum fault period and fault pin senses for a given PWM generator. */
void PWMGenFaultConfigure(unsigned long ulBase, unsigned long ulGen, unsigned long ulMinFaultPeriod, unsigned long ulFaultSenses)
|
{
ASSERT(HWREG(SYSCTL_DC5) & SYSCTL_DC5_PWMEFLT);
ASSERT(ulBase == PWM_BASE);
ASSERT(PWMGenValid(ulGen));
ASSERT(ulMinFaultPeriod < PWM_X_MINFLTPER_M);
ASSERT((ulFaultSenses & ~(PWM_FAULT0_SENSE_HIGH | PWM_FAULT0_SENSE_LOW |
PWM_FAULT1_SENSE_HIGH | PWM_FAULT1_SENSE_LOW |
PWM_FAULT2_SENSE_HIGH | PWM_FAULT2_SENSE_LOW |
PWM_FAULT3_SENSE_HIGH | PWM_FAULT3_SENSE_LOW)) ==
0);
HWREG(PWM_GEN_BADDR(ulBase, ulGen) + PWM_O_X_MINFLTPER) = ulMinFaultPeriod;
HWREG(PWM_GEN_EXT_BADDR(ulBase, ulGen) + PWM_O_X_FLTSEN) = ulFaultSenses;
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* SC_Itf_Mechanical Mechanical Function being requested by Host This is Optional function & user implementable. */
|
uint8_t SC_Itf_Mechanical(uint8_t bFunction)
|
/* SC_Itf_Mechanical Mechanical Function being requested by Host This is Optional function & user implementable. */
uint8_t SC_Itf_Mechanical(uint8_t bFunction)
|
{
UNUSED(bFunction);
return SLOTERROR_CMD_NOT_SUPPORTED;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Get GPIO port Dout register of the specified GPIO. */
|
long GPIOPinPortDoutGet(unsigned long ulPort)
|
/* Get GPIO port Dout register of the specified GPIO. */
long GPIOPinPortDoutGet(unsigned long ulPort)
|
{
xASSERT(GPIOBaseValid(ulPort));
return(xHWREG(ulPort + GPIO_PDOR));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Configures the high and low thresholds of the analog watchdog. */
|
void ADC_ConfigAnalogWatchdogThresholds(ADC_Module *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
|
/* Configures the high and low thresholds of the analog watchdog. */
void ADC_ConfigAnalogWatchdogThresholds(ADC_Module *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
|
{
assert_param(IsAdcModule(ADCx));
assert_param(IsAdcValid(HighThreshold));
assert_param(IsAdcValid(LowThreshold));
ADCx->WDGHIGH = HighThreshold;
ADCx->WDGLOW = LowThreshold;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* curl_easy_getinfo() is an external interface that allows an app to retrieve information from a performed transfer and similar. */
|
CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info,...)
|
/* curl_easy_getinfo() is an external interface that allows an app to retrieve information from a performed transfer and similar. */
CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info,...)
|
{
va_list arg;
void *paramp;
CURLcode result;
va_start(arg, info);
paramp = va_arg(arg, void *);
result = Curl_getinfo(data, info, paramp);
va_end(arg);
return result;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* This function is called for all triggers. It calls the appropriate function that writes the actual trigger records. */
|
void dasd_eer_write(struct dasd_device *device, struct dasd_ccw_req *cqr, unsigned int id)
|
/* This function is called for all triggers. It calls the appropriate function that writes the actual trigger records. */
void dasd_eer_write(struct dasd_device *device, struct dasd_ccw_req *cqr, unsigned int id)
|
{
if (!device->eer_cqr)
return;
switch (id) {
case DASD_EER_FATALERROR:
case DASD_EER_PPRCSUSPEND:
dasd_eer_write_standard_trigger(device, cqr, id);
break;
case DASD_EER_NOPATH:
dasd_eer_write_standard_trigger(device, NULL, id);
break;
case DASD_EER_STATECHANGE:
dasd_eer_write_snss_trigger(device, cqr, id);
break;
default:
dasd_eer_write_standard_trigger(device, NULL, id);
break;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* External function to wake up a server waiting for data This really only makes sense for services like lockd which have exactly one thread anyway. */
|
void svc_wake_up(struct svc_serv *serv)
|
/* External function to wake up a server waiting for data This really only makes sense for services like lockd which have exactly one thread anyway. */
void svc_wake_up(struct svc_serv *serv)
|
{
struct svc_rqst *rqstp;
unsigned int i;
struct svc_pool *pool;
for (i = 0; i < serv->sv_nrpools; i++) {
pool = &serv->sv_pools[i];
spin_lock_bh(&pool->sp_lock);
if (!list_empty(&pool->sp_threads)) {
rqstp = list_entry(pool->sp_threads.next,
struct svc_rqst,
rq_list);
dprintk("svc: daemon %p woken up.\n", rqstp);
wake_up(&rqstp->rq_wait);
}
spin_unlock_bh(&pool->sp_lock);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Checks whether the specified DMAy Channelx interrupt has occurred or not. */
|
ITStatus DMA_GetITStatus(uint32_t DMAy_IT)
|
/* Checks whether the specified DMAy Channelx interrupt has occurred or not. */
ITStatus DMA_GetITStatus(uint32_t DMAy_IT)
|
{
ITStatus bitstatus = RESET;
uint32_t tmpreg = 0;
assert_param(IS_DMA_GET_IT(DMAy_IT));
if ((DMAy_IT & FLAG_Mask) != (uint32_t)RESET)
{
tmpreg = DMA2->ISR;
}
else
{
tmpreg = DMA1->ISR;
}
if ((tmpreg & DMAy_IT) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
gcallipo/RadioDSP-Stm32f103
|
C++
|
Common Creative - Attribution 3.0
| 51
|
/* Reset root window geometry to fullscreen.
This function resets the root window size to fill the entire screen. Use this function to reconfigure the root window after a change in screen orientation. */
|
void win_reset_root_geometry(void)
|
/* Reset root window geometry to fullscreen.
This function resets the root window size to fill the entire screen. Use this function to reconfigure the root window after a change in screen orientation. */
void win_reset_root_geometry(void)
|
{
win_root.attributes.area.size.x = gfx_get_width();
win_root.attributes.area.size.y = gfx_get_height();
win_attribute_mask_t mask = WIN_ATTR_SIZE;
win_handle_event(&win_root, WIN_EVENT_ATTRIBUTES, &mask);
win_redraw(&win_root);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Send handshake to PC until we get a valid response. */
|
enum adp_handshake_status adp_wait_for_handshake(void)
|
/* Send handshake to PC until we get a valid response. */
enum adp_handshake_status adp_wait_for_handshake(void)
|
{
uint8_t handshake_status;
while (adp_request_handshake(ADP_VERSION, ADP_HANDSHAKE_OPTIONS_GPIO, &handshake_status) == false) {
}
return ((enum adp_handshake_status)handshake_status);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Specify the counter alignment mode.
The mode can be edge aligned or centered. */
|
void timer_set_alignment(uint32_t timer_peripheral, uint32_t alignment)
|
/* Specify the counter alignment mode.
The mode can be edge aligned or centered. */
void timer_set_alignment(uint32_t timer_peripheral, uint32_t alignment)
|
{
alignment &= TIM_CR1_CMS_MASK;
TIM_CR1(timer_peripheral) &= ~TIM_CR1_CMS_MASK;
TIM_CR1(timer_peripheral) |= alignment;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Set scheduling policy attribute in Thread attributes object.
See IEEE 1003.1 */
|
int pthread_attr_setschedpolicy(pthread_attr_t *_attr, int policy)
|
/* Set scheduling policy attribute in Thread attributes object.
See IEEE 1003.1 */
int pthread_attr_setschedpolicy(pthread_attr_t *_attr, int policy)
|
{
struct posix_thread_attr *attr = (struct posix_thread_attr *)_attr;
if (!__attr_is_initialized(attr) || !valid_posix_policy(policy)) {
return EINVAL;
}
attr->schedpolicy = policy;
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns transpose type for CRC protocol reflect out parameter.
This functions helps to set readTranspose member of crc_config_t structure. Reflect out is CRC protocol parameter. */
|
static crc_transpose_type_t CRC_GetTransposeTypeFromReflectOut(bool enable)
|
/* Returns transpose type for CRC protocol reflect out parameter.
This functions helps to set readTranspose member of crc_config_t structure. Reflect out is CRC protocol parameter. */
static crc_transpose_type_t CRC_GetTransposeTypeFromReflectOut(bool enable)
|
{
return ((enable) ? kCrcTransposeBitsAndBytes : kCrcTransposeNone);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* SPI Set Data Frame Format to 16 bits. */
|
void spi_set_dff_16bit(uint32_t spi)
|
/* SPI Set Data Frame Format to 16 bits. */
void spi_set_dff_16bit(uint32_t spi)
|
{
SPI_CR1(spi) |= SPI_CR1_DFF;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* We return "busy", only when we can map I/Os but underlying devices are busy (so even if we map I/Os now, the I/Os will wait on the underlying queue). In other words, if we want to kill I/Os or queue them inside us due to map unavailability, we don't return "busy". Otherwise, dm core won't give us the I/Os and we can't do what we want. */
|
static int multipath_busy(struct dm_target *ti)
|
/* We return "busy", only when we can map I/Os but underlying devices are busy (so even if we map I/Os now, the I/Os will wait on the underlying queue). In other words, if we want to kill I/Os or queue them inside us due to map unavailability, we don't return "busy". Otherwise, dm core won't give us the I/Os and we can't do what we want. */
static int multipath_busy(struct dm_target *ti)
|
{
int busy = 0, has_active = 0;
struct multipath *m = ti->private;
struct priority_group *pg;
struct pgpath *pgpath;
unsigned long flags;
spin_lock_irqsave(&m->lock, flags);
if (unlikely(!m->current_pgpath && m->next_pg))
pg = m->next_pg;
else if (likely(m->current_pg))
pg = m->current_pg;
else
goto out;
busy = 1;
list_for_each_entry(pgpath, &pg->pgpaths, list)
if (pgpath->is_active) {
has_active = 1;
if (!__pgpath_busy(pgpath)) {
busy = 0;
break;
}
}
if (!has_active)
busy = 0;
out:
spin_unlock_irqrestore(&m->lock, flags);
return busy;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* rpc_run_task - Allocate a new RPC task, then run rpc_execute against it @task_setup_data: pointer to task initialisation data */
|
struct rpc_task* rpc_run_task(const struct rpc_task_setup *task_setup_data)
|
/* rpc_run_task - Allocate a new RPC task, then run rpc_execute against it @task_setup_data: pointer to task initialisation data */
struct rpc_task* rpc_run_task(const struct rpc_task_setup *task_setup_data)
|
{
struct rpc_task *task, *ret;
task = rpc_new_task(task_setup_data);
if (task == NULL) {
rpc_release_calldata(task_setup_data->callback_ops,
task_setup_data->callback_data);
ret = ERR_PTR(-ENOMEM);
goto out;
}
if (task->tk_status != 0) {
ret = ERR_PTR(task->tk_status);
rpc_put_task(task);
goto out;
}
atomic_inc(&task->tk_count);
rpc_execute(task);
ret = task;
out:
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Waits until a new conversion result is available. */
|
int32_t ad7124_wait_for_conv_ready(struct ad7124_dev *dev, uint32_t timeout)
|
/* Waits until a new conversion result is available. */
int32_t ad7124_wait_for_conv_ready(struct ad7124_dev *dev, uint32_t timeout)
|
{
struct ad7124_st_reg *regs;
int32_t ret;
int8_t ready = 0;
if(!dev)
return INVALID_VAL;
regs = dev->regs;
while(!ready && --timeout) {
ret = ad7124_read_register(dev, ®s[AD7124_Status]);
if(ret < 0)
return ret;
ready = (regs[AD7124_Status].value &
AD7124_STATUS_REG_RDY) == 0;
}
return timeout ? 0 : TIMEOUT;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Just allocate a new mode, copy the existing mode into it, and return a pointer to it. Used to create new instances of established modes. */
|
struct drm_display_mode* drm_mode_duplicate(struct drm_device *dev, struct drm_display_mode *mode)
|
/* Just allocate a new mode, copy the existing mode into it, and return a pointer to it. Used to create new instances of established modes. */
struct drm_display_mode* drm_mode_duplicate(struct drm_device *dev, struct drm_display_mode *mode)
|
{
struct drm_display_mode *nmode;
int new_id;
nmode = drm_mode_create(dev);
if (!nmode)
return NULL;
new_id = nmode->base.id;
*nmode = *mode;
nmode->base.id = new_id;
INIT_LIST_HEAD(&nmode->head);
return nmode;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable or disable the buffer interval response function of TMR4 event. */
|
void TMR4_EVT_BufIntervalResponseCmd(CM_TMR4_TypeDef *TMR4x, uint32_t u32Ch, en_functional_state_t enNewState)
|
/* Enable or disable the buffer interval response function of TMR4 event. */
void TMR4_EVT_BufIntervalResponseCmd(CM_TMR4_TypeDef *TMR4x, uint32_t u32Ch, en_functional_state_t enNewState)
|
{
__IO uint16_t *SCSR;
DDL_ASSERT(IS_TMR4_UNIT(TMR4x));
DDL_ASSERT(IS_TMR4_EVT_CH(u32Ch));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
SCSR = TMR4_SCSR(TMR4x, u32Ch);
if (ENABLE == enNewState) {
SET_REG16_BIT(*SCSR, TMR4_SCSR_LMC);
} else {
CLR_REG16_BIT(*SCSR, TMR4_SCSR_LMC);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* It's also responsible for power management interactions. Some configurations might not work with our current power sources. For now we just assume the gadget is always self-powered. */
|
static int do_set_config(struct fsg_dev *fsg, u8 new_config)
|
/* It's also responsible for power management interactions. Some configurations might not work with our current power sources. For now we just assume the gadget is always self-powered. */
static int do_set_config(struct fsg_dev *fsg, u8 new_config)
|
{
int rc = 0;
if (fsg->config != 0) {
DBG(fsg, "reset config\n");
fsg->config = 0;
rc = do_set_interface(fsg, -1);
}
if (new_config != 0) {
fsg->config = new_config;
if ((rc = do_set_interface(fsg, 0)) != 0)
fsg->config = 0;
else {
char *speed;
switch (fsg->gadget->speed) {
case USB_SPEED_LOW: speed = "low"; break;
case USB_SPEED_FULL: speed = "full"; break;
case USB_SPEED_HIGH: speed = "high"; break;
default: speed = "?"; break;
}
INFO(fsg, "%s speed config #%d\n", speed, fsg->config);
}
}
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called during the final close of a tty or a pty pair in order to shut down the line discpline layer. On exit, each tty's ldisc is NULL. */
|
void tty_ldisc_release(struct tty_struct *tty)
|
/* Called during the final close of a tty or a pty pair in order to shut down the line discpline layer. On exit, each tty's ldisc is NULL. */
void tty_ldisc_release(struct tty_struct *tty)
|
{
struct tty_struct *o_tty = tty->other_struct;
tty_ldisc_kill(tty);
if (o_tty)
{
tty_ldisc_kill(o_tty);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Autosleep. When set to 1, autosleep is enabled, and the device enters wake-up mode automatically upon detection of inactivity. */
|
static int adxl372_set_autosleep(const struct device *dev, bool enable)
|
/* Autosleep. When set to 1, autosleep is enabled, and the device enters wake-up mode automatically upon detection of inactivity. */
static int adxl372_set_autosleep(const struct device *dev, bool enable)
|
{
struct adxl372_data *data = dev->data;
return data->hw_tf->write_reg_mask(dev, ADXL372_MEASURE,
ADXL372_MEASURE_AUTOSLEEP_MSK,
ADXL372_MEASURE_AUTOSLEEP_MODE(enable));
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Disable Carrier sense. When Disabled GMAC ignores CRS signal during frame transmission in half duplex mode. */
|
void synopGMAC_disable_crs(synopGMACdevice *gmacdev)
|
/* Disable Carrier sense. When Disabled GMAC ignores CRS signal during frame transmission in half duplex mode. */
void synopGMAC_disable_crs(synopGMACdevice *gmacdev)
|
{
synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDisableCrs);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* s e t u p A l l I n a c t i v e */
|
returnValue Constraints_setupAllInactive(Constraints *_THIS)
|
/* s e t u p A l l I n a c t i v e */
returnValue Constraints_setupAllInactive(Constraints *_THIS)
|
{
return Constraints_setupAll( _THIS,ST_INACTIVE );
}
|
DanielMartensson/EmbeddedLapack
|
C++
|
MIT License
| 129
|
/* gfs2_meta_syncfs - sync all the buffers in a filesystem @sdp: the filesystem */
|
void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
|
/* gfs2_meta_syncfs - sync all the buffers in a filesystem @sdp: the filesystem */
void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
|
{
gfs2_log_flush(sdp, NULL);
for (;;) {
gfs2_ail1_start(sdp, DIO_ALL);
if (gfs2_ail1_empty(sdp, DIO_ALL))
break;
msleep(10);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* getmiso: Why do we return 0 when the SIO line is high and vice-versa? The fact is, the lm70 eval board from NS (which this driver drives), is wired in just such a way : when the lm70's SIO goes high, a transistor switches it to low reflecting this on the parport (pin 13), and vice-versa. */
|
static int getmiso(struct spi_device *s)
|
/* getmiso: Why do we return 0 when the SIO line is high and vice-versa? The fact is, the lm70 eval board from NS (which this driver drives), is wired in just such a way : when the lm70's SIO goes high, a transistor switches it to low reflecting this on the parport (pin 13), and vice-versa. */
static int getmiso(struct spi_device *s)
|
{
struct spi_lm70llp *pp = spidev_to_pp(s);
return ((SIO == (parport_read_status(pp->port) & SIO)) ? 0 : 1 );
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Parsing for fps, which can be a fraction. Unfortunately, the spec for the header leaves out a lot of details, so this is mostly guessing. */
|
static AVRational read_fps(const char *line, int *error)
|
/* Parsing for fps, which can be a fraction. Unfortunately, the spec for the header leaves out a lot of details, so this is mostly guessing. */
static AVRational read_fps(const char *line, int *error)
|
{
int64_t num, den = 1;
AVRational result;
num = read_int(line, &line, error);
if (*line == '.')
line++;
for (; *line>='0' && *line<='9'; line++) {
if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
break;
num = 10 * num + *line - '0';
den *= 10;
}
if (!num)
*error = -1;
av_reduce(&result.num, &result.den, num, den, 0x7FFFFFFF);
return result;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Growl notification callback. Pointer to a function delivering growl events. */
|
void GrowlCb(uint8_t u8Code, uint8_t u8ClientID)
|
/* Growl notification callback. Pointer to a function delivering growl events. */
void GrowlCb(uint8_t u8Code, uint8_t u8ClientID)
|
{
printf("Growl CB : %d \r\n", u8Code);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* mtd_ooblayout_free - Get the OOB region definition of a specific free section @mtd: MTD device structure */
|
int mtd_ooblayout_free(struct mtd_info *mtd, int section, struct mtd_oob_region *oobfree)
|
/* mtd_ooblayout_free - Get the OOB region definition of a specific free section @mtd: MTD device structure */
int mtd_ooblayout_free(struct mtd_info *mtd, int section, struct mtd_oob_region *oobfree)
|
{
memset(oobfree, 0, sizeof(*oobfree));
if (!mtd || section < 0)
return -EINVAL;
if (!mtd->ooblayout || !mtd->ooblayout->free)
return -ENOTSUPP;
return mtd->ooblayout->free(mtd, section, oobfree);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function finally enables all IOMMUs found in the system after they have been initialized */
|
static void enable_iommus(void)
|
/* This function finally enables all IOMMUs found in the system after they have been initialized */
static void enable_iommus(void)
|
{
struct amd_iommu *iommu;
for_each_iommu(iommu) {
iommu_disable(iommu);
iommu_set_device_table(iommu);
iommu_enable_command_buffer(iommu);
iommu_enable_event_buffer(iommu);
iommu_set_exclusion_range(iommu);
iommu_init_msi(iommu);
iommu_enable(iommu);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Converts a 2 digit decimal to BCD format. */
|
u8 RTC_ByteToBcd2(u8 Value)
|
/* Converts a 2 digit decimal to BCD format. */
u8 RTC_ByteToBcd2(u8 Value)
|
{
u8 bcdhigh = 0;
while (Value >= 10) {
bcdhigh++;
Value -= 10;
}
return ((u8)(bcdhigh << 4) | Value);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* 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)
|
{
if (irq_p >= N_IRQS) {
posix_print_error_and_exit("Attempted to configure not existent interrupt %u\n",
irq_p);
return;
}
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
|
/* If no more slots are available, place the task on the transport's backlog queue. */
|
void xprt_reserve(struct rpc_task *task)
|
/* If no more slots are available, place the task on the transport's backlog queue. */
void xprt_reserve(struct rpc_task *task)
|
{
struct rpc_xprt *xprt = task->tk_xprt;
task->tk_status = -EIO;
spin_lock(&xprt->reserve_lock);
do_xprt_reserve(task);
spin_unlock(&xprt->reserve_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Description: Searches the unlabeled connection hash table and returns a pointer to the interface entry which matches @ifindex, otherwise NULL is returned. The caller is responsible for calling the rcu_read_lock() functions. */
|
static struct netlbl_unlhsh_iface* netlbl_unlhsh_search_iface(int ifindex)
|
/* Description: Searches the unlabeled connection hash table and returns a pointer to the interface entry which matches @ifindex, otherwise NULL is returned. The caller is responsible for calling the rcu_read_lock() functions. */
static struct netlbl_unlhsh_iface* netlbl_unlhsh_search_iface(int ifindex)
|
{
u32 bkt;
struct list_head *bkt_list;
struct netlbl_unlhsh_iface *iter;
bkt = netlbl_unlhsh_hash(ifindex);
bkt_list = &rcu_dereference(netlbl_unlhsh)->tbl[bkt];
list_for_each_entry_rcu(iter, bkt_list, list)
if (iter->valid && iter->ifindex == ifindex)
return iter;
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* ks_wrreg8 - write 8bit register value to chip @ks: The chip information @offset: The register address @value: The value to write */
|
static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
|
/* ks_wrreg8 - write 8bit register value to chip @ks: The chip information @offset: The register address @value: The value to write */
static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
|
{
u8 shift_bit = (offset & 0x03);
u16 value_write = (u16)(value << ((offset & 1) << 3));
ks->cmd_reg_cache = (u16)offset | (BE0 << shift_bit);
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
iowrite16(value_write, ks->hw_addr);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base PXP peripheral base address. retval kStatus_Success Successfully started the copy process. retval kStatus_InvalidArgument Invalid argument. */
|
status_t PXP_StartMemCopy(PXP_Type *base, uint32_t srcAddr, uint32_t destAddr, uint32_t size)
|
/* param base PXP peripheral base address. retval kStatus_Success Successfully started the copy process. retval kStatus_InvalidArgument Invalid argument. */
status_t PXP_StartMemCopy(PXP_Type *base, uint32_t srcAddr, uint32_t destAddr, uint32_t size)
|
{
uint16_t pitchBytes;
uint32_t height;
if ((0U == size) || ((size % 512U) != 0U))
{
return kStatus_InvalidArgument;
}
if (size < 8U * 512U)
{
height = 8U;
pitchBytes = (uint16_t)(size / height);
}
else
{
pitchBytes = 512U;
height = size / pitchBytes;
}
if (height > PXP_MAX_HEIGHT)
{
return kStatus_InvalidArgument;
}
PXP_StartRectCopy(base, srcAddr, pitchBytes, destAddr, pitchBytes, pitchBytes / 4U, (uint16_t)height,
kPXP_AsPixelFormatARGB8888);
return kStatus_Success;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Redirects an Fclose request.
Redirects an Fclose request to the appropriate handler based on the specified file handle. */
|
RtStatus_t Fclose(int32_t handleNumber)
|
/* Redirects an Fclose request.
Redirects an Fclose request to the appropriate handler based on the specified file handle. */
RtStatus_t Fclose(int32_t handleNumber)
|
{
RtStatus_t result = ERROR_OS_FILESYSTEM_NO_STEERING_FUNCTION;
FsType_t type;
Fclose_t function;
type = FileSystemType(handleNumber);
function = pRedirectFclose[type];
if (function != NULL) {
result = function(handleNumber);
}
totalFileOpened--;
fatCacheRelease(NULL);
return result;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Check the driver configuration if it's TRUE double buffered (both */
|
bool lv_disp_is_true_double_buf(lv_disp_t *disp)
|
/* Check the driver configuration if it's TRUE double buffered (both */
bool lv_disp_is_true_double_buf(lv_disp_t *disp)
|
{
uint32_t scr_size = disp->driver.hor_res * disp->driver.ver_res;
if(lv_disp_is_double_buf(disp) && disp->driver.buffer->size == scr_size) {
return true;
} else {
return false;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Sets the end address of an area.
Needs the I2C Password presentation to be effective. */
|
int32_t BSP_NFCTAG_WriteEndZonex(uint32_t Instance, const ST25DV_END_ZONE EndZone, const uint8_t EndZ)
|
/* Sets the end address of an area.
Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteEndZonex(uint32_t Instance, const ST25DV_END_ZONE EndZone, const uint8_t EndZ)
|
{
UNUSED(Instance);
return ST25DV_WriteEndZonex(&NfcTagObj, EndZone, EndZ);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* This is only for internal list manipulation where we know the prev/next entries already! */
|
void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next)
|
/* This is only for internal list manipulation where we know the prev/next entries already! */
void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next)
|
{
WARN(next->prev != prev,
"list_add corruption. next->prev should be "
"prev (%p), but was %p. (next=%p).\n",
prev, next->prev, next);
WARN(prev->next != next,
"list_add corruption. prev->next should be "
"next (%p), but was %p. (prev=%p).\n",
next, prev->next, prev);
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application start key has been loaded into MagicBootKey. If the bootloader started via the watchdog and the key is valid, this will force the user application to start via a software jump. */
|
void Application_Jump_Check(void)
|
/* Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application start key has been loaded into MagicBootKey. If the bootloader started via the watchdog and the key is valid, this will force the user application to start via a software jump. */
void Application_Jump_Check(void)
|
{
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
{
MCUSR &= ~(1 << WDRF);
wdt_disable();
MagicBootKey = 0;
((void (*)(void))0x0000)();
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
|
UINT64 EFIAPI CalculateSum64(IN CONST UINT64 *Buffer, IN UINTN Length)
|
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 64-bit boundary, then ASSERT(). If Length is not aligned on a 64-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT64 EFIAPI CalculateSum64(IN CONST UINT64 *Buffer, IN UINTN Length)
|
{
UINT64 Sum;
UINTN Count;
UINTN Total;
ASSERT (Buffer != NULL);
ASSERT (((UINTN)Buffer & 0x7) == 0);
ASSERT ((Length & 0x7) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN)Buffer) + 1));
Total = Length / sizeof (*Buffer);
for (Sum = 0, Count = 0; Count < Total; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disables Receive Own bit (Only in Half Duplex Mode). When enaled GMAC disables the reception of frames when gmii_txen_o is asserted. */
|
void synopGMAC_rx_own_disable(synopGMACdevice *gmacdev)
|
/* Disables Receive Own bit (Only in Half Duplex Mode). When enaled GMAC disables the reception of frames when gmii_txen_o is asserted. */
void synopGMAC_rx_own_disable(synopGMACdevice *gmacdev)
|
{
synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRxOwn);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* m o v e F i x e d T o F r e e */
|
returnValue Bounds_moveFixedToFree(Bounds *_THIS, int number)
|
/* m o v e F i x e d T o F r e e */
returnValue Bounds_moveFixedToFree(Bounds *_THIS, int number)
|
{
if ( ( number < 0 ) || ( number >= _THIS->n ) )
return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
if ( Bounds_removeIndex( _THIS,Bounds_getFixed( _THIS ),number ) != SUCCESSFUL_RETURN )
return THROWERROR( RET_MOVING_BOUND_FAILED );
if ( Bounds_addIndex( _THIS,Bounds_getFree( _THIS ),number,ST_INACTIVE ) != SUCCESSFUL_RETURN )
return THROWERROR( RET_MOVING_BOUND_FAILED );
return SUCCESSFUL_RETURN;
}
|
DanielMartensson/EmbeddedLapack
|
C++
|
MIT License
| 129
|
/* Reads and returns the current value of MM5. This function is only available on IA-32 and x64. */
|
UINT64 EFIAPI AsmReadMm5(VOID)
|
/* Reads and returns the current value of MM5. This function is only available on IA-32 and x64. */
UINT64 EFIAPI AsmReadMm5(VOID)
|
{
_asm {
push eax
push eax
movq [esp], mm5
pop eax
pop edx
emms
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns zero and the pfn at @pfn on success, -ve otherwise. */
|
int follow_pfn(struct vm_area_struct *vma, unsigned long address, unsigned long *pfn)
|
/* Returns zero and the pfn at @pfn on success, -ve otherwise. */
int follow_pfn(struct vm_area_struct *vma, unsigned long address, unsigned long *pfn)
|
{
if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
return -EINVAL;
*pfn = address >> PAGE_SHIFT;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: a newly-allocated string, with all the upper case characters in @str converted to lower case, with semantics that exactly match g_ascii_tolower(). (Note that this is unlike the old g_strdown(), which modified the string in place.) */
|
gchar* g_ascii_strdown(const gchar *str, gssize len)
|
/* Returns: a newly-allocated string, with all the upper case characters in @str converted to lower case, with semantics that exactly match g_ascii_tolower(). (Note that this is unlike the old g_strdown(), which modified the string in place.) */
gchar* g_ascii_strdown(const gchar *str, gssize len)
|
{
gchar *result, *s;
g_return_val_if_fail (str != NULL, NULL);
if (len < 0)
len = strlen (str);
result = g_strndup (str, len);
for (s = result; *s; s++)
*s = g_ascii_tolower (*s);
return result;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Attach task with pid 'pid' to cgroup 'cgrp'. Call with cgroup_mutex held. May take task_lock of task */
|
static int attach_task_by_pid(struct cgroup *cgrp, u64 pid)
|
/* Attach task with pid 'pid' to cgroup 'cgrp'. Call with cgroup_mutex held. May take task_lock of task */
static int attach_task_by_pid(struct cgroup *cgrp, u64 pid)
|
{
struct task_struct *tsk;
const struct cred *cred = current_cred(), *tcred;
int ret;
if (pid) {
rcu_read_lock();
tsk = find_task_by_vpid(pid);
if (!tsk || tsk->flags & PF_EXITING) {
rcu_read_unlock();
return -ESRCH;
}
tcred = __task_cred(tsk);
if (cred->euid &&
cred->euid != tcred->uid &&
cred->euid != tcred->suid) {
rcu_read_unlock();
return -EACCES;
}
get_task_struct(tsk);
rcu_read_unlock();
} else {
tsk = current;
get_task_struct(tsk);
}
ret = cgroup_attach_task(cgrp, tsk);
put_task_struct(tsk);
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base FlexCAN peripheral base pointer. param rxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Read Message from Rx FIFO successfully. retval kStatus_Fail - Rx FIFO is not enabled. */
|
status_t FLEXCAN_TransferReceiveFifoBlocking(CAN_Type *base, flexcan_frame_t *rxFrame)
|
/* param base FlexCAN peripheral base pointer. param rxFrame Pointer to CAN message frame structure for reception. retval kStatus_Success - Read Message from Rx FIFO successfully. retval kStatus_Fail - Rx FIFO is not enabled. */
status_t FLEXCAN_TransferReceiveFifoBlocking(CAN_Type *base, flexcan_frame_t *rxFrame)
|
{
status_t rxFifoStatus;
while (0U == FLEXCAN_GetMbStatusFlags(base, (uint32_t)kFLEXCAN_RxFifoFrameAvlFlag))
{
}
rxFifoStatus = FLEXCAN_ReadRxFifo(base, rxFrame);
FLEXCAN_ClearMbStatusFlags(base, (uint32_t)kFLEXCAN_RxFifoFrameAvlFlag);
return rxFifoStatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Reads the input data of specified GPIO port pin. */
|
bool GPIO_ReadInputDataBit(GPIO_TypeDef *gpio, u16 pin)
|
/* Reads the input data of specified GPIO port pin. */
bool GPIO_ReadInputDataBit(GPIO_TypeDef *gpio, u16 pin)
|
{
return ((gpio->IDR & pin)) ? Bit_SET : Bit_RESET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* STUSB1602 Checks Attach State Transition Reg (Bit0 0x0D */
|
Attach_State_Trans_TypeDef STUSB1602_Attach_State_Trans_Get(uint8_t Addr)
|
/* STUSB1602 Checks Attach State Transition Reg (Bit0 0x0D */
Attach_State_Trans_TypeDef STUSB1602_Attach_State_Trans_Get(uint8_t Addr)
|
{
STUSB1602_CC_DETECTION_STATUS_TRANS_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_DETECTION_STATUS_TRANS_REG, 1);
return (Attach_State_Trans_TypeDef)(reg.b.ATTACH_STATE_TRANS);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* @desc: GPIO descriptor to initialize @dev: GPIO device @offset: Offset of device GPIO */
|
static void gpio_desc_init(struct gpio_desc *desc, struct udevice *dev, uint offset)
|
/* @desc: GPIO descriptor to initialize @dev: GPIO device @offset: Offset of device GPIO */
static void gpio_desc_init(struct gpio_desc *desc, struct udevice *dev, uint offset)
|
{
desc->dev = dev;
desc->offset = offset;
desc->flags = 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This file is part of the Simba project. */
|
int mock_write_upgrade_module_init(int res)
|
/* This file is part of the Simba project. */
int mock_write_upgrade_module_init(int res)
|
{
harness_mock_write("upgrade_module_init()",
NULL,
0);
harness_mock_write("upgrade_module_init(): return (res)",
&res,
sizeof(res));
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Look down the chain to find the matching Device Device */
|
static struct device_node* find_device_node(int bus, int devfn)
|
/* Look down the chain to find the matching Device Device */
static struct device_node* find_device_node(int bus, int devfn)
|
{
struct device_node *node;
for (node = NULL; (node = of_find_all_nodes(node)); ) {
struct pci_dn *pdn = PCI_DN(node);
if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
return node;
}
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function checks to see if the last memory map descriptor in a memory map can be merged with any of the other memory map descriptors in a memorymap. Memory descriptors may be merged if they are adjacent and have the same type and attributes. */
|
EFI_MEMORY_DESCRIPTOR* MergeMemoryMapDescriptor(IN EFI_MEMORY_DESCRIPTOR *MemoryMap, IN EFI_MEMORY_DESCRIPTOR *MemoryMapDescriptor, IN UINTN DescriptorSize)
|
/* This function checks to see if the last memory map descriptor in a memory map can be merged with any of the other memory map descriptors in a memorymap. Memory descriptors may be merged if they are adjacent and have the same type and attributes. */
EFI_MEMORY_DESCRIPTOR* MergeMemoryMapDescriptor(IN EFI_MEMORY_DESCRIPTOR *MemoryMap, IN EFI_MEMORY_DESCRIPTOR *MemoryMapDescriptor, IN UINTN DescriptorSize)
|
{
for ( ; MemoryMap != MemoryMapDescriptor; MemoryMap = NEXT_MEMORY_DESCRIPTOR (MemoryMap, DescriptorSize)) {
if (MemoryMap->Type != MemoryMapDescriptor->Type) {
continue;
}
if (MemoryMap->Attribute != MemoryMapDescriptor->Attribute) {
continue;
}
if (MemoryMap->PhysicalStart + EFI_PAGES_TO_SIZE ((UINTN)MemoryMap->NumberOfPages) == MemoryMapDescriptor->PhysicalStart) {
MemoryMap->NumberOfPages += MemoryMapDescriptor->NumberOfPages;
return MemoryMapDescriptor;
}
if (MemoryMap->PhysicalStart - EFI_PAGES_TO_SIZE ((UINTN)MemoryMapDescriptor->NumberOfPages) == MemoryMapDescriptor->PhysicalStart) {
MemoryMap->PhysicalStart = MemoryMapDescriptor->PhysicalStart;
MemoryMap->VirtualStart = MemoryMapDescriptor->VirtualStart;
MemoryMap->NumberOfPages += MemoryMapDescriptor->NumberOfPages;
return MemoryMapDescriptor;
}
}
return NEXT_MEMORY_DESCRIPTOR (MemoryMapDescriptor, DescriptorSize);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Integrator AP has two UARTs, we use the first one, at 38400-8-N-1 Integrator CP has two UARTs, use the first one, at 38400-8-N-1 Versatile PB has four UARTs. */
|
int pl01x_serial_init(void)
|
/* Integrator AP has two UARTs, we use the first one, at 38400-8-N-1 Integrator CP has two UARTs, use the first one, at 38400-8-N-1 Versatile PB has four UARTs. */
int pl01x_serial_init(void)
|
{
pl01x_serial_init_baud(CONFIG_BAUDRATE);
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f' */
|
static void clearvalues(global_State *g, GCObject *l, GCObject *f)
|
/* clear entries with unmarked values from all weaktables in list 'l' up to element 'f' */
static void clearvalues(global_State *g, GCObject *l, GCObject *f)
|
{
Table *h = gco2t(l);
Node *n, *limit = gnodelast(h);
int i;
for (i = 0; i < h->sizearray; i++) {
TValue *o = &h->array[i];
if (iscleared(g, o))
setnilvalue(o);
}
for (n = gnode(h, 0); n < limit; n++) {
if (!ttisnil(gval(n)) && iscleared(g, gval(n))) {
setnilvalue(gval(n));
removeentry(n);
}
}
}
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* go through the driver hba list and for each hba, release any resource held. and unregisters iscsi transport and the cxgb3 module */
|
static void __exit cxgb3i_exit_module(void)
|
/* go through the driver hba list and for each hba, release any resource held. and unregisters iscsi transport and the cxgb3 module */
static void __exit cxgb3i_exit_module(void)
|
{
cxgb3_unregister_client(&t3c_client);
cxgb3i_pdu_cleanup();
cxgb3i_iscsi_cleanup();
cxgb3i_sdev_cleanup();
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable the Capture input of the PWM module.
The */
|
void PWMCAPInputEnable(unsigned long ulBase, unsigned long ulChannel)
|
/* Enable the Capture input of the PWM module.
The */
void PWMCAPInputEnable(unsigned long ulBase, unsigned long ulChannel)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xHWREG(ulBase + PWM_CAPENR) |= (PWM_CAPENR_CAPIE_0 << (ulChannelTemp));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Implementation of fputc using the DBGU as the standard output. Required for printf(). Returns the character written if successful, or -1 if the output stream is not stdout or stderr. */
|
signed int fputc(signed int c, FILE *pStream)
|
/* Implementation of fputc using the DBGU as the standard output. Required for printf(). Returns the character written if successful, or -1 if the output stream is not stdout or stderr. */
signed int fputc(signed int c, FILE *pStream)
|
{
if ((pStream == stdout) || (pStream == stderr)) {
DBGU_PutChar(c);
return c;
}
else {
return EOF;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* The caller is responsible to stop the host from using this ring before invoking this function: the VSTAT_DRIVER_OK bit must be clear in VhdrDeviceStatus. */
|
VOID EFIAPI VirtioRingUninit(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN OUT VRING *Ring)
|
/* The caller is responsible to stop the host from using this ring before invoking this function: the VSTAT_DRIVER_OK bit must be clear in VhdrDeviceStatus. */
VOID EFIAPI VirtioRingUninit(IN VIRTIO_DEVICE_PROTOCOL *VirtIo, IN OUT VRING *Ring)
|
{
VirtIo->FreeSharedPages (VirtIo, Ring->NumPages, Ring->Base);
SetMem (Ring, sizeof *Ring, 0x00);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function sends rpmsg "message" to remote device. */
|
int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src, uint32_t dst, const void *data, int size, int wait)
|
/* This function sends rpmsg "message" to remote device. */
int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src, uint32_t dst, const void *data, int size, int wait)
|
{
struct rpmsg_device *rdev;
if (!ept || !ept->rdev || !data || dst == RPMSG_ADDR_ANY)
return RPMSG_ERR_PARAM;
rdev = ept->rdev;
if (rdev->ops.send_offchannel_raw)
return rdev->ops.send_offchannel_raw(rdev, src, dst, data,
size, wait);
return RPMSG_ERR_PARAM;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Allocate @buffer->page if it hasn't been already, then copy the user-supplied buffer into it. */
|
static int fill_write_buffer(struct configfs_buffer *buffer, const char __user *buf, size_t count)
|
/* Allocate @buffer->page if it hasn't been already, then copy the user-supplied buffer into it. */
static int fill_write_buffer(struct configfs_buffer *buffer, const char __user *buf, size_t count)
|
{
int error;
if (!buffer->page)
buffer->page = (char *)__get_free_pages(GFP_KERNEL, 0);
if (!buffer->page)
return -ENOMEM;
if (count >= SIMPLE_ATTR_SIZE)
count = SIMPLE_ATTR_SIZE - 1;
error = copy_from_user(buffer->page,buf,count);
buffer->needs_read_fill = 1;
buffer->page[count] = 0;
return error ? -EFAULT : count;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Failure to call this function after a reset may lead to incorrect operation or permanent data loss if the EEPROM is later written. */
|
uint32_t EEPROMInit(void)
|
/* Failure to call this function after a reset may lead to incorrect operation or permanent data loss if the EEPROM is later written. */
uint32_t EEPROMInit(void)
|
{
uint32_t ui32Status;
SysCtlDelay(2);
_EEPROMWaitForDone();
ui32Status = HWREG(EEPROM_EESUPP);
if(ui32Status & (EEPROM_EESUPP_PRETRY | EEPROM_EESUPP_ERETRY))
{
return(EEPROM_INIT_ERROR);
}
SysCtlPeripheralReset(SYSCTL_PERIPH_EEPROM0);
SysCtlDelay(2);
_EEPROMWaitForDone();
ui32Status = HWREG(EEPROM_EESUPP);
if(ui32Status & (EEPROM_EESUPP_PRETRY | EEPROM_EESUPP_ERETRY))
{
return(EEPROM_INIT_ERROR);
}
return(EEPROM_INIT_OK);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The bootstrap configuration provides default settings for the pci inbound map (PIM). But the bootstrap config choices are limited and may not be sufficient for a given board. Override weak default pci_master_init() */
|
static void wait_for_pci_ready(void)
|
/* The bootstrap configuration provides default settings for the pci inbound map (PIM). But the bootstrap config choices are limited and may not be sufficient for a given board. Override weak default pci_master_init() */
static void wait_for_pci_ready(void)
|
{
int i;
char *s = getenv("pcidelay");
if (s) {
int ms = simple_strtoul(s, NULL, 10);
printf("PCI: Waiting for %d ms\n", ms);
for (i=0; i<ms; i++)
udelay(1000);
}
if (!(in_be32((void*)GPIO1_IR) & GPIO1_PPC_EREADY)) {
printf("PCI: Waiting for EREADY (CTRL-C to skip) ... ");
while (1) {
if (ctrlc()) {
puts("abort\n");
break;
}
if (in_be32((void*)GPIO1_IR) & GPIO1_PPC_EREADY) {
printf("done\n");
break;
}
}
}
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Check whether the sequence number of the incoming segment is acceptable. */
|
INTN TcpSeqAcceptable(IN TCP_CB *Tcb, IN TCP_SEG *Seg)
|
/* Check whether the sequence number of the incoming segment is acceptable. */
INTN TcpSeqAcceptable(IN TCP_CB *Tcb, IN TCP_SEG *Seg)
|
{
return (TCP_SEQ_LEQ (Tcb->RcvNxt, Seg->End) &&
TCP_SEQ_LT (Seg->Seq, Tcb->RcvWl2 + Tcb->RcvWnd));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* OPEN_EXPIRED: reclaim state on the server after a network partition. Assumes caller holds the appropriate lock */
|
static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state)
|
/* OPEN_EXPIRED: reclaim state on the server after a network partition. Assumes caller holds the appropriate lock */
static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state)
|
{
struct nfs4_opendata *opendata;
int ret;
opendata = nfs4_open_recoverdata_alloc(ctx, state);
if (IS_ERR(opendata))
return PTR_ERR(opendata);
ret = nfs4_open_recover(opendata, state);
if (ret == -ESTALE)
d_drop(ctx->path.dentry);
nfs4_opendata_put(opendata);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ipr_ioctl - IOCTL handler @sdev: scsi device struct @cmd: IOCTL cmd */
|
static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
|
/* ipr_ioctl - IOCTL handler @sdev: scsi device struct @cmd: IOCTL cmd */
static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
|
{
struct ipr_resource_entry *res;
res = (struct ipr_resource_entry *)sdev->hostdata;
if (res && ipr_is_gata(res)) {
if (cmd == HDIO_GET_IDENTITY)
return -ENOTTY;
return ata_sas_scsi_ioctl(res->sata_port->ap, sdev, cmd, arg);
}
return -EINVAL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* poll the DMA transmission/reception enable by writing any value to the ENET_DMA_TPEN/ENET_DMA_RPEN register, this will make the DMA to resume transmission/reception */
|
void enet_dmaprocess_resume(enet_dmadirection_enum direction)
|
/* poll the DMA transmission/reception enable by writing any value to the ENET_DMA_TPEN/ENET_DMA_RPEN register, this will make the DMA to resume transmission/reception */
void enet_dmaprocess_resume(enet_dmadirection_enum direction)
|
{
if(ENET_DMA_TX == direction) {
ENET_DMA_TPEN = 0U;
} else {
ENET_DMA_RPEN = 0U;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This service enables PEIMs to allocate memory after the permanent memory has been installed by a PEIM. */
|
EFI_STATUS EFIAPI PeiServicesAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
|
/* This service enables PEIMs to allocate memory after the permanent memory has been installed by a PEIM. */
EFI_STATUS EFIAPI PeiServicesAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
|
{
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get Word2 of the unique device identifier (UID based on 96 bits) */
|
uint32_t LL_GetUID_Word2(void)
|
/* Get Word2 of the unique device identifier (UID based on 96 bits) */
uint32_t LL_GetUID_Word2(void)
|
{
return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 0x14U))));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* brief Return PLL0 output clock rate from setup structure param pSetup : Pointer to a PLL setup structure return PLL0 output clock rate the setup structure will generate */
|
uint32_t CLOCK_GetPLL0OutFromSetup(pll_setup_t *pSetup)
|
/* brief Return PLL0 output clock rate from setup structure param pSetup : Pointer to a PLL setup structure return PLL0 output clock rate the setup structure will generate */
uint32_t CLOCK_GetPLL0OutFromSetup(pll_setup_t *pSetup)
|
{
uint32_t clkRate = 0;
uint32_t prediv, postdiv;
float workRate = 0.0F;
clkRate = CLOCK_GetPLL0InClockRate();
if (((pSetup->pllctrl & SYSCON_PLL0CTRL_BYPASSPLL_MASK) == 0UL) &&
((pSetup->pllctrl & SYSCON_PLL0CTRL_CLKEN_MASK) != 0UL) &&
((PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_PLL0_MASK) == 0UL) &&
((PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_PLL0_SSCG_MASK) == 0UL))
{
prediv = findPll0PreDiv();
postdiv = findPll0PostDiv();
clkRate = clkRate / prediv;
workRate = (float)clkRate * (float)findPll0MMult();
workRate /= (float)postdiv;
}
return (uint32_t)workRate;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Trigger the DAC by a Software Trigger.
If the trigger source is set to be a software trigger, cause a trigger to occur. The trigger is cleared by hardware after conversion. */
|
void dac_software_trigger(data_channel dac_channel)
|
/* Trigger the DAC by a Software Trigger.
If the trigger source is set to be a software trigger, cause a trigger to occur. The trigger is cleared by hardware after conversion. */
void dac_software_trigger(data_channel dac_channel)
|
{
switch (dac_channel) {
case CHANNEL_1:
DAC_SWTRIGR |= DAC_SWTRIGR_SWTRIG1;
break;
case CHANNEL_2:
DAC_SWTRIGR |= DAC_SWTRIGR_SWTRIG2;
break;
case CHANNEL_D:
DAC_SWTRIGR |= (DAC_SWTRIGR_SWTRIG1 | DAC_SWTRIGR_SWTRIG2);
break;
}
}
/**@}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Returns 0 if OK, -EOPNOTSUPP if udc driver doesn't handle D+ pullup */
|
static int pxa_udc_pullup(struct usb_gadget *_gadget, int is_active)
|
/* Returns 0 if OK, -EOPNOTSUPP if udc driver doesn't handle D+ pullup */
static int pxa_udc_pullup(struct usb_gadget *_gadget, int is_active)
|
{
struct pxa_udc *udc = to_gadget_udc(_gadget);
if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
return -EOPNOTSUPP;
dplus_pullup(udc, is_active);
if (should_enable_udc(udc))
udc_enable(udc);
if (should_disable_udc(udc))
udc_disable(udc);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Change Logs: Date Author Notes Bernard the first version for i386 */
|
uint32_t __umodsi3(uint32_t num, uint32_t den)
|
/* Change Logs: Date Author Notes Bernard the first version for i386 */
uint32_t __umodsi3(uint32_t num, uint32_t den)
|
{
register uint32_t quot = 0, qbit = 1;
if (den == 0)
{
asm volatile ("int $0");
return 0;
}
while ((int32_t) den >= 0)
{
den <<= 1;
qbit <<= 1;
}
while (qbit)
{
if (den <= num)
{
num -= den;
quot += qbit;
}
den >>= 1;
qbit >>= 1;
}
return num;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.