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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " o/ y) {& N& z' O5 r2 ?
  1. [code]EDMA sample test application5 F8 n. B& ]/ d7 x  V3 y7 O. O
  2. /*
    # M7 J0 y9 T- r; f& i% m
  3. * edma_test.c
    ; N. f9 l2 Y: i( n5 w3 p
  4. *1 N' v! f) J" m1 s) _+ L
  5. * brief  EDMA3 Test Application+ L- g: P6 H! G1 u
  6. *
    4 U( {2 r/ X3 J; \
  7. *   This file contains EDMA3 Test code.; V6 a/ G' m6 |
  8. *' D: a1 n: U& J6 E8 j# ~! v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 u% O- b' }, e% R% @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ?* E) M) B' o$ f! x9 x
  11. *         TO CHANGE.
    ; H- u0 E7 z6 t
  12. *
    7 c! K0 V2 o1 w2 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & x( _1 {3 L8 n; Q6 ]" l( Y
  14. *" t7 Y% ^6 V9 f8 C' l
  15. * This program is free software; you can redistribute it and/or
    / f9 J  u# X; e6 n) |
  16. * modify it under the terms of the GNU General Public License as
    9 `1 L9 Q) r. O2 Y6 [$ t
  17. * published by the Free Software Foundation version 2.. Y: y) K5 M/ g  ~- g
  18. *
    * K8 y8 `! }3 y- O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 S3 [( R+ d2 |% E9 G2 a! o
  20. * kind, whether express or implied; without even the implied warranty
    / F6 b' {6 k4 @& M! F( [. h" u, \. `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& u& {3 ^4 r7 _! F' u
  22. * GNU General Public License for more details.
    / A% c0 h; F1 j  W9 t
  23. */' x, w3 a/ ]  F0 p( Y' w

  24. " C0 J6 ]/ O$ H+ X- I
  25. #include <linux/module.h>
    7 {2 v7 T! _- @: n: P+ a
  26. #include <linux/init.h>
    : r8 I( j$ h2 A' ^/ B
  27. #include <linux/errno.h>
    ' O3 p- S% f2 g% I3 H# a
  28. #include <linux/types.h>6 Z4 W: l. W% X0 g
  29. #include <linux/interrupt.h>
      @4 V0 X* Y$ f& v. [0 o
  30. #include <asm/io.h>
    8 z8 w1 k1 H5 F! M" Z5 Y$ Q5 ?! B
  31. #include <linux/moduleparam.h>4 i9 B# C8 _! h/ n8 U* W1 ^
  32. #include <linux/sysctl.h>
    + q; c: Q; r! _+ E1 H0 A' t& w- [! U
  33. #include <linux/mm.h>4 u: s/ }6 A9 }5 B! ]8 x- u4 U  |
  34. #include <linux/dma-mapping.h>7 ^% l0 x) q& ^2 S

  35. # h. I, V3 x4 G, k3 z
  36. #include <mach/memory.h>6 R* B" T. C; `
  37. #include <mach/hardware.h>
    4 T" `6 b$ R9 C& C
  38. #include <mach/irqs.h>
      w! W6 `! M# S+ a
  39. #include <asm/hardware/edma.h>
    - M% y$ a1 R" d. O( g& `

  40. + ~4 G, t# l  K0 Z
  41. #undef EDMA3_DEBUG/ a" i2 {) `. M6 o; ~
  42. /*#define EDMA3_DEBUG*/
    ; G1 W2 D! W, @# \" y- c# K, w
  43. ) O% r% d9 _8 ~/ B
  44. #ifdef EDMA3_DEBUG" l! c6 @) [0 d( g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 r7 X2 d0 j" r6 r9 @% B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! a* w8 q( V$ o9 P6 X0 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 U' g: T" X6 F8 L  Y# F
  48. #else
    * ^  D$ ]2 A2 H! G( V5 W
  49. #define DMA_PRINTK( x... )
    # [, h( b. z" B
  50. #define DMA_FN_IN/ u( o& K: T; r$ D
  51. #define DMA_FN_OUT
    8 m, F+ z& o- K$ a
  52. #endif( E5 G1 Y& K* u- B5 o) J

  53. * @$ e8 U$ ?* }# m  {, g# j8 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & t; p. z3 X/ k' n' {
  55. #define STATIC_SHIFT                3- c, U! F: [( l% j! {
  56. #define TCINTEN_SHIFT               20; t* K( Q! s0 [0 V9 N5 Q2 u
  57. #define ITCINTEN_SHIFT              218 t: l- j( S* c- ?! m
  58. #define TCCHEN_SHIFT                22$ Y2 [: r2 c" x/ ^0 g7 b
  59. #define ITCCHEN_SHIFT               23- l9 p8 g9 O  h  k( U
  60. # l* M* T" J7 t( w
  61. static volatile int irqraised1 = 0;) C' `0 ]8 P4 o; O' j
  62. static volatile int irqraised2 = 0;
    1 v5 d  S& s! X- }) y
  63. ' p9 n. v# x' }3 s; O  p4 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 n6 H  {7 n5 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % M; C( c5 w) W( K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Z. L; C) E# i6 `

  67. , n* ~  X7 Q; [' n+ l7 ^; b
  68. dma_addr_t dmaphyssrc1 = 0;  Z' x$ y2 H( _( W; @) _. n
  69. dma_addr_t dmaphyssrc2 = 0;7 W7 t, {$ U$ @$ X; u3 u6 o; P# f. Q
  70. dma_addr_t dmaphysdest1 = 0;3 e3 A  F9 n8 P% N) f" o& t
  71. dma_addr_t dmaphysdest2 = 0;
    ) p& ~5 f3 e1 E) P0 i( a& K' r
  72. + P* Q3 b4 d" M" ^0 K9 o$ R
  73. char *dmabufsrc1 = NULL;' z. Y7 N  e; s5 ^6 N# K! _
  74. char *dmabufsrc2 = NULL;7 A( y. E2 Y5 ?, H5 W) ^% i
  75. char *dmabufdest1 = NULL;
    + {2 n! M9 r  K# p
  76. char *dmabufdest2 = NULL;
    ' n4 p6 p" d0 R- n8 `0 ?

  77. ! i# b4 w3 S. g; r
  78. static int acnt = 512;
    6 J" P; x) Y4 \$ |
  79. static int bcnt = 8;
    4 y$ p: Y. G9 ]; [
  80. static int ccnt = 8;' |7 T2 v: ]7 K
  81.   d' H" Z/ L, w. {6 I3 [4 D
  82. module_param(acnt, int, S_IRUGO);, J3 d7 c5 \- a+ l1 V
  83. module_param(bcnt, int, S_IRUGO);
    3 F0 F" c. Q4 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! s( X5 E, W2 v# t
8 o! j9 h9 Q, Y# L' e" H/ v# h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 m0 i' R- z- ]' Q8 F9 |$ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; R7 \" v+ j% s: ~( ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ M+ i+ W2 ]# V, ^# c0 }

' a0 E' v: ^4 D/ I! h  l" U8 E  G2 x& c, F8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 17:58 , Processed in 0.039588 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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