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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 M0 C. E. K, f) h* {  t
  1. [code]EDMA sample test application% T7 y+ C. k5 T/ b* Z6 |. M& w
  2. /*
    3 t+ E+ s0 ^7 b4 i' E3 V! k7 Z" u
  3. * edma_test.c
    % Y, h  i$ s' N. F
  4. *7 g: J* x* {! {# T. {$ ?4 a
  5. * brief  EDMA3 Test Application2 {& e! ~/ X& O( X3 O3 ]
  6. *
    7 [5 N) T8 S( L- u- c2 O+ {
  7. *   This file contains EDMA3 Test code.
    # d4 u! o) z; U6 l/ W; A/ n. D4 X
  8. *, Z# z/ ^: W9 [0 g8 {# j/ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; I' ?; F. o7 `7 y# H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p+ ?- t5 \9 Z
  11. *         TO CHANGE.
    6 T5 @% T7 N6 l. c0 a( H: ?9 ^' o
  12. *
    / Z1 k! R9 R4 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / Q: e. v! R% r( B/ f
  14. *- Q7 @1 o: W7 V% [" ^
  15. * This program is free software; you can redistribute it and/or
    : O+ d: u3 r2 o- C/ R" |
  16. * modify it under the terms of the GNU General Public License as
    ! ^1 M! {  H1 M+ h
  17. * published by the Free Software Foundation version 2.
    8 O6 U' I& l6 x$ @
  18. *( i5 V! p, W; g0 t6 t" D7 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , ?/ u% D) w: ?$ l' S
  20. * kind, whether express or implied; without even the implied warranty6 P. j9 g) m5 a0 _, p. B; v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ~4 {$ ]# B$ r) s4 I/ w4 c8 Z
  22. * GNU General Public License for more details.2 n8 \5 Y& W7 \. e  B
  23. */1 y% N! S# S# M1 c
  24. 4 h, h# [8 [3 h! ?  o: n6 Y
  25. #include <linux/module.h>
    * [; n! ?' _8 g/ P% M4 A
  26. #include <linux/init.h>9 [8 n$ ?+ b+ Y; U- x1 D& A
  27. #include <linux/errno.h>
    1 n0 j4 Q' K9 R) k( j. ]
  28. #include <linux/types.h>- L/ b2 q4 m6 D+ n0 t
  29. #include <linux/interrupt.h>
    * V' p" i1 q* Q/ r4 {. k5 j+ @, x4 ]
  30. #include <asm/io.h>6 `$ X! j' G9 x& E3 @( R& ~
  31. #include <linux/moduleparam.h>" i6 b6 c: ^, x
  32. #include <linux/sysctl.h>
    + h$ z3 F3 H8 d! d7 i, E- _$ d3 v8 H
  33. #include <linux/mm.h>& q/ v5 t3 o, \
  34. #include <linux/dma-mapping.h>
    & {/ ]7 w& Y! n

  35. & U  v" J* N, v7 H- s' _' T" H6 z: e
  36. #include <mach/memory.h>1 \) D6 L0 Y7 f; n$ Z& B" W
  37. #include <mach/hardware.h>- g4 B0 H* y7 I
  38. #include <mach/irqs.h>
    3 \0 O# \# c, K9 c" U5 N( p$ G, m
  39. #include <asm/hardware/edma.h>* F0 K: z5 ?5 C; T4 T$ j, K
  40. # v( Q1 r: g6 ~% ?- n; q
  41. #undef EDMA3_DEBUG, y6 Q. A1 y9 r
  42. /*#define EDMA3_DEBUG*/
    4 d/ d% X: _; ]7 J7 q& K( F& ?
  43. , q5 |  }1 L( p  u7 v
  44. #ifdef EDMA3_DEBUG
    ( p5 @0 w: v2 S0 e' }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . e4 l* N6 q; C; A9 B6 ~2 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ~, H$ h& k( {  a# o# W7 k5 v, d, `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e8 S: |: L, ?. y7 `
  48. #else/ U6 ~7 f) V' E  g+ @
  49. #define DMA_PRINTK( x... )
    : E$ [9 j! S7 @6 E
  50. #define DMA_FN_IN  E: v: Z% J/ B" M- D& [
  51. #define DMA_FN_OUT
    / I1 ]  g  b, y+ w
  52. #endif5 A4 E# g2 w. o) g) E

  53. - v! ~9 u4 j) c% \- n! O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! k$ l! w, Y8 Q$ i1 p* r- |; o
  55. #define STATIC_SHIFT                3
    - ?5 e7 R0 E% R" x' c
  56. #define TCINTEN_SHIFT               20
    2 O2 s; n- n" M0 C) X
  57. #define ITCINTEN_SHIFT              216 s# M: `1 }+ e
  58. #define TCCHEN_SHIFT                227 M0 I/ X' z$ \8 e7 A* q
  59. #define ITCCHEN_SHIFT               23# ]. q! f" Y7 I, B7 I( m* d; Y

  60. $ V" H8 r' U* e
  61. static volatile int irqraised1 = 0;6 X7 P' r7 M  Y) u7 i. a. h6 s7 s
  62. static volatile int irqraised2 = 0;
    8 f% ?0 L- n6 O: c, y

  63. 4 ?' b8 ~# o  s: T# j6 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k* {  O$ Z; b6 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - C; z1 P/ U$ I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 p2 y+ l) O0 J$ F! h. b

  67. & y; o8 @' ~7 w& ~) ~  ]2 I
  68. dma_addr_t dmaphyssrc1 = 0;
      P6 ~( l0 Z6 ~! x4 P0 H# R
  69. dma_addr_t dmaphyssrc2 = 0;8 r* y6 v& ?" g% w/ k+ Y6 ]( H
  70. dma_addr_t dmaphysdest1 = 0;
    " k5 ^! h& w+ y/ B" \' Q$ ~
  71. dma_addr_t dmaphysdest2 = 0;4 L8 t' M* }. z" b$ G
  72. 7 i6 t2 F! P. Z1 _; l& D  a
  73. char *dmabufsrc1 = NULL;: X2 r5 e0 h$ c
  74. char *dmabufsrc2 = NULL;* y; D- d2 N' g- z  S
  75. char *dmabufdest1 = NULL;
    $ S) O9 S/ d9 ]
  76. char *dmabufdest2 = NULL;5 ]1 P% x6 k# Z( u4 y( R

  77. 6 e' C$ }8 H$ T+ Z% N
  78. static int acnt = 512;4 \' v% O0 _. k/ Z) i
  79. static int bcnt = 8;
    5 |' |& Z8 W6 T
  80. static int ccnt = 8;
    + A$ @( @& n3 b0 Y# S
  81. 3 w+ @; X7 u1 x2 }1 ?
  82. module_param(acnt, int, S_IRUGO);
    7 s& O+ s+ o2 I2 Y7 A# z
  83. module_param(bcnt, int, S_IRUGO);
    3 U; _' _# A: ]8 Q* S$ M. o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# c& ^7 F  V( c6 Z! D* p/ H0 Y+ f4 [9 @- r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. R0 u: t  T( G; P& |& Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# j8 r+ Y; m, n5 ]7 _" M" e/ [' s" `' s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ e( Y3 @$ h" O
1 d! u# r) S- i; w( y, m- |4 u9 L/ ?
2 Y, {; T0 ^& ?) O! C5 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-7 14:47 , Processed in 0.042898 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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