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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 r' \6 E8 {" g
  1. [code]EDMA sample test application2 |7 K9 q8 ~; e6 {
  2. /*
    # e% h- ~5 ?" C8 [- q
  3. * edma_test.c
    - @* j/ g! N/ g( ?
  4. *! [& i2 Y& w% d5 C6 B
  5. * brief  EDMA3 Test Application
    3 W' g3 E0 U! \# ?8 ^9 W
  6. *
    5 K8 m& b) P* O4 \" {' F; j+ E
  7. *   This file contains EDMA3 Test code.: n7 L; L) r+ m
  8. *1 e& j1 N4 e7 c, B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      C& {1 }3 _8 c! k3 X8 @& Z$ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( g; q# ?4 p$ `1 O( J
  11. *         TO CHANGE.
    5 u* t2 j$ ~3 f: g" T6 y  R
  12. *2 B( r) m& [0 ~( I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" J3 _/ ]1 E  L/ Q# g; A$ X  A
  14. *
    : @" R% H0 U$ J( c; L  F  J* m
  15. * This program is free software; you can redistribute it and/or
    % \2 @( y; z& l
  16. * modify it under the terms of the GNU General Public License as- ]# ]% o- C$ t% |/ A' M6 a
  17. * published by the Free Software Foundation version 2.6 k* i4 ~8 U$ Z
  18. *
    7 k" _" ?! \5 j  N( H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 I2 x# W8 T3 ~/ K6 }# {5 i
  20. * kind, whether express or implied; without even the implied warranty& a8 H# A- ]1 Z, m' I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! v+ q% v5 H; R
  22. * GNU General Public License for more details.: y  f  M! g5 g; b2 Q9 S
  23. */+ o& c+ s6 s9 |8 {+ r

  24. 2 h0 y' E, R- G5 `6 W! ^* P
  25. #include <linux/module.h>3 J3 K" U- H0 O
  26. #include <linux/init.h>) ~  J* a7 @* O9 V, y6 ^
  27. #include <linux/errno.h>4 \; @6 O' T0 n( d; G$ o
  28. #include <linux/types.h>, C! _, V/ A: u) U* u/ t
  29. #include <linux/interrupt.h>* t; S. p) e; X) n2 k8 d3 j. l
  30. #include <asm/io.h>' ?& H, f) j" w! q  C/ U3 _
  31. #include <linux/moduleparam.h>$ S+ L8 }8 P  u: t  J7 y
  32. #include <linux/sysctl.h>
    / E! {9 g/ f# o- ?$ r
  33. #include <linux/mm.h>
    & W, s6 j1 ~" P( |5 t% V
  34. #include <linux/dma-mapping.h>
    / `: B0 `8 x1 \0 Q$ \6 P7 B

  35. & N3 `+ U3 V+ N  Y7 u# Y
  36. #include <mach/memory.h>
    ) x5 ?1 _8 I9 J" P
  37. #include <mach/hardware.h>- J6 v0 C& E) k) i, x. {6 L/ m9 H
  38. #include <mach/irqs.h>
    ) y) G8 M5 k' {  T. N- M
  39. #include <asm/hardware/edma.h>
    ! l  E# Z  z4 g0 c8 u
  40. 6 t) L) w7 K# |& C! \
  41. #undef EDMA3_DEBUG
    2 }6 o: {+ b' g' [- t* e2 I
  42. /*#define EDMA3_DEBUG*/
    1 [' }$ |, r# S" ?2 e

  43. . l; \0 }& N  y6 I
  44. #ifdef EDMA3_DEBUG; ]; k, o! q9 A7 v. B- q) s& m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& T% C8 A: c% j% X: i! _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) u5 ~, g9 \$ O. t: M" y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 W8 @( ~4 D& c* g) `. f2 M# m
  48. #else2 T- U9 v2 C; Z  b) U
  49. #define DMA_PRINTK( x... )
    * S& r( L: y% G5 H. C
  50. #define DMA_FN_IN* O5 V$ Q! i, p" R% _
  51. #define DMA_FN_OUT: v8 j# t) T$ o- c* J( t2 H
  52. #endif, P! d! t& |5 T0 I9 R$ Q

  53. 7 T) ~7 x  B3 [0 C% O! _( ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), V+ {7 Y2 F/ Q0 a+ ?, D
  55. #define STATIC_SHIFT                3
    9 |4 _2 w1 R+ z
  56. #define TCINTEN_SHIFT               20
    2 X6 j: [. c3 p) q1 f1 f
  57. #define ITCINTEN_SHIFT              21; p# e- ]/ g% G. K% B+ n* X
  58. #define TCCHEN_SHIFT                225 V8 P  ^: g* y# t3 d3 n5 P- X5 M
  59. #define ITCCHEN_SHIFT               23
      y4 ]& G4 ]* m. }# f6 W( X% }: }
  60. 9 b- @. c9 M1 D
  61. static volatile int irqraised1 = 0;
    7 M5 L1 k' m3 j
  62. static volatile int irqraised2 = 0;
    4 Q2 ]6 g9 u/ {' C

  63. 3 o$ S9 S" e; K8 b% O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 I4 b# I$ x, K3 ^8 f$ J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K" B# b7 J6 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 f1 k1 g" P6 t8 b2 ?/ ~$ F

  67. 5 w' ?. r+ o1 B/ T
  68. dma_addr_t dmaphyssrc1 = 0;
    5 u0 O/ X8 G' `: Y$ O8 k3 B9 U5 S
  69. dma_addr_t dmaphyssrc2 = 0;
    2 A* [5 J  W8 M, `" e1 j2 U
  70. dma_addr_t dmaphysdest1 = 0;* F" \/ m( @& I
  71. dma_addr_t dmaphysdest2 = 0;
    6 _3 e+ ~- k# I( m0 ^# R

  72. . @  G7 o0 b" |: U3 A
  73. char *dmabufsrc1 = NULL;" H1 |* u; z5 E# k, ^4 j5 A5 J: J2 }: G
  74. char *dmabufsrc2 = NULL;
    3 y7 F5 _! {* \0 ]: g3 i
  75. char *dmabufdest1 = NULL;
    : l7 O. S& r/ l7 |* Q; R! M9 u
  76. char *dmabufdest2 = NULL;) a* J1 E7 ?1 e

  77. - u/ N  ~  V9 z! H2 S( o/ Z+ Z& n
  78. static int acnt = 512;5 C6 s" m* p, x& l  P
  79. static int bcnt = 8;) x$ G9 _% K; M8 a7 r  m
  80. static int ccnt = 8;0 Y9 m( `7 Q% w: Z8 w( I
  81. . V  K8 @0 g7 }
  82. module_param(acnt, int, S_IRUGO);
    + T+ G2 |) ?& z' \9 L
  83. module_param(bcnt, int, S_IRUGO);
    ( ^4 U- ^8 D" z) g. H9 W: j. {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; H1 Z# [% M! E0 |3 S. Q: [! B6 M* }. B4 [' @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 C- [2 `9 Q: \4 E# Q9 carm-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 H3 L; j" C0 Q- Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# r3 @5 q0 H. {/ C9 a2 F* t  w0 q, E2 z3 }

/ W4 E: G  C* e$ `4 }1 f; K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 01:33 , Processed in 0.041541 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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