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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O/ b  B& T7 w$ Z4 c
  1. [code]EDMA sample test application
    & ~8 f5 v9 M6 M: P& J$ i
  2. /*
    ! n' ?' c* F  m/ c
  3. * edma_test.c
    ) e$ P& i8 r& |/ u, W7 ]8 g
  4. *. w6 o4 `( A. Z/ ]$ h
  5. * brief  EDMA3 Test Application, ?, Z8 ~: D1 @
  6. *( X7 \# L, |! Q
  7. *   This file contains EDMA3 Test code.
    & `" n' u7 E% H: j7 M( u6 o
  8. *
    * k; ]/ i; C! t' D* s% ~% V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ x$ A3 a+ `+ `& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 M9 a. A3 }3 [1 m
  11. *         TO CHANGE.  r$ j# Z- n$ ^
  12. *3 g' h. u6 {* e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ O$ p7 l. [7 n% y. Q& a: X2 ?
  14. *
    - o: q3 L3 Z# z% Z- k
  15. * This program is free software; you can redistribute it and/or8 ^2 W# x/ S; I! u6 b
  16. * modify it under the terms of the GNU General Public License as
    . a. f7 q$ t7 o2 R
  17. * published by the Free Software Foundation version 2.1 h# v! a) P. u0 ?$ N
  18. *
    1 L0 V3 r( n0 C! [) \4 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! y' |4 X, T2 X' M, q# \
  20. * kind, whether express or implied; without even the implied warranty
    . |- s, N1 A. W9 s. U# U8 m2 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # S1 _- [: |- F& p
  22. * GNU General Public License for more details.
    ) [5 z  i; b0 d
  23. */
    $ M3 L6 s; C* t" C

  24. 9 u: D0 O, L$ Z, c
  25. #include <linux/module.h>
    ) J. s9 e6 V; Y( X, b
  26. #include <linux/init.h>1 ^% A" |5 c8 o4 y$ G
  27. #include <linux/errno.h>
    9 T  [5 r' M4 J7 T2 R  G# X/ o
  28. #include <linux/types.h>
      n) d& B" v) }1 X
  29. #include <linux/interrupt.h>. `" x3 m- V6 P  \# J. |
  30. #include <asm/io.h>+ X" T6 i. o! N5 _2 ?+ L
  31. #include <linux/moduleparam.h>
    . y4 D- P3 [% g1 {
  32. #include <linux/sysctl.h>1 n# E% f% l+ ]+ m
  33. #include <linux/mm.h>
    ( I% k& V( j# y
  34. #include <linux/dma-mapping.h>
    9 P/ c. ]: q- E" I$ D

  35. / v3 D3 ?# ~  g1 E! o
  36. #include <mach/memory.h>4 d' T9 a. O. t4 e2 y3 {
  37. #include <mach/hardware.h>
    0 ~$ B; f; _* U* L  V. C
  38. #include <mach/irqs.h>) q: [( D: P, H0 `% D: J
  39. #include <asm/hardware/edma.h>: q+ A( g- b$ k$ ~3 P9 s2 x0 e

  40. , \! h$ u" K  m. B7 Z
  41. #undef EDMA3_DEBUG
    4 T4 a0 _( G3 B  O) d5 s
  42. /*#define EDMA3_DEBUG*/, N6 }. e% q9 a

  43. $ V3 C) O5 j" l) J, F
  44. #ifdef EDMA3_DEBUG7 K( V& b  r- `! Y1 P' x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * r5 I- W* @& g; U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 P. p8 d, r* {* o& v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' h  v6 ]  e- @3 v+ w( _+ `3 L+ I; }
  48. #else
    " F( ]+ u8 L3 F
  49. #define DMA_PRINTK( x... ): O; s/ T" I. k5 ?  C0 g- M
  50. #define DMA_FN_IN
    0 W7 |, \2 H  r  o2 G& E; h
  51. #define DMA_FN_OUT
    % ]  n; B3 @. a
  52. #endif/ I* Z: x; g1 @. r
  53. # M+ `+ Z2 L* ^4 q; p; q* l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  M6 `% E, k2 T- i# `3 s' n7 U; w
  55. #define STATIC_SHIFT                30 Y' d7 N6 Y2 a- B* r6 [' Y
  56. #define TCINTEN_SHIFT               20
    ; [/ a' R; N1 Q% `
  57. #define ITCINTEN_SHIFT              21* N* X5 a" L6 Z/ u6 a
  58. #define TCCHEN_SHIFT                229 G7 q# R5 `. Z8 V1 \+ Y
  59. #define ITCCHEN_SHIFT               235 D+ X$ v/ Y/ X: u; J
  60. ; S) n- t' D  c- H0 V) j! E5 q
  61. static volatile int irqraised1 = 0;/ E2 P, h; P* C0 G% x+ ?
  62. static volatile int irqraised2 = 0;
    7 Z: p& X/ J) Z; s) \
  63. " U( y& S; Z( I, `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B2 `% s0 y5 U9 `7 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t. H  l1 I# R; M1 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P) v9 }; f2 b8 l* t, Z" `- q5 A

  67. * \" V2 h3 ^) d
  68. dma_addr_t dmaphyssrc1 = 0;, ~2 r  @4 v* h
  69. dma_addr_t dmaphyssrc2 = 0;- S. v8 l% z9 q  X
  70. dma_addr_t dmaphysdest1 = 0;
    . ~! ^0 h4 g9 }9 l/ N
  71. dma_addr_t dmaphysdest2 = 0;5 n  R( f8 N* t/ C  w7 U0 y; ^

  72.   C9 X, i; |! }8 }4 _" j0 ]1 P
  73. char *dmabufsrc1 = NULL;9 m+ `! \7 i5 f, H
  74. char *dmabufsrc2 = NULL;. W, O" w5 y8 F5 T
  75. char *dmabufdest1 = NULL;
    2 \4 j! S+ |* a3 b3 H( ]' L; @- Z
  76. char *dmabufdest2 = NULL;
    1 m6 Z) z% c8 v  W1 x

  77. . O. O8 A8 S" h' U% D
  78. static int acnt = 512;4 e% L* g; B7 F6 T' [! X
  79. static int bcnt = 8;) H0 c$ W5 n- n+ @5 l6 R6 Q
  80. static int ccnt = 8;
    5 }& N" }% X- P+ B6 C
  81. ) m" m2 N9 `" M; U
  82. module_param(acnt, int, S_IRUGO);
    2 Z' ?% @. l( ^' w! @0 o
  83. module_param(bcnt, int, S_IRUGO);1 d) x4 {" c% l" R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 s; {+ b; T0 ^0 S

  X) D2 x6 L& W3 y9 n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 G: J# C' C! f. q  Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \) T4 w0 ?/ r7 g- T6 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ o; G; S1 G" o! w. [' F
: N& i3 w% m. g% ^& u7 V: h

$ f  H4 a, M: C7 C8 C$ f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 09:50 , Processed in 0.037284 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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