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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ y  _; h. E% l2 {
  1. [code]EDMA sample test application4 @7 z$ a  v* }, f
  2. /*
    ; [+ `0 m+ @+ l% o2 K: B" w% f( m
  3. * edma_test.c
    1 x2 N# t2 D, U  B6 t
  4. *
    : c: f  S# S$ B9 ]
  5. * brief  EDMA3 Test Application
    4 k6 |9 \; T- b
  6. *% w8 D' r$ A5 v  \, d
  7. *   This file contains EDMA3 Test code.( }0 f& D0 J4 y( \! q) r2 x) j$ N, v  r
  8. *
    4 n0 W% f7 C( s; N& J3 x$ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 e$ n: t6 }1 s: m" g6 i1 P9 |( @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 r" s8 j1 a1 j/ [
  11. *         TO CHANGE.
    7 e- @3 A5 l* L) X
  12. *0 x6 f* N! q2 Q2 ]6 d9 i+ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 ]2 O2 V9 O3 M( @! Z" L
  14. *
    ' q" n0 r2 b0 l. @9 {; p
  15. * This program is free software; you can redistribute it and/or
    + C7 ~& R9 L9 v: ]$ w
  16. * modify it under the terms of the GNU General Public License as  c7 Y  O" X" N, m4 @
  17. * published by the Free Software Foundation version 2.
    & y% j, p1 N1 C3 E& j
  18. *
    + T4 U  E$ `, O# M2 F5 s* m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 h8 ~) q! ^3 D$ V- @" f
  20. * kind, whether express or implied; without even the implied warranty2 S- g+ w) f; b  ]( K% N6 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , O; U5 u3 i% z6 q/ t
  22. * GNU General Public License for more details.. M: }2 A4 x" b# V
  23. */4 [% g( R+ b% ~+ M3 c
  24. 4 n. _3 p' h( y0 b/ H
  25. #include <linux/module.h>
    9 G: E+ {7 i1 s% w7 r2 @& e
  26. #include <linux/init.h>$ N& w. k5 d0 z% \
  27. #include <linux/errno.h>
    1 U# c0 ^6 T- }
  28. #include <linux/types.h>
    & O7 g5 d$ a% N6 J! X- `
  29. #include <linux/interrupt.h>
    - r3 B" N: d: n% F3 Y$ ~+ {
  30. #include <asm/io.h>
    ; Q" X$ C7 W8 X' g4 n3 A+ I
  31. #include <linux/moduleparam.h>
    7 M" K- F3 u; ~1 ^0 P! X' U
  32. #include <linux/sysctl.h>
    ' |' o. a9 J6 d. i% ]8 x, v
  33. #include <linux/mm.h>* }( F3 D, p4 R; q* N  l+ F! d6 Q
  34. #include <linux/dma-mapping.h>
    5 f$ v, |, Q2 h+ {/ E5 J* V; R- D

  35. 1 T+ ~- m, L  t; Z# ]( ^' ^- n2 g
  36. #include <mach/memory.h>
    $ I. g  o$ s% c3 o; T' d
  37. #include <mach/hardware.h>+ H8 ^6 a0 B6 A! [. E) x
  38. #include <mach/irqs.h>
      |" @$ z! B/ O
  39. #include <asm/hardware/edma.h>0 e5 t: P: `8 n2 J% H8 Z8 ~9 t, _

  40. " C, S" Z1 e0 L+ p, o  u- ?5 g2 m
  41. #undef EDMA3_DEBUG
    7 v6 F# f! e; C
  42. /*#define EDMA3_DEBUG*/
    + x8 e, r6 S  T# r; j& E

  43. + a, L4 d5 n. \8 {2 i* w( Z
  44. #ifdef EDMA3_DEBUG
    . ~( c# H+ |4 M# f5 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 _5 o  n6 z3 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" j7 u9 ^  j& n2 F& W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m! p7 Y( K3 P* ^% E
  48. #else
    ! F* M: R* g; T: w
  49. #define DMA_PRINTK( x... )
    ! O, _$ I2 k2 }+ J7 {0 ^) {# n: w4 h
  50. #define DMA_FN_IN; ^/ |6 g3 L" @# {7 C$ m9 ]2 L
  51. #define DMA_FN_OUT
    9 [4 e% ]# G. b! U0 ?
  52. #endif  X( b4 G- ]; Z$ V- M: @6 q) l( P

  53. ; p: T7 K, \  U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! G  V0 o& M1 u; x: c
  55. #define STATIC_SHIFT                3
    ) I/ x9 |' S+ `' d6 _7 J" X
  56. #define TCINTEN_SHIFT               20
    * ^0 B/ z9 L# w) s: R
  57. #define ITCINTEN_SHIFT              21
    & E+ j9 Z4 L# a& ^
  58. #define TCCHEN_SHIFT                22: U" m. W/ h. h* F4 d5 ]. K9 }6 w7 H& v
  59. #define ITCCHEN_SHIFT               23
    0 F: l( u7 |3 U* T+ ]
  60. 3 ^+ `+ ?- d1 v  \4 C3 j
  61. static volatile int irqraised1 = 0;
    8 z- r' l0 f4 H: C4 c
  62. static volatile int irqraised2 = 0;
    / |9 S3 s4 U+ [3 @
  63. 5 [9 y; Q: Y6 O7 i  z0 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % m1 V- I# M4 W) {, F2 `; v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 O( C/ ^9 l$ Y4 G6 Z6 q* N6 E8 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J# S3 D' T5 _: U; o% z

  67. 4 K2 H3 x+ Z$ ~. G9 f% B
  68. dma_addr_t dmaphyssrc1 = 0;+ ?) W; y! P( B. I, Y
  69. dma_addr_t dmaphyssrc2 = 0;1 C; F+ H, G; k# @6 w% f3 s- O
  70. dma_addr_t dmaphysdest1 = 0;/ I) t/ T. w# n7 s0 N
  71. dma_addr_t dmaphysdest2 = 0;4 W7 x5 I7 j+ F  t7 y* G/ s4 q

  72. & V$ R5 W, _' {8 M: q6 H& B2 m
  73. char *dmabufsrc1 = NULL;
    , [( _) l; w8 J. o6 ~/ S$ H
  74. char *dmabufsrc2 = NULL;
    " W: R8 E( ~+ `, q3 r
  75. char *dmabufdest1 = NULL;
    1 X: Z6 S1 _: L1 T9 h. P
  76. char *dmabufdest2 = NULL;
    / W+ }3 Y! {; G7 y# I% R

  77. 4 ?) l7 `+ ?5 k# |
  78. static int acnt = 512;9 W, s, e& s& o5 C+ ~( P. c, N
  79. static int bcnt = 8;& o- U6 }; f" _0 s3 T) `4 D
  80. static int ccnt = 8;2 O9 P5 d( \) w2 Z6 h/ n' B
  81.   F. s) I, k' r" O) J7 H$ k
  82. module_param(acnt, int, S_IRUGO);) p/ ^, V: b+ B* j. e( v6 ]
  83. module_param(bcnt, int, S_IRUGO);
    ! |2 e: i6 z" d- ]: W; W1 o# v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 Z$ A: m+ f5 h6 R+ X( e% C; |% d8 b" y1 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& S7 s8 P0 c5 F( L( W( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 M( y! r! H* {1 F1 K9 d3 F  X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B2 q! ?' u* L& P2 [7 z. C! S% ?3 i, r& Q; K  H# h9 U* o

0 u" Z4 ?; J' d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 03:59 , Processed in 0.042272 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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