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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |* ]" d% T6 A. e
  1. [code]EDMA sample test application4 F, I4 ~8 L) w0 k' r9 ]; G
  2. /*, m( n4 `) L5 u! b5 u, ?
  3. * edma_test.c
    ! d4 ~+ _* T6 i; m
  4. *) w5 T5 {9 q/ h. }, a
  5. * brief  EDMA3 Test Application
    7 v: U: N, j4 O0 J2 l
  6. *1 {/ G$ q" A0 B
  7. *   This file contains EDMA3 Test code.
    9 G( E1 ?% }" G! Y% \8 g
  8. *
    0 M2 E# f, Y* V. k/ b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 M4 b$ F# c- N  a7 ~/ X/ {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , {8 Q" \6 C8 w7 X5 Q& j
  11. *         TO CHANGE.2 ]$ x! C6 w2 {) Y- w
  12. *
    / G! k1 C+ L/ K- N' M3 y* P* ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , b0 L* t  P" L" Q1 Z
  14. *
    6 U' \- o' o& t8 i& X1 G7 [
  15. * This program is free software; you can redistribute it and/or$ o' y8 [8 _/ ~2 j+ P
  16. * modify it under the terms of the GNU General Public License as# K$ T% ]' L  N: W! M4 [- l! B
  17. * published by the Free Software Foundation version 2.
    & @' `/ L5 z/ i9 K& K4 Q4 l7 O  B! O
  18. *$ F& e: v  L* g& l7 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ a# E6 A7 Q* T9 ]! g8 v4 t
  20. * kind, whether express or implied; without even the implied warranty
    6 s$ e+ X1 Y6 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 n% i- l0 v$ E: X& @( F
  22. * GNU General Public License for more details.- l# M& {. e" ~. @2 f
  23. */
    2 U8 c; O9 x. R+ a2 E
  24. * }3 y5 v& n9 A7 y2 O. l% s$ A
  25. #include <linux/module.h>5 N1 i3 Z( F! {/ g3 p
  26. #include <linux/init.h>+ `2 ?4 H0 e2 {1 C; p
  27. #include <linux/errno.h>
    5 J! s+ g7 j/ m7 r3 ]+ k' r
  28. #include <linux/types.h>
    , a9 p% j! H0 y) X4 j
  29. #include <linux/interrupt.h>5 A# I, K" c: g' ?- ^& s$ T
  30. #include <asm/io.h>
    ' A! p8 o7 p, F$ @$ ~7 _% u% t
  31. #include <linux/moduleparam.h>
    * I3 T% O! Z, K4 v4 _% @2 _- I
  32. #include <linux/sysctl.h>
    2 a# A! t; h5 t' K" ?( g
  33. #include <linux/mm.h>. q9 _* ~0 F5 z" }
  34. #include <linux/dma-mapping.h>
    ' `) L3 ]( r( w7 H9 j0 ?9 U

  35. ; n0 ?4 y) ^3 H* |3 R
  36. #include <mach/memory.h>
    9 O, s. Z% L/ V/ b+ w. U
  37. #include <mach/hardware.h>+ G  ?$ f% y- B3 ?) T
  38. #include <mach/irqs.h>4 [' O5 i4 U) O2 @0 o
  39. #include <asm/hardware/edma.h>
    * ?4 S) [5 F, \* P; V

  40. ' ]- R: ]6 U4 O$ Y7 }
  41. #undef EDMA3_DEBUG3 T; A% d8 Y; k4 `4 j
  42. /*#define EDMA3_DEBUG*/
    2 T2 ?5 n8 F8 J2 {
  43. " f. C; p6 X0 {
  44. #ifdef EDMA3_DEBUG+ G& k+ H3 `8 L' V2 ?' c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 h* x- }3 N6 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), D+ I; w  c  M$ n6 f7 ?( C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). o" {; y! `7 S# G6 Q8 \' ]
  48. #else
      `- r& F. V6 F2 H( m& X
  49. #define DMA_PRINTK( x... )
    4 t' e; Z3 r9 D  m
  50. #define DMA_FN_IN
    " B" b# D$ m2 P) U1 \' f6 N
  51. #define DMA_FN_OUT1 `# I8 o$ j0 u# I
  52. #endif3 V0 w! A8 {- `& z, B
  53. - W: m% T+ b' p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . }' o4 z8 [" z! G  H
  55. #define STATIC_SHIFT                3
    + w4 i& S2 h0 }+ s
  56. #define TCINTEN_SHIFT               20
    + i4 H" J% `# L8 b
  57. #define ITCINTEN_SHIFT              217 T4 Q' t6 @  I7 ~
  58. #define TCCHEN_SHIFT                22
    # s7 z: L! x. }
  59. #define ITCCHEN_SHIFT               23
    7 C- W% z0 s5 o3 b) c

  60. " e* o1 o% Q6 h* Z6 e& f! O
  61. static volatile int irqraised1 = 0;( |+ x! g. ^( Y& Q" N. t- ^
  62. static volatile int irqraised2 = 0;
    $ y. W5 x7 {* x" q, u7 G

  63. ' D- J# ?+ f3 S2 K* P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \0 B6 t- C" ]2 A1 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 t; m0 p( X9 @: C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b  r6 ~; H  p  Q2 `0 M
  67. 4 V& f* d  D' [( {3 v! N/ v, @0 `
  68. dma_addr_t dmaphyssrc1 = 0;
    ! w9 R, o0 n) v$ Z! C# q' @1 y9 k7 L
  69. dma_addr_t dmaphyssrc2 = 0;2 y7 }% w+ `8 f5 G
  70. dma_addr_t dmaphysdest1 = 0;
    " e2 E, H8 A; A/ n
  71. dma_addr_t dmaphysdest2 = 0;3 r% Z/ ~" `3 D0 I" f- z

  72. . e% B8 o% L4 k6 k
  73. char *dmabufsrc1 = NULL;
    # M/ Y( K" R: H! `# v
  74. char *dmabufsrc2 = NULL;
    + X( e1 Y9 }& |9 o
  75. char *dmabufdest1 = NULL;; @- Z& S! A" B5 y
  76. char *dmabufdest2 = NULL;4 l+ B3 Z8 o' b1 L5 Z5 d; k* z
  77. - K# a. w( ]; T5 j* ?% p; J
  78. static int acnt = 512;
    $ w/ d5 z+ }2 `4 h5 |8 k5 w
  79. static int bcnt = 8;
    ! v8 Z% `/ N; D7 V/ q  V- ^" G
  80. static int ccnt = 8;. ~4 k: k% m. e* B. H3 x

  81. % i- Q. X3 {+ O6 U0 G- r; Q
  82. module_param(acnt, int, S_IRUGO);
    0 S2 T# {8 @* A% g- f- n
  83. module_param(bcnt, int, S_IRUGO);. h. b8 a$ c6 f( [6 B9 }( H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: S5 J0 y& [* ]- R" A/ ^6 s* M. N9 T/ r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, U9 }) [4 A* V$ p# m4 Z/ H; M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 I7 R- n* n4 `- Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ^: ]  c1 I8 n% C  ~3 ]( n, Y8 a3 b) z0 @6 \
8 |' G& Y2 P& W! f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 05:39 , Processed in 0.043388 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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