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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. m/ v6 Y  U5 v+ H9 m7 B8 O
  1. [code]EDMA sample test application
      e) K  E( ^4 j
  2. /*
    2 O) m( Y$ G4 w' z  z2 N& T- {& A
  3. * edma_test.c4 B. n( E' f" \  ?1 T  f
  4. *
    # x" E# Y/ o+ w; c+ C; W, P
  5. * brief  EDMA3 Test Application) b; I% B+ ?3 x) [( D0 l
  6. *
    1 j/ j$ `/ k, l' o6 a& F1 a1 p  v
  7. *   This file contains EDMA3 Test code.% S: [2 S( e" y/ {
  8. *
    ; f) l( E! c/ m) j' E8 b" g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 S! a4 F; q! u2 Z/ V3 [) @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  _  Q* ^' j% S
  11. *         TO CHANGE.3 j8 r" h) j1 {& X/ q7 p
  12. *
    , x6 p7 |8 v; D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ V3 n7 Q9 ^" r4 I/ v# M  d' O
  14. *6 `3 a% t  b. j- b+ a8 M
  15. * This program is free software; you can redistribute it and/or& p% \4 y1 U+ |
  16. * modify it under the terms of the GNU General Public License as
    - o! a; A  P( h
  17. * published by the Free Software Foundation version 2.. d3 @* ^% c8 y
  18. *% ?7 y3 e! O# Z( I: e) d5 J1 Q; z4 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 ^0 J) A# H" G& X! o, p
  20. * kind, whether express or implied; without even the implied warranty% A) ~$ W& M+ c$ t3 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y% h' ?6 p7 O2 m0 u
  22. * GNU General Public License for more details.
    ( m- o7 G* b$ `8 {8 T
  23. */+ {( C4 m( a8 j0 X
  24. ( P: E0 [6 F& d6 F% Y; U) K4 r
  25. #include <linux/module.h>& M3 a! C/ X, W$ J+ j. o8 z
  26. #include <linux/init.h>4 Z6 k' H; T, |+ p2 B" I# Z3 L' X
  27. #include <linux/errno.h>7 J4 b! A% u) N' _
  28. #include <linux/types.h>
    9 i5 B( n, Z7 _2 V; |3 [
  29. #include <linux/interrupt.h>% T. c+ {- n! s
  30. #include <asm/io.h>
    2 L8 g; q' O! l  _4 z3 C6 U9 ~
  31. #include <linux/moduleparam.h>
    * a% `  d6 B5 c  C- d. G
  32. #include <linux/sysctl.h>
    0 v+ e& d4 |9 n  ~' E
  33. #include <linux/mm.h>
    * t4 ]6 i; i# ~1 C
  34. #include <linux/dma-mapping.h>, n* T7 J& x4 n( @) V( |
  35. 1 t5 h! P7 d) g
  36. #include <mach/memory.h>* ]& D) l$ R% p( S& ~$ f4 e2 @
  37. #include <mach/hardware.h>
    7 ]7 n" j) e; E4 ^7 A
  38. #include <mach/irqs.h>
    8 q- o5 z. d& U
  39. #include <asm/hardware/edma.h>
    ! f6 Y+ D! @7 z% d" z

  40. + h8 m5 v' P  H& g
  41. #undef EDMA3_DEBUG9 n. Y3 m: a) S" c1 `$ g/ \
  42. /*#define EDMA3_DEBUG*/) U3 D3 V8 V6 T; L( d1 p* L* @$ K

  43. - _) k* k; O+ T, G$ T3 R
  44. #ifdef EDMA3_DEBUG- Y' q* A& s: W9 W& i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . t; V2 ^8 v( z& E0 c1 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      e) }8 y( F$ F& [6 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); C8 p# z4 W7 Z( s; w/ q& U
  48. #else
    % v/ f' T8 o) Y' C
  49. #define DMA_PRINTK( x... )4 c! k( K% A+ ]9 X' S3 e
  50. #define DMA_FN_IN
    $ F# R5 `; ~: R0 n  ^  P3 d  j1 p
  51. #define DMA_FN_OUT6 Q% M* S  @3 g
  52. #endif
    ' g, O' U$ y( {( v+ m) |2 n" i
  53. , x- E( E! t: C9 T/ k3 w. l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      Z9 F( p! E3 q2 O6 s5 B+ `
  55. #define STATIC_SHIFT                3+ y% Q& i3 }" k5 W# G9 ]
  56. #define TCINTEN_SHIFT               20' d* U5 M% r2 l0 I* S1 |+ u/ h+ U
  57. #define ITCINTEN_SHIFT              21+ o( a* V/ }! d' e& M+ W
  58. #define TCCHEN_SHIFT                22
    ) `! \' \9 `. D, D2 h
  59. #define ITCCHEN_SHIFT               23
    3 t7 m' p) ]6 b* X; s  p8 M0 z+ F

  60. % Y) ?" Y5 F5 }# C9 K* i
  61. static volatile int irqraised1 = 0;
    ' u" ]5 [. j# N# ]9 c3 L* Y
  62. static volatile int irqraised2 = 0;8 L8 j* g, {( j
  63. 3 Q& I- `0 p9 G: C8 H: Q, k# K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B, i6 y2 f4 i/ I& s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N/ k9 O! H( b: _% o) i9 O+ e( x% Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B- K; L8 q) z
  67. 0 K2 n2 ~. @& b# r: |. ~# u. d; N9 c& A
  68. dma_addr_t dmaphyssrc1 = 0;
    : _$ a6 s+ t6 p
  69. dma_addr_t dmaphyssrc2 = 0;
      T+ b8 D( |0 O: `% Q4 Z+ u
  70. dma_addr_t dmaphysdest1 = 0;
    1 t: v2 G1 Z9 ?0 K
  71. dma_addr_t dmaphysdest2 = 0;4 y5 B0 R' s  v. {& u# U

  72. % y" q( ^8 G6 K; I' I# p* C
  73. char *dmabufsrc1 = NULL;
    7 f' c( q, N5 G7 T* a# F" f0 G  \
  74. char *dmabufsrc2 = NULL;: W# z% W& W; W% C
  75. char *dmabufdest1 = NULL;8 M* l" A- S, V- B( u
  76. char *dmabufdest2 = NULL;& k6 j5 L% W. e5 s* `( X( }
  77. / k' R7 ^% z: t  @9 y% b
  78. static int acnt = 512;
    6 v$ @6 Y, z6 i% E1 K
  79. static int bcnt = 8;
      \/ H6 a" J! C5 R' h
  80. static int ccnt = 8;
    , s, t3 {4 T4 J/ @( i

  81. ) N6 L6 ?) \+ T! B5 \
  82. module_param(acnt, int, S_IRUGO);' ^- M) S# N( z/ J, l5 Y
  83. module_param(bcnt, int, S_IRUGO);; {, g4 E  j" K4 v' V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  a/ H" J7 L! V; ^# D
! a: e2 r  Y1 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' l. R' C& M2 H, ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 K1 Y( X) Y' {2 I: m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" V! k" w1 p6 h6 Q! c

1 E+ o9 z- N8 g7 b& l; f$ n5 C
! e" P) N7 q  c: j* D$ `1 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 02:06 , Processed in 0.052595 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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