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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - M3 O+ s0 a0 y! T: P
  1. [code]EDMA sample test application% [0 G; \/ W+ W2 G# U1 \9 X
  2. /*
    3 Q, d% o( W! @: h! Y& C
  3. * edma_test.c  J5 J; p" d5 z2 k9 J; R# Z3 p
  4. *1 [# `( \; f& m2 ]
  5. * brief  EDMA3 Test Application# \/ `; C8 J% i6 f& H. k) H
  6. *& `1 d- e) ~  h" T- a; O6 h
  7. *   This file contains EDMA3 Test code.0 Z7 G$ v) j- I1 \% _  Z: l# |
  8. *
    9 K2 C1 _! ^/ q/ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 u! E1 d4 o- m7 b: w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) u  ~1 m" {7 Q6 K4 \- b2 ^
  11. *         TO CHANGE.
    $ D& g9 N. N% _
  12. *
    - Y$ V2 H& ?# N2 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      J, C# B" h( ~! t# H" h& U. G
  14. *- L  g) e; y& ]  J% n) ~
  15. * This program is free software; you can redistribute it and/or/ P' }- I; I* ^
  16. * modify it under the terms of the GNU General Public License as0 l, n. P  a+ ^- |
  17. * published by the Free Software Foundation version 2., i1 S$ k" g' F& ?& G4 o, l
  18. *
    3 D8 c; c: z1 o( q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 n. g9 D; T' I  H& h
  20. * kind, whether express or implied; without even the implied warranty* G* ~* ^. c$ U4 D4 ~5 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; T% m5 S/ i$ W' b- K
  22. * GNU General Public License for more details.6 a3 L& f# _9 u0 R, ~& M& N
  23. */
    & P! E* l* k& ]1 k/ V2 e
  24. ! ~3 V* v+ c3 S2 _' O1 f- p/ e
  25. #include <linux/module.h>
    ; y7 a, O: t* E1 K. h; o
  26. #include <linux/init.h>
    ! f* s: \8 C  ~
  27. #include <linux/errno.h>
    6 X. u  |  S: ^# p  o
  28. #include <linux/types.h>
    , q, @) U' Q7 K. \+ ^! a* F# O9 ?! _
  29. #include <linux/interrupt.h>
    , R* X7 v" _  g0 Z6 O
  30. #include <asm/io.h>$ ~( w' D. ~1 ~) H
  31. #include <linux/moduleparam.h>
    / r; D1 |6 O% w
  32. #include <linux/sysctl.h>
    / a8 }4 v, C3 w1 q+ @. ?
  33. #include <linux/mm.h>. j; p  q) _8 B) [# d) ]
  34. #include <linux/dma-mapping.h>
    4 o7 z, L* p/ f7 {9 a* ~

  35. * E4 q+ S: w7 M; c$ w, L
  36. #include <mach/memory.h>
    5 N& g4 c$ l1 }1 F
  37. #include <mach/hardware.h>2 t& N: p" v3 f# v# o. D
  38. #include <mach/irqs.h>  z8 b% E- h* q0 C8 J! B
  39. #include <asm/hardware/edma.h>, n5 y1 ^% M& T
  40. 2 |- x% O& c9 H& H
  41. #undef EDMA3_DEBUG
    ' K, k$ B8 w5 ?  _( T/ U$ U/ S% P
  42. /*#define EDMA3_DEBUG*/* W: V1 m+ Q9 ]; f9 W' W
  43. 7 e/ K1 x& ^3 _( A
  44. #ifdef EDMA3_DEBUG' u0 E0 D, U$ W- A# v: w8 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): B1 x; @7 J7 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; Q/ n- z6 N% ]4 p4 f  [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , N# s3 R5 k$ B* c  M  k5 T# `* O
  48. #else
    ; e' ]  `+ O$ S( {
  49. #define DMA_PRINTK( x... )0 w& ?4 L2 T. l! i, ^; h
  50. #define DMA_FN_IN" r% i. `$ ?0 k3 T) X
  51. #define DMA_FN_OUT% R) W) f( D+ {. Q7 p
  52. #endif
    3 W& i2 O; T# _, I" g
  53. + Z6 V* @' b- |1 Z3 U' W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ r4 w) O" b0 N
  55. #define STATIC_SHIFT                3% A; i% u! K% i" @( m; @
  56. #define TCINTEN_SHIFT               204 x9 V6 Y3 l* J
  57. #define ITCINTEN_SHIFT              218 C6 @2 y- W# m3 m8 l; [3 ~
  58. #define TCCHEN_SHIFT                22
    * }/ {, u+ x: \
  59. #define ITCCHEN_SHIFT               23
    8 K6 s( A0 _  R! o, Z9 C: |7 X4 }1 ~4 m

  60. ( g# a" ~% Z8 Z- {- s0 z7 _
  61. static volatile int irqraised1 = 0;
    & Q) n2 f7 s# U" o0 r+ n1 G# |
  62. static volatile int irqraised2 = 0;0 V3 J  _1 F+ }; w  \8 c

  63. " h: W, k9 h' s, N+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A4 T1 |  B7 O, O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) i% w/ i( l: x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {$ R) i3 G1 f# w. ]) S5 O* [
  67. ; C* {6 @$ G. [7 x6 I
  68. dma_addr_t dmaphyssrc1 = 0;( F8 o. m0 A! ~9 _
  69. dma_addr_t dmaphyssrc2 = 0;  j) H0 k( l2 A" A. e
  70. dma_addr_t dmaphysdest1 = 0;
    - ?' n6 j2 I- n* ?% [) m) l
  71. dma_addr_t dmaphysdest2 = 0;1 i$ h1 D3 s; Y5 f) Y  z

  72. / w8 B1 T1 _7 g
  73. char *dmabufsrc1 = NULL;+ H$ ]( o9 S) ]& o) l% [4 j9 a
  74. char *dmabufsrc2 = NULL;
    / L+ u8 q0 {9 i' V8 t/ g" b
  75. char *dmabufdest1 = NULL;0 Q6 g4 r5 b3 e5 J
  76. char *dmabufdest2 = NULL;) h! M- Y+ Z8 r* l/ C5 V0 E

  77. ! ]& S5 l  u  k, N( {
  78. static int acnt = 512;3 z- t$ t5 f: e1 O8 c: Q, L
  79. static int bcnt = 8;" u, K) x8 P: q/ @
  80. static int ccnt = 8;. v% Y1 \  a. Z
  81. 8 f) Z# d! {+ a( X6 h! o! I
  82. module_param(acnt, int, S_IRUGO);& b2 x0 P1 G$ i8 t
  83. module_param(bcnt, int, S_IRUGO);
    % I+ M1 M/ o* Y' f* O; n$ p) M9 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) G& r1 n+ E( c3 \* u

5 G7 L6 B+ a/ w6 ?' s' B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" n0 N. y% ^( \: k5 d# ]/ a. K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 o0 ~# P8 q7 r, C3 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ z: T. E* z4 W
( W3 F5 g; ?8 K$ M% y

2 G) S* v! m4 J- l& w. Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 16:30 , Processed in 0.050195 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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