OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 |. j4 W% g0 R& k& K
  1. [code]EDMA sample test application
    ! \9 ?. N1 i& H0 M7 Y3 y
  2. /*0 G- m" z- o" Y
  3. * edma_test.c& e, h" z% @1 ?: y8 \
  4. *
    5 s% l( x- T0 e! |* B( A- o
  5. * brief  EDMA3 Test Application
    + [3 W/ V5 l6 V6 _/ F
  6. *
    4 `( y( B) h, k" A- d+ D
  7. *   This file contains EDMA3 Test code.
    ! y3 `# L+ S8 E' m
  8. *! c3 |" c2 ]2 @4 U4 t. M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! Y) p& j" G3 W9 f$ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 j7 |0 @+ W; h/ G
  11. *         TO CHANGE.2 R) c0 k1 t/ J& @/ X+ k
  12. *
    3 ?: {) w3 I. L7 Z. X& B* Q4 V+ U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Y% J6 d" a8 ?$ O! _- S
  14. *( V) I) y4 ?2 `3 S# r- s) N
  15. * This program is free software; you can redistribute it and/or! g2 i4 W0 ?5 \
  16. * modify it under the terms of the GNU General Public License as
    6 @! B: n. H* H( f, q& v* l
  17. * published by the Free Software Foundation version 2.3 d5 C( r( [9 T% B
  18. *4 W6 U! g3 n5 B* B& }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ^+ K+ W+ ?/ Z
  20. * kind, whether express or implied; without even the implied warranty& V! ]8 {2 M* w% |3 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" }; l# g: M6 F+ {7 T! ]( P
  22. * GNU General Public License for more details.9 o/ K: ?- e. D. `: l& g
  23. */  @6 k2 {+ J- H% R
  24. 5 @/ c& {% E. q0 E
  25. #include <linux/module.h># p, k6 D  C1 P5 T. I" G8 ?) p
  26. #include <linux/init.h>
    ; s+ p$ A9 x6 a; T! N1 ^' t
  27. #include <linux/errno.h>
    - X0 C/ s8 l& T$ Z
  28. #include <linux/types.h>4 _1 l- |& r4 t& h7 g' u
  29. #include <linux/interrupt.h>
    ; N* ]' Y, r' Z! A
  30. #include <asm/io.h>) }& l& \- ^; @4 _, I1 V0 w7 x6 d
  31. #include <linux/moduleparam.h>
    7 Z" U& Q5 r# h' e3 T4 d" W: Q6 m4 O
  32. #include <linux/sysctl.h>$ I: t' c1 ^3 M+ ?, U6 g; x
  33. #include <linux/mm.h>
    * `$ g8 l/ a3 G! x
  34. #include <linux/dma-mapping.h>0 ^3 |; G8 y2 a3 \( Z

  35. & x, d% \& D* A2 ]# H( z. [
  36. #include <mach/memory.h>5 x/ v# Z) _2 v# z
  37. #include <mach/hardware.h>
    7 }4 S) v9 N% ^
  38. #include <mach/irqs.h>
    ( A" s  e& }% a. _6 u! l
  39. #include <asm/hardware/edma.h>
    " j( Z0 |: h" N" ^/ p

  40. ( O' k7 v( N; K# z+ v
  41. #undef EDMA3_DEBUG5 s' B, z; b8 t
  42. /*#define EDMA3_DEBUG*/
    ' X; h/ m/ S$ l3 D* G9 R
  43. 2 M) E' G( C8 l
  44. #ifdef EDMA3_DEBUG
    8 {  T# g& _1 j2 [& R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ]$ j) J4 y7 r- @& G# s; z/ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , ~: f$ O& O5 a7 J* ?, s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 A9 _! E1 b/ x, M* H
  48. #else
    ; Q: Q6 O9 U# E( W2 p( m' Z
  49. #define DMA_PRINTK( x... )
    & N3 c' b' X0 n" i( S4 V# y8 A
  50. #define DMA_FN_IN
    ( Z0 N7 G% Z2 h' ^2 M
  51. #define DMA_FN_OUT2 y. q  @+ O% ?% `) m1 z
  52. #endif
    $ h& p- A& q! V& U9 N, _

  53. % q! i' r) Y9 O# h/ V: j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : Y) J1 T' U: c; ^  Z4 C
  55. #define STATIC_SHIFT                3
    2 W& H$ k* [' k* [
  56. #define TCINTEN_SHIFT               203 g5 x* s7 W7 f" i7 d
  57. #define ITCINTEN_SHIFT              21
    ' f1 Y. h( r! Z- b- \
  58. #define TCCHEN_SHIFT                222 L8 t! V6 }) I0 E. @
  59. #define ITCCHEN_SHIFT               23
    8 r! u6 L, r2 x* N* k3 N

  60. 0 |# [* B. ^6 I
  61. static volatile int irqraised1 = 0;
    4 t: Y: D' {0 ]* J; m
  62. static volatile int irqraised2 = 0;8 b# O  R2 ^7 I  I# X( V4 x! l4 T

  63. ) U7 ^! I& [* {' O; J7 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - p4 Q# ~# T" |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! y1 m2 t$ X$ S0 r5 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 H1 `) o' Z* H& \

  67. % u2 K+ K, z( r3 U  V
  68. dma_addr_t dmaphyssrc1 = 0;
    ; Z! D  Q: {: o6 x; m8 h* E
  69. dma_addr_t dmaphyssrc2 = 0;
    2 u2 R, V& k4 d9 S2 t! c9 Q
  70. dma_addr_t dmaphysdest1 = 0;
    3 }6 G- ^1 q7 c1 L7 ^- @
  71. dma_addr_t dmaphysdest2 = 0;+ N: c' w1 \) @

  72. & w  a( ~5 x+ T/ P8 G5 ]
  73. char *dmabufsrc1 = NULL;
    / q3 o  q# X& i# Q# S- u) j
  74. char *dmabufsrc2 = NULL;( ~8 _& N! B* @
  75. char *dmabufdest1 = NULL;
    / J2 Y3 u' d! P0 O  E$ G9 o
  76. char *dmabufdest2 = NULL;; A2 o/ V% S+ Q% B* N" [
  77. 6 R& e) G3 P9 A% X; ~- R& U5 U7 Q
  78. static int acnt = 512;
    ) ^& ^6 M6 O5 `8 ?  m
  79. static int bcnt = 8;, z5 g' F/ a0 g) L  Z
  80. static int ccnt = 8;) h, j: R1 g/ W- n
  81. * h7 f. D; v# n7 H" ]/ D' [! E2 c
  82. module_param(acnt, int, S_IRUGO);8 V5 U3 L7 d# m* @! U$ o
  83. module_param(bcnt, int, S_IRUGO);
    5 _0 J0 K, ^5 N* v5 _3 f) k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: Q% `% g1 D4 ?% {6 h9 P& h- r* l9 V* W6 @! m- F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @* ]& G; {6 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 |+ l4 t+ L, |$ p! p' {' A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: d4 A! b1 I. @* P( E% Y
, K1 _  ]: k; N
7 v% t) X! \0 a. e3 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 23:14 , Processed in 0.040823 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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