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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; H' a4 g' T6 \+ M
  1. [code]EDMA sample test application
    " ~8 E5 d& K( n% _2 R
  2. /*
    9 X2 N6 Y& y' z$ E8 x4 ~! T+ g
  3. * edma_test.c
    1 A' u. d$ P; K; q4 _
  4. *
    : g8 d9 N7 b0 v1 p4 o2 G5 k
  5. * brief  EDMA3 Test Application1 [* h5 e1 M& Z$ W! M! V  O- F
  6. *3 k; U. b9 v2 o1 n. Q' Q5 r- [" z/ n
  7. *   This file contains EDMA3 Test code.
    ! w- [- `6 b% s. [+ }
  8. *
    3 S6 h, E, j( ?% v0 [7 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 e) o0 ]5 e& `; j' z2 M3 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! q% x3 `( [: h. J6 Q# w) V5 `
  11. *         TO CHANGE.' o3 @0 h# J; X, O, ]; }$ p5 S( o4 G
  12. *4 Z4 z/ r/ i/ U3 d, w4 h2 c5 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! t' ^, Q; W5 B; J, n# i
  14. *
    7 o. K1 X$ n1 Y* J) l- c
  15. * This program is free software; you can redistribute it and/or
    ' l; g2 Y, H( V& ?' N9 G
  16. * modify it under the terms of the GNU General Public License as- ~  o6 _' X2 \7 Q8 u
  17. * published by the Free Software Foundation version 2.0 o' f* @! H- }. K9 @
  18. *
    : l8 N' L* x6 C, q+ r2 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! X0 ?5 Q3 B- Y0 ?2 p
  20. * kind, whether express or implied; without even the implied warranty
    0 \8 E( S, {% s* ^5 [& z2 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% J3 m% C) r! ]8 M5 s* @9 t% I* _( @
  22. * GNU General Public License for more details.3 s3 Y8 P( n: G$ y; c. l& B3 r) U+ r
  23. */
    2 \4 `5 {2 n9 q$ ]

  24. 2 C1 |* {0 \  L1 `2 l
  25. #include <linux/module.h>
    3 o, {. K: b7 x! ~! n# t* Y, c! w
  26. #include <linux/init.h>5 q% }0 j  c/ b+ k
  27. #include <linux/errno.h>* ], I$ |: o; b, e
  28. #include <linux/types.h>
    0 s% y2 h# t& j! B3 ?
  29. #include <linux/interrupt.h>
    , Z: B, C$ w8 q
  30. #include <asm/io.h>- c3 z/ o3 u4 K1 \' q. L4 a' z) @4 ?, H
  31. #include <linux/moduleparam.h>
    ' ~4 {. e( O& L4 a6 ~: t6 q
  32. #include <linux/sysctl.h>
    - _; s* J' j: q! P: d* Q
  33. #include <linux/mm.h>
    & t$ z! ]$ E# B* F' y! a
  34. #include <linux/dma-mapping.h>9 [- Z+ d3 d# |" o) L

  35.   D/ n. I( z# Y
  36. #include <mach/memory.h>
    3 ?3 Z* C3 K- q5 E5 c0 v
  37. #include <mach/hardware.h>5 P9 Y5 Q! ~1 M) s1 ]+ B  Q
  38. #include <mach/irqs.h>) I4 w0 v( y3 Q
  39. #include <asm/hardware/edma.h>
    2 D; n6 |. n! u: s& e, S& K

  40. 8 Y) z6 ]+ S- e& P
  41. #undef EDMA3_DEBUG
    2 P% g! g/ Q4 |' o
  42. /*#define EDMA3_DEBUG*// S: G! K8 z* L
  43. 7 A" Z6 W& v" r
  44. #ifdef EDMA3_DEBUG
    + J4 ~/ J" A! ?9 q) a/ D0 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); _+ n7 N# L( _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # F0 C- o5 O' D6 @0 B+ Z6 \3 _5 \# ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), g1 N6 c- N' l, O; A$ B7 x
  48. #else
    7 Q/ u# _) t5 V7 c! S7 s5 D
  49. #define DMA_PRINTK( x... )4 {9 E5 V! z+ a" ~" m. W
  50. #define DMA_FN_IN
    % S/ x4 _. R0 S  h; S. v
  51. #define DMA_FN_OUT
    # ]9 r  h, k6 ?* D0 N& |2 Y
  52. #endif
    % u. Z/ F1 l* o0 r
  53. . v+ J+ C, q0 {. h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) a% J+ @# K1 m# R2 m& F! H8 c5 d" {
  55. #define STATIC_SHIFT                3
    & E0 R# ?! X8 I+ k* V
  56. #define TCINTEN_SHIFT               20
    ; c7 |5 r2 G1 Y) @2 [* \
  57. #define ITCINTEN_SHIFT              21
    2 ~7 [# v) ?. c
  58. #define TCCHEN_SHIFT                221 C+ Q: d7 e4 a' D
  59. #define ITCCHEN_SHIFT               23! E) ~% n3 J! L( E  o' T* [+ L
  60. 8 y! }/ x0 `9 V( T( F- ?6 P
  61. static volatile int irqraised1 = 0;
    & U1 j' s7 t9 \" a
  62. static volatile int irqraised2 = 0;: e! i7 O* ?- F0 L0 ^2 z2 O
  63. 5 B: M( Z/ p7 n- Y9 O+ H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~- Q  g1 x$ @) m7 e7 ]4 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y% M+ \" g3 r8 e( V4 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ~- b4 m% n! q  l8 V7 r2 a

  67. : ^) W/ i5 f1 V8 }' U7 t9 d" `( b
  68. dma_addr_t dmaphyssrc1 = 0;
    * Y! }% k1 P& R
  69. dma_addr_t dmaphyssrc2 = 0;3 v1 N/ G2 W* p! G2 X
  70. dma_addr_t dmaphysdest1 = 0;! e3 z. T7 H( O2 Y) M
  71. dma_addr_t dmaphysdest2 = 0;% \& j3 t( o1 o7 k( [6 h
  72. 7 }1 m, D( \5 o& i% E
  73. char *dmabufsrc1 = NULL;/ Y- K8 H' G. }1 ]3 @, f
  74. char *dmabufsrc2 = NULL;
      |7 g% ~3 `2 S$ ~; q( K! c
  75. char *dmabufdest1 = NULL;
    9 {9 W$ s. ]( ^$ n
  76. char *dmabufdest2 = NULL;. r2 w3 j1 S0 ~* d
  77. ) f# U+ P, r8 A
  78. static int acnt = 512;
    & ^4 o/ E+ _9 g( G
  79. static int bcnt = 8;
    5 m2 X% Q+ r7 s( T+ H
  80. static int ccnt = 8;. K3 `2 S5 Q, H4 A# W6 j1 f
  81. ) E6 X: @- I# h2 @- |
  82. module_param(acnt, int, S_IRUGO);
    ; v% J5 I" t8 k- f- }8 ~
  83. module_param(bcnt, int, S_IRUGO);3 E- V' k1 ?* U, v8 t0 H5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) m, E+ p5 W1 b$ T
( \3 X. S% \9 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% b0 |" z# \8 I# B9 [; {" L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# y- e/ G# c0 k% Z% S3 r7 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, R7 w- I5 W9 z6 H% ]! w; X

' v. R  P5 T! F: C3 I6 Q: ]! ~. \4 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 22:14 , Processed in 0.037930 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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