Ignore:
Timestamp:
Jan 13, 2021, 12:36:17 AM (3 years ago)
Author:
alain
Message:

All modifications required to support the <tcp_chat> application
including error recovery in case of packet loss.A

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/fs/fatfs.c

    r673 r683  
    16301630xptr_t  fatfs_ctx_alloc( cxy_t  cxy )
    16311631{
    1632     kmem_req_t    req;
    1633 
    16341632    // allocate memory from remote cluster
    1635         req.type     = KMEM_KCM;
    1636         req.order    = bits_log2( sizeof(fatfs_ctx_t) );
    1637     req.flags    = AF_KERNEL | AF_ZERO;
    1638  
    1639     return XPTR( cxy , kmem_remote_alloc( cxy , &req ) );
     1633    void * ptr = kmem_remote_alloc( cxy,
     1634                                    bits_log2(sizeof(fatfs_ctx_t)),
     1635                                    AF_ZERO );
     1636
     1637    if( ptr == NULL ) return XPTR_NULL;
     1638    else              return XPTR( cxy , ptr );
    16401639
    16411640}  //end faffs_ctx_alloc()
     
    16451644{
    16461645    error_t       error;
    1647     kmem_req_t    req;
    16481646    cxy_t         cxy;             // FATFS context cluster identifier
    16491647    fatfs_ctx_t * fatfs_ctx_ptr;   // local pointer on FATFS context
     
    16671665    // allocate a 512 bytes buffer in remote cluster, used to store
    16681666    // temporarily the BOOT sector, and permanently the FS_INFO sector
    1669         req.type    = KMEM_KCM;
    1670     req.order   = 9;                    // 512 bytes
    1671     req.flags   = AF_KERNEL | AF_ZERO;
    1672         buffer      = kmem_remote_alloc( cxy , &req );
    1673 
     1667        buffer = kmem_remote_alloc( cxy,
     1668                                9,
     1669                                AF_ZERO );
    16741670    if( buffer == NULL )
    16751671    {
     
    18271823void fatfs_ctx_destroy( xptr_t  fatfs_ctx_xp )
    18281824{
    1829     kmem_req_t   req;
    18301825    mapper_t   * fat_mapper;
    18311826    uint8_t    * fs_info_buffer;
     
    18441839    fs_info_buffer = hal_remote_lpt( XPTR( fatfs_ctx_cxy , &fatfs_ctx_ptr->fs_info_buffer ) );
    18451840
    1846     // release FS_INFO buffer
    1847     req.type = KMEM_KCM;
    1848     req.ptr  = fs_info_buffer;
    1849     kmem_remote_free( fatfs_ctx_cxy , &req );
     1841    // release FS_INFO buffer (512 bytes)
     1842    kmem_remote_free( fatfs_ctx_cxy,
     1843                      fs_info_buffer,
     1844                      9 );               
    18501845
    18511846    // release FATFS context descriptor
    1852     req.type = KMEM_KCM;
    1853     req.ptr  = fatfs_ctx_ptr;
    1854     kmem_remote_free( fatfs_ctx_cxy , &req );
     1847    kmem_remote_free( fatfs_ctx_cxy,
     1848                      fatfs_ctx_ptr,
     1849                      bits_log2(sizeof(fatfs_ctx_t)) );
    18551850
    18561851}  // end fatfs_ctx_destroy()
     
    28572852
    28582853    // compute number of pages
    2859     npages = size >> CONFIG_PPM_PAGE_SHIFT;
     2854    npages = size >> CONFIG_PPM_PAGE_ORDER;
    28602855    if( size & CONFIG_PPM_PAGE_MASK ) npages++;
    28612856         
Note: See TracChangeset for help on using the changeset viewer.