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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 o7 j: L9 ]" u: h% D
  1. [code]EDMA sample test application
    ( \2 V! x8 N3 ]) B2 a: M. N" Z3 ?+ e
  2. /*
    ' T6 Q# U7 I7 ^8 G* i7 q: `6 R
  3. * edma_test.c9 {' c1 T& u; J8 B2 U  ^
  4. *
    ( P, q0 ~; V# t$ ~1 ^
  5. * brief  EDMA3 Test Application+ E% w( @! n2 Q7 ?# i9 U" H( d
  6. *
    # F4 z- I! t" {$ g1 @
  7. *   This file contains EDMA3 Test code.
    / V* g, X7 K4 k' }  L$ p  E
  8. *
    9 F; F; |2 b, l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( ~9 ^; M! s# x" b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# {. t, w% Q6 _9 U
  11. *         TO CHANGE.
    $ T( x* ?5 v- d4 |' d
  12. *0 K$ _) w- r: T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) l$ F4 b) m' F  b( Z& l
  14. *
    - g! A$ o2 r: e# I- l+ M8 k6 O
  15. * This program is free software; you can redistribute it and/or# M( k9 p$ e4 r2 l& h
  16. * modify it under the terms of the GNU General Public License as% L' L' M, N: _7 w  m: p% A
  17. * published by the Free Software Foundation version 2.% q; E* |% l* J$ m, i
  18. *
    ! R& F: J, U# Y1 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 r: }5 H/ L9 |2 ^- \+ K2 z
  20. * kind, whether express or implied; without even the implied warranty& @. g( v; x* H. H) N; J& \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) A+ \5 {2 {/ I( j! g& r9 n
  22. * GNU General Public License for more details.
    & `6 G9 h9 S3 M4 q
  23. */. n3 _4 i$ l" g9 r4 e
  24. $ g) {: Q% K+ K5 t& Q5 }/ R. `
  25. #include <linux/module.h>/ S/ U( \  h/ }6 y. {, a8 q: y: E" ]. L0 t
  26. #include <linux/init.h>
    2 R; W. ~' A$ K/ D% q0 y
  27. #include <linux/errno.h>. t8 L1 I  a/ z; o
  28. #include <linux/types.h>/ C: v6 Q4 ?, i4 d; `' k5 B
  29. #include <linux/interrupt.h>
    - B' p9 _+ [8 v0 x/ p
  30. #include <asm/io.h>* k! D$ t, K, G7 L
  31. #include <linux/moduleparam.h>* y" M/ R' k9 v; x; K
  32. #include <linux/sysctl.h>( P- x0 p1 ~. y
  33. #include <linux/mm.h>
    . l! h7 K- b- ?, k# w
  34. #include <linux/dma-mapping.h>
    ! K) N5 x3 K# K0 D  u

  35. # g1 R; h& U7 ]0 b: z- l
  36. #include <mach/memory.h>8 R( ]/ \4 f/ l9 C
  37. #include <mach/hardware.h>
    0 A8 {3 t, V- @  p5 j
  38. #include <mach/irqs.h>
    / p; B+ ~# m0 A, B1 e* g' K& T7 r
  39. #include <asm/hardware/edma.h>
    ' h1 {' t0 A2 e! H6 J8 J
  40. ( L; O5 g& w/ Q
  41. #undef EDMA3_DEBUG
    # D. K& o; ?, i  J& q# K
  42. /*#define EDMA3_DEBUG*/
    & x* M, T5 D1 Q# {* s! m' g

  43. ; `& {% C7 s5 A6 f8 }% w* v# G
  44. #ifdef EDMA3_DEBUG% ?# W) e* R7 l, ?: Z, s, B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , l6 J9 V! W/ s6 [. C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( V0 x3 q9 b0 K* ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 x' U/ a" m6 v4 m
  48. #else2 {4 I6 F: ]- P3 R6 j
  49. #define DMA_PRINTK( x... )
    ' m' _+ E: N0 i' w! C" k
  50. #define DMA_FN_IN
    : g! o' P1 m/ q9 c6 i
  51. #define DMA_FN_OUT- J5 o; F) R' h$ V2 i7 i5 @
  52. #endif
      n( d3 W" {) l  b' _% P0 G8 j
  53.   k$ O, B4 c9 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ y  G( X! {+ [2 a* f4 P
  55. #define STATIC_SHIFT                3
    7 `' w2 f8 S3 a
  56. #define TCINTEN_SHIFT               20
    % y6 ^3 @  Q( V3 ^' h
  57. #define ITCINTEN_SHIFT              217 i. I7 C" t  p- o; C8 Q0 N
  58. #define TCCHEN_SHIFT                226 B# A/ v  F, `" e, g" t
  59. #define ITCCHEN_SHIFT               23
    9 U1 w! r5 ?+ S

  60. ! V' V4 Y- d( ^# W7 g4 J) ~
  61. static volatile int irqraised1 = 0;2 f5 Z2 a- K9 a0 H
  62. static volatile int irqraised2 = 0;- k, n2 b: s  P! c8 J& t( ]
  63. 8 C8 ]( Q3 B5 J4 {+ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y+ O: G; q7 `) ?- Q# P/ ?, m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ]+ T; W2 _7 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # i- N% F  ?. U' I  Q
  67. 8 g2 D& F. b; m9 r2 T/ D" L7 Y5 h
  68. dma_addr_t dmaphyssrc1 = 0;4 @  D: `  e2 t8 ?5 e- b# \: @
  69. dma_addr_t dmaphyssrc2 = 0;
    & o7 Z& l0 f) z3 Z- D; q5 m
  70. dma_addr_t dmaphysdest1 = 0;& x* Q* Z. ?1 @# d6 k$ v0 q
  71. dma_addr_t dmaphysdest2 = 0;$ Y2 n5 z! n0 K* V! L! u) `
  72.   f5 i  C3 _7 U* k- q& h
  73. char *dmabufsrc1 = NULL;
    7 `1 ~: ]: g# c2 J. }' K* _% \
  74. char *dmabufsrc2 = NULL;5 U  {% X( \+ x( o! O
  75. char *dmabufdest1 = NULL;$ [5 y: z4 T# B, T& Y* ]
  76. char *dmabufdest2 = NULL;6 s. B( U4 }. W, R! F

  77. ( N; J9 q& S3 @6 n5 Q# l
  78. static int acnt = 512;5 e4 A3 N3 h/ y0 \  t
  79. static int bcnt = 8;2 N0 \( q5 R2 V! w3 g* S6 P
  80. static int ccnt = 8;6 C" d4 Z& o, m5 e

  81. . |; K+ U* r9 g, X
  82. module_param(acnt, int, S_IRUGO);
    ' s9 H0 j% ~5 w6 m- O4 L) Z' \
  83. module_param(bcnt, int, S_IRUGO);
    1 e- `9 J" y; A1 }( M8 d! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ I$ G3 w/ c: |! `3 a4 {
$ s/ ^  m8 _& E; Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {$ j* _! q6 P3 m! Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  s  H5 I5 g0 W4 w# A- y% O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 |8 C! |* H4 h- V4 }2 r; U4 J  ~. A

& L' z/ p2 e1 @% a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 18:43 , Processed in 0.038625 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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