OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 H1 L4 q, c2 w! k; U/ M3 Y
  1. [code]EDMA sample test application
    - M9 n4 t7 Q& ?! c' ]6 M+ n. Y
  2. /*
    " j7 j* I, A2 ]9 [- w
  3. * edma_test.c+ D; b; M  U; z0 o/ k, \
  4. *
    + g9 w5 N1 z5 [" ^
  5. * brief  EDMA3 Test Application0 K( e' a2 W6 Q0 s; P
  6. *
    - m5 X) G7 V0 d
  7. *   This file contains EDMA3 Test code.6 N  k5 g; W& S& G
  8. *! Q& B: m5 \8 L9 i' X$ B" k: S3 e/ n3 L, J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 U( I8 u! K, ~' t( z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 I$ I3 \; u: c+ y3 S
  11. *         TO CHANGE.2 N5 d$ b  d$ ]* L' O4 I
  12. *
    9 K1 X' d: ^. v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 t! X: B7 Y* t9 }
  14. *
    - U/ J& h) q5 J, H' c' M- Q, j. w
  15. * This program is free software; you can redistribute it and/or
    $ f% c1 H) v0 n
  16. * modify it under the terms of the GNU General Public License as  m( O: X6 j# r, D) I- @
  17. * published by the Free Software Foundation version 2.: t2 n, J+ J$ P& f
  18. *
    . x3 |: S. o0 n, E4 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 G) J. I( l  G1 V# e( X
  20. * kind, whether express or implied; without even the implied warranty
    : J: W& @8 U$ b& v( o; H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ o& [# I" C1 u; I4 o) W9 e
  22. * GNU General Public License for more details.
    ( F, A6 w7 B; K; _+ a& L8 B
  23. */
    1 [& D8 d* |0 w

  24. ' `, ]# X9 b1 ~1 v" N3 D
  25. #include <linux/module.h>' d! U/ @9 K  s- c* a  K& D' i
  26. #include <linux/init.h>
    0 V- c1 a+ _8 ~4 z
  27. #include <linux/errno.h>
    * n% g3 G4 Y5 y: ^" l
  28. #include <linux/types.h>
    * q* e3 Q* L9 d- ?& F, j
  29. #include <linux/interrupt.h>0 P/ t; w; l  \+ b' E6 M
  30. #include <asm/io.h>
    7 \( H; Z) B& }# h
  31. #include <linux/moduleparam.h>
    ! }/ q5 A7 Z1 ?; ]$ P
  32. #include <linux/sysctl.h>7 c+ @$ e4 e5 i: d
  33. #include <linux/mm.h>
    + q+ q2 [. {5 f# s+ W: g/ m: ?
  34. #include <linux/dma-mapping.h>
    : U; n& K2 M4 {: _/ _9 m5 t5 q1 L
  35. % [. \# w3 z$ k7 L& b* D! w  J
  36. #include <mach/memory.h>" W' P( Z3 n5 u5 E
  37. #include <mach/hardware.h>! {" y+ b4 j; _
  38. #include <mach/irqs.h>: s+ w2 o' O% t
  39. #include <asm/hardware/edma.h>
    - e" l# k# e5 J% w

  40. ' o/ ]2 X8 \1 X) ]
  41. #undef EDMA3_DEBUG
    ) d# {9 h3 K2 Q: `6 T
  42. /*#define EDMA3_DEBUG*/
    ) O! ]. ^* n  \3 F/ `
  43. * |: u+ R( z. H+ e1 F. ~
  44. #ifdef EDMA3_DEBUG2 j+ x, M3 Z" Q* |& S  l$ s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 d4 U" D- C$ y+ S+ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! C* M2 Q1 \  Y1 b* U# g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): P# Q0 P# l: i0 t# X' A7 E6 ^
  48. #else
    / v& A4 B  c- Z5 P* y6 d
  49. #define DMA_PRINTK( x... )
    8 z8 g5 K5 g3 e+ u9 B- X" r% B
  50. #define DMA_FN_IN8 G1 B4 W) t5 ?8 t
  51. #define DMA_FN_OUT
    & v. \7 l3 ^2 \6 ?& n( |3 l& Z) b
  52. #endif7 Y- o% X1 X1 j% d+ q0 c, L
  53. ( f/ p  P3 D7 h5 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( G6 ^4 Q3 F8 b/ d8 s& y- Z0 w: `
  55. #define STATIC_SHIFT                3# A" c. d) @4 `! t+ s7 M. `
  56. #define TCINTEN_SHIFT               20
    ( |7 T9 E8 M: g9 A% o, ~& |
  57. #define ITCINTEN_SHIFT              212 E3 r' s& U8 h. o4 v& ]
  58. #define TCCHEN_SHIFT                22/ B% ^: o5 `$ U4 Y2 D
  59. #define ITCCHEN_SHIFT               23+ w$ {! o1 J4 N" j
  60. 4 k5 S9 h' s+ [/ y  e9 q
  61. static volatile int irqraised1 = 0;( o4 U: f6 ~: b) s4 E, ]  p
  62. static volatile int irqraised2 = 0;; L% [: W; j; @7 x& \

  63. % h- e* K* L" j. ~* U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " f9 S5 Q: |& f  l% n% V  Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _# N  v, f7 g, [* ~; q  i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p1 z( G* e. p
  67. - Q8 w; M) D) [6 n
  68. dma_addr_t dmaphyssrc1 = 0;
    ' W; \$ _, j/ w- m0 F' y. u
  69. dma_addr_t dmaphyssrc2 = 0;
    / p! ?8 L  L4 [+ i6 e: m0 U
  70. dma_addr_t dmaphysdest1 = 0;
    ! h3 S" d. l) @  X. Y, k2 }# y) Q
  71. dma_addr_t dmaphysdest2 = 0;
    : {% i. ?* E- j, V* |1 @8 r
  72. 4 t' d* F8 j+ z/ @- _* [
  73. char *dmabufsrc1 = NULL;
    % Q1 f  |$ e1 T: k
  74. char *dmabufsrc2 = NULL;7 X: x7 l; q5 H) ^) M
  75. char *dmabufdest1 = NULL;
    : B- V3 [  ?: h; j! d4 Z
  76. char *dmabufdest2 = NULL;
    * @) u( S& {8 u$ U" E

  77. 0 H# J5 _+ Y0 F5 s
  78. static int acnt = 512;
    3 @& o) ?2 k. _* ^+ V# E' m2 ?
  79. static int bcnt = 8;
    2 {5 [) \4 `; D/ O
  80. static int ccnt = 8;
    2 M. @7 N7 {6 ^8 H2 }! H7 ~

  81. # J9 x% h4 P- |: |7 o3 [
  82. module_param(acnt, int, S_IRUGO);
    5 y( Q& x! j- s6 u9 a- O6 ^
  83. module_param(bcnt, int, S_IRUGO);
    * g& L! Y3 o- X4 C+ H: }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ l/ h7 e( Z- f" L9 f# N& j- t' H/ m; C6 [: y: W7 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ J- A0 z) s9 X# u7 l; Q4 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Y7 a/ Z- y2 S7 B) X4 E! Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 \. [8 a! V/ \& h
8 b% r3 l+ _4 P/ w5 D2 k1 e

  m1 t' D$ a! f) e# J, ^$ t& c9 ^2 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 09:01 , Processed in 0.037436 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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