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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 G/ F8 _6 M* V) O
  1. [code]EDMA sample test application% c: X7 @/ u2 G" ?0 s% [- {
  2. /*, b: ?, J7 m- S' T  F; Q
  3. * edma_test.c
    % M7 t( l' \: M9 M
  4. *
    ! q7 L# b) {- h5 S$ w3 Y( ~
  5. * brief  EDMA3 Test Application
    , H+ m% [' m# ^( m4 F
  6. *
    * I$ l8 q8 I: ^+ z3 M
  7. *   This file contains EDMA3 Test code.9 w& U; o+ z( E, _8 y4 d8 b# J
  8. *
    4 g# C" G" R- U. H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 }5 [, H5 \) e8 A$ N& S0 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + R+ A- i& A  P' k' f6 P; O
  11. *         TO CHANGE.
    - W# O9 k- `- i; K0 E8 @
  12. *
    5 L9 {: U9 t9 d6 i& b5 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  O+ `; I( v) {9 f" ?1 s7 n- A
  14. *
    / j7 ^7 X# s5 u* I
  15. * This program is free software; you can redistribute it and/or2 p7 e, t# @5 D/ ]) g( c
  16. * modify it under the terms of the GNU General Public License as
    ! Q2 ^5 P- w- |( r  F
  17. * published by the Free Software Foundation version 2.3 J- v* j6 P  H7 H% v& F4 p! ~
  18. *- ^6 ^  M+ k/ ~8 \9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ g% Y# w  n; |6 P
  20. * kind, whether express or implied; without even the implied warranty
    . H6 I% ~. F! g1 ~& R: y! g/ V# K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / C. }; L; P, I9 r0 l3 H2 U2 Z
  22. * GNU General Public License for more details.
    . k" m: \  ]% s2 s
  23. */
    # D* h, a# |* b% R2 `( F
  24. 2 b6 h5 m& g: @
  25. #include <linux/module.h>
    0 Y/ t1 f2 x# d
  26. #include <linux/init.h>
    ) p8 c2 R. J& u7 w) T
  27. #include <linux/errno.h>8 C- D+ o. Z3 y+ X8 I- b
  28. #include <linux/types.h>' v) B# F& f( i# n9 O' M
  29. #include <linux/interrupt.h>
    % Q2 W0 S3 ~: o, S  u  X8 [
  30. #include <asm/io.h>. D% c( f" p! G5 v% w$ _; j7 z
  31. #include <linux/moduleparam.h>0 Z% y9 `# M. T$ O/ O3 h
  32. #include <linux/sysctl.h>
    % @7 I: l; W7 U: u  v
  33. #include <linux/mm.h>
    , z8 Z0 E7 T8 j: r& h7 t: z" T$ a
  34. #include <linux/dma-mapping.h>
    ( G" p$ T/ k; a5 i& `9 ]

  35. " m; H% j% H. V/ A/ O
  36. #include <mach/memory.h>
    ! p2 u# A1 a1 W7 B& t" i
  37. #include <mach/hardware.h>
    # ~' a4 v. T4 p2 l
  38. #include <mach/irqs.h>& S6 F0 p  U* l- _  H1 O# H8 {! A/ Z
  39. #include <asm/hardware/edma.h>+ J* }7 Q; l0 Z# b7 v& s& M

  40. , _5 d7 k2 @. Z( a- a/ s
  41. #undef EDMA3_DEBUG& v, V) ]7 @- o( x+ z% B
  42. /*#define EDMA3_DEBUG*/
    ) m# Q* Z3 B. \; A6 q" }: X" Q; B

  43. ! ]6 B+ B, j% n+ [' C
  44. #ifdef EDMA3_DEBUG$ ~( [/ d8 O" f) |2 P4 {8 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). {/ Y, F5 ~) J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 R1 S: X4 N  K/ K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / ?: n5 d. w; _2 T! p1 D! l4 `
  48. #else# l* t+ \. {% T6 G% [: w$ n; Q) q
  49. #define DMA_PRINTK( x... )
    2 {$ V" j6 O) o' A' U
  50. #define DMA_FN_IN
    . k, v7 F+ ]% }- v, X2 U
  51. #define DMA_FN_OUT) b4 M# r/ k9 E8 S& k  O
  52. #endif6 F* c/ ^# c, d! t# S4 Z
  53. ! C, v" R7 }/ i3 K0 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 I5 a" W7 j8 T! v$ {2 O7 V+ L  r
  55. #define STATIC_SHIFT                31 c0 X( h' f! q) A
  56. #define TCINTEN_SHIFT               20
    3 G3 _2 C) }/ \  h' n, m! H' N2 l! X
  57. #define ITCINTEN_SHIFT              21$ a5 r  l4 x( x  `
  58. #define TCCHEN_SHIFT                22+ C% ~4 x* P, [5 N8 g
  59. #define ITCCHEN_SHIFT               23. O! R/ Y' U+ i& v( a9 Q9 {. I

  60. 0 h. M0 o8 D# h* A1 i
  61. static volatile int irqraised1 = 0;! T" A- B" r' [6 k# b
  62. static volatile int irqraised2 = 0;  s2 \& h7 I' K0 O- b2 R/ j$ B
  63. ; C2 ?/ E4 K1 i% }' }+ e; t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) p) P1 l0 {" u3 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z, A. {' g' h% H& |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . s- |. N0 c% g) U2 r  f

  67. : T  B' u: e: D5 q  U
  68. dma_addr_t dmaphyssrc1 = 0;! `  {3 C% J' a
  69. dma_addr_t dmaphyssrc2 = 0;4 Z  L2 l7 ]) L$ \- U
  70. dma_addr_t dmaphysdest1 = 0;
    " z, N1 Q% E1 p5 m9 _
  71. dma_addr_t dmaphysdest2 = 0;
    9 j2 L  U7 K9 h) l' L. p

  72. , c) ^1 P! z8 h& ~8 P# p
  73. char *dmabufsrc1 = NULL;$ F& B3 r: v3 X
  74. char *dmabufsrc2 = NULL;1 ?+ {: [7 c+ P, i
  75. char *dmabufdest1 = NULL;
    2 E  v1 @  t; ]7 v4 W4 t
  76. char *dmabufdest2 = NULL;
    9 d% d5 s6 Z" N' q& [2 q2 [
  77. / B4 x8 b2 d. w7 w5 ]6 C
  78. static int acnt = 512;9 M2 n2 B2 P' T- K( t, p
  79. static int bcnt = 8;
    3 P& @6 P* \. \6 E' \
  80. static int ccnt = 8;% t: D+ F$ L# Q3 ~
  81. ; p. \) F* l  V' B
  82. module_param(acnt, int, S_IRUGO);
    # \+ M# W3 @0 U* R$ Q' a
  83. module_param(bcnt, int, S_IRUGO);
    , a/ c/ {1 }9 P9 `$ l0 S& K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 O! s& J- v( b* X/ Y/ q) c
- K  i( I" J4 s8 w6 ?1 x: k* n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( o' {; o1 g; {: K$ _+ p7 c2 p7 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( V" W+ b8 w& f! z, O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" t/ |" d7 @, U6 U- k* D
- c( G' d2 y* m# I1 y; K! U* L
  B6 {( x. h  ?' _8 A6 S" a  d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 16:09 , Processed in 0.054524 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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