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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ~1 a2 _9 e  {+ a3 A, L# N
  1. [code]EDMA sample test application, U- }8 g: H  ?9 W, Y, M6 @+ Q
  2. /*
    $ Y  K$ r2 W& [7 l/ i
  3. * edma_test.c! U8 n  `8 {6 U6 A9 Z+ O2 }2 n
  4. *
    " g2 e! `: h- D  _
  5. * brief  EDMA3 Test Application5 X! q) ]. Q- N( @/ D0 I
  6. *
    : H8 H% }* d: Y6 C% K1 O
  7. *   This file contains EDMA3 Test code.! R" e' z; x, H9 a9 B/ l7 x* u
  8. *, x/ N6 @: w; b: j( R2 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * ~) f/ s- Y: N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 B8 V7 n# }) X+ u2 w
  11. *         TO CHANGE., w) h' {1 d+ `' R" J  m- m9 X
  12. *9 g" K# \, e! l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l6 v& o6 Q6 J( k' j! g7 V
  14. *
    ' d7 n- Z; i3 ]" ^; ^$ V8 B. c
  15. * This program is free software; you can redistribute it and/or) l" O; f- L6 S8 U
  16. * modify it under the terms of the GNU General Public License as
    ( a2 a' j1 J8 z0 A
  17. * published by the Free Software Foundation version 2./ h& I1 W7 `; ]. k
  18. *
    ! F2 N, k3 r, l) ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 V; P4 x+ I( v$ \1 a" x
  20. * kind, whether express or implied; without even the implied warranty- E# ^% ~% b9 T1 B: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- k: C; m0 _6 ?
  22. * GNU General Public License for more details./ u6 ^: ~7 E; f/ p0 C1 h
  23. */$ c. x% Y4 m0 ^8 F" r" n  o0 G
  24. . v+ J, z/ Z' o; w$ W' k0 S
  25. #include <linux/module.h>
    & i8 f3 A3 x! ~- A" G
  26. #include <linux/init.h>
    ( B) P/ Z2 M& A/ O4 A5 z
  27. #include <linux/errno.h>
    1 k, w+ N) X- Q
  28. #include <linux/types.h>
    . B% E# |- \7 }# q
  29. #include <linux/interrupt.h>$ v3 D9 y; s  }! f; M
  30. #include <asm/io.h>9 ]% {: w4 o' Q& j  @" n* J
  31. #include <linux/moduleparam.h>
    $ m' |# I8 r, x1 {/ T
  32. #include <linux/sysctl.h>
    & i2 ]2 ?8 J1 z' b7 a
  33. #include <linux/mm.h>
    + B/ I- _! W0 V  \
  34. #include <linux/dma-mapping.h>
    " a. R7 M5 [2 [/ E9 K
  35. / v$ a2 s6 s# W3 I0 C. Z
  36. #include <mach/memory.h>9 q2 \" Y  b2 z1 v& v% s. R2 d9 f
  37. #include <mach/hardware.h>
    & b1 O& I) P/ r5 d/ V& \
  38. #include <mach/irqs.h>8 m- e, V- e0 X3 b4 g/ q
  39. #include <asm/hardware/edma.h>
    3 i/ R5 m, F2 n: Z+ w/ ?: j' v( E
  40. % u9 U2 N: g2 q
  41. #undef EDMA3_DEBUG
    & B1 X2 l( X- l$ F1 W( y, J7 Z
  42. /*#define EDMA3_DEBUG*/
    0 N# r$ p  j$ c: ?6 J8 K+ w
  43. 0 ~0 {- v: i4 l4 x
  44. #ifdef EDMA3_DEBUG1 C, |  h% N5 t: k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & O7 h# E! @. p2 H& f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - y( U9 P3 C( A* ^8 \! I: h6 `: v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' V/ A6 D: z  Z# K, O% T* h) F
  48. #else8 ]# a0 X$ W6 W0 y
  49. #define DMA_PRINTK( x... )
    , e  N( L( o; m  C
  50. #define DMA_FN_IN9 i$ `6 A+ G7 i+ ~7 w6 F4 ~+ K. r
  51. #define DMA_FN_OUT0 J' _' v9 Z3 X* _
  52. #endif3 m5 L$ F( L1 a# |- `
  53. 4 P1 V. w  d& ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / Y2 p/ C9 P; d8 {) ~
  55. #define STATIC_SHIFT                30 k6 m& l, i0 T" n3 V0 @0 E: m
  56. #define TCINTEN_SHIFT               20
    9 \# c; z/ o/ W0 g
  57. #define ITCINTEN_SHIFT              21
    * M* k+ M6 t: W4 T0 Q' d, o& o
  58. #define TCCHEN_SHIFT                22
    : L2 R7 q  `/ ?  T, {
  59. #define ITCCHEN_SHIFT               232 i* R9 _- s/ q8 \
  60. 8 t5 E4 n: K! Z. u8 `1 y
  61. static volatile int irqraised1 = 0;6 N' l# @, Y$ J5 n; R% K- o; N
  62. static volatile int irqraised2 = 0;* K# c4 T. i, S4 o+ e5 K5 p

  63. . Z2 i; V- M# E' J& B0 I/ N3 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T6 B* b' T, M% h9 {: I% A8 C% f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C$ O: H* r' N7 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ]6 h, g5 p9 @. T  t& ]9 d
  67. ; x4 b% l# R' o. \& O$ D  [
  68. dma_addr_t dmaphyssrc1 = 0;
    + C* i' R5 a( A6 q7 ?) I# `# E
  69. dma_addr_t dmaphyssrc2 = 0;. K" k7 f/ ~* h) R( y9 e) M  S; H
  70. dma_addr_t dmaphysdest1 = 0;
    1 O  U. x0 i; e( W
  71. dma_addr_t dmaphysdest2 = 0;
    $ J2 {- Q" z0 ?7 C
  72. 8 x- _0 J, g% L3 `) U3 U; P
  73. char *dmabufsrc1 = NULL;% @4 [9 p1 `$ Q. ?% H
  74. char *dmabufsrc2 = NULL;  y" [$ U/ x8 f
  75. char *dmabufdest1 = NULL;
    8 T3 I* }# N2 T- U( g: c' [
  76. char *dmabufdest2 = NULL;
    ' D4 J; e5 n9 t! A1 Z! `) Q
  77. ( ?; x3 }/ E1 C! ]6 Q
  78. static int acnt = 512;1 r* `0 a1 x- q+ m" ?
  79. static int bcnt = 8;
    - R, P6 d0 J! n# E, B) n/ x
  80. static int ccnt = 8;& L8 o% T* W; o! v$ d( \/ m7 P+ S
  81. 3 H% j# Q% `% F& \0 I8 n1 b
  82. module_param(acnt, int, S_IRUGO);
      |+ a7 V0 g4 x1 g, O
  83. module_param(bcnt, int, S_IRUGO);9 `, K" a3 X3 i# c4 C+ l# B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ ~  T. b0 M) q( U* p- i
$ [$ M" c  }% z" G5 S$ u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 y7 ]5 B- o0 w' Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# m4 E1 k) }+ ]; ~4 w5 h2 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 A* J  q- ^2 }1 X( f- n. O# r/ e
0 |8 n- T6 b; X$ U
" J6 h, O; v6 s2 W4 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 11:43 , Processed in 0.048325 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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