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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Y2 D4 F* o, c# _/ s2 K
  1. [code]EDMA sample test application
    " j3 q7 q: Y- P6 ^$ \
  2. /*
    / Z. F' z+ U& b* u
  3. * edma_test.c
    , q9 B# s$ l% B/ t
  4. *; h3 D; Z; q$ z6 f
  5. * brief  EDMA3 Test Application
    ' c+ r9 c1 S- k) E$ c
  6. *
    - e: V- d6 W% b
  7. *   This file contains EDMA3 Test code.
    4 K) |% _- _3 E- r5 F0 y7 m
  8. *. T# }2 T" ~) j1 n/ u( f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H5 p) r4 q% b4 R: d* a7 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 n) u8 d8 G* x. X* o
  11. *         TO CHANGE./ K( u  P7 m# z5 k& N2 w+ c; e  ~0 `- u
  12. *! _9 L# [# [% j8 p: C# H) t  q) U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! R4 l0 c: p1 Q( b6 r8 q$ S3 b
  14. *
    ) ]' i" l( V- o1 l+ j' M
  15. * This program is free software; you can redistribute it and/or
    % D9 g$ D4 {9 Q
  16. * modify it under the terms of the GNU General Public License as. a5 a& `- Q" A# e4 ^; F0 h
  17. * published by the Free Software Foundation version 2.
    1 L8 [) p0 n: \3 l0 q4 I) R
  18. *
    0 ?. F# i9 t9 O  j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) o* e, V( G; j1 [: Z
  20. * kind, whether express or implied; without even the implied warranty$ A6 y- J& `/ Z& i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; Z. |% x9 y: s9 F2 U) U
  22. * GNU General Public License for more details.
    ( x1 K- J6 N7 U  b. B
  23. */, w! L* I& d& j1 z: l3 N) ]

  24. 1 w! X8 g3 G' j; u; p! ]
  25. #include <linux/module.h>0 ?1 r# G+ _& m  J4 w9 Z
  26. #include <linux/init.h>( j: b  T9 }" j' x/ T: R
  27. #include <linux/errno.h>
    * S! y+ [5 c! p/ {  C6 R) ^4 @
  28. #include <linux/types.h>
    / x8 ~4 D% y! W2 \; E0 a8 W: Q
  29. #include <linux/interrupt.h>
    . _& t: B5 {9 U8 ~, S
  30. #include <asm/io.h>! O, R8 B" n# V7 f' ]
  31. #include <linux/moduleparam.h>5 C) F4 x: |* Y( h7 [" ]. B
  32. #include <linux/sysctl.h>
    2 u/ }5 c8 V. U. P* b9 C! [
  33. #include <linux/mm.h>! [' N4 l4 l" O" x" g6 a5 B
  34. #include <linux/dma-mapping.h>
    : d" T( _* ?3 C: Z# {# t

  35. 8 }( A. m+ P, E4 D, x/ f
  36. #include <mach/memory.h>6 \$ r+ G/ F8 u- `
  37. #include <mach/hardware.h>) [" m6 _" b0 U' @' c. v% r
  38. #include <mach/irqs.h>3 X, E& f4 F% ~
  39. #include <asm/hardware/edma.h>- u- a+ V: |/ t" |3 P: l

  40. 3 U% ?+ V7 w: L5 E
  41. #undef EDMA3_DEBUG) O3 n' F8 [( l. L  ]+ W* Y
  42. /*#define EDMA3_DEBUG*/
    & B; L0 k4 D+ e) J  }4 Q& A! l+ D

  43. 6 Z$ y" ~7 z& [$ W1 G
  44. #ifdef EDMA3_DEBUG& f1 o. p: w+ ]# \$ b$ a0 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! _6 x. D& F+ `$ L, Y: }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % e" b( u2 @8 B1 O- V0 k* c9 i, Y) u5 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 q" X) R* f6 D" `+ b# }$ _: n
  48. #else' n  d$ ~* E% f) A3 H& s
  49. #define DMA_PRINTK( x... )' d7 r+ ~  {' f! ^- n0 u" V
  50. #define DMA_FN_IN  l9 I0 K. r# w" Y' P: Q
  51. #define DMA_FN_OUT
    & x% x( L6 j% b) r
  52. #endif
    ! U/ e; r" E' b0 f' ^, M' L

  53. 5 v6 X1 o) Y0 i" D* N* }1 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( |0 r" z1 q  ~/ Y
  55. #define STATIC_SHIFT                3' ]2 f) S& s/ C8 w
  56. #define TCINTEN_SHIFT               20
    " M6 o: e* Q/ w5 m; J8 U% Y8 c
  57. #define ITCINTEN_SHIFT              21
      \7 x/ L3 P, q8 W% Q2 \2 z
  58. #define TCCHEN_SHIFT                22$ }  R7 r4 G& f. r& |+ T: f
  59. #define ITCCHEN_SHIFT               23* k6 K  X" D& @3 P" m/ _
  60. ' ~; G/ T: c7 H% @6 u: k7 b- h7 a5 o8 i
  61. static volatile int irqraised1 = 0;  s7 _$ k! O) v
  62. static volatile int irqraised2 = 0;
    - \* k* b" S/ B* p# A4 X8 J4 k

  63. & G- W; E% @  f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 f' C6 ~3 X+ N9 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 f) T0 D( [: E1 y; O5 o5 {6 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l2 W, S" u5 d

  67. ' b, j$ q1 G, I0 R
  68. dma_addr_t dmaphyssrc1 = 0;
    0 t! K, N6 `/ }) V$ k7 M
  69. dma_addr_t dmaphyssrc2 = 0;
    ) g3 i0 z- D2 {' t
  70. dma_addr_t dmaphysdest1 = 0;
    1 h& o) d# {' ]* j5 X
  71. dma_addr_t dmaphysdest2 = 0;; j* L; a. C- B$ ~! B: O

  72. ; i9 g) M& q3 T+ k8 V
  73. char *dmabufsrc1 = NULL;
    4 b* @( I7 G4 m% m, O8 U$ f3 c* M7 c
  74. char *dmabufsrc2 = NULL;  k, s1 H! g# f3 |% D
  75. char *dmabufdest1 = NULL;- v1 ^- r. ?; l2 E
  76. char *dmabufdest2 = NULL;/ W+ [2 y) w5 A$ Z
  77. $ h0 m4 d9 M2 D0 [
  78. static int acnt = 512;; z9 C) b0 e. K# G  U/ w) G/ }. o6 s
  79. static int bcnt = 8;* f5 p! t" x6 Y! h8 l
  80. static int ccnt = 8;
    & l- K% A* o% m2 p8 w8 x. T+ r" q
  81. & W; t4 E/ V% r# ]/ W
  82. module_param(acnt, int, S_IRUGO);- t4 P  u$ K; p) o
  83. module_param(bcnt, int, S_IRUGO);
    ) w& E3 `) F; ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 b- x, E4 p. N2 t" L; K1 D4 e7 I0 V1 y$ {9 L/ N7 G$ t; J+ O( x- J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 H; x8 f- X; m* o  farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [- o9 F) O) ?- [) C, ^" e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d5 v+ ?" ~$ A+ E) E3 H
, ]4 }3 U& N, a

3 e+ K$ X5 r" P  H/ A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 22:58 , Processed in 0.042343 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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