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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 q$ r$ m0 A3 Q4 x! G# N, l5 U0 {
  1. [code]EDMA sample test application
    ! l& J* |2 O# k" v- l( e$ [% D9 O
  2. /*
    + ~6 @5 i' C+ q: x; r4 ?
  3. * edma_test.c$ k' `% X$ R. a6 v/ H
  4. *% V2 d4 m! F8 M* C, L
  5. * brief  EDMA3 Test Application
    0 X. ?, Z" U/ `8 v1 v  C- e( [" o& @
  6. *
    * X8 {7 J1 w' j, R5 r' q+ M
  7. *   This file contains EDMA3 Test code.: R* d3 @. a* C8 P' @, w
  8. *
    % q5 Z9 i8 ^7 g% ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' I0 r7 \) _  v. k& X  M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ w- `: X8 U4 b" o5 {, g
  11. *         TO CHANGE.1 V4 K  M" }! J0 h( ]) t) l
  12. *
      m3 x; {- ?0 h- n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) O  x* y$ B5 e4 d3 f$ S
  14. *& B$ V% f, R; N* J
  15. * This program is free software; you can redistribute it and/or0 c8 y- K, l1 R4 Y9 U" B
  16. * modify it under the terms of the GNU General Public License as
    6 [' ~4 D# d" e  R# ]5 k9 _/ j$ m1 {
  17. * published by the Free Software Foundation version 2.
    3 m3 D' p3 K! `( L
  18. *" h+ v& j& c. J# @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e/ K- `. P3 C9 W, ]2 V$ b
  20. * kind, whether express or implied; without even the implied warranty8 K+ m' F- C) V$ a+ G$ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. l/ F, V2 @2 l: e" ?
  22. * GNU General Public License for more details.1 w* Y# Y/ g1 x2 K# x
  23. */" v( l; f- A& \$ l$ ^$ v3 a

  24. # m1 H# X  F* g& l
  25. #include <linux/module.h>
    $ F( B8 I( Q' a; ~+ R2 ]" y
  26. #include <linux/init.h>3 ]( i9 d2 ]! E2 V4 f* K* V
  27. #include <linux/errno.h>
    % F/ k7 r4 W5 Q4 @1 P$ I* ?
  28. #include <linux/types.h>+ J# W& T% B5 {% v6 Y
  29. #include <linux/interrupt.h>
    ! U! x7 N+ F8 c
  30. #include <asm/io.h>- }1 F, x0 {' J- b) |
  31. #include <linux/moduleparam.h>
    ' x2 V) t3 @$ _% z" X+ p. S% z
  32. #include <linux/sysctl.h>
    / k6 C6 e" Q0 ^& F3 T5 l4 n2 x
  33. #include <linux/mm.h>4 G* ^$ S& _: R/ ~& l  u
  34. #include <linux/dma-mapping.h>0 G% Y- @7 S) q( G( [
  35. * f- q& X+ [# S+ A1 D+ S/ v; j
  36. #include <mach/memory.h>& Y! ~3 i+ _$ _. @) A
  37. #include <mach/hardware.h>  y9 B2 g# W* F
  38. #include <mach/irqs.h>5 t) [3 }% G; t+ r
  39. #include <asm/hardware/edma.h>9 u( I& F/ d+ Q4 z' V) y

  40. ; O1 ?$ j; y( E
  41. #undef EDMA3_DEBUG
    7 q; f7 W" ?/ C, F. u; E
  42. /*#define EDMA3_DEBUG*/
    $ ^' y( @& S6 {# u: n  ^

  43. 2 `. O, c  q+ u  e  T1 m. I
  44. #ifdef EDMA3_DEBUG, Q" U" Q( }; q% R8 ^7 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }% P/ \0 ^7 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 V% [! J0 q6 Q7 _) f$ }% l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' |# n* H2 C* O" K
  48. #else
    - `7 k1 Z6 \; C8 ?9 C. n
  49. #define DMA_PRINTK( x... )
    9 U6 U2 `) c% I0 l9 z) b( O/ `; T
  50. #define DMA_FN_IN5 ~1 v0 A( g4 g9 K+ e6 }
  51. #define DMA_FN_OUT
    " Q5 o. D! k: d, I5 l5 v" v
  52. #endif
    1 ]9 Z3 R8 {9 k# G# H3 k
  53. 0 V% q% z! f7 @. A' w9 I5 Y  f/ B  k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " F5 I5 e: u1 }) U
  55. #define STATIC_SHIFT                35 j% g! O$ t! E; ], k
  56. #define TCINTEN_SHIFT               20
    & b" v' |% ?, D) Y
  57. #define ITCINTEN_SHIFT              217 y8 C9 p( k9 g* f0 Q5 G9 I
  58. #define TCCHEN_SHIFT                225 U  ^% D- Z& Y8 X
  59. #define ITCCHEN_SHIFT               23! P. x- J/ |1 X2 s1 S% k" j
  60.   S# {& Y: A' `5 T
  61. static volatile int irqraised1 = 0;" R9 j7 e: X9 M6 X2 l! I# s7 T
  62. static volatile int irqraised2 = 0;; O% W* k7 N6 z& c! B3 ?8 ?
  63. % J. g, \' G* ?3 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p4 m! e. a& c- P2 W, P/ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `7 A# z; e/ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b9 b% d! e& J0 E" E( I

  67. 7 f2 I9 E4 z- f" A1 U$ e
  68. dma_addr_t dmaphyssrc1 = 0;
    5 [( R. c' v  X4 q) }8 u  q
  69. dma_addr_t dmaphyssrc2 = 0;
    ) g' @) W. I! g
  70. dma_addr_t dmaphysdest1 = 0;
    : N& i+ ^  a& h' r
  71. dma_addr_t dmaphysdest2 = 0;( c$ v( K) ^* l" f2 W4 L

  72. 1 s; ~6 S: X; ?) ^; x9 j2 w; h
  73. char *dmabufsrc1 = NULL;
    5 V8 h: e. y9 t# V  X6 n! M6 V, g' D
  74. char *dmabufsrc2 = NULL;( h/ \) n7 _1 o0 a) W8 Y: r
  75. char *dmabufdest1 = NULL;+ I: z! w3 x- z- Z
  76. char *dmabufdest2 = NULL;) q* S! ?! ^' M4 h4 s& u2 N) o
  77. 4 c7 Z2 Q1 b3 n# t2 z
  78. static int acnt = 512;( [, ]6 z( X3 v, Q
  79. static int bcnt = 8;! a# _* E) @5 [" z# H2 {
  80. static int ccnt = 8;, {8 n3 M! L5 _" O

  81. ! [, j' ~0 K  U4 r, q- K
  82. module_param(acnt, int, S_IRUGO);
    ! x1 k; i% C& @! h8 G  B; q
  83. module_param(bcnt, int, S_IRUGO);  \# Q0 W# U4 |0 W' K, I" w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; T2 A; S* E9 n8 c6 A6 \: X  N# z7 ~6 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l- R! C! [; c  t8 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( g6 |& z& F- Q5 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. B4 D5 r& t6 J9 i7 C7 ~( Z
1 S2 d+ S6 C  i( Z7 B- H0 G
8 X0 U2 X) [+ B/ }4 c4 z' ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 16:08 , Processed in 0.037348 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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