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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : b$ M0 X: w/ t  o% ^2 f' H
  1. [code]EDMA sample test application8 t$ U3 F4 p- N9 l7 w/ R. D! T
  2. /*% B7 z8 K5 J# j* E7 H$ R. n, s: y+ x
  3. * edma_test.c
    1 c6 ^  i2 d8 r; ~8 T* t
  4. *' N- W7 d9 ?! X, G( K$ z
  5. * brief  EDMA3 Test Application7 j% h. `' S0 Q. N- ]
  6. *
    $ H  v( m% g2 C/ w* B" `: t
  7. *   This file contains EDMA3 Test code.% l6 R3 R7 X2 j; M
  8. *$ G8 G% g. x1 m, W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / u5 \$ b8 h4 @  Q/ R9 V- l4 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 C, B& B1 L8 n% R
  11. *         TO CHANGE.& w# N" J6 ~' ?0 u" G) Q
  12. *5 u2 Z- y& c2 {9 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q& w+ D3 \! N9 V$ ]$ D9 d
  14. *0 K) u! ~' e. a' l& s
  15. * This program is free software; you can redistribute it and/or
    3 e8 O$ V& {4 |+ C7 I7 j$ h
  16. * modify it under the terms of the GNU General Public License as
    3 ~6 d/ u( j2 V' [3 P5 d0 f
  17. * published by the Free Software Foundation version 2.
    7 V0 n) r+ K9 z0 H8 Q5 m4 R
  18. ** w* z: [9 s# R; @9 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 `! p8 v; P) X9 v, m7 q6 j
  20. * kind, whether express or implied; without even the implied warranty
    # p! `9 |3 S% d  u1 E: {, G/ p* H8 i# j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* l' a: Y! H9 J9 r9 a8 N# m4 P
  22. * GNU General Public License for more details.# T- b2 F% r) [" k5 d4 Z
  23. */
    # L3 K8 J) d# Y8 M% S7 h9 z" B. Y

  24. : E5 R2 A! ^- y* I
  25. #include <linux/module.h>2 I0 ^0 B& {+ x
  26. #include <linux/init.h>
    ; r# Q; ^# a5 }6 H9 f
  27. #include <linux/errno.h>
    ' Y/ c- @# h1 ^5 U0 N
  28. #include <linux/types.h>
    0 {8 l% q. j5 p9 c; i9 I( D
  29. #include <linux/interrupt.h>$ t- V8 q7 G0 J+ M9 w6 _, F2 E' J
  30. #include <asm/io.h>6 i  w$ H, \. x+ U( t
  31. #include <linux/moduleparam.h>
    ' S: v/ S1 Y4 J- M7 a% e1 f
  32. #include <linux/sysctl.h>3 D! `; k( A% b2 w
  33. #include <linux/mm.h>
    0 [* o9 s5 |4 H$ q" A1 f
  34. #include <linux/dma-mapping.h>0 h* L/ Y4 O$ Z) n/ j+ s
  35. & ]/ `" ?. G6 E2 B7 e- O
  36. #include <mach/memory.h>4 Q4 w7 M, s5 Q' ^5 r
  37. #include <mach/hardware.h>2 F# ^* c) W2 O$ r) j7 q: x1 P
  38. #include <mach/irqs.h>0 G$ g& u, e6 B2 ]$ c& W
  39. #include <asm/hardware/edma.h>
    ; J. Y  |6 [! h
  40. 1 C- {- U# X! t' ~1 }& M) O
  41. #undef EDMA3_DEBUG
    * L7 i8 j& m6 O5 P+ K; L8 m4 W
  42. /*#define EDMA3_DEBUG*/
    " Q! \# e0 h8 W+ X* B1 k
  43. 1 A: D' G& S0 A" Q6 {2 }+ B
  44. #ifdef EDMA3_DEBUG
    , _% i) t+ F. E1 X/ F/ N8 ^( ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), D: b5 [# s. G; B4 n6 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , k: e8 C, }. p, S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- E5 K) L2 y$ x$ d% k# ^
  48. #else% N# y. M( Z$ d' P; S
  49. #define DMA_PRINTK( x... )
    6 l* O4 P3 n; d2 |, e, J& l
  50. #define DMA_FN_IN
    4 R$ x/ ^2 x1 j( B$ h: L, ?" g
  51. #define DMA_FN_OUT1 ^) ?; Q2 o9 x! {0 e
  52. #endif
    / Q. Q/ B/ [1 C# V, X3 g: M; |

  53. $ N( t) @5 X  d1 b8 q/ V- r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 P. g$ e, N; g/ b# p& K
  55. #define STATIC_SHIFT                3! P( A3 B. U* Q6 ?- ?& [- A
  56. #define TCINTEN_SHIFT               20
      O( S0 L6 h  U# G" a) o4 r
  57. #define ITCINTEN_SHIFT              21
    4 E3 ?9 E/ X8 C. M  f1 H
  58. #define TCCHEN_SHIFT                22
    ; j, r- B# e! w! ]* Y5 E
  59. #define ITCCHEN_SHIFT               231 y. p* A7 }" Q/ Y: R
  60. : ^% u& ~  d! m
  61. static volatile int irqraised1 = 0;
    + s6 G3 d6 v4 h7 n+ ^1 a  p, k# q, s& D' N
  62. static volatile int irqraised2 = 0;" V5 s3 A* k; }* I1 N. l: t

  63. . M6 ~2 j. y% h& r& l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |6 T* Q$ }& Z/ f3 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U2 `7 b1 ]/ }& |) M) q1 m+ }+ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 q) \: A% P7 ^2 ~; I5 n) e* _

  67. - y% T) p6 e5 w% ?) E: q
  68. dma_addr_t dmaphyssrc1 = 0;! z  k7 ~2 q4 b8 R! i2 }* }; ~7 V
  69. dma_addr_t dmaphyssrc2 = 0;8 m! R3 i4 }* h6 ?5 K1 u
  70. dma_addr_t dmaphysdest1 = 0;
    : s+ r1 y: y# ~9 z0 l' w
  71. dma_addr_t dmaphysdest2 = 0;8 z' O9 `4 x+ r) R# U

  72. + k$ u0 N; q0 l
  73. char *dmabufsrc1 = NULL;# u8 x" U- e' v
  74. char *dmabufsrc2 = NULL;
      D0 m9 N  T' i. }/ N8 p' }
  75. char *dmabufdest1 = NULL;2 O$ w8 x" f0 J# ?8 Z' [# A4 t
  76. char *dmabufdest2 = NULL;
    4 Y: P" [$ {  R% Q
  77. ( ^* B# |4 o) w
  78. static int acnt = 512;3 B1 ^- f- a) P  y
  79. static int bcnt = 8;* O8 L. W" ^" v2 s* z  S: e
  80. static int ccnt = 8;
    , A" p: t& G1 b
  81. , j( k2 O# ]' x2 g2 \
  82. module_param(acnt, int, S_IRUGO);
    ; M2 x/ e! V4 V, f8 c
  83. module_param(bcnt, int, S_IRUGO);
    5 u) |+ g6 J3 n8 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& p9 d1 {, A0 E1 N! m! e2 G! {* `- W# p) T' l3 o" Y6 w- c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ _( R3 m$ ~9 f3 B: @7 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# F5 s2 Y% g! F; v& _" _  h$ {0 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) p$ V4 p9 A: O# T7 B! S5 k3 g* `. E3 G) W: X9 L2 U
# X" m% n9 n- U' d6 O# @+ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 04:55 , Processed in 0.046639 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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