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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # c/ L* t" r' K
  1. [code]EDMA sample test application
    8 X; \5 J  o9 m
  2. /*9 v2 A4 l( s& Q! u
  3. * edma_test.c
    - L3 [$ E# P; [: \
  4. */ P4 n. `; _" X
  5. * brief  EDMA3 Test Application
    7 ~; Y  O. M1 t; B0 @1 L
  6. *
    # C% N. U; h# Y6 t! M" }" _
  7. *   This file contains EDMA3 Test code.
    - l7 X% W) N0 z* h
  8. *' J5 L9 i- ]2 e8 l' L( M# y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  y  c# R- W4 h6 L: Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 q1 d+ I# e  j
  11. *         TO CHANGE.
    7 w% J. i' e) a
  12. *1 K/ K" K$ w, a7 D8 r1 U: l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ?! B1 Z* n) R1 B  T3 X! K
  14. *
    6 C. L4 b5 }  m! g. N& T9 G! x6 R- A
  15. * This program is free software; you can redistribute it and/or& i3 W3 \* V( J$ ?( M
  16. * modify it under the terms of the GNU General Public License as9 z( l" M! F- U1 w" I% ?: X
  17. * published by the Free Software Foundation version 2.
    : N& y# o" I* b; g4 C0 b7 k+ A
  18. *
    # a; v" ]  [4 v& m0 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & k# w6 U9 J, t' l' K
  20. * kind, whether express or implied; without even the implied warranty
    9 u, K1 M- e5 D6 ?8 c: `" L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. E2 y3 P- u. N& |
  22. * GNU General Public License for more details.
    6 i1 N( a' r- v$ w% q
  23. */
    ! S- P7 l& b+ s, \, I" m
  24. / b; U. a" s+ O0 c7 k) l* ^" a3 a
  25. #include <linux/module.h>' c0 L1 v" w% v) c& w
  26. #include <linux/init.h>
    2 [/ X+ Q. ^, r% I# p$ K$ f4 F$ B
  27. #include <linux/errno.h>, r, }$ z3 [$ B
  28. #include <linux/types.h># U0 M* R0 x$ _! @
  29. #include <linux/interrupt.h>9 d* ~1 F$ I  T: y
  30. #include <asm/io.h>; w4 h3 q1 {) w" w  q/ N- \+ ]
  31. #include <linux/moduleparam.h>' I& k' B; K% n5 ?
  32. #include <linux/sysctl.h>
    / y7 ^& s+ {1 S1 W; X
  33. #include <linux/mm.h>
    : f+ _/ ^9 _& V, _/ S8 R  l
  34. #include <linux/dma-mapping.h>
    # K' m$ S6 s7 q; r
  35. 4 ~9 p* \3 H$ P/ x3 @5 ?
  36. #include <mach/memory.h>
    + m6 k  I$ Y* m8 V5 L3 V
  37. #include <mach/hardware.h>/ s1 v4 L, K  n1 ?  x% C
  38. #include <mach/irqs.h>
    ' h' |) U2 ?, L' R, I; M' b
  39. #include <asm/hardware/edma.h>/ E8 c3 Q4 y3 T% F6 i
  40. 7 Z1 Z  y, x+ T+ T
  41. #undef EDMA3_DEBUG
    ; m  W1 k$ a% H9 |8 w! _  ]$ C2 L  |
  42. /*#define EDMA3_DEBUG*/
    ) j/ ?3 Z; F  B$ k
  43. 0 S) y# o( `1 ]
  44. #ifdef EDMA3_DEBUG) P& h( P& [$ {+ J. G/ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 }: h- N  E" S' @0 M$ n" t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- D: ]. C# O: ^& N: j/ i& S# Q, R$ ~! O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 i& o6 b* D& Y; J  U
  48. #else0 F9 ]; s5 ^( G; T! \! f; D# c( g
  49. #define DMA_PRINTK( x... )0 j) }) D# p7 i& t$ Q8 |
  50. #define DMA_FN_IN5 I6 Y/ _; ^- k5 c/ s" V6 S* U
  51. #define DMA_FN_OUT; x4 Z9 _' ~6 M& G5 H- l
  52. #endif
    ! d: Y( d6 X! I# _1 P, ~" l

  53. * ?* r0 j, |# `9 |  J! l; ?2 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 W6 W- \; O2 H1 ]) O: K
  55. #define STATIC_SHIFT                3
    4 i; O' V: g, o# G6 A
  56. #define TCINTEN_SHIFT               20/ O0 f' V* J, \! \/ b- J/ X
  57. #define ITCINTEN_SHIFT              21  p! d! ^# s- Y- n6 }/ J( T4 z
  58. #define TCCHEN_SHIFT                22: s9 {- {0 f9 X3 ]# o) E
  59. #define ITCCHEN_SHIFT               23$ a: Q+ x$ W4 j; f
  60. , ~9 g9 j+ H; W3 H6 S0 J3 r
  61. static volatile int irqraised1 = 0;- o# c6 W- p: y: v
  62. static volatile int irqraised2 = 0;
    * @% Z6 O1 {  ~! l) _* S

  63. ; j7 g7 c3 d' c; D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 J- _6 H& v2 ?: o4 f  R1 q" k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 s0 C/ E  Z$ {; |* R' w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % q. W, y: M  h+ ]8 H/ p* R& z
  67. : h7 Y6 L" g1 c. t
  68. dma_addr_t dmaphyssrc1 = 0;+ j) _- `5 G* Q. r( L* K3 b
  69. dma_addr_t dmaphyssrc2 = 0;
    9 g" `. d4 E) {; T+ R: L5 Q. `
  70. dma_addr_t dmaphysdest1 = 0;- O0 ?- b: k' n0 a# u; Y
  71. dma_addr_t dmaphysdest2 = 0;
    ; _3 {: {. M; L/ q
  72. 5 T# x) t: G+ P
  73. char *dmabufsrc1 = NULL;+ J3 p6 G$ r0 m- q+ t# P- _0 h
  74. char *dmabufsrc2 = NULL;
    : E; f/ h" F% {1 Y
  75. char *dmabufdest1 = NULL;- _) [: Y; l6 M
  76. char *dmabufdest2 = NULL;8 y( u1 O: Z! T- w# E

  77. 3 U% S6 _, }$ g  }- I$ f% J2 J
  78. static int acnt = 512;
    ( ~, s/ Q) K9 g) j, i
  79. static int bcnt = 8;: Q) \( G9 M9 ]' W; |3 I. {
  80. static int ccnt = 8;
    5 e( X$ C6 {, _" L

  81. 0 v/ o/ ~- @/ Q$ N! d4 j
  82. module_param(acnt, int, S_IRUGO);$ n2 _' R) w7 P. P, |! B
  83. module_param(bcnt, int, S_IRUGO);
    / F' L. a0 J1 \% {# j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 W/ B9 e' r( u$ |3 B) d& r+ _3 G
* B0 [: @- u) Y5 V, G' N- }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% y, b2 v9 k* i- o2 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. J) w: U0 y; E  W0 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. K5 J/ W( T9 f- N# i5 h

) ?9 @2 v4 |- r. q0 \
$ B) T6 ]. x( Y  f2 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 20:53 , Processed in 0.040624 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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