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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# J+ h/ ~8 L, G, _/ B2 a& X' G, `# E; d
  1. [code]EDMA sample test application
    3 H9 f4 M8 I4 F. w" e
  2. /*
    8 a+ G  ~, a4 h
  3. * edma_test.c
      U1 _- i  Y9 U
  4. */ j# K; ~, ]2 i$ D6 @$ Q
  5. * brief  EDMA3 Test Application0 `! \' n2 T' B$ `  h
  6. *
    ( }! `+ H9 y$ B( Q0 ?. g# E; A6 ~
  7. *   This file contains EDMA3 Test code.
    / {1 i& ~9 O' A
  8. *3 @: F6 u" ]. C0 `3 `: {5 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 T5 t8 _6 d# B% @! G3 R% N6 ~: E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 ~) X6 g6 G) R8 I- I
  11. *         TO CHANGE.
    3 N- l8 P& c8 v" f
  12. *
    5 A0 `) ]8 K# f+ D  I, k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 G' Y; a3 d7 s5 D
  14. *
    $ S4 J. x3 Y8 A) u
  15. * This program is free software; you can redistribute it and/or' Q/ u  f* {2 [; M
  16. * modify it under the terms of the GNU General Public License as
      w; g  u* l  J. b9 {! Z1 E
  17. * published by the Free Software Foundation version 2.; \5 f& H' Z4 t4 e: h+ h% @
  18. *
    8 D$ j; w' }* I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 t7 D/ V- X1 @* S# l+ `- Z1 a  a
  20. * kind, whether express or implied; without even the implied warranty1 B0 F& `/ K, h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 R4 a' v5 i% Z5 }: I/ g7 ^* `
  22. * GNU General Public License for more details.
    2 l, ^6 A7 \9 |5 g1 ]( i; d
  23. */3 d2 Q/ M  ^; o: D/ D
  24. + ^3 y3 q8 J3 u' N: I
  25. #include <linux/module.h>1 D, c8 L2 d! d
  26. #include <linux/init.h>/ |& ]+ h4 t! x$ L9 p- X0 x
  27. #include <linux/errno.h>5 l" e8 @4 O' Z8 ?3 q5 d
  28. #include <linux/types.h>' ?2 Z  d: e- y' i" ]  ^& Q
  29. #include <linux/interrupt.h>
    ) H2 I( K! [0 K! c* [: ?, _
  30. #include <asm/io.h>) n$ w* l' f! b8 _
  31. #include <linux/moduleparam.h>( I: @3 N* \6 m' u
  32. #include <linux/sysctl.h>
    3 R5 W5 K6 h0 u2 B
  33. #include <linux/mm.h>4 Y6 U/ E9 n) L- w+ H% {; C
  34. #include <linux/dma-mapping.h>, Z/ O! h1 ^( \: B/ n: x

  35. * \7 Z0 s3 I( y" d) B0 x
  36. #include <mach/memory.h>" H. }" v: A, }' v! o
  37. #include <mach/hardware.h>6 `5 B1 H3 P; `
  38. #include <mach/irqs.h>
    4 H7 q- v. e: Q% Q# A
  39. #include <asm/hardware/edma.h>
    % l$ ]5 W; \1 G/ ~& m

  40. / R; H2 R: n# s$ n3 a' X. l$ T
  41. #undef EDMA3_DEBUG; c+ s+ \; m/ d$ a+ c: t5 X* C
  42. /*#define EDMA3_DEBUG*/' G% N/ S+ B8 @  `
  43. - p" V5 R% V8 z* \, m/ z' G
  44. #ifdef EDMA3_DEBUG. U, S( e' c0 V/ s% g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 _. ~8 t4 T' _: k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' [1 H5 L4 M" s- f! g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' N0 Q5 |' a/ i
  48. #else
    ; _. d! b0 J8 k
  49. #define DMA_PRINTK( x... )
    ' ^# g/ u& x2 \  G* G" I$ @! d
  50. #define DMA_FN_IN/ F1 P" s) e: E+ E, G0 P3 g8 Q
  51. #define DMA_FN_OUT
    % V& U  h3 C/ M: q( o- ~# k
  52. #endif" a4 q8 |7 L( X- E+ {4 B

  53. & @) {2 z& O* {0 F3 J" A3 U- l& q; w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + e3 `9 i- G. v* D2 l% `
  55. #define STATIC_SHIFT                3
    * y! _8 J9 [* l# K
  56. #define TCINTEN_SHIFT               20. T( c9 F, D, q& g. W1 h- W
  57. #define ITCINTEN_SHIFT              21
    ( s- P4 X$ I0 _% }
  58. #define TCCHEN_SHIFT                22
    & ^1 d" p2 c5 B) A! b3 V0 [
  59. #define ITCCHEN_SHIFT               23- G+ s8 U! l- ?; U8 s+ g0 B) U
  60.   p  G( b: T6 v2 e. ~
  61. static volatile int irqraised1 = 0;/ w+ o, f) f9 k% K  X: X- K
  62. static volatile int irqraised2 = 0;, e. |8 A* T  _8 `" @# f
  63. ' D6 k' z0 }, w4 h9 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 B5 Q+ C7 K# F2 ^2 Y! \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 U/ U8 J7 a1 O: Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: H9 w/ i* _; {- ^* S3 u0 }4 u
  67. ! n1 U; W! [: o/ @
  68. dma_addr_t dmaphyssrc1 = 0;/ Q2 J. d/ F$ [( m$ Z, S% p
  69. dma_addr_t dmaphyssrc2 = 0;3 u/ c/ ?1 S" ?: j! {
  70. dma_addr_t dmaphysdest1 = 0;
    ( l& i7 q6 ^) n; y% z# Q8 P
  71. dma_addr_t dmaphysdest2 = 0;0 @3 M; S/ T* j" \3 q  J

  72. : u/ t3 `. u+ h" P, U" e- a. p- Q2 s
  73. char *dmabufsrc1 = NULL;( c% t7 R$ ^, u% ]0 B- F# L1 ]
  74. char *dmabufsrc2 = NULL;
    9 s9 K- a. v6 e: W9 H6 \+ T9 {
  75. char *dmabufdest1 = NULL;
    ; J# Q7 b9 s2 P6 U9 F; N
  76. char *dmabufdest2 = NULL;7 K( s% S+ T' \: I
  77. # j  B' N7 e* m+ V  q: G5 x
  78. static int acnt = 512;; N- `5 O( f3 d( J- {
  79. static int bcnt = 8;* j+ m  I8 [& W4 G8 q
  80. static int ccnt = 8;* ~7 J3 ?5 D3 E$ t, t( ?

  81. 3 e4 R2 ]5 }3 A# o# |
  82. module_param(acnt, int, S_IRUGO);
    7 ^' a" G3 g* x5 O6 U4 X2 ^8 |
  83. module_param(bcnt, int, S_IRUGO);
    , P6 x* h; d  @1 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; K# I# ~+ }% r# F* l
7 U4 G, H+ r, f. @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  l; I2 A5 Y- R& A0 u
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 T: F! ^3 ~9 r$ Q! X8 z* `1 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% c" i2 k! ]# ?
3 n8 }1 ~' D8 z5 D# y
% x3 \6 `( D% L0 L) P9 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 18:27 , Processed in 0.039894 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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