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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e  E* s  t! \
  1. [code]EDMA sample test application
    ! ~% |: W: C2 i& Q. S" T/ G( h
  2. /*  A& P) D% E5 l
  3. * edma_test.c
    9 v2 Z, f8 W& w) ^* u0 B) ]# H: [) Q
  4. *% h$ y8 w  Z0 r6 M
  5. * brief  EDMA3 Test Application
    % n" f4 I' Y5 b$ w
  6. *# h3 |" M: ?3 y
  7. *   This file contains EDMA3 Test code.
    - f! D$ w0 o; _% Y9 d
  8. *
    ' t6 M5 a5 w) W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  e9 U8 q2 X* F/ d. s5 j2 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      S0 B: n  m: g# V( K0 p
  11. *         TO CHANGE.
    " o  Z2 P1 z) I) J  w) C% r7 x+ T
  12. *
    # e; I) A5 [$ M$ L6 ?) }, {& k/ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 ^2 n8 i- j! }; `# Y
  14. *) n& M8 e  m6 E$ |
  15. * This program is free software; you can redistribute it and/or
    , O& l- ~  Z' s& Q/ T
  16. * modify it under the terms of the GNU General Public License as; A0 G* o" Z! g; D3 N6 c, A2 n
  17. * published by the Free Software Foundation version 2.
    * N- d" i8 a9 r8 i
  18. *
    4 [' J# Y3 [! t3 |7 L& M; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* R/ {" x0 L4 |5 |" b' F5 x1 ?
  20. * kind, whether express or implied; without even the implied warranty/ [. _  s. V5 l/ u- C" I# w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ `8 j2 A  b. Y0 V. E# u+ F
  22. * GNU General Public License for more details.
    4 V5 L& g+ P6 X$ k1 m4 Y
  23. */
    ! K2 l  j4 N7 I7 ?* d" @6 q
  24. . ~" \2 [' R. k9 {9 L& ~5 t
  25. #include <linux/module.h>+ x' a" T/ R3 U1 Y% x. t$ X
  26. #include <linux/init.h>
    " c" Z) @) S5 N
  27. #include <linux/errno.h>8 e$ K* v$ s1 h/ j% b+ A$ x' c
  28. #include <linux/types.h>7 U- `; V0 @( r! l
  29. #include <linux/interrupt.h>* _1 g8 M: T  a0 q" V6 w5 O
  30. #include <asm/io.h>6 ?0 l$ i$ E  x0 ?  U0 R! o
  31. #include <linux/moduleparam.h>0 _1 Z4 r+ s& z4 v9 X9 |0 B
  32. #include <linux/sysctl.h>
    % x& U, l0 s+ m: I$ G
  33. #include <linux/mm.h>9 e& `' D% O7 b* @8 t( ^* p8 E; q( S
  34. #include <linux/dma-mapping.h>+ y5 O+ T; o% `+ M" ^. f9 Q
  35. $ b3 Q3 |9 g7 N
  36. #include <mach/memory.h>  Z  K9 j3 Y7 U4 W5 x# \- Z
  37. #include <mach/hardware.h>0 r4 b  M& O7 s3 C
  38. #include <mach/irqs.h>
    # T# Z" H: |$ g  x9 j! @6 X# v2 |! v) P
  39. #include <asm/hardware/edma.h>, J. S' d5 R. I
  40. - K5 K4 Z; z* ^' r$ d; _# N5 [
  41. #undef EDMA3_DEBUG* X7 l; L4 s% v2 e- ?- ~
  42. /*#define EDMA3_DEBUG*/
    ' ]2 {1 D: X/ T% Q: Z  ]
  43. $ t2 \( f8 q1 P( D' g* j
  44. #ifdef EDMA3_DEBUG
    9 O1 Y( D% o( |8 ]$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Z, Q' h+ d, S0 f) j9 F! P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 k$ g+ g" F7 |2 O6 A0 x4 d3 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & Q* E- Z( e+ A7 f9 q
  48. #else
    8 ^4 p7 O6 Q3 L4 m3 [% v
  49. #define DMA_PRINTK( x... )
    1 U; O7 T( B- V$ L1 Z* q1 w! C
  50. #define DMA_FN_IN, {+ l, ]. `6 O! q, O
  51. #define DMA_FN_OUT
    . A( e0 S" b0 d! Y: m
  52. #endif
    - M, C4 C4 y# e7 Q) K- W

  53. & O( T( L$ a) K( D. N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) B. e3 ]0 `: R) D$ C
  55. #define STATIC_SHIFT                36 l$ z+ K6 @- }" ]2 n9 }- _+ N
  56. #define TCINTEN_SHIFT               20  ]; x9 x6 p% D4 }  U/ S2 }
  57. #define ITCINTEN_SHIFT              21
    # S5 z* t+ U. u0 D
  58. #define TCCHEN_SHIFT                22! N) }% ?% Q. @5 Z$ c$ k
  59. #define ITCCHEN_SHIFT               234 I! d" H# ]- ?$ |: U  ~
  60. ' C- b6 a% \- w! |% s
  61. static volatile int irqraised1 = 0;0 W9 D+ G! M& q, \0 @& N
  62. static volatile int irqraised2 = 0;
    . O8 H. P) X2 {3 ^4 `5 ~
  63. ; d" @5 d5 L3 q& Z- y# I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & H. [& Z5 `$ h0 W% G6 V! a  L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! s8 o- `: U7 R0 D$ p2 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 w$ j) u- o" `; G' `1 U

  67. + b3 q2 R4 j; d& i" I5 _6 Q
  68. dma_addr_t dmaphyssrc1 = 0;6 E. [% O% ^, Y" {; n) m1 T+ z
  69. dma_addr_t dmaphyssrc2 = 0;/ l( p" z  d1 T6 R; Y6 R- P0 g; [' b  x
  70. dma_addr_t dmaphysdest1 = 0;
    7 q( B: r' w9 u7 x) ^1 @2 D: r
  71. dma_addr_t dmaphysdest2 = 0;
    ) n. a+ |/ c7 D7 B5 V0 t% [9 `4 P
  72. 7 E* P) p4 y  N2 Q
  73. char *dmabufsrc1 = NULL;; }( ^) p9 P: A8 x1 ~
  74. char *dmabufsrc2 = NULL;: n0 M/ m  Z* B4 {6 h9 f
  75. char *dmabufdest1 = NULL;
    " Z  m9 c2 _! d7 A- d1 I: G
  76. char *dmabufdest2 = NULL;
    - Z  m: p; \- }. Y% X  p# ?" |% i. e, X
  77. 8 ~) I; D- X4 r7 R- Y5 }
  78. static int acnt = 512;
    - V& ^0 V1 m- X7 I  T5 P" W
  79. static int bcnt = 8;
    3 J6 c$ H# N2 z8 M; u: z
  80. static int ccnt = 8;
    0 S0 G5 e$ z. L( B" {
  81. 1 G0 [' d' e7 G+ Z, B4 g* J8 O" Q
  82. module_param(acnt, int, S_IRUGO);$ d. V; M# `* i6 |6 Z: t& p
  83. module_param(bcnt, int, S_IRUGO);& f) x6 z' W* ~# l) Z! q# @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: Y! u7 I5 n* F: R0 ?7 M

% H3 t  {: o4 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. e9 Z+ {3 p9 |" A2 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 f0 _5 q3 c5 p4 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x( ~6 X5 @6 w! G! M8 Y' I
. X& A9 G: i! P/ C
; v) ?8 Q1 C! [7 L6 d) h9 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 02:48 , Processed in 0.038780 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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