UoS³ Flight Computer Firmware
 All Data Structures Files Functions Groups Pages
fram.c
1 
10 #include "board.h"
11 #include "../fram.h"
12 
13 #include <string.h>
14 
15 static uint8_t fram_data[FRAM_SIZE] = { 0 };
16 
17 bool FRAM_selfTest(void)
18 {
19  /* For behaviour-parity with embedded implementations */
20  //Fram_init();
21 
22  return true;
23 }
24 
25 void FRAM_write(uint32_t address, uint8_t *data, uint32_t length)
26 {
27  uint32_t i = 0;
28 
29  while(i<length)
30  {
31  /* Mask address to emulate hardware overflow behaviour */
32  fram_data[((address + i++) & FRAM_MAX_ADDRESS)] = *(data++);
33  }
34 }
35 
36 void FRAM_read(uint32_t address, uint8_t *data, uint32_t length)
37 {
38  uint32_t i = 0;
39 
40  while(i<length)
41  {
42  /* Mask address to emulate hardware overflow behaviour */
43  *(data++) = fram_data[((address + i++) & FRAM_MAX_ADDRESS)];
44  }
45 }
46 
bool FRAM_selfTest(void)
Definition: fram.c:17
void FRAM_read(uint32_t address, uint8_t *data, uint32_t length)
Definition: fram.c:36
void FRAM_write(uint32_t address, uint8_t *data, uint32_t length)
Definition: fram.c:25