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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" v. O! R; v6 v, s: Y
  1. [code]EDMA sample test application
    7 a- P- F! ]  V
  2. /*
    0 @/ k8 ?; `* s) C
  3. * edma_test.c' `$ E! S0 E7 A% S
  4. *
    ; N& g3 S1 @7 I# H% z; c8 R
  5. * brief  EDMA3 Test Application
    ! ^( k& h2 E+ Y/ L) J8 F& F. g
  6. *
    0 ?# f: _/ {+ X$ O
  7. *   This file contains EDMA3 Test code.
    5 Q3 J! h: X. v
  8. *
    / o4 V  a- J- M, a3 ]: B" l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , F$ s/ S5 [/ J4 [  U4 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- S4 f7 I; }' h2 S0 f! t
  11. *         TO CHANGE.- O7 f7 w: o! G% r: k
  12. *7 l% V* V0 B# a9 ~! J; a" O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 M4 n6 S  q2 z: H
  14. *4 R' J" `6 {8 x
  15. * This program is free software; you can redistribute it and/or6 @( i- S2 V, O' n5 V/ A
  16. * modify it under the terms of the GNU General Public License as
    6 L' h6 x- A% ?1 h
  17. * published by the Free Software Foundation version 2.0 n; x  P0 E# i
  18. *' ~+ l" d: t8 e+ p5 x: s6 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ^/ ~# F- Q$ Z3 z
  20. * kind, whether express or implied; without even the implied warranty. i; I9 M/ u/ X3 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & L2 `7 h1 Y( n% w: g" j% o
  22. * GNU General Public License for more details.& s+ K4 E8 \% j0 }, V# M
  23. */
    $ i- a' ?, F0 A0 {! B

  24. # |( W6 f1 e- z5 x3 z- O
  25. #include <linux/module.h>8 G" q0 A& S9 c2 t, Z( _* c
  26. #include <linux/init.h>/ i' r4 V4 P* c0 c# }, Q" f0 |
  27. #include <linux/errno.h>' {0 R# m% t9 `' s7 b
  28. #include <linux/types.h>
    % ~8 {* Z. ^8 V) ^/ o+ X% J
  29. #include <linux/interrupt.h>
    / q* r6 _, D, m
  30. #include <asm/io.h>! W2 b' ~+ {" G, S* @: \
  31. #include <linux/moduleparam.h>
    ' [5 V4 Y( I1 N
  32. #include <linux/sysctl.h>( ^  E! f- y, e* Y4 [4 m( L" Y- R( J
  33. #include <linux/mm.h>* f9 G  v' E0 K( U# S+ x! W
  34. #include <linux/dma-mapping.h>' e5 n( J1 X# h( b( e7 R$ u

  35. . o* a, E2 {* M; b4 I0 P
  36. #include <mach/memory.h>
    4 U3 j. W  F( j" ?" h2 j
  37. #include <mach/hardware.h>& u  ~) r6 v' w( S
  38. #include <mach/irqs.h>  ^& g( V7 S; }) K! j" o
  39. #include <asm/hardware/edma.h>" y" u2 c- G' c" T( t  N; s8 R

  40. / Q7 f1 g- W  G+ l/ K( _2 [4 R/ {
  41. #undef EDMA3_DEBUG9 j" n7 o& A- n* p9 {+ ^
  42. /*#define EDMA3_DEBUG*/' X; p0 f3 m8 X& B
  43. / [8 a" k" G+ ~8 A3 A
  44. #ifdef EDMA3_DEBUG
    5 C! W% u! W+ @$ D* g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ^% c7 U3 B* Z1 E5 S/ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- X' u; r- J. {; Y2 r. q  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( W2 F. |4 m; z* f! I  D
  48. #else
    , {# {( w- }2 ^/ \
  49. #define DMA_PRINTK( x... )- V0 ?2 f& [: p8 R0 p8 e
  50. #define DMA_FN_IN; V( w0 m5 _( u9 t* z( V+ u; T
  51. #define DMA_FN_OUT
    ! G# R: h* b7 h1 Q+ `0 |7 I
  52. #endif
    : @5 S% A9 G. D0 T
  53.   v: K9 x+ [  Q5 N7 Q$ ^, K+ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* J6 N3 j! |+ f8 s- u0 c: ]
  55. #define STATIC_SHIFT                3/ a9 Q! d; k$ |  p! B6 R' x. K% [
  56. #define TCINTEN_SHIFT               20  v/ h( T8 e( }6 W' y! \2 t1 C6 f
  57. #define ITCINTEN_SHIFT              21
    ' |( o1 _* E8 m7 P4 U5 _" w3 f4 O  P
  58. #define TCCHEN_SHIFT                222 r+ {/ m3 j1 h! h+ c# x1 s6 ?
  59. #define ITCCHEN_SHIFT               23, R6 p. a  n3 X) L

  60. ; I6 T7 [3 Y& A6 y( C
  61. static volatile int irqraised1 = 0;
    - \  r: {" g  _5 F
  62. static volatile int irqraised2 = 0;
    - H9 k& W8 O- X

  63. 0 f/ S9 A" J4 X' X; V+ v2 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 M, L$ k3 H4 I+ k- l5 v. S3 U7 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n* ^6 }1 E8 i  Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; d9 K4 @/ G( i" w2 W

  67. ! y' N2 h3 x" a9 K/ O
  68. dma_addr_t dmaphyssrc1 = 0;
    1 c. [6 @& C1 P9 d% U+ A
  69. dma_addr_t dmaphyssrc2 = 0;
    " Y6 W* R/ r# E3 V
  70. dma_addr_t dmaphysdest1 = 0;
    4 W1 c- }' ?$ T) C
  71. dma_addr_t dmaphysdest2 = 0;% g( v2 Q$ H9 \- L+ h& I
  72. . G0 Z- E$ G. J1 n2 q
  73. char *dmabufsrc1 = NULL;- z% F1 w' m7 H; J, o: @$ t
  74. char *dmabufsrc2 = NULL;
    4 J7 ~  _9 E5 R4 e
  75. char *dmabufdest1 = NULL;
    * v) C3 E- W2 ?$ p  W
  76. char *dmabufdest2 = NULL;
    4 v! j) ^" D$ ~' f
  77. 1 N. |$ s, ?1 B- c' v6 h6 s& Y- E( S
  78. static int acnt = 512;
    7 r0 g# H# [' M+ j
  79. static int bcnt = 8;
    9 d! N. S3 Q2 T4 Z# s2 O  x' p; Y
  80. static int ccnt = 8;
    , Y- U! h; r7 w0 T, Y6 J# A5 N8 v

  81. / W6 q  n) M. H$ ]( T+ f" Q- F/ F
  82. module_param(acnt, int, S_IRUGO);
    8 t* ]! O9 ^. t4 Z
  83. module_param(bcnt, int, S_IRUGO);
    3 S9 |2 @; N4 J: l" ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 S) L8 V4 E& ^; n/ J! o+ c/ N
5 o" _, O! }& W! s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 K$ X# l4 B/ i- e! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& q7 N$ H4 i7 R) q5 z7 X! D$ K# q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 K* ^& Q& a; @

, u! B' m9 L/ _' [  s6 w- V; g1 S7 J) J9 p: Z1 _1 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 21:59 , Processed in 0.039505 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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