Changeset 666 for trunk/kernel/libk/remote_buf.c
- Timestamp:
- Oct 10, 2020, 5:27:12 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_buf.c
r657 r666 31 31 #include <remote_buf.h> 32 32 33 ///////////////////////////////////////// //34 error_t remote_buf_ create( xptr_t buf_xp,35 33 ///////////////////////////////////////// 34 error_t remote_buf_init( xptr_t buf_xp, 35 uint32_t size ) 36 36 { 37 37 kmem_req_t req; … … 42 42 43 43 // allocate the data buffer 44 if( size >= CONFIG_PPM_PAGE_SIZE ) 44 if( size == 0 ) 45 { 46 data = NULL; 47 } 48 else if( size >= CONFIG_PPM_PAGE_SIZE ) 45 49 { 46 50 req.type = KMEM_PPM; … … 48 52 req.flags = AF_NONE; 49 53 data = kmem_remote_alloc( buf_cxy , &req ); 54 55 if( data == NULL ) return -1; 50 56 } 51 57 else … … 55 61 req.flags = AF_NONE; 56 62 data = kmem_remote_alloc( buf_cxy , &req ); 57 } 58 59 if( data == NULL ) return -1;63 64 if( data == NULL ) return -1; 65 } 60 66 61 67 // initialize buffer descriptor … … 68 74 return 0; 69 75 70 } // end remote_buf_ create()76 } // end remote_buf_init() 71 77 72 78 ///////////////////////////////////////// … … 78 84 cxy_t buf_cxy = GET_CXY( buf_xp ); 79 85 80 // release memory allocated to data buffer 81 if( buf_ptr->size >= CONFIG_PPM_PAGE_SIZE ) 86 uint32_t size = hal_remote_l32( XPTR( buf_cxy , &buf_ptr->size )); 87 88 // release memory allocated to data buffer if required 89 if( size == 0 ) 90 { 91 return; 92 } 93 else if( size >= CONFIG_PPM_PAGE_SIZE ) 82 94 { 83 95 req.type = KMEM_PPM;
Note: See TracChangeset
for help on using the changeset viewer.