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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 _: {0 {3 H$ R
  1. [code]EDMA sample test application
    9 Y3 Q! h' {: P1 A; _
  2. /*
    . `6 k6 x& Y& r' C
  3. * edma_test.c- T+ A0 X- `/ C. a8 l. J& I3 I
  4. *$ A& |, }, F2 t1 ]" N( U
  5. * brief  EDMA3 Test Application
    4 J$ m( K, t6 `
  6. *" T6 \% V' R3 b% I% I6 j
  7. *   This file contains EDMA3 Test code.' C/ w" t) ^# c! u" A
  8. *" n, t, M& }9 Q: z+ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 S- p1 G/ l) A- J. h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " q- Z7 H$ p( f& q/ O' v
  11. *         TO CHANGE.5 |" @! L# @, Y# ]
  12. *' _1 q4 k0 D" K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 h+ ?) u7 e. t. a- N
  14. *
    & K1 N- ]' I2 L9 {3 Q
  15. * This program is free software; you can redistribute it and/or
    + U2 {9 c9 {. D& n# F
  16. * modify it under the terms of the GNU General Public License as/ U" R2 I5 b9 Z: g
  17. * published by the Free Software Foundation version 2.
    2 Y+ h6 N$ M" \7 [. A6 W
  18. *
    0 b) v4 _8 R7 w# F) ~* q5 Y& `5 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / k5 U! z. b4 [0 O( P
  20. * kind, whether express or implied; without even the implied warranty
    3 n) d) F- d+ ]4 v- T  K, D5 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' ]: ]! @2 `- U5 _1 q8 Z& L
  22. * GNU General Public License for more details.
    # Y  i4 _8 t) g; V' A
  23. */
    ) ~) z. ?, [! G0 z2 H; n

  24. ' _3 b0 D& p0 c5 q+ ?
  25. #include <linux/module.h>6 r; N7 f) }0 [
  26. #include <linux/init.h>
    , h7 s2 u: h/ w# p; R$ T! S
  27. #include <linux/errno.h>
    0 f: G# j4 c: m
  28. #include <linux/types.h>( S4 L  x8 f+ y5 {; R* v. T
  29. #include <linux/interrupt.h>
      `7 T) P; W$ [4 f( F7 k/ \6 q
  30. #include <asm/io.h>* ]7 d3 }$ ~0 `$ s; P& A
  31. #include <linux/moduleparam.h>3 M4 m0 ^9 [  S/ P( b4 h8 s3 o6 w
  32. #include <linux/sysctl.h>
    8 x& X1 z8 y6 B
  33. #include <linux/mm.h>) d& N% ]% t, I: l& ~7 n1 \
  34. #include <linux/dma-mapping.h>
    * `+ |5 j; r6 w# l

  35.   U4 u  Z" ?( [
  36. #include <mach/memory.h>" ]' b3 u5 M1 ]# Z9 r+ U
  37. #include <mach/hardware.h>6 Z* w/ _% r3 t) H( S# W, x
  38. #include <mach/irqs.h>9 b0 B' w) B$ o
  39. #include <asm/hardware/edma.h>
    ! _3 H4 W% Q. q1 d4 w

  40. ! B# C: V! d1 ~3 o; k, m
  41. #undef EDMA3_DEBUG
    ) X+ s6 u& b. @  a( f( U2 d) k
  42. /*#define EDMA3_DEBUG*/) N; m* {  v$ P. a, P
  43. ( P* v8 e( H0 W8 i; I
  44. #ifdef EDMA3_DEBUG
    5 m/ r2 R# H, m+ d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 m; r" X, c2 Y. {2 h8 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" g" V0 I4 C- C. n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 W" Q7 f5 |. R8 Q) ]. z* ]5 m
  48. #else  E: ]; [- u  \( j
  49. #define DMA_PRINTK( x... )
    % t% Y. t% h+ O! A
  50. #define DMA_FN_IN
    . n( i5 u  O4 v1 Z: z6 p
  51. #define DMA_FN_OUT
    ( D; X8 L6 `$ t  v
  52. #endif/ \0 A3 o" h0 {; l4 I6 |2 g4 y6 {

  53. 3 N. M1 A1 R. ^7 h% R; j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! q: n) }: i+ M9 X5 d5 Q0 V8 I  ]! T
  55. #define STATIC_SHIFT                33 l" M( I/ m. B) |4 x
  56. #define TCINTEN_SHIFT               20
    " V8 t9 k6 B* b1 P2 a- _8 e
  57. #define ITCINTEN_SHIFT              21
    ) G2 u  h, O7 d# f3 g3 L
  58. #define TCCHEN_SHIFT                22
    1 f2 n6 O  r8 }* n- d  `, _. s
  59. #define ITCCHEN_SHIFT               23
    # Q  J0 Y5 W4 w  _- Z
  60. ; J* ?' ~* z$ n7 l9 I2 i* s
  61. static volatile int irqraised1 = 0;
    2 r7 P/ a4 g+ p* n/ }  m9 k2 e  Q
  62. static volatile int irqraised2 = 0;
    " }' M5 I1 q+ M4 H$ v
  63. 0 I9 q( O0 Y1 u" ~/ n. c$ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ }. O- m' P, m) t- T# N! X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! }$ r/ p3 A% m: c3 i7 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      @! F3 W( H! @* X8 m  B( B
  67. 8 Q4 Y9 X- O  v8 e
  68. dma_addr_t dmaphyssrc1 = 0;
    ) D- K. X" T. C3 o6 U
  69. dma_addr_t dmaphyssrc2 = 0;
    ) i% @8 r0 F- _9 K
  70. dma_addr_t dmaphysdest1 = 0;
    7 a& |8 ~5 w% B. C3 b
  71. dma_addr_t dmaphysdest2 = 0;4 _' B. s7 E3 g8 |- b) p/ A. q
  72. 0 P; T$ v) X7 T
  73. char *dmabufsrc1 = NULL;5 S: n7 L1 |, _0 ~! Y/ C' K% x7 ?
  74. char *dmabufsrc2 = NULL;
    % U- X& `# S' r# g! V8 ^3 M! M% |
  75. char *dmabufdest1 = NULL;
    ; E  W% G$ A/ {6 x
  76. char *dmabufdest2 = NULL;7 \6 N" }5 X  K7 e
  77. + S, R. t% a1 T
  78. static int acnt = 512;
    * W1 O- ?) q% M" a4 y- b  ^
  79. static int bcnt = 8;
    8 p# c1 @1 Y" @  o
  80. static int ccnt = 8;" m1 i- t( }, v8 z5 y
  81. 5 Q: |& o& p& z1 C- Z; {, G" }6 h
  82. module_param(acnt, int, S_IRUGO);6 B4 M; S' u3 F( H/ g7 f/ b
  83. module_param(bcnt, int, S_IRUGO);2 j. X( T/ N) y5 ~5 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  V9 I( i7 t, j2 d
* M4 F! N5 {) y6 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y% n& u5 s; d* w8 U3 U( A  w8 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: B& M$ g: n; S" r- V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# h' r# R3 R* S& r2 u& W  D4 @8 U* k& C

$ V# X3 N; x5 o: y5 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 16:22 , Processed in 0.040872 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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