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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ^% p4 o* E0 _- b$ E
  1. [code]EDMA sample test application
    % Z5 x8 c) A- \
  2. /*8 H9 S3 g8 w& S# @+ Z3 G( C6 l, x( h
  3. * edma_test.c
    0 C! ], j# Z; X5 j* B7 w
  4. *
    , f" F/ ?0 m9 v1 t
  5. * brief  EDMA3 Test Application
    2 e* I. I; {, t0 v  q" K1 O! ~* l
  6. *+ x/ i' ?) t2 O8 f1 ^$ `+ B- `
  7. *   This file contains EDMA3 Test code.
      f3 J* p7 N, n0 W% o3 j
  8. *
    , k! P- H9 y3 `$ o$ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 A. m+ C, Q& M6 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , G; m0 E( B% n$ f% V
  11. *         TO CHANGE." u7 b! ^) C( r  U+ H1 n
  12. *
    " _# [9 h0 ]) A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# p9 e0 z3 _9 f. w
  14. *
    ( a: L- g/ G0 l) p0 c! m9 E: C" q
  15. * This program is free software; you can redistribute it and/or% I  ^8 z/ e$ r% W
  16. * modify it under the terms of the GNU General Public License as
    1 K2 D1 c1 i9 j
  17. * published by the Free Software Foundation version 2.
    0 R4 _: g7 G* W/ J0 h
  18. *
    - C2 v4 O9 ?: a. Y4 y* k, S/ W: Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 O/ t5 k$ b( e/ E0 d1 W8 i0 Q
  20. * kind, whether express or implied; without even the implied warranty! L; T! V9 b9 w9 z  E. A$ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 x" j; {) g; W6 F. m. E; b4 ~
  22. * GNU General Public License for more details.& a0 q0 q% V" j3 E
  23. */
    0 ^& q( C# S! H. K5 l3 [

  24. ) K3 O8 V& I3 Q+ t
  25. #include <linux/module.h>- h2 K% O* n+ G( g0 N/ W
  26. #include <linux/init.h>
    ; c9 Y8 h) X! ^0 D' T
  27. #include <linux/errno.h>0 C* q, ~3 Q* s+ R1 W% d# ]
  28. #include <linux/types.h>
    , V6 Z7 w# e+ g
  29. #include <linux/interrupt.h>% {  Q+ _- h$ q7 J$ C8 F& F. X
  30. #include <asm/io.h>
    8 v  p/ r: c4 q& U0 ^
  31. #include <linux/moduleparam.h>8 }4 {' E/ [( w& M, N' |
  32. #include <linux/sysctl.h>: n! v- |1 z- P! b% b- p6 B6 C! x
  33. #include <linux/mm.h>0 k1 b4 I& B3 g
  34. #include <linux/dma-mapping.h>  x/ A+ y- ?- ?* u* u
  35. 5 j& _1 [# J  h
  36. #include <mach/memory.h>9 q9 J0 X$ R* z, _4 Q& O& B! g
  37. #include <mach/hardware.h>
    $ `' U8 |' n6 h% C; z9 V
  38. #include <mach/irqs.h>1 K1 g9 B5 t" |- s0 m0 L1 l
  39. #include <asm/hardware/edma.h>2 H4 r; b9 K* \" v0 P! |
  40. + a- J  w. ?5 Z. G* l  j0 P
  41. #undef EDMA3_DEBUG. X% [+ l9 F& S' |/ g& N, b
  42. /*#define EDMA3_DEBUG*/2 |$ A& \' Z- W. L: `' V  S  w2 _

  43. + C8 E' j0 W7 Q9 [
  44. #ifdef EDMA3_DEBUG
    ; E. h9 X9 I9 z5 f' s- n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), k& r9 @! z' K9 X( e7 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / z1 f: g* Y7 c! F. M5 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 f2 O  j! M) c$ H) W( N8 V+ T
  48. #else
    - F" S3 c9 h4 X2 a" T; S5 a/ `
  49. #define DMA_PRINTK( x... )
    - K2 D3 Z, u$ M  \; ^! T- ]8 p
  50. #define DMA_FN_IN
      Y" x. |8 M7 u: ^& \+ x2 f1 |
  51. #define DMA_FN_OUT2 x, J* ]1 ~  Q$ s" A- x7 F7 ^  A
  52. #endif2 g- t" |- v, a- X
  53. / C6 Q3 {0 ^' h% `" _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! }& h$ o5 q, i: L: S0 f, K) x
  55. #define STATIC_SHIFT                3
    $ r: d( `6 {, H' c
  56. #define TCINTEN_SHIFT               20  l1 T1 e2 E+ {# a* K4 @* |
  57. #define ITCINTEN_SHIFT              21
    ( a! W" [; ]9 |8 n0 J
  58. #define TCCHEN_SHIFT                223 A# n5 v8 \! r; \. J7 G, d
  59. #define ITCCHEN_SHIFT               23& E: J3 M4 B- ^! D1 v8 x" k) U  d* C
  60. . U3 f' j( [9 l/ Q% f1 c6 R
  61. static volatile int irqraised1 = 0;7 W* J) K2 l- b( z; H3 w
  62. static volatile int irqraised2 = 0;
    8 l& q# P0 Z- m3 E, l! q" s

  63. ! q- V9 [7 x: @& g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m4 e: a5 A, p& |, b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z4 {+ N9 d. Y1 {# r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c/ [/ n, ?4 q; m* f

  67. , h# O' e, ]* R' l. L- p
  68. dma_addr_t dmaphyssrc1 = 0;1 o5 E9 h5 K1 O  Z
  69. dma_addr_t dmaphyssrc2 = 0;7 g: v4 i) T# P9 t' t8 ^
  70. dma_addr_t dmaphysdest1 = 0;
    1 a% _0 p; Z9 B$ K( n
  71. dma_addr_t dmaphysdest2 = 0;
    : r& a) p7 F& Q# x, F

  72. % ?9 k, t" ^: }
  73. char *dmabufsrc1 = NULL;
    ! Z, r2 ~- h8 r# o! s* F9 V
  74. char *dmabufsrc2 = NULL;6 p/ i$ A7 P' Q
  75. char *dmabufdest1 = NULL;6 u, G6 @/ ^% o# p
  76. char *dmabufdest2 = NULL;6 ?) n4 k) `8 d: w0 V& [/ x

  77. ( ^+ `$ a% ^( A/ V& r% N' F
  78. static int acnt = 512;) t/ F2 @4 Z. @/ x( M- O4 l
  79. static int bcnt = 8;
    6 T. D, W- @2 {' r. o
  80. static int ccnt = 8;6 X* ?# w) m" f; o" r
  81. + k& F' D) R4 c) V9 W8 ?* S
  82. module_param(acnt, int, S_IRUGO);
    6 W/ x  M  Y3 r+ f
  83. module_param(bcnt, int, S_IRUGO);: F& R7 @% z$ O, R$ e8 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. N0 a3 x1 T+ Z- |3 h) Z% U2 C- o# ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ C5 {  v0 P+ `5 i( varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) N6 @! y, ?" Q$ c6 X# N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! |' l& B- r0 h9 d0 h
( w5 N( d& ]7 u7 t" `9 ~8 D1 b$ `9 u  v0 Y2 i) }" E& {1 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 02:14 , Processed in 0.057028 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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