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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; `% J: S& B$ G7 R/ R1 F- h7 ~. v
  1. [code]EDMA sample test application2 l! p, U1 n$ U! c- c" C9 X7 S
  2. /*
    ' n/ K5 @# ^5 z( I7 w& r: F
  3. * edma_test.c5 F' I/ E9 P$ a
  4. *  C3 J/ x8 q; }5 c
  5. * brief  EDMA3 Test Application, y5 T7 \( i- R$ y, u5 S  a
  6. *$ I- }2 Q2 C# e+ l0 o; P
  7. *   This file contains EDMA3 Test code.
    3 Y# \0 \6 l2 W! y' [5 S
  8. *
    9 e* k+ C0 i9 ]$ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; W2 g- |  Y9 t4 Y5 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' m9 t0 v6 M  j' Z. Q
  11. *         TO CHANGE." x, a$ y) i. h3 ?9 [
  12. *
    - _: g. w( l4 T( Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + n, G6 `% P+ X4 I# u
  14. *
    ) d4 j" h; P' ]7 P
  15. * This program is free software; you can redistribute it and/or& e; @9 ?* a  A+ A; B' l9 V
  16. * modify it under the terms of the GNU General Public License as, |* E& y5 p! F
  17. * published by the Free Software Foundation version 2.
    $ B: w7 l0 c# ?6 E
  18. *
    . D5 I$ O& Q2 g- e6 n" Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / T$ E- d; G- |' @7 O
  20. * kind, whether express or implied; without even the implied warranty7 W4 z; z8 D. N3 X4 V7 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' [5 D$ @" y" R+ x4 E7 L- q
  22. * GNU General Public License for more details.
    ( Z  l& M0 x' I7 x, }# k% \
  23. */: f3 ~; Z7 [6 ?' O+ s" [2 y
  24. # a: \1 {) P. {
  25. #include <linux/module.h>. H' A" y. F' d
  26. #include <linux/init.h>. i) k7 g2 d/ l& u  m* `" ?% `
  27. #include <linux/errno.h>+ g& v: w' F6 `8 \
  28. #include <linux/types.h>
    7 V9 J! b. {, A3 K, y- A, n6 b3 x
  29. #include <linux/interrupt.h>
    0 h% N: x( o3 x( p$ H+ m
  30. #include <asm/io.h>8 I7 l! S3 D: p* {' {3 f! ^
  31. #include <linux/moduleparam.h>
      T; H4 G7 U( Z, d) D
  32. #include <linux/sysctl.h>: ]& t( U  f9 l+ }& v: y$ Y( Z
  33. #include <linux/mm.h>
    , f, Z( q" y  f1 z3 L% N# S! o
  34. #include <linux/dma-mapping.h>
    , q. Z4 ^2 q- V& [; j
  35. - q% r6 C5 j0 q
  36. #include <mach/memory.h>
    " k, K- p( n3 j0 R
  37. #include <mach/hardware.h>7 {& i5 p3 y& ~
  38. #include <mach/irqs.h>
    * J9 w( x$ }8 k; l
  39. #include <asm/hardware/edma.h>
    0 ~6 O' l3 B# a6 M5 L% N

  40. 9 L# N% h7 `; O5 ^8 v; t2 q
  41. #undef EDMA3_DEBUG
    3 f; A, I+ e  ~& G8 l3 j; L% @3 Y
  42. /*#define EDMA3_DEBUG*/
    1 I: P9 c2 W6 |; @! v
  43. 7 i0 G! C* p8 ]$ X
  44. #ifdef EDMA3_DEBUG
    - @+ Q. N) T) U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , V* ~& a7 y2 A- N. A2 R4 n0 P- V- I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 |" }( U( ~4 L4 f. _8 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). F! @3 R9 U* ?. J" N
  48. #else
    1 w9 T8 r) ~. O$ p% ?
  49. #define DMA_PRINTK( x... )
    $ D5 n! F6 d: H
  50. #define DMA_FN_IN2 @& _4 l4 @$ ]8 D* s
  51. #define DMA_FN_OUT
    ( H: d0 {# p: Q! J* N
  52. #endif
    6 Y( v6 o  n% W

  53. 4 X  `* S% N* k' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 d$ u9 w6 T0 k3 m) U8 k6 e
  55. #define STATIC_SHIFT                3
    # ^' o. P. d* \+ h( A  E
  56. #define TCINTEN_SHIFT               20+ ?# l5 d& ^1 U) e) [, D: y8 v
  57. #define ITCINTEN_SHIFT              21
    / z0 x) n- n: D+ J" V/ \& W
  58. #define TCCHEN_SHIFT                22/ w. D" a; n/ u: t+ t9 {4 i( z( ]* j
  59. #define ITCCHEN_SHIFT               23
    ) V5 ?3 P, J  E0 h% M
  60. 1 f" H0 K" a3 o. Y0 L2 v0 Y# S
  61. static volatile int irqraised1 = 0;- L* ^$ e: g2 f
  62. static volatile int irqraised2 = 0;
    7 |9 F) q2 H- p8 m# o

  63. 6 Y! F: s* l$ _) z8 c- R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @3 F" r' Y( i  F2 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& v6 o/ M8 c, \! u& k' I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 y$ `. Q5 W. |% P
  67. ! P9 [2 z* R$ o& Q4 d) {$ h% i
  68. dma_addr_t dmaphyssrc1 = 0;6 u2 W9 s( a9 i# d$ z
  69. dma_addr_t dmaphyssrc2 = 0;
    ! g1 c! |+ W* \0 {7 W+ V7 I
  70. dma_addr_t dmaphysdest1 = 0;. d3 k6 n5 S$ {: H2 X: E% w, m
  71. dma_addr_t dmaphysdest2 = 0;8 u) F' {( f. a5 Y) a5 B
  72. 2 H: h% W/ A( r
  73. char *dmabufsrc1 = NULL;
    4 u9 b9 m/ @6 f" O( g+ h' j$ P3 [
  74. char *dmabufsrc2 = NULL;( L* o% U$ v  \, u- @! x# x
  75. char *dmabufdest1 = NULL;
    3 ~  V2 n2 d. f/ V% o5 h3 w' n4 |
  76. char *dmabufdest2 = NULL;& y. X1 N, h# K, R- t  w

  77. 8 _+ y$ Y% T$ Q0 y+ q
  78. static int acnt = 512;
    9 a7 y- S; M! p3 h: K' n
  79. static int bcnt = 8;' v( O$ j2 j2 U! G$ x) M4 \
  80. static int ccnt = 8;
      ^% T: p1 x% Y' w$ j0 H, ^

  81. # e# ~9 [" n0 |' s  m
  82. module_param(acnt, int, S_IRUGO);
    8 ^! U6 E2 J- t# R$ J
  83. module_param(bcnt, int, S_IRUGO);4 }1 G8 [3 Z* B7 P1 z( j+ a6 l9 j+ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 M' O: p' J1 D& S, V3 \
+ p# q. y" t5 L7 P  C. _* O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 X5 y* }* E  ~6 t7 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 T' B. V. i/ w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Z" p) A  A! H* _- J# v! `+ J- L/ @' h2 H/ |2 Q- ^. Z& Z6 X

- I6 Y% m% x2 ~8 b! v$ Z% D, t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 00:44 , Processed in 0.037285 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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