Skip to content

Commit 1a8a0ef

Browse files
committed
SDSIO: Add SDSIO Custom driver
1 parent 5654c8a commit 1a8a0ef

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

ARM.SDS.pdsc

+14
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- environment name attribute updated from "cmsis" to "csolution" for compliance
2525
SDSIO:
2626
- Gathered common SDSIO client code into sdsio_client.c/.h; low-level I/O dependant code remain in individual drivers
27+
- Added SDS:IO:Custom component and driver
2728
</release>
2829
</releases>
2930

@@ -136,6 +137,19 @@
136137
</files>
137138
</component>
138139

140+
<!-- SDS I/O (Custom client) -->
141+
<component Cclass="SDS" Cgroup="IO" Csub="Custom" Capiversion="1.0.0" Cversion="1.0.0">
142+
<description>I/O via Custom I/O to SDSIO Server</description>
143+
<RTE_Components_h>
144+
#define RTE_SDS_IO /* Synchronous Data Stream Input/Output */
145+
#define RTE_SDS_IO_CUSTOM /* Synchronous Data Stream Input/Output via Custom I/O */
146+
</RTE_Components_h>
147+
<files>
148+
<file category="source" name="sds/source/sdsio/client/sdsio_client.c"/>
149+
<file category="source" name="sds/source/sdsio/template/sdsio_client_custom.c" attr="template"/>
150+
</files>
151+
</component>
152+
139153
<!-- SDS I/O (File System - MDK FS) -->
140154
<component Cclass="SDS" Cgroup="IO" Csub="File System" Cvariant="MDK FS" Capiversion="1.0.0" Cversion="1.2.0" condition="SDS IO via File System - MDK FS">
141155
<description>I/O via File System (using component Keil::File System)</description>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/*
2+
* Copyright (c) 2025 Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the License); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// SDS I/O Client: Template for custom implementation
20+
21+
#include "sdsio.h"
22+
#include "sdsio_client.h"
23+
24+
/**
25+
\fn int32_t sdsioClientInit (void)
26+
\brief Initialize SDS I/O Client
27+
\return SDIOS_OK: initialization success
28+
SDSIO_ERROR: initialization failed
29+
*/
30+
int32_t sdsioClientInit (void) {
31+
int32_t ret = SDSIO_ERROR;
32+
33+
// ToDo: Add code for SDS I/O Client initialization
34+
35+
return ret;
36+
}
37+
38+
/**
39+
\fn int32_t sdsioClientUninit (void)
40+
\brief Un-Initialize SDS I/O Client
41+
\return SDIOS_OK: un-initialization success
42+
SDSIO_ERROR: un-initialization failed
43+
*/
44+
int32_t sdsioClientUninit (void) {
45+
46+
// ToDo: Add code for SDS I/O Client de-initialization
47+
48+
return SDSIO_OK;
49+
}
50+
51+
/**
52+
\fn uint32_t sdsioClientSend (const header_t *header, const void *data, uint32_t data_size)
53+
\brief Send data to SDSIO-Server
54+
\param[in] header pointer to header
55+
\param[in] data pointer to buffer with data to send
56+
\param[in] data_size data size in bytes
57+
\return number of bytes sent (including header)
58+
*/
59+
uint32_t sdsioClientSend (const header_t *header, const void *data, uint32_t data_size) {
60+
uint32_t num = 0U;
61+
// uint32_t cnt;
62+
63+
if (header == NULL) {
64+
return 0U;
65+
}
66+
67+
// Send header
68+
// ToDo: Modify code below to send header to SDSIO-Server
69+
// cnt = 0U;
70+
// while (cnt < sizeof(header_t)) {
71+
// cnt += CustomSend((const uint8_t *)header + cnt, sizeof(header_t) - cnt);
72+
// }
73+
// num = cnt;
74+
75+
76+
// Send data
77+
// ToDo: Modify code below to send data to SDSIO-Server
78+
// cnt = 0U;
79+
// if ((data != NULL) && (data_size != 0U)) {
80+
// while (cnt < data_size) {
81+
// cnt += CustomSend((const uint8_t *)data + cnt, data_size - cnt);
82+
// }
83+
// }
84+
// num += cnt;
85+
86+
return num;
87+
}
88+
89+
/**
90+
\fn uint32_t sdsioClientReceive (header_t *header, void *data, uint32_t data_size)
91+
\brief Receive data from SDSIO-Server
92+
\param[out] header pointer to header
93+
\param[out] data pointer to buffer for data to read
94+
\param[in] data_size data size in bytes
95+
\return number of bytes received (including header)
96+
*/
97+
uint32_t sdsioClientReceive (header_t *header, void *data, uint32_t data_size) {
98+
uint32_t num = 0U;
99+
// uint32_t cnt, size;
100+
101+
if (header == NULL) {
102+
return 0U;
103+
}
104+
105+
// Receive header
106+
// ToDo: Modify code below to receive header from SDSIO-Server
107+
// cnt = 0U;
108+
// while (cnt < sizeof(header_t)) {
109+
// cnt += CustomReceive((uint8_t *)header + cnt, sizeof(header_t) - cnt);
110+
// }
111+
// num = cnt;
112+
113+
// Receive data
114+
// ToDo: Modify code below to receive data from SDSIO-Server
115+
// cnt = 0U;
116+
// if ((num != 0U) && (header->data_size != 0U) &&
117+
// (data != NULL) && (data_size != 0U)) {
118+
119+
// if (header->data_size < data_size) {
120+
// size = header->data_size;
121+
// } else {
122+
// size = data_size;
123+
// }
124+
// while (cnt < size) {
125+
// cnt += CustomReceive((uint8_t *)data + cnt, size - cnt);
126+
// }
127+
// }
128+
// num += cnt;
129+
130+
return num;
131+
}

0 commit comments

Comments
 (0)