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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ], E* Z" W. U7 h
  1. [code]EDMA sample test application) O" l1 ^: K- `* q8 z' D# s
  2. /*
    2 r, d- P1 R; s' P0 A
  3. * edma_test.c2 R& C+ H7 k; c' m0 o
  4. *
    9 \( F' X' Y' E
  5. * brief  EDMA3 Test Application& {; S9 _* K4 Z5 I- y1 V
  6. *
    , P7 K* j! J9 y
  7. *   This file contains EDMA3 Test code.6 ~9 n1 w! g4 }3 X
  8. *0 [/ k! U7 b5 `6 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ~( ]. k& P& X, V/ y# ^3 J; M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! J9 z2 q: q7 e. ?8 j
  11. *         TO CHANGE.
    . Q' ]/ E; z8 X0 b
  12. *: c. K6 g2 l$ l7 u8 q- f0 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. J# z+ b4 ^  L8 x6 d9 V! w) ~2 E
  14. *
    . e- O  q" a* w. x! ?3 a% c
  15. * This program is free software; you can redistribute it and/or
    1 t0 C$ F$ ]$ m( P' T2 s0 l8 H+ {# [
  16. * modify it under the terms of the GNU General Public License as
    ' `& X) I' @4 L0 [
  17. * published by the Free Software Foundation version 2." S% A9 }) H- j# \/ f
  18. *
    + C  m+ d& W: S# n# W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: D2 B  L+ q1 y- o
  20. * kind, whether express or implied; without even the implied warranty9 {5 F$ ]5 i2 A7 t9 o$ d# n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; C4 l$ C# k( [2 G0 s" P
  22. * GNU General Public License for more details.
    ; o, `/ Z0 Z  J1 T
  23. */
    : E6 H  B3 c! d/ ~

  24. ( H5 m; i6 z5 ?" h
  25. #include <linux/module.h># i$ k3 r% M: v; C6 c4 Z4 H
  26. #include <linux/init.h>
    0 C/ [4 M  \) Z/ z) e( ^+ X
  27. #include <linux/errno.h>9 J6 C+ H9 l/ m6 p
  28. #include <linux/types.h>
    / W* s+ X7 H. B4 O
  29. #include <linux/interrupt.h>
    4 z6 Z, z: e* d4 l6 W/ R( |
  30. #include <asm/io.h>
    . w- i$ N# q/ C5 R# G& G( a9 g
  31. #include <linux/moduleparam.h>
    # l  r8 l4 v6 m1 l1 i
  32. #include <linux/sysctl.h>7 W6 w6 O1 W( I2 _6 e5 ]
  33. #include <linux/mm.h>
    3 G# j" P: ?3 L' ?
  34. #include <linux/dma-mapping.h>2 V' ~7 G, k+ `4 i; i6 z  d: y

  35. 9 w) U" V2 y1 G0 v( _0 w
  36. #include <mach/memory.h>
    4 s5 n0 D. q: g- M  H% P
  37. #include <mach/hardware.h>
    & F; u# i8 H) d4 u
  38. #include <mach/irqs.h>
    8 Z# m3 t2 ?- n9 J
  39. #include <asm/hardware/edma.h>
    , i5 i7 f9 `# E2 n, K% e

  40. 5 A7 r4 P9 i$ z3 `/ B+ r$ p3 |% s
  41. #undef EDMA3_DEBUG
    : V1 S+ Y$ ?8 E0 X' ^
  42. /*#define EDMA3_DEBUG*/3 q/ h4 X2 i4 c

  43. , K1 ^9 O- r6 d' P: B1 U
  44. #ifdef EDMA3_DEBUG; Q1 @6 w5 A$ C. C4 L4 Q) v5 Z5 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 o. r8 x9 Q8 N% m$ F0 L7 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : u* e8 a" r! x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( f4 O8 O: @1 x: {, [
  48. #else; m5 Z" p2 d% l
  49. #define DMA_PRINTK( x... )
    # g8 O4 Q0 G# l8 Z( _3 K
  50. #define DMA_FN_IN2 }% [8 h2 J5 u% Z& e  S
  51. #define DMA_FN_OUT# L9 O( A, B7 P( ^3 z6 T
  52. #endif
    + P: S. a+ T! d6 \& y

  53. 2 N3 ?& O" s: N2 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + ^$ c3 Q8 I; m! |5 L
  55. #define STATIC_SHIFT                3
    8 G1 T7 b- g6 a/ j5 K
  56. #define TCINTEN_SHIFT               208 i1 d: y0 ^6 r0 L  t2 g: Z0 a
  57. #define ITCINTEN_SHIFT              21/ h/ K8 W: W4 l
  58. #define TCCHEN_SHIFT                22
    3 O! r  |4 F. s
  59. #define ITCCHEN_SHIFT               23' v) f! n2 Z+ q, `. n+ e5 @" u

  60. $ ^( Q& R1 F- C+ W. t3 A( l
  61. static volatile int irqraised1 = 0;% g' |, a/ [0 t
  62. static volatile int irqraised2 = 0;
    7 N  ?" p2 i! j! d

  63. ; Y* {8 y" u3 P8 \! f9 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! P7 z" ~/ @  H* v" B/ u. Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . a5 d5 P9 R2 D7 y( }$ q! O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : X$ O) j: ?" a  d2 x& s
  67. 1 @# s# Q  u# g( a; \! J& ~9 R( J
  68. dma_addr_t dmaphyssrc1 = 0;0 f" U& P; L' l
  69. dma_addr_t dmaphyssrc2 = 0;
    $ {# {$ e* t, u/ I* ]0 I' E
  70. dma_addr_t dmaphysdest1 = 0;
    $ ^; @3 r: e$ }* n( D+ P* p
  71. dma_addr_t dmaphysdest2 = 0;
    7 ~/ X/ Z# w" k) j: m; u( @' i9 x

  72. 4 ^6 v9 N* D2 d; r
  73. char *dmabufsrc1 = NULL;. b$ W2 n; \5 ?% A6 g% a
  74. char *dmabufsrc2 = NULL;, P% C* @" h( U+ A2 t  _% k. z9 i% G2 O
  75. char *dmabufdest1 = NULL;
    6 ?$ z5 ?/ n2 _6 x, m+ N
  76. char *dmabufdest2 = NULL;
    . V' v8 T  x% p8 X1 j. Y2 A
  77. ) `  V5 G- M7 N2 i  d' p
  78. static int acnt = 512;
    / _9 U, q' \: Y: G& Q
  79. static int bcnt = 8;4 B. ~* P4 b; A1 {# Q  z
  80. static int ccnt = 8;
    ) u# m. `2 Q/ N1 N( C
  81. 8 i4 t3 W* ~; d' o
  82. module_param(acnt, int, S_IRUGO);
    1 g# A# i) A4 @3 b: E8 [
  83. module_param(bcnt, int, S_IRUGO);
    ) K" F2 s4 ~1 [5 E3 R5 d  P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( H7 p- X2 t' Y; E( n, G% Z+ `- r

9 f9 X% s% k  W6 a7 q* l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ o* _' n. g' n, D! B0 L) Larm-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 i& l6 D: b8 K8 h+ e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 t# Y( P$ R1 G
4 M3 @& m. F0 f. ?2 T. y& ?

/ d( C2 \* W9 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 16:26 , Processed in 0.037450 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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