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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x, x' ]1 M5 J4 m
  1. [code]EDMA sample test application! B/ H! w+ k" h; A# I
  2. /*
    4 v& Z5 ^6 a6 }1 I; o0 h' Q
  3. * edma_test.c8 `" d# q6 E% j& H6 H. _6 Z
  4. *
    " `2 b) B  q3 N6 m* |
  5. * brief  EDMA3 Test Application
    $ g+ a: B! v/ {
  6. *
    6 i6 H, q  o6 `) u( b9 D
  7. *   This file contains EDMA3 Test code.
    ! R! }4 a; b% t5 m% m, v4 K
  8. ** N6 G5 O" L0 F1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - w( e. e$ Q  i. v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- F! M( c% O  F  |" T
  11. *         TO CHANGE.
    3 A$ k. E; y4 f6 @, \# @7 M, }) M
  12. *3 c3 f, \$ d4 Z( N! d0 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ n3 G8 z! `% N) o
  14. *, c/ V5 e( ~8 D6 Z! L
  15. * This program is free software; you can redistribute it and/or
    5 H- |3 y, }4 m5 d) k
  16. * modify it under the terms of the GNU General Public License as  y& ]/ ^2 z) ]  a
  17. * published by the Free Software Foundation version 2.0 E. h1 S5 P& O  d) k, x, f7 v7 S
  18. *  E3 B  S1 w4 @! q" W$ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( M- E- C, W6 r" H1 D) S: G- v7 C! t
  20. * kind, whether express or implied; without even the implied warranty! k' Q7 R1 u7 t$ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* d; Q" E9 F7 ^# g7 [- x; w
  22. * GNU General Public License for more details.
    + g& k9 k7 c' G/ ?$ G3 N
  23. */. L' G+ L. g& e+ \9 z7 G
  24.   `" z3 k" L! d# u9 B6 [$ o1 X
  25. #include <linux/module.h>
    7 F9 V2 S1 i( W
  26. #include <linux/init.h>
    " W$ k/ }- i( T; V' C9 I
  27. #include <linux/errno.h>
    ) G3 M! n$ g1 j2 d9 _
  28. #include <linux/types.h>' L2 s6 z( G1 I- M
  29. #include <linux/interrupt.h># j2 `& h2 L% g3 {
  30. #include <asm/io.h>
      X, C1 E1 v6 Q
  31. #include <linux/moduleparam.h>( T, K5 l( K8 Y6 L
  32. #include <linux/sysctl.h>- o1 [" O. Z% E7 y3 _, C2 Z3 }
  33. #include <linux/mm.h>; M3 Z7 }. o6 }$ y2 h/ n
  34. #include <linux/dma-mapping.h>+ Y7 D5 n! \; u3 m- {1 W5 p% W

  35. 1 Z! m3 l& k/ \2 C
  36. #include <mach/memory.h>1 F2 U" E- d8 @3 [" h
  37. #include <mach/hardware.h>
    1 v3 s$ u6 g# x
  38. #include <mach/irqs.h># G- B- b9 i. [  x  M. W$ L
  39. #include <asm/hardware/edma.h>
    * b! @  T1 Z( b% g# d# j$ Z) Z

  40. ) a' a) f0 b2 a5 L) N& [  b
  41. #undef EDMA3_DEBUG- G) l) k4 X% s: E5 B. ]+ p
  42. /*#define EDMA3_DEBUG*/- b: t- W) E- d% ]& K" p, a* y
  43. 6 ?' f2 R5 F0 O% V
  44. #ifdef EDMA3_DEBUG
    , y6 h# N* g8 N5 n. w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - g# B2 F$ C' |$ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): e, c8 d) p% f' b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 \' I+ H4 @* x) B% H' k0 C8 D
  48. #else
    + ^8 q2 l3 `" g- d+ ^2 j1 e
  49. #define DMA_PRINTK( x... )
    + g+ {4 \/ W" y  [* h9 o! C& Y
  50. #define DMA_FN_IN
    $ @6 {" U: e( W, S  b: g
  51. #define DMA_FN_OUT
    0 d0 s! J) e9 a+ Q$ ]" O1 D
  52. #endif  k, R; V7 g- g8 m8 u% I2 P
  53. 3 U/ x" x  m9 i: R; H  D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      S: e- h8 q7 }
  55. #define STATIC_SHIFT                3
    / ]/ J  @4 M7 t$ o; P  Q  z
  56. #define TCINTEN_SHIFT               20
    1 C/ K9 h% S# r
  57. #define ITCINTEN_SHIFT              21
    1 U. {$ j5 _+ x' f
  58. #define TCCHEN_SHIFT                221 T" W2 [8 |) O# i) l1 m* y% n
  59. #define ITCCHEN_SHIFT               23
    2 j& z; H* k: q9 T7 J! j
  60. 8 `' i# B5 c6 v8 S
  61. static volatile int irqraised1 = 0;' x& I" R/ T% [
  62. static volatile int irqraised2 = 0;
    ' U: T; A( ]4 ]* I* l# e0 p
  63. / b7 D: M7 ]$ Y6 w$ U4 Q3 k+ N4 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l8 K6 g) I6 N  `& R2 N0 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 p+ ~! M3 n! Y6 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a+ q) T9 U: R  Y4 g  V5 q

  67. ( h: U  L3 P9 u$ N. o; q. Q% s% G2 v
  68. dma_addr_t dmaphyssrc1 = 0;+ {- |4 D$ L1 P6 \4 z
  69. dma_addr_t dmaphyssrc2 = 0;
    5 g) L- Z+ O5 N- y
  70. dma_addr_t dmaphysdest1 = 0;
      f$ G: p/ s) ]/ B. f7 i% `: w1 B
  71. dma_addr_t dmaphysdest2 = 0;7 @; e% b7 j6 {. m7 [9 W
  72. : @' g, m1 o2 j* a' E5 F) u
  73. char *dmabufsrc1 = NULL;0 a! Y* S) s9 Y7 f5 b
  74. char *dmabufsrc2 = NULL;
      c7 s' p" I  q. Q
  75. char *dmabufdest1 = NULL;
    2 K+ o5 k+ N; `3 {8 ?: v. }
  76. char *dmabufdest2 = NULL;7 W- Z( }" K% g6 B

  77. 9 |8 [) B. n1 Y
  78. static int acnt = 512;
    8 x7 S% I1 _5 _  D* \
  79. static int bcnt = 8;
    " t" d+ l+ D3 N% F8 Y' {
  80. static int ccnt = 8;
    ( M' Z; E3 Y8 h5 `2 t; O$ R* D
  81. 9 l4 S0 e1 h! T, N- H& t
  82. module_param(acnt, int, S_IRUGO);3 \- M- N1 X3 ~  d5 a% x
  83. module_param(bcnt, int, S_IRUGO);3 ~2 m. D1 l. ]7 {8 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  p  B1 ^$ R' r  U
* B6 U' [& L' Q& o- O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" S* E0 Z& _2 ]$ ]  z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' K, q9 l0 u; l- I% D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 I+ v3 \9 I% G% N; g: Q/ L
+ J7 m* {+ _6 l, ?7 A- W) P

/ Z2 F# [7 ]8 y) z. R/ J8 S+ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 04:26 , Processed in 0.042038 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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