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
/* Check Board Identity: returns 0 if recognized, -1 if unknown */
int checkboard(void)
/* Check Board Identity: returns 0 if recognized, -1 if unknown */ int checkboard(void)
{ puts ("Board: SIXNET SXNI855T\n"); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Free the memory block from the memory pool. */
VOID SdPeimFreeMemBlock(IN SD_PEIM_MEM_POOL *Pool, IN SD_PEIM_MEM_BLOCK *Block)
/* Free the memory block from the memory pool. */ VOID SdPeimFreeMemBlock(IN SD_PEIM_MEM_POOL *Pool, IN SD_PEIM_MEM_BLOCK *Block)
{ ASSERT ((Pool != NULL) && (Block != NULL)); IoMmuFreeBuffer (EFI_SIZE_TO_PAGES (Block->BufLen), Block->BufHost, Block->Mapping); }
tianocore/edk2
C++
Other
4,240
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Build a class cache including all classes attached to the specified interface */
int rtnl_class_alloc_cache(struct nl_sock *sk, int ifindex, struct nl_cache **result)
/* Build a class cache including all classes attached to the specified interface */ int rtnl_class_alloc_cache(struct nl_sock *sk, int ifindex, struct nl_cache **result)
{ struct nl_cache * cache; int err; cache = nl_cache_alloc(&rtnl_class_ops); if (!cache) return -NLE_NOMEM; cache->c_iarg1 = ifindex; if (sk && (err = nl_cache_refill(sk, cache)) < 0) { nl_cache_free(cache); return err; } *result = cache; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function for setting payload for ANT message and sending it. */
static void ant_message_send(ant_hrm_profile_t *p_profile)
/* Function for setting payload for ANT message and sending it. */ static void ant_message_send(ant_hrm_profile_t *p_profile)
{ uint32_t err_code; uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; sens_message_encode(p_profile, p_message_payload); err_code = sd_ant_broadcast_message_tx(p_profile->channel_number, sizeof (p_message_payload), p_message_payload); APP_ERROR_CHECK(err_code); }
labapart/polymcu
C++
null
201
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */
static gint g_environ_find(gchar **envp, const gchar *variable)
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */ static gint g_environ_find(gchar **envp, const gchar *variable)
{ gint len, i; if (envp == NULL) return -1; len = strlen (variable); for (i = 0; envp[i]; i++) { if (strncmp (envp[i], variable, len) == 0 && envp[i][len] == '=') return i; } return -1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* dca_remove_requester - remove a dca client from the list @dev - the device that wants dca service */
int dca_remove_requester(struct device *dev)
/* dca_remove_requester - remove a dca client from the list @dev - the device that wants dca service */ int dca_remove_requester(struct device *dev)
{ struct dca_provider *dca; int slot; unsigned long flags; if (!dev) return -EFAULT; spin_lock_irqsave(&dca_lock, flags); dca = dca_find_provider_by_dev(dev); if (!dca) { spin_unlock_irqrestore(&dca_lock, flags); return -ENODEV; } slot = dca->ops->remove_requester(dca, dev); spin_unlock_irqrestore(&dca_lock, flags); if (slot < 0) return slot; dca_sysfs_remove_req(dca, slot); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* allocate a buffer via vmalloc_32(). called from hw_params NOTE: this may be called not only once per pcm open! */
static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
/* allocate a buffer via vmalloc_32(). called from hw_params NOTE: this may be called not only once per pcm open! */ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
{ struct snd_pcm_runtime *runtime = subs->runtime; if (runtime->dma_area) { if (runtime->dma_bytes >= size) return 0; vfree(runtime->dma_area); } runtime->dma_area = vmalloc_32(size); if (! runtime->dma_area) return -ENOMEM; memset(runtime->dma_area, 0, size); runtime->dma_bytes = size; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the size of the whole flash array. */
uint32_t flashcalw_get_flash_size(void)
/* Gets the size of the whole flash array. */ uint32_t flashcalw_get_flash_size(void)
{ const uint16_t flash_size[(FLASHCALW_FPR_FSZ_Msk >> FLASHCALW_FPR_FSZ_Pos) + 1] = { 4, 8, 16, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 2048, }; return ((uint32_t)flash_size[(HFLASHC->FLASHCALW_FPR & FLASHCALW_FPR_FSZ_Msk) >> FLASHCALW_FPR_FSZ_Pos] << 10); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns the FMP Payload Header size in bytes. */
EFI_STATUS EFIAPI GetFmpPayloadHeaderSize(IN CONST VOID *Header, IN CONST UINTN FmpPayloadSize, OUT UINT32 *Size)
/* Returns the FMP Payload Header size in bytes. */ EFI_STATUS EFIAPI GetFmpPayloadHeaderSize(IN CONST VOID *Header, IN CONST UINTN FmpPayloadSize, OUT UINT32 *Size)
{ FMP_PAYLOAD_HEADER *FmpPayloadHeader; FmpPayloadHeader = NULL; if ((Header == NULL) || (Size == NULL)) { return EFI_INVALID_PARAMETER; } FmpPayloadHeader = (FMP_PAYLOAD_HEADER *)Header; if (((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) < (UINTN)FmpPayloadHeader) || ((UINTN)FmpPayloadHeader + sizeof (FMP_PAYLOAD_HEADER) >= (UINTN)FmpPayloadHeader + FmpPayloadSize) || (FmpPayloadHeader->HeaderSize < sizeof (FMP_PAYLOAD_HEADER))) { return EFI_INVALID_PARAMETER; } if (FmpPayloadHeader->Signature != FMP_PAYLOAD_HEADER_SIGNATURE) { return EFI_INVALID_PARAMETER; } *Size = FmpPayloadHeader->HeaderSize; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Checks if the input string matches to the regular expression pattern. */
EFI_STATUS EFIAPI RegularExpressionMatch(IN EFI_REGULAR_EXPRESSION_PROTOCOL *This, IN CHAR16 *String, IN CHAR16 *Pattern, IN EFI_REGEX_SYNTAX_TYPE *SyntaxType OPTIONAL, OUT BOOLEAN *Result, OUT EFI_REGEX_CAPTURE **Captures OPTIONAL, OUT UINTN *CapturesCount)
/* Checks if the input string matches to the regular expression pattern. */ EFI_STATUS EFIAPI RegularExpressionMatch(IN EFI_REGULAR_EXPRESSION_PROTOCOL *This, IN CHAR16 *String, IN CHAR16 *Pattern, IN EFI_REGEX_SYNTAX_TYPE *SyntaxType OPTIONAL, OUT BOOLEAN *Result, OUT EFI_REGEX_CAPTURE **Captures OPTIONAL, OUT UINTN *CapturesCount)
{ EFI_STATUS Status; UINT32 Index; BOOLEAN Supported; if ((This == NULL) || (String == NULL) || (Pattern == NULL) || (Result == NULL) || (CapturesCount == NULL)) { return EFI_INVALID_PARAMETER; } if (SyntaxType == NULL) { SyntaxType = mSupportedSyntaxes[0]; } else { Supported = FALSE; for (Index = 0; Index < ARRAY_SIZE (mSupportedSyntaxes); ++Index) { if (CompareGuid (SyntaxType, mSupportedSyntaxes[Index])) { Supported = TRUE; break; } } if (!Supported) { return EFI_UNSUPPORTED; } } Status = OnigurumaMatch (String, Pattern, SyntaxType, Result, Captures, CapturesCount); return Status; }
tianocore/edk2
C++
Other
4,240
/* Find the root directory on an UDF volume. */
EFI_STATUS FindRootDirectory(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, OUT UDF_FILE_INFO *File)
/* Find the root directory on an UDF volume. */ EFI_STATUS FindRootDirectory(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, OUT UDF_FILE_INFO *File)
{ EFI_STATUS Status; UDF_FILE_INFO Parent; Status = FindFileEntry ( BlockIo, DiskIo, Volume, &Volume->FileSetDesc.RootDirectoryIcb, &File->FileEntry ); if (EFI_ERROR (Status)) { return Status; } Parent.FileEntry = File->FileEntry; Parent.FileIdentifierDesc = NULL; Status = FindFile ( BlockIo, DiskIo, Volume, L"\\", NULL, &Parent, &Volume->FileSetDesc.RootDirectoryIcb, File ); if (EFI_ERROR (Status)) { FreePool (File->FileEntry); } return Status; }
tianocore/edk2
C++
Other
4,240
/* Derive SHA384 HMAC-based Expand Key Derivation Function (HKDF). */
BOOLEAN EFIAPI HkdfSha384Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
/* Derive SHA384 HMAC-based Expand Key Derivation Function (HKDF). */ BOOLEAN EFIAPI HkdfSha384Expand(IN CONST UINT8 *Prk, IN UINTN PrkSize, IN CONST UINT8 *Info, IN UINTN InfoSize, OUT UINT8 *Out, IN UINTN OutSize)
{ CALL_CRYPTO_SERVICE (HkdfSha384Expand, (Prk, PrkSize, Info, InfoSize, Out, OutSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Used to reset the sensor The value 0xB6 is written to the 0xE0 register the device is reset using the complete power-on-reset procedure. Soft reset can be easily set using bmp280_set_softreset(). */
BMP280_RETURN_FUNCTION_TYPE bmp280_set_soft_rst(void)
/* Used to reset the sensor The value 0xB6 is written to the 0xE0 register the device is reset using the complete power-on-reset procedure. Soft reset can be easily set using bmp280_set_softreset(). */ BMP280_RETURN_FUNCTION_TYPE bmp280_set_soft_rst(void)
{ BMP280_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 v_data_u8 = BMP280_SOFT_RESET_CODE; if (p_bmp280 == BMP280_NULL) { com_rslt = E_BMP280_NULL_PTR; } else { com_rslt = p_bmp280->BMP280_BUS_WRITE_FUNC(p_bmp280->dev_addr, BMP280_RST_REG, &v_data_u8, BMP280_GEN_READ_WRITE_DATA_LENGTH); } return com_rslt; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Re-enable interrupts on a event after they were throttled because they were coming too fast. */
static void power_pmu_unthrottle(struct perf_event *event)
/* Re-enable interrupts on a event after they were throttled because they were coming too fast. */ static void power_pmu_unthrottle(struct perf_event *event)
{ s64 val, left; unsigned long flags; if (!event->hw.idx || !event->hw.sample_period) return; local_irq_save(flags); perf_disable(); power_pmu_read(event); left = event->hw.sample_period; event->hw.last_period = left; val = 0; if (left < 0x80000000L) val = 0x80000000L - left; write_pmc(event->hw.idx, val); atomic64_set(&event->hw.prev_count, val); atomic64_set(&event->hw.period_left, left); perf_event_update_userpage(event); perf_enable(); local_irq_restore(flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: a newly allocated string, that is the normalized form of @str, or NULL if @str is not valid UTF-8. */
gchar* g_utf8_normalize(const gchar *str, gssize len, GNormalizeMode mode)
/* Returns: a newly allocated string, that is the normalized form of @str, or NULL if @str is not valid UTF-8. */ gchar* g_utf8_normalize(const gchar *str, gssize len, GNormalizeMode mode)
{ gunichar *result_wc = _g_utf8_normalize_wc (str, len, mode); gchar *result; result = g_ucs4_to_utf8 (result_wc, -1, NULL, NULL, NULL); g_free (result_wc); return result; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* gcov_info_free - release memory for profiling data set duplicate @info: profiling data set duplicate to free */
void gcov_info_free(struct gcov_info *info)
/* gcov_info_free - release memory for profiling data set duplicate @info: profiling data set duplicate to free */ void gcov_info_free(struct gcov_info *info)
{ unsigned int active = num_counter_active(info); unsigned int i; for (i = 0; i < active ; i++) vfree(info->counts[i].values); kfree(info->functions); kfree(info->filename); kfree(info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Make a BIOS call that returns one value only, or just status. If there is an error, then the error code is returned in @err and this function returns non-zero. This is used for simpler BIOS operations. This call may hold interrupts off for a long time on some laptops. */
static int apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax, int *err)
/* Make a BIOS call that returns one value only, or just status. If there is an error, then the error code is returned in @err and this function returns non-zero. This is used for simpler BIOS operations. This call may hold interrupts off for a long time on some laptops. */ static int apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax, int *err)
{ struct apm_bios_call call; int ret; call.func = func; call.ebx = ebx_in; call.ecx = ecx_in; ret = on_cpu0(__apm_bios_call_simple, &call); *eax = call.eax; *err = call.err; return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Print LLAP packets received on a physical LocalTalk interface. */
u_int ltalk_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
/* Print LLAP packets received on a physical LocalTalk interface. */ u_int ltalk_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{ u_int hdrlen; hdrlen = llap_print(ndo, p, h->len); if (hdrlen == 0) { return (h->caplen); } return (hdrlen); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Emit code for equality comparisons ('==', '~='). 'e1' was already put as RK by 'luaK_infix'. */
static void codeeq(FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2)
/* Emit code for equality comparisons ('==', '~='). 'e1' was already put as RK by 'luaK_infix'. */ static void codeeq(FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2)
{ lua_assert(e1->k == VK || e1->k == VKINT || e1->k == VKFLT); swapexps(e1, e2); } r1 = luaK_exp2anyreg(fs, e1); if (isSCnumber(e2, &im, &isfloat)) { op = OP_EQI; r2 = im; } else if (luaK_exp2RK(fs, e2)) { op = OP_EQK; r2 = e2->u.info; } else { op = OP_EQ; r2 = luaK_exp2anyreg(fs, e2); } freeexps(fs, e1, e2); e1->u.info = condjump(fs, op, r1, r2, isfloat, (opr == OPR_EQ)); e1->k = VJMP; }
Nicholas3388/LuaNode
C++
Other
1,055
/* periodic_next_shadow - return "next" pointer on shadow list @periodic: host pointer to qh/itd/sitd @tag: hardware tag for type of this record */
static union ehci_shadow* periodic_next_shadow(union ehci_shadow *periodic, __le32 tag)
/* periodic_next_shadow - return "next" pointer on shadow list @periodic: host pointer to qh/itd/sitd @tag: hardware tag for type of this record */ static union ehci_shadow* periodic_next_shadow(union ehci_shadow *periodic, __le32 tag)
{ switch (tag) { default: case Q_TYPE_QH: return &periodic->qh->qh_next; } }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the local host master port lock and destination ID register with the host device ID value. The host device ID value is provided by the platform. Returns %0 on success or %-1 on failure. */
static int rio_enum_host(struct rio_mport *port)
/* Sets the local host master port lock and destination ID register with the host device ID value. The host device ID value is provided by the platform. Returns %0 on success or %-1 on failure. */ static int rio_enum_host(struct rio_mport *port)
{ u32 result; rio_local_write_config_32(port, RIO_HOST_DID_LOCK_CSR, port->host_deviceid); rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result); if ((result & 0xffff) != port->host_deviceid) return -1; rio_local_set_device_id(port, port->host_deviceid); if (next_destid == port->host_deviceid) next_destid++; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Write out and wait upon all the dirty data associated with a block device via its mapping. Does not take the superblock lock. */
int sync_blockdev(struct block_device *bdev)
/* Write out and wait upon all the dirty data associated with a block device via its mapping. Does not take the superblock lock. */ int sync_blockdev(struct block_device *bdev)
{ return __sync_blockdev(bdev, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* In principle, this could be tied to an interrupt, but the adapter doesn't appear to be designed to support interrupts. We spin on the 0x80 ready bit. */
static unsigned char ppa_wait(ppa_struct *dev)
/* In principle, this could be tied to an interrupt, but the adapter doesn't appear to be designed to support interrupts. We spin on the 0x80 ready bit. */ static unsigned char ppa_wait(ppa_struct *dev)
{ int k; unsigned short ppb = dev->base; unsigned char r; k = PPA_SPIN_TMO; for (r = r_str(ppb); ((r & 0xc0) != 0xc0) && (k); k--) { udelay(1); r = r_str(ppb); } if (k) return (r & 0xf0); ppa_fail(dev, DID_TIME_OUT); printk(KERN_WARNING "ppa timeout in ppa_wait\n"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int mock_write_event_init(int res)
/* This file is part of the Simba project. */ int mock_write_event_init(int res)
{ harness_mock_write("event_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Change Logs: Date Author Notes GSunwinder first version */
int main(void)
/* Change Logs: Date Author Notes GSunwinder first version */ int main(void)
{ printf("SystemClk: %d Hz\r\n", SystemCoreClock); rt_pin_mode(LED_BLUE, PIN_MODE_OUTPUT); rt_pin_mode(LED_RED, PIN_MODE_OUTPUT); while (1) { rt_pin_write(LED_RED, PIN_LOW); rt_pin_write(LED_BLUE, PIN_HIGH); rt_thread_mdelay(1000); rt_pin_write(LED_RED, PIN_HIGH); rt_pin_write(LED_BLUE, PIN_LOW); rt_thread_mdelay(1000); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
{ return mRunningOnQ35 ? PciExpressBitFieldAnd16 (Address, StartBit, EndBit, AndData) : PciCf8BitFieldAnd16 (Address, StartBit, EndBit, AndData); }
tianocore/edk2
C++
Other
4,240
/* Reads the specified ADC Software start injected conversion Status. */
uint8_t ADC_ReadSoftwareStartInjectedConvStatus(ADC_T *adc)
/* Reads the specified ADC Software start injected conversion Status. */ uint8_t ADC_ReadSoftwareStartInjectedConvStatus(ADC_T *adc)
{ uint8_t ret; ret = (adc->CTRL2_B.INJSWSC) ? BIT_SET : BIT_RESET; return ret; }
pikasTech/PikaPython
C++
MIT License
1,403
/* RETURNS: Pointer to new bio on success, NULL on failure. */
struct bio* bio_alloc(gfp_t gfp_mask, int nr_iovecs)
/* RETURNS: Pointer to new bio on success, NULL on failure. */ struct bio* bio_alloc(gfp_t gfp_mask, int nr_iovecs)
{ struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set); if (bio) bio->bi_destructor = bio_fs_destructor; return bio; }
robutest/uclinux
C++
GPL-2.0
60
/* This macro is used to enable input channel interrupt. */
void ECAP_EnableINT(ECAP_T *ecap, uint32_t u32Mask)
/* This macro is used to enable input channel interrupt. */ void ECAP_EnableINT(ECAP_T *ecap, uint32_t u32Mask)
{ ecap->CTL0 |= (u32Mask); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is used to tell a year is a leap year or not. */
static bool is_leap_year(unsigned int year)
/* This function is used to tell a year is a leap year or not. */ static bool is_leap_year(unsigned int year)
{ u32 full_year = year + 1900; return (!(full_year % 4) && (full_year % 100)) || !(full_year % 400); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_11|GPIO_PIN_10); } else if(huart->Instance==USART6) { __HAL_RCC_USART6_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOG, GPIO_PIN_14|GPIO_PIN_9); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note: The only reason why drivers should use this is because they need to access the device list in irq context. Otherwise you really want to use scsi_device_lookup_by_target instead. */
struct scsi_device* __scsi_device_lookup_by_target(struct scsi_target *starget, uint lun)
/* Note: The only reason why drivers should use this is because they need to access the device list in irq context. Otherwise you really want to use scsi_device_lookup_by_target instead. */ struct scsi_device* __scsi_device_lookup_by_target(struct scsi_target *starget, uint lun)
{ struct scsi_device *sdev; list_for_each_entry(sdev, &starget->devices, same_target_siblings) { if (sdev->sdev_state == SDEV_DEL) continue; if (sdev->lun ==lun) return sdev; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the DMA channel to use for a given endpoint. */
void USBEndpointDMAChannel(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Channel)
/* Sets the DMA channel to use for a given endpoint. */ void USBEndpointDMAChannel(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Channel)
{ uint32_t ui32Mask; ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7)); ASSERT(ui32Channel <= UDMA_CHANNEL_USBEP3TX); ui32Mask = 0xf << (ui32Channel * 4); ui32Mask = HWREG(ui32Base + USB_O_DMASEL) & (~ui32Mask); ui32Mask |= (USBEPToIndex(ui32Endpoint)) << (ui32Channel * 4); HWREG(ui32Base + USB_O_DMASEL) = ui32Mask; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* i8042_aux_write() sends a byte out through the aux interface. */
static int i8042_aux_write(struct serio *serio, unsigned char c)
/* i8042_aux_write() sends a byte out through the aux interface. */ static int i8042_aux_write(struct serio *serio, unsigned char c)
{ struct i8042_port *port = serio->port_data; return i8042_command(&c, port->mux == -1 ? I8042_CMD_AUX_SEND : I8042_CMD_MUX_SEND + port->mux); }
robutest/uclinux
C++
GPL-2.0
60
/* This may free existing if the update cancels out whatever operation it was doing. */
static noinline void update_existing_ref(struct btrfs_trans_handle *trans, struct btrfs_delayed_ref_root *delayed_refs, struct btrfs_delayed_ref_node *existing, struct btrfs_delayed_ref_node *update)
/* This may free existing if the update cancels out whatever operation it was doing. */ static noinline void update_existing_ref(struct btrfs_trans_handle *trans, struct btrfs_delayed_ref_root *delayed_refs, struct btrfs_delayed_ref_node *existing, struct btrfs_delayed_ref_node *update)
{ if (update->action != existing->action) { existing->ref_mod--; if (existing->ref_mod == 0) { rb_erase(&existing->rb_node, &delayed_refs->root); existing->in_tree = 0; btrfs_put_delayed_ref(existing); delayed_refs->num_entries--; if (trans->delayed_ref_updates) trans->delayed_ref_updates--; } else { WARN_ON(existing->type == BTRFS_TREE_BLOCK_REF_KEY || existing->type == BTRFS_SHARED_BLOCK_REF_KEY); } } else { WARN_ON(existing->type == BTRFS_TREE_BLOCK_REF_KEY || existing->type == BTRFS_SHARED_BLOCK_REF_KEY); existing->ref_mod += update->ref_mod; } }
robutest/uclinux
C++
GPL-2.0
60
/* Find the first error in this address range */
static struct vme_bus_error* tsi148_find_error(vme_address_t aspace, unsigned long long address, size_t count)
/* Find the first error in this address range */ static struct vme_bus_error* tsi148_find_error(vme_address_t aspace, unsigned long long address, size_t count)
{ struct list_head *err_pos; struct vme_bus_error *vme_err, *valid = NULL; unsigned long long bound; bound = address + count; err_pos = NULL; list_for_each(err_pos, &(tsi148_bridge->vme_errors)) { vme_err = list_entry(err_pos, struct vme_bus_error, list); if((vme_err->address >= address) && (vme_err->address < bound)){ valid = vme_err; break; } } return valid; }
robutest/uclinux
C++
GPL-2.0
60
/* Allocate a memory block from a Memory Pool. */
void* osMemoryPoolAlloc(osMemoryPoolId_t mp_id, uint32_t timeout)
/* Allocate a memory block from a Memory Pool. */ void* osMemoryPoolAlloc(osMemoryPoolId_t mp_id, uint32_t timeout)
{ memory = isrRtxMemoryPoolAlloc(mp_id, timeout); } else { memory = __svcMemoryPoolAlloc(mp_id, timeout); } return memory; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Set OSD color mask, OSD data only will be displayed if the mask bit is set as 1. */
void vpostOSDSetColMask(uint8_t u8MaskColorR, uint8_t u8MaskColorG, uint8_t u8MaskColorB)
/* Set OSD color mask, OSD data only will be displayed if the mask bit is set as 1. */ void vpostOSDSetColMask(uint8_t u8MaskColorR, uint8_t u8MaskColorG, uint8_t u8MaskColorB)
{ outpw(REG_LCM_OSD_CMASK, ((u8MaskColorR << 16) | (u8MaskColorG << 8) | u8MaskColorB)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Releases ownership of the mutual exclusion lock, and restores the previous task priority level. */
VOID CoreReleaseLock(IN EFI_LOCK *Lock)
/* Releases ownership of the mutual exclusion lock, and restores the previous task priority level. */ VOID CoreReleaseLock(IN EFI_LOCK *Lock)
{ EFI_TPL Tpl; ASSERT (Lock != NULL); ASSERT (Lock->Lock == EfiLockAcquired); Tpl = Lock->OwnerTpl; Lock->Lock = EfiLockReleased; CoreRestoreTpl (Tpl); }
tianocore/edk2
C++
Other
4,240
/* The interrupt management utilities can only be called from ARM mode. When THUMB_INTERWORK is defined the utilities are defined as functions here to ensure a switch to ARM mode. When THUMB_INTERWORK is not defined then the utilities are defined as macros in portmacro.h - as per other ports. */
void vPortEnterCritical(void)
/* The interrupt management utilities can only be called from ARM mode. When THUMB_INTERWORK is defined the utilities are defined as functions here to ensure a switch to ARM mode. When THUMB_INTERWORK is not defined then the utilities are defined as macros in portmacro.h - as per other ports. */ void vPortEnterCritical(void)
{ asm volatile ( "STMDB SP!, {R0} \n\t" "MRS R0, CPSR \n\t" "ORR R0, R0, #0xC0 \n\t" "MSR CPSR, R0 \n\t" "LDMIA SP!, {R0}" ); ulCriticalNesting++; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Airpcap wrapper, used to set the link type of an airpcap adapter */
gboolean airpcap_if_set_link_type(PAirpcapHandle ah, AirpcapLinkType lt)
/* Airpcap wrapper, used to set the link type of an airpcap adapter */ gboolean airpcap_if_set_link_type(PAirpcapHandle ah, AirpcapLinkType lt)
{ if (!AirpcapLoaded) return FALSE; return g_PAirpcapSetLinkType(ah,lt); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read available data from the read FIFO, as 16-bit data items. */
uint32_t EPINonBlockingReadGet16(uint32_t ui32Base, uint32_t ui32Count, uint16_t *pui16Buf)
/* Read available data from the read FIFO, as 16-bit data items. */ uint32_t EPINonBlockingReadGet16(uint32_t ui32Base, uint32_t ui32Count, uint16_t *pui16Buf)
{ uint32_t ui32CountRead = 0; ASSERT(ui32Base == EPI0_BASE); ASSERT(ui32Count < 4096); ASSERT(pui16Buf); while(HWREG(ui32Base + EPI_O_RFIFOCNT) && ui32Count--) { *pui16Buf = (uint16_t)HWREG(ui32Base + EPI_O_READFIFO0); pui16Buf++; ui32CountRead++; } return(ui32CountRead); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Init the DMA channel Interrupt Callback function. param of pfnCallback */
void xDMAChannelIntCallbackInit(unsigned long ulChannelID, xtEventCallback pfnCallback)
/* Init the DMA channel Interrupt Callback function. param of pfnCallback */ void xDMAChannelIntCallbackInit(unsigned long ulChannelID, xtEventCallback pfnCallback)
{ int i; xASSERT(xDMAChannelIDValid(ulChannelID)); for(i = 0; g_psDMAChannelAssignTable[i].ulChannelID != xDMA_CHANNEL_NOT_EXIST; i++) { if(g_psDMAChannelAssignTable[i].ulChannelID == ulChannelID) { g_psDMAChannelAssignTable[i].pfnDMAChannelHandlerCallback = pfnCallback; break; } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This is always called in the context of the task which submitted the I/O. */
struct io_context* get_io_context(gfp_t gfp_flags, int node)
/* This is always called in the context of the task which submitted the I/O. */ struct io_context* get_io_context(gfp_t gfp_flags, int node)
{ struct io_context *ret = NULL; do { ret = current_io_context(gfp_flags, node); if (unlikely(!ret)) break; } while (!atomic_long_inc_not_zero(&ret->refcount)); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* reset sis900 MAC and wait until finished reset through command register change backoff algorithm for 900B0 & 635 M/B */
static void sis900_reset(struct net_device *net_dev)
/* reset sis900 MAC and wait until finished reset through command register change backoff algorithm for 900B0 & 635 M/B */ static void sis900_reset(struct net_device *net_dev)
{ struct sis900_private *sis_priv = netdev_priv(net_dev); long ioaddr = net_dev->base_addr; int i = 0; u32 status = TxRCMP | RxRCMP; outl(0, ioaddr + ier); outl(0, ioaddr + imr); outl(0, ioaddr + rfcr); outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr); while (status && (i++ < 1000)) { status ^= (inl(isr + ioaddr) & status); } if( (sis_priv->chipset_rev >= SIS635A_900_REV) || (sis_priv->chipset_rev == SIS900B_900_REV) ) outl(PESEL | RND_CNT, ioaddr + cfg); else outl(PESEL, ioaddr + cfg); }
robutest/uclinux
C++
GPL-2.0
60
/* 'mxml_write_string()' - Write a string, escaping & and < as needed. */
static int mxml_write_string(const char *s, void *p, _mxml_putc_cb_t putc_cb)
/* 'mxml_write_string()' - Write a string, escaping & and < as needed. */ static int mxml_write_string(const char *s, void *p, _mxml_putc_cb_t putc_cb)
{ const char *name; while (*s) { if ((name = mxmlEntityGetName(*s)) != NULL) { if ((*putc_cb)('&', p) < 0) return (-1); while (*name) { if ((*putc_cb)(*name, p) < 0) return (-1); name ++; } if ((*putc_cb)(';', p) < 0) return (-1); } else if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } return (0); }
DC-SWAT/DreamShell
C++
null
404
/* Setup the lapic timer in periodic or oneshot mode */
static void lapic_timer_setup(enum clock_event_mode mode, struct clock_event_device *evt)
/* Setup the lapic timer in periodic or oneshot mode */ static void lapic_timer_setup(enum clock_event_mode mode, struct clock_event_device *evt)
{ unsigned long flags; unsigned int v; if (evt->features & CLOCK_EVT_FEAT_DUMMY) return; local_irq_save(flags); switch (mode) { case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_ONESHOT: __setup_APIC_LVTT(calibration_result, mode != CLOCK_EVT_MODE_PERIODIC, 1); break; case CLOCK_EVT_MODE_UNUSED: case CLOCK_EVT_MODE_SHUTDOWN: v = apic_read(APIC_LVTT); v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR); apic_write(APIC_LVTT, v); apic_write(APIC_TMICT, 0); break; case CLOCK_EVT_MODE_RESUME: break; } local_irq_restore(flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* VmbusChannelProcessRescindOffer - Rescind the offer by initiating a device removal */
static void VmbusChannelProcessRescindOffer(void *context)
/* VmbusChannelProcessRescindOffer - Rescind the offer by initiating a device removal */ static void VmbusChannelProcessRescindOffer(void *context)
{ struct vmbus_channel *channel = context; DPRINT_ENTER(VMBUS); VmbusChildDeviceRemove(channel->DeviceObject); DPRINT_EXIT(VMBUS); }
robutest/uclinux
C++
GPL-2.0
60
/* Move 'size' bytes from PC to card. (Shouldn't be interrupted) */
static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, int size)
/* Move 'size' bytes from PC to card. (Shouldn't be interrupted) */ static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, int size)
{ wl3501_switch_page(this, (dest & 0x8000) ? WL3501_BSS_SPAGE1 : WL3501_BSS_SPAGE0); wl3501_outb(dest & 0xff, this->base_addr + WL3501_NIC_LMAL); wl3501_outb(((dest >> 8) & 0x7f), this->base_addr + WL3501_NIC_LMAH); wl3501_outsb(this->base_addr + WL3501_NIC_IODPA, src, size); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the name of the file we're parsing. Used for error reporting purposes. */
CHAR8* SFPGetFileName(VOID)
/* Return the name of the file we're parsing. Used for error reporting purposes. */ CHAR8* SFPGetFileName(VOID)
{ if (mGlobals.SourceFile.FileName[0]) { return mGlobals.SourceFile.FileName; } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Alternate thread. This routine invokes the workqueue many times. */
void alternate_thread(void *arg1, void *arg2, void *arg3)
/* Alternate thread. This routine invokes the workqueue many times. */ void alternate_thread(void *arg1, void *arg2, void *arg3)
{ ARG_UNUSED(arg1); ARG_UNUSED(arg2); ARG_UNUSED(arg3); k_sem_take(&ALT_SEM, K_FOREVER); alt_thread_iterations = critical_loop("alt1", alt_thread_iterations); k_sem_give(&REGRESS_SEM); k_sem_take(&ALT_SEM, K_FOREVER); alt_thread_iterations = critical_loop("alt2", alt_thread_iterations); k_sem_give(&REGRESS_SEM); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt32ToUintn(IN INT32 Operand, OUT UINTN *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeInt32ToUintn(IN INT32 Operand, OUT UINTN *Result)
{ return SafeInt32ToUint64 (Operand, (UINT64 *)Result); }
tianocore/edk2
C++
Other
4,240
/* Setting the value of TXFIFO_THRESH field in TXFILLTUNING register to counter DDR latencies in writing data into Tx buffer. This prevents Tx buffer from getting underrun */
static void set_txfifothresh(struct usb_ehci *, u32)
/* Setting the value of TXFIFO_THRESH field in TXFILLTUNING register to counter DDR latencies in writing data into Tx buffer. This prevents Tx buffer from getting underrun */ static void set_txfifothresh(struct usb_ehci *, u32)
{ u32 cmd; cmd = ehci_readl(&ehci->txfilltuning); cmd &= ~TXFIFO_THRESH_MASK; cmd |= TXFIFO_THRESH(txfifo_thresh); ehci_writel(&ehci->txfilltuning, cmd); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function is called by the keyboard handler when SysRq is pressed and any other keycode arrives. */
void handle_sysrq(int key, struct tty_struct *tty)
/* This function is called by the keyboard handler when SysRq is pressed and any other keycode arrives. */ void handle_sysrq(int key, struct tty_struct *tty)
{ if (sysrq_on()) __handle_sysrq(key, tty, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the Simba project. */
int mock_write_usb_format_descriptors(void *out_p, uint8_t *buf_p, size_t size, int res)
/* This file is part of the Simba project. */ int mock_write_usb_format_descriptors(void *out_p, uint8_t *buf_p, size_t size, int res)
{ harness_mock_write("usb_format_descriptors(out_p)", out_p, size); harness_mock_write("usb_format_descriptors(buf_p)", buf_p, sizeof(*buf_p)); harness_mock_write("usb_format_descriptors(size)", &size, sizeof(size)); harness_mock_write("usb_format_descriptors(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Selects the trigger for the internal counter of batching events between XL and gyro.. */
int32_t lsm6dso_fifo_cnt_event_batch_set(lsm6dso_ctx_t *ctx, lsm6dso_trig_counter_bdr_t val)
/* Selects the trigger for the internal counter of batching events between XL and gyro.. */ int32_t lsm6dso_fifo_cnt_event_batch_set(lsm6dso_ctx_t *ctx, lsm6dso_trig_counter_bdr_t val)
{ lsm6dso_counter_bdr_reg1_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_COUNTER_BDR_REG1, (uint8_t*)&reg, 1); if (ret == 0) { reg.trig_counter_bdr = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_COUNTER_BDR_REG1, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Read the EEPROM for the current default LED configuration. If the LED configuration is not valid, set to a valid LED configuration. */
static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data)
/* Read the EEPROM for the current default LED configuration. If the LED configuration is not valid, set to a valid LED configuration. */ static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data)
{ s32 ret_val; ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data); if (ret_val) { hw_dbg("NVM Read Error\n"); goto out; } if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) { switch(hw->phy.media_type) { case e1000_media_type_internal_serdes: *data = ID_LED_DEFAULT_82575_SERDES; break; case e1000_media_type_copper: default: *data = ID_LED_DEFAULT; break; } } out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the system OSC monitor mode. This function sets the system OSC monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */
void CLOCK_SetSysOscMonitorMode(scg_sosc_monitor_mode_t mode)
/* Sets the system OSC monitor mode. This function sets the system OSC monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected. */ void CLOCK_SetSysOscMonitorMode(scg_sosc_monitor_mode_t mode)
{ uint32_t reg = SCG0->SOSCCSR; reg &= ~(SCG_SOSCCSR_SOSCCM_MASK | SCG_SOSCCSR_SOSCCMRE_MASK); reg |= (uint32_t)mode; SCG0->SOSCCSR = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clear out all data in the circular buffer. */
static void ti_buf_clear(struct circ_buf *cb)
/* Clear out all data in the circular buffer. */ static void ti_buf_clear(struct circ_buf *cb)
{ cb->head = cb->tail = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Size is the number of words, not bytes, in the bitmap. */
int xfs_next_bit(uint *map, uint size, uint start_bit)
/* Size is the number of words, not bytes, in the bitmap. */ int xfs_next_bit(uint *map, uint size, uint start_bit)
{ uint * p = ((unsigned int *) map) + (start_bit >> BIT_TO_WORD_SHIFT); uint result = start_bit & ~(NBWORD - 1); uint tmp; size <<= BIT_TO_WORD_SHIFT; if (start_bit >= size) return -1; size -= result; start_bit &= (NBWORD - 1); if (start_bit) { tmp = *p++; tmp &= (~0U << start_bit); if (tmp != 0U) goto found; result += NBWORD; size -= NBWORD; } while (size) { if ((tmp = *p++) != 0U) goto found; result += NBWORD; size -= NBWORD; } return -1; found: return result + ffs(tmp) - 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the currently-set options related to reception of VLAN-tagged frames. */
uint32_t EMACVLANRxConfigGet(uint32_t ui32Base, uint16_t *pui16Tag)
/* Returns the currently-set options related to reception of VLAN-tagged frames. */ uint32_t EMACVLANRxConfigGet(uint32_t ui32Base, uint16_t *pui16Tag)
{ uint32_t ui32Value; ASSERT(ui32Base == EMAC0_BASE); ASSERT(pui16Tag); ui32Value = HWREG(ui32Base + EMAC_O_VLANTG); *pui16Tag = (ui32Value & EMAC_VLANTG_VL_M) >> EMAC_VLANTG_VL_S; return(ui32Value & ~EMAC_VLANTG_VL_M); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create a thread and add it to Active Threads and set it to state READY. */
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
/* Create a thread and add it to Active Threads and set it to state READY. */ osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
{ return svcThreadCreate(thread_def, argument); } else { return __svcThreadCreate(thread_def, argument); } }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Note this function is a backend of pci_default_resume and is not supposed to be called by normal code, write proper resume handler and use it instead. */
int pci_reenable_device(struct pci_dev *dev)
/* Note this function is a backend of pci_default_resume and is not supposed to be called by normal code, write proper resume handler and use it instead. */ int pci_reenable_device(struct pci_dev *dev)
{ if (pci_is_enabled(dev)) return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 1 if successful, -EINVAL if m is NULL, or -ENOENT if no item with a key matching item_key is found. */
int menu_default_set(struct menu *m, char *item_key)
/* Returns 1 if successful, -EINVAL if m is NULL, or -ENOENT if no item with a key matching item_key is found. */ int menu_default_set(struct menu *m, char *item_key)
{ struct menu_item *item; if (!m) return -EINVAL; item = menu_item_by_key(m, item_key); if (!item) return -ENOENT; m->default_item = item; return 1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Calls a read-using-characteristic-uuid proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_read_uuid_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_attr *attr)
/* Calls a read-using-characteristic-uuid proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */ static int ble_gattc_read_uuid_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_attr *attr)
{ int rc; BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task()); BLE_HS_DBG_ASSERT(attr != NULL || status != 0); ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0 && status != BLE_HS_EDONE) { STATS_INC(ble_gattc_stats, read_uuid_fail); } if (proc->read_uuid.cb == NULL) { rc = 0; } else { rc = proc->read_uuid.cb(proc->conn_handle, ble_gattc_error(status, att_handle), attr, proc->read_uuid.cb_arg); } return rc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeTimer(unsigned long ulPort, unsigned char ucPins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeTimer(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
watterott/WebRadio
C++
null
71
/* Handle floating-point assist faults and traps for domain. */
unsigned long vmm_handle_fpu_swa(int fp_fault, struct kvm_pt_regs *regs, unsigned long isr)
/* Handle floating-point assist faults and traps for domain. */ unsigned long vmm_handle_fpu_swa(int fp_fault, struct kvm_pt_regs *regs, unsigned long isr)
{ struct kvm_vcpu *v = current_vcpu; IA64_BUNDLE bundle; unsigned long fault_ip; fpswa_ret_t ret; fault_ip = regs->cr_iip; if (!fp_fault && (ia64_psr(regs)->ri == 0)) fault_ip -= 16; if (fetch_code(v, fault_ip, &bundle)) return -EAGAIN; if (!bundle.i64[0] && !bundle.i64[1]) return -EACCES; ret = vmm_fp_emulate(fp_fault, &bundle, &regs->cr_ipsr, &regs->ar_fpsr, &isr, &regs->pr, &regs->cr_ifs, regs); return ret.status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Prints (calling the Lua 'print' function) any values on the stack */
static void l_print(lua_State *L)
/* Prints (calling the Lua 'print' function) any values on the stack */ static void l_print(lua_State *L)
{ luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); lua_getglobal(L, "print"); lua_insert(L, 1); if (lua_pcall(L, n, 0, 0) != LUA_OK) { l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", lua_tostring(L, -1))); } } }
Nicholas3388/LuaNode
C++
Other
1,055
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */
static int pcidio_detach(struct comedi_device *dev)
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */ static int pcidio_detach(struct comedi_device *dev)
{ printk("comedi%d: cb_pcidio: remove\n", dev->minor); if (devpriv) { if (devpriv->pci_dev) { if (devpriv->dio_reg_base) { comedi_pci_disable(devpriv->pci_dev); } pci_dev_put(devpriv->pci_dev); } } if (dev->subdevices) { int i; for (i = 0; i < thisboard->n_8255; i++) { subdev_8255_cleanup(dev, dev->subdevices + i); } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This is the main worker function that manages the state of the interrupt handlers. It both installs and uninstalls interrupt handlers based on the value of NewCallback. If NewCallback is NULL, then uninstall is indicated. If NewCallback is non-NULL, then install is indicated. */
EFI_STATUS ManageIdtEntryTable(CALLBACK_FUNC NewCallback, EFI_EXCEPTION_TYPE ExceptionType)
/* This is the main worker function that manages the state of the interrupt handlers. It both installs and uninstalls interrupt handlers based on the value of NewCallback. If NewCallback is NULL, then uninstall is indicated. If NewCallback is non-NULL, then install is indicated. */ EFI_STATUS ManageIdtEntryTable(CALLBACK_FUNC NewCallback, EFI_EXCEPTION_TYPE ExceptionType)
{ EFI_STATUS Status; Status = EFI_SUCCESS; if (CompareMem (&IdtEntryTable[ExceptionType].NewDesc, &NullDesc, sizeof (IA32_IDT_GATE_DESCRIPTOR)) != 0) { if (NewCallback != NULL) { Status = EFI_ALREADY_STARTED; } else { UnhookEntry (ExceptionType); } } else { if (NewCallback == NULL) { Status = EFI_INVALID_PARAMETER; } else { HookEntry (ExceptionType, NewCallback); } } return Status; }
tianocore/edk2
C++
Other
4,240
/* Reset the timer by placing the timer back into it's default reset configuration. */
void TimerReset(void)
/* Reset the timer by placing the timer back into it's default reset configuration. */ void TimerReset(void)
{ LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_TIM1); LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_TIM1); LL_APB1_GRP2_DisableClock(LL_APB1_GRP2_PERIPH_TIM1); SysTick->CTRL = 0; SysTick->LOAD = 0; SysTick->VAL = 0; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id)
/* Return: 0 if all went well, else returns appropriate error value. */ static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id)
{ return ti_sci_set_clock_state(handle, dev_id, clk_id, 0, MSG_CLOCK_SW_STATE_AUTO); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Check if SWP bus is in SUSPENDED or DEACTIVATED state @rmtoll ISR SUSP LL_SWPMI_IsActiveFlag_SUSP. */
uint32_t LL_SWPMI_IsActiveFlag_SUSP(SWPMI_TypeDef *SWPMIx)
/* Check if SWP bus is in SUSPENDED or DEACTIVATED state @rmtoll ISR SUSP LL_SWPMI_IsActiveFlag_SUSP. */ uint32_t LL_SWPMI_IsActiveFlag_SUSP(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_SUSP) == (SWPMI_ISR_SUSP)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Configures the PLL clock source and DM DN factor. This function must be used only when the PLL is disabled. */
void RCC_PLLDMDNConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLDN, uint32_t RCC_PLLDM)
/* Configures the PLL clock source and DM DN factor. This function must be used only when the PLL is disabled. */ void RCC_PLLDMDNConfig(uint32_t RCC_PLLSource, uint32_t RCC_PLLDN, uint32_t RCC_PLLDM)
{ uint32_t tmpreg0 = 0; assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource)); assert_param(IS_RCC_PLL_MUL(RCC_PLLMul)); tmpreg0 = RCC->CR; tmpreg0 &= 0x038fffff; tmpreg0 |= (RCC_PLLDN << 26) | (RCC_PLLDM << 20); RCC->CR = tmpreg0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* BACnetDateRange ::= SEQUENCE { StartDate Date, EndDate Date } */
static guint fDateRange(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* BACnetDateRange ::= SEQUENCE { StartDate Date, EndDate Date } */ static guint fDateRange(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ if (tvb_reported_length_remaining(tvb, offset) <= 0) return offset; offset = fDate(tvb, pinfo, tree, offset, "Start Date: "); return fDate(tvb, pinfo, tree, offset, "End Date: "); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the Wi-Fi listen interval for power save operation. It is represented in units of AP Beacon periods. */
NMI_API sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt *pstrM2mLsnInt)
/* Set the Wi-Fi listen interval for power save operation. It is represented in units of AP Beacon periods. */ NMI_API sint8 m2m_wifi_set_lsn_int(tstrM2mLsnInt *pstrM2mLsnInt)
{ return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_LSN_INT, (uint8*)pstrM2mLsnInt, sizeof(tstrM2mLsnInt), NULL, 0, 0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */
EFI_STATUS EFIAPI Udp4Poll(IN EFI_UDP4_PROTOCOL *This)
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */ EFI_STATUS EFIAPI Udp4Poll(IN EFI_UDP4_PROTOCOL *This)
{ UDP4_INSTANCE_DATA *Instance; EFI_IP4_PROTOCOL *Ip; if (This == NULL) { return EFI_INVALID_PARAMETER; } Instance = UDP4_INSTANCE_DATA_FROM_THIS (This); Ip = Instance->IpInfo->Ip.Ip4; return Ip->Poll (Ip); }
tianocore/edk2
C++
Other
4,240
/* NOTE: we dont have to reset the callout since this packet will have had a valid MIC and that will restart the authenticated payload timer */
static void ble_ll_ctrl_rx_ping_rsp(struct ble_ll_conn_sm *connsm)
/* NOTE: we dont have to reset the callout since this packet will have had a valid MIC and that will restart the authenticated payload timer */ static void ble_ll_ctrl_rx_ping_rsp(struct ble_ll_conn_sm *connsm)
{ ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_LE_PING); }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* does not yet catch signals sent when the child dies. in exit.c or in signal.c. retrieve the contents of FRV userspace general registers */
static int genregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
/* does not yet catch signals sent when the child dies. in exit.c or in signal.c. retrieve the contents of FRV userspace general registers */ static int genregs_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
{ const struct user_int_regs *iregs = &target->thread.user->i; int ret; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, iregs, 0, sizeof(*iregs)); if (ret < 0) return ret; return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, sizeof(*iregs), -1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Starts checksum computation. Configures the CRC module for the specified CRC protocol. */
static void CRC_ConfigureAndStart(CRC_Type *base, const crc_module_config_t *config)
/* Starts checksum computation. Configures the CRC module for the specified CRC protocol. */ static void CRC_ConfigureAndStart(CRC_Type *base, const crc_module_config_t *config)
{ uint32_t crcControl; crcControl = 0U | CRC_CTRL_TOT(config->writeTranspose) | CRC_CTRL_TOTR(config->readTranspose) | CRC_CTRL_FXOR(config->complementChecksum) | CRC_CTRL_TCRC(config->crcBits); base->CTRL = crcControl; base->GPOLY = config->polynomial; base->CTRL = crcControl | CRC_CTRL_WAS(true); base->DATA = config->seed; base->CTRL = crcControl; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure ADC to sample the internal scaled VCC. */
static void configure_adc(void)
/* Configure ADC to sample the internal scaled VCC. */ static void configure_adc(void)
{ struct adc_config config; adc_get_config_defaults(&config); config.clock_source = GCLK_GENERATOR_0; config.clock_prescaler = ADC_CLOCK_PRESCALER_DIV4; config.reference = ADC_REFERENCE_INTREF; config.event_action = ADC_EVENT_ACTION_START_CONV; config.run_in_standby = true; config.on_demand = true; config.resolution = ADC_RESOLUTION_12BIT; adc_init(&adc_instance, ADC, &config); adc_enable(&adc_instance); }
memfault/zero-to-main
C++
null
200
/* This file contains the code to do various system dependent things. */
static int hfs_revalidate_dentry(struct dentry *dentry, struct nameidata *nd)
/* This file contains the code to do various system dependent things. */ static int hfs_revalidate_dentry(struct dentry *dentry, struct nameidata *nd)
{ struct inode *inode = dentry->d_inode; int diff; if(!inode) return 1; diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest; if (diff) { inode->i_ctime.tv_sec += diff; inode->i_atime.tv_sec += diff; inode->i_mtime.tv_sec += diff; HFS_I(inode)->tz_secondswest += diff; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* pdc_ata_setup_port - setup the mmio address @port: ata ioports to setup @base: base address */
static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
/* pdc_ata_setup_port - setup the mmio address @port: ata ioports to setup @base: base address */ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
{ port->cmd_addr = port->data_addr = base; port->feature_addr = port->error_addr = base + 0x05; port->nsect_addr = base + 0x0a; port->lbal_addr = base + 0x0f; port->lbam_addr = base + 0x10; port->lbah_addr = base + 0x15; port->device_addr = base + 0x1a; port->command_addr = port->status_addr = base + 0x1f; port->altstatus_addr = port->ctl_addr = base + 0x81a; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set Proximity alert level. Sets Proximity profile alert level. Alert level is described by ADI_BLE_ALERT_LEVEL */
ADI_BLER_RESULT adi_radio_Proximity_SetAlertLevel(const ADI_BLE_ALERT_LEVEL eLinkLossAlertLevel, const bool bLinkLoss)
/* Set Proximity alert level. Sets Proximity profile alert level. Alert level is described by ADI_BLE_ALERT_LEVEL */ ADI_BLER_RESULT adi_radio_Proximity_SetAlertLevel(const ADI_BLE_ALERT_LEVEL eLinkLossAlertLevel, const bool bLinkLoss)
{ ADI_BLER_RESULT bleResult; ADI_BLE_LOGEVENT(LOGID_CMD_PROX_REPORTER_SET_ALERT_LEVEL); ADI_BLE_RADIO_CMD_START(CMD_PROX_REPORTER_SET_ALERT_LEVEL); memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN],&eLinkLossAlertLevel, 1u); bleResult = bler_process_cmd(((bLinkLoss == true) ? CMD_PROX_REPORTER_SET_ALERT_LEVEL : CMD_PROX_REPORTER_SET_IMM_ALERT_LEVEL), 1u, NULL, 0u); if(bleResult == ADI_BLER_SUCCESS){ bleResult = ADI_BLE_WAIT_FOR_COMPLETION(ADI_EVENT_FLAG_RESP_SUCCESS,ADI_BLER_CMD_TIMEOUT); } ADI_BLE_RADIO_CMD_END(); return (bleResult); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* return The status flags. This is the logical OR of members of the enumeration ::snvs_status_flags_t */
uint32_t SNVS_HP_RTC_GetStatusFlags(SNVS_Type *base)
/* return The status flags. This is the logical OR of members of the enumeration ::snvs_status_flags_t */ uint32_t SNVS_HP_RTC_GetStatusFlags(SNVS_Type *base)
{ uint32_t flags = 0U; if ((base->HPSR & SNVS_HPSR_PI_MASK) != 0U) { flags |= (uint32_t)kSNVS_RTC_PeriodicInterruptFlag; } if ((base->HPSR & SNVS_HPSR_HPTA_MASK) != 0U) { flags |= (uint32_t)kSNVS_RTC_AlarmInterruptFlag; } return flags; }
eclipse-threadx/getting-started
C++
Other
310
/* sunxi_lcd_gpio_set_direction @screen_id: The index of screen. @io_index: the index of gpio @direct: value of gpio to be set */
s32 sunxi_lcd_gpio_set_direction(u32 screen_id, u32 io_index, u32 direct)
/* sunxi_lcd_gpio_set_direction @screen_id: The index of screen. @io_index: the index of gpio @direct: value of gpio to be set */ s32 sunxi_lcd_gpio_set_direction(u32 screen_id, u32 io_index, u32 direct)
{ if (g_lcd_drv.src_ops.sunxi_lcd_gpio_set_direction) return g_lcd_drv.src_ops.sunxi_lcd_gpio_set_direction(screen_id, io_index, direct); return -1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the total number of whole hours in the specified timespan */
int32_t timespanToHours(timespan_t *timespan)
/* Returns the total number of whole hours in the specified timespan */ int32_t timespanToHours(timespan_t *timespan)
{ if (timespan->days == 0) { return timespan->hours; } return timespan->hours + (timespan->days * 24); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Internal function creates opcode based on the template opcode for the normal opcode. */
UINT8* EFIAPI InternalHiiCreateOpCode(IN VOID *OpCodeHandle, IN VOID *OpCodeTemplate, IN UINT8 OpCode, IN UINTN OpCodeSize)
/* Internal function creates opcode based on the template opcode for the normal opcode. */ UINT8* EFIAPI InternalHiiCreateOpCode(IN VOID *OpCodeHandle, IN VOID *OpCodeTemplate, IN UINT8 OpCode, IN UINTN OpCodeSize)
{ return InternalHiiCreateOpCodeExtended (OpCodeHandle, OpCodeTemplate, OpCode, OpCodeSize, 0, 0); }
tianocore/edk2
C++
Other
4,240
/* 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_ADC1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function enables the bus protection bits for disabled power domains so that the system does not hang when some unit accesses the bus while in power down. */
static int mtk_infracfg_set_bus_protection(void __iomem *infracfg, u32 mask)
/* This function enables the bus protection bits for disabled power domains so that the system does not hang when some unit accesses the bus while in power down. */ static int mtk_infracfg_set_bus_protection(void __iomem *infracfg, u32 mask)
{ u32 val; clrsetbits_le32(infracfg + INFRA_TOPAXI_PROT_EN, mask, mask); return readl_poll_timeout(infracfg + INFRA_TOPAXI_PROT_STA1, val, (val & mask) == mask, 100); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Replace the functions "platform_write" and "platform_read" with your platform specific read and write function. This example use an STM32 evaluation board and CubeMX tool. In this case the "*handle" variable is useful in order to select the correct interface but the usage of "*handle" is not mandatory. */
static int32_t platform_write(void *handle, uint8_t reg, uint8_t *bufp, uint16_t len)
/* Replace the functions "platform_write" and "platform_read" with your platform specific read and write function. This example use an STM32 evaluation board and CubeMX tool. In this case the "*handle" variable is useful in order to select the correct interface but the usage of "*handle" is not mandatory. */ static int32_t platform_write(void *handle, uint8_t reg, uint8_t *bufp, uint16_t len)
{ if (handle == &hi2c1) { HAL_I2C_Mem_Write(handle, LSM6DSL_I2C_ADD_L, Reg, I2C_MEMADD_SIZE_8BIT, Bufp, len, 1000); } return 0; }
eclipse-threadx/getting-started
C++
Other
310
/* get the statement long string where SSL is reading */
const char* SSL_rstate_string_long(SSL *ssl)
/* get the statement long string where SSL is reading */ const char* SSL_rstate_string_long(SSL *ssl)
{ const char *str = "unknown"; SSL_ASSERT2(ssl); switch (ssl->rlayer.rstate) { case SSL_ST_READ_HEADER: str = "read header"; break; case SSL_ST_READ_BODY: str = "read body"; break; case SSL_ST_READ_DONE: str = "read done"; break; default: break; } return str; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* 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)DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint8, Value); }
tianocore/edk2
C++
Other
4,240
/* Some specific phy can't work properly without reset. This function will be called during initialization and link status change from ON to DOWN. */
static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr)
/* Some specific phy can't work properly without reset. This function will be called during initialization and link status change from ON to DOWN. */ static u16 sis900_reset_phy(struct net_device *net_dev, int phy_addr)
{ int i; u16 status; for (i = 0; i < 2; i++) status = mdio_read(net_dev, phy_addr, MII_STATUS); mdio_write( net_dev, phy_addr, MII_CONTROL, MII_CNTL_RESET ); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* brief Return Frequency of MClk Clock return Frequency of MClk Clock. */
uint32_t CLOCK_GetMclkClkFreq(void)
/* brief Return Frequency of MClk Clock return Frequency of MClk Clock. */ uint32_t CLOCK_GetMclkClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->MCLKCLKSEL) { case 0U: freq = CLOCK_GetFroHfFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 7U: freq = 0U; break; default: assert(false); break; } return freq / ((SYSCON->MCLKDIV & 0xffU) + 1U); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Enables or disables the selected ADC start of the injected channels conversion. */
void ADC_EnableSoftwareStartInjectedConv(ADC_Module *ADCx, FunctionalState Cmd)
/* Enables or disables the selected ADC start of the injected channels conversion. */ void ADC_EnableSoftwareStartInjectedConv(ADC_Module *ADCx, FunctionalState Cmd)
{ assert_param(IsAdcModule(ADCx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { ADCx->CTRL2 |= CTRL2_INJ_EXT_TRIG_JSWSTART_SET; } else { ADCx->CTRL2 &= CTRL2_INJ_EXT_TRIG_JSWSTART_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* fill in the FPU structure for a core dump */
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpreg)
/* fill in the FPU structure for a core dump */ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpreg)
{ struct task_struct *tsk = current; int fpvalid; fpvalid = is_using_fpu(tsk); if (fpvalid) { unlazy_fpu(tsk); memcpy(fpreg, &tsk->thread.fpu_state, sizeof(*fpreg)); } return fpvalid; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is executed in case of error occurrence. */
static void Timeout_Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Timeout_Error_Handler(void)
{ while(1) { BSP_LED_On(LED5); HAL_Delay(500); BSP_LED_Off(LED5); HAL_Delay(500); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Description: Add a new address entry into the unlabeled connection hash table using the interface entry specified by @iface. On success zero is returned, otherwise a negative value is returned. The caller is responsible for calling the rcu_read_lock() functions. */
static int netlbl_unlhsh_add_addr4(struct netlbl_unlhsh_iface *iface, const struct in_addr *addr, const struct in_addr *mask, u32 secid)
/* Description: Add a new address entry into the unlabeled connection hash table using the interface entry specified by @iface. On success zero is returned, otherwise a negative value is returned. The caller is responsible for calling the rcu_read_lock() functions. */ static int netlbl_unlhsh_add_addr4(struct netlbl_unlhsh_iface *iface, const struct in_addr *addr, const struct in_addr *mask, u32 secid)
{ int ret_val; struct netlbl_unlhsh_addr4 *entry; entry = kzalloc(sizeof(*entry), GFP_ATOMIC); if (entry == NULL) return -ENOMEM; entry->list.addr = addr->s_addr & mask->s_addr; entry->list.mask = mask->s_addr; entry->list.valid = 1; INIT_RCU_HEAD(&entry->rcu); entry->secid = secid; spin_lock(&netlbl_unlhsh_lock); ret_val = netlbl_af4list_add(&entry->list, &iface->addr4_list); spin_unlock(&netlbl_unlhsh_lock); if (ret_val != 0) kfree(entry); return ret_val; }
EmcraftSystems/linux-emcraft
C++
Other
266