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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O7 U6 N7 E& t% Z# f4 s, G
  1. [code]EDMA sample test application
    7 j/ }1 s; K8 H, X8 c
  2. /*
    8 n) U+ q; k* A# v6 z1 ]! f
  3. * edma_test.c: l) j: x# r4 S9 Q! Z
  4. *! S1 x8 ?; S9 C9 g1 t1 O4 y& G
  5. * brief  EDMA3 Test Application
    / ]% E- v4 t; D9 B1 j6 [# D
  6. *
    ) r. W: W2 A8 _2 Q# `
  7. *   This file contains EDMA3 Test code.1 D$ Q, l8 L, G- |5 Z2 F$ X, S
  8. *
    5 Y5 V5 w5 C+ D, Z+ B7 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 y6 X" f; ]2 y& A. |3 y7 I5 h& q0 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + L& T/ H5 J% S* q$ n
  11. *         TO CHANGE.
    8 Y  l  @/ F. |  S1 {2 [" \4 G" V
  12. *& {  d  `; v6 V5 g! r" r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 a9 x2 g1 Q, ]1 \# r
  14. *3 X6 _3 n- |7 }. B  l, T; k3 |
  15. * This program is free software; you can redistribute it and/or
    2 t8 c9 c, D/ Q$ v% S& o6 p9 `+ I9 z
  16. * modify it under the terms of the GNU General Public License as
    " o/ _; P; Y( v3 G
  17. * published by the Free Software Foundation version 2.
    : C. r4 b0 D7 Z
  18. *
    ! B' w' g( t  X- m: t4 l' c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) J1 [9 |# B: `0 S
  20. * kind, whether express or implied; without even the implied warranty2 B2 p; `# F# P9 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 I9 K8 g! y2 I: `  P
  22. * GNU General Public License for more details.4 z/ Z: w9 R( H" E
  23. */
    + N0 l& D/ O( w$ @# a* d" ^

  24. 7 a  q: X) Q5 _9 A& R  ~
  25. #include <linux/module.h>% G% n' ?3 P$ y& ^6 i- @9 x
  26. #include <linux/init.h>
    5 S5 k: b# E1 o! ^9 g, `4 Q8 P; A
  27. #include <linux/errno.h>
    % h$ }4 D- }' k, O  n
  28. #include <linux/types.h>5 {6 Y6 X2 H) H) ]: R! f' O
  29. #include <linux/interrupt.h>, Q4 F8 q9 i& P
  30. #include <asm/io.h>3 F, w8 f, z! _+ i7 I
  31. #include <linux/moduleparam.h>! T' n, n# ]* _4 o4 c
  32. #include <linux/sysctl.h>
    % I; ?; U0 U: q9 {  L( Y( d
  33. #include <linux/mm.h>
    6 L, T) w* w. ^
  34. #include <linux/dma-mapping.h>% N1 K7 |9 Y$ D% ?' I& @$ O0 n+ p7 [8 \1 x

  35. 5 ^+ a- B$ |2 X" g( k
  36. #include <mach/memory.h>
    9 v- O: P/ m9 {# z
  37. #include <mach/hardware.h>2 ?8 A! K2 ?' Y' g
  38. #include <mach/irqs.h>( U' @7 Q! y7 D2 z8 r0 x4 v
  39. #include <asm/hardware/edma.h>
    9 v+ i0 D; I! B0 m3 S& w! G

  40. 6 l) K% _3 I" @& D
  41. #undef EDMA3_DEBUG
    5 Q; n) i6 F  B% }$ {$ n5 `
  42. /*#define EDMA3_DEBUG*/3 K  V, ?2 G1 l9 ?
  43. 9 N6 q8 R+ z# P/ Y( M, P  \2 A! q
  44. #ifdef EDMA3_DEBUG- a6 }0 G) U4 p: T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 t: N1 F: t4 ^2 H. \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  B2 Y9 c+ o5 Q) W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , K3 @* w( G7 {# Z
  48. #else
    ! X! T( H8 Y: q* E5 L
  49. #define DMA_PRINTK( x... )' X8 X, _, c) X) L0 R
  50. #define DMA_FN_IN
      N# Z( Z' [7 ~% _' E. i" _
  51. #define DMA_FN_OUT( K9 y7 W3 z8 s; ]5 J" ]+ p$ g
  52. #endif
    7 f: U2 z, L5 f* j" V

  53. 7 _: Z4 i8 X1 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - k* g) }& m; K! e! O4 L
  55. #define STATIC_SHIFT                3
    ( R6 q7 z) l& a+ U& ]5 B
  56. #define TCINTEN_SHIFT               202 [1 L" P4 R7 v7 H
  57. #define ITCINTEN_SHIFT              213 j: G1 C! h5 D, {: p$ u  v- i
  58. #define TCCHEN_SHIFT                22
    $ e% b7 H4 g. L# u9 ]2 b
  59. #define ITCCHEN_SHIFT               23& |# D8 `5 D' F; j; |' R

  60. 8 C$ c# ]: ^! @3 d8 S- w
  61. static volatile int irqraised1 = 0;; W: w6 f9 R+ n0 a" v0 T8 u7 X
  62. static volatile int irqraised2 = 0;
      Y( P7 p- ?- Y0 ]- L4 h: m$ z

  63. - @" b" f6 H% B1 u3 Q/ f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d1 j2 Y! c- z% p+ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 L& ~6 A8 h8 @1 w0 Y' Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ m* ?( K) r2 [! o

  67. 3 V  ?& y, L, {# d
  68. dma_addr_t dmaphyssrc1 = 0;
    7 p/ R# A5 w. `- S: Q9 U
  69. dma_addr_t dmaphyssrc2 = 0;  K! m- _* l7 N% R6 K
  70. dma_addr_t dmaphysdest1 = 0;8 ?0 }4 W2 F9 I/ y4 t& h
  71. dma_addr_t dmaphysdest2 = 0;4 L2 J: `. M' u% H; ^

  72. $ ^, Z$ j2 D8 r+ t3 O1 I/ N
  73. char *dmabufsrc1 = NULL;: J7 L* p0 ?( m/ K
  74. char *dmabufsrc2 = NULL;
    & H' l* }/ |- x+ ~6 k
  75. char *dmabufdest1 = NULL;; _  L) ~, p. l
  76. char *dmabufdest2 = NULL;
    ) F: v. `2 q" l! v2 \9 u3 L
  77. - d7 `3 l/ w5 H' U5 H
  78. static int acnt = 512;
    $ T. j% ^' A8 @- Y* C+ j$ h
  79. static int bcnt = 8;) @6 Q% p0 t* b6 k. ?6 c$ L
  80. static int ccnt = 8;
    0 ~; h5 Q) W- ?5 N
  81. 6 A8 z4 d8 j) c
  82. module_param(acnt, int, S_IRUGO);$ P9 F& i1 U7 T9 D% E3 G
  83. module_param(bcnt, int, S_IRUGO);3 j$ e  q$ q. f6 }: |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 N9 M3 Z. ?! }& k: F( Q& X% ~6 U9 O" C1 P9 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) p; V9 N2 Q/ Y0 ~- v, s% b$ |% d+ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 i3 p; X3 w$ K9 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O$ W& g& t7 Y& a/ ^% m8 }& D7 a9 ?) P! G; e% ~! P% ?( e7 R/ f

* c* L8 v* G6 T% H& [! W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 12:04 , Processed in 0.039920 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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