CO_fifo.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. /**
  2. * FIFO circular buffer
  3. *
  4. * @file CO_fifo.h
  5. * @ingroup CO_CANopen_301_fifo
  6. * @author Janez Paternoster
  7. * @copyright 2020 Janez Paternoster
  8. *
  9. * This file is part of CANopenNode, an opensource CANopen Stack.
  10. * Project home page is <https://github.com/CANopenNode/CANopenNode>.
  11. * For more information on CANopen see <http://www.can-cia.org/>.
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the "License");
  14. * you may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * http://www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. */
  25. #ifndef CO_FIFO_H
  26. #define CO_FIFO_H
  27. #include "301/CO_driver.h"
  28. /* default configuration, see CO_config.h */
  29. #ifndef CO_CONFIG_FIFO
  30. #define CO_CONFIG_FIFO (0)
  31. #endif
  32. #if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE) || defined CO_DOXYGEN
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /**
  37. * @defgroup CO_CANopen_301_fifo FIFO circular buffer
  38. * @ingroup CO_CANopen_301
  39. * @{
  40. *
  41. * FIFO is organized as circular buffer with predefined capacity. It must be
  42. * initialized by CO_fifo_init(). Functions are not not thread safe.
  43. *
  44. * It can be used as general purpose FIFO circular buffer for any data. Data can
  45. * be written by CO_fifo_write() and read by CO_fifo_read() functions.
  46. *
  47. * Buffer has additional functions for usage with CiA309-3 standard. It acts as
  48. * circular buffer for storing ascii commands and fetching tokens from them.
  49. */
  50. /**
  51. * Fifo object
  52. */
  53. typedef struct {
  54. /** Buffer of size bufSize. Initialized by CO_fifo_init() */
  55. char *buf;
  56. /** Initialized by CO_fifo_init() */
  57. size_t bufSize;
  58. /** Location in the buffer, which will be next written. */
  59. size_t writePtr;
  60. /** Location in the buffer, which will be next read. */
  61. size_t readPtr;
  62. #if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) || defined CO_DOXYGEN
  63. /** Location in the buffer, which will be next read. */
  64. size_t altReadPtr;
  65. #endif
  66. #if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) || defined CO_DOXYGEN
  67. /** helper variable, set to false in CO_fifo_reset(), used in some
  68. * functions. */
  69. bool_t started;
  70. /** auxiliary variable, used in some functions. */
  71. uint32_t aux;
  72. #endif
  73. } CO_fifo_t;
  74. /**
  75. * Initialize fifo object
  76. *
  77. * @param fifo This object will be initialized
  78. * @param buf Pointer to externally defined buffer
  79. * @param bufSize Size of the above buffer. Usable size of the buffer will be
  80. * one byte less than bufSize, it is used for operation of the circular buffer.
  81. */
  82. void CO_fifo_init(CO_fifo_t *fifo, char *buf, size_t bufSize);
  83. /**
  84. * Reset fifo object, make it empty
  85. *
  86. * @param fifo This object
  87. */
  88. static inline void CO_fifo_reset(CO_fifo_t *fifo) {
  89. if (fifo != NULL) {
  90. fifo->readPtr = 0;
  91. fifo->writePtr = 0;
  92. #if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES
  93. fifo->started = false;
  94. #endif
  95. }
  96. return;
  97. }
  98. /**
  99. * Purge all data in fifo object, keep other properties
  100. *
  101. * @param fifo This object
  102. *
  103. * @return true, if data were purged or false, if fifo were already empty
  104. */
  105. static inline bool_t CO_fifo_purge(CO_fifo_t *fifo) {
  106. if (fifo != NULL && fifo->readPtr != fifo->writePtr) {
  107. fifo->readPtr = 0;
  108. fifo->writePtr = 0;
  109. return true;
  110. }
  111. return false;
  112. }
  113. /**
  114. * Get free buffer space in CO_fifo_t object
  115. *
  116. * @param fifo This object
  117. *
  118. * @return number of available bytes
  119. */
  120. static inline size_t CO_fifo_getSpace(CO_fifo_t *fifo) {
  121. int sizeLeft = (int)fifo->readPtr - fifo->writePtr - 1;
  122. if (sizeLeft < 0) {
  123. sizeLeft += fifo->bufSize;
  124. }
  125. return (size_t) sizeLeft;
  126. }
  127. /**
  128. * Get size of data inside CO_fifo_t buffer object
  129. *
  130. * @param fifo This object
  131. *
  132. * @return number of occupied bytes
  133. */
  134. static inline size_t CO_fifo_getOccupied(CO_fifo_t *fifo) {
  135. int sizeOccupied = (int)fifo->writePtr - fifo->readPtr;
  136. if (sizeOccupied < 0) {
  137. sizeOccupied += fifo->bufSize;
  138. }
  139. return (size_t) sizeOccupied;
  140. }
  141. /**
  142. * Put one character into CO_fifo_t buffer object
  143. *
  144. * @param fifo This object
  145. * @param c Character to put
  146. *
  147. * @return true, if write was successful (enough space in fifo buffer)
  148. */
  149. static inline bool_t CO_fifo_putc(CO_fifo_t *fifo, const char c) {
  150. if (fifo != NULL && fifo->buf != NULL) {
  151. size_t writePtrNext = fifo->writePtr + 1;
  152. if (writePtrNext != fifo->readPtr &&
  153. !(writePtrNext == fifo->bufSize && fifo->readPtr == 0))
  154. {
  155. fifo->buf[fifo->writePtr] = c;
  156. fifo->writePtr = (writePtrNext == fifo->bufSize) ? 0 : writePtrNext;
  157. return true;
  158. }
  159. }
  160. return false;
  161. }
  162. /**
  163. * Put one character into CO_fifo_t buffer object
  164. *
  165. * Overwrite old characters, if run out of space
  166. *
  167. * @param fifo This object
  168. * @param c Character to put
  169. */
  170. static inline void CO_fifo_putc_ov(CO_fifo_t *fifo, const char c) {
  171. if (fifo != NULL && fifo->buf != NULL) {
  172. fifo->buf[fifo->writePtr] = c;
  173. if (++fifo->writePtr == fifo->bufSize) fifo->writePtr = 0;
  174. if (fifo->readPtr == fifo->writePtr) {
  175. if (++fifo->readPtr == fifo->bufSize) fifo->readPtr = 0;
  176. }
  177. }
  178. }
  179. /**
  180. * Get one character from CO_fifo_t buffer object
  181. *
  182. * @param fifo This object
  183. * @param buf Buffer of length one byte, where character will be copied
  184. *
  185. * @return true, if read was successful (non-empty fifo buffer)
  186. */
  187. static inline bool_t CO_fifo_getc(CO_fifo_t *fifo, char *buf) {
  188. if (fifo != NULL && buf != NULL && fifo->readPtr != fifo->writePtr) {
  189. *buf = fifo->buf[fifo->readPtr];
  190. if (++fifo->readPtr == fifo->bufSize) {
  191. fifo->readPtr = 0;
  192. }
  193. return true;
  194. }
  195. return false;
  196. }
  197. /**
  198. * Write data into CO_fifo_t object.
  199. *
  200. * This function copies data from buf into internal buffer of CO_fifo_t
  201. * object. Function returns number of bytes successfully copied.
  202. * If there is not enough space in destination, not all bytes will be copied.
  203. *
  204. * @param fifo This object
  205. * @param buf Buffer which will be copied
  206. * @param count Number of bytes in buf
  207. * @param [in,out] crc Externally defined variable for CRC checksum, ignored if
  208. * NULL
  209. *
  210. * @return number of bytes actually written.
  211. */
  212. size_t CO_fifo_write(CO_fifo_t *fifo,
  213. const char *buf,
  214. size_t count,
  215. uint16_t *crc);
  216. /**
  217. * Read data from CO_fifo_t object.
  218. *
  219. * This function copies data from internal buffer of CO_fifo_t object into
  220. * buf. Function returns number of bytes successfully copied. Function also
  221. * writes true into eof argument, if command delimiter character is reached.
  222. *
  223. * @param fifo This object
  224. * @param buf Buffer into which data will be copied
  225. * @param count Copy up to count bytes into buffer
  226. * @param [out] eof If different than NULL, then search for delimiter character.
  227. * If found, then read up to (including) that character and set *eof to true.
  228. * Otherwise set *eof to false.
  229. *
  230. * @return number of bytes actually read.
  231. */
  232. size_t CO_fifo_read(CO_fifo_t *fifo, char *buf, size_t count, bool_t *eof);
  233. #if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ) || defined CO_DOXYGEN
  234. /**
  235. * Initializes alternate read with #CO_fifo_altRead
  236. *
  237. * @param fifo This object
  238. * @param offset Offset in bytes from original read pointer
  239. *
  240. * @return same as offset or lower, if there is not enough data.
  241. */
  242. size_t CO_fifo_altBegin(CO_fifo_t *fifo, size_t offset);
  243. /**
  244. * Ends alternate read with #CO_fifo_altRead and calculate crc checksum
  245. *
  246. * @param fifo This object
  247. * @param [in,out] crc Externally defined variable for CRC checksum, ignored if
  248. * NULL
  249. */
  250. void CO_fifo_altFinish(CO_fifo_t *fifo, uint16_t *crc);
  251. /**
  252. * Get alternate size of remaining data, see #CO_fifo_altRead
  253. *
  254. * @param fifo This object
  255. *
  256. * @return number of occupied bytes.
  257. */
  258. static inline size_t CO_fifo_altGetOccupied(CO_fifo_t *fifo) {
  259. int sizeOccupied = (int)fifo->writePtr - fifo->altReadPtr;
  260. if (sizeOccupied < 0) {
  261. sizeOccupied += fifo->bufSize;
  262. }
  263. return (size_t) sizeOccupied;
  264. }
  265. /**
  266. * Alternate read data from CO_fifo_t object.
  267. *
  268. * This function is similar as CO_fifo_read(), but uses alternate read pointer
  269. * inside circular buffer. It reads data from the buffer and data remains in it.
  270. * This function uses alternate read pointer and keeps original read pointer
  271. * unchanged. Before using this function, alternate read pointer must be
  272. * initialized with CO_fifo_altBegin(). CO_fifo_altFinish() sets original read
  273. * pointer to alternate read pointer and so empties the buffer.
  274. *
  275. * @param fifo This object
  276. * @param buf Buffer into which data will be copied
  277. * @param count Copy up to count bytes into buffer
  278. *
  279. * @return number of bytes actually read.
  280. */
  281. size_t CO_fifo_altRead(CO_fifo_t *fifo, char *buf, size_t count);
  282. #endif /* #if (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ALT_READ */
  283. #if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS) || defined CO_DOXYGEN
  284. /**
  285. * Search command inside FIFO
  286. *
  287. * If there are some data inside the FIFO, then search for command delimiter.
  288. *
  289. * If command is long, then in the buffer may not be enough space for it.
  290. * In that case buffer is full and no delimiter is present. Function then
  291. * returns true and command should be processed for the starting tokens.
  292. * Buffer can later be refilled multiple times, until command is closed by
  293. * command delimiter.
  294. *
  295. * If this function returns different than 0, then buffer is usually read
  296. * by multiple CO_fifo_readToken() calls. If reads was successful, then
  297. * delimiter is reached and fifo->readPtr is set after the command. If any
  298. * CO_fifo_readToken() returns nonzero *err, then there is an error and command
  299. * should be cleared. All this procedure must be implemented inside single
  300. * function call.
  301. *
  302. * @param fifo This object.
  303. * @param clear If true, then command will be cleared from the
  304. * buffer. If there is no delimiter, buffer will be cleared entirely.
  305. *
  306. * @return true if command with delimiter found or buffer full.
  307. */
  308. bool_t CO_fifo_CommSearch(CO_fifo_t *fifo, bool_t clear);
  309. /**
  310. * Trim spaces inside FIFO
  311. *
  312. * Function removes all non graphical characters and comments from fifo
  313. * buffer. It stops on first graphical character or on command delimiter (later
  314. * is also removed).
  315. *
  316. * @param fifo This object.
  317. * @param [in, out] insideComment if set to true as input, it skips all
  318. * characters and searches only for delimiter. As output it is set to true, if
  319. * fifo is empty, is inside comment and command delimiter is not found.
  320. *
  321. * @return true if command delimiter was found.
  322. */
  323. bool_t CO_fifo_trimSpaces(CO_fifo_t *fifo, bool_t *insideComment);
  324. /**
  325. * Get token from FIFO buffer
  326. *
  327. * Function search FIFO buffer for token. Token is string of only graphical
  328. * characters. Graphical character is any printable character except space with
  329. * acsii code within limits: 0x20 < code < 0x7F (see isgraph() function).
  330. *
  331. * If token is found, then copy it to the buf, if count is large enough. On
  332. * success also set readPtr to point to the next graphical character.
  333. *
  334. * Each token must have at least one empty space after it (space, command
  335. * delimiter, '\0', etc.). Delimiter must not be graphical character.
  336. *
  337. * If comment delimiter (delimComment, see #CO_fifo_init) character is found,
  338. * then all string till command delimiter (delimCommand, see #CO_fifo_init) will
  339. * be erased from the buffer.
  340. *
  341. * See also #CO_fifo_CommSearch().
  342. *
  343. * @param fifo This object.
  344. * @param buf Buffer into which data will be copied. Will be terminated by '\0'.
  345. * @param count Copy up to count bytes into buffer
  346. * @param [in,out] closed This is input/output variable. Not used if NULL.
  347. * - As output variable it is set to 1, if command delimiter (delimCommand,
  348. * see #CO_fifo_init) is found after the token and set to 0 otherwise.
  349. * - As input variable it is used for verifying error condition:
  350. * - *closed = 0: Set *err to true if token is empty or command delimiter
  351. * is found.
  352. * - *closed = 1: Set *err to true if token is empty or command delimiter
  353. * is NOT found.
  354. * - *closed = any other value: No checking of token size or command delimiter.
  355. * @param [out] err If not NULL, it is set to true if token is larger than buf
  356. * or in matching combination in 'closed' argument. If it is already true, then
  357. * function returns immediately.
  358. *
  359. * @return Number of bytes read.
  360. */
  361. size_t CO_fifo_readToken(CO_fifo_t *fifo,
  362. char *buf,
  363. size_t count,
  364. char *closed,
  365. bool_t *err);
  366. #endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_COMMANDS */
  367. #if ((CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES) || defined CO_DOXYGEN
  368. /**
  369. * Read uint8_t variable from fifo and output as ascii string.
  370. *
  371. * @param fifo This object.
  372. * @param buf Buffer into which ascii string will be copied.
  373. * @param count Available count of bytes inside the buf.
  374. * @param end True indicates, that fifo contains last bytes of data.
  375. *
  376. * @return Number of ascii bytes written into buf.
  377. */
  378. size_t CO_fifo_readU82a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  379. /** Read uint16_t variable from fifo as ascii string, see CO_fifo_readU82a */
  380. size_t CO_fifo_readU162a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  381. /** Read uint32_t variable from fifo as ascii string, see CO_fifo_readU82a */
  382. size_t CO_fifo_readU322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  383. /** Read uint64_t variable from fifo as ascii string, see CO_fifo_readU82a */
  384. size_t CO_fifo_readU642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  385. /** Read uint8_t variable from fifo as ascii string, see CO_fifo_readU82a */
  386. size_t CO_fifo_readX82a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  387. /** Read uint16_t variable from fifo as ascii string, see CO_fifo_readU82a */
  388. size_t CO_fifo_readX162a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  389. /** Read uint32_t variable from fifo as ascii string, see CO_fifo_readU82a */
  390. size_t CO_fifo_readX322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  391. /** Read uint64_t variable from fifo as ascii string, see CO_fifo_readU82a */
  392. size_t CO_fifo_readX642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  393. /** Read int8_t variable from fifo as ascii string, see CO_fifo_readU82a */
  394. size_t CO_fifo_readI82a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  395. /** Read int16_t variable from fifo as ascii string, see CO_fifo_readU82a */
  396. size_t CO_fifo_readI162a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  397. /** Read int32_t variable from fifo as ascii string, see CO_fifo_readU82a */
  398. size_t CO_fifo_readI322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  399. /** Read int64_t variable from fifo as ascii string, see CO_fifo_readU82a */
  400. size_t CO_fifo_readI642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  401. /** Read float32_t variable from fifo as ascii string, see CO_fifo_readU82a */
  402. size_t CO_fifo_readR322a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  403. /** Read float64_t variable from fifo as ascii string, see CO_fifo_readU82a */
  404. size_t CO_fifo_readR642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  405. /** Read data from fifo and output as space separated two digit ascii string,
  406. * see also CO_fifo_readU82a */
  407. size_t CO_fifo_readHex2a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  408. /** Read data from fifo and output as visible string. A visible string is
  409. * enclosed with double quotes. If a double quote is used within the string,
  410. * the quotes are escaped by a second quotes, e.g. “Hello “”World””, CANopen
  411. * is great”. UTF-8 characters and also line breaks works with this function.
  412. * Function removes all NULL and CR characters from output string.
  413. * See also CO_fifo_readU82a */
  414. size_t CO_fifo_readVs2a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  415. /** Read data from fifo and output as mime-base64 encoded string. Encoding is as
  416. * specified in RFC 2045, without CR-LF, but one long string. See also
  417. * CO_fifo_readU82a */
  418. size_t CO_fifo_readB642a(CO_fifo_t *fifo, char *buf, size_t count, bool_t end);
  419. /** Bitfields for status argument from CO_fifo_cpyTok2U8 function and similar */
  420. typedef enum {
  421. /** Bit is set, if command delimiter is reached in src */
  422. CO_fifo_st_closed = 0x01U,
  423. /** Bit is set, if copy was partial and more data are available. If unset
  424. * and no error, then all data was successfully copied. */
  425. CO_fifo_st_partial = 0x02U,
  426. /** Bit is set, if no valid token found */
  427. CO_fifo_st_errTok = 0x10U,
  428. /** Bit is set, if value is not valid or out of limits */
  429. CO_fifo_st_errVal = 0x20U,
  430. /** Bit is set, if destination buffer is to small */
  431. CO_fifo_st_errBuf = 0x40U,
  432. /** Bit is set, if internal error */
  433. CO_fifo_st_errInt = 0x80U,
  434. /** Bitmask for error bits */
  435. CO_fifo_st_errMask = 0xF0U
  436. } CO_fifo_st;
  437. /**
  438. * Read ascii string from src fifo and copy as uint8_t variable to dest fifo.
  439. *
  440. * @param dest destination fifo buffer object.
  441. * @param src source fifo buffer object.
  442. * @param [out] status bitfield of the CO_fifo_st type.
  443. *
  444. * @return Number of bytes written into dest.
  445. */
  446. size_t CO_fifo_cpyTok2U8 (CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  447. /** Copy ascii string to uint16_t variable, see CO_fifo_cpyTok2U8 */
  448. size_t CO_fifo_cpyTok2U16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  449. /** Copy ascii string to uint32_t variable, see CO_fifo_cpyTok2U8 */
  450. size_t CO_fifo_cpyTok2U32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  451. /** Copy ascii string to uint64_t variable, see CO_fifo_cpyTok2U8 */
  452. size_t CO_fifo_cpyTok2U64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  453. /** Copy ascii string to int8_t variable, see CO_fifo_cpyTok2U8 */
  454. size_t CO_fifo_cpyTok2I8 (CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  455. /** Copy ascii string to int16_t variable, see CO_fifo_cpyTok2U8 */
  456. size_t CO_fifo_cpyTok2I16(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  457. /** Copy ascii string to int32_t variable, see CO_fifo_cpyTok2U8 */
  458. size_t CO_fifo_cpyTok2I32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  459. /** Copy ascii string to int64_t variable, see CO_fifo_cpyTok2U8 */
  460. size_t CO_fifo_cpyTok2I64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  461. /** Copy ascii string to float32_t variable, see CO_fifo_cpyTok2U8 */
  462. size_t CO_fifo_cpyTok2R32(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  463. /** Copy ascii string to float64_t variable, see CO_fifo_cpyTok2U8 */
  464. size_t CO_fifo_cpyTok2R64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  465. /** Copy bytes written as two hex digits into to data. Bytes may be space
  466. * separated. See CO_fifo_cpyTok2U8 for parameters. */
  467. size_t CO_fifo_cpyTok2Hex(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  468. /** Copy visible string to data. A visible string must be enclosed with double
  469. * quotes, if it contains space. If a double quote is used within the string,
  470. * the quotes are escaped by a second quotes. Input string can not contain
  471. * newline characters. See CO_fifo_cpyTok2U8 */
  472. size_t CO_fifo_cpyTok2Vs(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  473. /** Read ascii mime-base64 encoded string from src fifo and copy as binary data
  474. * to dest fifo. Encoding is as specified in RFC 2045, without CR-LF, but one
  475. * long string in single line. See also CO_fifo_readU82a */
  476. size_t CO_fifo_cpyTok2B64(CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status);
  477. #endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ASCII_DATATYPES */
  478. /** @} */ /* CO_CANopen_301_fifo */
  479. #ifdef __cplusplus
  480. }
  481. #endif /*__cplusplus*/
  482. #endif /* (CO_CONFIG_FIFO) & CO_CONFIG_FIFO_ENABLE */
  483. #endif /* CO_FIFO_H */