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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : u) U+ P" C! }7 l7 \( P
  1. [code]EDMA sample test application; G/ Q9 P' d: W" V& q
  2. /*, E, I7 W* \" L6 f) D0 f
  3. * edma_test.c) F1 M2 ~* y3 Q2 p) [" L
  4. *
    ( Y9 d. p8 b1 ~' {0 R. h
  5. * brief  EDMA3 Test Application
    , l4 u; \% t9 G" _+ s2 N3 Y- a& b6 P
  6. *
    8 M2 e/ |$ n4 y* G; V+ }* Q3 @' ?( ?9 b7 `
  7. *   This file contains EDMA3 Test code.
    - O) E( `7 V+ M0 \8 y1 a
  8. *
    # {& n8 V1 F. c" R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 I8 s6 ^" @3 v. Q: A0 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 l6 Z' ~& i/ ?+ p/ D$ z, r
  11. *         TO CHANGE.
    3 J1 H, R0 b  r- _
  12. *
    ) _" @! e% C7 o. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 E$ z1 N8 N5 F; m6 o
  14. *' N  ^( a" h5 j: c$ K& v
  15. * This program is free software; you can redistribute it and/or
    9 W7 O( b9 V' D5 A2 s5 K# E
  16. * modify it under the terms of the GNU General Public License as7 V) G9 O1 \4 k1 i
  17. * published by the Free Software Foundation version 2.
    6 F/ w. y: m7 @$ l7 C) r  Z/ Y
  18. *
    ' l1 ]& x9 p. ~. ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 B  ]! U' T# T# S8 f
  20. * kind, whether express or implied; without even the implied warranty. F+ W- K" Y& j$ F, T, _, L+ f' U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) _! h" S8 x4 O. X
  22. * GNU General Public License for more details.7 x' a, a: X0 Y1 q  R/ [' W5 `
  23. */
    - S; u, N1 `: Z$ s

  24. 8 d! A/ c8 x: O4 x$ a
  25. #include <linux/module.h>: ]* Y* [) i) A: H# Y/ `* e
  26. #include <linux/init.h>
    * ]+ N: h, r8 h; R, x! b
  27. #include <linux/errno.h>
    ' R7 ^9 F# y6 m/ i7 y$ b. ?9 o
  28. #include <linux/types.h>, S5 b" n/ E& @0 r/ X0 {
  29. #include <linux/interrupt.h>$ z4 P5 k/ k. T# z0 O( I/ ?( A
  30. #include <asm/io.h>
    . R% D& C& K$ u- i( `) d6 \3 `
  31. #include <linux/moduleparam.h>3 Z' ?: g6 u) D7 [* q
  32. #include <linux/sysctl.h>
    ' ^3 d" z6 M3 i; u% b7 E2 W
  33. #include <linux/mm.h># e: ?/ s% J. R' o* Z: }
  34. #include <linux/dma-mapping.h>! b( L$ U4 I/ i4 i% j6 \0 K

  35. # i6 F  ], i1 F$ Q
  36. #include <mach/memory.h>
    ) S$ E' y9 y5 D3 a0 c* v7 X9 t: l4 ?
  37. #include <mach/hardware.h>" J" Y1 O; S0 ]: h
  38. #include <mach/irqs.h>
      L& b3 e) l& }/ e7 l, W/ W; f+ b
  39. #include <asm/hardware/edma.h>3 Y9 _. `0 d# z5 h3 q! B

  40. 6 w: z5 t6 ~+ i. U6 A5 c. f/ g
  41. #undef EDMA3_DEBUG
    " J! w" }; \# A% j/ {0 I( U
  42. /*#define EDMA3_DEBUG*/
    / P% f# l* m! l, W( f9 k

  43. 2 u! z! N2 c$ u' F# ^  l  V
  44. #ifdef EDMA3_DEBUG' u4 y4 f; m6 z& w' e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 V5 r# q& m! u3 x: R$ f. ^+ y2 U* b' u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; b" ]8 n9 O* k) e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; v( S& Z* ^+ b4 v) X4 \" Z
  48. #else9 P* ~0 X# G* o5 n
  49. #define DMA_PRINTK( x... )
    * c' q7 ?2 f- E  Z$ t8 f
  50. #define DMA_FN_IN
    # U& d0 O0 t  W- v2 N
  51. #define DMA_FN_OUT
      g5 G5 E8 ^+ {/ [$ ^
  52. #endif+ E, i" d9 s, m- A- @. Y
  53.   c1 E! M: T- {& n* N, V. E$ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ o: c* @: h8 k( F& ?
  55. #define STATIC_SHIFT                3
    * J" L# k  ~! f" G8 T' C
  56. #define TCINTEN_SHIFT               20
    8 _0 }$ e9 a  p. b; i0 Y8 X6 m& }
  57. #define ITCINTEN_SHIFT              210 e$ |5 K; g6 y" ~
  58. #define TCCHEN_SHIFT                227 k! {5 K1 W$ C
  59. #define ITCCHEN_SHIFT               234 B9 D0 }6 c8 D3 k' M! ], V
  60. 1 |& G% C1 I1 }2 Q! b
  61. static volatile int irqraised1 = 0;- v. k' `/ A: x8 I% U2 E" P# n
  62. static volatile int irqraised2 = 0;
    : k1 N* j! o# a  \
  63. : E" E. Y( Z) t  l7 ?  g- ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 V. ^- P) A* C$ {+ T" l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e0 v, c% Z4 b, t" f2 k8 a( |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' h5 Z- r: W! j

  67. 9 U. _8 Y9 @# p" E
  68. dma_addr_t dmaphyssrc1 = 0;+ c' t$ r# O9 @9 n* e/ _5 K" f! z2 N
  69. dma_addr_t dmaphyssrc2 = 0;
    % L# {0 F, G+ V
  70. dma_addr_t dmaphysdest1 = 0;
    $ Z; ~# Y2 G" c+ X! I0 P
  71. dma_addr_t dmaphysdest2 = 0;
    ) w" n" O4 H( |) u
  72. 2 p7 x2 ~  U& @
  73. char *dmabufsrc1 = NULL;& n: R% l8 f* U2 R. r# X$ d9 V4 b
  74. char *dmabufsrc2 = NULL;! t  {1 r# k7 |6 W& p9 B3 k( }& Y
  75. char *dmabufdest1 = NULL;
    * O. l3 I  |; @. e
  76. char *dmabufdest2 = NULL;
    . P8 K0 e& v& d1 p2 h

  77. 8 n" l. E# F% X  L( K2 W/ U
  78. static int acnt = 512;- j: N: n0 n( V; m
  79. static int bcnt = 8;1 F. c6 ^, O# u  J5 O
  80. static int ccnt = 8;/ M" H- F. E# ^' F' u. h0 T- ^

  81. 5 F2 Z" S) n7 q" B: p3 U, S
  82. module_param(acnt, int, S_IRUGO);
    ) V+ v; P0 t# ^
  83. module_param(bcnt, int, S_IRUGO);
    - z. ^. i; l6 r$ F; D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 J4 a( s. r& Y; I& ^% w
1 j% I9 P5 T" M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! K/ d7 c% I3 R0 [$ t  _8 g4 M. ]( {8 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- P2 ^3 n$ V- ~) ]- V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' H# t+ a/ ^$ {

. |2 o9 f; j: G8 ~
& d+ E) ?8 o) \8 S/ k1 q3 ?9 T+ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 05:11 , Processed in 0.041231 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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