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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   G: K7 u' A6 P$ S% K
  1. [code]EDMA sample test application6 ?2 Z/ C4 \: r. Y9 ^+ d
  2. /*$ z8 I& q, Z1 q2 H
  3. * edma_test.c
    / R$ e' x+ k/ W; b4 t8 {4 T
  4. *
    ; ?1 s5 c5 Z( \& u9 {: B# b
  5. * brief  EDMA3 Test Application
    ; y; ]1 `6 F# {. [. V
  6. *
    , h% }1 w& r: b+ P5 L% ~
  7. *   This file contains EDMA3 Test code.  s" u2 X/ N" a  s: {
  8. *  E4 M2 g* d  Z/ Y; k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / N" Q! Q; w, n- q8 \! ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " f) ]% I& h9 m
  11. *         TO CHANGE.
    ) R) R: k7 \2 F0 i8 {
  12. *
    8 y: p1 ]+ W+ m* `$ U+ r/ S& U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" i! K1 U4 S$ p
  14. *
    % J3 q* a( w' a6 h3 O
  15. * This program is free software; you can redistribute it and/or" U1 O" ~! \# ^* a1 `' V  a& J
  16. * modify it under the terms of the GNU General Public License as
    % a3 f9 e4 p0 ]# [) l1 U
  17. * published by the Free Software Foundation version 2.
    ) p( ?; h/ A7 k
  18. *$ ^  b; q/ u7 q! K5 r* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F) ^! ?$ R$ p8 x6 A' ?5 s" b" f4 ?
  20. * kind, whether express or implied; without even the implied warranty
    ( i! V7 |: n( J& H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 o4 n! f0 x7 A9 C' A+ X- W# H
  22. * GNU General Public License for more details." ?( g7 f2 O. i8 X
  23. */
    ' T) Q; c1 @: Q( v: G; T4 t
  24. 2 ~" s3 V' f9 Y5 {  b! j! S
  25. #include <linux/module.h>
    % V1 H! `7 E0 l; I4 z8 U5 ~& L
  26. #include <linux/init.h>
    / X  b" S% x; k- K) o: _
  27. #include <linux/errno.h>
    % ^9 d# W8 R  W( I/ U0 P
  28. #include <linux/types.h>
    * L: q& V$ M% p9 ?5 b
  29. #include <linux/interrupt.h>
    2 S+ i  U4 C. h, |' j
  30. #include <asm/io.h>
    4 m" F$ ~2 K7 H
  31. #include <linux/moduleparam.h>
    ! b+ K6 w* H4 Z% w% k$ ~
  32. #include <linux/sysctl.h>- y' W: V; R/ Y  ?$ Z
  33. #include <linux/mm.h>  H' _1 j# Q$ H0 w; I/ N2 M
  34. #include <linux/dma-mapping.h>
    0 r7 n( j$ p- v0 ^7 ?

  35. 1 V7 E, q1 O6 J/ \7 V) `: s5 w
  36. #include <mach/memory.h>( W' t: ~9 r  Q# ]
  37. #include <mach/hardware.h>: u( x1 G$ I5 P  V
  38. #include <mach/irqs.h>7 s5 B! T$ K- t6 [" P
  39. #include <asm/hardware/edma.h>+ \8 a2 n) Q% ]9 s- m: q

  40. ( Y3 z$ x* t. d1 h& `: \
  41. #undef EDMA3_DEBUG0 ]" L0 H1 L  E4 a. W0 u
  42. /*#define EDMA3_DEBUG*/6 A2 Y% P4 Z5 m% `8 m! T/ J

  43. $ E' o5 L7 f! [& b# z- {5 J% a
  44. #ifdef EDMA3_DEBUG
    % U0 I) u/ ^1 v) S- N" [" |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 Q, _' y! U/ X! H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 {+ I- y  U$ u: }. V4 q# i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 e/ x) t7 F- `6 a- M- {
  48. #else
    / Z& A$ o) S1 n7 \4 B
  49. #define DMA_PRINTK( x... )
    ; ^% Q6 h7 B& q) z3 H
  50. #define DMA_FN_IN
    . ^% a; f9 x1 N* c( F4 H- P7 x
  51. #define DMA_FN_OUT
    ) _  `8 G7 W; x/ k8 S# C6 i% h5 k
  52. #endif
      {. r' ]# v3 g- b: G: H% B: j
  53. 6 C! r# U. g+ q. j$ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # P! X9 p# u0 ]( X! v
  55. #define STATIC_SHIFT                3/ L" z, b1 ^' V* d
  56. #define TCINTEN_SHIFT               204 b5 a, g. ?% y
  57. #define ITCINTEN_SHIFT              21
    + a; q* v" V2 [  U# Y( R
  58. #define TCCHEN_SHIFT                22
    ' X1 O$ p, _8 d9 y4 q/ M
  59. #define ITCCHEN_SHIFT               23
    " j) x  Q" J" y; p5 c. |' w: n
  60. 5 P& y+ b4 p3 s$ M  J0 t+ l% y& Q: i
  61. static volatile int irqraised1 = 0;
    ; U5 G+ B) ]  a
  62. static volatile int irqraised2 = 0;6 ^4 t9 `5 y* u; ?
  63. 6 Y. s7 |; r% m! T, J1 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K1 e" n( D! |5 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ^7 [+ J7 x. e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 |' Q6 z$ j2 U' O

  67. 3 E) C- [2 g' Z+ `7 `
  68. dma_addr_t dmaphyssrc1 = 0;5 h& Y2 J# [; o9 v
  69. dma_addr_t dmaphyssrc2 = 0;
    % R& \9 ]3 A2 P3 O- J
  70. dma_addr_t dmaphysdest1 = 0;
    5 ~. s# A# f2 Z! N. O
  71. dma_addr_t dmaphysdest2 = 0;
    " }( g8 T; j1 ?
  72. / w+ ]5 n! z% k5 \9 P! v7 Z
  73. char *dmabufsrc1 = NULL;- A' [& Q. ?, v% A: H
  74. char *dmabufsrc2 = NULL;
    # a" A* c$ o  Z( f' @6 _1 y
  75. char *dmabufdest1 = NULL;& J. D/ e; j1 ?# p
  76. char *dmabufdest2 = NULL;
    - a. f& q% V% Q0 G9 g

  77. 7 S* V( P: Y* @) v- c8 @& Z
  78. static int acnt = 512;* S0 i: W" w& u' U( W$ K( t
  79. static int bcnt = 8;
    / `& S$ w- B6 m- \) T! ^0 z& S
  80. static int ccnt = 8;
    7 {8 m# v* n+ ~. D

  81. 8 z  D  u4 ~# G5 @' L( m4 k. o
  82. module_param(acnt, int, S_IRUGO);
    9 x9 u  B2 W' F. B1 d
  83. module_param(bcnt, int, S_IRUGO);+ f( {, s3 m6 G, O( z* f$ X+ _0 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% D' ^. v( W; k% B( x' n. |
2 u# H& N0 j- m2 M& b' m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, W- [+ n) _% z) G/ d3 L) h  W  B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 r8 R* d9 L( g; p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Q- j2 j: j& r8 T/ C  z% L/ F

- Q* H4 s0 q( W* Y4 Z" B( P$ m
% y8 h3 x) ^# T5 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 18:18 , Processed in 0.038819 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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