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 |
|---|---|---|---|---|---|---|---|
/* Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocatePages(IN UINTN Pages) | /* Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePages(IN UINTN Pages) | {
return InternalAllocatePages (EfiRuntimeServicesData, Pages);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the specified AUDIO SI peripheral. */ | void AUDIO_SI_Cmd(u8 new_state) | /* Enables or disables the specified AUDIO SI peripheral. */
void AUDIO_SI_Cmd(u8 new_state) | {
AUDIO_SI_TypeDef* SIx = AUDIO_SI_DEV;
if (new_state == ENABLE) {
SIx->SI_CTRLR &= ~ BIT_CTRLR_SI_DISABLE;
} else {
SIx->SI_CTRLR |= BIT_CTRLR_SI_DISABLE;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Enable the timer to start counting.
This should be called after the timer initial configuration has been completed. */ | void timer_enable_counter(uint32_t timer_peripheral) | /* Enable the timer to start counting.
This should be called after the timer initial configuration has been completed. */
void timer_enable_counter(uint32_t timer_peripheral) | {
TIM_CR1(timer_peripheral) |= TIM_CR1_CEN;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Read sensor device ID and revision numbers.
This function reads the sensor hardware identification registers and returns these values to the addresses specified in the function parameters. */ | static bool bmp_device_id(sensor_hal_t *hal, sensor_data_t *data) | /* Read sensor device ID and revision numbers.
This function reads the sensor hardware identification registers and returns these values to the addresses specified in the function parameters. */
static bool bmp_device_id(sensor_hal_t *hal, sensor_data_t *data) | {
data->device.id = (uint32_t)sensor_bus_get(hal, BMP_CHIP_ID);
data->device.version = (uint8_t)sensor_bus_get(hal, BMP_CHIP_VERSION);
return true;
} | memfault/zero-to-main | C++ | null | 200 |
/* Process function helper. Updates the ADC read register on the update timer interrupt. */ | static int32_t cn0414_process_update_adc(struct cn0414_dev *dev) | /* Process function helper. Updates the ADC read register on the update timer interrupt. */
static int32_t cn0414_process_update_adc(struct cn0414_dev *dev) | {
int32_t ret;
NVIC_DisableIRQ(TMR0_INT);
NVIC_DisableIRQ(HART_CD_INT);
ret = cn0414_read_channel(dev, dev->channel_index);
if((ret < 0) || (ret == 1))
goto finish;
if(dev->channel_index == IIN4)
dev->channel_index = VIN1;
else
dev->channel_index++;
adc_channel_flag = 0;
adc_sw_prescaler = 0;
finish:
NVIC_EnableIRQ(TMR0_INT);
NVIC_EnableIRQ(HART_CD_INT);
return ret;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* i8042_kbd_write() sends a byte out through the keyboard interface. */ | static int i8042_kbd_write(struct serio *port, unsigned char c) | /* i8042_kbd_write() sends a byte out through the keyboard interface. */
static int i8042_kbd_write(struct serio *port, unsigned char c) | {
unsigned long flags;
int retval = 0;
spin_lock_irqsave(&i8042_lock, flags);
if (!(retval = i8042_wait_write())) {
dbg("%02x -> i8042 (kbd-data)", c);
i8042_write_data(c);
}
spin_unlock_irqrestore(&i8042_lock, flags);
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check that fs_locations::fs_root is a prefix for what we believe to be the server path to this dentry */ | static int nfs4_validate_fspath(const struct vfsmount *mnt_parent, const struct dentry *dentry, const struct nfs4_fs_locations *locations, char *page, char *page2) | /* Check that fs_locations::fs_root is a prefix for what we believe to be the server path to this dentry */
static int nfs4_validate_fspath(const struct vfsmount *mnt_parent, const struct dentry *dentry, const struct nfs4_fs_locations *locations, char *page, char *page2) | {
const char *path, *fs_path;
path = nfs4_path(mnt_parent, dentry, page, PAGE_SIZE);
if (IS_ERR(path))
return PTR_ERR(path);
fs_path = nfs4_pathname_string(&locations->fs_path, page2, PAGE_SIZE);
if (IS_ERR(fs_path))
return PTR_ERR(fs_path);
if (strncmp(path, fs_path, strlen(fs_path)) != 0) {
dprintk("%s: path %s does not begin with fsroot %s\n",
__func__, path, fs_path);
return -ENOENT;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ServerEngines 209 N. Fair Oaks Ave Sunnyvale, CA 94085 */ | static void be_mcc_notify(struct be_adapter *adapter) | /* ServerEngines 209 N. Fair Oaks Ave Sunnyvale, CA 94085 */
static void be_mcc_notify(struct be_adapter *adapter) | {
struct be_queue_info *mccq = &adapter->mcc_obj.q;
u32 val = 0;
val |= mccq->id & DB_MCCQ_RING_ID_MASK;
val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
iowrite32(val, adapter->db + DB_MCCQ_OFFSET);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 if current has the requested access, error code otherwise */ | static int smack_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg) | /* Returns 0 if current has the requested access, error code otherwise */
static int smack_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg) | {
int may;
may = smack_flags_to_may(shmflg);
return smk_curacc_shm(shp, may);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If multiple processes watch the same inode with dnotify there is only one dnotify mark in inode->i_fsnotify_mark_entries but we chain a dnotify_struct onto that mark. This function either attaches the new dnotify_struct onto that list, or it |= the mask onto an existing dnofiy_struct. */ | static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnentry, fl_owner_t id, int fd, struct file *filp, __u32 mask) | /* If multiple processes watch the same inode with dnotify there is only one dnotify mark in inode->i_fsnotify_mark_entries but we chain a dnotify_struct onto that mark. This function either attaches the new dnotify_struct onto that list, or it |= the mask onto an existing dnofiy_struct. */
static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark_entry *dnentry, fl_owner_t id, int fd, struct file *filp, __u32 mask) | {
struct dnotify_struct *odn;
odn = dnentry->dn;
while (odn != NULL) {
if ((odn->dn_owner == id) && (odn->dn_filp == filp)) {
odn->dn_fd = fd;
odn->dn_mask |= mask;
return -EEXIST;
}
odn = odn->dn_next;
}
dn->dn_mask = mask;
dn->dn_fd = fd;
dn->dn_filp = filp;
dn->dn_owner = id;
dn->dn_next = dnentry->dn;
dnentry->dn = dn;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Change Logs: Date Author Notes Steven Liu the first version */ | int main(int argc, char **argv) | /* Change Logs: Date Author Notes Steven Liu the first version */
int main(int argc, char **argv) | {
rt_kprintf("Hello RK2108 RT-Thread!\n");
return RT_EOK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Retargets the C library printf function to the USART. */ | int fputc(int ch, FILE *f) | /* Retargets the C library printf function to the USART. */
int fputc(int ch, FILE *f) | {
static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START;
static unsigned portCHAR ucLine = 0;
if( ( usColumn == 0 ) && ( ucLine == 0 ) )
{
LCD_Clear();
}
if( ch != '\n' )
{
LCD_DisplayChar( ucLine, usRefColumn, (u8) ch );
usRefColumn -= mainCOLUMN_INCREMENT;
usColumn++;
if( usColumn == mainMAX_COLUMN )
{
ucLine += mainROW_INCREMENT;
usRefColumn = mainCOLUMN_START;
usColumn = 0;
}
}
else
{
ucLine += mainROW_INCREMENT;
usRefColumn = mainCOLUMN_START;
usColumn = 0; }
if( ucLine >= mainMAX_LINE )
{
ucLine = 0;
}
return ch;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Make the refreshing from an object. Draw all its children and the youngers too. */ | static void lv_refr_obj_and_children(lv_obj_t *top_p, const lv_area_t *mask_p) | /* Make the refreshing from an object. Draw all its children and the youngers too. */
static void lv_refr_obj_and_children(lv_obj_t *top_p, const lv_area_t *mask_p) | {
if(top_p == NULL) top_p = lv_disp_get_scr_act(disp_refr);
lv_refr_obj(top_p, mask_p);
lv_obj_t * par;
lv_obj_t * border_p = top_p;
par = lv_obj_get_parent(top_p);
while(par != NULL) {
lv_obj_t * i = lv_ll_get_prev(&(par->child_ll), border_p);
while(i != NULL) {
lv_refr_obj(i, mask_p);
i = lv_ll_get_prev(&(par->child_ll), i);
}
par->design_cb(par, mask_p, LV_DESIGN_DRAW_POST);
border_p = par;
par = lv_obj_get_parent(par);
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* All we do is set the XFS_BLI_INODE_BUF flag in the buffer's log format structure so that we'll know what to do at recovery time. */ | void xfs_trans_inode_buf(xfs_trans_t *tp, xfs_buf_t *bp) | /* All we do is set the XFS_BLI_INODE_BUF flag in the buffer's log format structure so that we'll know what to do at recovery time. */
void xfs_trans_inode_buf(xfs_trans_t *tp, xfs_buf_t *bp) | {
xfs_buf_log_item_t *bip;
ASSERT(XFS_BUF_ISBUSY(bp));
ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp);
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
ASSERT(atomic_read(&bip->bli_refcount) > 0);
bip->bli_format.blf_flags |= XFS_BLI_INODE_BUF;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If registry has been pre-initialized it is left "as is". NOTE: This routine may be called when TIPC is inactive. */ | static int reg_init(void) | /* If registry has been pre-initialized it is left "as is". NOTE: This routine may be called when TIPC is inactive. */
static int reg_init(void) | {
u32 i;
spin_lock_bh(®_lock);
if (!users) {
users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC);
if (users) {
for (i = 1; i <= MAX_USERID; i++) {
users[i].next = i - 1;
}
next_free_user = MAX_USERID;
}
}
spin_unlock_bh(®_lock);
return users ? 0 : -ENOMEM;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* We get here from the send completion handler, when the adapter tells us the ACK frame was sent. */ | void rds_iw_ack_send_complete(struct rds_iw_connection *ic) | /* We get here from the send completion handler, when the adapter tells us the ACK frame was sent. */
void rds_iw_ack_send_complete(struct rds_iw_connection *ic) | {
clear_bit(IB_ACK_IN_FLIGHT, &ic->i_ack_flags);
rds_iw_attempt_ack(ic);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clears the Own Address of the CEC device. */ | void CEC_OwnAddressClear(void) | /* Clears the Own Address of the CEC device. */
void CEC_OwnAddressClear(void) | {
CEC->CFGR = 0x0;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* uio_interrupt - hardware interrupt handler @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer @dev_id: Pointer to the devices */ | static irqreturn_t uio_interrupt(int irq, void *dev_id) | /* uio_interrupt - hardware interrupt handler @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer @dev_id: Pointer to the devices */
static irqreturn_t uio_interrupt(int irq, void *dev_id) | {
struct uio_device *idev = (struct uio_device *)dev_id;
irqreturn_t ret = idev->info->handler(irq, idev->info);
if (ret == IRQ_HANDLED)
uio_event_notify(idev->info);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configure EVENT to route RTC events to the ADC. */ | static void configure_event(void) | /* Configure EVENT to route RTC events to the ADC. */
static void configure_event(void) | {
struct events_config config;
system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBD,MCLK_APBDMASK_EVSYS);
events_get_config_defaults(&config);
config.generator = EVSYS_ID_GEN_RTC_CMP_0;
config.path = EVENTS_PATH_ASYNCHRONOUS;
config.run_in_standby = true;
config.on_demand = true;
config.clock_source = GCLK_GENERATOR_0;
events_allocate(&event, &config);
events_attach_user(&event, EVSYS_ID_USER_ADC_START);
} | memfault/zero-to-main | C++ | null | 200 |
/* Initialize the Base timer with its default value. */ | void TMR_ConfigTimeBaseStructInit(TMR_BaseConfig_T *baseConfig) | /* Initialize the Base timer with its default value. */
void TMR_ConfigTimeBaseStructInit(TMR_BaseConfig_T *baseConfig) | {
baseConfig->period = 0xFFFF;
baseConfig->division = 0x0000;
baseConfig->clockDivision = TMR_CLOCK_DIV_1;
baseConfig->countMode = TMR_COUNTER_MODE_UP;
baseConfig->repetitionCounter = 0x0000;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* show_boot_progress: - indicate state of the boot process */ | void show_boot_progress(int status) | /* show_boot_progress: - indicate state of the boot process */
void show_boot_progress(int status) | {
if (status < -32) status = -1;
logodl_set_led(0, (status & 1)==1);
logodl_set_led(1, (status & 2)==2);
return;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Get the count of items available in the read FIFO. */ | uint32_t EPINonBlockingReadAvail(uint32_t ui32Base) | /* Get the count of items available in the read FIFO. */
uint32_t EPINonBlockingReadAvail(uint32_t ui32Base) | {
ASSERT(ui32Base == EPI0_BASE);
return (HWREG(ui32Base + EPI_O_RFIFOCNT));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialize the trigger timer when in ADC Timer-Trigger Mode. */ | void ADC_TimerTrigCmd(u8 Tim_Idx, u32 PeriodMs, u32 NewState) | /* Initialize the trigger timer when in ADC Timer-Trigger Mode. */
void ADC_TimerTrigCmd(u8 Tim_Idx, u32 PeriodMs, u32 NewState) | {
ADC_TypeDef *adc = ADC;
RTIM_TimeBaseInitTypeDef TIM_InitStruct;
assert_param(IS_ADC_VALID_TIM(Tim_Idx));
adc->ADC_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);
} else {
RTIM_Cmd(TIMx_LP[Tim_Idx], DISABLE);
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* It translates an address from the 'presentation' form into the 'network' form.
This function does the reverse job of */ | int sock_present2network(const char *address, struct sockaddr_storage *sockaddr, int addr_family, char *errbuf, int errbuflen) | /* It translates an address from the 'presentation' form into the 'network' form.
This function does the reverse job of */
int sock_present2network(const char *address, struct sockaddr_storage *sockaddr, int addr_family, char *errbuf, int errbuflen) | {
int retval;
struct addrinfo *addrinfo;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = addr_family;
if ((retval = sock_initaddress(address, "22222", &hints, &addrinfo, errbuf, errbuflen)) == -1)
return 0;
if (addrinfo->ai_family == PF_INET)
memcpy(sockaddr, addrinfo->ai_addr, sizeof(struct sockaddr_in));
else
memcpy(sockaddr, addrinfo->ai_addr, sizeof(struct sockaddr_in6));
if (addrinfo->ai_next != NULL)
{
freeaddrinfo(addrinfo);
if (errbuf)
pcap_snprintf(errbuf, errbuflen, "More than one socket requested; using the first one returned");
return -2;
}
freeaddrinfo(addrinfo);
return -1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The function registers previously initialized polled input device with input layer. The device should be allocated with call to input_allocate_polled_device(). Callers should also set up poll() method and set up capabilities (id, name, phys, bits) of the corresponing input_dev structure. */ | int input_register_polled_device(struct input_polled_dev *dev) | /* The function registers previously initialized polled input device with input layer. The device should be allocated with call to input_allocate_polled_device(). Callers should also set up poll() method and set up capabilities (id, name, phys, bits) of the corresponing input_dev structure. */
int input_register_polled_device(struct input_polled_dev *dev) | {
struct input_dev *input = dev->input;
int error;
input_set_drvdata(input, dev);
INIT_DELAYED_WORK(&dev->work, input_polled_device_work);
if (!dev->poll_interval)
dev->poll_interval = 500;
if (!dev->poll_interval_max)
dev->poll_interval_max = dev->poll_interval;
input->open = input_open_polled_device;
input->close = input_close_polled_device;
error = input_register_device(input);
if (error)
return error;
error = sysfs_create_group(&input->dev.kobj,
&input_polldev_attribute_group);
if (error) {
input_unregister_device(input);
return error;
}
input_get_device(input);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Opposite to halt endpoint. If there are requests in the endpoint queue, the next transfer should be prepared. */ | static int udc_skeleton_ep_clear_halt(const struct device *dev, struct udc_ep_config *const cfg) | /* Opposite to halt endpoint. If there are requests in the endpoint queue, the next transfer should be prepared. */
static int udc_skeleton_ep_clear_halt(const struct device *dev, struct udc_ep_config *const cfg) | {
LOG_DBG("Clear halt ep 0x%02x", cfg->addr);
cfg->stat.halted = false;
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Return the thread ID of the current running thread. */ | osThreadId_t osThreadGetId(void) | /* Return the thread ID of the current running thread. */
osThreadId_t osThreadGetId(void) | {
thread_id = svcRtxThreadGetId();
} else {
thread_id = __svcThreadGetId();
}
return thread_id;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Sets the LCD in standby mode to reduce power consumption. */ | void halLcdStandby(void) | /* Sets the LCD in standby mode to reduce power consumption. */
void halLcdStandby(void) | {
LcdInitMacro[ 3 * 6 + 5 ] &= (~BIT3) & (~BIT2);
LcdInitMacro[ 3 * 6 + 5 ] |= BIT0;
halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Changes the state of a network interface from "started" to "stopped". */ | EFI_STATUS EFIAPI VirtioNetStop(IN EFI_SIMPLE_NETWORK_PROTOCOL *This) | /* Changes the state of a network interface from "started" to "stopped". */
EFI_STATUS EFIAPI VirtioNetStop(IN EFI_SIMPLE_NETWORK_PROTOCOL *This) | {
VNET_DEV *Dev;
EFI_TPL OldTpl;
EFI_STATUS Status;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Dev = VIRTIO_NET_FROM_SNP (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (Dev->Snm.State != EfiSimpleNetworkStarted) {
Status = EFI_NOT_STARTED;
} else {
Dev->Snm.State = EfiSimpleNetworkStopped;
Status = EFI_SUCCESS;
}
gBS->RestoreTPL (OldTpl);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function finds the next empty LEB in the ltab starting from @lnum. If a an empty LEB is found it is returned in @lnum and the function returns %0. Otherwise the function returns -ENOSPC. Note however, that LPT is designed never to run out of space. */ | static int alloc_lpt_leb(struct ubifs_info *c, int *lnum) | /* This function finds the next empty LEB in the ltab starting from @lnum. If a an empty LEB is found it is returned in @lnum and the function returns %0. Otherwise the function returns -ENOSPC. Note however, that LPT is designed never to run out of space. */
static int alloc_lpt_leb(struct ubifs_info *c, int *lnum) | {
int i, n;
n = *lnum - c->lpt_first + 1;
for (i = n; i < c->lpt_lebs; i++) {
if (c->ltab[i].tgc || c->ltab[i].cmt)
continue;
if (c->ltab[i].free == c->leb_size) {
c->ltab[i].cmt = 1;
*lnum = i + c->lpt_first;
return 0;
}
}
for (i = 0; i < n; i++) {
if (c->ltab[i].tgc || c->ltab[i].cmt)
continue;
if (c->ltab[i].free == c->leb_size) {
c->ltab[i].cmt = 1;
*lnum = i + c->lpt_first;
return 0;
}
}
return -ENOSPC;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Compare pbuf contents at specified offset with memory s2, both of length n */ | u16_t pbuf_memcmp(const struct pbuf *p, u16_t offset, const void *s2, u16_t n) | /* Compare pbuf contents at specified offset with memory s2, both of length n */
u16_t pbuf_memcmp(const struct pbuf *p, u16_t offset, const void *s2, u16_t n) | {
u16_t start = offset;
const struct pbuf* q = p;
u16_t i;
if(p->tot_len < (offset + n)) {
return 0xffff;
}
while ((q != NULL) && (q->len <= start)) {
start -= q->len;
q = q->next;
}
for (i = 0; i < n; i++) {
u8_t a = pbuf_get_at(q, start + i);
u8_t b = ((const u8_t*)s2)[i];
if (a != b) {
return i+1;
}
}
return 0;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Enable or Disable the I2C wake-up function of the specified I2C port.
The */ | void I2CWakeupEnable(unsigned long ulBase, xtBoolean bEnable) | /* Enable or Disable the I2C wake-up function of the specified I2C port.
The */
void I2CWakeupEnable(unsigned long ulBase, xtBoolean bEnable) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
if(bEnable){
xHWREG(ulBase + I2C_WKCON) |= I2C_WKCON_I2CWKEN;
} else {
xHWREG(ulBase + I2C_WKCON) &= ~I2C_WKCON_I2CWKEN;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function updates the chip attention register bit for the given ring to inform HBA that there is more work to be done in this ring. The caller is not required to hold any lock. */ | static void lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | /* This function updates the chip attention register bit for the given ring to inform HBA that there is more work to be done in this ring. The caller is not required to hold any lock. */
static void lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | {
int ringno = pring->ringno;
if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) {
wmb();
writel(CA_R0ATT << (ringno * 4), phba->CAregaddr);
readl(phba->CAregaddr);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* To save having to free/allocate a DRP IE when its MAS changes, enough memory is allocated for the maxiumum number of DRP allocation fields. This gives an overhead per reservation of up to (UWB_NUM_ZONES - 1) * 4 = 60 octets. */ | static struct uwb_ie_drp* uwb_drp_ie_alloc(void) | /* To save having to free/allocate a DRP IE when its MAS changes, enough memory is allocated for the maxiumum number of DRP allocation fields. This gives an overhead per reservation of up to (UWB_NUM_ZONES - 1) * 4 = 60 octets. */
static struct uwb_ie_drp* uwb_drp_ie_alloc(void) | {
struct uwb_ie_drp *drp_ie;
drp_ie = kzalloc(sizeof(struct uwb_ie_drp) +
UWB_NUM_ZONES * sizeof(struct uwb_drp_alloc),
GFP_KERNEL);
if (drp_ie) {
drp_ie->hdr.element_id = UWB_IE_DRP;
}
return drp_ie;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called before unloading the module. Detach the host. We have to free resources and halt the NCR chip. */ | static int sym_detach(struct Scsi_Host *shost, struct pci_dev *pdev) | /* Called before unloading the module. Detach the host. We have to free resources and halt the NCR chip. */
static int sym_detach(struct Scsi_Host *shost, struct pci_dev *pdev) | {
struct sym_hcb *np = sym_get_hcb(shost);
printk("%s: detaching ...\n", sym_name(np));
del_timer_sync(&np->s.timer);
printk("%s: resetting chip\n", sym_name(np));
OUTB(np, nc_istat, SRST);
INB(np, nc_mbox1);
udelay(10);
OUTB(np, nc_istat, 0);
sym_free_resources(np, pdev, 1);
scsi_host_put(shost);
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Find the separator at the end of the host name, or the '?' in cases like */ | static const char* find_host_sep(const char *url) | /* Find the separator at the end of the host name, or the '?' in cases like */
static const char* find_host_sep(const char *url) | {
const char *sep;
const char *query;
sep = strstr(url, "
if(!sep)
sep = url;
else
sep += 2;
query = strchr(sep, '?');
sep = strchr(sep, '/');
if(!sep)
sep = url + strlen(url);
if(!query)
query = url + strlen(url);
return sep < query ? sep : query;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Parse the configuration file 'fcfg' into the array of configuration elements 'image_cfg', and return the number of configuration elements in 'cfgn'. */ | static int image_create_config_parse(FILE *fcfg) | /* Parse the configuration file 'fcfg' into the array of configuration elements 'image_cfg', and return the number of configuration elements in 'cfgn'. */
static int image_create_config_parse(FILE *fcfg) | {
int ret;
int cfgi = 0;
while (!feof(fcfg)) {
char *line;
char buf[256];
memset(buf, 0, sizeof(buf));
line = fgets(buf, sizeof(buf), fcfg);
if (!line)
break;
if (line[0] == '\n' || line[0] == '#')
continue;
if (line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = 0;
ret = image_create_config_parse_oneline(line,
&image_cfg[cfgi]);
if (ret)
return ret;
cfgi++;
if (cfgi >= IMAGE_CFG_ELEMENT_MAX) {
fprintf(stderr,
"Too many configuration elements in .cfg file\n");
return -1;
}
}
cfgn = cfgi;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Set up a mapping for a block of I/O. virt, phys, size must all be page-aligned. This should only be called before ioremap is called. */ | void __init io_block_mapping(unsigned long virt, phys_addr_t phys, unsigned int size, int flags) | /* Set up a mapping for a block of I/O. virt, phys, size must all be page-aligned. This should only be called before ioremap is called. */
void __init io_block_mapping(unsigned long virt, phys_addr_t phys, unsigned int size, int flags) | {
int i;
if (virt > CONFIG_KERNEL_START && virt < ioremap_bot)
ioremap_bot = ioremap_base = virt;
for (i = 0; i < size; i += PAGE_SIZE)
map_page(virt + i, phys + i, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables the flash ready interrupt source on the EEFC peripheral. */ | void EFC_EnableFrdyIt(AT91S_EFC *pEfc) | /* Enables the flash ready interrupt source on the EEFC peripheral. */
void EFC_EnableFrdyIt(AT91S_EFC *pEfc) | {
pEfc->EFC_FMR |= AT91C_EFC_FRDY;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function prints user info on PC com port and initiates RX transfer. */ | void StartReception(void) | /* This function prints user info on PC com port and initiates RX transfer. */
void StartReception(void) | {
pBufferReadyForReception = aRXBufferA;
pBufferReadyForUser = aRXBufferB;
uwNbReceivedChars = 0;
uwBufferReadyIndication = 0;
PrintInfo(aTextInfoStart, sizeof(aTextInfoStart));
LL_USART_ClearFlag_ORE(USARTx_INSTANCE);
LL_USART_EnableIT_RXNE(USARTx_INSTANCE);
LL_USART_EnableIT_ERROR(USARTx_INSTANCE);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Set the source of the clock used by the LPTIM instance. */ | void LPTIM_SetClockSource(LPTIM_Module *LPTIMx, uint32_t ClockSource) | /* Set the source of the clock used by the LPTIM instance. */
void LPTIM_SetClockSource(LPTIM_Module *LPTIMx, uint32_t ClockSource) | {
MODIFY_REG(LPTIMx->CFG, LPTIM_CFG_CLKSEL, ClockSource);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Get the channel list index of the last used channel. */ | u32 CMP_GetLastChan(void) | /* Get the channel list index of the last used channel. */
u32 CMP_GetLastChan(void) | {
CMP_TypeDef *comparator = COMPARATOR;
return comparator->COMP_LAST_CH;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Sets the states of the CTS modem control signals trigger level.
The */ | void UARTModemStatusSet(unsigned long ulBase, unsigned long ulCtsTirg) | /* Sets the states of the CTS modem control signals trigger level.
The */
void UARTModemStatusSet(unsigned long ulBase, unsigned long ulCtsTirg) | {
xASSERT((ulBase == UART0_BASE) ||(ulBase == UART1_BASE) );
xHWREG(ulBase + UART_MSR) &= ~(UART_TRIGGER_CTS_H);
xHWREG(ulBase + UART_MSR) |= (ulCtsTirg);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return: a positive number nand_bbt_block_status status or -ERANGE if @entry is bigger than the BBT size. */ | int nanddev_bbt_get_block_status(const struct nand_device *nand, unsigned int entry) | /* Return: a positive number nand_bbt_block_status status or -ERANGE if @entry is bigger than the BBT size. */
int nanddev_bbt_get_block_status(const struct nand_device *nand, unsigned int entry) | {
unsigned int bits_per_block = fls(NAND_BBT_BLOCK_NUM_STATUS);
unsigned long *pos = nand->bbt.cache +
((entry * bits_per_block) / BITS_PER_LONG);
unsigned int offs = (entry * bits_per_block) % BITS_PER_LONG;
unsigned long status;
if (entry >= nanddev_neraseblocks(nand))
return -ERANGE;
status = pos[0] >> offs;
if (bits_per_block + offs > BITS_PER_LONG)
status |= pos[1] << (BITS_PER_LONG - offs);
return status & GENMASK(bits_per_block - 1, 0);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Dynamic FC Host Attributes Support lpfc_get_host_port_id - Copy the vport DID into the scsi host port id @shost: kernel scsi host pointer. */ | static void lpfc_get_host_port_id(struct Scsi_Host *shost) | /* Dynamic FC Host Attributes Support lpfc_get_host_port_id - Copy the vport DID into the scsi host port id @shost: kernel scsi host pointer. */
static void lpfc_get_host_port_id(struct Scsi_Host *shost) | {
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
fc_host_port_id(shost) = vport->fc_myDID;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants. */ | void md5_init(md5_state_t *ctx) | /* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants. */
void md5_init(md5_state_t *ctx) | {
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function erases the main flash + the customer INFO space. */ | int am_hal_flash_erase_main_plus_info_both_instances(uint32_t ui32ProgramKey) | /* This function erases the main flash + the customer INFO space. */
int am_hal_flash_erase_main_plus_info_both_instances(uint32_t ui32ProgramKey) | {
return g_am_hal_flash.flash_erase_main_plus_info_both_instances(
ui32ProgramKey);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This file is part of the Simba project. */ | int mock_write_settings_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_settings_module_init(int res) | {
harness_mock_write("settings_module_init()",
NULL,
0);
harness_mock_write("settings_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Frees global resources allocated by this library instance. */ | EFI_STATUS EFIAPI PrmModuleDiscoveryLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* Frees global resources allocated by this library instance. */
EFI_STATUS EFIAPI PrmModuleDiscoveryLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
LIST_ENTRY *Link;
LIST_ENTRY *NextLink;
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
if (IsListEmpty (&mPrmModuleList)) {
return EFI_SUCCESS;
}
Link = GetFirstNode (&mPrmModuleList);
while (!IsNull (&mPrmModuleList, Link)) {
ListEntry = CR (Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
NextLink = GetNextNode (&mPrmModuleList, Link);
RemoveEntryList (Link);
FreePool (ListEntry);
Link = NextLink;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable or disable the FIFO on a given device. Because of the way the ALi FIFO works it provides a boost on ATA disk but can be confused by ATAPI and we must therefore manage it. */ | static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int on) | /* Enable or disable the FIFO on a given device. Because of the way the ALi FIFO works it provides a boost on ATA disk but can be confused by ATAPI and we must therefore manage it. */
static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int on) | {
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int pio_fifo = 0x54 + ap->port_no;
u8 fifo;
int shift = 4 * adev->devno;
pci_read_config_byte(pdev, pio_fifo, &fifo);
fifo &= ~(0x0F << shift);
fifo |= (on << shift);
pci_write_config_byte(pdev, pio_fifo, fifo);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant! */ | char* ipaddr_ntoa(const ip_addr_t *addr) | /* Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant! */
char* ipaddr_ntoa(const ip_addr_t *addr) | {
static char str[16];
return ipaddr_ntoa_r(addr, str, 16);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Fill a rectangular area with a color on the active display */ | void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *color_p) | /* Fill a rectangular area with a color on the active display */
void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *color_p) | {
if(active == NULL) return;
if(active->driver.disp_flush != NULL) {
LV_LOG_TRACE("disp flush started");
active->driver.disp_flush(x1, y1, x2, y2, color_p);
LV_LOG_TRACE("disp flush ready");
} else {
LV_LOG_WARN("disp flush function registered");
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Returns: (transfer container) (element-type GObject.ParamSpec): a #GList of all #GParamSpecs owned by @owner_type in the pool::GParamSpecs. */ | GList* g_param_spec_pool_list_owned(GParamSpecPool *pool, GType owner_type) | /* Returns: (transfer container) (element-type GObject.ParamSpec): a #GList of all #GParamSpecs owned by @owner_type in the pool::GParamSpecs. */
GList* g_param_spec_pool_list_owned(GParamSpecPool *pool, GType owner_type) | {
gpointer data[2];
g_return_val_if_fail (pool != NULL, NULL);
g_return_val_if_fail (owner_type > 0, NULL);
g_mutex_lock (&pool->mutex);
data[0] = NULL;
data[1] = (gpointer) owner_type;
g_hash_table_foreach (pool->hash_table, pool_list, &data);
g_mutex_unlock (&pool->mutex);
return data[0];
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Write region vectors to log. The write happens using the space reservation of the ticket (tic). It is not a requirement that all writes for a given transaction occur with one call to xfs_log_write(). */ | int xfs_log_write(xfs_mount_t *mp, xfs_log_iovec_t reg[], int nentries, xfs_log_ticket_t tic, xfs_lsn_t *start_lsn) | /* Write region vectors to log. The write happens using the space reservation of the ticket (tic). It is not a requirement that all writes for a given transaction occur with one call to xfs_log_write(). */
int xfs_log_write(xfs_mount_t *mp, xfs_log_iovec_t reg[], int nentries, xfs_log_ticket_t tic, xfs_lsn_t *start_lsn) | {
int error;
xlog_t *log = mp->m_log;
if (XLOG_FORCED_SHUTDOWN(log))
return XFS_ERROR(EIO);
if ((error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0))) {
xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
}
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates the number bytes specified by AllocationSize of type EfiACPIMemoryNVS and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocateAcpiNvsPool(IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of type EfiACPIMemoryNVS and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateAcpiNvsPool(IN UINTN AllocationSize) | {
ASSERT_EFI_ERROR (RETURN_UNSUPPORTED);
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* draw a point with a given 16bit colour */ | arm_fsm_rt_t arm_2dp_rgb16_draw_point(arm_2d_op_drw_pt_t *ptOP, const arm_2d_tile_t *ptTarget, const arm_2d_location_t tLocation, uint_fast16_t hwColour) | /* draw a point with a given 16bit colour */
arm_fsm_rt_t arm_2dp_rgb16_draw_point(arm_2d_op_drw_pt_t *ptOP, const arm_2d_tile_t *ptTarget, const arm_2d_location_t tLocation, uint_fast16_t hwColour) | {
assert(NULL != ptTarget);
ARM_2D_IMPL(arm_2d_op_drw_pt_t, ptOP);
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
return arm_fsm_rt_on_going;
}
arm_2d_region_t tPointRegion = {
.tLocation = tLocation,
.tSize = {1,1},
};
OP_CORE.ptOp = &ARM_2D_OP_DRAW_POINT_RGB16;
OP_CORE.Preference.u2ACCMethods = ARM_2D_PREF_ACC_SW_ONLY;
this.Target.ptTile = ptTarget;
this.Target.ptRegion = &tPointRegion;
this.hwColour = hwColour;
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Write data to a file N.B. After this call resp->fh needs an fh_put */ | static __be32 nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, struct nfsd_attrstat *resp) | /* Write data to a file N.B. After this call resp->fh needs an fh_put */
static __be32 nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, struct nfsd_attrstat *resp) | {
__be32 nfserr;
int stable = 1;
unsigned long cnt = argp->len;
dprintk("nfsd: WRITE %s %d bytes at %d\n",
SVCFH_fmt(&argp->fh),
argp->len, argp->offset);
nfserr = nfsd_write(rqstp, fh_copy(&resp->fh, &argp->fh), NULL,
argp->offset,
rqstp->rq_vec, argp->vlen,
&cnt,
&stable);
return nfsd_return_attrs(nfserr, resp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function waits until the SDIO DMA data transfer is finished. */ | void SD_ProcessDMAIRQ(void) | /* This function waits until the SDIO DMA data transfer is finished. */
void SD_ProcessDMAIRQ(void) | {
if(DMA2->ISR & SD_SDIO_DMA_FLAG_TC)
{
DMAEndOfTransfer = 0x01;
DMA_ClearFlag(SD_SDIO_DMA_FLAG_TC | SD_SDIO_DMA_FLAG_TE | SD_SDIO_DMA_FLAG_HT | SD_SDIO_DMA_FLAG_GL);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* As a reference, see the "Firmware Specification v5.1", page 18 and 19. I did not follow their suggested timing to the word, but this works nice & fast anyway. */ | static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 reg) | /* As a reference, see the "Firmware Specification v5.1", page 18 and 19. I did not follow their suggested timing to the word, but this works nice & fast anyway. */
static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 reg) | {
int i;
for (i = 0; i < 100000; i++) {
u8 val = if_cs_read8(card, addr);
if (val == reg)
return 0;
udelay(5);
}
return -ETIME;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine sets the ethernet address of the board Returns: 0 - if successful -1 - otherwise */ | int usbdrv_set_mac(struct net_device *, void *) | /* This routine sets the ethernet address of the board Returns: 0 - if successful -1 - otherwise */
int usbdrv_set_mac(struct net_device *, void *) | {
struct usbdrv_private *macp;
int rc = -1;
macp = dev->ml_priv;
read_lock(&(macp->isolate_lock));
if (macp->driver_isolated) {
goto exit;
}
rc = 0;
exit:
read_unlock(&(macp->isolate_lock));
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sensing chain FIFO stop values memorization at threshold level.. */ | int32_t lps22hh_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val) | /* Sensing chain FIFO stop values memorization at threshold level.. */
int32_t lps22hh_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lps22hh_fifo_ctrl_t reg;
int32_t ret;
ret = lps22hh_read_reg(ctx, LPS22HH_FIFO_CTRL, (uint8_t *) ®, 1);
*val = reg.stop_on_wtm;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | {
IoWriteFifoWorker (Port, EfiPeiCpuIoWidthFifoUint8, Count, Buffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks if cpl <= required_cpl; if true, return true. Otherwise queue a #GP and return false. */ | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl) | /* Checks if cpl <= required_cpl; if true, return true. Otherwise queue a #GP and return false. */
bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl) | {
if (kvm_x86_ops->get_cpl(vcpu) <= required_cpl)
return true;
kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
return false;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* AKM AK8975 device state set routine.
This function places the AK8975 device in the specified state. */ | static bool ak8975_set_state(sensor_hal_t *hal, sensor_state_t state) | /* AKM AK8975 device state set routine.
This function places the AK8975 device in the specified state. */
static bool ak8975_set_state(sensor_hal_t *hal, sensor_state_t state) | {
if ((state == SENSOR_STATE_POWER_DOWN) ||
(state == SENSOR_STATE_SLEEP)) {
sensor_bus_put(hal, AK8975_REG_CNTL1, AK8975_POWER_DOWN_MODE);
return true;
}
return false;
} | memfault/zero-to-main | C++ | null | 200 |
/* This file is part of the Simba project. */ | int mock_write_network_interface_wifi_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_network_interface_wifi_module_init(int res) | {
harness_mock_write("network_interface_wifi_module_init()",
NULL,
0);
harness_mock_write("network_interface_wifi_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* This function processes the FC header to retrieve the VFI from the VF header, if one exists. This function will return the VFI if one exists or 0 if no VSAN Header exists. */ | static uint32_t lpfc_fc_hdr_get_vfi(struct fc_frame_header *fc_hdr) | /* This function processes the FC header to retrieve the VFI from the VF header, if one exists. This function will return the VFI if one exists or 0 if no VSAN Header exists. */
static uint32_t lpfc_fc_hdr_get_vfi(struct fc_frame_header *fc_hdr) | {
struct fc_vft_header *fc_vft_hdr = (struct fc_vft_header *)fc_hdr;
if (fc_hdr->fh_r_ctl != FC_RCTL_VFTH)
return 0;
return bf_get(fc_vft_hdr_vf_id, fc_vft_hdr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Stop the SP805 watchdog timer from counting down by disabling interrupts. */ | STATIC VOID SP805Stop(VOID) | /* Stop the SP805 watchdog timer from counting down by disabling interrupts. */
STATIC VOID SP805Stop(VOID) | {
if ((MmioRead32 (SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) != 0) {
MmioAnd32 (SP805_WDOG_CONTROL_REG, ~SP805_WDOG_CTRL_INTEN);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ADC Enable an EOC for Each Conversion.
The EOC is set after each conversion in a sequence rather than at the end of the sequence. Overrun detection is enabled only if DMA is enabled. */ | void adc_eoc_after_each(uint32_t adc) | /* ADC Enable an EOC for Each Conversion.
The EOC is set after each conversion in a sequence rather than at the end of the sequence. Overrun detection is enabled only if DMA is enabled. */
void adc_eoc_after_each(uint32_t adc) | {
ADC_CR2(adc) |= ADC_CR2_EOCS;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller to "operational". Without this, the ps3 controller will not report any events. */ | static int sony_set_operational(struct hid_device *hdev) | /* Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller to "operational". Without this, the ps3 controller will not report any events. */
static int sony_set_operational(struct hid_device *hdev) | {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
struct usb_device *dev = interface_to_usbdev(intf);
__u16 ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
int ret;
char *buf = kmalloc(18, GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
HID_REQ_GET_REPORT,
USB_DIR_IN | USB_TYPE_CLASS |
USB_RECIP_INTERFACE,
(3 << 8) | 0xf2, ifnum, buf, 17,
USB_CTRL_GET_TIMEOUT);
if (ret < 0)
dev_err(&hdev->dev, "can't set operational mode\n");
kfree(buf);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 on success, errno on failure (as defined in errno.h) */ | int et131x_open(struct net_device *netdev) | /* Returns 0 on success, errno on failure (as defined in errno.h) */
int et131x_open(struct net_device *netdev) | {
int result = 0;
struct et131x_adapter *adapter = netdev_priv(netdev);
add_timer(&adapter->ErrorTimer);
result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED,
netdev->name, netdev);
if (result) {
dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n",
netdev->irq);
return result;
}
et131x_rx_dma_enable(adapter);
et131x_tx_dma_enable(adapter);
et131x_enable_interrupts(adapter);
adapter->Flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
netif_start_queue(netdev);
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Load/Store generators Store from GPR register to memory. */ | static void do_gpr_st_memidx(DisasContext *s, TCGv_i64 source, TCGv_i64 tcg_addr, int size, int memidx) | /* Load/Store generators Store from GPR register to memory. */
static void do_gpr_st_memidx(DisasContext *s, TCGv_i64 source, TCGv_i64 tcg_addr, int size, int memidx) | {
g_assert(size <= 3);
tcg_gen_qemu_st_i64(source, tcg_addr, memidx, MO_TE + size);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Return the status of the L2 cache on a IIci */ | int via_get_cache_disable(void) | /* Return the status of the L2 cache on a IIci */
int via_get_cache_disable(void) | {
if (!via2) {
printk(KERN_ERR "via_get_cache_disable called on a non-VIA machine!\n");
return 1;
}
return (int) via2[gBufB] & VIA2B_vCDis;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Callback function for DhcpIterateOptions. This callback sets the EFI_DHCP4_PACKET_OPTION array in the DHCP_PARSE_CONTEXT to point the individual DHCP option in the packet. */ | EFI_STATUS Dhcp4ParseCheckOption(IN UINT8 Tag, IN UINT8 Len, IN UINT8 *Data, IN VOID *Context) | /* Callback function for DhcpIterateOptions. This callback sets the EFI_DHCP4_PACKET_OPTION array in the DHCP_PARSE_CONTEXT to point the individual DHCP option in the packet. */
EFI_STATUS Dhcp4ParseCheckOption(IN UINT8 Tag, IN UINT8 Len, IN UINT8 *Data, IN VOID *Context) | {
DHCP_PARSE_CONTEXT *Parse;
Parse = (DHCP_PARSE_CONTEXT *)Context;
Parse->Index++;
if (Parse->Index <= Parse->OptionCount) {
Parse->Option[Parse->Index - 1] = BASE_CR (Data, EFI_DHCP4_PACKET_OPTION, Data);
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Local function for finding connectivity middleware handler in the table.. */ | static conn_mw_handler_t conn_mw_handler_get(uint8_t opcode) | /* Local function for finding connectivity middleware handler in the table.. */
static conn_mw_handler_t conn_mw_handler_get(uint8_t opcode) | {
conn_mw_handler_t fp_handler = NULL;
uint32_t i;
for (i = 0; i < conn_mw_item_len; i++)
{
if (opcode == conn_mw_item[i].opcode)
{
fp_handler = conn_mw_item[i].fp_handler;
break;
}
}
return fp_handler;
} | labapart/polymcu | C++ | null | 201 |
/* Attribute write call back for the Descriptor V9D3 (128-bit UUID) attribute. */ | static ssize_t write_des_v9d3__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) | /* Attribute write call back for the Descriptor V9D3 (128-bit UUID) attribute. */
static ssize_t write_des_v9d3__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) | {
uint8_t *value = attr->user_data;
if (offset >= sizeof(des_v9d3__128_bit_uuid_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
if (offset + len > sizeof(des_v9d3__128_bit_uuid_value))
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
memcpy(value + offset, buf, len);
return len;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciSegmentAndThenOr16(IN UINT64 Address, IN UINT16 AndData, IN UINT16 OrData) | /* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciSegmentAndThenOr16(IN UINT64 Address, IN UINT16 AndData, IN UINT16 OrData) | {
UINTN Count;
PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This option will get or set the active shared key to be used to build the association shared key. */ | static int sctp_setsockopt_active_key(struct sock *sk, char __user *optval, unsigned int optlen) | /* This option will get or set the active shared key to be used to build the association shared key. */
static int sctp_setsockopt_active_key(struct sock *sk, char __user *optval, unsigned int optlen) | {
struct sctp_authkeyid val;
struct sctp_association *asoc;
if (!sctp_auth_enable)
return -EACCES;
if (optlen != sizeof(struct sctp_authkeyid))
return -EINVAL;
if (copy_from_user(&val, optval, optlen))
return -EFAULT;
asoc = sctp_id2assoc(sk, val.scact_assoc_id);
if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP))
return -EINVAL;
return sctp_auth_set_active_key(sctp_sk(sk)->ep, asoc,
val.scact_keynumber);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function returns a pointer to the znode to the left of @znode or NULL if there is not one. A negative error code is returned on failure. */ | static struct ubifs_znode* left_znode(struct ubifs_info *c, struct ubifs_znode *znode) | /* This function returns a pointer to the znode to the left of @znode or NULL if there is not one. A negative error code is returned on failure. */
static struct ubifs_znode* left_znode(struct ubifs_info *c, struct ubifs_znode *znode) | {
int level = znode->level;
while (1) {
int n = znode->iip - 1;
znode = znode->parent;
if (!znode)
return NULL;
if (n >= 0) {
znode = get_znode(c, znode, n);
if (IS_ERR(znode))
return znode;
while (znode->level != level) {
n = znode->child_cnt - 1;
znode = get_znode(c, znode, n);
if (IS_ERR(znode))
return znode;
}
break;
}
}
return znode;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SC_Itf_IccPowerOn Manages the Warm and Cold Reset and get the Answer to Reset from ICC. */ | void SC_Itf_IccPowerOn(uint8_t voltage) | /* SC_Itf_IccPowerOn Manages the Warm and Cold Reset and get the Answer to Reset from ICC. */
void SC_Itf_IccPowerOn(uint8_t voltage) | {
SCState = SC_POWER_ON;
SC_ADPU.Header.CLA = 0x00U;
SC_ADPU.Header.INS = SC_GET_A2R;
SC_ADPU.Header.P1 = 0x00U;
SC_ADPU.Header.P2 = 0x00U;
SC_ADPU.Body.LC = 0x00U;
SC_PowerCmd(SC_ENABLED);
SC_VoltageConfig(voltage);
while ((SCState != SC_ACTIVE_ON_T0) && (SCState != SC_ACTIVE_ON_T1)
&& (SCState != SC_NO_INIT))
{
SC_Handler(&SCState, &SC_ADPU, &SC_Response);
}
if ((SCState == SC_ACTIVE_ON_T0) || (SCState == SC_ACTIVE_ON_T1))
{
SC_Itf_UpdateParams();
SC_PTSConfig();
SC_SaveVoltage(voltage);
}
return;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Return value: resource entry pointer if found / NULL if not found */ | static struct ipr_resource_entry* ipr_find_starget(struct scsi_target *starget) | /* Return value: resource entry pointer if found / NULL if not found */
static struct ipr_resource_entry* ipr_find_starget(struct scsi_target *starget) | {
struct Scsi_Host *shost = dev_to_shost(&starget->dev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) shost->hostdata;
struct ipr_resource_entry *res;
list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
if ((res->cfgte.res_addr.bus == starget->channel) &&
(res->cfgte.res_addr.target == starget->id) &&
(res->cfgte.res_addr.lun == 0)) {
return res;
}
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check to see if this is a Ubik opcode. */ | static int is_ubik(uint32_t) | /* Check to see if this is a Ubik opcode. */
static int is_ubik(uint32_t) | {
if ((opcode >= VOTE_LOW && opcode <= VOTE_HIGH) ||
(opcode >= DISK_LOW && opcode <= DISK_HIGH))
return(1);
else
return(0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Duration to go in sleep mode. 1 LSb = 512 / ODR. */ | int32_t lsm6dsl_act_sleep_dur_get(stmdev_ctx_t *ctx, uint8_t *val) | /* Duration to go in sleep mode. 1 LSb = 512 / ODR. */
int32_t lsm6dsl_act_sleep_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.sleep_dur;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector57_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector57_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (57 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* BFA log set log level for a module */ | bfa_status_t bfa_log_set_level(struct bfa_log_mod_s *log_mod, int mod_id, enum bfa_log_severity log_level) | /* BFA log set log level for a module */
bfa_status_t bfa_log_set_level(struct bfa_log_mod_s *log_mod, int mod_id, enum bfa_log_severity log_level) | {
if (mod_id <= BFA_LOG_UNUSED_ID || mod_id > BFA_LOG_MODULE_ID_MAX)
return BFA_STATUS_EINVAL;
if (log_level <= BFA_LOG_INVALID || log_level > BFA_LOG_LEVEL_MAX)
return BFA_STATUS_EINVAL;
if (log_mod)
log_mod->log_level[mod_id] = log_level;
else
bfa_log_info[mod_id].level = log_level;
return BFA_STATUS_OK;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI MmioAnd16(IN UINTN Address, IN UINT16 AndData) | /* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI MmioAnd16(IN UINTN Address, IN UINT16 AndData) | {
return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Put task to the end of the run list without the overhead of dequeue followed by enqueue. */ | static void requeue_rt_entity(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se, int head) | /* Put task to the end of the run list without the overhead of dequeue followed by enqueue. */
static void requeue_rt_entity(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se, int head) | {
if (on_rt_rq(rt_se)) {
struct rt_prio_array *array = &rt_rq->active;
struct list_head *queue = array->queue + rt_se_prio(rt_se);
if (head)
list_move(&rt_se->run_list, queue);
else
list_move_tail(&rt_se->run_list, queue);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* NB: various calculations are based on the orinoco/wavelan drivers for compatibility */ | static void set_quality(struct rt_rtmp_adapter *pAdapter, struct iw_quality *iq, signed char rssi) | /* NB: various calculations are based on the orinoco/wavelan drivers for compatibility */
static void set_quality(struct rt_rtmp_adapter *pAdapter, struct iw_quality *iq, signed char rssi) | {
__u8 ChannelQuality;
if (rssi >= -50)
ChannelQuality = 100;
else if (rssi >= -80)
ChannelQuality = (__u8) (24 + ((rssi + 80) * 26) / 10);
else if (rssi >= -90)
ChannelQuality = (__u8) ((rssi + 90) * 26) / 10;
else
ChannelQuality = 0;
iq->qual = (__u8) ChannelQuality;
iq->level = (__u8) (rssi);
iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8) pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]);
iq->noise += 256 - 143;
iq->updated = pAdapter->iw_stats.qual.updated;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Helper function for the cn0415_status_pid(). Display the Kp constant for the PID controller. */ | static void cn0415_status_pid_kp(struct cn0415_dev *dev) | /* Helper function for the cn0415_status_pid(). Display the Kp constant for the PID controller. */
static void cn0415_status_pid_kp(struct cn0415_dev *dev) | {
uint8_t buffer[20];
cn0415_ftoa((uint8_t*)buffer, dev->controller->kp);
usr_uart_write_string(dev->aducm3029_uart_desc,
(uint8_t*)" PID Kp: ");
usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)buffer);
usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)"\n");
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Probe the media status and return EFI_NO_MEDIA or EFI_MEDIA_CHANGED for no media or media change case. Otherwise DefaultStatus is returned. */ | EFI_STATUS ProbeMediaStatusEx(IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN UINT32 MediaId, IN EFI_STATUS DefaultStatus) | /* Probe the media status and return EFI_NO_MEDIA or EFI_MEDIA_CHANGED for no media or media change case. Otherwise DefaultStatus is returned. */
EFI_STATUS ProbeMediaStatusEx(IN EFI_DISK_IO2_PROTOCOL *DiskIo2, IN UINT32 MediaId, IN EFI_STATUS DefaultStatus) | {
EFI_STATUS Status;
UINT8 Buffer[1];
Status = DiskIo2->ReadDiskEx (DiskIo2, MediaId, 0, NULL, 1, (VOID *)Buffer);
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
return Status;
}
return DefaultStatus;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Search a Question in Formset scope using its QuestionId. */ | FORM_BROWSER_STATEMENT* IdToQuestion(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form, IN UINT16 QuestionId) | /* Search a Question in Formset scope using its QuestionId. */
FORM_BROWSER_STATEMENT* IdToQuestion(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form, IN UINT16 QuestionId) | {
LIST_ENTRY *Link;
FORM_BROWSER_STATEMENT *Question;
Question = IdToQuestion2 (Form, QuestionId);
if (Question != NULL) {
return Question;
}
Link = GetFirstNode (&FormSet->FormListHead);
while (!IsNull (&FormSet->FormListHead, Link)) {
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
Question = IdToQuestion2 (Form, QuestionId);
if (Question != NULL) {
if (Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
GetQuestionValue (FormSet, Form, Question, GetSetValueWithHiiDriver);
}
return Question;
}
Link = GetNextNode (&FormSet->FormListHead, Link);
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function calculates and returns the number of LEBs which should be kept for index usage. */ | int ubifs_calc_min_idx_lebs(struct ubifs_info *c) | /* This function calculates and returns the number of LEBs which should be kept for index usage. */
int ubifs_calc_min_idx_lebs(struct ubifs_info *c) | {
int idx_lebs;
long long idx_size;
idx_size = c->old_idx_sz + c->budg_idx_growth + c->budg_uncommitted_idx;
idx_size += idx_size << 1;
idx_lebs = div_u64(idx_size + c->idx_leb_size - 1, c->idx_leb_size);
idx_lebs += 1;
if (idx_lebs < MIN_INDEX_LEBS)
idx_lebs = MIN_INDEX_LEBS;
return idx_lebs;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Completes frame/field rendering by passing any remaining blocks. Normally ff_draw_horiz_band() is called for each slice, however, some leftover blocks, for example from error_resilience(), may remain. It should be safe to call the function a few times for the same field. */ | void ff_xvmc_field_end(MpegEncContext *s) | /* Completes frame/field rendering by passing any remaining blocks. Normally ff_draw_horiz_band() is called for each slice, however, some leftover blocks, for example from error_resilience(), may remain. It should be safe to call the function a few times for the same field. */
void ff_xvmc_field_end(MpegEncContext *s) | {
struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
assert(render);
if (render->filled_mv_blocks_num > 0)
ff_draw_horiz_band(s, 0, 0);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Get the PWM duty of the PWM module.
The */ | unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel) | /* Get the PWM duty of the PWM module.
The */
unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
unsigned long ulCMRData;
unsigned long ulCNRData;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
ulCNRData = (xHWREG(ulBase + PWM_PERIOD0 +(ulChannelTemp * 4)));
ulCMRData = (xHWREG(ulBase + PWM_CMPDAT0 +(ulChannelTemp * 4)));
ulChannelTemp = (ulCMRData + 1) * 100 / (ulCNRData + 1);
return ulChannelTemp;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Disable an IOS Access Interrupt.
This function may be used to disable an interrupt to the NVIC. */ | void am_hal_ios_access_int_disable(uint32_t ui32Interrupt) | /* Disable an IOS Access Interrupt.
This function may be used to disable an interrupt to the NVIC. */
void am_hal_ios_access_int_disable(uint32_t ui32Interrupt) | {
AM_REG(IOSLAVE, REGACCINTEN) &= ~(ui32Interrupt);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Send GET_INTERFACE_CONDITION command to get card interface condition.
This function checks card interface condition, which includes host supply voltage information and asks the card whether card supports the specified host voltage. */ | static status_t SD_SendInterfaceCondition(sd_card_t *card) | /* Send GET_INTERFACE_CONDITION command to get card interface condition.
This function checks card interface condition, which includes host supply voltage information and asks the card whether card supports the specified host voltage. */
static status_t SD_SendInterfaceCondition(sd_card_t *card) | {
assert(card);
sdhc_transfer_t content = {0};
sdhc_command_t command = {0};
command.index = kSD_SendInterfaceCondition;
command.argument = 0x1AAU;
command.responseType = kSDHC_ResponseTypeR7;
content.command = &command;
content.data = NULL;
if (kStatus_Success != card->host.transfer(card->host.base, &content))
{
return kStatus_SDMMC_TransferFailed;
}
else
{
if ((command.response[0U] & 0xFFU) != 0xAAU)
{
return kStatus_SDMMC_CardNotSupport;
}
}
return kStatus_Success;
} | labapart/polymcu | C++ | null | 201 |
/* Generate System Reset through DWD.
This function can be called to generate system reset using DWD. */ | void dwdGenerateSysReset(void) | /* Generate System Reset through DWD.
This function can be called to generate system reset using DWD. */
void dwdGenerateSysReset(void) | {
rtiREG1->WDKEY = 0x0000E51AU;
rtiREG1->WDKEY = 0x00002345U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Updates the hash of a computation in progress by adding a message text. */ | EFI_STATUS EFIAPI BaseCrypto2HashUpdate(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST UINT8 *Message, IN UINTN MessageSize) | /* Updates the hash of a computation in progress by adding a message text. */
EFI_STATUS EFIAPI BaseCrypto2HashUpdate(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST UINT8 *Message, IN UINTN MessageSize) | {
EFI_HASH_INFO *HashInfo;
VOID *HashCtx;
BOOLEAN Ret;
HASH2_INSTANCE_DATA *Instance;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Instance = HASH2_INSTANCE_DATA_FROM_THIS (This);
if ((Instance->HashContext == NULL) || (Instance->HashInfoContext == NULL)) {
return EFI_NOT_READY;
}
HashInfo = Instance->HashInfoContext;
HashCtx = Instance->HashContext;
Ret = HashInfo->Update (HashCtx, Message, MessageSize);
if (!Ret) {
return EFI_OUT_OF_RESOURCES;
}
Instance->Updated = TRUE;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert time in nano seconds to number of cycles of DDR clock */ | static u32 ns_2_cycles(u32 ns) | /* Convert time in nano seconds to number of cycles of DDR clock */
static u32 ns_2_cycles(u32 ns) | {
return ((ns * (*T_den)) + (*T_num) - 1) / (*T_num);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Return: false - we are done with this request true - still buffers pending for this request */ | bool blk_end_request_err(struct request *rq, int error) | /* Return: false - we are done with this request true - still buffers pending for this request */
bool blk_end_request_err(struct request *rq, int error) | {
WARN_ON(error >= 0);
return blk_end_request(rq, error, blk_rq_err_bytes(rq));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set Counter.
Set the value of a timer's counter register contents. */ | void timer_set_counter(uint32_t timer_peripheral, uint32_t count) | /* Set Counter.
Set the value of a timer's counter register contents. */
void timer_set_counter(uint32_t timer_peripheral, uint32_t count) | {
TIM_CNT(timer_peripheral) = count;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.