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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F  X# u0 }. o7 A' O
  1. [code]EDMA sample test application, e  {2 D% @7 n% [; x' ~
  2. /*! w) s5 n: Q7 _; [2 A/ q' x2 w( [
  3. * edma_test.c
    2 f8 n. Q/ }4 f, B4 T' r
  4. *
    4 f. a4 b$ |2 V* J" H
  5. * brief  EDMA3 Test Application
    1 R# u! d2 F: _: x7 k6 u# w
  6. *
    3 [4 h* C$ v& [
  7. *   This file contains EDMA3 Test code.4 m7 K/ w$ h- J/ H
  8. *8 ]1 H6 h4 k- ~1 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 ?- x% _. c! u# _  x$ d6 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      C$ z* t2 G, U$ t
  11. *         TO CHANGE.
    / X# N+ g( V* S' _
  12. *
    - m9 C+ _% S- W* X5 B/ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 w( u' y3 M+ t5 a7 J* C
  14. *  F# n) B; u5 {; W6 i
  15. * This program is free software; you can redistribute it and/or# C, b3 N! z! {. c4 I' C
  16. * modify it under the terms of the GNU General Public License as
    - `3 G& r. G7 R1 H1 u' e5 n0 V
  17. * published by the Free Software Foundation version 2.
    - X; i& x$ ~2 L* b0 Q
  18. *
    ! K2 U  A- ^3 z' T" H9 ]  k6 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 F' {  P( V0 b4 J. n& W+ K" c
  20. * kind, whether express or implied; without even the implied warranty, v; u0 y' d* m0 L9 I, s8 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) }2 @3 m* i+ j: b5 b4 ^( S: W0 A
  22. * GNU General Public License for more details.8 O3 M, P, I8 \
  23. */! j8 q* `/ a4 O+ W
  24. + @8 c  T) R2 F0 O) K3 j& Z
  25. #include <linux/module.h>& ^. n' p! d( q  v! R* y$ E, w% s
  26. #include <linux/init.h>
    : a3 p9 n8 s6 s. q7 q: s
  27. #include <linux/errno.h>
    $ v" W9 q$ Q) ]# U, m! |
  28. #include <linux/types.h>
    2 C9 E- ~4 j' M) \3 O! I( K
  29. #include <linux/interrupt.h>
    " j: S* Z: v% d/ \
  30. #include <asm/io.h>6 y3 N, C5 P0 H# }
  31. #include <linux/moduleparam.h>% t$ a8 ?9 _2 y) v; J
  32. #include <linux/sysctl.h>
    9 S$ u! Z; q5 T) F! j3 T
  33. #include <linux/mm.h>1 b+ S- h6 E- r$ S- c$ N# M
  34. #include <linux/dma-mapping.h>
    " a! D8 @% c0 I

  35. - m& L5 a" }% u8 V! L) f4 |; u! n
  36. #include <mach/memory.h>
    6 I; {+ f7 ^7 `" g
  37. #include <mach/hardware.h>
    7 ?! c* ]! L, ]8 C( H0 N- h
  38. #include <mach/irqs.h>3 g8 q( p4 g4 N& n8 y
  39. #include <asm/hardware/edma.h>3 j) a4 `; P/ K. Z

  40. + t* a# c7 {' i& c6 ?% \
  41. #undef EDMA3_DEBUG
    : a7 ~9 r' @! l+ B7 f- y. |
  42. /*#define EDMA3_DEBUG*/. S5 E) f6 b% c% s# J

  43.   F+ `! C* n; z" A# q3 I% ?1 x4 L
  44. #ifdef EDMA3_DEBUG
    2 n/ p' l( L! R3 q/ R( ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 U! c- F0 x9 c; }6 k6 x% l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      b8 E3 r/ C7 t: |- ]. n7 v( B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h7 h+ W5 R' }
  48. #else0 ?! {, t+ q2 J* E( y8 X
  49. #define DMA_PRINTK( x... )1 l! B) G3 c' S+ B/ m$ C4 \) Y
  50. #define DMA_FN_IN
    ) B$ v0 m# I( k5 J% x6 ~# j
  51. #define DMA_FN_OUT2 h# F6 _1 o7 \- p8 u! W- L5 e
  52. #endif
    / `2 W5 h( x7 k

  53. : t7 y2 @7 z- C( {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 v, G( n2 D4 ~! J# n2 }
  55. #define STATIC_SHIFT                3
    & R0 _9 s/ B  L2 j
  56. #define TCINTEN_SHIFT               20
    " j6 z) e9 l/ B3 v2 X
  57. #define ITCINTEN_SHIFT              213 q& {1 X4 N% p0 S
  58. #define TCCHEN_SHIFT                22. n& W: D6 A; N
  59. #define ITCCHEN_SHIFT               23+ t6 E; t* e4 j
  60. : l; F1 \% q! _
  61. static volatile int irqraised1 = 0;
    1 I+ b7 |  p* h$ a
  62. static volatile int irqraised2 = 0;+ A! r& ?/ N7 C
  63. 7 @  h5 z7 b! t9 a' W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 p1 ]- D; t. r4 h( c6 P! Z; L- |- b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! x( @1 Y$ F% v, ^& p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ x# D8 M  {8 ^" u" n# @& [
  67. + y0 ?" F" F+ x% E3 B0 w$ m
  68. dma_addr_t dmaphyssrc1 = 0;( l3 s. e( m5 }' u/ g; }# q/ o
  69. dma_addr_t dmaphyssrc2 = 0;# F/ m# R0 L* G6 \3 `
  70. dma_addr_t dmaphysdest1 = 0;' D, j- C) j8 U7 A% p
  71. dma_addr_t dmaphysdest2 = 0;9 `- F, S9 x% I
  72. 3 ^3 ]9 U1 U# P( F+ K. E& g
  73. char *dmabufsrc1 = NULL;8 v! p; `3 }# d& D/ m
  74. char *dmabufsrc2 = NULL;
    " S# J7 Z3 O- M# }  o+ n6 V
  75. char *dmabufdest1 = NULL;0 m  Q5 E- h$ i4 ]& R# H) Q& v6 ~
  76. char *dmabufdest2 = NULL;2 C6 A2 m: Z. `! K4 w( F& _3 o

  77. & f7 a" q( }8 H6 b5 H6 ]' x
  78. static int acnt = 512;. j7 x+ R3 M. @, R9 O
  79. static int bcnt = 8;
    % m! x$ H2 n0 ?" F7 {
  80. static int ccnt = 8;
    & P3 e7 S4 @! U) r8 W
  81. 4 o  ?6 g# ]/ h4 b3 ]9 P; t1 T
  82. module_param(acnt, int, S_IRUGO);, V! |: R) l  m( [8 f. T  M
  83. module_param(bcnt, int, S_IRUGO);
    $ J' W( J% n1 w& S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ O; m2 r. a  @% y8 w: M- I
* v6 d$ {; Y: d2 x; i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: O: T; Q. Z( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q% K+ y: I4 f" I5 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. a* k) k, n' M' i4 u
0 j4 I1 I" N' i

  W" h) D3 ]! J+ Y0 o- b$ q+ F8 y- O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 10:13 , Processed in 0.039891 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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