Rename kmemalign to kmm_memalign for consitency with other naming

This commit is contained in:
Gregory Nutt 2014-08-31 14:57:31 -06:00
parent b5d22b428c
commit 5a488475a8
12 changed files with 38 additions and 33 deletions

View File

@ -294,7 +294,7 @@ config LPC31_EHCI_PREALLOCATE
---help---
Select this option to pre-allocate EHCI queue and descriptor
structure pools in .bss. Otherwise, these pools will be
dynamically allocated using kmemalign().
dynamically allocated using kmm_memalign().
config LPC31_EHCI_REGDEBUG
bool "Enable low-level EHCI register debug"

View File

@ -1,7 +1,7 @@
/*******************************************************************************
* arch/arm/src/lpc31xx/lpc31_ehci.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -4254,7 +4254,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
/* Allocate a pool of free Queue Head (QH) structures */
g_qhpool = (struct lpc31_qh_s *)
kmemalign(32, CONFIG_LPC31_EHCI_NQHS * sizeof(struct lpc31_qh_s));
kmm_memalign(32, CONFIG_LPC31_EHCI_NQHS * sizeof(struct lpc31_qh_s));
if (!g_qhpool)
{
usbhost_trace1(EHCI_TRACE1_QHPOOLALLOC_FAILED, 0);
@ -4275,7 +4275,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
/* Allocate a pool of free Transfer Descriptor (qTD) structures */
g_qtdpool = (struct lpc31_qtd_s *)
kmemalign(32, CONFIG_LPC31_EHCI_NQTDS * sizeof(struct lpc31_qtd_s));
kmm_memalign(32, CONFIG_LPC31_EHCI_NQTDS * sizeof(struct lpc31_qtd_s));
if (!g_qtdpool)
{
usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0);
@ -4288,7 +4288,7 @@ FAR struct usbhost_connection_s *lpc31_ehci_initialize(int controller)
/* Allocate the periodic framelist */
g_framelist = (uint32_t *)
kmemalign(4096, FRAME_LIST_SIZE * sizeof(uint32_t));
kmm_memalign(4096, FRAME_LIST_SIZE * sizeof(uint32_t));
if (!g_framelist)
{
usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0);

View File

@ -588,7 +588,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
/* Allocate buffers */
allocsize = CONFIG_SAM34_EMAC_NTXBUFFERS * sizeof(struct emac_txdesc_s);
priv->txdesc = (struct emac_txdesc_s *)kmemalign(8, allocsize);
priv->txdesc = (struct emac_txdesc_s *)kmm_memalign(8, allocsize);
if (!priv->txdesc)
{
nlldbg("ERROR: Failed to allocate TX descriptors\n");
@ -598,7 +598,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
memset(priv->txdesc, 0, allocsize);
allocsize = CONFIG_SAM34_EMAC_NRXBUFFERS * sizeof(struct emac_rxdesc_s);
priv->rxdesc = (struct emac_rxdesc_s *)kmemalign(8, allocsize);
priv->rxdesc = (struct emac_rxdesc_s *)kmm_memalign(8, allocsize);
if (!priv->rxdesc)
{
nlldbg("ERROR: Failed to allocate RX descriptors\n");
@ -609,7 +609,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
memset(priv->rxdesc, 0, allocsize);
allocsize = CONFIG_SAM34_EMAC_NTXBUFFERS * EMAC_TX_UNITSIZE;
priv->txbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->txbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->txbuffer)
{
nlldbg("ERROR: Failed to allocate TX buffer\n");
@ -618,7 +618,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
}
allocsize = CONFIG_SAM34_EMAC_NRXBUFFERS * EMAC_RX_UNITSIZE;
priv->rxbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->rxbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->rxbuffer)
{
nlldbg("ERROR: Failed to allocate RX buffer\n");

View File

@ -2684,7 +2684,7 @@ config SAMA5_EHCI_PREALLOCATE
---help---
Select this option to pre-allocate EHCI queue and descriptor
structure pools in .bss. Otherwise, these pools will be
dynamically allocated using kmemalign().
dynamically allocated using kmm_memalign().
config SAMA5_EHCI_REGDEBUG
bool "Enable low-level EHCI register debug"

View File

@ -4152,7 +4152,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
/* Allocate a pool of free Queue Head (QH) structures */
g_qhpool = (struct sam_qh_s *)
kmemalign(32, CONFIG_SAMA5_EHCI_NQHS * sizeof(struct sam_qh_s));
kmm_memalign(32, CONFIG_SAMA5_EHCI_NQHS * sizeof(struct sam_qh_s));
if (!g_qhpool)
{
usbhost_trace1(EHCI_TRACE1_QHPOOLALLOC_FAILED, 0);
@ -4173,7 +4173,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
/* Allocate a pool of free Transfer Descriptor (qTD) structures */
g_qtdpool = (struct sam_qtd_s *)
kmemalign(32, CONFIG_SAMA5_EHCI_NQTDS * sizeof(struct sam_qtd_s));
kmm_memalign(32, CONFIG_SAMA5_EHCI_NQTDS * sizeof(struct sam_qtd_s));
if (!g_qtdpool)
{
usbhost_trace1(EHCI_TRACE1_QTDPOOLALLOC_FAILED, 0);
@ -4186,7 +4186,7 @@ FAR struct usbhost_connection_s *sam_ehci_initialize(int controller)
/* Allocate the periodic framelist */
g_framelist = (uint32_t *)
kmemalign(4096, FRAME_LIST_SIZE * sizeof(uint32_t));
kmm_memalign(4096, FRAME_LIST_SIZE * sizeof(uint32_t));
if (!g_framelist)
{
usbhost_trace1(EHCI_TRACE1_PERFLALLOC_FAILED, 0);

View File

@ -593,7 +593,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
/* Allocate buffers */
allocsize = CONFIG_SAMA5_EMAC_NTXBUFFERS * sizeof(struct emac_txdesc_s);
priv->txdesc = (struct emac_txdesc_s *)kmemalign(8, allocsize);
priv->txdesc = (struct emac_txdesc_s *)kmm_memalign(8, allocsize);
if (!priv->txdesc)
{
nlldbg("ERROR: Failed to allocate TX descriptors\n");
@ -603,7 +603,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
memset(priv->txdesc, 0, allocsize);
allocsize = CONFIG_SAMA5_EMAC_NRXBUFFERS * sizeof(struct emac_rxdesc_s);
priv->rxdesc = (struct emac_rxdesc_s *)kmemalign(8, allocsize);
priv->rxdesc = (struct emac_rxdesc_s *)kmm_memalign(8, allocsize);
if (!priv->rxdesc)
{
nlldbg("ERROR: Failed to allocate RX descriptors\n");
@ -614,7 +614,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
memset(priv->rxdesc, 0, allocsize);
allocsize = CONFIG_SAMA5_EMAC_NTXBUFFERS * EMAC_TX_UNITSIZE;
priv->txbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->txbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->txbuffer)
{
nlldbg("ERROR: Failed to allocate TX buffer\n");
@ -623,7 +623,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
}
allocsize = CONFIG_SAMA5_EMAC_NRXBUFFERS * EMAC_RX_UNITSIZE;
priv->rxbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->rxbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->rxbuffer)
{
nlldbg("ERROR: Failed to allocate RX buffer\n");

View File

@ -920,7 +920,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
/* Allocate buffers */
allocsize = priv->attr->ntxbuffers * sizeof(struct emac_txdesc_s);
priv->txdesc = (struct emac_txdesc_s *)kmemalign(8, allocsize);
priv->txdesc = (struct emac_txdesc_s *)kmm_memalign(8, allocsize);
if (!priv->txdesc)
{
nlldbg("ERROR: Failed to allocate TX descriptors\n");
@ -930,7 +930,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
memset(priv->txdesc, 0, allocsize);
allocsize = priv->attr->nrxbuffers * sizeof(struct emac_rxdesc_s);
priv->rxdesc = (struct emac_rxdesc_s *)kmemalign(8, allocsize);
priv->rxdesc = (struct emac_rxdesc_s *)kmm_memalign(8, allocsize);
if (!priv->rxdesc)
{
nlldbg("ERROR: Failed to allocate RX descriptors\n");
@ -941,7 +941,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
memset(priv->rxdesc, 0, allocsize);
allocsize = priv->attr->ntxbuffers * EMAC_TX_UNITSIZE;
priv->txbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->txbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->txbuffer)
{
nlldbg("ERROR: Failed to allocate TX buffer\n");
@ -950,7 +950,7 @@ static int sam_buffer_initialize(struct sam_emac_s *priv)
}
allocsize = priv->attr->nrxbuffers * EMAC_RX_UNITSIZE;
priv->rxbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->rxbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->rxbuffer)
{
nlldbg("ERROR: Failed to allocate RX buffer\n");

View File

@ -524,7 +524,7 @@ static int sam_buffer_initialize(struct sam_gmac_s *priv)
/* Allocate buffers */
allocsize = CONFIG_SAMA5_GMAC_NTXBUFFERS * sizeof(struct gmac_txdesc_s);
priv->txdesc = (struct gmac_txdesc_s *)kmemalign(8, allocsize);
priv->txdesc = (struct gmac_txdesc_s *)kmm_memalign(8, allocsize);
if (!priv->txdesc)
{
nlldbg("ERROR: Failed to allocate TX descriptors\n");
@ -534,7 +534,7 @@ static int sam_buffer_initialize(struct sam_gmac_s *priv)
memset(priv->txdesc, 0, allocsize);
allocsize = CONFIG_SAMA5_GMAC_NRXBUFFERS * sizeof(struct gmac_rxdesc_s);
priv->rxdesc = (struct gmac_rxdesc_s *)kmemalign(8, allocsize);
priv->rxdesc = (struct gmac_rxdesc_s *)kmm_memalign(8, allocsize);
if (!priv->rxdesc)
{
nlldbg("ERROR: Failed to allocate RX descriptors\n");
@ -545,7 +545,7 @@ static int sam_buffer_initialize(struct sam_gmac_s *priv)
memset(priv->rxdesc, 0, allocsize);
allocsize = CONFIG_SAMA5_GMAC_NTXBUFFERS * GMAC_TX_UNITSIZE;
priv->txbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->txbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->txbuffer)
{
nlldbg("ERROR: Failed to allocate TX buffer\n");
@ -554,7 +554,7 @@ static int sam_buffer_initialize(struct sam_gmac_s *priv)
}
allocsize = CONFIG_SAMA5_GMAC_NRXBUFFERS * GMAC_RX_UNITSIZE;
priv->rxbuffer = (uint8_t *)kmemalign(8, allocsize);
priv->rxbuffer = (uint8_t *)kmm_memalign(8, allocsize);
if (!priv->rxbuffer)
{
nlldbg("ERROR: Failed to allocate RX buffer\n");

View File

@ -4291,7 +4291,7 @@ static void sam_sw_setup(struct sam_usbdev_s *priv)
/* Allocate a pool of free DMA transfer descriptors */
priv->dtdpool = (struct sam_dtd_s *)
kmemalign(16, CONFIG_SAMA5_UDPHS_NDTDS * sizeof(struct sam_dtd_s));
kmm_memalign(16, CONFIG_SAMA5_UDPHS_NDTDS * sizeof(struct sam_dtd_s));
if (!priv->dtdpool)
{
udbg("ERROR: Failed to allocate the DMA transfer descriptor pool\n");

View File

@ -129,7 +129,7 @@ extern "C"
# define kmalloc(s) malloc(s)
# define kzalloc(s) zalloc(s)
# define krealloc(p,s) realloc(p,s)
# define kmemalign(a,s) memalign(a,s)
# define kmm_memalign(a,s) memalign(a,s)
# define kfree(p) free(p)
#elif !defined(CONFIG_MM_KERNEL_HEAP)
@ -146,12 +146,12 @@ extern "C"
# define kmalloc(s) umm_malloc(s)
# define kzalloc(s) umm_zalloc(s)
# define krealloc(p,s) umm_realloc(p,s)
# define kmemalign(a,s) umm_memalign(a,s)
# define kmm_memalign(a,s) umm_memalign(a,s)
# define kfree(p) umm_free(p)
#else
/* Otherwise, the kernel-space allocators are declared here and we can call
* them directly.
/* Otherwise, the kernel-space allocators are declared in include/nuttx/mm.h
* and we can call them directly.
*/
void kmm_initialize(FAR void *heap_start, size_t heap_size);
@ -162,7 +162,6 @@ void kmm_givesemaphore(void);
FAR void *kmalloc(size_t size);
FAR void *kzalloc(size_t size);
FAR void *krealloc(FAR void *oldmem, size_t newsize);
FAR void *kmemalign(size_t alignment, size_t size);
void kfree(FAR void *mem);
#ifdef CONFIG_DEBUG

View File

@ -337,6 +337,12 @@ FAR void *mm_zalloc(FAR struct mm_heap_s *heap, size_t size);
FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
size_t size);
/* Functions contained in kmm_memalign.c ************************************/
#ifdef CONFIG_MM_KERNEL_HEAP
FAR void *kmm_memalign(size_t alignment, size_t size);
#endif
/* Functions contained in mm_brkaddr.c **************************************/
FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region);

View File

@ -58,7 +58,7 @@
****************************************************************************/
/************************************************************************
* Name: kmemalign
* Name: kmm_memalign
*
* Description:
* Allocate aligned memory in the kernel heap.
@ -72,7 +72,7 @@
*
************************************************************************/
FAR void *kmemalign(size_t alignment, size_t size)
FAR void *kmm_memalign(size_t alignment, size_t size)
{
return mm_memalign(&g_kmmheap, alignment, size);
}