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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ]9 P- g2 q1 S# t) m+ ^
  1. [code]EDMA sample test application
    ; b  U6 e: l" j2 P0 w
  2. /*) t; T1 Y& ?) d3 z! e2 j: u
  3. * edma_test.c% ~! i' f7 g; g- p+ x, R
  4. *' _! l; O' z: p7 M$ C
  5. * brief  EDMA3 Test Application8 C% N  \" {. ?/ ]. _* B
  6. *
    , _. C, T6 k) e! B0 c: g4 Y& M/ a9 \$ U
  7. *   This file contains EDMA3 Test code.
    . n- `1 `0 j8 z! }1 }) a
  8. *
    9 L) r8 z0 m+ K6 N3 H  ~  W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , Q* z2 @8 d$ J( t5 {. V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R  d( u! T. a; N$ C8 [  D- a7 S
  11. *         TO CHANGE.
    0 I" ?- c, R; n  @' E5 s, d! Q2 p
  12. *
    4 {$ M  ^  J' t$ l# e2 @6 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 h  D7 G6 D3 ?- }0 F
  14. *! `% B9 D7 a, r- e5 g/ B5 e! x
  15. * This program is free software; you can redistribute it and/or6 f4 d$ u# v. I! m
  16. * modify it under the terms of the GNU General Public License as  X+ a3 k3 l8 K. e: R. ?+ e" W
  17. * published by the Free Software Foundation version 2.
    7 F7 I6 |& D4 ~( k9 L! ?3 U
  18. *
    2 \9 `; F7 q& G/ t7 d& c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 o' S' k! r; P9 f! n6 E% q5 v
  20. * kind, whether express or implied; without even the implied warranty7 G; q  m8 m# T( l! ^" K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 a! X0 z0 W" ~. b0 k' _
  22. * GNU General Public License for more details.
    , t  u0 |' ^2 I; w5 B* q' Q4 _
  23. */
    6 s% W; p' z5 F  {
  24. & E6 Y0 k8 B4 \
  25. #include <linux/module.h># a* U. ?' {9 D) `
  26. #include <linux/init.h>
    - ^: a: g1 U& p: r; o; f9 ?
  27. #include <linux/errno.h>' t9 m1 v% J) Z+ I0 Q3 R& ?8 E& K
  28. #include <linux/types.h>
    1 Z% N; b+ u7 y
  29. #include <linux/interrupt.h>
    6 U, `% W# H3 Y# w) x& v
  30. #include <asm/io.h>7 D: J6 m' A) m9 _$ `* r: N5 ^8 u+ @
  31. #include <linux/moduleparam.h>
    ' H9 q$ J- O( D8 b! `) q' L
  32. #include <linux/sysctl.h>7 ^* T. {8 c9 R" P+ H  E* y: N
  33. #include <linux/mm.h>
    - H& ]1 \( O, ~" E5 V' c7 S
  34. #include <linux/dma-mapping.h>
    7 L2 o" \; \# d- i
  35. ! b  s' e4 t3 W2 [( _9 [/ w
  36. #include <mach/memory.h>% m, X9 A# c( K0 {7 o' y
  37. #include <mach/hardware.h>
    & O' w  W  ~/ j2 B; y  a
  38. #include <mach/irqs.h>4 h7 X( y5 m4 \4 t2 }
  39. #include <asm/hardware/edma.h>
    ( W0 P) o) E. Z3 i, U4 _: ~

  40. ' C$ @% J2 y) {6 c6 C
  41. #undef EDMA3_DEBUG
    ' B$ y6 H  w  y. V+ C
  42. /*#define EDMA3_DEBUG*/
    * @3 J4 R1 l, X' G% U
  43. $ j6 p0 w) s' B3 i6 {$ y
  44. #ifdef EDMA3_DEBUG
    6 N7 N+ P; i9 ^+ G5 b' u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + b- }+ p4 ~/ B- M. J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 M8 k$ Q* c) r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). o1 x' |6 a1 _
  48. #else
    " |- D% M) n% W- D3 R  h* q
  49. #define DMA_PRINTK( x... )- t! B! ?3 u, Y5 k$ \
  50. #define DMA_FN_IN3 e, d+ |4 E* R- T; \3 Z2 {1 g
  51. #define DMA_FN_OUT1 v2 n8 o2 O& }9 G
  52. #endif1 U8 K. s" W9 l- ^- ]9 a
  53. 3 K- ^8 Q% m8 W" A! H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 j5 Y; X2 A' P2 p; }9 E' T1 m
  55. #define STATIC_SHIFT                36 C% J- }# x- [) G+ u
  56. #define TCINTEN_SHIFT               20
    9 S. j3 l7 e/ O
  57. #define ITCINTEN_SHIFT              218 c5 ~* J7 m6 u; J0 r8 }
  58. #define TCCHEN_SHIFT                22
    4 p% A5 c0 }+ S7 J* z, n7 F, a+ `
  59. #define ITCCHEN_SHIFT               23% G/ c+ T- Q1 N* r5 V
  60. 9 n' A) |  o2 p) C; h! x6 E- E
  61. static volatile int irqraised1 = 0;
    ' z8 I2 i# q, r6 `
  62. static volatile int irqraised2 = 0;0 _0 @/ I* W1 l! f) z9 G
  63. 6 U& e4 p( e+ b' S9 G! o$ g. _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: h" Y( Q  Q- x0 q) w8 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ u) K1 V  s3 a3 ?3 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " [& ]' ~" Z- Y/ P* b
  67. 3 \0 g/ [! n$ s
  68. dma_addr_t dmaphyssrc1 = 0;
    6 D4 w6 ]6 x1 `$ D% l3 N
  69. dma_addr_t dmaphyssrc2 = 0;
    ( Y( ^5 x& i* ?7 f
  70. dma_addr_t dmaphysdest1 = 0;
    ; B5 H- m+ y+ m# G8 x& y% O
  71. dma_addr_t dmaphysdest2 = 0;2 G) P, ]) S9 S
  72. & m( K3 L8 _% J# u' U
  73. char *dmabufsrc1 = NULL;; l" ~. y2 A+ [5 V0 Y9 v* Z
  74. char *dmabufsrc2 = NULL;
    3 A; _0 h8 {# x7 F0 ~, O
  75. char *dmabufdest1 = NULL;" v6 H( k- @* y* b/ z+ c! o3 H
  76. char *dmabufdest2 = NULL;
    " K4 l: k$ Y/ [4 B" M

  77. 0 l% m7 ~1 c$ g5 I& U
  78. static int acnt = 512;
    6 a6 v& B& [- v
  79. static int bcnt = 8;
    : b  w1 V. T' Y" j! P1 F  d
  80. static int ccnt = 8;0 Y' g* d7 Y* i2 _' \' }/ A
  81. 5 P( e1 U$ U9 h" T
  82. module_param(acnt, int, S_IRUGO);
    7 L( V# s4 x0 [+ W- V
  83. module_param(bcnt, int, S_IRUGO);
    " u' J1 X$ i6 f0 |: K% \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ A$ O/ ?6 i7 x* z0 F) R. E, w, l3 {9 z! D5 ^% V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; h# `; U7 }. }4 t$ r
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  D- u3 s, S2 A  ^9 D: `8 J6 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 q/ L/ n2 @. h! k* I# `. c" k

( y4 W0 o3 ^1 B- D( C; g* e2 p: B6 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 07:55 , Processed in 0.039385 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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