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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d9 x! S  W. i! |
  1. [code]EDMA sample test application) D  p. g2 v" j6 M2 {0 m; }# C
  2. /*2 p6 _: x! ?& J. g: B
  3. * edma_test.c9 z9 C6 Z$ {8 g- F
  4. *- T. z2 r" K: I* y7 M' j% L
  5. * brief  EDMA3 Test Application
    8 y" r1 h8 e2 `* o! h2 d4 D% }
  6. *
    4 I$ |8 V! K- h- K4 m$ _
  7. *   This file contains EDMA3 Test code.
    & q  Z( i! T6 B  i3 L+ _* I
  8. *
    ( Y* B2 |3 l7 C6 _3 |  X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " Z! x7 x( z& R1 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, x0 J$ O& W5 k0 H
  11. *         TO CHANGE.
    $ A7 F8 p8 N4 T, ?, M1 O" U7 O8 N
  12. *
    7 P1 {7 d+ S$ `' ~1 h9 G  _5 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # u) a- A( L, y/ M# `
  14. *  E" w$ N! H2 X, V
  15. * This program is free software; you can redistribute it and/or% B! s0 V; c. m9 Q* i
  16. * modify it under the terms of the GNU General Public License as2 G5 B+ X3 k- K  j0 w5 ?
  17. * published by the Free Software Foundation version 2.
    , Q  @7 y5 ~' S7 D4 V" g$ O
  18. *7 N: `# l. D7 m" ^0 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : E4 x% f( Z9 J  @3 z7 I, y/ W
  20. * kind, whether express or implied; without even the implied warranty8 P& e7 g4 |7 [+ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y$ d! y7 V! T0 G" r3 V
  22. * GNU General Public License for more details.
    5 S' J( U. [# m& |$ M
  23. */
    % E3 K6 k; i" S" o" E$ ^7 h

  24. % b/ x8 x( s$ l3 B' z
  25. #include <linux/module.h>4 g- ?4 C8 r# w
  26. #include <linux/init.h>
    # o' h- h3 C# d. R! j# f+ k: }& A
  27. #include <linux/errno.h>, P1 \4 q$ b& C/ c+ C
  28. #include <linux/types.h>9 M+ t& V8 d, c2 y- U
  29. #include <linux/interrupt.h>
    $ e" B) S$ J2 z! L, m
  30. #include <asm/io.h>
    . P' `& X# H3 D% {2 S! r) E
  31. #include <linux/moduleparam.h>) G/ h: z1 v. |+ \' u& ~
  32. #include <linux/sysctl.h>( E: V  m+ u. `) O. u
  33. #include <linux/mm.h>
    $ V6 e: P0 H6 r$ w* h9 U2 z
  34. #include <linux/dma-mapping.h>6 J& p+ N$ v- F' z9 o2 B

  35. 8 J, X  k) g9 ]0 M0 Z! M
  36. #include <mach/memory.h>
      K: d, B2 L! `! R4 H& ?7 c9 y5 y
  37. #include <mach/hardware.h>
    & U2 y5 v* J. e& n# @! J
  38. #include <mach/irqs.h>
    8 x4 p9 G( M' a& R$ C
  39. #include <asm/hardware/edma.h>5 @7 j: \. Z2 L9 q6 N
  40. 8 x# t* P  s. n0 ]$ |; P
  41. #undef EDMA3_DEBUG
    3 H( O- X# \+ g7 p: j: w
  42. /*#define EDMA3_DEBUG*// o) I1 F2 z( v

  43. . o2 `, l6 t. k# J* f: D7 Y; j& B7 ?
  44. #ifdef EDMA3_DEBUG5 s* r" o* @: w2 G0 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ o2 L) o; s0 Q+ T$ O/ ~3 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) E& h4 Z# e% D- ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 c# G; p/ x. L6 m" C; Z5 b7 A' b( U
  48. #else: e, Z1 ]& }0 x  Q: G
  49. #define DMA_PRINTK( x... )- h4 L; {& }1 w- l0 ]; n
  50. #define DMA_FN_IN  N5 A! o' `! W+ @
  51. #define DMA_FN_OUT
    " t8 b5 Q+ X3 p1 ~/ k0 s9 s% v
  52. #endif5 x$ B" z7 a" J2 \( K; f

  53. 5 i7 F7 A0 a9 W# S3 A; f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). J* P0 I- x, H
  55. #define STATIC_SHIFT                3
    ! N+ i9 f' y, V- x4 H9 Z2 B
  56. #define TCINTEN_SHIFT               20- C4 i  P' d( c6 X5 Y- ~( {
  57. #define ITCINTEN_SHIFT              21) E+ u- I( |, e1 g! Z
  58. #define TCCHEN_SHIFT                22  z- ~  ^7 @3 ?6 V( c+ }. g" k
  59. #define ITCCHEN_SHIFT               23
    * R0 T5 K# R- h$ y

  60. 7 g7 j& X' B3 K( ^+ h9 d
  61. static volatile int irqraised1 = 0;
      v, B- N4 U" z* q( W, M% G7 T
  62. static volatile int irqraised2 = 0;
    4 p2 M8 [1 X& B" J8 E
  63. 4 W1 e$ [5 ]6 o, h8 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 u$ S( o* t/ x) m8 F6 l. x( d7 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + b' T' I. S5 n. e; j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 R8 y6 C/ N  c# r3 c: `
  67. & f. m: t* [# z: j. J% r" V
  68. dma_addr_t dmaphyssrc1 = 0;& G1 P+ I. [; V: n
  69. dma_addr_t dmaphyssrc2 = 0;0 k9 P. i0 j( ~+ B
  70. dma_addr_t dmaphysdest1 = 0;
    8 V3 c+ r# L6 d. `3 I$ k
  71. dma_addr_t dmaphysdest2 = 0;0 `) c# i6 X8 {7 j: Z& J! e
  72. 2 d# ?* z7 J3 d3 B, X3 k1 o9 }
  73. char *dmabufsrc1 = NULL;
    2 W7 h2 s) g2 i( b
  74. char *dmabufsrc2 = NULL;
    & K' \) t7 i( J" M7 ?1 y% a
  75. char *dmabufdest1 = NULL;
    # z8 Y. s( }3 u5 {0 I! Y! T
  76. char *dmabufdest2 = NULL;" I3 P+ x: d6 t$ ]
  77. ( C' R* g7 K. L  a! N% o/ w
  78. static int acnt = 512;5 Y8 Z4 e1 I$ _/ X
  79. static int bcnt = 8;4 P5 Z  q9 R6 F
  80. static int ccnt = 8;% z/ P! {- I# ~# V
  81.   `# C# O/ G3 j; G1 ?
  82. module_param(acnt, int, S_IRUGO);
    $ A; ~" R$ d& }3 ?8 g9 |, w9 ^
  83. module_param(bcnt, int, S_IRUGO);  l' u( Y: F: ?5 y- V# ^( E; x$ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& k: z. u8 a' j8 [9 p$ b7 R' J
  s; i1 z4 n) j. x6 B2 `! L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V. V2 G. D) D# |  V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 S1 j  B% }! _. ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ]/ E" y9 S' C& p. J

- s1 d4 D! b& B7 U& u$ ~3 J4 P% v4 z+ ~5 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-28 09:24 , Processed in 0.043925 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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