4.115
Rev | Line | |
---|
[e7fade3] | 1 | /* Driver Manager Read/Write Interface Implementation. |
---|
| 2 | * |
---|
[65d1f35] | 3 | * COPYRIGHT (c) 2009 Cobham Gaisler AB. |
---|
[e7fade3] | 4 | * |
---|
| 5 | * The license and distribution terms for this file may be |
---|
| 6 | * found in the file LICENSE in this distribution or at |
---|
[0decc806] | 7 | * http://www.rtems.org/license/LICENSE. |
---|
[e7fade3] | 8 | */ |
---|
| 9 | |
---|
| 10 | #include <string.h> |
---|
| 11 | #include <drvmgr/drvmgr.h> |
---|
| 12 | |
---|
| 13 | /* Set a range of memory in 128 byte chunks. |
---|
| 14 | * This call will take 128 bytes for buffer on stack |
---|
| 15 | */ |
---|
| 16 | void drvmgr_rw_memset( |
---|
| 17 | void *dstadr, |
---|
| 18 | int c, |
---|
| 19 | size_t n, |
---|
| 20 | void *a, |
---|
| 21 | drvmgr_wmem_arg wmem |
---|
| 22 | ) |
---|
| 23 | { |
---|
| 24 | unsigned long long buf[16+1]; /* Extra bytes after data are reserved |
---|
| 25 | * for optimizations by write_mem */ |
---|
| 26 | int txlen; |
---|
| 27 | char *adr; |
---|
| 28 | |
---|
| 29 | if (n <= 0) |
---|
| 30 | return; |
---|
| 31 | |
---|
| 32 | if (n > sizeof(unsigned long long)*16) |
---|
| 33 | txlen = sizeof(unsigned long long)*16; |
---|
| 34 | else |
---|
| 35 | txlen = n; |
---|
| 36 | |
---|
| 37 | memset(buf, c, txlen); |
---|
| 38 | |
---|
| 39 | adr = dstadr; |
---|
| 40 | do { |
---|
| 41 | wmem(adr, (const void *)&buf[0], txlen, a); |
---|
| 42 | adr += txlen; |
---|
| 43 | n -= txlen; |
---|
| 44 | |
---|
| 45 | /* next length to transmitt */ |
---|
| 46 | if (n > 16*sizeof(unsigned long long)) |
---|
| 47 | txlen = 16*sizeof(unsigned long long); |
---|
| 48 | else |
---|
| 49 | txlen = n; |
---|
| 50 | } while (n > 0); |
---|
| 51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.