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
|
|---|---|---|---|---|---|---|---|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
|
void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
|
{
Android_JNI_GetLocale(buf, buflen);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* SYSCTRL LSTIMER Bus Clock Enable and Reset Release. */
|
void LL_SYSCTRL_LSTMR_ClkEnRstRelease(void)
|
/* SYSCTRL LSTIMER Bus Clock Enable and Reset Release. */
void LL_SYSCTRL_LSTMR_ClkEnRstRelease(void)
|
{
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_LSTIMERBusClk_En(SYSCTRL);
__LL_SYSCTRL_LSTIMERSoftRst_Release(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Given type of sub-partition, identify BPDT entry for it. Sub-Partition could lie either within BPDT or S-BPDT. */
|
static struct bpdt_entry* __find_entry_by_type(struct bpdt_entry *e, size_t count, int type)
|
/* Given type of sub-partition, identify BPDT entry for it. Sub-Partition could lie either within BPDT or S-BPDT. */
static struct bpdt_entry* __find_entry_by_type(struct bpdt_entry *e, size_t count, int type)
|
{
size_t i;
for (i = 0; i < count; i++) {
if (e[i].type == type)
break;
}
if (i == count)
return NULL;
return &e[i];
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* A multicast group has three types of members: full member, non member, and send only member. We need to keep track of the number of members of each type based on their join state. Adjust the number of members the belong to the specified join states. */
|
static void adjust_membership(struct mcast_group *group, u8 join_state, int inc)
|
/* A multicast group has three types of members: full member, non member, and send only member. We need to keep track of the number of members of each type based on their join state. Adjust the number of members the belong to the specified join states. */
static void adjust_membership(struct mcast_group *group, u8 join_state, int inc)
|
{
int i;
for (i = 0; i < 3; i++, join_state >>= 1)
if (join_state & 0x1)
group->members[i] += inc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This is ugly, but preferable to the alternatives. Otherwise we would either need to write a program to do it in /etc/rc (and risk confusion if the program gets run more than once; it would also be hard to make the program warp the clock precisely n hours) or compile in the timezone information into the kernel. Bad, bad.... */
|
static void warp_clock(void)
|
/* This is ugly, but preferable to the alternatives. Otherwise we would either need to write a program to do it in /etc/rc (and risk confusion if the program gets run more than once; it would also be hard to make the program warp the clock precisely n hours) or compile in the timezone information into the kernel. Bad, bad.... */
static void warp_clock(void)
|
{
write_seqlock_irq(&xtime_lock);
wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;
xtime.tv_sec += sys_tz.tz_minuteswest * 60;
update_xtime_cache(0);
write_sequnlock_irq(&xtime_lock);
clock_was_set();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Draws a vertical line from (x,y1) to (x,y2) of GrayScale level. */
|
void halLcdVLine(int x, int y1, int y2, unsigned char GrayScale)
|
/* Draws a vertical line from (x,y1) to (x,y2) of GrayScale level. */
void halLcdVLine(int x, int y1, int y2, unsigned char GrayScale)
|
{
int y_dir, y;
if ( y1 < y2 )
y_dir = 1;
else
y_dir = -1;
y = y1;
while (y != y2)
{
halLcdPixel( x,y, GrayScale);
y += y_dir;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0, and executing a WBINVD instruction. This function is only available on IA-32 and x64. */
|
VOID EFIAPI AsmDisableCache(VOID)
|
/* Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0, and executing a WBINVD instruction. This function is only available on IA-32 and x64. */
VOID EFIAPI AsmDisableCache(VOID)
|
{
_asm {
mov eax, cr0
bts eax, 30
btr eax, 29
mov cr0, eax
wbinvd
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The byte ordering of bitmaps is more natural on little endian architectures. See the big-endian headers include/asm-ppc64/bitops.h and include/asm-s390/bitops.h for the best explanations of this ordering. */
|
int __bitmap_empty(const unsigned long *bitmap, int bits)
|
/* The byte ordering of bitmaps is more natural on little endian architectures. See the big-endian headers include/asm-ppc64/bitops.h and include/asm-s390/bitops.h for the best explanations of this ordering. */
int __bitmap_empty(const unsigned long *bitmap, int bits)
|
{
int k, lim = bits/BITS_PER_LONG;
for (k = 0; k < lim; ++k)
if (bitmap[k])
return 0;
if (bits % BITS_PER_LONG)
if (bitmap[k] & BITMAP_LAST_WORD_MASK(bits))
return 0;
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Deinitializes the EXTI peripheral registers to their default reset values. */
|
void EXTI_DeInit(void)
|
/* Deinitializes the EXTI peripheral registers to their default reset values. */
void EXTI_DeInit(void)
|
{
u16 i;
exEXTI_LineDisable(~0x00000000);
EXTI->PR = EXTI->PR;
EXTI->CFGR &= EXTI_CFGR_MEMMODE;
for (i = 0; i < 4; i++) {
EXTI->CR[i] = 0;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* A. Mallick added siginfo for most cases (close to IA32) D. Mosberger added ia32_intercept() */
|
int ia32_intercept(struct pt_regs *regs, unsigned long isr)
|
/* A. Mallick added siginfo for most cases (close to IA32) D. Mosberger added ia32_intercept() */
int ia32_intercept(struct pt_regs *regs, unsigned long isr)
|
{
switch ((isr >> 16) & 0xff) {
case 0:
case 4:
case 1:
return -1;
case 2:
if (((isr >> 14) & 0x3) >= 2) {
ia64_psr(regs)->id = 1;
return 0;
} else
return -1;
}
return -1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* ADC Set DMA to Continue.
This flag is set when the converted voltage crosses the high or low thresholds. */
|
bool adc_awd(uint32_t adc)
|
/* ADC Set DMA to Continue.
This flag is set when the converted voltage crosses the high or low thresholds. */
bool adc_awd(uint32_t adc)
|
{
return (ADC_ISR(adc) & ADC_ISR_AWD1) &&
(ADC_ISR(adc) & ADC_ISR_AWD2) &&
(ADC_ISR(adc) & ADC_ISR_AWD3);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Function to read a register of the MAX7310. */
|
uint8_t max7310_reg_read(uint8_t reg_addr)
|
/* Function to read a register of the MAX7310. */
uint8_t max7310_reg_read(uint8_t reg_addr)
|
{
uint8_t buf;
max7310_i2c_req->reg_addr = reg_addr;
max7310_i2c_req->buffer = &buf;
i2c_read(max7310_i2c_req);
return buf;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Description: Process a user generated REMOVE message and remove */
|
static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info)
|
/* Description: Process a user generated REMOVE message and remove */
static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info)
|
{
char *domain;
struct netlbl_audit audit_info;
if (!info->attrs[NLBL_MGMT_A_DOMAIN])
return -EINVAL;
netlbl_netlink_auditinfo(skb, &audit_info);
domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]);
return netlbl_domhsh_remove(domain, &audit_info);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* try to convert a float to an integer, rounding according to 'mode'. */
|
int luaV_flttointeger(lua_Number n, lua_Integer *p, F2Imod mode)
|
/* try to convert a float to an integer, rounding according to 'mode'. */
int luaV_flttointeger(lua_Number n, lua_Integer *p, F2Imod mode)
|
{
if (mode == F2Ieq) return 0;
else if (mode == F2Iceil)
f += 1;
}
return lua_numbertointeger(f, p);
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value in the target buffer. */
|
CONST VOID* EFIAPI InternalMemScanMem64(IN CONST VOID *Buffer, IN UINTN Length, IN UINT64 Value)
|
/* Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value in the target buffer. */
CONST VOID* EFIAPI InternalMemScanMem64(IN CONST VOID *Buffer, IN UINTN Length, IN UINT64 Value)
|
{
CONST UINT64 *Pointer;
Pointer = (CONST UINT64 *)Buffer;
do {
if (*Pointer == Value) {
return Pointer;
}
++Pointer;
} while (--Length != 0);
return NULL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Constructor function of VarCheckPcdLib to register var check PCD handler. */
|
EFI_STATUS EFIAPI VarCheckPcdLibNullClassConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* Constructor function of VarCheckPcdLib to register var check PCD handler. */
EFI_STATUS EFIAPI VarCheckPcdLibNullClassConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
LocateVarCheckPcdBin ();
VarCheckLibRegisterAddressPointer ((VOID **)&mVarCheckPcdBin);
VarCheckLibRegisterSetVariableCheckHandler (SetVariableCheckHandlerPcd);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Writes and returns a new value to CR4. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
|
UINTN EFIAPI AsmWriteCr4(UINTN Value)
|
/* Writes and returns a new value to CR4. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmWriteCr4(UINTN Value)
|
{
_asm {
mov eax, Value
_emit 0x0f
_emit 0x22
_emit 0xE0
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* User processing time, it is recommended to avoid blocking task for long time. */
|
void USBPD_DPM_UserExecute(void const *argument)
|
/* User processing time, it is recommended to avoid blocking task for long time. */
void USBPD_DPM_UserExecute(void const *argument)
|
{
uint32_t _timing = osWaitForever;
osMessageQId queue = *(osMessageQId *)argument;
do{
osEvent event = osMessageGet(queue, _timing);
switch (((DPM_USER_EVENT)event.value.v & 0xF))
{
case DPM_USER_EVENT_TIMER:
if (DPM_TIMER_ENABLE_MSK == DPM_Ports[USBPD_PORT_0].DPM_TimerSRCExtendedCapa)
{
DPM_Ports[USBPD_PORT_0].DPM_TimerSRCExtendedCapa = 0;
USBPD_DPM_RequestGetSourceCapabilityExt(USBPD_PORT_0);
}
break;
default:
break;
}
_timing = CheckDPMTimers();
}
while(1);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* This function performs ECB encryption on input plain text blocks. */
|
void ecb_encrypt(uint8_t *plainText, uint8_t *cipherText, uint32_t size)
|
/* This function performs ECB encryption on input plain text blocks. */
void ecb_encrypt(uint8_t *plainText, uint8_t *cipherText, uint32_t size)
|
{
uint32_t input_block_size = 0;
uint8_t block_count = 0;
input_block_size = size/AES_BLOCK_SIZE;
for(block_count = 0;block_count < input_block_size; block_count++){
aes_cipher(plainText+(block_count * AES_BLOCK_SIZE),
cipherText+(block_count * AES_BLOCK_SIZE));
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* udc_disable_interrupts - disable interrupts switch off interrupts udc_ep0_packetsize - return ep0 packetsize */
|
void udc_enable(struct usb_device_instance *device)
|
/* udc_disable_interrupts - disable interrupts switch off interrupts udc_ep0_packetsize - return ep0 packetsize */
void udc_enable(struct usb_device_instance *device)
|
{
UDCDBGA ("enable device %p, status %d", device, device->status);
udc_devstat = 0;
udc_device = device;
if (!ep0_urb) {
ep0_urb =
usbd_alloc_urb (udc_device,
udc_device->bus->endpoint_array);
} else {
serial_printf ("udc_enable: ep0_urb already allocated %p\n",
ep0_urb);
}
UDCDBG ("Check clock status");
UDCREG (STATUS_REQ);
outl (inl (FUNC_MUX_CTRL_0) | UDC_VBUS_CTRL | UDC_VBUS_MODE,
FUNC_MUX_CTRL_0);
UDCREGL (FUNC_MUX_CTRL_0);
omap1510_configure_device (device);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Fix a string to only have the file name, removing starting at the first space of whatever is quoted. */
|
CHAR16* FixFileName(IN CHAR16 *FileName)
|
/* Fix a string to only have the file name, removing starting at the first space of whatever is quoted. */
CHAR16* FixFileName(IN CHAR16 *FileName)
|
{
CHAR16 *Copy;
CHAR16 *TempLocation;
if (FileName == NULL) {
return (NULL);
}
if (FileName[0] == L'\"') {
Copy = FileName+1;
if ((TempLocation = StrStr (Copy, L"\"")) != NULL) {
TempLocation[0] = CHAR_NULL;
}
} else {
Copy = FileName;
while (Copy[0] == L' ') {
Copy++;
}
if ((TempLocation = StrStr (Copy, L" ")) != NULL) {
TempLocation[0] = CHAR_NULL;
}
}
if (Copy[0] == CHAR_NULL) {
return (NULL);
}
return (Copy);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Th function frees statistical data buffer of all the FC nodes of the vport. */
|
void lpfc_free_bucket(struct lpfc_vport *vport)
|
/* Th function frees statistical data buffer of all the FC nodes of the vport. */
void lpfc_free_bucket(struct lpfc_vport *vport)
|
{
struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
if (!NLP_CHK_NODE_ACT(ndlp))
continue;
kfree(ndlp->lat_data);
ndlp->lat_data = NULL;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This is done by changing the page table attribute to be PRESENT. */
|
VOID EFIAPI UnsetGuardPage(IN EFI_PHYSICAL_ADDRESS BaseAddress)
|
/* This is done by changing the page table attribute to be PRESENT. */
VOID EFIAPI UnsetGuardPage(IN EFI_PHYSICAL_ADDRESS BaseAddress)
|
{
EFI_STATUS Status;
if (mSmmMemoryAttribute != NULL) {
mOnGuarding = TRUE;
Status = mSmmMemoryAttribute->ClearMemoryAttributes (
mSmmMemoryAttribute,
BaseAddress,
EFI_PAGE_SIZE,
EFI_MEMORY_RP|EFI_MEMORY_RO|EFI_MEMORY_XP
);
ASSERT_EFI_ERROR (Status);
if (gST == NULL) {
Status = mSmmMemoryAttribute->SetMemoryAttributes (
mSmmMemoryAttribute,
BaseAddress,
EFI_PAGE_SIZE,
EFI_MEMORY_XP
);
ASSERT_EFI_ERROR (Status);
}
mOnGuarding = FALSE;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read value stored in a PHY register. Note: MDI interface is assumed to already have been enabled. */
|
static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int *value)
|
/* Read value stored in a PHY register. Note: MDI interface is assumed to already have been enabled. */
static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int *value)
|
{
unsigned short mii_rxdata;
sep_emac_write(MAC_MII_ADDRESS,(unsigned long)(address<<8) | phy_addr);
sep_emac_write(MAC_MII_CMD ,0x2);
udelay(40);
sep_phy_wait();
mii_rxdata = sep_emac_read(MAC_MII_RXDATA);
*value = mii_rxdata;
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Asynchronous read a single char.
Sets up the driver to read data from the USART module to the data pointer given. If registered and enabled, a callback will be called when the receiving is completed. */
|
enum status_code usart_read_job(struct usart_module *const module, uint16_t *const rx_data)
|
/* Asynchronous read a single char.
Sets up the driver to read data from the USART module to the data pointer given. If registered and enabled, a callback will be called when the receiving is completed. */
enum status_code usart_read_job(struct usart_module *const module, uint16_t *const rx_data)
|
{
Assert(module);
Assert(rx_data);
return _usart_read_buffer(module, (uint8_t *)rx_data, 1);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized, or partly destroyed. If a resource is destroyed, it is marked as such in case the destroy failed and being called again later. */
|
VOID Dhcp6DestroyService(IN OUT DHCP6_SERVICE *Service)
|
/* Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized, or partly destroyed. If a resource is destroyed, it is marked as such in case the destroy failed and being called again later. */
VOID Dhcp6DestroyService(IN OUT DHCP6_SERVICE *Service)
|
{
ASSERT (Service->NumOfChild == 0);
if (Service->ClientId != NULL) {
FreePool (Service->ClientId);
}
if (Service->UdpIo != NULL) {
UdpIoFreeIo (Service->UdpIo);
}
FreePool (Service);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Setup the external reset length. The length is asserted during a time of pow(2, powl+1) Slow Clock(32KHz). The duration is between 60us and 2s. */
|
void RSTC_SetExtResetLength(AT91PS_RSTC rstc, unsigned char powl)
|
/* Setup the external reset length. The length is asserted during a time of pow(2, powl+1) Slow Clock(32KHz). The duration is between 60us and 2s. */
void RSTC_SetExtResetLength(AT91PS_RSTC rstc, unsigned char powl)
|
{
unsigned int rmr = READ_RSTC(rstc, RSTC_RMR);
rmr &= ~(AT91C_RSTC_KEY | AT91C_RSTC_ERSTL);
rmr |= (powl << 8) & AT91C_RSTC_ERSTL;
WRITE_RSTC(rstc, RSTC_RMR, rmr | RSTC_KEY_PASSWORD);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Return the state of the selected IO pin(s). */
|
uint32_t stmpe811_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
|
/* Return the state of the selected IO pin(s). */
uint32_t stmpe811_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
|
{
return((uint32_t)(IOE_Read(DeviceAddr, STMPE811_REG_IO_MP_STA) & (uint8_t)IO_Pin));
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* If the enable or disable AP operation cannot be completed prior to the return from this service, then EFI_UNSUPPORTED must be returned. */
|
EFI_STATUS EFIAPI PeiEnableDisableAP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
|
/* If the enable or disable AP operation cannot be completed prior to the return from this service, then EFI_UNSUPPORTED must be returned. */
EFI_STATUS EFIAPI PeiEnableDisableAP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
|
{
return MpInitLibEnableDisableAP (ProcessorNumber, EnableAP, HealthFlag);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Converts a text device path node to USB audio device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbAudio(CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to USB audio device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbAudio(CHAR16 *TextDeviceNode)
|
{
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_AUDIO;
UsbClassText.SubClassExist = TRUE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Parameters: ch FEC channel pa Physical (Hardware) Address for the selected FEC */
|
static void fec_set_address(const unsigned portCHAR *pa)
|
/* Parameters: ch FEC channel pa Physical (Hardware) Address for the selected FEC */
static void fec_set_address(const unsigned portCHAR *pa)
|
{
unsigned portCHAR crc;
MCF_FEC_PALR = ( pa[ 0 ] << 24 ) | ( pa[ 1 ] << 16 ) | ( pa[ 2 ] << 8 ) | ( pa[ 3 ] << 0 );
MCF_FEC_PAUR = ( pa[ 4 ] << 24 ) | ( pa[ 5 ] << 16 );
crc = fec_hash_address( pa );
if( crc >= 32 )
{
MCF_FEC_IAUR |= (unsigned portLONG)(1 << (crc - 32));
}
else
{
MCF_FEC_IALR |= (unsigned portLONG)(1 << crc);
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Notify the hypervisor using the VMGEXIT instruction that the SEV-ES guest wishes to be terminated. */
|
VOID SevEsProtocolFailure(IN UINT8 ReasonCode)
|
/* Notify the hypervisor using the VMGEXIT instruction that the SEV-ES guest wishes to be terminated. */
VOID SevEsProtocolFailure(IN UINT8 ReasonCode)
|
{
MSR_SEV_ES_GHCB_REGISTER Msr;
Msr.GhcbPhysicalAddress = 0;
Msr.GhcbTerminate.Function = GHCB_INFO_TERMINATE_REQUEST;
Msr.GhcbTerminate.ReasonCodeSet = GHCB_TERMINATE_GHCB;
Msr.GhcbTerminate.ReasonCode = ReasonCode;
AsmWriteMsr64 (MSR_SEV_ES_GHCB, Msr.GhcbPhysicalAddress);
AsmVmgExit ();
ASSERT (FALSE);
CpuDeadLoop ();
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the buffer with zeros, 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 AllocateReservedZeroPool(IN UINTN AllocationSize)
|
/* Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the buffer with zeros, 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 AllocateReservedZeroPool(IN UINTN AllocationSize)
|
{
return InternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Waits until the word is transmitted on the specified port. */
|
void SPIDataPut(unsigned long ulBase, unsigned long ulData)
|
/* Waits until the word is transmitted on the specified port. */
void SPIDataPut(unsigned long ulBase, unsigned long ulData)
|
{
while(!(HWREG(ulBase + MCSPI_O_CH0STAT)&MCSPI_CH0STAT_TXS))
{
}
HWREG(ulBase + MCSPI_O_TX0) = ulData;
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Opposite of ax_open(). Only used when "ifconfig <devname> down" is done. */
|
static int ax_close(struct net_device *dev)
|
/* Opposite of ax_open(). Only used when "ifconfig <devname> down" is done. */
static int ax_close(struct net_device *dev)
|
{
unsigned long flags;
spin_lock_irqsave(&dev_lock(dev), flags);
AX88190_init(dev, 0);
spin_unlock_irqrestore(&dev_lock(dev), flags);
netif_stop_queue(dev);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This file is part of the Simba project. */
|
static int test_bootloader(void)
|
/* This file is part of the Simba project. */
static int test_bootloader(void)
|
{
BTASSERT(upgrade_bootloader_enter() == -1);
BTASSERT(upgrade_bootloader_stay_set() == 0);
BTASSERT(upgrade_bootloader_stay_get() == 1);
BTASSERT(upgrade_bootloader_stay_clear() == 0);
BTASSERT(upgrade_bootloader_stay_get() == 0);
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(huart->Instance==USART1)
{
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Pack two data bytes into single value and take into account sign bit. */
|
static int16_t dht_convert_data(dht_sensor_type_t sensor_type, uint8_t msb, uint8_t lsb)
|
/* Pack two data bytes into single value and take into account sign bit. */
static int16_t dht_convert_data(dht_sensor_type_t sensor_type, uint8_t msb, uint8_t lsb)
|
{
int16_t data;
if (sensor_type == DHT_TYPE_DHT22 || sensor_type == DHT_TYPE_SI7021) {
data = msb & 0x7F;
data <<= 8;
data |= lsb;
if (msb & BIT(7)) {
data = 0 - data;
}
}
else {
data = msb * 10;
}
return data;
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* This function handles External lines 9 to 5 interrupt request. */
|
void EXTI9_5_IRQHandler(void)
|
/* This function handles External lines 9 to 5 interrupt request. */
void EXTI9_5_IRQHandler(void)
|
{
if(EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET)
{
EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
STM_EVAL_LEDOn(LED1);
RTC_ClearFlag(RTC_FLAG_SEC);
while(RTC_GetFlagStatus(RTC_FLAG_SEC) == RESET);
RTC_SetAlarm(RTC_GetCounter()+ 3);
RTC_WaitForLastTask();
PWR_EnterSTANDBYMode();
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Called from the 'insn_write' function to perform a single write. */
|
static void pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int data)
|
/* Called from the 'insn_write' function to perform a single write. */
static void pci224_ao_set_data(struct comedi_device *dev, int chan, int range, unsigned int data)
|
{
unsigned short mangled;
devpriv->ao_readback[chan] = data;
outw(1 << chan, dev->iobase + PCI224_DACCEN);
devpriv->daccon = COMBINE(devpriv->daccon, devpriv->hwrange[range],
(PCI224_DACCON_POLAR_MASK |
PCI224_DACCON_VREF_MASK));
outw(devpriv->daccon | PCI224_DACCON_FIFORESET,
dev->iobase + PCI224_DACCON);
mangled = (unsigned short)data << (16 - thisboard->ao_bits);
if ((devpriv->daccon & PCI224_DACCON_POLAR_MASK) ==
PCI224_DACCON_POLAR_BI) {
mangled ^= 0x8000;
}
outw(mangled, dev->iobase + PCI224_DACDATA);
inw(dev->iobase + PCI224_SOFTTRIG);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the number of hats on a joystick */
|
int SDL_JoystickNumHats(SDL_Joystick *joystick)
|
/* Get the number of hats on a joystick */
int SDL_JoystickNumHats(SDL_Joystick *joystick)
|
{
if (!SDL_PrivateJoystickValid(joystick)) {
return -1;
}
return joystick->nhats;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Returns the longest prefix not needing a quote up to maxlen if positive. This stops at the first \0 because it's marked as a character needing an escape. */
|
static ssize_t next_quote_pos(const char *s, ssize_t maxlen)
|
/* Returns the longest prefix not needing a quote up to maxlen if positive. This stops at the first \0 because it's marked as a character needing an escape. */
static ssize_t next_quote_pos(const char *s, ssize_t maxlen)
|
{
ssize_t len;
if (maxlen < 0) {
for (len = 0; !sq_must_quote(s[len]); len++);
} else {
for (len = 0; len < maxlen && !sq_must_quote(s[len]); len++);
}
return len;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set the output port width of the TPIU. */
|
void am_hal_tpiu_port_width_set(uint32_t ui32PortWidth)
|
/* Set the output port width of the TPIU. */
void am_hal_tpiu_port_width_set(uint32_t ui32PortWidth)
|
{
AM_REG(TPIU, CSPSR) = 1 << (ui32PortWidth - 1);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disables detection of pause frames with stations unicast address. When disabled GMAC only detects with the unique multicast address (802.3x). */
|
void synopGMAC_unicast_pause_frame_detect_disable(synopGMACdevice *gmacdev)
|
/* Disables detection of pause frames with stations unicast address. When disabled GMAC only detects with the unique multicast address (802.3x). */
void synopGMAC_unicast_pause_frame_detect_disable(synopGMACdevice *gmacdev)
|
{
synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacUnicastPauseFrame);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Indicate if a character is the end of a primitive value. */
|
static bool isEndOfPrimitive(char ch)
|
/* Indicate if a character is the end of a primitive value. */
static bool isEndOfPrimitive(char ch)
|
{
return ch == ',' || isOneOfThem(ch, blank) || isOneOfThem(ch, endofblock);
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* Add a resolved address to this file's list of resolved addresses. */
|
gboolean cf_add_ip_name_from_string(capture_file *cf, const char *addr, const char *name)
|
/* Add a resolved address to this file's list of resolved addresses. */
gboolean cf_add_ip_name_from_string(capture_file *cf, const char *addr, const char *name)
|
{
if (!add_ip_name_from_string(addr, name))
return FALSE;
cf->unsaved_changes = TRUE;
return TRUE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* work on completed aio dio IO, to convert unwritten extents to extents */
|
static void ext4_end_aio_dio_work(struct work_struct *work)
|
/* work on completed aio dio IO, to convert unwritten extents to extents */
static void ext4_end_aio_dio_work(struct work_struct *work)
|
{
ext4_io_end_t *io = container_of(work, ext4_io_end_t, work);
struct inode *inode = io->inode;
int ret = 0;
mutex_lock(&inode->i_mutex);
ret = ext4_end_aio_dio_nolock(io);
if (ret >= 0) {
if (!list_empty(&io->list))
list_del_init(&io->list);
ext4_free_io_end(io);
}
mutex_unlock(&inode->i_mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* note This function must be called by the lock owner. */
|
void XRDC2_UnlockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem)
|
/* note This function must be called by the lock owner. */
void XRDC2_UnlockMemExclAccess(XRDC2_Type *base, xrdc2_mem_t mem)
|
{
uint32_t mrc = XRDC2_GET_MRC((uint32_t)mem);
uint32_t mrgd = XRDC2_GET_MRGD((uint32_t)mem);
base->MRCI_MRGDJ[mrc][mrgd].MRC_MRGD_W6 = XRDC2_EAL_UNLOCKED;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* DAC volume attenuation mixer control (-64dB to 0dB) */
|
static int wm_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
/* DAC volume attenuation mixer control (-64dB to 0dB) */
static int wm_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = DAC_RES;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function frees an RSA key imported with either crypto_rsa_import_public_key() or crypto_rsa_import_private_key(). */
|
void crypto_rsa_free(struct crypto_rsa_key *key)
|
/* This function frees an RSA key imported with either crypto_rsa_import_public_key() or crypto_rsa_import_private_key(). */
void crypto_rsa_free(struct crypto_rsa_key *key)
|
{
if (key) {
bignum_deinit(key->n);
bignum_deinit(key->e);
bignum_deinit(key->d);
bignum_deinit(key->p);
bignum_deinit(key->q);
bignum_deinit(key->dmp1);
bignum_deinit(key->dmq1);
bignum_deinit(key->iqmp);
os_free(key);
}
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Refresh credentials. This is a no-op for AUTH_UNIX */
|
static int unx_refresh(struct rpc_task *task)
|
/* Refresh credentials. This is a no-op for AUTH_UNIX */
static int unx_refresh(struct rpc_task *task)
|
{
set_bit(RPCAUTH_CRED_UPTODATE, &task->tk_msg.rpc_cred->cr_flags);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* GK - Changed to support mounting root fs via NFS Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 Simplified starting of init: Michael A. Griffith */
|
static int __init kernel_init(void *)
|
/* GK - Changed to support mounting root fs via NFS Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 Simplified starting of init: Michael A. Griffith */
static int __init kernel_init(void *)
|
{
lock_kernel();
set_mems_allowed(node_possible_map);
set_cpus_allowed_ptr(current, cpu_all_mask);
init_pid_ns.child_reaper = current;
cad_pid = task_pid(current);
smp_prepare_cpus(setup_max_cpus);
do_pre_smp_initcalls();
start_boot_trace();
smp_init();
sched_init_smp();
do_basic_setup();
if (!ramdisk_execute_command)
ramdisk_execute_command = "/init";
if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
ramdisk_execute_command = NULL;
prepare_namespace();
}
init_post();
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Reads three signed 16 bit values over I2C. */
|
err_t lsm303accelRead48(uint8_t addr, uint8_t reg, uint8_t buffer[6])
|
/* Reads three signed 16 bit values over I2C. */
err_t lsm303accelRead48(uint8_t addr, uint8_t reg, uint8_t buffer[6])
|
{
I2CWriteLength = 2;
I2CReadLength = 0;
I2CMasterBuffer[0] = addr;
I2CMasterBuffer[1] = reg | (0x80);
i2cEngine();
I2CWriteLength = 0;
I2CReadLength = 6;
I2CMasterBuffer[0] = addr | 0x01;
ASSERT_I2C_STATUS(i2cEngine());
uint8_t i;
for (i = 0; i < 6; i++)
{
buffer[i] = I2CSlaveBuffer[i];
}
return ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Modified 1995, 1996 by Volker Lendecke to be usable for ncp Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache */
|
static int _recv(struct socket *sock, void *buf, int size, unsigned flags)
|
/* Modified 1995, 1996 by Volker Lendecke to be usable for ncp Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache */
static int _recv(struct socket *sock, void *buf, int size, unsigned flags)
|
{
struct msghdr msg = {NULL, };
struct kvec iov = {buf, size};
return kernel_recvmsg(sock, &msg, &iov, 1, size, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures clocks, LCD, port pints, etc. necessary to execute this demo. */
|
static void prvSetupHardware(void)
|
/* Configures clocks, LCD, port pints, etc. necessary to execute this demo. */
static void prvSetupHardware(void)
|
{
unsigned long ulCPU_Clock_KHz = ( configCPU_CLOCK_HZ / 1000UL );
taskDISABLE_INTERRUPTS();
WDTCTL = WDTPW + WDTHOLD;
halBoardInit();
LFXT_Start( XT1DRIVE_0 );
Init_FLL_Settle( ( unsigned short ) ulCPU_Clock_KHz, 488 );
halButtonsInit( BUTTON_ALL );
halButtonsInterruptEnable( BUTTON_SELECT );
halLcdInit();
halLcdSetContrast( 100 );
halLcdClearScreen();
halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT );
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Only data is little endian, addr has cpu endianess */
|
static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr, __le16 *data, u16 count)
|
/* Only data is little endian, addr has cpu endianess */
static void hpi_read_words_le16(struct c67x00_device *dev, u16 addr, __le16 *data, u16 count)
|
{
unsigned long flags;
int i;
spin_lock_irqsave(&dev->hpi.lock, flags);
hpi_write_reg(dev, HPI_ADDR, addr);
for (i = 0; i < count; i++)
*data++ = cpu_to_le16(hpi_read_reg(dev, HPI_DATA));
spin_unlock_irqrestore(&dev->hpi.lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialization function for the Q15 FIR lattice filter. */
|
void arm_fir_lattice_init_q15(arm_fir_lattice_instance_q15 *S, uint16_t numStages, const q15_t *pCoeffs, q15_t *pState)
|
/* Initialization function for the Q15 FIR lattice filter. */
void arm_fir_lattice_init_q15(arm_fir_lattice_instance_q15 *S, uint16_t numStages, const q15_t *pCoeffs, q15_t *pState)
|
{
S->numStages = numStages;
S->pCoeffs = pCoeffs;
memset(pState, 0, (numStages) * sizeof(q15_t));
S->pState = pState;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This function is used to handle ports that do not have an interrupt. This doesn't work very well for 16450's, but gives barely passable results for a 16550A. (Although at the expense of much CPU overhead). */
|
static void serial8250_timeout(unsigned long data)
|
/* This function is used to handle ports that do not have an interrupt. This doesn't work very well for 16450's, but gives barely passable results for a 16550A. (Although at the expense of much CPU overhead). */
static void serial8250_timeout(unsigned long data)
|
{
struct uart_8250_port *up = (struct uart_8250_port *)data;
unsigned int iir;
iir = serial_in(up, UART_IIR);
if (!(iir & UART_IIR_NO_INT))
serial8250_handle_port(up);
mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the total number of whole minutes in the specified timespan */
|
int32_t timespanToMinutes(timespan_t *timespan)
|
/* Returns the total number of whole minutes in the specified timespan */
int32_t timespanToMinutes(timespan_t *timespan)
|
{
return (timespanToHours(timespan) * 60) + timespan->minutes;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Convert UINT64 data to big-endian for aligned with the FDT blob */
|
UINT64 EFIAPI CpuToFdt64(IN UINT64 Value)
|
/* Convert UINT64 data to big-endian for aligned with the FDT blob */
UINT64 EFIAPI CpuToFdt64(IN UINT64 Value)
|
{
return cpu_to_fdt64 (Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Specifies the low threshold and high threshold of analog watchdog. */
|
void ADC_AWD_SetThreshold(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint16_t u16LowThreshold, uint16_t u16HighThreshold)
|
/* Specifies the low threshold and high threshold of analog watchdog. */
void ADC_AWD_SetThreshold(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint16_t u16LowThreshold, uint16_t u16HighThreshold)
|
{
uint32_t u32AwdDr0;
uint32_t u32AwdDr1;
DDL_ASSERT(IS_ADC_UNIT(ADCx));
DDL_ASSERT(IS_ADC_AWD(u8AwdUnit));
u32AwdDr0 = (uint32_t)&ADCx->AWD0DR0;
u32AwdDr1 = (uint32_t)&ADCx->AWD0DR1;
WRITE_REG16(ADC_AWDx_DR(u8AwdUnit, u32AwdDr0), u16LowThreshold);
WRITE_REG16(ADC_AWDx_DR(u8AwdUnit, u32AwdDr1), u16HighThreshold);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ADC1 and ADC2 Interrupt Handler.
If users want to user the ADC1 Callback feature, Users should promise that the ADC0 Handle in the vector table is ADCIntHandler. */
|
void ADC12IntHandler(void)
|
/* ADC1 and ADC2 Interrupt Handler.
If users want to user the ADC1 Callback feature, Users should promise that the ADC0 Handle in the vector table is ADCIntHandler. */
void ADC12IntHandler(void)
|
{
unsigned long ulIntFlags = 0;
ulIntFlags = xHWREG(ADC1_BASE + ADC_SR);
if(ulIntFlags&(ADC_INT_END_CONVERSION|ADC_INT_AWD|ADC_INT_END_JEOC))
{
xHWREG(ADC1_BASE + ADC_SR) = ~ulIntFlags;
if(g_pfnADCHandlerCallbacks[0])
{
g_pfnADCHandlerCallbacks[0](0, ulIntFlags, 0, 0);
}
}
ulIntFlags = xHWREG(ADC2_BASE + ADC_SR);
if(ulIntFlags&(ADC_INT_END_CONVERSION|ADC_INT_AWD|ADC_INT_END_JEOC))
{
xHWREG(ADC1_BASE + ADC_SR) = ~ulIntFlags;
if(g_pfnADCHandlerCallbacks[1])
{
g_pfnADCHandlerCallbacks[1](0, ulIntFlags, 0, 0);
}
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Process a CPL_ACT_ESTABLISH message: -> host Updates connection state from an active establish CPL message. Runs with the connection lock held. */
|
static void s3_free_atid(struct t3cdev *cdev, unsigned int tid)
|
/* Process a CPL_ACT_ESTABLISH message: -> host Updates connection state from an active establish CPL message. Runs with the connection lock held. */
static void s3_free_atid(struct t3cdev *cdev, unsigned int tid)
|
{
struct s3_conn *c3cn = cxgb3_free_atid(cdev, tid);
if (c3cn)
c3cn_put(c3cn);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If String is not aligned on a 16-bit boundary, then ASSERT(). */
|
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
|
/* If String is not aligned on a 16-bit boundary, then ASSERT(). */
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
|
{
UINTN Length;
ASSERT (((UINTN)String & BIT0) == 0);
if ((String == NULL) || (MaxSize == 0)) {
return 0;
}
Length = 0;
while (String[Length] != 0) {
if (Length >= MaxSize - 1) {
return MaxSize;
}
Length++;
}
return Length;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disable Luminance 8-bit Y to 1-bit Y Conversion. */
|
void CCAP_DisableLumaYOne(void)
|
/* Disable Luminance 8-bit Y to 1-bit Y Conversion. */
void CCAP_DisableLumaYOne(void)
|
{
CCAP->CTL &= ~CCAP_CTL_Luma_Y_One_Msk;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If the underlying virtio-blk device doesn't support flushing (ie. write-caching), then this function should not be called by higher layers, according to EFI_BLOCK_IO_MEDIA characteristics set in */
|
EFI_STATUS EFIAPI VirtioBlkFlushBlocks(IN EFI_BLOCK_IO_PROTOCOL *This)
|
/* If the underlying virtio-blk device doesn't support flushing (ie. write-caching), then this function should not be called by higher layers, according to EFI_BLOCK_IO_MEDIA characteristics set in */
EFI_STATUS EFIAPI VirtioBlkFlushBlocks(IN EFI_BLOCK_IO_PROTOCOL *This)
|
{
VBLK_DEV *Dev;
Dev = VIRTIO_BLK_FROM_BLOCK_IO (This);
return Dev->BlockIoMedia.WriteCaching ?
SynchronousRequest (
Dev,
0,
0,
NULL,
TRUE
) :
EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Message: BackSpaceReqMessage Opcode: 0x0119 Type: CallControl Direction: pbx2dev VarLength: no */
|
static void handle_BackSpaceReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: BackSpaceReqMessage Opcode: 0x0119 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_BackSpaceReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Change Logs: Date Author Notes heyuanjie87 first version. Bernard code cleanup This function initializes watchdog */
|
static rt_err_t rt_watchdog_init(struct rt_device *dev)
|
/* Change Logs: Date Author Notes heyuanjie87 first version. Bernard code cleanup This function initializes watchdog */
static rt_err_t rt_watchdog_init(struct rt_device *dev)
|
{
rt_watchdog_t *wtd;
RT_ASSERT(dev != RT_NULL);
wtd = (rt_watchdog_t *)dev;
if (wtd->ops->init)
{
return (wtd->ops->init(wtd));
}
return (-RT_ENOSYS);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* computes a partial checksum, e.g. for TCP/UDP fragments why bother folding? */
|
__wsum csum_partial(const void *buff, int len, __wsum sum)
|
/* computes a partial checksum, e.g. for TCP/UDP fragments why bother folding? */
__wsum csum_partial(const void *buff, int len, __wsum sum)
|
{
unsigned int result = do_csum(buff, len);
addc(result, sum);
return (__force __wsum)from32to16(result);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Compat version of cputime_to_compat_timeval, perhaps this should be an inline in <linux/compat.h>. */
|
static void cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
|
/* Compat version of cputime_to_compat_timeval, perhaps this should be an inline in <linux/compat.h>. */
static void cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value)
|
{
struct timeval tv;
cputime_to_timeval(cputime, &tv);
value->tv_sec = tv.tv_sec;
value->tv_usec = tv.tv_usec;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* configure the free watchdog timer counter prescaler value */
|
ErrStatus fwdgt_prescaler_value_config(uint16_t prescaler_value)
|
/* configure the free watchdog timer counter prescaler value */
ErrStatus fwdgt_prescaler_value_config(uint16_t prescaler_value)
|
{
uint32_t timeout = FWDGT_PSC_TIMEOUT;
uint32_t flag_status = RESET;
FWDGT_CTL = FWDGT_WRITEACCESS_ENABLE;
do{
flag_status = FWDGT_STAT & FWDGT_STAT_PUD;
}while((--timeout > 0U) && ((uint32_t)RESET != flag_status));
if ((uint32_t)RESET != flag_status){
return ERROR;
}
FWDGT_PSC = (uint32_t)prescaler_value;
return SUCCESS;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function will do debouce, it is invoked when sub device attached to the hub port. */
|
rt_err_t rt_usb_hub_port_debounce(uhubinst_t uhub, rt_uint16_t port)
|
/* This function will do debouce, it is invoked when sub device attached to the hub port. */
rt_err_t rt_usb_hub_port_debounce(uhubinst_t uhub, rt_uint16_t port)
|
{
rt_err_t ret;
int i = 0, times = 20;
rt_uint32_t pstatus;
rt_bool_t connect = RT_TRUE;
RT_ASSERT(uhub != RT_NULL);
for(i=0; i<times; i++)
{
ret = rt_usb_hub_get_port_status(uhub, port, (rt_uint8_t*)&pstatus);
if(ret != RT_EOK) return ret;
if(!(pstatus & PORT_CCS))
{
connect = RT_FALSE;
break;
}
rt_thread_delay(1);
}
if(connect) return RT_EOK;
else return -RT_ERROR;
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* It acts on the state of GPIO pin. */
|
void USBPD_HW_IF_GPIO_Set(USBPD_BSP_GPIOPins_TypeDef gpio, GPIO_PinState PinState)
|
/* It acts on the state of GPIO pin. */
void USBPD_HW_IF_GPIO_Set(USBPD_BSP_GPIOPins_TypeDef gpio, GPIO_PinState PinState)
|
{
HAL_GPIO_WritePin(gpio.GPIOx, gpio.GPIO_Pin, PinState);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Finds the sbp2_command for a given outstanding command ORB. Only looks at the in-use list. */
|
static struct sbp2_command_info* sbp2util_find_command_for_orb(struct sbp2_lu *lu, dma_addr_t orb)
|
/* Finds the sbp2_command for a given outstanding command ORB. Only looks at the in-use list. */
static struct sbp2_command_info* sbp2util_find_command_for_orb(struct sbp2_lu *lu, dma_addr_t orb)
|
{
struct sbp2_command_info *cmd;
unsigned long flags;
spin_lock_irqsave(&lu->cmd_orb_lock, flags);
if (!list_empty(&lu->cmd_orb_inuse))
list_for_each_entry(cmd, &lu->cmd_orb_inuse, list)
if (cmd->command_orb_dma == orb) {
spin_unlock_irqrestore(
&lu->cmd_orb_lock, flags);
return cmd;
}
spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */
|
static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
|
/* This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag */
static int vfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
|
{
if (var->vmode & FB_VMODE_YWRAP) {
if (var->yoffset < 0
|| var->yoffset >= info->var.yres_virtual
|| var->xoffset)
return -EINVAL;
} else {
if (var->xoffset + var->xres > info->var.xres_virtual ||
var->yoffset + var->yres > info->var.yres_virtual)
return -EINVAL;
}
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
if (var->vmode & FB_VMODE_YWRAP)
info->var.vmode |= FB_VMODE_YWRAP;
else
info->var.vmode &= ~FB_VMODE_YWRAP;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Activate Single wire protocol bus (SUSPENDED or ACTIVATED state) */
|
void LL_SWPMI_Activate(SWPMI_TypeDef *SWPMIx)
|
/* Activate Single wire protocol bus (SUSPENDED or ACTIVATED state) */
void LL_SWPMI_Activate(SWPMI_TypeDef *SWPMIx)
|
{
CLEAR_BIT(SWPMIx->CR, SWPMI_CR_DEACT);
SET_BIT(SWPMIx->CR, SWPMI_CR_SWPACT);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Retrieve ordinal number of the given USART hardware instance. */
|
uint8_t _usart_usart_sync_get_hardware_index(const struct _usart_sync_device *const device)
|
/* Retrieve ordinal number of the given USART hardware instance. */
uint8_t _usart_usart_sync_get_hardware_index(const struct _usart_sync_device *const device)
|
{
ASSERT(device);
return _usart_get_hardware_index(device->hw);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* configure the PLLSAIR divider used as input of TLI */
|
void rcu_tli_clock_div_config(uint32_t pllsai_r_div)
|
/* configure the PLLSAIR divider used as input of TLI */
void rcu_tli_clock_div_config(uint32_t pllsai_r_div)
|
{
uint32_t reg;
reg = RCU_CFG1;
reg &= ~RCU_CFG1_PLLSAIRDIV;
RCU_CFG1 = (reg | pllsai_r_div);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Checks whether the FLASH SMPSEL is SMP1 or SMP2. */
|
void FLASH_SetSMPSELStatus(FLASH_SMPSEL FLASH_smpsel)
|
/* Checks whether the FLASH SMPSEL is SMP1 or SMP2. */
void FLASH_SetSMPSELStatus(FLASH_SMPSEL FLASH_smpsel)
|
{
assert_param(IS_FLASH_SMPSEL_STATE(FLASH_smpsel));
FLASH->CTRL &= CTRL_Reset_SMPSEL;
FLASH->CTRL |= FLASH_smpsel;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If a pin's mode is set to GPIO, it is configured as an input to avoid side-effects. The gpio can be manipulated later using standard GPIO API calls. */
|
static void config_pin(unsigned long cfg)
|
/* If a pin's mode is set to GPIO, it is configured as an input to avoid side-effects. The gpio can be manipulated later using standard GPIO API calls. */
static void config_pin(unsigned long cfg)
|
{
int pin = PIN_NUM(cfg);
int pull = PIN_PULL(cfg);
int af = PIN_ALT(cfg);
int output = PIN_DIR(cfg);
int val = PIN_VAL(cfg);
if (output)
db8500_gpio_make_output(pin, val);
else {
db8500_gpio_make_input(pin);
db8500_gpio_set_pull(pin, pull);
}
gpio_set_mode(pin, af);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* At exit, the @ha's flags.enable_64bit_addressing set to indicated supported addressing method. */
|
static void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha)
|
/* At exit, the @ha's flags.enable_64bit_addressing set to indicated supported addressing method. */
static void qla4xxx_config_dma_addressing(struct scsi_qla_host *ha)
|
{
int retval;
if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(64)) == 0) {
if (pci_set_consistent_dma_mask(ha->pdev, DMA_BIT_MASK(64))) {
dev_dbg(&ha->pdev->dev,
"Failed to set 64 bit PCI consistent mask; "
"using 32 bit.\n");
retval = pci_set_consistent_dma_mask(ha->pdev,
DMA_BIT_MASK(32));
}
} else
retval = pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get timebase clock frequency (like cpu_clk in Hz) */
|
unsigned long get_tbclk(void)
|
/* Get timebase clock frequency (like cpu_clk in Hz) */
unsigned long get_tbclk(void)
|
{
ulong tbclk;
tbclk = (gd->bus_clk + 3L) / 4L;
return (tbclk);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Return our stored notion of how the camera is/should be configured. The V4l2 spec wants us to be smarter, and actually get this from the camera (and not mess with it at open time). Someday. */
|
static int cafe_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, struct v4l2_format *f)
|
/* Return our stored notion of how the camera is/should be configured. The V4l2 spec wants us to be smarter, and actually get this from the camera (and not mess with it at open time). Someday. */
static int cafe_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, struct v4l2_format *f)
|
{
struct cafe_camera *cam = priv;
f->fmt.pix = cam->pix_format;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* reset the XGXS (between serdes and IBC). Slightly less intrusive than resetting the IBC or external link state, and useful in some cases to cause some retraining. To do this right, we reset IBC as well. */
|
static void ipath_7220_xgxs_reset(struct ipath_devdata *dd)
|
/* reset the XGXS (between serdes and IBC). Slightly less intrusive than resetting the IBC or external link state, and useful in some cases to cause some retraining. To do this right, we reset IBC as well. */
static void ipath_7220_xgxs_reset(struct ipath_devdata *dd)
|
{
u64 val, prev_val;
prev_val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_xgxsconfig);
val = prev_val | INFINIPATH_XGXS_RESET;
prev_val &= ~INFINIPATH_XGXS_RESET;
ipath_write_kreg(dd, dd->ipath_kregs->kr_control,
dd->ipath_control & ~INFINIPATH_C_LINKENABLE);
ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, val);
ipath_read_kreg32(dd, dd->ipath_kregs->kr_scratch);
ipath_write_kreg(dd, dd->ipath_kregs->kr_xgxsconfig, prev_val);
ipath_write_kreg(dd, dd->ipath_kregs->kr_control,
dd->ipath_control);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called by LVM after the snapshot is done. We need to reset the RECOVER flag here, even though the filesystem is not technically dirty yet. */
|
static int ext3_unfreeze(struct super_block *sb)
|
/* Called by LVM after the snapshot is done. We need to reset the RECOVER flag here, even though the filesystem is not technically dirty yet. */
static int ext3_unfreeze(struct super_block *sb)
|
{
if (!(sb->s_flags & MS_RDONLY)) {
lock_super(sb);
EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1);
unlock_super(sb);
journal_unlock_updates(EXT3_SB(sb)->s_journal);
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Abort the session when the transition from BS to RT is initiated. */
|
VOID EFIAPI IScsiOnExitBootService(IN EFI_EVENT Event, IN VOID *Context)
|
/* Abort the session when the transition from BS to RT is initiated. */
VOID EFIAPI IScsiOnExitBootService(IN EFI_EVENT Event, IN VOID *Context)
|
{
ISCSI_DRIVER_DATA *Private;
Private = (ISCSI_DRIVER_DATA *)Context;
gBS->CloseEvent (Private->ExitBootServiceEvent);
Private->ExitBootServiceEvent = NULL;
if (Private->Session != NULL) {
IScsiSessionAbort (Private->Session);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Checks whether the specified ADC flag is set or not. */
|
FlagStatus ADC_GetFlagStatus(ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
|
/* Checks whether the specified ADC flag is set or not. */
FlagStatus ADC_GetFlagStatus(ADC_TypeDef *ADCx, uint32_t ADC_FLAG)
|
{
FlagStatus bitstatus = RESET;
uint32_t tmpreg = 0;
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_GET_FLAG(ADC_FLAG));
if((uint32_t)(ADC_FLAG & 0x01000000))
{
tmpreg = ADCx->CR & 0xFEFFFFFF;
}
else
{
tmpreg = ADCx->ISR;
}
if ((tmpreg & ADC_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). It does not pad out the result like strncpy() does. */
|
size_t strlcpy(char *dest, const char *src, size_t size)
|
/* Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). It does not pad out the result like strncpy() does. */
size_t strlcpy(char *dest, const char *src, size_t size)
|
{
size_t ret = strlen(src);
if (size) {
size_t len = (ret >= size) ? size - 1 : ret;
memcpy(dest, src, len);
dest[len] = '\0';
}
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USBD_CtlContinueRx continue receive data on the ctl pipe. */
|
USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint32_t len)
|
/* USBD_CtlContinueRx continue receive data on the ctl pipe. */
USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint32_t len)
|
{
(void)USBD_LL_PrepareReceive(pdev, 0U, pbuf, len);
return USBD_OK;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* This function parse the value got from TPM2_GetCapability and return the TPM FirmwareVersion. */
|
EFI_STATUS EFIAPI Tpm2GetCapabilityFirmwareVersion(OUT UINT32 *FirmwareVersion1, OUT UINT32 *FirmwareVersion2)
|
/* This function parse the value got from TPM2_GetCapability and return the TPM FirmwareVersion. */
EFI_STATUS EFIAPI Tpm2GetCapabilityFirmwareVersion(OUT UINT32 *FirmwareVersion1, OUT UINT32 *FirmwareVersion2)
|
{
TPMS_CAPABILITY_DATA TpmCap;
TPMI_YES_NO MoreData;
EFI_STATUS Status;
Status = Tpm2GetCapability (
TPM_CAP_TPM_PROPERTIES,
TPM_PT_FIRMWARE_VERSION_1,
1,
&MoreData,
&TpmCap
);
if (EFI_ERROR (Status)) {
return Status;
}
*FirmwareVersion1 = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
Status = Tpm2GetCapability (
TPM_CAP_TPM_PROPERTIES,
TPM_PT_FIRMWARE_VERSION_2,
1,
&MoreData,
&TpmCap
);
if (EFI_ERROR (Status)) {
return Status;
}
*FirmwareVersion2 = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The Timer 0 default IRQ, declared in start up code. */
|
void TIMER0IntHandler(void)
|
/* The Timer 0 default IRQ, declared in start up code. */
void TIMER0IntHandler(void)
|
{
unsigned long ulBase = TIMER0_BASE;
unsigned long ulTemp0,ulTemp1;
ulTemp0 = (xHWREG(ulBase + TIMER_TISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_TISR) = ulTemp0;
ulTemp1 = (xHWREG(ulBase + TIMER_TEISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_TEISR) = ulTemp1;
if (g_pfnTimerHandlerCallbacks[0] != 0)
{
g_pfnTimerHandlerCallbacks[0](0, 0, ulTemp0 | ulTemp1, 0);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Enables or disables the specified I2C peripheral, this is one bit register. */
|
void USI_I2C_Cmd(USI_TypeDef *USIx, u8 NewState)
|
/* Enables or disables the specified I2C peripheral, this is one bit register. */
void USI_I2C_Cmd(USI_TypeDef *USIx, u8 NewState)
|
{
assert_param(IS_USI_I2C_ALL_PERIPH(USIx));
if (NewState != DISABLE)
{
USIx->I2C_ENABLE |= USI_I2C_ENABLE;
}
else
{
USIx->I2C_ENABLE &= ~USI_I2C_ENABLE;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Write multiple data in buffer to LCD controller. */
|
static void ili9225_write_ram_buffer(const ili9225_color_t *p_us_buf, uint32_t ul_size)
|
/* Write multiple data in buffer to LCD controller. */
static void ili9225_write_ram_buffer(const ili9225_color_t *p_us_buf, uint32_t ul_size)
|
{
volatile uint32_t i;
if (ul_size == 0)
return;
spi_enable(BOARD_ILI9225_SPI);
gpio_set_pin_high(BOARD_ILI9225_RS_GPIO);
for(i = 0; i < ul_size; i++){
spi_write(BOARD_ILI9225_SPI, p_us_buf[i], BOARD_ILI9225_SPI_NPCS, 0);
}
spi_disable(BOARD_ILI9225_SPI);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Returns the current time and date information, and the time-keeping capabilities of the hardware platform. */
|
EFI_STATUS EFIAPI GetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities)
|
/* Returns the current time and date information, and the time-keeping capabilities of the hardware platform. */
EFI_STATUS EFIAPI GetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities)
|
{
if (Time == NULL) {
return EFI_INVALID_PARAMETER;
}
Time->TimeZone = mTimeSettings.TimeZone;
Time->Daylight = mTimeSettings.Daylight;
return LibGetTime (Time, Capabilities);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return a pointer to the string mapped by 'key', if it is not present in the dictionary or if the stored object is not of QString type NULL will be returned. */
|
const char* qdict_get_try_str(const QDict *qdict, const char *key)
|
/* Return a pointer to the string mapped by 'key', if it is not present in the dictionary or if the stored object is not of QString type NULL will be returned. */
const char* qdict_get_try_str(const QDict *qdict, const char *key)
|
{
QObject *obj;
obj = qdict_get(qdict, key);
if (!obj || qobject_type(obj) != QTYPE_QSTRING)
return NULL;
return qstring_get_str(qobject_to_qstring(obj));
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Returns: the offset from the beginning of the buffer. */
|
goffset g_seekable_tell(GSeekable *seekable)
|
/* Returns: the offset from the beginning of the buffer. */
goffset g_seekable_tell(GSeekable *seekable)
|
{
GSeekableIface *iface;
g_return_val_if_fail (G_IS_SEEKABLE (seekable), 0);
iface = G_SEEKABLE_GET_IFACE (seekable);
return (* iface->tell) (seekable);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Here comes the high level stuff (i.e. the filesystem interface) and helper functions. Normally this should be the only part that has to be adapted to different kernel versions. */
|
static void flush_track_callback(unsigned long nr)
|
/* Here comes the high level stuff (i.e. the filesystem interface) and helper functions. Normally this should be the only part that has to be adapted to different kernel versions. */
static void flush_track_callback(unsigned long nr)
|
{
nr&=3;
writefromint = 1;
if (!try_fdc(nr)) {
flush_track_timer[nr].expires = jiffies + 1;
add_timer(flush_track_timer + nr);
return;
}
get_fdc(nr);
(*unit[nr].dtype->write_fkt)(nr);
if (!raw_write(nr)) {
printk (KERN_NOTICE "floppy disk write protected\n");
writefromint = 0;
writepending = 0;
}
rel_fdc();
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable the cache.
Call this function to completely shut down cache features. */
|
void am_hal_cachectrl_disable(void)
|
/* Disable the cache.
Call this function to completely shut down cache features. */
void am_hal_cachectrl_disable(void)
|
{
uint32_t ui32CacheCfg;
ui32CacheCfg = AM_REG(CACHECTRL, CACHECFG);
ui32CacheCfg &= (AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE(0) |
AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE(0));
AM_REG(CACHECTRL, CACHECFG) = ui32CacheCfg;
AM_REG(CACHECTRL, CACHECTRL);
AM_REG(CACHECTRL, CACHECTRL);
AM_REG(CACHECTRL, CACHECTRL);
AM_BFW(CACHECTRL, CACHECFG, ENABLE, 0);
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_CACHE_DIS);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Locking Note: This function expects that the lport mutex is locked before calling it. */
|
void fc_disc_stop_rports(struct fc_disc *disc)
|
/* Locking Note: This function expects that the lport mutex is locked before calling it. */
void fc_disc_stop_rports(struct fc_disc *disc)
|
{
struct fc_lport *lport;
struct fc_rport_priv *rdata, *next;
lport = disc->lport;
mutex_lock(&disc->disc_mutex);
list_for_each_entry_safe(rdata, next, &disc->rports, peers)
lport->tt.rport_logoff(rdata);
mutex_unlock(&disc->disc_mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* initialize an RTJpegContext, may be called multiple times */
|
void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp, int width, int height, const uint32_t *lquant, const uint32_t *cquant)
|
/* initialize an RTJpegContext, may be called multiple times */
void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp, int width, int height, const uint32_t *lquant, const uint32_t *cquant)
|
{
int i;
c->dsp = dsp;
for (i = 0; i < 64; i++) {
int z = ff_zigzag_direct[i];
int p = c->dsp->idct_permutation[i];
z = ((z << 3) | (z >> 3)) & 63;
c->scan[i] = c->dsp->idct_permutation[z];
c->lquant[p] = lquant[i];
c->cquant[p] = cquant[i];
}
c->w = width;
c->h = height;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.