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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ~8 T5 i/ N, j& A: D
  1. [code]EDMA sample test application
    ; a- S: P/ w9 ~/ ]
  2. /*/ f/ i- o1 T) l8 s, x
  3. * edma_test.c% \4 J) M! k7 [6 w* F  u
  4. *
    & ^8 Q" ]0 y3 M6 ]
  5. * brief  EDMA3 Test Application
    9 q3 v  e5 q% ?/ B5 d. j5 V  ~
  6. *
    $ W. n7 e+ q; P
  7. *   This file contains EDMA3 Test code.1 n9 q7 l- V. N- V
  8. */ w6 r/ ^3 ^* l3 B2 Y2 o' u# F) B7 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- t) X1 q! \% Y( H) J8 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ X" U" y; f+ {; f0 r
  11. *         TO CHANGE./ i4 x4 B$ Y4 G5 h
  12. *
    : ^/ J( ^) Z: p, X& ]' ~# }' p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) i3 E( V/ e# {6 U' n5 @
  14. *1 [4 K3 m8 ?/ @! w
  15. * This program is free software; you can redistribute it and/or+ S3 e% n1 F7 m' H; b  s4 E: v& N' q
  16. * modify it under the terms of the GNU General Public License as6 [+ i, ~  m+ H' m: w
  17. * published by the Free Software Foundation version 2.
    ( Z; e' j# o7 W: B5 T! G; i
  18. *2 v. I: Q, H% p' n  ?5 f) B6 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " ]+ a; y) P" {3 b
  20. * kind, whether express or implied; without even the implied warranty. G4 p* y2 r1 }& K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( a5 A) j7 U6 h- }2 \
  22. * GNU General Public License for more details.
    : ^' P  T" ], B/ j3 e  T6 b
  23. */
    ; h# |+ ~8 h/ g) v0 L7 X

  24. 4 f1 ?8 V8 H& _7 ~; F1 _
  25. #include <linux/module.h>+ h$ l: R1 x) N5 a9 g$ w% O: E! ]/ W
  26. #include <linux/init.h>
    2 p! A) G7 D. R4 S, Z
  27. #include <linux/errno.h>$ F* A6 x  b3 {$ }1 ]2 l1 [
  28. #include <linux/types.h>$ O  Y+ a. E& i5 ?- W" j
  29. #include <linux/interrupt.h>$ s! D4 N5 `, N( W% p
  30. #include <asm/io.h>
    $ @. h7 |1 \! X( b% r* s2 c
  31. #include <linux/moduleparam.h>: n5 m! T5 J7 L  `6 C6 a
  32. #include <linux/sysctl.h>
    ; n* B, C5 W  k0 m
  33. #include <linux/mm.h>& l2 C: y3 _# G6 o
  34. #include <linux/dma-mapping.h>; L! o( G0 |/ ?* C/ E
  35. 1 ~5 ]$ z+ \$ n5 s3 F: h1 S
  36. #include <mach/memory.h>2 h% J$ \3 |6 M$ o
  37. #include <mach/hardware.h>
    1 R- |. L7 \9 r+ P0 Z; k8 s. w) v
  38. #include <mach/irqs.h>
    % e+ l8 t& S4 V
  39. #include <asm/hardware/edma.h>
    % E5 n4 H# p: t" ?; f* S
  40. # `: F8 w  T8 ?  Z0 D! ?. W
  41. #undef EDMA3_DEBUG( @' S( R) @1 ?% O
  42. /*#define EDMA3_DEBUG*/
    3 O/ N0 R5 m6 C# T
  43. 0 N3 q) X5 U8 T+ i( m
  44. #ifdef EDMA3_DEBUG$ A4 a+ U: h0 c8 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # L% y% `; W; |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 R, r; `" r4 L% f5 Z. V6 R4 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 W+ `  X3 a* [
  48. #else
    & s4 j, A( U2 ^3 C- `! w4 _" ~
  49. #define DMA_PRINTK( x... )
    ' ~; `7 N5 T1 d
  50. #define DMA_FN_IN. u+ t! }+ z) i% Z7 V" d3 o3 [5 e
  51. #define DMA_FN_OUT% A7 y/ o- A4 O
  52. #endif5 M3 R- Z8 e6 E$ N6 I6 \

  53. " w1 x+ P$ g/ a. L7 G! j& x# [! b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 ~: Z0 o- N+ }) _% k+ n
  55. #define STATIC_SHIFT                3
    ! T" @; }. W: B/ n5 r7 R  W
  56. #define TCINTEN_SHIFT               20
    ' ^( U, J3 z7 f  B, l& w
  57. #define ITCINTEN_SHIFT              21
    " ]6 W2 T: [8 [# r) T
  58. #define TCCHEN_SHIFT                22$ R, e( m9 g# ^6 G& Q
  59. #define ITCCHEN_SHIFT               23
    4 R5 x- N& o. b
  60. 6 T- N7 ?$ n2 w
  61. static volatile int irqraised1 = 0;
    8 d7 \: [8 a# A; u. O
  62. static volatile int irqraised2 = 0;
    5 |- W" s0 t& t6 t/ |

  63. ( R$ e  G) w* f: |% V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % U; D. r( R, d5 B# f( v) ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u0 j8 x% F7 I6 \9 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ]( F0 K. v( I) j8 U0 ]
  67. ) a- F# {+ X! M$ n
  68. dma_addr_t dmaphyssrc1 = 0;
    * A; ?- c* {3 f6 Z$ N
  69. dma_addr_t dmaphyssrc2 = 0;
    1 l; z9 Q( _, y
  70. dma_addr_t dmaphysdest1 = 0;
    6 u7 A( V4 ?1 x4 N( i2 B1 M: g
  71. dma_addr_t dmaphysdest2 = 0;
    + Q  h* G* F4 u/ }  K5 U  P. V1 ?+ B

  72. + d5 ~: `) {2 K# U7 T$ R( U8 \! e
  73. char *dmabufsrc1 = NULL;
    9 @% _2 s: p% V1 q
  74. char *dmabufsrc2 = NULL;
    " i- q" V7 ?. `( G% G6 l) F& K* J
  75. char *dmabufdest1 = NULL;% k" G7 k, x9 E" [8 b
  76. char *dmabufdest2 = NULL;6 F: u3 Z' e6 v( u1 k* a
  77. # D$ f/ `0 H0 x$ j6 Y- \. h
  78. static int acnt = 512;4 \& r5 y" C2 k; o
  79. static int bcnt = 8;% B: J7 b) p( K* \8 v, {# B
  80. static int ccnt = 8;, ~9 _$ j" l" J
  81. 7 Z; D7 U  F' w8 b! l
  82. module_param(acnt, int, S_IRUGO);
      a4 k8 L( S# ]3 \2 t$ l4 ?1 {2 \
  83. module_param(bcnt, int, S_IRUGO);
    # c3 Y9 T3 B) M  F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 F+ L9 `$ h) L& D

1 ?! f5 e3 t9 A& w; ~! j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ]; ]4 P# S- I+ G: I# S, H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) w8 T1 _1 f( N) Y& y2 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ V2 w! S5 x' A4 _# g$ j& O8 q

6 P; {/ K0 y- C/ P
* E) H. d, k) Z- i* g9 R' W& P1 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 04:01 , Processed in 0.039013 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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