mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
mm, audio, crypto, graphics: Fix various spacing/alignment issues
This commit is contained in:
+1
-1
Submodule arch updated: ecb6712035...8faab42f9a
+4
-4
@@ -873,11 +873,11 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)
|
|||||||
char path[AUDIO_MAX_DEVICE_PATH];
|
char path[AUDIO_MAX_DEVICE_PATH];
|
||||||
static bool dev_audio_created = false;
|
static bool dev_audio_created = false;
|
||||||
#ifndef CONFIG_AUDIO_CUSTOM_DEV_PATH
|
#ifndef CONFIG_AUDIO_CUSTOM_DEV_PATH
|
||||||
const char* devname = "/dev/audio";
|
FAR const char *devname = "/dev/audio";
|
||||||
#elif !defined(CONFIG_AUDIO_DEV_ROOT)
|
#elif !defined(CONFIG_AUDIO_DEV_ROOT)
|
||||||
const char* devname = CONFIG_AUDIO_DEV_PATH;
|
FAR const char *devname = CONFIG_AUDIO_DEV_PATH;
|
||||||
const char* ptr;
|
FAR const char *ptr;
|
||||||
char* pathptr;
|
FAR char *pathptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate the upper-half data structure */
|
/* Allocate the upper-half data structure */
|
||||||
|
|||||||
+3
-3
@@ -100,7 +100,7 @@ static int cryptodev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
case CIOCGSESSION:
|
case CIOCGSESSION:
|
||||||
{
|
{
|
||||||
struct session_op *ses = (struct session_op*)arg;
|
FAR struct session_op *ses = (FAR struct session_op *)arg;
|
||||||
ses->ses = (uint32_t)ses;
|
ses->ses = (uint32_t)ses;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -112,8 +112,8 @@ static int cryptodev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case CIOCCRYPT:
|
case CIOCCRYPT:
|
||||||
{
|
{
|
||||||
FAR struct crypt_op *op = (struct crypt_op*)arg;
|
FAR struct crypt_op *op = (FAR struct crypt_op *)arg;
|
||||||
FAR struct session_op *ses = (struct session_op*)op->ses;
|
FAR struct session_op *ses = (FAR struct session_op *)op->ses;
|
||||||
int encrypt;
|
int encrypt;
|
||||||
|
|
||||||
switch (op->op)
|
switch (op->op)
|
||||||
|
|||||||
@@ -85,16 +85,18 @@
|
|||||||
int nxbe_colormap(FAR NX_DRIVERTYPE *dev)
|
int nxbe_colormap(FAR NX_DRIVERTYPE *dev)
|
||||||
{
|
{
|
||||||
struct fb_cmap_s cmap;
|
struct fb_cmap_s cmap;
|
||||||
uint8_t *alloc;
|
FAR uint8_t *alloc;
|
||||||
uint8_t *red;
|
FAR uint8_t *red;
|
||||||
uint8_t *green;
|
FAR uint8_t *green;
|
||||||
uint8_t *blue;
|
FAR uint8_t *blue;
|
||||||
uint8_t rval;
|
uint8_t rval;
|
||||||
uint8_t gval;
|
uint8_t gval;
|
||||||
int size;
|
int size;
|
||||||
int ndx;
|
int ndx;
|
||||||
int ret;
|
int ret;
|
||||||
int i, j, k;
|
int i;
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
|
||||||
/* Allocate the color map tables in one allocation:
|
/* Allocate the color map tables in one allocation:
|
||||||
*
|
*
|
||||||
@@ -102,7 +104,7 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
size = 3 * CONFIG_NX_NCOLORS * sizeof(uint8_t);
|
size = 3 * CONFIG_NX_NCOLORS * sizeof(uint8_t);
|
||||||
alloc = (uint8_t*)kmm_malloc(size);
|
alloc = (FAR uint8_t *)kmm_malloc(size);
|
||||||
if (alloc == NULL)
|
if (alloc == NULL)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
|
|||||||
|
|
||||||
/* Then copy the image */
|
/* Then copy the image */
|
||||||
|
|
||||||
sline = (const uint8_t*)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride;
|
sline = (FAR const uint8_t *)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride;
|
||||||
dline = pinfo->fbmem + dest->pt1.y * deststride + NXGL_SCALEX(dest->pt1.x);
|
dline = pinfo->fbmem + dest->pt1.y * deststride + NXGL_SCALEX(dest->pt1.x);
|
||||||
|
|
||||||
while (rows--)
|
while (rows--)
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
|
|||||||
/* Set up to copy the image */
|
/* Set up to copy the image */
|
||||||
|
|
||||||
xoffset = dest->pt1.x - origin->x;
|
xoffset = dest->pt1.x - origin->x;
|
||||||
sline = (const uint8_t*)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride;
|
sline = (FAR const uint8_t *)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride;
|
||||||
#if NXGLIB_BITSPERPIXEL < 8
|
#if NXGLIB_BITSPERPIXEL < 8
|
||||||
remainder = NXGL_REMAINDERX(xoffset);
|
remainder = NXGL_REMAINDERX(xoffset);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -88,12 +88,12 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
|
|||||||
|
|
||||||
/* Map the memory chunk into a free node */
|
/* Map the memory chunk into a free node */
|
||||||
|
|
||||||
node = (FAR struct mm_freenode_s *)((char*)mem - SIZEOF_MM_ALLOCNODE);
|
node = (FAR struct mm_freenode_s *)((FAR char *)mem - SIZEOF_MM_ALLOCNODE);
|
||||||
node->preceding &= ~MM_ALLOC_BIT;
|
node->preceding &= ~MM_ALLOC_BIT;
|
||||||
|
|
||||||
/* Check if the following node is free and, if so, merge it */
|
/* Check if the following node is free and, if so, merge it */
|
||||||
|
|
||||||
next = (FAR struct mm_freenode_s *)((char*)node + node->size);
|
next = (FAR struct mm_freenode_s *)((FAR char *)node + node->size);
|
||||||
if ((next->preceding & MM_ALLOC_BIT) == 0)
|
if ((next->preceding & MM_ALLOC_BIT) == 0)
|
||||||
{
|
{
|
||||||
FAR struct mm_allocnode_s *andbeyond;
|
FAR struct mm_allocnode_s *andbeyond;
|
||||||
@@ -103,7 +103,7 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
|
|||||||
* index past the tail chunk because it is always allocated.
|
* index past the tail chunk because it is always allocated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
andbeyond = (FAR struct mm_allocnode_s*)((char*)next + next->size);
|
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + next->size);
|
||||||
|
|
||||||
/* Remove the next node. There must be a predecessor,
|
/* Remove the next node. There must be a predecessor,
|
||||||
* but there may not be a successor node.
|
* but there may not be a successor node.
|
||||||
@@ -127,7 +127,7 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
|
|||||||
* it with this node
|
* it with this node
|
||||||
*/
|
*/
|
||||||
|
|
||||||
prev = (FAR struct mm_freenode_s *)((char*)node - node->preceding);
|
prev = (FAR struct mm_freenode_s *)((FAR char *)node - node->preceding);
|
||||||
if ((prev->preceding & MM_ALLOC_BIT) == 0)
|
if ((prev->preceding & MM_ALLOC_BIT) == 0)
|
||||||
{
|
{
|
||||||
/* Remove the node. There must be a predecessor, but there may
|
/* Remove the node. There must be a predecessor, but there may
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
|
int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
|
||||||
{
|
{
|
||||||
struct mm_allocnode_s *node;
|
FAR struct mm_allocnode_s *node;
|
||||||
size_t mxordblk = 0;
|
size_t mxordblk = 0;
|
||||||
int ordblks = 0; /* Number of non-inuse chunks */
|
int ordblks = 0; /* Number of non-inuse chunks */
|
||||||
size_t uordblks = 0; /* Total allocated space */
|
size_t uordblks = 0; /* Total allocated space */
|
||||||
@@ -98,7 +98,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
|
|||||||
|
|
||||||
for (node = heap->mm_heapstart[region];
|
for (node = heap->mm_heapstart[region];
|
||||||
node < heap->mm_heapend[region];
|
node < heap->mm_heapend[region];
|
||||||
node = (struct mm_allocnode_s *)((char*)node + node->size))
|
node = (FAR struct mm_allocnode_s *)((FAR char *)node + node->size))
|
||||||
{
|
{
|
||||||
mvdbg("region=%d node=%p size=%p preceding=%p (%c)\n",
|
mvdbg("region=%d node=%p size=%p preceding=%p (%c)\n",
|
||||||
region, node, node->size, (node->preceding & ~MM_ALLOC_BIT),
|
region, node, node->size, (node->preceding & ~MM_ALLOC_BIT),
|
||||||
|
|||||||
@@ -164,11 +164,11 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
|||||||
{
|
{
|
||||||
/* Get a pointer to the next node in physical memory */
|
/* Get a pointer to the next node in physical memory */
|
||||||
|
|
||||||
next = (FAR struct mm_freenode_s*)(((char*)node) + node->size);
|
next = (FAR struct mm_freenode_s *)(((FAR char *)node) + node->size);
|
||||||
|
|
||||||
/* Create the remainder node */
|
/* Create the remainder node */
|
||||||
|
|
||||||
remainder = (FAR struct mm_freenode_s*)(((char*)node) + size);
|
remainder = (FAR struct mm_freenode_s *)(((FAR char *)node) + size);
|
||||||
remainder->size = remaining;
|
remainder->size = remaining;
|
||||||
remainder->preceding = size;
|
remainder->preceding = size;
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
|||||||
/* Handle the case of an exact size match */
|
/* Handle the case of an exact size match */
|
||||||
|
|
||||||
node->preceding |= MM_ALLOC_BIT;
|
node->preceding |= MM_ALLOC_BIT;
|
||||||
ret = (void*)((char*)node + SIZEOF_MM_ALLOCNODE);
|
ret = (void *)((FAR char *)node + SIZEOF_MM_ALLOCNODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_givesemaphore(heap);
|
mm_givesemaphore(heap);
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
|
|||||||
|
|
||||||
/* Get the node the next node after the allocation. */
|
/* Get the node the next node after the allocation. */
|
||||||
|
|
||||||
next = (FAR struct mm_allocnode_s*)((char*)node + node->size);
|
next = (FAR struct mm_allocnode_s *)((FAR char *)node + node->size);
|
||||||
|
|
||||||
/* Make sure that there is space to convert the preceding mm_allocnode_s
|
/* Make sure that there is space to convert the preceding mm_allocnode_s
|
||||||
* into an mm_freenode_s. I think that this should always be true
|
* into an mm_freenode_s. I think that this should always be true
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||||||
* chunk)
|
* chunk)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
andbeyond = (FAR struct mm_allocnode_s*)((char*)next + nextsize);
|
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + nextsize);
|
||||||
|
|
||||||
/* Remove the next node. There must be a predecessor, but there
|
/* Remove the next node. There must be a predecessor, but there
|
||||||
* may not be a successor node.
|
* may not be a successor node.
|
||||||
@@ -308,7 +308,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||||||
/* Extend the node into the next chunk */
|
/* Extend the node into the next chunk */
|
||||||
|
|
||||||
oldnode->size = oldsize + takenext;
|
oldnode->size = oldsize + takenext;
|
||||||
newnode = (FAR struct mm_freenode_s *)((char*)oldnode + oldnode->size);
|
newnode = (FAR struct mm_freenode_s *)((FAR char *)oldnode + oldnode->size);
|
||||||
|
|
||||||
/* Did we consume the entire preceding chunk? */
|
/* Did we consume the entire preceding chunk? */
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
* heap - A reference to the data structure that defines this heap.
|
* heap - A reference to the data structure that defines this heap.
|
||||||
* incr - Specifies the number of bytes to add or to remove from the
|
* incr - Specifies the number of bytes to add or to remove from the
|
||||||
* space allocated for the process.
|
* space allocated for the process.
|
||||||
maxbreak - The maximum permissible break address.
|
* maxbreak - The maximum permissible break address.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Upon successful completion, sbrk() returns the prior break value.
|
* Upon successful completion, sbrk() returns the prior break value.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
|
|||||||
|
|
||||||
/* Get a reference to the next node */
|
/* Get a reference to the next node */
|
||||||
|
|
||||||
next = (FAR struct mm_freenode_s*)((char*)node + node->size);
|
next = (FAR struct mm_freenode_s *)((FAR char *)node + node->size);
|
||||||
|
|
||||||
/* Check if it is free */
|
/* Check if it is free */
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
|
|||||||
|
|
||||||
/* Get the chunk next the next node (which could be the tail chunk) */
|
/* Get the chunk next the next node (which could be the tail chunk) */
|
||||||
|
|
||||||
andbeyond = (FAR struct mm_allocnode_s*)((char*)next + next->size);
|
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + next->size);
|
||||||
|
|
||||||
/* Remove the next node. There must be a predecessor, but there may
|
/* Remove the next node. There must be a predecessor, but there may
|
||||||
* not be a successor node.
|
* not be a successor node.
|
||||||
@@ -101,7 +101,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
|
|||||||
* tailing memory from the aligned chunk.
|
* tailing memory from the aligned chunk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
newnode = (FAR struct mm_freenode_s*)((char*)node + size);
|
newnode = (FAR struct mm_freenode_s *)((FAR char *)node + size);
|
||||||
|
|
||||||
/* Set up the size of the new node */
|
/* Set up the size of the new node */
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
|
|||||||
* tailing memory from the aligned chunk.
|
* tailing memory from the aligned chunk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
newnode = (FAR struct mm_freenode_s*)((char*)node + size);
|
newnode = (FAR struct mm_freenode_s *)((FAR char *)node + size);
|
||||||
|
|
||||||
/* Set up the size of the new node */
|
/* Set up the size of the new node */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user