Commit 242afdaa by shtaya

DMA implemented.

parent 72bc16c5
Showing with 46 additions and 2 deletions
......@@ -26,12 +26,39 @@ typedef struct sales
} sales_t;
void readFile(sales_t *);
void dispData(sales_t *);
void sortData(sales_t *);
int main(void)
{
sales_t data[NFIELD];
int i;
sales_t *data;
sales_t **pArray;
data = (sales_t*)malloc(sizeof(sales_t)*NFIELD);
if (data == NULL)
{
printf( "memory allocation error\n" );
exit(EXIT_FAILURE);
}
pArray = (sales_t**)malloc(sizeof(sales_t*)*NFIELD);
if (pArray == NULL)
{
printf( "memory allocation error\n" );
exit(EXIT_FAILURE);
}
for(i = 0; i < NFIELD; i++)
{
pArray[i] = &data[i];
}
readFile(*pArray);
dispData(*pArray);
readFile(data);
sortData(*pArray);
return 0;
}
......@@ -60,3 +87,20 @@ void readFile(sales_t *sp)
return;
}
void dispData(sales_t *sp)
{
int i;
for(i = 0; i < 100; i++)
{
printf("%d,%d\n", (sp+i)->person_id,(sp+i)->book_id);
}
return;
}
void sortData(sales_t *sp)
{
return;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment