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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - j1 {8 k- h6 J
  1. [code]EDMA sample test application
    - v5 a# |; H* |' x* h
  2. /*
    + [8 ~8 F/ Q- h5 v
  3. * edma_test.c
    , s- n& P0 b$ O5 k3 c
  4. *
    1 Y$ ?+ U, ~6 f8 ~
  5. * brief  EDMA3 Test Application/ o2 F" A2 `4 [) Y+ C4 V1 ?9 W
  6. *
    2 C' l0 a0 J" }; `
  7. *   This file contains EDMA3 Test code.7 m0 h$ h- {& J. X/ X7 Q7 q' f
  8. *3 p7 {4 f% F* V0 w7 o, R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " G. b/ U9 F6 c; i$ A. X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 G5 v) @' _6 O4 n  a: t, z' p7 p
  11. *         TO CHANGE.! g" x; ~" c5 M0 C1 I4 X5 z3 e/ Q
  12. *5 V9 r' m8 K8 \6 @* H7 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 A7 ~6 g5 `  b/ n
  14. *
    . ~3 l( z. ?- O! p7 W  s. {
  15. * This program is free software; you can redistribute it and/or
    6 Z' G% @" y/ r/ K
  16. * modify it under the terms of the GNU General Public License as; \6 a0 n9 j. Q3 t
  17. * published by the Free Software Foundation version 2.
    3 Y7 i% }6 P! k! w
  18. *
    ; m1 ?3 N4 X/ H, }% V3 r6 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 v1 P+ H6 t! X  [
  20. * kind, whether express or implied; without even the implied warranty' r8 e+ S$ Y$ P" k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 r7 G' I; x* w; E) k+ b8 \9 {2 Z) n
  22. * GNU General Public License for more details.5 X& Q5 j0 M0 I& C+ x
  23. */5 w% c6 B9 Q2 a1 B
  24.   K) ~% v* c  V" i
  25. #include <linux/module.h>
    4 x( b% ]9 a# z# @
  26. #include <linux/init.h>
    / R& i* H% h9 o
  27. #include <linux/errno.h>" X3 c. S5 g, G9 c2 {
  28. #include <linux/types.h>
    0 c5 d  X" ?  ]0 [: N/ M0 R$ n2 q
  29. #include <linux/interrupt.h>
    - R, r8 h. r4 c+ L
  30. #include <asm/io.h>! A9 d! v( b6 [" I8 h4 C! M
  31. #include <linux/moduleparam.h>
    4 G' n2 p6 L; g
  32. #include <linux/sysctl.h>
    3 L, l* j% Q* t! t. n
  33. #include <linux/mm.h>1 V$ o/ W$ D2 s, N+ {
  34. #include <linux/dma-mapping.h>
    & W4 z5 |( y  @. O' [

  35. 3 _7 v# o6 ]: {( n
  36. #include <mach/memory.h>
    ; N( d' s1 T6 u; M' Y
  37. #include <mach/hardware.h>
    2 y8 [2 D1 K& T* G: l
  38. #include <mach/irqs.h>1 @5 w& L9 ?! l; A8 L9 m
  39. #include <asm/hardware/edma.h>: o3 [1 l3 m4 m

  40. 8 L' ?! x+ A' M! L- n
  41. #undef EDMA3_DEBUG- \' P6 N, y, I0 ^& J
  42. /*#define EDMA3_DEBUG*/. b5 u( v& l/ `$ _! k
  43. + @. B- W# D8 |1 Z2 m: X
  44. #ifdef EDMA3_DEBUG
    $ r2 A6 H, P2 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- o6 ~; T4 S% K' ^3 J, ~! z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ _0 R( v0 \* h$ J9 ^$ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ k: Z7 W0 ^$ t/ Q/ v2 A
  48. #else0 o3 z+ g( T8 p# u0 r
  49. #define DMA_PRINTK( x... )- X8 P' U9 F* f) J" _3 {+ f% a6 u0 }
  50. #define DMA_FN_IN
    & G7 x  p" v9 r! B: I6 J; c$ N, |
  51. #define DMA_FN_OUT/ E9 [1 ~2 P) h/ D3 d
  52. #endif
    $ U* e6 M; |! i) V
  53. ' u9 s  m- a) r# x2 o# ^4 R0 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / b# C2 _1 D  O) L
  55. #define STATIC_SHIFT                30 v  C3 u! O; a! ^$ W
  56. #define TCINTEN_SHIFT               20
    # t: @* Z3 o  ?0 S
  57. #define ITCINTEN_SHIFT              21) G% B& ~6 i9 j: W# J
  58. #define TCCHEN_SHIFT                22
    , d. ~$ w: N( W+ X! j
  59. #define ITCCHEN_SHIFT               23
    & X7 j2 D7 g' B( A9 ?8 K! E
  60. ' J9 j5 d; j' D* p/ }! I
  61. static volatile int irqraised1 = 0;
    7 r" L8 d7 @! d3 Z3 Z" p
  62. static volatile int irqraised2 = 0;' [) ^1 `  c( @4 \6 P  z! M) M

  63. ' u+ Z: z& X5 O0 X1 s. U4 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! s! S$ ^0 S) `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M/ |5 ~1 r6 {) B6 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 F5 d1 K3 k1 d) D3 z

  67. 8 x6 j; C* v2 j& x5 `4 {, e+ @" c
  68. dma_addr_t dmaphyssrc1 = 0;
    , I  s+ O9 W/ |1 j% g% z. c& D
  69. dma_addr_t dmaphyssrc2 = 0;2 I& S/ N8 |" u0 ~+ y
  70. dma_addr_t dmaphysdest1 = 0;3 a' g/ ]+ n! Q# e
  71. dma_addr_t dmaphysdest2 = 0;! `! \+ d  e1 w8 B5 O
  72. 9 ]0 A! o: ^8 I. a, T
  73. char *dmabufsrc1 = NULL;' i$ Q8 _( l' |, N0 y. t. g, h0 P
  74. char *dmabufsrc2 = NULL;0 L0 R6 g% P& W4 V0 W* j- F) a
  75. char *dmabufdest1 = NULL;
    8 v) M& J% s9 v2 _9 N% G6 O
  76. char *dmabufdest2 = NULL;
    + z0 n6 Q, {" C6 Z. M3 B% H
  77. 7 t- ?) S, i' U9 H9 z; V3 j) U
  78. static int acnt = 512;
    " H! l- Y' l( ]1 c
  79. static int bcnt = 8;8 m' B: x7 a% M( j" `4 D8 ]& Z
  80. static int ccnt = 8;0 Y9 O0 ^# x( Z  }! T) J. J! @: q

  81. - ]& t: ^; O2 o' y( e
  82. module_param(acnt, int, S_IRUGO);
    - ~4 E; o, B% s: D1 c
  83. module_param(bcnt, int, S_IRUGO);
    4 ^% r( L7 r% Y9 a8 C( Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% t3 N; q  q# X6 o7 w: E1 v0 q4 C- Y2 Y1 f- j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y. P9 n+ r" F9 r0 X/ g" K% p1 {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 Q4 W( B( c5 s7 Z) F9 Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ R7 h4 ?& b7 N6 r( E0 L" `
3 a/ {4 \4 a8 T5 [' c4 e, B( \
7 n# W  d. F6 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 21:11 , Processed in 0.040212 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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