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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 r3 l; j. j1 q* B
  1. [code]EDMA sample test application
    6 A0 k; w0 W/ F) f4 V
  2. /*$ I" t( |5 G6 |+ K! j' f
  3. * edma_test.c
    " U4 q  b. Q% L% |1 }/ R1 L0 \
  4. *9 A, a$ M) A3 v# V+ _
  5. * brief  EDMA3 Test Application
    6 a* c2 W; Z) m; a0 ]- F( m4 Q' D
  6. *
    5 i  U8 M3 G- n2 {0 A0 g5 b
  7. *   This file contains EDMA3 Test code.
    $ S3 S4 D& o$ [) M+ k: \, D& H  |
  8. *  a  `0 a: ]/ d( N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 I# @/ \. a8 ^& f  @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 F, J5 X! K4 g, k
  11. *         TO CHANGE.
    ; v3 Q8 n7 x3 m( @% T
  12. *6 \% H6 h) }9 ~/ ^, q. Y, g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 m, m: s: O+ C8 X% k/ v' l+ t
  14. *
    5 U; p( {$ Z- I- O
  15. * This program is free software; you can redistribute it and/or
    ' L3 H/ _  C9 t! A5 e- c% @' y
  16. * modify it under the terms of the GNU General Public License as
    * v5 @* s5 D5 @, V( s
  17. * published by the Free Software Foundation version 2.6 C" i& ~1 |. @: ~
  18. *
    " [# [- @9 w! f6 |8 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 E3 F) e. [9 F
  20. * kind, whether express or implied; without even the implied warranty5 ]! Y9 P3 ?: u6 a# ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; M4 S: m% Z2 o1 A3 \
  22. * GNU General Public License for more details.
    & ]2 f0 }* r! a# q* M
  23. */" [/ O1 y1 [1 M: z

  24. $ W' g# c% J$ o5 q2 c$ P8 A8 P
  25. #include <linux/module.h>2 y: ^1 x2 x2 x
  26. #include <linux/init.h>+ z- d* L9 w2 x) H! ^
  27. #include <linux/errno.h>- _9 U' S! g0 q6 E8 H
  28. #include <linux/types.h>
      o8 q! w  }) Q3 I
  29. #include <linux/interrupt.h>3 B+ M) a! m# L- u8 _( Q4 |
  30. #include <asm/io.h>, L' t( u) h6 j
  31. #include <linux/moduleparam.h>
    ( u+ c; N9 S% X: @: R7 L3 F" O
  32. #include <linux/sysctl.h>
    . }  {* T9 ?, t; p1 j" A: j. ]/ |
  33. #include <linux/mm.h>
    % G! x8 `3 n- p0 O5 ?5 p" D4 w
  34. #include <linux/dma-mapping.h>' a6 ?  L& [- i, }* K- K
  35. % s2 Q, E" P% m' e2 |
  36. #include <mach/memory.h>$ r2 ~% d0 O$ @& f
  37. #include <mach/hardware.h>
    : u8 K1 t* W! `& ~- k: ]4 x: ]5 [
  38. #include <mach/irqs.h>1 C0 J7 z. M2 r7 C3 e  {
  39. #include <asm/hardware/edma.h>
    / }9 i- W0 k2 i& q; q& c( f  j+ J
  40. " }3 @" |9 c8 f" u0 K' A) p( h
  41. #undef EDMA3_DEBUG
    ' X' W# ]- Z* p! C% H8 K6 K
  42. /*#define EDMA3_DEBUG*/
    ! x# m8 B$ O; B: q, j
  43. & e. U7 H$ j' r2 L. q( ]1 I3 k  y
  44. #ifdef EDMA3_DEBUG8 B1 V& z1 B5 N1 p7 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 u' L6 p0 P6 y# n) w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Y2 f! n% k1 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ P- f! N9 j! V) X
  48. #else, l9 U' u* a- \% o+ M4 @" \, L- u
  49. #define DMA_PRINTK( x... )) s; ^5 k# m  z* a% |; r1 [0 s
  50. #define DMA_FN_IN
    4 |7 F. N# M8 F
  51. #define DMA_FN_OUT
    & _& [' Z' w+ X. M& y# k
  52. #endif; `+ V* [) l  }) {8 B* ^0 ]$ v

  53. & W. G; ^; |% H% [2 W8 c3 N# y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : m; i5 b) ]3 N: U" I
  55. #define STATIC_SHIFT                3
    # S2 [8 u( z8 P+ h
  56. #define TCINTEN_SHIFT               20
    * r: f/ z9 j# _4 O  G" z0 u! E- B
  57. #define ITCINTEN_SHIFT              21
    2 W: T. U6 _' p) e( G
  58. #define TCCHEN_SHIFT                22% r- h1 B  j, o- B
  59. #define ITCCHEN_SHIFT               23
    ! @$ C0 _. R* x2 P0 g; D
  60. 4 `; E, Q# K* f( K0 x
  61. static volatile int irqraised1 = 0;4 p+ B) B* B$ s! e
  62. static volatile int irqraised2 = 0;
    9 V5 k: n* Y) C) i- N- @  H) V/ Y
  63. ; B. f. m4 e  f* p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {, v1 O4 q) q3 l6 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " p; y- K; @4 P3 A+ p( f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j; `; b- J4 W' }, o9 {" m+ M

  67. 5 L4 Z4 e, }: a' E3 Y+ V$ n6 E, [
  68. dma_addr_t dmaphyssrc1 = 0;# N- f1 l, {) J; B
  69. dma_addr_t dmaphyssrc2 = 0;
    5 G4 n2 U8 f3 N  Z
  70. dma_addr_t dmaphysdest1 = 0;
    8 ?* ?0 l2 J% o5 `4 Q7 c
  71. dma_addr_t dmaphysdest2 = 0;. W8 h7 a3 S+ C9 f

  72. % b) _" U( Q3 B% R
  73. char *dmabufsrc1 = NULL;
    * D( F9 b! P, K
  74. char *dmabufsrc2 = NULL;& ?/ A# {8 O/ N* g  z
  75. char *dmabufdest1 = NULL;
    # d+ T# F7 }$ u! {! O" @
  76. char *dmabufdest2 = NULL;
    - C4 Y. h7 k0 J  \$ q* S

  77. 3 i, K3 _% {% g5 b
  78. static int acnt = 512;' ~. e7 h& v4 B
  79. static int bcnt = 8;* `. v$ ~& h0 R, e8 B* D0 P
  80. static int ccnt = 8;& `+ g8 _: b0 F1 I! `7 z* [

  81. 4 {% G( ?( ^6 f. X2 }: \+ L
  82. module_param(acnt, int, S_IRUGO);
    : [% J9 q6 t4 D
  83. module_param(bcnt, int, S_IRUGO);
    8 F, p: X0 L+ @: c& K+ |: @: g: H* y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 a4 u( o! w5 s; o; p  W
' u) j# r* ?5 Q' P" Q+ r9 ^( X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 U9 X2 d* U, O0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ J' m7 q$ X  N5 F$ d5 j4 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 G" ]9 x- Y6 c: }7 x. u3 _: |$ {- h+ E9 O" @" n) O
  L3 l" K! f  P2 B. l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 16:09 , Processed in 0.038254 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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