forked from jbech-linaro/secure96
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
- Loading branch information
1 parent
2ec8783
commit a444cec
Showing
8 changed files
with
145 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2017, Linaro Ltd and contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include <device.h> | ||
#include <io.h> | ||
#include <packet.h> | ||
#include <status.h> | ||
|
||
uint8_t device_idle(struct io_interface *ioif) | ||
{ | ||
uint8_t ret; | ||
uint8_t data; | ||
uint8_t word_addr = PKT_FUNC_IDLE; | ||
|
||
at204_write(ioif, &word_addr, sizeof(word_addr)); | ||
|
||
/* If idle was successful, we expect a NAK on read */ | ||
ret = at204_read(ioif, &data, sizeof(data)); | ||
|
||
if (ret != STATUS_OK) | ||
ret = STATUS_OK; | ||
else | ||
ret = STATUS_EXEC_ERROR; | ||
|
||
return ret; | ||
} | ||
|
||
uint8_t device_sleep(struct io_interface *ioif) | ||
{ | ||
uint8_t ret; | ||
uint8_t data; | ||
uint8_t word_addr = PKT_FUNC_SLEEP; | ||
|
||
at204_write(ioif, &word_addr, sizeof(word_addr)); | ||
|
||
/* If sleep was successful, we expect a NAK on read */ | ||
ret = at204_read(ioif, &data, sizeof(data)); | ||
|
||
if (ret != STATUS_OK) | ||
ret = STATUS_OK; | ||
else | ||
ret = STATUS_EXEC_ERROR; | ||
|
||
return ret; | ||
} | ||
|
||
uint8_t device_reset(struct io_interface *ioif) | ||
{ | ||
uint8_t word_addr = PKT_FUNC_RESET; | ||
|
||
at204_write(ioif, &word_addr, sizeof(word_addr)); | ||
|
||
return STATUS_OK; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters