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
|
|---|---|---|---|---|---|---|---|
/* About: Purpose Implementation of the USBGenericRequest class. Returns the type of the given request. */
|
unsigned char USBGenericRequest_GetType(const USBGenericRequest *request)
|
/* About: Purpose Implementation of the USBGenericRequest class. Returns the type of the given request. */
unsigned char USBGenericRequest_GetType(const USBGenericRequest *request)
|
{
return ((request->bmRequestType >> 5) & 0x3);
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Clear the state of the POSIX architecture free whatever memory it may have allocated, etc. */
|
void posix_arch_clean_up(void)
|
/* Clear the state of the POSIX architecture free whatever memory it may have allocated, etc. */
void posix_arch_clean_up(void)
|
{
nct_clean_up(te_state);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Mark code array such that isMarked(ic->cur_mark, i) is true only for nodes that are alive. */
|
static void mark_code(struct icode *ic)
|
/* Mark code array such that isMarked(ic->cur_mark, i) is true only for nodes that are alive. */
static void mark_code(struct icode *ic)
|
{
ic->cur_mark += 1;
make_marks(ic, ic->root);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Converts a ACPI address device path structure to its string representative. */
|
VOID DevPathToTextAcpiAdr(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
/* Converts a ACPI address device path structure to its string representative. */
VOID DevPathToTextAcpiAdr(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
{
ACPI_ADR_DEVICE_PATH *AcpiAdr;
UINT16 Index;
UINT16 Length;
UINT16 AdditionalAdrCount;
AcpiAdr = DevPath;
Length = (UINT16)DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)AcpiAdr);
AdditionalAdrCount = (UINT16)((Length - 8) / 4);
UefiDevicePathLibCatPrint (Str, L"AcpiAdr(0x%x", AcpiAdr->ADR);
for (Index = 0; Index < AdditionalAdrCount; Index++) {
UefiDevicePathLibCatPrint (Str, L",0x%x", *(UINT32 *)((UINT8 *)AcpiAdr + 8 + Index * 4));
}
UefiDevicePathLibCatPrint (Str, L")");
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is executed in case of error occurrence. */
|
static void Error_Handler(void)
|
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
|
{
BSP_LED_Off(LED2);
while(1)
{
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Configure TC72 temperature convertion mode.
This function is to set and change TC72 temperature convertion mode,you can use TC72_MODE_SHUTDOWN if you want to enter low power consumption condition. And you can use TC72_MODE_CONTINUOUS or TC72_MODE_ONESHOT to switch condition from shutdown mode. */
|
void TC72Configure(unsigned char ucMode)
|
/* Configure TC72 temperature convertion mode.
This function is to set and change TC72 temperature convertion mode,you can use TC72_MODE_SHUTDOWN if you want to enter low power consumption condition. And you can use TC72_MODE_CONTINUOUS or TC72_MODE_ONESHOT to switch condition from shutdown mode. */
void TC72Configure(unsigned char ucMode)
|
{
unsigned char ucWrite = 0;
xASSERT((ucMode == TC72_MODE_CONTINUOUS) || (ucMode == TC72_MODE_SHUTDOWN)
|| (ucMode == TC72_MODE_ONESHOT));
xGPIOSPinWrite(TC72_PIN_SPI_CS, 1);
ucWrite = TC72_CONTROL_WRITE_REG;
xSPIDataWrite(TC72_PIN_SPI_PORT, &ucWrite, 1);
if(ucMode == TC72_MODE_CONTINUOUS)
{
ucWrite = TC72_MODE_CONTINUOUS;
}
else if(ucMode == TC72_MODE_SHUTDOWN)
{
ucWrite = TC72_MODE_SHUTDOWN; }
else
{
ucWrite = TC72_MODE_ONESHOT; }
xSPIDataWrite(TC72_PIN_SPI_PORT, &ucWrite, 1);
xGPIOSPinWrite(TC72_PIN_SPI_CS, 0);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function calculates and updates an UINT8 checksum. */
|
VOID AcpiPlatformChecksum(IN UINT8 *Buffer, IN UINTN Size)
|
/* This function calculates and updates an UINT8 checksum. */
VOID AcpiPlatformChecksum(IN UINT8 *Buffer, IN UINTN Size)
|
{
UINTN ChecksumOffset;
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
Buffer[ChecksumOffset] = 0;
Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Event handler for the library USB Connection event. */
|
void EVENT_USB_Device_Connect(void)
|
/* Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
|
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
CloseLogFile();
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* param base SPDIF base pointer param handle SPDIF eDMA handle pointer. param count Bytes count received by SPDIF. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */
|
status_t SPDIF_TransferGetReceiveCountEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle, size_t *count)
|
/* param base SPDIF base pointer param handle SPDIF eDMA handle pointer. param count Bytes count received by SPDIF. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */
status_t SPDIF_TransferGetReceiveCountEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle, size_t *count)
|
{
assert(handle != NULL);
status_t status = kStatus_Success;
if (handle->state != (uint32_t)kSPDIF_Busy)
{
status = kStatus_NoTransferInProgress;
}
else
{
*count = (handle->transferSize[handle->queueDriver] -
(uint32_t)handle->nbytes *
EDMA_GetRemainingMajorLoopCount(handle->dmaRightHandle->base, handle->dmaRightHandle->channel));
}
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Returns zero if successful, or a negative error code on failure. */
|
int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id)
|
/* Returns zero if successful, or a negative error code on failure. */
int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id)
|
{
struct snd_kcontrol *kctl;
down_write(&card->controls_rwsem);
kctl = snd_ctl_find_id(card, src_id);
if (kctl == NULL) {
up_write(&card->controls_rwsem);
return -ENOENT;
}
kctl->id = *dst_id;
kctl->id.numid = card->last_numid + 1;
card->last_numid += kctl->count;
up_write(&card->controls_rwsem);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Do what every setup is needed on image and the reboot code buffer to allow us to avoid allocations later. */
|
int machine_kexec_prepare(struct kimage *image)
|
/* Do what every setup is needed on image and the reboot code buffer to allow us to avoid allocations later. */
int machine_kexec_prepare(struct kimage *image)
|
{
int error;
set_pages_x(image->control_code_page, 1);
error = machine_kexec_alloc_page_tables(image);
if (error)
return error;
machine_kexec_prepare_page_tables(image);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The Entry Point of module. It follows the standard UEFI driver model. */
|
EFI_STATUS EFIAPI InitializeSataControllerDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* The Entry Point of module. It follows the standard UEFI driver model. */
EFI_STATUS EFIAPI InitializeSataControllerDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gSataControllerDriverBinding,
ImageHandle,
&gSataControllerComponentName,
&gSataControllerComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* tipc_bearer_find_interface - locates bearer object with matching interface name */
|
struct bearer* tipc_bearer_find_interface(const char *if_name)
|
/* tipc_bearer_find_interface - locates bearer object with matching interface name */
struct bearer* tipc_bearer_find_interface(const char *if_name)
|
{
struct bearer *b_ptr;
char *b_if_name;
u32 i;
for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (!b_ptr->active)
continue;
b_if_name = strchr(b_ptr->publ.name, ':') + 1;
if (!strcmp(b_if_name, if_name))
return b_ptr;
}
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Read a whole tile off data from the file, and convert to RGBA form. The returned RGBA data is organized from bottom to top of tile, and may include zeroed areas if the tile extends off the image. */
|
int TIFFReadRGBATile(TIFF *tif, uint32 col, uint32 row, uint32 *raster)
|
/* Read a whole tile off data from the file, and convert to RGBA form. The returned RGBA data is organized from bottom to top of tile, and may include zeroed areas if the tile extends off the image. */
int TIFFReadRGBATile(TIFF *tif, uint32 col, uint32 row, uint32 *raster)
|
{
return TIFFReadRGBATileExt(tif, col, row, raster, 0 );
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Check if the time zone is valid. Valid values are between -1440 and 1440 or 2047 (EFI_UNSPECIFIED_TIMEZONE). */
|
BOOLEAN EFIAPI IsValidTimeZone(IN INT16 TimeZone)
|
/* Check if the time zone is valid. Valid values are between -1440 and 1440 or 2047 (EFI_UNSPECIFIED_TIMEZONE). */
BOOLEAN EFIAPI IsValidTimeZone(IN INT16 TimeZone)
|
{
return TimeZone == EFI_UNSPECIFIED_TIMEZONE ||
(TimeZone >= -1440 && TimeZone <= 1440);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Acceleration (g's) in body frame. Embedded MPL defines gravity as positive acceleration pointing away from the Earth. */
|
int inv_get_sensor_type_accel(long *data, int8_t *accuracy, inv_time_t *timestamp)
|
/* Acceleration (g's) in body frame. Embedded MPL defines gravity as positive acceleration pointing away from the Earth. */
int inv_get_sensor_type_accel(long *data, int8_t *accuracy, inv_time_t *timestamp)
|
{
inv_get_accel_set(data, accuracy, timestamp);
if (eMPL_out.accel_status & INV_NEW_DATA)
return 1;
else
return 0;
}
|
Luos-io/luos_engine
|
C++
|
MIT License
| 496
|
/* If no initialization is required, then return RETURN_SUCCESS. */
|
EFI_STATUS EFIAPI ShellCommandLineParseEx(IN CONST SHELL_PARAM_ITEM *CheckList, OUT LIST_ENTRY **CheckPackage, OUT CHAR16 **ProblemParam OPTIONAL, IN BOOLEAN AutoPageBreak, IN BOOLEAN AlwaysAllowNumbers)
|
/* If no initialization is required, then return RETURN_SUCCESS. */
EFI_STATUS EFIAPI ShellCommandLineParseEx(IN CONST SHELL_PARAM_ITEM *CheckList, OUT LIST_ENTRY **CheckPackage, OUT CHAR16 **ProblemParam OPTIONAL, IN BOOLEAN AutoPageBreak, IN BOOLEAN AlwaysAllowNumbers)
|
{
ASSERT (CheckList != NULL);
ASSERT (CheckPackage != NULL);
if (gEfiShellParametersProtocol != NULL) {
return (InternalCommandLineParse (
CheckList,
CheckPackage,
ProblemParam,
AutoPageBreak,
(CONST CHAR16 **)gEfiShellParametersProtocol->Argv,
gEfiShellParametersProtocol->Argc,
AlwaysAllowNumbers
));
}
ASSERT (mEfiShellInterface != NULL);
return (InternalCommandLineParse (
CheckList,
CheckPackage,
ProblemParam,
AutoPageBreak,
(CONST CHAR16 **)mEfiShellInterface->Argv,
mEfiShellInterface->Argc,
AlwaysAllowNumbers
));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Accelerometer Z-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */
|
int32_t lsm6dso_xl_usr_offset_z_set(lsm6dso_ctx_t *ctx, uint8_t *buff)
|
/* Accelerometer Z-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */
int32_t lsm6dso_xl_usr_offset_z_set(lsm6dso_ctx_t *ctx, uint8_t *buff)
|
{
int32_t ret;
ret = lsm6dso_write_reg(ctx, LSM6DSO_Z_OFS_USR, buff, 1);
return ret;
}
|
alexander-g-dean/ESF
|
C++
| null | 41
|
/* This function synchronizes write-buffers which contain nodes belonging to @inode. Returns zero in case of success and a negative error code in case of failure. */
|
int ubifs_sync_wbufs_by_inode(struct ubifs_info *c, struct inode *inode)
|
/* This function synchronizes write-buffers which contain nodes belonging to @inode. Returns zero in case of success and a negative error code in case of failure. */
int ubifs_sync_wbufs_by_inode(struct ubifs_info *c, struct inode *inode)
|
{
int i, err = 0;
for (i = 0; i < c->jhead_cnt; i++) {
struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;
if (i == GCHD)
continue;
if (!wbuf_has_ino(wbuf, inode->i_ino))
continue;
mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);
if (wbuf_has_ino(wbuf, inode->i_ino))
err = ubifs_wbuf_sync_nolock(wbuf);
mutex_unlock(&wbuf->io_mutex);
if (err) {
ubifs_ro_mode(c, err);
return err;
}
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check to see if the page at the given address is a Guard page or not. */
|
BOOLEAN EFIAPI IsGuardPage(IN EFI_PHYSICAL_ADDRESS Address)
|
/* Check to see if the page at the given address is a Guard page or not. */
BOOLEAN EFIAPI IsGuardPage(IN EFI_PHYSICAL_ADDRESS Address)
|
{
UINTN BitMap;
BitMap = GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 3);
return ((BitMap == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Push a formatted temporary message onto the statusbar. */
|
void statusbar_push_temporary_msg(const gchar *msg_format,...)
|
/* Push a formatted temporary message onto the statusbar. */
void statusbar_push_temporary_msg(const gchar *msg_format,...)
|
{
va_list ap;
gchar *msg;
guint msg_id;
va_start(ap, msg_format);
msg = g_strdup_vprintf(msg_format, ap);
va_end(ap);
msg_id = gtk_statusbar_push(GTK_STATUSBAR(info_bar), main_ctx, msg);
g_free(msg);
flash_time = TEMPORARY_FLASH_TIMEOUT - 1;
g_timeout_add(TEMPORARY_FLASH_INTERVAL, statusbar_flash_temporary_msg, NULL);
g_timeout_add(TEMPORARY_MSG_TIMEOUT, statusbar_remove_temporary_msg, GUINT_TO_POINTER(msg_id));
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function determines the size of the SRAM on the device. */
|
uint32_t SysCtlSRAMSizeGet(void)
|
/* This function determines the size of the SRAM on the device. */
uint32_t SysCtlSRAMSizeGet(void)
|
{
return ((HWREG(FLASH_SSIZE) + 1) * 256);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* time stamp Initialize This function Loads/Initializes h the value specified in the Timestamp High Update and Timestamp Low Update register. */
|
s32 synopGMAC_TS_timestamp_init(synopGMACdevice *gmacdev, u32 high_value, u32 low_value)
|
/* time stamp Initialize This function Loads/Initializes h the value specified in the Timestamp High Update and Timestamp Low Update register. */
s32 synopGMAC_TS_timestamp_init(synopGMACdevice *gmacdev, u32 high_value, u32 low_value)
|
{
u32 loop_variable;
synopGMACWriteReg(gmacdev->MacBase, GmacTSHighUpdate, high_value);
synopGMACWriteReg(gmacdev->MacBase, GmacTSLowUpdate, low_value);
for (loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++)
{
if (!((synopGMACReadReg(gmacdev->MacBase, GmacTSControl)) & GmacTSINT))
{
break;
}
plat_delay(DEFAULT_DELAY_VARIABLE);
}
if (loop_variable < DEFAULT_LOOP_VARIABLE)
synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSINT);
else
{
TR("Error::: The TSADDREG bit is not getting cleared !!!!!!\n");
return -ESYNOPGMACPHYERR;
}
return -ESYNOPGMACNOERR;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set the Drive Current value of a specific channel. */
|
static int fdc2x1x_set_idrive(const struct device *dev, uint8_t chx, uint8_t idrv)
|
/* Set the Drive Current value of a specific channel. */
static int fdc2x1x_set_idrive(const struct device *dev, uint8_t chx, uint8_t idrv)
|
{
return fdc2x1x_reg_write_mask(dev,
FDC2X1X_DRIVE_CURRENT_CH0 + chx,
FDC2X1X_DRV_CURRENT_CHX_IDRIVE_MSK,
FDC2X1X_DRV_CURRENT_CHX_IDRIVE_SET(idrv));
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Initialize I2C slave function. This function is to 7-bit slave addresses and enable General Call function of specified I2C port. */
|
void I2CSlaveInit(unsigned long ulBase, unsigned long ulSlaveAddr, unsigned long ulGeneralCall)
|
/* Initialize I2C slave function. This function is to 7-bit slave addresses and enable General Call function of specified I2C port. */
void I2CSlaveInit(unsigned long ulBase, unsigned long ulSlaveAddr, unsigned long ulGeneralCall)
|
{
xASSERT(
(ulBase == I2C0_BASE) ||
(ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE)
);
if(ulGeneralCall == I2C_GENERAL_CALL_EN)
{
ulSlaveAddr |= ADR_GC;
xHWREG(ulBase + I2C_ADR0) = ulSlaveAddr;
}
else if(ulGeneralCall == I2C_GENERAL_CALL_DIS)
{
ulSlaveAddr &= ~ADR_GC;
xHWREG(ulBase + I2C_ADR0) = ulSlaveAddr;
}
else
{
while(1);
}
xHWREG(ulBase + I2C_CONSET) = CONSET_AA;
xHWREG(ulBase + I2C_CONCLR) = CONCLR_SIC | CONCLR_STAC | CONCLR_I2CENC;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function will register an usb class driver to the class driver manager. */
|
rt_err_t rt_usbh_class_driver_register(ucd_t drv)
|
/* This function will register an usb class driver to the class driver manager. */
rt_err_t rt_usbh_class_driver_register(ucd_t drv)
|
{
if (drv == RT_NULL) return -RT_ERROR;
if (rt_usbh_class_driver_find(drv->class_code, drv->subclass_code) == RT_NULL)
{
rt_list_insert_after(&_driver_list, &(drv->list));
}
return RT_EOK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The "no encryption" mode has no overhead. It limits the payload size to the maximum size allowed by the standard (16384 bytes); the caller is responsible for possibly enforcing a smaller fragment length. */
|
static void clear_max_plaintext(const br_sslrec_out_clear_context *cc, size_t *start, size_t *end)
|
/* The "no encryption" mode has no overhead. It limits the payload size to the maximum size allowed by the standard (16384 bytes); the caller is responsible for possibly enforcing a smaller fragment length. */
static void clear_max_plaintext(const br_sslrec_out_clear_context *cc, size_t *start, size_t *end)
|
{
size_t len;
(void)cc;
len = *end - *start;
if (len > 16384) {
*end = *start + 16384;
}
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* Draw anti-aliased circle with blending.
Note: The AA-circle routine is based on AA-ellipse with identical radii. */
|
int aacircleColor(SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
|
/* Draw anti-aliased circle with blending.
Note: The AA-circle routine is based on AA-ellipse with identical radii. */
int aacircleColor(SDL_Surface *dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
|
{
return (aaellipseColor(dst, x, y, rad, rad, color));
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Returns CR_OK upon successfull completion, an error code otherwise. */
|
enum CRStatus cr_parser_set_default_sac_handler(CRParser *a_this)
|
/* Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_parser_set_default_sac_handler(CRParser *a_this)
|
{
CRDocHandler *default_sac_handler = NULL;
enum CRStatus status = CR_ERROR;
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
default_sac_handler = cr_doc_handler_new ();
cr_doc_handler_set_default_sac_handler (default_sac_handler);
status = cr_parser_set_sac_handler (a_this, default_sac_handler);
if (status != CR_OK) {
cr_doc_handler_destroy (default_sac_handler);
default_sac_handler = NULL;
}
return status;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* The phy_id is ignored as the driver will probe for it. */
|
static int __init parse_tag_ethernet(struct tag *tag)
|
/* The phy_id is ignored as the driver will probe for it. */
static int __init parse_tag_ethernet(struct tag *tag)
|
{
int i;
i = tag->u.ethernet.mac_index;
if (i < ARRAY_SIZE(hw_addr))
memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address,
sizeof(hw_addr[i].addr));
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Internal function to retrieves the 64-bit frequency in Hz. */
|
UINT64 InternalGetPerformanceCounterFrequency(VOID)
|
/* Internal function to retrieves the 64-bit frequency in Hz. */
UINT64 InternalGetPerformanceCounterFrequency(VOID)
|
{
return CpuidCoreClockCalculateTscFrequency ();
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* The peripheral clock will be the same as the PCLK1 clock. This will be the value returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()). */
|
void I2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk)
|
/* The peripheral clock will be the same as the PCLK1 clock. This will be the value returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()). */
void I2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk)
|
{
unsigned long ulSCLFreq;
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xHWREG(ulBase + I2C_CR) |= I2C_CR_I2CEN;
ulSCLFreq = xSysCtlClockGet();
xHWREG(ulBase + I2C_SHPGR) = (ulSCLFreq*2)/(ulI2CClk*5) -7;
xHWREG(ulBase + I2C_SLPGR) = (ulSCLFreq*3)/(ulI2CClk*5) -7;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Returns nonzero if an interrupt is pending on the given VIA/IRQ combination. */
|
int via_irq_pending(int irq)
|
/* Returns nonzero if an interrupt is pending on the given VIA/IRQ combination. */
int via_irq_pending(int irq)
|
{
int irq_src = IRQ_SRC(irq);
int irq_idx = IRQ_IDX(irq);
int irq_bit = 1 << irq_idx;
if (irq_src == 1) {
return via1[vIFR] & irq_bit;
} else if (irq_src == 2) {
return via2[gIFR] & irq_bit;
} else if (irq_src == 7) {
return ~via2[gBufA] & irq_bit;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* After receiving "dec_cntr" times RNR command, this action decreases "npta" by one. Returns 0 for success, 1 otherwise. */
|
int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk, struct sk_buff *skb)
|
/* After receiving "dec_cntr" times RNR command, this action decreases "npta" by one. Returns 0 for success, 1 otherwise. */
int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk, struct sk_buff *skb)
|
{
struct llc_sock *llc = llc_sk(sk);
if (llc->remote_busy_flag)
if (!llc->dec_step) {
if (!llc->dec_cntr) {
llc->inc_cntr = llc->dec_cntr = 2;
if (llc->npta > 0)
--llc->npta;
} else
--llc->dec_cntr;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function frees up the transform and any associated resources, then drops the refcount on the associated algorithm. */
|
void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
|
/* This function frees up the transform and any associated resources, then drops the refcount on the associated algorithm. */
void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
|
{
struct crypto_alg *alg;
if (unlikely(!mem))
return;
alg = tfm->__crt_alg;
if (!tfm->exit && alg->cra_exit)
alg->cra_exit(tfm);
crypto_exit_ops(tfm);
crypto_mod_put(alg);
kzfree(mem);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Gets the phase delay between a trigger and the start of a sequence. */
|
uint32_t ADCPhaseDelayGet(uint32_t ui32Base)
|
/* Gets the phase delay between a trigger and the start of a sequence. */
uint32_t ADCPhaseDelayGet(uint32_t ui32Base)
|
{
ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
return(HWREG(ui32Base + ADC_O_SPC));
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Display a calibration point on the given buffer. */
|
static void draw_calibration_point(const rtouch_point_t *p_point)
|
/* Display a calibration point on the given buffer. */
static void draw_calibration_point(const rtouch_point_t *p_point)
|
{
lcd_set_foreground_color(UNI_COLOR_RED);
lcd_draw_filled_rectangle(p_point->x - POINTS_SIZE / 2,
p_point->y - POINTS_SIZE / 2,
p_point->x - POINTS_SIZE / 2 + POINTS_SIZE,
p_point->y - POINTS_SIZE / 2 + POINTS_SIZE
);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Reads a number of bytes in the internal RWWEE Flash. */
|
int32_t _rww_flash_read(struct _flash_device *const device, const uint32_t src_addr, uint8_t *buffer, uint32_t length)
|
/* Reads a number of bytes in the internal RWWEE Flash. */
int32_t _rww_flash_read(struct _flash_device *const device, const uint32_t src_addr, uint8_t *buffer, uint32_t length)
|
{
if (!_is_valid_rww_flash_address(src_addr) || !_is_valid_rww_flash_address(src_addr + length)) {
return ERR_BAD_ADDRESS;
}
_flash_read(device, src_addr, buffer, length);
return ERR_NONE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* guillemot_open() is a callback from the input open routine. */
|
static int guillemot_open(struct input_dev *dev)
|
/* guillemot_open() is a callback from the input open routine. */
static int guillemot_open(struct input_dev *dev)
|
{
struct guillemot *guillemot = input_get_drvdata(dev);
gameport_start_polling(guillemot->gameport);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* this is the low level routine to read/write a bit on the One Wire interface on the hardware. It does write 0 if parameter bit is set to 0, otherwise a write 1/read. */
|
static u8 mxc_w1_ds2_touch_bit(void *data, u8 bit)
|
/* this is the low level routine to read/write a bit on the One Wire interface on the hardware. It does write 0 if parameter bit is set to 0, otherwise a write 1/read. */
static u8 mxc_w1_ds2_touch_bit(void *data, u8 bit)
|
{
struct mxc_w1_device *mdev = data;
void __iomem *ctrl_addr = mdev->regs + MXC_W1_CONTROL;
unsigned int timeout_cnt = 400;
__raw_writeb((1 << (5 - bit)), ctrl_addr);
while (timeout_cnt--) {
if (!((__raw_readb(ctrl_addr) >> (5 - bit)) & 0x1))
break;
udelay(1);
}
return ((__raw_readb(ctrl_addr)) >> 3) & 0x1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable/disable the 3 wire feature of the specified SPI port.
In no slave select signal mode, the SS_LTRIG, SPI_SSR, shall be set as 1. */
|
void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable)
|
/* Enable/disable the 3 wire feature of the specified SPI port.
In no slave select signal mode, the SS_LTRIG, SPI_SSR, shall be set as 1. */
void SPI3WireFunction(unsigned long ulBase, xtBoolean xtEnable)
|
{
xASSERT(ulBase == SPI0_BASE);
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_NOSLVSEL;
xHWREG(ulBase + SPI_SSR) |= SPI_SS_LTRIG;
}
else
{
xHWREG(ulBase + SPI_CNTRL2) &= ~SPI_CNTRL2_NOSLVSEL;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Gets the error status of the I2C Master module. */
|
unsigned long I2CMasterErr(unsigned long ulBase)
|
/* Gets the error status of the I2C Master module. */
unsigned long I2CMasterErr(unsigned long ulBase)
|
{
unsigned long ulErr;
ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));
ulErr = HWREG(ulBase + I2C_O_MCS);
if(ulErr & I2C_MCS_BUSY)
{
return(I2C_MASTER_ERR_NONE);
}
if(ulErr & (I2C_MCS_ERROR | I2C_MCS_ARBLST))
{
return(ulErr & (I2C_MCS_ARBLST | I2C_MCS_DATACK | I2C_MCS_ADRACK));
}
else
{
return(I2C_MASTER_ERR_NONE);
}
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* Function to read the Phy register. The access to phy register is a slow process as the data is moved accross MDI/MDO interface */
|
s32 synopGMAC_read_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 *data)
|
/* Function to read the Phy register. The access to phy register is a slow process as the data is moved accross MDI/MDO interface */
s32 synopGMAC_read_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 *data)
|
{
u32 addr;
u32 loop_variable;
addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask);
addr = addr | GmiiBusy ;
synopGMACWriteReg(RegBase, GmacGmiiAddr, addr);
for (loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++)
{
if (!(synopGMACReadReg(RegBase, GmacGmiiAddr) & GmiiBusy))
{
break;
}
plat_delay(DEFAULT_DELAY_VARIABLE);
}
if (loop_variable < DEFAULT_LOOP_VARIABLE)
* data = (u16)(synopGMACReadReg(RegBase, GmacGmiiData) & 0xFFFF);
else
{
TR("Error::: PHY not responding Busy bit didnot get cleared !!!!!!\n");
return -ESYNOPGMACPHYERR;
}
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If there is no additional space for HOB creation, then ASSERT(). If the FvImage buffer is not at its required alignment, then ASSERT(). */
|
VOID EFIAPI BuildFvHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
|
/* If there is no additional space for HOB creation, then ASSERT(). If the FvImage buffer is not at its required alignment, then ASSERT(). */
VOID EFIAPI BuildFvHob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
|
{
EFI_HOB_FIRMWARE_VOLUME *Hob;
if (!InternalCheckFvAlignment (BaseAddress, Length)) {
ASSERT (FALSE);
return;
}
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16)sizeof (EFI_HOB_FIRMWARE_VOLUME));
if (Hob == NULL) {
return;
}
Hob->BaseAddress = BaseAddress;
Hob->Length = Length;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reads the sensor and returns the data as a sensors_event_t. */
|
err_t lsm303accelGetSensorEvent(sensors_event_t *event)
|
/* Reads the sensor and returns the data as a sensors_event_t. */
err_t lsm303accelGetSensorEvent(sensors_event_t *event)
|
{
memset(event, 0, sizeof(sensors_event_t));
event->version = sizeof(sensors_event_t);
event->sensor_id = _lsm303accelSensorID;
event->type = SENSOR_TYPE_ACCELEROMETER;
event->timestamp = delayGetTicks();
ASSERT_STATUS(lsm303accelRead());
event->acceleration.x = _lsm303accelData.x * _lsm303accel_MG_LSB * SENSORS_GRAVITY_STANDARD;
event->acceleration.y = _lsm303accelData.y * _lsm303accel_MG_LSB * SENSORS_GRAVITY_STANDARD;
event->acceleration.z = _lsm303accelData.z * _lsm303accel_MG_LSB * SENSORS_GRAVITY_STANDARD;
return ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Init interrupts callback for the specified SPI Port. */
|
void xSPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
|
/* Init interrupts callback for the specified SPI Port. */
void xSPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
|
{
xASSERT(ulBase == SPI0_BASE);
g_pfnSPIHandlerCallbacks[0] = xtSPICallback;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* param base SAI base pointer. param handle SAI handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function. */
|
void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
|
/* param base SAI base pointer. param handle SAI handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function. */
void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
|
{
assert(handle);
memset(handle, 0, sizeof(*handle));
s_saiHandle[SAI_GetInstance(base)][1] = handle;
handle->callback = callback;
handle->userData = userData;
handle->base = base;
s_saiRxIsr = SAI_TransferRxHandleIRQ;
EnableIRQ(s_saiRxIRQ[SAI_GetInstance(base)]);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Reset stack pointer to begin of the stack. */
|
VOID ResetCurrentExpressionStack(VOID)
|
/* Reset stack pointer to begin of the stack. */
VOID ResetCurrentExpressionStack(VOID)
|
{
mCurrentExpressionPointer = mCurrentExpressionStack;
mFormExpressionPointer = mFormExpressionStack;
mStatementExpressionPointer = mStatementExpressionStack;
mOptionExpressionPointer = mOptionExpressionStack;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* On success, the client takes ownership of the credentials block and caller must not free it. On failure, caller is responsible for freeing the credential block. */
|
int tlsv1_client_set_cred(struct tlsv1_client *conn, struct tlsv1_credentials *cred)
|
/* On success, the client takes ownership of the credentials block and caller must not free it. On failure, caller is responsible for freeing the credential block. */
int tlsv1_client_set_cred(struct tlsv1_client *conn, struct tlsv1_credentials *cred)
|
{
tlsv1_cred_free(conn->cred);
conn->cred = cred;
return 0;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Convert (unsigned) quad to double. This is exactly like floatdidf.c except that negatives never occur. */
|
double __floatunsdidf(u_quad_t x)
|
/* Convert (unsigned) quad to double. This is exactly like floatdidf.c except that negatives never occur. */
double __floatunsdidf(u_quad_t x)
|
{
double d;
union uu u;
u.uq = x;
d = (double) u.ul[H] * (((int) 1 << (INT_BITS - 2)) * 4.0);
d += u.ul[L];
return d;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Allocate new memory and concatenate Source on the end of Destination. */
|
VOID NewStringCat(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
|
/* Allocate new memory and concatenate Source on the end of Destination. */
VOID NewStringCat(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
|
{
CHAR16 *NewHiiString;
UINTN MaxLen;
if (*Dest == NULL) {
NewStringCopy (Dest, Src);
return;
}
MaxLen = (StrSize (*Dest) + StrSize (Src) - 2) / sizeof (CHAR16);
NewHiiString = AllocatePool (MaxLen * sizeof (CHAR16));
if (NewHiiString == NULL) {
return;
}
StrCpyS (NewHiiString, MaxLen, *Dest);
StrCatS (NewHiiString, MaxLen, Src);
FreePool (*Dest);
*Dest = NewHiiString;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reads and returns the current value of MM3. This function is only available on IA-32 and X64. */
|
UINT64 EFIAPI AsmReadMm3(VOID)
|
/* Reads and returns the current value of MM3. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm3(VOID)
|
{
UINT64 Data;
__asm__ __volatile__ (
"push %%eax \n\t"
"push %%eax \n\t"
"movq %%mm3, (%%esp)\n\t"
"pop %%eax \n\t"
"pop %%edx \n\t"
: "=A" (Data)
);
return Data;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Drivers should call this routine in their vblank interrupt handlers to update the vblank counter and send any signals that may be pending. */
|
void drm_handle_vblank(struct drm_device *dev, int crtc)
|
/* Drivers should call this routine in their vblank interrupt handlers to update the vblank counter and send any signals that may be pending. */
void drm_handle_vblank(struct drm_device *dev, int crtc)
|
{
if (!dev->num_crtcs)
return;
atomic_inc(&dev->_vblank_count[crtc]);
DRM_WAKEUP(&dev->vbl_queue[crtc]);
drm_handle_vblank_events(dev, crtc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Handler for Button 1 rising edge interrupt.
Handle process led1 status change. */
|
static void button1_handler(uint32_t ul_id, uint32_t ul_mask)
|
/* Handler for Button 1 rising edge interrupt.
Handle process led1 status change. */
static void button1_handler(uint32_t ul_id, uint32_t ul_mask)
|
{
if (PIN_PUSHBUTTON_1_ID == ul_id && PIN_PUSHBUTTON_1_MASK == ul_mask)
gs_uc_wait_button = 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Enables or disables the specified I2C PEC transfer. */
|
void I2C_TransmitPEC(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
/* Enables or disables the specified I2C PEC transfer. */
void I2C_TransmitPEC(I2C_TypeDef *I2Cx, FunctionalState NewState)
|
{
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->CR1 |= I2C_CR1_PEC;
}
else
{
I2Cx->CR1 &= (uint16_t)~((uint16_t)I2C_CR1_PEC);
}
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* Set the PWM duty of the PWM module.
The */
|
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty)
|
/* Set the PWM duty of the PWM module.
The */
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty)
|
{
unsigned long ulCMRData;
xASSERT(PWMBaseValid(ulBase));
xASSERT(((ulChannel >= 0) || (ulChannel <= 3)));
xASSERT(((ulDuty > 0) || (ulDuty <= 100)));
ulCMRData = (PWMARRGet(ulBase) * ulDuty) / 100;
if ((PWMARRGet(ulBase) * ulDuty) / 100 == 0)
{
ulCMRData = 0;
}
xHWREG(ulBase + TIMER_CCR1 + ulChannel * 4) &= ~TIMER_CCR1_CCR1_M;
xHWREG(ulBase + TIMER_CCR1 + ulChannel * 4) |= ulCMRData;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Selects the condition for the system to enter low power mode. */
|
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState)
|
/* Selects the condition for the system to enter low power mode. */
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState)
|
{
assert_param(IS_NVIC_LP(LowPowerMode));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
SCB->SCR |= LowPowerMode;
}
else
{
SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* SetRxDmaTimer - Set the heartbeat timer according to line rate. @etdev: pointer to our adapter structure */
|
void SetRxDmaTimer(struct et131x_adapter *etdev)
|
/* SetRxDmaTimer - Set the heartbeat timer according to line rate. @etdev: pointer to our adapter structure */
void SetRxDmaTimer(struct et131x_adapter *etdev)
|
{
if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) ||
(etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) {
writel(0, &etdev->regs->rxdma.max_pkt_time);
writel(1, &etdev->regs->rxdma.num_pkt_done);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts a text device path node to USB HID device path structure. */
|
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbHID(IN CHAR16 *TextDeviceNode)
|
/* Converts a text device path node to USB HID device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbHID(IN CHAR16 *TextDeviceNode)
|
{
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_HID;
UsbClassText.SubClassExist = TRUE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns: the position of the element in the #GList, or -1 if the element is not found */
|
gint g_list_position(GList *list, GList *llink)
|
/* Returns: the position of the element in the #GList, or -1 if the element is not found */
gint g_list_position(GList *list, GList *llink)
|
{
gint i;
i = 0;
while (list)
{
if (list == llink)
return i;
i++;
list = list->next;
}
return -1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* DMA Get FIFO Status.
Status of FIFO (empty. full or partial filled states) is returned. This has no meaning if direct mode is enabled (as the FIFO is not used). */
|
uint32_t dma_fifo_status(uint32_t dma, uint8_t stream)
|
/* DMA Get FIFO Status.
Status of FIFO (empty. full or partial filled states) is returned. This has no meaning if direct mode is enabled (as the FIFO is not used). */
uint32_t dma_fifo_status(uint32_t dma, uint8_t stream)
|
{
return DMA_SFCR(dma, stream) & DMA_SxFCR_FS_MASK;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Orders the MAC DMA controller to attempt to acquire the next transmit descriptor. */
|
void EMACTxDMAPollDemand(uint32_t ui32Base)
|
/* Orders the MAC DMA controller to attempt to acquire the next transmit descriptor. */
void EMACTxDMAPollDemand(uint32_t ui32Base)
|
{
HWREG(ui32Base + EMAC_O_TXPOLLD) = 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base Pointer to the FLEXIO_MCULCD_Type structure. param baudRate_Bps Desired baud rate. param srcClock_Hz FLEXIO clock frequency in Hz. retval kStatus_Success Set successfully. retval kStatus_InvalidArgument Could not set the baud rate. */
|
status_t FLEXIO_MCULCD_SetBaudRate(FLEXIO_MCULCD_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
|
/* param base Pointer to the FLEXIO_MCULCD_Type structure. param baudRate_Bps Desired baud rate. param srcClock_Hz FLEXIO clock frequency in Hz. retval kStatus_Success Set successfully. retval kStatus_InvalidArgument Could not set the baud rate. */
status_t FLEXIO_MCULCD_SetBaudRate(FLEXIO_MCULCD_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
|
{
uint32_t baudRateDiv;
uint32_t timerCompare;
status_t status;
uint8_t baudRatio;
baudRatio = (FLEXIO_MCULCD_DATA_BUS_WIDTH == 16) ? 2 : 1;
baudRateDiv = (srcClock_Hz + 1) / (baudRate_Bps * baudRatio);
if ((0U == baudRateDiv) || (baudRateDiv > (FLEXIO_BAUDRATE_DIV_MASK + 1U)))
{
status = kStatus_InvalidArgument;
}
else
{
timerCompare = base->flexioBase->TIMCMP[base->timerIndex];
timerCompare = (timerCompare & ~FLEXIO_BAUDRATE_DIV_MASK) | baudRateDiv;
base->flexioBase->TIMCMP[base->timerIndex] = timerCompare;
status = kStatus_Success;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns the video format preset matching the input video dimensions and time base. */
|
static VideoFormat GetDiracVideoFormatPreset(AVCodecContext *avccontext)
|
/* Returns the video format preset matching the input video dimensions and time base. */
static VideoFormat GetDiracVideoFormatPreset(AVCodecContext *avccontext)
|
{
unsigned int num_formats = sizeof(ff_dirac_video_formats) /
sizeof(ff_dirac_video_formats[0]);
unsigned int idx = ff_dirac_schro_get_video_format_idx(avccontext);
return (idx < num_formats) ?
ff_dirac_video_formats[idx] : VIDEO_FORMAT_CUSTOM;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Returns the length of an Ethernet header, including optional VLAN tag. */
|
static int eth_hdr_len(const void *data)
|
/* Returns the length of an Ethernet header, including optional VLAN tag. */
static int eth_hdr_len(const void *data)
|
{
const struct ethhdr *e = data;
return e->h_proto == htons(ETH_P_8021Q) ? VLAN_ETH_HLEN : ETH_HLEN;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* fpu_init - Initialize FPU registers @fpu: Pointer to software emulated FPU registers. */
|
static void fpu_init(struct sh_fpu_soft_struct *fpu)
|
/* fpu_init - Initialize FPU registers @fpu: Pointer to software emulated FPU registers. */
static void fpu_init(struct sh_fpu_soft_struct *fpu)
|
{
int i;
fpu->fpscr = FPSCR_INIT;
fpu->fpul = 0;
for (i = 0; i < 16; i++) {
fpu->fp_regs[i] = 0;
fpu->xfp_regs[i]= 0;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Convert a string of up to 4 hex digits into the corresponding IPv6 form. */
|
static int ipv6_hex(unsigned char *out, const char *in, int inlen)
|
/* Convert a string of up to 4 hex digits into the corresponding IPv6 form. */
static int ipv6_hex(unsigned char *out, const char *in, int inlen)
|
{
unsigned char c;
unsigned int num = 0;
if (inlen > 4)
return 0;
while (inlen--) {
c = *in++;
num <<= 4;
if ((c >= '0') && (c <= '9'))
num |= c - '0';
else if ((c >= 'A') && (c <= 'F'))
num |= c - 'A' + 10;
else if ((c >= 'a') && (c <= 'f'))
num |= c - 'a' + 10;
else
return 0;
}
out[0] = num >> 8;
out[1] = num & 0xff;
return 1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Called when the driver needs to lock its access */
|
sl_status_t sl_wfx_host_lock(void)
|
/* Called when the driver needs to lock its access */
sl_status_t sl_wfx_host_lock(void)
|
{
UINT status;
status = tx_mutex_get(&sl_wfx_host_mutex, TX_WAIT_FOREVER);
if (status != TX_SUCCESS) {
return SL_STATUS_FAIL;
}
return SL_STATUS_OK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Set specified flag to 1 on a UFS device. */
|
EFI_STATUS UfsSetFlag(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 FlagId)
|
/* Set specified flag to 1 on a UFS device. */
EFI_STATUS UfsSetFlag(IN UFS_PEIM_HC_PRIVATE_DATA *Private, IN UINT8 FlagId)
|
{
EFI_STATUS Status;
UINT8 Value;
Value = 1;
Status = UfsRwFlags (Private, FALSE, FlagId, &Value);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is called when this driver is unloaded. */
|
static void __exit mpc8610_hpcd_exit(void)
|
/* This function is called when this driver is unloaded. */
static void __exit mpc8610_hpcd_exit(void)
|
{
of_unregister_platform_driver(&mpc8610_hpcd_of_driver);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If latched faults are configured, the application must call */
|
unsigned long PWMGenFaultStatus(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup)
|
/* If latched faults are configured, the application must call */
unsigned long PWMGenFaultStatus(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup)
|
{
ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE));
ASSERT(PWMGenValid(ulGen));
ASSERT((ulGroup == PWM_FAULT_GROUP_0) || (ulGroup == PWM_FAULT_GROUP_1));
if(ulGroup == PWM_FAULT_GROUP_0)
{
return(HWREG(PWM_GEN_EXT_BADDR(ulBase, ulGen) + PWM_O_X_FLTSTAT0));
}
else
{
return(HWREG(PWM_GEN_EXT_BADDR(ulBase, ulGen) + PWM_O_X_FLTSTAT1));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Converts the specified number of core clock ticks to timespan ticks (nanosecods) */
|
int64_t timespanSystemClockToTicks(int32_t clockTicks)
|
/* Converts the specified number of core clock ticks to timespan ticks (nanosecods) */
int64_t timespanSystemClockToTicks(int32_t clockTicks)
|
{
uint32_t nsPerTick;
nsPerTick = 1000000 / (SystemCoreClock / 1000000);
return ((int64_t)clockTicks * (int64_t)nsPerTick) / 1000LL;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* DBG("our IP is (%s) %08lx\n", DREAMCAST_IP, net_ip); } */
|
static void _setup_ip(const char *cip, uint8 *ip)
|
/* DBG("our IP is (%s) %08lx\n", DREAMCAST_IP, net_ip); } */
static void _setup_ip(const char *cip, uint8 *ip)
|
{
if (cip[c] != '.') {
ip[i] *= 10;
ip[i] += cip[c] - '0';
} else
i--;
}
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* __iounmap_from - Low level function to tear down the page tables for an IO mapping. This is used for mappings that are manipulated manually, like partial unmapping of PCI IOs or ISA space. */
|
void __iounmap_at(void *ea, unsigned long size)
|
/* __iounmap_from - Low level function to tear down the page tables for an IO mapping. This is used for mappings that are manipulated manually, like partial unmapping of PCI IOs or ISA space. */
void __iounmap_at(void *ea, unsigned long size)
|
{
WARN_ON(((unsigned long)ea) & ~PAGE_MASK);
WARN_ON(size & ~PAGE_MASK);
unmap_kernel_range((unsigned long)ea, size);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Handle complete IN transfer on EP0.
In IN_DATA state it starts a receive and switches to OUT_STATUS state. In IN_STATUS state its starts a new read of setup packets and switches to IDLE. */
|
void USBD_HandleEP0_IN()
|
/* Handle complete IN transfer on EP0.
In IN_DATA state it starts a receive and switches to OUT_STATUS state. In IN_STATUS state its starts a new read of setup packets and switches to IDLE. */
void USBD_HandleEP0_IN()
|
{
device.Driver->EndpointReadStart(0,0);
device.EP0_State = OUT_STATUS;
}
if (device.EP0_State == IN_STATUS) {
device.Driver->EndpointReadStart(device.Endpoints[0].Address,24);
device.EP0_State = IDLE;
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Changed callback for the channel combobox - set channel and offset */
|
void airpcap_channel_changed_set_cb(GtkWidget *channel_cb, gpointer channel_offset_cb)
|
/* Changed callback for the channel combobox - set channel and offset */
void airpcap_channel_changed_set_cb(GtkWidget *channel_cb, gpointer channel_offset_cb)
|
{
airpcap_channel_changed_common(channel_cb, channel_offset_cb, TRUE);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* retrieve the current 10.14 frequency from pipe, and set it. the value is referred in prepare_playback_urb(). */
|
static int retire_playback_sync_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb)
|
/* retrieve the current 10.14 frequency from pipe, and set it. the value is referred in prepare_playback_urb(). */
static int retire_playback_sync_urb(struct snd_usb_substream *subs, struct snd_pcm_runtime *runtime, struct urb *urb)
|
{
unsigned int f;
unsigned long flags;
if (urb->iso_frame_desc[0].status == 0 &&
urb->iso_frame_desc[0].actual_length == 3) {
f = combine_triple((u8*)urb->transfer_buffer) << 2;
if (f >= subs->freqn - subs->freqn / 8 && f <= subs->freqmax) {
spin_lock_irqsave(&subs->lock, flags);
subs->freqm = f;
spin_unlock_irqrestore(&subs->lock, flags);
}
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set External Trigger Filter Parameters for Slave.
Set the input filter parameters for the external trigger, specifying: */
|
void timer_slave_set_filter(uint32_t timer_peripheral, enum tim_ic_filter flt)
|
/* Set External Trigger Filter Parameters for Slave.
Set the input filter parameters for the external trigger, specifying: */
void timer_slave_set_filter(uint32_t timer_peripheral, enum tim_ic_filter flt)
|
{
TIM_SMCR(timer_peripheral) &= ~TIM_SMCR_ETF_MASK;
TIM_SMCR(timer_peripheral) |= flt << 8;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* FKS: tracing shows ess_probe writes wrong value to 0x64. Bit 3 reads 1, but should be written 0 only. Check this. */
|
static int ess_probe(sb_devc *devc, int reg, int xorval)
|
/* FKS: tracing shows ess_probe writes wrong value to 0x64. Bit 3 reads 1, but should be written 0 only. Check this. */
static int ess_probe(sb_devc *devc, int reg, int xorval)
|
{
int val1, val2, val3;
val1 = ess_getmixer (devc, reg);
val2 = val1 ^ xorval;
ess_setmixer (devc, reg, val2);
val3 = ess_getmixer (devc, reg);
ess_setmixer (devc, reg, val1);
return (val2 == val3);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the bit-width of the format, or a negative error code if unknown format. */
|
int snd_pcm_format_width(snd_pcm_format_t format)
|
/* Returns the bit-width of the format, or a negative error code if unknown format. */
int snd_pcm_format_width(snd_pcm_format_t format)
|
{
int val;
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST)
return -EINVAL;
if ((val = pcm_formats[format].width) == 0)
return -EINVAL;
return val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable or disable write protect of PIO registers. */
|
void pio_set_writeprotect(Pio *p_pio, const uint32_t ul_enable)
|
/* Enable or disable write protect of PIO registers. */
void pio_set_writeprotect(Pio *p_pio, const uint32_t ul_enable)
|
{
p_pio->PIO_WPMR = PIO_WPMR_WPKEY_PASSWD | (ul_enable & PIO_WPMR_WPEN);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Return Value: On success, pointer to the_nilfs is returned. On error, NULL is returned. */
|
static struct the_nilfs* alloc_nilfs(struct block_device *bdev)
|
/* Return Value: On success, pointer to the_nilfs is returned. On error, NULL is returned. */
static struct the_nilfs* alloc_nilfs(struct block_device *bdev)
|
{
struct the_nilfs *nilfs;
nilfs = kzalloc(sizeof(*nilfs), GFP_KERNEL);
if (!nilfs)
return NULL;
nilfs->ns_bdev = bdev;
atomic_set(&nilfs->ns_count, 1);
atomic_set(&nilfs->ns_ndirtyblks, 0);
init_rwsem(&nilfs->ns_sem);
init_rwsem(&nilfs->ns_super_sem);
mutex_init(&nilfs->ns_mount_mutex);
init_rwsem(&nilfs->ns_writer_sem);
INIT_LIST_HEAD(&nilfs->ns_list);
INIT_LIST_HEAD(&nilfs->ns_supers);
spin_lock_init(&nilfs->ns_last_segment_lock);
nilfs->ns_gc_inodes_h = NULL;
init_rwsem(&nilfs->ns_segctor_sem);
return nilfs;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Encode a point into a buffer. This function assumes that the point is valid, in affine coordinates, and not the point at infinity. */
|
static void p256_encode(void *dst, const p256_jacobian *P)
|
/* Encode a point into a buffer. This function assumes that the point is valid, in affine coordinates, and not the point at infinity. */
static void p256_encode(void *dst, const p256_jacobian *P)
|
{
unsigned char *buf;
buf = dst;
buf[0] = 0x04;
le30_to_be8(buf + 1, 32, P->x);
le30_to_be8(buf + 33, 32, P->y);
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* inotify_user_setup - Our initialization function. Note that we cannnot return error because we have compiled-in VFS hooks. So an (unlikely) failure here must result in panic(). */
|
static int __init inotify_user_setup(void)
|
/* inotify_user_setup - Our initialization function. Note that we cannnot return error because we have compiled-in VFS hooks. So an (unlikely) failure here must result in panic(). */
static int __init inotify_user_setup(void)
|
{
int ret;
ret = register_filesystem(&inotify_fs_type);
if (unlikely(ret))
panic("inotify: register_filesystem returned %d!\n", ret);
inotify_mnt = kern_mount(&inotify_fs_type);
if (IS_ERR(inotify_mnt))
panic("inotify: kern_mount ret %ld!\n", PTR_ERR(inotify_mnt));
inotify_inode_mark_cachep = KMEM_CACHE(inotify_inode_mark_entry, SLAB_PANIC);
event_priv_cachep = KMEM_CACHE(inotify_event_private_data, SLAB_PANIC);
inotify_max_queued_events = 16384;
inotify_max_user_instances = 128;
inotify_max_user_watches = 8192;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This is the API to delete SL spawn task and delete the SL queue. */
|
void VDeleteSimpleLinkSpawnTask(void)
|
/* This is the API to delete SL spawn task and delete the SL queue. */
void VDeleteSimpleLinkSpawnTask(void)
|
{
if(xSimpleLinkSpawnTaskHndl)
{
vTaskDelete( xSimpleLinkSpawnTaskHndl );
xSimpleLinkSpawnTaskHndl = 0;
}
if(xSimpleLinkSpawnQueue)
{
vQueueDelete( xSimpleLinkSpawnQueue );
xSimpleLinkSpawnQueue = 0;
}
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Configs the CEC peripheral according to the specified parameters in the cecConfig. */
|
void CEC_Config(CEC_Config_T *cecConfig)
|
/* Configs the CEC peripheral according to the specified parameters in the cecConfig. */
void CEC_Config(CEC_Config_T *cecConfig)
|
{
CEC->CFG_B.SFTCFG = cecConfig->signalFreeTime;
CEC->CFG_B.RXTCFG = cecConfig->RxTolerance;
CEC->CFG_B.RXSBRERR = cecConfig->stopReception;
CEC->CFG_B.GEBRERR = cecConfig->bitRisingError;
CEC->CFG_B.GELBPERR = cecConfig->longPeriodError;
CEC->CFG_B.AEBGIB = cecConfig->broadcastrNoGen;
CEC->CFG_B.SFTOB = cecConfig->signalFreeTimeOption;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* check whether FMC bank0 is ready or not */
|
fmc_state_enum fmc_bank0_ready_wait(uint32_t timeout)
|
/* check whether FMC bank0 is ready or not */
fmc_state_enum fmc_bank0_ready_wait(uint32_t timeout)
|
{
fmc_state_enum fmc_state = FMC_BUSY;
do{
fmc_state = fmc_bank0_state_get();
timeout--;
}while((FMC_BUSY == fmc_state) && (0x00U != timeout));
if(FMC_BUSY == fmc_state){
fmc_state = FMC_TOERR;
}
return fmc_state;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read and display the MODE setting in the flash software buffer. */
|
static int32_t cn0503_flash_read_mode(struct cn0503_dev *dev)
|
/* Read and display the MODE setting in the flash software buffer. */
static int32_t cn0503_flash_read_mode(struct cn0503_dev *dev)
|
{
cli_write_string(dev->cli_handler,
(uint8_t *)"RESP: FL_READ MODE?=");
cli_write_string(dev->cli_handler,
cn0503_ascii_modes[dev->sw_flash_buffer[CN0503_FLASH_MODE_IDX]]);
cli_write_string(dev->cli_handler, (uint8_t *)"\n");
return SUCCESS;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* xs_destroy - prepare to shutdown a transport @xprt: doomed transport */
|
static void xs_destroy(struct rpc_xprt *xprt)
|
/* xs_destroy - prepare to shutdown a transport @xprt: doomed transport */
static void xs_destroy(struct rpc_xprt *xprt)
|
{
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
dprintk("RPC: xs_destroy xprt %p\n", xprt);
cancel_rearming_delayed_work(&transport->connect_worker);
xs_close(xprt);
xs_free_peer_addresses(xprt);
kfree(xprt->slot);
kfree(xprt);
module_put(THIS_MODULE);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Note: this code is harmless on little-endian machines. */
|
static void byteReverse(unsigned char *buf, unsigned longs)
|
/* Note: this code is harmless on little-endian machines. */
static void byteReverse(unsigned char *buf, unsigned longs)
|
{
__u32 t;
do {
t = (__u32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(__u32 *) buf = t;
buf += 4;
} while (--longs);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Get relative threshold of touch judgement for specified channel. */
|
u32 CapTouch_GetChDiffThres(CAPTOUCH_TypeDef *CapTouch, u8 Channel)
|
/* Get relative threshold of touch judgement for specified channel. */
u32 CapTouch_GetChDiffThres(CAPTOUCH_TypeDef *CapTouch, u8 Channel)
|
{
assert_param(IS_CAPTOUCH_ALL_PERIPH(CapTouch));
assert_param(IS_CT_CHANNEL(Channel));
return (CapTouch->CT_CH[Channel].CTRL & BIT_CT_CHX_TOUCH_THRES) >> 16;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Selects the SDADC channel to be used for regular conversion. */
|
void SDADC_ChannelSelect(SDADC_TypeDef *SDADCx, uint32_t SDADC_Channel)
|
/* Selects the SDADC channel to be used for regular conversion. */
void SDADC_ChannelSelect(SDADC_TypeDef *SDADCx, uint32_t SDADC_Channel)
|
{
uint32_t tmpcr2;
assert_param(IS_SDADC_ALL_PERIPH(SDADCx));
assert_param(IS_SDADC_REGULAR_CHANNEL(SDADC_Channel));
tmpcr2 = SDADCx->CR2;
tmpcr2 &= (uint32_t) (~SDADC_CR2_RCH);
tmpcr2 |= (uint32_t) (SDADC_Channel & 0xFFFF0000);
SDADCx->CR2 = tmpcr2;
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* adds a VLAN range to a port's VLAN membership table */
|
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
|
/* adds a VLAN range to a port's VLAN membership table */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
|
{
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* The ProcessPacket () function process each inbound or outbound TLS APP packet. */
|
EFI_STATUS EFIAPI TlsProcessPacket(IN EFI_TLS_PROTOCOL *This, IN OUT EFI_TLS_FRAGMENT_DATA **FragmentTable, IN UINT32 *FragmentCount, IN EFI_TLS_CRYPT_MODE CryptMode)
|
/* The ProcessPacket () function process each inbound or outbound TLS APP packet. */
EFI_STATUS EFIAPI TlsProcessPacket(IN EFI_TLS_PROTOCOL *This, IN OUT EFI_TLS_FRAGMENT_DATA **FragmentTable, IN UINT32 *FragmentCount, IN EFI_TLS_CRYPT_MODE CryptMode)
|
{
EFI_STATUS Status;
TLS_INSTANCE *Instance;
EFI_TPL OldTpl;
Status = EFI_SUCCESS;
if ((This == NULL) || (FragmentTable == NULL) || (FragmentCount == NULL)) {
return EFI_INVALID_PARAMETER;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance = TLS_INSTANCE_FROM_PROTOCOL (This);
if (Instance->TlsSessionState != EfiTlsSessionDataTransferring) {
Status = EFI_NOT_READY;
goto ON_EXIT;
}
switch (CryptMode) {
case EfiTlsEncrypt:
Status = TlsEncryptPacket (Instance, FragmentTable, FragmentCount);
break;
case EfiTlsDecrypt:
Status = TlsDecryptPacket (Instance, FragmentTable, FragmentCount);
break;
default:
return EFI_INVALID_PARAMETER;
}
ON_EXIT:
gBS->RestoreTPL (OldTpl);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Command response callback function for sd_ble_gatts_sys_attr_get BLE command.
Callback for decoding the output parameters and the command response return code. */
|
static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
/* Command response callback function for sd_ble_gatts_sys_attr_get BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
{
uint32_t result_code;
const uint32_t err_code = ble_gatts_sys_attr_get_rsp_dec(
p_buffer,
length,
(uint8_t *) mp_out_params[0],
(uint16_t *) mp_out_params[1],
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* CAN MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan)
|
/* CAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hcan->Instance==CAN)
{
__HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_CAN;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* RCC Set the Source for the USB Clock. */
|
void rcc_set_usbclk_source(enum rcc_osc clk)
|
/* RCC Set the Source for the USB Clock. */
void rcc_set_usbclk_source(enum rcc_osc clk)
|
{
switch (clk) {
case RCC_PLL:
RCC_CFGR3 |= RCC_CFGR3_USBSW;
break;
case RCC_HSI48:
RCC_CFGR3 &= ~RCC_CFGR3_USBSW;
break;
case RCC_HSI:
case RCC_HSE:
case RCC_LSI:
case RCC_LSE:
case RCC_HSI14:
break;
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Stop counting the timer instance.
If there are no more timer instance started it also stops the hardware timer. */
|
int32_t timer_stop(struct timer_desc *desc)
|
/* Stop counting the timer instance.
If there are no more timer instance started it also stops the hardware timer. */
int32_t timer_stop(struct timer_desc *desc)
|
{
uint32_t counter;
struct aducm_timer_desc *tmr_desc;
if (!desc)
return FAILURE;
tmr_desc = desc->extra;
if (!tmr_desc->started)
return FAILURE;
timer_counter_get(desc, &counter);
desc->load_value = counter;
if (nb_enables == 1)
while (ADI_TMR_DEVICE_BUSY == adi_tmr_Enable(timer_id, false));
nb_enables--;
tmr_desc->started = false;
return SUCCESS;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Calculates a CRC8 checksum for the given buffer with the polynom stored in the crc_table */
|
static guint8 crc8_precompiled(guint8 *buf, guint32 len, guint8 seed, const guint8 crc_table[])
|
/* Calculates a CRC8 checksum for the given buffer with the polynom stored in the crc_table */
static guint8 crc8_precompiled(guint8 *buf, guint32 len, guint8 seed, const guint8 crc_table[])
|
{
guint8 crc;
crc = seed;
while(len-- > 0)
crc = crc_table[(guint8)(*buf++) ^ crc];
return crc;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* param base SAI base pointer. param handle Pointer to the sai_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
|
status_t SAI_TransferGetReceiveCount(I2S_Type *base, sai_handle_t *handle, size_t *count)
|
/* param base SAI base pointer. param handle Pointer to the sai_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
status_t SAI_TransferGetReceiveCount(I2S_Type *base, sai_handle_t *handle, size_t *count)
|
{
assert(handle);
status_t status = kStatus_Success;
if (handle->state != kSAI_Busy)
{
status = kStatus_NoTransferInProgress;
}
else
{
*count = (handle->transferSize[handle->queueDriver] - handle->saiQueue[handle->queueDriver].dataSize);
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.