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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 M& C! g9 r; k+ K. N% M
  1. [code]EDMA sample test application" T% d3 G! i8 s$ q# h
  2. /*2 ^3 u8 _/ I9 n6 c
  3. * edma_test.c. m6 Y; b  e# S- Y
  4. *0 N4 x9 [0 V" C8 \3 \
  5. * brief  EDMA3 Test Application/ l2 ]7 X6 Z2 F! j3 y6 Q$ w
  6. *
    ' K( [2 R( w. d3 a3 Q* c% G
  7. *   This file contains EDMA3 Test code.- H3 F/ X/ }8 K. Z( h
  8. *
    ) D' i1 b9 M8 o) ^% _5 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  k" z% ], f9 A3 B" D/ w7 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, e, Y) g  O4 I' o1 \9 T* X4 Q5 J
  11. *         TO CHANGE.
    , [8 C* J/ |3 l, m# a
  12. *
    ) V/ X6 v& v% s, W; |- m8 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , d* W5 S, }1 I; B; K' B
  14. *
    5 s/ m4 P6 H5 _! a. A
  15. * This program is free software; you can redistribute it and/or
    0 h& M  g6 P. S1 w* c' y3 {
  16. * modify it under the terms of the GNU General Public License as. B0 W' ?% A$ K; f
  17. * published by the Free Software Foundation version 2.7 P* t9 L2 Q( n7 Q9 p# w; i
  18. *' |4 T. B  ^' E, @# E) ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 }. ]. i" L1 R2 {
  20. * kind, whether express or implied; without even the implied warranty
    & m6 M) L. C& s4 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 d+ ]" n) ?6 l8 N
  22. * GNU General Public License for more details.5 G3 f8 G  N$ m& {3 P- b  U
  23. */# y3 Y# h) r! ?2 m
  24. 8 N" Q, ~" m  f- v
  25. #include <linux/module.h>
      Y1 q4 S+ G' ^; w6 t2 W7 j* G
  26. #include <linux/init.h>) {5 O# [- M+ H5 B+ H3 A
  27. #include <linux/errno.h>. K, ]4 h, ?$ l! m
  28. #include <linux/types.h>
    ( h& g7 P; w6 P$ H. b$ m
  29. #include <linux/interrupt.h>
    ( L0 n* }$ T+ t
  30. #include <asm/io.h>
    ) v7 [1 E* k5 w  J* K3 A
  31. #include <linux/moduleparam.h>
    ' |2 |, R8 g4 m! j4 U4 u* N( f7 F
  32. #include <linux/sysctl.h>
    * |7 F7 A, {  h* a; T" P9 r8 h
  33. #include <linux/mm.h>, _1 g6 V- K/ N
  34. #include <linux/dma-mapping.h>
    ) w" N# \1 ^( B
  35. % f2 c9 z9 n" v3 w
  36. #include <mach/memory.h>: }3 y4 h- }8 h. [) n. O/ d6 P
  37. #include <mach/hardware.h>
    : y% h" {8 b1 ?' ]2 m) a) i6 ]
  38. #include <mach/irqs.h>0 ^) G) k9 c( o2 O0 p* ?
  39. #include <asm/hardware/edma.h>8 \6 M1 Z. `* t; \# b

  40. 4 p0 q" e. s0 ?+ j  M. {
  41. #undef EDMA3_DEBUG
    6 P  g  `: {( v4 w% _) g/ q
  42. /*#define EDMA3_DEBUG*/1 q1 c% I, ^; h" E' b7 ^$ C6 @8 ]
  43. ( B( N) l; e8 {0 R: s8 A1 P0 K6 h
  44. #ifdef EDMA3_DEBUG
    $ N, [3 F+ l3 j7 G( d& j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ }7 A( I9 e8 Q8 I+ o$ {4 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 S; P2 J5 a+ L: e: [# Q$ q5 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( j3 m# U- h0 N7 q7 b
  48. #else0 P0 V; w3 c$ p3 y7 N3 g
  49. #define DMA_PRINTK( x... )
    - t, k2 X* S6 }; X& u, q: J
  50. #define DMA_FN_IN; C7 v" m# M6 Q) k( t
  51. #define DMA_FN_OUT( d/ W! G; U3 M* C1 n, J* e( K! W9 b
  52. #endif1 N5 P4 Q# \* ~$ F9 ^  w
  53. ; i9 e/ x  Q5 G6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 w* e9 E" h  }: m6 ]
  55. #define STATIC_SHIFT                3, {# j3 J4 p4 `8 ^; {5 _
  56. #define TCINTEN_SHIFT               20' e  C5 ]6 M% i" [0 z
  57. #define ITCINTEN_SHIFT              214 V$ D( \  @& M( D/ D3 @$ g+ d0 ^" z
  58. #define TCCHEN_SHIFT                22
    ; B' N- b9 @' F4 i( D
  59. #define ITCCHEN_SHIFT               23
    8 y0 o6 r) k* `/ [3 I

  60. ! \6 r+ G5 @8 m6 i) X7 _
  61. static volatile int irqraised1 = 0;
    , u$ H  w+ k$ ~/ ~
  62. static volatile int irqraised2 = 0;+ B( ^" w0 Q. k% T1 J8 n

  63. ! i' ^, }9 z- P2 ^' b9 E7 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ~7 V" g. |' Y, Z5 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , `, f. _1 b7 s; _6 k) W7 ^7 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # Y, c; P% F& K/ G+ N3 R

  67. 5 d: O+ B- ?: a/ A1 i5 M$ s
  68. dma_addr_t dmaphyssrc1 = 0;8 p  ~6 u9 V/ Q% _2 [5 j% f
  69. dma_addr_t dmaphyssrc2 = 0;
    0 H# N+ T4 i5 x4 l3 D3 a9 \
  70. dma_addr_t dmaphysdest1 = 0;2 r5 c( [& M& N8 n/ t( x, O
  71. dma_addr_t dmaphysdest2 = 0;
    * z" Z8 T5 @, G' a2 m: I0 G

  72. + A3 d! `! w# \: M
  73. char *dmabufsrc1 = NULL;
    8 j" T7 W6 _$ L7 ^: f& R
  74. char *dmabufsrc2 = NULL;% j) R* B* b* {8 R& G+ m" N
  75. char *dmabufdest1 = NULL;0 q; |' i4 d2 j0 L! J
  76. char *dmabufdest2 = NULL;  t* @8 y1 G8 P( a1 C( V+ n. u
  77. 8 @, A+ H, f0 m
  78. static int acnt = 512;
    7 M$ d$ ?6 w( K  @5 u. |1 p2 ]1 b
  79. static int bcnt = 8;
    & D+ Z5 r0 G  B8 J3 p  a) C
  80. static int ccnt = 8;8 ~7 g: f6 Q9 ~- u8 l7 d7 P
  81. # Z% t6 g. o  f- Q% e
  82. module_param(acnt, int, S_IRUGO);
    ; p3 d0 H+ [; [. x7 z& l
  83. module_param(bcnt, int, S_IRUGO);
    - t5 Q0 f! K& Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  m' |0 L( u( P

  ?3 V" v9 S) p# R4 `$ i8 L  \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 \" E# s  Z% e7 c/ C5 ~3 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 r. r* y5 O4 U1 Y, C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ?- H4 |+ u" @) w6 v

8 M2 A( w9 F. Y6 Y
* ]  d, ]8 r8 p6 T8 K$ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 07:12 , Processed in 0.038694 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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