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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b/ W' D# K9 |5 Z2 i
  1. [code]EDMA sample test application
    8 u( P+ T1 U) G0 \
  2. /*7 p/ W6 h  Z# t' C% ]* q% U+ n
  3. * edma_test.c( i/ {2 \5 m$ L
  4. *4 m2 n1 r4 C; _$ M
  5. * brief  EDMA3 Test Application' i; c& v) b0 B6 I0 \# @* B
  6. *
    : r" Q, m# y  `1 X  R
  7. *   This file contains EDMA3 Test code.
    / b2 h- q- s0 V3 n: F
  8. *! W  F: P9 C5 R+ H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ~$ G+ Y. U: e$ z1 B1 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / P1 v. x; f7 ^( O
  11. *         TO CHANGE.4 `9 ^3 ]' J& V1 b
  12. *$ |3 n9 H% @9 a9 Y+ W; c  E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A+ s, M, X& p  u3 d
  14. *! H. T' c7 ^+ G; U2 a+ d
  15. * This program is free software; you can redistribute it and/or! V1 c2 i4 m; Q
  16. * modify it under the terms of the GNU General Public License as7 N7 h- f, E( N$ z0 r) I
  17. * published by the Free Software Foundation version 2.# e+ K7 a1 _. H: t; a8 ]/ @6 F
  18. *: K' h4 c' J1 t; I& O, Y- n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 F3 j  A. z" q4 T+ n4 S- ~6 e
  20. * kind, whether express or implied; without even the implied warranty
    3 \8 T- K  _8 c- g7 K( G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 {1 o. ^  F# `* {, m; x8 }
  22. * GNU General Public License for more details.# [) ]5 J- s5 G1 b
  23. */
    6 E* a5 K- \7 S. R7 c% g
  24. 6 S# |' X1 Y. i  d  ]' O' H
  25. #include <linux/module.h>  m( e# I, S( Y  k
  26. #include <linux/init.h>+ Z, l  |* E, n5 c* @: f7 H: s
  27. #include <linux/errno.h>
    : ^$ A+ P2 g. ~1 y; S" N
  28. #include <linux/types.h>+ C3 P3 ]) d; R4 l
  29. #include <linux/interrupt.h>
    * `& ?" V" V$ X4 @% O7 J
  30. #include <asm/io.h>  O) x9 A* h& ^' ~
  31. #include <linux/moduleparam.h>
    # q( u6 |9 t; V: ^& |
  32. #include <linux/sysctl.h>% ?. s  {  E! Y' y- h# N( g, B
  33. #include <linux/mm.h>
    1 Q# {: {6 X) D& M5 R3 U
  34. #include <linux/dma-mapping.h>
    ! }! s7 n! ]* L

  35. 8 E' U5 w, f# V+ `' e
  36. #include <mach/memory.h>* A5 ^! H1 z7 f+ t
  37. #include <mach/hardware.h>
    4 }! }0 B, p" r" w9 C
  38. #include <mach/irqs.h>' F& O9 g5 @4 [0 @
  39. #include <asm/hardware/edma.h>( C/ s  Z+ r+ a/ {# Y
  40. % d" M& }8 k$ ~0 t* R/ i3 P
  41. #undef EDMA3_DEBUG
    9 z# n, S' G* f8 a- p" G+ M' w
  42. /*#define EDMA3_DEBUG*/' T9 v  M( k7 p+ \8 P

  43. - `5 D/ c# ?3 F0 O; @# w
  44. #ifdef EDMA3_DEBUG
    + ]1 P0 z) ^$ K( o: _0 R; J9 N+ Y& E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 h- A1 ^. ~( s- ~* K6 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - V: x* u, ~/ L4 W; @' X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) G$ n' f" b" x  e" b) ^
  48. #else* i% A5 D1 s* T1 u4 o
  49. #define DMA_PRINTK( x... ); _% B$ O8 h! |
  50. #define DMA_FN_IN
    5 r0 G, v( `% w) o/ u4 |% [6 o, T
  51. #define DMA_FN_OUT
    4 U* n6 S) f6 i1 U  K9 L8 q
  52. #endif- N) G9 H; @7 \7 ~$ V1 u

  53. * t1 J4 k" i% K( R% M+ R% I6 j+ D* \$ u, O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): G' p& }$ N! d- l# R% y
  55. #define STATIC_SHIFT                38 O! @+ F* H! R$ E  _) G
  56. #define TCINTEN_SHIFT               20: _* k/ E# P; [2 w
  57. #define ITCINTEN_SHIFT              21( U: \3 h; T0 s
  58. #define TCCHEN_SHIFT                225 i" q: a" T. s; w' J+ c; u
  59. #define ITCCHEN_SHIFT               23* l. a4 p) C& s$ T
  60. 6 D9 X3 N) b- o% y+ }; i
  61. static volatile int irqraised1 = 0;9 K2 L5 `7 \4 B$ T) e
  62. static volatile int irqraised2 = 0;6 o1 b" |5 s! q0 \5 a! d) _. b

  63. - y% V. ^, |; F5 ?! ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v5 U7 j9 t. y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R  f* K7 X8 i1 E6 E% Z- G; B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E6 W+ }8 k7 U) K
  67. 8 E* N# p$ \. [) z3 M: E# R8 K3 [
  68. dma_addr_t dmaphyssrc1 = 0;8 M1 F9 z) k- p/ H' h  l
  69. dma_addr_t dmaphyssrc2 = 0;
    8 E) b% g# ]4 V" v! N
  70. dma_addr_t dmaphysdest1 = 0;
    1 g% A0 ^' q% a2 n6 l, r) U( G( q; i7 z: A
  71. dma_addr_t dmaphysdest2 = 0;8 N) {6 T) K+ q2 B% ]# ~$ i/ r

  72. * s% h% |- T8 c, K
  73. char *dmabufsrc1 = NULL;- m; Y1 q4 ]& l) M) t
  74. char *dmabufsrc2 = NULL;/ y$ V" d8 Q4 Y) X9 D! I! ~
  75. char *dmabufdest1 = NULL;8 b5 Y$ F: N/ n6 E
  76. char *dmabufdest2 = NULL;
    4 I. |+ W( U; `. k! i$ I6 ^. E
  77. 6 o! P# p/ Q; [  k2 R
  78. static int acnt = 512;
    9 A! Q0 A3 _, b" i
  79. static int bcnt = 8;
    " b& v. e1 T# |  R: h* X  o: T: X3 o
  80. static int ccnt = 8;
    2 T- i7 {1 J3 ^* f4 i# n" E5 {

  81. , n! X. n: |+ p' ?! h- H
  82. module_param(acnt, int, S_IRUGO);) c  E+ F) F7 F5 e: T
  83. module_param(bcnt, int, S_IRUGO);: [! y1 W, n& A- S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" H( [; V! j' w% `
5 ]) p+ E# D% V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! b( j  h! \" F( f1 p; ?9 H2 \$ ~7 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: c" o' a' f/ T& }: Y0 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: M9 ^" e5 Z+ N! t  Q/ y* V- E! v1 H) m- ?) m2 ]4 k4 N  s' p

8 Y. M1 A7 Y6 ]/ i! H' V) ]' a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-21 02:08 , Processed in 0.040060 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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