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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C, H7 f; e3 J( N: ~
  1. [code]EDMA sample test application# ^9 G  C+ I0 W: I& Y3 ?0 x
  2. /*
    * ^' E$ G% l4 k/ `' @* S! ^
  3. * edma_test.c
    5 R+ B6 z! L( Y, i/ I
  4. *( g1 j) Y7 J9 x0 W( \' \
  5. * brief  EDMA3 Test Application: x/ ]! W9 w, {8 C
  6. *
    " W1 k- J- z& s3 J- u0 D9 @
  7. *   This file contains EDMA3 Test code.' V: R2 }4 h) G: V
  8. *0 }  K9 z. N9 H6 e+ ]' q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ]  ~! G7 T- I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ y: B8 J# @" h8 K8 U: B7 x
  11. *         TO CHANGE.
    9 W# l6 t+ I# R% B, I; U: P
  12. *
    4 i! P3 H. e! n) V9 }% n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 B' O6 `$ q1 ^+ b$ D. S0 X; ^
  14. *
    4 E6 X1 d+ y+ X3 r9 K: }8 O5 S+ Z& ]
  15. * This program is free software; you can redistribute it and/or
    ( b4 o/ R) P0 u( T+ g" C
  16. * modify it under the terms of the GNU General Public License as
    9 c$ R. U" }3 ~6 ?0 C/ D  E# c4 q
  17. * published by the Free Software Foundation version 2.- \9 w& i- D- }* k& \
  18. *7 Y4 z  X  ?) i, R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; C' k+ {8 D& k- J- _# q; k$ o
  20. * kind, whether express or implied; without even the implied warranty7 }, T9 J  L& E6 e# H, w+ E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - @' h3 h6 T) Q, |/ R4 J
  22. * GNU General Public License for more details.
    ' b9 i& m0 ?. ]7 z/ G
  23. */
    7 p1 E. W1 J' D$ L9 \3 K

  24. ' g" Z1 Z+ [3 e7 K1 ]2 u1 b' M9 V. H
  25. #include <linux/module.h>' }4 e5 n0 Y3 t6 s  w3 [
  26. #include <linux/init.h>* m, X- z6 I, h: o  c
  27. #include <linux/errno.h>
    ( F5 Z2 l  z5 M$ O7 [; W0 A# s# d
  28. #include <linux/types.h>, n- E3 B7 R6 d5 u! \6 X
  29. #include <linux/interrupt.h>
    . }* ^  f6 t- q4 m2 k
  30. #include <asm/io.h>$ P* ], v" a+ y- v
  31. #include <linux/moduleparam.h>
    0 M4 f$ A9 \; L4 `% J+ y, Z/ N1 w
  32. #include <linux/sysctl.h>' T) J7 l& m$ ^8 J
  33. #include <linux/mm.h>
    ! _3 |1 N8 B$ O: ~
  34. #include <linux/dma-mapping.h>
    & I- C' {, H5 L, F& K. W

  35. % A7 Q3 A. X! C# F
  36. #include <mach/memory.h>
    8 @, x% i1 u/ P3 ^) x1 b, E
  37. #include <mach/hardware.h>
    + ]+ O$ g& i- l0 y/ d0 K5 e2 t
  38. #include <mach/irqs.h>1 V1 M* t- @. J* w- i4 |
  39. #include <asm/hardware/edma.h>
    $ k& I& c- T' S9 [

  40. ; ]5 e0 L: a! }( ^8 `& w$ O6 w
  41. #undef EDMA3_DEBUG& w' N5 H2 E. W) c
  42. /*#define EDMA3_DEBUG*/
    ! W$ M- ?! z: v1 R( ]/ `, r
  43. ' }' ~# D0 Y& b- ^9 e# k" a5 A  ^
  44. #ifdef EDMA3_DEBUG2 J  ^/ H" [5 A5 |1 l- M1 C9 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + V, a4 e5 @- H. V6 R2 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p: W; X( [/ ~. l2 r* q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % [& t- X, w3 c6 I; Y3 n. Q9 L' G+ J2 e
  48. #else
    1 n! J% J1 x2 d" g& H4 l( y
  49. #define DMA_PRINTK( x... )7 I2 x* O: G# W8 k0 g
  50. #define DMA_FN_IN: u! u9 w, G* t3 z& f& O
  51. #define DMA_FN_OUT
    ' w# b6 \6 f2 {" `# s6 N& `
  52. #endif
    7 w8 Z+ ]/ `7 Z/ ^0 a
  53. : Y+ ?+ P0 ]4 D( g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) S9 F! A  X+ l4 T$ r6 j1 l1 }6 g
  55. #define STATIC_SHIFT                3
    5 c. t, F; d/ X1 `5 H" c4 K, y
  56. #define TCINTEN_SHIFT               203 y6 R+ _8 h9 l5 V8 ~' e
  57. #define ITCINTEN_SHIFT              21+ K# @$ L  j" N& {
  58. #define TCCHEN_SHIFT                22
    ! |/ U0 v5 ~1 z! P( z* E0 U
  59. #define ITCCHEN_SHIFT               23
    8 X* ^5 x4 d% [8 m- ~$ V& ]
  60. # z% B% b( G* D& \# h
  61. static volatile int irqraised1 = 0;
    / X: i4 o' w# `
  62. static volatile int irqraised2 = 0;
    . ?) I! p/ K1 Z& T
  63. . [3 ?+ {* E6 h& V. O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?/ ]7 `) w% C7 u# {4 M# }, S& M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 C3 i; [3 s& t) V9 w5 V9 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( j. J! v) Z9 t$ r

  67. ! m) n0 q3 G0 e- {
  68. dma_addr_t dmaphyssrc1 = 0;
    6 {- }. x1 V7 z) w8 @
  69. dma_addr_t dmaphyssrc2 = 0;: y5 C& q2 w+ }) J
  70. dma_addr_t dmaphysdest1 = 0;$ B% P8 a  ]" O6 I/ |* f! ^, S6 i
  71. dma_addr_t dmaphysdest2 = 0;4 j, U. M* u2 Z% e' e# @) [3 h! n* w
  72. * \( N+ x9 Y) E7 S3 l4 b' a2 h* S
  73. char *dmabufsrc1 = NULL;* K- Y) C$ {+ s
  74. char *dmabufsrc2 = NULL;! G2 o+ ^- i, _
  75. char *dmabufdest1 = NULL;
    / g, }  m; Z7 h/ U# t: {
  76. char *dmabufdest2 = NULL;# Z7 k9 }4 g2 e

  77. , k2 p& R* ^9 a9 m- H1 {- f3 ^1 [
  78. static int acnt = 512;
    5 d( u% A8 M, k4 E. A
  79. static int bcnt = 8;9 v  t  b& w7 r, v8 z
  80. static int ccnt = 8;
    , D' c" k$ W$ N  `/ p
  81.   H2 }! a& C/ C
  82. module_param(acnt, int, S_IRUGO);& s2 ?- b" a- f8 G5 j* E0 H4 d
  83. module_param(bcnt, int, S_IRUGO);
    3 e# N) x; t" O# W: P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: K2 z( N' r8 C5 a- Y# o5 ]" H1 J' c( k0 N' T  k4 B5 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: k4 q; l3 n* e. r6 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  B# p- T+ B) R: M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Q3 C0 N* A7 z8 b* ]& s  [( U( a; {% f, b$ V$ N0 J, q5 V

8 `1 {1 y5 J4 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 08:16 , Processed in 0.039631 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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