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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  c+ _( e" H7 a) `% m
  1. [code]EDMA sample test application
    8 a; u7 o& `4 D. O4 {" \7 p  V4 b
  2. /*
    9 C2 Y  K3 B4 L# N
  3. * edma_test.c
      `# ^1 `; S% y$ Y9 M  P1 Q
  4. *
    - z; r; l- V3 L" s
  5. * brief  EDMA3 Test Application4 m: f6 |2 c9 f( A' K8 }
  6. *
    + [& W" ], _' y' h. d) a
  7. *   This file contains EDMA3 Test code.
    % d7 u1 Y: [. X6 ?4 Y- {! Z
  8. *, Y" e; g: |  f! \. Y6 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 q7 h* S* q. P2 }5 Z/ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , d! O/ P3 }0 [3 R
  11. *         TO CHANGE.
    ' `9 F( ?- S; M: o
  12. *
    # Q7 ^* W. F# E# R0 ?9 Z; b4 ]( _: {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Z* K; a6 U3 G
  14. *
    5 L. G4 B' j* Z
  15. * This program is free software; you can redistribute it and/or
    1 n7 n! U& A6 D* G% z% O& a+ Q
  16. * modify it under the terms of the GNU General Public License as
    ' g7 S  c. e* w9 d: |
  17. * published by the Free Software Foundation version 2.
    1 E& t# c- U) b$ ^
  18. *
    + A, x# F' @4 g$ [/ A- _  F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% V6 |) z. Y( y( E# z9 s
  20. * kind, whether express or implied; without even the implied warranty4 k+ |: Q1 h+ {2 j. ]6 W( V6 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 L# Q8 U! P; N2 R
  22. * GNU General Public License for more details.
    2 [( F) r3 l* L0 b- z
  23. */
    $ ?8 W/ x% W1 o' a$ R  V. F

  24. % S( w8 x9 Y+ P! \& s! L1 C
  25. #include <linux/module.h>
    * [; X$ D1 Y  ?5 \, m1 {  D7 k( e+ k
  26. #include <linux/init.h>; _/ L( \8 Y5 e1 V# m) s
  27. #include <linux/errno.h>
    5 H! A' f6 V& p+ H
  28. #include <linux/types.h>
    4 g9 J4 y0 n# e* |" N! |! k
  29. #include <linux/interrupt.h>; `& U+ ^2 g- g+ Y5 k% S) O3 `
  30. #include <asm/io.h>
    1 v4 W. s8 h; E9 k6 h! i7 X- |
  31. #include <linux/moduleparam.h>
    & p4 Y( W: k4 P$ q7 Q
  32. #include <linux/sysctl.h>
    & ]2 @! X0 w( E  ~! K$ }( g
  33. #include <linux/mm.h>
    0 [% H4 E$ b5 Y. a
  34. #include <linux/dma-mapping.h>
    0 i1 U" T! I* Q5 ^- x5 x

  35. " ]& r: C+ [, L
  36. #include <mach/memory.h>. |% X8 w* d' _% v1 Y; }! k
  37. #include <mach/hardware.h>. {1 f8 T. q8 ^) L" ?" w
  38. #include <mach/irqs.h>
    : ~( Z0 |  Z0 Z8 `) T
  39. #include <asm/hardware/edma.h>
    + {9 c' h1 H, s' J
  40. ; ~) Z3 E% n% `" M9 \; Z6 P& u" a# g
  41. #undef EDMA3_DEBUG! e( w( ]! o4 b
  42. /*#define EDMA3_DEBUG*/
    % T. G$ ~0 Q9 v: S9 m4 c" T
  43. 3 n" I  c, l5 D+ V& Y3 Y' n3 C
  44. #ifdef EDMA3_DEBUG
    7 l! v/ S. ^' l# W) L, i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( T9 g* I9 Q3 c5 q  M! k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), P: d! E0 Z. I1 b% _+ z$ ^* ^: n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 H: H" Q3 |. g) N9 B) k
  48. #else2 I0 K; a& j0 R6 w- m/ W# E
  49. #define DMA_PRINTK( x... )6 {4 D% z* l/ f1 e2 \% W
  50. #define DMA_FN_IN
    $ k7 d7 a  S0 p6 H6 H
  51. #define DMA_FN_OUT. y% c8 b5 f8 `2 q. a' [
  52. #endif
    ) v; }0 ?! \& S9 y0 G9 `
  53. % T* S. a; p: m+ p, K4 o& |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 P$ y( i& x, y. \8 g+ f- j/ L' u* @
  55. #define STATIC_SHIFT                3. `2 O% s$ l! k6 l& G# N+ [. r
  56. #define TCINTEN_SHIFT               20; L8 @6 ^- o7 K& J
  57. #define ITCINTEN_SHIFT              21
    1 l- R( }$ b& b: t
  58. #define TCCHEN_SHIFT                22, D$ M9 z- o0 v/ {5 s3 [
  59. #define ITCCHEN_SHIFT               23; @# ?9 ~0 y% x7 k- l
  60. ' y  v* c/ B2 B. W: C. B
  61. static volatile int irqraised1 = 0;  t  u6 Y  e, d! Y
  62. static volatile int irqraised2 = 0;1 b  z8 `1 N; ?
  63. $ ^: `( u: o; _9 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }6 a2 ~9 O9 l6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }: [( O7 A4 b8 i# y* f. N( S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 c  Z" I5 \  u- H
  67. ( t/ T( S6 s+ C' u7 V
  68. dma_addr_t dmaphyssrc1 = 0;+ ^' |! W* X3 w2 f+ v$ ^
  69. dma_addr_t dmaphyssrc2 = 0;! Q/ D3 s% d4 E; J3 ]& }
  70. dma_addr_t dmaphysdest1 = 0;
    0 W+ J! G, @% ~4 B
  71. dma_addr_t dmaphysdest2 = 0;0 O; R( v% I& S$ L! z

  72. ( K) v/ J; ?& ]/ J
  73. char *dmabufsrc1 = NULL;
    4 z# z4 o8 v% ]0 p' H
  74. char *dmabufsrc2 = NULL;( e6 V7 s- q: p
  75. char *dmabufdest1 = NULL;8 c0 [, u# u* ?+ o7 y+ ~
  76. char *dmabufdest2 = NULL;
    0 S6 n* |1 K3 \1 O# b  `

  77. . L8 `$ u" |' ~, B( y/ ]
  78. static int acnt = 512;* I4 d  \7 a0 z9 l( M
  79. static int bcnt = 8;4 _5 w: _3 u; v* v
  80. static int ccnt = 8;
    3 M8 v6 \5 u/ g( X/ P# x$ H1 ]

  81. ' e% p# z, y0 Y% g6 \& v
  82. module_param(acnt, int, S_IRUGO);
    % D% j3 R& O! a
  83. module_param(bcnt, int, S_IRUGO);
      U& D3 H* ^9 `6 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" ^& s3 R8 Z' l

$ C* t+ [$ W  Y& Y) h& b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ F3 _+ @! }0 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 x& l* O  o- \) j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, C+ t1 Y+ X/ ^0 b. p" U$ H
0 N' [$ n" ^! e# X* h& Q) y5 N7 u: j$ o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-14 21:50 , Processed in 0.039909 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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