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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # _3 j% I+ S) O0 j
  1. [code]EDMA sample test application
    , L; X) _6 h" C# P$ g
  2. /*) Z6 E5 E% b: ~& k
  3. * edma_test.c8 O% S) p/ f7 X  F2 y9 s
  4. *
    8 \; J& B' n) b2 V) q& I! B- K
  5. * brief  EDMA3 Test Application
    % ~) X. I3 C% c+ Q  n
  6. *
    - p9 J) d" \" e4 G, |, M! U1 `
  7. *   This file contains EDMA3 Test code.( t7 u- r& k6 ^2 `2 [. p
  8. *
    $ @6 O+ b3 w( r" X6 y5 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 Q" m" A& ~6 D3 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 O( X& ^/ \) Z2 C
  11. *         TO CHANGE.
    ) d5 _- C% Q6 A" s
  12. *: X0 D: D- z& U$ n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! w! p* P& P. L" u3 A( \
  14. *4 _" F# c. @0 z: e2 U% v5 R2 }
  15. * This program is free software; you can redistribute it and/or  b" D5 A( r$ F9 I, z8 }
  16. * modify it under the terms of the GNU General Public License as
    2 y5 a" N  Y! |. m, Y5 x* h9 J
  17. * published by the Free Software Foundation version 2.
    8 I* u* @$ j4 D2 z. ~3 \# {
  18. *2 v" e+ W# |1 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- {2 W+ ^" s  U# W6 l
  20. * kind, whether express or implied; without even the implied warranty
    0 y! z! @: R' Y3 H% r8 i1 [8 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , I, [6 Y+ f1 {  X# c+ k4 B+ g$ ~
  22. * GNU General Public License for more details./ ~, F, n* Q4 C& o" |3 @
  23. */
    4 U6 O& C3 ]# d9 T. B% ?1 w
  24. + G+ U3 _& D1 e( Z5 H" \
  25. #include <linux/module.h>4 {  d/ E: I; H% W5 K( ^9 k* z
  26. #include <linux/init.h>- G- Z: \: g. w& J) G* n  {9 g
  27. #include <linux/errno.h>
      C, ^% t* W. @; S) Z* _
  28. #include <linux/types.h>
    . E& M5 k6 f+ [5 s( F
  29. #include <linux/interrupt.h>. ?+ i. w. e" ~) n8 M
  30. #include <asm/io.h>
    ) x/ y$ S6 c9 M8 C6 ?6 @2 z
  31. #include <linux/moduleparam.h>
    * f+ N* v! Q0 ?7 c& O0 l
  32. #include <linux/sysctl.h>
    2 D% p. ]" Y' V) s3 i4 T9 c
  33. #include <linux/mm.h>
    " q8 u8 a3 e( x( ?2 b
  34. #include <linux/dma-mapping.h>
    " q% l, k+ U. d% j
  35.   B4 l9 ]: q7 }8 g  r6 y5 |
  36. #include <mach/memory.h>
    , A9 E2 [5 T$ s/ \( t
  37. #include <mach/hardware.h>
    8 n# i" C. a7 ]
  38. #include <mach/irqs.h>: l7 `& d0 C' [. r
  39. #include <asm/hardware/edma.h>
    ' W; J& s/ D; [! X" u5 K3 `7 t, ^

  40. 4 I& h$ w9 w2 H/ {% v# M* _- K* A
  41. #undef EDMA3_DEBUG
    " L: B! `' X& O. u( b
  42. /*#define EDMA3_DEBUG*/! b' j- X+ J- [4 V6 C% H0 N

  43.   g9 [4 g7 [/ S9 Q! }4 o$ H
  44. #ifdef EDMA3_DEBUG* _' v2 @  @# B; a3 Z* x4 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 {9 L% Y& L; Y" G! t, P0 A4 ^- ?! F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D- m/ x3 L3 c' B7 P* L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). L3 D( o- ]+ k7 |) O. F& m
  48. #else
    8 d& o' g! I% w0 b
  49. #define DMA_PRINTK( x... )
    1 W4 [* Z( F. o+ v" N
  50. #define DMA_FN_IN, S$ u$ [5 |7 O" i# X. o
  51. #define DMA_FN_OUT& L0 t6 G0 i0 E9 [: w( w
  52. #endif
    / O( N* P) K. j5 g5 T

  53. / u; [: W: j: i+ x; h" B5 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 U/ [: ?5 W3 p9 C
  55. #define STATIC_SHIFT                3
    % |5 |0 G  k- _' j7 `
  56. #define TCINTEN_SHIFT               20* _" P9 x, o8 X4 v! H2 v6 w
  57. #define ITCINTEN_SHIFT              21
    & _: }! V7 H2 W
  58. #define TCCHEN_SHIFT                22- L( o+ a0 j) |4 x4 ~. G: B
  59. #define ITCCHEN_SHIFT               23
      r1 N% t+ _3 J" L& w
  60. 8 j5 W& U1 O5 D9 _7 y6 ?" K9 S
  61. static volatile int irqraised1 = 0;7 {- j! B* }/ {+ L0 Z  k- `
  62. static volatile int irqraised2 = 0;+ v7 n% d) D9 c2 c$ |0 a

  63. 4 s8 e) [9 p' U% M6 U( W( c* v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( [' K& X9 X5 d# S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 g3 e$ T% A' O1 k- [) q" ^/ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; T4 v- q; U2 d# m% z
  67. 6 a/ T; D5 N- F5 U/ {
  68. dma_addr_t dmaphyssrc1 = 0;
    & A. j, L# F! Q/ l3 K
  69. dma_addr_t dmaphyssrc2 = 0;
    2 w6 A' T9 I" ~+ D, ?" \1 \
  70. dma_addr_t dmaphysdest1 = 0;
    * d3 Y' F/ e/ k5 K: T
  71. dma_addr_t dmaphysdest2 = 0;
    / O2 _" u1 U2 s9 W4 |3 P" v/ _* v' M
  72. 1 C; F* C6 ^" U5 |
  73. char *dmabufsrc1 = NULL;% q$ {  a! H' }) d# O
  74. char *dmabufsrc2 = NULL;
    % I3 O0 v1 |3 S+ m8 W4 b
  75. char *dmabufdest1 = NULL;( X$ i# S6 q+ ?( n3 }/ B
  76. char *dmabufdest2 = NULL;& w4 ^" D" [% y
  77. 8 N. u# q2 I8 s
  78. static int acnt = 512;0 M& Z4 d5 a$ h9 Z1 j
  79. static int bcnt = 8;
    4 y+ P: `: D" G3 Q) i
  80. static int ccnt = 8;
    * O% r, z" Q. o. c

  81. 4 v9 `1 \/ B1 c( y+ m- ^
  82. module_param(acnt, int, S_IRUGO);
    4 D2 V, `/ A9 i1 q/ i1 d
  83. module_param(bcnt, int, S_IRUGO);& \7 v9 q! v8 k2 u/ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 U: x9 ]7 M+ l1 U3 \% h0 f9 d6 Z
- ^& ^& m; r: e  m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 t. n7 @. }& H* |. [' V9 F# Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; L/ v9 S# [! E5 w, D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 X* K" y  f- T8 W$ o& P& X. R+ \# s
( R  G' ]. Q& M: u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 15:07 , Processed in 0.039200 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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