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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 i7 [1 U1 S( N8 W$ K; Q
  1. [code]EDMA sample test application( F0 G  v& ?9 m  b* e! ^6 O- v! J
  2. /*; O6 X' G7 M. J% v' [0 J. z4 R+ X# T
  3. * edma_test.c
      a- t4 d1 f9 i* e' {) e1 ]% o
  4. *
    ' ^- J- Y4 P+ I5 _) M* Q, H
  5. * brief  EDMA3 Test Application
    # [5 @# Y( h. z% n% Q. A
  6. *5 F" X: j% x, Z% ^0 V0 J# G
  7. *   This file contains EDMA3 Test code.
    $ F8 K7 y2 I$ i: N5 j! h
  8. *
    0 d/ U( K+ F9 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " O+ [- @6 |1 R& k5 _& }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 d% C( W* ^% i7 @) M: `2 W2 U* G
  11. *         TO CHANGE.* X0 i- r  B* E- U
  12. *
    6 w3 {) e- g* q  Y( G, [" C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 T) l8 u* c, ]1 y/ w, Z6 z
  14. *. c. \3 c+ Q9 G7 {
  15. * This program is free software; you can redistribute it and/or2 r( g4 z! H# X
  16. * modify it under the terms of the GNU General Public License as3 E5 O6 c9 \; j
  17. * published by the Free Software Foundation version 2.1 b; [* Q# }9 f6 T) e; x
  18. *
    6 A/ J, a6 Q( \4 t2 t0 W5 M' S& `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) e, M  `6 }) s2 o
  20. * kind, whether express or implied; without even the implied warranty* ^3 w+ @( a; {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 P% `$ J: l  q/ `  z# V1 ]
  22. * GNU General Public License for more details.
    ; {* c* v7 V& ~7 d: M' a# C6 ^
  23. */( O, `. A# M# _3 r

  24. 4 ^( b- b8 i3 f* u* ^1 N" V& O# U
  25. #include <linux/module.h>: ?- E; c1 b4 `+ f7 {8 w6 o
  26. #include <linux/init.h>
    % `* B' p6 r9 |/ S- O! l" m
  27. #include <linux/errno.h>
      W% ?0 R1 W' A$ F" r% O
  28. #include <linux/types.h>8 I8 j& x5 g  Z9 N% R3 P
  29. #include <linux/interrupt.h>
    ! @) c  v1 S* K5 ~- \; m
  30. #include <asm/io.h>
    # _& S, Z8 l7 N
  31. #include <linux/moduleparam.h>
    , l! z2 A* s1 ?1 L  S3 U0 |+ D! H
  32. #include <linux/sysctl.h>
    3 }/ d+ S& `' m& f: V4 x
  33. #include <linux/mm.h>! `2 X- e; Q- R! {: _1 l
  34. #include <linux/dma-mapping.h>7 U% r/ C7 ~! G% A+ ^7 ?7 I" K
  35. 5 n9 z7 p, g( Q5 _* Y* h
  36. #include <mach/memory.h>: L9 `9 E# N7 E2 x- l& T% J1 Z
  37. #include <mach/hardware.h>
    7 v" ~+ D0 Z# Q  _, d
  38. #include <mach/irqs.h>/ c4 A0 T/ h3 n
  39. #include <asm/hardware/edma.h>
    & D4 _) F4 ~! B& y: F! e) \
  40. 4 B( J9 K. |6 e0 R% m& `+ y
  41. #undef EDMA3_DEBUG
    0 O! o; _7 Y1 t4 `5 a3 E: q. O
  42. /*#define EDMA3_DEBUG*/  m: o! n/ g8 X1 H, T! P+ i" r
  43. ' [3 _4 y7 ]& f3 W- l7 r
  44. #ifdef EDMA3_DEBUG
    + w  v: [6 [0 P$ q, n) ]0 E. N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . y- R- C2 N- g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' d+ G* }7 S. [: F# {0 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P2 @  Y. k. Y9 E
  48. #else% a. a2 q" i% _% l; H1 Y$ C! ?. u: @# Z
  49. #define DMA_PRINTK( x... )
    # X3 Q7 h: f/ V  O* s$ c
  50. #define DMA_FN_IN! J0 S+ I" n: T# Z, ~9 N
  51. #define DMA_FN_OUT" }" A! c9 H: m4 g
  52. #endif
    , W" k- ?# ]) r2 N4 P! q0 r
  53. 7 l3 i8 B+ c. f0 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + q% P+ k+ o. m
  55. #define STATIC_SHIFT                3" \; L7 ?2 d. _6 H2 N
  56. #define TCINTEN_SHIFT               20+ g3 Y/ b6 F& m( V( D3 t# j7 u
  57. #define ITCINTEN_SHIFT              217 q4 S. M2 c* i' b4 s: s5 ]9 a
  58. #define TCCHEN_SHIFT                22
    : G7 e4 g1 R1 V' M5 z! V" J/ k
  59. #define ITCCHEN_SHIFT               23
      ?5 P7 s% n3 i+ |: u

  60. , b% e5 X! N6 P: D4 ]
  61. static volatile int irqraised1 = 0;/ F/ i5 e, D# _# A+ a! |
  62. static volatile int irqraised2 = 0;: t& F( {" n/ F. ?9 |) b/ h+ ?

  63. # n  b' l3 q5 K" k( `% `: H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y# _( j4 c7 ~; `, r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( }9 }2 f6 t1 r' r9 [' G  B$ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : E' o. ?( v$ @1 q( ]' T
  67. 3 c% r& }% z' c9 Y( z7 w4 J$ [
  68. dma_addr_t dmaphyssrc1 = 0;
    # ]6 v+ c  _+ }* h. o
  69. dma_addr_t dmaphyssrc2 = 0;
    - d6 Z0 s7 l$ {$ {
  70. dma_addr_t dmaphysdest1 = 0;
    7 V0 Y- z  U6 D7 S
  71. dma_addr_t dmaphysdest2 = 0;- c7 P' L2 d6 C. Z% U
  72. 2 c. L/ v1 W' ^9 l+ s
  73. char *dmabufsrc1 = NULL;2 R; N7 v- M  n. v& B! F* N
  74. char *dmabufsrc2 = NULL;
    : W9 S% \5 r9 t7 ^- P
  75. char *dmabufdest1 = NULL;
    , c4 c5 f) A* r$ {$ t4 _5 d$ l
  76. char *dmabufdest2 = NULL;: y; W/ ~: l$ _& M+ a
  77. " i3 d$ G( x1 l6 N
  78. static int acnt = 512;
    ; ^4 E: d2 Q  N! E( `
  79. static int bcnt = 8;: G0 L  H- d/ A! L6 D' S
  80. static int ccnt = 8;8 R0 Z! y# K6 J3 `
  81. ; u; p7 W9 E% H, r( j
  82. module_param(acnt, int, S_IRUGO);. B& z6 T" _' V" u! ^
  83. module_param(bcnt, int, S_IRUGO);
    6 u1 T$ p- D! S+ b7 e0 H$ g* `2 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 q6 \! z1 d! \2 J1 C9 G
; {7 I7 u2 _' W- G/ D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; b4 H0 K4 k3 N3 [3 z8 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 P  W$ A! ^. @4 V& z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 g' a$ R* f! H
$ k; j7 U% T- ]) Q9 o/ G" N$ x7 e8 b7 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-6 13:56 , Processed in 0.045626 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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