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
|
|---|---|---|---|---|---|---|---|
/* Look for segments in samples in the sample queue matching the data in ptr. Samples not matching are removed from the queue. If a match is found, the next time it will look for matches starting from the end of the previous matched segment. */
|
static int find_sample_match(const uint8_t *data, int len, HintSampleQueue *queue, int *pos, int *match_sample, int *match_offset, int *match_len)
|
/* Look for segments in samples in the sample queue matching the data in ptr. Samples not matching are removed from the queue. If a match is found, the next time it will look for matches starting from the end of the previous matched segment. */
static int find_sample_match(const uint8_t *data, int len, HintSampleQueue *queue, int *pos, int *match_sample, int *match_offset, int *match_len)
|
{
while (queue->len > 0) {
HintSample *sample = &queue->samples[0];
if (sample->offset == 0 && sample->size > 5)
sample->offset = 5;
if (match_segments(data, len, sample->data, sample->offset,
sample->size, pos, match_offset, match_len) == 0) {
*match_sample = sample->sample_number;
sample->offset = *match_offset + *match_len + 5;
if (sample->offset + 10 >= sample->size)
sample_queue_pop(queue);
return 0;
}
if (sample->offset < 10 && sample->size > 20) {
sample->offset = sample->size/2;
} else {
sample_queue_pop(queue);
}
}
return -1;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* param base CSI peripheral base address. param mask The interrupts to disable, pass in as OR'ed value of ref _csi_interrupt_enable. */
|
void CSI_DisableInterrupts(CSI_Type *base, uint32_t mask)
|
/* param base CSI peripheral base address. param mask The interrupts to disable, pass in as OR'ed value of ref _csi_interrupt_enable. */
void CSI_DisableInterrupts(CSI_Type *base, uint32_t mask)
|
{
base->CSICR1 &= ~(mask & CSI_CSICR1_INT_EN_MASK);
base->CSICR3 &= ~(mask & CSI_CSICR3_INT_EN_MASK);
base->CSICR18 &= ~((mask & CSI_CSICR18_INT_EN_MASK) >> 6U);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Writes a number of bytes to memory provided the data does not exceed page boundaries. At the start of the buffer is placed the address at which the write will take place. The write size cannot exceed remaining page size. Maximum page size is 32 bytes. If the size of the write would exceed the remaining size of the page, the function exits with negative error code. */
|
int32_t memory_write_within_page(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size)
|
/* Writes a number of bytes to memory provided the data does not exceed page boundaries. At the start of the buffer is placed the address at which the write will take place. The write size cannot exceed remaining page size. Maximum page size is 32 bytes. If the size of the write would exceed the remaining size of the page, the function exits with negative error code. */
int32_t memory_write_within_page(struct memory_desc *dev, uint16_t address, uint8_t *data, uint32_t size)
|
{
int32_t ret;
uint8_t *transmit_array;
uint32_t page_remainder;
uint8_t i;
page_remainder = address % WRITE_SIZE_LIMIT;
page_remainder = WRITE_SIZE_LIMIT - page_remainder;
if(page_remainder < size)
return WRITE_SIZE_ERROR;
transmit_array = calloc((size + 2), sizeof *transmit_array);
if (!transmit_array)
return -1;
transmit_array[0] = (address & 0xff00) >> 8;
transmit_array[1] = (address & 0x00ff) >> 0;
for(i = 0; i < size; i++)
transmit_array[i + 2] = data[i];
ret = i2c_write(dev->i2c_dev, transmit_array, size + 2, true);
free(transmit_array);
mdelay(5);
return ret;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* This function will be called following a call to the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL Write function. */
|
VOID EFIAPI PlatformFvbDataWritten(IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, IN EFI_LBA Lba, IN UINTN Offset, IN UINTN NumBytes, IN UINT8 *Buffer)
|
/* This function will be called following a call to the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL Write function. */
VOID EFIAPI PlatformFvbDataWritten(IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, IN EFI_LBA Lba, IN UINTN Offset, IN UINTN NumBytes, IN UINT8 *Buffer)
|
{
STATIC EFI_EVENT EventToSignal = NULL;
if (!EfiAtRuntime ()) {
if (EventToSignal == NULL) {
EventToSignal = (EFI_EVENT)(UINTN)PcdGet64 (PcdEmuVariableEvent);
}
if (EventToSignal != NULL) {
gBS->SignalEvent (EventToSignal);
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* mux the pin to the "A" internal peripheral role. */
|
int at91_set_a_periph(unsigned port, unsigned pin, int use_pullup)
|
/* mux the pin to the "A" internal peripheral role. */
int at91_set_a_periph(unsigned port, unsigned pin, int use_pullup)
|
{
at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
u32 mask;
if ((port < AT91_PIO_PORTS) && (pin < 32)) {
mask = 1 << pin;
writel(mask, &pio->port[port].idr);
at91_set_pio_pullup(port, pin, use_pullup);
writel(mask, &pio->port[port].asr);
writel(mask, &pio->port[port].pdr);
}
return 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Check if any of the interfaces is up. */
|
static bool _udp_pcb_is_in_use()
|
/* Check if any of the interfaces is up. */
static bool _udp_pcb_is_in_use()
|
{
for (p=0; p<MDNS_IP_PROTOCOL_MAX; p++) {
if(_mdns_server->interfaces[i].pcbs[p].pcb){
return true;
}
}
}
return false;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Print the hexical DWORD raw index data to instruction content. */
|
UINTN EdbPrintRawIndexData32(IN UINT32 Data32)
|
/* Print the hexical DWORD raw index data to instruction content. */
UINTN EdbPrintRawIndexData32(IN UINT32 Data32)
|
{
BOOLEAN Sign;
UINTN NaturalUnits;
UINTN ConstantUnits;
UINTN Offset;
Sign = EdbGetNaturalIndex32 (Data32, &NaturalUnits, &ConstantUnits);
Offset = EdbPrintIndexData (Sign, NaturalUnits, ConstantUnits);
return Offset;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the reporting of an uncorrectable ECC error to the CPU. On this microcontroller, directly reading data from flash memory can result in a CPU trap, when that particular flash page is in the erased state. This is caused because an unprogrammed flash page also doesn't have its ECC bits set. */
|
static void CpuEnableUncorrectableEccErrorTrap(blt_bool enable)
|
/* Enables or disables the reporting of an uncorrectable ECC error to the CPU. On this microcontroller, directly reading data from flash memory can result in a CPU trap, when that particular flash page is in the erased state. This is caused because an unprogrammed flash page also doesn't have its ECC bits set. */
static void CpuEnableUncorrectableEccErrorTrap(blt_bool enable)
|
{
IfxCpu_ResourceCpu coreIndex;
blt_int16u password;
Ifx_CPU * cpu;
blt_int8u maskUEccVal;
if (enable)
{
maskUEccVal = 2;
}
else
{
maskUEccVal = 1;
}
password = IfxScuWdt_getGlobalEndinitPassword();
IfxScuWdt_clearGlobalEndinit(password);
for (coreIndex = 0; coreIndex < IfxCpu_ResourceCpu_none; coreIndex++)
{
cpu = IfxCpu_getAddress(coreIndex);
ASSERT_RT(cpu != NULL_PTR);
if (cpu != NULL_PTR)
{
cpu->FLASHCON1.B.MASKUECC = maskUEccVal;
}
}
IfxScuWdt_setGlobalEndinit(password);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Configures User push-button in GPIO or EXTI Line Mode. */
|
void UserButton_Init(uint32_t Button_Mode)
|
/* Configures User push-button in GPIO or EXTI Line Mode. */
void UserButton_Init(uint32_t Button_Mode)
|
{
USER_BUTTON_GPIO_CLK_ENABLE();
LL_GPIO_SetPinMode(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_MODE_INPUT);
LL_GPIO_SetPinPull(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_PULL_NO);
if(Button_Mode == BUTTON_MODE_EXTI)
{
USER_BUTTON_SYSCFG_SET_EXTI();
USER_BUTTON_EXTI_LINE_ENABLE();
USER_BUTTON_EXTI_RISING_TRIG_ENABLE();
NVIC_EnableIRQ(USER_BUTTON_EXTI_IRQn);
NVIC_SetPriority(USER_BUTTON_EXTI_IRQn,0x03);
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Some devices on the dock station need to have drivers called to perform hotplug operations after a dock event has occurred. Traverse the list of dock devices that have registered a hotplug handler, and call the handler. */
|
static void hotplug_dock_devices(struct dock_station *ds, u32 event)
|
/* Some devices on the dock station need to have drivers called to perform hotplug operations after a dock event has occurred. Traverse the list of dock devices that have registered a hotplug handler, and call the handler. */
static void hotplug_dock_devices(struct dock_station *ds, u32 event)
|
{
struct dock_dependent_device *dd;
mutex_lock(&ds->hp_lock);
list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list)
if (dd->ops && dd->ops->handler)
dd->ops->handler(dd->handle, event, dd->context);
list_for_each_entry(dd, &ds->dependent_devices, list) {
if (event == ACPI_NOTIFY_EJECT_REQUEST)
dock_remove_acpi_device(dd->handle);
else
dock_create_acpi_device(dd->handle);
}
mutex_unlock(&ds->hp_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Write byte to SDIO register, and read result.
Writes byte to SDIO register, and reads the register after write */
|
int sdio_rw_byte(struct sdio_func *func, uint32_t reg, uint8_t write_val, uint8_t *read_val)
|
/* Write byte to SDIO register, and read result.
Writes byte to SDIO register, and reads the register after write */
int sdio_rw_byte(struct sdio_func *func, uint32_t reg, uint8_t write_val, uint8_t *read_val)
|
{
int ret;
if ((func->card->type != CARD_SDIO) && (func->card->type != CARD_COMBO)) {
LOG_WRN("Card does not support SDIO commands");
return -ENOTSUP;
}
ret = k_mutex_lock(&func->card->lock, K_MSEC(CONFIG_SD_DATA_TIMEOUT));
if (ret) {
LOG_WRN("Could not get SD card mutex");
return -EBUSY;
}
ret = sdio_io_rw_direct(func->card, SDIO_IO_WRITE, func->num, reg,
write_val, read_val);
k_mutex_unlock(&func->card->lock);
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Function for tracing page 4 and common data. */
|
static void page4_data_log(ant_hrm_page4_data_t const *p_page_data)
|
/* Function for tracing page 4 and common data. */
static void page4_data_log(ant_hrm_page4_data_t const *p_page_data)
|
{
LOG_PAGE4("Previous heart beat event time: %u.",
(unsigned int)ANT_HRM_BEAT_TIME_SEC(p_page_data->prev_beat));
LOG_PAGE4("%03us\n\r", (unsigned int)ANT_HRM_BEAT_TIME_MSEC(p_page_data->prev_beat));
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. */
|
EFI_STATUS EFIAPI InitializeCpuExceptionHandlers(IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL)
|
/* Caller should try to get an array of interrupt and/or exception vectors that are in use and need to persist by EFI_VECTOR_HANDOFF_INFO defined in PI 1.3 specification. If caller cannot get reserved vector list or it does not exists, set VectorInfo to NULL. If VectorInfo is not NULL, the exception vectors will be initialized per vector attribute accordingly. */
EFI_STATUS EFIAPI InitializeCpuExceptionHandlers(IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL)
|
{
InitializeSpinLock (&mExceptionHandlerData.DisplayMessageSpinLock);
return InitializeCpuExceptionHandlersWorker (VectorInfo, &mExceptionHandlerData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Allocate memory blocks and check for alignment of 8 bytes.
Allocate 3 blocks of memory from 2 memory slabs respectively and check if all blocks are aligned to 8 bytes and free them. */
|
ZTEST(mslab_api, test_mslab_alloc_align)
|
/* Allocate memory blocks and check for alignment of 8 bytes.
Allocate 3 blocks of memory from 2 memory slabs respectively and check if all blocks are aligned to 8 bytes and free them. */
ZTEST(mslab_api, test_mslab_alloc_align)
|
{
tmslab_alloc_align(&mslab);
tmslab_alloc_align(&kmslab);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns 0 on success on < 0 on error. */
|
int phy_clear_interrupt(struct phy_device *phydev)
|
/* Returns 0 on success on < 0 on error. */
int phy_clear_interrupt(struct phy_device *phydev)
|
{
int err = 0;
if (phydev->drv->ack_interrupt)
err = phydev->drv->ack_interrupt(phydev);
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI S3PciBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI S3PciBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
|
{
return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldWrite16 (Address, StartBit, EndBit, Value));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Sets the control bits on a serial device. */
|
RETURN_STATUS EFIAPI SerialPortSetControl(IN UINT32 Control)
|
/* Sets the control bits on a serial device. */
RETURN_STATUS EFIAPI SerialPortSetControl(IN UINT32 Control)
|
{
UINT8 Mcr;
if ((Control & (~(EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY))) != 0) {
return RETURN_UNSUPPORTED;
}
Mcr = IoRead8 ((UINT16)gUartBase + MCR_OFFSET);
Mcr &= (~(MCR_DTRC | MCR_RTS));
if ((Control & EFI_SERIAL_DATA_TERMINAL_READY) == EFI_SERIAL_DATA_TERMINAL_READY) {
Mcr |= MCR_DTRC;
}
if ((Control & EFI_SERIAL_REQUEST_TO_SEND) == EFI_SERIAL_REQUEST_TO_SEND) {
Mcr |= MCR_RTS;
}
IoWrite8 ((UINT16)gUartBase + MCR_OFFSET, Mcr);
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Converts a text device path node to Serial device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSerial(IN CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to Serial device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSerial(IN CHAR16 *TextDeviceNode)
|
{
return ConvertFromTextAcpi (TextDeviceNode, 0x0501);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get Periph Status for the given peripheral ID. */
|
unsigned int PMC_IsPeriphEnabled(unsigned int id)
|
/* Get Periph Status for the given peripheral ID. */
unsigned int PMC_IsPeriphEnabled(unsigned int id)
|
{
if (id < 32) {
return (PMC->PMC_PCSR0 & (1 << id));
}
else {
return (PMC->PMC_PCSR1 & (1 << (id - 32)));
}
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* PLL supplies Epson LCD Clock, Ethernet Clock and UART external clock */
|
int pll_init(void)
|
/* PLL supplies Epson LCD Clock, Ethernet Clock and UART external clock */
int pll_init(void)
|
{
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
return i2c_write(CONFIG_SYS_I2C_PLL_ADDR, 0, 1,
(uchar *) pll_fs6377_regs, sizeof(pll_fs6377_regs));
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Unblock tasks waiting for static initialization to complete. Preconditions: */
|
static void signal_waiting_tasks()
|
/* Unblock tasks waiting for static initialization to complete. Preconditions: */
static void signal_waiting_tasks()
|
{
auto count = s_static_init_waiting_count;
while (count--) {
xSemaphoreGive(s_static_init_wait_sem);
}
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Returns waiting task that should be serviced first or NULL if none exists */
|
static struct ext_wait_queue* wq_get_first_waiter(struct mqueue_inode_info *info, int sr)
|
/* Returns waiting task that should be serviced first or NULL if none exists */
static struct ext_wait_queue* wq_get_first_waiter(struct mqueue_inode_info *info, int sr)
|
{
struct list_head *ptr;
ptr = info->e_wait_q[sr].list.prev;
if (ptr == &info->e_wait_q[sr].list)
return NULL;
return list_entry(ptr, struct ext_wait_queue, list);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* show_scaling_governor - show the current policy for the specified CPU */
|
static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
|
/* show_scaling_governor - show the current policy for the specified CPU */
static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
|
{
if (policy->policy == CPUFREQ_POLICY_POWERSAVE)
return sprintf(buf, "powersave\n");
else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE)
return sprintf(buf, "performance\n");
else if (policy->governor)
return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n",
policy->governor->name);
return -EINVAL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* if object 'o' has a finalizer, remove it from 'allgc' list (must search the list to find it) and link it in 'finobj' list. */
|
void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
|
/* if object 'o' has a finalizer, remove it from 'allgc' list (must search the list to find it) and link it in 'finobj' list. */
void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
|
{
GCObject **p;
if (issweepphase(g)) {
makewhite(g, o);
if (g->sweepgc == &o->next)
g->sweepgc = sweeptolive(L, g->sweepgc);
}
for (p = &g->allgc; *p != o; p = &(*p)->next) { }
*p = o->next;
o->next = g->finobj;
g->finobj = o;
l_setbit(o->marked, FINALIZEDBIT);
}
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* Disable the interrupt mode for the selected IT source. */
|
void stmpe811_DisableITSource(uint16_t DeviceAddr, uint8_t Source)
|
/* Disable the interrupt mode for the selected IT source. */
void stmpe811_DisableITSource(uint16_t DeviceAddr, uint8_t Source)
|
{
uint8_t tmp = 0;
tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_EN);
tmp &= ~Source;
IOE_Write(DeviceAddr, STMPE811_REG_INT_EN, tmp);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Clears the RCC reset flags. The reset flags are: RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST. */
|
void RCC_ClearFlag(void)
|
/* Clears the RCC reset flags. The reset flags are: RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST. */
void RCC_ClearFlag(void)
|
{
SET_BIT(RCC->CSR, RCC_CSR_RMVF);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This routine stops all the timers associated with a @vport. This function is invoked before disabling or deleting a @vport. Note that the physical port is treated as @vport 0. */
|
void lpfc_stop_vport_timers(struct lpfc_vport *vport)
|
/* This routine stops all the timers associated with a @vport. This function is invoked before disabling or deleting a @vport. Note that the physical port is treated as @vport 0. */
void lpfc_stop_vport_timers(struct lpfc_vport *vport)
|
{
del_timer_sync(&vport->els_tmofunc);
del_timer_sync(&vport->fc_fdmitmo);
lpfc_can_disctmo(vport);
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Parses Length and returns the length which DR7 LENn field accepts. For example: If we receive 1-Byte length then we should return 0. Zero gets written to DR7 LENn field. */
|
UINTN ConvertLengthData(IN UINTN Length)
|
/* Parses Length and returns the length which DR7 LENn field accepts. For example: If we receive 1-Byte length then we should return 0. Zero gets written to DR7 LENn field. */
UINTN ConvertLengthData(IN UINTN Length)
|
{
if (Length == 1) {
return 0;
} else if (Length == 2) {
return 1;
} else if (Length == 4) {
return 3;
} else {
return 2;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* initializes original state of the mass storage parameters */
|
void usb_host_msc_init(usb_core_instance *pdev)
|
/* initializes original state of the mass storage parameters */
void usb_host_msc_init(usb_core_instance *pdev)
|
{
if (host_driver_ifdevconnected(pdev) != 0UL) {
USBH_MSC_CBWData.field.CBWSignature = HOST_MSC_BOT_CBW_SIGNATURE;
USBH_MSC_CBWData.field.CBWTag = HOST_MSC_BOT_CBW_TAG;
USBH_MSC_CBWData.field.CBWLUN = 0U;
USBH_MSC_BOTXferParam.CmdStateMachine = USB_HOST_MSC_CMD_SEND;
}
BOTStallErrorCount = 0UL;
MSCErrorCount = 0U;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Return the local rtcp port used by the RTP connection */
|
int rtp_get_local_rtcp_port(URLContext *h)
|
/* Return the local rtcp port used by the RTP connection */
int rtp_get_local_rtcp_port(URLContext *h)
|
{
RTPContext *s = h->priv_data;
return udp_get_local_port(s->rtcp_hd);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* This file is part of the Simba project. */
|
static int test_init(void)
|
/* This file is part of the Simba project. */
static int test_init(void)
|
{
BTASSERT(science_module_init() == 0);
BTASSERT(science_module_init() == 0);
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Function: int msgqueue_msglength(MsgQueue_t *msgq) Purpose : calculate the total length of all messages on the message queue Params : msgq - queue to examine Returns : number of bytes of messages in queue */
|
int msgqueue_msglength(MsgQueue_t *msgq)
|
/* Function: int msgqueue_msglength(MsgQueue_t *msgq) Purpose : calculate the total length of all messages on the message queue Params : msgq - queue to examine Returns : number of bytes of messages in queue */
int msgqueue_msglength(MsgQueue_t *msgq)
|
{
struct msgqueue_entry *mq = msgq->qe;
int length = 0;
for (mq = msgq->qe; mq; mq = mq->next)
length += mq->msg.length;
return length;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* calculates the magnitude value in G between two axis
Note that */
|
static void tmag5273_magnitude_convert(uint8_t raw_value, const uint16_t range, struct sensor_value *magnitude)
|
/* calculates the magnitude value in G between two axis
Note that */
static void tmag5273_magnitude_convert(uint8_t raw_value, const uint16_t range, struct sensor_value *magnitude)
|
{
tmag5273_channel_b_field_convert(raw_value << 8, range, magnitude);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function returns %0 on success and a negative error code on failure. */
|
static int add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, void *node)
|
/* This function returns %0 on success and a negative error code on failure. */
static int add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, void *node)
|
{
struct ubifs_ch *ch = node;
int len = le32_to_cpu(ch->len), remains = c->leb_size - *offs;
if (len > remains) {
int sz = ALIGN(*offs, c->min_io_size), err;
ubifs_pad(c, buf + *offs, sz - *offs);
err = ubifs_leb_change(c, *lnum, buf, sz);
if (err)
return err;
*lnum = ubifs_next_log_lnum(c, *lnum);
*offs = 0;
}
memcpy(buf + *offs, node, len);
*offs += ALIGN(len, 8);
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* XDR a fixed length array. Unlike variable-length arrays, the storage of fixed length arrays is static and unfreeable. */
|
bool_t xdr_vector(XDR *xdrs, char *basep, unsigned int nelem, unsigned int elemsize, xdrproc_t xdr_elem)
|
/* XDR a fixed length array. Unlike variable-length arrays, the storage of fixed length arrays is static and unfreeable. */
bool_t xdr_vector(XDR *xdrs, char *basep, unsigned int nelem, unsigned int elemsize, xdrproc_t xdr_elem)
|
{
register unsigned int i;
register char *elptr;
elptr = basep;
for (i = 0; i < nelem; i++) {
if (!(*xdr_elem) (xdrs, elptr, LASTUNSIGNED)) {
return (FALSE);
}
elptr += elemsize;
}
return (TRUE);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* That's crap, since doing that while some partitions are opened or mounted will give you really nasty results. */
|
static int mm_revalidate(struct gendisk *disk)
|
/* That's crap, since doing that while some partitions are opened or mounted will give you really nasty results. */
static int mm_revalidate(struct gendisk *disk)
|
{
struct cardinfo *card = disk->private_data;
set_capacity(disk, card->mm_size << 1);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable or disable the TMR4 PWM main output by hardware after clear EMB event. */
|
void TMR4_PWM_EmbHWMainOutputCmd(CM_TMR4_TypeDef *TMR4x, en_functional_state_t enNewState)
|
/* Enable or disable the TMR4 PWM main output by hardware after clear EMB event. */
void TMR4_PWM_EmbHWMainOutputCmd(CM_TMR4_TypeDef *TMR4x, en_functional_state_t enNewState)
|
{
DDL_ASSERT(IS_TMR4_UNIT(TMR4x));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
if (ENABLE == enNewState) {
SET_REG32_BIT(TMR4x->PSCR, TMR4_PSCR_AOE);
} else {
CLR_REG32_BIT(TMR4x->PSCR, TMR4_PSCR_AOE);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The effects of a successful call to this function cannot be undone. */
|
EFI_STATUS TransferS3ContextToBootScript(IN S3_CONTEXT *S3Context)
|
/* The effects of a successful call to this function cannot be undone. */
EFI_STATUS TransferS3ContextToBootScript(IN S3_CONTEXT *S3Context)
|
{
RETURN_STATUS Status;
if (S3Context->Used == 0) {
ReleaseS3Context (S3Context);
return EFI_SUCCESS;
}
Status = QemuFwCfgS3CallWhenBootScriptReady (
AppendFwCfgBootScript,
S3Context,
sizeof (SCRATCH_BUFFER)
);
return (EFI_STATUS)Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function simply removes all the attribute files and then calls device_del. */
|
void attribute_container_class_device_del(struct device *classdev)
|
/* This function simply removes all the attribute files and then calls device_del. */
void attribute_container_class_device_del(struct device *classdev)
|
{
attribute_container_remove_attrs(classdev);
device_del(classdev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set up the SPI controller for a specified SPI slave device */
|
static int spi_a2f_setup(struct spi_device *s)
|
/* Set up the SPI controller for a specified SPI slave device */
static int spi_a2f_setup(struct spi_device *s)
|
{
struct spi_a2f *c = spi_master_get_devdata(s->master);
int ret = 0;
if (c->stopping) {
ret = -ESHUTDOWN;
goto Done;
}
if (spi_a2f_hw_bt_check(c, s->bits_per_word)) {
dev_err(&s->dev, "unsupported bits per word %d\n",
s->bits_per_word);
ret = -EINVAL;
goto Done;
}
c->slave = NULL;
Done:
d_printk(1, "slv=%s,spd=%d,cs=%d,bt=%d,md=0x%x,ret=%d\n",
dev_name(&s->dev), s->max_speed_hz,
s->chip_select, s->bits_per_word, s->mode, ret);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configure the selected source to generate a global interrupt or not. */
|
uint8_t mfxstm32l152_TS_ITStatus(uint16_t DeviceAddr)
|
/* Configure the selected source to generate a global interrupt or not. */
uint8_t mfxstm32l152_TS_ITStatus(uint16_t DeviceAddr)
|
{
return(mfxstm32l152_GlobalITStatus(DeviceAddr, MFXSTM32L152_IRQ_TS));
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Set Uart Baud Rate use baudrate parameter Ovsr & Ovsr_adj. */
|
void USI_UARTSetBaudExt(USI_TypeDef *USIx, u32 Ovsr, u32 Ovsr_adj)
|
/* Set Uart Baud Rate use baudrate parameter Ovsr & Ovsr_adj. */
void USI_UARTSetBaudExt(USI_TypeDef *USIx, u32 Ovsr, u32 Ovsr_adj)
|
{
assert_param(IS_ALL_USI_PERIPH(USIx));
USIx->UART_TX_FRACTION_BAUD &=(~(USI_UART_TX_XFACTOR|USI_UART_TX_XFACTOR_ADJ));
USIx->UART_TX_FRACTION_BAUD |= (Ovsr|(Ovsr_adj<<20));
USIx->UART_RX_BAUD_XTAL &= (~USI_RUART_LPRX_XTAL_CYCNUM_PERBIT);
USIx->UART_RX_BAUD_XTAL |= Ovsr;
USIx->UART_RX_FRACTION_BAUD_CTRL &= (~USI_UART_RX_XFACTOR_ADJ);
USIx->UART_RX_FRACTION_BAUD_CTRL |= Ovsr_adj;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Derive SHA384 HMAC-based Extract Key Derivation Function (HKDF). */
|
BOOLEAN EFIAPI HkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, IN UINTN PrkOutSize)
|
/* Derive SHA384 HMAC-based Extract Key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, IN UINTN PrkOutSize)
|
{
return HkdfMdExtract (MBEDTLS_MD_SHA384, Key, KeySize, Salt, SaltSize, PrkOut, PrkOutSize);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return: 0 on success, a negative error code otherwise. */
|
int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val)
|
/* Return: 0 on success, a negative error code otherwise. */
int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val)
|
{
int ret;
u8 cfg;
ret = spinand_get_cfg(spinand, &cfg);
if (ret)
return ret;
cfg &= ~mask;
cfg |= val;
return spinand_set_cfg(spinand, cfg);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Return the number of entries in the gExceptionType */
|
UINTN MaxEfiException(VOID)
|
/* Return the number of entries in the gExceptionType */
UINTN MaxEfiException(VOID)
|
{
return sizeof (gExceptionType)/sizeof (EFI_EXCEPTION_TYPE_ENTRY);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Modify the resource, the function returns the content of the register after the modification. */
|
static int twl4030_codec_set_resource(enum twl4030_codec_res id, int enable)
|
/* Modify the resource, the function returns the content of the register after the modification. */
static int twl4030_codec_set_resource(enum twl4030_codec_res id, int enable)
|
{
struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
u8 val;
twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val,
codec->resource[id].reg);
if (enable)
val |= codec->resource[id].mask;
else
val &= ~codec->resource[id].mask;
twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
val, codec->resource[id].reg);
return val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Announces that a buffer were filled and request the next */
|
static void vbi_buffer_filled(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, struct cx231xx_buffer *buf)
|
/* Announces that a buffer were filled and request the next */
static void vbi_buffer_filled(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, struct cx231xx_buffer *buf)
|
{
buf->vb.state = VIDEOBUF_DONE;
buf->vb.field_count++;
do_gettimeofday(&buf->vb.ts);
dev->vbi_mode.isoc_ctl.buf = NULL;
list_del(&buf->vb.queue);
wake_up(&buf->vb.done);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct. */
|
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
|
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct. */
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
|
{
uint32_t tmpreg = 0;
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock));
assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL));
assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA));
assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit));
tmpreg = USARTx->CR2;
tmpreg &= (uint32_t)~((uint32_t)CR2_CLOCK_CLEAR_MASK);
tmpreg |= (uint32_t)(USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL |
USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit);
USARTx->CR2 = tmpreg;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* This command is used to read and write (if supported by NIC H/W) nonvolatile storage on the NIC. */
|
VOID UndiNvData(IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
|
/* This command is used to read and write (if supported by NIC H/W) nonvolatile storage on the NIC. */
VOID UndiNvData(IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
|
{
EFI_STATUS Status;
Cdb->StatCode = PXE_STATCODE_UNSUPPORTED;
if (Nic->UsbEth->UsbEthUndi.UsbEthUndiNvData != NULL) {
Status = Nic->UsbEth->UsbEthUndi.UsbEthUndiNvData (Cdb, Nic);
if (EFI_ERROR (Status)) {
Cdb->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
} else {
Cdb->StatFlags = PXE_STATFLAGS_COMMAND_COMPLETE;
Cdb->StatCode = PXE_STATCODE_SUCCESS;
}
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Tries to find a free spu to run @ctx. If no free spu is available add the context to the runqueue so it gets woken up once an spu is available. */
|
int spu_activate(struct spu_context *ctx, unsigned long flags)
|
/* Tries to find a free spu to run @ctx. If no free spu is available add the context to the runqueue so it gets woken up once an spu is available. */
int spu_activate(struct spu_context *ctx, unsigned long flags)
|
{
struct spu *spu;
if (ctx->spu)
return 0;
spu_activate_top:
if (signal_pending(current))
return -ERESTARTSYS;
spu = spu_get_idle(ctx);
if (!spu && rt_prio(ctx->prio))
spu = find_victim(ctx);
if (spu) {
unsigned long runcntl;
runcntl = ctx->ops->runcntl_read(ctx);
__spu_schedule(spu, ctx);
if (runcntl & SPU_RUNCNTL_RUNNABLE)
spuctx_switch_state(ctx, SPU_UTIL_USER);
return 0;
}
if (ctx->flags & SPU_CREATE_NOSCHED) {
spu_prio_wait(ctx);
goto spu_activate_top;
}
spu_add_to_rq(ctx);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* ENABLE or DISABLE UARTx auto flow control.
@method UART_AutoFlowCtrlCmd */
|
void UART_AutoFlowCtrlCmd(UART_TypeDef *UARTx, FunctionalState NewState)
|
/* ENABLE or DISABLE UARTx auto flow control.
@method UART_AutoFlowCtrlCmd */
void UART_AutoFlowCtrlCmd(UART_TypeDef *UARTx, FunctionalState NewState)
|
{
_ASSERT(IS_UART(UARTx));
UARTx->CTRL.bit.FLOW_CTRL = NewState;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initialize the ethernetif layer and set network interface device up */
|
static void tcpip_init_done_callback(void *arg)
|
/* Initialize the ethernetif layer and set network interface device up */
static void tcpip_init_done_callback(void *arg)
|
{
rt_sem_release((rt_sem_t)arg);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set the slave select pins of the specified SPI port. */
|
void SPISSSet(unsigned long ulBase)
|
/* Set the slave select pins of the specified SPI port. */
void SPISSSet(unsigned long ulBase)
|
{
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_CNTRL0) |= SPI_CNTRL0_SELOEN;
xHWREG(ulBase + SPI_CNTRL0) |= SPI_CNTRL0_SSELC;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* get the verifying result of the SSL certification */
|
long SSL_get_verify_result(const SSL *ssl)
|
/* get the verifying result of the SSL certification */
long SSL_get_verify_result(const SSL *ssl)
|
{
SSL_ASSERT1(ssl);
return SSL_METHOD_CALL(get_verify_result, ssl);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* This searches for raid_device based on wwid, then return raid_device object. */
|
static struct _raid_device* _scsih_raid_device_find_by_wwid(struct MPT2SAS_ADAPTER *ioc, u64 wwid)
|
/* This searches for raid_device based on wwid, then return raid_device object. */
static struct _raid_device* _scsih_raid_device_find_by_wwid(struct MPT2SAS_ADAPTER *ioc, u64 wwid)
|
{
struct _raid_device *raid_device, *r;
r = NULL;
list_for_each_entry(raid_device, &ioc->raid_device_list, list) {
if (raid_device->wwid != wwid)
continue;
r = raid_device;
goto out;
}
out:
return r;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: a #gsize of the number of bytes peeked, or -1 on error. */
|
gsize g_buffered_input_stream_peek(GBufferedInputStream *stream, void *buffer, gsize offset, gsize count)
|
/* Returns: a #gsize of the number of bytes peeked, or -1 on error. */
gsize g_buffered_input_stream_peek(GBufferedInputStream *stream, void *buffer, gsize offset, gsize count)
|
{
gsize available;
gsize end;
g_return_val_if_fail (G_IS_BUFFERED_INPUT_STREAM (stream), -1);
g_return_val_if_fail (buffer != NULL, -1);
available = g_buffered_input_stream_get_available (stream);
if (offset > available)
return 0;
end = MIN (offset + count, available);
count = end - offset;
memcpy (buffer, stream->priv->buffer + stream->priv->pos + offset, count);
return count;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT32 EFIAPI S3PciSegmentBitFieldAndThenOr32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData)
|
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentBitFieldAndThenOr32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData)
|
{
return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* gfs2_io_error_bh_i - Flag a buffer I/O error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */
|
int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh, const char *function, char *file, unsigned int line)
|
/* gfs2_io_error_bh_i - Flag a buffer I/O error and withdraw Returns: -1 if this call withdrew the machine, 0 if it was already withdrawn */
int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh, const char *function, char *file, unsigned int line)
|
{
int rv;
rv = gfs2_lm_withdraw(sdp,
"GFS2: fsid=%s: fatal: I/O error\n"
"GFS2: fsid=%s: block = %llu\n"
"GFS2: fsid=%s: function = %s, file = %s, line = %u\n",
sdp->sd_fsname,
sdp->sd_fsname, (unsigned long long)bh->b_blocknr,
sdp->sd_fsname, function, file, line);
return rv;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function don't work with non-blocking fd's. Any of the possibilities with non-bloking fd's is bad: */
|
ssize_t qemu_write_full(int fd, const void *buf, size_t count)
|
/* This function don't work with non-blocking fd's. Any of the possibilities with non-bloking fd's is bad: */
ssize_t qemu_write_full(int fd, const void *buf, size_t count)
|
{
ssize_t ret = 0;
ssize_t total = 0;
while (count) {
ret = write(fd, buf, count);
if (ret < 0) {
if (errno == EINTR)
continue;
break;
}
count -= ret;
buf += ret;
total += ret;
}
return total;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* This function returns the number of supported languages on HiiHandle. */
|
UINT16 EFIAPI GetSupportedLanguageNumber(IN EFI_HII_HANDLE HiiHandle)
|
/* This function returns the number of supported languages on HiiHandle. */
UINT16 EFIAPI GetSupportedLanguageNumber(IN EFI_HII_HANDLE HiiHandle)
|
{
CHAR8 *Lang;
CHAR8 *Languages;
CHAR8 *LanguageString;
UINT16 LangNumber;
Languages = HiiGetSupportedLanguages (HiiHandle);
if (Languages == NULL) {
return 0;
}
LangNumber = 0;
Lang = AllocatePool (AsciiStrSize (Languages));
if (Lang != NULL) {
LanguageString = Languages;
while (*LanguageString != 0) {
GetNextLanguage (&LanguageString, Lang);
LangNumber++;
}
FreePool (Lang);
}
FreePool (Languages);
return LangNumber;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* ECC interrupt service routine. User application must invoke this function in his CRYPTO_IRQHandler() to let Crypto driver know ECC processing was done. */
|
void ECC_Complete(CRPT_T *crpt)
|
/* ECC interrupt service routine. User application must invoke this function in his CRYPTO_IRQHandler() to let Crypto driver know ECC processing was done. */
void ECC_Complete(CRPT_T *crpt)
|
{
if(crpt->INTSTS & CRPT_INTSTS_ECCIF_Msk)
{
g_ECC_done = 1UL;
crpt->INTSTS = CRPT_INTSTS_ECCIF_Msk;
}
if(crpt->INTSTS & CRPT_INTSTS_ECCEIF_Msk)
{
g_ECCERR_done = 1UL;
crpt->INTSTS = CRPT_INTSTS_ECCEIF_Msk;
printf("ECCEIF flag is set!!\n");
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Common Timer0 interrupt handler.
This function handles Timer0 counter overflow interrupt request */
|
void TIMER0_IRQHandler(void)
|
/* Common Timer0 interrupt handler.
This function handles Timer0 counter overflow interrupt request */
void TIMER0_IRQHandler(void)
|
{
if (TIMER0->IF & TIMER_IF_OF)
{
if (timerCbTable[0].cbFunc != RT_NULL)
{
(timerCbTable[0].cbFunc)(timerCbTable[0].userPtr);
}
BITBAND_Peripheral(&(TIMER0->IFC), _TIMER_IF_OF_SHIFT, 0x1UL);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns a pointer to the allocated event buffer structure on success otherwise ERR_PTR(errno). */
|
static struct dwc3_event_buffer* dwc3_alloc_one_event_buffer(struct dwc3 *dwc, unsigned length)
|
/* Returns a pointer to the allocated event buffer structure on success otherwise ERR_PTR(errno). */
static struct dwc3_event_buffer* dwc3_alloc_one_event_buffer(struct dwc3 *dwc, unsigned length)
|
{
struct dwc3_event_buffer *evt;
evt = devm_kzalloc((struct udevice *)dwc->dev, sizeof(*evt),
GFP_KERNEL);
if (!evt)
return ERR_PTR(-ENOMEM);
evt->dwc = dwc;
evt->length = length;
evt->buf = dma_alloc_coherent(length,
(unsigned long *)&evt->dma);
if (!evt->buf)
return ERR_PTR(-ENOMEM);
dwc3_flush_cache((uintptr_t)evt->buf, evt->length);
return evt;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* stop the network -> net_device queue. For slaves, stop the corresponding master interface. */
|
static __inline__ void isdn_net_device_stop_queue(isdn_net_local *lp)
|
/* stop the network -> net_device queue. For slaves, stop the corresponding master interface. */
static __inline__ void isdn_net_device_stop_queue(isdn_net_local *lp)
|
{
if (lp->master)
netif_stop_queue(lp->master);
else
netif_stop_queue(lp->netdev->dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The reason for tempudelay and not udelay is that loops_per_usec (used in udelay) is not set when functions here are called from time.c */
|
static void tempudelay(int usecs)
|
/* The reason for tempudelay and not udelay is that loops_per_usec (used in udelay) is not set when functions here are called from time.c */
static void tempudelay(int usecs)
|
{
volatile int loops;
for(loops = usecs * 12; loops > 0; loops--);}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Add a new Link Tuple with default values to the given Link Set */
|
static iib_link_set_entry_t * add_default_link_set_entry(iib_base_entry_t *base_entry, timex_t *now, uint64_t val_time)
|
/* Add a new Link Tuple with default values to the given Link Set */
static iib_link_set_entry_t * add_default_link_set_entry(iib_base_entry_t *base_entry, timex_t *now, uint64_t val_time)
|
{
iib_link_set_entry_t *new_entry;
new_entry = (iib_link_set_entry_t *) malloc(sizeof(iib_link_set_entry_t));
if (!new_entry) {
return NULL;
}
new_entry->address_list_head = NULL;
reset_link_set_entry(new_entry, now, val_time);
LL_PREPEND(base_entry->link_set_head, new_entry);
return new_entry;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* VmbusSetEvent - Send an event notification to the parent */
|
int VmbusSetEvent(u32 childRelId)
|
/* VmbusSetEvent - Send an event notification to the parent */
int VmbusSetEvent(u32 childRelId)
|
{
int ret = 0;
DPRINT_ENTER(VMBUS);
set_bit(childRelId & 31,
(unsigned long *)gVmbusConnection.SendInterruptPage +
(childRelId >> 5));
ret = HvSignalEvent();
DPRINT_EXIT(VMBUS);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable the PLL bypass and use the PLL clock.
USERCC2 must have been set by a call to */
|
void rcc_pll_bypass_disable(void)
|
/* Disable the PLL bypass and use the PLL clock.
USERCC2 must have been set by a call to */
void rcc_pll_bypass_disable(void)
|
{
SYSCTL_RCC2 &= ~SYSCTL_RCC2_BYPASS2;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Fills each ADC_InitStruct member with its default value. */
|
void ADC_InitStruct(ADC_InitType *ADC_InitStruct)
|
/* Fills each ADC_InitStruct member with its default value. */
void ADC_InitStruct(ADC_InitType *ADC_InitStruct)
|
{
ADC_InitStruct->WorkMode = ADC_WORKMODE_INDEPENDENT;
ADC_InitStruct->MultiChEn = DISABLE;
ADC_InitStruct->ContinueConvEn = DISABLE;
ADC_InitStruct->ExtTrigSelect = ADC_EXT_TRIGCONV_T1_CC1;
ADC_InitStruct->DatAlign = ADC_DAT_ALIGN_R;
ADC_InitStruct->ChsNumber = 1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* xfs_iozero clears the specified range of buffer supplied, and marks all the affected blocks as valid and modified. If an affected block is not allocated, it will be allocated. If an affected block is not completely overwritten, and is not valid before the operation, it will be read from disk before being partially zeroed. */
|
STATIC int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count)
|
/* xfs_iozero clears the specified range of buffer supplied, and marks all the affected blocks as valid and modified. If an affected block is not allocated, it will be allocated. If an affected block is not completely overwritten, and is not valid before the operation, it will be read from disk before being partially zeroed. */
STATIC int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count)
|
{
struct page *page;
struct address_space *mapping;
int status;
mapping = VFS_I(ip)->i_mapping;
do {
unsigned offset, bytes;
void *fsdata;
offset = (pos & (PAGE_CACHE_SIZE -1));
bytes = PAGE_CACHE_SIZE - offset;
if (bytes > count)
bytes = count;
status = pagecache_write_begin(NULL, mapping, pos, bytes,
AOP_FLAG_UNINTERRUPTIBLE,
&page, &fsdata);
if (status)
break;
zero_user(page, offset, bytes);
status = pagecache_write_end(NULL, mapping, pos, bytes, bytes,
page, fsdata);
WARN_ON(status <= 0);
pos += bytes;
count -= bytes;
status = 0;
} while (count);
return (-status);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
|
bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
|
/* param src USB HS PHY PLL clock source. param freq The frequency specified by src. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
|
{
const clock_usb_pll_config_t g_ccmConfigUsbPll = {.loopDivider = 0U};
if ((CCM_ANALOG->PLL_USB1 & CCM_ANALOG_PLL_USB1_ENABLE_MASK) != 0U)
{
CCM_ANALOG->PLL_USB1 |= CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK;
}
else
{
CLOCK_InitUsb1Pll(&g_ccmConfigUsbPll);
}
USBPHY1->CTRL &= ~USBPHY_CTRL_SFTRST_MASK;
USBPHY1->CTRL &= ~USBPHY_CTRL_CLKGATE_MASK;
USBPHY1->PWD = 0;
USBPHY1->CTRL |= USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK | USBPHY_CTRL_ENAUTOCLR_CLKGATE_MASK |
USBPHY_CTRL_ENUTMILEVEL2_MASK | USBPHY_CTRL_ENUTMILEVEL3_MASK;
return true;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Deinitializes the ETHERNET peripheral registers to their default reset values. */
|
void ETH_DeInit(void)
|
/* Deinitializes the ETHERNET peripheral registers to their default reset values. */
void ETH_DeInit(void)
|
{
RCC_EnableAHBPeriphReset(RCC_AHB_PERIPH_ETHMAC, ENABLE);
RCC_EnableAHBPeriphReset(RCC_AHB_PERIPH_ETHMAC, DISABLE);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
|
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_4;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG_ADC_CONTROL;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* parent_has_perm: when adding a new allow rule to a device whitelist, the rule must be allowed in the parent device */
|
static int parent_has_perm(struct dev_cgroup *childcg, struct dev_whitelist_item *wh)
|
/* parent_has_perm: when adding a new allow rule to a device whitelist, the rule must be allowed in the parent device */
static int parent_has_perm(struct dev_cgroup *childcg, struct dev_whitelist_item *wh)
|
{
struct cgroup *pcg = childcg->css.cgroup->parent;
struct dev_cgroup *parent;
if (!pcg)
return 1;
parent = cgroup_to_devcgroup(pcg);
return may_access_whitelist(parent, wh);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If any reserved bits in Address are set, then ASSERT(). */
|
UINT8 EFIAPI PciSegmentWrite8(IN UINT64 Address, IN UINT8 Value)
|
/* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentWrite8(IN UINT64 Address, IN UINT8 Value)
|
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0);
return (UINT8)PeiPciSegmentLibPciCfg2WriteWorker (Address, EfiPeiPciCfgWidthUint8, Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function will copy string no more than n bytes. */
|
char* rt_strncpy(char *dst, const char *src, rt_ubase_t n)
|
/* This function will copy string no more than n bytes. */
char* rt_strncpy(char *dst, const char *src, rt_ubase_t n)
|
{
if (n != 0)
{
char *d = dst;
const char *s = src;
do
{
if ((*d++ = *s++) == 0)
{
while (--n != 0)
*d++ = 0;
break;
}
} while (--n != 0);
}
return (dst);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This function scans tables for contiguous clusters. A contiguous run of clusters may be allocated, unallocated, or zero. */
|
static unsigned int qed_count_contiguous_clusters(BDRVQEDState *s, QEDTable *table, unsigned int index, unsigned int n, uint64_t *offset)
|
/* This function scans tables for contiguous clusters. A contiguous run of clusters may be allocated, unallocated, or zero. */
static unsigned int qed_count_contiguous_clusters(BDRVQEDState *s, QEDTable *table, unsigned int index, unsigned int n, uint64_t *offset)
|
{
unsigned int end = MIN(index + n, s->table_nelems);
uint64_t last = table->offsets[index];
unsigned int i;
*offset = last;
for (i = index + 1; i < end; i++) {
if (qed_offset_is_unalloc_cluster(last)) {
if (!qed_offset_is_unalloc_cluster(table->offsets[i])) {
break;
}
} else if (qed_offset_is_zero_cluster(last)) {
if (!qed_offset_is_zero_cluster(table->offsets[i])) {
break;
}
} else {
if (table->offsets[i] != last + s->header.cluster_size) {
break;
}
last = table->offsets[i];
}
}
return i - index;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Store a full block of iplan2 data after c2p conversion */
|
static void store_iplan2(void *dst, u32 bpp, u32 d[4])
|
/* Store a full block of iplan2 data after c2p conversion */
static void store_iplan2(void *dst, u32 bpp, u32 d[4])
|
{
int i;
for (i = 0; i < bpp/2; i++, dst += 4)
put_unaligned_be32(d[perm_c2p_16x8[i]], dst);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT32 EFIAPI S3IoBitFieldWrite32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
|
/* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3IoBitFieldWrite32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
|
{
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldWrite32 (Port, StartBit, EndBit, Value));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Register the NOR flash platform device with the kernel */
|
void __init lpc18xx_nor_flash_init(void)
|
/* Register the NOR flash platform device with the kernel */
void __init lpc18xx_nor_flash_init(void)
|
{
unsigned int size = 0;
switch (lpc18xx_platform_get()) {
case PLATFORM_LPC18XX_HITEX_LPC4350_EVAL:
case PLATFORM_LPC18XX_HITEX_LPC1850_EVAL:
size = 4*1024*1024;
break;
case PLATFORM_LPC18XX_EA_LPC4357_EVAL:
goto out;
default:
printk(KERN_ERR "%s: Unknown platform %#x, exit\n", __func__,
lpc18xx_platform_get());
goto out;
}
flash_resources[0].end = flash_resources[0].start + size - 1;
flash_partitions[2].size = size - FLASH_JFFS2_OFFSET;
if (size)
platform_device_register(&flash_dev);
out:
return;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* tty->count serves to decide whether the device should be enabled or disabled on the host. If it's equal to 1, then we are doing the first open or last close. Otherwise, open and close just return. */
|
int line_open(struct line *lines, struct tty_struct *tty)
|
/* tty->count serves to decide whether the device should be enabled or disabled on the host. If it's equal to 1, then we are doing the first open or last close. Otherwise, open and close just return. */
int line_open(struct line *lines, struct tty_struct *tty)
|
{
struct line *line = &lines[tty->index];
int err = -ENODEV;
spin_lock(&line->count_lock);
if (!line->valid)
goto out_unlock;
err = 0;
if (tty->count > 1)
goto out_unlock;
spin_unlock(&line->count_lock);
tty->driver_data = line;
line->tty = tty;
err = enable_chan(line);
if (err)
return err;
INIT_DELAYED_WORK(&line->task, line_timer_cb);
if (!line->sigio) {
chan_enable_winch(&line->chan_list, tty);
line->sigio = 1;
}
chan_window_size(&line->chan_list, &tty->winsize.ws_row,
&tty->winsize.ws_col);
return err;
out_unlock:
spin_unlock(&line->count_lock);
return err;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base ASRC base pointer. param channelPair ASRC channel pair param handle ASRC eDMA handle pointer. param callback Pointer to user callback function. param txDmaHandle ASRC send edma handle pointer. param periphConfig peripheral configuration. param userData User parameter passed to the callback function. */
|
void ASRC_TransferOutCreateHandleEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *outDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
|
/* param base ASRC base pointer. param channelPair ASRC channel pair param handle ASRC eDMA handle pointer. param callback Pointer to user callback function. param txDmaHandle ASRC send edma handle pointer. param periphConfig peripheral configuration. param userData User parameter passed to the callback function. */
void ASRC_TransferOutCreateHandleEDMA(ASRC_Type *base, asrc_edma_handle_t *handle, asrc_channel_pair_t channelPair, asrc_edma_callback_t callback, edma_handle_t *outDmaHandle, const asrc_p2p_edma_config_t *periphConfig, void *userData)
|
{
assert((handle != NULL) && (NULL != outDmaHandle));
uint32_t instance = ASRC_GetInstance(base);
(void)memset(&handle->out, 0, sizeof(asrc_out_edma_handle_t));
handle->out.outDmaHandle = outDmaHandle;
handle->callback = callback;
handle->userData = userData;
handle->out.state = kStatus_ASRCIdle;
handle->channelPair = channelPair;
handle->out.peripheralConfig = periphConfig;
s_edmaPrivateHandle[instance][channelPair].base = base;
s_edmaPrivateHandle[instance][channelPair].handle = handle;
EDMA_InstallTCDMemory(outDmaHandle, (edma_tcd_t *)(STCD_ADDR(handle->out.tcd)), ASRC_XFER_OUT_QUEUE_SIZE);
EDMA_SetCallback(outDmaHandle, ASRC_OutEDMACallback, &s_edmaPrivateHandle[instance][channelPair]);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns number of bytes read or error code, as appropriate */
|
static ssize_t smk_read_ambient(struct file *filp, char __user *buf, size_t cn, loff_t *ppos)
|
/* Returns number of bytes read or error code, as appropriate */
static ssize_t smk_read_ambient(struct file *filp, char __user *buf, size_t cn, loff_t *ppos)
|
{
ssize_t rc;
int asize;
if (*ppos != 0)
return 0;
mutex_lock(&smack_ambient_lock);
asize = strlen(smack_net_ambient) + 1;
if (cn >= asize)
rc = simple_read_from_buffer(buf, cn, ppos,
smack_net_ambient, asize);
else
rc = -EINVAL;
mutex_unlock(&smack_ambient_lock);
return rc;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns the maximum packet size including the FCoE header and trailer, but not including any Ethernet or VLAN headers. */
|
static u32 fcoe_ctlr_fcoe_size(struct fcoe_ctlr *fip)
|
/* Returns the maximum packet size including the FCoE header and trailer, but not including any Ethernet or VLAN headers. */
static u32 fcoe_ctlr_fcoe_size(struct fcoe_ctlr *fip)
|
{
return fip->lp->mfs + sizeof(struct fc_frame_header) +
sizeof(struct fcoe_hdr) + sizeof(struct fcoe_crc_eof);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures the TIMx Output Compare 2 Fast feature. */
|
void TIM_OC2FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
|
/* Configures the TIMx Output Compare 2 Fast feature. */
void TIM_OC2FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
|
{
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_123458_PERIPH(TIMx));
assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= CCMR_OC24FE_Reset;
tmpccmr1 |= (uint16_t)(TIM_OCFast << 8);
TIMx->CCMR1 = tmpccmr1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Attempt to initiate a splice from a file to a pipe. */
|
static long do_splice_to(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags)
|
/* Attempt to initiate a splice from a file to a pipe. */
static long do_splice_to(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags)
|
{
ssize_t (*splice_read)(struct file *, loff_t *,
struct pipe_inode_info *, size_t, unsigned int);
int ret;
if (unlikely(!(in->f_mode & FMODE_READ)))
return -EBADF;
ret = rw_verify_area(READ, in, ppos, len);
if (unlikely(ret < 0))
return ret;
if (in->f_op && in->f_op->splice_read)
splice_read = in->f_op->splice_read;
else
splice_read = default_file_splice_read;
return splice_read(in, ppos, pipe, len, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Flush CPU data cache. If the instruction cache is fully coherent with all DMA operations then function can just return EFI_SUCCESS. */
|
EFI_STATUS EFIAPI CpuFlushCpuDataCache(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Length, IN EFI_CPU_FLUSH_TYPE FlushType)
|
/* Flush CPU data cache. If the instruction cache is fully coherent with all DMA operations then function can just return EFI_SUCCESS. */
EFI_STATUS EFIAPI CpuFlushCpuDataCache(IN EFI_CPU_ARCH_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Length, IN EFI_CPU_FLUSH_TYPE FlushType)
|
{
if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {
AsmWbinvd ();
return EFI_SUCCESS;
} else if (FlushType == EfiCpuFlushTypeInvalidate) {
AsmInvd ();
return EFI_SUCCESS;
} else {
return EFI_UNSUPPORTED;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Stop announcing sys ticks into the kernel.
Disable the system ticks generation */
|
void sys_clock_disable(void)
|
/* Stop announcing sys ticks into the kernel.
Disable the system ticks generation */
void sys_clock_disable(void)
|
{
irq_disable(TIMER_TICK_IRQ);
hwtimer_set_silent_ticks(INT64_MAX);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* ipath_disable_wc - disable write combining for MMIO writes to the device @dd: infinipath device */
|
void ipath_disable_wc(struct ipath_devdata *dd)
|
/* ipath_disable_wc - disable write combining for MMIO writes to the device @dd: infinipath device */
void ipath_disable_wc(struct ipath_devdata *dd)
|
{
if (dd->ipath_wc_cookie) {
int r;
ipath_cdbg(VERBOSE, "undoing WCCOMB on pio buffers\n");
r = mtrr_del(dd->ipath_wc_cookie, dd->ipath_wc_base,
dd->ipath_wc_len);
if (r < 0)
dev_info(&dd->pcidev->dev,
"mtrr_del(%lx, %lx, %lx) failed: %d\n",
dd->ipath_wc_cookie, dd->ipath_wc_base,
dd->ipath_wc_len, r);
dd->ipath_wc_cookie = 0;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This API function disables the variable policy enforcement. If it's already been called once, will return EFI_ALREADY_STARTED. */
|
EFI_STATUS EFIAPI DisableVariablePolicy(VOID)
|
/* This API function disables the variable policy enforcement. If it's already been called once, will return EFI_ALREADY_STARTED. */
EFI_STATUS EFIAPI DisableVariablePolicy(VOID)
|
{
if (!IsVariablePolicyLibInitialized ()) {
return EFI_NOT_READY;
}
if (mProtectionDisabled) {
return EFI_ALREADY_STARTED;
}
if (mInterfaceLocked) {
return EFI_WRITE_PROTECTED;
}
if (!PcdGetBool (PcdAllowVariablePolicyEnforcementDisable)) {
return EFI_WRITE_PROTECTED;
}
mProtectionDisabled = TRUE;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Check whether this statement value is changed. If yes, update the statement value and return TRUE; else return FALSE. */
|
VOID UpdateStatement(IN OUT FORM_BROWSER_STATEMENT *Statement)
|
/* Check whether this statement value is changed. If yes, update the statement value and return TRUE; else return FALSE. */
VOID UpdateStatement(IN OUT FORM_BROWSER_STATEMENT *Statement)
|
{
GetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, GetSetValueWithHiiDriver);
mHiiPackageListUpdated = FALSE;
ProcessCallBackFunction (gCurrentSelection, gCurrentSelection->FormSet, gCurrentSelection->Form, Statement, EFI_BROWSER_ACTION_RETRIEVE, FALSE);
if (mHiiPackageListUpdated) {
mHiiPackageListUpdated = FALSE;
gCurrentSelection->Action = UI_ACTION_REFRESH_FORMSET;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function initialize TD_EVENT_HDR for EV_NO_ACTION Event Type other than EFI Specification ID event. The behavior is defined by TCG PC Client PFP Spec. Section 9.3.4 EV_NO_ACTION Event Types */
|
VOID InitNoActionEvent(IN OUT CC_EVENT_HDR *NoActionEvent, IN UINT32 EventSize)
|
/* This function initialize TD_EVENT_HDR for EV_NO_ACTION Event Type other than EFI Specification ID event. The behavior is defined by TCG PC Client PFP Spec. Section 9.3.4 EV_NO_ACTION Event Types */
VOID InitNoActionEvent(IN OUT CC_EVENT_HDR *NoActionEvent, IN UINT32 EventSize)
|
{
UINT32 DigestListCount;
TPMI_ALG_HASH HashAlgId;
UINT8 *DigestBuffer;
DigestBuffer = (UINT8 *)NoActionEvent->Digests.digests;
DigestListCount = 0;
NoActionEvent->MrIndex = 0;
NoActionEvent->EventType = EV_NO_ACTION;
ZeroMem (&NoActionEvent->Digests, sizeof (NoActionEvent->Digests));
if ((mTdxDxeData.BsCap.HashAlgorithmBitmap & EFI_CC_BOOT_HASH_ALG_SHA384) != 0) {
HashAlgId = TPM_ALG_SHA384;
CopyMem (DigestBuffer, &HashAlgId, sizeof (TPMI_ALG_HASH));
DigestBuffer += sizeof (TPMI_ALG_HASH) + GetHashSizeFromAlgo (HashAlgId);
DigestListCount++;
}
WriteUnaligned32 ((UINT32 *)&NoActionEvent->Digests.count, DigestListCount);
WriteUnaligned32 ((UINT32 *)DigestBuffer, EventSize);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initialize the GLOC module.
Support and FAQ: visit */
|
void gloc_init(struct gloc_dev_inst *const dev_inst, Gloc *const gloc)
|
/* Initialize the GLOC module.
Support and FAQ: visit */
void gloc_init(struct gloc_dev_inst *const dev_inst, Gloc *const gloc)
|
{
Assert(dev_inst);
Assert(gloc);
dev_inst->hw_dev = gloc;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function allocates space for a new copy of the device path specified by DevicePath. If DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */
|
EFI_DEVICE_PATH_PROTOCOL* UefiDevicePathLibDuplicateDevicePath(CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
/* This function allocates space for a new copy of the device path specified by DevicePath. If DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */
EFI_DEVICE_PATH_PROTOCOL* UefiDevicePathLibDuplicateDevicePath(CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
{
UINTN Size;
Size = GetDevicePathSize (DevicePath);
if (Size == 0) {
return NULL;
}
return AllocateCopyPool (Size, DevicePath);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function used to create subcommands with devices names. */
|
static void device_name_get(size_t idx, struct shell_static_entry *entry)
|
/* Function used to create subcommands with devices names. */
static void device_name_get(size_t idx, struct shell_static_entry *entry)
|
{
const struct device *dev = shell_device_lookup(idx, NULL);
entry->syntax = (dev != NULL) ? dev->name : NULL;
entry->handler = NULL;
entry->help = NULL;
entry->subcmd = NULL;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns 1 on success or < 0 on error. */
|
static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path, const char *envaddr_name)
|
/* Returns 1 on success or < 0 on error. */
static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path, const char *envaddr_name)
|
{
unsigned long file_addr;
char *envaddr;
envaddr = from_env(envaddr_name);
if (!envaddr)
return -ENOENT;
if (strict_strtoul(envaddr, 16, &file_addr) < 0)
return -EINVAL;
return get_relfile(cmdtp, file_path, file_addr);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* DMA Stream Reset.
The specified stream is disabled and configuration registers are cleared. */
|
void dma_stream_reset(uint32_t dma, uint8_t stream)
|
/* DMA Stream Reset.
The specified stream is disabled and configuration registers are cleared. */
void dma_stream_reset(uint32_t dma, uint8_t stream)
|
{
DMA_SCR(dma, stream) &= ~DMA_SxCR_EN;
DMA_SCR(dma, stream) = 0;
DMA_SNDTR(dma, stream) = 0;
DMA_SPAR(dma, stream) = 0;
DMA_SM0AR(dma, stream) = 0;
DMA_SM1AR(dma, stream) = 0;
DMA_SFCR(dma, stream) = 0x21;
uint32_t mask = DMA_ISR_MASK(stream);
if (stream < 4) {
DMA_LIFCR(dma) |= mask;
} else {
DMA_HIFCR(dma) |= mask;
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Find a socket that wants to accept the Connect Request we just received. */
|
static struct sock* nr_find_listener(ax25_address *addr)
|
/* Find a socket that wants to accept the Connect Request we just received. */
static struct sock* nr_find_listener(ax25_address *addr)
|
{
struct sock *s;
struct hlist_node *node;
spin_lock_bh(&nr_list_lock);
sk_for_each(s, node, &nr_list)
if (!ax25cmp(&nr_sk(s)->source_addr, addr) &&
s->sk_state == TCP_LISTEN) {
bh_lock_sock(s);
goto found;
}
s = NULL;
found:
spin_unlock_bh(&nr_list_lock);
return s;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set the Buffer Clear bit in the Configuration register of specific DMA channel. This will stop the descriptor based DMA operation. */
|
static void clear_dma_buffer(unsigned int channel)
|
/* Set the Buffer Clear bit in the Configuration register of specific DMA channel. This will stop the descriptor based DMA operation. */
static void clear_dma_buffer(unsigned int channel)
|
{
dma_ch[channel].regs->cfg |= RESTART;
SSYNC();
dma_ch[channel].regs->cfg &= ~RESTART;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return data element in an Array by its Index in ordered list array buffer. */
|
UINT64 OrderedListGetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index)
|
/* Return data element in an Array by its Index in ordered list array buffer. */
UINT64 OrderedListGetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index)
|
{
UINT64 Data;
ASSERT (Array != NULL);
Data = 0;
switch (Type) {
case EFI_IFR_TYPE_NUM_SIZE_8:
Data = (UINT64)*(((UINT8 *)Array) + Index);
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
Data = (UINT64)*(((UINT16 *)Array) + Index);
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
Data = (UINT64)*(((UINT32 *)Array) + Index);
break;
case EFI_IFR_TYPE_NUM_SIZE_64:
Data = (UINT64)*(((UINT64 *)Array) + Index);
break;
default:
break;
}
return Data;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.