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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* l6 i( d+ l, |$ h! `
  1. [code]EDMA sample test application
    8 E9 V- a+ g% F
  2. /*9 q8 C7 X+ \5 h7 W  G: T8 t
  3. * edma_test.c
    " O* e9 }' H1 d0 C7 g$ K
  4. *
    ! ]3 n3 L+ V: B# o
  5. * brief  EDMA3 Test Application
    " Q, S# N7 W& j% I, |0 r( ]
  6. *
    7 z; D7 W' d  d7 |, Q- g* y
  7. *   This file contains EDMA3 Test code./ B* t5 p. V0 k' a! @. O
  8. *; \" Y) l1 d( l! ?$ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 `7 L3 w- y, o2 O7 c: [1 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `: ^0 G1 x2 Q6 @1 e) A$ |
  11. *         TO CHANGE.: Q0 Y4 U7 l, L% d0 c( a% _7 u
  12. *, L  F3 e' ?/ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) J! U4 q# y( L- N  T  d3 l7 L
  14. *
    . t' |1 R  e& d- w7 B% {: g
  15. * This program is free software; you can redistribute it and/or' K3 c) d  ~& t! [9 n3 p: y
  16. * modify it under the terms of the GNU General Public License as2 F# s% J* N# S
  17. * published by the Free Software Foundation version 2.* l6 E1 j$ k4 Z' s$ S1 v
  18. *
      M# V2 a" U5 Z' [* E. F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ A1 b* K( `. u; {1 O) S6 d, g- |0 k7 ?
  20. * kind, whether express or implied; without even the implied warranty
    , ^7 Q1 r: h+ W/ Y4 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 T. R' @5 o8 C( h
  22. * GNU General Public License for more details.
    8 S: ]' M6 x9 X' b" x* ^7 X$ H3 F3 F
  23. */( u" b7 r  a% Y2 `6 c+ a) T
  24. 5 g% S5 Y( G5 \! Y5 e1 [; T
  25. #include <linux/module.h>
    5 J4 S3 m* x7 W
  26. #include <linux/init.h>+ a+ y; S1 G: J
  27. #include <linux/errno.h>( o6 P# y5 _' Y
  28. #include <linux/types.h>
    0 T2 a) C& }4 Y; w' l
  29. #include <linux/interrupt.h>
    ( x& w/ l: J5 d- Y) ^1 Y
  30. #include <asm/io.h>; I! z" B& L& {: J- r# y, I
  31. #include <linux/moduleparam.h>/ e# g  ]9 [' m. U" W
  32. #include <linux/sysctl.h>3 [1 ]5 v3 _. H2 X$ p
  33. #include <linux/mm.h>
    ; Y0 N( D9 `7 r' F; O$ O  U
  34. #include <linux/dma-mapping.h>
    - a7 k& z- V/ p6 U* U- w
  35. ! ?5 r% k& ]0 k* k8 F
  36. #include <mach/memory.h>6 G; \. G7 {! H( N. ~  e- O
  37. #include <mach/hardware.h>
    ' m0 E! o- }+ b5 n9 X1 k* b
  38. #include <mach/irqs.h>: b1 L, K6 P- e8 B3 z; l
  39. #include <asm/hardware/edma.h>
    , X5 b) a1 B. {
  40. ! s! Y) O0 D6 I: ?" @" h7 s
  41. #undef EDMA3_DEBUG9 H, T1 ?/ P- q# z7 H6 K
  42. /*#define EDMA3_DEBUG*/
    % k% i! q/ U3 [% S. ?
  43. # Y" ^5 `2 l9 U4 M1 f& ^
  44. #ifdef EDMA3_DEBUG
    ( X- R* {; i" x4 H' b3 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 W5 K: i1 g5 M9 b2 ]. Z. c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  k& i' z& d% Z: F- D! ?4 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 v" a0 B$ b# L' c7 c
  48. #else
    8 `; o; L: n  f2 j% m; S6 n( N
  49. #define DMA_PRINTK( x... )" |5 Q: r+ T% L7 c% X( F
  50. #define DMA_FN_IN/ V! `+ o; x- T! m* c$ G/ G
  51. #define DMA_FN_OUT
    8 a9 \. a5 F  D
  52. #endif
      O6 z* k1 y# t7 S6 r" S, ~) z
  53. 3 u- Z  l3 R" b1 l6 `/ p# _2 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & A/ q( L: N, s! d8 C; J
  55. #define STATIC_SHIFT                3/ V, T9 d$ K! i. o
  56. #define TCINTEN_SHIFT               200 c, r9 ^* u8 p: w8 h
  57. #define ITCINTEN_SHIFT              21
      t8 J& ]7 x* _3 E' K7 _
  58. #define TCCHEN_SHIFT                22+ S9 R/ f7 o$ a% W. C- N
  59. #define ITCCHEN_SHIFT               23( z9 P' y8 z) c* g2 ?
  60. ! x# E5 E, k1 E  v
  61. static volatile int irqraised1 = 0;
    % l) \, I: V# C; s) L, R
  62. static volatile int irqraised2 = 0;3 }2 g3 _6 W% g

  63. 3 w; F' I, e* o2 W2 E2 f/ Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ f: ]/ H% n9 u# Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ?0 C$ [! N( V2 |/ d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      m6 g! r* T$ q6 o
  67. 0 i" R* z# U2 v: ]
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ?- b, y# ^6 }6 @8 X4 m3 C
  69. dma_addr_t dmaphyssrc2 = 0;
    * f/ M6 a0 t* B% R2 n- u! a; Z
  70. dma_addr_t dmaphysdest1 = 0;+ [4 V( |8 |, H
  71. dma_addr_t dmaphysdest2 = 0;
    : x2 x& Y6 P5 {3 s
  72. ) U! ~9 ^9 \" V- B& k
  73. char *dmabufsrc1 = NULL;
    ' z! @/ X& D& W5 E6 H1 Q  S
  74. char *dmabufsrc2 = NULL;
    ' g! L5 U& T. h# s9 t# M
  75. char *dmabufdest1 = NULL;
    9 J" w5 ]1 `' e% {/ K' ?
  76. char *dmabufdest2 = NULL;) `/ I9 n- O8 [6 E

  77. 0 n3 N1 }* X3 q
  78. static int acnt = 512;' O" n) l% t4 k  a" }" E/ k; A! c9 D
  79. static int bcnt = 8;
    ; o4 Q) R* o$ o9 \
  80. static int ccnt = 8;
    5 z, x$ \; Z7 ^

  81. 6 `/ Z; p: H9 ?
  82. module_param(acnt, int, S_IRUGO);
    ! J  `# B/ j" J8 [- U' j
  83. module_param(bcnt, int, S_IRUGO);. E2 A% t' W% G* z2 c6 ?/ v, Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 a6 k& L, N3 U% X) Y. t' W! C& {: j2 O% t  r/ N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* d, U" Z7 Q. {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, W/ O3 x9 h: D. a. ?$ b9 o; v! B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& a+ C( O4 L4 z* J; v1 m$ ~
( D& |9 M3 m8 D+ \' N: @3 R7 @) R+ i+ y. m9 _3 r" n( z0 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-30 00:48 , Processed in 0.041237 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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