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 the pixel skip setting used by the Generator in the VTC core. */ | void XVtc_GetSkipPixel(XVtc *InstancePtr, int *GeneratorChromaSkipPtr) | /* This function gets the pixel skip setting used by the Generator in the VTC core. */
void XVtc_GetSkipPixel(XVtc *InstancePtr, int *GeneratorChromaSkipPtr) | {
u32 FrameEncodeRegValue;
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertVoid(GeneratorChromaSkipPtr != NULL);
FrameEncodeRegValue = XVtc_ReadReg(InstancePtr->Config.BaseAddress,
(XVTC_GFENC_OFFSET));
if (FrameEncodeRegValue & XVTC_ENC_GACPS_M... | ua1arn/hftrx | C++ | null | 69 |
/* Slave Requests Master R/W/Exe Access to Shared SARAM. */ | uint16_t IPCLiteReqMemAccess(uint32_t ulFlag, uint32_t ulMask, uint16_t ulMaster, uint32_t ulStatusFlag) | /* Slave Requests Master R/W/Exe Access to Shared SARAM. */
uint16_t IPCLiteReqMemAccess(uint32_t ulFlag, uint32_t ulMask, uint16_t ulMaster, uint32_t ulStatusFlag) | {
uint16_t status;
uint32_t GSxMSEL_REGaddress = (uint32_t)(&MemCfgRegs.GSxMSEL.all);
if (ulMaster == IPC_GSX_CPU2_MASTER)
{
status =
IPCLiteLtoRSetBits_Protected (ulFlag, GSxMSEL_REGaddress, ulMask,
IPC_LENGTH_32_BITS,
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the content of the 'db' variable based on 'dbDefault' variable content. */ | EFI_STATUS EFIAPI EnrollDbFromDefault(VOID) | /* Sets the content of the 'db' variable based on 'dbDefault' variable content. */
EFI_STATUS EFIAPI EnrollDbFromDefault(VOID) | {
EFI_STATUS Status;
Status = EnrollFromDefault (
EFI_IMAGE_SECURITY_DATABASE,
EFI_DB_DEFAULT_VARIABLE_NAME,
&gEfiImageSecurityDatabaseGuid
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the offset value from a sample sequence if Injected Channel. */ | unsigned long ADCInjectedOffsetDataGet(unsigned long ulBase, unsigned long ulChannel) | /* Get the offset value from a sample sequence if Injected Channel. */
unsigned long ADCInjectedOffsetDataGet(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulReturn;
xASSERT((ulBase == ADC1_BASE) || (ulBase == ADC2_BASE) || (ulBase == ADC3_BASE));
xASSERT((ulChannel > 0) || (ulChannel < 5));
ulReturn = (xHWREG(ulBase + ADC_JOFR1 + (ulChannel-1)*4) & ADC_JOFR1_M);
return ulReturn;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Checks whether the specified TIM flag is set or not. */ | FlagStatus TIM_GetCCENStatus(TIM_Module *TIMx, uint32_t TIM_CCEN) | /* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetCCENStatus(TIM_Module *TIMx, uint32_t TIM_CCEN) | {
INTStatus bitstatus = RESET;
assert_param(IsTimList3Module(TIMx));
if (TIMx==TIM1 || TIMx==TIM8)
{
assert_param(IsAdvancedTimCCENFlag(TIM_CCEN));
if ((TIMx->CCEN & TIM_CCEN) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatu... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function returns the same value as time('now'). */ | static void ctimeFunc(sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2) | /* This function returns the same value as time('now'). */
static void ctimeFunc(sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2) | {
UNUSED_PARAMETER2(NotUsed, NotUsed2);
timeFunc(context, 0, 0);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Insert one pre-fetched key into the FIFO buffer. */ | BOOLEAN EfiKeyFiFoForNotifyInsertOneKey(EFI_KEY_FIFO *EfiKeyFiFo, EFI_INPUT_KEY *Input) | /* Insert one pre-fetched key into the FIFO buffer. */
BOOLEAN EfiKeyFiFoForNotifyInsertOneKey(EFI_KEY_FIFO *EfiKeyFiFo, EFI_INPUT_KEY *Input) | {
UINT8 Tail;
Tail = EfiKeyFiFo->Tail;
if (IsEfiKeyFiFoForNotifyFull (EfiKeyFiFo)) {
return FALSE;
}
CopyMem (&EfiKeyFiFo->Data[Tail], Input, sizeof (EFI_INPUT_KEY));
EfiKeyFiFo->Tail = (UINT8)((Tail + 1) % (FIFO_MAX_NUMBER + 1));
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Older driver gets the media mode from mii status output register. Now we set our media capability and auto-negotiate to get the upper bound of speed and duplex between two ends. If the types of mii phy is HOME, it doesn't need to auto-negotiate and autong_complete should be set to 1. */ | static void sis900_check_mode(struct net_device *net_dev, struct mii_phy *mii_phy) | /* Older driver gets the media mode from mii status output register. Now we set our media capability and auto-negotiate to get the upper bound of speed and duplex between two ends. If the types of mii phy is HOME, it doesn't need to auto-negotiate and autong_complete should be set to 1. */
static void sis900_check_mod... | {
struct sis900_private *sis_priv = netdev_priv(net_dev);
long ioaddr = net_dev->base_addr;
int speed, duplex;
if (mii_phy->phy_types == LAN) {
outl(~EXD & inl(ioaddr + cfg), ioaddr + cfg);
sis900_set_capability(net_dev , mii_phy);
sis900_auto_negotiate(net_dev, sis_priv->cur_phy);
} else {
outl(EXD | inl(... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the Internal High Speed oscillator to program/erase FLASH. */ | FLASH_HSICLOCK FLASH_ClockInit(void) | /* Configures the Internal High Speed oscillator to program/erase FLASH. */
FLASH_HSICLOCK FLASH_ClockInit(void) | {
bool HSIStatus = 0;
__IO uint32_t StartUpCounter = 0;
FLASH_HSICLOCK hsiclock_status = FLASH_HSICLOCK_ENABLE;
if((RCC->CTRL & RCC_CTRL_HSIRDF) == RESET)
{
RCC->CTRL |= ((uint32_t)RCC_CTRL_HSIEN);
do
{
HSIStatus = RCC->CTRL & RCC_CTRL_HSIRDF;
StartUpC... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Detects if Pending Break feature supported on current processor. */ | BOOLEAN EFIAPI PendingBreakSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL) | /* Detects if Pending Break feature supported on current processor. */
BOOLEAN EFIAPI PendingBreakSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL) | {
if (IS_ATOM_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
IS_CORE2_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
IS_CORE_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
IS_PENTIUM_4_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel) ||
IS_PEN... | tianocore/edk2 | C++ | Other | 4,240 |
/* Do option processing on a datagram, possibly discarding it if bad options are encountered, or forwarding it if source-routed. Returns 1 if packet has been forwarded/freed, 0 if the packet should be processed further. Strip out IP options, at higher level protocol in the kernel. Second argument is buffer to which opt... | void ip_stripoptions(register struct mbuf *m, struct mbuf *mopt) | /* Do option processing on a datagram, possibly discarding it if bad options are encountered, or forwarding it if source-routed. Returns 1 if packet has been forwarded/freed, 0 if the packet should be processed further. Strip out IP options, at higher level protocol in the kernel. Second argument is buffer to which opt... | {
register int i;
struct ip *ip = mtod(m, struct ip *);
register caddr_t opts;
int olen;
olen = (ip->ip_hl<<2) - sizeof (struct ip);
opts = (caddr_t)(ip + 1);
i = m->m_len - (sizeof (struct ip) + olen);
memcpy(opts, opts + olen, (unsigned)i);
m->m_len -= olen;
ip->ip_hl = sizeof(struct ip) >> 2;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Assert or deassert the control signals on a serial port. The following control signals are set according their bit settings : . Request to Send . Data Terminal Ready */ | RETURN_STATUS EFIAPI SerialPortSetControl(IN UINT32 Control) | /* Assert or deassert the control signals on a serial port. The following control signals are set according their bit settings : . Request to Send . Data Terminal Ready */
RETURN_STATUS EFIAPI SerialPortSetControl(IN UINT32 Control) | {
return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Display the application footer (status) on the LCD screen. */ | void LCD_LOG_SetFooter(uint8_t *Status) | /* Display the application footer (status) on the LCD screen. */
void LCD_LOG_SetFooter(uint8_t *Status) | {
sFONT *cFont;
uint8_t tmp[40], i;
LCD_SetBackColor(Blue);
cFont = LCD_GetFont();
for (i= 0; i< (320/cFont->Width)-1 ; i++)
{
tmp[i] = ' ';
}
tmp[(320/cFont->Width)-1] = 0;
LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - cFont->Height, tmp);
LCD_DisplayStringLine(LCD_PIXEL_HEIGHT - cFont->Height, Sta... | avem-labs/Avem | C++ | MIT License | 1,752 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */ | UINT16 EFIAPI PciCf8And16(IN UINTN Address, IN UINT16 AndData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */
UINT16 EFIAPI PciCf8And16(IN UINTN Address, IN UINT16 AndData) | {
BOOLEAN InterruptState;
UINT32 AddressPort;
UINT16 Result;
ASSERT_INVALID_PCI_ADDRESS (Address, 1);
InterruptState = SaveAndDisableInterrupts ();
AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoAnd16 ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 0 on success otherwise negative errno. In the error case, dwc may contain some buffers allocated but not all which were requested. */ | static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length) | /* Returns 0 on success otherwise negative errno. In the error case, dwc may contain some buffers allocated but not all which were requested. */
static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length) | {
int num;
int i;
num = DWC3_NUM_INT(dwc->hwparams.hwparams1);
dwc->num_event_buffers = num;
dwc->ev_buffs = memalign(CONFIG_SYS_CACHELINE_SIZE,
sizeof(*dwc->ev_buffs) * num);
if (!dwc->ev_buffs)
return -ENOMEM;
for (i = 0; i < num; i++) {
struct dwc3_event_buffer *evt;
evt = dwc3_alloc_one_event_... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If not found it in the current boot option, create a new one. */ | UINTN GetBootManagerMenuAppOption(VOID) | /* If not found it in the current boot option, create a new one. */
UINTN GetBootManagerMenuAppOption(VOID) | {
UINTN BootOptionCount;
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
UINTN Index;
UINTN OptionNumber;
OptionNumber = 0;
BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
for (Index = 0; Index < BootOpt... | tianocore/edk2 | C++ | Other | 4,240 |
/* this function is a POSIX compliant version, which shall request that all data for the open file descriptor named by fildes is to be transferred to the storage device associated with the file described by fildes. */ | int fsync(int fildes) | /* this function is a POSIX compliant version, which shall request that all data for the open file descriptor named by fildes is to be transferred to the storage device associated with the file described by fildes. */
int fsync(int fildes) | {
int ret;
struct dfs_file *file;
file = fd_get(fildes);
if (file == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
ret = dfs_file_fsync(file);
return ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Restart the card from scratch, as if from a cold-boot. Implementation resembles the first-half of the e1000_resume routine. */ | static pci_ers_result_t atl1e_io_slot_reset(struct pci_dev *pdev) | /* Restart the card from scratch, as if from a cold-boot. Implementation resembles the first-half of the e1000_resume routine. */
static pci_ers_result_t atl1e_io_slot_reset(struct pci_dev *pdev) | {
struct net_device *netdev = pci_get_drvdata(pdev);
struct atl1e_adapter *adapter = netdev_priv(netdev);
if (pci_enable_device(pdev)) {
dev_err(&pdev->dev,
"ATL1e: Cannot re-enable PCI device after reset.\n");
return PCI_ERS_RESULT_DISCONNECT;
}
pci_set_master(pdev);
pci_enable_wake(pdev, PCI_D3hot,... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Call this function if you change anything that should be written to the meta-data super block. This function sets MD_DIRTY, and starts a timer that ensures that within five seconds you have to call drbd_md_sync(). */ | void drbd_md_mark_dirty(struct drbd_conf *mdev) | /* Call this function if you change anything that should be written to the meta-data super block. This function sets MD_DIRTY, and starts a timer that ensures that within five seconds you have to call drbd_md_sync(). */
void drbd_md_mark_dirty(struct drbd_conf *mdev) | {
set_bit(MD_DIRTY, &mdev->flags);
mod_timer(&mdev->md_sync_timer, jiffies + 5*HZ);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note, this function synchronizes even VFS inodes which are locked (@i_mutex) by the caller of the budgeting function, because write-back does not touch @i_mutex. */ | static void shrink_liability(struct ubifs_info *c, int nr_to_write) | /* Note, this function synchronizes even VFS inodes which are locked (@i_mutex) by the caller of the budgeting function, because write-back does not touch @i_mutex. */
static void shrink_liability(struct ubifs_info *c, int nr_to_write) | {
writeback_inodes_sb(c->vfs_sb);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function starts atomic LEB change operation. Returns zero in case of success and a negative error code in case of failure. */ | int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, const struct ubi_leb_change_req *req) | /* This function starts atomic LEB change operation. Returns zero in case of success and a negative error code in case of failure. */
int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, const struct ubi_leb_change_req *req) | {
ubi_assert(!vol->updating && !vol->changing_leb);
dbg_gen("start changing LEB %d:%d, %u bytes",
vol->vol_id, req->lnum, req->bytes);
if (req->bytes == 0)
return ubi_eba_atomic_leb_change(ubi, vol, req->lnum, NULL, 0,
req->dtype);
vol->upd_bytes = req->bytes;
vol->upd_received = 0;
vol->changing_leb =... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine also will remove the FV information found by given FV format GUID from PrivateData->UnknownFvInfo. */ | EFI_STATUS FindUnknownFormatFvInfo(IN PEI_CORE_INSTANCE *PrivateData, IN EFI_GUID *Format, OUT VOID **FvInfo, OUT UINT32 *FvInfoSize, OUT UINT32 *AuthenticationStatus) | /* This routine also will remove the FV information found by given FV format GUID from PrivateData->UnknownFvInfo. */
EFI_STATUS FindUnknownFormatFvInfo(IN PEI_CORE_INSTANCE *PrivateData, IN EFI_GUID *Format, OUT VOID **FvInfo, OUT UINT32 *FvInfoSize, OUT UINT32 *AuthenticationStatus) | {
UINTN Index;
UINTN Index2;
Index = 0;
for ( ; Index < PrivateData->UnknownFvInfoCount; Index++) {
if (CompareGuid (Format, &PrivateData->UnknownFvInfo[Index].FvFormat)) {
break;
}
}
if (Index == PrivateData->UnknownFvInfoCount) {
return EFI_NOT_FOUND;
}
*FvInfo = Priv... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will check if VarName should be recorded and return the address of VarName if it is needed. */ | CHAR16* AssignVarName(IN CHAR16 *VarName) | /* This function will check if VarName should be recorded and return the address of VarName if it is needed. */
CHAR16* AssignVarName(IN CHAR16 *VarName) | {
UINTN Index;
for (Index = 0; Index < sizeof (mVariableType)/sizeof (mVariableType[0]); Index++) {
if (StrCmp (VarName, mVariableType[Index].VariableName) == 0) {
return mVariableType[Index].VariableName;
}
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function validates the length coded on 8 bytes of a shared memory range */ | STATIC VOID EFIAPI ValidateRangeLength8(IN UINT8 *Ptr, IN VOID *Context) | /* This function validates the length coded on 8 bytes of a shared memory range */
STATIC VOID EFIAPI ValidateRangeLength8(IN UINT8 *Ptr, IN VOID *Context) | {
if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
IncrementErrorCount ();
Print (
L"\nError: Shared memory range length is too short.\n"
L"Length is %u when it should be greater than %u",
*(UINT64 *)Ptr,
MIN_MEMORY_RANGE_LENGTH
);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The SRAM power configuration is specified as one of: */ | void SysCtlDeepSleepPowerSet(uint32_t ui32Config) | /* The SRAM power configuration is specified as one of: */
void SysCtlDeepSleepPowerSet(uint32_t ui32Config) | {
HWREG(SYSCTL_DSLPPWRCFG) = ui32Config;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the operational mode of the given engine. */ | static int lp5562_set_engine_op_mode(const struct device *dev, enum lp5562_led_sources engine, enum lp5562_engine_op_modes mode) | /* Set the operational mode of the given engine. */
static int lp5562_set_engine_op_mode(const struct device *dev, enum lp5562_led_sources engine, enum lp5562_engine_op_modes mode) | {
return lp5562_set_engine_reg(dev, engine, LP5562_OP_MODE, mode);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* sca3000_show_reg() - sysfs interface to read the chip revision number */ | static ssize_t sca3000_show_rev(struct device *dev, struct device_attribute *attr, char *buf) | /* sca3000_show_reg() - sysfs interface to read the chip revision number */
static ssize_t sca3000_show_rev(struct device *dev, struct device_attribute *attr, char *buf) | {
int len = 0, ret;
struct iio_dev *dev_info = dev_get_drvdata(dev);
struct sca3000_state *st = dev_info->dev_data;
u8 *rx;
mutex_lock(&st->lock);
ret = sca3000_read_data(st, SCA3000_REG_ADDR_REVID, &rx, 1);
if (ret < 0)
goto error_ret;
len += sprintf(buf + len,
"major=%d, minor=%d\n",
rx[1]... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function multiplies the 64-bit signed value Multiplicand by the 64-bit signed value Multiplier and generates a 64-bit signed result. This 64-bit signed result is returned. */ | INT64 EFIAPI MultS64x64(IN INT64 Multiplicand, IN INT64 Multiplier) | /* This function multiplies the 64-bit signed value Multiplicand by the 64-bit signed value Multiplier and generates a 64-bit signed result. This 64-bit signed result is returned. */
INT64 EFIAPI MultS64x64(IN INT64 Multiplicand, IN INT64 Multiplier) | {
return (INT64)MultU64x64 ((UINT64)Multiplicand, (UINT64)Multiplier);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads the specified ADC Software start conversion Status. */ | uint8_t ADC_ReadSoftwareStartConvStatus(ADC_T *adc) | /* Reads the specified ADC Software start conversion Status. */
uint8_t ADC_ReadSoftwareStartConvStatus(ADC_T *adc) | {
uint8_t ret;
ret = (adc->CTRL2_B.REGSWSC) ? BIT_SET : BIT_RESET;
return ret;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* stmmac_dma_start_tx @ioaddr: device I/O address Description: this function starts the DMA tx process. */ | static void stmmac_dma_start_tx(unsigned long ioaddr) | /* stmmac_dma_start_tx @ioaddr: device I/O address Description: this function starts the DMA tx process. */
static void stmmac_dma_start_tx(unsigned long ioaddr) | {
u32 value = readl(ioaddr + DMA_CONTROL);
value |= DMA_CONTROL_ST;
writel(value, ioaddr + DMA_CONTROL);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function handles External line 0 interrupt request. */ | void EXTI0_IRQHandler(void) | /* This function handles External line 0 interrupt request. */
void EXTI0_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(MFX_IRQOUT_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Takes the console sem and the called methods then take the tty termios_mutex and the tty ctrl_lock in that order. */ | static int vt_resize(struct tty_struct *tty, struct winsize *ws) | /* Takes the console sem and the called methods then take the tty termios_mutex and the tty ctrl_lock in that order. */
static int vt_resize(struct tty_struct *tty, struct winsize *ws) | {
struct vc_data *vc = tty->driver_data;
int ret;
acquire_console_sem();
ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row);
release_console_sem();
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base ADC peripheral base address. param mask Mask value for the cleared flags. See "adc_status_flags_t". */ | void ADC_ClearStatusFlags(ADC_Type *base, uint32_t mask) | /* param base ADC peripheral base address. param mask Mask value for the cleared flags. See "adc_status_flags_t". */
void ADC_ClearStatusFlags(ADC_Type *base, uint32_t mask) | {
uint32_t tmp32 = 0;
if (0U != (mask & (uint32_t)kADC_CalibrationFailedFlag))
{
tmp32 |= ADC_GS_CALF_MASK;
}
if (0U != (mask & (uint32_t)kADC_ConversionActiveFlag))
{
tmp32 |= ADC_GS_ADACT_MASK;
}
base->GS = tmp32;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* get a new Response buffer that only has a status. */ | static VCardResponse* vcard_response_new_status(vcard_7816_status_t status) | /* get a new Response buffer that only has a status. */
static VCardResponse* vcard_response_new_status(vcard_7816_status_t status) | {
VCardResponse *new_response;
new_response = (VCardResponse *)g_malloc(sizeof(VCardResponse));
new_response->b_data = &new_response->b_sw1;
new_response->b_len = 0;
new_response->b_total_len = 2;
new_response->b_type = VCARD_MALLOC_STRUCT;
vcard_response_set_status(new_response, status);
... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Change Logs: Date Author Notes yi.qiu first version */ | void* dlsym(void *handle, const char *symbol) | /* Change Logs: Date Author Notes yi.qiu first version */
void* dlsym(void *handle, const char *symbol) | {
int i;
struct rt_dlmodule *module;
RT_ASSERT(handle != RT_NULL);
module = (struct rt_dlmodule *)handle;
for(i=0; i<module->nsym; i++)
{
if (rt_strcmp(module->symtab[i].name, symbol) == 0)
return (void*)module->symtab[i].addr;
}
return RT_NULL;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* fc_disc_init() - Initialize the discovery layer for a local port @lport: The local port that needs the discovery layer to be initialized */ | int fc_disc_init(struct fc_lport *lport) | /* fc_disc_init() - Initialize the discovery layer for a local port @lport: The local port that needs the discovery layer to be initialized */
int fc_disc_init(struct fc_lport *lport) | {
struct fc_disc *disc;
if (!lport->tt.disc_start)
lport->tt.disc_start = fc_disc_start;
if (!lport->tt.disc_stop)
lport->tt.disc_stop = fc_disc_stop;
if (!lport->tt.disc_stop_final)
lport->tt.disc_stop_final = fc_disc_stop_final;
if (!lport->tt.disc_recv_req)
lport->tt.disc_recv_req = fc_disc_recv_req;
d... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Modify the PWM rate. Any value below BACKLIGHTMIN reset the value to the default value (DEFAULT_CCR_BACKLIGHTSTART). */ | void LCD_SetBackLight(u32 newBacklightStart) | /* Modify the PWM rate. Any value below BACKLIGHTMIN reset the value to the default value (DEFAULT_CCR_BACKLIGHTSTART). */
void LCD_SetBackLight(u32 newBacklightStart) | {
if( newBacklightStart >= BACKLIGHTMIN )
{
Current_CCR_BackLightStart = newBacklightStart;
}
else
{
Current_CCR_BackLightStart = DEFAULT_CCR_BACKLIGHTSTART;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Get low frequency RC oscillator clock frequency for target system. */ | uint32_t SystemLFRCOClockGet(void) | /* Get low frequency RC oscillator clock frequency for target system. */
uint32_t SystemLFRCOClockGet(void) | {
return EFR32_LFRCO_FREQ;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* The interrupt handler for the MTU - which is used to maintain the time base used by the run time stats. */ | void MTU_Match(void) | /* The interrupt handler for the MTU - which is used to maintain the time base used by the run time stats. */
void MTU_Match(void) | {
volatile unsigned char ucStatus;
ulRunTime++;
ucStatus = MTU20.TSR.BYTE;
MTU20.TSR.BIT.TGFA = 0;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Check the AVC to determine whether the @requested permissions are granted for the SID pair (@ssid, @tsid), interpreting the permissions based on @tclass, and call the security server on a cache miss to obtain a new decision and add it to the cache. Audit the granting or denial of permissions in accordance with the p... | int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, u32 requested, struct common_audit_data *auditdata) | /* Check the AVC to determine whether the @requested permissions are granted for the SID pair (@ssid, @tsid), interpreting the permissions based on @tclass, and call the security server on a cache miss to obtain a new decision and add it to the cache. Audit the granting or denial of permissions in accordance with the p... | {
struct av_decision avd;
int rc;
rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd);
avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata);
return rc;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Indicates whether there are currently any active GATT client procedures. */ | int ble_gattc_any_jobs(void) | /* Indicates whether there are currently any active GATT client procedures. */
int ble_gattc_any_jobs(void) | {
return !STAILQ_EMPTY(&ble_gattc_procs);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Change the requested timestamp in the given inode. We don't lock across timestamp updates, and we don't log them but we do record the fact that there is dirty information in core. */ | void xfs_ichgtime(xfs_inode_t *ip, int flags) | /* Change the requested timestamp in the given inode. We don't lock across timestamp updates, and we don't log them but we do record the fact that there is dirty information in core. */
void xfs_ichgtime(xfs_inode_t *ip, int flags) | {
struct inode *inode = VFS_I(ip);
timespec_t tv;
int sync_it = 0;
tv = current_fs_time(inode->i_sb);
if ((flags & XFS_ICHGTIME_MOD) &&
!timespec_equal(&inode->i_mtime, &tv)) {
inode->i_mtime = tv;
sync_it = 1;
}
if ((flags & XFS_ICHGTIME_CHG) &&
!timespec_equal(&inode->i_ctime, &tv)) {
inode->i... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check the SPL header for the "sunxi" variant. If found: parse values that might have been passed by the loader ("fel" utility), and update the environment accordingly. */ | static void parse_spl_header(const uint32_t spl_addr) | /* Check the SPL header for the "sunxi" variant. If found: parse values that might have been passed by the loader ("fel" utility), and update the environment accordingly. */
static void parse_spl_header(const uint32_t spl_addr) | {
struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION);
if (spl == INVALID_SPL_HEADER)
return;
if (!spl->fel_script_address)
return;
if (spl->fel_uEnv_length != 0) {
himport_r(&env_htab, (char *)(uintptr_t)spl->fel_script_address,
spl->fel_uEnv_length, '\n', H_NOCLEAR, 0, 0, NULL);
retur... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* HAL_PCDEx_LPM_Callback : Send LPM message to user layer. */ | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) | /* HAL_PCDEx_LPM_Callback : Send LPM message to user layer. */
void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) | {
switch ( msg)
{
case PCD_LPM_L0_ACTIVE:
if (hpcd->Init.low_power_enable)
{
SystemClockConfig_STOP();
SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
}
__HAL_PCD_UNGATE_PHYCLOCK(hpcd);
USBD_LL_Resume(hpcd->pData);
break;
case PCD_LPM... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Swap two points p1 pointer to the first point p2 pointer to the second point */ | static void point_swap(lv_point_t *p1, lv_point_t *p2) | /* Swap two points p1 pointer to the first point p2 pointer to the second point */
static void point_swap(lv_point_t *p1, lv_point_t *p2) | {
lv_point_t tmp;
tmp.x = p1->x;
tmp.y = p1->y;
p1->x = p2->x;
p1->y = p2->y;
p2->x = tmp.x;
p2->y = tmp.y;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* configure TSI pin mode when charge-transfer sequence is IDLE */ | void tsi_pin_mode_config(uint8_t pin_mode) | /* configure TSI pin mode when charge-transfer sequence is IDLE */
void tsi_pin_mode_config(uint8_t pin_mode) | {
if(RESET == (TSI_CTL & TSI_CTL_TSIS)){
if(TSI_OUTPUT_LOW == pin_mode){
TSI_CTL &= ~TSI_CTL_PINMOD;
}else{
TSI_CTL |= TSI_CTL_PINMOD;
}
}
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* platform_get_resource - get a resource for a device @dev: platform device @type: resource type @num: resource index */ | struct resource* platform_get_resource(struct platform_device *dev, unsigned int type, unsigned int num) | /* platform_get_resource - get a resource for a device @dev: platform device @type: resource type @num: resource index */
struct resource* platform_get_resource(struct platform_device *dev, unsigned int type, unsigned int num) | {
int i;
for (i = 0; i < dev->num_resources; i++) {
struct resource *r = &dev->resource[i];
if (type == resource_type(r) && num-- == 0)
return r;
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets interrupt status for the specified PWM generator block. */ | uint32_t PWMGenIntStatus(uint32_t ui32Base, uint32_t ui32Gen, bool bMasked) | /* Gets interrupt status for the specified PWM generator block. */
uint32_t PWMGenIntStatus(uint32_t ui32Base, uint32_t ui32Gen, bool bMasked) | {
ASSERT((ui32Base == PWM0_BASE) || (ui32Base == PWM1_BASE));
ASSERT(_PWMGenValid(ui32Gen));
ui32Gen = PWM_GEN_BADDR(ui32Base, ui32Gen);
if(bMasked == true)
{
return(HWREG(ui32Gen + PWM_O_X_ISC));
}
else
{
return(HWREG(ui32Gen + PWM_O_X_RIS));
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function waiting(3s) for all pending commands to complete prior to putting controller in reset. */ | static void _wait_for_commands_to_complete(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | /* This function waiting(3s) for all pending commands to complete prior to putting controller in reset. */
static void _wait_for_commands_to_complete(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | {
u32 ioc_state;
unsigned long flags;
u16 i;
ioc->pending_io_count = 0;
if (sleep_flag != CAN_SLEEP)
return;
ioc_state = mpt2sas_base_get_iocstate(ioc, 0);
if ((ioc_state & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_OPERATIONAL)
return;
spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
for (i = 0; i < ioc->scs... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable I2C second slave address of the specified I2C port.
The */ | void I2CSecondAddressDisable(unsigned long ulBase) | /* Disable I2C second slave address of the specified I2C port.
The */
void I2CSecondAddressDisable(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xHWREGB(ulBase + I2C_SMB) &= ~(I2C_SMB_SIICAEN);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This is a helper function which releases budget corresponding to the budget of one new page of data. */ | static void release_new_page_budget(struct ubifs_info *c) | /* This is a helper function which releases budget corresponding to the budget of one new page of data. */
static void release_new_page_budget(struct ubifs_info *c) | {
struct ubifs_budget_req req = { .recalculate = 1, .new_page = 1 };
ubifs_release_budget(c, &req);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We can't use the standard PCI driver registration stuff here, since that allows only one driver to bind to each PCI device (and we want multiple drivers to be able to bind to the device). Instead, manually scan for the PCI device, request a single region, and keep track of the devices that we're using. */ | static int __init cs5535_gpio_scan_pci(void) | /* We can't use the standard PCI driver registration stuff here, since that allows only one driver to bind to each PCI device (and we want multiple drivers to be able to bind to the device). Instead, manually scan for the PCI device, request a single region, and keep track of the devices that we're using. */
static in... | {
struct pci_dev *pdev;
int err = -ENODEV;
int i;
for (i = 0; i < ARRAY_SIZE(cs5535_gpio_pci_tbl); i++) {
pdev = pci_get_device(cs5535_gpio_pci_tbl[i].vendor,
cs5535_gpio_pci_tbl[i].device, NULL);
if (pdev) {
err = cs5535_gpio_probe(pdev, &cs5535_gpio_pci_tbl[i]);
if (err)
pci_dev_put(pdev);
br... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* unregister_wide_hw_breakpoint - unregister a wide breakpoint in the kernel @cpu_events: the per cpu set of events to unregister */ | void unregister_wide_hw_breakpoint(struct perf_event **cpu_events) | /* unregister_wide_hw_breakpoint - unregister a wide breakpoint in the kernel @cpu_events: the per cpu set of events to unregister */
void unregister_wide_hw_breakpoint(struct perf_event **cpu_events) | {
int cpu;
struct perf_event **pevent;
for_each_possible_cpu(cpu) {
pevent = per_cpu_ptr(cpu_events, cpu);
unregister_hw_breakpoint(*pevent);
}
free_percpu(cpu_events);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* mpc52xx_is_extirq - Returns true if hwirq number is for an external IRQ */ | static int mpc52xx_is_extirq(int l1, int l2) | /* mpc52xx_is_extirq - Returns true if hwirq number is for an external IRQ */
static int mpc52xx_is_extirq(int l1, int l2) | {
return ((l1 == 0) && (l2 == 0)) ||
((l1 == 1) && (l2 >= 1) && (l2 <= 3));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Detach from a device handler. If a device handler is specified, only detach if the currently attached handler matches @scsi_dh. */ | static void scsi_dh_handler_detach(struct scsi_device *sdev, struct scsi_device_handler *scsi_dh) | /* Detach from a device handler. If a device handler is specified, only detach if the currently attached handler matches @scsi_dh. */
static void scsi_dh_handler_detach(struct scsi_device *sdev, struct scsi_device_handler *scsi_dh) | {
if (!sdev->scsi_dh_data)
return;
if (scsi_dh && scsi_dh != sdev->scsi_dh_data->scsi_dh)
return;
if (!scsi_dh)
scsi_dh = sdev->scsi_dh_data->scsi_dh;
if (scsi_dh && scsi_dh->detach)
kref_put(&sdev->scsi_dh_data->kref, __detach_handler);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Offloads read by reading from a given socket. */ | static ssize_t offload_read(void *obj, void *buffer, size_t count) | /* Offloads read by reading from a given socket. */
static ssize_t offload_read(void *obj, void *buffer, size_t count) | {
return offload_recvfrom(obj, buffer, count, 0, NULL, 0);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Reads a block of data from the FLASH. */ | void sFLASH_ReadBuffer(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) | /* Reads a block of data from the FLASH. */
void sFLASH_ReadBuffer(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) | {
sFLASH_CS_LOW();
sFLASH_SendByte(sFLASH_CMD_READ);
sFLASH_SendByte((ReadAddr & 0xFF0000) >> 16);
sFLASH_SendByte((ReadAddr& 0xFF00) >> 8);
sFLASH_SendByte(ReadAddr & 0xFF);
while (NumByteToRead--)
{
*pBuffer = sFLASH_SendByte(sFLASH_DUMMY_BYTE);
pBuffer++;
}
sFLASH_CS_HIGH();
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Configure which DNS server to use for queries. */ | void resolv_conf(u16_t *dnsserver) | /* Configure which DNS server to use for queries. */
void resolv_conf(u16_t *dnsserver) | {
if (resolv_conn != NULL)
{
uip_udp_remove(resolv_conn);
}
resolv_conn = uip_udp_new(dnsserver, HTONS(53));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Compute the Hour, Minute, and Seconds from the julian day number. */ | static void computeHMS(DateTime *p) | /* Compute the Hour, Minute, and Seconds from the julian day number. */
static void computeHMS(DateTime *p) | {
int s;
if( p->validHMS ) return;
computeJD(p);
s = (int)((p->iJD + 43200000) % 86400000);
p->s = s/1000.0;
s = (int)p->s;
p->s -= s;
p->h = s/3600;
s -= p->h*3600;
p->m = s/60;
p->s += s - p->m*60;
p->validHMS = 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Enable/disable SPI master interrupt.
param device The pointer to SPI master device instance param type The type of interrupt to disable/enable if applicable param state Enable or disable */ | void _spi_m_async_set_irq_state(struct _spi_async_dev *const device, const enum _spi_async_dev_cb_type type, const bool state) | /* Enable/disable SPI master interrupt.
param device The pointer to SPI master device instance param type The type of interrupt to disable/enable if applicable param state Enable or disable */
void _spi_m_async_set_irq_state(struct _spi_async_dev *const device, const enum _spi_async_dev_cb_type type, const bool state... | {
ASSERT(device);
if (SPI_DEV_CB_ERROR == type) {
hri_sercomspi_write_INTEN_ERROR_bit(device->prvt, state);
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function returns if there is need to split page entry. */ | PAGE_ATTRIBUTE NeedSplitPage(IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 *PageEntry, IN PAGE_ATTRIBUTE PageAttribute) | /* This function returns if there is need to split page entry. */
PAGE_ATTRIBUTE NeedSplitPage(IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 *PageEntry, IN PAGE_ATTRIBUTE PageAttribute) | {
UINT64 PageEntryLength;
PageEntryLength = PageAttributeToLength (PageAttribute);
if (((BaseAddress & (PageEntryLength - 1)) == 0) && (Length >= PageEntryLength)) {
return PageNone;
}
if (((BaseAddress & PAGING_2M_MASK) != 0) || (Length < SIZE_2MB)) {
return Page4K;
}
return Page2M;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* fb_destroy_modelist: destroy modelist @head: struct list_head of modelist */ | void fb_destroy_modelist(struct list_head *head) | /* fb_destroy_modelist: destroy modelist @head: struct list_head of modelist */
void fb_destroy_modelist(struct list_head *head) | {
struct list_head *pos, *n;
list_for_each_safe(pos, n, head) {
list_del(pos);
kfree(pos);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Command response callback function for sd_ble_gap_conn_sec_get BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gap_conn_sec_get BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code = 0;
const uint32_t err_code = ble_gap_conn_sec_get_rsp_dec(
p_buffer,
length,
(ble_gap_conn_sec_t * *)&mp_out_params[0
],
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* fc_rport_state() - Return a string identifying the remote port's state @rdata: The remote port */ | static const char* fc_rport_state(struct fc_rport_priv *rdata) | /* fc_rport_state() - Return a string identifying the remote port's state @rdata: The remote port */
static const char* fc_rport_state(struct fc_rport_priv *rdata) | {
const char *cp;
cp = fc_rport_state_names[rdata->rp_state];
if (!cp)
cp = "Unknown";
return cp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* find an available list bitmap. If you can't find one, flush a commit list and try again */ | static struct reiserfs_list_bitmap* get_list_bitmap(struct super_block *sb, struct reiserfs_journal_list *jl) | /* find an available list bitmap. If you can't find one, flush a commit list and try again */
static struct reiserfs_list_bitmap* get_list_bitmap(struct super_block *sb, struct reiserfs_journal_list *jl) | {
int i, j;
struct reiserfs_journal *journal = SB_JOURNAL(sb);
struct reiserfs_list_bitmap *jb = NULL;
for (j = 0; j < (JOURNAL_NUM_BITMAPS * 3); j++) {
i = journal->j_list_bitmap_index;
journal->j_list_bitmap_index = (i + 1) % JOURNAL_NUM_BITMAPS;
jb = journal->j_list_bitmap + i;
if (journal->j_list_bitmap... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the specified ADC DMA request. */ | void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState) | /* Enables or disables the specified ADC DMA request. */
void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState) | {
assert_param(IS_ADC_DMA_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
ADCx->CR2 |= ADC_CR2_DMA;
}
else
{
ADCx->CR2 &= (uint32_t) (~ADC_CR2_DMA);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* return the total number of blocks to be allocate, including the direct and indirect blocks. */ | static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, int blocks_to_boundary) | /* return the total number of blocks to be allocate, including the direct and indirect blocks. */
static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, int blocks_to_boundary) | {
unsigned long count = 0;
if (k > 0) {
if (blks < blocks_to_boundary + 1)
count += blks;
else
count += blocks_to_boundary + 1;
return count;
}
count++;
while (count < blks && count <= blocks_to_boundary &&
le32_to_cpu(*(branch[0].p + count)) == 0) {
count++;
}
return count;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the UART clock.
This function enables the clock to the UART. */ | void am_hal_uart_clock_enable(uint32_t ui32Module) | /* Enable the UART clock.
This function enables the clock to the UART. */
void am_hal_uart_clock_enable(uint32_t ui32Module) | {
am_hal_clkgen_uarten_set(ui32Module, AM_HAL_CLKGEN_UARTEN_EN);
AM_REGn(UART, ui32Module, CR) |= AM_REG_UART_CR_CLKEN_M;
AM_REGn(UART, ui32Module, CR) |= AM_REG_UART_CR_CLKSEL_24MHZ;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* sn_fixup_ionodes() - This routine initializes the HUB data structure for each node in the system. This function is only executed when running with a non-ACPI capable PROM. */ | static void __init sn_fixup_ionodes(void) | /* sn_fixup_ionodes() - This routine initializes the HUB data structure for each node in the system. This function is only executed when running with a non-ACPI capable PROM. */
static void __init sn_fixup_ionodes(void) | {
struct hubdev_info *hubdev;
u64 status;
u64 nasid;
int i;
extern void sn_common_hubdev_init(struct hubdev_info *);
for (i = 0; i < num_cnodes; i++) {
hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo);
nasid = cnodeid_to_nasid(i);
hubdev->max_segment_number = 0xffffffff;
hubdev->max_pcibus_number = 0xf... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* SYSCTRL IIR4 Bus&Function Clock Enable and Reset Release. */ | void LL_SYSCTRL_IIR4_ClkEnRstRelease(void) | /* SYSCTRL IIR4 Bus&Function Clock Enable and Reset Release. */
void LL_SYSCTRL_IIR4_ClkEnRstRelease(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_IIR4BusClk_En(SYSCTRL);
__LL_SYSCTRL_IIR4FunClk_En(SYSCTRL);
__LL_SYSCTRL_IIR4SoftRst_Release(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RETURNS: 1 if wrong command, 0 if right. */ | static int check_command(int cmd) | /* RETURNS: 1 if wrong command, 0 if right. */
static int check_command(int cmd) | {
switch (cmd) {
case NAND_CMD_READ0:
case NAND_CMD_READ1:
case NAND_CMD_READSTART:
case NAND_CMD_PAGEPROG:
case NAND_CMD_READOOB:
case NAND_CMD_ERASE1:
case NAND_CMD_STATUS:
case NAND_CMD_SEQIN:
case NAND_CMD_READID:
case NAND_CMD_ERASE2:
case NAND_CMD_RESET:
case NAND_CMD_RNDOUT:
case NAND_CMD_RNDOUTSTA... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the I2C time out flag of the specified I2C port.
The */ | xtBoolean I2CTimeoutFlagGet(unsigned long ulBase) | /* Get the I2C time out flag of the specified I2C port.
The */
xtBoolean I2CTimeoutFlagGet(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
return ((xHWREG(ulBase + I2C_O_TOC) & I2C_TOC_TIF) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */ | ulong get_tbclk(void) | /* This function is derived from PowerPC code (timebase clock frequency). On ARM it returns the number of timer ticks per second. */
ulong get_tbclk(void) | {
ulong tbclk;
tbclk = TIMER_FREQ_HZ;
return tbclk;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This will create a new EFI_FILE_PROTOCOL identical to the Templace except that the new one has Unicode and Ascii knowledge. */ | EFI_FILE_PROTOCOL* CreateFileInterfaceFile(IN CONST EFI_FILE_PROTOCOL *Template, IN CONST BOOLEAN Unicode) | /* This will create a new EFI_FILE_PROTOCOL identical to the Templace except that the new one has Unicode and Ascii knowledge. */
EFI_FILE_PROTOCOL* CreateFileInterfaceFile(IN CONST EFI_FILE_PROTOCOL *Template, IN CONST BOOLEAN Unicode) | {
EFI_FILE_PROTOCOL_FILE *NewOne;
NewOne = AllocateZeroPool (sizeof (EFI_FILE_PROTOCOL_FILE));
if (NewOne == NULL) {
return (NULL);
}
CopyMem (NewOne, Template, sizeof (EFI_FILE_PROTOCOL_FILE));
NewOne->Orig = (EFI_FILE_PROTOCOL *)Template;
NewOne->Unicode = Unicode;
NewOne->Open ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Selects the TIM Group Channel 5 and Channel 2, OC2REFC is the logical AND of OC2REFC and OC5REF. */ | void TIM_SelectGC5C2(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Selects the TIM Group Channel 5 and Channel 2, OC2REFC is the logical AND of OC2REFC and OC5REF. */
void TIM_SelectGC5C2(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST4_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->CCR5 |= TIM_CCR5_GC5C2;
}
else
{
TIMx->CCR5 &= (uint32_t)~TIM_CCR5_GC5C2;
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* session lock must be held and if not called for a task that is still pending or from the xmit thread, then xmit thread must be suspended. */ | static void fail_scsi_task(struct iscsi_task *task, int err) | /* session lock must be held and if not called for a task that is still pending or from the xmit thread, then xmit thread must be suspended. */
static void fail_scsi_task(struct iscsi_task *task, int err) | {
struct iscsi_conn *conn = task->conn;
struct scsi_cmnd *sc;
int state;
sc = task->sc;
if (!sc)
return;
if (task->state == ISCSI_TASK_PENDING) {
conn->session->queued_cmdsn--;
state = ISCSI_TASK_COMPLETED;
} else if (err == DID_TRANSPORT_DISRUPTED)
state = ISCSI_TASK_ABRT_SESS_RECOV;
else
state = ISC... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In interrupt mode, handle the interrupt. NOTE: Assumes data->lock is held. */ | static irqreturn_t pmcmsptwi_interrupt(int irq, void *ptr) | /* In interrupt mode, handle the interrupt. NOTE: Assumes data->lock is held. */
static irqreturn_t pmcmsptwi_interrupt(int irq, void *ptr) | {
struct pmcmsptwi_data *data = ptr;
u32 reason = pmcmsptwi_readl(data->iobase +
MSP_TWI_INT_STS_REG_OFFSET);
pmcmsptwi_writel(reason, data->iobase + MSP_TWI_INT_STS_REG_OFFSET);
dev_dbg(&pmcmsptwi_adapter.dev, "Got interrupt 0x%08x\n", reason);
if (!(reason & MSP_TWI_INT_STS_DONE))
return IRQ_NONE;
data->... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* destroy a packet that has an RxRPC control buffer */ | void rxrpc_packet_destructor(struct sk_buff *skb) | /* destroy a packet that has an RxRPC control buffer */
void rxrpc_packet_destructor(struct sk_buff *skb) | {
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
struct rxrpc_call *call = sp->call;
_enter("%p{%p}", skb, call);
if (call) {
if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA)
rxrpc_hard_ACK_data(call, sp);
rxrpc_put_call(call);
sp->call = NULL;
}
if (skb->sk)
sock_rfree(skb);
_leave("");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns CR_OK upon sucessful completion, an error code otherwise. */ | enum CRStatus cr_font_size_set_predefined_absolute_font_size(CRFontSize *a_this, enum CRPredefinedAbsoluteFontSize a_predefined) | /* Returns CR_OK upon sucessful completion, an error code otherwise. */
enum CRStatus cr_font_size_set_predefined_absolute_font_size(CRFontSize *a_this, enum CRPredefinedAbsoluteFontSize a_predefined) | {
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
g_return_val_if_fail (a_predefined >= PREDEFINED_ABSOLUTE_FONT_SIZE
&& a_predefined < NB_FONT_SIZE_TYPE,
CR_BAD_PARAM_ERROR) ;
a_this->type = PREDEFINED_ABSOLUTE_FONT_SIZE ;
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Requires j_list_lock Called under jbd_lock_bh_state(jh2bh(jh)), and drops it */ | static int __try_to_free_cp_buf(struct journal_head *jh) | /* Requires j_list_lock Called under jbd_lock_bh_state(jh2bh(jh)), and drops it */
static int __try_to_free_cp_buf(struct journal_head *jh) | {
int ret = 0;
struct buffer_head *bh = jh2bh(jh);
if (jh->b_jlist == BJ_None && !buffer_locked(bh) &&
!buffer_dirty(bh) && !buffer_write_io_error(bh)) {
JBUFFER_TRACE(jh, "remove from checkpoint list");
ret = __journal_remove_checkpoint(jh) + 1;
jbd_unlock_bh_state(bh);
journal_remove_journal_head(bh);... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the actual frequency of USCI_SPI bus clock. Only available in Master mode. */ | uint32_t USPI_GetBusClock(USPI_T *uspi) | /* Get the actual frequency of USCI_SPI bus clock. Only available in Master mode. */
uint32_t USPI_GetBusClock(USPI_T *uspi) | {
uint32_t u32BusClk;
uint32_t u32ClkDiv;
u32ClkDiv = (uspi->BRGEN & USPI_BRGEN_CLKDIV_Msk) >> USPI_BRGEN_CLKDIV_Pos;
if(uspi == USPI0)
{
u32BusClk = (uint32_t)( CLK_GetPCLK0Freq() / ((u32ClkDiv+1ul)<<1) );
}
else
{
u32BusClk = (uint32_t)( CLK_GetPCLK1Freq() / ((u32ClkDiv... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* STUSB1602 sets the VCONN Role SWAP status (bit1 0x18 */ | STUSB1602_StatusTypeDef STUSB1602_VCONN_Role_Swap_Status_Set(uint8_t Addr, VCONN_Role_Swap_TypeDef st) | /* STUSB1602 sets the VCONN Role SWAP status (bit1 0x18 */
STUSB1602_StatusTypeDef STUSB1602_VCONN_Role_Swap_Status_Set(uint8_t Addr, VCONN_Role_Swap_TypeDef st) | {
STUSB1602_StatusTypeDef status = STUSB1602_OK;
STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
reg.b.VCONN_SWAP_EN = st;
status = STUSB1602_WriteReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
return status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Move entries from net_ee to done_ee, if ready. Grab done_ee, call all callbacks, free the entries. The callbacks typically send out ACKs. */ | static int drbd_process_done_ee(struct drbd_conf *mdev) | /* Move entries from net_ee to done_ee, if ready. Grab done_ee, call all callbacks, free the entries. The callbacks typically send out ACKs. */
static int drbd_process_done_ee(struct drbd_conf *mdev) | {
LIST_HEAD(work_list);
LIST_HEAD(reclaimed);
struct drbd_epoch_entry *e, *t;
int ok = (mdev->state.conn >= C_WF_REPORT_PARAMS);
spin_lock_irq(&mdev->req_lock);
reclaim_net_ee(mdev, &reclaimed);
list_splice_init(&mdev->done_ee, &work_list);
spin_unlock_irq(&mdev->req_lock);
list_for_each_entry_safe(e, t, &recl... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT8 EFIAPI BitFieldCountOnes64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit) | /* If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI BitFieldCountOnes64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit) | {
UINT64 BitField;
UINT8 Count;
ASSERT (EndBit < 64);
ASSERT (StartBit <= EndBit);
BitField = BitFieldRead64 (Operand, StartBit, EndBit);
Count = BitFieldCountOnes32 ((UINT32)BitField, 0, 31);
Count += BitFieldCountOnes32 ((UINT32)RShiftU64 (BitField, 32), 0, 31);
return Count;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This API is used to move the data index ahead of the current_frame_length parameter when unnecessary FIFO data appears while extracting the user specified data. */ | static void move_next_frame(uint16_t *data_index, uint8_t current_frame_length, const struct bmi160_dev *dev) | /* This API is used to move the data index ahead of the current_frame_length parameter when unnecessary FIFO data appears while extracting the user specified data. */
static void move_next_frame(uint16_t *data_index, uint8_t current_frame_length, const struct bmi160_dev *dev) | {
if ((*data_index + current_frame_length) > dev->fifo->length)
{
*data_index = dev->fifo->length;
}
else
{
*data_index = *data_index + current_frame_length;
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function will notity sof event to all of class. */ | rt_err_t _sof_notify(udevice_t device) | /* This function will notity sof event to all of class. */
rt_err_t _sof_notify(udevice_t device) | {
struct rt_list_node *i;
uclass_t cls;
RT_ASSERT(device != RT_NULL);
for (i = device->curr_cfg->cls_list.next;
i != &device->curr_cfg->cls_list;
i = i->next)
{
cls = (uclass_t)rt_list_entry(i, struct uclass, list);
if (cls->ops->sof_handler != RT_NULL)
... | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Prom init. We read our one and only communication with the firmware. Grab the amount of installed memory. Better boot loaders (CoLo) pass a command line too :-) */ | void __init prom_init(void) | /* Prom init. We read our one and only communication with the firmware. Grab the amount of installed memory. Better boot loaders (CoLo) pass a command line too :-) */
void __init prom_init(void) | {
unsigned long memsz;
int argc, i;
char **argv;
memsz = fw_arg0 & 0x7fff0000;
argc = fw_arg0 & 0x0000ffff;
argv = (char **)fw_arg1;
for (i = 1; i < argc; i++) {
strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
if (i < (argc - 1))
strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
}
add_memory_region(0x0,... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This file is generated automatically. You should not modify this source file, as your changes will be lost if this source file is re-generated. */ | int32_t adi_initComponents(void) | /* This file is generated automatically. You should not modify this source file, as your changes will be lost if this source file is re-generated. */
int32_t adi_initComponents(void) | {
int32_t result = 0;
return result;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Change Logs: Date Author Notes RiceChen the first version */ | void* imx6ull_get_periph_vaddr(rt_uint32_t paddr) | /* Change Logs: Date Author Notes RiceChen the first version */
void* imx6ull_get_periph_vaddr(rt_uint32_t paddr) | {
return rt_ioremap((void *)paddr, sizeof(sizeof(rt_uint32_t)));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* requires that rx->skb is a frame with ethernet header */ | static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | /* requires that rx->skb is a frame with ethernet header */
static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | {
static const u8 pae_group_addr[ETH_ALEN] __aligned(2)
= { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data;
if (ehdr->h_proto == htons(ETH_P_PAE) &&
(compare_ether_addr(ehdr->h_dest, rx->sdata->dev->dev_addr) == 0 ||
compare_ether_addr(ehdr->h_dest, pae_group... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Dissects the Init Event Request packet specified in Section 2.3.3. Standard states that the packet only has 1 field. */ | void dissect_ptpIP_init_event_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset) | /* Dissects the Init Event Request packet specified in Section 2.3.3. Standard states that the packet only has 1 field. */
void dissect_ptpIP_init_event_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 *offset) | {
guint32 connectionNumber;
col_set_str(
pinfo->cinfo,
COL_INFO,
"Init Event Request");
connectionNumber = tvb_get_letohl(tvb, *offset);
proto_tree_add_item(tree, hf_ptpIP_connectionNumber, tvb, *offset, 4,ENC_LITTLE_ENDIAN);
col_append_fstr(
pinfo->cinfo,
COL... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns the number of remaining data units in the current DMA Channelx transfer. */ | uint16_t DMA_GetCurrDataCounter(DMA_ChannelType *DMAChx) | /* Returns the number of remaining data units in the current DMA Channelx transfer. */
uint16_t DMA_GetCurrDataCounter(DMA_ChannelType *DMAChx) | {
assert_param(IS_DMA_ALL_PERIPH(DMAChx));
return ((uint16_t)(DMAChx->TXNUM));
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Clear the status of the specified HASH flag. */ | int32_t HASH_ClearStatus(uint32_t u32Flag) | /* Clear the status of the specified HASH flag. */
int32_t HASH_ClearStatus(uint32_t u32Flag) | {
int32_t i32Ret;
DDL_ASSERT(IS_HASH_FLAG_CLR(u32Flag));
i32Ret = HASH_Wait(HASH_ACTION_START);
if (i32Ret == LL_OK) {
CLR_REG32_BIT(CM_HASH->CR, u32Flag);
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read from NOR and write into SDRAM See errata 2.8.7. */ | int nor_sdram_bufcopy(ulong dst, ulong src, ulong size) | /* Read from NOR and write into SDRAM See errata 2.8.7. */
int nor_sdram_bufcopy(ulong dst, ulong src, ulong size) | {
int ret = 0;
ulong copysize = 0;
while(size) {
copysize = min(size, SOC_RAM_BUFFER_SIZE);
if ((ret = nor_sdram_bufcopy_onebuf(dst, src, copysize)) <= 0)
goto done;
dst += min(size, SOC_RAM_BUFFER_SIZE);
src += min(size, SOC_RAM_BUFFER_SIZE);
size -= min(size, SOC_RAM_BUFFER_SIZE);
}
done:
return ret... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Calculate the 32-bit CRC in a EFI table using the service provided by the gRuntime service. */ | VOID CalculateEfiHdrCrc(IN OUT EFI_TABLE_HEADER *Hdr) | /* Calculate the 32-bit CRC in a EFI table using the service provided by the gRuntime service. */
VOID CalculateEfiHdrCrc(IN OUT EFI_TABLE_HEADER *Hdr) | {
UINT32 Crc;
Hdr->CRC32 = 0;
Crc = 0;
gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
Hdr->CRC32 = Crc;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Extract the Previous Interface Name from a live interface */ | static int mapping_getprevname(int skfd, const char *ifname, struct if_mapping *target, int flag) | /* Extract the Previous Interface Name from a live interface */
static int mapping_getprevname(int skfd, const char *ifname, struct if_mapping *target, int flag) | {
skfd = skfd; ifname = ifname; flag = flag;
target->active[SELECT_PREVNAME] = 1;
return(0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enable all interrupts on the CPU.
This routine can be called from either interrupt, task or fiber level. */ | void posix_irq_unlock(unsigned int key) | /* Enable all interrupts on the CPU.
This routine can be called from either interrupt, task or fiber level. */
void posix_irq_unlock(unsigned int key) | {
hw_irq_ctrl_change_lock(key);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Enable or disable interrupt on the rising edge of a event line */ | void stm32_exti_enable_int(unsigned int line, int enable) | /* Enable or disable interrupt on the rising edge of a event line */
void stm32_exti_enable_int(unsigned int line, int enable) | {
if (line >= STM32F2_EXTI_NUM_LINES)
goto out;
if (enable) {
stm32_exti_clear_pending(line);
KINETIS_EXTI->rtsr |= (1 << line);
KINETIS_EXTI->ftsr &= ~(1 << line);
KINETIS_EXTI->imr |= (1 << line);
} else {
KINETIS_EXTI->imr &= ~(1 << line);
KINETIS_EXTI->rtsr &= ~(1 << line);
KINETIS_EXTI->ftsr &= ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is used to set duty ratio. */ | int tls_pwm_duty_config(u8 channel, u8 duty) | /* This function is used to set duty ratio. */
int tls_pwm_duty_config(u8 channel, u8 duty) | {
u32 temp = 0;
if(channel > (PWM_CHANNEL_MAX_NUM - 1))
{
TLS_DBGPRT_ERR("duty param err\n");
return WM_FAILED;
}
if (duty == 0)
{
tls_pwm_stop(channel);
return WM_SUCCESS;
}
if (4 == channel)
{
temp = tls_reg_read32(HR_PWM_CH4_REG2) & ~0x0000FF00;
temp |= (duty << 8);
... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Write a single variable length string with header to the server. */ | static int write_mqtt_string(struct mqtt_client_t *self_p, struct mqtt_string_t *mqtt_string) | /* Write a single variable length string with header to the server. */
static int write_mqtt_string(struct mqtt_client_t *self_p, struct mqtt_string_t *mqtt_string) | {
int res;
uint8_t buf[2];
if (mqtt_string->size == 0 || mqtt_string->buf_p == NULL) {
return (-EINVAL);
}
if (mqtt_string->size > 0xffff) {
return (-EINVAL);
}
buf[0] = MSB(mqtt_string->size);
buf[1] = LSB(mqtt_string->size);
if (chan_write(self_p->transport.out_p, &... | eerimoq/simba | C++ | Other | 337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.