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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  m. p2 b+ B+ u2 D  A
  1. [code]EDMA sample test application
    ! p! C- r: J- t& L  t1 j
  2. /*  o! d4 K" ?( E2 Y. Q
  3. * edma_test.c$ y# G2 D7 z  x. S7 W
  4. *
    5 ?% P8 J* S: G1 m0 r
  5. * brief  EDMA3 Test Application( B" x( F. G. ]' k5 e4 R
  6. *
    2 e- I) w" E8 U2 i/ h" K5 j; x0 \
  7. *   This file contains EDMA3 Test code.* a; Q, ]' F* T7 X! C
  8. *
    4 w/ \& ~2 i2 b7 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! ~6 o+ {. k3 t. ]/ I* \! |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& v! w+ O1 b7 U; ?8 M" Z
  11. *         TO CHANGE.
    ) ]% U( f1 `. u0 e) [3 D7 e: f, k
  12. *# W. J/ y8 Y( ]- {% ]1 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 r- _  _% ^" W) u) n
  14. *
    3 r2 Q4 x0 X7 x0 W9 W; S/ n3 Z5 X
  15. * This program is free software; you can redistribute it and/or
    ( r* X) J* W9 V
  16. * modify it under the terms of the GNU General Public License as$ |/ v7 @8 ^8 _( n: }
  17. * published by the Free Software Foundation version 2." t. s9 x% E; s+ s/ B
  18. *% o5 p' c' Q/ t7 Q) ~* k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 j, Q7 q7 y# f
  20. * kind, whether express or implied; without even the implied warranty
    1 q' J/ p, u4 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 v% T: d: g$ f  k) A
  22. * GNU General Public License for more details.2 J* h7 J  T( {* P7 b# w5 T7 n
  23. */: q+ t( t% G5 g6 T9 I* y! w

  24. ' U; I% R( F3 w0 C- p) Q
  25. #include <linux/module.h>3 S1 Q( `( L2 o2 g7 J0 M
  26. #include <linux/init.h>* t% e$ F# Y& u
  27. #include <linux/errno.h>
    " k* {9 F( v* ]' z0 O. O
  28. #include <linux/types.h>  V* ?3 D$ R- o4 d4 f
  29. #include <linux/interrupt.h>
    3 C! X' R) M) h
  30. #include <asm/io.h>
      n7 b8 w; O3 X
  31. #include <linux/moduleparam.h>0 y7 ?- q8 U, l% {3 _
  32. #include <linux/sysctl.h>
    ! ]$ s& F/ W# ^5 q- Y$ e4 z0 E
  33. #include <linux/mm.h>
    + \  d0 g. J" m
  34. #include <linux/dma-mapping.h>
    9 t) i' O( Z) e
  35. $ _' A, T6 R# j; G
  36. #include <mach/memory.h>
    9 S; T" O0 V; g( {' j
  37. #include <mach/hardware.h>
    ! w. w% O  }. V; Z+ W$ x- T
  38. #include <mach/irqs.h>
    & }- G) ^: @/ v% ^
  39. #include <asm/hardware/edma.h>; h0 j2 V2 i0 O- D9 k% E

  40. 7 d" J# H9 u& f( {9 _
  41. #undef EDMA3_DEBUG5 B8 K7 G0 \7 M0 t& \3 w
  42. /*#define EDMA3_DEBUG*/5 n5 Q4 _# B; h9 t

  43. ' ~5 _/ h- C$ r5 v5 D+ x* y) g
  44. #ifdef EDMA3_DEBUG% O3 y6 W5 M+ c5 M! X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & k+ ~3 E& l+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 L3 x5 K6 y6 E- K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( V- S# i$ ?( p  h; C: S2 J9 x1 o
  48. #else) X/ S3 u" D6 a6 |
  49. #define DMA_PRINTK( x... )' x$ `5 r* x6 h  V
  50. #define DMA_FN_IN
      c; d. q( z# x1 V& L
  51. #define DMA_FN_OUT6 u7 Q' e: x8 a4 V9 K  X
  52. #endif/ r) a7 q8 U7 T3 S# p9 j' @4 L
  53. & W$ P2 a  j0 [8 {% ~1 z: u- z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  U* H* v$ Z1 j! N* j3 J, n
  55. #define STATIC_SHIFT                3
    . X% r' S& q0 n% Y1 p$ O1 p
  56. #define TCINTEN_SHIFT               20
    4 ?* e: j/ u6 @, k  a
  57. #define ITCINTEN_SHIFT              217 }( o. O$ T- M
  58. #define TCCHEN_SHIFT                22# k$ I$ p0 ^: \' f- z4 p. B
  59. #define ITCCHEN_SHIFT               237 }: B) t& u: w
  60. 4 {4 ^) H- l$ l6 H
  61. static volatile int irqraised1 = 0;  J: m4 d% l" |
  62. static volatile int irqraised2 = 0;2 v8 g' O- C- H. Q$ p
  63. * i) W& M7 n$ P. v2 }0 u- N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g3 V4 U* M+ z$ b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 |8 L. }! |5 l$ D: [/ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 o* ^  G: z$ q
  67. 9 t' t0 T5 j3 {* _) G3 r) {
  68. dma_addr_t dmaphyssrc1 = 0;
    ( b2 V; z* J/ }4 w
  69. dma_addr_t dmaphyssrc2 = 0;4 ], H+ U( q4 O# M% m
  70. dma_addr_t dmaphysdest1 = 0;
    - B: [5 q0 e2 P
  71. dma_addr_t dmaphysdest2 = 0;% F0 r; g$ B. r" e. j' W4 d) K
  72. 8 R0 B. ^" S" D+ h
  73. char *dmabufsrc1 = NULL;
    # M- w* o5 a+ X4 I0 k
  74. char *dmabufsrc2 = NULL;; N+ ?8 T8 D6 C- _& N0 m
  75. char *dmabufdest1 = NULL;! S% K. F0 @' k1 o$ P. S2 v& O
  76. char *dmabufdest2 = NULL;
    : p% P1 O) b6 ~: v+ S

  77. 7 U& H- `$ N' [5 j% j2 p
  78. static int acnt = 512;
    7 X2 E: x0 |$ \) u
  79. static int bcnt = 8;
    0 l# n7 O9 W! L. X; K) W
  80. static int ccnt = 8;
    5 G) Z- j  |0 B& f+ p
  81. ' [9 v1 @. R7 V  m# j: \- ?/ I) f
  82. module_param(acnt, int, S_IRUGO);
    + Q3 V0 ^8 `+ ~- v9 P  t
  83. module_param(bcnt, int, S_IRUGO);
    # B: o. e3 ~$ O; h# T2 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( T) N. O( T: E; P# ?* E( `
2 z# N8 a" h* l" T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 t4 \4 w; A6 {5 S+ j( y
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; \' {; M8 ]' s- {" `3 I9 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) V& ~2 v4 X8 z" k& }) `1 L5 j1 O8 v: X! S8 c9 q! y

( k0 {9 R' g) H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-6 23:21 , Processed in 0.040688 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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