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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z/ ?' C* N. h! a  \$ A
  1. [code]EDMA sample test application7 ?3 L$ x7 ]8 d+ A5 _% {5 H
  2. /*
    6 O# P- w& m7 B+ R% \& I
  3. * edma_test.c
    & i0 Q# G$ h4 }2 ?" f5 e, l
  4. *
    $ \9 v0 n: G7 x0 J+ [
  5. * brief  EDMA3 Test Application
      n  c7 G3 q' x5 e1 K
  6. *2 B. q8 I/ u& }  l. H6 `- p
  7. *   This file contains EDMA3 Test code.1 ?7 O& K  j- Y$ C+ N8 q4 w
  8. *7 _- i( z: s# Q& A9 H. f9 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^5 M7 a$ v. r! i1 B& Q1 t5 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % m5 R- W, `! t) ^+ ]
  11. *         TO CHANGE.
    " Y+ {: @3 h2 E9 P. @$ p- I
  12. *. s9 M& [0 ?$ S& A5 ?- `! L! E/ d! n' q3 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 h/ |; n: H8 a" g! W4 e
  14. *' y5 R' D. Z/ b* C( p
  15. * This program is free software; you can redistribute it and/or
    7 `3 y8 W; {6 o9 @2 a$ |0 ]# A: i2 v
  16. * modify it under the terms of the GNU General Public License as7 e* a2 B) z# s( U
  17. * published by the Free Software Foundation version 2.
    1 [0 ]& y3 V. n7 [  m- r/ Q/ N
  18. *
    ' [/ X4 z4 a0 U$ T3 m- j' Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - w  M* q9 q; W2 s$ \1 F" W% F2 m% c
  20. * kind, whether express or implied; without even the implied warranty
    - ]8 L, h6 o) K( y: P) m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * g6 N/ }- x; ], z' k
  22. * GNU General Public License for more details.) ]2 s% q# r6 E* ?) `% K
  23. */
    " h; e7 f6 y+ a- q& F7 h( f

  24. 5 s  q! g7 R0 T! z
  25. #include <linux/module.h>
    4 e* ?: \7 L" q. S5 b% z
  26. #include <linux/init.h>
    ( |% u+ U" m% O
  27. #include <linux/errno.h>+ ^* p7 C! u7 z
  28. #include <linux/types.h>
    % j' Y9 F. G/ E/ J
  29. #include <linux/interrupt.h>
    & b6 T* {0 T+ }5 y% P0 u
  30. #include <asm/io.h>
    ' o3 ?* O0 |; }; [9 h$ c8 |0 N$ N# D
  31. #include <linux/moduleparam.h>
    3 N7 ?; @( K1 j3 y/ q' r" I
  32. #include <linux/sysctl.h>
    ' l1 |8 _6 w+ h9 r
  33. #include <linux/mm.h>  G7 j/ y0 r' L* k9 f, l( M
  34. #include <linux/dma-mapping.h>
    , i) ~4 _2 Q8 U, P9 F+ }
  35. ; I, k' P. Z% l$ \4 {; R
  36. #include <mach/memory.h>
    + A6 R$ T5 w! [# z1 C, S1 U
  37. #include <mach/hardware.h>1 ?5 l1 a3 t1 E' i0 l/ s
  38. #include <mach/irqs.h>* T- A- ^, W7 n! M2 D- w4 o
  39. #include <asm/hardware/edma.h>9 P* D+ n1 Q, l$ _  h3 L
  40. " V6 S( l9 Y* o; T; d- Q# h
  41. #undef EDMA3_DEBUG! S+ f6 j2 t& \5 h& G. E/ c
  42. /*#define EDMA3_DEBUG*/' n8 U" W2 S3 Y4 u

  43. 0 F7 r5 n9 t0 g
  44. #ifdef EDMA3_DEBUG
    ( s1 S7 f2 L$ s* l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). y2 ]( s8 m' O; Y4 y4 O  o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 \  V: V) W5 B- g/ F& r% W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Q/ [- S* @* `1 _, Z( q
  48. #else  A5 A2 i- a4 o, C8 x
  49. #define DMA_PRINTK( x... )
    0 d" q  \# F0 m' T7 @. [
  50. #define DMA_FN_IN. N/ N* A& ?2 g
  51. #define DMA_FN_OUT
      k; a8 O; Q% W
  52. #endif
    9 ^6 {; ^) k3 m+ O0 H' p- ?
  53. % i6 g9 H, L* @3 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; s) Q6 M- _/ k' V4 ?  c# p7 S3 i, Y
  55. #define STATIC_SHIFT                3
    4 H& t6 N( u+ y
  56. #define TCINTEN_SHIFT               20* w) z: [: m( x+ D
  57. #define ITCINTEN_SHIFT              21, x# w& r# |' z% `' w
  58. #define TCCHEN_SHIFT                22
    6 l; F& A% p/ a
  59. #define ITCCHEN_SHIFT               23
    : Q9 B! D6 D& U

  60. $ \6 P6 P& M, I' C$ l3 j" X
  61. static volatile int irqraised1 = 0;, q4 u, v: h" E* N  D6 r
  62. static volatile int irqraised2 = 0;+ J; ^' f0 W7 I9 m2 W
  63. & k/ L& l6 l' ^$ ?0 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A( l: S  Z5 L( v$ f3 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * o+ p; n' U. H5 ^# S" P" H- j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q/ V7 I# }. [

  67. ! L9 D- h: J$ Y7 ~$ b" P3 M
  68. dma_addr_t dmaphyssrc1 = 0;
    ' I' a' l& d- v9 \3 m
  69. dma_addr_t dmaphyssrc2 = 0;9 O. P; d* i2 o! P5 T& }. V
  70. dma_addr_t dmaphysdest1 = 0;
    3 L/ Z6 h! j* z6 r+ v2 N
  71. dma_addr_t dmaphysdest2 = 0;0 V8 k: C( [7 g: ^
  72. / y6 v( p' t1 G8 m, |8 }
  73. char *dmabufsrc1 = NULL;
    6 @% y: c' K9 E, q( h+ ^  O: C# T7 w
  74. char *dmabufsrc2 = NULL;
    ) m( a% p5 L$ P0 n
  75. char *dmabufdest1 = NULL;" K) e) ?) R' n- e$ \3 N
  76. char *dmabufdest2 = NULL;( e; Y; @! K+ W7 n

  77. 8 R) q% M8 j! a8 [% y9 X1 F
  78. static int acnt = 512;3 G8 z3 d# w& o9 v1 t% [
  79. static int bcnt = 8;
    ( ]" k4 h. |! c4 O
  80. static int ccnt = 8;  _: _9 u, o. i6 f7 Q
  81. 0 o" n. m2 z5 @4 U( w
  82. module_param(acnt, int, S_IRUGO);
    / f8 o9 k4 }& g5 C& U' `2 c) s: {4 r
  83. module_param(bcnt, int, S_IRUGO);
    . z8 I9 ?" r1 D# P- |& p/ \5 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 B: q: m# K1 l5 ?! D; h" w
6 H% }3 Y" L! `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( [$ L; J7 C+ H+ G) {" X6 O) C2 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 M7 t6 _8 I- ~. m# l- u1 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) I% x: _3 ]9 Z+ T8 w6 q" Q
  \3 _1 x( Z5 \5 V# Y
! }1 q' B* Z$ d* k0 _0 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 07:55 , Processed in 0.041976 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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