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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; N7 `* }( m- h: K
  1. [code]EDMA sample test application
    . U( Q; \/ Z) V) o2 |
  2. /*
    ' V. {  n8 ^+ C0 f/ C8 }# s1 f# p
  3. * edma_test.c" H0 N- Z4 I4 n% l; s. A
  4. *9 W- m7 e- d, r
  5. * brief  EDMA3 Test Application
    / N1 [2 v; L8 `; p- y
  6. *
    $ r' P8 K; i' j3 j9 }
  7. *   This file contains EDMA3 Test code., N  T5 N0 B$ p4 A
  8. *
    - j' T$ {, A) B: t# t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , x3 D$ J9 }) q/ S. {7 I, `& A1 E. R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( U" V. }* j# E4 N' f
  11. *         TO CHANGE.% |9 p3 e" _5 b# J4 }  h
  12. *
    % |6 G6 g4 ?& v8 v, b$ ^, k! Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / K: P3 T1 M( S5 O1 ^+ i
  14. *& B3 R% y+ r8 N  V' w
  15. * This program is free software; you can redistribute it and/or+ S6 T. o" K, r& h8 a+ u
  16. * modify it under the terms of the GNU General Public License as- y/ ?$ T8 @  [2 p
  17. * published by the Free Software Foundation version 2.
    5 g1 o% n8 \1 ?  H0 S8 C' {$ E% l( E4 @* Z
  18. *3 u  T; \0 g( Y7 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ~- P1 [' Y4 L
  20. * kind, whether express or implied; without even the implied warranty1 o2 h( C9 ]. _- y7 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / s, F& _$ K9 a+ S. ]# Z5 e7 X
  22. * GNU General Public License for more details.
    6 B: b$ l  B0 ~& H3 w+ X# d4 X) }
  23. */2 a0 C+ l2 N. c4 V8 D

  24. 7 m5 h2 F1 `8 y# ^
  25. #include <linux/module.h>
    * n. a6 K6 s/ O9 ]/ P
  26. #include <linux/init.h>' r, ?8 ~' r& \" N" v
  27. #include <linux/errno.h>
    9 j4 X$ g" A1 V! N
  28. #include <linux/types.h>3 v% G1 i# k9 U
  29. #include <linux/interrupt.h>$ G3 b+ f; {8 C# }. n- o
  30. #include <asm/io.h>* u6 n2 k$ i) j4 M
  31. #include <linux/moduleparam.h>- ^' T/ ^. H& q* g4 Y) V
  32. #include <linux/sysctl.h>
    . Q' w# b0 ]8 m% z) w
  33. #include <linux/mm.h>
    : g# y$ o* e$ Q, l
  34. #include <linux/dma-mapping.h>4 t6 P' u; [- T

  35.   U3 w- f$ A$ c2 G
  36. #include <mach/memory.h>. N9 v  f. N; g1 v
  37. #include <mach/hardware.h>
    3 r1 W8 C7 E/ s% J
  38. #include <mach/irqs.h>
    $ _4 K# a) j+ y/ |5 N
  39. #include <asm/hardware/edma.h>
    / f8 O% U: C. g+ ]

  40. " W+ z( F0 u% t4 G
  41. #undef EDMA3_DEBUG, d+ f: n/ A# E, e0 H) X) O9 W
  42. /*#define EDMA3_DEBUG*/
    . V% k6 D6 I7 z& x  W* ?
  43. 0 e9 J# u6 r' Q0 B+ a
  44. #ifdef EDMA3_DEBUG
    4 g! d* z3 s! _' P; @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 w! q6 S* c# X, v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 x9 k, h5 U* R# E4 B7 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 w" Y: _! L/ N1 V4 V. P+ P  R) b
  48. #else" Q. g! p; L; Z& Q( r
  49. #define DMA_PRINTK( x... )
    : ]7 L  x3 l% j* R
  50. #define DMA_FN_IN! B; {. V: O8 b) Y7 x) j
  51. #define DMA_FN_OUT
    * i" R  C; P, E- z& q0 o- g/ B
  52. #endif$ V; [, G# `: j; C7 _0 y9 y

  53. 6 ~9 z% S0 W2 t7 ?& S: M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  `. H( u( q# N' F5 ^" H
  55. #define STATIC_SHIFT                3
    ; j. V$ ^  q0 }/ u' }+ g5 z/ C
  56. #define TCINTEN_SHIFT               20
    0 \  p& l3 O& Z, [# v
  57. #define ITCINTEN_SHIFT              21
    ( J/ T0 Y! t& d4 m5 q3 w& A& r
  58. #define TCCHEN_SHIFT                225 S7 U; T7 ]9 @$ ~  w
  59. #define ITCCHEN_SHIFT               233 B3 l& g8 v& c

  60. 9 k+ ?% m: s1 r  Q) E
  61. static volatile int irqraised1 = 0;$ }7 O; F* p! _- f9 J
  62. static volatile int irqraised2 = 0;
    ) \2 d+ p* Z& n5 x
  63. # L0 @6 c$ ?% T6 t4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h2 z" a& O  M$ _- x% b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# f( r8 v+ d& L, A8 Q6 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `% h4 A# Q* B, a
  67. 3 }1 r5 z- {5 [9 S# x! q
  68. dma_addr_t dmaphyssrc1 = 0;7 d2 T; v: O# f0 c/ k/ F7 H
  69. dma_addr_t dmaphyssrc2 = 0;4 Q, d( \% ^! H% {, @3 a- i
  70. dma_addr_t dmaphysdest1 = 0;
    4 }7 J7 b! P9 c, o' D! M
  71. dma_addr_t dmaphysdest2 = 0;
    . c* f! s: X1 J) H4 z
  72. $ c! d5 x. |, d( Q8 O7 q* l: U+ Q
  73. char *dmabufsrc1 = NULL;
    % W" _% p2 O3 O" V
  74. char *dmabufsrc2 = NULL;
    / \" x) L' p3 b; H2 G1 `, u1 W+ D
  75. char *dmabufdest1 = NULL;/ R4 v3 \+ G* _7 U( V
  76. char *dmabufdest2 = NULL;  s3 y5 d$ r+ [) A

  77. + y! Q' }1 ?. [3 e) I/ {8 X- ^2 X
  78. static int acnt = 512;
    6 ?5 y/ M5 g2 a( d* K
  79. static int bcnt = 8;  m# y7 W0 G7 U# _
  80. static int ccnt = 8;
    . ]. R, t6 r: P: f. [! ~7 ?' s: B
  81. 7 s' t( }1 N% t% p
  82. module_param(acnt, int, S_IRUGO);
      G9 ~* D: a, W# f
  83. module_param(bcnt, int, S_IRUGO);
    5 P7 [0 R3 k; c( s5 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) g( r' ~  U0 F+ N9 ]$ U2 C3 e4 g! s6 r& E3 c( s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- E( \6 k; ?/ C3 S& N$ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  Z  c  c! s6 w% v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 q% G# ?3 k9 c. H7 m! V: z7 w* f3 ]

$ z# ~! [. b" h4 _/ K! s1 b; U2 U* w. |3 X8 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 13:47 , Processed in 0.047745 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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