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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ o# M2 W4 q  h0 J( t# p3 g: U% d
  1. [code]EDMA sample test application
    " X) z& J7 s! j3 r' \, r/ e
  2. /*4 S/ H2 E/ m1 `: g6 ]; z4 p
  3. * edma_test.c
    5 Q# G7 B  Q/ b% ~; w
  4. *
    5 H; w9 \9 ]: l4 {1 u! d8 B
  5. * brief  EDMA3 Test Application
    * H; }$ C0 X9 C8 ]9 U
  6. *2 ~; U. d# C! }$ ^. J  f' l5 Z
  7. *   This file contains EDMA3 Test code.+ F& S2 O, G& v1 e/ D
  8. *: g# A1 a4 i; D+ C/ _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 a. x/ K. X- K0 [2 @* v, w0 M0 |2 g7 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 [$ F% Y" O1 \
  11. *         TO CHANGE.
    5 P) P6 Z( D1 c! H+ ~/ Q
  12. *" y, v  |: j/ Z& o& S& F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 I1 O* b! Q  W+ d- Z6 [
  14. *
    8 B& K3 n, W* r/ c, q/ M! J
  15. * This program is free software; you can redistribute it and/or  j/ N- G# Y2 F! B5 K2 B' P
  16. * modify it under the terms of the GNU General Public License as  @+ D- O% A# D
  17. * published by the Free Software Foundation version 2.
    1 J( S/ ~1 @2 K6 E, {8 I
  18. *
    # _, g4 I; ^; N* L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; H8 g4 S8 B" r. J
  20. * kind, whether express or implied; without even the implied warranty
    / M% T$ d$ k1 F8 ^  ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & u' I% U: t, l( Z
  22. * GNU General Public License for more details.
    7 ^8 n9 @  o) x8 H
  23. */
    . F/ F8 G- X7 o5 U5 ?( w

  24. : ?# Q# c, p3 h5 o! {
  25. #include <linux/module.h>- i1 z" E5 ^  |9 \/ @
  26. #include <linux/init.h>
    " V6 D# R1 w2 y( q& g8 l* Y/ T) q
  27. #include <linux/errno.h>
    - g9 E) M) P" v. S$ ?
  28. #include <linux/types.h>7 k  R2 L: t- Z, ?- H, ]
  29. #include <linux/interrupt.h>
    4 C$ m+ {1 \7 N1 [! H
  30. #include <asm/io.h>
      I0 E. ]; X9 _# c. ~
  31. #include <linux/moduleparam.h>
    ! s) q% M9 q- B( s( ]; d
  32. #include <linux/sysctl.h>) G! T3 x9 l9 O) v8 x3 i9 [7 K
  33. #include <linux/mm.h>) g& B7 ?( M+ U+ `; t/ Q
  34. #include <linux/dma-mapping.h>
    # J2 a4 v: {& M' O* j/ B

  35. ! |9 Y  k3 g- q  c  k& r
  36. #include <mach/memory.h>
    : X! Q* l0 O) `1 Y3 x, V
  37. #include <mach/hardware.h>6 s: [9 J: W* v# Y4 a; ~
  38. #include <mach/irqs.h>
    8 I9 s3 G8 s( W0 t* {2 h! A; H
  39. #include <asm/hardware/edma.h>
    ; ~( z+ ]7 V: n' {
  40. . Z9 f$ y+ x' e
  41. #undef EDMA3_DEBUG5 q3 t) S$ e2 [5 q6 ^" n
  42. /*#define EDMA3_DEBUG*/
    : C4 A; X2 H' G; y$ a
  43. , \% [$ {( Y; ?$ E  g: W) }
  44. #ifdef EDMA3_DEBUG0 ~- E- F) N1 A7 [1 f4 Z/ M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 j& }! U$ v( s* d2 Z/ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 |3 y) p8 e1 X' L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - S6 C7 T' z3 T, Z( T* q
  48. #else
    2 J3 m. G  q0 B& S3 S% b- ]9 R
  49. #define DMA_PRINTK( x... )9 C: F/ H1 Q8 k
  50. #define DMA_FN_IN
    1 f! e/ Z; Q# c% T. B$ L
  51. #define DMA_FN_OUT4 j. _4 Z& t# I5 ?' n! t- `+ Q
  52. #endif9 |: Z8 L$ i5 B2 a
  53. 5 D# G  U: a: w) d2 q+ Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . ]8 d4 T, t' ?
  55. #define STATIC_SHIFT                3
    / }2 r( |1 N1 H0 k
  56. #define TCINTEN_SHIFT               200 {/ L7 w; i1 M; H) V. l. T8 K
  57. #define ITCINTEN_SHIFT              21
    # S0 N; \! N2 t3 \9 b7 y5 t7 k
  58. #define TCCHEN_SHIFT                22- p/ H2 B! E; P1 f! b  v
  59. #define ITCCHEN_SHIFT               23
    $ H4 S6 `) ~, R4 Y! r
  60. : f* \- q$ a) S4 x
  61. static volatile int irqraised1 = 0;$ i  r7 J: u1 U  h  @  i: l: `
  62. static volatile int irqraised2 = 0;
    + {5 D4 K" M2 d" D% m

  63. - ?7 o; ?* Y/ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; r6 ^3 l& k. @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 @' `+ k9 h2 V& f/ i4 T2 _5 P9 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y7 @& q+ @! H; h6 Y# g7 `
  67. ( o) {3 `% ]' A7 T) ^. b- f. T4 M7 P2 i
  68. dma_addr_t dmaphyssrc1 = 0;- @1 \. k1 g" m1 D2 K" ?
  69. dma_addr_t dmaphyssrc2 = 0;$ p* u; Z4 s, b
  70. dma_addr_t dmaphysdest1 = 0;. a- v; x* h# t: d. v5 F& e
  71. dma_addr_t dmaphysdest2 = 0;+ E( p; D3 G; q- C3 `8 W
  72.   T. @+ m' ~4 \
  73. char *dmabufsrc1 = NULL;7 Q$ d. Y* ]1 L6 ^& \0 }
  74. char *dmabufsrc2 = NULL;( u! `* d. ^4 V% c" \; V
  75. char *dmabufdest1 = NULL;5 {# y% R! p: P
  76. char *dmabufdest2 = NULL;
    ' N5 f. u) f4 j" M8 `

  77. 7 z; z- `9 K5 k+ W& J& `) @
  78. static int acnt = 512;7 v7 @" M" P$ W/ z  F" x
  79. static int bcnt = 8;
    1 d( u$ S; o' H3 U
  80. static int ccnt = 8;, @* X3 M' Y' w$ r

  81. # }6 W9 i8 M* q7 m1 I
  82. module_param(acnt, int, S_IRUGO);
    - Y; ?& a! M* A
  83. module_param(bcnt, int, S_IRUGO);
    * e% D; d* l) _4 R" q" r( j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; O. I& j) t8 U" P" [+ z0 e6 n/ j
8 T) c. f/ O0 p0 X  f% O5 i7 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 T3 ^0 V0 N  x0 W  o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( C8 t  Z) |# u5 m5 |, D& t! p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, p9 P- W, x: e2 q
5 ?6 _8 t! W8 i* R4 z  a1 B) U8 [  O
' _9 m8 K/ D) T& H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 07:28 , Processed in 0.041313 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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