OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14518|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" w/ j- a& C+ Y, G
  1. [code]EDMA sample test application
    & S/ s) d+ q7 |% k* l3 {( P7 C+ `! j
  2. /*
    ; H5 i3 j8 q8 C# u
  3. * edma_test.c
    ' r: ?4 c% M# }9 g
  4. *( X/ x4 `. h$ F4 N0 _8 m: R
  5. * brief  EDMA3 Test Application
    + Q7 S8 D# g2 p) ?9 V# {6 Z8 g
  6. *. q  `) O3 @4 }
  7. *   This file contains EDMA3 Test code.
    3 P  Z7 i$ n* f1 Y
  8. *0 Z8 M: }2 A3 v2 x: z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% I* T( N! g5 m+ }1 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 S, `9 H9 |$ _( `
  11. *         TO CHANGE.+ O9 w4 B& W# b1 Z
  12. *( ?( z6 t  }* v# [! @- x, e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o: r. a( i' `3 h
  14. *5 L: G$ O8 `6 c% ]' _
  15. * This program is free software; you can redistribute it and/or
    1 V; _' M+ y; Y/ Z+ q
  16. * modify it under the terms of the GNU General Public License as9 p1 Q/ k; W* D4 g& v
  17. * published by the Free Software Foundation version 2.
    2 ]* [5 k6 Z% O
  18. *( g( [& d" L+ W# A0 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 n# W( [1 p5 x) o* ~# B/ w
  20. * kind, whether express or implied; without even the implied warranty
    # \) k. j4 n! f0 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 v9 t( B: V/ K) s( c) P" ~
  22. * GNU General Public License for more details.3 M: D! ]4 ]1 t9 O& F- _2 c
  23. */
    ' s% x3 |: m) {4 g
  24. : E$ e0 L2 N( L# t, V% [, @
  25. #include <linux/module.h>1 I0 r6 R4 {4 f4 _: O; R8 v3 t. }
  26. #include <linux/init.h>
    * D# m& N, L) ^' r. W  z- _
  27. #include <linux/errno.h>6 o: T  B( c+ V
  28. #include <linux/types.h>. W& w  P0 ]% w
  29. #include <linux/interrupt.h>& W; T" U4 a) @
  30. #include <asm/io.h>
    7 i' C: m' R, `7 `0 S+ E* k
  31. #include <linux/moduleparam.h>5 e& z0 ^& A1 W+ }
  32. #include <linux/sysctl.h>. G$ M8 B& ^& _( B
  33. #include <linux/mm.h>
    # O+ n2 c$ r  b& b
  34. #include <linux/dma-mapping.h>
    & R4 p( J1 a/ ^2 X

  35. - H5 C* p* Q: d
  36. #include <mach/memory.h>+ w8 M9 V4 V- U/ A- w
  37. #include <mach/hardware.h>1 N/ x2 f! G3 P0 M) s, Z6 Q- _3 y
  38. #include <mach/irqs.h>
    & c  C" u9 v  @" W3 N
  39. #include <asm/hardware/edma.h>0 ]" I1 r4 d9 [! L

  40. 1 l" u- \- ]' y$ ^! }" C4 F0 g2 a
  41. #undef EDMA3_DEBUG
    5 C/ C, j& Q" j: {0 S
  42. /*#define EDMA3_DEBUG*/
    , U4 R; W: w. L+ J1 d: ?$ @

  43. ) k; Q" K. ^' G2 s1 s3 D4 W
  44. #ifdef EDMA3_DEBUG
    # L. {* D6 f0 _, B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g9 H, a) S9 I3 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 W& L8 {7 t+ g& l* Y+ R" ~8 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * S5 U, q* S- E2 a. }  I
  48. #else
    / s& F, c! J" T' X( W4 G
  49. #define DMA_PRINTK( x... )9 v. M) Z/ S  F0 [! [- [
  50. #define DMA_FN_IN
    . c& {' F0 P# q% z* b9 z. m
  51. #define DMA_FN_OUT1 ~5 z3 e% n8 C# }/ {6 _
  52. #endif
    ; f, V  x* c1 h9 o/ M

  53. 3 k7 |3 }8 L2 A. F5 P* M* g" e1 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 V6 u0 \. x1 ^( r
  55. #define STATIC_SHIFT                3
    . T! f" z* `( Q7 S) [. H
  56. #define TCINTEN_SHIFT               20
    * u4 |" F& _' |+ G- f# }/ I
  57. #define ITCINTEN_SHIFT              21" s: ]7 w& h8 y0 Y' z; u. p: ?
  58. #define TCCHEN_SHIFT                22
    % k- k% x2 C4 F7 s
  59. #define ITCCHEN_SHIFT               238 ?9 b9 ~; z+ N# @$ M4 Z
  60. - G6 g$ o7 P# X* F8 M2 X
  61. static volatile int irqraised1 = 0;5 z) b  [$ T$ Y* }/ {/ }8 B
  62. static volatile int irqraised2 = 0;1 k* {8 Y6 ?  |4 y- {, ]( z
  63. ' z- }) x2 m1 V1 j% y# b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  S# _4 `* O3 n- e. L5 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / X. v5 E3 \, U2 A7 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) v/ Q6 i0 P4 ?. Z* t( l; ~: g; _

  67. * P4 V$ v& H5 t7 x/ m, u! h
  68. dma_addr_t dmaphyssrc1 = 0;: @8 \# J/ X3 I; b1 ^( G1 S/ [
  69. dma_addr_t dmaphyssrc2 = 0;
    , f6 m. M9 u7 t
  70. dma_addr_t dmaphysdest1 = 0;9 g' u( }0 Y( N
  71. dma_addr_t dmaphysdest2 = 0;. f! v5 I( _  s3 L

  72. & I" g- S' I2 h8 D7 g) I
  73. char *dmabufsrc1 = NULL;, O: W( B  C# f3 V
  74. char *dmabufsrc2 = NULL;
    * A  W* `$ Y( x/ _, l1 f
  75. char *dmabufdest1 = NULL;# P0 T& @, i$ G9 U9 [
  76. char *dmabufdest2 = NULL;8 g, o% J+ P: {8 o

  77. # f$ C2 U* N  j2 `
  78. static int acnt = 512;/ z& S1 j: c# o; F/ p0 n8 U1 z5 z2 j
  79. static int bcnt = 8;
    ; U/ k0 K1 a* n8 ]1 j# h: F3 c2 X/ u- W
  80. static int ccnt = 8;0 D# H; f, _: C) ^/ [: R
  81. 5 s( Q. D% S9 `5 y
  82. module_param(acnt, int, S_IRUGO);( }1 {6 l4 M/ y* G/ [
  83. module_param(bcnt, int, S_IRUGO);
    ( J: V' x& E2 [4 G! x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% d4 N. p' A$ G: X8 W/ u

+ \$ @4 g) n1 X* Q6 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 i; I+ X4 q0 L% barm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& B, X% B: I4 ?' q+ l" a" ?5 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. x3 q. _0 F; Z1 U2 Q; p
  n, y; }- b2 _" P3 s5 f' n; u: \9 m; o( p2 S) N& \* v9 r+ X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号 ) 

GMT+8, 2026-11-30 02:20 , Processed in 0.046849 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表