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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m- J: ]3 U8 C
  1. [code]EDMA sample test application
    % N) |/ {: b, T% f0 p9 b
  2. /*
    ! `- I3 `/ H  T% Z
  3. * edma_test.c
    ; p, o& l) N. M+ a3 K
  4. *
    7 v( J& r4 M! T2 \6 r9 `6 M
  5. * brief  EDMA3 Test Application8 E9 r. ~6 Q5 X2 }& S! ^/ A' @
  6. *' r& N8 u+ w* K0 G6 L
  7. *   This file contains EDMA3 Test code.7 \; S+ h8 _+ z. V8 c
  8. *9 ~; Q% E" |4 x. i. L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' l, z5 l% [1 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + W+ [: z: K, V4 n
  11. *         TO CHANGE.
    * C. g: @* X, Z- l
  12. *9 j4 g: {( I7 z$ ^. D& b2 `1 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* s0 t! ?" K5 O' p9 {
  14. *
    9 o2 q$ U  s4 @! g3 n  ]5 `# C
  15. * This program is free software; you can redistribute it and/or5 D  R! a5 S4 R3 b
  16. * modify it under the terms of the GNU General Public License as
    ( U/ N$ L7 j, ?, s
  17. * published by the Free Software Foundation version 2.4 E  j5 `0 u% i8 w5 j
  18. *
      a: x" ^4 ]  O5 @9 v& ?) i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 I& u; F& T3 W# j
  20. * kind, whether express or implied; without even the implied warranty
    7 j0 s0 ~1 ^3 a7 j2 `8 }" Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + u7 s& k! W. G5 h
  22. * GNU General Public License for more details.
    * B+ X* T  r! s- v8 E9 P6 x
  23. */9 q) s$ G  C% j) }
  24. ; ~- m7 ?; {7 G7 X+ m
  25. #include <linux/module.h>0 r0 c$ G1 v0 a. a3 S
  26. #include <linux/init.h>* }* ~5 i. u( g7 ?  J6 w
  27. #include <linux/errno.h>
    / P: \6 R5 l& [
  28. #include <linux/types.h>
    ; K- S7 J3 M4 D0 J- P: g. \
  29. #include <linux/interrupt.h>
    0 I* K' s# a9 k0 ^( Z6 @2 H: a
  30. #include <asm/io.h>
    % @6 |6 _  m7 R0 a; I* P
  31. #include <linux/moduleparam.h>
    3 g; e. d, D) d
  32. #include <linux/sysctl.h>
    5 M9 g2 [5 s  F! b
  33. #include <linux/mm.h>, S' Y! Y1 Y2 j0 I% x1 M$ P  T$ O
  34. #include <linux/dma-mapping.h>
    , O- f  g1 y( n

  35. ( Y5 p/ l& ~* {4 B/ _
  36. #include <mach/memory.h>
    5 x/ L, V5 k, \
  37. #include <mach/hardware.h>; B, C  Z9 j- E; c2 E# o+ A
  38. #include <mach/irqs.h>
    ) B, n' R2 |0 ]+ [0 \% _. O2 X
  39. #include <asm/hardware/edma.h>% i( B/ @$ J- F* |2 H' {/ Z+ h! B

  40. ' ]: u& ?/ k5 x7 k3 N0 k
  41. #undef EDMA3_DEBUG
    1 l% P# o, ~8 C% a+ |
  42. /*#define EDMA3_DEBUG*/2 b1 ?% i. X. a/ |0 R

  43. + X! a- L; Y. v& ~
  44. #ifdef EDMA3_DEBUG
    4 Y7 }& }* s' G1 t, g6 X& |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / Z5 r4 u5 Y7 F9 H( U* Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 o* r: ^0 Q- `1 Q# s$ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Q4 d: n- r" K$ y  d4 M
  48. #else4 v6 [! v" q: `; s# ]
  49. #define DMA_PRINTK( x... ): l7 Z$ g) e& U$ x
  50. #define DMA_FN_IN2 O. i  c1 v! u/ N$ E
  51. #define DMA_FN_OUT
    ( O* v- w, ]0 ?7 `3 H3 c# }6 X
  52. #endif, f% x$ I% s: l2 S
  53. / R8 h2 _+ N: ^( q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' `9 K! T; `: n" L) z$ _
  55. #define STATIC_SHIFT                30 X) A/ ^) P9 k4 r+ M2 `, B
  56. #define TCINTEN_SHIFT               20/ p9 p$ X7 G! i: b
  57. #define ITCINTEN_SHIFT              21
    * a! l. L, ^4 I, x
  58. #define TCCHEN_SHIFT                22
    7 w2 Z& u5 U0 j! j) G
  59. #define ITCCHEN_SHIFT               23' |: y; C3 |4 k- |% Y2 \1 a
  60. + Q: N8 ?5 u- Z, N& q
  61. static volatile int irqraised1 = 0;
      U2 u. y) B. v  F5 G+ v
  62. static volatile int irqraised2 = 0;
    ; S8 C! O$ H1 r* r8 o  c

  63. ; ^! D8 r0 X' E; G+ c: H, o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P8 ?( k. R5 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 f5 s0 n* j' S) G6 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 m# z/ X' x% h* ?

  67. / C" S+ |9 i# `2 g* R  ^
  68. dma_addr_t dmaphyssrc1 = 0;1 \0 Q! f' q2 [+ D1 x: M
  69. dma_addr_t dmaphyssrc2 = 0;
    & K+ Y$ X* ]) J( @4 u0 [
  70. dma_addr_t dmaphysdest1 = 0;
    : T/ s7 r. }8 T1 |- u) B
  71. dma_addr_t dmaphysdest2 = 0;/ Q0 N% W- \' k+ y- g. F/ v$ i# T0 }
  72. : t$ Y& @( f. n: L/ v8 z
  73. char *dmabufsrc1 = NULL;
    " V" K4 e4 |+ A" H9 H" w6 {/ K
  74. char *dmabufsrc2 = NULL;
    5 I8 X- z+ f$ s: v/ }% u/ w2 d! [
  75. char *dmabufdest1 = NULL;
    : {$ M& L1 i0 p  Q9 F$ j9 A5 O
  76. char *dmabufdest2 = NULL;
    5 U* a6 B5 I- B; [! G7 g6 ]

  77. " Y! a% M# Y- o1 q1 G# T" B" m+ A
  78. static int acnt = 512;" J2 n$ F' s, k) L
  79. static int bcnt = 8;& v* _! a0 ~2 V- [( _  z
  80. static int ccnt = 8;$ a' p; v. ?3 J, ~+ {5 b8 o
  81. 6 a$ a$ \. S+ P: {+ c+ r
  82. module_param(acnt, int, S_IRUGO);: ~1 {. b. A3 z2 I$ a$ b
  83. module_param(bcnt, int, S_IRUGO);- S4 X) c$ M2 I9 m4 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ v3 P2 j# w0 }0 ?! p# o6 j  ?; b" v6 Y3 C+ @. C( f" P  {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' }7 H3 p% X$ l5 D3 f1 F: C/ X. narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% W, x: x7 F0 r, I* K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' J9 G% M7 u9 `, x( ?# ^
9 c9 P4 ]& H3 Z+ r" w, a, ?. U- Q2 A5 Y$ Z% ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 04:04 , Processed in 0.045257 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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