Changes between Version 8 and Version 9 of ObjectDeveloperGuide
- Timestamp:
- 05/11/09 17:46:22 (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ObjectDeveloperGuide
v8 v9 17 17 * The object reads once the initialization parameters and configures its behaviour. 18 18 * Given a set of parameter values, the object produces an output set of streams as a function of an input set of streams within the defined resource utilization constraints. 19 20 == [[BR]]Defining an Object ==19 [[BR]] 20 == Defining an Object == 21 21 Given the previous definition of an object, we define a directory structure for its implementation in order to homogenize objects from several sources and to access easily to useful information. Generating a new object should follow this layout: 22 22 … … 28 28 ||myobj/Makefile||For compilation|| 29 29 30 == ==31 == ==32 == ==33 30 == Implementing the Object == 34 31 Once your object has been properly defined, you can begin coding it. Here we assume the reader is familiar with basic ALOE concepts, nevertheless, this section describes how to implement an ALOE Object and provides some examples. 35 32 36 === ===37 33 === Process Structure === 38 34 All the tasks a radio application shall realize must follow the following simple function structure: … … 52 48 53 49 Note how the object owns the CPU during the time it process the message. After that, the object returns to the STATUS point handing the CPU over to ALOE again. In anomalous or time rules violation, ALOE may release the ownership from the object before returning to the STATUS point. 54 55 '''Figure 3.1 – ALOE Object Flow Diagram'''56 50 57 51 === Coding an Object === … … 237 231 int filter_type; 238 232 239 fdi = NewFlow(“input”, FLOW_READ_ONLY);233 fdi = CreateItf(“input”, FLOW_READ_ONLY); 240 234 if (fdi < 0) { 241 235 WriteLog(“Error creating flow\n”); 242 236 return 0; 243 237 } 244 fdo = Create Flow(“output”, FLOW_WRITE_ONLY);238 fdo = CreateItf(“output”, FLOW_WRITE_ONLY); 245 239 if (fdo < 0) { 246 240 WriteLog(“Error creating flow\n”); 247 241 return 0; 248 242 } 249 fdc = Create Flow(“control”, FLOW_READ_ONLY);243 fdc = CreateItf(“control”, FLOW_READ_ONLY); 250 244 if (fdo < 0) { 251 245 WriteLog(“Error creating flow\n”); … … 267 261 return 0; 268 262 } 263 264 /* perform non-realtime computations */ 269 265 calc_fir_coefs(fir_coef,filter_type); 270 n = InitStatsFile(); 271 if (n < 0) { 272 WriteLog (“Error initiating stats\n”); 273 return 0; 274 } 266 275 267 stat_outsignal = InitStat(“out_signal”); 276 268 if (stat_outsignal < 0) { … … 301 293 } 302 294 /* Read from control interface */ 303 n = Read Flow(fdc, &control, sizeof(struct control_itf));295 n = ReadItf(fdc, &control, sizeof(struct control_itf)); 304 296 if (n < 0) { 305 297 WriteLog(“Error reading from control flow\n”); … … 311 303 /* receive a block of data */ 312 304 do { 313 n = Read Flow(fdi, &input.data[rcv_len], long_in_block - rcv_len);305 n = ReadItf(fdi, &input.data[rcv_len], long_in_block - rcv_len); 314 306 if (n < 0) { 315 307 WriteLog(“Error reading from flow\n”); … … 324 316 if (rcv_len == long_block) { 325 317 my_process_function(input, output, fir_coef, long_in_block); 326 n = Write Flow(fdo, data_out.data, long_out_block);318 n = WriteItf(fdo, data_out.data, long_out_block); 327 319 if (n < 0) { 328 320 LogWrite(“Error writing to flow\n”); … … 339 331 } 340 332 }}} 341 [[BR]]342 [[BR]]343 [[BR]]344 == Coding Style ==345 [[BR]]346 333 [[BR]] 347 334 [[BR]] 348 335 == Compiling and Linking == 349 [[BR]] 350 [[BR]] 351 352 [wiki:ALOEImplementations "[Back to ALOE Implementations]"] 336 337 Compiling an ALOE objects does not need any other consideration rather than linking with the ALOE SW Library and HW Library. Obviously, we have to pick the HW library of our system. Under linux, and once we have installed ALOE (binary or source), the libraries should appear at /usr/local/lib with the names libsw_api.a and libhw_api.a. 338 339 If your prefer to use autoconf/automake tools these files might be useful: 340 * sample configure.in 341 * sample Makefile.am 342 343 [wiki:ALOE "[Back to ALOE]"]
