OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q0 R9 ~: D0 k: e+ V: Q8 u2 ^" a
  1. [code]EDMA sample test application' K& }% h7 f! v7 V3 I
  2. /** N' z, R' }' L& s* q. @
  3. * edma_test.c8 R5 \1 o8 n% j# |. `
  4. *
    0 M' h/ @7 i" j' E* N7 a( p0 i
  5. * brief  EDMA3 Test Application; S3 F: k: {/ e% {) e' a0 x. T( F+ u
  6. *
    ; h/ C4 D6 V, U+ e8 d) }8 S( O# q
  7. *   This file contains EDMA3 Test code.9 r3 W+ |  T1 b0 u  `
  8. *, [* F) ]  p/ j6 S8 G6 \  d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 M6 |. i6 W( S! R- m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ~: c! k% Y' z5 A
  11. *         TO CHANGE.
    2 N$ z7 p0 b% ~% Q' z
  12. *
    1 x$ d% _6 s: Q" y* k  G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; S$ Q% v3 m. q- E. u9 t: v
  14. *
    7 p% O, l! D/ \; z
  15. * This program is free software; you can redistribute it and/or2 n! ^+ i- f6 Q" A& q
  16. * modify it under the terms of the GNU General Public License as
    2 d$ |6 p+ F7 d' J7 O! H* W3 c2 x% Q6 W
  17. * published by the Free Software Foundation version 2.1 J" b& x3 S+ V/ l0 t  e% R* s
  18. *
    ' e$ ~. e0 N1 R$ h- E! ?* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & ?7 R% Z- K6 L
  20. * kind, whether express or implied; without even the implied warranty; y" U3 ?. A0 ^& w" ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; M+ Q1 w5 m3 R  f! B2 j' d
  22. * GNU General Public License for more details.
    , m6 D% q; J( z% X8 ^
  23. */
    ; m  V0 ?" X. f% j# Y# l

  24. 3 ^* e( p1 w5 N1 y
  25. #include <linux/module.h>
    0 l. A5 Z! F- s7 G- r
  26. #include <linux/init.h>
    + g6 L" t& K' _' p$ I, m" l% n
  27. #include <linux/errno.h>! T2 ^) w) e& @1 z; f
  28. #include <linux/types.h>0 ^2 D# n% Y2 w# D' z) q+ C
  29. #include <linux/interrupt.h>0 v- p9 y4 k7 o0 p
  30. #include <asm/io.h>% M( v& F3 U( _+ V: n
  31. #include <linux/moduleparam.h>8 j. h1 `/ D- }! v2 g% `8 i
  32. #include <linux/sysctl.h>4 s2 q  I% m# F4 [5 g6 P
  33. #include <linux/mm.h>) ^: d* L; M6 @3 v6 ?( |
  34. #include <linux/dma-mapping.h>- t6 q" T0 B9 `! |; r

  35. 0 j! ~2 B" P0 `/ Z1 h9 t0 Z1 m
  36. #include <mach/memory.h>
    $ ?# h) v$ `2 w5 S- B+ P, `; y
  37. #include <mach/hardware.h>
    + J& Q7 [0 j6 s  ?/ S. r
  38. #include <mach/irqs.h>
    9 X. w/ @# u4 W  e# d6 Y
  39. #include <asm/hardware/edma.h>9 X; q% B( p; J# P
  40. ! `9 q8 A6 p# ^( @! ^
  41. #undef EDMA3_DEBUG
    5 k( l# t  a3 P
  42. /*#define EDMA3_DEBUG*/
    5 w$ N0 I8 o9 _! H$ c

  43. / N( ]' c7 m% D9 b. ^/ C
  44. #ifdef EDMA3_DEBUG) G4 F% g" _4 Z% M% g  [4 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( c: f  \$ K/ p0 T1 u0 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 `/ N- q2 J6 o* d: d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i) w$ r+ u& j
  48. #else
    3 ]( G- j" i! S7 u9 X
  49. #define DMA_PRINTK( x... )' h0 c1 Q1 A) |9 ^, ?
  50. #define DMA_FN_IN
    ! ~- j. H) e7 d3 P, q* R+ Z
  51. #define DMA_FN_OUT
    6 I2 z" @1 f# \3 I+ r0 Q0 L" m  @) O" _
  52. #endif. W4 f0 w4 H) F- X& h2 N1 c
  53. 1 M* R2 G4 O! ^! T, c; H5 o1 ^1 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ i; d* l1 g1 W. }. o
  55. #define STATIC_SHIFT                3" B! h4 G( @* Q$ c+ ?1 h
  56. #define TCINTEN_SHIFT               20
    7 E5 d/ z1 ~- R1 l) l4 y
  57. #define ITCINTEN_SHIFT              21
    + E" a' p# P% N2 W8 v+ p% t
  58. #define TCCHEN_SHIFT                220 S5 o* N* T8 ~% ~
  59. #define ITCCHEN_SHIFT               23
    3 T9 G6 \7 }) p+ M4 L  a; u8 O

  60. 9 g, x- b. p: l$ p5 y
  61. static volatile int irqraised1 = 0;
    ; b1 r" F8 F- b2 E3 Y  [
  62. static volatile int irqraised2 = 0;+ ~. g8 O4 s' t+ s6 @  X: e

  63. ! E. l( A) f1 w( ?, l  n+ D; ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 I' B# d! _4 U7 }! w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v8 X. D. w5 b8 X8 `* [. N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 k1 p) F& Z) n1 u* v% j6 Z

  67. - ?; ~5 i2 ^4 N+ r' S
  68. dma_addr_t dmaphyssrc1 = 0;
    ; K# c3 x! i# ~" ]7 |( A4 N
  69. dma_addr_t dmaphyssrc2 = 0;2 g0 b& j7 F+ Q3 Y! H7 ]& N% F
  70. dma_addr_t dmaphysdest1 = 0;
    % {. J" |6 a. A  \7 h
  71. dma_addr_t dmaphysdest2 = 0;
    5 U* i' [5 C' U9 c& H# ^0 l

  72. + J; e1 N) X! U  ~3 ^4 W
  73. char *dmabufsrc1 = NULL;! L2 P0 z; D* J  H* C
  74. char *dmabufsrc2 = NULL;
    + ?9 U% w& H9 g( v
  75. char *dmabufdest1 = NULL;+ b5 R3 v0 b' j% N; J
  76. char *dmabufdest2 = NULL;
    - @7 X' Q+ }8 ~' a  J; c: {

  77. 7 {! o( ?  a. M  w
  78. static int acnt = 512;
    0 b0 w* Q& o3 ^: [4 t' i8 Q
  79. static int bcnt = 8;
    5 ^7 @  v. e9 ^2 @& A/ n
  80. static int ccnt = 8;
    0 F' {7 Y+ C! G

  81. . ]8 f! n) B. A% M% y; F" K
  82. module_param(acnt, int, S_IRUGO);
    . E* R- I# t0 D) Z( r1 Y5 y4 v) c: _6 i
  83. module_param(bcnt, int, S_IRUGO);2 E2 ~! ~; R# `: t$ x$ g) W, q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ^) D: k- I3 Q9 i* L1 e+ Z- a( d3 C$ E& K; v5 H4 w0 O1 X" S$ w1 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. e* F) a5 _4 s- M4 b9 Qarm-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 h7 ?  V: v  q: K* S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" d0 L* w3 u6 c9 P) Q; Q  g: i/ S, }% C4 [$ b6 i0 v. [! z1 l6 \! K
/ c( o; X$ p, r8 h  ^$ N* ~1 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 08:26 , Processed in 0.038590 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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