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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 `; b' d4 }+ t+ f' d2 K3 {
  1. [code]EDMA sample test application5 X) b# r# D9 b& d: K
  2. /*% W: m1 v+ I& _; q% I+ h
  3. * edma_test.c9 ?. l/ u! k, A  q
  4. *& r7 F6 \* _1 n& W' G
  5. * brief  EDMA3 Test Application' K# W  S+ @4 R9 ]3 g$ y+ d( ?
  6. *% {: m; S" X9 T0 r6 o
  7. *   This file contains EDMA3 Test code.( ?# _7 }: c; K1 m& E( A4 Y
  8. *
    ) _7 S8 h9 e6 d) _  Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % q+ O* C3 V0 ]) @! `# {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 a/ U3 c/ n! ~7 V
  11. *         TO CHANGE.
    9 i$ A) M0 ?' x; {
  12. *' ~2 b+ W* i9 l" {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 P$ p9 Y6 O& V7 U* d0 c7 R
  14. *
    , M( |* g2 U6 h# _) S" [! Y; ^1 R
  15. * This program is free software; you can redistribute it and/or& j: w  {8 H5 l. f3 d- n0 ?
  16. * modify it under the terms of the GNU General Public License as5 Y5 z& ^- o5 i5 J: V" @
  17. * published by the Free Software Foundation version 2.
    " K3 P* O3 d4 V; ?
  18. *# M4 I) ~3 k2 \7 @: c* N, B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! ^/ O$ N3 A0 H
  20. * kind, whether express or implied; without even the implied warranty5 T) i6 Z8 D. \% a9 p; {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' }) S! \3 W7 S% u% Y0 Q5 p
  22. * GNU General Public License for more details.
    ' |$ H) K' N) E% R  E
  23. */& v. }% ~  @6 }
  24. . Q$ B9 A( S  S- O2 Z- G" L7 O( @
  25. #include <linux/module.h>
    5 C: r6 T" q6 _+ ~
  26. #include <linux/init.h>
    & J* t! W# w7 ?2 _3 E, M" i
  27. #include <linux/errno.h>
    & r5 [; p+ r" ^% ~% A# L9 l: S3 U
  28. #include <linux/types.h>
    & Y! ]  h1 `5 J3 A  V! b
  29. #include <linux/interrupt.h>
      |4 X4 E6 l+ a% v
  30. #include <asm/io.h>
    - l2 G, I- k& r5 E0 F
  31. #include <linux/moduleparam.h>
    9 K/ y! ?2 a9 l! D$ Y7 S7 ~& X
  32. #include <linux/sysctl.h>
    " U/ i7 y/ {  d
  33. #include <linux/mm.h>3 K" k; e( x2 Q- e
  34. #include <linux/dma-mapping.h>
    ( r6 z/ E* Y* g0 D, c+ A" t, n

  35. , A# @7 Q& C% M4 x
  36. #include <mach/memory.h>5 Z$ l# q. t7 M0 `* d. `: f
  37. #include <mach/hardware.h>
    ; C8 d' K  o, ?% z# v
  38. #include <mach/irqs.h>
    ; X  Z; u7 B* C  U) U
  39. #include <asm/hardware/edma.h>7 M* N1 q) v) N- w. b. T& u

  40. ( g1 t/ m8 q6 y' u+ B
  41. #undef EDMA3_DEBUG; Y% w7 w! N# U: I6 Q( `; h
  42. /*#define EDMA3_DEBUG*/
    ! k) p9 G/ y5 V$ j6 x- ?% l

  43. # @# ~/ j/ I; O+ R9 h
  44. #ifdef EDMA3_DEBUG- |  H4 N, e( A% L0 u5 y/ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U5 [' D; C% `- w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 d* h8 M( Y) l: Z: R3 t3 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), D" ^2 m: ~  [% x: e
  48. #else% A% I: O8 W0 o, ]+ f, X" j
  49. #define DMA_PRINTK( x... )# ^& Z# ]4 r5 U
  50. #define DMA_FN_IN  ]# f# E( K% S
  51. #define DMA_FN_OUT
    & }6 V& v& P, p0 n; h
  52. #endif
    ! M; A4 n1 U8 e6 O# e1 f  P+ A

  53. : c3 T: Q# F, j2 F4 i4 z! B$ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) Z) r+ y7 M: C" S* X) o! A5 K* F
  55. #define STATIC_SHIFT                3! @1 Q/ M( U' W  t9 a  H) C1 N# U
  56. #define TCINTEN_SHIFT               209 h# B4 |0 q3 _$ P
  57. #define ITCINTEN_SHIFT              21, n6 g6 @% C+ F' u' C* b" g
  58. #define TCCHEN_SHIFT                22
    " N" z, ~- e: ^) z7 w
  59. #define ITCCHEN_SHIFT               23% L/ a# j0 n( }- p4 Y; `
  60. ( a: f* S" U" A. B
  61. static volatile int irqraised1 = 0;. ]4 H4 M$ ]0 x2 W) l# E3 n) \
  62. static volatile int irqraised2 = 0;% Q7 N% y7 A5 l& x% P" l. ~

  63. 7 J3 @% a: [3 O2 n! F9 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 b1 f" b! x2 Y$ g5 G  ~7 W) h! C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" e& `( _9 ]1 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I+ V1 p3 i0 o8 j, U8 J9 w; X5 v

  67. : E3 i1 X3 [8 R7 P" s  z, u
  68. dma_addr_t dmaphyssrc1 = 0;" q$ y4 U- r" ?
  69. dma_addr_t dmaphyssrc2 = 0;
    9 t- X" g) {: T8 |
  70. dma_addr_t dmaphysdest1 = 0;
    , I; s& Y& z; u2 A
  71. dma_addr_t dmaphysdest2 = 0;) }* J& @) R+ {( N! F8 G  s
  72. , J! c" d+ y" ^) S; Z9 y1 v* o% k& o
  73. char *dmabufsrc1 = NULL;* g  t  G. I: \8 \. O
  74. char *dmabufsrc2 = NULL;$ K& F- [" J9 ^/ p1 {
  75. char *dmabufdest1 = NULL;
    . U, c: o( V/ Q7 m0 \5 v
  76. char *dmabufdest2 = NULL;6 n/ A& B, a! k; {( w  {5 B

  77. - E5 C) r2 @- |  C
  78. static int acnt = 512;6 I! n/ b+ `! G$ M
  79. static int bcnt = 8;3 u. f& l1 d( H- j5 q. B
  80. static int ccnt = 8;/ r' B( p! v4 D. r, k' Y! M

  81. : a; N9 Z! u6 N# S* ~" k( x! W! c
  82. module_param(acnt, int, S_IRUGO);4 K5 e( A' m6 X5 E7 Z
  83. module_param(bcnt, int, S_IRUGO);1 l# K5 y8 B# {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 |* [/ D+ s& r1 Q7 P) E' c1 d* E; C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* M% Q$ q- g9 r3 k" A/ Z6 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( J( m: |. A) w& X8 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) y7 l, j1 i! `7 {' f+ U; u8 s! E3 \7 }" [1 S
  @/ y  E' `% ?# d+ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 02:21 , Processed in 0.041120 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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