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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( t3 n" _" Y1 X( N+ S$ u7 p
  1. [code]EDMA sample test application( X7 T7 c$ t' Q5 R% r9 H
  2. /*8 Y" h+ {" C& g
  3. * edma_test.c
    ) D5 D3 i  A) `' |+ J
  4. *
    7 z1 h- e0 H; |* f( ]8 Q, V5 ]
  5. * brief  EDMA3 Test Application
    ! Q' w1 |9 ^* S3 K4 X
  6. *
    $ {# W: F2 q6 T: u
  7. *   This file contains EDMA3 Test code.
    - t6 Z6 N& Z9 D, @0 K. U
  8. *
    ! h5 H! ?3 x. c7 }9 T" ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 D* g5 k; W1 H& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R( I% h9 ]4 |: S6 t5 x
  11. *         TO CHANGE.) v7 ^# b- N" h) M* S: r
  12. *
    - w0 g; I  S+ L: b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . I2 @( c+ a2 V* G+ @" {. ]
  14. *
    * w5 X6 {( w, {6 c% ^" Y# ^
  15. * This program is free software; you can redistribute it and/or% a# b( [1 [8 z: M7 W6 ^
  16. * modify it under the terms of the GNU General Public License as
    $ k9 P1 \5 N7 H  N
  17. * published by the Free Software Foundation version 2.; o1 w7 ^5 u4 h3 ?( P9 M
  18. *. \8 ]; C; \% Z! S, {' s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; u4 `  f( T7 z, F' w. E
  20. * kind, whether express or implied; without even the implied warranty
    & l5 C0 H$ x, X' Q; @, R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 Y/ @- D7 n( i: Q! C; n6 S
  22. * GNU General Public License for more details.
    & J8 L2 h) T* w1 W2 w, R" w
  23. */
    - O: O( H. b& Q+ X. @

  24. ( V( [9 B8 N1 d9 O& u+ g) v
  25. #include <linux/module.h>9 M. P4 D9 P+ d
  26. #include <linux/init.h>9 T, d4 L! j; a$ ~  Z9 Z5 c
  27. #include <linux/errno.h>
    6 F: I5 ^- q. I# j4 W6 ^
  28. #include <linux/types.h>) s, Z$ N* P' p
  29. #include <linux/interrupt.h>
    : S) }6 f0 R) {0 j
  30. #include <asm/io.h>
    ; S( B1 u6 k3 ^9 d3 v+ Y7 V
  31. #include <linux/moduleparam.h>- ?0 q' G  ?) l
  32. #include <linux/sysctl.h>3 q" ]$ t* b, @( d
  33. #include <linux/mm.h>
    8 b' h7 U4 D! O8 X5 o" |
  34. #include <linux/dma-mapping.h>( f* ]6 x8 b& g7 {+ q3 I* u

  35. - O+ j$ ^- T( w, |3 R# q' K( _& w
  36. #include <mach/memory.h>
    , t# {$ B" g* D) h) K4 ?/ L
  37. #include <mach/hardware.h>
    4 i& M" A2 p- p1 G, a. }" t
  38. #include <mach/irqs.h>
    6 d7 z2 Z$ {7 S7 s- ^
  39. #include <asm/hardware/edma.h>
    * z0 {& A" F! K* U! S; l# J, T

  40. : ], x8 p2 e; J$ o# u/ |2 H0 r
  41. #undef EDMA3_DEBUG
    $ u' A$ R( o3 w% [' x
  42. /*#define EDMA3_DEBUG*/
    & H4 ]6 s4 q1 _2 h# d8 m" R

  43. ( t' W( K' y. i5 C6 `* M
  44. #ifdef EDMA3_DEBUG8 F% S8 P4 u$ o8 z) ^# C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]3 E' y: K0 o; I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); s3 R5 r* i1 Y" p- o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x$ ^( S1 R3 D
  48. #else
    3 H; B& K0 }/ T2 m% {' d
  49. #define DMA_PRINTK( x... )3 T& k% u  j: }+ w
  50. #define DMA_FN_IN
    - _3 C  g7 M3 M# M
  51. #define DMA_FN_OUT- W' S' p" o, i# |! q/ a
  52. #endif
    ! o: D# F* y, e0 l
  53. : F; ?5 Y" t; {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * c. N1 R' p% A2 ~& @
  55. #define STATIC_SHIFT                3
    . F5 @1 t" ]6 Z8 l+ s& N0 k
  56. #define TCINTEN_SHIFT               20
    0 ?5 A& f8 q9 ^2 ^) t; Y
  57. #define ITCINTEN_SHIFT              21
    ( U5 n7 _" J+ j1 y% q7 `' b, s
  58. #define TCCHEN_SHIFT                22
    + t" {8 j! f& s- b* N5 r
  59. #define ITCCHEN_SHIFT               23$ S# a  @5 }0 m- T. s; x0 o+ j
  60. 6 J" p3 U- w6 ~' P9 a
  61. static volatile int irqraised1 = 0;6 x3 l# q8 D0 F4 M; \! i, Y
  62. static volatile int irqraised2 = 0;" t2 l5 M4 D' M4 F# m

  63. 1 G3 K0 d1 h, L7 l9 g2 C* ?# h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~8 D* P' E5 I( ^0 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; _# s% s* k0 s9 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( `, z  v% R$ V7 c5 a

  67. : L! k" e8 d7 x( T* v/ \
  68. dma_addr_t dmaphyssrc1 = 0;
    . L7 u4 w8 ~% R5 M2 T9 M
  69. dma_addr_t dmaphyssrc2 = 0;  T0 C. |* o: @; ^' w) P
  70. dma_addr_t dmaphysdest1 = 0;
    3 H( Q4 m; ^! n/ O& I2 m
  71. dma_addr_t dmaphysdest2 = 0;
    2 G! e# h8 t2 v% s; b6 F% L5 K
  72. : S, c: c; b% C
  73. char *dmabufsrc1 = NULL;/ `, n) N6 _# A- Q. Y) o; `/ s8 F
  74. char *dmabufsrc2 = NULL;( C) I% p& m; C
  75. char *dmabufdest1 = NULL;' q% h0 {9 K( K, z2 I2 n
  76. char *dmabufdest2 = NULL;
    6 w! X; Y1 Z. G8 Z$ ~! X. |
  77. : g9 W/ y( r9 q7 y3 L0 [% }
  78. static int acnt = 512;0 _& ?5 Y8 R' P7 g6 e6 }
  79. static int bcnt = 8;
    9 m0 ]" V. v) R" p/ m
  80. static int ccnt = 8;. Z( |* ~5 O) m; U4 ~
  81. % N* _2 b6 |. z
  82. module_param(acnt, int, S_IRUGO);
    , f' \  E5 t% g7 j# U
  83. module_param(bcnt, int, S_IRUGO);
    9 Z; \, Z& M7 p% y  |# [4 y  K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- s- d) N  F4 I% r3 K
& J$ ~! G1 s  Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! r$ b) U( l4 j6 P2 i0 k3 Y* }+ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; w3 m9 n( R! Q. ?' F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 }; ]$ q8 ?. g  ^: [' S" k8 h' C; u0 k" k2 o# a" m/ u4 n

0 r7 a- S7 j, x2 F$ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 22:08 , Processed in 0.040797 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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