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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : o- c7 X' t# ?( d! ~
  1. [code]EDMA sample test application
    % t+ d! {- W. Z! q* k/ N
  2. /*$ }  m+ H5 r5 P; f
  3. * edma_test.c
    % q8 @% t$ c, u5 y. u1 Z
  4. *
    7 K* H2 B( H( ]9 g* @7 q
  5. * brief  EDMA3 Test Application
    + V; `; f& T* W
  6. *
    4 H' B; ]" d* C  M
  7. *   This file contains EDMA3 Test code.. N+ T. ]& K. [
  8. *+ F) d  Z' a; R* I8 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / v6 C1 z# e8 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 k2 a) Q4 m, N6 l, X' U
  11. *         TO CHANGE.( z* a5 g' P, y& L4 t! H
  12. *5 F3 U* Z" o3 X" X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' [' w5 r2 X, h) c2 ]
  14. *
    - G9 F6 ?1 u* u! m4 e2 u
  15. * This program is free software; you can redistribute it and/or
    0 _, S1 U- U. I7 B- @6 l
  16. * modify it under the terms of the GNU General Public License as) \1 p. ?9 I5 W
  17. * published by the Free Software Foundation version 2.3 L4 l7 p9 K' D8 |9 N9 d+ i" t
  18. *
    - R: M* ]0 T& X" a( x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : d8 J2 Z% J: s# s5 l: B8 r
  20. * kind, whether express or implied; without even the implied warranty
    ( }7 B: c3 l& S, K" I- N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) }# X# g- U9 s+ w6 y  L3 b* P) Y
  22. * GNU General Public License for more details.8 Q/ Y, `: f8 t+ i
  23. */. l; R8 ]" M& A# [% k9 \
  24. 4 I  l' f4 _. a7 w8 r+ }
  25. #include <linux/module.h>1 h" n+ H. ^1 }* h9 l% \
  26. #include <linux/init.h>
    9 \: t2 S4 o$ t. O8 a- x" V, x! Q" C9 W
  27. #include <linux/errno.h>$ _2 X+ j7 d8 S/ q. s; ]
  28. #include <linux/types.h># J: t' T, _0 a+ ^: ^( B2 u9 J* p
  29. #include <linux/interrupt.h>& _2 D8 Z2 y' @, Y/ d1 @
  30. #include <asm/io.h>) `$ m  f, U0 m2 S0 F
  31. #include <linux/moduleparam.h>; \' ^) t4 o2 B7 [# C3 Y+ k4 z
  32. #include <linux/sysctl.h>' L$ G5 d7 B9 V  K% e! H* B. z/ S
  33. #include <linux/mm.h>" {' ?; W( s1 ?% r# k$ S
  34. #include <linux/dma-mapping.h>
    5 q2 q5 _1 ?" O- @% v. O

  35. , y' K- K- X7 U  s, n( m
  36. #include <mach/memory.h>
      \* Y, K' m7 K/ _& T; t; s
  37. #include <mach/hardware.h>4 D3 L  h% u  @  H
  38. #include <mach/irqs.h>- [6 l- }5 x# x- k7 h# `: V) w
  39. #include <asm/hardware/edma.h>
    1 |# u  X7 v: K8 ?# s; B9 E

  40. - x3 Q0 a4 q: Y
  41. #undef EDMA3_DEBUG
    & Z# p0 v5 {+ M
  42. /*#define EDMA3_DEBUG*/0 K/ H& ?  a9 m, P9 E$ J' T

  43.   e! r! X/ {2 W* S
  44. #ifdef EDMA3_DEBUG# X8 \" Q3 e# _8 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ]- \% W( r1 r) {3 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ]: t9 w! D$ {) ~# W* @# b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [( Z9 a' Q, I5 z. a. e* n
  48. #else
    6 u1 ?: K( ]5 S
  49. #define DMA_PRINTK( x... ), I0 y* V0 e. D" Y
  50. #define DMA_FN_IN
      _+ e; n* s* O. h' ?- Y6 H
  51. #define DMA_FN_OUT6 ~- H5 r' t+ ~9 R$ r: A1 h
  52. #endif5 D7 w1 U' P/ j0 a. ?# R' Z, {
  53. / S4 E( `) w& t& p# Y8 x4 ]0 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( }2 G, ^3 ?/ G5 _( H
  55. #define STATIC_SHIFT                34 u6 ?$ A- ^, I) X8 H9 A
  56. #define TCINTEN_SHIFT               20
    - C$ j6 X+ S' v
  57. #define ITCINTEN_SHIFT              21
    ; i8 M- c) _  \/ C
  58. #define TCCHEN_SHIFT                22
    : z& O  L8 f9 S7 q1 N3 d- ^
  59. #define ITCCHEN_SHIFT               236 ?, V1 j- I& z% j) y- s3 x

  60. " v7 Q3 [6 [- K( b' Q* f* h
  61. static volatile int irqraised1 = 0;7 A6 W+ P- y9 J+ [& K. o0 _
  62. static volatile int irqraised2 = 0;
    + |" B( u5 L& }( \9 N* e
  63. / q6 V0 q8 t! h" S7 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d! i6 ^! C: S5 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% A6 \; c" `" n1 U1 v0 q) e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B3 B1 G/ W# R  C
  67. 6 G) |# `' N# J! D5 q. Z4 K
  68. dma_addr_t dmaphyssrc1 = 0;0 V: s( n7 X% m: L, E0 Z& Z- w6 J7 D3 E
  69. dma_addr_t dmaphyssrc2 = 0;8 v0 _- j' l5 }' r/ v  s& D
  70. dma_addr_t dmaphysdest1 = 0;' p# l. S, J- D5 w8 r
  71. dma_addr_t dmaphysdest2 = 0;3 I* {* F/ t4 @+ D
  72.   ^3 d6 E, q' g8 w2 i3 w; D* h
  73. char *dmabufsrc1 = NULL;- d4 i, x& N0 g9 a) S' k/ ]9 A- ^4 A
  74. char *dmabufsrc2 = NULL;
    $ u! U1 q% k8 W% z& k. `
  75. char *dmabufdest1 = NULL;$ \4 _$ O, ~: u
  76. char *dmabufdest2 = NULL;% Z' ?, e; ?: \

  77. : T# F8 e: d# Q8 {7 [. l6 @
  78. static int acnt = 512;
    9 o5 q" k( [+ U  T7 C. E, n
  79. static int bcnt = 8;
    2 F5 [. p* }0 n$ x
  80. static int ccnt = 8;; _3 }+ l( U8 @. }& N! u
  81. 3 y6 L, G9 \* H  m: `! o7 y
  82. module_param(acnt, int, S_IRUGO);
    * E8 J+ I# {0 r+ ?6 j
  83. module_param(bcnt, int, S_IRUGO);. p8 ~+ P& z5 {8 I: x# j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% [( B# O+ o+ i7 v

& ~0 E- B4 u8 g6 ]5 p# ~' s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ h2 L* d" P- Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n* y+ M# O  N% U6 f7 H9 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, W8 _) E7 P1 J6 f) {6 A5 O- t$ m* d+ p5 _; u4 e& J9 K! e
- p+ o8 E# a; K; w. f+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 22:14 , Processed in 0.040749 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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