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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" @; p. U% a7 I: b
  1. [code]EDMA sample test application9 S1 ^# {9 D7 @
  2. /*
    3 u& L* I  q& _( n4 Q
  3. * edma_test.c
    8 m  R: ]" g$ i1 ^
  4. *
    ; E6 W3 z7 W; E" I; w: J$ v
  5. * brief  EDMA3 Test Application
    + C/ V* H( n! C$ O
  6. *
    ; y. r+ R. u7 A8 c. x
  7. *   This file contains EDMA3 Test code.  G6 D5 g. K' t! J6 a3 @1 h: h
  8. *
    3 f. V/ H. J" E- a2 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 |' S/ m* F, K! }- o: ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" R3 [  C8 _: Z. J  T
  11. *         TO CHANGE.0 x- Y9 g2 i1 `2 j
  12. *
    + q7 w- l1 l3 ~9 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- S/ m! ^7 v! t' Y8 N  y& O
  14. *
    ' @" ?* _# i  H/ K- F5 x
  15. * This program is free software; you can redistribute it and/or& l* r0 S# k0 e7 I7 k- i# b8 e
  16. * modify it under the terms of the GNU General Public License as- z" Y: m, o: N( Q9 C. g& P( z! s$ n
  17. * published by the Free Software Foundation version 2.1 d& g  e. n$ p- l- b
  18. *
    3 A! \- |  y0 o/ }! D. f' y6 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! N& {$ A4 p6 C9 d& N# Q
  20. * kind, whether express or implied; without even the implied warranty/ X; J  R& J* _5 W% I+ ?9 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 s% ]* J- w7 |7 J' p" ?* X, l
  22. * GNU General Public License for more details.
    - W4 ?" @9 m; d  p9 e8 v$ O
  23. */3 L3 {- E5 p9 P" p; r0 D8 V

  24. 4 u; T3 u! Y+ I& Q# v2 u( [
  25. #include <linux/module.h>
    9 @$ w: c* P0 o3 q, Q% U/ n
  26. #include <linux/init.h>
    : ?7 C$ |/ a& W. _9 ^  e) b% t  {  U
  27. #include <linux/errno.h>
    ! q# {0 A5 {. O9 B
  28. #include <linux/types.h>
    $ O# Y! W  _% H  ?/ V% P
  29. #include <linux/interrupt.h># U4 q9 y8 z# }$ U2 _" G
  30. #include <asm/io.h>! S0 d  p. K( U4 K
  31. #include <linux/moduleparam.h>% G% [' Q6 J/ Z4 y9 y- F  q
  32. #include <linux/sysctl.h>
    6 j2 T8 w5 D* \8 u/ g$ z
  33. #include <linux/mm.h>
    + A, d. e, K5 `# u" w
  34. #include <linux/dma-mapping.h>
      X5 q9 X) q$ R7 f. A! J' O) l% K

  35.   q+ S& c+ g7 n7 K9 Q
  36. #include <mach/memory.h># w! F8 }; k# I+ I" c/ ]7 l
  37. #include <mach/hardware.h>
    ) m6 s9 m% g& W: y
  38. #include <mach/irqs.h>
    5 z* w$ Q* J. e0 Y3 e7 c% k
  39. #include <asm/hardware/edma.h>5 c+ V) v# c4 a

  40.   f/ d0 B8 l' m
  41. #undef EDMA3_DEBUG
    3 I2 C8 L2 N% U
  42. /*#define EDMA3_DEBUG*/
    . {8 s1 I1 |1 E' F- h% u

  43. 0 B  m2 V5 Y2 z( m% a# Q; w
  44. #ifdef EDMA3_DEBUG
    , ~: S& h6 I# O2 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 E1 M- @6 A; Z0 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 h) L5 V; {9 {0 l  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): l% _5 T3 d& U% Z/ e! f# U
  48. #else" e0 c$ A; U7 U6 d1 S" [2 Q' i
  49. #define DMA_PRINTK( x... ); c4 ^( p2 w2 H
  50. #define DMA_FN_IN5 A# [% d  i1 {' ?9 Z3 k
  51. #define DMA_FN_OUT$ i8 p  ^" Y" j2 i
  52. #endif
    1 a9 x" O- w  Z- u- c8 F7 A" g
  53. , O3 ?, @6 u) s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + j# {! v. T& d; ?
  55. #define STATIC_SHIFT                3
    1 y  P: e( @* }5 o
  56. #define TCINTEN_SHIFT               202 j* D+ Z3 ~$ `
  57. #define ITCINTEN_SHIFT              21
    ' ?1 c/ {9 ~& B4 u) ~" B$ V7 u
  58. #define TCCHEN_SHIFT                22- k9 U" M8 z8 f
  59. #define ITCCHEN_SHIFT               23
    : _8 o& @7 }" {) N. S- Z8 w
  60. ! F- i9 U) L- l% m
  61. static volatile int irqraised1 = 0;8 ?) C3 k2 O8 p* J
  62. static volatile int irqraised2 = 0;2 h$ A3 v' H- V6 G

  63. , ]% R% a+ V. ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M9 w1 R. Y8 C$ A9 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 A7 J, z0 u  y! A5 G2 k$ [  E- h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d. P6 `' g" P+ w) I% t: W0 f% ^
  67. ! |& d% V. C, a; ~. o1 d, D
  68. dma_addr_t dmaphyssrc1 = 0;! x3 ?3 w, |  e8 o( N+ }( r
  69. dma_addr_t dmaphyssrc2 = 0;7 W0 Z0 D  P0 D1 W. k  S
  70. dma_addr_t dmaphysdest1 = 0;
    7 I% ]9 H9 c, _& p8 B( Z9 _
  71. dma_addr_t dmaphysdest2 = 0;
    5 `. x1 J5 u+ J" d% P

  72. ) H: P( F6 p" J
  73. char *dmabufsrc1 = NULL;8 P9 t% k3 }" y+ n) X
  74. char *dmabufsrc2 = NULL;
    ( s8 n+ I. z# i! I( }! V
  75. char *dmabufdest1 = NULL;
    7 h. R% u3 f$ W$ m
  76. char *dmabufdest2 = NULL;
    : ]5 b+ X3 w6 [- `$ q& s/ _" n

  77. 1 X. p* I* [3 W
  78. static int acnt = 512;- ^& a9 L; @1 X: O, F8 F" v) Z
  79. static int bcnt = 8;, m  g) _$ v3 A% o& c  ?
  80. static int ccnt = 8;
    , M3 l1 b5 D+ V; P2 I1 P
  81. 9 N. R5 T( e+ ^* ~4 E) u5 j
  82. module_param(acnt, int, S_IRUGO);
    1 c, h2 S' C7 ^0 @8 ?5 W- h9 A
  83. module_param(bcnt, int, S_IRUGO);
    * O, _" K; ^% o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& y* @( Z3 P, b" a7 V* M4 Z$ ^
  A  N7 m) N1 b5 x3 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ]$ J6 C. O! L4 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# f9 ^6 S) J" s$ i4 X7 \! S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( b* Q# d! u' r% J/ h4 [3 D5 o1 ?; R: |/ u5 B
- i  g8 ?2 a, F8 s) d. |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 17:02 , Processed in 0.038511 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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