summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/HAL/drivers/USBClasses/MSD/include/abstractMemory.h
blob: 2eab5f00c5a942a2a081c71e3cce4ebb7b725499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/****************************************************************************//**
  \file abstactMemory.h

  \brief Declaration of abstract memory commands.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
  History:
    29/08/11 N. Fomin - Created
*******************************************************************************/
#ifndef _ABSTRACT_MEMORY_H
#define _ABSTRACT_MEMORY_H

/******************************************************************************
                   Includes section
******************************************************************************/
#include <types.h>
#include <hsmci.h>

/******************************************************************************
                   Types section
******************************************************************************/
typedef enum
{
  memorySuccessStatus,
  memoryErrorStatus
} MemoryStatus_t;

/******************************************************************************
                   Prototypes section
******************************************************************************/
/**************************************************************************//**
\brief Writes data to memory at "address".
\param[in]
  descriptor - pointer to hsmci descriptor;
  address - address of blocks to write.
  callback - pointer to function to nofity upper layer about end of write
             procedure.
\return
  status of write procedure.
******************************************************************************/
MemoryStatus_t absMemWrite(HAL_HsmciDescriptor_t *descriptor, uint32_t address, void (*callback)(MemoryStatus_t));

/**************************************************************************//**
\brief Reads data from memory at "address".
\param[in]
  descriptor - pointer to hsmci descriptor;
  address - address of blocks to read.
  callback - pointer to function to nofity upper layer about end of read
             procedure.
\return
  status of read procedure.
******************************************************************************/
MemoryStatus_t absMemRead(HAL_HsmciDescriptor_t *descriptor, uint32_t address, void (*callback)(MemoryStatus_t));

/**************************************************************************//**
\brief Performs memory initialization.
\param[in]
  descriptor - pointer to hsmci descriptor.
\return
  status of initialization procedure.
******************************************************************************/
MemoryStatus_t absMemInit(HAL_HsmciDescriptor_t *descriptor);

/**************************************************************************//**
\brief Reads memory capacity.
\param[in]
  descriptor - pointer to hsmci descriptor.
\param[out]
  lastBlockNumber - number of last accessible block of memory.
\return
  status of read capacity procedure.
******************************************************************************/
MemoryStatus_t absMemCapacity(HAL_HsmciDescriptor_t *descriptor, uint32_t *lastBlockNumber);

#endif /* _ABSTRACT_MEMORY_H */
// eof abstactMemory.h