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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) J) v* L7 r0 j- m& w9 s
  1. [code]EDMA sample test application" f$ a6 _: ~2 ?) w% M3 `
  2. /*6 d6 {# J3 Z7 e5 ~: H' e
  3. * edma_test.c
    - s5 a/ i. r5 T3 B" M" R7 g
  4. *; b, M$ z0 d9 J. A8 v
  5. * brief  EDMA3 Test Application0 ~0 n7 {, M0 B* ~0 ?! ?( r
  6. *
    2 C5 W7 M2 y! Y% D3 k
  7. *   This file contains EDMA3 Test code.
    ; f+ [" C5 A% z% b. z$ B
  8. *
    - T' W) s; U2 l; v1 M. D$ T2 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! J% K1 G/ i. z8 `2 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, l" c" M* v1 L' H# e
  11. *         TO CHANGE.7 i8 [8 d* x& n# [, x& Q
  12. *
    $ f) O. B; [3 k; ~3 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% y$ S& R$ U6 r0 Q% X3 Z* x
  14. */ @1 h. _# m/ q
  15. * This program is free software; you can redistribute it and/or
    0 W+ N- P: S& w2 z4 N  t: H# P
  16. * modify it under the terms of the GNU General Public License as
    5 D, r; Z7 M) O$ @/ ?3 t3 {/ r
  17. * published by the Free Software Foundation version 2.* A, {. F8 G* \, `, V
  18. *% I; W) t) S: i# B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {' y3 I" z7 J! A( L; F* {! Y
  20. * kind, whether express or implied; without even the implied warranty
    # ?8 Q! D0 Y* }2 s9 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 G( j: z2 n4 T$ s; j4 p
  22. * GNU General Public License for more details.- u, W4 O0 l6 w7 z* F- z! ?7 Z0 w7 w9 [$ j
  23. */
    : [5 N/ N; \9 A4 C
  24. % T' V! c/ x* T, D& e+ g6 U7 a" u
  25. #include <linux/module.h>  ?/ X9 @/ v! C" @$ H
  26. #include <linux/init.h>
    * ~6 ~% V7 k+ Q6 i1 K5 M; `( P$ a& }
  27. #include <linux/errno.h>, _* s1 o3 L$ a! `8 Y! }+ h
  28. #include <linux/types.h>$ [& e, z* `$ ]
  29. #include <linux/interrupt.h>
    # ^3 y0 R, O7 ]+ X2 }
  30. #include <asm/io.h>. F: o- k, R/ `( m
  31. #include <linux/moduleparam.h>
    5 P6 @! s; [9 j* H* ~
  32. #include <linux/sysctl.h>% \7 d1 V: j& ^
  33. #include <linux/mm.h>4 ?- K  A1 \) Z5 M0 Y" Z
  34. #include <linux/dma-mapping.h>
    1 `7 l; H' c* u: F* ]9 \. _

  35. * g6 P& J  |, B' G- m
  36. #include <mach/memory.h>2 J" A& L. m: X  n* B6 H7 g- n
  37. #include <mach/hardware.h>
    2 i. C( N4 I- r  E
  38. #include <mach/irqs.h>/ t+ x1 m0 U$ c  R3 E/ L6 P. ?  x
  39. #include <asm/hardware/edma.h>, }' ]8 k, R* L6 P
  40. " W/ V; P) p+ m# z7 [
  41. #undef EDMA3_DEBUG8 f* P" S8 n# c1 H0 y
  42. /*#define EDMA3_DEBUG*/  _% J8 s2 d+ x9 m' G4 u
  43. 1 J2 V/ }3 ~1 n; a* D4 [8 A
  44. #ifdef EDMA3_DEBUG
    % e6 [% i0 B; A# ~/ u5 M4 ?0 K0 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; g7 z" M$ p! t; r! T  ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( M( Y0 s' `1 F# B% a6 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * a- M9 G4 l% O/ F1 s- v
  48. #else
    8 l* W* S, L! X3 E
  49. #define DMA_PRINTK( x... )- G8 A1 Z9 D" ]9 r
  50. #define DMA_FN_IN
    - K! L- k$ B1 H+ R' d) ~; o
  51. #define DMA_FN_OUT
    $ V/ A! Y8 }7 h$ Y3 I
  52. #endif
    * E6 p+ J$ V) |2 {: A

  53. 5 ^+ |0 k3 u: O6 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); V- A& z( @: X5 T
  55. #define STATIC_SHIFT                3
    5 M5 A, L! ~# Z6 S* k
  56. #define TCINTEN_SHIFT               20
    + L9 r% e" V- k+ l) K: q# V! ]' F1 _
  57. #define ITCINTEN_SHIFT              217 j) Z4 g% a3 U3 ~" y
  58. #define TCCHEN_SHIFT                22, j6 g- Z" b- J: _( P2 f+ V; s
  59. #define ITCCHEN_SHIFT               23- E3 C$ K/ V2 l  ?
  60. . [2 f- J' k" |! p' Z) N% k
  61. static volatile int irqraised1 = 0;2 C) q0 u9 l4 F' t; m
  62. static volatile int irqraised2 = 0;8 I& g! J, h' h8 i5 O  s
  63. 5 X+ c( ]0 ~5 G+ m7 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . F, `  o6 _7 Z- J1 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 q4 b: o+ ~1 J! J. t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q% d/ ]+ ~9 `- K" t' q
  67. ; k* H0 Z' {, y" k2 b
  68. dma_addr_t dmaphyssrc1 = 0;
    * n- s& x* W/ s  Y
  69. dma_addr_t dmaphyssrc2 = 0;+ }4 {# z' ~: l0 g* [5 t+ {$ L
  70. dma_addr_t dmaphysdest1 = 0;1 j1 p7 ^( x8 [7 Z. l
  71. dma_addr_t dmaphysdest2 = 0;; q4 N" p: g+ [; S3 T( f+ m+ L
  72. $ M1 R7 Y8 w, U; r# r
  73. char *dmabufsrc1 = NULL;
    ( p8 k8 E& \0 y6 t  A
  74. char *dmabufsrc2 = NULL;
    : j) V/ }9 I; h+ u3 V
  75. char *dmabufdest1 = NULL;
    , n; s: w9 @9 L0 O6 O
  76. char *dmabufdest2 = NULL;' y+ K+ @9 a+ Z  w* P" H% g5 S

  77. 4 C: P$ G* \/ y- e
  78. static int acnt = 512;
    8 @! j- Q; Q/ d4 H0 V
  79. static int bcnt = 8;' Y3 k5 @' _* e# _
  80. static int ccnt = 8;7 @) w9 Z  w! k+ ^* |3 i: i

  81. ; p& H$ ^6 M& ]5 q' V
  82. module_param(acnt, int, S_IRUGO);; J0 R, l3 N9 o+ x2 u/ k
  83. module_param(bcnt, int, S_IRUGO);- `3 E% r8 m- i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 Z" h) ]: d9 Z7 k2 L7 p- Q' {

& u3 c8 K* N4 T; j8 H6 s# {* P* c$ i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) h6 [# b- K3 p  Z  T: f3 j6 @- V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, M" m  i, @2 f+ z/ {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {1 E5 |5 E3 V9 C) k

4 [0 e) Z& T  }" D( }9 T
. `- g! O; `+ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 12:22 , Processed in 0.038829 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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