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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   @" N8 V% w) d0 U0 p
  1. [code]EDMA sample test application1 b5 w! s! K9 t  e: u, `
  2. /*
    ! y, ]$ @5 L, p$ x; A* i
  3. * edma_test.c
    + U' u7 w3 j) U  E' A( {2 O
  4. *& Y0 a3 R+ C3 J" M' D* X
  5. * brief  EDMA3 Test Application; [. e4 C+ y$ b& c* E& ^0 m: B
  6. *  d5 }* r7 y0 i) g# w5 d
  7. *   This file contains EDMA3 Test code.4 B: P" B% j4 D/ n5 M
  8. *
    - Z+ ?1 f3 x% Z. _9 g+ O7 g+ M" i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# G8 G6 B* B6 a' C# `, b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 L" ~# o3 {) L) t+ r* y, E
  11. *         TO CHANGE.9 B( L  l. D6 p
  12. *
    & ]9 _8 B/ d9 V2 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 N( P: h4 `4 I. e
  14. *" a) y6 T( u& W( H2 i' n' @' g
  15. * This program is free software; you can redistribute it and/or
    $ o! \* t7 t8 g# j- m/ V) D4 T
  16. * modify it under the terms of the GNU General Public License as
    & a5 u* _7 g% y6 r& e
  17. * published by the Free Software Foundation version 2.
    ( q% ^( P  U# y! P* _
  18. *
    . M, z  }( p. O# B5 K6 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 L) \% s. m/ c: x8 P" X
  20. * kind, whether express or implied; without even the implied warranty  F# a4 X% Y. A8 y1 o/ b0 \& o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : ]. Q9 A% `7 e/ A: M8 K2 |2 _
  22. * GNU General Public License for more details.! v, }5 j2 k) F; [
  23. */
    4 P. k& L+ N$ p8 I

  24. / L0 c" b, ^1 A4 [* q% E
  25. #include <linux/module.h>
    4 d3 |1 |  M- c9 `5 ~
  26. #include <linux/init.h>, G6 m! N$ [8 p
  27. #include <linux/errno.h>: v0 C9 c# Z7 c
  28. #include <linux/types.h>8 |# }% F% Q# _6 N
  29. #include <linux/interrupt.h>
    $ L8 F; g9 W. q: I
  30. #include <asm/io.h>7 P( y$ o) K  s) Z3 @
  31. #include <linux/moduleparam.h>
    ; }9 u5 S7 \  [; M
  32. #include <linux/sysctl.h>
    % [% {  b1 u6 @
  33. #include <linux/mm.h>
    ( J" T: F$ a# W3 H
  34. #include <linux/dma-mapping.h>; S" J$ B6 ?: ^; }$ I/ F
  35. . `( n5 @' ^4 R; x! r
  36. #include <mach/memory.h>
    9 x" q2 [. n7 v! D& p8 N
  37. #include <mach/hardware.h>* K0 i. u  w$ M9 a4 f5 e' v
  38. #include <mach/irqs.h># v+ r! Q$ z% R' ?$ }
  39. #include <asm/hardware/edma.h>+ X0 R( {" `" `. n7 J+ [

  40. 2 E/ P: ?: k9 T; o
  41. #undef EDMA3_DEBUG. R$ k& ]% x& r0 L0 e" ~/ K! I+ w, p
  42. /*#define EDMA3_DEBUG*/- z5 q: W" p4 c% ^& Z7 |( o

  43. 1 ?5 v! j. o# L
  44. #ifdef EDMA3_DEBUG. c" }. x3 z0 C- c1 b6 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' M1 T  V. W2 j( `* g0 M4 d1 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 r+ S( f! v- M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + c" G" Z4 g$ a- J$ E
  48. #else
    2 U! w! d/ f, J* p( K* @! L
  49. #define DMA_PRINTK( x... )$ i7 G+ Z9 {! v  y# V
  50. #define DMA_FN_IN
    # y' Y% q4 ~4 k; K' V
  51. #define DMA_FN_OUT
    ; V4 h0 `8 ]( h0 u3 J: [
  52. #endif0 J0 O$ h! i7 Y8 s- f7 \

  53. ) q" x7 _7 d1 x3 ?$ V! N  w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 z5 Z( q, X. Z% B" D
  55. #define STATIC_SHIFT                3
    * S; K! H6 Z' g/ W
  56. #define TCINTEN_SHIFT               20
    3 R) n) ~- p! q* J  X7 I; L- Z8 p
  57. #define ITCINTEN_SHIFT              21
    5 Z1 l$ Q7 {4 b; i
  58. #define TCCHEN_SHIFT                228 r5 ?8 V' u/ [, A
  59. #define ITCCHEN_SHIFT               23. d! b# s& Y& m
  60. 4 B3 }. B) ~  j0 t5 C: r  T
  61. static volatile int irqraised1 = 0;6 l' R& N% m8 j" \/ Y$ D+ B
  62. static volatile int irqraised2 = 0;
    ; c! B  x1 c8 G7 C

  63. # [  e# g- m0 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G. f* i' o' P6 o. S& ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 V2 c! ~* |% `; w, S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u! ?  i# \6 R) j8 F# ^7 W

  67. 1 f4 j. N8 U1 |
  68. dma_addr_t dmaphyssrc1 = 0;! \1 F1 i* Q; _, g5 C' \* ?: d
  69. dma_addr_t dmaphyssrc2 = 0;
    1 |8 j: a! M9 w4 p
  70. dma_addr_t dmaphysdest1 = 0;
    - j/ y- @% Z2 [# S8 g
  71. dma_addr_t dmaphysdest2 = 0;: v' E# b5 ?  x  @( F

  72. ! h. K4 s' J1 o4 X- a0 R( L
  73. char *dmabufsrc1 = NULL;" N; m0 t; T! U, T% {7 _8 |
  74. char *dmabufsrc2 = NULL;
    " R$ r/ m& n7 }7 m. |+ B& }7 F" ^$ N
  75. char *dmabufdest1 = NULL;6 F  g. H  U) j- u+ V9 e3 w5 H
  76. char *dmabufdest2 = NULL;# {/ N3 m' a. Y+ ]

  77. % a7 ?, q: h6 Y- ]% D6 p
  78. static int acnt = 512;
    2 E0 x+ Z' t- j3 p
  79. static int bcnt = 8;
    0 j) u; m) R, ]% l( B. B$ N$ W
  80. static int ccnt = 8;1 l. Q- p( W. {8 O% q
  81. $ x+ x4 w2 H/ C$ u& g5 N
  82. module_param(acnt, int, S_IRUGO);
    7 n) T0 r9 T0 }; Y* q. r
  83. module_param(bcnt, int, S_IRUGO);; ~& D# v% M& f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ V9 ~5 b& J- k" c
  Y3 n, X) V0 n0 i' M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Y# N" |  v9 V+ ~( Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ V4 L$ W3 G) c+ d. e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" M, p; H2 b& G
* \; b( I( R& q9 y* @5 C! B
- Z$ F( M/ m; J, q  N0 T8 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 22:38 , Processed in 0.036840 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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