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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % b% h7 Q2 L0 f! E3 F" v3 P, N
  1. [code]EDMA sample test application
    & G% T$ S! ^" f: |6 d2 x# V
  2. /*
    - I" u2 ]7 P! S, ^5 v8 ~: p# a! [! O
  3. * edma_test.c
    ' y1 p9 K1 N$ M5 V: z9 Z! s% N
  4. *' J5 n, o( f1 K; j; d6 V0 b
  5. * brief  EDMA3 Test Application- s/ d8 b. F( L+ s9 i, o, q6 f
  6. *
    4 M! v3 t$ i. d1 o2 ~
  7. *   This file contains EDMA3 Test code.
    7 X! i* }& H  G4 S/ m/ `
  8. *
    / l2 o% k6 v! s. k/ a. o' A! \! g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 T. t! K% x' w: F3 D) K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  V! P3 j4 u9 d8 \9 U
  11. *         TO CHANGE.4 m# l/ X$ F) e( J* D) G0 W$ N
  12. *4 i) ^2 |- j6 k3 n5 z6 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. w' n4 K7 |' o7 }: ]
  14. *- C( G0 g9 p1 @, e* ^
  15. * This program is free software; you can redistribute it and/or
      ^0 f8 s* [/ {+ |" L) [
  16. * modify it under the terms of the GNU General Public License as
    ! R4 X9 _0 e6 p/ \6 X
  17. * published by the Free Software Foundation version 2.
    5 A  J" w1 s# T$ f# v
  18. *7 p; N( G) v2 ^4 Y7 I" G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) R) I$ N4 G8 x" z4 a: \7 |3 l
  20. * kind, whether express or implied; without even the implied warranty- x" V5 F- D9 T" C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 _$ O7 U2 [' e2 K
  22. * GNU General Public License for more details.
    : h0 r9 a$ v$ T+ J1 y/ V+ x& w" k
  23. */
    0 ^. C+ w1 l" `. y7 n- I/ A9 ~, ]

  24. 9 i1 ]0 H4 E2 a' M! [& V
  25. #include <linux/module.h>1 K  C3 Q4 G$ f# r! K# o7 b
  26. #include <linux/init.h>
    4 e, b$ r  l+ G/ x) M: U
  27. #include <linux/errno.h>( B! H; B! v/ M$ v0 B. i, \
  28. #include <linux/types.h>6 ?$ h! u! L# a( X  M4 m
  29. #include <linux/interrupt.h>
    * j, _7 P% Y; U1 m' k# }9 n
  30. #include <asm/io.h>% H/ r: w! k9 t
  31. #include <linux/moduleparam.h>
    # B) E0 T3 p$ A: F
  32. #include <linux/sysctl.h>
    ! R& U! l  x0 m7 _7 @7 l
  33. #include <linux/mm.h>
    8 P* x! P6 G" l2 D$ ^( Y. k
  34. #include <linux/dma-mapping.h>6 F# K/ N5 f  E; _1 n

  35. . n* w" }  I. I8 M/ f
  36. #include <mach/memory.h>; a/ S! R' B2 t9 b+ U  s
  37. #include <mach/hardware.h>; w+ N! o& ?1 m% @# m) w! M
  38. #include <mach/irqs.h>' f! \4 V5 t" g* E
  39. #include <asm/hardware/edma.h>3 H2 R; x8 K) V6 @3 l$ O4 F7 M
  40. : o2 l2 V0 d5 `: g$ {4 @! w- }
  41. #undef EDMA3_DEBUG! K# R* \1 R" U) _! {" h/ Y
  42. /*#define EDMA3_DEBUG*/7 [- u1 H% {3 b& y

  43. 7 {6 }& T6 L( [+ Z5 h3 r
  44. #ifdef EDMA3_DEBUG
    ) e9 G% `) B: D! s, }) Z9 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). z" n; ]% G1 Q( ]  j4 }9 [4 R9 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 f% f- P0 o; I8 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 H5 {, V% z( D) x
  48. #else
    2 f0 i' @: [& w
  49. #define DMA_PRINTK( x... )2 ?: ]6 H8 D3 F# i& N2 C
  50. #define DMA_FN_IN
    , c$ J. u* q& W1 `% s3 R6 E+ E# r
  51. #define DMA_FN_OUT/ V2 ~9 d) f. g, ]
  52. #endif
    ; c/ }- Q0 \% R2 I7 l6 {6 F

  53. : ~- t( f# |& Y1 m+ y; \& u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 D. ^% c( t0 z2 p6 [% `2 E
  55. #define STATIC_SHIFT                3
    5 c2 G9 M7 l7 x2 s5 v) N) N5 d
  56. #define TCINTEN_SHIFT               20
    3 U  @9 a- u: I6 ?  [6 G
  57. #define ITCINTEN_SHIFT              21
    , @7 |( g, g& Z; i
  58. #define TCCHEN_SHIFT                22
    5 C: b4 ]$ w3 C/ p
  59. #define ITCCHEN_SHIFT               23
    ; M& Z  K+ k; A, l, f' s6 S- t
  60. 8 E  w6 b. O3 o# w( b
  61. static volatile int irqraised1 = 0;3 o' m" p, ~" t+ j: G8 B4 E
  62. static volatile int irqraised2 = 0;
    ' T) K6 Q, W  ?! ?. i0 V

  63. ' x8 [. ^7 p, d& i2 I9 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' _+ {: E6 o8 }1 e1 v7 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ e! h/ A% Q4 |1 l3 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f) ^+ A( G: P9 R' i
  67. * c/ H# k$ `. G" ?7 H  k; l/ M0 u
  68. dma_addr_t dmaphyssrc1 = 0;0 }% n" f# ?: X7 |# T0 o/ N
  69. dma_addr_t dmaphyssrc2 = 0;7 j# r; k# \  D8 Y9 |8 h2 f, V& b
  70. dma_addr_t dmaphysdest1 = 0;5 f, b* V4 `9 G. n. v
  71. dma_addr_t dmaphysdest2 = 0;
    7 X  d$ T. O) k

  72. 3 g1 `1 A, A/ b# `( _2 z
  73. char *dmabufsrc1 = NULL;
    & A9 d: l3 S' i  }/ i
  74. char *dmabufsrc2 = NULL;
    7 V& [- h* P5 y4 B8 @( b2 D
  75. char *dmabufdest1 = NULL;
    $ q& r9 L8 Q/ P: d! E0 H& d
  76. char *dmabufdest2 = NULL;
    1 m* o$ ^, i/ G. W

  77. : S+ y* I) R+ w; g
  78. static int acnt = 512;
    1 n4 u- i- q7 y6 B' v( Y, K& \0 \
  79. static int bcnt = 8;) f, u  x8 L; J8 f9 Q3 r
  80. static int ccnt = 8;
    8 U6 S  M1 }9 {4 N$ ~- ?

  81. % k; f, |) o: b7 m! V3 D+ z
  82. module_param(acnt, int, S_IRUGO);
    1 B8 r3 j7 E; O; w( N( O
  83. module_param(bcnt, int, S_IRUGO);
    ' E7 H+ }9 r# v- w/ b2 N0 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( \5 M/ G* ^" Q3 j6 G! c% s- s/ N! L- ]7 B- y0 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S3 v' A2 j! W# w/ j- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 F. r5 s1 D- m+ ]! T# l& g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 L+ o" R1 h1 z* j* G
# a6 H9 d# q4 b, V
" X; W; J/ ?: n) W! s2 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 17:55 , Processed in 0.038209 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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