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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # b% b) S) j1 w, K
  1. [code]EDMA sample test application
    ' C6 n% k) x" s% Y4 r
  2. /*( t7 ?  i4 @/ P6 v( J
  3. * edma_test.c4 A6 G9 q' A& c- }5 M. v5 D9 {+ U
  4. *
    ' Q0 f/ C# Z5 w0 L% F, v% C
  5. * brief  EDMA3 Test Application
    ; l2 ]& F9 X- |, Z5 {
  6. *
    5 p2 h0 z( ?+ b" R2 ]3 ^. S, |5 I
  7. *   This file contains EDMA3 Test code./ n: X: c6 b& x4 u3 V$ M' \! X
  8. *: N$ ?) A* q- p) O/ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ]  Z7 f2 a2 R! c+ W* v, k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % M- j6 L% @$ \6 ]& @
  11. *         TO CHANGE.8 R  C% e4 R: k
  12. *
    2 s' F4 K- I3 m, o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: L+ p: Y8 X4 k3 `: f9 q
  14. *
    ' ^) A- O0 x7 X' f# u5 C2 [
  15. * This program is free software; you can redistribute it and/or
    ' N0 o  `+ v* i  c* Y  P
  16. * modify it under the terms of the GNU General Public License as
    + W. }! o! i7 l2 [2 {: M
  17. * published by the Free Software Foundation version 2.
    2 J9 V5 L/ h' ]
  18. *
    % n! P+ V7 e1 V5 v. ~0 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; M% y- u' G0 j4 D- ?
  20. * kind, whether express or implied; without even the implied warranty
    4 B& D6 \. N# S4 }* T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" \5 P) H1 J4 r$ S5 D
  22. * GNU General Public License for more details.) Q$ C; R6 {5 z9 D1 y) a' h, d5 E
  23. */: O# ]( h; A  [% x; T
  24. ' l; e% ?/ l5 }+ j7 `% @
  25. #include <linux/module.h>7 l6 e3 A3 Y# }! W8 `- g6 ?; i, u
  26. #include <linux/init.h>9 p7 q! ^1 f' x/ U
  27. #include <linux/errno.h>/ Q: ]& m- D9 a. y- [
  28. #include <linux/types.h>+ c" t3 z* ^, a; {4 Y
  29. #include <linux/interrupt.h>
    ; w0 d! F. L7 j1 J% R7 W
  30. #include <asm/io.h>  L& ]. X& P) [3 T4 N9 Q
  31. #include <linux/moduleparam.h>
    8 R3 w  N3 v3 |# v
  32. #include <linux/sysctl.h># T" ?1 ]8 G% ~& A0 a
  33. #include <linux/mm.h>
    0 \( e( o$ g0 J9 ^/ W) I# C, C
  34. #include <linux/dma-mapping.h>& o/ \, g) g3 h* O7 _1 p0 i

  35. 8 F" b1 Q0 n% d4 `+ }. B* s( x
  36. #include <mach/memory.h>
    / s1 l3 O, s. \9 W- v) z1 h
  37. #include <mach/hardware.h>
    5 N# A3 `3 F8 g# B! ]1 n
  38. #include <mach/irqs.h>
    3 n! ~) q7 ]' a" w* L
  39. #include <asm/hardware/edma.h>
    / S/ r2 E" E: B9 ^  k2 x
  40. ! D, t1 _- l, s" u5 ]) w
  41. #undef EDMA3_DEBUG3 d6 V0 h1 F7 X) d, w
  42. /*#define EDMA3_DEBUG*/
    " ~2 J) h! w9 |/ `1 X4 i1 c5 f

  43. $ ^- G. i2 v' |+ h+ t7 c! `; I. Y, ~
  44. #ifdef EDMA3_DEBUG2 B& z: {( b7 s5 B4 D. P# r$ {$ N) W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! o0 K& t  f+ W3 G- M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * w; t+ L) i4 G/ i2 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ~$ e9 Y4 i2 S7 [  _: G1 `
  48. #else5 o- Y6 Z& ]' ~; Z
  49. #define DMA_PRINTK( x... )& ~9 X8 s5 ~( X1 C5 Z! L7 G
  50. #define DMA_FN_IN
    & d2 h- a9 H3 v# k* r
  51. #define DMA_FN_OUT! H; [2 g  b8 ~
  52. #endif, S+ P# Z' l; }

  53. % I% B3 y, }, w5 M) v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 u: m0 O$ O. k4 G5 V
  55. #define STATIC_SHIFT                3
    & K+ E  m' _  g  x
  56. #define TCINTEN_SHIFT               203 R# Y/ H$ |) k$ _/ u  R
  57. #define ITCINTEN_SHIFT              21- U' K" B, O- q  v3 Z
  58. #define TCCHEN_SHIFT                227 |/ r8 h9 N* [# m' S' }
  59. #define ITCCHEN_SHIFT               231 b' G1 P* Y! e( D, r

  60. ! U0 T( }) z5 d$ |$ n2 H0 Z
  61. static volatile int irqraised1 = 0;! f$ M3 _' U+ x) F: c. ^0 i
  62. static volatile int irqraised2 = 0;0 z% v6 R1 o  q  G" h/ J

  63. " _6 P3 s, w' Y, U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % x4 }# ]; ^7 k$ V* s8 }8 a5 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [+ o1 S) E5 k9 s3 O1 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V: h; z3 I5 z( I) i& |
  67. % A6 ?( m8 g8 [+ ]0 p3 G
  68. dma_addr_t dmaphyssrc1 = 0;
    - f9 V, g: L7 h3 S& d
  69. dma_addr_t dmaphyssrc2 = 0;2 o  `# v, G8 \, \
  70. dma_addr_t dmaphysdest1 = 0;$ w1 ^' w. a) I1 c0 X& A: H
  71. dma_addr_t dmaphysdest2 = 0;
    7 y" m' Y7 ?+ e/ c2 I0 [

  72. % ]: d8 T" C% D- I8 V0 i
  73. char *dmabufsrc1 = NULL;
    . w" O: g. F# E" o
  74. char *dmabufsrc2 = NULL;
    1 F! a. f, X" q) `  Q; A
  75. char *dmabufdest1 = NULL;4 `4 b* {1 [$ L$ `
  76. char *dmabufdest2 = NULL;
      s0 N, R+ @2 k9 N9 b: p$ G
  77. ; Q! a* M7 Q4 Q
  78. static int acnt = 512;* z; k2 _  ~9 Z- l4 t; _
  79. static int bcnt = 8;" Q4 b& S" X. d* Q$ ?
  80. static int ccnt = 8;
    0 O1 d3 n' y* _7 g1 b3 Y1 A

  81. % @. h! t/ ^4 Y4 m- _( [. i8 {
  82. module_param(acnt, int, S_IRUGO);8 n0 I$ @/ ]( @5 J  b
  83. module_param(bcnt, int, S_IRUGO);) y  d& r1 m1 {2 V; H/ ?) [6 o3 z' l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* v' d6 C4 ]9 n; X4 b
' w( a" s8 D2 m* M8 v! q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 U) }# m0 s& h2 \; n, Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( D; q; F9 ~, R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! D# G+ S3 ]. |! Q, a, e, o% s

8 `' M5 f( B9 ?8 p
* A9 [  I' i. u- O8 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 09:10 , Processed in 0.041679 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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