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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 m/ W5 x) Y1 ~/ N6 L. j2 y
  1. [code]EDMA sample test application
    , M. a  l) F. E* d. P' K/ G, `2 S
  2. /*- e4 i; N& v; U, ]
  3. * edma_test.c4 m1 X: n. r0 r. i' `
  4. *
    . k5 u, C# B. s; |8 W+ G
  5. * brief  EDMA3 Test Application& N2 `, I4 }, L  A0 c9 H3 b$ K
  6. *
    ! Z% A5 y& R) y$ m3 w% _: ?
  7. *   This file contains EDMA3 Test code.
    ! q$ ?/ C9 k* o7 p- M1 `" `/ _
  8. *
    8 z5 x$ U9 k9 R- h) e# w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " d. Z0 i3 i2 m! I- l1 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 W' r" ]0 R& q: [
  11. *         TO CHANGE.; `5 u; _- J3 M& v
  12. *. X6 m. t7 F; y: i4 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " W7 ?; N8 m( H
  14. *
    1 L3 B* v$ X4 l' M5 A" t2 W5 g
  15. * This program is free software; you can redistribute it and/or2 S5 A: b; U, J9 l: k" t6 s/ {' t9 U
  16. * modify it under the terms of the GNU General Public License as9 t! {+ T, P/ G. s" n2 r2 L9 F
  17. * published by the Free Software Foundation version 2.
    # e0 z4 r7 R" ^2 w
  18. *
    & V  \) ]8 @/ V: ?( x+ U$ c+ i: r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 Q9 D3 M* c$ ~7 \# [8 g6 p7 q
  20. * kind, whether express or implied; without even the implied warranty
    0 j$ k* j, P+ m/ A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: i' p# G+ \# |2 s9 `$ G9 p( F* Y
  22. * GNU General Public License for more details.
    9 S( H/ a1 f9 b4 w
  23. */5 N- `. ?1 G" M. ~

  24. . Z8 S( ^: l. `( ?, Q4 O/ Q
  25. #include <linux/module.h>" J; s+ X' P& f$ |; s4 \( i
  26. #include <linux/init.h>
    4 w& s8 A) E* o9 Q" @# ^
  27. #include <linux/errno.h>/ e8 G2 _( l% C. o# V8 i$ i+ o/ `
  28. #include <linux/types.h>
    0 q+ d; q1 A8 [1 l8 c
  29. #include <linux/interrupt.h>
    ( I% Q' X+ G" m+ C
  30. #include <asm/io.h>
    : k0 k8 u6 S: [; {( c
  31. #include <linux/moduleparam.h>
    4 z" Q6 e" G( m: a; u- B' m
  32. #include <linux/sysctl.h>3 `" J, n, R3 M( D
  33. #include <linux/mm.h>* Q, `8 z& C& n! r; x8 M
  34. #include <linux/dma-mapping.h>- p2 c4 Q' y+ ]3 @9 c/ J8 n

  35. & n- X0 R7 f2 g0 \' `2 s+ H
  36. #include <mach/memory.h>
    " H9 {# t" m; t$ j$ h* m
  37. #include <mach/hardware.h>3 O0 y- [8 ?7 U# B* Y
  38. #include <mach/irqs.h>( N$ I, ]( y4 N% }
  39. #include <asm/hardware/edma.h>
    6 a  x6 \, |' K# o  _

  40. 7 T2 u" A; n& M$ T& d
  41. #undef EDMA3_DEBUG
    9 f, _  M" u+ W0 F7 \# G
  42. /*#define EDMA3_DEBUG*/" N/ ]( N8 `1 `: x4 {
  43. 9 D) K1 f% Z  _: h, e/ Y+ B3 W
  44. #ifdef EDMA3_DEBUG
    * g8 n) \+ Y* e% ]- i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); a; p& }; l9 l9 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' b+ v2 H' {* c2 c% }$ J3 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% H+ m* s( v! x% q( r" Y9 y
  48. #else
    # H5 t) o8 b3 j. s" C
  49. #define DMA_PRINTK( x... )9 y- A7 d: J9 O5 u
  50. #define DMA_FN_IN- t+ y+ K  W7 N
  51. #define DMA_FN_OUT, n- C5 N' M: c3 W9 }
  52. #endif
    % S" `' A7 x1 q/ Z4 i
  53. 3 w: ^2 F- J" B+ f- _* {4 ?: I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): ^$ ?. C$ V- m6 Y" a, g
  55. #define STATIC_SHIFT                3
    ' |! b4 r! F! s1 u5 _
  56. #define TCINTEN_SHIFT               20
    ( o. l0 G8 v, O& d+ W/ d
  57. #define ITCINTEN_SHIFT              21+ p$ W( }! g7 F/ P% n; ]  m' O
  58. #define TCCHEN_SHIFT                225 l7 M- ~3 e: c; U
  59. #define ITCCHEN_SHIFT               23
    , J4 S4 y# G& m1 `# f8 @/ ~; B

  60. 5 M5 ~% j: v2 h
  61. static volatile int irqraised1 = 0;- `8 ]1 [6 {  |& _/ k( M
  62. static volatile int irqraised2 = 0;
    ; x( h1 \6 g9 J$ G) O

  63. 0 R2 p( W# g+ y" D5 K4 Y( a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; r4 {3 e  q3 {3 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! H: C3 M5 x4 u* K* V7 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % `4 c) R, R, g0 [% E: O) Z
  67. " z7 B* Y' p/ w9 X$ }
  68. dma_addr_t dmaphyssrc1 = 0;
    & y3 P, `9 h% y; r
  69. dma_addr_t dmaphyssrc2 = 0;
    2 T* E) {7 i5 F* b2 e; P
  70. dma_addr_t dmaphysdest1 = 0;
    7 x3 u8 U1 K: g& u" h/ X
  71. dma_addr_t dmaphysdest2 = 0;
    . X0 R$ I' ~- ^) F) R2 v& P# b( U

  72. 9 M0 A$ y! c  E
  73. char *dmabufsrc1 = NULL;
    " C+ j) |1 z9 q* n4 E
  74. char *dmabufsrc2 = NULL;# P7 |0 W9 |. r
  75. char *dmabufdest1 = NULL;/ }" f# W8 L) o
  76. char *dmabufdest2 = NULL;
    & ~9 y4 [: B: `1 }& \
  77. 6 {: t; n) D& n5 K5 c- C
  78. static int acnt = 512;6 X+ U+ _& X3 Q4 C( X
  79. static int bcnt = 8;# q/ Q& m! N% N3 ^( Q2 {
  80. static int ccnt = 8;
    - d3 Z5 U+ g* R, F/ X1 y, c

  81. 8 C7 n# l$ i4 g/ a: H: Z7 b
  82. module_param(acnt, int, S_IRUGO);$ u- {9 v/ L$ P9 d8 o6 ]7 ?
  83. module_param(bcnt, int, S_IRUGO);
    / s& W: J$ f+ c& [4 f( F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 O( J- O3 \5 r4 K3 y- ]& F7 a" O% I" b: j; \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 t7 K% F; `0 D: J$ M$ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# J3 o& O* p1 U0 H7 s. o- W- S6 p1 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& A4 v% v. E8 s& r8 V
6 l& o8 ~. R+ J2 p% u1 A2 `3 Z) ^& _& j! e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-15 20:29 , Processed in 0.038989 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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