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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) C2 f) g$ [, `' a2 f8 \
  1. [code]EDMA sample test application& P' t7 I- y" F/ d
  2. /*
    7 p- f3 Q9 {4 ?
  3. * edma_test.c
    % s  u4 z. D7 S! ?4 B3 B
  4. ** y5 J' d9 F9 W, U# ^
  5. * brief  EDMA3 Test Application  r  P7 [6 [. \- _; l( |5 ]$ W+ {
  6. *- l5 O. y$ T2 f0 c
  7. *   This file contains EDMA3 Test code.- f5 L- O1 O5 T2 G8 V2 x' ?7 C
  8. *& g' j( m- G% p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; j# `- y: H% |. r/ }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% V% @3 v( Y2 L
  11. *         TO CHANGE.9 s2 C/ n: t: u! J) D
  12. *
    ; H4 E" O# \* v9 o7 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# H& r, t- |: m8 V- y
  14. *
    2 |: h6 |8 m! [0 c
  15. * This program is free software; you can redistribute it and/or3 V3 {3 {/ Q% Y- D- M: }, H
  16. * modify it under the terms of the GNU General Public License as
    & q& N2 C+ N. l) q! U
  17. * published by the Free Software Foundation version 2.
    . K3 g4 h( W$ s' O$ T! Z- d
  18. *7 z5 d. H# [4 W- r: \+ N2 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  `/ Y- A* S+ d; y- T: r& P
  20. * kind, whether express or implied; without even the implied warranty
    4 V/ J0 v7 ?- G6 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; u, @% R% }. |9 i. B: H8 I% B; A2 K
  22. * GNU General Public License for more details.
    + @8 |0 Y. I& F+ ~# P$ l4 ?
  23. */
    $ D# f7 i! @/ ^$ N9 ]
  24.   ^8 P8 E5 y* _
  25. #include <linux/module.h>& E6 g, h9 t  a) |9 `
  26. #include <linux/init.h>0 u9 |3 Y+ E% ]5 t
  27. #include <linux/errno.h>
    , B& P" f3 Y% b& y5 S1 V
  28. #include <linux/types.h>
    5 Y( S3 }) ]8 g
  29. #include <linux/interrupt.h>/ r2 N- r; d; n) l+ A9 h& m
  30. #include <asm/io.h>
    - \, D9 l4 Q+ u( v
  31. #include <linux/moduleparam.h># }) z% Z7 ]$ l* v- @5 u; ~
  32. #include <linux/sysctl.h>
    - G6 S3 Y7 P4 V+ p* k) m
  33. #include <linux/mm.h>( d  {; J9 d" j$ Z& H* Y+ A
  34. #include <linux/dma-mapping.h>
    ) ?" B( M$ S- y% B0 T

  35. ! _& n/ D3 q5 s
  36. #include <mach/memory.h>9 q6 O5 ^. ~4 E4 i. o6 `
  37. #include <mach/hardware.h>
    . e( l" V) R1 `' h& O
  38. #include <mach/irqs.h>
    ' f% J7 w) B# {) c
  39. #include <asm/hardware/edma.h>
    8 n0 v4 [0 H$ |+ m% k% A' @
  40. 9 N* B1 X& y  j* Q. Z
  41. #undef EDMA3_DEBUG# Y2 n8 o& Z, R
  42. /*#define EDMA3_DEBUG*/
    , {) ]+ n& p- i% v! y6 |4 R7 x  ]

  43. % d& k  U& T9 B
  44. #ifdef EDMA3_DEBUG
    $ G, m9 E% c# b1 l& x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ p4 X. r$ c* W! o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j1 j! Z4 ?* B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 _1 h& S6 j- u! R5 D; ^
  48. #else
    : @  j) o( l8 l+ T
  49. #define DMA_PRINTK( x... )+ G7 L/ t, Q2 s& k+ C
  50. #define DMA_FN_IN" \* y# Z) a) q: d+ y  S
  51. #define DMA_FN_OUT
    - L4 X% a) |' ^  ]# r6 o1 {7 `
  52. #endif
      @, K5 p2 ~& V- v& q; s, @3 M
  53. & W: l! w+ u3 |! U+ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 S/ B( t0 l' f9 n$ Z
  55. #define STATIC_SHIFT                3& R" O; M! J$ h
  56. #define TCINTEN_SHIFT               20
    / L- s0 z3 t$ t* n6 L& h
  57. #define ITCINTEN_SHIFT              21
    : t4 m. B' X$ R' N
  58. #define TCCHEN_SHIFT                22
    & N' |& @" I* W+ ]# V
  59. #define ITCCHEN_SHIFT               23' l2 V" b* ^  N! e( [9 P
  60. " T$ E- T# c! O( x" T" P# K( ]
  61. static volatile int irqraised1 = 0;* @4 d) n( K. ]
  62. static volatile int irqraised2 = 0;* w. I* C- P" z) S" M# |
  63. 3 |1 W  O! j# {# ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ~% Y- n& Q4 V5 a- O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Z# q+ a3 t$ B* U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; V# z; c% Z6 T+ l4 }3 z! P3 S9 l

  67. 8 d; \, n% I1 v6 D4 K
  68. dma_addr_t dmaphyssrc1 = 0;" F3 {" R! Q) V& V" Q
  69. dma_addr_t dmaphyssrc2 = 0;
    - b4 E; ?) Q( D; H. r5 r; o: `- C
  70. dma_addr_t dmaphysdest1 = 0;
    & \, y7 `" Z* b  n
  71. dma_addr_t dmaphysdest2 = 0;. H( q, ^7 A: Q2 w5 }
  72. ! Q# S7 @  y# x" g. w9 ^
  73. char *dmabufsrc1 = NULL;
    ( b' b% ?! u  \& r) u8 {$ l6 ~
  74. char *dmabufsrc2 = NULL;
    2 o& r/ i; T. @" u2 O$ m( L
  75. char *dmabufdest1 = NULL;
    * O0 }" @9 R0 M4 V6 G# {4 D
  76. char *dmabufdest2 = NULL;
    2 a: J7 p, k! _( N
  77. 5 D* H" |$ |/ Z: r& N
  78. static int acnt = 512;! z7 [- U" {8 P" b7 p
  79. static int bcnt = 8;2 J8 j, L4 x. u- S( a
  80. static int ccnt = 8;
    / v: r8 D: V* O! i6 r

  81. 5 ~/ k* ^1 g# a, a6 i* a
  82. module_param(acnt, int, S_IRUGO);' P: J7 c$ G. E3 _8 {, r) V
  83. module_param(bcnt, int, S_IRUGO);
    " J9 A. [1 L0 ^- g6 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: R# Q  n. B. F/ F- }7 l
, I' ~6 |9 w7 d9 a) d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Y8 d" V7 a+ V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 i/ Y7 u6 u. u! ]0 _( n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 R7 S1 s5 P1 `
1 `$ v( ]/ M9 j! D
: J# z# f/ _. U0 W; w( K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-15 04:39 , Processed in 0.036485 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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