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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m: @6 \+ Q2 Y1 g. t7 D# |
  1. [code]EDMA sample test application
    , m8 C' L& O+ `" Q6 B3 m; D6 O
  2. /*
    7 G- B# _; z0 w, _. ?0 p9 y# T# D
  3. * edma_test.c
    6 i# H0 p. m6 g
  4. *. q2 w1 Y( N3 l/ G/ I
  5. * brief  EDMA3 Test Application
    3 d9 i; I) E/ q- w8 R- P* v7 n' `
  6. *
    2 ^! x$ ^( o4 {. u" X
  7. *   This file contains EDMA3 Test code.
    : ], o/ D4 W* i, T7 L
  8. *% j& q1 |# Z) O' P$ X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 \/ L7 D) K1 @" M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* n: |$ k/ t9 N$ G8 q
  11. *         TO CHANGE.
    * u* s. c# Z$ z# G6 N1 f
  12. *
    # F0 D% w6 e1 l. h: w5 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . N, {0 P) C) n( A
  14. *# n: v9 r, B4 P+ T7 ~; u
  15. * This program is free software; you can redistribute it and/or
    6 b: {) G3 }' w
  16. * modify it under the terms of the GNU General Public License as$ u) O/ g9 t& j: M2 j
  17. * published by the Free Software Foundation version 2.
      [7 _$ @4 L* E/ x
  18. */ s* B( f) d7 @4 i! W/ D# l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % F, C& a7 p0 Z3 s; Q
  20. * kind, whether express or implied; without even the implied warranty' h7 m: m# T2 l7 J- b- G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' n' D( L9 y: V' K( X
  22. * GNU General Public License for more details.
    0 K7 t, i$ m9 H2 h% Y/ A, ?
  23. */
    : Z+ t5 h) x, {5 L7 _
  24. , L6 y) K; E5 F
  25. #include <linux/module.h>6 ]0 g% ~0 o# D
  26. #include <linux/init.h>
    9 }4 M7 e1 ]. \# D+ i: F; D4 A
  27. #include <linux/errno.h>
    0 g8 _+ E" ^3 G1 f" o) G
  28. #include <linux/types.h>
    6 V+ _' y3 s) s" R5 E4 e1 e8 C9 X
  29. #include <linux/interrupt.h>( W9 X1 {1 S( F7 S" V6 `
  30. #include <asm/io.h>$ b) M) x7 c! q0 i& N* q! e
  31. #include <linux/moduleparam.h>& I% u5 {8 B2 |4 K3 u4 o( V/ L
  32. #include <linux/sysctl.h>' l2 ^% B, w1 {, O8 g# j
  33. #include <linux/mm.h>
    ! D4 n2 _3 }, [8 B* L! A: W
  34. #include <linux/dma-mapping.h># o4 O6 D* Q8 f+ a

  35. 6 ]" c5 O: C" I8 T7 s
  36. #include <mach/memory.h>% W4 P; b( s) ^
  37. #include <mach/hardware.h>
    6 e! I# b% d9 e# ?6 ~
  38. #include <mach/irqs.h>7 Z# l) [9 P) E7 ~$ F
  39. #include <asm/hardware/edma.h>
    0 |5 ^# V, M0 a( R8 C

  40. - v! N* E$ i, n- ~
  41. #undef EDMA3_DEBUG
    9 W0 s' U0 q* z7 i3 }' I
  42. /*#define EDMA3_DEBUG*/
    + O' b! I0 X2 i- G. K- }

  43. 7 R0 p5 G3 ~* u- ?$ \- b+ o
  44. #ifdef EDMA3_DEBUG
    2 Z' _* i: g. g' g- v+ `( r3 L! P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ~. J; u& b$ r* U( h4 N0 \0 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 z; e( r; o# e% k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ a: M% f* Q) u8 h
  48. #else
    4 V, r0 Y+ K/ Q: [
  49. #define DMA_PRINTK( x... )  c" A7 ^# [$ j" ~
  50. #define DMA_FN_IN
    8 C# P1 T9 P- s# _7 F" l/ O
  51. #define DMA_FN_OUT
    # e+ X! b/ N  L6 I
  52. #endif
    1 ?$ e( t  {. W) n- S

  53. / g6 \5 j0 Z8 Y' V: U1 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ X% s( O3 G) `5 n
  55. #define STATIC_SHIFT                3
    , C" m) M" R9 h
  56. #define TCINTEN_SHIFT               20
      p! K( i: ?; i: }# N+ x; J" c& W
  57. #define ITCINTEN_SHIFT              21
    $ J3 e) \8 k6 U
  58. #define TCCHEN_SHIFT                22# b/ m; A9 \( F2 B3 y
  59. #define ITCCHEN_SHIFT               23
    8 V1 B/ H2 O% C+ G
  60. " T/ z+ ~, \! j9 H) G8 P7 [# V3 p
  61. static volatile int irqraised1 = 0;
    0 n8 B' o! S( C) t
  62. static volatile int irqraised2 = 0;
    + w5 Q% g! s. Q
  63. 3 E% E0 E1 Y# K" {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 E2 Z% j! \& e7 N" ~5 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 f. ~: ~) F* l  g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 u, O( b+ D+ A
  67. $ ^, |- P2 M) T" ~! M7 E
  68. dma_addr_t dmaphyssrc1 = 0;$ S) f1 o) z6 z  @) ?
  69. dma_addr_t dmaphyssrc2 = 0;: J8 B' h" I2 c2 C! X
  70. dma_addr_t dmaphysdest1 = 0;0 H7 [. l! ]8 C2 A1 u, A1 y2 J
  71. dma_addr_t dmaphysdest2 = 0;2 S# A0 ]: e4 C2 I2 R9 g

  72. ) V; V& T" @6 b- U$ C! S1 x
  73. char *dmabufsrc1 = NULL;" U) E6 N: j' v9 f0 z
  74. char *dmabufsrc2 = NULL;
    5 F& W9 m& ^4 ~  m1 G
  75. char *dmabufdest1 = NULL;2 V* `* n, U* f1 m* z' H
  76. char *dmabufdest2 = NULL;; ~! v7 ~; `5 \  [4 Z2 M0 j

  77. ! W. O) B+ t/ T8 ~) l
  78. static int acnt = 512;
    8 e2 P2 I( P- m7 ~; r
  79. static int bcnt = 8;
    + i7 a1 F. q* O+ J( c& l
  80. static int ccnt = 8;
    ( S6 g1 E8 [* `2 K' t# ?* p
  81. . V) v6 A6 ~; {; n: V6 _
  82. module_param(acnt, int, S_IRUGO);, M/ Z9 |3 @; E6 l
  83. module_param(bcnt, int, S_IRUGO);0 F" s; H: e# h$ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, [- b% x$ a/ X# O* D

, v' y$ M! t9 I' P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* h$ D% {  V- B4 S5 d% Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  v9 X) V5 ]& K/ V* [+ z1 o2 ?7 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, W9 g+ c2 E) z) K) y1 v% ?9 H

7 }% o4 H6 Y4 W6 G% f
* y  k9 v4 v2 F# K( u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 13:55 , Processed in 0.037309 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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